@bison-lab/payload-core 4.12.4 → 4.14.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.
@@ -1,2 +1,30 @@
1
1
  import { A as PACKAGE_BLOCK_SLUGS, C as BlockLibraryDoc, D as BlockLibraryKind, O as BlockLibraryRow, T as BlockLibraryEntry, _ as SectionControls, a as sectionControlsFromLibrary, c as BlockLibraryReader, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as SectionControlKey, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, j as PackageBlockSlug, l as blockLibraryEntriesFromConfig, m as SECTION_CONTROL_KEYS, n as BlockLibraryOptions, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as BlockLibraryCheck, u as getSectionControls, v as defaultSectionControls, x as BLOCK_LIBRARY_SLUG, y as sectionControlsOf } from "./catalogue-9MO2jy69.mjs";
2
- export { BLOCK_LIBRARY_SLUG, type BlockLibraryCheck, type BlockLibraryDoc, type BlockLibraryEntry, type BlockLibraryKind, type BlockLibraryOptions, type BlockLibraryReader, type BlockLibraryRow, DEFAULT_SECTION_CONTROLS, HERO_SECTION_CONTROLS, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, type PackageBlockSlug, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, type SectionControlKey, type SectionControls, blockLibraryCatalogue, blockLibraryEntriesFromConfig, defaultBlockLibraryValue, defaultSectionControls, getSectionControls, sectionControlsFromLibrary, sectionControlsOf, stampBlockLibrary, validateBlockLibrary };
2
+
3
+ //#region src/block-library/island.d.ts
4
+ /**
5
+ * How a Block library island tells its card how tall it is (BIS-147).
6
+ * The island (`BlockLibraryIsland`, on `./react`) posts its height to the
7
+ * admin window; the card sizes its iframe from it. No React, no plugin:
8
+ * both halves import this.
9
+ */
10
+ declare const ISLAND_HEIGHT_MESSAGE: "bison-lab:block-library-island-height";
11
+ /** The card's height until its island reports, and for a site whose island never does. */
12
+ declare const ISLAND_FALLBACK_HEIGHT = 720;
13
+ /** An empty sample, or a `position: fixed` one (the navbar), still shows as a card. */
14
+ declare const ISLAND_MIN_HEIGHT = 120;
15
+ /**
16
+ * The iframe's height is the island's viewport, so a sample sized in `vh`
17
+ * grows when the card does. The ceiling stops that loop.
18
+ */
19
+ declare const ISLAND_MAX_HEIGHT = 960;
20
+ type IslandHeightMessage = {
21
+ type: typeof ISLAND_HEIGHT_MESSAGE;
22
+ height: number;
23
+ };
24
+ /** The height a message carries, or `null` when it is not an island's height message. */
25
+ declare function islandHeightOf(data: unknown): number | null;
26
+ /** A reported height, held between the floor and the ceiling and rounded up to a whole pixel. */
27
+ declare function clampIslandHeight(height: number): number;
28
+ //#endregion
29
+ export { BLOCK_LIBRARY_SLUG, type BlockLibraryCheck, type BlockLibraryDoc, type BlockLibraryEntry, type BlockLibraryKind, type BlockLibraryOptions, type BlockLibraryReader, type BlockLibraryRow, DEFAULT_SECTION_CONTROLS, HERO_SECTION_CONTROLS, ISLAND_FALLBACK_HEIGHT, ISLAND_HEIGHT_MESSAGE, ISLAND_MAX_HEIGHT, ISLAND_MIN_HEIGHT, type IslandHeightMessage, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, type PackageBlockSlug, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, type SectionControlKey, type SectionControls, blockLibraryCatalogue, blockLibraryEntriesFromConfig, clampIslandHeight, defaultBlockLibraryValue, defaultSectionControls, getSectionControls, islandHeightOf, sectionControlsFromLibrary, sectionControlsOf, stampBlockLibrary, validateBlockLibrary };
30
+ //# sourceMappingURL=block-library.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-library.d.mts","names":[],"sources":["../src/block-library/island.ts"],"mappings":";;;;;;AAOA;;;cAAa,qBAAA;;cAGA,sBAAA;;cAGA,iBAAA;;;AAAb;;cAMa,iBAAA;AAAA,KAED,mBAAA;EAAwB,IAAA,SAAa,qBAAA;EAAuB,MAAA;AAAA;;iBAGxD,cAAA,CAAe,IAAA;;iBASf,iBAAA,CAAkB,MAAA"}
@@ -1,2 +1,34 @@
1
1
  import { _ as sectionControlsOf, a as sectionControlsFromLibrary, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as defaultSectionControls, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, l as BLOCK_LIBRARY_SLUG, m as SECTION_CONTROL_KEYS, n as getSectionControls, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as blockLibraryEntriesFromConfig, u as PACKAGE_BLOCK_SLUGS } from "./published-BjmUCpdY.mjs";
2
- export { BLOCK_LIBRARY_SLUG, DEFAULT_SECTION_CONTROLS, HERO_SECTION_CONTROLS, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, blockLibraryCatalogue, blockLibraryEntriesFromConfig, defaultBlockLibraryValue, defaultSectionControls, getSectionControls, sectionControlsFromLibrary, sectionControlsOf, stampBlockLibrary, validateBlockLibrary };
2
+ //#region src/block-library/island.ts
3
+ /**
4
+ * How a Block library island tells its card how tall it is (BIS-147).
5
+ * The island (`BlockLibraryIsland`, on `./react`) posts its height to the
6
+ * admin window; the card sizes its iframe from it. No React, no plugin:
7
+ * both halves import this.
8
+ */
9
+ const ISLAND_HEIGHT_MESSAGE = "bison-lab:block-library-island-height";
10
+ /** The card's height until its island reports, and for a site whose island never does. */
11
+ const ISLAND_FALLBACK_HEIGHT = 720;
12
+ /** An empty sample, or a `position: fixed` one (the navbar), still shows as a card. */
13
+ const ISLAND_MIN_HEIGHT = 120;
14
+ /**
15
+ * The iframe's height is the island's viewport, so a sample sized in `vh`
16
+ * grows when the card does. The ceiling stops that loop.
17
+ */
18
+ const ISLAND_MAX_HEIGHT = 960;
19
+ /** The height a message carries, or `null` when it is not an island's height message. */
20
+ function islandHeightOf(data) {
21
+ if (!data || typeof data !== "object") return null;
22
+ const message = data;
23
+ if (message.type !== "bison-lab:block-library-island-height") return null;
24
+ const height = message.height;
25
+ return typeof height === "number" && Number.isFinite(height) && height >= 0 ? height : null;
26
+ }
27
+ /** A reported height, held between the floor and the ceiling and rounded up to a whole pixel. */
28
+ function clampIslandHeight(height) {
29
+ return Math.min(960, Math.max(120, Math.ceil(height)));
30
+ }
31
+ //#endregion
32
+ export { BLOCK_LIBRARY_SLUG, DEFAULT_SECTION_CONTROLS, HERO_SECTION_CONTROLS, ISLAND_FALLBACK_HEIGHT, ISLAND_HEIGHT_MESSAGE, ISLAND_MAX_HEIGHT, ISLAND_MIN_HEIGHT, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, blockLibraryCatalogue, blockLibraryEntriesFromConfig, clampIslandHeight, defaultBlockLibraryValue, defaultSectionControls, getSectionControls, islandHeightOf, sectionControlsFromLibrary, sectionControlsOf, stampBlockLibrary, validateBlockLibrary };
33
+
34
+ //# sourceMappingURL=block-library.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-library.mjs","names":[],"sources":["../src/block-library/island.ts"],"sourcesContent":["/**\n * How a Block library island tells its card how tall it is (BIS-147).\n * The island (`BlockLibraryIsland`, on `./react`) posts its height to the\n * admin window; the card sizes its iframe from it. No React, no plugin:\n * both halves import this.\n */\n\nexport const ISLAND_HEIGHT_MESSAGE = \"bison-lab:block-library-island-height\" as const;\n\n/** The card's height until its island reports, and for a site whose island never does. */\nexport const ISLAND_FALLBACK_HEIGHT = 720;\n\n/** An empty sample, or a `position: fixed` one (the navbar), still shows as a card. */\nexport const ISLAND_MIN_HEIGHT = 120;\n\n/**\n * The iframe's height is the island's viewport, so a sample sized in `vh`\n * grows when the card does. The ceiling stops that loop.\n */\nexport const ISLAND_MAX_HEIGHT = 960;\n\nexport type IslandHeightMessage = { type: typeof ISLAND_HEIGHT_MESSAGE; height: number };\n\n/** The height a message carries, or `null` when it is not an island's height message. */\nexport function islandHeightOf(data: unknown): number | null {\n if (!data || typeof data !== \"object\") return null;\n const message = data as Partial<IslandHeightMessage>;\n if (message.type !== ISLAND_HEIGHT_MESSAGE) return null;\n const height = message.height;\n return typeof height === \"number\" && Number.isFinite(height) && height >= 0 ? height : null;\n}\n\n/** A reported height, held between the floor and the ceiling and rounded up to a whole pixel. */\nexport function clampIslandHeight(height: number): number {\n return Math.min(ISLAND_MAX_HEIGHT, Math.max(ISLAND_MIN_HEIGHT, Math.ceil(height)));\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,wBAAwB;;AAGrC,MAAa,yBAAyB;;AAGtC,MAAa,oBAAoB;;;;;AAMjC,MAAa,oBAAoB;;AAKjC,SAAgB,eAAe,MAA8B;AAC3D,KAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;CAC9C,MAAM,UAAU;AAChB,KAAI,QAAQ,SAAA,wCAAgC,QAAO;CACnD,MAAM,SAAS,QAAQ;AACvB,QAAO,OAAO,WAAW,YAAY,OAAO,SAAS,OAAO,IAAI,UAAU,IAAI,SAAS;;;AAIzF,SAAgB,kBAAkB,QAAwB;AACxD,QAAO,KAAK,IAAA,KAAuB,KAAK,IAAA,KAAuB,KAAK,KAAK,OAAO,CAAC,CAAC"}
@@ -194,6 +194,27 @@ function pageEditorTokens(doc) {
194
194
  return tokens;
195
195
  }
