@orion-studios/payload-studio 0.5.0-beta.2 → 0.5.0-beta.21

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.
@@ -231,6 +231,36 @@ var BeforeAfterBlock = {
231
231
  relationTo: "media",
232
232
  required: false
233
233
  },
234
+ {
235
+ name: "imageFit",
236
+ type: "select",
237
+ defaultValue: "cover",
238
+ options: [
239
+ { label: "Cover", value: "cover" },
240
+ { label: "Contain", value: "contain" }
241
+ ]
242
+ },
243
+ {
244
+ name: "imageCornerStyle",
245
+ type: "select",
246
+ defaultValue: "rounded",
247
+ options: [
248
+ { label: "Rounded", value: "rounded" },
249
+ { label: "Square", value: "square" }
250
+ ]
251
+ },
252
+ {
253
+ name: "imagePosition",
254
+ type: "select",
255
+ defaultValue: "center",
256
+ options: [
257
+ { label: "Center", value: "center" },
258
+ { label: "Top", value: "top" },
259
+ { label: "Bottom", value: "bottom" },
260
+ { label: "Left", value: "left" },
261
+ { label: "Right", value: "right" }
262
+ ]
263
+ },
234
264
  {
235
265
  name: "description",
236
266
  type: "textarea"
@@ -428,6 +458,36 @@ var FeatureGridBlock = {
428
458
  type: "upload",
429
459
  relationTo: "media",
430
460
  required: false
461
+ },
462
+ {
463
+ name: "imageFit",
464
+ type: "select",
465
+ defaultValue: "cover",
466
+ options: [
467
+ { label: "Cover", value: "cover" },
468
+ { label: "Contain", value: "contain" }
469
+ ]
470
+ },
471
+ {
472
+ name: "imageCornerStyle",
473
+ type: "select",
474
+ defaultValue: "rounded",
475
+ options: [
476
+ { label: "Rounded", value: "rounded" },
477
+ { label: "Square", value: "square" }
478
+ ]
479
+ },
480
+ {
481
+ name: "imagePosition",
482
+ type: "select",
483
+ defaultValue: "center",
484
+ options: [
485
+ { label: "Center", value: "center" },
486
+ { label: "Top", value: "top" },
487
+ { label: "Bottom", value: "bottom" },
488
+ { label: "Left", value: "left" },
489
+ { label: "Right", value: "right" }
490
+ ]
431
491
  }
432
492
  ]
433
493
  },
@@ -554,10 +614,44 @@ var HeroBlock = {
554
614
  relationTo: "media"
555
615
  },
556
616
  {
557
- name: "backgroundImageURL",
558
- type: "text",
617
+ name: "backgroundImageFit",
618
+ type: "select",
619
+ defaultValue: "cover",
620
+ options: [
621
+ { label: "Cover", value: "cover" },
622
+ { label: "Cover (Square)", value: "cover-square" },
623
+ { label: "Contain", value: "contain" },
624
+ { label: "Contain (Square)", value: "contain-square" }
625
+ ],
626
+ admin: {
627
+ description: "How the hero image should be sized within the section."
628
+ }
629
+ },
630
+ {
631
+ name: "backgroundImageCornerStyle",
632
+ type: "select",
633
+ defaultValue: "rounded",
634
+ options: [
635
+ { label: "Rounded", value: "rounded" },
636
+ { label: "Square", value: "square" }
637
+ ],
638
+ admin: {
639
+ description: "How the hero image corners should appear."
640
+ }
641
+ },
642
+ {
643
+ name: "backgroundImagePosition",
644
+ type: "select",
645
+ defaultValue: "center",
646
+ options: [
647
+ { label: "Center", value: "center" },
648
+ { label: "Top", value: "top" },
649
+ { label: "Bottom", value: "bottom" },
650
+ { label: "Left", value: "left" },
651
+ { label: "Right", value: "right" }
652
+ ],
559
653
  admin: {
560
- description: "Optional external/background image URL override for this hero section."
654
+ description: "Where the hero image should anchor inside the section."
561
655
  }
562
656
  },
