@bison-lab/payload-core 4.15.2 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +41 -31
  2. package/dist/admin.mjs.map +1 -1
  3. package/dist/block-library.d.mts +1 -1
  4. package/dist/block-thumbnails--AJzSdzJ.mjs +130 -0
  5. package/dist/block-thumbnails--AJzSdzJ.mjs.map +1 -0
  6. package/dist/block-thumbnails-cli.d.mts +1 -0
  7. package/dist/block-thumbnails-cli.mjs +121 -0
  8. package/dist/block-thumbnails-cli.mjs.map +1 -0
  9. package/dist/block-thumbnails.d.mts +74 -0
  10. package/dist/block-thumbnails.d.mts.map +1 -0
  11. package/dist/block-thumbnails.mjs +2 -0
  12. package/dist/{catalogue-CFXM1yAZ.d.mts → catalogue-DMoDgScN.d.mts} +6 -5
  13. package/dist/catalogue-DMoDgScN.d.mts.map +1 -0
  14. package/dist/{facet-field-_8bYI1i0.d.mts → facet-field-DKzRCYrh.d.mts} +1 -1
  15. package/dist/{facet-field-_8bYI1i0.d.mts.map → facet-field-DKzRCYrh.d.mts.map} +1 -1
  16. package/dist/index.d.mts +27 -11
  17. package/dist/index.d.mts.map +1 -1
  18. package/dist/index.mjs +80 -21
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/metadata.d.mts +1 -1
  21. package/dist/navigation.d.mts +1 -1
  22. package/dist/{preview-Vaa1KXJP.d.mts → preview-T5VFcS32.d.mts} +1 -1
  23. package/dist/{preview-Vaa1KXJP.d.mts.map → preview-T5VFcS32.d.mts.map} +1 -1
  24. package/dist/published-BjmUCpdY.mjs.map +1 -1
  25. package/dist/{published-FUgC5Mc8.d.mts → published-IX1-6JEa.d.mts} +1 -1
  26. package/dist/{published-FUgC5Mc8.d.mts.map → published-IX1-6JEa.d.mts.map} +1 -1
  27. package/dist/taxonomy.d.mts +1 -1
  28. package/dist/theme.d.mts +1 -1
  29. package/dist/{title-ImlifZ_6.d.mts → title-BvjHeRo5.d.mts} +1 -1
  30. package/dist/{title-ImlifZ_6.d.mts.map → title-BvjHeRo5.d.mts.map} +1 -1
  31. package/dist/{wireframe-BTocmmyY.mjs → wireframe-ApjwNWAN.mjs} +6 -1
  32. package/dist/{wireframe-BTocmmyY.mjs.map → wireframe-ApjwNWAN.mjs.map} +1 -1
  33. package/dist/wireframe-cli.mjs +5 -1
  34. package/dist/wireframe-cli.mjs.map +1 -1
  35. package/dist/wireframe.d.mts +5 -0
  36. package/dist/wireframe.d.mts.map +1 -1
  37. package/dist/wireframe.mjs +1 -1
  38. package/package.json +6 -1
  39. package/dist/catalogue-CFXM1yAZ.d.mts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-ImlifZ_6.mjs";
1
+ import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-BvjHeRo5.mjs";
2
2
 
3
3
  //#region src/seo/metadata.d.ts
4
4
  /** A page as the reader needs it; a site's generated `Page` is assignable. */
@@ -1,2 +1,2 @@
1
- import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-FUgC5Mc8.mjs";
1
+ import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-IX1-6JEa.mjs";
2
2
  export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, type FooterColumnWidth, type FooterSocial, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
@@ -349,4 +349,4 @@ declare const THEME_PREVIEW_BREAKPOINTS: readonly [{
349
349
  }];
350
350
  //#endregion
