@orion-studios/payload-studio 0.5.0-beta.3 → 0.5.0-beta.30

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.
Files changed (46) hide show
  1. package/dist/admin/client.js +68 -7
  2. package/dist/admin/client.mjs +68 -7
  3. package/dist/admin/index.d.mts +1 -1
  4. package/dist/admin/index.d.ts +1 -1
  5. package/dist/admin/index.js +37 -0
  6. package/dist/admin/index.mjs +3 -1
  7. package/dist/admin-app/client.d.mts +4 -0
  8. package/dist/admin-app/client.d.ts +4 -0
  9. package/dist/admin-app/client.js +705 -2
  10. package/dist/admin-app/client.mjs +701 -1
  11. package/dist/admin-app/index.d.mts +1 -1
  12. package/dist/admin-app/index.d.ts +1 -1
  13. package/dist/admin-app/index.js +167 -0
  14. package/dist/admin-app/index.mjs +13 -1
  15. package/dist/admin-app/styles.css +127 -0
  16. package/dist/blocks/index.js +193 -3
  17. package/dist/blocks/index.mjs +2 -2
  18. package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
  19. package/dist/{chunk-ZLLNO5FM.mjs → chunk-GPQPDEB5.mjs} +44 -13
  20. package/dist/{chunk-PC5622T7.mjs → chunk-H7DSTEVT.mjs} +180 -4
  21. package/dist/{chunk-UJFU323N.mjs → chunk-QW24Y4UH.mjs} +18 -8
  22. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  23. package/dist/chunk-XVH5SCBD.mjs +234 -0
  24. package/dist/index-BBvk9b9i.d.mts +97 -0
  25. package/dist/index-BBvk9b9i.d.ts +97 -0
  26. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
  27. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
  28. package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
  29. package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +674 -250
  33. package/dist/index.mjs +11 -11
  34. package/dist/nextjs/index.d.mts +1 -1
  35. package/dist/nextjs/index.d.ts +1 -1
  36. package/dist/nextjs/index.js +276 -13
  37. package/dist/nextjs/index.mjs +4 -1
  38. package/dist/studio-pages/builder.css +25 -1
  39. package/dist/studio-pages/client.js +2063 -1118
  40. package/dist/studio-pages/client.mjs +2063 -1118
  41. package/dist/studio-pages/index.js +18 -7
  42. package/dist/studio-pages/index.mjs +2 -2
  43. package/package.json +2 -2
  44. package/dist/chunk-AAOHJDNS.mjs +0 -67
  45. package/dist/index-BallJs-K.d.mts +0 -43
  46. package/dist/index-BallJs-K.d.ts +0 -43
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
@@ -306,12 +307,53 @@ function addTooltipToField(field, tooltips) {
306
307
  return field;
307
308
  }
308
309
 
310
+ // src/admin/fields/headerNav.ts
311
+ var createHeaderNavItemsField = () => ({
312
+ name: "navItems",
313
+ type: "array",
314
+ labels: { singular: "Navigation Link", plural: "Navigation Links" },
315
+ admin: {
316
+ description: "The links displayed in your website's main navigation menu."
317
+ },
318
+ fields: [
319
+ {
320
+ name: "label",
321
+ type: "text",
322
+ required: true,
323
+ admin: {
324
+ description: "The text shown for this navigation link."
325
+ }
326
+ },
327
+ {
328
+ name: "href",
329
+ type: "text",
330
+ required: true,
331
+ admin: {
332
+ description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
333
+ }
334
+ },
335
+ {
336
+ name: "parentHref",
337
+ type: "text",
338
+ admin: {
339
+ description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
340
+ }
341
+ }
342
+ ]
343
+ });
344
+
309
345
  // src/admin-app/index.ts
310
346
  var admin_app_exports = {};
311
347
  __export(admin_app_exports, {
312
348
  AdminBreadcrumbs: () => AdminBreadcrumbs,
313
349
  AdminPage: () => AdminPage,
350
+ buildAdminPageLinkOptions: () => buildAdminPageLinkOptions,
351
+ buildNestedNavTree: () => buildNestedNavTree,
352
+ getAdminNavRows: () => getAdminNavRows,
314
353
  navItemIsActive: () => navItemIsActive,
354
+ normalizeAdminNavInputs: () => normalizeAdminNavInputs,
355
+ normalizeNestedNavItems: () => normalizeNestedNavItems,
356
+ parseAdminHeaderNavFromForm: () => parseAdminHeaderNavFromForm,
315
357
  roleCanAccessNav: () => roleCanAccessNav
316
358
  });
