@bison-lab/payload-core 4.35.0 → 4.36.1

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 (52) hide show
  1. package/README.md +23 -1
  2. package/dist/admin.mjs +5 -2
  3. package/dist/admin.mjs.map +1 -1
  4. package/dist/block-library.d.mts +1 -1
  5. package/dist/{block-thumbnails-VRxpSXw1.mjs → block-thumbnails-DXOUzGjY.mjs} +1 -1
  6. package/dist/{block-thumbnails-VRxpSXw1.mjs.map → block-thumbnails-DXOUzGjY.mjs.map} +1 -1
  7. package/dist/block-thumbnails-cli.mjs +1 -1
  8. package/dist/block-thumbnails.mjs +1 -1
  9. package/dist/{catalogue-CEfYwTSK.d.mts → catalogue-PvKGCih7.d.mts} +1 -1
  10. package/dist/{catalogue-CEfYwTSK.d.mts.map → catalogue-PvKGCih7.d.mts.map} +1 -1
  11. package/dist/{facet-field-BvQp8Hzh.d.mts → facet-field-CZbLDAQz.d.mts} +1 -1
  12. package/dist/{facet-field-BvQp8Hzh.d.mts.map → facet-field-CZbLDAQz.d.mts.map} +1 -1
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +113 -6
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/locale-CFWfB4wP.mjs +12 -0
  18. package/dist/locale-CFWfB4wP.mjs.map +1 -0
  19. package/dist/locale-CxFNy8ex.d.mts +15 -0
  20. package/dist/locale-CxFNy8ex.d.mts.map +1 -0
  21. package/dist/metadata.d.mts +1 -1
  22. package/dist/navigation.d.mts +3 -2
  23. package/dist/navigation.mjs +1 -1
  24. package/dist/og.d.mts +2 -2
  25. package/dist/og.mjs +1 -1
  26. package/dist/{preview-Cgbh9eAq.d.mts → preview-v-GlYuqa.d.mts} +2 -2
  27. package/dist/{preview-Cgbh9eAq.d.mts.map → preview-v-GlYuqa.d.mts.map} +1 -1
  28. package/dist/{published-Dsg-HX-v.d.mts → published-B3IYStMQ.d.mts} +7 -4
  29. package/dist/published-B3IYStMQ.d.mts.map +1 -0
  30. package/dist/{published-BLXCep6Z.d.mts → published-Cow49CSZ.d.mts} +7 -3
  31. package/dist/published-Cow49CSZ.d.mts.map +1 -0
  32. package/dist/{published-CEuK5ym6.mjs → published-DACERo16.mjs} +13 -5
  33. package/dist/published-DACERo16.mjs.map +1 -0
  34. package/dist/{published-DgAzpDSG.mjs → published-DefZv9na.mjs} +8 -3
  35. package/dist/published-DefZv9na.mjs.map +1 -0
  36. package/dist/taxonomy.d.mts +1 -1
  37. package/dist/theme.d.mts +5 -4
  38. package/dist/theme.d.mts.map +1 -1
  39. package/dist/theme.mjs +1 -1
  40. package/dist/{title-C8ppEDlc.d.mts → title-DFKu53nG.d.mts} +1 -1
  41. package/dist/{title-C8ppEDlc.d.mts.map → title-DFKu53nG.d.mts.map} +1 -1
  42. package/dist/{types-D6jQql5Z.d.mts → types-B7Hy1Ho-.d.mts} +1 -1
  43. package/dist/{types-D6jQql5Z.d.mts.map → types-B7Hy1Ho-.d.mts.map} +1 -1
  44. package/dist/wireframe-cli.mjs +1 -1
  45. package/dist/{wireframe-sJW8Q4NS.mjs → wireframe-xcJNJzBf.mjs} +1 -1
  46. package/dist/{wireframe-sJW8Q4NS.mjs.map → wireframe-xcJNJzBf.mjs.map} +1 -1
  47. package/dist/wireframe.mjs +1 -1
  48. package/package.json +3 -3
  49. package/dist/published-BLXCep6Z.d.mts.map +0 -1
  50. package/dist/published-CEuK5ym6.mjs.map +0 -1
  51. package/dist/published-DgAzpDSG.mjs.map +0 -1
  52. package/dist/published-Dsg-HX-v.d.mts.map +0 -1
@@ -0,0 +1,12 @@
1
+ //#region src/locale.ts
2
+ /** The `locale` / `fallbackLocale` arguments to spread into a read, only when set. */
3
+ function localeArgs({ locale, fallbackLocale } = {}) {
4
+ return {
5
+ ...locale !== void 0 ? { locale } : {},
6
+ ...fallbackLocale !== void 0 ? { fallbackLocale } : {}
7
+ };
8
+ }
9
+ //#endregion
10
+ export { localeArgs as t };
11
+
12
+ //# sourceMappingURL=locale-CFWfB4wP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-CFWfB4wP.mjs","names":[],"sources":["../src/locale.ts"],"sourcesContent":["/**\n * Which locale a read returns, as Payload's Local API takes it. Omit both\n * on a single-locale site. On a multi-locale site pass the request's\n * locale, or a Spanish page renders the default locale's copy.\n * `fallbackLocale: false` returns empty where the locale has no value\n * instead of the default locale's.\n */\nexport interface LocaleRead {\n locale?: string;\n fallbackLocale?: string | false;\n}\n\n/** The `locale` / `fallbackLocale` arguments to spread into a read, only when set. */\nexport function localeArgs({ locale, fallbackLocale }: LocaleRead = {}): LocaleRead {\n return {\n ...(locale !== undefined ? { locale } : {}),\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n };\n}\n"],"mappings":";;AAaA,SAAgB,WAAW,EAAE,QAAQ,mBAA+B,EAAE,EAAc;AAClF,QAAO;EACL,GAAI,WAAW,KAAA,IAAY,EAAE,QAAQ,GAAG,EAAE;EAC1C,GAAI,mBAAmB,KAAA,IAAY,EAAE,gBAAgB,GAAG,EAAE;EAC3D"}
@@ -0,0 +1,15 @@
1
+ //#region src/locale.d.ts
2
+ /**
3
+ * Which locale a read returns, as Payload's Local API takes it. Omit both
4
+ * on a single-locale site. On a multi-locale site pass the request's
5
+ * locale, or a Spanish page renders the default locale's copy.
6
+ * `fallbackLocale: false` returns empty where the locale has no value
7
+ * instead of the default locale's.
8
+ */
9
+ interface LocaleRead {
10
+ locale?: string;
11
+ fallbackLocale?: string | false;
12
+ }
13
+ //#endregion
14
+ export { LocaleRead as t };
15
+ //# sourceMappingURL=locale-CxFNy8ex.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-CxFNy8ex.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAOA;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-C8ppEDlc.mjs";
1
+ import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-DFKu53nG.mjs";
2
2
 