196
196
  //#endregion
197
- export { colorDocFromState as a, themeConfigFromDoc as c, SYSTEM_COLOR_KEYS as i, pageEditorLooks as n, docFromConfig as o, pageEditorTokens as r, stateFromColorDoc as s, PAGE_EDITOR_SYSTEM_KEYS as t };
197
+ //#region src/block-library/island.ts
198
+ /**
199
+ * How a Block library island tells its card how tall it is (BIS-147).
200
+ * The island (`BlockLibraryIsland`, on `./react`) posts its height to the
201
+ * admin window; the card sizes its iframe from it. No React, no plugin:
202
+ * both halves import this.
203
+ */
204
+ const ISLAND_HEIGHT_MESSAGE = "bison-lab:block-library-island-height";
205
+ /** The height a message carries, or `null` when it is not an island's height message. */
206
+ function islandHeightOf(data) {
207
+ if (!data || typeof data !== "object") return null;
208
+ const message = data;
209
+ if (message.type !== "bison-lab:block-library-island-height") return null;
210
+ const height = message.height;
211
+ return typeof height === "number" && Number.isFinite(height) && height >= 0 ? height : null;
212
+ }
213
+ /** A reported height, held between the floor and the ceiling and rounded up to a whole pixel. */
214
+ function clampIslandHeight(height) {
215
+ return Math.min(960, Math.max(120, Math.ceil(height)));
216
+ }
217
+ //#endregion
218
+ export { pageEditorLooks as a, colorDocFromState as c, themeConfigFromDoc as d, PAGE_EDITOR_SYSTEM_KEYS as i, docFromConfig as l, clampIslandHeight as n, pageEditorTokens as o, islandHeightOf as r, SYSTEM_COLOR_KEYS as s, ISLAND_HEIGHT_MESSAGE as t, stateFromColorDoc as u };
198
219
 