317
359
 
@@ -345,6 +387,161 @@ function AdminPage({ title, description, breadcrumbs, actions, children }) {
345
387
  ] });
346
388
  }
347
389
 
390
+ // src/admin-app/nestedNavigation.ts
391
+ var normalizeNestedNavItems = (items) => {
392
+ const deduped = [];
393
+ const seen = /* @__PURE__ */ new Set();
394
+ for (const item of items) {
395
+ const href = typeof item.href === "string" ? item.href.trim() : "";
396
+ const label = typeof item.label === "string" ? item.label.trim() : "";
397
+ const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
398
+ if (!href || !label || seen.has(href)) {
399
+ continue;
400
+ }
401
+ seen.add(href);
402
+ deduped.push({
403
+ href,
404
+ label,
405
+ ...parentHref ? { parentHref } : {}
406
+ });
407
+ }
408
+ const hrefs = new Set(deduped.map((item) => item.href));
409
+ return deduped.map((item) => ({
410
+ href: item.href,
411
+ label: item.label,
412
+ ...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
413
+ }));
414
+ };
415
+ var buildNestedNavTree = (items) => {
416
+ const childrenByParent = /* @__PURE__ */ new Map();
417
+ const topLevel = [];
418
+ for (const item of items) {
419
+ if (!item.parentHref) {
420
+ topLevel.push(item);
421
+ continue;
422
+ }
423
+ const children = childrenByParent.get(item.parentHref) || [];
424
+ children.push(item);
425
+ childrenByParent.set(item.parentHref, children);
426
+ }
427
+ if (topLevel.length === 0 && items.length > 0) {
428
+ return {
429
+ topLevel: items.map((item) => ({ href: item.href, label: item.label })),
430
+ childrenByParent: /* @__PURE__ */ new Map()
431
+ };
432
+ }
433
+ return { childrenByParent, topLevel };
434
+ };
435
+
436
+ // src/admin-app/navigationLinks.ts
437
+ var fallbackHomeOption = {
438
+ href: "/",
439
+ label: "Home",
440
+ title: "Home"
441
+ };
442
+ var buildAdminPageLinkOptions = (pages) => {
443
+ const options = pages.map((page) => {
444
+ const href = typeof page.path === "string" ? page.path.trim() : "";
445
+ const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
446
+ if (!href) {
447
+ return null;
448
+ }
449
+ const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
450
+ const indentLevel = Math.max(depth - 1, 0);
451
+ const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
452
+ return {
453
+ href,
454
+ label: `${indent}${title}`,
455
+ title
456
+ };
457
+ }).filter((option) => option !== null).sort((a, b) => {
458
+ if (a.href === "/" && b.href !== "/") return -1;
459
+ if (b.href === "/" && a.href !== "/") return 1;
460
+ return a.href.localeCompare(b.href);
461
+ });
462
+ if (options.length === 0) {
463
+ return [fallbackHomeOption];
464
+ }
465
+ return options;
466
+ };
467
+ var getAdminNavRows = (navItems, pageOptions, minRows = 6, maxRows = 20) => {
468
+ const preferredRows = Math.max(navItems.length + 2, Math.min(8, pageOptions.length));
469
+ return Math.min(Math.max(minRows, preferredRows), maxRows);
470
+ };
471
+ var normalizeAdminNavInputs = (rows, pageOptions) => {
472
+ const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
473
+ const deduped = [];
474
+ const seen = /* @__PURE__ */ new Set();
475
+ for (const row of rows) {
476
+ const href = typeof row.href === "string" ? row.href.trim() : "";
477
+ const defaultLabel = allowedLinks.get(href);
478
+ const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
479
+ const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
480
+ if (!href || !defaultLabel || seen.has(href)) {
481
+ continue;
482
+ }
483
+ seen.add(href);
484
+ deduped.push({
485
+ href,
486
+ label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
487
+ ...parentHref.length > 0 ? { parentHref } : {}
488
+ });
489
+ }
490
+ const hrefs = new Set(deduped.map((item) => item.href));
491
+ const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
492
+ const createsCycle = (href, parentHref) => {
493
+ const visited = /* @__PURE__ */ new Set([href]);
494
+ let current = parentHref;
495
+ while (current) {
496
+ if (visited.has(current)) {
497
+ return true;
498
+ }
499
+ visited.add(current);
500
+ current = parentByHref.get(current) || "";
501
+ }
502
+ return false;
503
+ };
504
+ return deduped.map((item) => {
505
+ const parentHref = item.parentHref;
506
+ if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
507
+ return {
508
+ href: item.href,
509
+ label: item.label
510
+ };
511
+ }
512
+ return item;
513
+ });
514
+ };
515
+ var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
516
+ const serialized = String(formData.get("navItemsState") || "").trim();
517
+ if (serialized.length > 0) {
518
+ try {
519
+ const parsed = JSON.parse(serialized);
520
+ if (Array.isArray(parsed)) {
521
+ return normalizeAdminNavInputs(parsed.slice(0, maxRows), pageOptions);
522
+ }
523
+ } catch {
524
+ }
525
+ }
526
+ const rawCount = Number(String(formData.get("navCount") || "0"));
527
+ const navCount = Number.isFinite(rawCount) ? Math.max(0, Math.min(rawCount, maxRows)) : 0;
528
+ const navRows = [];
529
+ for (let index = 0; index < navCount; index += 1) {
530
+ const href = String(formData.get(`navPage_${index}`) || "").trim();
531
+ const label = String(formData.get(`navLabel_${index}`) || "").trim();
532
+ const parentHref = String(formData.get(`navParentHref_${index}`) || "").trim();
533
+ navRows.push({
534
+ href,
535
+ label,
536
+ parentHref
537
+ });
538
+ }
539
+ if (navRows.length > 0) {
540
+ return normalizeAdminNavInputs(navRows, pageOptions);
541
+ }
542
+ return [];
543
+ };
544
+
348
545
  // src/admin-app/routeRegistry.ts
