@bison-lab/payload-core 4.39.0 → 5.0.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 (75) hide show
  1. package/README.md +63 -33
  2. package/dist/admin.d.mts +19 -7
  3. package/dist/admin.d.mts.map +1 -1
  4. package/dist/admin.mjs +229 -16
  5. package/dist/admin.mjs.map +1 -1
  6. package/dist/block-library.d.mts +1 -1
  7. package/dist/block-library.mjs +1 -1
  8. package/dist/{block-thumbnails-DXOUzGjY.mjs → block-thumbnails-DC34uFtE.mjs} +1 -1
  9. package/dist/{block-thumbnails-DXOUzGjY.mjs.map → block-thumbnails-DC34uFtE.mjs.map} +1 -1
  10. package/dist/block-thumbnails-cli.mjs +1 -1
  11. package/dist/block-thumbnails.mjs +1 -1
  12. package/dist/capability-CqdYCzG1.d.mts +434 -0
  13. package/dist/capability-CqdYCzG1.d.mts.map +1 -0
  14. package/dist/capability-DHPE2kon.mjs +2685 -0
  15. package/dist/capability-DHPE2kon.mjs.map +1 -0
  16. package/dist/{catalogue-FxH10X3v.d.mts → catalogue-DWqHWVE5.d.mts} +1 -1
  17. package/dist/{catalogue-FxH10X3v.d.mts.map → catalogue-DWqHWVE5.d.mts.map} +1 -1
  18. package/dist/{facet-field-DjaZ0C7D.d.mts → facet-field-2K22iuWA.d.mts} +1 -1
  19. package/dist/{facet-field-DjaZ0C7D.d.mts.map → facet-field-2K22iuWA.d.mts.map} +1 -1
  20. package/dist/{facet-field-Uf8S4yL1.mjs → facet-field-DO3VT_Cz.mjs} +1 -1
  21. package/dist/{facet-field-Uf8S4yL1.mjs.map → facet-field-DO3VT_Cz.mjs.map} +1 -1
  22. package/dist/index.d.mts +13 -7
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +25 -667
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/{locale-CFWfB4wP.mjs → locale-B6rUVwpg.mjs} +1 -1
  27. package/dist/locale-B6rUVwpg.mjs.map +1 -0
  28. package/dist/{locale-CWiIcGuU.d.mts → locale-CTT3nn6T.d.mts} +5 -4
  29. package/dist/locale-CTT3nn6T.d.mts.map +1 -0
  30. package/dist/messages-dZV_aAnR.mjs +93 -0
  31. package/dist/messages-dZV_aAnR.mjs.map +1 -0
  32. package/dist/metadata.d.mts +1 -1
  33. package/dist/navigation.d.mts +2 -2
  34. package/dist/navigation.mjs +1 -1
  35. package/dist/og.d.mts +2 -2
  36. package/dist/og.mjs +1 -1
  37. package/dist/{preview-CNBVfmM7.d.mts → preview-1vwxBgm5.d.mts} +2 -2
  38. package/dist/{preview-CNBVfmM7.d.mts.map → preview-1vwxBgm5.d.mts.map} +1 -1
  39. package/dist/{published-_1rrTj_B.d.mts → published-B3etM6X5.d.mts} +3 -3
  40. package/dist/{published-_1rrTj_B.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
  41. package/dist/{published-D3yVnbxs.mjs → published-BMt7Z5CF.mjs} +2 -2
  42. package/dist/{published-D3yVnbxs.mjs.map → published-BMt7Z5CF.mjs.map} +1 -1
  43. package/dist/{published-DefZv9na.mjs → published-CkqqY08H.mjs} +2 -2
  44. package/dist/{published-DefZv9na.mjs.map → published-CkqqY08H.mjs.map} +1 -1
  45. package/dist/{published-DXjnElZn.d.mts → published-QDNmDi02.d.mts} +2 -2
  46. package/dist/{published-DXjnElZn.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
  47. package/dist/{published-QyTcDznE.mjs → published-hqtvmVUD.mjs} +1 -1
  48. package/dist/{published-QyTcDznE.mjs.map → published-hqtvmVUD.mjs.map} +1 -1
  49. package/dist/{root-page-key-B86JwL8Z.mjs → root-page-key-kx3C1eyp.mjs} +1 -1
  50. package/dist/{root-page-key-B86JwL8Z.mjs.map → root-page-key-kx3C1eyp.mjs.map} +1 -1
  51. package/dist/seo.mjs +1 -1
  52. package/dist/{messages-Fl1spIwN.mjs → strings-Fd7kUCT7.mjs} +156 -118
  53. package/dist/strings-Fd7kUCT7.mjs.map +1 -0
  54. package/dist/taxonomy.d.mts +1 -1
  55. package/dist/taxonomy.mjs +1 -1
  56. package/dist/theme.d.mts +4 -4
  57. package/dist/theme.mjs +1 -1
  58. package/dist/{title-D_jixG36.d.mts → title-trhUexxM.d.mts} +1 -1
  59. package/dist/{title-D_jixG36.d.mts.map → title-trhUexxM.d.mts.map} +1 -1
  60. package/dist/translate-messages-cli.mjs +3 -2
  61. package/dist/translate-messages-cli.mjs.map +1 -1
  62. package/dist/translate.d.mts +300 -206
  63. package/dist/translate.d.mts.map +1 -1
  64. package/dist/translate.mjs +225 -1027
  65. package/dist/translate.mjs.map +1 -1
  66. package/dist/{types-Db6Iy3hJ.d.mts → types-DLBlHZUd.d.mts} +1 -1
  67. package/dist/{types-Db6Iy3hJ.d.mts.map → types-DLBlHZUd.d.mts.map} +1 -1
  68. package/dist/{wireframe-xcJNJzBf.mjs → wireframe-CXorKFU_.mjs} +1 -1
  69. package/dist/{wireframe-xcJNJzBf.mjs.map → wireframe-CXorKFU_.mjs.map} +1 -1
  70. package/dist/wireframe-cli.mjs +1 -1
  71. package/dist/wireframe.mjs +1 -1
  72. package/package.json +6 -8
  73. package/dist/locale-CFWfB4wP.mjs.map +0 -1
  74. package/dist/locale-CWiIcGuU.d.mts.map +0 -1
  75. package/dist/messages-Fl1spIwN.mjs.map +0 -1
@@ -9,4 +9,4 @@ function localeArgs({ locale, fallbackLocale } = {}) {
9
9
  //#endregion
10
10
  export { localeArgs as t };
11
11
 
12
- //# sourceMappingURL=locale-CFWfB4wP.mjs.map
12
+ //# sourceMappingURL=locale-B6rUVwpg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-B6rUVwpg.mjs","names":[],"sources":["../src/locale.ts"],"sourcesContent":["/**\n * Which locale a read returns, as Payload's Local API takes it. Pass the\n * request's locale (every site carries the library's languages), or a\n * Spanish page renders the default locale's copy; omitted reads the\n * default locale.\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":";;AAcA,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"}
@@ -1,8 +1,9 @@
1
1
  //#region src/locale.d.ts
2
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.
3
+ * Which locale a read returns, as Payload's Local API takes it. Pass the
4
+ * request's locale (every site carries the library's languages), or a
5
+ * Spanish page renders the default locale's copy; omitted reads the
6
+ * default locale.
6
7
  * `fallbackLocale: false` returns empty where the locale has no value
7
8
  * instead of the default locale's.
8
9
  */
@@ -12,4 +13,4 @@ interface LocaleRead {
12
13
  }
13
14
  //#endregion
14
15
  export { LocaleRead as t };
15
- //# sourceMappingURL=locale-CWiIcGuU.d.mts.map
16
+ //# sourceMappingURL=locale-CTT3nn6T.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-CTT3nn6T.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAQA;;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
@@ -0,0 +1,93 @@
1
+ import { n as translateStrings } from "./strings-Fd7kUCT7.mjs";
2
+ //#region src/translate/messages.ts
3
+ const BATCH_SIZE = 40;
4
+ /** Every string leaf as [path, value]; array indexes are path segments. */
5
+ function stringLeaves(node, path = [], out = []) {
6
+ if (typeof node === "string") out.push([path, node]);
7
+ else if (Array.isArray(node)) node.forEach((item, index) => stringLeaves(item, [...path, String(index)], out));
8
+ else if (node && typeof node === "object") for (const [key, value] of Object.entries(node)) stringLeaves(value, [...path, key], out);
9
+ return out;
10
+ }
11
+ function getAtPath(root, path) {
12
+ let current = root;
13
+ for (const segment of path) {
14
+ if (current == null || typeof current !== "object") return void 0;
15
+ current = Array.isArray(current) ? current[Number(segment)] : current[segment];
16
+ }
17
+ return current;
18
+ }
19
+ function setAtPath(root, path, value) {
20
+ let current = root;
21
+ for (let i = 0; i < path.length - 1; i++) {
22
+ const segment = path[i];
23
+ const wantArray = /^\d+$/.test(path[i + 1]);
24
+ const container = current;
25
+ let child = container[segment];
26
+ if (child == null || typeof child !== "object" || Array.isArray(child) !== wantArray) {
27
+ child = wantArray ? [] : {};
28
+ container[segment] = child;
29
+ }
30
+ current = child;
31
+ }
32
+ current[path[path.length - 1]] = value;
33
+ }
34
+ /**
35
+ * The `{name}` arguments of a message, sorted. Plural and select messages are
36
+ * skipped (their branch bodies are braced text the model rightly translates),
37
+ * so this only checks plain interpolations.
38
+ */
39
+ function placeholderNames(message) {
40
+ if (/,\s*(plural|select|selectordinal)\s*,/.test(message)) return null;
41
+ return [...message.matchAll(/\{\s*([A-Za-z_][\w]*)\s*\}/g)].map((match) => match[1]).sort().join(",");
42
+ }
43
+ /** A translation that dropped or renamed a `{placeholder}` would break at render; keep the source instead. */
44
+ function keepsPlaceholders(source, translated) {
45
+ const before = placeholderNames(source);
46
+ return before === null || before === placeholderNames(translated);
47
+ }
48
+ /**
49
+ * Fills a target next-intl message file from the source file. The source is
50
+ * the truth; only keys that are missing or empty in the target are
51
+ * translated, so reviewed copy is never overwritten, unless `force`
52
+ * re-translates every key. Batches of 40, so one failure costs at most 40
53
+ * keys. `{placeholders}` survive because the translator's prompt keeps them.
54
+ */
55
+ async function fillMessages(options) {
56
+ const base = !options.force && options.target && typeof options.target === "object" && !Array.isArray(options.target) ? structuredClone(options.target) : {};
57
+ const missing = stringLeaves(options.source).filter(([path]) => {
58
+ const existing = getAtPath(base, path);
59
+ return typeof existing !== "string" || existing.trim() === "";
60
+ });
61
+ let translated = 0;
62
+ let fellBack = 0;
63
+ for (let i = 0; i < missing.length; i += BATCH_SIZE) {
64
+ const batch = missing.slice(i, i + BATCH_SIZE);
65
+ const result = await translateStrings(batch.map(([, value]) => value), {
66
+ translator: options.translator,
67
+ from: options.from,
68
+ to: options.to,
69
+ context: options.context ?? "Website UI strings",
70
+ ...options.site ? { site: options.site } : {}
71
+ });
72
+ batch.forEach(([path, source], index) => {
73
+ const value = result?.[index];
74
+ if (value !== void 0 && keepsPlaceholders(source, value)) {
75
+ translated += 1;
76
+ setAtPath(base, path, value);
77
+ } else {
78
+ fellBack += 1;
79
+ setAtPath(base, path, source);
80
+ }
81
+ });
82
+ options.onProgress?.(Math.min(i + BATCH_SIZE, missing.length), missing.length);
83
+ }
84
+ return {
85
+ messages: base,
86
+ translated,
87
+ fellBack
88
+ };
89
+ }
90
+ //#endregion
91
+ export { fillMessages as t };
92
+
93
+ //# sourceMappingURL=messages-dZV_aAnR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages-dZV_aAnR.mjs","names":[],"sources":["../src/translate/messages.ts"],"sourcesContent":["import { translateStrings } from \"./strings\";\nimport type { TranslateSite, Translator } from \"./types\";\n\n/** A next-intl message file: nested objects and arrays with string leaves. */\nexport type MessagesJson = string | number | boolean | null | MessagesJson[] | { [key: string]: MessagesJson };\n\nconst BATCH_SIZE = 40;\n\n/** Every string leaf as [path, value]; array indexes are path segments. */\nfunction stringLeaves(\n node: MessagesJson,\n path: string[] = [],\n out: Array<[string[], string]> = [],\n): Array<[string[], string]> {\n if (typeof node === \"string\") out.push([path, node]);\n else if (Array.isArray(node)) node.forEach((item, index) => stringLeaves(item, [...path, String(index)], out));\n else if (node && typeof node === \"object\") {\n for (const [key, value] of Object.entries(node)) stringLeaves(value, [...path, key], out);\n }\n return out;\n}\n\nfunction getAtPath(root: MessagesJson, path: string[]): MessagesJson | undefined {\n let current: MessagesJson | undefined = root;\n for (const segment of path) {\n if (current == null || typeof current !== \"object\") return undefined;\n current = Array.isArray(current) ? current[Number(segment)] : current[segment];\n }\n return current;\n}\n\nfunction setAtPath(root: { [key: string]: MessagesJson }, path: string[], value: string): void {\n let current: { [key: string]: MessagesJson } | MessagesJson[] = root;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i]!;\n const wantArray = /^\\d+$/.test(path[i + 1]!);\n const container = current as Record<string, MessagesJson>;\n let child = container[segment];\n // Create the container when missing, and REPAIR it when the existing\n // target node has the opposite shape from the source (the source changed\n // an object into a list) so string keys never land in an array or the\n // reverse.\n if (child == null || typeof child !== \"object\" || Array.isArray(child) !== wantArray) {\n child = wantArray ? [] : {};\n container[segment] = child;\n }\n current = child as { [key: string]: MessagesJson } | MessagesJson[];\n }\n (current as Record<string, MessagesJson>)[path[path.length - 1]!] = value;\n}\n\n/**\n * The `{name}` arguments of a message, sorted. Plural and select messages are\n * skipped (their branch bodies are braced text the model rightly translates),\n * so this only checks plain interpolations.\n */\nfunction placeholderNames(message: string): string | null {\n if (/,\\s*(plural|select|selectordinal)\\s*,/.test(message)) return null;\n const names = [...message.matchAll(/\\{\\s*([A-Za-z_][\\w]*)\\s*\\}/g)].map((match) => match[1]!);\n return names.sort().join(\",\");\n}\n\n/** A translation that dropped or renamed a `{placeholder}` would break at render; keep the source instead. */\nexport function keepsPlaceholders(source: string, translated: string): boolean {\n const before = placeholderNames(source);\n return before === null || before === placeholderNames(translated);\n}\n\nexport interface FillMessagesResult {\n /** The target file to write. */\n messages: MessagesJson;\n /** Keys translated. */\n translated: number;\n /**\n * Keys whose batch failed, or whose translation lost a `{placeholder}`.\n * They hold the source text, so the file stays\n * complete (a hole renders as MISSING_MESSAGE); a plain re-run will not\n * retry them, `--force` (or a hand edit) will.\n */\n fellBack: number;\n}\n\n/**\n * Fills a target next-intl message file from the source file. The source is\n * the truth; only keys that are missing or empty in the target are\n * translated, so reviewed copy is never overwritten, unless `force`\n * re-translates every key. Batches of 40, so one failure costs at most 40\n * keys. `{placeholders}` survive because the translator's prompt keeps them.\n */\nexport async function fillMessages(options: {\n source: MessagesJson;\n target?: MessagesJson;\n translator: Translator;\n from: string;\n to: string;\n force?: boolean;\n context?: string;\n site?: TranslateSite;\n onProgress?: (done: number, total: number) => void;\n}): Promise<FillMessagesResult> {\n const base =\n !options.force && options.target && typeof options.target === \"object\" && !Array.isArray(options.target)\n ? (structuredClone(options.target) as { [key: string]: MessagesJson })\n : {};\n const missing = stringLeaves(options.source).filter(([path]) => {\n const existing = getAtPath(base, path);\n return typeof existing !== \"string\" || existing.trim() === \"\";\n });\n\n let translated = 0;\n let fellBack = 0;\n for (let i = 0; i < missing.length; i += BATCH_SIZE) {\n const batch = missing.slice(i, i + BATCH_SIZE);\n const sources = batch.map(([, value]) => value);\n const result = await translateStrings(sources, {\n translator: options.translator,\n from: options.from,\n to: options.to,\n context: options.context ?? \"Website UI strings\",\n ...(options.site ? { site: options.site } : {}),\n });\n batch.forEach(([path, source], index) => {\n const value = result?.[index];\n if (value !== undefined && keepsPlaceholders(source, value)) {\n translated += 1;\n setAtPath(base, path, value);\n } else {\n fellBack += 1;\n setAtPath(base, path, source);\n }\n });\n options.onProgress?.(Math.min(i + BATCH_SIZE, missing.length), missing.length);\n }\n return { messages: base, translated, fellBack };\n}\n"],"mappings":";;AAMA,MAAM,aAAa;;AAGnB,SAAS,aACP,MACA,OAAiB,EAAE,EACnB,MAAiC,EAAE,EACR;AAC3B,KAAI,OAAO,SAAS,SAAU,KAAI,KAAK,CAAC,MAAM,KAAK,CAAC;UAC3C,MAAM,QAAQ,KAAK,CAAE,MAAK,SAAS,MAAM,UAAU,aAAa,MAAM,CAAC,GAAG,MAAM,OAAO,MAAM,CAAC,EAAE,IAAI,CAAC;UACrG,QAAQ,OAAO,SAAS,SAC/B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAAE,cAAa,OAAO,CAAC,GA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C,QAAQ,CAAC,UAAU;EAC9D,MAAM,WAAW,UAAU,MAAM,KAAK;AACtC,SAAO,OAAO,aAAa,YAAY,SAAS,MAAM,KAAK;GAC3D;CAEF,IAAI,aAAa;CACjB,IAAI,WAAW;AACf,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,YAAY;EACnD,MAAM,QAAQ,QAAQ,MAAM,GAAG,IAAI,WAAW;EAE9C,MAAM,SAAS,MAAM,iBADL,MAAM,KAAK,GAAG,WAAW,MAAM,EACA;GAC7C,YAAY,QAAQ;GACpB,MAAM,QAAQ;GACd,IAAI,QAAQ;GACZ,SAAS,QAAQ,WAAW;GAC5B,GAAI,QAAQ,OAAO,EAAE,MAAM,QAAQ,MAAM,GAAG,EAAE;GAC/C,CAAC;AACF,QAAM,SAAS,CAAC,MAAM,SAAS,UAAU;GACvC,MAAM,QAAQ,SAAS;AACvB,OAAI,UAAU,KAAA,KAAa,kBAAkB,QAAQ,MAAM,EAAE;AAC3D,kBAAc;AACd,cAAU,MAAM,MAAM,MAAM;UACvB;AACL,gBAAY;AACZ,cAAU,MAAM,MAAM,OAAO;;IAE/B;AACF,UAAQ,aAAa,KAAK,IAAI,IAAI,YAAY,QAAQ,OAAO,EAAE,QAAQ,OAAO;;AAEhF,QAAO;EAAE,UAAU;EAAM;EAAY;EAAU"}
@@ -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-D_jixG36.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-trhUexxM.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,3 +1,3 @@
1
- import { t as LocaleRead } from "./locale-CWiIcGuU.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-DXjnElZn.mjs";
1
+ import { t as LocaleRead } from "./locale-CTT3nn6T.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-QDNmDi02.mjs";
3
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-D3yVnbxs.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-BMt7Z5CF.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-Db6Iy3hJ.mjs";
2
- import { t as ThemePayload } from "./published-_1rrTj_B.mjs";
1
+ import { _ as ThemeIdentityFallback } from "./types-DLBlHZUd.mjs";
2
+ import { t as ThemePayload } from "./published-B3etM6X5.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-DefZv9na.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-CkqqY08H.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-Db6Iy3hJ.mjs";
1
+ import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-DLBlHZUd.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-CNBVfmM7.d.mts.map
113
+ //# sourceMappingURL=preview-1vwxBgm5.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview-CNBVfmM7.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/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D,yBAAA;EAAA"}
1
+ {"version":3,"file":"preview-1vwxBgm5.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,5 +1,5 @@
1
- import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-Db6Iy3hJ.mjs";
2
- import { t as LocaleRead } from "./locale-CWiIcGuU.mjs";
1
+ import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-DLBlHZUd.mjs";
2
+ import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
3
3
  import { ThemeConfig } from "@bison-lab/tokens";
4
4
 
5
5
  //#region src/theme/published.d.ts
@@ -27,4 +27,4 @@ declare function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Pr
27
27
  declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback, read?: LocaleRead): Promise<ResolvedThemeIdentity>;
28
28
  //#endregion
29
29
  export { getPublishedIdentity as n, getPublishedTheme as r, ThemePayload as t };
30
- //# sourceMappingURL=published-_1rrTj_B.d.mts.map
30
+ //# sourceMappingURL=published-B3etM6X5.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-_1rrTj_B.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
+ {"version":3,"file":"published-B3etM6X5.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,4 +1,4 @@
1
- import { t as localeArgs } from "./locale-CFWfB4wP.mjs";
1
+ import { t as localeArgs } from "./locale-B6rUVwpg.mjs";
2
2
  //#region src/navigation/types.ts
3
3
  const NAVIGATION_SLUG = "navigation";
4
4
  const NAVIGATION_DB_NAME = "nav";
@@ -427,4 +427,4 @@ async function getNavigation({ payload, draft = false, ...read }) {
427
427
  //#endregion
428
428
  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 };
429
429
 
430
- //# sourceMappingURL=published-D3yVnbxs.mjs.map
430
+ //# sourceMappingURL=published-BMt7Z5CF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-D3yVnbxs.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, a site path starting with /, or a #anchor on the same page.\";\n\nconst SAME_PAGE_ANCHOR = /^#[A-Za-z][\\w:.-]*$/;\n\n/**\n * What the picker will store as an external destination: http(s) with a\n * host, mailto:/tel: with a value, an in-site path, or a same-page #anchor. 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 // A same-page fragment: a site's link adapter can open a modal or scroll to it.\n if (raw.startsWith(\"#\")) return SAME_PAGE_ANCHOR.test(raw);\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:\", a site path (\"/contact\"), or a same-page \"#anchor\".',\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;AAEF,MAAM,mBAAmB;;;;;;AAOzB,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,CAAE,QAAO;AACzD,KAAI,YAAY,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAC/C,KAAI,SAAS,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAE5C,KAAI,IAAI,WAAW,IAAI,CAAE,QAAO,iBAAiB,KAAK,IAAI;AAC1D,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,IAAI;AACxB,UAAQ,IAAI,aAAa,WAAW,IAAI,aAAa,aAAa,QAAQ,IAAI,SAAS;SACjF;AACN,SAAO;;;AAIX,SAAgB,qBAAqB,OAAgB,WAAW,OAAsB;CACpF,MAAM,MAAM,OAAO,SAAS,GAAG,CAAC,MAAM;AACtC,KAAI,CAAC,IAAK,QAAO,WAAW,4BAA4B;AACxD,QAAO,oBAAoB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AS,SAAS,IAAI;AAE5B,SADe,UAAU,YAAY,SAAS,SAAS,OAAO,OAAO,GAAG,SACvD,EAAE;;AAGrB,SAAS,SAAS,KAAgC;CAChD,MAAM,SAAS,SAAS,IAAI;AAE5B,SADe,UAAU,YAAY,SAAS,SAAS,OAAO,OAAO,GAAG,SACvD,EAAE;;AAGrB,SAAS,MAAM,KAA6B;CAC1C,MAAM,SAAS,SAAS,IAAI;AAE5B,SADY,UAAU,SAAS,SAAS,SAAS,OAAO,IAAI,GAAG,SACjD,EAAE;;;;;;;;;;AAWlB,eAAsB,cAAc,EAClC,SACA,QAAQ,OACR,GAAG,QACyC;CAC5C,MAAM,SAAS,WAAW,KAAK;CAC/B,MAAM,CAAC,WAAW,aAAa,MAAM,QAAQ,IAAI,CAC/C,QAAQ,WAAW;EAAE,MAAM;EAAiB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,EACzE,QAAQ,WAAW;EAAE,MAAM;EAAwB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,CACjF,CAAC;AACF,QAAO;EAAE,QAAQ,SAAS,UAAU;EAAE,QAAQ,SAAS,UAAU;EAAE,KAAK,MAAM,UAAU;EAAE"}
1
+ {"version":3,"file":"published-BMt7Z5CF.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, a site path starting with /, or a #anchor on the same page.\";\n\nconst SAME_PAGE_ANCHOR = /^#[A-Za-z][\\w:.-]*$/;\n\n/**\n * What the picker will store as an external destination: http(s) with a\n * host, mailto:/tel: with a value, an in-site path, or a same-page #anchor. 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 // A same-page fragment: a site's link adapter can open a modal or scroll to it.\n if (raw.startsWith(\"#\")) return SAME_PAGE_ANCHOR.test(raw);\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:\", a site path (\"/contact\"), or a same-page \"#anchor\".',\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;;;;;;;;;ACVl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QAAQ,OACR,GAAG,QACyC;CAC5C,MAAM,SAAS,WAAW,KAAK;CAC/B,MAAM,CAAC,WAAW,aAAa,MAAM,QAAQ,IAAI,CAC/C,QAAQ,WAAW;EAAE,MAAM;EAAiB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,EACzE,QAAQ,WAAW;EAAE,MAAM;EAAwB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,CACjF,CAAC;AACF,QAAO;EAAE,QAAQ,SAAS,UAAU;EAAE,QAAQ,SAAS,UAAU;EAAE,KAAK,MAAM,UAAU;EAAE"}
@@ -1,5 +1,5 @@
1
1
  import { t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CN6EOeDM.mjs";
2
- import { t as localeArgs } from "./locale-CFWfB4wP.mjs";
2
+ import { t as localeArgs } from "./locale-B6rUVwpg.mjs";
3
3
  //#region src/theme/published.ts
4
4
  /**
5
5
  * The Theme row, or `seed` when the Global is empty. Theme has no draft
@@ -33,4 +33,4 @@ async function getPublishedIdentity(payload, fallback, read = {}) {
33
33
  //#endregion
34
34
  export { getPublishedTheme as n, getPublishedIdentity as t };
35
35
 
36
- //# sourceMappingURL=published-DefZv9na.mjs.map
36
+ //# sourceMappingURL=published-CkqqY08H.mjs.map
@@ -1 +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
+ {"version":3,"file":"published-CkqqY08H.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,4 +1,4 @@
1
- import { t as LocaleRead } from "./locale-CWiIcGuU.mjs";
1
+ import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
2
2
  import { ArrayFieldValidation, Block, Field, GlobalConfig } from "payload";
3
3
 
4
4
  //#region src/navigation/types.d.ts
@@ -137,4 +137,4 @@ declare function getNavigation({
137
137
  }: GetNavigationArgs): Promise<NavigationDoc>;
138
138
  //#endregion
139
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 };
140
- //# sourceMappingURL=published-DXjnElZn.d.mts.map
140
+ //# sourceMappingURL=published-QDNmDi02.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-DXjnElZn.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,W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DF;;;;;cEwFa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"published-QDNmDi02.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;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,UAAA;EACzC,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KChEG,QAAA;AAAA,cAaQ,qBAAA;;ADVb;;;;iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAgBpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UAyFpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;ADnItC;;;;AAAA,iBC8IgB,iBAAA,CAAkB,KAAA;;;;;;ADjJlC;cELa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;AFEb;AAAA,cEAa,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;;cAWtB,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;;AFpDvD;;;;iBE6DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;;AF/DF;;;;;cEwFa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
@@ -459,4 +459,4 @@ async function getSectionControls(payload, extras = blockLibraryEntriesFromConfi
459
459
  //#endregion
460
460
  export { sectionControlsOf as _, sectionControlsFromLibrary as a, BLOCK_LIBRARY_CATEGORIES as c, DEFAULT_SECTION_CONTROLS as d, HERO_SECTION_CONTROLS as f, defaultSectionControls as g, SECTION_CONTROL_LABELS as h, defaultBlockLibraryValue as i, BLOCK_LIBRARY_SLUG as l, SECTION_CONTROL_KEYS as m, getSectionControls as n, stampBlockLibrary as o, NO_SECTION_CONTROLS as p, blockLibraryCatalogue as r, validateBlockLibrary as s, blockLibraryEntriesFromConfig as t, PACKAGE_BLOCK_SLUGS as u };
461
461
 
462
- //# sourceMappingURL=published-QyTcDznE.mjs.map
462
+ //# sourceMappingURL=published-hqtvmVUD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-QyTcDznE.mjs","names":["PACKAGE_SLUGS"],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"ctaBand\",\n \"logoCloud\",\n \"gallery\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"ctaBand\", label: \"CTA band\", category: \"cta\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"logoCloud\", label: \"Logo cloud\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"gallery\", label: \"Gallery\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nconst PACKAGE_SLUGS = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));\n\n/**\n * The package entries, then the site's extras. An extra whose slug the\n * package ships replaces that package entry in its place: a site that\n * registered its own block before the package shipped one under the same\n * slug still renders its own config, so its label, category, controls,\n * picture and sample are the true ones. A release that adds such a block\n * therefore never yields two rows for one slug, and never relabels the\n * site's block as the package's.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS.has(entry.slug)).map((entry) => [entry.slug, entry]));\n return [\n ...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? { ...entry, sectionControls: { ...entry.sectionControls } }),\n ...own.filter((entry) => !PACKAGE_SLUGS.has(entry.slug)),\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out (the catalogue already has them) unless the site\n * registered its own entry under one, which `siteSlugs` records.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown; siteSlugs?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n const siteSlugs = blocks?.admin?.custom?.siteSlugs;\n const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === \"string\") : []);\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || (PACKAGE_SLUGS.has(slug) && !own.has(slug))) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_LIBRARY_SLUG, depth: 0, overrideAccess: true })) as\n | BlockLibraryDoc\n | null\n | undefined;\n return sectionControlsFromLibrary(doc, extras);\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,uBAAuB;CAAC;CAAc;CAAW;CAAU;CAAS;;AAOjF,MAAa,yBAA4D;CACvE,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,2BAA4C;CACvD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;;;;;AAOD,MAAa,wBAAyC;CACpD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,sBAAuC;CAClD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;AAED,SAAgB,uBAAuB,MAAyC;AAC9E,KAAI,SAAS,OAAQ,QAAO,EAAE,GAAG,uBAAuB;AACxD,KAAI,SAAS,SAAU,QAAO,EAAE,GAAG,qBAAqB;AACxD,QAAO,EAAE,GAAG,0BAA0B;;;AAIxC,SAAgB,OAAO,OAAuE;AAC5F,QAAO,MAAM,SAAS,MAAM,aAAa,SAAS,SAAS,MAAM,aAAa,eAAe,WAAW;;;;;;;AAQ1G,SAAgB,kBAAkB,OAAgB,UAA4C;CAC5F,MAAM,SAAS,SAAS,OAAO,UAAU,WAAY,QAAoC,EAAE;CAC3F,MAAM,MAAM,EAAE,GAAG,UAAU;AAC3B,MAAK,MAAM,OAAO,qBAChB,KAAI,OAAO,OAAO,SAAS,UAAW,KAAI,OAAO,OAAO;AAE1D,QAAO;;;AAIT,SAAgB,qBAAqB,OAA2C;AAC9E,QAAO,kBAAkB,MAAM,iBAAiB,uBAAuB,OAAO,MAAM,CAAC,CAAC;;;;AC7ExF,MAAa,qBAAqB;AAElC,MAAa,2BAA2B;CACtC;EAAE,IAAI;EAAQ,OAAO;EAAQ;CAC7B;EAAE,IAAI;EAAW,OAAO;EAAW;CACnC;EAA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AAO,QAAQ,SAAU,QAAO,EAAE;EAC9C,MAAM,EAAE,MAAM,OAAO,UAAU,MAAM,oBAAoB;AACzD,MAAI,OAAO,SAAS,YAAY,CAAC,QAAS,cAAc,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAG,QAAO,EAAE;AAC/F,SAAO,CACL;GACE;GACA,OAAO,OAAO,UAAU,WAAW,QAAQ;GAC3C,UAAU,OAAO,aAAa,WAAW,WAAW;GACpD,GAAI,SAAS,UAAU,SAAS,aAAa,SAAS,WAAW,EAAE,MAAM,GAAG,EAAE;GAC9E,GAAI,mBAAmB,OAAO,oBAAoB,WAC9C,EAAmB,iBAAyD,GAC5E,EAAE;GACP,CACF;GACD;;;;;;;;;;AAWJ,eAAsB,mBACpB,SACA,SAAuC,8BAA8B,QAA8B,EACzD;AAK1C,QAAO,2BAJM,MAAM,QAAQ,WAAW;EAAE,MAAM;EAAoB,OAAO;EAAG,gBAAgB;EAAM,CAAC,EAI5D,OAAO"}
1
+ {"version":3,"file":"published-hqtvmVUD.mjs","names":["PACKAGE_SLUGS"],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"ctaBand\",\n \"logoCloud\",\n \"gallery\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"ctaBand\", label: \"CTA band\", category: \"cta\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"logoCloud\", label: \"Logo cloud\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"gallery\", label: \"Gallery\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nconst PACKAGE_SLUGS = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));\n\n/**\n * The package entries, then the site's extras. An extra whose slug the\n * package ships replaces that package entry in its place: a site that\n * registered its own block before the package shipped one under the same\n * slug still renders its own config, so its label, category, controls,\n * picture and sample are the true ones. A release that adds such a block\n * therefore never yields two rows for one slug, and never relabels the\n * site's block as the package's.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS.has(entry.slug)).map((entry) => [entry.slug, entry]));\n return [\n ...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? { ...entry, sectionControls: { ...entry.sectionControls } }),\n ...own.filter((entry) => !PACKAGE_SLUGS.has(entry.slug)),\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out (the catalogue already has them) unless the site\n * registered its own entry under one, which `siteSlugs` records.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown; siteSlugs?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n const siteSlugs = blocks?.admin?.custom?.siteSlugs;\n const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === \"string\") : []);\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || (PACKAGE_SLUGS.has(slug) && !own.has(slug))) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_LIBRARY_SLUG, depth: 0, overrideAccess: true })) as\n | BlockLibraryDoc\n | null\n | undefined;\n return sectionControlsFromLibrary(doc, extras);\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,uBAAuB;CAAC;CAAc;CAAW;CAAU;CAAS;;AAOjF,MAAa,yBAA4D;CACvE,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,2BAA4C;CACvD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;;;;;AAOD,MAAa,wBAAyC;CACpD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,sBAAuC;CAClD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;AAED,SAAgB,uBAAuB,MAAyC;AAC9E,KAAI,SAAS,OAAQ,QAAO,EAAE,GAAG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