@bison-lab/payload-core 5.12.0 → 5.13.0

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 (109) hide show
  1. package/README.md +125 -10
  2. package/dist/admin-branding-CEKdfYah.mjs +178 -0
  3. package/dist/admin-branding-CEKdfYah.mjs.map +1 -0
  4. package/dist/admin-head-CcpH7P4C.mjs +187 -0
  5. package/dist/admin-head-CcpH7P4C.mjs.map +1 -0
  6. package/dist/admin-head-QfW81bDy.d.mts +63 -0
  7. package/dist/admin-head-QfW81bDy.d.mts.map +1 -0
  8. package/dist/admin-server.d.mts +52 -0
  9. package/dist/admin-server.d.mts.map +1 -0
  10. package/dist/admin-server.mjs +94 -0
  11. package/dist/admin-server.mjs.map +1 -0
  12. package/dist/admin.d.mts.map +1 -1
  13. package/dist/admin.mjs +12 -4
  14. package/dist/admin.mjs.map +1 -1
  15. package/dist/{alternates-DxBTUXHh.mjs → alternates-Tv5-ccza.mjs} +1 -1
  16. package/dist/{alternates-DxBTUXHh.mjs.map → alternates-Tv5-ccza.mjs.map} +1 -1
  17. package/dist/{alternates-DlRTsaVe.d.mts → alternates-aRncEUBI.d.mts} +1 -1
  18. package/dist/{alternates-DlRTsaVe.d.mts.map → alternates-aRncEUBI.d.mts.map} +1 -1
  19. package/dist/block-library.d.mts +1 -1
  20. package/dist/block-library.mjs +1 -1
  21. package/dist/{block-thumbnails-DC34uFtE.mjs → block-thumbnails-DvILqW_e.mjs} +1 -1
  22. package/dist/{block-thumbnails-DC34uFtE.mjs.map → block-thumbnails-DvILqW_e.mjs.map} +1 -1
  23. package/dist/block-thumbnails-cli.mjs +1 -1
  24. package/dist/block-thumbnails.mjs +1 -1
  25. package/dist/{capability-Kd5LgQpm.mjs → capability-B4FLx4OX.mjs} +4 -159
  26. package/dist/capability-B4FLx4OX.mjs.map +1 -0
  27. package/dist/{capability-NlorUIta.d.mts → capability-DonuHSPG.d.mts} +1 -1
  28. package/dist/{capability-NlorUIta.d.mts.map → capability-DonuHSPG.d.mts.map} +1 -1
  29. package/dist/{catalogue-CJ0RlTg4.d.mts → catalogue-tVovXWp9.d.mts} +1 -1
  30. package/dist/{catalogue-CJ0RlTg4.d.mts.map → catalogue-tVovXWp9.d.mts.map} +1 -1
  31. package/dist/{facet-field-DO3VT_Cz.mjs → facet-field-7p6_MhsT.mjs} +1 -1
  32. package/dist/{facet-field-DO3VT_Cz.mjs.map → facet-field-7p6_MhsT.mjs.map} +1 -1
  33. package/dist/{facet-field-Cd6lffed.d.mts → facet-field-Dbcu1L91.d.mts} +1 -1
  34. package/dist/{facet-field-Cd6lffed.d.mts.map → facet-field-Dbcu1L91.d.mts.map} +1 -1
  35. package/dist/{types-B1MmE-L3.d.mts → identity-B4Lew8Fu.d.mts} +40 -24
  36. package/dist/identity-B4Lew8Fu.d.mts.map +1 -0
  37. package/dist/{identity-CN6EOeDM.mjs → identity-CkUE_uN2.mjs} +11 -3
  38. package/dist/{identity-CN6EOeDM.mjs.map → identity-CkUE_uN2.mjs.map} +1 -1
  39. package/dist/index.d.mts +58 -16
  40. package/dist/index.d.mts.map +1 -1
  41. package/dist/index.mjs +150 -60
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/island-97l5VY8l.mjs.map +1 -1
  44. package/dist/languages-B_iiWwxE.mjs +179 -0
  45. package/dist/languages-B_iiWwxE.mjs.map +1 -0
  46. package/dist/languages-cDe9Lznx.d.mts +86 -0
  47. package/dist/languages-cDe9Lznx.d.mts.map +1 -0
  48. package/dist/{locale-tnKLkutC.d.mts → locale-CTT3nn6T.d.mts} +1 -1
  49. package/dist/locale-CTT3nn6T.d.mts.map +1 -0
  50. package/dist/{locale-B6rUVwpg.mjs → locale-DaEJ1d2O.mjs} +1 -1
  51. package/dist/{locale-B6rUVwpg.mjs.map → locale-DaEJ1d2O.mjs.map} +1 -1
  52. package/dist/locale-routing.d.mts +129 -0
  53. package/dist/locale-routing.d.mts.map +1 -0
  54. package/dist/locale-routing.mjs +256 -0
  55. package/dist/locale-routing.mjs.map +1 -0
  56. package/dist/lookup-DiOCro-_.mjs +165 -0
  57. package/dist/lookup-DiOCro-_.mjs.map +1 -0
  58. package/dist/lookup-uyEKHlLX.d.mts +41 -0
  59. package/dist/lookup-uyEKHlLX.d.mts.map +1 -0
  60. package/dist/{messages-XFoL9RtF.mjs → messages-Bv6JIEiG.mjs} +2 -2
  61. package/dist/{messages-XFoL9RtF.mjs.map → messages-Bv6JIEiG.mjs.map} +1 -1
  62. package/dist/metadata.d.mts +2 -2
  63. package/dist/metadata.mjs +1 -1
  64. package/dist/navigation.d.mts +2 -2
  65. package/dist/navigation.mjs +1 -1
  66. package/dist/og.d.mts +2 -2
  67. package/dist/og.mjs +2 -2
  68. package/dist/{preview-Br1SQCKn.mjs → preview-BE7P1ezl.mjs} +5 -120
  69. package/dist/preview-BE7P1ezl.mjs.map +1 -0
  70. package/dist/{preview-B69Dhi8T.d.mts → preview-DSQN4uYa.d.mts} +2 -2
  71. package/dist/{preview-B69Dhi8T.d.mts.map → preview-DSQN4uYa.d.mts.map} +1 -1
  72. package/dist/{published-Vu_QX2Vv.mjs → published-BF2F3od_.mjs} +2 -2
  73. package/dist/{published-Vu_QX2Vv.mjs.map → published-BF2F3od_.mjs.map} +1 -1
  74. package/dist/{published-hqtvmVUD.mjs → published-BzihgcSf.mjs} +1 -1
  75. package/dist/{published-hqtvmVUD.mjs.map → published-BzihgcSf.mjs.map} +1 -1
  76. package/dist/{published-B80KqlcU.mjs → published-C8bW5jvC.mjs} +3 -3
  77. package/dist/{published-B80KqlcU.mjs.map → published-C8bW5jvC.mjs.map} +1 -1
  78. package/dist/{published-2I-k6zEo.d.mts → published-DYpXTy84.d.mts} +3 -3
  79. package/dist/{published-2I-k6zEo.d.mts.map → published-DYpXTy84.d.mts.map} +1 -1
  80. package/dist/{published-BhYTEAK_.d.mts → published-VTz_aYaQ.d.mts} +2 -2
  81. package/dist/{published-BhYTEAK_.d.mts.map → published-VTz_aYaQ.d.mts.map} +1 -1
  82. package/dist/{root-page-key-kx3C1eyp.mjs → root-page-key-ywNz2k4L.mjs} +1 -1
  83. package/dist/{root-page-key-kx3C1eyp.mjs.map → root-page-key-ywNz2k4L.mjs.map} +1 -1
  84. package/dist/seo.d.mts +1 -1
  85. package/dist/seo.mjs +2 -2
  86. package/dist/{strings-Fd7kUCT7.mjs → strings-_9n8BefX.mjs} +1 -1
  87. package/dist/{strings-Fd7kUCT7.mjs.map → strings-_9n8BefX.mjs.map} +1 -1
  88. package/dist/taxonomy.d.mts +1 -1
  89. package/dist/taxonomy.mjs +1 -1
  90. package/dist/theme.d.mts +6 -5
  91. package/dist/theme.d.mts.map +1 -1
  92. package/dist/theme.mjs +6 -63
  93. package/dist/{title-BVV3o329.d.mts → title-DBSLJfrW.d.mts} +1 -1
  94. package/dist/{title-BVV3o329.d.mts.map → title-DBSLJfrW.d.mts.map} +1 -1
  95. package/dist/translate-messages-cli.mjs +2 -2
  96. package/dist/translate.d.mts +2 -77
  97. package/dist/translate.d.mts.map +1 -1
  98. package/dist/translate.mjs +4 -3
  99. package/dist/translate.mjs.map +1 -1
  100. package/dist/{wireframe-Ba65SOj8.mjs → wireframe-DjPHSACa.mjs} +1 -1
  101. package/dist/{wireframe-Ba65SOj8.mjs.map → wireframe-DjPHSACa.mjs.map} +1 -1
  102. package/dist/wireframe-cli.mjs +1 -1
  103. package/dist/wireframe.mjs +1 -1
  104. package/package.json +11 -3
  105. package/dist/capability-Kd5LgQpm.mjs.map +0 -1
  106. package/dist/locale-tnKLkutC.d.mts.map +0 -1
  107. package/dist/preview-Br1SQCKn.mjs.map +0 -1
  108. package/dist/theme.mjs.map +0 -1
  109. package/dist/types-B1MmE-L3.d.mts.map +0 -1
