@orion-studios/payload-studio 0.5.0-beta.7 → 0.5.0-beta.70
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/README.md +20 -0
- package/dist/admin/client.d.mts +2 -0
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +779 -137
- package/dist/admin/client.mjs +769 -129
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +100 -8
- package/dist/admin/index.mjs +3 -1
- package/dist/admin-app/client.d.mts +7 -0
- package/dist/admin-app/client.d.ts +7 -0
- package/dist/admin-app/client.js +1262 -3
- package/dist/admin-app/client.mjs +1164 -2
- package/dist/admin-app/index.d.mts +1 -1
- package/dist/admin-app/index.d.ts +1 -1
- package/dist/admin-app/index.js +167 -0
- package/dist/admin-app/index.mjs +13 -1
- package/dist/admin-app/styles.css +229 -0
- package/dist/blocks/index.js +633 -8
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-CKX5Y2HU.mjs} +44 -13
- package/dist/{chunk-J7W5EE3B.mjs → chunk-HCEPGEAI.mjs} +100 -8
- package/dist/chunk-HXGAG6I7.mjs +325 -0
- package/dist/chunk-ROTPP5CU.mjs +99 -0
- package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
- package/dist/chunk-VDGSMD6H.mjs +1072 -0
- package/dist/{chunk-PC5622T7.mjs → chunk-XK3K5GRP.mjs} +620 -9
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/{index-CmR6NInu.d.ts → index-BIwu3qIH.d.mts} +29 -3
- package/dist/{index-CmR6NInu.d.mts → index-BIwu3qIH.d.ts} +29 -3
- package/dist/index-CdnUNrvX.d.mts +134 -0
- package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.mts} +1 -0
- package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.ts} +1 -0
- package/dist/index-DyHbWliW.d.ts +134 -0
- package/dist/index-ZbOx4OCF.d.mts +128 -0
- package/dist/index-ZbOx4OCF.d.ts +128 -0
- package/dist/{index-DJFhANvJ.d.mts → index-cDYkEj29.d.mts} +20 -2
- package/dist/{index-DJFhANvJ.d.ts → index-cDYkEj29.d.ts} +20 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2145 -305
- package/dist/index.mjs +9 -9
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +996 -13
- package/dist/nextjs/index.mjs +4 -1
- package/dist/studio/index.d.mts +2 -1
- package/dist/studio/index.d.ts +2 -1
- package/dist/studio/index.js +171 -2
- package/dist/studio/index.mjs +7 -3
- package/dist/studio-pages/builder.css +358 -8
- package/dist/studio-pages/client.d.mts +17 -0
- package/dist/studio-pages/client.d.ts +17 -0
- package/dist/studio-pages/client.js +5657 -1478
- package/dist/studio-pages/client.mjs +5549 -1461
- package/dist/studio-pages/index.d.mts +3 -2
- package/dist/studio-pages/index.d.ts +3 -2
- package/dist/studio-pages/index.js +799 -29
- package/dist/studio-pages/index.mjs +6 -2
- package/package.json +26 -12
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/chunk-N67KVM2S.mjs +0 -156
- package/dist/chunk-UJFU323N.mjs +0 -301
- package/dist/index-B9N5MyjF.d.mts +0 -39
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
- package/dist/index-g8tBHLKD.d.ts +0 -39
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
43
43
|
var admin_exports = {};
|
|
44
44
|
__export(admin_exports, {
|
|
45
45
|
configureAdmin: () => configureAdmin,
|
|
46
|
+
createHeaderNavItemsField: () => createHeaderNavItemsField,
|
|
46
47
|
createThemePreferenceField: () => createThemePreferenceField,
|
|
47
48
|
themePreferenceField: () => themePreferenceField,
|
|
48
49
|
withTooltips: () => withTooltips
|
|
@@ -98,14 +99,25 @@ function configureAdmin(config) {
|
|
|
98
99
|
defaultTheme = "brand-light",
|
|
99
100
|
logoUrl
|
|
100
101
|
} = config;
|
|
101
|
-
const studioEnabled =
|
|
102
|
+
const studioEnabled = config.studio?.enabled ?? true;
|
|
102
103
|
const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
|
|
103
104
|
const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
|
|
104
|
-
const
|
|
105
|
+
const contactFormStudioPath = "/studio-contact-form";
|
|
106
|
+
const configuredGlobals = config.studio?.globals || [
|
|
105
107
|
{ slug: "site-settings", label: "Website Settings" },
|
|
106
108
|
{ slug: "header", label: "Header & Navigation" },
|
|
107
|
-
{ slug: "footer", label: "Footer" }
|
|
109
|
+
{ slug: "footer", label: "Footer" },
|
|
110
|
+
{ slug: "contact-form", label: "Contact Form" }
|
|
108
111
|
];
|
|
112
|
+
const globals = configuredGlobals.map((global) => {
|
|
113
|
+
if (global.slug !== "contact-form" || global.href) {
|
|
114
|
+
return global;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
...global,
|
|
118
|
+
href: contactFormStudioPath
|
|
119
|
+
};
|
|
120
|
+
});
|
|
109
121
|
let cssPath;
|
|
110
122
|
const pkgDist = getPkgDistDir();
|
|
111
123
|
const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
|
|
@@ -135,7 +147,8 @@ function configureAdmin(config) {
|
|
|
135
147
|
clientProps: {
|
|
136
148
|
brandName,
|
|
137
149
|
logoUrl,
|
|
138
|
-
globalsBasePath: "/
|
|
150
|
+
globalsBasePath: "/studio-globals",
|
|
151
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
139
152
|
mediaCollectionSlug,
|
|
140
153
|
pagesCollectionSlug
|
|
141
154
|
}
|
|
@@ -167,7 +180,8 @@ function configureAdmin(config) {
|
|
|
167
180
|
clientProps: {
|
|
168
181
|
brandName,
|
|
169
182
|
logoUrl,
|
|
170
|
-
globalsBasePath: "/
|
|
183
|
+
globalsBasePath: "/studio-globals",
|
|
184
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
171
185
|
mediaCollectionSlug,
|
|
172
186
|
pagesCollectionSlug
|
|
173
187
|
}
|
|
@@ -181,7 +195,18 @@ function configureAdmin(config) {
|
|
|
181
195
|
path: clientPath,
|
|
182
196
|
clientProps: {
|
|
183
197
|
globals,
|
|
184
|
-
globalsBasePath: "/
|
|
198
|
+
globalsBasePath: "/studio-globals"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
studioContactForm: {
|
|
203
|
+
path: "/studio-contact-form",
|
|
204
|
+
Component: {
|
|
205
|
+
exportName: "AdminStudioContactFormView",
|
|
206
|
+
path: clientPath,
|
|
207
|
+
clientProps: {
|
|
208
|
+
globalSlug: "contact-form",
|
|
209
|
+
globalsBasePath: "/studio-globals"
|
|
185
210
|
}
|
|
186
211
|
}
|
|
187
212
|
}
|
|
@@ -228,16 +253,47 @@ function configureAdmin(config) {
|
|
|
228
253
|
const labelMap = {
|
|
229
254
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
230
255
|
footer: { group: "Site Design", label: "Footer" },
|
|
231
|
-
"site-settings": { group: "Site Design", label: "Website Settings" }
|
|
256
|
+
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
257
|
+
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
232
258
|
};
|
|
233
259
|
return globals2.map((global) => {
|
|
234
260
|
const mapping = labelMap[global.slug];
|
|
235
261
|
if (!mapping) return global;
|
|
262
|
+
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
263
|
+
const existingViews = global.admin?.components?.views;
|
|
264
|
+
const existingEditViews = existingViews?.edit;
|
|
265
|
+
const hasCustomContactFormEditView = Boolean(
|
|
266
|
+
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
267
|
+
);
|
|
268
|
+
const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
|
|
269
|
+
...existingEditViews,
|
|
270
|
+
default: {
|
|
271
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
272
|
+
Component: {
|
|
273
|
+
exportName: "StudioContactFormRedirect",
|
|
274
|
+
path: clientPath,
|
|
275
|
+
clientProps: {
|
|
276
|
+
studioContactFormPath: contactFormStudioPath
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
} : existingEditViews;
|
|
236
281
|
return {
|
|
237
282
|
...global,
|
|
238
283
|
admin: {
|
|
239
284
|
...global.admin,
|
|
240
|
-
group: mapping.group
|
|
285
|
+
group: mapping.group,
|
|
286
|
+
components: {
|
|
287
|
+
...global.admin?.components,
|
|
288
|
+
...shouldAttachContactFormRedirect ? {
|
|
289
|
+
views: {
|
|
290
|
+
...existingViews,
|
|
291
|
+
...contactFormEditViews ? {
|
|
292
|
+
edit: contactFormEditViews
|
|
293
|
+
} : {}
|
|
294
|
+
}
|
|
295
|
+
} : {}
|
|
296
|
+
}
|
|
241
297
|
},
|
|
242
298
|
label: mapping.label
|
|
243
299
|
};
|
|
@@ -306,12 +362,53 @@ function addTooltipToField(field, tooltips) {
|
|
|
306
362
|
return field;
|
|
307
363
|
}
|
|
308
364
|
|
|
365
|
+
// src/admin/fields/headerNav.ts
|
|
366
|
+
var createHeaderNavItemsField = () => ({
|
|
367
|
+
name: "navItems",
|
|
368
|
+
type: "array",
|
|
369
|
+
labels: { singular: "Navigation Link", plural: "Navigation Links" },
|
|
370
|
+
admin: {
|
|
371
|
+
description: "The links displayed in your website's main navigation menu."
|
|
372
|
+
},
|
|
373
|
+
fields: [
|
|
374
|
+
{
|
|
375
|
+
name: "label",
|
|
376
|
+
type: "text",
|
|
377
|
+
required: true,
|
|
378
|
+
admin: {
|
|
379
|
+
description: "The text shown for this navigation link."
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "href",
|
|
384
|
+
type: "text",
|
|
385
|
+
required: true,
|
|
386
|
+
admin: {
|
|
387
|
+
description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "parentHref",
|
|
392
|
+
type: "text",
|
|
393
|
+
admin: {
|
|
394
|
+
description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
});
|
|
399
|
+
|
|
309
400
|
// src/admin-app/index.ts
|
|
310
401
|
var admin_app_exports = {};
|
|
311
402
|
__export(admin_app_exports, {
|
|
312
403
|
AdminBreadcrumbs: () => AdminBreadcrumbs,
|
|
313
404
|
AdminPage: () => AdminPage,
|
|
405
|
+
buildAdminPageLinkOptions: () => buildAdminPageLinkOptions,
|
|
406
|
+
buildNestedNavTree: () => buildNestedNavTree,
|
|
407
|
+
getAdminNavRows: () => getAdminNavRows,
|
|
314
408
|
navItemIsActive: () => navItemIsActive,
|
|
409
|
+
normalizeAdminNavInputs: () => normalizeAdminNavInputs,
|
|
410
|
+
normalizeNestedNavItems: () => normalizeNestedNavItems,
|
|
411
|
+
parseAdminHeaderNavFromForm: () => parseAdminHeaderNavFromForm,
|
|
315
412
|
roleCanAccessNav: () => roleCanAccessNav
|
|
316
413
|
});
|
|
317
414
|
|
|
@@ -345,6 +442,161 @@ function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
|
345
442
|
] });
|
|
346
443
|
}
|
|
347
444
|
|
|
445
|
+
// src/admin-app/nestedNavigation.ts
|
|
446
|
+
var normalizeNestedNavItems = (items) => {
|
|
447
|
+
const deduped = [];
|
|
448
|
+
const seen = /* @__PURE__ */ new Set();
|
|
449
|
+
for (const item of items) {
|
|
450
|
+
const href = typeof item.href === "string" ? item.href.trim() : "";
|
|
451
|
+
const label = typeof item.label === "string" ? item.label.trim() : "";
|
|
452
|
+
const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
|
|
453
|
+
if (!href || !label || seen.has(href)) {
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
seen.add(href);
|
|
457
|
+
deduped.push({
|
|
458
|
+
href,
|
|
459
|
+
label,
|
|
460
|
+
...parentHref ? { parentHref } : {}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
464
|
+
return deduped.map((item) => ({
|
|
465
|
+
href: item.href,
|
|
466
|
+
label: item.label,
|
|
467
|
+
...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
|
|
468
|
+
}));
|
|
469
|
+
};
|
|
470
|
+
var buildNestedNavTree = (items) => {
|
|
471
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
472
|
+
const topLevel = [];
|
|
473
|
+
for (const item of items) {
|
|
474
|
+
if (!item.parentHref) {
|
|
475
|
+
topLevel.push(item);
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const children = childrenByParent.get(item.parentHref) || [];
|
|
479
|
+
children.push(item);
|
|
480
|
+
childrenByParent.set(item.parentHref, children);
|
|
481
|
+
}
|
|
482
|
+
if (topLevel.length === 0 && items.length > 0) {
|
|
483
|
+
return {
|
|
484
|
+
topLevel: items.map((item) => ({ href: item.href, label: item.label })),
|
|
485
|
+
childrenByParent: /* @__PURE__ */ new Map()
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
return { childrenByParent, topLevel };
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
// src/admin-app/navigationLinks.ts
|
|
492
|
+
var fallbackHomeOption = {
|
|
493
|
+
href: "/",
|
|
494
|
+
label: "Home",
|
|
495
|
+
title: "Home"
|
|
496
|
+
};
|
|
497
|
+
var buildAdminPageLinkOptions = (pages) => {
|
|
498
|
+
const options = pages.map((page) => {
|
|
499
|
+
const href = typeof page.path === "string" ? page.path.trim() : "";
|
|
500
|
+
const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
|
|
501
|
+
if (!href) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
|
|
505
|
+
const indentLevel = Math.max(depth - 1, 0);
|
|
506
|
+
const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
|
|
507
|
+
return {
|
|
508
|
+
href,
|
|
509
|
+
label: `${indent}${title}`,
|
|
510
|
+
title
|
|
511
|
+
};
|
|
512
|
+
}).filter((option) => option !== null).sort((a, b) => {
|
|
513
|
+
if (a.href === "/" && b.href !== "/") return -1;
|
|
514
|
+
if (b.href === "/" && a.href !== "/") return 1;
|
|
515
|
+
return a.href.localeCompare(b.href);
|
|
516
|
+
});
|
|
517
|
+
if (options.length === 0) {
|
|
518
|
+
return [fallbackHomeOption];
|
|
519
|
+
}
|
|
520
|
+
return options;
|
|
521
|
+
};
|
|
522
|
+
var getAdminNavRows = (navItems, pageOptions, minRows = 6, maxRows = 20) => {
|
|
523
|
+
const preferredRows = Math.max(navItems.length + 2, Math.min(8, pageOptions.length));
|
|
524
|
+
return Math.min(Math.max(minRows, preferredRows), maxRows);
|
|
525
|
+
};
|
|
526
|
+
var normalizeAdminNavInputs = (rows, pageOptions) => {
|
|
527
|
+
const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
|
|
528
|
+
const deduped = [];
|
|
529
|
+
const seen = /* @__PURE__ */ new Set();
|
|
530
|
+
for (const row of rows) {
|
|
531
|
+
const href = typeof row.href === "string" ? row.href.trim() : "";
|
|
532
|
+
const defaultLabel = allowedLinks.get(href);
|
|
533
|
+
const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
|
|
534
|
+
const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
|
|
535
|
+
if (!href || !defaultLabel || seen.has(href)) {
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
seen.add(href);
|
|
539
|
+
deduped.push({
|
|
540
|
+
href,
|
|
541
|
+
label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
|
|
542
|
+
...parentHref.length > 0 ? { parentHref } : {}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
546
|
+
const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
|
|
547
|
+
const createsCycle = (href, parentHref) => {
|
|
548
|
+
const visited = /* @__PURE__ */ new Set([href]);
|
|
549
|
+
let current = parentHref;
|
|
550
|
+
while (current) {
|
|
551
|
+
if (visited.has(current)) {
|
|
552
|
+
return true;
|
|
553
|
+
}
|
|
554
|
+
visited.add(current);
|
|
555
|
+
current = parentByHref.get(current) || "";
|
|
556
|
+
}
|
|
557
|
+
return false;
|
|
558
|
+
};
|
|
559
|
+
return deduped.map((item) => {
|
|
560
|
+
const parentHref = item.parentHref;
|
|
561
|
+
if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
|
|
562
|
+
return {
|
|
563
|
+
href: item.href,
|
|
564
|
+
label: item.label
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
return item;
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
|
|
571
|
+
const serialized = String(formData.get("navItemsState") || "").trim();
|
|
572
|
+
if (serialized.length > 0) {
|
|
573
|
+
try {
|
|
574
|
+
const parsed = JSON.parse(serialized);
|
|
575
|
+
if (Array.isArray(parsed)) {
|
|
576
|
+
return normalizeAdminNavInputs(parsed.slice(0, maxRows), pageOptions);
|
|
577
|
+
}
|
|
578
|
+
} catch {
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const rawCount = Number(String(formData.get("navCount") || "0"));
|
|
582
|
+
const navCount = Number.isFinite(rawCount) ? Math.max(0, Math.min(rawCount, maxRows)) : 0;
|
|
583
|
+
const navRows = [];
|
|
584
|
+
for (let index = 0; index < navCount; index += 1) {
|
|
585
|
+
const href = String(formData.get(`navPage_${index}`) || "").trim();
|
|
586
|
+
const label = String(formData.get(`navLabel_${index}`) || "").trim();
|
|
587
|
+
const parentHref = String(formData.get(`navParentHref_${index}`) || "").trim();
|
|
588
|
+
navRows.push({
|
|
589
|
+
href,
|
|
590
|
+
label,
|
|
591
|
+
parentHref
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
if (navRows.length > 0) {
|
|
595
|
+
return normalizeAdminNavInputs(navRows, pageOptions);
|
|
596
|
+
}
|
|
597
|
+
return [];
|
|
598
|
+
};
|
|
599
|
+
|
|
348
600
|
// src/admin-app/routeRegistry.ts
|
|
349
601
|
var roleCanAccessNav = (role, item) => {
|
|
350
602
|
if (!item.roles || item.roles.length === 0) {
|
|
@@ -400,6 +652,7 @@ var sectionStyleDefaults = {
|
|
|
400
652
|
contentGradientPreset: "none",
|
|
401
653
|
contentGradientTo: "#f4f6f2",
|
|
402
654
|
contentWidth: "inherit",
|
|
655
|
+
sectionPaddingX: "inherit",
|
|
403
656
|
sectionBackgroundColor: "#ffffff",
|
|
404
657
|
sectionBackgroundMode: "none",
|
|
405
658
|
sectionGradientAngle: "135",
|
|
@@ -437,6 +690,19 @@ var sectionStyleFields = () => [
|
|
|
437
690
|
type: "select",
|
|
438
691
|
defaultValue: sectionStyleDefaults.sectionPaddingY,
|
|
439
692
|
options: [
|
|
693
|
+
{ label: "None", value: "none" },
|
|
694
|
+
{ label: "Small", value: "sm" },
|
|
695
|
+
{ label: "Medium", value: "md" },
|
|
696
|
+
{ label: "Large", value: "lg" }
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
name: "sectionPaddingX",
|
|
701
|
+
type: "select",
|
|
702
|
+
defaultValue: sectionStyleDefaults.sectionPaddingX,
|
|
703
|
+
options: [
|
|
704
|
+
{ label: "Inherit", value: "inherit" },
|
|
705
|
+
{ label: "None", value: "none" },
|
|
440
706
|
{ label: "Small", value: "sm" },
|
|
441
707
|
{ label: "Medium", value: "md" },
|
|
442
708
|
{ label: "Large", value: "lg" }
|
|
@@ -552,11 +818,22 @@ var BeforeAfterBlock = {
|
|
|
552
818
|
name: "subtitle",
|
|
553
819
|
type: "textarea"
|
|
554
820
|
},
|
|
821
|
+
{
|
|
822
|
+
name: "itemsPerRow",
|
|
823
|
+
type: "number",
|
|
824
|
+
defaultValue: 2,
|
|
825
|
+
min: 1,
|
|
826
|
+
max: 4,
|
|
827
|
+
admin: {
|
|
828
|
+
description: "How many project cards to show per row on desktop.",
|
|
829
|
+
step: 1
|
|
830
|
+
}
|
|
831
|
+
},
|
|
555
832
|
{
|
|
556
833
|
name: "items",
|
|
557
834
|
type: "array",
|
|
558
835
|
minRows: 1,
|
|
559
|
-
maxRows:
|
|
836
|
+
maxRows: 30,
|
|
560
837
|
fields: [
|
|
561
838
|
{
|
|
562
839
|
name: "label",
|
|
@@ -575,12 +852,88 @@ var BeforeAfterBlock = {
|
|
|
575
852
|
relationTo: "media",
|
|
576
853
|
required: false
|
|
577
854
|
},
|
|
855
|
+
{
|
|
856
|
+
name: "imageHeight",
|
|
857
|
+
type: "number",
|
|
858
|
+
defaultValue: 160,
|
|
859
|
+
min: 60,
|
|
860
|
+
max: 600,
|
|
861
|
+
admin: {
|
|
862
|
+
description: "Overrides the before/after image height (in pixels).",
|
|
863
|
+
step: 10
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: "imageFit",
|
|
868
|
+
type: "select",
|
|
869
|
+
defaultValue: "cover",
|
|
870
|
+
options: [
|
|
871
|
+
{ label: "Cover", value: "cover" },
|
|
872
|
+
{ label: "Contain", value: "contain" }
|
|
873
|
+
]
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
name: "imageCornerStyle",
|
|
877
|
+
type: "select",
|
|
878
|
+
defaultValue: "rounded",
|
|
879
|
+
options: [
|
|
880
|
+
{ label: "Rounded", value: "rounded" },
|
|
881
|
+
{ label: "Square", value: "square" }
|
|
882
|
+
]
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
name: "imagePosition",
|
|
886
|
+
type: "select",
|
|
887
|
+
defaultValue: "center",
|
|
888
|
+
options: [
|
|
889
|
+
{ label: "Center", value: "center" },
|
|
890
|
+
{ label: "Top", value: "top" },
|
|
891
|
+
{ label: "Bottom", value: "bottom" },
|
|
892
|
+
{ label: "Left", value: "left" },
|
|
893
|
+
{ label: "Right", value: "right" }
|
|
894
|
+
]
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: "imagePositionX",
|
|
898
|
+
type: "number",
|
|
899
|
+
min: 0,
|
|
900
|
+
max: 100,
|
|
901
|
+
admin: {
|
|
902
|
+
description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
|
|
903
|
+
step: 1
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
name: "imagePositionY",
|
|
908
|
+
type: "number",
|
|
909
|
+
min: 0,
|
|
910
|
+
max: 100,
|
|
911
|
+
admin: {
|
|
912
|
+
description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
|
|
913
|
+
step: 1
|
|
914
|
+
}
|
|
915
|
+
},
|
|
578
916
|
{
|
|
579
917
|
name: "description",
|
|
580
918
|
type: "textarea"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: "settings",
|
|
922
|
+
type: "json",
|
|
923
|
+
admin: {
|
|
924
|
+
hidden: true
|
|
925
|
+
}
|
|
581
926
|
}
|
|
582
927
|
]
|
|
583
928
|
},
|
|
929
|
+
{
|
|
930
|
+
name: "settings",
|
|
931
|
+
type: "json",
|
|
932
|
+
admin: {
|
|
933
|
+
description: "Internal builder settings schema v2.",
|
|
934
|
+
hidden: true
|
|
935
|
+
}
|
|
936
|
+
},
|
|
584
937
|
...sectionStyleFields()
|
|
585
938
|
]
|
|
586
939
|
};
|
|
@@ -618,6 +971,14 @@ var BookingEmbedBlock = {
|
|
|
618
971
|
type: "text",
|
|
619
972
|
defaultValue: "/contact"
|
|
620
973
|
},
|
|
974
|
+
{
|
|
975
|
+
name: "settings",
|
|
976
|
+
type: "json",
|
|
977
|
+
admin: {
|
|
978
|
+
description: "Internal builder settings schema v2.",
|
|
979
|
+
hidden: true
|
|
980
|
+
}
|
|
981
|
+
},
|
|
621
982
|
...sectionStyleFields()
|
|
622
983
|
]
|
|
623
984
|
};
|
|
@@ -679,6 +1040,14 @@ var CtaBlock = {
|
|
|
679
1040
|
description: "Optional background color override for the CTA strip (example: #124a37)."
|
|
680
1041
|
}
|
|
681
1042
|
},
|
|
1043
|
+
{
|
|
1044
|
+
name: "settings",
|
|
1045
|
+
type: "json",
|
|
1046
|
+
admin: {
|
|
1047
|
+
description: "Internal builder settings schema v2.",
|
|
1048
|
+
hidden: true
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
682
1051
|
...sectionStyleFields()
|
|
683
1052
|
]
|
|
684
1053
|
};
|
|
@@ -718,9 +1087,24 @@ var FaqBlock = {
|
|
|
718
1087
|
name: "answer",
|
|
719
1088
|
type: "textarea",
|
|
720
1089
|
required: true
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
name: "settings",
|
|
1093
|
+
type: "json",
|
|
1094
|
+
admin: {
|
|
1095
|
+
hidden: true
|
|
1096
|
+
}
|
|
721
1097
|
}
|
|
722
1098
|
]
|
|
723
1099
|
},
|
|
1100
|
+
{
|
|
1101
|
+
name: "settings",
|
|
1102
|
+
type: "json",
|
|
1103
|
+
admin: {
|
|
1104
|
+
description: "Internal builder settings schema v2.",
|
|
1105
|
+
hidden: true
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
724
1108
|
...sectionStyleFields()
|
|
725
1109
|
]
|
|
726
1110
|
};
|
|
@@ -745,6 +1129,17 @@ var FeatureGridBlock = {
|
|
|
745
1129
|
type: "text",
|
|
746
1130
|
required: true
|
|
747
1131
|
},
|
|
1132
|
+
{
|
|
1133
|
+
name: "itemsPerRow",
|
|
1134
|
+
type: "number",
|
|
1135
|
+
defaultValue: 3,
|
|
1136
|
+
min: 1,
|
|
1137
|
+
max: 6,
|
|
1138
|
+
admin: {
|
|
1139
|
+
description: "How many items to show per row on desktop.",
|
|
1140
|
+
step: 1
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
748
1143
|
{
|
|
749
1144
|
name: "items",
|
|
750
1145
|
type: "array",
|
|
@@ -760,11 +1155,43 @@ var FeatureGridBlock = {
|
|
|
760
1155
|
name: "description",
|
|
761
1156
|
type: "textarea"
|
|
762
1157
|
},
|
|
1158
|
+
{
|
|
1159
|
+
name: "iconType",
|
|
1160
|
+
type: "select",
|
|
1161
|
+
defaultValue: "badge",
|
|
1162
|
+
options: [
|
|
1163
|
+
{ label: "Badge Text", value: "badge" },
|
|
1164
|
+
{ label: "Icon", value: "lucide" }
|
|
1165
|
+
],
|
|
1166
|
+
admin: {
|
|
1167
|
+
description: "Choose whether this item uses a short badge label or an icon."
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
763
1170
|
{
|
|
764
1171
|
name: "icon",
|
|
765
1172
|
type: "text",
|
|
766
1173
|
admin: {
|
|
767
|
-
description: 'Optional short icon label (e.g. "01", "Leaf", "Star").'
|
|
1174
|
+
description: 'Optional short icon label (e.g. "01", "Leaf", "Star").',
|
|
1175
|
+
condition: (_, siblingData) => siblingData?.iconType !== "lucide"
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
name: "iconLucide",
|
|
1180
|
+
type: "select",
|
|
1181
|
+
options: [
|
|
1182
|
+
{ label: "Shield Check", value: "ShieldCheck" },
|
|
1183
|
+
{ label: "Clock", value: "Clock" },
|
|
1184
|
+
{ label: "Leaf", value: "Leaf" },
|
|
1185
|
+
{ label: "Dollar Sign", value: "DollarSign" },
|
|
1186
|
+
{ label: "Hard Hat", value: "HardHat" },
|
|
1187
|
+
{ label: "Sparkles", value: "Sparkles" },
|
|
1188
|
+
{ label: "Tree Pine", value: "TreePine" },
|
|
1189
|
+
{ label: "Badge Check", value: "BadgeCheck" },
|
|
1190
|
+
{ label: "Calendar Clock", value: "CalendarClock" }
|
|
1191
|
+
],
|
|
1192
|
+
admin: {
|
|
1193
|
+
description: "Select an icon for this item.",
|
|
1194
|
+
condition: (_, siblingData) => siblingData?.iconType === "lucide"
|
|
768
1195
|
}
|
|
769
1196
|
},
|
|
770
1197
|
{
|
|
@@ -772,6 +1199,74 @@ var FeatureGridBlock = {
|
|
|
772
1199
|
type: "upload",
|
|
773
1200
|
relationTo: "media",
|
|
774
1201
|
required: false
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
name: "imageHeight",
|
|
1205
|
+
type: "number",
|
|
1206
|
+
defaultValue: 160,
|
|
1207
|
+
min: 40,
|
|
1208
|
+
max: 600,
|
|
1209
|
+
admin: {
|
|
1210
|
+
description: "Overrides the image height in the builder/section (in pixels).",
|
|
1211
|
+
step: 10
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
name: "imageFit",
|
|
1216
|
+
type: "select",
|
|
1217
|
+
defaultValue: "cover",
|
|
1218
|
+
options: [
|
|
1219
|
+
{ label: "Cover", value: "cover" },
|
|
1220
|
+
{ label: "Contain", value: "contain" }
|
|
1221
|
+
]
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
name: "imageCornerStyle",
|
|
1225
|
+
type: "select",
|
|
1226
|
+
defaultValue: "rounded",
|
|
1227
|
+
options: [
|
|
1228
|
+
{ label: "Rounded", value: "rounded" },
|
|
1229
|
+
{ label: "Square", value: "square" }
|
|
1230
|
+
]
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: "imagePosition",
|
|
1234
|
+
type: "select",
|
|
1235
|
+
defaultValue: "center",
|
|
1236
|
+
options: [
|
|
1237
|
+
{ label: "Center", value: "center" },
|
|
1238
|
+
{ label: "Top", value: "top" },
|
|
1239
|
+
{ label: "Bottom", value: "bottom" },
|
|
1240
|
+
{ label: "Left", value: "left" },
|
|
1241
|
+
{ label: "Right", value: "right" }
|
|
1242
|
+
]
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
name: "imagePositionX",
|
|
1246
|
+
type: "number",
|
|
1247
|
+
min: 0,
|
|
1248
|
+
max: 100,
|
|
1249
|
+
admin: {
|
|
1250
|
+
description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
|
|
1251
|
+
step: 1
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
name: "imagePositionY",
|
|
1256
|
+
type: "number",
|
|
1257
|
+
min: 0,
|
|
1258
|
+
max: 100,
|
|
1259
|
+
admin: {
|
|
1260
|
+
description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
|
|
1261
|
+
step: 1
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
name: "settings",
|
|
1266
|
+
type: "json",
|
|
1267
|
+
admin: {
|
|
1268
|
+
hidden: true
|
|
1269
|
+
}
|
|
775
1270
|
}
|
|
776
1271
|
]
|
|
777
1272
|
},
|
|
@@ -797,6 +1292,14 @@ var FeatureGridBlock = {
|
|
|
797
1292
|
description: "Optional background color override when using the Highlight variant (example: #1f684f)."
|
|
798
1293
|
}
|
|
799
1294
|
},
|
|
1295
|
+
{
|
|
1296
|
+
name: "settings",
|
|
1297
|
+
type: "json",
|
|
1298
|
+
admin: {
|
|
1299
|
+
description: "Internal builder settings schema v2.",
|
|
1300
|
+
hidden: true
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
800
1303
|
...sectionStyleFields()
|
|
801
1304
|
]
|
|
802
1305
|
};
|
|
@@ -835,6 +1338,14 @@ var FormEmbedBlock = {
|
|
|
835
1338
|
}
|
|
836
1339
|
]
|
|
837
1340
|
},
|
|
1341
|
+
{
|
|
1342
|
+
name: "settings",
|
|
1343
|
+
type: "json",
|
|
1344
|
+
admin: {
|
|
1345
|
+
description: "Internal builder settings schema v2.",
|
|
1346
|
+
hidden: true
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
838
1349
|
...sectionStyleFields()
|
|
839
1350
|
]
|
|
840
1351
|
};
|
|
@@ -898,10 +1409,44 @@ var HeroBlock = {
|
|
|
898
1409
|
relationTo: "media"
|
|
899
1410
|
},
|
|
900
1411
|
{
|
|
901
|
-
name: "
|
|
902
|
-
type: "
|
|
1412
|
+
name: "backgroundImageFit",
|
|
1413
|
+
type: "select",
|
|
1414
|
+
defaultValue: "cover",
|
|
1415
|
+
options: [
|
|
1416
|
+
{ label: "Cover", value: "cover" },
|
|
1417
|
+
{ label: "Cover (Square)", value: "cover-square" },
|
|
1418
|
+
{ label: "Contain", value: "contain" },
|
|
1419
|
+
{ label: "Contain (Square)", value: "contain-square" }
|
|
1420
|
+
],
|
|
1421
|
+
admin: {
|
|
1422
|
+
description: "How the hero image should be sized within the section."
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
name: "backgroundImageCornerStyle",
|
|
1427
|
+
type: "select",
|
|
1428
|
+
defaultValue: "rounded",
|
|
1429
|
+
options: [
|
|
1430
|
+
{ label: "Rounded", value: "rounded" },
|
|
1431
|
+
{ label: "Square", value: "square" }
|
|
1432
|
+
],
|
|
903
1433
|
admin: {
|
|
904
|
-
description: "
|
|
1434
|
+
description: "How the hero image corners should appear."
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
name: "backgroundImagePosition",
|
|
1439
|
+
type: "select",
|
|
1440
|
+
defaultValue: "center",
|
|
1441
|
+
options: [
|
|
1442
|
+
{ label: "Center", value: "center" },
|
|
1443
|
+
{ label: "Top", value: "top" },
|
|
1444
|
+
{ label: "Bottom", value: "bottom" },
|
|
1445
|
+
{ label: "Left", value: "left" },
|
|
1446
|
+
{ label: "Right", value: "right" }
|
|
1447
|
+
],
|
|
1448
|
+
admin: {
|
|
1449
|
+
description: "Where the hero image should anchor inside the section."
|
|
905
1450
|
}
|
|
906
1451
|
},
|
|
907
1452
|
{
|
|
@@ -911,6 +1456,113 @@ var HeroBlock = {
|
|
|
911
1456
|
description: "Optional background color override (example: #124a37)."
|
|
912
1457
|
}
|
|
913
1458
|
},
|
|
1459
|
+
{
|
|
1460
|
+
name: "backgroundOverlayMode",
|
|
1461
|
+
type: "select",
|
|
1462
|
+
defaultValue: "none",
|
|
1463
|
+
options: [
|
|
1464
|
+
{ label: "None", value: "none" },
|
|
1465
|
+
{ label: "Solid", value: "solid" },
|
|
1466
|
+
{ label: "Gradient", value: "gradient" }
|
|
1467
|
+
],
|
|
1468
|
+
admin: {
|
|
1469
|
+
description: "Optional overlay on top of the hero image (applies when an image is present)."
|
|
1470
|
+
}
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
name: "backgroundOverlayOpacity",
|
|
1474
|
+
type: "number",
|
|
1475
|
+
defaultValue: 45,
|
|
1476
|
+
min: 0,
|
|
1477
|
+
max: 100,
|
|
1478
|
+
admin: {
|
|
1479
|
+
description: "Overlay opacity (0-100).",
|
|
1480
|
+
step: 1
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
name: "backgroundOverlayColor",
|
|
1485
|
+
type: "text",
|
|
1486
|
+
admin: {
|
|
1487
|
+
description: "Overlay solid color (example: #000000). Used when Overlay Mode is Solid."
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
name: "backgroundOverlayGradientFrom",
|
|
1492
|
+
type: "text",
|
|
1493
|
+
admin: {
|
|
1494
|
+
description: "Gradient overlay start color (example: #0d4a37). Used when Overlay Mode is Gradient."
|
|
1495
|
+
}
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
name: "backgroundOverlayGradientTo",
|
|
1499
|
+
type: "text",
|
|
1500
|
+
admin: {
|
|
1501
|
+
description: "Gradient overlay end color (example: #1f684f). Used when Overlay Mode is Gradient."
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
name: "backgroundOverlayGradientAngle",
|
|
1506
|
+
type: "text",
|
|
1507
|
+
admin: {
|
|
1508
|
+
description: "Gradient overlay angle in degrees (0-360). Used when Overlay Mode is Gradient."
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
name: "backgroundOverlayGradientFromStrength",
|
|
1513
|
+
type: "number",
|
|
1514
|
+
defaultValue: 100,
|
|
1515
|
+
min: 0,
|
|
1516
|
+
max: 100,
|
|
1517
|
+
admin: {
|
|
1518
|
+
description: "Gradient start strength (0-100). Set to 0 for transparent.",
|
|
1519
|
+
step: 1
|
|
1520
|
+
}
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
name: "backgroundOverlayGradientToStrength",
|
|
1524
|
+
type: "number",
|
|
1525
|
+
defaultValue: 100,
|
|
1526
|
+
min: 0,
|
|
1527
|
+
max: 100,
|
|
1528
|
+
admin: {
|
|
1529
|
+
description: "Gradient end strength (0-100). Set to 0 for transparent.",
|
|
1530
|
+
step: 1
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
name: "backgroundOverlayGradientStart",
|
|
1535
|
+
type: "number",
|
|
1536
|
+
defaultValue: 0,
|
|
1537
|
+
min: 0,
|
|
1538
|
+
max: 100,
|
|
1539
|
+
admin: {
|
|
1540
|
+
description: "Where the gradient starts (0-100).",
|
|
1541
|
+
step: 1
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
name: "backgroundOverlayGradientEnd",
|
|
1546
|
+
type: "number",
|
|
1547
|
+
defaultValue: 100,
|
|
1548
|
+
min: 0,
|
|
1549
|
+
max: 100,
|
|
1550
|
+
admin: {
|
|
1551
|
+
description: "Where the gradient ends (0-100).",
|
|
1552
|
+
step: 1
|
|
1553
|
+
}
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
name: "backgroundOverlayGradientFeather",
|
|
1557
|
+
type: "number",
|
|
1558
|
+
defaultValue: 100,
|
|
1559
|
+
min: 0,
|
|
1560
|
+
max: 100,
|
|
1561
|
+
admin: {
|
|
1562
|
+
description: "How soft the transition is (0 = hard edge, 100 = smooth).",
|
|
1563
|
+
step: 1
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
914
1566
|
{
|
|
915
1567
|
name: "variant",
|
|
916
1568
|
type: "select",
|
|
@@ -926,14 +1578,44 @@ var HeroBlock = {
|
|
|
926
1578
|
}
|
|
927
1579
|
]
|
|
928
1580
|
},
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1581
|
+
{
|
|
1582
|
+
name: "heroHeight",
|
|
1583
|
+
type: "select",
|
|
1584
|
+
defaultValue: "sm",
|
|
1585
|
+
options: [
|
|
1586
|
+
{
|
|
1587
|
+
label: "Small",
|
|
1588
|
+
value: "sm"
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
label: "Medium (Half Screen)",
|
|
1592
|
+
value: "md"
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
label: "Full Screen",
|
|
1596
|
+
value: "full"
|
|
1597
|
+
}
|
|
1598
|
+
],
|
|
1599
|
+
admin: {
|
|
1600
|
+
description: "Controls the vertical height of the hero section."
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
name: "settings",
|
|
1605
|
+
type: "json",
|
|
1606
|
+
admin: {
|
|
1607
|
+
description: "Internal builder settings schema v2.",
|
|
1608
|
+
hidden: true
|
|
1609
|
+
}
|
|
1610
|
+
},
|
|
1611
|
+
...sectionStyleFields()
|
|
1612
|
+
]
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
// src/blocks/blocks/LogoWall.ts
|
|
1616
|
+
var LogoWallBlock = {
|
|
1617
|
+
slug: "logoWall",
|
|
1618
|
+
imageURL: "/images/logo-mark.svg",
|
|
937
1619
|
imageAltText: "Logo wall section preview",
|
|
938
1620
|
admin: {
|
|
939
1621
|
components: {
|
|
@@ -971,12 +1653,88 @@ var LogoWallBlock = {
|
|
|
971
1653
|
relationTo: "media",
|
|
972
1654
|
required: false
|
|
973
1655
|
},
|
|
1656
|
+
{
|
|
1657
|
+
name: "imageHeight",
|
|
1658
|
+
type: "number",
|
|
1659
|
+
defaultValue: 64,
|
|
1660
|
+
min: 24,
|
|
1661
|
+
max: 200,
|
|
1662
|
+
admin: {
|
|
1663
|
+
description: "Overrides the logo image height (in pixels).",
|
|
1664
|
+
step: 4
|
|
1665
|
+
}
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
name: "imageFit",
|
|
1669
|
+
type: "select",
|
|
1670
|
+
defaultValue: "contain",
|
|
1671
|
+
options: [
|
|
1672
|
+
{ label: "Cover", value: "cover" },
|
|
1673
|
+
{ label: "Contain", value: "contain" }
|
|
1674
|
+
]
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: "imageCornerStyle",
|
|
1678
|
+
type: "select",
|
|
1679
|
+
defaultValue: "rounded",
|
|
1680
|
+
options: [
|
|
1681
|
+
{ label: "Rounded", value: "rounded" },
|
|
1682
|
+
{ label: "Square", value: "square" }
|
|
1683
|
+
]
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
name: "imagePosition",
|
|
1687
|
+
type: "select",
|
|
1688
|
+
defaultValue: "center",
|
|
1689
|
+
options: [
|
|
1690
|
+
{ label: "Center", value: "center" },
|
|
1691
|
+
{ label: "Top", value: "top" },
|
|
1692
|
+
{ label: "Bottom", value: "bottom" },
|
|
1693
|
+
{ label: "Left", value: "left" },
|
|
1694
|
+
{ label: "Right", value: "right" }
|
|
1695
|
+
]
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
name: "imagePositionX",
|
|
1699
|
+
type: "number",
|
|
1700
|
+
min: 0,
|
|
1701
|
+
max: 100,
|
|
1702
|
+
admin: {
|
|
1703
|
+
description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
|
|
1704
|
+
step: 1
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
name: "imagePositionY",
|
|
1709
|
+
type: "number",
|
|
1710
|
+
min: 0,
|
|
1711
|
+
max: 100,
|
|
1712
|
+
admin: {
|
|
1713
|
+
description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
|
|
1714
|
+
step: 1
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
974
1717
|
{
|
|
975
1718
|
name: "href",
|
|
976
1719
|
type: "text"
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
name: "settings",
|
|
1723
|
+
type: "json",
|
|
1724
|
+
admin: {
|
|
1725
|
+
hidden: true
|
|
1726
|
+
}
|
|
977
1727
|
}
|
|
978
1728
|
]
|
|
979
1729
|
},
|
|
1730
|
+
{
|
|
1731
|
+
name: "settings",
|
|
1732
|
+
type: "json",
|
|
1733
|
+
admin: {
|
|
1734
|
+
description: "Internal builder settings schema v2.",
|
|
1735
|
+
hidden: true
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
980
1738
|
...sectionStyleFields()
|
|
981
1739
|
]
|
|
982
1740
|
};
|
|
@@ -1021,6 +1779,44 @@ var MediaBlock = {
|
|
|
1021
1779
|
}
|
|
1022
1780
|
]
|
|
1023
1781
|
},
|
|
1782
|
+
{
|
|
1783
|
+
name: "imageFit",
|
|
1784
|
+
type: "select",
|
|
1785
|
+
defaultValue: "cover",
|
|
1786
|
+
options: [
|
|
1787
|
+
{ label: "Cover", value: "cover" },
|
|
1788
|
+
{ label: "Contain", value: "contain" }
|
|
1789
|
+
]
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
name: "imageCornerStyle",
|
|
1793
|
+
type: "select",
|
|
1794
|
+
defaultValue: "rounded",
|
|
1795
|
+
options: [
|
|
1796
|
+
{ label: "Rounded", value: "rounded" },
|
|
1797
|
+
{ label: "Square", value: "square" }
|
|
1798
|
+
]
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
name: "imagePosition",
|
|
1802
|
+
type: "select",
|
|
1803
|
+
defaultValue: "center",
|
|
1804
|
+
options: [
|
|
1805
|
+
{ label: "Center", value: "center" },
|
|
1806
|
+
{ label: "Top", value: "top" },
|
|
1807
|
+
{ label: "Bottom", value: "bottom" },
|
|
1808
|
+
{ label: "Left", value: "left" },
|
|
1809
|
+
{ label: "Right", value: "right" }
|
|
1810
|
+
]
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
name: "settings",
|
|
1814
|
+
type: "json",
|
|
1815
|
+
admin: {
|
|
1816
|
+
description: "Internal builder settings schema v2.",
|
|
1817
|
+
hidden: true
|
|
1818
|
+
}
|
|
1819
|
+
},
|
|
1024
1820
|
...sectionStyleFields()
|
|
1025
1821
|
]
|
|
1026
1822
|
};
|
|
@@ -1064,6 +1860,14 @@ var RichTextBlock = {
|
|
|
1064
1860
|
}
|
|
1065
1861
|
]
|
|
1066
1862
|
},
|
|
1863
|
+
{
|
|
1864
|
+
name: "settings",
|
|
1865
|
+
type: "json",
|
|
1866
|
+
admin: {
|
|
1867
|
+
description: "Internal builder settings schema v2.",
|
|
1868
|
+
hidden: true
|
|
1869
|
+
}
|
|
1870
|
+
},
|
|
1067
1871
|
...sectionStyleFields()
|
|
1068
1872
|
]
|
|
1069
1873
|
};
|
|
@@ -1111,9 +1915,24 @@ var StatsBlock = {
|
|
|
1111
1915
|
{
|
|
1112
1916
|
name: "description",
|
|
1113
1917
|
type: "text"
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
name: "settings",
|
|
1921
|
+
type: "json",
|
|
1922
|
+
admin: {
|
|
1923
|
+
hidden: true
|
|
1924
|
+
}
|
|
1114
1925
|
}
|
|
1115
1926
|
]
|
|
1116
1927
|
},
|
|
1928
|
+
{
|
|
1929
|
+
name: "settings",
|
|
1930
|
+
type: "json",
|
|
1931
|
+
admin: {
|
|
1932
|
+
description: "Internal builder settings schema v2.",
|
|
1933
|
+
hidden: true
|
|
1934
|
+
}
|
|
1935
|
+
},
|
|
1117
1936
|
...sectionStyleFields()
|
|
1118
1937
|
]
|
|
1119
1938
|
};
|
|
@@ -1138,11 +1957,41 @@ var TestimonialsBlock = {
|
|
|
1138
1957
|
type: "text",
|
|
1139
1958
|
required: true
|
|
1140
1959
|
},
|
|
1960
|
+
{
|
|
1961
|
+
name: "visibleCount",
|
|
1962
|
+
type: "number",
|
|
1963
|
+
defaultValue: 3,
|
|
1964
|
+
min: 1,
|
|
1965
|
+
max: 6,
|
|
1966
|
+
admin: {
|
|
1967
|
+
description: "How many testimonials to show at once.",
|
|
1968
|
+
step: 1
|
|
1969
|
+
}
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
name: "autoRotate",
|
|
1973
|
+
type: "checkbox",
|
|
1974
|
+
defaultValue: true,
|
|
1975
|
+
admin: {
|
|
1976
|
+
description: "Automatically rotates through all testimonials."
|
|
1977
|
+
}
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
name: "rotateIntervalSeconds",
|
|
1981
|
+
type: "number",
|
|
1982
|
+
defaultValue: 7,
|
|
1983
|
+
min: 2,
|
|
1984
|
+
max: 30,
|
|
1985
|
+
admin: {
|
|
1986
|
+
description: "How often to rotate (in seconds).",
|
|
1987
|
+
step: 1
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1141
1990
|
{
|
|
1142
1991
|
name: "items",
|
|
1143
1992
|
type: "array",
|
|
1144
1993
|
minRows: 1,
|
|
1145
|
-
maxRows:
|
|
1994
|
+
maxRows: 30,
|
|
1146
1995
|
fields: [
|
|
1147
1996
|
{
|
|
1148
1997
|
name: "quote",
|
|
@@ -1157,9 +2006,35 @@ var TestimonialsBlock = {
|
|
|
1157
2006
|
{
|
|
1158
2007
|
name: "location",
|
|
1159
2008
|
type: "text"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
name: "rating",
|
|
2012
|
+
type: "number",
|
|
2013
|
+
defaultValue: 5,
|
|
2014
|
+
min: 1,
|
|
2015
|
+
max: 5,
|
|
2016
|
+
admin: {
|
|
2017
|
+
description: "Star rating (1-5).",
|
|
2018
|
+
step: 1
|
|
2019
|
+
}
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
name: "settings",
|
|
2023
|
+
type: "json",
|
|
2024
|
+
admin: {
|
|
2025
|
+
hidden: true
|
|
2026
|
+
}
|
|
1160
2027
|
}
|
|
1161
2028
|
]
|
|
1162
2029
|
},
|
|
2030
|
+
{
|
|
2031
|
+
name: "settings",
|
|
2032
|
+
type: "json",
|
|
2033
|
+
admin: {
|
|
2034
|
+
description: "Internal builder settings schema v2.",
|
|
2035
|
+
hidden: true
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
1163
2038
|
...sectionStyleFields()
|
|
1164
2039
|
]
|
|
1165
2040
|
};
|
|
@@ -1283,12 +2158,14 @@ var sectionPresets = [
|
|
|
1283
2158
|
{
|
|
1284
2159
|
quote: "Great communication, fair pricing, and the cleanup was perfect. We will use them again.",
|
|
1285
2160
|
name: "Katie M.",
|
|
1286
|
-
location: "Austin, TX"
|
|
2161
|
+
location: "Austin, TX",
|
|
2162
|
+
rating: 5
|
|
1287
2163
|
},
|
|
1288
2164
|
{
|
|
1289
2165
|
quote: "They removed a dangerous limb over our driveway quickly and safely.",
|
|
1290
2166
|
name: "James R.",
|
|
1291
|
-
location: "Round Rock, TX"
|
|
2167
|
+
location: "Round Rock, TX",
|
|
2168
|
+
rating: 5
|
|
1292
2169
|
}
|
|
1293
2170
|
]
|
|
1294
2171
|
},
|
|
@@ -1510,257 +2387,233 @@ function createPayloadClient(config) {
|
|
|
1510
2387
|
|
|
1511
2388
|
// src/nextjs/queries/pages.ts
|
|
1512
2389
|
var import_cache = require("next/cache");
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
2390
|
+
|
|
2391
|
+
// src/studio/index.ts
|
|
2392
|
+
var studio_exports = {};
|
|
2393
|
+
__export(studio_exports, {
|
|
2394
|
+
assertStudioDocumentV1: () => assertStudioDocumentV1,
|
|
2395
|
+
compileStudioDocument: () => compileStudioDocument,
|
|
2396
|
+
createEmptyStudioDocument: () => createEmptyStudioDocument,
|
|
2397
|
+
createImageUploadOptimizationHook: () => createImageUploadOptimizationHook,
|
|
2398
|
+
createStudioRegistry: () => createStudioRegistry,
|
|
2399
|
+
migrateStudioDocument: () => migrateStudioDocument,
|
|
2400
|
+
validateStudioDocument: () => validateStudioDocument,
|
|
2401
|
+
withImageUploadOptimization: () => withImageUploadOptimization
|
|
2402
|
+
});
|
|
2403
|
+
|
|
2404
|
+
// src/studio/imageUploadOptimization.ts
|
|
2405
|
+
var import_promises = require("fs/promises");
|
|
2406
|
+
var DEFAULT_SUPPORTED_MIME_TYPES = [
|
|
2407
|
+
"image/jpeg",
|
|
2408
|
+
"image/jpg",
|
|
2409
|
+
"image/png",
|
|
2410
|
+
"image/webp",
|
|
2411
|
+
"image/avif",
|
|
2412
|
+
"image/tiff"
|
|
2413
|
+
];
|
|
2414
|
+
var DEFAULT_OPTIONS = {
|
|
2415
|
+
avifQuality: 50,
|
|
2416
|
+
enforceSmallerForLossy: true,
|
|
2417
|
+
jpegQuality: 78,
|
|
2418
|
+
minBytes: 48 * 1024,
|
|
2419
|
+
minQualityFloor: 42,
|
|
2420
|
+
onlyIfSmaller: true,
|
|
2421
|
+
pngCompressionLevel: 9,
|
|
2422
|
+
skipAnimated: true,
|
|
2423
|
+
tiffQuality: 75,
|
|
2424
|
+
webpQuality: 78
|
|
2425
|
+
};
|
|
2426
|
+
var clamp = (value, min, max) => Math.max(min, Math.min(max, Math.round(value)));
|
|
2427
|
+
var isUploadMutationOperation = (operation) => operation === "create" || operation === "update" || operation === "updateByID";
|
|
2428
|
+
var isLossyMimeType = (mimetype) => mimetype === "image/jpeg" || mimetype === "image/jpg" || mimetype === "image/webp" || mimetype === "image/avif" || mimetype === "image/tiff";
|
|
2429
|
+
var readIncomingBuffer = async (file) => {
|
|
2430
|
+
if (file.tempFilePath) {
|
|
2431
|
+
return (0, import_promises.readFile)(file.tempFilePath);
|
|
1516
2432
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
2433
|
+
return file.data;
|
|
2434
|
+
};
|
|
2435
|
+
var writeOptimizedBuffer = async (file, buffer) => {
|
|
2436
|
+
if (file.tempFilePath) {
|
|
2437
|
+
await (0, import_promises.unlink)(file.tempFilePath).catch(() => void 0);
|
|
2438
|
+
}
|
|
2439
|
+
return {
|
|
2440
|
+
...file,
|
|
2441
|
+
data: buffer,
|
|
2442
|
+
size: buffer.length,
|
|
2443
|
+
tempFilePath: void 0
|
|
2444
|
+
};
|
|
2445
|
+
};
|
|
2446
|
+
var createImageUploadOptimizationHook = (options = {}) => {
|
|
2447
|
+
const supportedMimeTypes = new Set(options.supportedMimeTypes || DEFAULT_SUPPORTED_MIME_TYPES);
|
|
2448
|
+
const settings = { ...DEFAULT_OPTIONS, ...options };
|
|
2449
|
+
return async ({ operation, req }) => {
|
|
2450
|
+
if (!isUploadMutationOperation(operation)) {
|
|
2451
|
+
return;
|
|
2452
|
+
}
|
|
2453
|
+
const file = req.file;
|
|
2454
|
+
if (!file) {
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
if (!supportedMimeTypes.has(file.mimetype)) {
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
if (typeof file.size === "number" && file.size < settings.minBytes) {
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2463
|
+
const sharpFactory = req.payload?.config?.sharp;
|
|
2464
|
+
if (typeof sharpFactory !== "function") {
|
|
2465
|
+
return;
|
|
2466
|
+
}
|
|
2467
|
+
const originalBuffer = await readIncomingBuffer(file);
|
|
2468
|
+
if (!Buffer.isBuffer(originalBuffer) || originalBuffer.length === 0) {
|
|
2469
|
+
return;
|
|
2470
|
+
}
|
|
2471
|
+
const animatedInput = file.mimetype === "image/avif" || file.mimetype === "image/webp";
|
|
2472
|
+
const metadataProbe = await sharpFactory(
|
|
2473
|
+
originalBuffer,
|
|
2474
|
+
animatedInput ? {
|
|
2475
|
+
animated: true
|
|
2476
|
+
} : void 0
|
|
2477
|
+
).metadata();
|
|
2478
|
+
if (settings.skipAnimated && typeof metadataProbe.pages === "number" && metadataProbe.pages > 1) {
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2481
|
+
const buildPipeline = (qualityOverride) => {
|
|
2482
|
+
let pipeline = sharpFactory(
|
|
2483
|
+
originalBuffer,
|
|
2484
|
+
animatedInput ? {
|
|
2485
|
+
animated: true
|
|
2486
|
+
} : void 0
|
|
2487
|
+
);
|
|
2488
|
+
switch (file.mimetype) {
|
|
2489
|
+
case "image/jpeg":
|
|
2490
|
+
case "image/jpg":
|
|
2491
|
+
pipeline = pipeline.jpeg({
|
|
2492
|
+
mozjpeg: true,
|
|
2493
|
+
progressive: true,
|
|
2494
|
+
quality: clamp(qualityOverride ?? settings.jpegQuality, 20, 100)
|
|
2495
|
+
});
|
|
2496
|
+
break;
|
|
2497
|
+
case "image/png":
|
|
2498
|
+
pipeline = pipeline.png({
|
|
2499
|
+
compressionLevel: clamp(settings.pngCompressionLevel, 0, 9),
|
|
2500
|
+
palette: false
|
|
2501
|
+
});
|
|
2502
|
+
break;
|
|
2503
|
+
case "image/webp":
|
|
2504
|
+
pipeline = pipeline.webp({
|
|
2505
|
+
quality: clamp(qualityOverride ?? settings.webpQuality, 20, 100)
|
|
2506
|
+
});
|
|
2507
|
+
break;
|
|
2508
|
+
case "image/avif":
|
|
2509
|
+
pipeline = pipeline.avif({
|
|
2510
|
+
quality: clamp(qualityOverride ?? settings.avifQuality, 20, 100)
|
|
2511
|
+
});
|
|
2512
|
+
break;
|
|
2513
|
+
case "image/tiff":
|
|
2514
|
+
pipeline = pipeline.tiff({
|
|
2515
|
+
quality: clamp(qualityOverride ?? settings.tiffQuality, 20, 100)
|
|
2516
|
+
});
|
|
2517
|
+
break;
|
|
2518
|
+
default:
|
|
2519
|
+
return null;
|
|
1530
2520
|
}
|
|
2521
|
+
return pipeline;
|
|
2522
|
+
};
|
|
2523
|
+
const initialPipeline = buildPipeline();
|
|
2524
|
+
if (!initialPipeline) {
|
|
2525
|
+
return;
|
|
1531
2526
|
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
2527
|
+
let optimizedBuffer = await initialPipeline.toBuffer();
|
|
2528
|
+
const shouldSweepQuality = settings.enforceSmallerForLossy && isLossyMimeType(file.mimetype);
|
|
2529
|
+
if (shouldSweepQuality) {
|
|
2530
|
+
const initialQuality = file.mimetype === "image/jpeg" || file.mimetype === "image/jpg" ? settings.jpegQuality : file.mimetype === "image/webp" ? settings.webpQuality : file.mimetype === "image/avif" ? settings.avifQuality : settings.tiffQuality;
|
|
2531
|
+
let bestBuffer = optimizedBuffer;
|
|
2532
|
+
let quality = clamp(initialQuality - 5, settings.minQualityFloor, 100);
|
|
2533
|
+
while (quality >= settings.minQualityFloor) {
|
|
2534
|
+
const retryPipeline = buildPipeline(quality);
|
|
2535
|
+
if (!retryPipeline) {
|
|
2536
|
+
break;
|
|
2537
|
+
}
|
|
2538
|
+
const retryBuffer = await retryPipeline.toBuffer();
|
|
2539
|
+
if (retryBuffer.length < bestBuffer.length) {
|
|
2540
|
+
bestBuffer = retryBuffer;
|
|
1546
2541
|
}
|
|
2542
|
+
quality -= 5;
|
|
1547
2543
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
2544
|
+
optimizedBuffer = bestBuffer;
|
|
2545
|
+
}
|
|
2546
|
+
if (settings.onlyIfSmaller && optimizedBuffer.length >= originalBuffer.length) {
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
req.file = await writeOptimizedBuffer(file, optimizedBuffer);
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2552
|
+
var withImageUploadOptimization = (collection, options = {}) => {
|
|
2553
|
+
if (!collection.upload) {
|
|
2554
|
+
return collection;
|
|
1550
2555
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
},
|
|
1559
|
-
["page-by-path"],
|
|
1560
|
-
{ tags: [contentTag] }
|
|
1561
|
-
);
|
|
1562
|
-
async function getPageBySegments(segments, draft = false) {
|
|
1563
|
-
const path2 = normalizePath(segments);
|
|
1564
|
-
const payload = await getPayloadClient();
|
|
1565
|
-
if (draft) {
|
|
1566
|
-
return queryPageByPath(payload, path2, true);
|
|
2556
|
+
const existingHooks = collection.hooks || {};
|
|
2557
|
+
const beforeOperation = existingHooks.beforeOperation || [];
|
|
2558
|
+
return {
|
|
2559
|
+
...collection,
|
|
2560
|
+
hooks: {
|
|
2561
|
+
...existingHooks,
|
|
2562
|
+
beforeOperation: [createImageUploadOptimizationHook(options), ...beforeOperation]
|
|
1567
2563
|
}
|
|
1568
|
-
|
|
2564
|
+
};
|
|
2565
|
+
};
|
|
2566
|
+
|
|
2567
|
+
// src/studio/index.ts
|
|
2568
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2569
|
+
var makeIssue = (message, path2, code = "studio.invalid") => ({
|
|
2570
|
+
code,
|
|
2571
|
+
message,
|
|
2572
|
+
path: path2,
|
|
2573
|
+
severity: "error"
|
|
2574
|
+
});
|
|
2575
|
+
var createEmptyStudioDocument = (title) => ({
|
|
2576
|
+
metadata: {},
|
|
2577
|
+
schemaVersion: 1,
|
|
2578
|
+
title,
|
|
2579
|
+
nodes: [],
|
|
2580
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2581
|
+
});
|
|
2582
|
+
function assertStudioDocumentV1(input) {
|
|
2583
|
+
if (!isRecord(input)) {
|
|
2584
|
+
throw new Error("Studio document must be an object");
|
|
1569
2585
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
const pages = await payload.find({
|
|
1573
|
-
collection: "pages",
|
|
1574
|
-
depth: 0,
|
|
1575
|
-
draft: false,
|
|
1576
|
-
limit: 1e3,
|
|
1577
|
-
pagination: false,
|
|
1578
|
-
overrideAccess: false,
|
|
1579
|
-
where: {
|
|
1580
|
-
_status: {
|
|
1581
|
-
equals: "published"
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
});
|
|
1585
|
-
return pages.docs.map((doc) => doc.path).filter((path2) => typeof path2 === "string" && path2.length > 0);
|
|
2586
|
+
if (input.schemaVersion !== 1) {
|
|
2587
|
+
throw new Error("Unsupported studio schemaVersion");
|
|
1586
2588
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
return [];
|
|
1590
|
-
}
|
|
1591
|
-
return path2.split("/").filter(Boolean);
|
|
2589
|
+
if (!Array.isArray(input.nodes)) {
|
|
2590
|
+
throw new Error("Studio document nodes must be an array");
|
|
1592
2591
|
}
|
|
2592
|
+
const nodes = input.nodes.map((node, index) => {
|
|
2593
|
+
if (!isRecord(node)) {
|
|
2594
|
+
throw new Error(`Node at index ${index} must be an object`);
|
|
2595
|
+
}
|
|
2596
|
+
if (typeof node.id !== "string" || node.id.length === 0) {
|
|
2597
|
+
throw new Error(`Node at index ${index} has invalid id`);
|
|
2598
|
+
}
|
|
2599
|
+
if (typeof node.type !== "string" || node.type.length === 0) {
|
|
2600
|
+
throw new Error(`Node at index ${index} has invalid type`);
|
|
2601
|
+
}
|
|
2602
|
+
if (!isRecord(node.data)) {
|
|
2603
|
+
throw new Error(`Node at index ${index} has invalid data`);
|
|
2604
|
+
}
|
|
2605
|
+
return {
|
|
2606
|
+
id: node.id,
|
|
2607
|
+
type: node.type,
|
|
2608
|
+
data: node.data
|
|
2609
|
+
};
|
|
2610
|
+
});
|
|
1593
2611
|
return {
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
// src/nextjs/queries/site.ts
|
|
1601
|
-
var import_cache2 = require("next/cache");
|
|
1602
|
-
function createSiteQueries(getPayloadClient, contentTag = "website-content") {
|
|
1603
|
-
const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
|
|
1604
|
-
async () => {
|
|
1605
|
-
const payload = await getPayloadClient();
|
|
1606
|
-
const settings = await payload.findGlobal({
|
|
1607
|
-
slug: "site-settings",
|
|
1608
|
-
depth: 1
|
|
1609
|
-
});
|
|
1610
|
-
return settings;
|
|
1611
|
-
},
|
|
1612
|
-
["site-settings-global"],
|
|
1613
|
-
{ tags: [contentTag] }
|
|
1614
|
-
);
|
|
1615
|
-
const getHeaderCached = (0, import_cache2.unstable_cache)(
|
|
1616
|
-
async () => {
|
|
1617
|
-
const payload = await getPayloadClient();
|
|
1618
|
-
const header = await payload.findGlobal({
|
|
1619
|
-
slug: "header",
|
|
1620
|
-
depth: 1
|
|
1621
|
-
});
|
|
1622
|
-
return header;
|
|
1623
|
-
},
|
|
1624
|
-
["header-global"],
|
|
1625
|
-
{ tags: [contentTag] }
|
|
1626
|
-
);
|
|
1627
|
-
const getFooterCached = (0, import_cache2.unstable_cache)(
|
|
1628
|
-
async () => {
|
|
1629
|
-
const payload = await getPayloadClient();
|
|
1630
|
-
const footer = await payload.findGlobal({
|
|
1631
|
-
slug: "footer",
|
|
1632
|
-
depth: 1
|
|
1633
|
-
});
|
|
1634
|
-
return footer;
|
|
1635
|
-
},
|
|
1636
|
-
["footer-global"],
|
|
1637
|
-
{ tags: [contentTag] }
|
|
1638
|
-
);
|
|
1639
|
-
async function getSiteSettings(draft = false) {
|
|
1640
|
-
if (draft) {
|
|
1641
|
-
const payload = await getPayloadClient();
|
|
1642
|
-
const settings = await payload.findGlobal({
|
|
1643
|
-
slug: "site-settings",
|
|
1644
|
-
depth: 1,
|
|
1645
|
-
draft: true
|
|
1646
|
-
});
|
|
1647
|
-
return settings;
|
|
1648
|
-
}
|
|
1649
|
-
return getSiteSettingsCached();
|
|
1650
|
-
}
|
|
1651
|
-
async function getHeader(draft = false) {
|
|
1652
|
-
if (draft) {
|
|
1653
|
-
const payload = await getPayloadClient();
|
|
1654
|
-
const header = await payload.findGlobal({
|
|
1655
|
-
slug: "header",
|
|
1656
|
-
depth: 1,
|
|
1657
|
-
draft: true
|
|
1658
|
-
});
|
|
1659
|
-
return header;
|
|
1660
|
-
}
|
|
1661
|
-
return getHeaderCached();
|
|
1662
|
-
}
|
|
1663
|
-
async function getFooter(draft = false) {
|
|
1664
|
-
if (draft) {
|
|
1665
|
-
const payload = await getPayloadClient();
|
|
1666
|
-
const footer = await payload.findGlobal({
|
|
1667
|
-
slug: "footer",
|
|
1668
|
-
depth: 1,
|
|
1669
|
-
draft: true
|
|
1670
|
-
});
|
|
1671
|
-
return footer;
|
|
1672
|
-
}
|
|
1673
|
-
return getFooterCached();
|
|
1674
|
-
}
|
|
1675
|
-
return {
|
|
1676
|
-
getSiteSettings,
|
|
1677
|
-
getHeader,
|
|
1678
|
-
getFooter
|
|
1679
|
-
};
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
// src/nextjs/utilities/media.ts
|
|
1683
|
-
function resolveMedia(media) {
|
|
1684
|
-
if (!media) {
|
|
1685
|
-
return null;
|
|
1686
|
-
}
|
|
1687
|
-
if (typeof media === "number" || typeof media === "string") {
|
|
1688
|
-
return null;
|
|
1689
|
-
}
|
|
1690
|
-
if (media.url) {
|
|
1691
|
-
return {
|
|
1692
|
-
url: media.url,
|
|
1693
|
-
alt: media.alt || ""
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
if (media.filename) {
|
|
1697
|
-
return {
|
|
1698
|
-
url: `/media/${media.filename}`,
|
|
1699
|
-
alt: media.alt || ""
|
|
1700
|
-
};
|
|
1701
|
-
}
|
|
1702
|
-
return null;
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
// src/studio/index.ts
|
|
1706
|
-
var studio_exports = {};
|
|
1707
|
-
__export(studio_exports, {
|
|
1708
|
-
assertStudioDocumentV1: () => assertStudioDocumentV1,
|
|
1709
|
-
compileStudioDocument: () => compileStudioDocument,
|
|
1710
|
-
createEmptyStudioDocument: () => createEmptyStudioDocument,
|
|
1711
|
-
createStudioRegistry: () => createStudioRegistry,
|
|
1712
|
-
migrateStudioDocument: () => migrateStudioDocument,
|
|
1713
|
-
validateStudioDocument: () => validateStudioDocument
|
|
1714
|
-
});
|
|
1715
|
-
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1716
|
-
var makeIssue = (message, path2, code = "studio.invalid") => ({
|
|
1717
|
-
code,
|
|
1718
|
-
message,
|
|
1719
|
-
path: path2,
|
|
1720
|
-
severity: "error"
|
|
1721
|
-
});
|
|
1722
|
-
var createEmptyStudioDocument = (title) => ({
|
|
1723
|
-
metadata: {},
|
|
1724
|
-
schemaVersion: 1,
|
|
1725
|
-
title,
|
|
1726
|
-
nodes: [],
|
|
1727
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1728
|
-
});
|
|
1729
|
-
function assertStudioDocumentV1(input) {
|
|
1730
|
-
if (!isRecord(input)) {
|
|
1731
|
-
throw new Error("Studio document must be an object");
|
|
1732
|
-
}
|
|
1733
|
-
if (input.schemaVersion !== 1) {
|
|
1734
|
-
throw new Error("Unsupported studio schemaVersion");
|
|
1735
|
-
}
|
|
1736
|
-
if (!Array.isArray(input.nodes)) {
|
|
1737
|
-
throw new Error("Studio document nodes must be an array");
|
|
1738
|
-
}
|
|
1739
|
-
const nodes = input.nodes.map((node, index) => {
|
|
1740
|
-
if (!isRecord(node)) {
|
|
1741
|
-
throw new Error(`Node at index ${index} must be an object`);
|
|
1742
|
-
}
|
|
1743
|
-
if (typeof node.id !== "string" || node.id.length === 0) {
|
|
1744
|
-
throw new Error(`Node at index ${index} has invalid id`);
|
|
1745
|
-
}
|
|
1746
|
-
if (typeof node.type !== "string" || node.type.length === 0) {
|
|
1747
|
-
throw new Error(`Node at index ${index} has invalid type`);
|
|
1748
|
-
}
|
|
1749
|
-
if (!isRecord(node.data)) {
|
|
1750
|
-
throw new Error(`Node at index ${index} has invalid data`);
|
|
1751
|
-
}
|
|
1752
|
-
return {
|
|
1753
|
-
id: node.id,
|
|
1754
|
-
type: node.type,
|
|
1755
|
-
data: node.data
|
|
1756
|
-
};
|
|
1757
|
-
});
|
|
1758
|
-
return {
|
|
1759
|
-
metadata: isRecord(input.metadata) ? input.metadata : void 0,
|
|
1760
|
-
schemaVersion: 1,
|
|
1761
|
-
title: typeof input.title === "string" ? input.title : void 0,
|
|
1762
|
-
nodes,
|
|
1763
|
-
updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
|
|
2612
|
+
metadata: isRecord(input.metadata) ? input.metadata : void 0,
|
|
2613
|
+
schemaVersion: 1,
|
|
2614
|
+
title: typeof input.title === "string" ? input.title : void 0,
|
|
2615
|
+
nodes,
|
|
2616
|
+
updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
|
|
1764
2617
|
};
|
|
1765
2618
|
}
|
|
1766
2619
|
function createStudioRegistry(modules) {
|
|
@@ -1842,20 +2695,750 @@ function migrateStudioDocument(value, migrations) {
|
|
|
1842
2695
|
}
|
|
1843
2696
|
current = migration.migrate(current);
|
|
1844
2697
|
}
|
|
1845
|
-
return assertStudioDocumentV1(current);
|
|
1846
|
-
}
|
|
2698
|
+
return assertStudioDocumentV1(current);
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
// src/studio-pages/index.ts
|
|
2702
|
+
var studio_pages_exports = {};
|
|
2703
|
+
__export(studio_pages_exports, {
|
|
2704
|
+
createDefaultStudioDocument: () => createDefaultStudioDocument,
|
|
2705
|
+
defaultBuilderThemeTokens: () => defaultBuilderThemeTokens,
|
|
2706
|
+
layoutToStudioDocument: () => layoutToStudioDocument,
|
|
2707
|
+
pageInspectorPanels: () => pageInspectorPanels,
|
|
2708
|
+
pageNodeTypes: () => pageNodeTypes,
|
|
2709
|
+
pagePaletteGroups: () => pagePaletteGroups,
|
|
2710
|
+
pageStudioModuleManifest: () => pageStudioModuleManifest,
|
|
2711
|
+
resolveBuilderThemeTokens: () => resolveBuilderThemeTokens,
|
|
2712
|
+
studioDocumentToLayout: () => studioDocumentToLayout
|
|
2713
|
+
});
|
|
2714
|
+
|
|
2715
|
+
// src/studio-pages/builder/settings-v2/types.ts
|
|
2716
|
+
var defaultBuilderBlockSettingsV2 = {
|
|
2717
|
+
advanced: {
|
|
2718
|
+
customClassName: "",
|
|
2719
|
+
editCopyInPanel: false,
|
|
2720
|
+
hideOnMobile: false
|
|
2721
|
+
},
|
|
2722
|
+
appearance: {
|
|
2723
|
+
contentBackgroundColor: "#ffffff",
|
|
2724
|
+
contentBackgroundMode: "none",
|
|
2725
|
+
contentGradientAngle: "135",
|
|
2726
|
+
contentGradientFrom: "#ffffff",
|
|
2727
|
+
contentGradientPreset: "none",
|
|
2728
|
+
contentGradientTo: "#f4f6f2",
|
|
2729
|
+
sectionBackgroundColor: "#ffffff",
|
|
2730
|
+
sectionBackgroundMode: "none",
|
|
2731
|
+
sectionGradientAngle: "135",
|
|
2732
|
+
sectionGradientFrom: "#124a37",
|
|
2733
|
+
sectionGradientPreset: "forest",
|
|
2734
|
+
sectionGradientTo: "#1f684f"
|
|
2735
|
+
},
|
|
2736
|
+
layout: {
|
|
2737
|
+
contentWidth: "inherit",
|
|
2738
|
+
sectionPaddingX: "inherit",
|
|
2739
|
+
sectionPaddingY: "md"
|
|
2740
|
+
},
|
|
2741
|
+
media: {
|
|
2742
|
+
cornerStyle: "rounded",
|
|
2743
|
+
fit: "cover",
|
|
2744
|
+
height: null,
|
|
2745
|
+
position: "center",
|
|
2746
|
+
positionX: null,
|
|
2747
|
+
positionY: null
|
|
2748
|
+
},
|
|
2749
|
+
typography: {
|
|
2750
|
+
bodyAlign: "left",
|
|
2751
|
+
headingAlign: "left",
|
|
2752
|
+
letterSpacingPreset: "normal",
|
|
2753
|
+
lineHeightPreset: "normal",
|
|
2754
|
+
maxTextWidth: "auto"
|
|
2755
|
+
},
|
|
2756
|
+
version: 2
|
|
2757
|
+
};
|
|
2758
|
+
var defaultBuilderItemSettingsV2 = {
|
|
2759
|
+
layout: {
|
|
2760
|
+
contentWidth: "inherit",
|
|
2761
|
+
sectionPaddingX: "inherit",
|
|
2762
|
+
sectionPaddingY: "md"
|
|
2763
|
+
},
|
|
2764
|
+
media: {
|
|
2765
|
+
cornerStyle: "rounded",
|
|
2766
|
+
fit: "cover",
|
|
2767
|
+
height: null,
|
|
2768
|
+
position: "center",
|
|
2769
|
+
positionX: null,
|
|
2770
|
+
positionY: null
|
|
2771
|
+
},
|
|
2772
|
+
typography: {
|
|
2773
|
+
bodyAlign: "left",
|
|
2774
|
+
headingAlign: "left",
|
|
2775
|
+
letterSpacingPreset: "normal",
|
|
2776
|
+
lineHeightPreset: "normal",
|
|
2777
|
+
maxTextWidth: "auto"
|
|
2778
|
+
},
|
|
2779
|
+
version: 2
|
|
2780
|
+
};
|
|
2781
|
+
var defaultBuilderThemeTokens = {
|
|
2782
|
+
colors: {
|
|
2783
|
+
accent: "#0d4a37",
|
|
2784
|
+
bodyText: "#13211c",
|
|
2785
|
+
headingText: "#13211c",
|
|
2786
|
+
surface: "#ffffff"
|
|
2787
|
+
},
|
|
2788
|
+
radii: {
|
|
2789
|
+
card: 16,
|
|
2790
|
+
panel: 14
|
|
2791
|
+
},
|
|
2792
|
+
spacing: {
|
|
2793
|
+
sectionGap: "md",
|
|
2794
|
+
sectionPadding: "md"
|
|
2795
|
+
},
|
|
2796
|
+
typography: {
|
|
2797
|
+
bodySize: "md",
|
|
2798
|
+
headingSize: "md"
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
// src/studio-pages/builder/adapters/settingsV2.ts
|
|
2803
|
+
var isRecord2 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2804
|
+
var parsePercent = (value) => {
|
|
2805
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2806
|
+
return Math.max(0, Math.min(100, value));
|
|
2807
|
+
}
|
|
2808
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
2809
|
+
const parsed = Number(value);
|
|
2810
|
+
if (Number.isFinite(parsed)) {
|
|
2811
|
+
return Math.max(0, Math.min(100, parsed));
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return null;
|
|
2815
|
+
};
|
|
2816
|
+
var parsePixel = (value) => {
|
|
2817
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2818
|
+
return value;
|
|
2819
|
+
}
|
|
2820
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
2821
|
+
const parsed = Number(value);
|
|
2822
|
+
if (Number.isFinite(parsed)) {
|
|
2823
|
+
return parsed;
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
return null;
|
|
2827
|
+
};
|
|
2828
|
+
var mergeSettings = (defaults, input) => {
|
|
2829
|
+
if (!isRecord2(input)) {
|
|
2830
|
+
return structuredClone(defaults);
|
|
2831
|
+
}
|
|
2832
|
+
const next = structuredClone(defaults);
|
|
2833
|
+
for (const [key, value] of Object.entries(input)) {
|
|
2834
|
+
if (isRecord2(value) && isRecord2(next[key])) {
|
|
2835
|
+
next[key] = mergeSettings(next[key], value);
|
|
2836
|
+
continue;
|
|
2837
|
+
}
|
|
2838
|
+
if (typeof value !== "undefined") {
|
|
2839
|
+
next[key] = value;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
return next;
|
|
2843
|
+
};
|
|
2844
|
+
var legacyBlockToV2Settings = (block) => {
|
|
2845
|
+
const current = mergeSettings(defaultBuilderBlockSettingsV2, block.settings);
|
|
2846
|
+
current.layout.contentWidth = block.contentWidth === "narrow" || block.contentWidth === "content" || block.contentWidth === "wide" || block.contentWidth === "full" || block.contentWidth === "inherit" ? block.contentWidth : current.layout.contentWidth;
|
|
2847
|
+
current.layout.sectionPaddingX = block.sectionPaddingX === "none" || block.sectionPaddingX === "sm" || block.sectionPaddingX === "md" || block.sectionPaddingX === "lg" || block.sectionPaddingX === "inherit" ? block.sectionPaddingX : current.layout.sectionPaddingX;
|
|
2848
|
+
current.layout.sectionPaddingY = block.sectionPaddingY === "none" || block.sectionPaddingY === "sm" || block.sectionPaddingY === "lg" ? block.sectionPaddingY : current.layout.sectionPaddingY;
|
|
2849
|
+
current.appearance.sectionBackgroundMode = block.sectionBackgroundMode === "none" || block.sectionBackgroundMode === "color" || block.sectionBackgroundMode === "gradient" ? block.sectionBackgroundMode : current.appearance.sectionBackgroundMode;
|
|
2850
|
+
current.appearance.sectionBackgroundColor = typeof block.sectionBackgroundColor === "string" ? block.sectionBackgroundColor : current.appearance.sectionBackgroundColor;
|
|
2851
|
+
current.appearance.sectionGradientPreset = typeof block.sectionGradientPreset === "string" ? block.sectionGradientPreset : current.appearance.sectionGradientPreset;
|
|
2852
|
+
current.appearance.sectionGradientFrom = typeof block.sectionGradientFrom === "string" ? block.sectionGradientFrom : current.appearance.sectionGradientFrom;
|
|
2853
|
+
current.appearance.sectionGradientTo = typeof block.sectionGradientTo === "string" ? block.sectionGradientTo : current.appearance.sectionGradientTo;
|
|
2854
|
+
current.appearance.sectionGradientAngle = typeof block.sectionGradientAngle === "string" ? block.sectionGradientAngle : current.appearance.sectionGradientAngle;
|
|
2855
|
+
current.appearance.contentBackgroundMode = block.contentBackgroundMode === "none" || block.contentBackgroundMode === "color" || block.contentBackgroundMode === "gradient" ? block.contentBackgroundMode : current.appearance.contentBackgroundMode;
|
|
2856
|
+
current.appearance.contentBackgroundColor = typeof block.contentBackgroundColor === "string" ? block.contentBackgroundColor : current.appearance.contentBackgroundColor;
|
|
2857
|
+
current.appearance.contentGradientPreset = typeof block.contentGradientPreset === "string" ? block.contentGradientPreset : current.appearance.contentGradientPreset;
|
|
2858
|
+
current.appearance.contentGradientFrom = typeof block.contentGradientFrom === "string" ? block.contentGradientFrom : current.appearance.contentGradientFrom;
|
|
2859
|
+
current.appearance.contentGradientTo = typeof block.contentGradientTo === "string" ? block.contentGradientTo : current.appearance.contentGradientTo;
|
|
2860
|
+
current.appearance.contentGradientAngle = typeof block.contentGradientAngle === "string" ? block.contentGradientAngle : current.appearance.contentGradientAngle;
|
|
2861
|
+
if (block.backgroundImageFit === "cover" || block.backgroundImageFit === "contain") {
|
|
2862
|
+
current.media.fit = block.backgroundImageFit;
|
|
2863
|
+
}
|
|
2864
|
+
if (block.imageFit === "cover" || block.imageFit === "contain") {
|
|
2865
|
+
current.media.fit = block.imageFit;
|
|
2866
|
+
}
|
|
2867
|
+
if (block.backgroundImageCornerStyle === "rounded" || block.backgroundImageCornerStyle === "square") {
|
|
2868
|
+
current.media.cornerStyle = block.backgroundImageCornerStyle;
|
|
2869
|
+
}
|
|
2870
|
+
if (block.imageCornerStyle === "rounded" || block.imageCornerStyle === "square") {
|
|
2871
|
+
current.media.cornerStyle = block.imageCornerStyle;
|
|
2872
|
+
}
|
|
2873
|
+
if (block.backgroundImagePosition === "top" || block.backgroundImagePosition === "bottom" || block.backgroundImagePosition === "left" || block.backgroundImagePosition === "right" || block.backgroundImagePosition === "center") {
|
|
2874
|
+
current.media.position = block.backgroundImagePosition;
|
|
2875
|
+
}
|
|
2876
|
+
if (block.imagePosition === "top" || block.imagePosition === "bottom" || block.imagePosition === "left" || block.imagePosition === "right" || block.imagePosition === "center") {
|
|
2877
|
+
current.media.position = block.imagePosition;
|
|
2878
|
+
}
|
|
2879
|
+
current.media.positionX = parsePercent(block.imagePositionX ?? block.backgroundImagePositionX);
|
|
2880
|
+
current.media.positionY = parsePercent(block.imagePositionY ?? block.backgroundImagePositionY);
|
|
2881
|
+
current.media.height = parsePixel(block.imageHeight);
|
|
2882
|
+
current.typography.headingAlign = block.textHeadingAlign === "left" || block.textHeadingAlign === "center" || block.textHeadingAlign === "right" || block.textHeadingAlign === "justify" ? block.textHeadingAlign : current.typography.headingAlign;
|
|
2883
|
+
current.typography.bodyAlign = block.textBodyAlign === "left" || block.textBodyAlign === "center" || block.textBodyAlign === "right" || block.textBodyAlign === "justify" ? block.textBodyAlign : current.typography.bodyAlign;
|
|
2884
|
+
current.typography.maxTextWidth = block.textMaxWidth === "auto" || block.textMaxWidth === "sm" || block.textMaxWidth === "md" || block.textMaxWidth === "lg" || block.textMaxWidth === "full" ? block.textMaxWidth : current.typography.maxTextWidth;
|
|
2885
|
+
current.typography.lineHeightPreset = block.textLineHeightPreset === "tight" || block.textLineHeightPreset === "normal" || block.textLineHeightPreset === "relaxed" ? block.textLineHeightPreset : current.typography.lineHeightPreset;
|
|
2886
|
+
current.typography.letterSpacingPreset = block.textLetterSpacingPreset === "tight" || block.textLetterSpacingPreset === "normal" || block.textLetterSpacingPreset === "relaxed" ? block.textLetterSpacingPreset : current.typography.letterSpacingPreset;
|
|
2887
|
+
current.advanced.editCopyInPanel = Boolean(block.editCopyInPanel ?? current.advanced.editCopyInPanel);
|
|
2888
|
+
current.advanced.customClassName = typeof block.customClassName === "string" ? block.customClassName : current.advanced.customClassName;
|
|
2889
|
+
current.advanced.hideOnMobile = Boolean(block.hideOnMobile ?? current.advanced.hideOnMobile);
|
|
2890
|
+
return current;
|
|
2891
|
+
};
|
|
2892
|
+
var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
2893
|
+
const settings = legacyBlockToV2Settings(blockWithSettings);
|
|
2894
|
+
const next = {
|
|
2895
|
+
...blockWithSettings,
|
|
2896
|
+
settings
|
|
2897
|
+
};
|
|
2898
|
+
next.contentWidth = settings.layout.contentWidth;
|
|
2899
|
+
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
2900
|
+
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
2901
|
+
next.sectionBackgroundMode = settings.appearance.sectionBackgroundMode;
|
|
2902
|
+
next.sectionBackgroundColor = settings.appearance.sectionBackgroundColor;
|
|
2903
|
+
next.sectionGradientPreset = settings.appearance.sectionGradientPreset;
|
|
2904
|
+
next.sectionGradientFrom = settings.appearance.sectionGradientFrom;
|
|
2905
|
+
next.sectionGradientTo = settings.appearance.sectionGradientTo;
|
|
2906
|
+
next.sectionGradientAngle = settings.appearance.sectionGradientAngle;
|
|
2907
|
+
next.contentBackgroundMode = settings.appearance.contentBackgroundMode;
|
|
2908
|
+
next.contentBackgroundColor = settings.appearance.contentBackgroundColor;
|
|
2909
|
+
next.contentGradientPreset = settings.appearance.contentGradientPreset;
|
|
2910
|
+
next.contentGradientFrom = settings.appearance.contentGradientFrom;
|
|
2911
|
+
next.contentGradientTo = settings.appearance.contentGradientTo;
|
|
2912
|
+
next.contentGradientAngle = settings.appearance.contentGradientAngle;
|
|
2913
|
+
next.textHeadingAlign = settings.typography.headingAlign;
|
|
2914
|
+
next.textBodyAlign = settings.typography.bodyAlign;
|
|
2915
|
+
next.textMaxWidth = settings.typography.maxTextWidth;
|
|
2916
|
+
next.textLineHeightPreset = settings.typography.lineHeightPreset;
|
|
2917
|
+
next.textLetterSpacingPreset = settings.typography.letterSpacingPreset;
|
|
2918
|
+
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
2919
|
+
next.customClassName = settings.advanced.customClassName;
|
|
2920
|
+
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
2921
|
+
if (next.blockType === "hero") {
|
|
2922
|
+
next.backgroundImageFit = settings.media.fit;
|
|
2923
|
+
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
2924
|
+
next.backgroundImagePosition = settings.media.position;
|
|
2925
|
+
next.backgroundImagePositionX = settings.media.positionX;
|
|
2926
|
+
next.backgroundImagePositionY = settings.media.positionY;
|
|
2927
|
+
} else {
|
|
2928
|
+
next.imageFit = settings.media.fit;
|
|
2929
|
+
next.imageCornerStyle = settings.media.cornerStyle;
|
|
2930
|
+
next.imagePosition = settings.media.position;
|
|
2931
|
+
next.imagePositionX = settings.media.positionX;
|
|
2932
|
+
next.imagePositionY = settings.media.positionY;
|
|
2933
|
+
next.imageHeight = settings.media.height;
|
|
2934
|
+
}
|
|
2935
|
+
if (Array.isArray(next.items)) {
|
|
2936
|
+
next.items = next.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
|
2937
|
+
}
|
|
2938
|
+
return next;
|
|
2939
|
+
};
|
|
2940
|
+
var legacyItemToV2Settings = (item) => {
|
|
2941
|
+
const current = mergeSettings(defaultBuilderItemSettingsV2, item.settings);
|
|
2942
|
+
if (item.imageFit === "cover" || item.imageFit === "contain") {
|
|
2943
|
+
current.media.fit = item.imageFit;
|
|
2944
|
+
}
|
|
2945
|
+
if (item.imageCornerStyle === "rounded" || item.imageCornerStyle === "square") {
|
|
2946
|
+
current.media.cornerStyle = item.imageCornerStyle;
|
|
2947
|
+
}
|
|
2948
|
+
if (item.imagePosition === "top" || item.imagePosition === "bottom" || item.imagePosition === "left" || item.imagePosition === "right" || item.imagePosition === "center") {
|
|
2949
|
+
current.media.position = item.imagePosition;
|
|
2950
|
+
}
|
|
2951
|
+
current.media.positionX = parsePercent(item.imagePositionX);
|
|
2952
|
+
current.media.positionY = parsePercent(item.imagePositionY);
|
|
2953
|
+
current.media.height = parsePixel(item.imageHeight);
|
|
2954
|
+
return current;
|
|
2955
|
+
};
|
|
2956
|
+
var v2SettingsToLegacyItem = (itemWithSettings) => {
|
|
2957
|
+
const settings = legacyItemToV2Settings(itemWithSettings);
|
|
2958
|
+
return {
|
|
2959
|
+
...itemWithSettings,
|
|
2960
|
+
imageCornerStyle: settings.media.cornerStyle,
|
|
2961
|
+
imageFit: settings.media.fit,
|
|
2962
|
+
imageHeight: settings.media.height,
|
|
2963
|
+
imagePosition: settings.media.position,
|
|
2964
|
+
imagePositionX: settings.media.positionX,
|
|
2965
|
+
imagePositionY: settings.media.positionY,
|
|
2966
|
+
settings
|
|
2967
|
+
};
|
|
2968
|
+
};
|
|
2969
|
+
var migrateBlockToSettingsV2 = (block) => {
|
|
2970
|
+
const withLegacyMirrors = v2SettingsToLegacyBlock(block);
|
|
2971
|
+
if (!Array.isArray(withLegacyMirrors.items)) {
|
|
2972
|
+
return withLegacyMirrors;
|
|
2973
|
+
}
|
|
2974
|
+
return {
|
|
2975
|
+
...withLegacyMirrors,
|
|
2976
|
+
items: withLegacyMirrors.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem)
|
|
2977
|
+
};
|
|
2978
|
+
};
|
|
2979
|
+
|
|
2980
|
+
// src/studio-pages/builder/settings-v2/themeTokens.ts
|
|
2981
|
+
var isRecord3 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2982
|
+
var merge = (base, next) => {
|
|
2983
|
+
if (!next || !isRecord3(next)) {
|
|
2984
|
+
return base;
|
|
2985
|
+
}
|
|
2986
|
+
const merged = { ...base };
|
|
2987
|
+
for (const [key, value] of Object.entries(next)) {
|
|
2988
|
+
if (isRecord3(value) && isRecord3(merged[key])) {
|
|
2989
|
+
merged[key] = merge(merged[key], value);
|
|
2990
|
+
continue;
|
|
2991
|
+
}
|
|
2992
|
+
if (typeof value !== "undefined") {
|
|
2993
|
+
merged[key] = value;
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
return merged;
|
|
2997
|
+
};
|
|
2998
|
+
var resolveBuilderThemeTokens = (layers) => {
|
|
2999
|
+
const withSite = merge(defaultBuilderThemeTokens, layers.site);
|
|
3000
|
+
const withPage = merge(withSite, layers.page);
|
|
3001
|
+
return merge(withPage, layers.block);
|
|
3002
|
+
};
|
|
3003
|
+
|
|
3004
|
+
// src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
|
|
3005
|
+
var import_react = require("react");
|
|
3006
|
+
|
|
3007
|
+
// src/studio-pages/builder/ui/Accordion.tsx
|
|
3008
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3009
|
+
|
|
3010
|
+
// src/studio-pages/builder/ui/ImageControls.tsx
|
|
3011
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3012
|
+
|
|
3013
|
+
// src/studio-pages/builder/settings-v2/inspectorSchema.ts
|
|
3014
|
+
var alignOptions = [
|
|
3015
|
+
{ label: "Left", value: "left" },
|
|
3016
|
+
{ label: "Center", value: "center" },
|
|
3017
|
+
{ label: "Right", value: "right" },
|
|
3018
|
+
{ label: "Justify", value: "justify" }
|
|
3019
|
+
];
|
|
3020
|
+
var layoutFieldSet = [
|
|
3021
|
+
{
|
|
3022
|
+
group: "layout",
|
|
3023
|
+
key: "settings.layout.contentWidth",
|
|
3024
|
+
label: "Content Width",
|
|
3025
|
+
options: [
|
|
3026
|
+
{ label: "Inherit Page Default", value: "inherit" },
|
|
3027
|
+
{ label: "Narrow", value: "narrow" },
|
|
3028
|
+
{ label: "Content", value: "content" },
|
|
3029
|
+
{ label: "Wide", value: "wide" },
|
|
3030
|
+
{ label: "Full", value: "full" }
|
|
3031
|
+
],
|
|
3032
|
+
tags: ["width", "container"],
|
|
3033
|
+
type: "select"
|
|
3034
|
+
},
|
|
3035
|
+
{
|
|
3036
|
+
group: "layout",
|
|
3037
|
+
key: "settings.layout.sectionPaddingY",
|
|
3038
|
+
label: "Section Vertical Spacing",
|
|
3039
|
+
options: [
|
|
3040
|
+
{ label: "None", value: "none" },
|
|
3041
|
+
{ label: "Small", value: "sm" },
|
|
3042
|
+
{ label: "Medium", value: "md" },
|
|
3043
|
+
{ label: "Large", value: "lg" }
|
|
3044
|
+
],
|
|
3045
|
+
tags: ["spacing", "padding"],
|
|
3046
|
+
type: "select"
|
|
3047
|
+
},
|
|
3048
|
+
{
|
|
3049
|
+
group: "layout",
|
|
3050
|
+
key: "settings.layout.sectionPaddingX",
|
|
3051
|
+
label: "Section Horizontal Spacing",
|
|
3052
|
+
options: [
|
|
3053
|
+
{ label: "Inherit", value: "inherit" },
|
|
3054
|
+
{ label: "None", value: "none" },
|
|
3055
|
+
{ label: "Small", value: "sm" },
|
|
3056
|
+
{ label: "Medium", value: "md" },
|
|
3057
|
+
{ label: "Large", value: "lg" }
|
|
3058
|
+
],
|
|
3059
|
+
tags: ["spacing", "padding"],
|
|
3060
|
+
type: "select"
|
|
3061
|
+
}
|
|
3062
|
+
];
|
|
3063
|
+
var typographyFieldSet = [
|
|
3064
|
+
{
|
|
3065
|
+
group: "typography",
|
|
3066
|
+
key: "settings.typography.headingAlign",
|
|
3067
|
+
label: "Heading Alignment",
|
|
3068
|
+
options: alignOptions,
|
|
3069
|
+
tags: ["text", "align", "heading"],
|
|
3070
|
+
type: "select"
|
|
3071
|
+
},
|
|
3072
|
+
{
|
|
3073
|
+
group: "typography",
|
|
3074
|
+
key: "settings.typography.bodyAlign",
|
|
3075
|
+
label: "Body Alignment",
|
|
3076
|
+
options: alignOptions,
|
|
3077
|
+
tags: ["text", "align", "paragraph"],
|
|
3078
|
+
type: "select"
|
|
3079
|
+
},
|
|
3080
|
+
{
|
|
3081
|
+
group: "typography",
|
|
3082
|
+
key: "settings.typography.maxTextWidth",
|
|
3083
|
+
label: "Text Width",
|
|
3084
|
+
options: [
|
|
3085
|
+
{ label: "Auto", value: "auto" },
|
|
3086
|
+
{ label: "Small", value: "sm" },
|
|
3087
|
+
{ label: "Medium", value: "md" },
|
|
3088
|
+
{ label: "Large", value: "lg" },
|
|
3089
|
+
{ label: "Full", value: "full" }
|
|
3090
|
+
],
|
|
3091
|
+
tags: ["readability", "measure", "line length"],
|
|
3092
|
+
type: "select"
|
|
3093
|
+
},
|
|
3094
|
+
{
|
|
3095
|
+
advanced: true,
|
|
3096
|
+
group: "typography",
|
|
3097
|
+
key: "settings.typography.lineHeightPreset",
|
|
3098
|
+
label: "Line Height",
|
|
3099
|
+
options: [
|
|
3100
|
+
{ label: "Tight", value: "tight" },
|
|
3101
|
+
{ label: "Normal", value: "normal" },
|
|
3102
|
+
{ label: "Relaxed", value: "relaxed" }
|
|
3103
|
+
],
|
|
3104
|
+
type: "select"
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
advanced: true,
|
|
3108
|
+
group: "typography",
|
|
3109
|
+
key: "settings.typography.letterSpacingPreset",
|
|
3110
|
+
label: "Letter Spacing",
|
|
3111
|
+
options: [
|
|
3112
|
+
{ label: "Tight", value: "tight" },
|
|
3113
|
+
{ label: "Normal", value: "normal" },
|
|
3114
|
+
{ label: "Relaxed", value: "relaxed" }
|
|
3115
|
+
],
|
|
3116
|
+
type: "select"
|
|
3117
|
+
}
|
|
3118
|
+
];
|
|
3119
|
+
var styleFieldSet = [
|
|
3120
|
+
{
|
|
3121
|
+
group: "style",
|
|
3122
|
+
key: "settings.appearance.sectionBackgroundMode",
|
|
3123
|
+
label: "Section Background",
|
|
3124
|
+
options: [
|
|
3125
|
+
{ label: "None", value: "none" },
|
|
3126
|
+
{ label: "Color", value: "color" },
|
|
3127
|
+
{ label: "Gradient", value: "gradient" }
|
|
3128
|
+
],
|
|
3129
|
+
tags: ["background", "section"],
|
|
3130
|
+
type: "select"
|
|
3131
|
+
},
|
|
3132
|
+
{
|
|
3133
|
+
group: "style",
|
|
3134
|
+
key: "settings.appearance.sectionBackgroundColor",
|
|
3135
|
+
label: "Section Background Color",
|
|
3136
|
+
type: "color"
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
group: "style",
|
|
3140
|
+
key: "settings.appearance.contentBackgroundMode",
|
|
3141
|
+
label: "Content Background",
|
|
3142
|
+
options: [
|
|
3143
|
+
{ label: "None", value: "none" },
|
|
3144
|
+
{ label: "Color", value: "color" },
|
|
3145
|
+
{ label: "Gradient", value: "gradient" }
|
|
3146
|
+
],
|
|
3147
|
+
tags: ["background", "content"],
|
|
3148
|
+
type: "select"
|
|
3149
|
+
},
|
|
3150
|
+
{
|
|
3151
|
+
group: "style",
|
|
3152
|
+
key: "settings.appearance.contentBackgroundColor",
|
|
3153
|
+
label: "Content Background Color",
|
|
3154
|
+
type: "color"
|
|
3155
|
+
}
|
|
3156
|
+
];
|
|
3157
|
+
var commonAdvanced = [
|
|
3158
|
+
{
|
|
3159
|
+
group: "advanced",
|
|
3160
|
+
inlineEditable: false,
|
|
3161
|
+
key: "settings.advanced.editCopyInPanel",
|
|
3162
|
+
label: "Edit Copy In Panel",
|
|
3163
|
+
tags: ["inline", "copy", "text"],
|
|
3164
|
+
type: "checkbox"
|
|
3165
|
+
},
|
|
3166
|
+
{
|
|
3167
|
+
advanced: true,
|
|
3168
|
+
group: "advanced",
|
|
3169
|
+
key: "settings.advanced.hideOnMobile",
|
|
3170
|
+
label: "Hide On Mobile",
|
|
3171
|
+
type: "checkbox"
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
advanced: true,
|
|
3175
|
+
group: "advanced",
|
|
3176
|
+
key: "settings.advanced.customClassName",
|
|
3177
|
+
label: "Custom Class Name",
|
|
3178
|
+
type: "text"
|
|
3179
|
+
}
|
|
3180
|
+
];
|
|
3181
|
+
var mediaFieldSet = [
|
|
3182
|
+
{
|
|
3183
|
+
group: "media",
|
|
3184
|
+
key: "settings.media.fit",
|
|
3185
|
+
label: "Image Fit",
|
|
3186
|
+
options: [
|
|
3187
|
+
{ label: "Cover", value: "cover" },
|
|
3188
|
+
{ label: "Contain", value: "contain" }
|
|
3189
|
+
],
|
|
3190
|
+
tags: ["image", "media"],
|
|
3191
|
+
type: "select"
|
|
3192
|
+
},
|
|
3193
|
+
{
|
|
3194
|
+
group: "media",
|
|
3195
|
+
key: "settings.media.cornerStyle",
|
|
3196
|
+
label: "Image Corners",
|
|
3197
|
+
options: [
|
|
3198
|
+
{ label: "Rounded", value: "rounded" },
|
|
3199
|
+
{ label: "Square", value: "square" }
|
|
3200
|
+
],
|
|
3201
|
+
tags: ["image", "radius", "corners"],
|
|
3202
|
+
type: "select"
|
|
3203
|
+
},
|
|
3204
|
+
{
|
|
3205
|
+
group: "media",
|
|
3206
|
+
key: "settings.media.position",
|
|
3207
|
+
label: "Image Position",
|
|
3208
|
+
options: [
|
|
3209
|
+
{ label: "Center", value: "center" },
|
|
3210
|
+
{ label: "Top", value: "top" },
|
|
3211
|
+
{ label: "Bottom", value: "bottom" },
|
|
3212
|
+
{ label: "Left", value: "left" },
|
|
3213
|
+
{ label: "Right", value: "right" }
|
|
3214
|
+
],
|
|
3215
|
+
type: "select"
|
|
3216
|
+
}
|
|
3217
|
+
];
|
|
3218
|
+
var inspectorDefinitionByBlockType = {
|
|
3219
|
+
beforeAfter: {
|
|
3220
|
+
blockType: "beforeAfter",
|
|
3221
|
+
fields: [
|
|
3222
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3223
|
+
{ group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
|
|
3224
|
+
{ group: "basics", key: "itemsPerRow", label: "Items Per Row", max: 4, min: 1, type: "number" },
|
|
3225
|
+
...layoutFieldSet,
|
|
3226
|
+
...typographyFieldSet,
|
|
3227
|
+
...styleFieldSet,
|
|
3228
|
+
...commonAdvanced
|
|
3229
|
+
]
|
|
3230
|
+
},
|
|
3231
|
+
bookingEmbed: {
|
|
3232
|
+
blockType: "bookingEmbed",
|
|
3233
|
+
fields: [
|
|
3234
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3235
|
+
{ group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
|
|
3236
|
+
{ group: "basics", inlineEditable: false, key: "buttonLabel", label: "Button Label", type: "text" },
|
|
3237
|
+
{ group: "basics", inlineEditable: false, key: "buttonHref", label: "Button URL", type: "text" },
|
|
3238
|
+
...layoutFieldSet,
|
|
3239
|
+
...typographyFieldSet,
|
|
3240
|
+
...styleFieldSet,
|
|
3241
|
+
...commonAdvanced
|
|
3242
|
+
]
|
|
3243
|
+
},
|
|
3244
|
+
cta: {
|
|
3245
|
+
blockType: "cta",
|
|
3246
|
+
fields: [
|
|
3247
|
+
{ group: "basics", inlineEditable: true, key: "headline", label: "Headline", type: "text" },
|
|
3248
|
+
{ group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
|
|
3249
|
+
{ group: "basics", inlineEditable: false, key: "buttonLabel", label: "Button Label", type: "text" },
|
|
3250
|
+
{ group: "basics", inlineEditable: false, key: "buttonHref", label: "Button URL", type: "text" },
|
|
3251
|
+
{
|
|
3252
|
+
group: "basics",
|
|
3253
|
+
key: "style",
|
|
3254
|
+
label: "Variant",
|
|
3255
|
+
options: [
|
|
3256
|
+
{ label: "Light", value: "light" },
|
|
3257
|
+
{ label: "Dark", value: "dark" }
|
|
3258
|
+
],
|
|
3259
|
+
type: "select"
|
|
3260
|
+
},
|
|
3261
|
+
...layoutFieldSet,
|
|
3262
|
+
...typographyFieldSet,
|
|
3263
|
+
...styleFieldSet,
|
|
3264
|
+
...commonAdvanced
|
|
3265
|
+
]
|
|
3266
|
+
},
|
|
3267
|
+
faq: {
|
|
3268
|
+
blockType: "faq",
|
|
3269
|
+
fields: [
|
|
3270
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3271
|
+
...layoutFieldSet,
|
|
3272
|
+
...typographyFieldSet,
|
|
3273
|
+
...styleFieldSet,
|
|
3274
|
+
...commonAdvanced
|
|
3275
|
+
]
|
|
3276
|
+
},
|
|
3277
|
+
featureGrid: {
|
|
3278
|
+
blockType: "featureGrid",
|
|
3279
|
+
fields: [
|
|
3280
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3281
|
+
{
|
|
3282
|
+
group: "basics",
|
|
3283
|
+
key: "variant",
|
|
3284
|
+
label: "Variant",
|
|
3285
|
+
options: [
|
|
3286
|
+
{ label: "Cards", value: "cards" },
|
|
3287
|
+
{ label: "Highlight", value: "highlight" }
|
|
3288
|
+
],
|
|
3289
|
+
type: "select"
|
|
3290
|
+
},
|
|
3291
|
+
{ group: "basics", key: "itemsPerRow", label: "Items Per Row", max: 6, min: 1, type: "number" },
|
|
3292
|
+
...layoutFieldSet,
|
|
3293
|
+
...typographyFieldSet,
|
|
3294
|
+
...mediaFieldSet,
|
|
3295
|
+
...styleFieldSet,
|
|
3296
|
+
...commonAdvanced
|
|
3297
|
+
]
|
|
3298
|
+
},
|
|
3299
|
+
formEmbed: {
|
|
3300
|
+
blockType: "formEmbed",
|
|
3301
|
+
fields: [
|
|
3302
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3303
|
+
{ group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
|
|
3304
|
+
{
|
|
3305
|
+
group: "basics",
|
|
3306
|
+
key: "formType",
|
|
3307
|
+
label: "Form Type",
|
|
3308
|
+
options: [{ label: "Quote", value: "quote" }],
|
|
3309
|
+
type: "select"
|
|
3310
|
+
},
|
|
3311
|
+
...layoutFieldSet,
|
|
3312
|
+
...typographyFieldSet,
|
|
3313
|
+
...styleFieldSet,
|
|
3314
|
+
...commonAdvanced
|
|
3315
|
+
]
|
|
3316
|
+
},
|
|
3317
|
+
hero: {
|
|
3318
|
+
blockType: "hero",
|
|
3319
|
+
fields: [
|
|
3320
|
+
{ group: "basics", inlineEditable: true, key: "kicker", label: "Kicker", type: "text" },
|
|
3321
|
+
{ group: "basics", inlineEditable: true, key: "headline", label: "Headline", type: "text" },
|
|
3322
|
+
{ group: "basics", inlineEditable: true, key: "subheadline", label: "Subheadline", type: "textarea" },
|
|
3323
|
+
{
|
|
3324
|
+
group: "basics",
|
|
3325
|
+
key: "variant",
|
|
3326
|
+
label: "Variant",
|
|
3327
|
+
options: [
|
|
3328
|
+
{ label: "Default", value: "default" },
|
|
3329
|
+
{ label: "Centered", value: "centered" }
|
|
3330
|
+
],
|
|
3331
|
+
type: "select"
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
group: "layout",
|
|
3335
|
+
key: "heroHeight",
|
|
3336
|
+
label: "Hero Height",
|
|
3337
|
+
options: [
|
|
3338
|
+
{ label: "Small", value: "sm" },
|
|
3339
|
+
{ label: "Medium (Half Screen)", value: "md" },
|
|
3340
|
+
{ label: "Full Screen", value: "full" }
|
|
3341
|
+
],
|
|
3342
|
+
type: "select"
|
|
3343
|
+
},
|
|
3344
|
+
...layoutFieldSet,
|
|
3345
|
+
...typographyFieldSet,
|
|
3346
|
+
...mediaFieldSet,
|
|
3347
|
+
...styleFieldSet,
|
|
3348
|
+
...commonAdvanced
|
|
3349
|
+
]
|
|
3350
|
+
},
|
|
3351
|
+
logoWall: {
|
|
3352
|
+
blockType: "logoWall",
|
|
3353
|
+
fields: [
|
|
3354
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3355
|
+
{ group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
|
|
3356
|
+
...layoutFieldSet,
|
|
3357
|
+
...typographyFieldSet,
|
|
3358
|
+
...mediaFieldSet,
|
|
3359
|
+
...styleFieldSet,
|
|
3360
|
+
...commonAdvanced
|
|
3361
|
+
]
|
|
3362
|
+
},
|
|
3363
|
+
media: {
|
|
3364
|
+
blockType: "media",
|
|
3365
|
+
fields: [
|
|
3366
|
+
{ group: "basics", inlineEditable: true, key: "caption", label: "Caption", type: "text" },
|
|
3367
|
+
{
|
|
3368
|
+
group: "basics",
|
|
3369
|
+
key: "size",
|
|
3370
|
+
label: "Size",
|
|
3371
|
+
options: [
|
|
3372
|
+
{ label: "Default", value: "default" },
|
|
3373
|
+
{ label: "Wide", value: "wide" }
|
|
3374
|
+
],
|
|
3375
|
+
type: "select"
|
|
3376
|
+
},
|
|
3377
|
+
...layoutFieldSet,
|
|
3378
|
+
...typographyFieldSet,
|
|
3379
|
+
...mediaFieldSet,
|
|
3380
|
+
...styleFieldSet,
|
|
3381
|
+
...commonAdvanced
|
|
3382
|
+
]
|
|
3383
|
+
},
|
|
3384
|
+
richText: {
|
|
3385
|
+
blockType: "richText",
|
|
3386
|
+
fields: [
|
|
3387
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3388
|
+
{
|
|
3389
|
+
group: "basics",
|
|
3390
|
+
key: "width",
|
|
3391
|
+
label: "Rich Text Width",
|
|
3392
|
+
options: [
|
|
3393
|
+
{ label: "Normal", value: "normal" },
|
|
3394
|
+
{ label: "Narrow", value: "narrow" }
|
|
3395
|
+
],
|
|
3396
|
+
type: "select"
|
|
3397
|
+
},
|
|
3398
|
+
...layoutFieldSet,
|
|
3399
|
+
...typographyFieldSet,
|
|
3400
|
+
...styleFieldSet,
|
|
3401
|
+
...commonAdvanced
|
|
3402
|
+
]
|
|
3403
|
+
},
|
|
3404
|
+
stats: {
|
|
3405
|
+
blockType: "stats",
|
|
3406
|
+
fields: [
|
|
3407
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3408
|
+
{ group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
|
|
3409
|
+
...layoutFieldSet,
|
|
3410
|
+
...typographyFieldSet,
|
|
3411
|
+
...styleFieldSet,
|
|
3412
|
+
...commonAdvanced
|
|
3413
|
+
]
|
|
3414
|
+
},
|
|
3415
|
+
testimonials: {
|
|
3416
|
+
blockType: "testimonials",
|
|
3417
|
+
fields: [
|
|
3418
|
+
{ group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
|
|
3419
|
+
{ group: "basics", key: "visibleCount", label: "Visible At Once", max: 6, min: 1, type: "number" },
|
|
3420
|
+
{ group: "basics", key: "autoRotate", label: "Auto Rotate", type: "checkbox" },
|
|
3421
|
+
{
|
|
3422
|
+
advanced: true,
|
|
3423
|
+
group: "advanced",
|
|
3424
|
+
key: "rotateIntervalSeconds",
|
|
3425
|
+
label: "Rotate Interval Seconds",
|
|
3426
|
+
max: 30,
|
|
3427
|
+
min: 2,
|
|
3428
|
+
type: "number"
|
|
3429
|
+
},
|
|
3430
|
+
...layoutFieldSet,
|
|
3431
|
+
...typographyFieldSet,
|
|
3432
|
+
...styleFieldSet,
|
|
3433
|
+
...commonAdvanced
|
|
3434
|
+
]
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
|
|
3438
|
+
// src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
|
|
3439
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1847
3440
|
|
|
1848
3441
|
// src/studio-pages/index.ts
|
|
1849
|
-
var studio_pages_exports = {};
|
|
1850
|
-
__export(studio_pages_exports, {
|
|
1851
|
-
createDefaultStudioDocument: () => createDefaultStudioDocument,
|
|
1852
|
-
layoutToStudioDocument: () => layoutToStudioDocument,
|
|
1853
|
-
pageInspectorPanels: () => pageInspectorPanels,
|
|
1854
|
-
pageNodeTypes: () => pageNodeTypes,
|
|
1855
|
-
pagePaletteGroups: () => pagePaletteGroups,
|
|
1856
|
-
pageStudioModuleManifest: () => pageStudioModuleManifest,
|
|
1857
|
-
studioDocumentToLayout: () => studioDocumentToLayout
|
|
1858
|
-
});
|
|
1859
3442
|
var withSectionStyleDefaults = (value) => ({
|
|
1860
3443
|
...sectionStyleDefaults,
|
|
1861
3444
|
...value
|
|
@@ -1869,9 +3452,13 @@ var defaultNodeData = {
|
|
|
1869
3452
|
title: "Book a Time"
|
|
1870
3453
|
},
|
|
1871
3454
|
beforeAfter: withSectionStyleDefaults({
|
|
3455
|
+
itemsPerRow: 2,
|
|
1872
3456
|
items: [
|
|
1873
3457
|
{
|
|
1874
3458
|
description: "Before and after result summary.",
|
|
3459
|
+
imageCornerStyle: "rounded",
|
|
3460
|
+
imageFit: "cover",
|
|
3461
|
+
imagePosition: "center",
|
|
1875
3462
|
label: "Project One"
|
|
1876
3463
|
}
|
|
1877
3464
|
],
|
|
@@ -1894,10 +3481,11 @@ var defaultNodeData = {
|
|
|
1894
3481
|
},
|
|
1895
3482
|
featureGrid: {
|
|
1896
3483
|
...withSectionStyleDefaults({}),
|
|
3484
|
+
itemsPerRow: 3,
|
|
1897
3485
|
items: [
|
|
1898
|
-
{ description: "Explain this point.", icon: "01", title: "Feature One" },
|
|
1899
|
-
{ description: "Explain this point.", icon: "02", title: "Feature Two" },
|
|
1900
|
-
{ description: "Explain this point.", icon: "03", title: "Feature Three" }
|
|
3486
|
+
{ description: "Explain this point.", iconType: "badge", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
|
|
3487
|
+
{ description: "Explain this point.", iconType: "badge", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
|
|
3488
|
+
{ description: "Explain this point.", iconType: "badge", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
|
|
1901
3489
|
],
|
|
1902
3490
|
title: "Section Title",
|
|
1903
3491
|
variant: "cards"
|
|
@@ -1910,7 +3498,22 @@ var defaultNodeData = {
|
|
|
1910
3498
|
},
|
|
1911
3499
|
hero: {
|
|
1912
3500
|
...withSectionStyleDefaults({}),
|
|
1913
|
-
backgroundColor: "
|
|
3501
|
+
backgroundColor: "",
|
|
3502
|
+
backgroundOverlayMode: "none",
|
|
3503
|
+
backgroundOverlayOpacity: 45,
|
|
3504
|
+
backgroundOverlayColor: "#000000",
|
|
3505
|
+
backgroundOverlayGradientFrom: "#0d4a37",
|
|
3506
|
+
backgroundOverlayGradientTo: "#1f684f",
|
|
3507
|
+
backgroundOverlayGradientAngle: "135",
|
|
3508
|
+
backgroundOverlayGradientFromStrength: 100,
|
|
3509
|
+
backgroundOverlayGradientToStrength: 100,
|
|
3510
|
+
backgroundOverlayGradientStart: 0,
|
|
3511
|
+
backgroundOverlayGradientEnd: 100,
|
|
3512
|
+
backgroundOverlayGradientFeather: 100,
|
|
3513
|
+
backgroundImageCornerStyle: "rounded",
|
|
3514
|
+
backgroundImageFit: "cover",
|
|
3515
|
+
backgroundImagePosition: "center",
|
|
3516
|
+
heroHeight: "sm",
|
|
1914
3517
|
headline: "New Hero Section",
|
|
1915
3518
|
kicker: "Optional kicker",
|
|
1916
3519
|
primaryHref: "/contact",
|
|
@@ -1923,13 +3526,16 @@ var defaultNodeData = {
|
|
|
1923
3526
|
media: {
|
|
1924
3527
|
...withSectionStyleDefaults({}),
|
|
1925
3528
|
caption: "Add a caption",
|
|
3529
|
+
imageCornerStyle: "rounded",
|
|
3530
|
+
imageFit: "cover",
|
|
3531
|
+
imagePosition: "center",
|
|
1926
3532
|
size: "default"
|
|
1927
3533
|
},
|
|
1928
3534
|
logoWall: withSectionStyleDefaults({
|
|
1929
3535
|
items: [
|
|
1930
|
-
{ name: "Trusted Partner 1" },
|
|
1931
|
-
{ name: "Trusted Partner 2" },
|
|
1932
|
-
{ name: "Trusted Partner 3" }
|
|
3536
|
+
{ imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
|
|
3537
|
+
{ imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
|
|
3538
|
+
{ imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
|
|
1933
3539
|
],
|
|
1934
3540
|
subtitle: "Trusted by teams and homeowners across Central Texas.",
|
|
1935
3541
|
title: "Trusted by Local Organizations"
|
|
@@ -1970,8 +3576,11 @@ var defaultNodeData = {
|
|
|
1970
3576
|
},
|
|
1971
3577
|
testimonials: {
|
|
1972
3578
|
...withSectionStyleDefaults({}),
|
|
1973
|
-
|
|
1974
|
-
|
|
3579
|
+
autoRotate: true,
|
|
3580
|
+
items: [{ location: "City, ST", name: "Customer Name", quote: "Customer feedback goes here.", rating: 5 }],
|
|
3581
|
+
rotateIntervalSeconds: 7,
|
|
3582
|
+
title: "What Customers Say",
|
|
3583
|
+
visibleCount: 3
|
|
1975
3584
|
},
|
|
1976
3585
|
stats: withSectionStyleDefaults({
|
|
1977
3586
|
items: [
|
|
@@ -2001,7 +3610,11 @@ var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
|
|
|
2001
3610
|
type,
|
|
2002
3611
|
displayName: nodeTypeLabels[type] || type,
|
|
2003
3612
|
description: `Page node for ${nodeTypeLabels[type] || type}`,
|
|
2004
|
-
getDefaultData: () =>
|
|
3613
|
+
getDefaultData: () => {
|
|
3614
|
+
const migrated = migrateBlockToSettingsV2(structuredClone(defaultNodeData[type]));
|
|
3615
|
+
const { blockType: _ignoredBlockType, ...data } = migrated;
|
|
3616
|
+
return data;
|
|
3617
|
+
}
|
|
2005
3618
|
}));
|
|
2006
3619
|
var validatePageDocument = (document) => {
|
|
2007
3620
|
const issues = [];
|
|
@@ -2057,13 +3670,14 @@ var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
|
|
|
2057
3670
|
id: `${nodeType}-panel`,
|
|
2058
3671
|
label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
|
|
2059
3672
|
nodeType,
|
|
2060
|
-
fields: [
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
3673
|
+
fields: inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
|
|
3674
|
+
advanced: field.advanced,
|
|
3675
|
+
group: field.group,
|
|
3676
|
+
inlineEditable: field.inlineEditable,
|
|
3677
|
+
key: field.key,
|
|
3678
|
+
label: field.label,
|
|
3679
|
+
type: field.type
|
|
3680
|
+
})) || []
|
|
2067
3681
|
}));
|
|
2068
3682
|
var pageStudioModuleManifest = {
|
|
2069
3683
|
id: "studio-pages",
|
|
@@ -2075,11 +3689,16 @@ var pageStudioModuleManifest = {
|
|
|
2075
3689
|
validators: [validatePageDocument],
|
|
2076
3690
|
migrations: [],
|
|
2077
3691
|
compiler: {
|
|
2078
|
-
compileNode: (node) =>
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
3692
|
+
compileNode: (node) => {
|
|
3693
|
+
const normalized = migrateBlockToSettingsV2({
|
|
3694
|
+
blockType: node.type,
|
|
3695
|
+
...node.data
|
|
3696
|
+
});
|
|
3697
|
+
return {
|
|
3698
|
+
id: node.id,
|
|
3699
|
+
...normalized
|
|
3700
|
+
};
|
|
3701
|
+
}
|
|
2083
3702
|
},
|
|
2084
3703
|
permissions: [
|
|
2085
3704
|
{ action: "read", role: "admin" },
|
|
@@ -2099,9 +3718,10 @@ var ensureNodeID = (inputID, index) => {
|
|
|
2099
3718
|
return `node-${index + 1}`;
|
|
2100
3719
|
};
|
|
2101
3720
|
var layoutToStudioDocument = (layout, title, metadata) => {
|
|
2102
|
-
const nodes = layout.filter((block) => typeof block.blockType === "string").map((
|
|
3721
|
+
const nodes = layout.filter((block) => typeof block.blockType === "string").map((rawBlock, index) => {
|
|
3722
|
+
const block = migrateBlockToSettingsV2(rawBlock);
|
|
2103
3723
|
const blockType = String(block.blockType);
|
|
2104
|
-
const { id, blockType:
|
|
3724
|
+
const { id, blockType: _ignoredBlockType, ...data } = block;
|
|
2105
3725
|
return {
|
|
2106
3726
|
id: ensureNodeID(id, index),
|
|
2107
3727
|
type: blockType,
|
|
@@ -2116,11 +3736,13 @@ var layoutToStudioDocument = (layout, title, metadata) => {
|
|
|
2116
3736
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2117
3737
|
};
|
|
2118
3738
|
};
|
|
2119
|
-
var studioDocumentToLayout = (document) => document.nodes.map(
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
3739
|
+
var studioDocumentToLayout = (document) => document.nodes.map(
|
|
3740
|
+
(node) => migrateBlockToSettingsV2({
|
|
3741
|
+
id: node.id,
|
|
3742
|
+
blockType: node.type,
|
|
3743
|
+
...node.data
|
|
3744
|
+
})
|
|
3745
|
+
);
|
|
2124
3746
|
var createDefaultStudioDocument = (title) => ({
|
|
2125
3747
|
metadata: {},
|
|
2126
3748
|
schemaVersion: 1,
|
|
@@ -2128,6 +3750,224 @@ var createDefaultStudioDocument = (title) => ({
|
|
|
2128
3750
|
nodes: [],
|
|
2129
3751
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2130
3752
|
});
|
|
3753
|
+
|
|
3754
|
+
// src/nextjs/queries/pages.ts
|
|
3755
|
+
var PAGE_QUERY_CACHE_VERSION = "v4-published-only-public";
|
|
3756
|
+
function withStudioDocumentLayout(page) {
|
|
3757
|
+
if (!page) {
|
|
3758
|
+
return null;
|
|
3759
|
+
}
|
|
3760
|
+
try {
|
|
3761
|
+
const studioDocument = assertStudioDocumentV1(page.studioDocument);
|
|
3762
|
+
const compiledLayout = studioDocumentToLayout(studioDocument);
|
|
3763
|
+
if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
|
|
3764
|
+
return {
|
|
3765
|
+
...page,
|
|
3766
|
+
layout: compiledLayout
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3769
|
+
} catch {
|
|
3770
|
+
}
|
|
3771
|
+
return page;
|
|
3772
|
+
}
|
|
3773
|
+
function normalizePath(segments) {
|
|
3774
|
+
if (!segments || segments.length === 0) {
|
|
3775
|
+
return "/";
|
|
3776
|
+
}
|
|
3777
|
+
const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
|
|
3778
|
+
return cleaned.length > 0 ? `/${cleaned}` : "/";
|
|
3779
|
+
}
|
|
3780
|
+
async function queryPageByPath(payload, path2, draft) {
|
|
3781
|
+
const pathWhere = {
|
|
3782
|
+
path: {
|
|
3783
|
+
equals: path2
|
|
3784
|
+
}
|
|
3785
|
+
};
|
|
3786
|
+
const publishedWhere = {
|
|
3787
|
+
_status: {
|
|
3788
|
+
equals: "published"
|
|
3789
|
+
}
|
|
3790
|
+
};
|
|
3791
|
+
const result = await payload.find({
|
|
3792
|
+
collection: "pages",
|
|
3793
|
+
depth: 2,
|
|
3794
|
+
draft,
|
|
3795
|
+
limit: 1,
|
|
3796
|
+
overrideAccess: false,
|
|
3797
|
+
where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
|
|
3798
|
+
});
|
|
3799
|
+
if (result.docs.length > 0) {
|
|
3800
|
+
return withStudioDocumentLayout(result.docs[0] || null);
|
|
3801
|
+
}
|
|
3802
|
+
if (path2 === "/") {
|
|
3803
|
+
const homeWhere = {
|
|
3804
|
+
slug: {
|
|
3805
|
+
equals: "home"
|
|
3806
|
+
}
|
|
3807
|
+
};
|
|
3808
|
+
const homeResult = await payload.find({
|
|
3809
|
+
collection: "pages",
|
|
3810
|
+
depth: 2,
|
|
3811
|
+
draft,
|
|
3812
|
+
limit: 1,
|
|
3813
|
+
overrideAccess: false,
|
|
3814
|
+
where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
|
|
3815
|
+
});
|
|
3816
|
+
return withStudioDocumentLayout(homeResult.docs[0] || null);
|
|
3817
|
+
}
|
|
3818
|
+
return null;
|
|
3819
|
+
}
|
|
3820
|
+
function createPageQueries(getPayloadClient, contentTag = "website-content") {
|
|
3821
|
+
const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
|
|
3822
|
+
async (path2) => {
|
|
3823
|
+
const payload = await getPayloadClient();
|
|
3824
|
+
return queryPageByPath(payload, path2, false);
|
|
3825
|
+
},
|
|
3826
|
+
["page-by-path", PAGE_QUERY_CACHE_VERSION],
|
|
3827
|
+
{ tags: [contentTag] }
|
|
3828
|
+
);
|
|
3829
|
+
async function getPageBySegments(segments, draft = false) {
|
|
3830
|
+
const path2 = normalizePath(segments);
|
|
3831
|
+
const payload = await getPayloadClient();
|
|
3832
|
+
if (draft) {
|
|
3833
|
+
return queryPageByPath(payload, path2, true);
|
|
3834
|
+
}
|
|
3835
|
+
return getPublishedPageByPathCached(path2);
|
|
3836
|
+
}
|
|
3837
|
+
async function listPublishedPagePaths() {
|
|
3838
|
+
const payload = await getPayloadClient();
|
|
3839
|
+
const pages = await payload.find({
|
|
3840
|
+
collection: "pages",
|
|
3841
|
+
depth: 0,
|
|
3842
|
+
draft: false,
|
|
3843
|
+
limit: 1e3,
|
|
3844
|
+
pagination: false,
|
|
3845
|
+
overrideAccess: false,
|
|
3846
|
+
where: {
|
|
3847
|
+
_status: {
|
|
3848
|
+
equals: "published"
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
});
|
|
3852
|
+
return pages.docs.map((doc) => doc.path).filter((path2) => typeof path2 === "string" && path2.length > 0);
|
|
3853
|
+
}
|
|
3854
|
+
function pathToSegments(path2) {
|
|
3855
|
+
if (!path2 || path2 === "/") {
|
|
3856
|
+
return [];
|
|
3857
|
+
}
|
|
3858
|
+
return path2.split("/").filter(Boolean);
|
|
3859
|
+
}
|
|
3860
|
+
return {
|
|
3861
|
+
getPageBySegments,
|
|
3862
|
+
listPublishedPagePaths,
|
|
3863
|
+
pathToSegments
|
|
3864
|
+
};
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
// src/nextjs/queries/site.ts
|
|
3868
|
+
var import_cache2 = require("next/cache");
|
|
3869
|
+
function createSiteQueries(getPayloadClient, contentTag = "website-content") {
|
|
3870
|
+
const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
|
|
3871
|
+
async () => {
|
|
3872
|
+
const payload = await getPayloadClient();
|
|
3873
|
+
const settings = await payload.findGlobal({
|
|
3874
|
+
slug: "site-settings",
|
|
3875
|
+
depth: 1
|
|
3876
|
+
});
|
|
3877
|
+
return settings;
|
|
3878
|
+
},
|
|
3879
|
+
["site-settings-global"],
|
|
3880
|
+
{ tags: [contentTag] }
|
|
3881
|
+
);
|
|
3882
|
+
const getHeaderCached = (0, import_cache2.unstable_cache)(
|
|
3883
|
+
async () => {
|
|
3884
|
+
const payload = await getPayloadClient();
|
|
3885
|
+
const header = await payload.findGlobal({
|
|
3886
|
+
slug: "header",
|
|
3887
|
+
depth: 1
|
|
3888
|
+
});
|
|
3889
|
+
return header;
|
|
3890
|
+
},
|
|
3891
|
+
["header-global"],
|
|
3892
|
+
{ tags: [contentTag] }
|
|
3893
|
+
);
|
|
3894
|
+
const getFooterCached = (0, import_cache2.unstable_cache)(
|
|
3895
|
+
async () => {
|
|
3896
|
+
const payload = await getPayloadClient();
|
|
3897
|
+
const footer = await payload.findGlobal({
|
|
3898
|
+
slug: "footer",
|
|
3899
|
+
depth: 1
|
|
3900
|
+
});
|
|
3901
|
+
return footer;
|
|
3902
|
+
},
|
|
3903
|
+
["footer-global"],
|
|
3904
|
+
{ tags: [contentTag] }
|
|
3905
|
+
);
|
|
3906
|
+
async function getSiteSettings(draft = false) {
|
|
3907
|
+
if (draft) {
|
|
3908
|
+
const payload = await getPayloadClient();
|
|
3909
|
+
const settings = await payload.findGlobal({
|
|
3910
|
+
slug: "site-settings",
|
|
3911
|
+
depth: 1,
|
|
3912
|
+
draft: true
|
|
3913
|
+
});
|
|
3914
|
+
return settings;
|
|
3915
|
+
}
|
|
3916
|
+
return getSiteSettingsCached();
|
|
3917
|
+
}
|
|
3918
|
+
async function getHeader(draft = false) {
|
|
3919
|
+
if (draft) {
|
|
3920
|
+
const payload = await getPayloadClient();
|
|
3921
|
+
const header = await payload.findGlobal({
|
|
3922
|
+
slug: "header",
|
|
3923
|
+
depth: 1,
|
|
3924
|
+
draft: true
|
|
3925
|
+
});
|
|
3926
|
+
return header;
|
|
3927
|
+
}
|
|
3928
|
+
return getHeaderCached();
|
|
3929
|
+
}
|
|
3930
|
+
async function getFooter(draft = false) {
|
|
3931
|
+
if (draft) {
|
|
3932
|
+
const payload = await getPayloadClient();
|
|
3933
|
+
const footer = await payload.findGlobal({
|
|
3934
|
+
slug: "footer",
|
|
3935
|
+
depth: 1,
|
|
3936
|
+
draft: true
|
|
3937
|
+
});
|
|
3938
|
+
return footer;
|
|
3939
|
+
}
|
|
3940
|
+
return getFooterCached();
|
|
3941
|
+
}
|
|
3942
|
+
return {
|
|
3943
|
+
getSiteSettings,
|
|
3944
|
+
getHeader,
|
|
3945
|
+
getFooter
|
|
3946
|
+
};
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
// src/nextjs/utilities/media.ts
|
|
3950
|
+
function resolveMedia(media) {
|
|
3951
|
+
if (!media) {
|
|
3952
|
+
return null;
|
|
3953
|
+
}
|
|
3954
|
+
if (typeof media === "number" || typeof media === "string") {
|
|
3955
|
+
return null;
|
|
3956
|
+
}
|
|
3957
|
+
if (media.url) {
|
|
3958
|
+
return {
|
|
3959
|
+
url: media.url,
|
|
3960
|
+
alt: media.alt || ""
|
|
3961
|
+
};
|
|
3962
|
+
}
|
|
3963
|
+
if (media.filename) {
|
|
3964
|
+
return {
|
|
3965
|
+
url: `/media/${media.filename}`,
|
|
3966
|
+
alt: media.alt || ""
|
|
3967
|
+
};
|
|
3968
|
+
}
|
|
3969
|
+
return null;
|
|
3970
|
+
}
|
|
2131
3971
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2132
3972
|
0 && (module.exports = {
|
|
2133
3973
|
admin,
|