199
- //# sourceMappingURL=looks-BbL309kO.mjs.map
220
+ //# sourceMappingURL=island-97l5VY8l.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"island-97l5VY8l.mjs","names":[],"sources":["../src/theme/map.ts","../src/theme/types.ts","../src/theme/looks.ts","../src/block-library/island.ts"],"sourcesContent":["import {\n createColorScale,\n DESTRUCTIVE_SCALE_HEX,\n generateColorScale,\n isThemeHex,\n SHADE_STEPS,\n type ColorScale,\n type ColorScaleInclude,\n type ColorScaleState,\n type ShadeStep,\n type ThemeConfig,\n} from \"@bison-lab/tokens\";\n\nimport { SAME_AS_BODY } from \"./fields\";\nimport type { ThemeColorDoc, ThemeDoc } from \"./types\";\n\nfunction pick<T>(value: T | null | undefined, fallback: T): T {\n return value == null ? fallback : value;\n}\n\nfunction headingFromDoc(\n heading: string | null | undefined,\n seed: ThemeConfig[\"fontHeading\"],\n): string | null {\n if (heading === undefined) return seed;\n if (heading === null || heading === SAME_AS_BODY) return null;\n return heading;\n}\n\nfunction hexFromColor(value: ThemeColorDoc | string | null | undefined, fallback: string): string {\n if (typeof value === \"string\") return value || fallback;\n return pick(value?.hex, fallback);\n}\n\nexport function colorDocFromHex(hex: string, sourceStep: ShadeStep = 500): ThemeColorDoc {\n return colorDocFromState(createColorScale(hex, sourceStep));\n}\n\nexport function colorDocFromState(state: ColorScaleState): ThemeColorDoc {\n return {\n hex: state.hex,\n sourceStep: state.sourceStep,\n scale: state.scale,\n stale: state.stale,\n include: Array.isArray(state.include) ? \"custom\" : state.include,\n includedSteps: Array.isArray(state.include) ? [...state.include] : undefined,\n };\n}\n\nexport function stateFromColorDoc(\n doc: ThemeColorDoc | null | undefined,\n fallbackHex = \"#000000\",\n): ColorScaleState {\n const hex = isThemeHex(doc?.hex) ? doc.hex : fallbackHex;\n const sourceStep = (Number(doc?.sourceStep) || 500) as ShadeStep;\n const include = includeFromDoc(doc, sourceStep);\n const scale =\n doc?.scale && typeof doc.scale === \"object\" ? (doc.scale as ColorScale) : generateColorScale(hex, sourceStep);\n return { hex, sourceStep, scale, stale: Boolean(doc?.stale), include };\n}\n\nfunction includeFromDoc(doc: ThemeColorDoc | null | undefined, sourceStep: ShadeStep): ColorScaleInclude {\n if (doc?.include === \"source\") return \"source\";\n if (doc?.include === \"custom\" && Array.isArray(doc.includedSteps)) {\n const steps = doc.includedSteps.map(Number).filter((step): step is ShadeStep => SHADE_STEPS.includes(step as ShadeStep));\n if (!steps.includes(sourceStep)) steps.push(sourceStep);\n return steps;\n }\n return \"all\";\n}\n\n/**\n * Nested Theme document → flat `ThemeConfig`. Null or missing editor\n * fields take the seed; `darkSelector` and `fontWeights` always come from\n * the seed. Reads the BIS-87 groups and the pre-BIS-87 flat fields.\n */\nexport function themeConfigFromDoc(doc: ThemeDoc | null | undefined, seed: ThemeConfig): ThemeConfig {\n const brand = doc?.colors?.brand ?? doc?.brand;\n const typography = doc?.typography ?? doc?.fonts;\n const appearance = doc?.appearance;\n return {\n brandPrimary: hexFromColor(brand?.primary, seed.brandPrimary),\n brandSecondary: hexFromColor(brand?.secondary, seed.brandSecondary),\n brandAccent: hexFromColor(brand?.accent, seed.brandAccent),\n brandHighlight: hexFromColor(brand?.highlight, seed.brandHighlight),\n brandSuccess: hexFromColor(brand?.success, seed.brandSuccess),\n brandDestructive:\n hexFromColor(brand?.destructive, seed.brandDestructive ?? DESTRUCTIVE_SCALE_HEX) ||\n seed.brandDestructive ||\n DESTRUCTIVE_SCALE_HEX,\n greyScale: pick(doc?.colors?.greyScale ?? doc?.greyScale, seed.greyScale),\n radius: pick(appearance?.radius ?? doc?.radius, seed.radius),\n shadow: pick(appearance?.shadow ?? doc?.shadow, seed.shadow),\n motion: pick(appearance?.motion ?? doc?.motion, seed.motion),\n density: pick(appearance?.density ?? doc?.density, seed.density),\n defaultTheme: pick(appearance?.defaultTheme ?? doc?.defaultTheme, seed.defaultTheme),\n fontBody: pick(typography?.body, seed.fontBody),\n fontHeading: headingFromDoc(typography?.heading, seed.fontHeading),\n darkSelector: seed.darkSelector,\n fontWeights: seed.fontWeights,\n };\n}\n\n/** The document `seedTheme` writes so a fresh Global matches the seed config. */\nexport function docFromConfig(config: ThemeConfig, destructive?: string): ThemeDoc {\n const destructiveHex = destructive ?? config.brandDestructive ?? DESTRUCTIVE_SCALE_HEX;\n return {\n colors: {\n brand: {\n primary: colorDocFromHex(config.brandPrimary),\n secondary: colorDocFromHex(config.brandSecondary),\n accent: colorDocFromHex(config.brandAccent),\n highlight: colorDocFromHex(config.brandHighlight),\n success: colorDocFromHex(config.brandSuccess),\n destructive: colorDocFromHex(destructiveHex),\n },\n library: [],\n greyScale: config.greyScale,\n },\n typography: {\n body: config.fontBody,\n heading: config.fontHeading,\n },\n appearance: {\n defaultTheme: config.defaultTheme,\n radius: config.radius,\n shadow: config.shadow,\n motion: config.motion,\n density: config.density,\n },\n };\n}\n\nexport function validateThemeHex(value: unknown): true | string {\n if (!isThemeHex(value)) return \"Enter a six-digit hex colour like #1e3a5f\";\n return true;\n}\n\nexport function validateSourceIncluded(\n value: unknown,\n { siblingData }: { siblingData?: { sourceStep?: unknown; include?: unknown } },\n): true | string {\n const include = siblingData?.include;\n if (include === \"all\" || include === \"source\") return true;\n const source = Number(siblingData?.sourceStep);\n const steps = Array.isArray(value) ? value.map(Number) : [];\n if (!SHADE_STEPS.includes(source as ShadeStep)) return true;\n if (!steps.includes(source)) return \"The source step cannot be excluded\";\n return true;\n}\n","import type { Access } from \"payload\";\nimport type { FontEntry } from \"@bison-lab/fonts\";\nimport type { ColorScale, ColorScaleInclude, ShadeStep, ThemeConfig } from \"@bison-lab/tokens\";\n\nimport type { ColorUsagesOption } from \"./color-usages\";\nimport type { ResolvedThemeIdentity, ThemeIdentityFallback } from \"./identity\";\n\n/**\n * The Theme document a site's generated types will describe. Optional and\n * nullable, no index signature: a generated Global is assignable to this,\n * never the reverse.\n *\n * Legacy flat `brand.*` hexes, `fonts`, and preset fields at the root stay\n * readable so `getPublishedTheme` still maps a pre-BIS-87 row.\n */\nexport interface ThemeColorDoc {\n hex?: string | null;\n sourceStep?: ShadeStep | string | null;\n scale?: ColorScale | null;\n stale?: boolean | null;\n include?: ColorScaleInclude | \"custom\" | null;\n includedSteps?: ShadeStep[] | string[] | null;\n}\n\nexport interface ThemeLibraryColorDoc extends ThemeColorDoc {\n key?: string | null;\n label?: string | null;\n}\n\nexport interface ThemeDoc {\n colors?: {\n brand?: {\n primary?: ThemeColorDoc | string | null;\n secondary?: ThemeColorDoc | string | null;\n accent?: ThemeColorDoc | string | null;\n highlight?: ThemeColorDoc | string | null;\n success?: ThemeColorDoc | string | null;\n destructive?: ThemeColorDoc | string | null;\n } | null;\n library?: ThemeLibraryColorDoc[] | null;\n greyScale?: ThemeConfig[\"greyScale\"] | null;\n } | null;\n typography?: {\n body?: string | null;\n heading?: string | null;\n } | null;\n appearance?: {\n defaultTheme?: ThemeConfig[\"defaultTheme\"] | null;\n radius?: ThemeConfig[\"radius\"] | null;\n shadow?: ThemeConfig[\"shadow\"] | null;\n motion?: ThemeConfig[\"motion\"] | null;\n density?: ThemeConfig[\"density\"] | null;\n } | null;\n /** @deprecated Pre-BIS-87 flat brand hexes. */\n brand?: {\n primary?: ThemeColorDoc | string | null;\n secondary?: ThemeColorDoc | string | null;\n accent?: ThemeColorDoc | string | null;\n highlight?: ThemeColorDoc | string | null;\n success?: ThemeColorDoc | string | null;\n destructive?: ThemeColorDoc | string | null;\n } | null;\n /** @deprecated Pre-BIS-87; now `colors.greyScale`. */\n greyScale?: ThemeConfig[\"greyScale\"] | null;\n /** @deprecated Pre-BIS-87; now `appearance.*`. */\n radius?: ThemeConfig[\"radius\"] | null;\n shadow?: ThemeConfig[\"shadow\"] | null;\n motion?: ThemeConfig[\"motion\"] | null;\n density?: ThemeConfig[\"density\"] | null;\n defaultTheme?: ThemeConfig[\"defaultTheme\"] | null;\n /** @deprecated Pre-BIS-87; now `typography`. */\n fonts?: {\n body?: string | null;\n heading?: string | null;\n } | null;\n logo?: number | string | ThemeUploadDoc | null;\n favicon?: number | string | ThemeUploadDoc | null;\n logoMark?: number | string | ThemeUploadDoc | null;\n}\n\nexport interface ThemeUploadDoc {\n id?: number | string | null;\n url?: string | null;\n alt?: string | null;\n}\n\n/**\n * What an editor can change. `darkSelector` and `fontWeights` stay on the\n * seed — they mean nothing in the admin — and `themeConfigFromDoc` puts\n * them back.\n */\nexport type EditableTheme = Omit<ThemeConfig, \"darkSelector\" | \"fontWeights\">;\n\nexport interface CreateThemeOptions {\n /**\n * `update` defaults to `canUseFeature(\"theme\")` (Designer in the seed).\n * `read` defaults to public; pass a stricter function to tighten it.\n * Omitting `access` still registers the Global.\n */\n access?: { read?: Access; update?: Access };\n /** The site's `bison.config.json`. Every field's `defaultValue`, and the fallback `getPublishedTheme` returns. */\n seed: ThemeConfig;\n /**\n * Destructive seed hex. Falls back to `seed.brandDestructive`, then\n * the library's `DESTRUCTIVE_SCALE_HEX` (`#FF7C6B`).\n */\n destructive?: string;\n /** Default: the whole catalogue. */\n fonts?: readonly FontEntry[];\n /** Where the site's `serveFont` route answers, for the picker's specimens. Default `\"/fonts\"`. */\n fontsBaseUrl?: string;\n /** Fill + automatic label target. Default `7`. Warnings never block save. */\n contrastTarget?: number;\n /**\n * @deprecated Theme has no preview pane (SPI-56 canceled). Kept so a\n * site that still passes it does not fail to boot.\n */\n previewPath?: string;\n /**\n * Adds the Identity page (logo, favicon, mobile-menu mark) when given.\n * Pass `BRAND_ASSETS_SLUG` (or the slug you gave `createBrandAssets`).\n * Save on that page writes only those uploads onto the stored Theme row.\n */\n logo?: { collection: string };\n /**\n * Fallback art when logo, favicon, or mobile-menu mark is empty. The\n * site passes today's files; `--color-primary-mark` is not a Theme field.\n */\n identity?: { fallback?: ThemeIdentityFallback };\n /** Fires from `afterChange` on every save — Theme has no draft mode. */\n onPublish?: (theme: ThemeConfig, doc: ThemeDoc) => void | Promise<void>;\n /**\n * Where Colors Delete looks for `lookField` / `colorTokenField` tokens\n * (drafts included). `true` scans every registered collection and\n * global at request time — Payload internals and Theme itself are\n * skipped, so a later Navigation or Territories global joins without\n * a site change. A list still names slugs. Omit or pass empty: every\n * additional color is unused and deletes immediately.\n */\n colorUsages?: ColorUsagesOption;\n}\n\nexport interface ThemeHeadOptions {\n fontsBaseUrl?: string;\n attribute?: \"class\" | \"data-theme\";\n identity?: ResolvedThemeIdentity;\n /**\n * Custom Colors rows. `themeHead` emits their 50–950 variables and\n * `[data-look]` bindings so a picker key paints without a package bump.\n */\n library?: ThemeLibraryColorDoc[] | null;\n}\n\nexport interface ThemeHead {\n css: string;\n preloads: { href: string; type: \"font/woff2\" }[];\n identity?: ResolvedThemeIdentity;\n}\n\nexport const THEME_SLUG = \"theme\";\nexport const THEME_COLORS_SLUG = \"theme-colors\";\nexport const THEME_TYPOGRAPHY_SLUG = \"theme-typography\";\nexport const THEME_APPEARANCE_SLUG = \"theme-appearance\";\nexport const THEME_IDENTITY_SLUG = \"theme-identity\";\n\nexport const SYSTEM_COLOR_KEYS = [\n \"primary\",\n \"secondary\",\n \"accent\",\n \"highlight\",\n \"success\",\n \"destructive\",\n] as const;\n\nexport type SystemColorKey = (typeof SYSTEM_COLOR_KEYS)[number];\n","import { includedShadeSteps, type ShadeStep } from \"@bison-lab/tokens\";\n\nimport { stateFromColorDoc } from \"./map\";\nimport { THEME_SLUG, type ThemeColorDoc, type ThemeDoc, type ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * System colors Color Settings offers as page-editor fills. Success and\n * Destructive stay off this list — they are theme chrome only.\n */\nexport const PAGE_EDITOR_SYSTEM_KEYS = [\"primary\", \"secondary\", \"accent\", \"highlight\"] as const;\n\nexport type PageEditorSystemKey = (typeof PAGE_EDITOR_SYSTEM_KEYS)[number];\n\nexport interface LookOption {\n label: string;\n value: string;\n}\n\nconst SYSTEM_LABELS: Record<PageEditorSystemKey, string> = {\n primary: \"Primary\",\n secondary: \"Secondary\",\n accent: \"Accent\",\n highlight: \"Highlight\",\n};\n\nfunction brandColor(doc: ThemeDoc | null | undefined, key: PageEditorSystemKey): ThemeColorDoc | null {\n const brand = doc?.colors?.brand ?? doc?.brand;\n const value = brand?.[key];\n if (typeof value === \"string\" || value == null) return value == null ? null : { hex: value };\n return value;\n}\n\nexport function themeLibraryFromDoc(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return Array.isArray(doc?.colors?.library) ? doc.colors.library : [];\n}\n\nfunction libraryRows(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return themeLibraryFromDoc(doc);\n}\n\nfunction titleCase(key: string): string {\n return key.charAt(0).toUpperCase() + key.slice(1);\n}\n\nfunction stepsFor(color: ThemeColorDoc | null | undefined, fallbackHex: string): ShadeStep[] {\n return includedShadeSteps(stateFromColorDoc(color, fallbackHex));\n}\n\n/**\n * Family keys a `lookField()` may offer: the page-editor system scales\n * plus every custom color on Colors. Adding Coral on Theme makes `coral`\n * appear here with no `@bison-lab/*` release.\n */\nexport function pageEditorLooks(doc: ThemeDoc | null | undefined): LookOption[] {\n const system = PAGE_EDITOR_SYSTEM_KEYS.map((value) => ({\n label: SYSTEM_LABELS[value],\n value,\n }));\n const custom = libraryRows(doc)\n .map((row) => {\n const value = row.key?.trim();\n if (!value) return null;\n return { label: row.label?.trim() || titleCase(value), value };\n })\n .filter((option): option is LookOption => option !== null);\n return [...system, ...custom];\n}\n\n/**\n * Included steps as `coral-400`. Excluded steps do not appear. System\n * scales with no stored include list offer the full 50–950 ramp.\n */\nexport function pageEditorTokens(doc: ThemeDoc | null | undefined): LookOption[] {\n const tokens: LookOption[] = [];\n for (const key of PAGE_EDITOR_SYSTEM_KEYS) {\n const label = SYSTEM_LABELS[key];\n for (const step of stepsFor(brandColor(doc, key), \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n for (const row of libraryRows(doc)) {\n const key = row.key?.trim();\n if (!key) continue;\n const label = row.label?.trim() || titleCase(key);\n for (const step of stepsFor(row, row.hex ?? \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n return tokens;\n}\n\nexport async function themeDocFromRequest(req: {\n payload?: {\n findGlobal?: (args: {\n slug: string;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n };\n}): Promise<ThemeDoc | null> {\n try {\n const doc = await req.payload?.findGlobal?.({\n slug: THEME_SLUG,\n depth: 0,\n overrideAccess: true,\n });\n return doc ?? null;\n } catch {\n return null;\n }\n}\n","/**\n * How a Block library island tells its card how tall it is (BIS-147).\n * The island (`BlockLibraryIsland`, on `./react`) posts its height to the\n * admin window; the card sizes its iframe from it. No React, no plugin:\n * both halves import this.\n */\n\nexport const ISLAND_HEIGHT_MESSAGE = \"bison-lab:block-library-island-height\" as const;\n\n/** The card's height until its island reports, and for a site whose island never does. */\nexport const ISLAND_FALLBACK_HEIGHT = 720;\n\n/** An empty sample, or a `position: fixed` one (the navbar), still shows as a card. */\nexport const ISLAND_MIN_HEIGHT = 120;\n\n/**\n * The iframe's height is the island's viewport, so a sample sized in `vh`\n * grows when the card does. The ceiling stops that loop.\n */\nexport const ISLAND_MAX_HEIGHT = 960;\n\nexport type IslandHeightMessage = { type: typeof ISLAND_HEIGHT_MESSAGE; height: number };\n\n/** The height a message carries, or `null` when it is not an island's height message. */\nexport function islandHeightOf(data: unknown): number | null {\n if (!data || typeof data !== \"object\") return null;\n const message = data as Partial<IslandHeightMessage>;\n if (message.type !== ISLAND_HEIGHT_MESSAGE) return null;\n const height = message.height;\n return typeof height === \"number\" && Number.isFinite(height) && height >= 0 ? height : null;\n}\n\n/** A reported height, held between the floor and the ceiling and rounded up to a whole pixel. */\nexport function clampIslandHeight(height: number): number {\n return Math.min(ISLAND_MAX_HEIGHT, Math.max(ISLAND_MIN_HEIGHT, Math.ceil(height)));\n}\n"],"mappings":";;;AAgBA,SAAS,KAAQ,OAA6B,UAAgB;AAC5D,QAAO,SAAS,OAAO,WAAW;;AAGpC,SAAS,eACP,SACA,MACe;AACf,KAAI,YAAY,KAAA,EAAW,QAAO;AAClC,KAAI,YAAY,QAAQ,YAAA,GAA0B,QAAO;AACzD,QAAO;;AAGT,SAAS,aAAa,OAAkD,UAA0B;AAChG,KAAI,OAAO,UAAU,SAAU,QAAO,SAAS;AAC/C,QAAO,KAAK,OAAO,KAAK,SAAS;;AAGnC,SAAgB,gBAAgB,KAAa,aAAwB,KAAoB;AACvF,QAAO,kBAAkB,iBAAiB,KAAK,WAAW,CAAC;;AAG7D,SAAgB,kBAAkB,OAAuC;AACvE,QAAO;EACL,KAAK,MAAM;EACX,YAAY,MAAM;EAClB,OAAO,MAAM;EACb,OAAO,MAAM;EACb,SAAS,MAAM,QAAQ,MAAM,QAAQ,GAAG,WAAW,MAAM;EACzD,eAAe,MAAM,QAAQ,MAAM,QAAQ,GAAG,CAAC,GAAG,MAAM,QAAQ,GAAG,KAAA;EACpE;;AAGH,SAAgB,kBACd,KACA,cAAc,WACG;CACjB,MAAM,MAAM,WAAW,KAAK,IAAI,GAAG,IAAI,MAAM;CAC7C,MAAM,aAAc,OAAO,KAAK,WAAW,IAAI;CAC/C,MAAM,UAAU,eAAe,KAA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AS,SAAU,QAAO;CAC9C,MAAM,UAAU;AAChB,KAAI,QAAQ,SAAA,wCAAgC,QAAO;CACnD,MAAM,SAAS,QAAQ;AACvB,QAAO,OAAO,WAAW,YAAY,OAAO,SAAS,OAAO,IAAI,UAAU,IAAI,SAAS;;;AAIzF,SAAgB,kBAAkB,QAAwB;AACxD,QAAO,KAAK,IAAA,KAAuB,KAAK,IAAA,KAAuB,KAAK,KAAK,OAAO,CAAC,CAAC"}
package/dist/react.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
2
  import { ThemeConfig } from "@bison-lab/tokens";