349
546
  var roleCanAccessNav = (role, item) => {
350
547
  if (!item.roles || item.roles.length === 0) {
@@ -400,6 +597,7 @@ var sectionStyleDefaults = {
400
597
  contentGradientPreset: "none",
401
598
  contentGradientTo: "#f4f6f2",
402
599
  contentWidth: "inherit",
600
+ sectionPaddingX: "inherit",
403
601
  sectionBackgroundColor: "#ffffff",
404
602
  sectionBackgroundMode: "none",
405
603
  sectionGradientAngle: "135",
@@ -437,6 +635,19 @@ var sectionStyleFields = () => [
437
635
  type: "select",
438
636
  defaultValue: sectionStyleDefaults.sectionPaddingY,
439
637
  options: [
638
+ { label: "None", value: "none" },
639
+ { label: "Small", value: "sm" },
640
+ { label: "Medium", value: "md" },
641
+ { label: "Large", value: "lg" }
642
+ ]
643
+ },
644
+ {
645
+ name: "sectionPaddingX",
646
+ type: "select",
647
+ defaultValue: sectionStyleDefaults.sectionPaddingX,
648
+ options: [
649
+ { label: "Inherit", value: "inherit" },
650
+ { label: "None", value: "none" },
440
651
  { label: "Small", value: "sm" },
441
652
  { label: "Medium", value: "md" },
442
653
  { label: "Large", value: "lg" }
@@ -575,6 +786,36 @@ var BeforeAfterBlock = {
575
786
  relationTo: "media",
576
787
  required: false
577
788
  },
789
+ {
790
+ name: "imageFit",
791
+ type: "select",
792
+ defaultValue: "cover",
793
+ options: [
794
+ { label: "Cover", value: "cover" },
795
+ { label: "Contain", value: "contain" }
796
+ ]
797
+ },
798
+ {
799
+ name: "imageCornerStyle",
800
+ type: "select",
801
+ defaultValue: "rounded",
802
+ options: [
803
+ { label: "Rounded", value: "rounded" },
804
+ { label: "Square", value: "square" }
805
+ ]
806
+ },
807
+ {
808
+ name: "imagePosition",
809
+ type: "select",
810
+ defaultValue: "center",
811
+ options: [
812
+ { label: "Center", value: "center" },
813
+ { label: "Top", value: "top" },
814
+ { label: "Bottom", value: "bottom" },
815
+ { label: "Left", value: "left" },
816
+ { label: "Right", value: "right" }
817
+ ]
818
+ },
578
819
  {
579
820
  name: "description",
580
821
  type: "textarea"
@@ -772,6 +1013,36 @@ var FeatureGridBlock = {
772
1013
  type: "upload",
773
1014
  relationTo: "media",
774
1015
  required: false
1016
+ },
1017
+ {
1018
+ name: "imageFit",
1019
+ type: "select",
1020
+ defaultValue: "cover",
1021
+ options: [
1022
+ { label: "Cover", value: "cover" },
1023
+ { label: "Contain", value: "contain" }
1024
+ ]
1025
+ },
1026
+ {
1027
+ name: "imageCornerStyle",
1028
+ type: "select",
1029
+ defaultValue: "rounded",
1030
+ options: [
1031
+ { label: "Rounded", value: "rounded" },
1032
+ { label: "Square", value: "square" }
1033
+ ]
1034
+ },
1035
+ {
1036
+ name: "imagePosition",
1037
+ type: "select",
1038
+ defaultValue: "center",
1039
+ options: [
1040
+ { label: "Center", value: "center" },
1041
+ { label: "Top", value: "top" },
1042
+ { label: "Bottom", value: "bottom" },
1043
+ { label: "Left", value: "left" },
1044
+ { label: "Right", value: "right" }
1045
+ ]
775
1046
  }
776
1047
  ]
777
1048
  },
@@ -898,10 +1169,44 @@ var HeroBlock = {
898
1169
  relationTo: "media"
899
1170
  },
900
1171
  {
901
- name: "backgroundImageURL",
902
- type: "text",
1172
+ name: "backgroundImageFit",
1173
+ type: "select",
1174
+ defaultValue: "cover",
1175
+ options: [
1176
+ { label: "Cover", value: "cover" },
1177
+ { label: "Cover (Square)", value: "cover-square" },
1178
+ { label: "Contain", value: "contain" },
1179
+ { label: "Contain (Square)", value: "contain-square" }
1180
+ ],
1181
+ admin: {
1182
+ description: "How the hero image should be sized within the section."
1183
+ }
1184
+ },
1185
+ {
1186
+ name: "backgroundImageCornerStyle",
1187
+ type: "select",
1188
+ defaultValue: "rounded",
1189
+ options: [
1190
+ { label: "Rounded", value: "rounded" },
1191
+ { label: "Square", value: "square" }
1192
+ ],
903
1193
  admin: {
904
- description: "Optional external/background image URL override for this hero section."
1194
+ description: "How the hero image corners should appear."
1195
+ }
1196
+ },
1197
+ {
1198
+ name: "backgroundImagePosition",
1199
+ type: "select",
1200
+ defaultValue: "center",
1201
+ options: [
1202
+ { label: "Center", value: "center" },
1203
+ { label: "Top", value: "top" },
1204
+ { label: "Bottom", value: "bottom" },
1205
+ { label: "Left", value: "left" },
1206
+ { label: "Right", value: "right" }
1207
+ ],
1208
+ admin: {
1209
+ description: "Where the hero image should anchor inside the section."
905
1210
  }
906
1211
  },
907
1212
  {
@@ -926,6 +1231,28 @@ var HeroBlock = {
926
1231
  }
927
1232
  ]
928
1233
  },
1234
+ {
1235
+ name: "heroHeight",
1236
+ type: "select",
1237
+ defaultValue: "sm",
1238
+ options: [
1239
+ {
1240
+ label: "Small",
1241
+ value: "sm"
1242
+ },
1243
+ {
1244
+ label: "Medium (Half Screen)",
1245
+ value: "md"
1246
+ },
1247
+ {
1248
+ label: "Full Screen",
1249
+ value: "full"
1250
+ }
1251
+ ],
1252
+ admin: {
1253
+ description: "Controls the vertical height of the hero section."
1254
+ }
1255
+ },
929
1256
  ...sectionStyleFields()
930
1257
  ]
931
1258
  };
@@ -971,6 +1298,36 @@ var LogoWallBlock = {
971
1298
  relationTo: "media",
972
1299
  required: false
973
1300
  },
1301
+ {
1302
+ name: "imageFit",
1303
+ type: "select",
1304
+ defaultValue: "contain",
1305
+ options: [
1306
+ { label: "Cover", value: "cover" },
1307
+ { label: "Contain", value: "contain" }
1308
+ ]
1309
+ },
1310
+ {
1311
+ name: "imageCornerStyle",
1312
+ type: "select",
1313
+ defaultValue: "rounded",
1314
+ options: [
1315
+ { label: "Rounded", value: "rounded" },
1316
+ { label: "Square", value: "square" }
1317
+ ]
1318
+ },
1319
+ {
1320
+ name: "imagePosition",
1321
+ type: "select",
1322
+ defaultValue: "center",
1323
+ options: [
1324
+ { label: "Center", value: "center" },
1325
+ { label: "Top", value: "top" },
1326
+ { label: "Bottom", value: "bottom" },
1327
+ { label: "Left", value: "left" },
1328
+ { label: "Right", value: "right" }
1329
+ ]
1330
+ },
974
1331
  {
975
1332
  name: "href",
976
1333
  type: "text"
@@ -1021,6 +1378,36 @@ var MediaBlock = {
1021
1378
  }
1022
1379
  ]
1023
1380
  },