563
657
  {
@@ -627,6 +721,36 @@ var LogoWallBlock = {
627
721
  relationTo: "media",
628
722
  required: false
629
723
  },
724
+ {
725
+ name: "imageFit",
726
+ type: "select",
727
+ defaultValue: "contain",
728
+ options: [
729
+ { label: "Cover", value: "cover" },
730
+ { label: "Contain", value: "contain" }
731
+ ]
732
+ },
733
+ {
734
+ name: "imageCornerStyle",
735
+ type: "select",
736
+ defaultValue: "rounded",
737
+ options: [
738
+ { label: "Rounded", value: "rounded" },
739
+ { label: "Square", value: "square" }
740
+ ]
741
+ },
742
+ {
743
+ name: "imagePosition",
744
+ type: "select",
745
+ defaultValue: "center",
746
+ options: [
747
+ { label: "Center", value: "center" },
748
+ { label: "Top", value: "top" },
749
+ { label: "Bottom", value: "bottom" },
750
+ { label: "Left", value: "left" },
751
+ { label: "Right", value: "right" }
752
+ ]
753
+ },
630
754
  {
631
755
  name: "href",
632
756
  type: "text"
@@ -677,6 +801,36 @@ var MediaBlock = {
677
801
  }
678
802
  ]
679
803
  },
804
+ {
805
+ name: "imageFit",
806
+ type: "select",
807
+ defaultValue: "cover",
808
+ options: [
809
+ { label: "Cover", value: "cover" },
810
+ { label: "Contain", value: "contain" }
811
+ ]
812
+ },
813
+ {
814
+ name: "imageCornerStyle",
815
+ type: "select",
816
+ defaultValue: "rounded",
817
+ options: [
818
+ { label: "Rounded", value: "rounded" },
819
+ { label: "Square", value: "square" }
820
+ ]
821
+ },
822
+ {
823
+ name: "imagePosition",
824
+ type: "select",
825
+ defaultValue: "center",
826
+ options: [
827
+ { label: "Center", value: "center" },
828
+ { label: "Top", value: "top" },
829
+ { label: "Bottom", value: "bottom" },
830
+ { label: "Left", value: "left" },
831
+ { label: "Right", value: "right" }
832
+ ]
833
+ },
680
834
  ...sectionStyleFields()
681
835
  ]
682
836
  };
@@ -17,7 +17,7 @@ import {
17
17
  defaultPageLayoutBlocks,
18
18
  sectionPresets,
19
19
  templateStarterPresets
20
- } from "../chunk-PC5622T7.mjs";
20
+ } from "../chunk-IBZVI3JP.mjs";
21
21
  import "../chunk-ETRRXURT.mjs";
22
22
  import "../chunk-6BWS3CLP.mjs";