351
351
  export { ThemeHeadOptions as A, rewriteColorUsages as B, THEME_COLORS_SLUG as C, ThemeColorDoc as D, THEME_TYPOGRAPHY_SLUG as E, resolveThemeIdentity as F, ColorUsage as I, ColorUsagesList as L, ThemeUploadDoc as M, ResolvedThemeIdentity as N, ThemeDoc as O, ThemeIdentityFallback as P, ColorUsagesOption as R, THEME_APPEARANCE_SLUG as S, THEME_SLUG as T, themeColorKeys as _, pageEditorLooks as a, SYSTEM_COLOR_KEYS as b, LookFieldMode as c, lookField as d, ColorTokenHit as f, rewriteColorToken as g, deleteLibraryColor as h, PageEditorSystemKey as i, ThemeLibraryColorDoc as j, ThemeHead as k, LookFieldOptions as l, rewriteColorTokens as m, LookOption as n, pageEditorTokens as o, findColorTokens as p, PAGE_EDITOR_SYSTEM_KEYS as r, themeLibraryFromDoc as s, THEME_PREVIEW_BREAKPOINTS as t, colorTokenField as u, CreateThemeOptions as v, THEME_IDENTITY_SLUG as w, SystemColorKey as x, EditableTheme as y, findColorUsages as z };
352
- //# sourceMappingURL=preview-Vaa1KXJP.d.mts.map
352
+ //# sourceMappingURL=preview-T5VFcS32.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview-Vaa1KXJP.d.mts","names":[],"sources":["../src/theme/color-usages.ts","../src/theme/identity.ts","../src/theme/types.ts","../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;UAOiB,eAAA;EACf,WAAA;EACA,OAAA;AAAA;;;;AAQF;;KAAY,iBAAA,UAA2B,eAAA;AAAA,UAEtB,UAAA;EACf,UAAA;EACA,MAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;AAAA;AAAA,KAGG,UAAA;EAAe,IAAA,EAAM,MAAA;EAA2B,UAAA;EAAqB,IAAA;AAAA;AAAA,KAErE,OAAA;EAAY,IAAA;AAAA;AAAA,UAEA,iBAAA;EACf,IAAA,GAAO,IAAA;IACL,UAAA;IACA,KAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,UAAA;EACd,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,MAAA,oBAA0B,QAAA;EACxC,MAAA,GAAS,IAAA;IACP,UAAA;IACA,EAAA;IACA,IAAA,EAAM,MAAA;IACN,KAAA;IACA,cAAA;EAAA,MACI,OAAA;EACN,YAAA,GAAe,IAAA;IACb,IAAA;IACA,IAAA,EAAM,MAAA;IACN,KAAA;IACA,cAAA;EAAA,MACI,OAAA;EACN,WAAA,GAAc,MAAA;EACd,OAAA;IAAY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","names":[],"sources":["../src/theme/color-usages.ts","../src/theme/identity.ts","../src/theme/types.ts","../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;UAOiB,eAAA;EACf,WAAA;EACA,OAAA;AAAA;;;;AAQF;;KAAY,iBAAA,UAA2B,eAAA;AAAA,UAEtB,UAAA;EACf,UAAA;EACA,MAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;AAAA;AAAA,KAGG,UAAA;EAAe,IAAA,EAAM,MAAA;EAA2B,UAAA;EAAqB,IAAA;AAAA;AAAA,KAErE,OAAA;EAAY,IAAA;AAAA;AAAA,UAEA,iBAAA;EACf,IAAA,GAAO,IAAA;IACL,UAAA;IACA,KAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,UAAA;EACd,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,MAAA,oBAA0B,QAAA;EACxC,MAAA,GAAS,IAAA;IACP,UAAA;IACA,EAAA;IACA,IAAA,EAAM,MAAA;IACN,KAAA;IACA,cAAA;EAAA,MACI,OAAA;EACN,YAAA,GAAe,IAAA;IACb,IAAA;IACA,IAAA,EAAM,MAAA;IACN,KAAA;IACA,cAAA;EAAA,MACI,OAAA;EACN,WAAA,GAAc,MAAA;EACd,OAAA;IAAY,MAAA,GAAS,OAAA;EAAA;EACrB,MAAA;IACE,WAAA,GAAc,OAAA;IACd,OAAA,GAAU,OAAA;EAAA;AAAA;;;;;iBAQQ,eAAA,CACpB,OAAA,EAAS,iBAAA,EACT,MAAA,EAAQ,iBAAA,cACR,GAAA,WACC,OAAA,CAAQ,UAAA;AAAA,iBAoBW,kBAAA,CACpB,OAAA,EAAS,iBAAA,EACT,MAAA,EAAQ,iBAAA,cACR,OAAA,UACA,KAAA,WACC,OAAA;;;UClGc,kBAAA;EACf,GAAA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pC;;;;;iBGwBgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;;ALMZ;;iBKqCgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;iBAO7C,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;;cCtDtD,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;;;ANbvE;;iBMkCgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;;;;iBAmBnD,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;;;;;;cCpEvD,yBAAA;EAAA"}
@@ -1 +1 @@
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, as a URL or a\n * `data:` URI (`bison-wireframes` writes one per block). `blockDrawer()`\n * sets it as the block's `admin.images.thumbnail` unless the block config\n * already has one. Package blocks ship theirs; a site 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,M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D;;;;;;;;;;AAWJ,eAAsB,mBACpB,SACA,SAAuC,8BAA8B,QAA8B,EACzD;AAK1C,QAAO,2BAJM,MAAM,QAAQ,WAAW;EAAE,MAAM;EAAoB,OAAO;EAAG,gBAAgB;EAAM,CAAC,EAI5D,OAAO"}
1
+ {"version":3,"file":"published-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,QAAO,EAAE,GAAG,0BAA0B;;;AAIxC,SAAgB,OAAO,OAAuE;AAC5F,QAAO,MAAM,SAAS,MAAM,aAAa,SAAS,SAAS,MAAM,aAAa,eAAe,WAAW;;;;;;;AAQ1G,SAAgB,kBAAkB,OAAgB,UAA4C;CAC5F,MAAM,SAAS,SAAS,OAAO,UAAU,WAAY,QAAoC,EAAE;CAC3F,MAAM,MAAM,EAAE,GAAG,UAAU;AAC3B,MAAK,MAAM,OAAO,qBAChB,KAAI,OAAO,OAAO,SAAS,UAAW,KAAI,OAAO,OAAO;AAE1D,QAAO;;;AAIT,SAAgB,qBAAqB,OAA2C;AAC9E,QAAO,kBAAkB,MAAM,iBAAiB,uBAAuB,OAAO,MAAM,CAAC,CAAC;;;;AC7ExF,MAAa,qBA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ACoB,OAAO,QAAQ;AACpC,KAAI,CAAC,MAAM,QAAQ,KAAK,CAAE,QAAO,EAAE;AACnC,QAAO,KAAK,SAAS,QAA6B;AAChD,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO,EAAE;EAC9C,MAAM,EAAE,MAAM,OAAO,UAAU,MAAM,oBAAoB;AACzD,MAAI,OAAO,SAAS,YAAY,CAAC,QAAQ,cAAc,IAAI,KAAK,CAAE,QAAO,EAAE;AAC3E,SAAO,CACL;GACE;GACA,OAAO,OAAO,UAAU,WAAW,QAAQ;GAC3C,UAAU,OAAO,aAAa,WAAW,WAAW;GACpD,GAAI,SAAS,UAAU,SAAS,aAAa,SAAS,WAAW,EAAE,MAAM,GAAG,EAAE;GAC9E,GAAI,mBAAmB,OAAO,oBAAoB,WAC9C,EAAmB,iBAAyD,GAC5E,EAAE;GACP,CACF;GACD;;;;;;;;;;AAWJ,eAAsB,mBACpB,SACA,SAAuC,8BAA8B,QAA8B,EACzD;AAK1C,QAAO,2BAJM,MAAM,QAAQ,WAAW;EAAE,MAAM;EAAoB,OAAO;EAAG,gBAAgB;EAAM,CAAC,EAI5D,OAAO"}
@@ -134,4 +134,4 @@ declare function getNavigation({
134
134
  }: GetNavigationArgs): Promise<NavigationDoc>;