3
+ import { ReactNode } from "react";
3
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
5
 
5
6
  //#region src/react/theme-preview.d.ts
@@ -28,5 +29,24 @@ declare function ThemePreview({
28
29
  contrastTarget
29
30
  }: ThemePreviewProps): react_jsx_runtime0.JSX.Element;
30
31
  //#endregion
31
- export { ThemePreview, type ThemePreviewProps };
32
+ //#region src/react/block-library-island.d.ts
33
+ type BlockLibraryIslandProps = {
34
+ children: ReactNode; /** Air around the sample, in pixels, so its edges do not touch the card's border. */
35
+ padding?: number;
36
+ };
37
+ /**
38
+ * The wrapper a site's Block library preview route puts around one
39
+ * sample (BIS-147). It puts the same air on every side of the sample,
40
+ * so a block whose container is narrower than the card sits in the
41
+ * middle of it, then reports its own height to the admin window so the
42
+ * card is as tall as the block. It measures itself, not the document: the document is at
43
+ * least as tall as the iframe, so it could never shrink the card.
44
+ * Outside an iframe it reports nothing.
45
+ */
46
+ declare function BlockLibraryIsland({
47
+ children,
48
+ padding
49
+ }: BlockLibraryIslandProps): react_jsx_runtime0.JSX.Element;
50
+ //#endregion
51
+ export { BlockLibraryIsland, type BlockLibraryIslandProps, ThemePreview, type ThemePreviewProps };
32
52
  //# sourceMappingURL=react.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.mts","names":[],"sources":["../src/react/theme-preview.tsx"],"mappings":";;;;;UASiB,iBAAA;;EAEf,KAAA,EAAO,WAAA;EAFQ;EAIf,IAAA,EAAM,WAAA;;EAEN,YAAA;EAJA;EAMA,SAAA;EAJA;EAMA,cAAA;AAAA;;;;;AAkBF;iBAAgB,YAAA,CAAA;EACd,KAAA;EACA,IAAA;EACA,YAAA;EACA,SAAA;EACA;AAAA,GACC,iBAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"react.d.mts","names":[],"sources":["../src/react/theme-preview.tsx","../src/react/block-library-island.tsx"],"mappings":";;;;;;UASiB,iBAAA;;EAEf,KAAA,EAAO,WAAA;;EAEP,IAAA,EAAM,WAAA;EAJ0B;EAMhC,YAAA;EAFiB;EAIjB,SAAA;EANO;EAQP,cAAA;AAAA;;;;;;iBAkBc,YAAA,CAAA;EACd,KAAA;EACA,IAAA;EACA,YAAA;EACA,SAAA;EACA;AAAA,GACC,iBAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCvCR,uBAAA;EACV,QAAA,EAAU,SAAA;EAEV,OAAA;AAAA;;;;;;;;;;iBAYc,kBAAA,CAAA;EAAqB,QAAA;EAAU;AAAA,GAAgB,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/react.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { c as themeConfigFromDoc, o as docFromConfig, s as stateFromColorDoc, t as PAGE_EDITOR_SYSTEM_KEYS } from "./looks-BbL309kO.mjs";
2
+ import { d as themeConfigFromDoc, i as PAGE_EDITOR_SYSTEM_KEYS, l as docFromConfig, t as ISLAND_HEIGHT_MESSAGE, u as stateFromColorDoc } from "./island-97l5VY8l.mjs";
3
3
  import { auditTheme, buildThemeCss, generateNamedScaleCSS, isThemeHex, lookBindingCss, themeFontIds } from "@bison-lab/tokens";
4
- import { useRef, useState } from "react";
4
+ import { useEffect, useRef, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { fontFaceCss, fontPreloads } from "@bison-lab/fonts";
7
7
  import { useLivePreview } from "@payloadcms/live-preview-react";
@@ -97,6 +97,50 @@ function ThemePreview({ theme, seed, fontsBaseUrl, serverURL, contrastTarget = 4
97
97
  });
98
98
  }
99
99
  //#endregion
