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

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 (62) hide show
  1. package/README.md +58 -68
  2. package/dist/admin/client.d.mts +6 -0
  3. package/dist/admin/client.d.ts +6 -0
  4. package/dist/admin/client.js +4533 -799
  5. package/dist/admin/client.mjs +3349 -756
  6. package/dist/admin/index.d.mts +2 -1
  7. package/dist/admin/index.d.ts +2 -1
  8. package/dist/admin/index.js +386 -55
  9. package/dist/admin/index.mjs +2 -1
  10. package/dist/admin-app/client.d.mts +1 -0
  11. package/dist/admin-app/client.d.ts +1 -0
  12. package/dist/admin-app/client.js +285 -109
  13. package/dist/admin-app/client.mjs +59 -871
  14. package/dist/admin-app/index.d.mts +2 -1
  15. package/dist/admin-app/index.d.ts +2 -1
  16. package/dist/admin-app/index.mjs +5 -3
  17. package/dist/admin-app/styles.css +1767 -56
  18. package/dist/admin.css +158 -35
  19. package/dist/blocks/index.js +415 -200
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
  22. package/dist/chunk-KPIX7OSV.mjs +1051 -0
  23. package/dist/chunk-OQSEJXC4.mjs +166 -0
  24. package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
  25. package/dist/chunk-PF3EBZXF.mjs +326 -0
  26. package/dist/{chunk-74XFAVXU.mjs → chunk-QJAWO6K3.mjs} +377 -55
  27. package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
  28. package/dist/chunk-W2UOCJDX.mjs +32 -0
  29. package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
  30. package/dist/{index-ZbOx4OCF.d.mts → index-52HdVLQq.d.ts} +12 -22
  31. package/dist/index-B6_D4Hm4.d.ts +439 -0
  32. package/dist/index-CYaWadBl.d.mts +439 -0
  33. package/dist/index-Crx_MtPw.d.ts +223 -0
  34. package/dist/index-Cv-6qnrw.d.mts +223 -0
  35. package/dist/{index-ZbOx4OCF.d.ts → index-DEQC3Dwj.d.mts} +12 -22
  36. package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
  37. package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
  38. package/dist/index.d.mts +5 -4
  39. package/dist/index.d.ts +5 -4
  40. package/dist/index.js +1858 -1202
  41. package/dist/index.mjs +10 -8
  42. package/dist/nextjs/index.js +5 -684
  43. package/dist/nextjs/index.mjs +2 -3
  44. package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
  45. package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
  46. package/dist/studio/index.d.mts +1 -1
  47. package/dist/studio/index.d.ts +1 -1
  48. package/dist/studio-pages/builder.css +125 -83
  49. package/dist/studio-pages/client.d.mts +58 -1
  50. package/dist/studio-pages/client.d.ts +58 -1
  51. package/dist/studio-pages/client.js +450 -241
  52. package/dist/studio-pages/client.mjs +455 -247
  53. package/dist/studio-pages/index.d.mts +3 -2
  54. package/dist/studio-pages/index.d.ts +3 -2
  55. package/dist/studio-pages/index.js +418 -183
  56. package/dist/studio-pages/index.mjs +15 -6
  57. package/package.json +10 -4
  58. package/dist/chunk-SIL2J5MF.mjs +0 -155
  59. package/dist/index-BnoqmQDP.d.mts +0 -219
  60. package/dist/index-CTpik6fR.d.ts +0 -219
  61. package/dist/index-R7hA134j.d.mts +0 -140
  62. package/dist/index-vjrjy0P4.d.ts +0 -140