135
135
  //#endregion
136
136
  export { NAVIGATION_FOOTER_SLUG as C, NavigationFooter as D, NavigationDoc as E, NavigationHeader as O, NAVIGATION_FOOTER_DB_NAME as S, NavigationBar as T, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_DB_NAME as b, FooterColumnWidth as c, normalizeFooterDesktop as d, validateFooterColumns as f, isValidExternalHref as g, headerCtaEnabled as h, FOOTER_MAX_COLUMNS as i, FooterSocial as l, EXTERNAL_HREF_MESSAGE as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, validateFooterSocialUrl as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, footerDesktopTracks as u, validateHeaderCta as v, NAVIGATION_SLUG as w, NAVIGATION_FEATURE as x, CreateNavigationOptions as y };
137
- //# sourceMappingURL=published-FUgC5Mc8.d.mts.map
137
+ //# sourceMappingURL=published-IX1-6JEa.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-FUgC5Mc8.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;cAWa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA;EACf,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KC9DG,QAAA;AAAA,cAaQ,qBAAA;ADZb;;;;;AAAA,iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAcpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UAyFpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;;;;;iBAWtB,iBAAA,CAAkB,KAAA;;;;;AD/IlC;;cEHa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;;cAEA,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;AFJnC;AAAA,cEea,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;AFtDvD;;;;;AAAA,iBE+DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;AFjEF;;;;;;AAAA,cE0Fa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;AF9IxC;;;;;iBG4BsB,aAAA,CAAA;EAAgB,OAAA;EAAS;AAAA,GAAiB,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"published-IX1-6JEa.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;cAWa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA;EACf,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KC9DG,QAAA;AAAA,cAaQ,qBAAA;ADZb;;;;;AAAA,iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAcpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UAyFpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;;;;;iBAWtB,iBAAA,CAAkB,KAAA;;;;;AD/IlC;;cEHa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;;cAEA,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;AFJnC;AAAA,cEea,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;AFtDvD;;;;;AAAA,iBE+DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;AFjEF;;;;;;AAAA,cE0Fa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;AF9IxC;;;;;iBG4BsB,aAAA,CAAA;EAAgB,OAAA;EAAS;AAAA,GAAiB,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
@@ -1,2 +1,2 @@
1
- import { n as facetField, t as FacetEntry } from "./facet-field-_8bYI1i0.mjs";
1
+ import { n as facetField, t as FacetEntry } from "./facet-field-DKzRCYrh.mjs";
2
2
  export { type FacetEntry, facetField };