100
- export { ThemePreview };
100
+ //#region src/react/block-library-island.tsx
101
+ /**
102
+ * The wrapper a site's Block library preview route puts around one
103
+ * sample (BIS-147). It puts the same air on every side of the sample,
104
+ * so a block whose container is narrower than the card sits in the
105
+ * middle of it, then reports its own height to the admin window so the
106
+ * card is as tall as the block. It measures itself, not the document: the document is at
107
+ * least as tall as the iframe, so it could never shrink the card.
108
+ * Outside an iframe it reports nothing.
109
+ */
110
+ function BlockLibraryIsland({ children, padding = 24 }) {
111
+ const ref = useRef(null);
112
+ useEffect(() => {
113
+ const island = ref.current;
114
+ if (!island || window.parent === window) return;
115
+ let last = -1;
116
+ const report = () => {
117
+ const height = Math.ceil(island.getBoundingClientRect().height);
118
+ if (height === last) return;
119
+ last = height;
120
+ const message = {
121
+ type: ISLAND_HEIGHT_MESSAGE,
122
+ height
123
+ };
124
+ window.parent.postMessage(message, window.location.origin);
125
+ };
126
+ report();
127
+ if (typeof ResizeObserver === "undefined") return;
128
+ const observer = new ResizeObserver(report);
129
+ observer.observe(island);
130
+ return () => observer.disconnect();
131
+ }, []);
132
+ return /* @__PURE__ */ jsx("div", {
133
+ ref,
134
+ "data-block-library-island": "",
135
+ style: {
136
+ display: "flow-root",
137
+ boxSizing: "border-box",
138
+ padding
139
+ },
140
+ children
141
+ });
142
+ }
143
+ //#endregion
144
+ export { BlockLibraryIsland, ThemePreview };
101
145
 