package/README.md CHANGED
@@ -14,18 +14,19 @@ pnpm add @bison-lab/payload-core @payloadcms/plugin-seo @payloadcms/plugin-redir
14
14
  Peers: `payload`, `@payloadcms/plugin-seo`, and `@payloadcms/plugin-redirects` are required. `@bison-lab/tokens`
15
15
  and `@bison-lab/fonts` are required because Theme is required. `@payloadcms/ui`,
16
16
  `next` and `react` are needed for admin fields (`./admin` refreshes the
17
- Media list with `next/navigation`, which Payload's admin already loads); `@bison-lab/ui` and
17
+ Media list with `next/navigation`, which Payload's admin already loads), and
18
+ `next` for `./locale-routing`; `@bison-lab/ui` and
18
19
  `@payloadcms/live-preview-react` are peers of the `./react` entry.
19
20
  Pin the plugin to the same version as `payload`; Payload releases them in
20
21
  lockstep.
21
22
 
22
- ## Fourteen entry points, and why
23
+ ## Sixteen entry points, and why
23
24
 
24
25
  | Import | Contents | Runs where |
25
26
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
26
27
  | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createBlockLibrary`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createQuestions`, `createTaxonomy`, `createFormSubmissions`, `facetField`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `listAlign`, `blockDrawer`, `richTextEditorFonts`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
27
28
  | `@bison-lab/payload-core/metadata` | `pageMetadata`, the title helpers, the same types | Server. What a page route imports; it does not load the plugin. |
28
- | `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead`, `themeHeadFromDoc` | Server. What a root layout imports; it does not load the plugin or React. |
29
+ | `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead`, `themeHeadFromDoc`, `getAdminHead`, `getAdminIdentity`, `adminAuthCss` | Server. What a root layout imports; it does not load the plugin or React. |
29
30
  | `@bison-lab/payload-core/seo` | `pageSitemap`, `getSitemapPages`, `organizationJsonLd`, `websiteJsonLd`, `breadcrumbListJsonLd`, `jsonLdGraph`, `jsonLdHtml`, `JsonLd` | Server. What `app/sitemap.ts` and a page route import; no plugin, no banner. `JsonLd` is a Server Component, so it loads React. |
30
31
  | `@bison-lab/payload-core/og` | `ogImageHandler`, `renderOgImage`, `ogCardColors`, `ogCardElement`, `OG_IMAGE_SIZE` | Server. The Open Graph card route (BIS-183); no plugin, no `@payloadcms/ui`, no `next`, no banner. Needs the optional peers `satori` and `@resvg/resvg-js`. |
31
32
  | `@bison-lab/payload-core/navigation` | `getNavigation`, the Header and Footer slugs | Server. What a site header imports; it does not load the plugin or React. |
@@ -35,7 +36,9 @@ lockstep.
35
36
  | `@bison-lab/payload-core/a11y` | `checkPage`, `expectAccessiblePage`, `formatPageCheck`, `PAGE_CHECK_RULES`, `AXE_TAGS` | Node, beside Playwright. What a site's own tests call over its rendered pages (#306): axe, heading order, keyboard focus. No Payload, no React. Needs the optional peer `@axe-core/playwright`. |
36
37
  | `@bison-lab/payload-core/wireframe` | Deprecated: the 4.15 wireframe generator and the `bison-wireframes` bin | Node. Kept for one release so a site's script keeps working; use `./block-thumbnails`. Goes in the next major. |
37
38
  | `@bison-lab/payload-core/translate` | `applyTranslation` / `translation`, the deprecated `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the settings readers and key helpers, `BisonTranslationMarker`, the languages (`LIBRARY_LOCALES`, `activeLocales`, `inactiveLocaleRedirect`, `activeAlternates`), the `localizeExistingContent` migration and `isLocalizedPath`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is a required peer (every site has translation), imported on the first translation. |
39
+ | `@bison-lab/payload-core/locale-routing` | `localeProxy`, `routeLocale`, `getRequestLocale`, `localeFromHeaders`, `localePath`, `LOCALE_HEADER`, `matchRedirect`, `REDIRECTS_SLUG`; re-exports `activeLocales`, `inactiveLocaleRedirect`, `activeAlternates` | Server. What a site's proxy and pages import for language URLs (#339); no Payload at runtime, no plugin, no React. `next` (optional peer) stays external. |
38
40
  | `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, the FAQ Library list, "Translate now" (`TranslateNowMenuItem`) and the Translation key panel (`TranslationKeyPanel`) | Admin. Referenced by import-map string; `generate:importmap` writes it. |
41
+ | `@bison-lab/payload-core/admin-server` | `AdminLogo`, `AdminIcon` (the Theme-branded `graphics.Logo` / `Icon`), `AdminHead` (the admin `<head>` from the Theme) | Server, inside the Payload admin. No `"use client"` banner: each reads the Theme with `payload`. The graphics resolve through the import map; `AdminHead` is rendered by the site's `(payload)/layout.tsx`. `./admin` is the only entry that loads `@payloadcms/ui`, with one exception: this entry takes `@payloadcms/ui/shared`, the unbannered subpath, for Payload's default graphics, because Payload's OG image route calls `graphics.Icon` outside the client boundary, where an export of the bannered `./admin` is a throwing stub. |
39
42
  | `@bison-lab/payload-core/react` | `BlockLibraryIsland`; `ThemePreview` (legacy; Theme has no preview pane) | Client. What a Block library preview route wraps its sample in. |
40
43
 
41
44
  ## Page check
@@ -236,9 +239,11 @@ export default buildConfig({
236
239
  identity: {
237
240
  fallback: {
238
241
  lockup: { url: "/logo-lockup.svg", alt: "Acme" },
242
+ lockupDark: { url: "/logo-lockup-white.svg", alt: "Acme" },
239
243
  mark: { url: "/logo-mark.svg", alt: "Acme mark" },
240
244
  },
241
245
  },
246
+ siteName: "Acme", // admin tab titles end "| Acme CMS"
242
247
  colorUsages: true,
243
248
  onPublish: async () => {
244
249
  revalidateTag("theme");
@@ -305,11 +310,63 @@ const { css, preloads } = themeHead(theme, { identity });
305
310
  // identity.lockup / identity.mark / identity.favicon — uploaded file or the fallback
306
311
  ```
307
312
 
308
- If the admin layout renders the same head, the admin panel restyles too.
309
-
310
313
  `getPublishedTheme` reads the live row and falls back to the seed when
311
- the Global is empty. Empty logo, favicon, and mobile-menu mark use the
312
- fallback the site passed into `createTheme`. There is no Theme preview pane.
314
+ the Global is empty. Empty logo, dark logo, favicon, and mobile-menu mark
315
+ use the fallback the site passed into `createTheme`. The dark logo
316
+ (`identity.lockupDark`) is for a dark background; the fallback's dark
317
+ logo is used only while the logo is the fallback too, so a new uploaded
318
+ logo is never paired with the old dark art. There is no Theme preview
319
+ pane.
320
+
321
+ **5. Brand the admin (#301).** The admin's login logo, header icon,
322
+ favicon, tab titles and login, forgot and reset screens come from the
323
+ Theme.
324
+
325
+ - `adminNav()` sets `admin.components.graphics.Logo` to `ADMIN_LOGO` and
326
+ `Icon` to `ADMIN_ICON` (both `@bison-lab/payload-core/admin-server`),
327
+ and `admin.meta.titleSuffix` to `| <siteName> CMS` from
328
+ `createTheme({ siteName })`. Each only where the site left it unset: a
329
+ site's own `graphics.Logo`, `Icon` or `titleSuffix` is kept. Without the
330
+ Theme Global it changes nothing.
331
+ - `AdminLogo` (login) shows the Theme logo, and the dark logo when
332
+ Payload's `<html data-theme="dark">` is on; `AdminIcon` (header) shows
333
+ the mobile menu logo (`logoMark`). With no upload they show the
334
+ `identity.fallback`, and with none, Payload's own graphics. A failed
335
+ Theme read logs and shows the fallback, so the login still renders.
336
+ Payload's admin Open Graph image renders `graphics.Icon` without
337
+ `payload`; there `AdminIcon` is Payload's own icon, in the fill asked for.
338
+ - `AdminHead` replaces the Theme head a site's `(payload)/layout.tsx`
339
+ rendered by hand. It reads the Theme on every request (no cache), so a
340
+ Theme save shows on the next request with no deploy:
341
+
342
+ ```tsx
343
+ // app/(payload)/layout.tsx
344
+ import { AdminHead } from "@bison-lab/payload-core/admin-server";
345
+ import { getPayload } from "payload";
346
+ import bisonConfig from "../../../bison.config.json";
347
+
348
+ const Layout = async ({ children }: Args) => {
349
+ const payload = await getPayload({ config });
350
+ return (
351
+ <RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
352
+ <AdminHead payload={payload as never} seed={bisonConfig} fontsBaseUrl="/fonts" />
353
+ {children}
354
+ </RootLayout>
355
+ );
356
+ };
357
+ ```
358
+
359
+ It renders the font preloads, a `<link rel="icon">` for the Theme
360
+ favicon (upload, else fallback; none keeps Payload's), and one `<style>`:
361
+ the Theme variables with the dark palette on `[data-theme="dark"]`, then
362
+ `adminAuthCss`. Every auth screen renders through Payload's
363
+ MinimalTemplate, so those rules are CSS on `.template-minimal` in
364
+ `@layer payload`: the background, the card and its `--primary` rule, the
365
+ primary button and plain links (not `a.btn`) from `--primary` and its scale, and the logo
366
+ (dark logo in dark mode) as a pseudo-element on forgot and reset, which
367
+ have no logo slot. `getAdminHead` is the same data without React, from
368
+ `./theme`. `payload as never`: Payload's generic `findGlobal` is not
369
+ assignable to the structural reader, as with `getPublishedIdentity`.
313
370
 
314
371
  `richTextEditorFonts()` sets the admin's Rich Text editor (and its
315
372
  version diff) in `var(--font-body)` with normal tracking. Payload writes
@@ -697,10 +754,12 @@ refused — never rewritten to `slug-2`. Unlock opens Parent and a
697
754
  change writes a 308 the same way a typed slug change does (BIS-171). The
698
755
  lock is a `beforeValidate` hook that keeps the stored address, not field
699
756
  `access.update`: Payload renders a field with update denied as read-only
700
- when the edit view loads, so Unlock could never open it. `createRedirects()`
757
+ when the edit view loads, so Unlock could never open it. `createRedirects({ isReservedSlug })`
701
758
  wraps `@payloadcms/plugin-redirects` for `pages` only (permanent 308) and
702
759
  collapses chains when a published slug changes. The plugin stores the
703
- rows; the site still has to serve them. Pin the plugin to the same
760
+ rows; the site serves them with `matchRedirect` from `./locale-routing`
761
+ (Redirects in each language, below). The predicate refuses a `from` that
762
+ is reserved with or without a language prefix. Pin the plugin to the same
704
763
  version as `payload`, then `payload generate:importmap`,
705
764
  `payload generate:types`, and `payload migrate:create`. Create and update follow the Content tick;
706
765
  only the Publish grant writes the live page (a publish, a save without
@@ -979,11 +1038,67 @@ defaults) decide which target languages are translated and live.
979
1038
  (`ACTIVE_LOCALES_CACHE_MS`, cleared by a save in the same process) for
980
1039
  middleware; `inactiveLocaleRedirect` and `activeAlternates` are the 308 and
981
1040
  the switcher/hreflang filter; `GET /api/translation/locales` serves it to an
982
- edge runtime. `localizeExistingContent` is the one-to-several locale data
1041
+ edge runtime.
1042
+
1043
+ `./locale-routing` (#339) is the routing a site switches on from those
1044
+ ticks. `localeProxy(request, locales)` is the last step of a site's proxy:
1045
+ an unprefixed URL is served in the default language; a live language's
1046
+ prefix is rewritten to the site's existing route with the language in the
1047
+ `x-bison-locale` request header (`LOCALE_HEADER`, set or removed on every
1048
+ request so a visitor's own never reaches a page); an unticked language's
1049
+ prefix and the default language's own prefix 308 to the unprefixed path,
1050
+ `no-store`; a prefix in the wrong case 308s to the language's spelling.
1051
+ `/admin`, `/api`, `/_next`, `/_vercel`, a file outside a language prefix,
1052
+ and the site's `skip` are untouched without reading the list. Every target
1053
+ is set on a clone of the request URL after `pathAfterPrefix` collapses
1054
+ leading slashes, so it never leaves the host. `routeLocale` is the same
1055
+ decision as data, for a per-language lookup beside it.
1056
+ `getRequestLocale()` reads the header through `next/headers`
1057
+ (`localeFromHeaders` is the pure half), answering the default language for
1058
+ a missing or non-live value. `localePath` is the prefixed path for
1059
+ `pathFor`. The entry imports `./translate/languages` only, which has no
1060
+ runtime Payload import; `src/__tests__/locale-routing.test.ts` walks its
1061
+ import graph to hold that. `localizeExistingContent` is the one-to-several locale data
983
1062
  migration: it runs the generated SQL with every `DROP COLUMN` / `DROP TYPE`
984
1063
  moved last and each moving column copied into `<table>_locales` first.
985
1064
  It also sets the default locale on the new `locale` column of `_rels` / `_texts` / `_numbers` rows whose `path` is a localized field (`isLocalizedPath` over the migration's `payload.config`), and stops when such rows exist without it. Postgres only. `pnpm --filter @bison-lab/payload-core test:postgres` runs it against a local Postgres with recorded `migrate:create` output (`src/__tests__/fixtures/localize/`); the normal suite skips it. The same command also boots a real Payload on a scratch database (`@payloadcms/db-postgres`, a dev dependency pinned to the Payload version) to hold the Interface text Global's behavior that FakePayload only copies: a never-saved Global reading as a draft, and a version restore writing the live row (`interface-text-postgres.test.ts`, #305 / #309). `restore-rest-postgres.test.ts` logs in and restores page versions through Payload's REST handler (`handleEndpoints`), the request the admin's Restore sends, so a hook that queries with the restore's request is held to the REST path, not only the Local API: the slug check, and the Roles read that decides Publish (#334).
986
1065
 
1066
+ ### Redirects in each language (#340)
1067
+
1068
+ A Redirects row has a `language` select (`REDIRECT_LANGUAGE_FIELD`, not
1069
+ localized, indexed), offering every carried language but the default;
1070
+ empty is the default language, which every row saved before #340 is. The
1071
+ collection's `beforeValidate` stores the row as `normalizeRedirectFrom`
1072
+ says (`src/redirects/lookup.ts`): one leading slash, no trailing one, a
1073
+ language's row under its prefix in the language's own spelling (`/old` as
1074
+ Spanish → `/es/old`, `/ES/old` with no language → a Spanish row), the
1075
+ default language stored as none, and a language the site does not carry
1076
+ kept for the select to refuse. A `from` under one language's prefix saved
1077
+ as another language is refused under From
1078
+ (`mismatchedRedirectLanguageMessage`). The path is otherwise kept as
1079
+ typed. A file-shaped path outside a language prefix (`/old.html`) is never
1080
+ looked up, because `routeLocale` skips it.
1081
+
1082
+ `matchRedirect({ payload, pathname, search, locales, isReservedSlug })`
1083
+ on `./locale-routing` is the proxy's lookup, from `routeLocale`'s
1084
+ decision: an unprefixed URL reads rows with no language; a live
1085
+ language's URL reads that language's row, then a no-language row saved
1086
+ with the whole path, then the no-language row for the path after the
1087
+ prefix, sent on in that language (a typed path prefixed unless it names
1088
+ a language, a page at its path there); an unticked language's URL reads
1089
+ only a no-language row saved with the whole path, so `localeProxy`'s 308
1090
+ stands. One `from: { in }` query, depth 1 with only the page's slug,
1091
+ `pageKey` and `_status`. A reference to a missing, unpublished or
1092
+ slug-less page, an off-site path (checked after dot segments resolve, so
1093
+ `/.//evil.com` is refused), or a path to itself answers nothing and
1094
+ the next candidate is tried. The query string is kept unless the
1095
+ destination has its own; a failed read answers null. Slugs are shared, so
1096
+ `recordPublishedSlugRedirect` still writes one no-language row, and moves
1097
+ each language's rows off the old path (`/es/about` → `/es/about-us`) and
1098
+ deletes a language's row on the new one. `redirects-postgres.test.ts`
1099
+ (`test:postgres`) holds the enum, the null language and the populated
1100
+ lookup on a real Postgres.
1101
+
987
1102
  ### Jobs, usage and failures (#295, #296)
988
1103
 
989
1104
  `translate/jobs.ts`: a hidden `translation-jobs` collection holds each job's
@@ -0,0 +1,178 @@
1
+ import { l as stateFromColorDoc, o as THEME_SLUG } from "./identity-CkUE_uN2.mjs";
2
+ import { includedShadeSteps } from "@bison-lab/tokens";
3
+ //#region src/theme/looks.ts
4
+ /**
5
+ * System colors Color Settings offers as page-editor fills. Success and
6
+ * Destructive stay off this list — they are theme chrome only.
7
+ */
8
+ const PAGE_EDITOR_SYSTEM_KEYS = [
9
+ "primary",
10
+ "secondary",
11
+ "accent",
12
+ "highlight"
13
+ ];
14
+ const SYSTEM_LABELS = {
15
+ primary: "Primary",
16
+ secondary: "Secondary",
17
+ accent: "Accent",
18
+ highlight: "Highlight"
19
+ };
20
+ function brandColor(doc, key) {
21
+ const value = (doc?.colors?.brand ?? doc?.brand)?.[key];
22
+ if (typeof value === "string" || value == null) return value == null ? null : { hex: value };
23
+ return value;
24
+ }
25
+ function themeLibraryFromDoc(doc) {
26
+ return Array.isArray(doc?.colors?.library) ? doc.colors.library : [];
27
+ }
28
+ function libraryRows(doc) {
29
+ return themeLibraryFromDoc(doc);
30
+ }
31
+ function titleCase(key) {
32
+ return key.charAt(0).toUpperCase() + key.slice(1);
33
+ }
34
+ function stepsFor(color, fallbackHex) {
35
+ return includedShadeSteps(stateFromColorDoc(color, fallbackHex));
36
+ }
37
+ /**
38
+ * Family keys a `lookField()` may offer: the page-editor system scales
39
+ * plus every custom color on Colors. Adding Coral on Theme makes `coral`
40
+ * appear here with no `@bison-lab/*` release.
41
+ */
42
+ function pageEditorLooks(doc) {
43
+ const system = PAGE_EDITOR_SYSTEM_KEYS.map((value) => ({
44
+ label: SYSTEM_LABELS[value],
45
+ value
46
+ }));
47
+ const custom = libraryRows(doc).map((row) => {
48
+ const value = row.key?.trim();
49
+ if (!value) return null;
50
+ return {
51
+ label: row.label?.trim() || titleCase(value),
52
+ value
53
+ };
54
+ }).filter((option) => option !== null);
55
+ return [...system, ...custom];
56
+ }
57
+ /**
58
+ * Included steps as `coral-400`. Excluded steps do not appear. System
59
+ * scales with no stored include list offer the full 50–950 ramp.
60
+ */
61
+ function pageEditorTokens(doc) {
62
+ const tokens = [];
63
+ for (const key of PAGE_EDITOR_SYSTEM_KEYS) {
64
+ const label = SYSTEM_LABELS[key];
65
+ for (const step of stepsFor(brandColor(doc, key), "#000000")) tokens.push({
66
+ label: `${label} ${step}`,
67
+ value: `${key}-${step}`
68
+ });
69
+ }
70
+ for (const row of libraryRows(doc)) {
71
+ const key = row.key?.trim();
72
+ if (!key) continue;
73
+ const label = row.label?.trim() || titleCase(key);
74
+ for (const step of stepsFor(row, row.hex ?? "#000000")) tokens.push({
75
+ label: `${label} ${step}`,
76
+ value: `${key}-${step}`
77
+ });
78
+ }
79
+ return tokens;
80
+ }
81
+ /**
82
+ * `pageEditorTokens` with each step's stored color, grouped by family in
83
+ * the same order, so an admin picker can paint a swatch without the site's
84
+ * Theme stylesheet.
85
+ */
86
+ function pageEditorSwatches(doc) {
87
+ const swatches = [];
88
+ const push = (family, familyLabel, color, fallbackHex) => {
89
+ const state = stateFromColorDoc(color, fallbackHex);
90
+ for (const step of includedShadeSteps(state)) swatches.push({
91
+ label: `${familyLabel} ${step}`,
92
+ value: `${family}-${step}`,
93
+ family,
94
+ familyLabel,
95
+ step,
96
+ hsl: String(state.scale[step] ?? "")
97
+ });
98
+ };
99
+ for (const key of PAGE_EDITOR_SYSTEM_KEYS) push(key, SYSTEM_LABELS[key], brandColor(doc, key), "#000000");
100
+ for (const row of libraryRows(doc)) {
101
+ const key = row.key?.trim();
102
+ if (!key) continue;
103
+ push(key, row.label?.trim() || titleCase(key), row, row.hex ?? "#000000");
104
+ }
105
+ return swatches;
106
+ }
107
+ async function themeDocFromRequest(req) {
108
+ try {
109
+ return await req.payload?.findGlobal?.({
110
+ slug: "theme",
111
+ depth: 0,
112
+ overrideAccess: true
113
+ }) ?? null;
114
+ } catch {
115
+ return null;
116
+ }
117
+ }
118
+ //#endregion
119
+ //#region src/theme/admin-branding.ts
120
+ /** `admin.components.graphics.Logo`: the Theme logo on the login screen. */
121
+ const ADMIN_LOGO = "@bison-lab/payload-core/admin-server#AdminLogo";
122
+ /** `admin.components.graphics.Icon`: the Theme mobile menu logo in the admin header. */
123
+ const ADMIN_ICON = "@bison-lab/payload-core/admin-server#AdminIcon";
124
+ /**
125
+ * The Theme Global's identity fallback and site name, read from a config
126
+ * (raw or sanitized). `undefined` when the site registered no Theme.
127
+ */
128
+ function themeAdminCustom(config) {
129
+ const theme = config.globals?.find((global) => global.slug === THEME_SLUG);
130
+ if (!theme) return void 0;
131
+ const custom = theme.admin?.custom ?? {};
132
+ const siteName = typeof custom.siteName === "string" ? custom.siteName.trim() : "";
133
+ return {
134
+ identityFallback: custom.identityFallback,
135
+ ...siteName ? { siteName } : {}
136
+ };
137
+ }
138
+ /**
139
+ * Brands the admin from the Theme Global: the login logo, the header icon
140
+ * and the tab-title suffix. Each is filled only where the site left it
141
+ * unset, so a site's own `graphics.Logo` / `Icon` or `meta.titleSuffix`
142
+ * always wins. A config without the Theme Global comes back unchanged.
143
+ *
144
+ * `adminNav()` runs it, the same way it runs `applyTranslation`, so every
145
+ * site gets it without a plugin of its own. The favicon and the login and
146
+ * reset-screen styles come from the admin head (`AdminHead`), which the
147
+ * site's `(payload)/layout.tsx` renders: they need the request, not the
148
+ * config.
149
+ */
150
+ function applyAdminBranding(config) {
151
+ const custom = themeAdminCustom(config);
152
+ if (!custom) return config;
153
+ const admin = config.admin ?? {};
154
+ const graphics = admin.components?.graphics;
155
+ const meta = admin.meta;
156
+ return {
157
+ ...config,
158
+ admin: {
159
+ ...admin,
160
+ components: {
161
+ ...admin.components,
162
+ graphics: {
163
+ ...graphics,
164
+ Logo: graphics?.Logo ?? "@bison-lab/payload-core/admin-server#AdminLogo",
165
+ Icon: graphics?.Icon ?? "@bison-lab/payload-core/admin-server#AdminIcon"
166
+ }
167
+ },
168
+ ...custom.siteName && !meta?.titleSuffix ? { meta: {
169
+ ...meta,
170
+ titleSuffix: `| ${custom.siteName} CMS`
171
+ } } : {}
172
+ }
173
+ };
174
+ }
175
+ //#endregion
176
+ export { PAGE_EDITOR_SYSTEM_KEYS as a, pageEditorTokens as c, themeAdminCustom as i, themeDocFromRequest as l, ADMIN_LOGO as n, pageEditorLooks as o, applyAdminBranding as r, pageEditorSwatches as s, ADMIN_ICON as t, themeLibraryFromDoc as u };
177
+
178
+ //# sourceMappingURL=admin-branding-CEKdfYah.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-branding-CEKdfYah.mjs","names":[],"sources":["../src/theme/looks.ts","../src/theme/admin-branding.ts"],"sourcesContent":["import { includedShadeSteps, type ShadeStep } from \"@bison-lab/tokens\";\n\nimport { stateFromColorDoc } from \"./map\";\nimport { THEME_SLUG, type ThemeColorDoc, type ThemeDoc, type ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * System colors Color Settings offers as page-editor fills. Success and\n * Destructive stay off this list — they are theme chrome only.\n */\nexport const PAGE_EDITOR_SYSTEM_KEYS = [\"primary\", \"secondary\", \"accent\", \"highlight\"] as const;\n\nexport type PageEditorSystemKey = (typeof PAGE_EDITOR_SYSTEM_KEYS)[number];\n\nexport interface LookOption {\n label: string;\n value: string;\n}\n\nconst SYSTEM_LABELS: Record<PageEditorSystemKey, string> = {\n primary: \"Primary\",\n secondary: \"Secondary\",\n accent: \"Accent\",\n highlight: \"Highlight\",\n};\n\nfunction brandColor(doc: ThemeDoc | null | undefined, key: PageEditorSystemKey): ThemeColorDoc | null {\n const brand = doc?.colors?.brand ?? doc?.brand;\n const value = brand?.[key];\n if (typeof value === \"string\" || value == null) return value == null ? null : { hex: value };\n return value;\n}\n\nexport function themeLibraryFromDoc(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return Array.isArray(doc?.colors?.library) ? doc.colors.library : [];\n}\n\nfunction libraryRows(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return themeLibraryFromDoc(doc);\n}\n\nfunction titleCase(key: string): string {\n return key.charAt(0).toUpperCase() + key.slice(1);\n}\n\nfunction stepsFor(color: ThemeColorDoc | null | undefined, fallbackHex: string): ShadeStep[] {\n return includedShadeSteps(stateFromColorDoc(color, fallbackHex));\n}\n\n/**\n * Family keys a `lookField()` may offer: the page-editor system scales\n * plus every custom color on Colors. Adding Coral on Theme makes `coral`\n * appear here with no `@bison-lab/*` release.\n */\nexport function pageEditorLooks(doc: ThemeDoc | null | undefined): LookOption[] {\n const system = PAGE_EDITOR_SYSTEM_KEYS.map((value) => ({\n label: SYSTEM_LABELS[value],\n value,\n }));\n const custom = libraryRows(doc)\n .map((row) => {\n const value = row.key?.trim();\n if (!value) return null;\n return { label: row.label?.trim() || titleCase(value), value };\n })\n .filter((option): option is LookOption => option !== null);\n return [...system, ...custom];\n}\n\n/**\n * Included steps as `coral-400`. Excluded steps do not appear. System\n * scales with no stored include list offer the full 50–950 ramp.\n */\nexport function pageEditorTokens(doc: ThemeDoc | null | undefined): LookOption[] {\n const tokens: LookOption[] = [];\n for (const key of PAGE_EDITOR_SYSTEM_KEYS) {\n const label = SYSTEM_LABELS[key];\n for (const step of stepsFor(brandColor(doc, key), \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n for (const row of libraryRows(doc)) {\n const key = row.key?.trim();\n if (!key) continue;\n const label = row.label?.trim() || titleCase(key);\n for (const step of stepsFor(row, row.hex ?? \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n return tokens;\n}\n\n/** One included step with its stored color, for a picker that draws swatches. */\nexport interface ColorSwatch extends LookOption {\n /** The family key the token starts with (`primary`, `coral`). */\n family: string;\n /** The family's label (`Primary`, `Coral`). */\n familyLabel: string;\n step: ShadeStep;\n /** The step's HSL triplet (`330 100% 43%`), the value its CSS variable holds. */\n hsl: string;\n}\n\n/**\n * `pageEditorTokens` with each step's stored color, grouped by family in\n * the same order, so an admin picker can paint a swatch without the site's\n * Theme stylesheet.\n */\nexport function pageEditorSwatches(doc: ThemeDoc | null | undefined): ColorSwatch[] {\n const swatches: ColorSwatch[] = [];\n const push = (family: string, familyLabel: string, color: ThemeColorDoc | null | undefined, fallbackHex: string) => {\n const state = stateFromColorDoc(color, fallbackHex);\n for (const step of includedShadeSteps(state)) {\n swatches.push({\n label: `${familyLabel} ${step}`,\n value: `${family}-${step}`,\n family,\n familyLabel,\n step,\n hsl: String(state.scale[step] ?? \"\"),\n });\n }\n };\n for (const key of PAGE_EDITOR_SYSTEM_KEYS) push(key, SYSTEM_LABELS[key], brandColor(doc, key), \"#000000\");\n for (const row of libraryRows(doc)) {\n const key = row.key?.trim();\n if (!key) continue;\n push(key, row.label?.trim() || titleCase(key), row, row.hex ?? \"#000000\");\n }\n return swatches;\n}\n\nexport async function themeDocFromRequest(req: {\n payload?: {\n findGlobal?: (args: {\n slug: string;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n };\n}): Promise<ThemeDoc | null> {\n try {\n const doc = await req.payload?.findGlobal?.({\n slug: THEME_SLUG,\n depth: 0,\n overrideAccess: true,\n });\n return doc ?? null;\n } catch {\n return null;\n }\n}\n","import type { Config } from \"payload\";\n\nimport type { ThemeIdentityFallback } from \"./identity\";\nimport { THEME_SLUG } from \"./types\";\n\n/** `admin.components.graphics.Logo`: the Theme logo on the login screen. */\nexport const ADMIN_LOGO = \"@bison-lab/payload-core/admin-server#AdminLogo\";\n/** `admin.components.graphics.Icon`: the Theme mobile menu logo in the admin header. */\nexport const ADMIN_ICON = \"@bison-lab/payload-core/admin-server#AdminIcon\";\n\n/** What `createTheme` leaves on the Theme Global's `admin.custom` for the admin branding. */\nexport interface ThemeAdminCustom {\n identityFallback?: ThemeIdentityFallback;\n siteName?: string;\n}\n\ninterface GlobalLike {\n slug: string;\n admin?: { custom?: Record<string, unknown> } | null;\n}\n\n/**\n * The Theme Global's identity fallback and site name, read from a config\n * (raw or sanitized). `undefined` when the site registered no Theme.\n */\nexport function themeAdminCustom(config: {\n globals?: readonly GlobalLike[] | null;\n}): ThemeAdminCustom | undefined {\n const theme = config.globals?.find((global) => global.slug === THEME_SLUG);\n if (!theme) return undefined;\n const custom = theme.admin?.custom ?? {};\n const siteName =\n typeof custom.siteName === \"string\" ? custom.siteName.trim() : \"\";\n return {\n identityFallback: custom.identityFallback as\n ThemeIdentityFallback | undefined,\n ...(siteName ? { siteName } : {}),\n };\n}\n\n/**\n * Brands the admin from the Theme Global: the login logo, the header icon\n * and the tab-title suffix. Each is filled only where the site left it\n * unset, so a site's own `graphics.Logo` / `Icon` or `meta.titleSuffix`\n * always wins. A config without the Theme Global comes back unchanged.\n *\n * `adminNav()` runs it, the same way it runs `applyTranslation`, so every\n * site gets it without a plugin of its own. The favicon and the login and\n * reset-screen styles come from the admin head (`AdminHead`), which the\n * site's `(payload)/layout.tsx` renders: they need the request, not the\n * config.\n */\nexport function applyAdminBranding(config: Config): Config {\n const custom = themeAdminCustom(config);\n if (!custom) return config;\n\n const admin = config.admin ?? {};\n const graphics = admin.components?.graphics;\n const meta = admin.meta;\n return {\n ...config,\n admin: {\n ...admin,\n components: {\n ...admin.components,\n graphics: {\n ...graphics,\n Logo: graphics?.Logo ?? ADMIN_LOGO,\n Icon: graphics?.Icon ?? ADMIN_ICON,\n },\n },\n ...(custom.siteName && !meta?.titleSuffix\n ? { meta: { ...meta, titleSuffix: `| ${custom.siteName} CMS` } }\n : {}),\n },\n };\n}\n"],"mappings":";;;;;;;AASA,MAAa,0BAA0B;CAAC;CAAW;CAAa;CAAU;CAAY;AAStF,MAAM,gBAAqD;CACzD,SAAS;CACT,WAAW;CACX,QAAQ;CACR,WAAW;CACZ;AAED,SAAS,WAAW,KAAkC,KAAgD;CAEpG,MAAM,SADQ,KAAK,QAAQ,SAAS,KAAK,SACnB;AACtB,KAAI,OAAO,UAAU,YAAY,SAAS,KAAM,QAAO,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AAO;EAEzB,GAAI,WAAW,EAAE,UAAU,GAAG,EAAE;EACjC;;;;;;;;;;;;;;AAeH,SAAgB,mBAAmB,QAAwB;CACzD,MAAM,SAAS,iBAAiB,OAAO;AACvC,KAAI,CAAC,OAAQ,QAAO;CAEpB,MAAM,QAAQ,OAAO,SAAS,EAAE;CAChC,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,OAAO,MAAM;AACnB,QAAO;EACL,GAAG;EACH,OAAO;GACL,GAAG;GACH,YAAY;IACV,GAAG,MAAM;IACT,UAAU;KACR,GAAG;KACH,MAAM,UAAU,QAAA;KAChB,MAAM,UAAU,QAAA;KACjB;IACF;GACD,GAAI,OAAO,YAAY,CAAC,MAAM,cAC1B,EAAE,MAAM;IAAE,GAAG;IAAM,aAAa,KAAK,OAAO,SAAS;IAAO,EAAE,GAC9D,EAAE;GACP;EACF"}
@@ -0,0 +1,187 @@
1
+ import { l as stateFromColorDoc, t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CkUE_uN2.mjs";
2
+ import { a as PAGE_EDITOR_SYSTEM_KEYS, i as themeAdminCustom, u as themeLibraryFromDoc } from "./admin-branding-CEKdfYah.mjs";
3
+ import { fontFaceCss, fontPreloads } from "@bison-lab/fonts";
4
+ import { buildThemeCss, generateNamedScaleCSS, lookBindingCss, themeFontIds } from "@bison-lab/tokens";
5
+ //#region src/theme/look-css.ts
6
+ /**
7
+ * Custom `--coral-*` variables plus `[data-look]` bindings for every
8
+ * page-editor family. System bindings always ship so a look key paints
9
+ * before anyone adds a custom scale.
10
+ */
11
+ function themeLookCss(library) {
12
+ const rows = Array.isArray(library) ? library : [];
13
+ const customKeys = [];
14
+ const scaleLines = [];
15
+ for (const row of rows) {
16
+ const key = row.key?.trim();
17
+ if (!key) continue;
18
+ customKeys.push(key);
19
+ const state = stateFromColorDoc(row, row.hex ?? "#000000");
20
+ scaleLines.push(generateNamedScaleCSS(key, state.scale));
21
+ }
22
+ return [scaleLines.length ? `:root {\n${scaleLines.join("\n")}\n}` : "", lookBindingCss([...PAGE_EDITOR_SYSTEM_KEYS, ...customKeys])].filter(Boolean).join("\n\n");
23
+ }
24
+ //#endregion
25
+ //#region src/theme/head.ts
26
+ /**
27
+ * `@font-face` plus `buildThemeCss` as one stylesheet, and the preload
28
+ * list for the families the config names. A root layout (and the admin
29
+ * layout, if it should restyle too) renders `css` in a `<style>` and
30
+ * each preload as `<link rel="preload" as="font">`.
31
+ *
32
+ * `library` adds custom `--coral-*` variables and `[data-look]` bindings
33
+ * so a Color Settings scale paints the moment it is published.
34
+ */
35
+ function themeHead(config, options = {}) {
36
+ const fontsBaseUrl = options.fontsBaseUrl ?? "/fonts";
37
+ const ids = themeFontIds(config);
38
+ const faces = fontFaceCss(ids, fontsBaseUrl);
39
+ const theme = buildThemeCss(config, { attribute: options.attribute });
40
+ const looks = themeLookCss(options.library);
41
+ const body = looks ? `${theme}\n\n${looks}` : theme;
42
+ return {
43
+ css: faces ? `${faces}\n\n${body}` : body,
44
+ preloads: fontPreloads(ids, fontsBaseUrl),
45
+ identity: options.identity
46
+ };
47
+ }
48
+ /**
49
+ * `themeHead` plus the custom scales on the Theme document. Sites that
50
+ * still call `themeHead(getPublishedTheme())` keep working; they miss
51
+ * `--coral-*` until they pass `library` or switch here.
52
+ */
53
+ function themeHeadFromDoc(doc, seed, options = {}) {
54
+ return themeHead(themeConfigFromDoc(doc, seed), {
55
+ ...options,
56
+ library: themeLibraryFromDoc(doc)
57
+ });
58
+ }
59
+ //#endregion
60
+ //#region src/theme/admin-head.ts
61
+ /**
62
+ * The live Theme row at depth 1 (upload urls populated). A failed read
63
+ * (a database not migrated yet) logs and answers `null`, so the login
64
+ * screen still renders, with the fallback art, rather than locking
65
+ * everyone out of the admin.
66
+ */
67
+ async function readThemeDoc(payload) {
68
+ try {
69
+ return await payload.findGlobal({
70
+ slug: "theme",
71
+ draft: false,
72
+ depth: 1,
73
+ overrideAccess: true
74
+ }) ?? null;
75
+ } catch (error) {
76
+ payload.logger?.error({
77
+ err: error,
78
+ msg: "Admin branding could not read the Theme; showing the fallback"
79
+ });
80
+ return null;
81
+ }
82
+ }
83
+ /** Uploaded logo, dark logo, mark and favicon, else the Theme Global's fallback. */
84
+ async function getAdminIdentity(payload) {
85
+ return resolveThemeIdentity(await readThemeDoc(payload), themeAdminCustom(payload.config)?.identityFallback);
86
+ }
87
+ /**
88
+ * A url as a quoted CSS string that cannot close the string, the rule or
89
+ * the `<style>` element it is written into.
90
+ */
91
+ function cssUrl(url) {
92
+ return `url("${url.replace(/[\u0000-\u001f\u007f]/g, "").replace(/["'\\()<>]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`)}")`;
93
+ }
94
+ /**
95
+ * The login and auth-screen stylesheet. Every auth screen (login, forgot
96
+ * password, reset password, create first user, unauthorized) renders
97
+ * through Payload's MinimalTemplate, and reset has no custom-view hook, so
98
+ * this is all CSS on `.template-minimal`. Colors are Theme variables
99
+ * (`--primary` and its 50–950 scale), so the rules never change: the
100
+ * Theme `<style>` beside them does. Forgot and reset have no logo slot,
101
+ * so the logo reaches them as a pseudo-element; login has its own
102
+ * (`graphics.Logo`).
103
+ *
104
+ * In `@layer payload`, which Payload declares after its own
105
+ * `payload-default`, so these win on layer order, not specificity.
106
+ */
107
+ function adminAuthCss(identity) {
108
+ const logo = identity.lockup ?? identity.mark;
109
+ const darkLogo = identity.lockup ? identity.lockupDark : null;
110
+ return [
111
+ `/* Admin auth screens, from the published Theme (@bison-lab/payload-core adminAuthCss). */`,
112
+ `@layer payload {`,
113
+ ` .template-minimal {`,
114
+ ` background-color: var(--theme-elevation-50);`,
115
+ ` background-image: radial-gradient(80% 100% at 50% 0%, hsl(var(--primary) / 0.08), transparent 60%);`,
116
+ ` }`,
117
+ ` .template-minimal__wrap {`,
118
+ ` position: relative;`,
119
+ ` overflow: hidden;`,
120
+ ` padding: calc(var(--base) * 1.75) calc(var(--base) * 1.5);`,
121
+ ` background-color: var(--theme-elevation-0);`,
122
+ ` border: 1px solid var(--theme-border-color);`,
123
+ ` border-radius: var(--style-radius-l);`,
124
+ ` box-shadow: var(--shadow-md);`,
125
+ ` }`,
126
+ ` .template-minimal__wrap::after {`,
127
+ ` content: "";`,
128
+ ` position: absolute;`,
129
+ ` inset-block-start: 0;`,
130
+ ` inset-inline: 0;`,
131
+ ` height: 3px;`,
132
+ ` background-image: linear-gradient(90deg, hsl(var(--primary-700)), hsl(var(--primary-500)), hsl(var(--primary-300)));`,
133
+ ` }`,
134
+ ` .template-minimal .btn--style-primary {`,
135
+ ` --bg-color: hsl(var(--primary));`,
136
+ ` --color: hsl(var(--primary-foreground));`,
137
+ ` --hover-bg: hsl(var(--primary-700));`,
138
+ ` --hover-color: hsl(var(--primary-foreground));`,
139
+ ` }`,
140
+ ` .template-minimal a:not(.btn) {`,
141
+ ` color: hsl(var(--primary-700));`,
142
+ ` }`,
143
+ ` [data-theme="dark"] .template-minimal a:not(.btn) {`,
144
+ ` color: hsl(var(--primary-300));`,
145
+ ` }`,
146
+ ...logo ? [
147
+ ` .template-minimal:not(.login) .template-minimal__wrap::before {`,
148
+ ` content: "";`,
149
+ ` display: block;`,
150
+ ` height: calc(var(--base) * 2);`,
151
+ ` margin: 0 auto calc(var(--base) * 1.25);`,
152
+ ` background: ${cssUrl(logo.url)} center / contain no-repeat;`,
153
+ ` }`,
154
+ ...darkLogo ? [
155
+ ` [data-theme="dark"] .template-minimal:not(.login) .template-minimal__wrap::before {`,
156
+ ` background-image: ${cssUrl(darkLogo.url)};`,
157
+ ` }`
158
+ ] : []
159
+ ] : [],
160
+ `}`
161
+ ].join("\n");
162
+ }
163
+ /**
164
+ * Everything the admin `<head>` needs from the Theme, read once per
165
+ * request: the Theme stylesheet (`themeHeadFromDoc`, dark palette on
166
+ * `[data-theme="dark"]`), the auth-screen rules after it, the font
167
+ * preloads, and the favicon. No cache, so a Theme save shows on the next
168
+ * request. `AdminHead` in `@bison-lab/payload-core/admin-server` renders it.
169
+ */
170
+ async function getAdminHead(payload, seed, options = {}) {
171
+ const doc = await readThemeDoc(payload);
172
+ const identity = resolveThemeIdentity(doc, themeAdminCustom(payload.config)?.identityFallback);
173
+ const theme = themeHeadFromDoc(doc, seed, {
174
+ fontsBaseUrl: options.fontsBaseUrl,
175
+ attribute: options.attribute ?? "data-theme"
176
+ });
177
+ return {
178
+ css: `${theme.css}\n\n${adminAuthCss(identity)}`,
179
+ preloads: theme.preloads,
180
+ favicon: identity.favicon,
181
+ identity
182
+ };
183
+ }
184
+ //#endregion
185
+ export { themeHeadFromDoc as a, themeHead as i, getAdminHead as n, getAdminIdentity as r, adminAuthCss as t };
186
+
187
+ //# sourceMappingURL=admin-head-CcpH7P4C.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-head-CcpH7P4C.mjs","names":[],"sources":["../src/theme/look-css.ts","../src/theme/head.ts","../src/theme/admin-head.ts"],"sourcesContent":["import { generateNamedScaleCSS, lookBindingCss } from \"@bison-lab/tokens\";\n\nimport { PAGE_EDITOR_SYSTEM_KEYS } from \"./looks\";\nimport { stateFromColorDoc } from \"./map\";\nimport type { ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * Custom `--coral-*` variables plus `[data-look]` bindings for every\n * page-editor family. System bindings always ship so a look key paints\n * before anyone adds a custom scale.\n */\nexport function themeLookCss(library?: ThemeLibraryColorDoc[] | null): string {\n const rows = Array.isArray(library) ? library : [];\n const customKeys: string[] = [];\n const scaleLines: string[] = [];\n\n for (const row of rows) {\n const key = row.key?.trim();\n if (!key) continue;\n customKeys.push(key);\n const state = stateFromColorDoc(row, row.hex ?? \"#000000\");\n scaleLines.push(generateNamedScaleCSS(key, state.scale));\n }\n\n const scales = scaleLines.length ? `:root {\\n${scaleLines.join(\"\\n\")}\\n}` : \"\";\n const bindings = lookBindingCss([...PAGE_EDITOR_SYSTEM_KEYS, ...customKeys]);\n return [scales, bindings].filter(Boolean).join(\"\\n\\n\");\n}\n","import { fontFaceCss, fontPreloads } from \"@bison-lab/fonts\";\nimport { buildThemeCss, themeFontIds, type ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { themeLookCss } from \"./look-css\";\nimport { themeLibraryFromDoc } from \"./looks\";\nimport { themeConfigFromDoc } from \"./map\";\nimport type { ThemeDoc, ThemeHead, ThemeHeadOptions } from \"./types\";\n\n/**\n * `@font-face` plus `buildThemeCss` as one stylesheet, and the preload\n * list for the families the config names. A root layout (and the admin\n * layout, if it should restyle too) renders `css` in a `<style>` and\n * each preload as `<link rel=\"preload\" as=\"font\">`.\n *\n * `library` adds custom `--coral-*` variables and `[data-look]` bindings\n * so a Color Settings scale paints the moment it is published.\n */\nexport function themeHead(config: ThemeConfig, options: ThemeHeadOptions = {}): ThemeHead {\n const fontsBaseUrl = options.fontsBaseUrl ?? \"/fonts\";\n const ids = themeFontIds(config);\n const faces = fontFaceCss(ids, fontsBaseUrl);\n const theme = buildThemeCss(config, { attribute: options.attribute });\n const looks = themeLookCss(options.library);\n const body = looks ? `${theme}\\n\\n${looks}` : theme;\n return {\n css: faces ? `${faces}\\n\\n${body}` : body,\n preloads: fontPreloads(ids, fontsBaseUrl),\n identity: options.identity,\n };\n}\n\n/**\n * `themeHead` plus the custom scales on the Theme document. Sites that\n * still call `themeHead(getPublishedTheme())` keep working; they miss\n * `--coral-*` until they pass `library` or switch here.\n */\nexport function themeHeadFromDoc(\n doc: ThemeDoc | null | undefined,\n seed: ThemeConfig,\n options: Omit<ThemeHeadOptions, \"library\"> = {},\n): ThemeHead {\n return themeHead(themeConfigFromDoc(doc, seed), {\n ...options,\n library: themeLibraryFromDoc(doc),\n });\n}\n","import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { themeAdminCustom } from \"./admin-branding\";\nimport { themeHeadFromDoc } from \"./head\";\nimport {\n resolveThemeIdentity,\n type ResolvedThemeIdentity,\n type ThemeIdentityAsset,\n} from \"./identity\";\nimport type { ThemePayload } from \"./published\";\nimport { THEME_SLUG, type ThemeDoc, type ThemeHead } from \"./types\";\n\n/**\n * The `payload` a server component gets: the Theme reader plus the\n * sanitized config, where `createTheme` left the identity fallback.\n */\nexport interface AdminBrandingPayload extends ThemePayload {\n config: {\n globals?:\n | readonly {\n slug: string;\n admin?: { custom?: Record<string, unknown> } | null;\n }[]\n | null;\n };\n logger?: { error: (details: { err: unknown; msg: string }) => void };\n}\n\nexport interface AdminHeadOptions {\n /** Where the site's `serveFont` route answers. Default `\"/fonts\"`. */\n fontsBaseUrl?: string;\n /** Default `\"data-theme\"`: the attribute Payload flips on `<html>` for its own dark mode. */\n attribute?: \"class\" | \"data-theme\";\n}\n\nexport interface AdminHeadData extends Pick<ThemeHead, \"css\" | \"preloads\"> {\n /** The Theme favicon (upload, else the fallback), or `null` to keep Payload's. */\n favicon: ThemeIdentityAsset | null;\n identity: ResolvedThemeIdentity;\n}\n\n/**\n * The live Theme row at depth 1 (upload urls populated). A failed read\n * (a database not migrated yet) logs and answers `null`, so the login\n * screen still renders, with the fallback art, rather than locking\n * everyone out of the admin.\n */\nasync function readThemeDoc(\n payload: AdminBrandingPayload,\n): Promise<ThemeDoc | null> {\n try {\n return (\n (await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n })) ?? null\n );\n } catch (error) {\n payload.logger?.error({\n err: error,\n msg: \"Admin branding could not read the Theme; showing the fallback\",\n });\n return null;\n }\n}\n\n/** Uploaded logo, dark logo, mark and favicon, else the Theme Global's fallback. */\nexport async function getAdminIdentity(\n payload: AdminBrandingPayload,\n): Promise<ResolvedThemeIdentity> {\n const doc = await readThemeDoc(payload);\n return resolveThemeIdentity(\n doc,\n themeAdminCustom(payload.config)?.identityFallback,\n );\n}\n\n/**\n * A url as a quoted CSS string that cannot close the string, the rule or\n * the `<style>` element it is written into.\n */\nfunction cssUrl(url: string): string {\n const safe = url\n .replace(/[\\u0000-\\u001f\\u007f]/g, \"\")\n .replace(\n /[\"'\\\\()<>]/g,\n (char) =>\n `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`,\n );\n return `url(\"${safe}\")`;\n}\n\n/**\n * The login and auth-screen stylesheet. Every auth screen (login, forgot\n * password, reset password, create first user, unauthorized) renders\n * through Payload's MinimalTemplate, and reset has no custom-view hook, so\n * this is all CSS on `.template-minimal`. Colors are Theme variables\n * (`--primary` and its 50–950 scale), so the rules never change: the\n * Theme `<style>` beside them does. Forgot and reset have no logo slot,\n * so the logo reaches them as a pseudo-element; login has its own\n * (`graphics.Logo`).\n *\n * In `@layer payload`, which Payload declares after its own\n * `payload-default`, so these win on layer order, not specificity.\n */\nexport function adminAuthCss(identity: ResolvedThemeIdentity): string {\n const logo = identity.lockup ?? identity.mark;\n const darkLogo = identity.lockup ? identity.lockupDark : null;\n const logoRules = logo\n ? [\n ` .template-minimal:not(.login) .template-minimal__wrap::before {`,\n ` content: \"\";`,\n ` display: block;`,\n ` height: calc(var(--base) * 2);`,\n ` margin: 0 auto calc(var(--base) * 1.25);`,\n ` background: ${cssUrl(logo.url)} center / contain no-repeat;`,\n ` }`,\n ...(darkLogo\n ? [\n ` [data-theme=\"dark\"] .template-minimal:not(.login) .template-minimal__wrap::before {`,\n ` background-image: ${cssUrl(darkLogo.url)};`,\n ` }`,\n ]\n : []),\n ]\n : [];\n\n return [\n `/* Admin auth screens, from the published Theme (@bison-lab/payload-core adminAuthCss). */`,\n `@layer payload {`,\n ` .template-minimal {`,\n ` background-color: var(--theme-elevation-50);`,\n ` background-image: radial-gradient(80% 100% at 50% 0%, hsl(var(--primary) / 0.08), transparent 60%);`,\n ` }`,\n ` .template-minimal__wrap {`,\n ` position: relative;`,\n ` overflow: hidden;`,\n ` padding: calc(var(--base) * 1.75) calc(var(--base) * 1.5);`,\n ` background-color: var(--theme-elevation-0);`,\n ` border: 1px solid var(--theme-border-color);`,\n ` border-radius: var(--style-radius-l);`,\n ` box-shadow: var(--shadow-md);`,\n ` }`,\n ` .template-minimal__wrap::after {`,\n ` content: \"\";`,\n ` position: absolute;`,\n ` inset-block-start: 0;`,\n ` inset-inline: 0;`,\n ` height: 3px;`,\n ` background-image: linear-gradient(90deg, hsl(var(--primary-700)), hsl(var(--primary-500)), hsl(var(--primary-300)));`,\n ` }`,\n ` .template-minimal .btn--style-primary {`,\n ` --bg-color: hsl(var(--primary));`,\n ` --color: hsl(var(--primary-foreground));`,\n ` --hover-bg: hsl(var(--primary-700));`,\n ` --hover-color: hsl(var(--primary-foreground));`,\n ` }`,\n ` .template-minimal a:not(.btn) {`,\n ` color: hsl(var(--primary-700));`,\n ` }`,\n ` [data-theme=\"dark\"] .template-minimal a:not(.btn) {`,\n ` color: hsl(var(--primary-300));`,\n ` }`,\n ...logoRules,\n `}`,\n ].join(\"\\n\");\n}\n\n/**\n * Everything the admin `<head>` needs from the Theme, read once per\n * request: the Theme stylesheet (`themeHeadFromDoc`, dark palette on\n * `[data-theme=\"dark\"]`), the auth-screen rules after it, the font\n * preloads, and the favicon. No cache, so a Theme save shows on the next\n * request. `AdminHead` in `@bison-lab/payload-core/admin-server` renders it.\n */\nexport async function getAdminHead(\n payload: AdminBrandingPayload,\n seed: ThemeConfig,\n options: AdminHeadOptions = {},\n): Promise<AdminHeadData> {\n const doc = await readThemeDoc(payload);\n const identity = resolveThemeIdentity(\n doc,\n themeAdminCustom(payload.config)?.identityFallback,\n );\n const theme = themeHeadFromDoc(doc, seed, {\n fontsBaseUrl: options.fontsBaseUrl,\n attribute: options.attribute ?? \"data-theme\",\n });\n return {\n css: `${theme.css}\\n\\n${adminAuthCss(identity)}`,\n preloads: theme.preloads,\n favicon: identity.favicon,\n identity,\n };\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,aAAa,SAAiD;CAC5E,MAAM,OAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,EAAE;CAClD,MAAM,aAAuB,EAAE;CAC/B,MAAM,aAAuB,EAAE;AAE/B,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,MAAM,IAAI,KAAK,MAAM;AAC3B,MAAI,CAAC,IAAK;AACV,aAAW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