package/dist/theme.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ThemeHeadOptions, D as ThemeColorDoc, F as resolveThemeIdentity, M as ThemeUploadDoc, N as ResolvedThemeIdentity, O as ThemeDoc, P as ThemeIdentityFallback, T as THEME_SLUG, _ as themeColorKeys, a as pageEditorLooks, b as SYSTEM_COLOR_KEYS, d as lookField, f as ColorTokenHit, g as rewriteColorToken, h as deleteLibraryColor, i as PageEditorSystemKey, j as ThemeLibraryColorDoc, k as ThemeHead, m as rewriteColorTokens, n as LookOption, o as pageEditorTokens, p as findColorTokens, r as PAGE_EDITOR_SYSTEM_KEYS, s as themeLibraryFromDoc, t as THEME_PREVIEW_BREAKPOINTS, u as colorTokenField, v as CreateThemeOptions, x as SystemColorKey, y as EditableTheme } from "./preview-Vaa1KXJP.mjs";
1
+ import { A as ThemeHeadOptions, D as ThemeColorDoc, F as resolveThemeIdentity, M as ThemeUploadDoc, N as ResolvedThemeIdentity, O as ThemeDoc, P as ThemeIdentityFallback, T as THEME_SLUG, _ as themeColorKeys, a as pageEditorLooks, b as SYSTEM_COLOR_KEYS, d as lookField, f as ColorTokenHit, g as rewriteColorToken, h as deleteLibraryColor, i as PageEditorSystemKey, j as ThemeLibraryColorDoc, k as ThemeHead, m as rewriteColorTokens, n as LookOption, o as pageEditorTokens, p as findColorTokens, r as PAGE_EDITOR_SYSTEM_KEYS, s as themeLibraryFromDoc, t as THEME_PREVIEW_BREAKPOINTS, u as colorTokenField, v as CreateThemeOptions, x as SystemColorKey, y as EditableTheme } from "./preview-T5VFcS32.mjs";
2
2
  import { ShadeStep, ThemeConfig } from "@bison-lab/tokens";
3
3
 
4
4
  //#region src/theme/published.d.ts
@@ -52,4 +52,4 @@ declare function documentTitle(siteName: string, pageTitle: string): string;
52
52
  declare function titleTemplate(siteName: string): string;
53
53
  //#endregion
54
54
  export { SeoImageSize as a, SeoImageDoc as i, titleTemplate as n, SeoImageValue as o, MediaId as r, SeoMeta as s, documentTitle as t };