102
146
  //# sourceMappingURL=react.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.mjs","names":[],"sources":["../src/theme/look-css.ts","../src/theme/head.ts","../src/react/theme-preview.tsx"],"sourcesContent":["import { generateNamedScaleCSS, lookBindingCss } from \"@bison-lab/tokens\";\n\nimport { PAGE_EDITOR_SYSTEM_KEYS } from \"./looks\";\nimport { stateFromColorDoc } from \"./map\";\nimport type { ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * Custom `--coral-*` variables plus `[data-look]` bindings for every\n * page-editor family. System bindings always ship so a look key paints\n * before anyone adds a custom scale.\n */\nexport function themeLookCss(library?: ThemeLibraryColorDoc[] | null): string {\n const rows = Array.isArray(library) ? library : [];\n const customKeys: string[] = [];\n const scaleLines: string[] = [];\n\n for (const row of rows) {\n const key = row.key?.trim();\n if (!key) continue;\n customKeys.push(key);\n const state = stateFromColorDoc(row, row.hex ?? \"#000000\");\n scaleLines.push(generateNamedScaleCSS(key, state.scale));\n }\n\n const scales = scaleLines.length ? `:root {\\n${scaleLines.join(\"\\n\")}\\n}` : \"\";\n const bindings = lookBindingCss([...PAGE_EDITOR_SYSTEM_KEYS, ...customKeys]);\n return [scales, bindings].filter(Boolean).join(\"\\n\\n\");\n}\n","import { fontFaceCss, fontPreloads } from \"@bison-lab/fonts\";\nimport { buildThemeCss, themeFontIds, type ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { themeLookCss } from \"./look-css\";\nimport { themeLibraryFromDoc } from \"./looks\";\nimport { themeConfigFromDoc } from \"./map\";\nimport type { ThemeDoc, ThemeHead, ThemeHeadOptions } from \"./types\";\n\n/**\n * `@font-face` plus `buildThemeCss` as one stylesheet, and the preload\n * list for the families the config names. A root layout (and the admin\n * layout, if it should restyle too) renders `css` in a `<style>` and\n * each preload as `<link rel=\"preload\" as=\"font\">`.\n *\n * `library` adds custom `--coral-*` variables and `[data-look]` bindings\n * so a Color Settings scale paints the moment it is published.\n */\nexport function themeHead(config: ThemeConfig, options: ThemeHeadOptions = {}): ThemeHead {\n const fontsBaseUrl = options.fontsBaseUrl ?? \"/fonts\";\n const ids = themeFontIds(config);\n const faces = fontFaceCss(ids, fontsBaseUrl);\n const theme = buildThemeCss(config, { attribute: options.attribute });\n const looks = themeLookCss(options.library);\n const body = looks ? `${theme}\\n\\n${looks}` : theme;\n return {\n css: faces ? `${faces}\\n\\n${body}` : body,\n preloads: fontPreloads(ids, fontsBaseUrl),\n identity: options.identity,\n };\n}\n\n/**\n * `themeHead` plus the custom scales on the Theme document. Sites that\n * still call `themeHead(getPublishedTheme())` keep working; they miss\n * `--coral-*` until they pass `library` or switch here.\n */\nexport function themeHeadFromDoc(\n doc: ThemeDoc | null | undefined,\n seed: ThemeConfig,\n options: Omit<ThemeHeadOptions, \"library\"> = {},\n): ThemeHead {\n return themeHead(themeConfigFromDoc(doc, seed), {\n ...options,\n library: themeLibraryFromDoc(doc),\n });\n}\n","import { useLivePreview } from \"@payloadcms/live-preview-react\";\nimport { ContrastStrip, ThemeShowcase } from \"@bison-lab/ui\";\nimport { auditTheme, isThemeHex, type ThemeConfig } from \"@bison-lab/tokens\";\nimport { useRef, useState } from \"react\";\n\nimport { themeHead } from \"../theme/head\";\nimport { docFromConfig, themeConfigFromDoc } from \"../theme/map\";\nimport type { ThemeDoc } from \"../theme/types\";\n\nexport interface ThemePreviewProps {\n /** Published theme from `getPublishedTheme`. Shown until a live-preview message arrives. */\n theme: ThemeConfig;\n /** The site's `bison.config.json`. Fills fields a live message leaves empty. */\n seed: ThemeConfig;\n /** Where the site's `serveFont` route answers. */\n fontsBaseUrl: string;\n /** Absolute origin of the Payload server. Required by `useLivePreview`. */\n serverURL: string;\n /** Body-text target `ContrastStrip` judges against. Default `4.5`. */\n contrastTarget?: number;\n}\n\nfunction isRenderableTheme(config: ThemeConfig): boolean {\n return (\n isThemeHex(config.brandPrimary) &&\n isThemeHex(config.brandSecondary) &&\n isThemeHex(config.brandAccent) &&\n isThemeHex(config.brandHighlight) &&\n isThemeHex(config.brandSuccess)\n );\n}\n\n/**\n * The Theme document's preview pane, and the site's design-system page.\n * Rebuilds `themeHead` in the browser from each live-preview message.\n * A half-typed hex keeps the last complete stylesheet.\n */\nexport function ThemePreview({\n theme,\n seed,\n fontsBaseUrl,\n serverURL,\n contrastTarget = 4.5,\n}: ThemePreviewProps) {\n const { data } = useLivePreview<ThemeDoc>({\n initialData: docFromConfig(theme),\n serverURL,\n });\n const mapped = themeConfigFromDoc(data, seed);\n const last = useRef(theme);\n if (isRenderableTheme(mapped)) last.current = mapped;\n const config = last.current;\n const css = themeHead(config, { fontsBaseUrl }).css;\n const [mode, setMode] = useState<\"light\" | \"dark\">(\"light\");\n\n return (\n <div role=\"region\" aria-label=\"Theme preview\" data-theme={mode} className=\"bl-theme-preview\">\n <style>{css}</style>\n <div className=\"bl-theme-preview__bar\">\n <button type=\"button\" aria-pressed={mode === \"light\"} onClick={() => setMode(\"light\")}>\n Light\n </button>\n <button type=\"button\" aria-pressed={mode === \"dark\"} onClick={() => setMode(\"dark\")}>\n Dark\n </button>\n </div>\n <ThemeShowcase />\n <ContrastStrip checks={auditTheme(config, { target: contrastTarget })} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAWA,SAAgB,aAAa,SAAiD;CAC5E,MAAM,OAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,EAAE;CAClD,MAAM,aAAuB,EAAE;CAC/B,MAAM,aAAuB,EAAE;AAE/B,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,MAAM,IAAI,KAAK,MAAM;AAC3B,MAAI,CAAC,IAAK;AACV,aAAW,KAAK,IAAI;EACpB,MAAM,QAAQ,kBAAkB,KAAK,IAAI,OAAO,UAAU;AAC1D,aAAW,KAAK,sBAAsB,KAAK,MAAM,MAAM,CAAC;;AAK1D,QAAO,CAFQ,WAAW,SAAS,YAAY,WAAW,KAAK,KAAK,CAAC,OAAO,IAC3D,eAAe,CAAC,GAAG,yBAAyB,GAAG,WAAW,CAAC,CACnD,CAAC,OAAO,QAAQ,CAAC,KAAK,OAAO;;;;;;;;;;;;;ACTxD,SAAgB,UAAU,QAAqB,UAA4B,EAAE,EAAa;CACxF,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,MAAM,aAAa,OAAO;CAChC,MAAM,QAAQ,YAAY,KAAK,aAAa;CAC5C,MAAM,QAAQ,cAAc,QAAQ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AAC,EAAI,CAAA;GACrE"}
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../src/theme/look-css.ts","../src/theme/head.ts","../src/react/theme-preview.tsx","../src/react/block-library-island.tsx"],"sourcesContent":["import { generateNamedScaleCSS, lookBindingCss } from \"@bison-lab/tokens\";\n\nimport { PAGE_EDITOR_SYSTEM_KEYS } from \"./looks\";\nimport { stateFromColorDoc } from \"./map\";\nimport type { ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * Custom `--coral-*` variables plus `[data-look]` bindings for every\n * page-editor family. System bindings always ship so a look key paints\n * before anyone adds a custom scale.\n */\nexport function themeLookCss(library?: ThemeLibraryColorDoc[] | null): string {\n const rows = Array.isArray(library) ? library : [];\n const customKeys: string[] = [];\n const scaleLines: string[] = [];\n\n for (const row of rows) {\n const key = row.key?.trim();\n if (!key) continue;\n customKeys.push(key);\n const state = stateFromColorDoc(row, row.hex ?? \"#000000\");\n scaleLines.push(generateNamedScaleCSS(key, state.scale));\n }\n\n const scales = scaleLines.length ? `:root {\\n${scaleLines.join(\"\\n\")}\\n}` : \"\";\n const bindings = lookBindingCss([...PAGE_EDITOR_SYSTEM_KEYS, ...customKeys]);\n return [scales, bindings].filter(Boolean).join(\"\\n\\n\");\n}\n","import { fontFaceCss, fontPreloads } from \"@bison-lab/fonts\";\nimport { buildThemeCss, themeFontIds, type ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { themeLookCss } from \"./look-css\";\nimport { themeLibraryFromDoc } from \"./looks\";\nimport { themeConfigFromDoc } from \"./map\";\nimport type { ThemeDoc, ThemeHead, ThemeHeadOptions } from \"./types\";\n\n/**\n * `@font-face` plus `buildThemeCss` as one stylesheet, and the preload\n * list for the families the config names. A root layout (and the admin\n * layout, if it should restyle too) renders `css` in a `<style>` and\n * each preload as `<link rel=\"preload\" as=\"font\">`.\n *\n * `library` adds custom `--coral-*` variables and `[data-look]` bindings\n * so a Color Settings scale paints the moment it is published.\n */\nexport function themeHead(config: ThemeConfig, options: ThemeHeadOptions = {}): ThemeHead {\n const fontsBaseUrl = options.fontsBaseUrl ?? \"/fonts\";\n const ids = themeFontIds(config);\n const faces = fontFaceCss(ids, fontsBaseUrl);\n const theme = buildThemeCss(config, { attribute: options.attribute });\n const looks = themeLookCss(options.library);\n const body = looks ? `${theme}\\n\\n${looks}` : theme;\n return {\n css: faces ? `${faces}\\n\\n${body}` : body,\n preloads: fontPreloads(ids, fontsBaseUrl),\n identity: options.identity,\n };\n}\n\n/**\n * `themeHead` plus the custom scales on the Theme document. Sites that\n * still call `themeHead(getPublishedTheme())` keep working; they miss\n * `--coral-*` until they pass `library` or switch here.\n */\nexport function themeHeadFromDoc(\n doc: ThemeDoc | null | undefined,\n seed: ThemeConfig,\n options: Omit<ThemeHeadOptions, \"library\"> = {},\n): ThemeHead {\n return themeHead(themeConfigFromDoc(doc, seed), {\n ...options,\n library: themeLibraryFromDoc(doc),\n });\n}\n","import { useLivePreview } from \"@payloadcms/live-preview-react\";\nimport { ContrastStrip, ThemeShowcase } from \"@bison-lab/ui\";\nimport { auditTheme, isThemeHex, type ThemeConfig } from \"@bison-lab/tokens\";\nimport { useRef, useState } from \"react\";\n\nimport { themeHead } from \"../theme/head\";\nimport { docFromConfig, themeConfigFromDoc } from \"../theme/map\";\nimport type { ThemeDoc } from \"../theme/types\";\n\nexport interface ThemePreviewProps {\n /** Published theme from `getPublishedTheme`. Shown until a live-preview message arrives. */\n theme: ThemeConfig;\n /** The site's `bison.config.json`. Fills fields a live message leaves empty. */\n seed: ThemeConfig;\n /** Where the site's `serveFont` route answers. */\n fontsBaseUrl: string;\n /** Absolute origin of the Payload server. Required by `useLivePreview`. */\n serverURL: string;\n /** Body-text target `ContrastStrip` judges against. Default `4.5`. */\n contrastTarget?: number;\n}\n\nfunction isRenderableTheme(config: ThemeConfig): boolean {\n return (\n isThemeHex(config.brandPrimary) &&\n isThemeHex(config.brandSecondary) &&\n isThemeHex(config.brandAccent) &&\n isThemeHex(config.brandHighlight) &&\n isThemeHex(config.brandSuccess)\n );\n}\n\n/**\n * The Theme document's preview pane, and the site's design-system page.\n * Rebuilds `themeHead` in the browser from each live-preview message.\n * A half-typed hex keeps the last complete stylesheet.\n */\nexport function ThemePreview({\n theme,\n seed,\n fontsBaseUrl,\n serverURL,\n contrastTarget = 4.5,\n}: ThemePreviewProps) {\n const { data } = useLivePreview<ThemeDoc>({\n initialData: docFromConfig(theme),\n serverURL,\n });\n const mapped = themeConfigFromDoc(data, seed);\n const last = useRef(theme);\n if (isRenderableTheme(mapped)) last.current = mapped;\n const config = last.current;\n const css = themeHead(config, { fontsBaseUrl }).css;\n const [mode, setMode] = useState<\"light\" | \"dark\">(\"light\");\n\n return (\n <div role=\"region\" aria-label=\"Theme preview\" data-theme={mode} className=\"bl-theme-preview\">\n <style>{css}</style>\n <div className=\"bl-theme-preview__bar\">\n <button type=\"button\" aria-pressed={mode === \"light\"} onClick={() => setMode(\"light\")}>\n Light\n </button>\n <button type=\"button\" aria-pressed={mode === \"dark\"} onClick={() => setMode(\"dark\")}>\n Dark\n </button>\n </div>\n <ThemeShowcase />\n <ContrastStrip checks={auditTheme(config, { target: contrastTarget })} />\n </div>\n );\n}\n","import { useEffect, useRef, type ReactNode } from \"react\";\n\nimport { ISLAND_HEIGHT_MESSAGE, type IslandHeightMessage } from \"../block-library/island\";\n\nexport type BlockLibraryIslandProps = {\n children: ReactNode;\n /** Air around the sample, in pixels, so its edges do not touch the card's border. */\n padding?: number;\n};\n\n/**\n * The wrapper a site's Block library preview route puts around one\n * sample (BIS-147). It puts the same air on every side of the sample,\n * so a block whose container is narrower than the card sits in the\n * middle of it, then reports its own height to the admin window so the\n * card is as tall as the block. It measures itself, not the document: the document is at\n * least as tall as the iframe, so it could never shrink the card.\n * Outside an iframe it reports nothing.\n */\nexport function BlockLibraryIsland({ children, padding = 24 }: BlockLibraryIslandProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const island = ref.current;\n if (!island || window.parent === window) return;\n let last = -1;\n const report = () => {\n const height = Math.ceil(island.getBoundingClientRect().height);\n if (height === last) return;\n last = height;\n const message: IslandHeightMessage = { type: ISLAND_HEIGHT_MESSAGE, height };\n window.parent.postMessage(message, window.location.origin);\n };\n report();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(report);\n observer.observe(island);\n return () => observer.disconnect();\n }, []);\n\n return (\n <div\n ref={ref}\n data-block-library-island=\"\"\n style={{ display: \"flow-root\", boxSizing: \"border-box\", padding }}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAWA,SAAgB,aAAa,SAAiD;CAC5E,MAAM,OAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,EAAE;CAClD,MAAM,aAAuB,EAAE;CAC/B,MAAM,aAAuB,EAAE;AAE/B,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,MAAM,IAAI,KAAK,MAAM;AAC3B,MAAI,CAAC,IAAK;AACV,aAAW,KAAK,IAAI;EACpB,MAAM,QAAQ,kBAAkB,KAAK,IAAI,OAAO,UAAU;AAC1D,aAAW,KAAK,sBAAsB,KAAK,MAAM,MAAM,CAAC;;AAK1D,QAAO,CAFQ,WAAW,SAAS,YAAY,WAAW,KAAK,KAAK,CAAC,OAAO,IAC3D,eAAe,CAAC,GAAG,yBAAyB,GAAG,WAAW,CAAC,CACnD,CAAC,OAAO,QAAQ,CAAC,KAAK,OAAO;;;;;;;;;;;;;ACTxD,SAAgB,UAAU,QAAqB,UAA4B,EAAE,EAAa;CACxF,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,MAAM,aAAa,OAAO;CAChC,MAAM,QAAQ,YAAY,KAAK,aAAa;CAC5C,MAAM,QAAQ,cAAc,QAAQ,EAAE,WAAW,QAAQ,WAAW,CAAC;CACrE,MAAM,QAAQ,aAAa,QAAQ,QAAQ;CAC3C,MAAM,OAAO,QAAQ,GAAG,MAAM,MAAM,UAAU;AAC9C,QAAO;EACL,KAAK,QAAQ,GAAG,MAAM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,CAAC,UAAU,OAAO,WAAW,OAAQ;EACzC,IAAI,OAAO;EACX,MAAM,eAAe;GACnB,MAAM,SAAS,KAAK,KAAK,OAAO,uBAAuB,CAAC,OAAO;AAC/D,OAAI,WAAW,KAAM;AACrB,UAAO;GACP,MAAM,UAA+B;IAAE,MAAM;IAAuB;IAAQ;AAC5E,UAAO,OAAO,YAAY,SAAS,OAAO,SAAS,OAAO;;AAE5D,UAAQ;AACR,MAAI,OAAO,mBAAmB,YAAa;EAC3C,MAAM,WAAW,IAAI,eAAe,OAAO;AAC3C,WAAS,QAAQ,OAAO;AACxB,eAAa,SAAS,YAAY;IACjC,EAAE,CAAC;AAEN,QACE,oBAAC,OAAD;EACO;EACL,6BAA0B;EAC1B,OAAO;GAAE,SAAS;GAAa,WAAW;GAAc;GAAS;EAEhE;EACG,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-core",
3
- "version": "4.12.4",
3
+ "version": "4.14.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",
@@ -125,7 +125,7 @@
125
125
  "vitest": "^4.1.2",