3
3
  //#region src/seo/metadata.d.ts
4
4
  /** A page as the reader needs it; a site's generated `Page` is assignable. */
@@ -1,2 +1,3 @@
1
- import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-Dsg-HX-v.mjs";
2
- export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, type FooterColumnWidth, type FooterSocial, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
1
+ import { t as LocaleRead } from "./locale-CxFNy8ex.mjs";
2
+ import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-B3IYStMQ.mjs";
3
+ export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, type FooterColumnWidth, type FooterSocial, type LocaleRead, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
@@ -1,2 +1,2 @@
1
- import { C as NAVIGATION_SLUG, S as NAVIGATION_FOOTER_SLUG, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, c as footerDesktopTracks, f as validateFooterSocialUrl, h as isValidExternalHref, i as FOOTER_MAX_COLUMNS, o as FOOTER_SOCIALS, p as EXTERNAL_HREF_MESSAGE, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as normalizeFooterDesktop, v as validateHeaderCta, x as NAVIGATION_FOOTER_DB_NAME, y as NAVIGATION_DB_NAME } from "./published-CEuK5ym6.mjs";
1
+ import { C as NAVIGATION_SLUG, S as NAVIGATION_FOOTER_SLUG, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, c as footerDesktopTracks, f as validateFooterSocialUrl, h as isValidExternalHref, i as FOOTER_MAX_COLUMNS, o as FOOTER_SOCIALS, p as EXTERNAL_HREF_MESSAGE, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as normalizeFooterDesktop, v as validateHeaderCta, x as NAVIGATION_FOOTER_DB_NAME, y as NAVIGATION_DB_NAME } from "./published-DACERo16.mjs";
2
2
  export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
package/dist/og.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as ThemeIdentityFallback } from "./types-D6jQql5Z.mjs";
2
- import { t as ThemePayload } from "./published-BLXCep6Z.mjs";
1
+ import { _ as ThemeIdentityFallback } from "./types-B7Hy1Ho-.mjs";
2
+ import { t as ThemePayload } from "./published-Cow49CSZ.mjs";
3
3
  import { FontId } from "@bison-lab/fonts";
4
4
  import { ThemeConfig } from "@bison-lab/tokens";
5
5
  import { Payload } from "payload";
package/dist/og.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
2
2
  import "./identity-CN6EOeDM.mjs";
3
- import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-DgAzpDSG.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-DefZv9na.mjs";
4
4
  import { isFontId } from "@bison-lab/fonts";
5
5
  import { auditTheme, brandColorsFromConfig, deriveDarkPalette, deriveLightPalette } from "@bison-lab/tokens";
6
6
  import * as fontsServer from "@bison-lab/fonts/server";
@@ -1,4 +1,4 @@
1
- import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-D6jQql5Z.mjs";
1
+ import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-B7Hy1Ho-.mjs";
2
2
  import { ShadeStep } from "@bison-lab/tokens";
3
3
  import { StaticLabel, TextField, TextFieldSingleValidation } from "payload";
4
4
 
@@ -110,4 +110,4 @@ declare const THEME_PREVIEW_BREAKPOINTS: readonly [{
110
110
  }];
111
111
  //#endregion
112
112
  export { deleteLibraryColor as _, PageEditorSystemKey as a, pageEditorTokens as c, LookFieldOptions as d, colorTokenField as f, rewriteColorTokens as g, findColorTokens as h, PAGE_EDITOR_SYSTEM_KEYS as i, themeLibraryFromDoc as l, ColorTokenHit as m, ColorSwatch as n, pageEditorLooks as o, lookField as p, LookOption as r, pageEditorSwatches as s, THEME_PREVIEW_BREAKPOINTS as t, LookFieldMode as u, rewriteColorToken as v, themeColorKeys as y };