@@ -1,3 +1,6 @@
1
+ import {
2
+ adminNavIcons
3
+ } from "./chunk-W2UOCJDX.mjs";
1
4
  import {
2
5
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
3
6
  SOCIAL_MEDIA_ICON_OPTIONS,
@@ -51,6 +54,7 @@ var themePreferenceField = createThemePreferenceField("brand-light");
51
54
 
52
55
  // src/shared/studioSections.ts
53
56
  var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
57
+ var studioIcons = new Set(adminNavIcons);
54
58
  var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
55
59
  var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
56
60
  var normalizePathLikeValue = (value) => {
@@ -91,6 +95,7 @@ var normalizeCard = (value) => {
91
95
  ...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
92
96
  };
93
97
  };
98
+ var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
94
99
  var resolveStudioSections = (value) => {
95
100
  if (!Array.isArray(value)) {
96
101
  return [];
@@ -116,6 +121,7 @@ var resolveStudioSections = (value) => {
116
121
  label,
117
122
  href,
118
123
  matchPrefixes,
124
+ ...normalizeIcon(entry.icon) ? { icon: normalizeIcon(entry.icon) } : {},
119
125
  ...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
120
126
  ...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
121
127
  });
@@ -180,17 +186,28 @@ function configureAdmin(config) {
180
186
  brandPrimary = "#3b82f6",
181
187
  brandSecondary = "#8b5cf6",
182
188
  defaultTheme = "brand-light",
183
- logoUrl
189
+ logoUrl,
190
+ allowThemePreference = false
184
191
  } = config;
185
192
  const studioEnabled = config.studio?.enabled ?? true;
193
+ const formsEnabled = config.studio?.forms?.enabled ?? false;
194
+ const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
195
+ const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
196
+ const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
186
197
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
198
+ const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
187
199
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
188
- const contactFormStudioPath = "/studio-contact-form";
200
+ const globalsBasePath = "/site-globals";
201
+ const pagesBasePath = "/pages";
202
+ const formsBasePath = "/forms";
203
+ const mediaBasePath = "/media";
204
+ const toolsBasePath = "/tools";
205
+ const contactFormStudioPath = "/contact-form";
189
206
  const configuredGlobals = config.studio?.globals || [
190
207
  { slug: "site-settings", label: "Website Settings" },
191
208
  { slug: "header", label: "Header & Navigation" },
192
209
  { slug: "footer", label: "Footer" },
193
- { slug: "contact-form", label: "Contact Form" }
210
+ { slug: "social-media", label: "Social Media" }
194
211
  ];
195
212
  const globals = configuredGlobals.map((global) => {
196
213
  if (global.slug !== "contact-form" || global.href) {
@@ -203,24 +220,78 @@ function configureAdmin(config) {
203
220
  });
204
221
  const studioSections = resolveStudioSections(config.studio?.sections || []);
205
222
  const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
223
+ const sitePreview = config.studio?.sitePreview;
206
224
  let cssPath;
207
225
  const pkgDist = getPkgDistDir();
208
226
  const sourceCssPath = path.resolve(pkgDist, "admin.css");
209
- if (config.basePath && fs.existsSync(sourceCssPath)) {
210
- let css = fs.readFileSync(sourceCssPath, "utf-8");
211
- css = css.replace("--brand-primary: #3b82f6;", `--brand-primary: ${brandPrimary};`);
212
- css = css.replace("--brand-secondary: #8b5cf6;", `--brand-secondary: ${brandSecondary};`);
213
- const genDir = path.resolve(config.basePath, ".generated");
227
+ const adminAppCssPath = path.resolve(pkgDist, "admin-app", "styles.css");
228
+ const cssSources = [sourceCssPath, adminAppCssPath].filter((filePath) => fs.existsSync(filePath));
229
+ if (cssSources.length === 0) {
230
+ cssPath = sourceCssPath;
231
+ } else {
232
+ let css = cssSources.map((filePath) => fs.readFileSync(filePath, "utf-8")).join("\n\n");
233
+ css = css.replace(
234
+ "--orion-cms-brand-primary-fallback: #3b82f6;",
235
+ `--orion-cms-brand-primary-fallback: ${brandPrimary};`
236
+ );
237
+ css = css.replace(
238
+ "--orion-cms-brand-secondary-fallback: #8b5cf6;",
239
+ `--orion-cms-brand-secondary-fallback: ${brandSecondary};`
240
+ );
241
+ const outputBasePath = config.basePath || process.cwd();
242
+ const genDir = path.resolve(outputBasePath, ".generated");
214
243
  if (!fs.existsSync(genDir)) {
215
244
  fs.mkdirSync(genDir, { recursive: true });
216
245
  }
217
246
  const genPath = path.resolve(genDir, "admin.css");
218
247
  fs.writeFileSync(genPath, css);
219
248
  cssPath = genPath;
220
- } else {
221
- cssPath = sourceCssPath;
222
249
  }
223
250
  const clientPath = "@orion-studios/payload-studio/admin/client";
251
+ const studioNavClientProps = {
252
+ brandName,
253
+ formSubmissionsCollectionSlug,
254
+ formsCollectionSlug,
255
+ formsEnabled,
256
+ formUploadsCollectionSlug,
257
+ globalsBasePath,
258
+ globalsExtraMatchPrefixes: [contactFormStudioPath],
259
+ logoUrl,
260
+ mediaCollectionSlug,
261
+ pagesCollectionSlug,
262
+ sections: studioSections
263
+ };
264
+ const studioBackBreadcrumbComponent = {
265
+ exportName: "StudioBackBreadcrumb",
266
+ path: clientPath
267
+ };
268
+ const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
269
+ (item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
270
+ );
271
+ const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
272
+ const attachStudioBackBreadcrumbToCollection = (collection) => {
273
+ if (!studioEnabled) {
274
+ return collection;
275
+ }
276
+ const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
277
+ return {
278
+ ...collection,
279
+ admin: {
280
+ ...collection.admin,
281
+ components: {
282
+ ...collection.admin?.components,
283
+ edit: {
284
+ ...collection.admin?.components?.edit,
285
+ beforeDocumentControls: appendComponent(
286
+ existingBeforeDocumentControls,
287
+ studioBackBreadcrumbComponent,
288
+ "StudioBackBreadcrumb"
289
+ )
290
+ }
291
+ }
292
+ }
293
+ };
294
+ };
224
295
  return {
225
296
  admin: {
226
297
  css: cssPath,
@@ -229,15 +300,7 @@ function configureAdmin(config) {
229
300
  Nav: {
230
301
  exportName: "AdminStudioNav",
231
302
  path: clientPath,
232
- clientProps: {
233
- brandName,
234
- logoUrl,
235
- globalsBasePath: "/studio-globals",
236
- globalsExtraMatchPrefixes: [contactFormStudioPath],
237
- mediaCollectionSlug,
238
- pagesCollectionSlug,
239
- sections: studioSections
240
- }
303
+ clientProps: studioNavClientProps
241
304
  }
242
305
  } : {},
243
306
  graphics: {
@@ -263,37 +326,113 @@ function configureAdmin(config) {
263
326
  Component: {
264
327
  exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
265
328
  path: clientPath,
266
- clientProps: {
267
- brandName,
268
- logoUrl,
269
- globalsBasePath: "/studio-globals",
270
- globalsExtraMatchPrefixes: [contactFormStudioPath],
271
- mediaCollectionSlug,
272
- pagesCollectionSlug,
273
- sections: studioSections
274
- }
329
+ clientProps: studioNavClientProps
275
330
  }
276
331
  },
277
332
  ...studioEnabled ? {
278
333
  studioGlobals: {
279
- path: "/studio-globals",
334
+ path: globalsBasePath,
280
335
  Component: {
281
336
  exportName: "AdminStudioGlobalsView",
282
337
  path: clientPath,
283
338
  clientProps: {
339
+ ...studioNavClientProps,
284
340
  globals,
285
- globalsBasePath: "/studio-globals"
341
+ globalsBasePath
342
+ }
343
+ }
344
+ },
345
+ studioPages: {
346
+ path: pagesBasePath,
347
+ Component: {
348
+ exportName: "AdminStudioPagesListView",
349
+ path: clientPath,
350
+ clientProps: {
351
+ ...studioNavClientProps,
352
+ pagesCollectionSlug
353
+ }
354
+ }
355
+ },
356
+ studioPageEditor: {
357
+ path: `${pagesBasePath}/:id`,
358
+ Component: {
359
+ exportName: "AdminStudioPageEditView",
360
+ path: clientPath,
361
+ clientProps: {
362
+ ...studioNavClientProps,
363
+ builderBasePath
364
+ }
365
+ }
366
+ },
367
+ studioPageNew: {
368
+ path: `${pagesBasePath}/new`,
369
+ Component: {
370
+ exportName: "AdminStudioNewPageView",
371
+ path: clientPath,
372
+ clientProps: {
373
+ ...studioNavClientProps,
374
+ pagesCollectionSlug
286
375
  }
287
376
  }
288
377
  },
289
378
  studioContactForm: {
290
- path: "/studio-contact-form",
379
+ path: contactFormStudioPath,
291
380
  Component: {
292
381
  exportName: "AdminStudioContactFormView",
293
382
  path: clientPath,
294
383
  clientProps: {
384
+ ...studioNavClientProps,
295
385
  globalSlug: "contact-form",
296
- globalsBasePath: "/studio-globals"
386
+ globalsBasePath
387
+ }
388
+ }
389
+ },
390
+ ...formsEnabled ? {
391
+ studioForms: {
392
+ path: formsBasePath,
393
+ Component: {
394
+ exportName: "AdminStudioFormsView",
395
+ path: clientPath,
396
+ clientProps: {
397
+ ...studioNavClientProps,
398
+ formsCollectionSlug,
399
+ formSubmissionsCollectionSlug,
400
+ formUploadsCollectionSlug
401
+ }
402
+ }
403
+ }
404
+ } : {},
405
+ studioMedia: {
406
+ path: mediaBasePath,
407
+ Component: {
408
+ exportName: "AdminStudioMediaView",
409
+ path: clientPath,
410
+ clientProps: {
411
+ ...studioNavClientProps,
412
+ mediaCollectionSlug
413
+ }
414
+ }
415
+ },
416
+ studioMediaItem: {
417
+ path: `${mediaBasePath}/:id`,
418
+ Component: {
419
+ exportName: "AdminStudioMediaItemView",
420
+ path: clientPath,
421
+ clientProps: {
422
+ ...studioNavClientProps,
423
+ mediaCollectionSlug
424
+ }
425
+ }
426
+ },
427
+ studioTools: {
428
+ path: toolsBasePath,
429
+ Component: {
430
+ exportName: "AdminStudioToolsView",
431
+ path: clientPath,
432
+ clientProps: {
433
+ ...studioNavClientProps,
434
+ mediaCollectionSlug,
435
+ pagesCollectionSlug
297
436
  }
298
437
  }
299
438
  },
@@ -302,7 +441,13 @@ function configureAdmin(config) {
302
441
  id,
303
442
  {
304
443
  path: view.path,
305
- Component: view.Component
444
+ Component: {
445
+ ...view.Component,
446
+ clientProps: {
447
+ ...studioNavClientProps,
448
+ ...view.Component.clientProps || {}
449
+ }
450
+ }
306
451
  }
307
452
  ])
308
453
  )
@@ -313,19 +458,39 @@ function configureAdmin(config) {
313
458
  exportName: "ThemeProvider",
314
459
  path: clientPath,
315
460
  clientProps: {
461
+ allowThemePreference,
316
462
  defaultTheme
317
463
  }
318
464
  }
319
465
  ],
320
- afterNavLinks: [
466
+ beforeLogin: [
321
467
  {
322
- exportName: "ThemeSwitcher",
468
+ exportName: "AdminLoginIntro",
323
469
  path: clientPath,
324
470
  clientProps: {
325
- defaultTheme
471
+ brandName,
472
+ logoUrl
326
473
  }
327
474
  }
328
- ]
475
+ ],
476
+ afterLogin: [
477
+ {
478
+ exportName: "AdminLoginPasswordToggle",
479
+ path: clientPath
480
+ }
481
+ ],
482
+ ...allowThemePreference ? {
483
+ afterNavLinks: [
484
+ {
485
+ exportName: "ThemeSwitcher",
486
+ path: clientPath,
487
+ clientProps: {
488
+ allowThemePreference,
489
+ defaultTheme
490
+ }
491
+ }
492
+ ]
493
+ } : {}
329
494
  },
330
495
  meta: {
331
496
  titleSuffix: ` \u2014 ${brandName}`
@@ -340,10 +505,76 @@ function configureAdmin(config) {
340
505
  const hasThemePreference = existingFields.some(
341
506
  (field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
342
507
  );
343
- return {
508
+ const nextCollection = {
344
509
  ...usersCollection,
345
- fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
510
+ fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
346
511
  };
512
+ return attachStudioBackBreadcrumbToCollection(nextCollection);
513
+ },
514
+ wrapPagesCollection(pagesCollection) {
515
+ if (!studioEnabled) {
516
+ return pagesCollection;
517
+ }
518
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
519
+ const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
520
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
521
+ const existingEditViews = existingViews?.edit;
522
+ const hasCustomEditView = Boolean(
523
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
524
+ );
525
+ return {
526
+ ...collectionWithBreadcrumb,
527
+ admin: {
528
+ ...collectionWithBreadcrumb.admin,
529
+ components: {
530
+ ...collectionWithBreadcrumb.admin?.components,
531
+ edit: {
532
+ ...collectionWithBreadcrumb.admin?.components?.edit,
533
+ editMenuItems: appendComponent(
534
+ existingEditMenuItems,
535
+ {
536
+ exportName: "OpenInStudioMenuItem",
537
+ path: clientPath,
538
+ clientProps: {
539
+ pagesPathBase: pagesBasePath
540
+ }
541
+ },
542
+ "OpenInStudioMenuItem"
543
+ )
544
+ },
545
+ views: {
546
+ ...existingViews,
547
+ ...hasCustomEditView ? {} : {
548
+ edit: {
549
+ ...existingEditViews,
550
+ default: {
551
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
552
+ Component: {
553
+ exportName: "PageEditRedirectToStudio",
554
+ path: clientPath,
555
+ clientProps: {
556
+ pagesPathBase: pagesBasePath
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
562
+ }
563
+ }
564
+ }
565
+ };
566
+ },
567
+ wrapMediaCollection(mediaCollection) {
568
+ return attachStudioBackBreadcrumbToCollection(mediaCollection);
569
+ },
570
+ wrapFormsCollection(formsCollection) {
571
+ return attachStudioBackBreadcrumbToCollection(formsCollection);
572
+ },
573
+ wrapFormSubmissionsCollection(formSubmissionsCollection) {
574
+ return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
575
+ },
576
+ wrapFormUploadsCollection(formUploadsCollection) {
577
+ return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
347
578
  },
348
579
  wrapGlobals(globals2) {
349
580
  const labelMap = {
@@ -356,25 +587,110 @@ function configureAdmin(config) {
356
587
  return globals2.map((global) => {
357
588
  const mapping = labelMap[global.slug];
358
589
  if (!mapping) return global;
590
+ const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
591
+ const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
359
592
  const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
593
+ const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
594
+ const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
360
595
  const existingViews = global.admin?.components?.views;
361
596
  const existingEditViews = existingViews?.edit;
362
- const hasCustomContactFormEditView = Boolean(
597
+ const hasCustomEditView = Boolean(
363
598
  existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
364
599
  );
365
- const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
366
- ...existingEditViews,
367
- default: {
368
- ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
369
- Component: {
370
- exportName: "StudioContactFormRedirect",
371
- path: clientPath,
372
- clientProps: {
373
- studioContactFormPath: contactFormStudioPath
600
+ const nextEditViews = (() => {
601
+ if (shouldAttachSiteSettingsEditView && !hasCustomEditView) {
602
+ return {
603
+ ...existingEditViews,
604
+ default: {
605
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
606
+ Component: {
607
+ exportName: "AdminStudioSiteSettingsGlobalView",
608
+ path: clientPath,
609
+ clientProps: {
610
+ ...studioNavClientProps,
611
+ globalSlug: global.slug,
612
+ mediaCollectionSlug
613
+ }
614
+ }
374
615
  }
375
- }
616
+ };
617
+ }
618
+ if (shouldAttachSocialMediaEditView && !hasCustomEditView) {
619
+ return {
620
+ ...existingEditViews,
621
+ default: {
622
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
623
+ Component: {
624
+ exportName: "AdminStudioSocialMediaGlobalView",
625
+ path: clientPath,
626
+ clientProps: {
627
+ ...studioNavClientProps,
628
+ globalSlug: global.slug
629
+ }
630
+ }
631
+ }
632
+ };
633
+ }
634
+ if (shouldAttachHeaderEditView && !hasCustomEditView) {
635
+ return {
636
+ ...existingEditViews,
637
+ default: {
638
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
639
+ Component: {
640
+ exportName: "AdminStudioHeaderGlobalView",
641
+ path: clientPath,
642
+ clientProps: {
643
+ ...studioNavClientProps,
644
+ actionHref: sitePreview?.header?.actionHref,
645
+ actionLabel: sitePreview?.header?.actionLabel,
646
+ globalSlug: global.slug,
647
+ locationSummary: sitePreview?.locationSummary,
648
+ pagesCollectionSlug
649
+ }
650
+ }
651
+ }
652
+ };
653
+ }
654
+ if (shouldAttachFooterEditView && !hasCustomEditView) {
655
+ return {
656
+ ...existingEditViews,
657
+ default: {
658
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
659
+ Component: {
660
+ exportName: "AdminStudioFooterGlobalView",
661
+ path: clientPath,
662
+ clientProps: {
663
+ ...studioNavClientProps,
664
+ builtByHref: sitePreview?.footer?.builtByHref,
665
+ builtByLabel: sitePreview?.footer?.builtByLabel,
666
+ description: sitePreview?.footer?.description,
667
+ footerCategories: sitePreview?.footer?.footerCategories,
668
+ footerLinks: sitePreview?.footer?.footerLinks,
669
+ globalSlug: global.slug,
670
+ locationSummary: sitePreview?.locationSummary
671
+ }
672
+ }
673
+ }
674
+ };
675
+ }
676
+ if (shouldAttachContactFormRedirect && !hasCustomEditView) {
677
+ return {
678
+ ...existingEditViews,
679
+ default: {
680
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
681
+ Component: {
682
+ exportName: "StudioContactFormRedirect",
683
+ path: clientPath,
684
+ clientProps: {
685
+ studioContactFormPath: contactFormStudioPath
686
+ }
687
+ }
688
+ }
689
+ };
376
690
  }
377
- } : existingEditViews;
691
+ return existingEditViews;
692
+ })();
693
+ const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
378
694
  return {
379
695
  ...global,
380
696
  admin: {
@@ -382,12 +698,18 @@ function configureAdmin(config) {
382
698
  group: mapping.group,
383
699
  components: {
384
700
  ...global.admin?.components,
385
- ...shouldAttachContactFormRedirect ? {
701
+ elements: {
702
+ ...global.admin?.components?.elements,
703
+ beforeDocumentControls: studioEnabled ? appendComponent(
704
+ existingBeforeDocumentControls,
705
+ studioBackBreadcrumbComponent,
706
+ "StudioBackBreadcrumb"
707
+ ) : existingBeforeDocumentControls
708
+ },
709
+ ...nextEditViews ? {
386
710
  views: {
387
711
  ...existingViews,
388
- ...contactFormEditViews ? {
389
- edit: contactFormEditViews
390
- } : {}
712
+ edit: nextEditViews
391
713
  }
392
714
  } : {}
393
715
  }
@@ -1,3 +1,7 @@
1
+ import {
2
+ navItemIsActive,
3
+ roleCanAccessNav
4
+ } from "./chunk-W2UOCJDX.mjs";
1
5
  import {
2
6
  __export
3
7
  } from "./chunk-6BWS3CLP.mjs";
@@ -202,23 +206,6 @@ var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
202
206
  return [];
203
207
  };
204
208
 
205
- // src/admin-app/routeRegistry.ts
206
- var roleCanAccessNav = (role, item) => {
207
- if (!item.roles || item.roles.length === 0) {
208
- return true;
209
- }
210
- if (!role) {
211
- return false;
212
- }
213
- return item.roles.includes(role);
214
- };
215
- var navItemIsActive = (pathname, item) => {
216
- if (item.href === "/admin") {
217
- return pathname === "/admin";
218
- }
219
- return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
220
- };
221
-
222
209
  export {
223
210
  AdminBreadcrumbs,
224
211
  AdminPage,
@@ -228,7 +215,5 @@ export {
228
215
  getAdminNavRows,
229
216
  normalizeAdminNavInputs,
230
217
  parseAdminHeaderNavFromForm,
231
- roleCanAccessNav,
232
- navItemIsActive,
233
218
  admin_app_exports
234
219
  };
@@ -0,0 +1,32 @@
1
+ // src/admin-app/routeRegistry.ts
2
+ var adminNavIcons = [
3
+ "dashboard",
4
+ "pages",
5
+ "forms",
6
+ "globals",
7
+ "media",
8
+ "tools",
9
+ "account",
10
+ "analytics"
11
+ ];
12
+ var roleCanAccessNav = (role, item) => {
13
+ if (!item.roles || item.roles.length === 0) {
14
+ return true;
15
+ }
16
+ if (!role) {
17
+ return false;
18
+ }
19
+ return item.roles.includes(role);
20
+ };
21
+ var navItemIsActive = (pathname, item) => {
22
+ if (item.href === "/admin") {
23
+ return pathname === "/admin";
24
+ }
25
+ return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
26
+ };
27
+
28
+ export {
29
+ adminNavIcons,
30
+ roleCanAccessNav,
31
+ navItemIsActive
32
+ };