23
23
  export {
@@ -1,3 +1,9 @@
1
+ import {
2
+ assertStudioDocumentV1
3
+ } from "./chunk-N67KVM2S.mjs";
4
+ import {
5
+ studioDocumentToLayout
6
+ } from "./chunk-D4S5OA4U.mjs";
1
7
  import {
2
8
  __export
3
9
  } from "./chunk-6BWS3CLP.mjs";
@@ -27,6 +33,24 @@ function createPayloadClient(config) {
27
33
 
28
34
  // src/nextjs/queries/pages.ts
29
35
  import { unstable_cache } from "next/cache";
36
+ var PAGE_QUERY_CACHE_VERSION = "v2-studio-layout-published-only";
37
+ function withStudioDocumentLayout(page) {
38
+ if (!page) {
39
+ return null;
40
+ }
41
+ try {
42
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
43
+ const compiledLayout = studioDocumentToLayout(studioDocument);
44
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
45
+ return {
46
+ ...page,
47
+ layout: compiledLayout
48
+ };
49
+ }
50
+ } catch {
51
+ }
52
+ return page;
53
+ }
30
54
  function normalizePath(segments) {
31
55
  if (!segments || segments.length === 0) {
32
56
  return "/";
@@ -35,35 +59,42 @@ function normalizePath(segments) {
35
59
  return cleaned.length > 0 ? `/${cleaned}` : "/";
36
60
  }
37
61
  async function queryPageByPath(payload, path, draft) {
62
+ const pathWhere = {
63
+ path: {
64
+ equals: path
65
+ }
66
+ };
67
+ const publishedWhere = {
68
+ _status: {
69
+ equals: "published"
70
+ }
71
+ };
38
72
  const result = await payload.find({
39
73
  collection: "pages",
40
74
  depth: 2,
41
75
  draft,
42
76
  limit: 1,
43
77
  overrideAccess: false,
44
- where: {
45
- path: {
46
- equals: path
47
- }
48
- }
78
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
49
79
  });
50
80
  if (result.docs.length > 0) {
51
- return result.docs[0] || null;
81
+ return withStudioDocumentLayout(result.docs[0] || null);
52
82
  }
53
83
  if (path === "/") {
84
+ const homeWhere = {
85
+ slug: {
86
+ equals: "home"
87
+ }
88
+ };
54
89
  const homeResult = await payload.find({
55
90
  collection: "pages",
56
91
  depth: 2,
57
92
  draft,
58
93
  limit: 1,
59
94
  overrideAccess: false,
60
- where: {
61
- slug: {
62
- equals: "home"
63
- }
64
- }
95
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
65
96
  });
66
- return homeResult.docs[0] || null;
97
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
67
98
  }
68
99
  return null;
69
100
  }
@@ -73,7 +104,7 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
73
104
  const payload = await getPayloadClient();
74
105
  return queryPageByPath(payload, path, false);
75
106
  },
76
- ["page-by-path"],
107
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
77
108
  { tags: [contentTag] }
78
109
  );
79
110
  async function getPageBySegments(segments, draft = false) {
@@ -32,6 +32,9 @@ var defaultNodeData = {
32
32
  items: [
33
33
  {
34
34
  description: "Before and after result summary.",
35
+ imageCornerStyle: "rounded",
36
+ imageFit: "cover",
37
+ imagePosition: "center",
35
38
  label: "Project One"
36
39
  }
37
40
  ],
@@ -55,9 +58,9 @@ var defaultNodeData = {
55
58
  featureGrid: {
56
59
  ...withSectionStyleDefaults({}),
57
60
  items: [
58
- { description: "Explain this point.", icon: "01", title: "Feature One" },
59
- { description: "Explain this point.", icon: "02", title: "Feature Two" },
60
- { description: "Explain this point.", icon: "03", title: "Feature Three" }
61
+ { description: "Explain this point.", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
62
+ { description: "Explain this point.", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
63
+ { description: "Explain this point.", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
61
64
  ],
62
65
  title: "Section Title",
63
66
  variant: "cards"
@@ -70,7 +73,10 @@ var defaultNodeData = {
70
73
  },
71
74
  hero: {
72
75
  ...withSectionStyleDefaults({}),
73
- backgroundColor: "#124a37",
76
+ backgroundColor: "",
77
+ backgroundImageCornerStyle: "rounded",
78
+ backgroundImageFit: "cover",
79
+ backgroundImagePosition: "center",
74
80
  headline: "New Hero Section",
75
81
  kicker: "Optional kicker",
76
82
  primaryHref: "/contact",
@@ -83,13 +89,16 @@ var defaultNodeData = {
83
89
  media: {
84
90
  ...withSectionStyleDefaults({}),
85
91
  caption: "Add a caption",
92
+ imageCornerStyle: "rounded",
93
+ imageFit: "cover",
94
+ imagePosition: "center",
86
95
  size: "default"
87
96
  },
88
97
  logoWall: withSectionStyleDefaults({
89
98
  items: [
90
- { name: "Trusted Partner 1" },
91
- { name: "Trusted Partner 2" },
92
- { name: "Trusted Partner 3" }
99
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
100
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
101
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
93
102
  ],
94
103
  subtitle: "Trusted by teams and homeowners across Central Texas.",
95
104
  title: "Trusted by Local Organizations"
@@ -81,6 +81,36 @@ var BeforeAfterBlock = {
81
81
  relationTo: "media",
82
82
  required: false
83
83
  },
84
+ {
85
+ name: "imageFit",
86
+ type: "select",
87
+ defaultValue: "cover",
88
+ options: [
89
+ { label: "Cover", value: "cover" },
90
+ { label: "Contain", value: "contain" }
91
+ ]
92
+ },
93
+ {
94
+ name: "imageCornerStyle",
95
+ type: "select",
96
+ defaultValue: "rounded",
97
+ options: [
98
+ { label: "Rounded", value: "rounded" },
99
+ { label: "Square", value: "square" }
100
+ ]
101
+ },
102
+ {
103
+ name: "imagePosition",
104
+ type: "select",
105
+ defaultValue: "center",
106
+ options: [
107
+ { label: "Center", value: "center" },
108
+ { label: "Top", value: "top" },
109
+ { label: "Bottom", value: "bottom" },
110
+ { label: "Left", value: "left" },
111
+ { label: "Right", value: "right" }
112
+ ]
113
+ },
84
114
  {
85
115
  name: "description",
86
116
  type: "textarea"
@@ -278,6 +308,36 @@ var FeatureGridBlock = {
278
308
  type: "upload",
279
309
  relationTo: "media",
280
310
  required: false
311
+ },
312
+ {
313
+ name: "imageFit",
314
+ type: "select",
315
+ defaultValue: "cover",
316
+ options: [
317
+ { label: "Cover", value: "cover" },
318
+ { label: "Contain", value: "contain" }
319
+ ]
320
+ },
321
+ {
322
+ name: "imageCornerStyle",
323
+ type: "select",
324
+ defaultValue: "rounded",
325
+ options: [
326
+ { label: "Rounded", value: "rounded" },
327
+ { label: "Square", value: "square" }
328
+ ]
329
+ },
330
+ {
331
+ name: "imagePosition",
332
+ type: "select",
333
+ defaultValue: "center",
334
+ options: [
335
+ { label: "Center", value: "center" },
336
+ { label: "Top", value: "top" },
337
+ { label: "Bottom", value: "bottom" },
338
+ { label: "Left", value: "left" },
339
+ { label: "Right", value: "right" }
340
+ ]
281
341
  }
282
342
  ]
283
343
  },
@@ -404,10 +464,44 @@ var HeroBlock = {
404
464
  relationTo: "media"
405
465
  },
406
466
  {
407
- name: "backgroundImageURL",
408
- type: "text",
467
+ name: "backgroundImageFit",
468
+ type: "select",
469
+ defaultValue: "cover",
470
+ options: [
471
+ { label: "Cover", value: "cover" },
472
+ { label: "Cover (Square)", value: "cover-square" },
473
+ { label: "Contain", value: "contain" },
474
+ { label: "Contain (Square)", value: "contain-square" }
475
+ ],
476
+ admin: {
477
+ description: "How the hero image should be sized within the section."
478
+ }
479
+ },
480
+ {
481
+ name: "backgroundImageCornerStyle",
482
+ type: "select",
483
+ defaultValue: "rounded",
484
+ options: [
485
+ { label: "Rounded", value: "rounded" },
486
+ { label: "Square", value: "square" }
487
+ ],
488
+ admin: {
489
+ description: "How the hero image corners should appear."
490
+ }
491
+ },
492
+ {
493
+ name: "backgroundImagePosition",
494
+ type: "select",
495
+ defaultValue: "center",
496
+ options: [
497
+ { label: "Center", value: "center" },
498
+ { label: "Top", value: "top" },
499
+ { label: "Bottom", value: "bottom" },
500
+ { label: "Left", value: "left" },
501
+ { label: "Right", value: "right" }
502
+ ],
409
503
  admin: {
410
- description: "Optional external/background image URL override for this hero section."
504
+ description: "Where the hero image should anchor inside the section."
411
505
  }
412
506
  },
413
507
  {
@@ -477,6 +571,36 @@ var LogoWallBlock = {
477
571
  relationTo: "media",
478
572
  required: false
479
573
  },
574
+ {
575
+ name: "imageFit",
576
+ type: "select",
577
+ defaultValue: "contain",
578
+ options: [
579
+ { label: "Cover", value: "cover" },
580
+ { label: "Contain", value: "contain" }
581
+ ]
582
+ },
583
+ {
584
+ name: "imageCornerStyle",
585
+ type: "select",
586
+ defaultValue: "rounded",
587
+ options: [
588
+ { label: "Rounded", value: "rounded" },
589
+ { label: "Square", value: "square" }
590
+ ]
591
+ },
592
+ {
593
+ name: "imagePosition",
594
+ type: "select",
595
+ defaultValue: "center",
596
+ options: [
597
+ { label: "Center", value: "center" },
598
+ { label: "Top", value: "top" },
599
+ { label: "Bottom", value: "bottom" },
600
+ { label: "Left", value: "left" },
601
+ { label: "Right", value: "right" }
602
+ ]
603
+ },
480
604
  {
481
605
  name: "href",
482
606
  type: "text"
@@ -527,6 +651,36 @@ var MediaBlock = {
527
651
  }
528
652
  ]
529
653
  },
654
+ {
655
+ name: "imageFit",
656
+ type: "select",
657
+ defaultValue: "cover",
658
+ options: [
659
+ { label: "Cover", value: "cover" },
660
+ { label: "Contain", value: "contain" }
661
+ ]
662
+ },
663
+ {
664
+ name: "imageCornerStyle",
665
+ type: "select",
666
+ defaultValue: "rounded",
667
+ options: [
668
+ { label: "Rounded", value: "rounded" },
669
+ { label: "Square", value: "square" }
670
+ ]
671
+ },
672
+ {
673
+ name: "imagePosition",
674
+ type: "select",
675
+ defaultValue: "center",
676
+ options: [
677
+ { label: "Center", value: "center" },
678
+ { label: "Top", value: "top" },
679
+ { label: "Bottom", value: "bottom" },
680
+ { label: "Left", value: "left" },
681
+ { label: "Right", value: "right" }
682
+ ]
683
+ },
530
684
  ...sectionStyleFields()
531
685
  ]
532
686
  };