113
- //# sourceMappingURL=preview-Cgbh9eAq.d.mts.map
113
+ //# sourceMappingURL=preview-v-GlYuqa.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview-Cgbh9eAq.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
1
+ {"version":3,"file":"preview-v-GlYuqa.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
@@ -1,3 +1,4 @@
1
+ import { t as LocaleRead } from "./locale-CxFNy8ex.mjs";
1
2
  import { ArrayFieldValidation, Block, Field, GlobalConfig } from "payload";
2
3
 
3
4
  //#region src/navigation/types.d.ts
@@ -46,7 +47,7 @@ interface NavigationDoc {
46
47
  footer: NavigationFooter;
47
48
  bar: NavigationBar;
48
49
  }
49
- interface GetNavigationArgs {
50
+ interface GetNavigationArgs extends LocaleRead {
50
51
  payload: {
51
52
  findGlobal: (args: {
52
53
  slug: string;
@@ -126,12 +127,14 @@ declare function validateFooterSocialUrl(value: unknown): true | string;
126
127
  * site header does not learn two slugs. `bar` is the hidden Header group
127
128
  * (hide on scroll, viewport, default panel width). `draft: true`
128
129
  * reads the newest version; omit it (or pass false) for the published
129
- * documents.
130
+ * documents. A multi-locale site passes the request's `locale` (and
131
+ * `fallbackLocale`), so the labels and footer copy read in that locale.
130
132
  */
131
133
  declare function getNavigation({
132
134
  payload,
133
- draft
135
+ draft,
136
+ ...read
134
137
  }: GetNavigationArgs): Promise<NavigationDoc>;
135
138
  //#endregion
136
139
  export { NAVIGATION_FOOTER_SLUG as C, NavigationFooter as D, NavigationDoc as E, NavigationHeader as O, NAVIGATION_FOOTER_DB_NAME as S, NavigationBar as T, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_DB_NAME as b, FooterColumnWidth as c, normalizeFooterDesktop as d, validateFooterColumns as f, isValidExternalHref as g, headerCtaEnabled as h, FOOTER_MAX_COLUMNS as i, FooterSocial as l, EXTERNAL_HREF_MESSAGE as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, validateFooterSocialUrl as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, footerDesktopTracks as u, validateHeaderCta as v, NAVIGATION_SLUG as w, NAVIGATION_FEATURE as x, CreateNavigationOptions as y };
137
- //# sourceMappingURL=published-Dsg-HX-v.d.mts.map
140
+ //# sourceMappingURL=published-B3IYStMQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-B3IYStMQ.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;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,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
@@ -1,4 +1,5 @@
1
- import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-D6jQql5Z.mjs";
1
+ import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-B7Hy1Ho-.mjs";
2
+ import { t as LocaleRead } from "./locale-CxFNy8ex.mjs";
2
3
  import { ThemeConfig } from "@bison-lab/tokens";
3
4
 
4
5
  //#region src/theme/published.d.ts
@@ -19,8 +20,11 @@ declare function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Pr
19
20
  /**
20
21
  * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site
21
22
  * passed into `createTheme`. Depth 1 so the upload url is populated.
23
+ * Takes the request's `locale` like every other reader. Theme and its
24
+ * brand assets hold no localized field today (a logo's alt is the brand
25
+ * name), so it only matters once one does.
22
26
  */
23
- declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback): Promise<ResolvedThemeIdentity>;
27
+ declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback, read?: LocaleRead): Promise<ResolvedThemeIdentity>;
24
28
  //#endregion
25
29
  export { getPublishedIdentity as n, getPublishedTheme as r, ThemePayload as t };
26
- //# sourceMappingURL=published-BLXCep6Z.d.mts.map
30
+ //# sourceMappingURL=published-Cow49CSZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-Cow49CSZ.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
@@ -1,3 +1,4 @@
1
+ import { t as localeArgs } from "./locale-CFWfB4wP.mjs";
1
2
  //#region src/navigation/types.ts
2
3
  const NAVIGATION_SLUG = "navigation";
3
4
  const NAVIGATION_DB_NAME = "nav";
@@ -100,6 +101,7 @@ function linkFields({ required = false, pagesCollection } = {}) {
100
101
  {
101
102
  name: "label",
102
103
  type: "text",
104
+ localized: true,
103
105
  label: "Label",
104
106
  required
105
107
  },
@@ -327,6 +329,7 @@ function footerColumnsField({ pagesCollection } = {}) {
327
329
  fields: [{
328
330
  name: "heading",
329
331
  type: "text",
332
+ localized: true,
330
333
  label: "Section Label",
331
334
  required: true
332
335
  }, {
@@ -365,6 +368,7 @@ function footerBrandField() {
365
368
  {
366
369
  name: "tagline",
367
370
  type: "textarea",
371
+ localized: true,
368
372
  label: "Text below the logo"
369
373
  },
370
374
  ...socialFields()
@@ -396,17 +400,21 @@ function barOf(doc) {
396
400
  * site header does not learn two slugs. `bar` is the hidden Header group
397
401
  * (hide on scroll, viewport, default panel width). `draft: true`
398
402
  * reads the newest version; omit it (or pass false) for the published
399
- * documents.
403
+ * documents. A multi-locale site passes the request's `locale` (and
404
+ * `fallbackLocale`), so the labels and footer copy read in that locale.
400
405
  */
401
- async function getNavigation({ payload, draft = false }) {
406
+ async function getNavigation({ payload, draft = false, ...read }) {
407
+ const locale = localeArgs(read);
402
408
  const [headerDoc, footerDoc] = await Promise.all([payload.findGlobal({
403
409
  slug: NAVIGATION_SLUG,
404
410
  draft,
405
- depth: 1
411
+ depth: 1,
412
+ ...locale
406
413
  }), payload.findGlobal({
407
414
  slug: NAVIGATION_FOOTER_SLUG,
408
415
  draft,
409
- depth: 1
416
+ depth: 1,
417
+ ...locale
410
418
  })]);
411
419
  return {
412
420
  header: headerOf(headerDoc),
@@ -417,4 +425,4 @@ async function getNavigation({ payload, draft = false }) {
417
425
  //#endregion
418
426
  export { NAVIGATION_SLUG as C, NAVIGATION_FOOTER_SLUG as S, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_FEATURE as b, footerDesktopTracks as c, validateFooterColumns as d, validateFooterSocialUrl as f, linkField as g, isValidExternalHref as h, FOOTER_MAX_COLUMNS as i, footerFields as l, headerCtaEnabled as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, EXTERNAL_HREF_MESSAGE as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, normalizeFooterDesktop as u, validateHeaderCta as v, NAVIGATION_FOOTER_DB_NAME as x, NAVIGATION_DB_NAME as y };
419
427
 
420
- //# sourceMappingURL=published-CEuK5ym6.mjs.map
428
+ //# sourceMappingURL=published-DACERo16.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-DACERo16.mjs","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"sourcesContent":["/**\n * Public Header and Footer as two Globals so each has its own Save /\n * Publish / drafts. Bar behaviour (`bar` on Header) stays in the schema\n * with `admin.hidden`; it is not a Settings tab. Featured looks stay on\n * chrome roles (BIS-85 / SPI-89), not a Header array. The items kit\n * editor is the workspace field (BIS-119 / BIS-121). Payload's left nav\n * stays until BIS-90. The Spinal bump is SPI-99.\n */\n\nimport type { Block, GlobalConfig } from \"payload\";\n\nimport type { LocaleRead } from \"../locale\";\n\nexport const NAVIGATION_SLUG = \"navigation\";\nexport const NAVIGATION_DB_NAME = \"nav\";\nexport const NAVIGATION_FOOTER_SLUG = \"navigation-footer\";\nexport const NAVIGATION_FOOTER_DB_NAME = \"navf\";\n\nexport const NAVIGATION_FEATURE = \"navigation\";\n\nexport interface CreateNavigationOptions {\n /**\n * Header bar blocks this site offers. The field stays a blocks array —\n * a later nav block is appended here, not a mega-menu-only shape.\n */\n blocks: Block[];\n /**\n * Preview URL for both documents. The site owns the path — this factory\n * does not invent a route.\n */\n preview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"preview\"]>;\n livePreview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"livePreview\"]>;\n /**\n * Component path for Payload's Preview button, as a key into the site's\n * committed `importMap.js`.\n */\n previewButton?: string;\n /** The collection a page link points into. Defaults to `pages`. */\n pagesCollection?: string;\n /** Locked footer copyright uses this name. The year stays the current year. */\n footerCopyrightName?: string;\n}\n\nexport interface NavigationHeader {\n items?: unknown;\n cta?: unknown;\n}\n\nexport interface NavigationBar {\n hideOnScroll?: boolean | null;\n viewport?: boolean | null;\n defaultMaxWidth?: (\"narrow\" | \"standard\" | \"wide\") | null;\n}\n\nexport interface NavigationFooter {\n columns?: unknown;\n brand?: unknown;\n}\n\nexport interface NavigationDoc {\n header: NavigationHeader;\n footer: NavigationFooter;\n bar: NavigationBar;\n}\n\nexport interface GetNavigationArgs extends LocaleRead {\n payload: {\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n overrideAccess?: boolean;\n depth?: number;\n }) => Promise<unknown>;\n };\n draft?: boolean;\n}\n","import type { Condition, Field, GroupField, RowField, TextFieldSingleValidation } from \"payload\";\n\n/**\n * Same import-map string as `@bison-lab/payload-blocks`. A site that\n * already generates the blocks admin map gets the picker; a missing\n * entry renders the row as nothing, so `payload generate:importmap` is\n * part of adopting this factory.\n */\nconst LINK_FIELD = \"@bison-lab/payload-blocks/admin#LinkField\";\n\ntype LinkType = \"page\" | \"external\";\n\ninterface LinkDestination {\n type?: LinkType | null;\n href?: string | null;\n}\n\nfunction linkTypeOf(link: LinkDestination | null | undefined): LinkType {\n if (link?.type === \"external\") return \"external\";\n if (link?.type === \"page\") return \"page\";\n return link?.href ? \"external\" : \"page\";\n}\n\nexport const EXTERNAL_HREF_MESSAGE =\n \"Enter a valid URL (https://…), a mailto: or tel: link, or a site path starting with /.\";\n\n/**\n * What the picker will store as an external destination: http(s) with a\n * host, mailto:/tel: with a value, or an in-site path. Rejects a bare\n * host, protocol-relative URLs, and anything that is not a link.\n */\nexport function isValidExternalHref(value: unknown): boolean {\n const raw = String(value ?? \"\").trim();\n if (!raw || /\\s/.test(raw)) return false;\n if (raw.startsWith(\"/\") && !raw.startsWith(\"//\")) return true;\n if (/^mailto:/i.test(raw)) return raw.length > \"mailto:\".length;\n if (/^tel:/i.test(raw)) return raw.length > \"tel:\".length;\n try {\n const url = new URL(raw);\n return (url.protocol === \"http:\" || url.protocol === \"https:\") && Boolean(url.hostname);\n } catch {\n return false;\n }\n}\n\nexport function validateExternalHref(value: unknown, required = false): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return required ? \"This field is required.\" : true;\n return isValidExternalHref(raw) ? true : EXTERNAL_HREF_MESSAGE;\n}\n\nconst whenPage: Condition = (_data, siblingData) => linkTypeOf(siblingData as LinkDestination) === \"page\";\nconst whenExternal: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"external\";\n\nfunction hrefValidate(required: boolean): TextFieldSingleValidation {\n return (value, { siblingData }) => {\n if (linkTypeOf(siblingData as LinkDestination) !== \"external\") return true;\n return validateExternalHref(value, required);\n };\n}\n\nfunction linkDestinationFields({\n required = false,\n pagesCollection = \"pages\",\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): RowField[] {\n return [\n {\n type: \"row\",\n admin: { components: { Field: LINK_FIELD } },\n fields: [\n {\n name: \"type\",\n type: \"radio\",\n label: \"Link\",\n defaultValue: \"page\",\n options: [\n { label: \"Page\", value: \"page\" },\n { label: \"URL\", value: \"external\" },\n ],\n admin: { layout: \"horizontal\" },\n },\n {\n name: \"page\",\n type: \"relationship\",\n relationTo: pagesCollection,\n required,\n filterOptions: { _status: { equals: \"published\" } },\n admin: { condition: whenPage },\n },\n {\n name: \"href\",\n type: \"text\",\n label: \"URL\",\n required,\n validate: hrefValidate(required),\n admin: {\n condition: whenExternal,\n description:\n 'A full URL (\"https://example.com\"), \"mailto:\" or \"tel:\", or a site path (\"/contact\").',\n },\n },\n ],\n },\n ];\n}\n\nfunction linkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return [\n ...linkDestinationFields({ required, pagesCollection }),\n { name: \"label\", type: \"text\", localized: true, label: \"Label\", required },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n admin: {\n // Drawn by LinkField next to the destination so Header, Footer, and\n // page blocks cannot drift apart.\n hidden: true,\n },\n },\n ];\n}\n\nexport interface HeaderCtaValue {\n enabled?: boolean | null;\n type?: LinkType | null;\n page?: unknown;\n href?: string | null;\n label?: string | null;\n}\n\n/** A stored button, or a legacy row that already has a label or destination. */\nexport function headerCtaEnabled(cta: HeaderCtaValue | null | undefined): boolean {\n if (!cta) return false;\n if (cta.enabled === false) return false;\n if (cta.enabled === true) return true;\n return Boolean(cta.label || cta.page || cta.href);\n}\n\n/**\n * When the Header button is on, label and destination are required.\n * Off (or a cleared row) can save empty.\n */\nexport function validateHeaderCta(value: unknown): true | string {\n const cta = (value && typeof value === \"object\" ? value : {}) as HeaderCtaValue;\n if (!headerCtaEnabled(cta)) return true;\n if (!String(cta.label ?? \"\").trim()) return \"The Header button needs a label.\";\n const dest = linkTypeOf(cta);\n if (dest === \"external\") {\n const href = validateExternalHref(cta.href, true);\n if (href !== true) {\n return href === \"This field is required.\"\n ? \"The Header button needs a published page or a URL.\"\n : href;\n }\n }\n if (dest === \"page\" && (cta.page == null || cta.page === \"\")) {\n return \"The Header button needs a published page or a URL.\";\n }\n return true;\n}\n\nexport function linkField({\n name = \"link\",\n label,\n admin,\n required,\n pagesCollection,\n toggle,\n}: {\n name?: string;\n label?: GroupField[\"label\"];\n admin?: GroupField[\"admin\"];\n required?: boolean;\n pagesCollection?: string;\n /** Header button: an enable checkbox; children are not required unless it is on. */\n toggle?: boolean;\n} = {}): GroupField {\n return {\n name,\n type: \"group\",\n fields: toggle\n ? [\n {\n name: \"enabled\",\n type: \"checkbox\",\n label: \"Show Header button\",\n defaultValue: false,\n },\n ...linkFields({ required: false, pagesCollection }),\n ]\n : linkFields({ required, pagesCollection }),\n ...(toggle ? { validate: validateHeaderCta as NonNullable<GroupField[\"validate\"]> } : {}),\n ...(label === undefined ? {} : { label }),\n ...(admin === undefined ? {} : { admin }),\n };\n}\n\nexport function footerLinkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return linkFields({ required, pagesCollection });\n}\n","import type { ArrayField, ArrayFieldValidation, Field, GroupField, TextField } from \"payload\";\n\nimport { footerLinkFields, isValidExternalHref, validateExternalHref } from \"./link\";\n\n/**\n * Same presets as the header mega-menu. Desktop only. Tablet is a fixed\n * 2×2 on the public footer; mobile stacks.\n */\nexport const FOOTER_COLUMN_WIDTHS = [\"25\", \"33\", \"50\", \"66\", \"75\", \"100\"] as const;\nexport type FooterColumnWidth = (typeof FOOTER_COLUMN_WIDTHS)[number];\n\n/** Logo column plus link columns. */\nexport const FOOTER_MAX_COLUMNS = 4;\n/** Link columns. The logo column is always first and is not in this count. */\nexport const FOOTER_MAX_LINK_COLUMNS = FOOTER_MAX_COLUMNS - 1;\n\nexport const FOOTER_SOCIALS = [\"facebook\", \"instagram\", \"linkedin\", \"x\", \"youtube\"] as const;\nexport type FooterSocial = (typeof FOOTER_SOCIALS)[number];\n\nconst FOOTER_SOCIAL_LABELS: Record<FooterSocial, string> = {\n facebook: \"Facebook\",\n instagram: \"Instagram\",\n linkedin: \"LinkedIn\",\n x: \"X\",\n youtube: \"YouTube\",\n};\n\n/** Twelfths of a row. Link-column widths share this 12; the logo column does not. */\nexport const FOOTER_TWELFTHS: Record<FooterColumnWidth, number> = {\n \"25\": 3,\n \"33\": 4,\n \"50\": 6,\n \"66\": 8,\n \"75\": 9,\n \"100\": 12,\n};\n\nexport const FOOTER_COLUMNS_FIELD = \"@bison-lab/payload-blocks/admin#FooterColumnsField\";\n\ninterface FooterLinkRow {\n label?: string | null;\n type?: \"page\" | \"external\" | null;\n page?: unknown;\n href?: string | null;\n}\n\ninterface FooterSectionRow {\n heading?: string | null;\n links?: FooterLinkRow[] | null;\n}\n\ninterface FooterColumnRow {\n desktop?: FooterColumnWidth | null;\n sections?: FooterSectionRow[] | null;\n}\n\nfunction evenDesktop(count: number): FooterColumnWidth[] {\n return (\n {\n 1: [\"100\"],\n 2: [\"50\", \"50\"],\n 3: [\"33\", \"33\", \"33\"],\n 4: [\"25\", \"25\", \"25\", \"25\"],\n } as Record<number, FooterColumnWidth[]>\n )[count] ?? [];\n}\n\n/** Even split for the current link-column count. Used by the kit editor. */\nexport function normalizeFooterDesktop(count: number): FooterColumnWidth[] {\n return evenDesktop(count);\n}\n\n/**\n * Desktop tracks: the logo keeps its own percent; link columns share the\n * remaining `1fr` and are themselves percent of that leftover, not of the\n * full footer.\n */\nexport function footerDesktopTracks(\n brand: FooterColumnWidth | null | undefined,\n columns: Array<FooterColumnWidth | null | undefined>,\n): {\n brandPercent: string;\n brandTemplate: string;\n linksTemplate: string;\n} {\n const width = brand && brand in FOOTER_TWELFTHS ? brand : \"25\";\n const brandPercent = `${width}%`;\n const links = columns.map((column) => `${column && column in FOOTER_TWELFTHS ? column : \"25\"}%`);\n return {\n brandPercent,\n brandTemplate: `${brandPercent} minmax(0,1fr)`,\n linksTemplate: links.join(\" \") || \"1fr\",\n };\n}\n\nfunction linkHasDestination(link: FooterLinkRow): boolean {\n if (link.type === \"external\") return isValidExternalHref(link.href);\n if (link.type === \"page\") return link.page != null && link.page !== \"\";\n if (String(link.href ?? \"\").trim()) return isValidExternalHref(link.href);\n return link.page != null && link.page !== \"\";\n}\n\n/**\n * Link-column widths must add to 100% of the space beside the logo. The\n * logo width is independent. Each section needs a labeled destination\n * before publish. Draft saves skip field validation. A footer with only\n * the logo column is valid.\n */\nexport const validateFooterColumns: ArrayFieldValidation = (value) => {\n const columns = (Array.isArray(value) ? value : []) as FooterColumnRow[];\n if (columns.length > FOOTER_MAX_LINK_COLUMNS) {\n return \"No more than three link columns. The logo column is always first.\";\n }\n\n if (columns.length === 0) return true;\n\n const twelfths = columns.reduce((sum, row) => sum + FOOTER_TWELFTHS[row?.desktop ?? \"100\"], 0);\n if (twelfths !== 12) {\n const percent = Math.round((twelfths / 12) * 100);\n return `Desktop column widths add up to ${percent}%. They need to add up to 100% of the space beside the logo.`;\n }\n\n for (const [columnIndex, column] of columns.entries()) {\n const sections = column.sections ?? [];\n if (sections.length === 0) {\n return `Column ${columnIndex + 1} needs at least one section.`;\n }\n for (const [sectionIndex, section] of sections.entries()) {\n if (!String(section.heading ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs a section label.`;\n }\n const links = section.links ?? [];\n if (links.length === 0) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs at least one link.`;\n }\n for (const [linkIndex, link] of links.entries()) {\n if (!String(link.label ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a label.`;\n }\n if (!linkHasDestination(link)) {\n const href = String(link.href ?? \"\").trim();\n if (href && validateExternalHref(href) !== true) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a valid URL.`;\n }\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a destination.`;\n }\n }\n }\n }\n\n return true;\n};\n\nexport function validateFooterSocialUrl(value: unknown): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return true;\n try {\n const url = new URL(raw);\n if (url.protocol === \"http:\" || url.protocol === \"https:\") return true;\n } catch {\n // not a URL\n }\n return \"Must be a valid http(s) URL.\";\n}\n\nfunction socialFields(): TextField[] {\n return FOOTER_SOCIALS.map((name) => ({\n name,\n type: \"text\",\n label: FOOTER_SOCIAL_LABELS[name],\n validate: validateFooterSocialUrl,\n }));\n}\n\nexport function footerColumnsField({\n pagesCollection,\n}: {\n pagesCollection?: string;\n} = {}): ArrayField {\n return {\n name: \"columns\",\n type: \"array\",\n dbName: \"c\",\n labels: { singular: \"Column\", plural: \"Columns\" },\n maxRows: FOOTER_MAX_LINK_COLUMNS,\n validate: validateFooterColumns,\n admin: {\n description:\n \"Logo column plus up to three link columns. Link-column widths add up to 100% of the space beside the logo.\",\n },\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"sections\",\n type: \"array\",\n dbName: \"s\",\n labels: { singular: \"Section\", plural: \"Sections\" },\n minRows: 1,\n fields: [\n {\n name: \"heading\",\n type: \"text\",\n localized: true,\n label: \"Section Label\",\n required: true,\n },\n {\n name: \"links\",\n type: \"array\",\n labels: { singular: \"Link\", plural: \"Links\" },\n minRows: 1,\n fields: footerLinkFields({ required: true, pagesCollection }),\n },\n ],\n },\n ],\n };\n}\n\nexport function footerBrandField(): GroupField {\n return {\n name: \"brand\",\n type: \"group\",\n label: \"Brand & social\",\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"tagline\",\n type: \"textarea\",\n localized: true,\n label: \"Text below the logo\",\n },\n ...socialFields(),\n ],\n };\n}\n\nexport function footerFields(options: { pagesCollection?: string } = {}): Field[] {\n return [footerColumnsField(options), footerBrandField()];\n}\n","import { localeArgs } from \"../locale\";\nimport {\n NAVIGATION_FOOTER_SLUG,\n NAVIGATION_SLUG,\n type GetNavigationArgs,\n type NavigationBar,\n type NavigationDoc,\n type NavigationFooter,\n type NavigationHeader,\n} from \"./types\";\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" ? (value as Record<string, unknown>) : null;\n}\n\nfunction headerOf(doc: unknown): NavigationHeader {\n const record = asRecord(doc);\n const header = record && \"header\" in record ? asRecord(record.header) : null;\n return header ?? {};\n}\n\nfunction footerOf(doc: unknown): NavigationFooter {\n const record = asRecord(doc);\n const footer = record && \"footer\" in record ? asRecord(record.footer) : null;\n return footer ?? {};\n}\n\nfunction barOf(doc: unknown): NavigationBar {\n const record = asRecord(doc);\n const bar = record && \"bar\" in record ? asRecord(record.bar) : null;\n return bar ?? {};\n}\n\n/**\n * Reads Header and Footer and returns one `{ header, footer, bar }`. A\n * site header does not learn two slugs. `bar` is the hidden Header group\n * (hide on scroll, viewport, default panel width). `draft: true`\n * reads the newest version; omit it (or pass false) for the published\n * documents. A multi-locale site passes the request's `locale` (and\n * `fallbackLocale`), so the labels and footer copy read in that locale.\n */\nexport async function getNavigation({\n payload,\n draft = false,\n ...read\n}: GetNavigationArgs): Promise<NavigationDoc> {\n const locale = localeArgs(read);\n const [headerDoc, footerDoc] = await Promise.all([\n payload.findGlobal({ slug: NAVIGATION_SLUG, draft, depth: 1, ...locale }),\n payload.findGlobal({ slug: NAVIGATION_FOOTER_SLUG, draft, depth: 1, ...locale }),\n ]);\n return { header: headerOf(headerDoc), footer: footerOf(footerDoc), bar: barOf(headerDoc) };\n}\n"],"mappings":";;AAaA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;AAEzC,MAAa,qBAAqB;;;;;;;;;ACVlC,MAAM,aAAa;AASnB,SAAS,WAAW,MAAoD;AACtE,KAAI,MAAM,SAAS,WAAY,QAAO;AACtC,KAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,QAAO,MAAM,OAAO,aAAa;;AAGnC,MAAa,wBACX;;;;;;AAOF,SAAgB,oBAAoB,OAAyB;CAC3D,MAAM,MAAM,OAAO,SAAS,GAAG,CAAC,MAAM;AACtC,KAAI,CAAC,OAAO,KAAK,KAAK,IAAI,CAAE,QAAO;AACnC,KAAI,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,WAAW,KAAK,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
+ import { t as localeArgs } from "./locale-CFWfB4wP.mjs";
2
3
  //#region src/theme/published.ts
3
4
  /**
4
5
  * The Theme row, or `seed` when the Global is empty. Theme has no draft
@@ -16,16 +17,20 @@ async function getPublishedTheme(payload, seed) {
16
17
  /**
17
18
  * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site
18
19
  * passed into `createTheme`. Depth 1 so the upload url is populated.
20
+ * Takes the request's `locale` like every other reader. Theme and its
21
+ * brand assets hold no localized field today (a logo's alt is the brand
22
+ * name), so it only matters once one does.
19
23
  */
20
- async function getPublishedIdentity(payload, fallback) {
24
+ async function getPublishedIdentity(payload, fallback, read = {}) {
21
25
  return resolveThemeIdentity(await payload.findGlobal({
22
26
  slug: "theme",
23
27
  draft: false,
24
28
  depth: 1,
25
- overrideAccess: true
29
+ overrideAccess: true,
30
+ ...localeArgs(read)
26
31
  }) ?? {}, fallback);
27
32
  }
28
33
  //#endregion
29
34
  export { getPublishedTheme as n, getPublishedIdentity as t };
30
35
 
31
- //# sourceMappingURL=published-DgAzpDSG.mjs.map
36
+ //# sourceMappingURL=published-DefZv9na.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-DefZv9na.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
@@ -1,2 +1,2 @@
1
- import { n as facetField, t as FacetEntry } from "./facet-field-BvQp8Hzh.mjs";
1
+ import { n as facetField, t as FacetEntry } from "./facet-field-CZbLDAQz.mjs";
2
2
  export { type FacetEntry, facetField };
package/dist/theme.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-D6jQql5Z.mjs";
2
- import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-Cgbh9eAq.mjs";
3
- import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-BLXCep6Z.mjs";
1
+ import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-B7Hy1Ho-.mjs";
2
+ import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-v-GlYuqa.mjs";
3
+ import { t as LocaleRead } from "./locale-CxFNy8ex.mjs";
4
+ import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-Cow49CSZ.mjs";
4
5
  import { ShadeStep, ThemeConfig } from "@bison-lab/tokens";
5
6
 
6
7
  //#region src/theme/map.d.ts
@@ -29,5 +30,5 @@ declare function themeHead(config: ThemeConfig, options?: ThemeHeadOptions): The
29
30
  */
30
31
  declare function themeHeadFromDoc(doc: ThemeDoc | null | undefined, seed: ThemeConfig, options?: Omit<ThemeHeadOptions, "library">): ThemeHead;
31
32
  //#endregion
32
- export { type ColorSwatch, type ColorTokenHit, type CreateThemeOptions, type EditableTheme, type LookOption, PAGE_EDITOR_SYSTEM_KEYS, type PageEditorSystemKey, type ResolvedThemeIdentity, SYSTEM_COLOR_KEYS, type SystemColorKey, THEME_PREVIEW_BREAKPOINTS, THEME_SLUG, type ThemeColorDoc, type ThemeDoc, type ThemeHead, type ThemeHeadOptions, type ThemeIdentityFallback, type ThemeLibraryColorDoc, type ThemeUploadDoc, colorTokenField, deleteLibraryColor, findColorTokens, getPublishedIdentity, getPublishedTheme, lookField, pageEditorLooks, pageEditorSwatches, pageEditorTokens, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, themeColorKeys, themeConfigFromDoc, themeHead, themeHeadFromDoc, themeLibraryFromDoc };
33
+ export { type ColorSwatch, type ColorTokenHit, type CreateThemeOptions, type EditableTheme, type LocaleRead, type LookOption, PAGE_EDITOR_SYSTEM_KEYS, type PageEditorSystemKey, type ResolvedThemeIdentity, SYSTEM_COLOR_KEYS, type SystemColorKey, THEME_PREVIEW_BREAKPOINTS, THEME_SLUG, type ThemeColorDoc, type ThemeDoc, type ThemeHead, type ThemeHeadOptions, type ThemeIdentityFallback, type ThemeLibraryColorDoc, type ThemeUploadDoc, colorTokenField, deleteLibraryColor, findColorTokens, getPublishedIdentity, getPublishedTheme, lookField, pageEditorLooks, pageEditorSwatches, pageEditorTokens, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, themeColorKeys, themeConfigFromDoc, themeHead, themeHeadFromDoc, themeLibraryFromDoc };
33
34
  //# sourceMappingURL=theme.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.mts","names":[],"sources":["../src/theme/map.ts","../src/theme/head.ts"],"mappings":";;;;;;;AA4EA;;;;iBAAgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,qBAA6B,IAAA,EAAM,WAAA,GAAc,WAAA;;;;;;;AAAzF;;;;;iBC3DgB,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,OAAA,GAAS,gBAAA,GAAwB,SAAA;;;;;;iBAmBhE,gBAAA,CACd,GAAA,EAAK,QAAA,qBACL,IAAA,EAAM,WAAA,EACN,OAAA,GAAS,IAAA,CAAK,gBAAA,eACb,SAAA"}
1
+ {"version":3,"file":"theme.d.mts","names":[],"sources":["../src/theme/map.ts","../src/theme/head.ts"],"mappings":";;;;;;;;;AA4EA;;;iBAAgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,qBAA6B,IAAA,EAAM,WAAA,GAAc,WAAA;;;;;;;;AAAzF;;;;iBC3DgB,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,OAAA,GAAS,gBAAA,GAAwB,SAAA;;;;;;iBAmBhE,gBAAA,CACd,GAAA,EAAK,QAAA,qBACL,IAAA,EAAM,WAAA,EACN,OAAA,GAAS,IAAA,CAAK,gBAAA,eACb,SAAA"}
package/dist/theme.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { l as stateFromColorDoc, n as SYSTEM_COLOR_KEYS, o as THEME_SLUG, t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CN6EOeDM.mjs";
2
2
  import { a as pageEditorLooks, c as themeLibraryFromDoc, d as deleteLibraryColor, f as rewriteColorToken, i as PAGE_EDITOR_SYSTEM_KEYS, l as findColorTokens, n as colorTokenField, o as pageEditorSwatches, p as themeColorKeys, r as lookField, s as pageEditorTokens, t as THEME_PREVIEW_BREAKPOINTS, u as rewriteColorTokens } from "./preview-Br1SQCKn.mjs";
3
- import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-DgAzpDSG.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-DefZv9na.mjs";
4
4
  import { fontFaceCss, fontPreloads } from "@bison-lab/fonts";
5
5
  import { buildThemeCss, generateNamedScaleCSS, lookBindingCss, themeFontIds } from "@bison-lab/tokens";
6
6
  //#region src/theme/look-css.ts
@@ -52,4 +52,4 @@ declare function documentTitle(siteName: string, pageTitle: string): string;
52
52
  declare function titleTemplate(siteName: string): string;
53
53
  //#endregion
54
54
  export { SeoImageSize as a, SeoImageDoc as i, titleTemplate as n, SeoImageValue as o, MediaId as r, SeoMeta as s, documentTitle as t };
55
- //# sourceMappingURL=title-C8ppEDlc.d.mts.map
55
+ //# sourceMappingURL=title-DFKu53nG.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"title-C8ppEDlc.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
1
+ {"version":3,"file":"title-DFKu53nG.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
@@ -258,4 +258,4 @@ declare const SYSTEM_COLOR_KEYS: readonly ["primary", "secondary", "accent", "hi
258
258
  type SystemColorKey = (typeof SYSTEM_COLOR_KEYS)[number];
259
259
  //#endregion
260
260
  export { rewriteColorUsages as C, findColorUsages as S, ThemeIdentityFallback as _, THEME_APPEARANCE_SLUG as a, ColorUsagesList as b, THEME_SLUG as c, ThemeDoc as d, ThemeHead as f, ResolvedThemeIdentity as g, ThemeUploadDoc as h, SystemColorKey as i, THEME_TYPOGRAPHY_SLUG as l, ThemeLibraryColorDoc as m, EditableTheme as n, THEME_COLORS_SLUG as o, ThemeHeadOptions as p, SYSTEM_COLOR_KEYS as r, THEME_IDENTITY_SLUG as s, CreateThemeOptions as t, ThemeColorDoc as u, resolveThemeIdentity as v, ColorUsagesOption as x, ColorUsage as y };
261
- //# sourceMappingURL=types-D6jQql5Z.d.mts.map
261
+ //# sourceMappingURL=types-B7Hy1Ho-.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-D6jQql5Z.d.mts","names":[],"sources":["../src/theme/color-usages.ts","../src/theme/identity.ts","../src/theme/types.ts"],"mappings":";;;;;UAOiB,eAAA;EACf,WAAA;EACA,OAAA;AAAA;;;;AAQF;;KAAY,iBAAA,UAA2B,eAAA;AAAA,UAEtB,UAAA;EACf,UAAA;EACA,MAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;AAAA;AAAA,KAGG,UAAA;EAAe,IAAA,EAAM,MAAA;EAA2B,UAAA;EAAqB,IAAA;AAAA;AAAA,KAErE,OAAA;EAAY,IAAA;AAAA;AAAA,UAEA,iBAAA;EACf,IAAA,GAAO,IAAA;IACL,UAAA;IACA,KAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,UAAA;EACd,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KA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,QAAA;IAAa,QAAA,GAAW,qBAAA;EAAA;EF/BhB;EEiCR,SAAA,IAAa,KAAA,EAAO,WAAA,EAAa,GAAA,EAAK,QAAA,YAAoB,OAAA;EF9BlD;;;;;;;;EEuCR,WAAA,GAAc,iBAAA;AAAA;AAAA,UAGC,gBAAA;EACf,YAAA;EACA,SAAA;EACA,QAAA,GAAW,qBAAA;ED/II;;;;ECoJf,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,SAAA;EACf,GAAA;EACA,QAAA;IAAY,IAAA;IAAc,IAAA;EAAA;EAC1B,QAAA,GAAW,qBAAA;AAAA;AAAA,cAGA,UAAA;AAAA,cACA,iBAAA;AAAA,cACA,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,mBAAA;AAAA,cAEA,iBAAA;AAAA,KASD,cAAA,WAAyB,iBAAA"}
1
+ {"version":3,"file":"types-B7Hy1Ho-.d.mts","names":[],"sources":["../src/theme/color-usages.ts","../src/theme/identity.ts","../src/theme/types.ts"],"mappings":";;;;;UAOiB,eAAA;EACf,WAAA;EACA,OAAA;AAAA;;;;AAQF;;KAAY,iBAAA,UAA2B,eAAA;AAAA,UAEtB,UAAA;EACf,UAAA;EACA,MAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;AAAA;AAAA,KAGG,UAAA;EAAe,IAAA,EAAM,MAAA;EAA2B,UAAA;EAAqB,IAAA;AAAA;AAAA,KAErE,OAAA;EAAY,IAAA;AAAA;AAAA,UAEA,iBAAA;EACf,IAAA,GAAO,IAAA;IACL,UAAA;IACA,KAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,UAAA;EACd,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,MAAA,oBAA0B,QAAA;EACxC,MAAA,GAAS,IAAA;IACP,UAAA;IACA,EAAA;IACA,IAAA,EAAM,MAAA;IACN,KAAA;IACA,c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c,iBAAA;AAAA;AAAA,UAGC,gBAAA;EACf,YAAA;EACA,SAAA;EACA,QAAA,GAAW,qBAAA;ED/II;;;;ECoJf,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,SAAA;EACf,GAAA;EACA,QAAA;IAAY,IAAA;IAAc,IAAA;EAAA;EAC1B,QAAA,GAAW,qBAAA;AAAA;AAAA,cAGA,UAAA;AAAA,cACA,iBAAA;AAAA,cACA,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,mBAAA;AAAA,cAEA,iBAAA;AAAA,KASD,cAAA,WAAyB,iBAAA"}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as captureWireframes, s as svgDataUri } from "./wireframe-sJW8Q4NS.mjs";
2
+ import { a as captureWireframes, s as svgDataUri } from "./wireframe-xcJNJzBf.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { mkdirSync, writeFileSync } from "node:fs";
5
5
  import { dirname, join, resolve } from "node:path";
@@ -300,4 +300,4 @@ async function captureWireframes(page, previews, { selector = WIREFRAME_ROOT } =
300
300
  //#endregion
301
301
  export { captureWireframes as a, wireframeSvg as c, WIREFRAME_WIDTH as i, WIREFRAME_ROOT as n, extractWireframe as o, WIREFRAME_VIEWPORT as r, svgDataUri as s, WIREFRAME_HEIGHT as t };
302
302
 
303
- //# sourceMappingURL=wireframe-sJW8Q4NS.mjs.map
303
+ //# sourceMappingURL=wireframe-xcJNJzBf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe-sJW8Q4NS.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * @deprecated since 4.16: the Add Block drawer shows screenshots now\n * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).\n * Kept working for this release so a site that calls it does not break;\n * it goes in the next major.\n *\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB,UAAoC;CACnE,MAAM,OAAO,SAAS,cAAc,SAAS;AAG7C,KAAI,CAAC,KAAM,OAAM,IAAI,MAAM,sBAAsB,WAAW;CAC5D,MAAM,SAAS,KAAK,uBAAuB;CAC3C,MAAM,SAA2B,EAAE;CACnC,MAAM,wBAAQ,IAAI,KAAc;CAEhC,MAAM,cAAc,UAA2D;EAC7E,MAAM,QAAQ,MAAM,MAAM,mBAAmB;AAC7C,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,QAAQ,MAAM,GAAI,MAAM,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,OAAO;AACpE,SAAO;GAAC,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAE;;CAErE,MAAM,aAAa,SAA2C,QA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AI,KAAK,WAAW,EAAE,CAAC,SAAS,GAAG,CAAC,aAAa,CAAC,SAAS,GAAG,IAAI,GAAG;;;;;;;;;AAsBlH,eAAsB,kBACpB,MACA,UACA,EAAE,WAAW,mBAA0C,EAAE,EACxB;AACjC,OAAM,KAAK,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;CACrD,MAAM,MAA8B,EAAE;AACtC,MAAK,MAAM,EAAE,MAAM,SAAS,UAAU;EACpC,MAAM,WAAW,MAAM,KAAK,KAAK,KAAK,EAAE,WAAW,eAAe,CAAC;EACnE,MAAM,SAAS,WAAW,SAAS,QAAQ,GAAG;AAC9C,MAAI,UAAU,IAAK,OAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,YAAY,OAAO,0EAA0E;AAChJ,QAAM,KAAK,eAAe,SAAS,MAAM,MAAM,WAAW,KAAA,EAAU,EAAE,KAAA,EAAU;EAChF,IAAI;AACJ,MAAI;AACF,aAAU,MAAM,KAAK,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
1
+ {"version":3,"file":"wireframe-xcJNJzBf.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * @deprecated since 4.16: the Add Block drawer shows screenshots now\n * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).\n * Kept working for this release so a site that calls it does not break;\n * it goes in the next major.\n *\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB,UAAoC;CACnE,MAAM,OAAO,SAAS,cAAc,SAAS;AAG7C,KAAI,CAAC,KAAM,OAAM,IAAI,MAAM,sBAAsB,WAAW;CAC5D,MAAM,SAAS,KAAK,uBAAuB;CAC3C,MAAM,SAA2B,EAAE;CACnC,MAAM,wBAAQ,IAAI,KAAc;CAEhC,MAAM,cAAc,UAA2D;EAC7E,MAAM,QAAQ,MAAM,MAAM,mBAAmB;AAC7C,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,QAAQ,MAAM,GAAI,MAAM,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,OAAO;AACpE,SAAO;GAAC,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAE;;CAErE,MAAM,aAAa,SAA2C,QAAS,IAAI,KAAK,QAAS,IAAI,KAAK,QAAS,IAAI,MAAM;CACrH,MAAM,SAAS,YAAqB,iBAAiB,QAAQ;CAC7D,MAAM,SAAS,YAAqB;EAClC,MAAM,MAAM,MAA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0C,EAAE,EACxB;AACjC,OAAM,KAAK,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;CACrD,MAAM,MAA8B,EAAE;AACtC,MAAK,MAAM,EAAE,MAAM,SAAS,UAAU;EACpC,MAAM,WAAW,MAAM,KAAK,KAAK,KAAK,EAAE,WAAW,eAAe,CAAC;EACnE,MAAM,SAAS,WAAW,SAAS,QAAQ,GAAG;AAC9C,MAAI,UAAU,IAAK,OAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,YAAY,OAAO,0EAA0E;AAChJ,QAAM,KAAK,eAAe,SAAS,MAAM,MAAM,WAAW,KAAA,EAAU,EAAE,KAAA,EAAU;EAChF,IAAI;AACJ,MAAI;AACF,aAAU,MAAM,KAAK,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
@@ -1,2 +1,2 @@
1
- import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-sJW8Q4NS.mjs";
1
+ import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-xcJNJzBf.mjs";
2
2
  export { WIREFRAME_HEIGHT, WIREFRAME_ROOT, WIREFRAME_VIEWPORT, WIREFRAME_WIDTH, captureWireframes, extractWireframe, svgDataUri, wireframeSvg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-core",
3
- "version": "4.35.0",
3
+ "version": "4.36.1",
4
4
  "description": "Site-agnostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
5
5
  "keywords": [
6
6
  "bison-lab",
@@ -153,9 +153,9 @@
153
153
  "tsdown": "^0.21.0",
154
154
  "typescript": "^5.9.3",
155
155
  "vitest": "^4.1.2",
156
- "@bison-lab/fonts": "4.35.0",
157
156
  "@bison-lab/tokens": "4.35.0",
158
- "@bison-lab/ui": "4.35.0"
157
+ "@bison-lab/ui": "4.35.0",
158
+ "@bison-lab/fonts": "4.35.0"
159
159
  },
160
160
  "publishConfig": {
161
161
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"published-BLXCep6Z.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;UAOiB,YAAA;EACf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;iBAcsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,GACV,OAAA,CAAQ,qBAAA"}