1381
+ {
1382
+ name: "imageFit",
1383
+ type: "select",
1384
+ defaultValue: "cover",
1385
+ options: [
1386
+ { label: "Cover", value: "cover" },
1387
+ { label: "Contain", value: "contain" }
1388
+ ]
1389
+ },
1390
+ {
1391
+ name: "imageCornerStyle",
1392
+ type: "select",
1393
+ defaultValue: "rounded",
1394
+ options: [
1395
+ { label: "Rounded", value: "rounded" },
1396
+ { label: "Square", value: "square" }
1397
+ ]
1398
+ },
1399
+ {
1400
+ name: "imagePosition",
1401
+ type: "select",
1402
+ defaultValue: "center",
1403
+ options: [
1404
+ { label: "Center", value: "center" },
1405
+ { label: "Top", value: "top" },
1406
+ { label: "Bottom", value: "bottom" },
1407
+ { label: "Left", value: "left" },
1408
+ { label: "Right", value: "right" }
1409
+ ]
1410
+ },
1024
1411
  ...sectionStyleFields()
1025
1412
  ]
1026
1413
  };
@@ -1510,251 +1897,60 @@ function createPayloadClient(config) {
1510
1897
 
1511
1898
  // src/nextjs/queries/pages.ts
1512
1899
  var import_cache = require("next/cache");
1513
- function normalizePath(segments) {
1514
- if (!segments || segments.length === 0) {
1515
- return "/";
1900
+
1901
+ // src/studio/index.ts
1902
+ var studio_exports = {};
1903
+ __export(studio_exports, {
1904
+ assertStudioDocumentV1: () => assertStudioDocumentV1,
1905
+ compileStudioDocument: () => compileStudioDocument,
1906
+ createEmptyStudioDocument: () => createEmptyStudioDocument,
1907
+ createStudioRegistry: () => createStudioRegistry,
1908
+ migrateStudioDocument: () => migrateStudioDocument,
1909
+ validateStudioDocument: () => validateStudioDocument
1910
+ });
1911
+ var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
1912
+ var makeIssue = (message, path2, code = "studio.invalid") => ({
1913
+ code,
1914
+ message,
1915
+ path: path2,
1916
+ severity: "error"
1917
+ });
1918
+ var createEmptyStudioDocument = (title) => ({
1919
+ metadata: {},
1920
+ schemaVersion: 1,
1921
+ title,
1922
+ nodes: [],
1923
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1924
+ });
1925
+ function assertStudioDocumentV1(input) {
1926
+ if (!isRecord(input)) {
1927
+ throw new Error("Studio document must be an object");
1516
1928
  }
1517
- const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
1518
- return cleaned.length > 0 ? `/${cleaned}` : "/";
1519
- }
1520
- async function queryPageByPath(payload, path2, draft) {
1521
- const result = await payload.find({
1522
- collection: "pages",
1523
- depth: 2,
1524
- draft,
1525
- limit: 1,
1526
- overrideAccess: false,
1527
- where: {
1528
- path: {
1529
- equals: path2
1530
- }
1531
- }
1532
- });
1533
- if (result.docs.length > 0) {
1534
- return result.docs[0] || null;
1929
+ if (input.schemaVersion !== 1) {
1930
+ throw new Error("Unsupported studio schemaVersion");
1535
1931
  }
1536
- if (path2 === "/") {
1537
- const homeResult = await payload.find({
1538
- collection: "pages",
1539
- depth: 2,
1540
- draft,
1541
- limit: 1,
1542
- overrideAccess: false,
1543
- where: {
1544
- slug: {
1545
- equals: "home"
1546
- }
1547
- }
1548
- });
1549
- return homeResult.docs[0] || null;
1932
+ if (!Array.isArray(input.nodes)) {
1933
+ throw new Error("Studio document nodes must be an array");
1550
1934
  }
1551
- return null;
1552
- }
1553
- function createPageQueries(getPayloadClient, contentTag = "website-content") {
1554
- const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
1555
- async (path2) => {
1556
- const payload = await getPayloadClient();
1557
- return queryPageByPath(payload, path2, false);
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);
1935
+ const nodes = input.nodes.map((node, index) => {
1936
+ if (!isRecord(node)) {
1937
+ throw new Error(`Node at index ${index} must be an object`);
1567
1938
  }
1568
- return getPublishedPageByPathCached(path2);
1569
- }
1570
- async function listPublishedPagePaths() {
1571
- const payload = await getPayloadClient();
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);
1586
- }
1587
- function pathToSegments(path2) {
1588
- if (!path2 || path2 === "/") {
1589
- return [];
1939
+ if (typeof node.id !== "string" || node.id.length === 0) {
1940
+ throw new Error(`Node at index ${index} has invalid id`);
1590
1941
  }
1591
- return path2.split("/").filter(Boolean);
1592
- }
1593
- return {
1594
- getPageBySegments,
1595
- listPublishedPagePaths,
1596
- pathToSegments
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
- });
1942
+ if (typeof node.type !== "string" || node.type.length === 0) {
1943
+ throw new Error(`Node at index ${index} has invalid type`);
1944
+ }
1945
+ if (!isRecord(node.data)) {
1946
+ throw new Error(`Node at index ${index} has invalid data`);
1947
+ }
1948
+ return {
1949
+ id: node.id,
1950
+ type: node.type,
1951
+ data: node.data
1952
+ };
1953
+ });
1758
1954
  return {
1759
1955
  metadata: isRecord(input.metadata) ? input.metadata : void 0,
1760
1956
  schemaVersion: 1,
@@ -1872,6 +2068,9 @@ var defaultNodeData = {
1872
2068
  items: [
1873
2069
  {
1874
2070
  description: "Before and after result summary.",
2071
+ imageCornerStyle: "rounded",
2072
+ imageFit: "cover",
2073
+ imagePosition: "center",
1875
2074
  label: "Project One"
1876
2075
  }
1877
2076
  ],
@@ -1895,9 +2094,9 @@ var defaultNodeData = {
1895
2094
  featureGrid: {
1896
2095
  ...withSectionStyleDefaults({}),
1897
2096
  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" }
2097
+ { description: "Explain this point.", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
2098
+ { description: "Explain this point.", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
2099
+ { description: "Explain this point.", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
1901
2100
  ],
1902
2101
  title: "Section Title",
1903
2102
  variant: "cards"
@@ -1910,7 +2109,11 @@ var defaultNodeData = {
1910
2109
  },
1911
2110
  hero: {
1912
2111
  ...withSectionStyleDefaults({}),
1913
- backgroundColor: "#124a37",
2112
+ backgroundColor: "",
2113
+ backgroundImageCornerStyle: "rounded",
2114
+ backgroundImageFit: "cover",
2115
+ backgroundImagePosition: "center",
2116
+ heroHeight: "sm",
1914
2117
  headline: "New Hero Section",
1915
2118
  kicker: "Optional kicker",
1916
2119
  primaryHref: "/contact",
@@ -1923,13 +2126,16 @@ var defaultNodeData = {
1923
2126
  media: {
1924
2127
  ...withSectionStyleDefaults({}),
1925
2128
  caption: "Add a caption",
2129
+ imageCornerStyle: "rounded",
2130
+ imageFit: "cover",
2131
+ imagePosition: "center",
1926
2132
  size: "default"
1927
2133
  },
1928
2134
  logoWall: withSectionStyleDefaults({
1929
2135
  items: [
1930
- { name: "Trusted Partner 1" },
1931
- { name: "Trusted Partner 2" },
1932
- { name: "Trusted Partner 3" }
2136
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
2137
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
2138
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
1933
2139
  ],
1934
2140
  subtitle: "Trusted by teams and homeowners across Central Texas.",
1935
2141
  title: "Trusted by Local Organizations"
@@ -2128,6 +2334,224 @@ var createDefaultStudioDocument = (title) => ({
2128
2334
  nodes: [],
2129
2335
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2130
2336
  });
2337
+
2338
+ // src/nextjs/queries/pages.ts
2339
+ var PAGE_QUERY_CACHE_VERSION = "v2-studio-layout-published-only";
2340
+ function withStudioDocumentLayout(page) {
2341
+ if (!page) {
2342
+ return null;
2343
+ }
2344
+ try {
2345
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
2346
+ const compiledLayout = studioDocumentToLayout(studioDocument);
2347
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
2348
+ return {
2349
+ ...page,
2350
+ layout: compiledLayout
2351
+ };
2352
+ }
2353
+ } catch {
2354
+ }
2355
+ return page;
2356
+ }
2357
+ function normalizePath(segments) {
2358
+ if (!segments || segments.length === 0) {
2359
+ return "/";
2360
+ }
2361
+ const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
2362
+ return cleaned.length > 0 ? `/${cleaned}` : "/";
2363
+ }
2364
+ async function queryPageByPath(payload, path2, draft) {
2365
+ const pathWhere = {
2366
+ path: {
2367
+ equals: path2
2368
+ }
2369
+ };
2370
+ const publishedWhere = {
2371
+ _status: {
2372
+ equals: "published"
2373
+ }
2374
+ };
2375
+ const result = await payload.find({
2376
+ collection: "pages",
2377
+ depth: 2,
2378
+ draft,
2379
+ limit: 1,
2380
+ overrideAccess: false,
2381
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
2382
+ });
2383
+ if (result.docs.length > 0) {
2384
+ return withStudioDocumentLayout(result.docs[0] || null);
2385
+ }
2386
+ if (path2 === "/") {
2387
+ const homeWhere = {
2388
+ slug: {
2389
+ equals: "home"
2390
+ }
2391
+ };
2392
+ const homeResult = await payload.find({
2393
+ collection: "pages",
2394
+ depth: 2,
2395
+ draft,
2396
+ limit: 1,
2397
+ overrideAccess: false,
2398
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
2399
+ });
2400
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
2401
+ }
2402
+ return null;
2403
+ }
2404
+ function createPageQueries(getPayloadClient, contentTag = "website-content") {
2405
+ const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
2406
+ async (path2) => {
2407
+ const payload = await getPayloadClient();
2408
+ return queryPageByPath(payload, path2, false);
2409
+ },
2410
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
2411
+ { tags: [contentTag] }
2412
+ );
2413
+ async function getPageBySegments(segments, draft = false) {
2414
+ const path2 = normalizePath(segments);
2415
+ const payload = await getPayloadClient();
2416
+ if (draft) {
2417
+ return queryPageByPath(payload, path2, true);
2418
+ }
2419
+ return getPublishedPageByPathCached(path2);
2420
+ }
2421
+ async function listPublishedPagePaths() {
2422
+ const payload = await getPayloadClient();
2423
+ const pages = await payload.find({
2424
+ collection: "pages",
2425
+ depth: 0,
2426
+ draft: false,
2427
+ limit: 1e3,
2428
+ pagination: false,
2429
+ overrideAccess: false,
2430
+ where: {
2431
+ _status: {
2432
+ equals: "published"
2433
+ }
2434
+ }
2435
+ });
2436
+ return pages.docs.map((doc) => doc.path).filter((path2) => typeof path2 === "string" && path2.length > 0);
2437
+ }
2438
+ function pathToSegments(path2) {
2439
+ if (!path2 || path2 === "/") {
2440
+ return [];
2441
+ }
2442
+ return path2.split("/").filter(Boolean);
2443
+ }
2444
+ return {
2445
+ getPageBySegments,
2446
+ listPublishedPagePaths,
2447
+ pathToSegments
2448
+ };
2449
+ }
2450
+
2451
+ // src/nextjs/queries/site.ts
2452
+ var import_cache2 = require("next/cache");
2453
+ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
2454
+ const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
2455
+ async () => {
2456
+ const payload = await getPayloadClient();
2457
+ const settings = await payload.findGlobal({
2458
+ slug: "site-settings",
2459
+ depth: 1
2460
+ });
2461
+ return settings;
2462
+ },
2463
+ ["site-settings-global"],
2464
+ { tags: [contentTag] }
2465
+ );
2466
+ const getHeaderCached = (0, import_cache2.unstable_cache)(
2467
+ async () => {
2468
+ const payload = await getPayloadClient();
2469
+ const header = await payload.findGlobal({
2470
+ slug: "header",
2471
+ depth: 1
2472
+ });
2473
+ return header;
2474
+ },
2475
+ ["header-global"],
2476
+ { tags: [contentTag] }
2477
+ );
2478
+ const getFooterCached = (0, import_cache2.unstable_cache)(
2479
+ async () => {
2480
+ const payload = await getPayloadClient();
2481
+ const footer = await payload.findGlobal({
2482
+ slug: "footer",
2483
+ depth: 1
2484
+ });
2485
+ return footer;
2486
+ },
2487
+ ["footer-global"],
2488
+ { tags: [contentTag] }
2489
+ );
2490
+ async function getSiteSettings(draft = false) {
2491
+ if (draft) {
2492
+ const payload = await getPayloadClient();
2493
+ const settings = await payload.findGlobal({
2494
+ slug: "site-settings",
2495
+ depth: 1,
2496
+ draft: true
2497
+ });
2498
+ return settings;
2499
+ }
2500
+ return getSiteSettingsCached();
2501
+ }
2502
+ async function getHeader(draft = false) {
2503
+ if (draft) {
2504
+ const payload = await getPayloadClient();
2505
+ const header = await payload.findGlobal({
2506
+ slug: "header",
2507
+ depth: 1,
2508
+ draft: true
2509
+ });
2510
+ return header;
2511
+ }
2512
+ return getHeaderCached();
2513
+ }
2514
+ async function getFooter(draft = false) {
2515
+ if (draft) {
2516
+ const payload = await getPayloadClient();
2517
+ const footer = await payload.findGlobal({
2518
+ slug: "footer",
2519
+ depth: 1,
2520
+ draft: true
2521
+ });
2522
+ return footer;
2523
+ }
2524
+ return getFooterCached();
2525
+ }
2526
+ return {
2527
+ getSiteSettings,
2528
+ getHeader,
2529
+ getFooter
2530
+ };
2531
+ }
2532
+
2533
+ // src/nextjs/utilities/media.ts
2534
+ function resolveMedia(media) {
2535
+ if (!media) {
2536
+ return null;
2537
+ }
2538
+ if (typeof media === "number" || typeof media === "string") {
2539
+ return null;
2540
+ }
2541
+ if (media.url) {
2542
+ return {
2543
+ url: media.url,
2544
+ alt: media.alt || ""
2545
+ };
2546
+ }
2547
+ if (media.filename) {
2548
+ return {
2549
+ url: `/media/${media.filename}`,
2550
+ alt: media.alt || ""
2551
+ };
2552
+ }
2553
+ return null;
2554
+ }
2131
2555
  // Annotate the CommonJS export names for ESM import in node:
2132
2556
  0 && (module.exports = {
2133
2557
  admin,