@bison-lab/payload-core 4.32.0 → 4.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/block-library.d.mts +1 -1
- package/dist/block-library.mjs +1 -1
- package/dist/{catalogue-SrzJ3equ.d.mts → catalogue-BC_A9eLc.d.mts} +9 -5
- package/dist/{catalogue-SrzJ3equ.d.mts.map → catalogue-BC_A9eLc.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{published-BFiOGw2X.mjs → published-niJkPGjE.mjs} +18 -10
- package/dist/published-niJkPGjE.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/published-BFiOGw2X.mjs.map +0 -1
|
@@ -293,16 +293,20 @@ const PACKAGE_BLOCKS = [
|
|
|
293
293
|
const PACKAGE_SLUGS$1 = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));
|
|
294
294
|
/**
|
|
295
295
|
* The package entries, then the site's extras. An extra whose slug the
|
|
296
|
-
* package ships
|
|
297
|
-
*
|
|
298
|
-
*
|
|
296
|
+
* package ships replaces that package entry in its place: a site that
|
|
297
|
+
* registered its own block before the package shipped one under the same
|
|
298
|
+
* slug still renders its own config, so its label, category, controls,
|
|
299
|
+
* picture and sample are the true ones. A release that adds such a block
|
|
300
|
+
* therefore never yields two rows for one slug, and never relabels the
|
|
301
|
+
* site's block as the package's.
|
|
299
302
|
*/
|
|
300
303
|
function blockLibraryCatalogue(extras = []) {
|
|
301
|
-
const
|
|
302
|
-
|
|
304
|
+
const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));
|
|
305
|
+
const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS$1.has(entry.slug)).map((entry) => [entry.slug, entry]));
|
|
306
|
+
return [...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? {
|
|
303
307
|
...entry,
|
|
304
308
|
sectionControls: { ...entry.sectionControls }
|
|
305
|
-
})
|
|
309
|
+
}), ...own.filter((entry) => !PACKAGE_SLUGS$1.has(entry.slug))];
|
|
306
310
|
}
|
|
307
311
|
function defaultBlockLibraryValue(options) {
|
|
308
312
|
return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));
|
|
@@ -415,15 +419,19 @@ const PACKAGE_SLUGS = new Set(PACKAGE_BLOCK_SLUGS);
|
|
|
415
419
|
* `createBlockLibrary` keeps the rows it seeded (package and extras) on the
|
|
416
420
|
* `blocks` field's `admin.custom.rows`, so a site block's catalogue default
|
|
417
421
|
* is known here without the site passing `blocks` a second time. Package
|
|
418
|
-
* slugs are left out
|
|
422
|
+
* slugs are left out (the catalogue already has them) unless the site
|
|
423
|
+
* registered its own entry under one, which `siteSlugs` records.
|
|
419
424
|
*/
|
|
420
425
|
function blockLibraryEntriesFromConfig(payload) {
|
|
421
|
-
const
|
|
426
|
+
const blocks = ((Array.isArray(payload.config?.globals) ? payload.config.globals : []).find((global) => typeof global === "object" && global !== null && global.slug === "block-library")?.fields ?? []).find((field) => typeof field === "object" && field !== null && field.name === "blocks");
|
|
427
|
+
const rows = blocks?.admin?.custom?.rows;
|
|
422
428
|
if (!Array.isArray(rows)) return [];
|
|
429
|
+
const siteSlugs = blocks?.admin?.custom?.siteSlugs;
|
|
430
|
+
const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === "string") : []);
|
|
423
431
|
return rows.flatMap((row) => {
|
|
424
432
|
if (!row || typeof row !== "object") return [];
|
|
425
433
|
const { slug, label, category, kind, sectionControls } = row;
|
|
426
|
-
if (typeof slug !== "string" || !slug || PACKAGE_SLUGS.has(slug)) return [];
|
|
434
|
+
if (typeof slug !== "string" || !slug || PACKAGE_SLUGS.has(slug) && !own.has(slug)) return [];
|
|
427
435
|
return [{
|
|
428
436
|
slug,
|
|
429
437
|
label: typeof label === "string" ? label : slug,
|
|
@@ -451,4 +459,4 @@ async function getSectionControls(payload, extras = blockLibraryEntriesFromConfi
|
|
|
451
459
|
//#endregion
|
|
452
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 };
|
|
453
461
|
|
|
454
|
-
//# sourceMappingURL=published-
|
|
462
|
+
//# sourceMappingURL=published-niJkPGjE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-niJkPGjE.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,OAA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"@bison-lab/payload-core",
|
|
3
|
-
"version": "4.32.
|
|
3
|
+
"version": "4.32.1",
|
|
4
4
|
"description": "Site-agnostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bison-lab",
|
|
@@ -135,8 +135,8 @@
|
|
|
135
135
|
"tsdown": "^0.21.0",
|
|
136
136
|
"typescript": "^5.9.3",
|
|
137
137
|
"vitest": "^4.1.2",
|
|
138
|
-
"@bison-lab/fonts": "3.27.1",
|
|
139
138
|
"@bison-lab/tokens": "4.5.0",
|
|
139
|
+
"@bison-lab/fonts": "3.27.1",
|
|
140
140
|
"@bison-lab/ui": "4.32.0"
|
|
141
141
|
},
|
|
142
142
|
"publishConfig": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"published-BFiOGw2X.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 is dropped (the package entry wins), as\n * `blockLibraryEntriesFromConfig` does, so a release that adds a block a\n * site had registered itself never yields two rows for one slug.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const extra = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug) && !PACKAGE_SLUGS.has(entry.slug));\n return [\n ...PACKAGE_BLOCKS.map((entry) => ({ ...entry, sectionControls: { ...entry.sectionControls } })),\n ...extra,\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.\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 } } } =>\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 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)) 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,OA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