55
- //# sourceMappingURL=title-ImlifZ_6.d.mts.map
55
+ //# sourceMappingURL=title-BvjHeRo5.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"title-ImlifZ_6.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
1
+ {"version":3,"file":"title-BvjHeRo5.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
@@ -1,5 +1,10 @@
1
1
  //#region src/wireframe.ts
2
2
  /**
3
+ * @deprecated since 4.16: the Add Block drawer shows screenshots now
4
+ * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).
5
+ * Kept working for this release so a site that calls it does not break;
6
+ * it goes in the next major.
7
+ *
3
8
  * Black-and-white wireframes of Block library samples, for Payload's Add
4
9
  * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a
5
10
  * script drives a browser to each block's preview (`previewPath(slug)`),
@@ -295,4 +300,4 @@ async function captureWireframes(page, previews, { selector = WIREFRAME_ROOT } =
295
300
  //#endregion
296
301
  export { captureWireframes as a, wireframeSvg as c, WIREFRAME_WIDTH as i, WIREFRAME_ROOT as n, extractWireframe as o, WIREFRAME_VIEWPORT as r, svgDataUri as s, WIREFRAME_HEIGHT as t };
297
302
 
298
- //# sourceMappingURL=wireframe-BTocmmyY.mjs.map
303
+ //# sourceMappingURL=wireframe-ApjwNWAN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe-BTocmmyY.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;AAWA,M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K,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
1
+ {"version":3,"file":"wireframe-ApjwNWAN.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * @deprecated since 4.16: the Add Block drawer shows screenshots now\n * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).\n * Kept working for this release so a site that calls it does not break;\n * it goes in the next major.\n *\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB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QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { a as captureWireframes, s as svgDataUri } from "./wireframe-BTocmmyY.mjs";
2
+ import { a as captureWireframes, s as svgDataUri } from "./wireframe-ApjwNWAN.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { mkdirSync, writeFileSync } from "node:fs";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { parseArgs } from "node:util";
7
7
  //#region src/wireframe-cli.ts
8
8
  /**
9
+ * @deprecated since 4.16: use `bison-block-thumbnails`, which takes real
10
+ * screenshots. Still works for this release; it prints a pointer first.
11
+ *
9
12
  * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one
10
13
  * black-and-white wireframe per block, from a running site's Block library
11
14
  * preview route. Run it from the site, which supplies Playwright and its
@@ -46,6 +49,7 @@ const { values } = parseArgs({ options: {
46
49
  default: false
47
50
  }
48
51
  } });
52
+ console.warn("bison-wireframes is deprecated: use bison-block-thumbnails (real screenshots) instead. It goes in the next major.");
49
53
  function fail(message) {
50
54
  console.error(`bison-wireframes: ${message}`);
51
55
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe-cli.mjs","names":[],"sources":["../src/wireframe-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one\n * black-and-white wireframe per block, from a running site's Block library\n * preview route. Run it from the site, which supplies Playwright and its\n * browser; this package does not depend on either.\n *\n * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \\\n * --base http://localhost:3039 \\\n * --slugs ctaBand,productMap \\\n * --out src/blocks/wireframes.generated.ts\n *\n * `--preview /block-library/{slug}` is the route (the default), `--selector`\n * the element that holds the sample (default: `BlockLibraryIsland`'s), and\n * `--users users` the auth collection to sign in to. The login is read from the\n * environment, never from arguments, so it stays out of shell history, and\n * is required unless `--no-login` names a public route. A preview that\n * answers an error or renders no sample fails the run; nothing is written.\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { captureWireframes, svgDataUri, type WireframePage } from \"./wireframe\";\n\ntype Browser = {\n newContext(): Promise<{\n newPage(): Promise<WireframePage>;\n request: { post(url: string, options: { data: unknown }): Promise<{ ok(): boolean; status(): number }> };\n }>;\n close(): Promise<void>;\n};\n\nconst { values } = parseArgs({\n options: {\n base: { type: \"string\" },\n preview: { type: \"string\", default: \"/block-library/{slug}\" },\n selector: { type: \"string\" },\n slugs: { type: \"string\" },\n out: { type: \"string\" },\n \"svg-dir\": { type: \"string\" },\n users: { type: \"string\", default: \"users\" },\n export: { type: \"string\", default: \"BLOCK_WIREFRAMES\" },\n \"no-login\": { type: \"boolean\", default: false },\n },\n});\n\nfunction fail(message: string): never {\n console.error(`bison-wireframes: ${message}`);\n process.exit(1);\n}\n\nconst base = values.base?.replace(/\\/$/, \"\") ?? fail(\"--base is required\");\nconst slugs = (values.slugs ?? fail(\"--slugs is required\")).split(\",\").map((slug) => slug.trim()).filter(Boolean);\nconst out = values.out ?? fail(\"--out is required\");\nconst email = process.env.WIREFRAME_EMAIL;\nconst password = process.env.WIREFRAME_PASSWORD;\n// The Block library preview refuses a logged-out request, so a missing\n// login is an error unless the route is public (`--no-login`).\nif (!values[\"no-login\"] && !(email && password)) {\n fail(\"set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route\");\n}\n\n// Playwright from the site running this, not from this package.\nconst require = createRequire(join(process.cwd(), \"package.json\"));\nlet chromium: { launch(): Promise<Browser> };\ntry {\n ({ chromium } = require(\"playwright\") as { chromium: typeof chromium });\n} catch {\n try {\n ({ chromium } = require(\"@playwright/test\") as { chromium: typeof chromium });\n } catch {\n fail(\"needs playwright (or @playwright/test) installed in the project it runs from\");\n }\n}\n\nconst browser = await chromium.launch();\ntry {\n const context = await browser.newContext();\n if (!values[\"no-login\"]) {\n const login = await context.request.post(`${base}/api/${values.users}/login`, { data: { email, password } });\n if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);\n }\n const page = await context.newPage();\n const previews = slugs.map((slug) => ({ slug, url: `${base}${values.preview!.replace(\"{slug}\", slug)}` }));\n const svgs = await captureWireframes(page, previews, values.selector ? { selector: values.selector } : {});\n\n if (values[\"svg-dir\"]) {\n mkdirSync(values[\"svg-dir\"], { recursive: true });\n for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values[\"svg-dir\"], `${slug}.svg`), svg);\n }\n\n const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);\n const module = [\n \"// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's\",\n \"// Block library preview. Do not edit by hand: rerun it when a layout changes.\",\n `export const ${values.export}: Record<string, string> = {`,\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n const target = resolve(out);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, module);\n console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);\n} catch (error) {\n await browser.close();\n fail(error instanceof Error ? error.message : String(error));\n} finally {\n await browser.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,EAAE,WAAW,UAAU,EAC3B,SAAS;CACP,MAAM,EAAE,MAAM,UAAU;CACxB,SAAS;EAAE,MAAM;EAAU,SAAS;EAAyB;CAC7D,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,KAAK,EAAE,MAAM,UAAU;CACvB,WAAW,EAAE,MAAM,UAAU;CAC7B,OAAO;EAAE,MAAM;EAAU,SAAS;EAAS;CAC3C,QAAQ;EAAE,MAAM;EAAU,SAAS;EAAoB;CACvD,YAAY;EAAE,MAAM;EAAW,SAAS;EAAO;CAChD,EACF,CAAC;AAEF,SAAS,KAAK,SAAwB;AACpC,SAA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;AACjD,OAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAE,eAAc,KAAK,OAAO,YAAY,GAAG,KAAK,MAAM,EAAE,IAAI;;CAG5G,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC,GAAG;CACzH,MAAM,SAAS;EACb;EACA;EACA,gBAAgB,OAAO,OAAO;EAC9B,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK;CACZ,MAAM,SAAS,QAAQ,IAAI;AAC3B,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,eAAc,QAAQ,OAAO;AAC7B,SAAQ,IAAI,2BAA2B,MAAM,OAAO,iBAAiB,MAAM;SACpE,OAAO;AACd,OAAM,QAAQ,OAAO;AACrB,MAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;UACpD;AACR,OAAM,QAAQ,OAAO"}
1
+ {"version":3,"file":"wireframe-cli.mjs","names":[],"sources":["../src/wireframe-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * @deprecated since 4.16: use `bison-block-thumbnails`, which takes real\n * screenshots. Still works for this release; it prints a pointer first.\n *\n * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one\n * black-and-white wireframe per block, from a running site's Block library\n * preview route. Run it from the site, which supplies Playwright and its\n * browser; this package does not depend on either.\n *\n * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \\\n * --base http://localhost:3039 \\\n * --slugs ctaBand,productMap \\\n * --out src/blocks/wireframes.generated.ts\n *\n * `--preview /block-library/{slug}` is the route (the default), `--selector`\n * the element that holds the sample (default: `BlockLibraryIsland`'s), and\n * `--users users` the auth collection to sign in to. The login is read from the\n * environment, never from arguments, so it stays out of shell history, and\n * is required unless `--no-login` names a public route. A preview that\n * answers an error or renders no sample fails the run; nothing is written.\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { captureWireframes, svgDataUri, type WireframePage } from \"./wireframe\";\n\ntype Browser = {\n newContext(): Promise<{\n newPage(): Promise<WireframePage>;\n request: { post(url: string, options: { data: unknown }): Promise<{ ok(): boolean; status(): number }> };\n }>;\n close(): Promise<void>;\n};\n\nconst { values } = parseArgs({\n options: {\n base: { type: \"string\" },\n preview: { type: \"string\", default: \"/block-library/{slug}\" },\n selector: { type: \"string\" },\n slugs: { type: \"string\" },\n out: { type: \"string\" },\n \"svg-dir\": { type: \"string\" },\n users: { type: \"string\", default: \"users\" },\n export: { type: \"string\", default: \"BLOCK_WIREFRAMES\" },\n \"no-login\": { type: \"boolean\", default: false },\n },\n});\n\nconsole.warn(\"bison-wireframes is deprecated: use bison-block-thumbnails (real screenshots) instead. It goes in the next major.\");\n\nfunction fail(message: string): never {\n console.error(`bison-wireframes: ${message}`);\n process.exit(1);\n}\n\nconst base = values.base?.replace(/\\/$/, \"\") ?? fail(\"--base is required\");\nconst slugs = (values.slugs ?? fail(\"--slugs is required\")).split(\",\").map((slug) => slug.trim()).filter(Boolean);\nconst out = values.out ?? fail(\"--out is required\");\nconst email = process.env.WIREFRAME_EMAIL;\nconst password = process.env.WIREFRAME_PASSWORD;\n// The Block library preview refuses a logged-out request, so a missing\n// login is an error unless the route is public (`--no-login`).\nif (!values[\"no-login\"] && !(email && password)) {\n fail(\"set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route\");\n}\n\n// Playwright from the site running this, not from this package.\nconst require = createRequire(join(process.cwd(), \"package.json\"));\nlet chromium: { launch(): Promise<Browser> };\ntry {\n ({ chromium } = require(\"playwright\") as { chromium: typeof chromium });\n} catch {\n try {\n ({ chromium } = require(\"@playwright/test\") as { chromium: typeof chromium });\n } catch {\n fail(\"needs playwright (or @playwright/test) installed in the project it runs from\");\n }\n}\n\nconst browser = await chromium.launch();\ntry {\n const context = await browser.newContext();\n if (!values[\"no-login\"]) {\n const login = await context.request.post(`${base}/api/${values.users}/login`, { data: { email, password } });\n if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);\n }\n const page = await context.newPage();\n const previews = slugs.map((slug) => ({ slug, url: `${base}${values.preview!.replace(\"{slug}\", slug)}` }));\n const svgs = await captureWireframes(page, previews, values.selector ? { selector: values.selector } : {});\n\n if (values[\"svg-dir\"]) {\n mkdirSync(values[\"svg-dir\"], { recursive: true });\n for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values[\"svg-dir\"], `${slug}.svg`), svg);\n }\n\n const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);\n const module = [\n \"// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's\",\n \"// Block library preview. Do not edit by hand: rerun it when a layout changes.\",\n `export const ${values.export}: Record<string, string> = {`,\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n const target = resolve(out);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, module);\n console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);\n} catch (error) {\n await browser.close();\n fail(error instanceof Error ? error.message : String(error));\n} finally {\n await browser.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,EAAE,WAAW,UAAU,EAC3B,SAAS;CACP,MAAM,EAAE,MAAM,UAAU;CACxB,SAAS;EAAE,MAAM;EAAU,SAAS;EAAyB;CAC7D,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,KAAK,EAAE,MAAM,UAAU;CACvB,WAAW,EAAE,MAAM,UAAU;CAC7B,OAAO;EAAE,MAAM;EAAU,SAAS;EAAS;CAC3C,QAAQ;EAAE,MAAM;EAAU,SAAS;EAAoB;CACvD,YAAY;EAAE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AU,OAAO,UAAU,GAAG,EAAE,CAAC;AAE1G,KAAI,OAAO,YAAY;AACrB,YAAU,OAAO,YAAY,EAAE,WAAW,MAAM,CAAC;AACjD,OAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAE,eAAc,KAAK,OAAO,YAAY,GAAG,KAAK,MAAM,EAAE,IAAI;;CAG5G,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC,GAAG;CACzH,MAAM,SAAS;EACb;EACA;EACA,gBAAgB,OAAO,OAAO;EAC9B,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK;CACZ,MAAM,SAAS,QAAQ,IAAI;AAC3B,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,eAAc,QAAQ,OAAO;AAC7B,SAAQ,IAAI,2BAA2B,MAAM,OAAO,iBAAiB,MAAM;SACpE,OAAO;AACd,OAAM,QAAQ,OAAO;AACrB,MAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;UACpD;AACR,OAAM,QAAQ,OAAO"}
@@ -1,5 +1,10 @@
1
1
  //#region src/wireframe.d.ts
2
2
  /**
3
+ * @deprecated since 4.16: the Add Block drawer shows screenshots now
4
+ * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).
5
+ * Kept working for this release so a site that calls it does not break;
6
+ * it goes in the next major.
7
+ *
3
8
  * Black-and-white wireframes of Block library samples, for Payload's Add
4
9
  * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a
5
10
  * script drives a browser to each block's preview (`previewPath(slug)`),
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe.d.mts","names":[],"sources":["../src/wireframe.ts"],"mappings":";;AAWA;;;;;AACA;;;;cADa,eAAA;AAAA,cACA,gBAAA;;cAGA,kBAAA;EAAA,SAA0D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CAAQ,CAAA,GAAI,GAAA,EAAK,CAAA,GAAI,OAAA,CAAQ,CAAA;AAAA;;;;;;;;iBAU5C,iBAAA,CACpB,IAAA,EAAM,aAAA,EACN,QAAA;EAAqB,IAAA;EAAc,GAAA;AAAA;EACjC;AAAA;EAA+B,QAAA;AAAA,IAChC,OAAA,CAAQ,MAAA"}
@@ -1,2 +1,2 @@
1
- import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-BTocmmyY.mjs";
1
+ import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-ApjwNWAN.mjs";
2
2
  export { WIREFRAME_HEIGHT, WIREFRAME_ROOT, WIREFRAME_VIEWPORT, WIREFRAME_WIDTH, captureWireframes, extractWireframe, svgDataUri, wireframeSvg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-core",
3
- "version": "4.15.2",
3
+ "version": "4.16.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",
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "type": "module",
26
26
  "bin": {
27
+ "bison-block-thumbnails": "./dist/block-thumbnails-cli.mjs",
27
28
  "bison-wireframes": "./dist/wireframe-cli.mjs"
28
29
  },
29
30
  "main": "./dist/index.mjs",
@@ -53,6 +54,10 @@
53
54
  "import": "./dist/taxonomy.mjs",
54
55
  "types": "./dist/taxonomy.d.mts"
55
56
  },
57
+ "./block-thumbnails": {
58
+ "import": "./dist/block-thumbnails.mjs",
59
+ "types": "./dist/block-thumbnails.d.mts"
60
+ },
56
61
  "./wireframe": {
57
62
  "import": "./dist/wireframe.mjs",
58
63
  "types": "./dist/wireframe.d.mts"
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalogue-CFXM1yAZ.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,QAAA;;EAEA,IAAA,GAAO,gBAAA;EACP,YAAA;EACA,MAAA;EAT0B;;;;AAE5B;;EAcE,eAAA,GAAkB,OAAA,CAAQ,eAAA;EATnB;;;;;;EAgBP,SAAA;AAAA;AAAA,UAGe,eAAA;EACf,EAAA;EACA,IAAA;EACA,KAAA;EACA,QAAA;EACA,OAAA;EACA,IAAA,EAAM,gBAAA;EATN;EAWA,eAAA,EAAiB,eAAA;AAAA;AARnB;AAAA,UAYiB,eAAA;EACf,MAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,IAAA;AAAA;;UAIe,uBAAA,SAAgC,kBAAA;EAC/C,UAAA;EACA,EAAA;EACA,MAAA;AAAA;;UAIe,iBAAA;EACf,SAAA,EAAW,kBAAA;EACX,MAAA,EAAQ,uBAAA;AAAA;;;;;AA/FV;;;;;AAEA;cCMa,oBAAA;AAAA,KAED,iBAAA,WAA4B,oBAAA;AAAA,KAE5B,eAAA,GAAkB,MAAA,CAAO,iBAAA;;cAGxB,sBAAA,EAAwB,MAAA,CAAO,iBAAA;;cAQ/B,wBAAA,EAA0B,eAAA;;;;;;cAY1B,qBAAA,EAAuB,eAAA;;cAQvB,mBAAA,EAAqB,eAAA;AAAA,iBAOlB,sBAAA,CAA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