126
126
  "@bison-lab/fonts": "3.27.1",
127
127
  "@bison-lab/tokens": "4.5.0",
128
- "@bison-lab/ui": "4.10.2"
128
+ "@bison-lab/ui": "4.13.0"
129
129
  },
130
130
  "publishConfig": {
131
131
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"looks-BbL309kO.mjs","names":[],"sources":["../src/theme/map.ts","../src/theme/types.ts","../src/theme/looks.ts"],"sourcesContent":["import {\n createColorScale,\n DESTRUCTIVE_SCALE_HEX,\n generateColorScale,\n isThemeHex,\n SHADE_STEPS,\n type ColorScale,\n type ColorScaleInclude,\n type ColorScaleState,\n type ShadeStep,\n type ThemeConfig,\n} from \"@bison-lab/tokens\";\n\nimport { SAME_AS_BODY } from \"./fields\";\nimport type { ThemeColorDoc, ThemeDoc } from \"./types\";\n\nfunction pick<T>(value: T | null | undefined, fallback: T): T {\n return value == null ? fallback : value;\n}\n\nfunction headingFromDoc(\n heading: string | null | undefined,\n seed: ThemeConfig[\"fontHeading\"],\n): string | null {\n if (heading === undefined) return seed;\n if (heading === null || heading === SAME_AS_BODY) return null;\n return heading;\n}\n\nfunction hexFromColor(value: ThemeColorDoc | string | null | undefined, fallback: string): string {\n if (typeof value === \"string\") return value || fallback;\n return pick(value?.hex, fallback);\n}\n\nexport function colorDocFromHex(hex: string, sourceStep: ShadeStep = 500): ThemeColorDoc {\n return colorDocFromState(createColorScale(hex, sourceStep));\n}\n\nexport function colorDocFromState(state: ColorScaleState): ThemeColorDoc {\n return {\n hex: state.hex,\n sourceStep: state.sourceStep,\n scale: state.scale,\n stale: state.stale,\n include: Array.isArray(state.include) ? \"custom\" : state.include,\n includedSteps: Array.isArray(state.include) ? [...state.include] : undefined,\n };\n}\n\nexport function stateFromColorDoc(\n doc: ThemeColorDoc | null | undefined,\n fallbackHex = \"#000000\",\n): ColorScaleState {\n const hex = isThemeHex(doc?.hex) ? doc.hex : fallbackHex;\n const sourceStep = (Number(doc?.sourceStep) || 500) as ShadeStep;\n const include = includeFromDoc(doc, sourceStep);\n const scale =\n doc?.scale && typeof doc.scale === \"object\" ? (doc.scale as ColorScale) : generateColorScale(hex, sourceStep);\n return { hex, sourceStep, scale, stale: Boolean(doc?.stale), include };\n}\n\nfunction includeFromDoc(doc: ThemeColorDoc | null | undefined, sourceStep: ShadeStep): ColorScaleInclude {\n if (doc?.include === \"source\") return \"source\";\n if (doc?.include === \"custom\" && Array.isArray(doc.includedSteps)) {\n const steps = doc.includedSteps.map(Number).filter((step): step is ShadeStep => SHADE_STEPS.includes(step as ShadeStep));\n if (!steps.includes(sourceStep)) steps.push(sourceStep);\n return steps;\n }\n return \"all\";\n}\n\n/**\n * Nested Theme document → flat `ThemeConfig`. Null or missing editor\n * fields take the seed; `darkSelector` and `fontWeights` always come from\n * the seed. Reads the BIS-87 groups and the pre-BIS-87 flat fields.\n */\nexport function themeConfigFromDoc(doc: ThemeDoc | null | undefined, seed: ThemeConfig): ThemeConfig {\n const brand = doc?.colors?.brand ?? doc?.brand;\n const typography = doc?.typography ?? doc?.fonts;\n const appearance = doc?.appearance;\n return {\n brandPrimary: hexFromColor(brand?.primary, seed.brandPrimary),\n brandSecondary: hexFromColor(brand?.secondary, seed.brandSecondary),\n brandAccent: hexFromColor(brand?.accent, seed.brandAccent),\n brandHighlight: hexFromColor(brand?.highlight, seed.brandHighlight),\n brandSuccess: hexFromColor(brand?.success, seed.brandSuccess),\n brandDestructive:\n hexFromColor(brand?.destructive, seed.brandDestructive ?? DESTRUCTIVE_SCALE_HEX) ||\n seed.brandDestructive ||\n DESTRUCTIVE_SCALE_HEX,\n greyScale: pick(doc?.colors?.greyScale ?? doc?.greyScale, seed.greyScale),\n radius: pick(appearance?.radius ?? doc?.radius, seed.radius),\n shadow: pick(appearance?.shadow ?? doc?.shadow, seed.shadow),\n motion: pick(appearance?.motion ?? doc?.motion, seed.motion),\n density: pick(appearance?.density ?? doc?.density, seed.density),\n defaultTheme: pick(appearance?.defaultTheme ?? doc?.defaultTheme, seed.defaultTheme),\n fontBody: pick(typography?.body, seed.fontBody),\n fontHeading: headingFromDoc(typography?.heading, seed.fontHeading),\n darkSelector: seed.darkSelector,\n fontWeights: seed.fontWeights,\n };\n}\n\n/** The document `seedTheme` writes so a fresh Global matches the seed config. */\nexport function docFromConfig(config: ThemeConfig, destructive?: string): ThemeDoc {\n const destructiveHex = destructive ?? config.brandDestructive ?? DESTRUCTIVE_SCALE_HEX;\n return {\n colors: {\n brand: {\n primary: colorDocFromHex(config.brandPrimary),\n secondary: colorDocFromHex(config.brandSecondary),\n accent: colorDocFromHex(config.brandAccent),\n highlight: colorDocFromHex(config.brandHighlight),\n success: colorDocFromHex(config.brandSuccess),\n destructive: colorDocFromHex(destructiveHex),\n },\n library: [],\n greyScale: config.greyScale,\n },\n typography: {\n body: config.fontBody,\n heading: config.fontHeading,\n },\n appearance: {\n defaultTheme: config.defaultTheme,\n radius: config.radius,\n shadow: config.shadow,\n motion: config.motion,\n density: config.density,\n },\n };\n}\n\nexport function validateThemeHex(value: unknown): true | string {\n if (!isThemeHex(value)) return \"Enter a six-digit hex colour like #1e3a5f\";\n return true;\n}\n\nexport function validateSourceIncluded(\n value: unknown,\n { siblingData }: { siblingData?: { sourceStep?: unknown; include?: unknown } },\n): true | string {\n const include = siblingData?.include;\n if (include === \"all\" || include === \"source\") return true;\n const source = Number(siblingData?.sourceStep);\n const steps = Array.isArray(value) ? value.map(Number) : [];\n if (!SHADE_STEPS.includes(source as ShadeStep)) return true;\n if (!steps.includes(source)) return \"The source step cannot be excluded\";\n return true;\n}\n","import type { Access } from \"payload\";\nimport type { FontEntry } from \"@bison-lab/fonts\";\nimport type { ColorScale, ColorScaleInclude, ShadeStep, ThemeConfig } from \"@bison-lab/tokens\";\n\nimport type { ColorUsagesOption } from \"./color-usages\";\nimport type { ResolvedThemeIdentity, ThemeIdentityFallback } from \"./identity\";\n\n/**\n * The Theme document a site's generated types will describe. Optional and\n * nullable, no index signature: a generated Global is assignable to this,\n * never the reverse.\n *\n * Legacy flat `brand.*` hexes, `fonts`, and preset fields at the root stay\n * readable so `getPublishedTheme` still maps a pre-BIS-87 row.\n */\nexport interface ThemeColorDoc {\n hex?: string | null;\n sourceStep?: ShadeStep | string | null;\n scale?: ColorScale | null;\n stale?: boolean | null;\n include?: ColorScaleInclude | \"custom\" | null;\n includedSteps?: ShadeStep[] | string[] | null;\n}\n\nexport interface ThemeLibraryColorDoc extends ThemeColorDoc {\n key?: string | null;\n label?: string | null;\n}\n\nexport interface ThemeDoc {\n colors?: {\n brand?: {\n primary?: ThemeColorDoc | string | null;\n secondary?: ThemeColorDoc | string | null;\n accent?: ThemeColorDoc | string | null;\n highlight?: ThemeColorDoc | string | null;\n success?: ThemeColorDoc | string | null;\n destructive?: ThemeColorDoc | string | null;\n } | null;\n library?: ThemeLibraryColorDoc[] | null;\n greyScale?: ThemeConfig[\"greyScale\"] | null;\n } | null;\n typography?: {\n body?: string | null;\n heading?: string | null;\n } | null;\n appearance?: {\n defaultTheme?: ThemeConfig[\"defaultTheme\"] | null;\n radius?: ThemeConfig[\"radius\"] | null;\n shadow?: ThemeConfig[\"shadow\"] | null;\n motion?: ThemeConfig[\"motion\"] | null;\n density?: ThemeConfig[\"density\"] | null;\n } | null;\n /** @deprecated Pre-BIS-87 flat brand hexes. */\n brand?: {\n primary?: ThemeColorDoc | string | null;\n secondary?: ThemeColorDoc | string | null;\n accent?: ThemeColorDoc | string | null;\n highlight?: ThemeColorDoc | string | null;\n success?: ThemeColorDoc | string | null;\n destructive?: ThemeColorDoc | string | null;\n } | null;\n /** @deprecated Pre-BIS-87; now `colors.greyScale`. */\n greyScale?: ThemeConfig[\"greyScale\"] | null;\n /** @deprecated Pre-BIS-87; now `appearance.*`. */\n radius?: ThemeConfig[\"radius\"] | null;\n shadow?: ThemeConfig[\"shadow\"] | null;\n motion?: ThemeConfig[\"motion\"] | null;\n density?: ThemeConfig[\"density\"] | null;\n defaultTheme?: ThemeConfig[\"defaultTheme\"] | null;\n /** @deprecated Pre-BIS-87; now `typography`. */\n fonts?: {\n body?: string | null;\n heading?: string | null;\n } | null;\n logo?: number | string | ThemeUploadDoc | null;\n favicon?: number | string | ThemeUploadDoc | null;\n logoMark?: number | string | ThemeUploadDoc | null;\n}\n\nexport interface ThemeUploadDoc {\n id?: number | string | null;\n url?: string | null;\n alt?: string | null;\n}\n\n/**\n * What an editor can change. `darkSelector` and `fontWeights` stay on the\n * seed — they mean nothing in the admin — and `themeConfigFromDoc` puts\n * them back.\n */\nexport type EditableTheme = Omit<ThemeConfig, \"darkSelector\" | \"fontWeights\">;\n\nexport interface CreateThemeOptions {\n /**\n * `update` defaults to `canUseFeature(\"theme\")` (Designer in the seed).\n * `read` defaults to public; pass a stricter function to tighten it.\n * Omitting `access` still registers the Global.\n */\n access?: { read?: Access; update?: Access };\n /** The site's `bison.config.json`. Every field's `defaultValue`, and the fallback `getPublishedTheme` returns. */\n seed: ThemeConfig;\n /**\n * Destructive seed hex. Falls back to `seed.brandDestructive`, then\n * the library's `DESTRUCTIVE_SCALE_HEX` (`#FF7C6B`).\n */\n destructive?: string;\n /** Default: the whole catalogue. */\n fonts?: readonly FontEntry[];\n /** Where the site's `serveFont` route answers, for the picker's specimens. Default `\"/fonts\"`. */\n fontsBaseUrl?: string;\n /** Fill + automatic label target. Default `7`. Warnings never block save. */\n contrastTarget?: number;\n /**\n * @deprecated Theme has no preview pane (SPI-56 canceled). Kept so a\n * site that still passes it does not fail to boot.\n */\n previewPath?: string;\n /**\n * Adds the Identity page (logo, favicon, mobile-menu mark) when given.\n * Pass `BRAND_ASSETS_SLUG` (or the slug you gave `createBrandAssets`).\n * Save on that page writes only those uploads onto the stored Theme row.\n */\n logo?: { collection: string };\n /**\n * Fallback art when logo, favicon, or mobile-menu mark is empty. The\n * site passes today's files; `--color-primary-mark` is not a Theme field.\n */\n identity?: { fallback?: ThemeIdentityFallback };\n /** Fires from `afterChange` on every save — Theme has no draft mode. */\n onPublish?: (theme: ThemeConfig, doc: ThemeDoc) => void | Promise<void>;\n /**\n * Where Colors Delete looks for `lookField` / `colorTokenField` tokens\n * (drafts included). `true` scans every registered collection and\n * global at request time — Payload internals and Theme itself are\n * skipped, so a later Navigation or Territories global joins without\n * a site change. A list still names slugs. Omit or pass empty: every\n * additional color is unused and deletes immediately.\n */\n colorUsages?: ColorUsagesOption;\n}\n\nexport interface ThemeHeadOptions {\n fontsBaseUrl?: string;\n attribute?: \"class\" | \"data-theme\";\n identity?: ResolvedThemeIdentity;\n /**\n * Custom Colors rows. `themeHead` emits their 50–950 variables and\n * `[data-look]` bindings so a picker key paints without a package bump.\n */\n library?: ThemeLibraryColorDoc[] | null;\n}\n\nexport interface ThemeHead {\n css: string;\n preloads: { href: string; type: \"font/woff2\" }[];\n identity?: ResolvedThemeIdentity;\n}\n\nexport const THEME_SLUG = \"theme\";\nexport const THEME_COLORS_SLUG = \"theme-colors\";\nexport const THEME_TYPOGRAPHY_SLUG = \"theme-typography\";\nexport const THEME_APPEARANCE_SLUG = \"theme-appearance\";\nexport const THEME_IDENTITY_SLUG = \"theme-identity\";\n\nexport const SYSTEM_COLOR_KEYS = [\n \"primary\",\n \"secondary\",\n \"accent\",\n \"highlight\",\n \"success\",\n \"destructive\",\n] as const;\n\nexport type SystemColorKey = (typeof SYSTEM_COLOR_KEYS)[number];\n","import { includedShadeSteps, type ShadeStep } from \"@bison-lab/tokens\";\n\nimport { stateFromColorDoc } from \"./map\";\nimport { THEME_SLUG, type ThemeColorDoc, type ThemeDoc, type ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * System colors Color Settings offers as page-editor fills. Success and\n * Destructive stay off this list — they are theme chrome only.\n */\nexport const PAGE_EDITOR_SYSTEM_KEYS = [\"primary\", \"secondary\", \"accent\", \"highlight\"] as const;\n\nexport type PageEditorSystemKey = (typeof PAGE_EDITOR_SYSTEM_KEYS)[number];\n\nexport interface LookOption {\n label: string;\n value: string;\n}\n\nconst SYSTEM_LABELS: Record<PageEditorSystemKey, string> = {\n primary: \"Primary\",\n secondary: \"Secondary\",\n accent: \"Accent\",\n highlight: \"Highlight\",\n};\n\nfunction brandColor(doc: ThemeDoc | null | undefined, key: PageEditorSystemKey): ThemeColorDoc | null {\n const brand = doc?.colors?.brand ?? doc?.brand;\n const value = brand?.[key];\n if (typeof value === \"string\" || value == null) return value == null ? null : { hex: value };\n return value;\n}\n\nexport function themeLibraryFromDoc(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return Array.isArray(doc?.colors?.library) ? doc.colors.library : [];\n}\n\nfunction libraryRows(doc: ThemeDoc | null | undefined): ThemeLibraryColorDoc[] {\n return themeLibraryFromDoc(doc);\n}\n\nfunction titleCase(key: string): string {\n return key.charAt(0).toUpperCase() + key.slice(1);\n}\n\nfunction stepsFor(color: ThemeColorDoc | null | undefined, fallbackHex: string): ShadeStep[] {\n return includedShadeSteps(stateFromColorDoc(color, fallbackHex));\n}\n\n/**\n * Family keys a `lookField()` may offer: the page-editor system scales\n * plus every custom color on Colors. Adding Coral on Theme makes `coral`\n * appear here with no `@bison-lab/*` release.\n */\nexport function pageEditorLooks(doc: ThemeDoc | null | undefined): LookOption[] {\n const system = PAGE_EDITOR_SYSTEM_KEYS.map((value) => ({\n label: SYSTEM_LABELS[value],\n value,\n }));\n const custom = libraryRows(doc)\n .map((row) => {\n const value = row.key?.trim();\n if (!value) return null;\n return { label: row.label?.trim() || titleCase(value), value };\n })\n .filter((option): option is LookOption => option !== null);\n return [...system, ...custom];\n}\n\n/**\n * Included steps as `coral-400`. Excluded steps do not appear. System\n * scales with no stored include list offer the full 50–950 ramp.\n */\nexport function pageEditorTokens(doc: ThemeDoc | null | undefined): LookOption[] {\n const tokens: LookOption[] = [];\n for (const key of PAGE_EDITOR_SYSTEM_KEYS) {\n const label = SYSTEM_LABELS[key];\n for (const step of stepsFor(brandColor(doc, key), \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n for (const row of libraryRows(doc)) {\n const key = row.key?.trim();\n if (!key) continue;\n const label = row.label?.trim() || titleCase(key);\n for (const step of stepsFor(row, row.hex ?? \"#000000\")) {\n tokens.push({ label: `${label} ${step}`, value: `${key}-${step}` });\n }\n }\n return tokens;\n}\n\nexport async function themeDocFromRequest(req: {\n payload?: {\n findGlobal?: (args: {\n slug: string;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n };\n}): Promise<ThemeDoc | null> {\n try {\n const doc = await req.payload?.findGlobal?.({\n slug: THEME_SLUG,\n depth: 0,\n overrideAccess: true,\n });\n return doc ?? null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;;AAgBA,SAAS,KAAQ,OAA6B,UAAgB;AAC5D,QAAO,SAAS,OAAO,WAAW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