@bison-lab/payload-core 4.20.0 → 4.24.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.
- package/README.md +10 -1
- package/dist/admin.d.mts +14 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +14 -1
- package/dist/admin.mjs.map +1 -1
- package/dist/block-library.d.mts +1 -1
- package/dist/block-library.mjs +1 -1
- package/dist/{catalogue-DMoDgScN.d.mts → catalogue-D8RgcFNY.d.mts} +2 -2
- package/dist/catalogue-D8RgcFNY.d.mts.map +1 -0
- package/dist/index.d.mts +28 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +57 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{published-BjmUCpdY.mjs → published-CWBd2bO5.mjs} +33 -1
- package/dist/published-CWBd2bO5.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/catalogue-DMoDgScN.d.mts.map +0 -1
- package/dist/published-BjmUCpdY.mjs.map +0 -1
|
@@ -123,10 +123,14 @@ const PACKAGE_BLOCK_SLUGS = [
|
|
|
123
123
|
"hero",
|
|
124
124
|
"heroSweep",
|
|
125
125
|
"heroCompact",
|
|
126
|
+
"heroSimple",
|
|
126
127
|
"showcasePanels",
|
|
128
|
+
"featureHighlights",
|
|
129
|
+
"featureChecklist",
|
|
127
130
|
"processSteps",
|
|
128
131
|
"faqColumns",
|
|
129
132
|
"testimonialMasonry",
|
|
133
|
+
"testimonialCarousel",
|
|
130
134
|
"statsBand",
|
|
131
135
|
"richText",
|
|
132
136
|
"nap",
|
|
@@ -161,6 +165,13 @@ const PACKAGE_BLOCKS = [
|
|
|
161
165
|
kind: "hero",
|
|
162
166
|
sectionControls: HERO_SECTION_CONTROLS
|
|
163
167
|
},
|
|
168
|
+
{
|
|
169
|
+
slug: "heroSimple",
|
|
170
|
+
label: "Simple hero",
|
|
171
|
+
category: "hero",
|
|
172
|
+
kind: "hero",
|
|
173
|
+
sectionControls: HERO_SECTION_CONTROLS
|
|
174
|
+
},
|
|
164
175
|
{
|
|
165
176
|
slug: "showcasePanels",
|
|
166
177
|
label: "Showcase panels",
|
|
@@ -168,6 +179,20 @@ const PACKAGE_BLOCKS = [
|
|
|
168
179
|
kind: "section",
|
|
169
180
|
sectionControls: DEFAULT_SECTION_CONTROLS
|
|
170
181
|
},
|
|
182
|
+
{
|
|
183
|
+
slug: "featureHighlights",
|
|
184
|
+
label: "Feature highlights",
|
|
185
|
+
category: "feature",
|
|
186
|
+
kind: "section",
|
|
187
|
+
sectionControls: DEFAULT_SECTION_CONTROLS
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
slug: "featureChecklist",
|
|
191
|
+
label: "Feature checklist",
|
|
192
|
+
category: "feature",
|
|
193
|
+
kind: "section",
|
|
194
|
+
sectionControls: DEFAULT_SECTION_CONTROLS
|
|
195
|
+
},
|
|
171
196
|
{
|
|
172
197
|
slug: "processSteps",
|
|
173
198
|
label: "Process steps",
|
|
@@ -189,6 +214,13 @@ const PACKAGE_BLOCKS = [
|
|
|
189
214
|
kind: "section",
|
|
190
215
|
sectionControls: DEFAULT_SECTION_CONTROLS
|
|
191
216
|
},
|
|
217
|
+
{
|
|
218
|
+
slug: "testimonialCarousel",
|
|
219
|
+
label: "Testimonial carousel",
|
|
220
|
+
category: "testimonials",
|
|
221
|
+
kind: "section",
|
|
222
|
+
sectionControls: DEFAULT_SECTION_CONTROLS
|
|
223
|
+
},
|
|
192
224
|
{
|
|
193
225
|
slug: "statsBand",
|
|
194
226
|
label: "Stats",
|
|
@@ -373,4 +405,4 @@ async function getSectionControls(payload, extras = blockLibraryEntriesFromConfi
|
|
|
373
405
|
//#endregion
|
|
374
406
|
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 };
|
|
375
407
|
|
|
376
|
-
//# sourceMappingURL=published-
|
|
408
|
+
//# sourceMappingURL=published-CWBd2bO5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-CWBd2bO5.mjs","names":[],"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`. CTA is a category for a site\n * extra; the package ships no CTA slug. 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 \"nap\",\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: \"nap\", label: \"Contact\", category: \"contact\", 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\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const extra = extras.filter((entry) => !NOT_CATALOGUE.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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,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bison-lab/payload-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.0",
|
|
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",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"vitest": "^4.1.2",
|
|
138
138
|
"@bison-lab/fonts": "3.27.1",
|
|
139
139
|
"@bison-lab/tokens": "4.5.0",
|
|
140
|
-
"@bison-lab/ui": "4.
|
|
140
|
+
"@bison-lab/ui": "4.23.0"
|
|
141
141
|
},
|
|
142
142
|
"publishConfig": {
|
|
143
143
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue-DMoDgScN.d.mts","names":[],"sources":["../src/block-library/types.ts","../src/block-library/controls.ts","../src/block-library/published.ts","../src/block-library/catalogue.ts"],"mappings":";;;cAEa,kBAAA;AAAA,cAEA,wBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaD,sBAAA,WAAiC,wBAAA;AAAA,KAEjC,gBAAA;;;;;AAAZ;cAOa,mBAAA;AAAA,KAcD,gBAAA,WAA2B,mBAAA;AAAA,UAEtB,iBAAA;EACf,IAAA;EACA,KAAA;EACA,Q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AAe,eAAA;;;UCvBT,mBAAA;EACf,MAAA,YAAkB,iBAAA;EAClB,WAAA,GAAc,IAAA;AAAA;AAAA,UAGC,iBAAA;EACf,SAAA,YAAqB,eAAA;EHzCV;EG2CX,OAAA,YAAmB,kBAAA;;EAEnB,MAAA,YAAkB,kBAAA;EAClB,KAAA;AAAA;AAAA,iBAGc,qBAAA,CAAsB,MAAA,YAAiB,iBAAA,KAA2B,iBAAA;AAAA,iBAQlE,wBAAA,CAAyB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;;;;;;;iBAuBxD,iBAAA,CAAkB,KAAA,WAAgB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;;;;;;;;;;AHnEjF;iBG4GgB,0BAAA,CACd,GAAA,EAAK,eAAA,qBACL,MAAA,YAAiB,iBAAA,KAChB,MAAA,SAAe,eAAA;;;;AH7GlB;;;iBG6IsB,oBAAA,CACpB,KAAA,WACA,OAAA,EAAS,mBAAA,EACT,KAAA,GAAO,iBAAA,GACN,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"published-BjmUCpdY.mjs","names":[],"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`. CTA is a category for a site\n * extra; the package ships no CTA slug. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"showcasePanels\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"statsBand\",\n \"richText\",\n \"nap\",\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: \"showcasePanels\", label: \"Showcase panels\", 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: \"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: \"nap\", label: \"Contact\", category: \"contact\", 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\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const extra = extras.filter((entry) => !NOT_CATALOGUE.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,QAA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