@getvitops/generator 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +20 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +628 -219
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/schema.json +99 -34
- package/site.schema.json +223 -66
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/schema.ts","../src/tokens.ts","../src/docs.ts","../src/generate.ts","../src/site.ts","../src/index.ts"],"sourcesContent":["/**\n * Canonical `design-system.json` schema — the single source of truth.\n *\n * Authored with `zod/mini` (tree-shakeable Zod v4). Everything else derives from it:\n * • the `DesignSystem` TS type (`z.infer`), used throughout the generator,\n * • the published JSON Schema (`toJSONSchema`), emitted to `schema.json` for `$schema` refs,\n * • runtime validation (`validate`) for the CLI and to gate `generate`.\n */\nimport * as z from 'zod/mini';\n\n// A CSS declaration block: prop -> value. Values stay strings (they can be hex,\n// var(), clamp(), keywords, …); the generator, not the schema, interprets them.\nconst CssDecls = z.record(z.string(), z.string());\n// Animation/effect vars + typography role values are string | number.\nconst Scalar = z.union([z.string(), z.number()]);\nconst VarMap = z.record(z.string(), Scalar);\n\n// ── colors ──────────────────────────────────────────────────────────────────\n// A palette hue, authored one of two ways:\n// • `{ seed, anchors? }` — an 11-step numeric scale (50…950) is GENERATED in\n// OKLCH from the seed (anchors pin specific steps; hex or oklch() values).\n// • `{ tones }` — a fixed brand kit: authored tones used verbatim at their\n// nearest steps + tinted off-white/off-black endpoints; no interpolation.\nconst SeededRamp = z.object({\n seed: z.string(),\n anchors: z.optional(z.record(z.string(), z.string())),\n});\nconst FixedRamp = z.object({\n tones: z.union([z.array(z.string()), z.record(z.string(), z.string())]),\n});\nconst Ramp = z.union([SeededRamp, FixedRamp]);\n\nconst UtilityName = z.enum(['bg', 'text', 'border', 'outline', 'fill', 'stroke']);\n\n// `roles` maps each semantic role (neutral, surface, ui-primary, …) to the\n// palette hue backing it. The generator derives every role's FUNCTIONAL tokens\n// (bg / text / solid / on-solid / borders / muted stops) from the hue's scale,\n// and dark mode flips automatically — there is no per-appearance scheme grammar.\nconst Colors = z.object({\n palette: z.record(z.string(), Ramp),\n roles: z.record(z.string(), z.string()),\n utilities: z.optional(z.array(UtilityName)),\n});\n\n// ── fluid modular scale (type + space) ──────────────────────────────────────\nconst Scale = z.object({\n base: z.string(), // anchor size, e.g. \"1rem\"\n ratio: z.number(), // modular ratio at large viewports\n steps: z.optional(z.number()), // token count when `names` is absent\n names: z.optional(z.array(z.string())), // t-shirt names (else 1..steps)\n baseStep: z.optional(z.number()), // 1-based index of the value anchor\n baseline: z.optional(z.string()), // GUI scale centre (metadata)\n fluid: z.optional(\n z.object({\n minVw: z.string(),\n maxVw: z.string(),\n minRatio: z.number(),\n }),\n ),\n});\n\n// ── patterns ────────────────────────────────────────────────────────────────\nconst Pattern = z.object({\n group: z.optional(z.string()), // token-cascade group (tag/control/panel/…)\n overrides: z.optional(CssDecls), // per-pattern token overrides\n element: z.optional(z.string()), // styled at element level via :where()\n class: z.optional(z.string()), // or as a class\n default_role: z.optional(z.string()), // role for the bare/default variant\n base: z.optional(CssDecls),\n states: z.optional(z.record(z.string(), z.record(z.string(), z.unknown()))),\n roles: z.optional(z.array(z.string())), // semantic role variants to emit\n});\n\nconst Patterns = z.object({\n defaults: z.optional(CssDecls), // --<prop>-default\n radii: z.optional(CssDecls), // --br-<name> shape primitives\n groups: z.optional(z.record(z.string(), CssDecls)), // --<prop>-<group>\n z: z.optional(z.record(z.string(), z.number())), // --z-tier-<name>\n items: z.optional(z.record(z.string(), Pattern)),\n});\n\n// ── typography ──────────────────────────────────────────────────────────────\n// A role is an open bag of CSS-ish keys (family/size/weight/tracking/…); values\n// are string | number. The generator maps known keys and ignores the rest.\nconst TypographyRole = z.record(z.string(), Scalar);\nconst Typography = z.object({\n families: z.optional(z.record(z.string(), z.string())),\n roles: z.optional(z.record(z.string(), TypographyRole)),\n headings: z.optional(z.record(z.string(), z.string())),\n});\n\n// ── animations ──────────────────────────────────────────────────────────────\nconst AnimEffect = z.object({\n kf: z.string(), // keyframe family: composite | paint | layout\n css: z.optional(VarMap), // extra literal declarations\n vars: z.optional(VarMap), // --<key>: <value> (non-default endpoints)\n});\nconst Animations = z.object({\n effects: z.optional(z.record(z.string(), AnimEffect)),\n journeys: z.optional(\n z.object({\n base: z.optional(z.record(z.string(), VarMap)),\n compose: z.optional(z.array(z.array(z.string()))),\n }),\n ),\n});\n\n// ── the design system ───────────────────────────────────────────────────────\nexport const DesignSystemSchema = z.object({\n $schema: z.optional(z.string()),\n colors: Colors,\n shadows: z.optional(z.record(z.string(), z.string())),\n fonts: z.optional(z.record(z.string(), z.string())),\n typeScale: z.optional(Scale),\n spaceScale: z.optional(Scale),\n patterns: z.optional(Patterns),\n typography: z.optional(Typography),\n animations: z.optional(Animations),\n});\n\nexport type DesignSystem = z.infer<typeof DesignSystemSchema>;\n\n// A deep-partial view used for theme deltas: `extends` patches and alternate\n// schemes supply only what they override, so every field (down through\n// colors → schemes → semantic) is optional. Reuses the same leaf schemas, so\n// there's no second source of truth. Completeness is enforced after merge\n// (validate the resolved theme against `DesignSystemSchema`).\nconst ColorsPatch = z.object({\n palette: z.optional(z.record(z.string(), Ramp)),\n roles: z.optional(z.record(z.string(), z.string())),\n utilities: z.optional(z.array(UtilityName)),\n});\nexport const DesignSystemPatchSchema = z.extend(z.partial(DesignSystemSchema), {\n colors: z.optional(ColorsPatch),\n});\nexport type DesignSystemPatch = z.infer<typeof DesignSystemPatchSchema>;\n\n/**\n * Stable URL of the published JSON Schema. Resolves once `@getvitops/generator` is on\n * npm (unpkg serves the packaged `schema.json`); `vitops init` stamps this into a\n * scaffolded config's `$schema` so editors light up autocomplete + validation.\n */\nexport const SCHEMA_URL = 'https://unpkg.com/@getvitops/generator/schema.json';\n\n/** The published JSON Schema (draft-2020-12), derived from the zod schema. */\nexport const jsonSchema = {\n $id: SCHEMA_URL,\n ...z.toJSONSchema(DesignSystemSchema, { target: 'draft-2020-12' }),\n};\n\nexport type ValidationResult =\n | { ok: true; data: DesignSystem; errors: [] }\n | { ok: false; data: undefined; errors: z.core.$ZodIssue[] };\n\n/** Validate an unknown value against the design-system schema. */\nexport function validate(input: unknown): ValidationResult {\n const result = z.safeParse(DesignSystemSchema, input);\n if (!result.success) return { ok: false, data: undefined, errors: result.error.issues };\n // Every role must point at a palette hue that exists.\n const { palette, roles } = result.data.colors;\n for (const [role, hue] of Object.entries(roles)) {\n if (palette[hue] == null) {\n return {\n ok: false,\n data: undefined,\n errors: [\n {\n code: 'custom',\n path: ['colors', 'roles', role],\n message: `role \"${role}\" references unknown palette hue \"${hue}\"`,\n } as z.core.$ZodIssue,\n ],\n };\n }\n }\n return { ok: true, data: result.data, errors: [] };\n}\n","/**\n * Palette expansion + semantic functional tokens.\n *\n * A palette hue is authored one of two ways:\n * • `{ seed, anchors? }` — an 11-step numeric scale (50…950) generated in\n * OKLCH via @getvitops/utils/color (lightness transposed toward tinted\n * near-white/near-black, chroma dampened at the extremes),\n * • `{ tones }` — a fixed brand kit: authored tones placed verbatim at their\n * nearest steps + tinted endpoints; nothing else is invented (strict kits).\n *\n * Every role (from `colors.roles`) gets FUNCTIONAL tokens — the public API:\n * --<role>-bg / -bg-muted / -border / -border-bold / -solid / -solid-bold /\n * -on-solid / -text / -text-muted / -text-x-muted\n * plus the appearance-relative emphasis stops (x-muted · muted · bold · x-bold)\n * and, for `surface`, the translucent `--surface-glass` + `--overlay` scrim.\n * Dark mode flips the mapping automatically (solid stays mode-stable).\n */\nimport {\n contrastLc,\n generateOklchPalette,\n hexToOklch,\n oklchStringToHex,\n pickOn,\n} from '@getvitops/utils/color';\n\nexport const NUMERIC_STEPS = [\n '50',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n] as const;\ntype NumStep = (typeof NUMERIC_STEPS)[number];\n\n// Lightness centres of the numeric scale (mirrors the engine's internal curve).\nconst STEP_L: Record<NumStep, number> = {\n '50': 0.95,\n '100': 0.9,\n '200': 0.8,\n '300': 0.7,\n '400': 0.6,\n '500': 0.5,\n '600': 0.4,\n '700': 0.3,\n '800': 0.2,\n '900': 0.1,\n '950': 0.05,\n};\n\nexport interface ExpandedHue {\n /** Numeric steps (sparse for fixed-tone kits). */\n numeric: Partial<Record<NumStep, string>>;\n /** True when only authored tones + endpoints exist (no interpolation). */\n sparse?: boolean;\n}\n\ninterface SeedInput {\n seed: string;\n anchors?: Record<string, string>;\n}\ninterface TonesInput {\n tones: string[] | Record<string, string>;\n}\n\nconst isHex = (v: string) => v.startsWith('#');\nconst toOklchStr = (v: string) => {\n if (!isHex(v)) return v; // already oklch(...)\n const { l, c, h } = hexToOklch(v);\n return `oklch(${(l * 100).toFixed(2)}% ${c.toFixed(4)} ${h.toFixed(2)})`;\n};\nconst nearestStep = (l: number): NumStep =>\n NUMERIC_STEPS.reduce((best, s) =>\n Math.abs(l - STEP_L[s]) < Math.abs(l - STEP_L[best]) ? s : best,\n );\n\nfunction expandSeeded(input: SeedInput): ExpandedHue {\n // Seed + author anchors pinned at their natural (or explicit) steps, PLUS\n // implicit tinted near-white/near-black endpoint anchors (unless the author\n // pins 50/950 themselves). The engine then interpolates lightness/chroma\n // piecewise BETWEEN anchors — monotonic by construction, with the light side\n // actually reaching near-white (the original \"mid-gray light end\" bug) and\n // chroma tapering toward the tinted-neutral ends.\n const anchors: Record<string, string> = {};\n const seedStep = nearestStep(hexToOklch(input.seed).l);\n anchors[seedStep] = toOklchStr(input.seed);\n for (const [key, value] of Object.entries(input.anchors ?? {})) {\n const step = (NUMERIC_STEPS as readonly string[]).includes(key)\n ? key\n : nearestStep(hexToOklch(value).l);\n anchors[step] = toOklchStr(value);\n }\n const hue = hexToOklch(input.seed).h;\n anchors['50'] ??= `oklch(97% 0.008 ${hue.toFixed(2)})`;\n anchors['950'] ??= `oklch(13% 0.015 ${hue.toFixed(2)})`;\n const scale = generateOklchPalette(anchors) as Record<string, string>;\n const numeric: Partial<Record<NumStep, string>> = {};\n for (const s of NUMERIC_STEPS) if (scale[s] != null) numeric[s] = oklchStringToHex(scale[s]);\n return { numeric };\n}\n\nfunction expandTones(input: TonesInput): ExpandedHue {\n // Strict kit: authored tones verbatim at their nearest step; add tinted\n // endpoints (the one allowed exception); interpolate nothing else.\n const tones = Array.isArray(input.tones) ? input.tones : Object.values(input.tones);\n const numeric: Partial<Record<NumStep, string>> = {};\n for (const hex of tones) numeric[nearestStep(hexToOklch(hex).l)] = hex;\n const hue = hexToOklch(tones[0] ?? '#808080').h;\n numeric['50'] ??= oklchStringToHex(`oklch(97% 0.010 ${hue.toFixed(2)})`);\n numeric['950'] ??= oklchStringToHex(`oklch(15% 0.015 ${hue.toFixed(2)})`);\n return { numeric, sparse: true };\n}\n\n/** Snap to the nearest AVAILABLE numeric step (sparse kits). */\nfunction snap(numeric: Partial<Record<NumStep, string>>, want: NumStep): NumStep {\n if (numeric[want] != null) return want;\n const have = NUMERIC_STEPS.filter((s) => numeric[s] != null);\n return have.reduce((best, s) =>\n Math.abs(STEP_L[s] - STEP_L[want]) < Math.abs(STEP_L[best] - STEP_L[want]) ? s : best,\n );\n}\n\n/** Expand every palette hue into its numeric scale. */\nexport function expandPalette(raw: Record<string, unknown>): Record<string, ExpandedHue> {\n const out: Record<string, ExpandedHue> = {};\n for (const [name, entry] of Object.entries(raw)) {\n const e = entry as Partial<SeedInput & TonesInput>;\n if (typeof e?.seed === 'string') out[name] = expandSeeded(e as SeedInput);\n else if (e?.tones != null) out[name] = expandTones(e as TonesInput);\n else throw new Error(`palette hue \"${name}\" must have a \"seed\" or \"tones\"`);\n }\n return out;\n}\n\n// ── functional token mapping ─────────────────────────────────────────────────\n\ntype TokenMap = Record<string, NumStep>;\nconst LIGHT: TokenMap = {\n bg: '50',\n 'bg-muted': '100',\n border: '200',\n 'border-bold': '300',\n text: '950',\n 'text-muted': '800',\n 'text-x-muted': '600',\n};\nconst DARK: TokenMap = {\n bg: '950',\n 'bg-muted': '900',\n border: '800',\n 'border-bold': '700',\n text: '50',\n 'text-muted': '200',\n 'text-x-muted': '400',\n};\n// surface = background planes; elevation is lighter-when-raised in BOTH modes.\nconst SURFACE_LIGHT: TokenMap = { ...LIGHT, bg: '100', 'bg-muted': '200', 'bg-bold': '50' };\nconst SURFACE_DARK: TokenMap = { ...DARK, bg: '900', 'bg-muted': '950', 'bg-bold': '800' };\n// appearance-relative emphasis stops (base excluded — the bare name is functional).\nconst EMPHASIS_LIGHT: TokenMap = { 'x-muted': '100', muted: '300', bold: '700', 'x-bold': '900' };\nconst EMPHASIS_DARK: TokenMap = { 'x-muted': '900', muted: '700', bold: '300', 'x-bold': '100' };\n\nexport interface FunctionalRole {\n role: string;\n hue: string;\n /** token → CSS value, per appearance. */\n light: Record<string, string>;\n dark: Record<string, string>;\n}\n\n/** Resolve the functional token set for one role over its hue. */\nexport function functionalRole(role: string, hueName: string, hue: ExpandedHue): FunctionalRole {\n const numeric = hue.numeric;\n const v = (n: NumStep) => `var(--color-${hueName}-${snap(numeric, n)})`;\n const hex = (n: NumStep) => numeric[snap(numeric, n)] as string;\n\n // solid: the vivid tone — at least 500 (white text needs the depth), at most 700.\n const naturalRaw = NUMERIC_STEPS.find((s) => numeric[s] === hex('500')) ?? '500';\n const natural = Number(snap(numeric, naturalRaw));\n const solidStep = snap(numeric, String(Math.min(Math.max(natural, 500), 700)) as NumStep);\n const solidBold = snap(numeric, String(Math.min(Number(solidStep) + 100, 950)) as NumStep);\n const onSolid = pickOn(numeric[solidStep] as string);\n\n const isSurface = role === 'surface';\n const map = (table: TokenMap): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [token, step] of Object.entries(table)) out[token] = v(step as NumStep);\n return out;\n };\n const emphasis = (table: TokenMap, prefix: string): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [stop, step] of Object.entries(table)) out[`${prefix}-${stop}`] = v(step as NumStep);\n return out;\n };\n\n const light = {\n ...map(isSurface ? SURFACE_LIGHT : LIGHT),\n solid: v(solidStep),\n 'solid-bold': v(solidBold),\n 'on-solid': onSolid,\n ...emphasis(EMPHASIS_LIGHT, 'stop'),\n };\n const dark = {\n ...map(isSurface ? SURFACE_DARK : DARK),\n solid: v(solidStep),\n 'solid-bold': v(solidBold),\n 'on-solid': onSolid,\n ...emphasis(EMPHASIS_DARK, 'stop'),\n };\n return { role, hue: hueName, light, dark };\n}\n\n/** Verify a functional role's contrast targets. Returns human-readable failures. */\nexport function checkContrast(\n fr: FunctionalRole,\n numericOf: (hueName: string) => Partial<Record<NumStep, string>>,\n): string[] {\n const failures: string[] = [];\n const resolve = (val: string): string => {\n const m = /^var\\(--color-([a-z0-9-]+)-(\\d+)\\)$/.exec(val);\n if (!m) return val;\n return numericOf(m[1] as string)[m[2] as NumStep] ?? val;\n };\n for (const [name, tokens] of [\n ['light', fr.light],\n ['dark', fr.dark],\n ] as const) {\n const bg = resolve(tokens.bg as string);\n const checks: Array<[string, string, number]> = [\n ['text', resolve(tokens.text as string), 75],\n ['text-muted', resolve(tokens['text-muted'] as string), 60],\n ];\n for (const [token, hexV, min] of checks) {\n const lc = contrastLc(hexV, bg);\n if (lc < min)\n failures.push(`${fr.role}/${name}: ${token} Lc ${lc.toFixed(1)} < ${min} on bg ${bg}`);\n }\n const onLc = contrastLc(tokens['on-solid'] as string, resolve(tokens.solid as string));\n if (onLc < 60)\n failures.push(`${fr.role}/${name}: on-solid Lc ${onLc.toFixed(1)} < 60 on solid`);\n }\n return failures;\n}\n","/**\n * OKF documentation bundle generator (ported from the repo's `generate-docs.ts`).\n *\n * Pure: `generateDocs(ds, assetsDir)` returns a `{ relPath: markdown }` map for the\n * Open Knowledge Format tree (top index, css/, bricks/), reading the Bricks element\n * PHP from `<assetsDir>/bricks/elements`. No filesystem writes — the caller decides\n * where the bundle lands (e.g. `<outDir>/docs`).\n */\nimport { readFileSync, readdirSync, existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { DesignSystem } from './schema.ts';\nimport { expandPalette } from './tokens.ts';\n\nconst DS_PATH = 'design-system.json';\n\n// Curated element display order (by $name, sans the vitops- prefix). Unlisted\n// elements fall to the end alphabetically so new ones still appear.\nconst ORDER = [\n 'split',\n 'centered',\n 'carousel',\n 'color-scheme-toggle',\n 'copy-button',\n 'dismissable',\n 'entries',\n 'image-compare',\n 'sitenav',\n 'multi-field',\n 'split-link',\n 'split-panel',\n];\n\n// ── PHP array-literal parser ─────────────────────────────────────────────────\ntype Json = string | number | boolean | null | Json[] | { [k: string]: Json };\n\ninterface Tok {\n t: 'str' | 'num' | 'id' | 'punc' | 'arrow';\n v: string;\n}\n\nfunction tokenize(src: string): Tok[] {\n const toks: Tok[] = [];\n let i = 0;\n const n = src.length;\n while (i < n) {\n const c = src[i] as string;\n if (c === ' ' || c === '\\t' || c === '\\n' || c === '\\r') {\n i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '/') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '#') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '*') {\n i += 2;\n while (i < n && !(src[i] === '*' && src[i + 1] === '/')) i++;\n i += 2;\n continue;\n }\n if (c === \"'\" || c === '\"') {\n const quote = c;\n i++;\n let s = '';\n while (i < n && src[i] !== quote) {\n if (src[i] === '\\\\' && i + 1 < n) {\n const next = src[i + 1];\n s += next === 'n' ? '\\n' : next === 't' ? '\\t' : next;\n i += 2;\n } else {\n s += src[i++];\n }\n }\n i++;\n toks.push({ t: 'str', v: s });\n continue;\n }\n if (c === '=' && src[i + 1] === '>') {\n toks.push({ t: 'arrow', v: '=>' });\n i += 2;\n continue;\n }\n if ('[](){},'.includes(c)) {\n toks.push({ t: 'punc', v: c });\n i++;\n continue;\n }\n if (\n (c >= '0' && c <= '9') ||\n (c === '-' && (src[i + 1] as string) >= '0' && (src[i + 1] as string) <= '9')\n ) {\n let s = c;\n i++;\n while (i < n && (src[i] as string) >= '0' && (src[i] as string) <= '9') s += src[i++];\n toks.push({ t: 'num', v: s });\n continue;\n }\n if (/[A-Za-z_\\\\]/.test(c)) {\n let s = c;\n i++;\n while (i < n && /[A-Za-z0-9_\\\\]/.test(src[i] as string)) s += src[i++];\n toks.push({ t: 'id', v: s });\n continue;\n }\n i++;\n }\n return toks;\n}\n\nclass Parser {\n p = 0;\n toks: Tok[];\n constructor(toks: Tok[]) {\n this.toks = toks;\n }\n peek(): Tok | undefined {\n return this.toks[this.p];\n }\n next(): Tok | undefined {\n return this.toks[this.p++];\n }\n parseValue(): Json {\n const t = this.peek();\n if (!t) return null;\n if (t.t === 'str') {\n this.next();\n return t.v;\n }\n if (t.t === 'num') {\n this.next();\n return Number(t.v);\n }\n if (t.t === 'id') {\n this.next();\n if (t.v === 'true') return true;\n if (t.v === 'false') return false;\n if (t.v === 'null') return null;\n if (this.peek()?.t === 'punc' && this.peek()?.v === '(') {\n this.next();\n if (t.v === 'array') return this.parseBody(')');\n const args = this.parseCallArgs();\n return args.find((a) => typeof a === 'string') ?? args[0] ?? '';\n }\n return t.v;\n }\n if (t.t === 'punc' && t.v === '[') {\n this.next();\n return this.parseBody(']');\n }\n if (t.t === 'punc' && t.v === '(') {\n this.next();\n return this.parseBody(')');\n }\n this.next();\n return null;\n }\n private parseCallArgs(): Json[] {\n const args: Json[] = [];\n while (this.peek() && !(this.peek()!.t === 'punc' && this.peek()!.v === ')')) {\n args.push(this.parseValue());\n if (this.peek()?.t === 'punc' && this.peek()?.v === ',') this.next();\n }\n this.next();\n return args;\n }\n private parseBody(close: string): Json {\n const list: Json[] = [];\n const map: Record<string, Json> = {};\n let keyed = false;\n while (this.peek() && !(this.peek()!.t === 'punc' && this.peek()!.v === close)) {\n const first = this.parseValue();\n if (this.peek()?.t === 'arrow') {\n this.next();\n const val = this.parseValue();\n // PHP array keys are scalars; stringify objects defensively.\n map[typeof first === 'object' && first !== null ? JSON.stringify(first) : String(first)] =\n val;\n keyed = true;\n } else {\n list.push(first);\n }\n if (this.peek()?.t === 'punc' && this.peek()?.v === ',') this.next();\n }\n this.next();\n return keyed ? map : list;\n }\n}\n\nfunction parsePhpLiteral(text: string): Json {\n return new Parser(tokenize(text)).parseValue();\n}\n\n// ── Source-region helpers ────────────────────────────────────────────────────\nfunction matchBalanced(src: string, open: number): number {\n const pairs: Record<string, string> = { '(': ')', '[': ']', '{': '}' };\n const stack: string[] = [];\n let i = open;\n const n = src.length;\n while (i < n) {\n const c = src[i] as string;\n if (c === '/' && src[i + 1] === '/') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '*') {\n i += 2;\n while (i < n && !(src[i] === '*' && src[i + 1] === '/')) i++;\n i += 2;\n continue;\n }\n if (c === \"'\" || c === '\"') {\n i++;\n while (i < n && src[i] !== c) {\n if (src[i] === '\\\\') i++;\n i++;\n }\n i++;\n continue;\n }\n if (c in pairs) stack.push(pairs[c] as string);\n else if (c === ')' || c === ']' || c === '}') {\n if (stack.pop() !== c) {\n /* unbalanced — best effort */\n }\n if (stack.length === 0) return i + 1;\n }\n i++;\n }\n return n;\n}\n\nfunction methodBody(src: string, name: string): string | null {\n const m = new RegExp(`function\\\\s+${name}\\\\s*\\\\([^)]*\\\\)`).exec(src);\n if (!m) return null;\n const brace = src.indexOf('{', m.index + m[0].length);\n if (brace < 0) return null;\n const end = matchBalanced(src, brace);\n return src.slice(brace + 1, end - 1);\n}\n\nfunction literalAt(src: string, fromIdx: number): { text: string; end: number } | null {\n let i = fromIdx;\n while (i < src.length && /\\s/.test(src[i] as string)) i++;\n let open: number;\n if (src[i] === '[') open = i;\n else if (src.startsWith('array', i)) open = src.indexOf('(', i);\n else return null;\n const end = matchBalanced(src, open);\n return { text: src.slice(i, end), end };\n}\n\n// ── Per-element extraction ───────────────────────────────────────────────────\ninterface Control {\n key: string;\n def: Record<string, Json>;\n}\ninterface Element {\n name: string;\n label: string;\n nestable: boolean;\n docblock: string;\n controls: Control[];\n cssClass: string | null;\n children: string[];\n keywords: string[];\n}\n\nfunction firstString(re: RegExp, src: string): string | null {\n const m = re.exec(src);\n return m ? (m[1] ?? null) : null;\n}\n\nfunction extractDocblock(src: string): string {\n const m = /\\/\\*\\*([\\s\\S]*?)\\*\\//.exec(src);\n if (!m) return '';\n const lines = (m[1] as string)\n .split('\\n')\n .map((l) => l.replace(/^\\s*\\*?\\s?/, '').replace(/\\s+$/, ''));\n while (lines.length && lines[0] === '') lines.shift();\n if (lines.length && /Bricks Builder\\)\\./.test(lines[0] as string)) lines.shift();\n const owned = lines.findIndex((l) => l.startsWith('Owned by the framework repo'));\n const kept = (owned >= 0 ? lines.slice(0, owned) : lines).map((l) => l.replace(/^•\\s*/, '- '));\n while (kept.length && kept[kept.length - 1] === '') kept.pop();\n while (kept.length && kept[0] === '') kept.shift();\n return kept.join('\\n');\n}\n\nfunction extractControls(src: string): Control[] {\n const body = methodBody(src, 'set_controls');\n if (!body) return [];\n const controls: Control[] = [];\n const re = /\\$this->controls\\[\\s*'([^']+)'\\s*\\](\\[\\s*'([^']+)'\\s*\\])?\\s*=\\s*/g;\n let m: RegExpExecArray | null;\n while ((m = re.exec(body))) {\n const key = m[1] as string;\n if (m[2]) continue;\n const lit = literalAt(body, m.index + m[0].length);\n if (!lit) continue;\n const def = parsePhpLiteral(lit.text);\n if (def && typeof def === 'object' && !Array.isArray(def))\n controls.push({ key, def: def as Record<string, Json> });\n re.lastIndex = lit.end;\n }\n return controls;\n}\n\nfunction extractChildren(src: string): string[] {\n const body = methodBody(src, 'get_nestable_children');\n if (!body) return [];\n const labels: string[] = [];\n const re = /'label'\\s*=>\\s*esc_html__\\(\\s*'([^']*)'/g;\n let m: RegExpExecArray | null;\n while ((m = re.exec(body))) labels.push(m[1] as string);\n return labels;\n}\n\nfunction extractKeywords(src: string): string[] {\n const body = methodBody(src, 'get_keywords');\n if (!body) return [];\n const ret = /return\\s+/.exec(body);\n if (!ret) return [];\n const lit = literalAt(body, ret.index + ret[0].length);\n if (!lit) return [];\n const arr = parsePhpLiteral(lit.text);\n return Array.isArray(arr) ? arr.filter((x): x is string => typeof x === 'string') : [];\n}\n\nfunction parseElement(src: string): Element | null {\n const name = firstString(/public\\s+\\$name\\s*=\\s*'vitops-([^']+)'/, src);\n if (!name) return null;\n return {\n name,\n label:\n firstString(/function get_label\\(\\)[\\s\\S]*?return\\s+esc_html__\\(\\s*'([^']*)'/, src) ?? name,\n nestable: /public\\s+\\$nestable\\s*=\\s*true/.test(src),\n docblock: extractDocblock(src),\n controls: extractControls(src),\n cssClass: firstString(\n /\\$this->controls\\[\\s*'_cssClasses'\\s*\\]\\[\\s*'default'\\s*\\]\\s*=\\s*'([^']*)'/,\n src,\n ),\n children: extractChildren(src),\n keywords: extractKeywords(src),\n };\n}\n\n// ── Markdown rendering ───────────────────────────────────────────────────────\n/** Stringify a parsed-PHP Json value for prose (objects → JSON, not [object Object]). */\nconst asText = (v: Json | undefined): string =>\n v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v);\n\nfunction controlLine(c: Control): string {\n const def = c.def;\n if (def.type === 'info') return `- _Note:_ ${asText(def.content)}`;\n const label = (def.label as string) || c.key;\n const options =\n def.options && typeof def.options === 'object' && !Array.isArray(def.options)\n ? (def.options as Record<string, string>)\n : null;\n const meta: string[] = [];\n let type = (def.type as string) || 'text';\n if (def.units === true) type += '+units';\n meta.push(type);\n if (def.default !== undefined) {\n const raw = asText(def.default);\n const shown = options && options[raw] ? options[raw] : raw;\n meta.push(`default \\`${shown}\\``);\n }\n if (def.placeholder !== undefined && def.placeholder !== '')\n meta.push(`placeholder \\`${asText(def.placeholder)}\\``);\n if (def.min !== undefined || def.max !== undefined)\n meta.push(\n `range ${def.min != null ? asText(def.min) : '–'}–${def.max != null ? asText(def.max) : '∞'}`,\n );\n const tail: string[] = [];\n if (def.description) tail.push(asText(def.description));\n if (options)\n tail.push(\n `Options: ${Object.values(options)\n .map((o) => `\\`${o}\\``)\n .join(', ')}.`,\n );\n if (Array.isArray(def.css) && def.css.length) {\n const first = def.css[0];\n if (first && typeof first === 'object' && !Array.isArray(first) && 'property' in first)\n tail.push(`Bound to \\`${asText((first as Record<string, Json>).property)}\\`.`);\n }\n if (def.type === 'repeater' && def.fields && typeof def.fields === 'object') {\n const fields = Object.values(def.fields as Record<string, Json>)\n .map((f) =>\n f && typeof f === 'object' && !Array.isArray(f)\n ? asText((f as Record<string, Json>).label)\n : null,\n )\n .filter(Boolean);\n if (fields.length) tail.push(`Fields: ${fields.join(', ')}.`);\n }\n const head = `- **${label}** (${meta.join(', ')})`;\n return tail.length ? `${head} — ${tail.join(' ')}` : head;\n}\n\nfunction renderElement(el: Element): string {\n const out: string[] = [];\n const nest = el.nestable ? 'nestable' : 'not nestable';\n out.push(`## ${el.label} — \\`vitops-${el.name}\\` · ${nest}`);\n out.push('');\n if (el.docblock) {\n out.push(el.docblock);\n out.push('');\n }\n const real = el.controls.filter((c) => c.def.type !== 'info');\n if (real.length) {\n out.push('**Controls**');\n out.push('');\n for (const c of el.controls) out.push(controlLine(c));\n out.push('');\n } else {\n const notes = el.controls.filter((c) => c.def.type === 'info');\n if (notes.length) {\n for (const c of notes) out.push(controlLine(c));\n out.push('');\n }\n }\n if (el.cssClass) {\n out.push(\n `**Base CSS class:** \\`${el.cssClass}\\` (applied automatically; add ratio/modifier classes alongside it in the element's \"CSS classes\" field).`,\n );\n out.push('');\n }\n if (el.children.length) {\n out.push(`**Seeded children:** ${el.children.join(', ')}.`);\n out.push('');\n }\n if (el.keywords.length) {\n out.push(`**Keywords:** ${el.keywords.filter((k) => k !== 'vitops').join(', ')}.`);\n out.push('');\n }\n return out.join('\\n');\n}\n\n// ── OKF helpers ──────────────────────────────────────────────────────────────\ninterface Frontmatter {\n type: string;\n title: string;\n description: string;\n resource?: string;\n tags?: string[];\n}\nfunction frontmatter(fm: Frontmatter): string {\n const q = (s: string) => `\"${s.replace(/\"/g, '\\\\\"')}\"`;\n const lines = [\n `type: ${q(fm.type)}`,\n `title: ${q(fm.title)}`,\n `description: ${q(fm.description)}`,\n ];\n if (fm.resource) lines.push(`resource: ${q(fm.resource)}`);\n if (fm.tags) lines.push(`tags: [${fm.tags.join(', ')}]`);\n lines.push('generator: \"@getvitops/generator\"');\n return `---\\n${lines.join('\\n')}\\n---`;\n}\n\nconst INDEX_NOTE = `<!-- GENERATED by @getvitops/generator — do not edit; regenerate with \\`vitops generate\\`. -->`;\n\nconst ELEMENTS_FRONTMATTER = frontmatter({\n type: 'Bricks Elements Reference',\n title: 'Vitops — Bricks Builder elements reference',\n description:\n 'Every repo-owned Bricks element, its controls, defaults, seeded children and keywords, for driving the Bricks Builder UI.',\n resource: 'bricks/elements',\n tags: ['bricks', 'wordpress', 'elements', 'design-system'],\n});\n\nconst ELEMENTS_PREAMBLE = `${ELEMENTS_FRONTMATTER}\n\n# Vitops — Bricks Builder elements reference\n\nContext for driving the Bricks Builder UI (e.g. Claude for Chrome). Every section below\nis generated from the element's own source, so this reference always matches the elements\ncurrently deployed. See also the CSS class vocabulary in [/css/classes.md](../css/classes.md)\nand the integration guidance in [/bricks/index.md](index.md).\n\n## How they appear in the builder\n\n- The elements register from \\`dist/bricks/load.php\\` and group under a **\"Vitops\"** category\n pinned to the **top** of the element panel. Insert one by searching its **label** (e.g.\n \"Split\", \"Carousel\") or any of its **keywords** (listed per element).\n- Two rendering families:\n - **Web-component elements** render a Lit custom element (\\`<wc-*>\\`, \\`<copy-button>\\`, …)\n from \\`dist/elements.js\\` and progressively enhance. A few (Image Compare, Split Panel)\n show their children stacked in the builder canvas until the client-side upgrade runs —\n that is expected, not broken.\n - **CSS-pattern elements** (Split, Centered, Menu, Split Link) render plain markup styled\n by the framework CSS — no JS dependency.\n- **Nestable** elements accept child elements dropped into them; some seed starter children\n (listed as \"Seeded children\"). **Non-nestable** elements are configured entirely through\n their controls.\n\n## Configuring layout\n\nSome layout is set through **controls**; some through **CSS classes typed into the element's\nbuilt-in \"CSS classes\" field** (called out per element as modifier classes). Responsive\nsuffixes on those classes engage from a container breakpoint: \\`-sm\\` = 30rem, \\`-md\\` = 48rem,\n\\`-lg\\` = 64rem, \\`-xl\\` = 80rem.\n\nEach control below lists its type, default/placeholder, any select options, and the CSS\ncustom property it writes (when it drives one). Info notes flagged _Note:_ carry the\nmodifier-class and structural guidance from the element itself.\n\n---\n`;\n\nfunction renderElementsDoc(elementsDir: string): string {\n const files = existsSync(elementsDir)\n ? readdirSync(elementsDir).filter((f) => f.endsWith('.php'))\n : [];\n const elements: Element[] = [];\n for (const f of files) {\n try {\n const el = parseElement(readFileSync(join(elementsDir, f), 'utf8'));\n if (el) elements.push(el);\n } catch {\n /* skip unparseable element */\n }\n }\n elements.sort((a, b) => {\n const ia = ORDER.indexOf(a.name);\n const ib = ORDER.indexOf(b.name);\n if (ia >= 0 && ib >= 0) return ia - ib;\n if (ia >= 0) return -1;\n if (ib >= 0) return 1;\n return a.name.localeCompare(b.name);\n });\n const body = elements.map(renderElement).join('\\n---\\n\\n');\n return `${ELEMENTS_PREAMBLE}\\n${body}`;\n}\n\n// ── CSS framework reference (rule-summarized, from the config) ────────────────\nconst code = (xs: string[]) => xs.map((x) => `\\`${x}\\``).join(', ');\n\nfunction renderCssClasses(ds: DesignSystem): string {\n const expanded = expandPalette(ds.colors.palette as Record<string, unknown>);\n const ramps = Object.keys(expanded);\n const roles = Object.keys(ds.colors.roles ?? {});\n const utils = ds.colors.utilities ?? ['bg', 'text', 'border'];\n const typeRoles = Object.keys(ds.typography?.roles ?? {});\n const shadows = Object.keys(ds.shadows ?? {});\n const effects = Object.keys(ds.animations?.effects ?? {});\n const items = (ds.patterns?.items ?? {}) as Record<\n string,\n { roles?: string[]; default_role?: string }\n >;\n const patterns = Object.keys(items);\n const patternRoles = Array.from(\n new Set(\n Object.values(items).flatMap(\n (p) => [p.default_role, ...(p.roles ?? [])].filter(Boolean) as string[],\n ),\n ),\n );\n const spaceNames = ds.spaceScale?.names ?? [];\n const typeNames = ds.typeScale?.names ?? [];\n const families = Object.keys(ds.typography?.families ?? {});\n const radii = Object.keys(ds.patterns?.radii ?? {});\n\n return `${frontmatter({\n type: 'CSS Framework Reference',\n title: 'Vitops CSS framework — class vocabulary',\n description:\n 'Every utility and component class in the Vitops CSS framework, stated as a naming rule over the design tokens it expands.',\n resource: DS_PATH,\n tags: ['css', 'utilities', 'patterns', 'design-system'],\n })}\n\n# Vitops CSS framework — class vocabulary (LLM reference)\n\nA variable-driven CSS framework. Classes encode the design system's **tokens** (colour,\ntype, space, shadow), **responsive grammar**, and **interaction states** — so styling with\nthese classes stays consistent and theme-/dark-mode-aware. Prefer them over hand-written\nCSS or ad-hoc property values.\n\nThis is a **rule reference**, not an exhaustive list: each family below is a naming rule\nplus the set of tokens it expands over. Applying a rule to any listed token yields a valid\nclass (e.g. rule \\`bg-<color>\\` + colour \\`pine-xl\\` → \\`bg-pine-xl\\`).\n\n## Responsive & state variant grammar\n\nEvery utility accepts a **container-breakpoint prefix**; animation utilities also accept a\n**state prefix**. In CSS/Bricks the separator is \\`-\\`; in Tailwind it is \\`:\\` / \\`@\\`.\n\n| Intent | CSS / Bricks | Tailwind |\n| ----------------- | -------------------------- | ----------------------------------------- |\n| responsive split | \\`md-split-1-2\\` | \\`@md:split-1-2\\` |\n| responsive align | \\`md-items-center\\` | \\`@md:items-center\\` |\n| hover effect | \\`transition hover-fade-in\\` | \\`transition fade-in hover:flip-fade-in\\` |\n\n- Breakpoint prefixes (bare): \\`sm-\\` = 30rem, \\`md-\\` = 48rem, \\`lg-\\` = 64rem, \\`xl-\\` = 80rem.\n- State prefixes (animation effects only): \\`hover-\\`, \\`active-\\`, \\`focus-\\`, and \\`flip-<effect>\\`\n (plays the effect in reverse on toggle). Effects require \\`transition\\` on the element.\n\n## Layout & structure\n\n- **\\`centered\\`** — named-track grid centering content in the reading \\`measure\\` track.\n Widen a **direct child** by adding \\`breakout\\`, \\`spotlight\\`, or \\`fullbleed\\` (each\n breakpoint-prefixable) to that child. Track widths are set via \\`--width-measure\\` /\n \\`--width-breakout\\` / \\`--width-spotlight\\` and \\`--gutter\\`.\n- **\\`rhythm\\`** — relationship-based vertical spacing (margins between headings, paragraphs,\n lists, media) driven by the space scale. Usually paired with \\`centered\\`.\n- **\\`split\\`** — equal flex columns. Ratio rule: **\\`split-<a>-<b>\\`** where \\`<a>-<b>\\` ∈\n \\`1-2\\`, \\`2-1\\`, \\`1-3\\`, \\`3-1\\`, \\`1-4\\`, \\`4-1\\`, \\`2-3\\`, \\`3-2\\` (breakpoint-prefixable).\n- **Flex** — \\`flex\\`, \\`flex-row\\`, \\`flex-col\\`; \\`g\\` for gap (space-scale token).\n- **Alignment** — \\`items-{start,center,end,stretch}\\`, \\`justify-{start,center,end,between}\\`,\n text align \\`text-{start,center,end}\\` (all breakpoint-prefixable).\n- **Display** — \\`block\\`, \\`inline\\`, \\`inline-block\\`, \\`flex\\`, \\`grid\\`, \\`hidden\\`\n (breakpoint-prefixable, e.g. \\`md-hidden\\`).\n- **Accessibility** — \\`sr-only\\` / \\`not-sr-only\\` (breakpoint-prefixable).\n- **State hooks** — \\`is-active\\`, \\`is-open\\` (styling flags toggled by JS / native state).\n\n## Spacing\n\nThe space scale is ${code(spaceNames)} exposed as \\`--space-<name>\\` tokens.\nGap (\\`g\\`) and \\`rhythm\\` margins consume these tokens; prefer \\`rhythm\\` for vertical flow\nrather than per-element margins.\n\n## Typography\n\nRule: **\\`font-<role>\\`** — role ∈ ${code(typeRoles)}. Each role carries its own family,\nsize (from the type scale ${code(typeNames)}), tracking, transform, and weight.\nFamilies: ${code(families)} (\\`--font-*\\`).\n\n## Colour\n\n**Functional tokens are the primary vocabulary** — classes name the *job*, not the tone, and\nevery one remaps automatically under \\`:root[data-brx-theme=\"dark\"]\\` (background/text ends\nswap; \\`solid\\` fills stay mode-stable with a computed \\`on-\\` foreground). Prefer these over\nraw steps. Rules (role ∈ ${code(roles)}):\n\n- **Surfaces** — \\`bg-<role>\\` (the role's background wash; for \\`surface\\` this is the\n card/panel plane), \\`bg-<role>-muted\\` (subtle / sunken), \\`bg-surface-bold\\` (raised plane).\n- **Solid fills** — \\`bg-<role>-solid\\`, \\`bg-<role>-solid-bold\\` (hover / emphasis), paired\n with \\`text-on-<role>\\` for guaranteed-contrast foreground.\n- **Content** — \\`text-<role>\\` (primary, contrast-guaranteed in both appearances),\n \\`text-<role>-muted\\` (secondary), \\`text-<role>-x-muted\\` (tertiary / disabled).\n- **Borders** — \\`border-<role>\\`, \\`border-<role>-bold\\`.\n- **Translucency** — \\`glass\\` (translucent surface + backdrop blur); \\`--overlay\\` scrim var.\n- **Emphasis stops** (appearance-relative vars for power use):\n \\`--color-<role>-{x-muted,muted,bold,x-bold}\\` — \\`muted\\` recedes toward the background\n extreme, \\`bold\\` advances toward the foreground, in *either* appearance.\n\nEveryday pairings: page \\`bg-neutral\\` + \\`text-neutral\\`; cards \\`bg-surface\\`; captions\n\\`text-neutral-muted\\`; buttons \\`bg-ui-primary-solid text-on-ui-primary\\`; status text\n\\`text-danger\\` / \\`text-success\\` / \\`text-warning\\` / \\`text-info\\`.\n\n**Raw scale** (secondary / fine control) — rule \\`<util>-<hue>-<step>\\` with util ∈\n${code(utils)}: every hue is an 11-step OKLCH scale generated from its seed (or fixed brand\ntones), numeric steps \\`50\\` … \\`950\\` (tinted near-white → tinted near-black) — e.g.\n\\`bg-${ramps[0] ?? 'brand'}-100\\`, \\`text-${ramps[0] ?? 'brand'}-800\\`. Hues: ${code(ramps)}.\nThe **bare** role name (\\`bg-<role>\\`, \\`text-<role>\\`) is always the functional token.\n\n## Shadows\n\nRule: **\\`drop-shadow-<size>\\`** — size ∈ ${code(shadows)} (applied as a \\`filter\\`, so it\nfollows non-rectangular shapes).\n\n## Animation\n\nRule: **\\`<effect>\\`** (with the state/flip prefixes above) — effect ∈ ${code(effects)}.\nComposed **journeys** chain multiple effects into one entrance: rule \\`<parts>-journey\\`\n(e.g. \\`fade-slide-journey\\`, \\`fade-scale-blur-journey\\`). All require \\`transition\\` on the\nelement; scroll-linked entrances resolve within the first portion of the element's scroll.\n\n## Component patterns\n\nEach pattern is a base class \\`<pattern>\\` with interaction states (hover/active/focus-visible)\nbaked in; coloured patterns add role variants via rule **\\`<pattern>-<role>\\`**.\n\n- Patterns: ${code(patterns)}.\n- Roles (for coloured patterns like \\`badge\\`, \\`tag\\`, \\`status\\`, \\`button\\`):\n ${code(patternRoles)} — e.g. \\`badge-success\\`, \\`button-danger\\`. The default (unsuffixed)\n variant uses the brand-primary role.\n- Shape primitives: \\`--br-<name>\\` radii — ${code(radii)}.\n`;\n}\n\n// ── Reserved index.md listings (no frontmatter) ──────────────────────────────\nfunction renderTopIndex(): string {\n return `${INDEX_NOTE}\n\n# Vitops design system\n\nLLM-oriented documentation bundle (Open Knowledge Format) for the Vitops design system — a\nvariable-driven CSS framework plus progressively-enhanced web components, generated from\n\\`design-system.json\\` and published alongside the deployed theme.\n\n# Contents\n\n* [CSS framework](css/) - the class vocabulary (colour, type, space, layout, animation, component patterns), stated as naming rules\n* [Bricks Builder](bricks/) - custom elements and how to style them\n`;\n}\n\nfunction renderCssIndex(): string {\n return `${INDEX_NOTE}\n\n# CSS framework\n\n# Contents\n\n* [Class vocabulary](classes.md) - every utility and component class, summarized by naming rule\n`;\n}\n\nfunction renderBricksIndex(): string {\n return `${INDEX_NOTE}\n\n# Bricks Builder integration\n\n# Styling\n\nPrefer adding the framework **CSS classes** — see [/css/classes.md](../css/classes.md) — in a\nBricks element's \"CSS classes\" field over hand-setting spacing, colour, or typography through\nthe Bricks Builder property panels. The classes encode the design system's tokens, responsive\ngrammar, and interaction states, so they stay consistent, respond to theme / dark mode, and\nupdate with the system. Values typed directly into Bricks' property controls are one-off,\ndrift from the system, and don't react to theme changes — reserve them for genuinely bespoke,\none-element cases.\n\n# Contents\n\n* [Elements reference](elements.md) - every custom Vitops element, its controls, defaults, seeded children and keywords\n* [Class vocabulary](../css/classes.md) - the framework CSS classes to apply to elements\n`;\n}\n\n/**\n * Build the OKF docs bundle for a config. Returns a `{ relPath: content }` map;\n * the caller writes it wherever the bundle should live (e.g. `<outDir>/docs`).\n */\nexport function generateDocs(ds: DesignSystem, assetsDir: string): Record<string, string> {\n const elementsDir = join(assetsDir, 'bricks', 'elements');\n return {\n 'index.md': renderTopIndex(),\n 'css/index.md': renderCssIndex(),\n 'css/classes.md': renderCssClasses(ds),\n 'bricks/index.md': renderBricksIndex(),\n 'bricks/elements.md': renderElementsDoc(elementsDir),\n };\n}\n","/**\n * Pure, parameterized port of the Vitops design-system generator.\n *\n * `generate({ input, format, outDir })` reads a consumer's `design-system.json`,\n * validates it, and emits consumer-ready output for the chosen format into\n * `outDir`. Unlike the original CWD-bound script it mutates no shared state: every\n * generated token layer is built in memory and either bundled (css/bricks) or\n * inlined (tailwind) before writing.\n *\n * Framework-static assets (the hand-written CSS partials, the Bricks PHP + loader,\n * and the pre-built JS bundles) live under `assets/` in this package and are read /\n * copied from there — they are the same for every consumer.\n */\nimport { readFileSync, writeFileSync, mkdirSync, cpSync, existsSync, readdirSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createHash } from 'node:crypto';\nimport { transform } from 'lightningcss';\nimport { validate, type DesignSystem } from './schema.ts';\nimport { generateDocs } from './docs.ts';\nimport {\n expandPalette,\n functionalRole,\n NUMERIC_STEPS,\n type ExpandedHue,\n type FunctionalRole,\n} from './tokens.ts';\n\nexport type Format = 'bricks' | 'css' | 'tailwind';\n\nexport interface GenerateOptions {\n /** Path to a design-system.json, OR an already-parsed config object. */\n input: string | DesignSystem;\n /** Output target. Default: 'bricks'. */\n format?: Format;\n /** Directory to write outputs into. Default: 'dist'. */\n outDir?: string;\n /** Override the framework asset root (advanced/testing). */\n assetsDir?: string;\n}\n\nexport interface GenerateResult {\n format: Format;\n outDir: string;\n written: string[];\n}\n\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst DEFAULT_ASSETS = join(HERE, '..', 'assets');\n\n// ── colour machinery ─────────────────────────────────────────────────────────\n// Every hue is an 11-step numeric OKLCH scale (see tokens.ts); every role is a\n// hue reference that resolves to FUNCTIONAL tokens. No named steps, no scheme\n// grammar — dark mode is the automatic functional flip.\nconst UTILITY_PROPS: Record<string, string> = {\n bg: 'background-color',\n text: 'color',\n border: 'border-color',\n outline: 'outline-color',\n fill: 'fill',\n stroke: 'stroke',\n};\n\n// Functional-token var name: emphasis stops live in the --color-* namespace\n// (`stop-x-muted` → --color-<role>-x-muted); everything else is --<role>-<token>.\nconst fnVar = (role: string, token: string): string =>\n token.startsWith('stop-') ? `--color-${role}-${token.slice(5)}` : `--${role}-${token}`;\n// The functional utility classes for one role (bare name = functional default).\nconst fnUtilities = (role: string, utilities: string[], isSurface: boolean): string => {\n const rows: string[] = [];\n if (utilities.includes('bg')) {\n rows.push(`.bg-${role} { background-color: var(--${role}-bg); }`);\n rows.push(`.bg-${role}-muted { background-color: var(--${role}-bg-muted); }`);\n rows.push(`.bg-${role}-solid { background-color: var(--${role}-solid); }`);\n rows.push(`.bg-${role}-solid-bold { background-color: var(--${role}-solid-bold); }`);\n if (isSurface) rows.push(`.bg-${role}-bold { background-color: var(--${role}-bg-bold); }`);\n }\n if (utilities.includes('text')) {\n rows.push(`.text-${role} { color: var(--${role}-text); }`);\n rows.push(`.text-${role}-muted { color: var(--${role}-text-muted); }`);\n rows.push(`.text-${role}-x-muted { color: var(--${role}-text-x-muted); }`);\n rows.push(`.text-on-${role} { color: var(--${role}-on-solid); }`);\n }\n if (utilities.includes('border'))\n rows.push(\n `.border-${role} { border-color: var(--${role}-border); }`,\n `.border-${role}-bold { border-color: var(--${role}-border-bold); }`,\n );\n return rows.join('\\n');\n};\n\nconst decls = (obj: Record<string, string>, indent = ' ') =>\n Object.entries(obj)\n .map(([k, v]) => `${indent}${k}: ${v};`)\n .join('\\n');\n\n// ── fluid modular scale ───────────────────────────────────────────────────────\ninterface ScaleConfig {\n base: string;\n ratio: number;\n steps?: number;\n names?: string[];\n baseStep?: number;\n baseline?: string;\n fluid?: { minVw: string; maxVw: string; minRatio: number };\n}\ninterface ScaleStep {\n name: string;\n value: string;\n max: string;\n offset: number;\n}\nconst round = (n: number) => Number(n.toFixed(4)).toString();\nconst rem = (v: string) => parseFloat(v);\nconst buildScale = (s: ScaleConfig): ScaleStep[] => {\n const names = s.names ?? Array.from({ length: s.steps ?? 0 }, (_, i) => String(i + 1));\n const base = rem(s.base);\n const baseStep = s.baseStep ?? Math.ceil(names.length / 2);\n const baselineIdx = s.baseline ? names.indexOf(s.baseline) : baseStep - 1;\n return names.map((name, i) => {\n const k = i - (baseStep - 1);\n const vMax = base * Math.pow(s.ratio, k);\n const max = `${round(vMax)}rem`;\n let value = max;\n if (s.fluid) {\n const { minVw, maxVw, minRatio } = s.fluid;\n const vMin = base * Math.pow(minRatio, k);\n const lo = Math.min(vMin, vMax);\n const hi = Math.max(vMin, vMax);\n if (lo !== hi) {\n const slope = (vMax - vMin) / (rem(maxVw) - rem(minVw));\n const intercept = vMin - slope * rem(minVw);\n const sign = slope < 0 ? '-' : '+';\n const pref = `calc(${round(intercept)}rem ${sign} ${round(Math.abs(slope * 100))}vw)`;\n value = `clamp(${round(lo)}rem, ${pref}, ${round(hi)}rem)`;\n }\n }\n return { name, value, max, offset: i - baselineIdx };\n });\n};\n\n// ── typography ─────────────────────────────────────────────────────────────────\ninterface TypographyRole {\n family?: string;\n [key: string]: string | number | undefined;\n}\nconst TYPO_KEYMAP: Record<string, [string, string]> = {\n family: ['font-family', 'ff'],\n size: ['font-size', 'fs'],\n weight: ['font-weight', 'fw'],\n style: ['font-style', 'fst'],\n 'line-height': ['line-height', 'lh'],\n tracking: ['letter-spacing', 'ls'],\n 'text-decoration': ['text-decoration', 'td'],\n 'text-transform': ['text-transform', 'tt'],\n 'text-wrap': ['text-wrap', 'tw'],\n color: ['color', 'color'],\n};\nconst TYPO_IDENTITY: Record<string, string> = {\n 'font-style': 'normal',\n 'letter-spacing': 'normal',\n 'text-decoration': 'none',\n 'text-transform': 'none',\n 'text-wrap': 'wrap',\n};\n\n// ── animation state defaults ─────────────────────────────────────────────────\nconst STATE_DEFAULT: Record<string, string> = {\n opacity: '1',\n 'translate-x': '0',\n 'translate-y': '0',\n 'scale-x': '1',\n 'scale-y': '1',\n rotate: '0deg',\n blur: '0px',\n shadow: '0 0 0 transparent',\n brightness: '1',\n grayscale: '0',\n contrast: '1',\n saturate: '1',\n sepia: '0',\n 'hue-rotate': '0deg',\n clip: 'none',\n};\n\n// Pattern base geometry props → override-hook shorthand.\nconst BASE_HOOK: Record<string, string> = {\n padding: 'p',\n 'border-radius': 'br',\n border: 'b',\n 'box-shadow': 'ds',\n 'font-size': 'fs',\n};\n\ninterface Pattern {\n group?: string;\n overrides?: Record<string, string>;\n element?: string;\n class?: string;\n default_role?: string;\n base?: Record<string, string>;\n states?: Record<string, Record<string, unknown>>;\n roles?: string[];\n}\n\nconst id = (key: string) => createHash('sha256').update(key).digest('hex').slice(0, 6);\n\n/**\n * The in-memory output of building a design system. String fields are CSS/JSON\n * ready to write; the generated CSS partials feed the css/bricks bundler.\n */\ninterface Built {\n generated: Record<string, string>; // filename (under generated/) -> css\n bricksColorsNamed: string;\n bricksColorsSemantic: string;\n bricksVariables: string;\n tokensJson: string;\n designManifest: string;\n tailwind: string;\n // captured for the tailwind bundler\n twTypeTokensCss: string;\n twPatternTokensCss: string;\n patternsCss: string;\n}\n\nfunction build(ds: DesignSystem, format: Format, assetsDir: string): Built {\n const BRICKS = format === 'bricks';\n // Every hue expands to its 11-step numeric OKLCH scale; every role resolves\n // to functional tokens over its hue. Dark mode is the automatic flip.\n const expandedPalette = expandPalette(ds.colors.palette as Record<string, unknown>);\n const roleMap = ds.colors.roles as Record<string, string>;\n const scaleRoles: FunctionalRole[] = [];\n for (const [role, hueName] of Object.entries(roleMap)) {\n const hue = expandedPalette[hueName];\n if (hue == null) throw new Error(`role \"${role}\" references unknown palette hue \"${hueName}\"`);\n scaleRoles.push(functionalRole(role, hueName, hue));\n }\n const surfaceRole = scaleRoles.find((r) => r.role === 'surface');\n const patterns = ds.patterns;\n const shadows = ds.shadows;\n const typography = ds.typography;\n const UTILITIES = (ds.colors.utilities ?? ['bg', 'text', 'border']).filter(\n (u) => u in UTILITY_PROPS,\n );\n\n const generated: Record<string, string> = {};\n\n // ── color.css ──────────────────────────────────────────────────────────────\n if (BRICKS) {\n generated['color.css'] =\n '/* Colours provided by Bricks (palette import generates tokens + utilities). */\\n';\n } else {\n let css = `/* GENERATED from design-system.json — do not edit by hand. */\\n:root {\\n`;\n css += ` color-scheme: light;\\n`;\n css += ` /* Hue scales (numeric steps, 50 = tinted near-white … 950 = tinted near-black) */\\n`;\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric))\n css += ` --color-${name}-${n}: ${hex};\\n`;\n css += `\\n /* Functional role tokens (the public API) */\\n`;\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.light)) css += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n if (surfaceRole) {\n css += `\\n /* Translucent surface + scrim */\\n`;\n css += ` --surface-glass: color-mix(in oklch, var(--surface-bg) 72%, transparent);\\n`;\n css += ` --overlay: color-mix(in oklch, var(--color-${surfaceRole.hue}-950) 45%, transparent);\\n`;\n }\n css += `}\\n\\n`;\n // Dark appearance: the automatic functional flip (solid stays mode-stable).\n {\n let fb = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.dark))\n if (fr.light[t] !== val) fb += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n if (surfaceRole)\n fb += ` --overlay: color-mix(in oklch, var(--color-${surfaceRole.hue}-950) 60%, transparent);\\n`;\n if (fb) {\n css += `/* Functional role tokens (dark) */\\n`;\n css += `:root[data-brx-theme=\"dark\"] {\\n color-scheme: dark;\\n${fb}}\\n\\n`;\n }\n }\n // Utilities: hue numeric steps + role emphasis stops, then the functional\n // set (emitted last so it wins ties, e.g. bg-<role>-muted).\n const allTokens: string[] = [];\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const n of Object.keys(hue.numeric)) allTokens.push(`${name}-${n}`);\n for (const fr of scaleRoles)\n for (const stop of ['x-muted', 'muted', 'bold', 'x-bold'])\n allTokens.push(`${fr.role}-${stop}`);\n css += `/* Colour utilities — ${UTILITIES.join(', ')} */\\n`;\n for (const token of allTokens)\n css +=\n UTILITIES.map(\n (cls) => `.${cls}-${token} { ${UTILITY_PROPS[cls]}: var(--color-${token}); }`,\n ).join('\\n') + '\\n';\n css += `\\n/* Functional utilities (the public API) */\\n`;\n for (const fr of scaleRoles)\n css += `${fnUtilities(fr.role, UTILITIES, fr.role === 'surface')}\\n`;\n if (surfaceRole)\n css += `.glass { background-color: var(--surface-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }\\n`;\n generated['color.css'] = css;\n }\n\n // ── shadows.css ──────────────────────────────────────────────────────────────\n {\n const entries = Object.entries(shadows ?? {});\n let sh = `/* GENERATED drop-shadow tokens + utilities — do not edit by hand. */\\n`;\n if (entries.length) {\n sh += `:root {\\n`;\n for (const [name, value] of entries) sh += ` --shadow-${name}: ${value};\\n`;\n sh += `}\\n\\n`;\n for (const [name] of entries)\n sh += `.drop-shadow-${name} { filter: drop-shadow(var(--shadow-${name})); }\\n`;\n }\n generated['shadows.css'] = sh;\n }\n\n // ── scales ───────────────────────────────────────────────────────────────────\n const typeSteps = ds.typeScale ? buildScale(ds.typeScale as ScaleConfig) : [];\n const spaceSteps = ds.spaceScale ? buildScale(ds.spaceScale as ScaleConfig) : [];\n const textMax: Record<string, string> = Object.fromEntries(\n typeSteps.map((s) => [`text-${s.name}`, s.max]),\n );\n\n const typographyFamilies = typography?.families ?? {};\n const withScaleFallback = (v: string) =>\n v.replace(/var\\(\\s*(--text-[\\w-]+)\\s*\\)/g, (m, name) =>\n textMax[name.slice(2)] ? `var(${name}, ${textMax[name.slice(2)]})` : m,\n );\n const roleDecls = (role: string, spec: TypographyRole): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [key, [prop, sfx]] of Object.entries(TYPO_KEYMAP)) {\n const identity = TYPO_IDENTITY[prop];\n if (spec[key] == null && identity == null) continue;\n const raw =\n spec[key] == null\n ? (identity as string)\n : key === 'family'\n ? (typographyFamilies[spec.family as string] ?? String(spec.family))\n : key === 'size'\n ? withScaleFallback(String(spec[key]))\n : String(spec[key]);\n out[prop] = `var(--${role}-${sfx}, ${raw})`;\n }\n return out;\n };\n\n // ── type-tokens.css ──────────────────────────────────────────────────────────\n let twTypeTokensCss = '';\n if (BRICKS) {\n generated['type-tokens.css'] =\n '/* Fonts + type/space scales provided by Bricks (Font + Variables managers). */\\n';\n } else {\n const root: Record<string, string> = {};\n for (const [name, stack] of Object.entries(ds.fonts ?? {})) root[`--font-${name}`] = stack;\n for (const s of typeSteps) root[`--text-${s.name}`] = s.value;\n for (const s of spaceSteps) root[`--space-${s.name}`] = s.value;\n const css = `/* GENERATED font families + fluid type/space scales — do not edit by hand. */\\n:root {\\n${decls(root)}\\n}\\n`;\n twTypeTokensCss = css;\n generated['type-tokens.css'] = css;\n }\n\n // ── tokens.css (pattern token cascade) ───────────────────────────────────────\n let twPatternTokensCss = '';\n {\n const tDefaults = patterns?.defaults ?? {};\n const tRadii = patterns?.radii ?? {};\n const tGroups = patterns?.groups ?? {};\n const tZ = patterns?.z ?? {};\n const tItems = (patterns?.items ?? {}) as Record<string, Pattern>;\n const root: Record<string, string> = {};\n for (const [prop, val] of Object.entries(tDefaults)) root[`--${prop}-default`] = val;\n if (!BRICKS) for (const [name, val] of Object.entries(tRadii)) root[`--br-${name}`] = val;\n for (const [group, props] of Object.entries(tGroups))\n for (const [prop, val] of Object.entries(props)) root[`--${prop}-${group}`] = val;\n for (const [name, n] of Object.entries(tZ)) root[`--z-tier-${name}`] = String(n);\n const aliases: Record<string, string> = {};\n for (const [name, p] of Object.entries(tItems)) {\n if (!p.group) continue;\n for (const prop of Object.keys(tGroups[p.group] ?? {}))\n aliases[`--${prop}-${name}-group`] = `var(--${prop}-${p.group})`;\n for (const [prop, val] of Object.entries(p.overrides ?? {}))\n aliases[`--${prop}-${name}-group`] = val;\n }\n let tok = `/* GENERATED pattern token cascade — do not edit by hand. */\\n:root {\\n`;\n tok += decls(root) + '\\n';\n if (Object.keys(aliases).length) tok += '\\n' + decls(aliases) + '\\n';\n tok += `}\\n`;\n twPatternTokensCss = tok;\n generated['tokens.css'] = tok;\n }\n\n // ── typography.css (.font-* roles) ───────────────────────────────────────────\n {\n const roles = (typography?.roles ?? {}) as Record<string, TypographyRole>;\n const headings = typography?.headings ?? {};\n let typo = `/* GENERATED typography roles — do not edit by hand. */\\n`;\n for (const [role, spec] of Object.entries(roles))\n typo += `.font-${role} {\\n${decls(roleDecls(role, spec))}\\n}\\n`;\n for (const [tag, role] of Object.entries(headings))\n if (roles[role]) typo += `${tag} {\\n${decls(roleDecls(role, roles[role]))}\\n}\\n`;\n generated['typography.css'] = typo;\n }\n\n // ── patterns.css (component interaction patterns) ────────────────────────────\n const stateRules = (\n sel: string,\n role: string | null,\n states: Record<string, Record<string, unknown>>,\n colorProp: 'background-color' | 'color' = 'background-color',\n ) => {\n let out = '';\n for (const [state, spec] of Object.entries(states)) {\n const body: string[] = [];\n // `step` intensifies the pattern's colour: fills swap solid → solid-bold;\n // text swaps the bold emphasis stop → x-bold.\n if (typeof spec.step === 'number' && role) {\n const stateVar =\n colorProp === 'background-color'\n ? `var(--${role}-${spec.step >= 1 ? 'solid-bold' : 'solid'})`\n : `var(--color-${role}-${spec.step >= 1 ? 'x-bold' : 'bold'})`;\n body.push(`${colorProp}: ${stateVar};`);\n }\n if (typeof spec.scale === 'number') body.push(`scale: ${spec.scale};`);\n if (typeof spec.lift === 'string') body.push(`translate: 0 calc(-1 * ${spec.lift});`);\n if (typeof spec.shadow === 'string' && shadows?.[spec.shadow])\n body.push(`filter: drop-shadow(var(--shadow-${spec.shadow}));`);\n else if (spec.shadow === true)\n body.push(`box-shadow: var(--lift-shadow, 0 8px 20px -6px rgb(0 0 0 / 0.25));`);\n if (spec.ring === true) {\n const ringColor = role ? `var(--color-${role}-muted)` : `var(--color-ui-primary-muted)`;\n body.push(`outline: none;`, `box-shadow: 0 0 0 3px ${ringColor};`);\n }\n if (spec.css && typeof spec.css === 'object')\n for (const [k, v] of Object.entries(spec.css as Record<string, string>))\n body.push(`${k}: ${v};`);\n if (!body.length) continue;\n const pseudo =\n state === 'hover'\n ? ':hover'\n : state === 'active'\n ? ':active'\n : state === 'focus-visible'\n ? ':focus-visible'\n : `:${state}`;\n const rule = `${sel}${pseudo} {\\n ${body.join('\\n ')}\\n}\\n`;\n out += state === 'hover' ? `@media (hover: hover) {\\n${rule}}\\n` : rule;\n }\n return out;\n };\n\n let pat = `/* GENERATED component patterns — do not edit by hand. */\\n`;\n pat += `/* Interaction transitions for patterned elements (independent props compose). */\\n`;\n for (const [pname, p] of Object.entries((patterns?.items ?? {}) as Record<string, Pattern>)) {\n if (!p.base) continue;\n const states = p.states ?? {};\n const isElement = !!p.element;\n const defaultSel = isElement ? `:where(${p.element})` : `.${p.class ?? pname}`;\n const defaultRole = p.default_role ?? null;\n const base = { ...p.base };\n const fills =\n pname === 'button' ||\n pname === 'badge' ||\n base['background-color'] != null ||\n base['background'] != null;\n const colorProp: 'background-color' | 'color' = fills ? 'background-color' : 'color';\n pat += `${defaultSel} {\\n`;\n const hasStates = Object.keys(states).length > 0;\n if (hasStates) {\n pat += ` transition-property: translate, scale, rotate, filter, box-shadow, background-color, color;\\n`;\n pat += ` transition-duration: var(--interact-duration, 200ms);\\n`;\n pat += ` transition-timing-function: var(--interact-easing, ease);\\n`;\n pat += ` translate: 0 0; scale: 1; rotate: 0deg;\\n`;\n }\n if (defaultRole && fills && base['background-color'] == null && base['background'] == null)\n base['background-color'] = `var(--${defaultRole}-solid)`;\n const wrappedBase: Record<string, string> = {};\n for (const [prop, val] of Object.entries(base)) {\n const sfx = BASE_HOOK[prop];\n wrappedBase[prop] = sfx ? `var(--${sfx}-${pname}, ${val})` : String(val);\n }\n pat += decls(wrappedBase) + '\\n}\\n';\n pat += stateRules(defaultSel, defaultRole, states, colorProp);\n for (const role of p.roles ?? []) {\n const variantSel = isElement ? `${p.element}.${role}` : `.${p.class ?? pname}-${role}`;\n // Fills sit on the role's solid + pair with on-solid; text variants use\n // the bold emphasis stop (readable accent in both appearances).\n const variantColorDecl = fills\n ? `background-color: var(--${role}-solid); color: var(--${role}-on-solid)`\n : `color: var(--color-${role}-bold)`;\n pat += `${variantSel} { ${variantColorDecl}; }\\n`;\n pat += stateRules(variantSel, role, states, colorProp);\n }\n pat += '\\n';\n }\n generated['patterns.css'] = pat;\n\n // ── animation-effects.css ────────────────────────────────────────────────────\n {\n const anim = ds.animations ?? {};\n const asStr = (v: string | number) => String(v);\n const block = (sel: string, d: Record<string, string>) => `.${sel} {\\n${decls(d)}\\n}\\n`;\n let out = `/* GENERATED animation effects + journeys — do not edit by hand. */\\n`;\n for (const [name, e] of Object.entries(anim.effects ?? {})) {\n const d: Record<string, string> = { '--_anim': e.kf };\n for (const [k, v] of Object.entries(e.css ?? {})) d[k] = asStr(v);\n for (const [k, v] of Object.entries(e.vars ?? {})) d[`--${k}`] = asStr(v);\n out += block(name, d);\n }\n const base = anim.journeys?.base ?? {};\n for (const parts of anim.journeys?.compose ?? []) {\n const d: Record<string, string> = {\n '--_anim': parts.map((p) => `${p}-journey`).join(', '),\n 'animation-range': 'entry exit',\n };\n for (const p of parts)\n for (const [k, v] of Object.entries(base[p] ?? {})) d[`--${k}`] = asStr(v);\n out += block(`${parts.join('-')}-journey`, d);\n }\n const STATES: [string, (s: string) => string][] = [\n ['hover', (s) => `.${s}:hover`],\n ['focus', (s) => `.${s}:focus-visible`],\n ['active', (s) => `.${s}.is-active, .${s}[data-active]`],\n ];\n out += `\\n/* State-flip variants — compose with .transition (hover-/focus-/active-<fx>). */\\n`;\n for (const [name, e] of Object.entries(anim.effects ?? {})) {\n if (e.kf !== 'composite' && e.kf !== 'paint') continue;\n const props: Record<string, { from?: string; to?: string }> = {};\n for (const [k, v] of Object.entries(e.vars ?? {})) {\n const m = /^(.*)-(from|to)$/.exec(k);\n if (m) (props[m[1] as string] ??= {})[m[2] as 'from' | 'to'] = asStr(v);\n }\n const rest: Record<string, string> = {};\n for (const [p, ft] of Object.entries(props)) {\n if (ft.from != null && ft.from !== STATE_DEFAULT[p]) rest[`--${p}-from`] = ft.from;\n if (ft.to != null && ft.to !== STATE_DEFAULT[p]) rest[`--${p}-to`] = ft.to;\n }\n const flip: Record<string, string> = Object.fromEntries(\n Object.keys(props).map((p) => [`--t-${p}`, `var(--${p}-to, ${STATE_DEFAULT[p]})`]),\n );\n if (Object.keys(rest).length)\n out += `${STATES.map(([s]) => `.${s}-${name}`).join(', ')} {\\n${decls(rest)}\\n}\\n`;\n for (const [s, sel] of STATES) out += `${sel(`${s}-${name}`)} {\\n${decls(flip)}\\n}\\n`;\n }\n generated['animation-effects.css'] = out;\n }\n\n // ── Bricks palettes ──────────────────────────────────────────────────────────\n // Named = the hue scales (numeric steps); Semantic = the functional role\n // tokens with their automatic light/dark pairing.\n const namedColors: unknown[] = [];\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric)) {\n const token = `${name}-${n}`;\n namedColors.push({\n raw: `var(--color-${token})`,\n light: hex,\n id: id(`named:${token}`),\n utilityClasses: UTILITIES,\n });\n }\n const semanticColors: unknown[] = [];\n for (const fr of scaleRoles)\n for (const [t, light] of Object.entries(fr.light)) {\n const dark = fr.dark[t] as string;\n semanticColors.push({\n raw: `var(${fnVar(fr.role, t)})`,\n light,\n darkModeEnabled: light !== dark,\n dark,\n id: id(`semantic:${fr.role}-${t}`),\n utilityClasses: UTILITIES,\n });\n }\n const bricksColorsNamed = JSON.stringify(\n { id: id('palette:named'), name: 'Named', colors: namedColors },\n null,\n 2,\n );\n const bricksColorsSemantic = JSON.stringify(\n { id: id('palette:semantic'), name: 'Semantic', colors: semanticColors },\n null,\n 2,\n );\n\n // ── Bricks Global Variables (fonts + scales) ─────────────────────────────────\n const bricksVariables = (() => {\n type BrxScale = { scale: number; scaleName: string };\n type BrxVar = { id: string; name: string; value: string; category?: string; scale?: BrxScale };\n type BrxCat = { id: string; name: string; scale: Record<string, unknown>; utilityClasses: [] };\n const scaleMeta = (scope: string, prefix: string, s: ScaleConfig, names: string[]) => {\n const px = Math.round(rem(s.base) * 16);\n const lo = s.fluid?.minRatio ?? s.ratio;\n return {\n scaleScope: scope,\n scaleType: 'tshirt',\n scaleNames: names,\n prefix,\n minFontSize: px,\n minScaleRatio: lo,\n minScaleRatioSelect: lo,\n maxFontSize: px,\n maxScaleRatio: s.ratio,\n maxScaleRatioSelect: s.ratio,\n baseline: s.baseline ?? names[Math.floor((names.length - 1) / 2)],\n };\n };\n const categories: BrxCat[] = [];\n const variables: BrxVar[] = [];\n const addScale = (\n label: string,\n scope: string,\n prefix: string,\n cfg: ScaleConfig | undefined,\n steps: ScaleStep[],\n ) => {\n if (!cfg || !steps.length) return;\n const names = steps.map((s) => s.name);\n const catId = id(`varcat:${scope}`);\n categories.push({\n id: catId,\n name: label,\n scale: scaleMeta(scope, prefix, cfg, names),\n utilityClasses: [],\n });\n for (const st of steps)\n variables.push({\n id: id(`var:${prefix}${st.name}`),\n name: `${prefix}${st.name}`,\n value: st.value,\n category: catId,\n scale: { scale: st.offset, scaleName: st.name },\n });\n };\n addScale('Typography', 'typography', 'text-', ds.typeScale as ScaleConfig, typeSteps);\n addScale('Spacing', 'spacing', 'space-', ds.spaceScale as ScaleConfig, spaceSteps);\n for (const [name, stack] of Object.entries(ds.fonts ?? {}))\n variables.push({ id: id(`var:font-${name}`), name: `font-${name}`, value: stack });\n for (const [name, val] of Object.entries(ds.patterns?.radii ?? {}))\n variables.push({ id: id(`var:br-${name}`), name: `br-${name}`, value: val });\n return JSON.stringify({ variables, categories }, null, 2);\n })();\n\n // ── tokens.json (trimmed token export for programmatic consumers) ────────────\n const numericPalette = Object.fromEntries(\n Object.entries(expandedPalette).map(([k, v]) => [k, v.numeric]),\n );\n const tokensJson = JSON.stringify(\n {\n colors: {\n palette: numericPalette,\n roles: roleMap,\n functional: Object.fromEntries(\n scaleRoles.map((fr) => [fr.role, { light: fr.light, dark: fr.dark }]),\n ),\n },\n fonts: ds.fonts ?? {},\n text: Object.fromEntries(typeSteps.map((s) => [s.name, s.value])),\n spacing: Object.fromEntries(spaceSteps.map((s) => [s.name, s.value])),\n shadows: shadows ?? {},\n radii: ds.patterns?.radii ?? {},\n },\n null,\n 2,\n );\n\n // ── design-manifest.json (live-editor manifest; css format) ──────────────────\n const designManifest = (() => {\n const reverseIndex: Record<string, string> = {};\n // Numeric steps are generated from the hue's seed — edits map back to it.\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const n of Object.keys(hue.numeric))\n reverseIndex[`--color-${name}-${n}`] = `colors.palette.${name}.seed`;\n const colorRoles = Object.entries(roleMap).map(([name, ramp]) => ({ name, ramp }));\n const typoRoles = (typography?.roles ?? {}) as Record<string, TypographyRole>;\n const hooks: Record<string, { prop: string; key: string }> = {};\n for (const [key, [prop, sfx]] of Object.entries(TYPO_KEYMAP)) hooks[sfx] = { prop, key };\n for (const [role, spec] of Object.entries(typoRoles))\n for (const [key, [, sfx]] of Object.entries(TYPO_KEYMAP))\n if (spec[key] != null) reverseIndex[`--${role}-${sfx}`] = `typography.roles.${role}.${key}`;\n const pDefaults = patterns?.defaults ?? {};\n const pRadii = patterns?.radii ?? {};\n const pGroups = patterns?.groups ?? {};\n const pItems = (patterns?.items ?? {}) as Record<string, Pattern>;\n for (const prop of Object.keys(pDefaults))\n reverseIndex[`--${prop}-default`] = `patterns.defaults.${prop}`;\n for (const name of Object.keys(pRadii)) reverseIndex[`--br-${name}`] = `patterns.radii.${name}`;\n for (const [group, props] of Object.entries(pGroups))\n for (const prop of Object.keys(props))\n reverseIndex[`--${prop}-${group}`] = `patterns.groups.${group}.${prop}`;\n const items = Object.entries(pItems).map(([name, p]) => {\n const base = p.base ?? {};\n const wrappable = Object.keys(base)\n .filter((prop) => prop in BASE_HOOK)\n .map((prop) => ({ sfx: BASE_HOOK[prop] as string, prop }));\n for (const { sfx, prop } of wrappable)\n reverseIndex[`--${sfx}-${name}`] = `patterns.items.${name}.base.${prop}`;\n return { name, group: p.group ?? null, base, wrappable, roles: p.roles ?? [] };\n });\n return JSON.stringify(\n {\n colors: {\n ramps: Object.keys(expandedPalette),\n steps: NUMERIC_STEPS,\n palette: numericPalette,\n roles: colorRoles,\n },\n typography: {\n roles: Object.keys(typoRoles),\n hooks,\n families: typographyFamilies,\n specs: typoRoles,\n },\n scales: {\n text: typeSteps.map((s) => ({ name: s.name, value: s.value, max: s.max })),\n space: spaceSteps.map((s) => ({ name: s.name, value: s.value, max: s.max })),\n },\n fonts: ds.fonts ?? {},\n patterns: { defaults: pDefaults, radii: pRadii, groups: pGroups, items },\n shadows: shadows ?? {},\n interaction: { duration: '200ms', easing: 'ease' },\n reverseIndex,\n },\n null,\n 2,\n );\n })();\n\n // ── Tailwind bundle ──────────────────────────────────────────────────────────\n const tailwind = emitTailwind({\n ds,\n expandedPalette,\n scaleRoles,\n shadows,\n typeSteps,\n spaceSteps,\n typography,\n roleDecls,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss: pat,\n assetsDir,\n });\n\n return {\n generated,\n bricksColorsNamed,\n bricksColorsSemantic,\n bricksVariables,\n tokensJson,\n designManifest,\n tailwind,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss: pat,\n };\n}\n\n// ── Tailwind emitter ──────────────────────────────────────────────────────────\ninterface TwCtx {\n ds: DesignSystem;\n expandedPalette: Record<string, ExpandedHue>;\n scaleRoles: FunctionalRole[];\n shadows: Record<string, string> | undefined;\n typeSteps: ScaleStep[];\n spaceSteps: ScaleStep[];\n typography: DesignSystem['typography'];\n roleDecls: (role: string, spec: TypographyRole) => Record<string, string>;\n twTypeTokensCss: string;\n twPatternTokensCss: string;\n patternsCss: string;\n assetsDir: string;\n}\n\nfunction emitTailwind(ctx: TwCtx): string {\n const {\n ds,\n expandedPalette,\n scaleRoles,\n shadows,\n typeSteps,\n spaceSteps,\n typography,\n roleDecls,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss,\n assetsDir,\n } = ctx;\n const cssDir = join(assetsDir, 'css');\n const nl = (arr: string[]) => arr.filter(Boolean).join('\\n');\n const parts: string[] = [`/* GENERATED for Tailwind v4 (Astro) — do not edit by hand. */`];\n parts.push(`@import \"tailwindcss\";\\n`);\n\n const theme: string[] = [];\n theme.push(` /* Hue scales → bg-<hue>-<step> text-* border-* (numeric, 50…950) */`);\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric))\n theme.push(` --color-${name}-${n}: ${hex};`);\n theme.push(`\\n /* Fonts → font-* */`);\n for (const [name, stack] of Object.entries(ds.fonts ?? {}))\n theme.push(` --font-${name}: ${stack};`);\n theme.push(`\\n /* Fluid type scale → text-* */`);\n for (const s of typeSteps) theme.push(` --text-${s.name}: ${s.value};`);\n // Fluid space steps are NOT put in Tailwind's --spacing-* namespace: named\n // spacing keys shadow the size scales (e.g. `max-w-7xl` would resolve to\n // var(--spacing-7xl) ≈ 6rem and collapse layouts). They ship as --space-*\n // (matching the css format) in a plain :root below; use var(--space-<name>)\n // or the TW4 arbitrary form p-(--space-md). Numeric spacing (p-4 …) keeps\n // Tailwind's default --spacing multiplier.\n theme.push(`\\n /* Drop-shadows → shadow-* */`);\n for (const [name, value] of Object.entries(shadows ?? {}))\n theme.push(` --shadow-${name}: ${value};`);\n theme.push(`\\n /* Container breakpoints → @sm:/@md:/@lg:/@xl: */`);\n for (const [name, val] of [\n ['sm', '30rem'],\n ['md', '48rem'],\n ['lg', '64rem'],\n ['xl', '80rem'],\n ])\n theme.push(` --container-${name}: ${val};`);\n parts.push(`@theme {\\n${theme.join('\\n')}\\n}\\n`);\n\n if (spaceSteps.length)\n parts.push(\n `/* Fluid space scale — var(--space-<name>) or p-(--space-<name>) */\\n:root {\\n` +\n spaceSteps.map((s) => ` --space-${s.name}: ${s.value};`).join('\\n') +\n `\\n}\\n`,\n );\n\n // Functional role tokens (not --color-*, so a plain :root block — Tailwind\n // must not derive single-purpose utilities from them; the @utility set below\n // is the public API).\n if (scaleRoles.length) {\n let fn = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.light)) fn += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n const surface = scaleRoles.find((r) => r.role === 'surface');\n if (surface) {\n fn += ` --surface-glass: color-mix(in oklch, var(--surface-bg) 72%, transparent);\\n`;\n fn += ` --overlay: color-mix(in oklch, var(--color-${surface.hue}-950) 45%, transparent);\\n`;\n }\n parts.push(`/* Functional role tokens (the public API) */\\n:root {\\n${fn}}\\n`);\n }\n\n parts.push(\n `/* ── Framework tokens (consumed by the inlined components) ── */\\n` +\n `${twTypeTokensCss}\\n${twPatternTokensCss}`,\n );\n\n // Dark appearance: the automatic functional flip (solid stays mode-stable).\n let darkBlock = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.dark))\n if (fr.light[t] !== val) darkBlock += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n {\n const surface = scaleRoles.find((r) => r.role === 'surface');\n if (surface)\n darkBlock += ` --overlay: color-mix(in oklch, var(--color-${surface.hue}-950) 60%, transparent);\\n`;\n }\n if (darkBlock)\n parts.push(\n `/* Functional role tokens (dark) */\\n:root[data-brx-theme=\"dark\"] {\\n color-scheme: dark;\\n${darkBlock}}\\n`,\n );\n\n parts.push(\n `/* State variant for the active flip (hover/focus-visible are built in). */\\n` +\n `@custom-variant is-active (&.is-active, &[data-active]);\\n`,\n );\n\n const util: string[] = [];\n if (scaleRoles.length) {\n util.push(`/* Functional colour utilities (the public API) */`);\n for (const fr of scaleRoles)\n for (const row of fnUtilities(fr.role, ['bg', 'text', 'border'], fr.role === 'surface').split(\n '\\n',\n )) {\n const m = /^\\.([^ ]+) \\{ (.*) \\}$/.exec(row);\n if (m) util.push(`@utility ${m[1]} {\\n ${m[2]}\\n}`);\n }\n if (scaleRoles.some((r) => r.role === 'surface'))\n util.push(\n `@utility glass {\\n background-color: var(--surface-glass);\\n backdrop-filter: blur(12px);\\n -webkit-backdrop-filter: blur(12px);\\n}`,\n );\n }\n util.push(`/* Typography roles */`);\n for (const [role, spec] of Object.entries(\n (typography?.roles ?? {}) as Record<string, TypographyRole>,\n ))\n util.push(`@utility font-${role} {\\n${decls(roleDecls(role, spec))}\\n}`);\n util.push(`\\n/* Animation effects (pair with .transition or a driver) */`);\n const asStr = (v: string | number) => String(v);\n for (const [name, e] of Object.entries(ds.animations?.effects ?? {})) {\n const d: Record<string, string> = { '--_anim': e.kf };\n for (const [k, v] of Object.entries(e.css ?? {})) d[k] = asStr(v);\n for (const [k, v] of Object.entries(e.vars ?? {})) d[`--${k}`] = asStr(v);\n util.push(`@utility ${name} {\\n${decls(d)}\\n}`);\n if (e.kf !== 'composite' && e.kf !== 'paint') continue;\n const props = new Set<string>();\n for (const k of Object.keys(e.vars ?? {})) {\n const m = /^(.*)-(from|to)$/.exec(k);\n if (m) props.add(m[1] as string);\n }\n const flip = Object.fromEntries(\n [...props].map((p) => [`--t-${p}`, `var(--${p}-to, ${STATE_DEFAULT[p]})`]),\n );\n util.push(`@utility flip-${name} {\\n${decls(flip)}\\n}`);\n }\n util.push(`\\n/* Split — internal fractions (pair split with a ratio) */`);\n util.push(\n `@utility split {\\n display: flex;\\n` +\n ` & > * { flex: 1; }\\n` +\n ` & > :first-child { flex: var(--_split-a, 1); }\\n` +\n ` & > :last-child { flex: var(--_split-b, 1); }\\n}`,\n );\n const RATIOS: [number, number][] = [\n [1, 2],\n [2, 1],\n [1, 3],\n [3, 1],\n [1, 4],\n [4, 1],\n [2, 3],\n [3, 2],\n ];\n for (const [a, b] of RATIOS)\n util.push(`@utility split-${a}-${b} {\\n --_split-a: ${a};\\n --_split-b: ${b};\\n}`);\n util.push(`\\n/* Track placement (inside .centered) */`);\n for (const track of ['measure', 'breakout', 'spotlight', 'fullbleed'])\n util.push(`@utility ${track} {\\n grid-column: ${track};\\n}`);\n parts.push(util.join('\\n') + '\\n');\n\n // Structure mirrors layout.css (kept literal for parity with the original emitter).\n parts.push(`/* ── Structure (mirrors src/css/layout.css) ── */\n:root {\n --rhythm-scale: 1;\n --rhythm-base: calc(1rlh * var(--rhythm-scale));\n --rhythm-h-p: 0.4;\n --rhythm-p-p: 0.9;\n --rhythm-p-h: 1.6;\n --rhythm-h-h: 0.6;\n --rhythm-p-list: 0.5;\n --rhythm-list-p: 0.9;\n --rhythm-li-li: 0.3;\n --rhythm-text-media: 1.2;\n --rhythm-media-text: 1.2;\n --width-measure: 65ch;\n --width-breakout: 90ch;\n --width-spotlight: 120ch;\n --gutter: clamp(1rem, 4cqi, 3rem);\n}\n\nbody {\n container-type: inline-size;\n}\n\n/* Class-level structure rules live in \\`components\\` so track/spacing utilities\n (@layer utilities — later in the layer order) can override them; unlayered\n CSS would beat ALL layered utilities regardless of specificity (e.g.\n \\`.centered > *\\` pinning children to \\`measure\\` over \\`.spotlight\\`). */\n@layer components {\n.rhythm {\n display: flow-root;\n}\n.rhythm > * + * {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-p));\n}\n.rhythm > :where(h1, h2, h3, h4, h5, h6) + p {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-h-p));\n}\n.rhythm > p + :where(h1, h2, h3, h4, h5, h6) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-h));\n}\n.rhythm > :where(h1, h2, h3, h4, h5, h6) + :where(h1, h2, h3, h4, h5, h6) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-h-h));\n}\n.rhythm > p + :where(ul, ol) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-list));\n}\n.rhythm > :where(ul, ol) + p {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-list-p));\n}\n.rhythm :where(ul, ol) > li + li {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-li-li));\n}\n.rhythm > :where(p, h1, h2, h3, h4, h5, h6, ul, ol) + :where(figure, img, picture, video) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-text-media));\n}\n.rhythm > :where(figure, img, picture, video) + :where(p, h1, h2, h3, h4, h5, h6, ul, ol) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-media-text));\n}\n\n.centered {\n --_measure: min(var(--width-measure), 100% - var(--gutter) * 2);\n --_breakout: minmax(0, calc((var(--width-breakout) - var(--width-measure)) / 2));\n --_spotlight: minmax(0, calc((var(--width-spotlight) - var(--width-breakout)) / 2));\n position: relative;\n display: grid;\n grid-template-columns:\n [fullbleed-start] minmax(var(--gutter), 1fr)\n [spotlight-start] var(--_spotlight)\n [breakout-start] var(--_breakout)\n [measure-start] var(--_measure) [measure-end]\n var(--_breakout) [breakout-end]\n var(--_spotlight) [spotlight-end]\n minmax(var(--gutter), 1fr) [fullbleed-end];\n}\n.centered > * {\n grid-column: measure;\n}\n\n.region {\n padding-block: clamp(\n var(--region-space-min, 3rem),\n var(--region-space, 8vh),\n var(--region-space-max, 8rem)\n );\n}\n}\n`);\n\n // Same layering rationale as the structure block above.\n const animEngine = readFileSync(join(cssDir, 'animation.css'), 'utf8');\n parts.push(`/* ── Animation engine (animation.css) ── */\\n@layer components {\\n${animEngine}\\n}`);\n // Patterns live in Tailwind's `components` layer so single-purpose utilities\n // (@layer utilities — declared later in the layer order) override them, e.g.\n // `.text-on-ui-primary` beating the link pattern's element-level `a { color }`.\n // Unlayered CSS would win over ALL layered utilities regardless of specificity.\n parts.push(`/* ── Component patterns ── */\\n@layer components {\\n${patternsCss}\\n}`);\n\n // Component + structural partials: the full framework library, minus the\n // Tailwind-owned utility layer. Sourced live from the CSS partials (in index.css\n // cascade order) so this never goes stale, then run through stripForTailwind.\n const TW_CLASH = new Set<string>([\n 'block',\n 'inline',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-row',\n 'contents',\n 'hidden',\n 'list-item',\n 'static',\n 'fixed',\n 'absolute',\n 'relative',\n 'sticky',\n 'isolate',\n 'visible',\n 'invisible',\n 'collapse',\n 'sr-only',\n 'not-sr-only',\n 'flex-row',\n 'flex-row-reverse',\n 'flex-col',\n 'flex-col-reverse',\n 'flex-wrap',\n 'flex-nowrap',\n 'items-start',\n 'items-end',\n 'items-center',\n 'items-baseline',\n 'items-stretch',\n 'justify-start',\n 'justify-end',\n 'justify-center',\n 'justify-between',\n 'justify-around',\n 'justify-evenly',\n 'content-start',\n 'content-end',\n 'content-center',\n 'content-between',\n 'content-around',\n 'content-evenly',\n 'text-left',\n 'text-center',\n 'text-right',\n 'text-justify',\n 'text-start',\n 'text-end',\n ]);\n const droppedClashes = new Set<string>();\n let droppedVariantBlocks = 0;\n const stripForTailwind = (css: string): string => {\n const kept: string[] = [];\n let depth = 0;\n let start = 0;\n let preludeEnd = -1;\n for (let i = 0; i < css.length; i++) {\n const ch = css[i];\n if (ch === '/' && css[i + 1] === '*') {\n const end = css.indexOf('*/', i + 2);\n i = end === -1 ? css.length : end + 1;\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n i += 1;\n while (i < css.length && css[i] !== ch) i += css[i] === '\\\\' ? 2 : 1;\n continue;\n }\n if (ch === '{') {\n if (depth === 0) preludeEnd = i;\n depth++;\n } else if (ch === '}') {\n depth--;\n if (depth === 0) {\n const raw = css.slice(start, i + 1).trim();\n const prelude = css\n .slice(start, preludeEnd)\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .trim();\n const clash = /^\\.([A-Za-z0-9_-]+)/.exec(prelude);\n if (/^@container\\s*\\(\\s*min-width:/.test(prelude)) droppedVariantBlocks++;\n else if (clash && TW_CLASH.has(clash[1] as string))\n droppedClashes.add(clash[1] as string);\n else if (raw) kept.push(raw);\n start = i + 1;\n }\n }\n }\n return kept.join('\\n\\n');\n };\n\n const partials = componentPartialOrder(cssDir);\n const componentCss = partials\n .map((rel) => {\n const css = readFileSync(join(cssDir, rel), 'utf8');\n return `/* ── ${rel} ── */\\n${stripForTailwind(css)}`;\n })\n .join('\\n\\n');\n // Same layering rationale as the patterns block above.\n parts.push(\n `/* ── Component + structural partials (Tailwind-clashing utilities dropped) ── */\\n@layer components {\\n${componentCss}\\n}`,\n );\n\n return nl(parts) + '\\n';\n}\n\n/**\n * The component/structural CSS partials to inline into the Tailwind bundle, in\n * index.css cascade order. Everything the aggregator imports EXCEPT the engine\n * (global/animation), the layout utilities (Tailwind owns them), and the generated\n * token layer (Tailwind builds its own via @theme).\n */\nfunction componentPartialOrder(cssDir: string): string[] {\n const indexPath = join(cssDir, 'index.css');\n const skip = new Set(['global.css', 'animation.css', 'layout.css']);\n const order: string[] = [];\n const seen = new Set<string>();\n const text = existsSync(indexPath) ? readFileSync(indexPath, 'utf8') : '';\n for (const m of text.matchAll(/@import\\s+['\"]\\.\\/([^'\"]+)['\"]/g)) {\n const rel = m[1] as string;\n if (rel.startsWith('generated/')) continue;\n if (skip.has(rel)) continue;\n if (!seen.has(rel) && existsSync(join(cssDir, rel))) {\n seen.add(rel);\n order.push(rel);\n }\n }\n // Fallback: if no index.css, inline utilities + every pattern partial.\n if (!order.length) {\n if (existsSync(join(cssDir, 'utilities.css'))) order.push('utilities.css');\n const pdir = join(cssDir, 'patterns');\n if (existsSync(pdir))\n for (const f of readdirSync(pdir).sort()) if (f.endsWith('.css')) order.push(`patterns/${f}`);\n }\n return order;\n}\n\n// ── CSS bundling (css + bricks formats) ───────────────────────────────────────\n/**\n * Assemble the full stylesheet by resolving index.css's @import order against the\n * static partials (from assets) and the freshly generated token partials (in\n * memory), then minify with lightningcss. No @import survives, so no disk\n * resolution / shared `generated/` dir is needed.\n */\nfunction bundleCss(\n generated: Record<string, string>,\n assetsDir: string,\n minify: boolean,\n): { code: string; map: string | undefined } {\n const cssDir = join(assetsDir, 'css');\n const indexPath = join(cssDir, 'index.css');\n const index = readFileSync(indexPath, 'utf8');\n const chunks: string[] = [];\n for (const line of index.split('\\n')) {\n const m = /@import\\s+['\"]\\.\\/([^'\"]+)['\"]/.exec(line);\n if (!m) continue;\n const rel = m[1] as string;\n if (rel.startsWith('generated/')) {\n const name = rel.slice('generated/'.length);\n chunks.push(generated[name] ?? '');\n } else {\n chunks.push(readFileSync(join(cssDir, rel), 'utf8'));\n }\n }\n const merged = chunks.join('\\n');\n const res = transform({\n filename: 'styles.css',\n code: Buffer.from(merged),\n minify,\n sourceMap: minify,\n });\n return {\n code: res.code.toString(),\n map: res.map ? res.map.toString() : undefined,\n };\n}\n\n// ── public generate() ─────────────────────────────────────────────────────────\nfunction loadConfig(input: string | DesignSystem): DesignSystem {\n const raw = typeof input === 'string' ? JSON.parse(readFileSync(input, 'utf8')) : input;\n const result = validate(raw);\n if (!result.ok) {\n const lines = result.errors\n .slice(0, 12)\n .map((e) => ` • ${e.path.join('.') || '(root)'}: ${e.message}`)\n .join('\\n');\n throw new Error(`Invalid design-system.json:\\n${lines}`);\n }\n return result.data;\n}\n\nexport async function generate(options: GenerateOptions): Promise<GenerateResult> {\n const format: Format = options.format ?? 'bricks';\n const outDir = options.outDir ?? 'dist';\n const assetsDir = options.assetsDir ?? DEFAULT_ASSETS;\n const ds = loadConfig(options.input);\n const built = build(ds, format, assetsDir);\n mkdirSync(outDir, { recursive: true });\n const written: string[] = [];\n const put = (rel: string, content: string) => {\n const p = join(outDir, rel);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, content);\n written.push(p);\n };\n\n if (format === 'tailwind') {\n put('tailwind.css', built.tailwind);\n put('tokens.json', built.tokensJson);\n } else if (format === 'css') {\n const { code } = bundleCss(built.generated, assetsDir, true);\n put('styles.css', code);\n put('tokens.json', built.tokensJson);\n put('design-manifest.json', built.designManifest);\n } else {\n // bricks: bundled minified CSS + Bricks import JSON + copied JS/PHP/docs.\n const { code, map } = bundleCss(built.generated, assetsDir, true);\n put('styles.min.css', map ? code + `\\n/*# sourceMappingURL=styles.min.css.map */` : code);\n if (map) put('styles.min.css.map', map);\n put('bricks-colors-named.json', built.bricksColorsNamed);\n put('bricks-colors-semantic.json', built.bricksColorsSemantic);\n put('bricks-variables.json', built.bricksVariables);\n put('tokens.json', built.tokensJson);\n // Framework-static JS bundles → outDir root (theme enqueues them).\n const jsDir = join(assetsDir, 'js');\n if (existsSync(jsDir)) {\n cpSync(jsDir, outDir, { recursive: true });\n for (const f of readdirSync(jsDir)) written.push(join(outDir, f));\n }\n // Bricks PHP elements + loader → outDir/bricks.\n const bricksSrc = join(assetsDir, 'bricks');\n if (existsSync(bricksSrc)) {\n cpSync(bricksSrc, join(outDir, 'bricks'), { recursive: true });\n written.push(join(outDir, 'bricks'));\n }\n // OKF docs bundle (generated per-config) → outDir/docs.\n const docs = generateDocs(ds, assetsDir);\n for (const [rel, content] of Object.entries(docs)) put(join('docs', rel), content);\n }\n\n return { format, outDir, written };\n}\n","/**\n * Company / site-level configuration schema — the umbrella around a\n * `design-system.json`-compliant `designSystem`.\n *\n * Authored with `zod/mini` (same instance the design-system schema uses), so the\n * two compose: `DesignSystemSchema` is embedded as `designSystem.<theme>` and the\n * whole thing serialises to one JSON Schema via `z.toJSONSchema`. Everything a\n * generator needs derives from here: the `SiteConfig` type (`z.infer`), the\n * published JSON Schema (`siteJsonSchema`), and runtime validation (`validateSite`).\n *\n * Pure: no YAML/env/fs. `resolveSiteConfig` takes an already-parsed object; a\n * thin loader (reading YAML, injecting `SITE_ENV`) lives outside this module.\n */\nimport * as z from 'zod/mini';\nimport { DesignSystemPatchSchema, type DesignSystem } from './schema.ts';\n\n// ── Primitives ────────────────────────────────────────────────────────────────\n\n/** A string, or a per-locale map of strings (`{ en: \"…\", fr: \"…\" }`). */\nconst LocalizableSchema = z.union([z.string(), z.record(z.string(), z.string())]);\n\nconst ImageRefSchema = z.union([\n z.string(),\n z.object({\n src: z.string(),\n alt: z.string(),\n width: z.optional(z.number()),\n height: z.optional(z.number()),\n }),\n]);\n\n// Attribute bags on generated HTML — constrained to serialisable scalars so the\n// exported JSON Schema still offers validation (vs. an opaque `unknown`).\nconst AttrValue = z.union([z.string(), z.number(), z.boolean()]);\nconst AttrsSchema = z.optional(z.record(z.string(), AttrValue));\n\nconst IsoDate = z.string().check(z.regex(/^\\d{4}-\\d{2}-\\d{2}$/)); // YYYY-MM-DD\nconst Iso4217 = z.string().check(z.regex(/^[A-Z]{3}$/)); // currency code\nconst DayOfWeek = z.enum([\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n 'Sunday',\n]);\n\n// ── Design system (named-theme map) ─────────────────────────────────────────────\n// Each entry is a full `DesignSystem` plus a localised `displayName` and an\n// optional `extends` (another entry's key). Entries are lenient (all top-level\n// fields optional) so an extending entry can be a partial patch; the resolved\n// theme is validated against the full `DesignSystemSchema` by `resolveTheme`.\n\nconst DesignSystemEntry = z.extend(DesignSystemPatchSchema, {\n displayName: z.optional(LocalizableSchema),\n extends: z.optional(z.string()),\n});\n\n// ── Locales ─────────────────────────────────────────────────────────────────────\n\nconst LocaleSchema = z.object({\n name: z.string(),\n tagline: z.optional(z.string()),\n basePath: z.optional(z.string()),\n});\n\n// ── Domains ─────────────────────────────────────────────────────────────────────\n\nconst HttpRedirect = z.union([z.literal(301), z.literal(302), z.literal(307), z.literal(308)]);\n\nconst DomainAliasSchema = z.object({\n domain: z.string(),\n redirectType: HttpRedirect,\n redirectTo: z.string(),\n environment: z.optional(z.string()),\n});\n\n// ── Contact / address (schema.org-aligned) ──────────────────────────────────────\n\n/** schema.org `PostalAddress` field names, so JSON-LD generation is lossless. */\nconst PostalAddressSchema = z.object({\n streetAddress: z.string(),\n addressLocality: z.string(), // city\n addressRegion: z.optional(z.string()), // state/province\n postalCode: z.optional(z.string()),\n addressCountry: z.string(), // ISO 3166-1 alpha-2 preferred\n});\n\nconst ContactObjectSchema = z.object({\n name: z.optional(z.string()),\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n});\n\n// contact is either a string (location key reference) or an inline object\nconst ContactConfigSchema = z.union([z.string(), ContactObjectSchema]);\n\n// ── Locations (schema.org LocalBusiness) ────────────────────────────────────────\n\nconst GeoSchema = z.object({\n latitude: z.number().check(z.gte(-90), z.lte(90)),\n longitude: z.number().check(z.gte(-180), z.lte(180)),\n});\n\n/** schema.org `OpeningHoursSpecification` — per-day open/close (24h `HH:MM`). */\nconst OpeningHoursSchema = z.object({\n dayOfWeek: z.array(DayOfWeek),\n opens: z.string().check(z.regex(/^\\d{2}:\\d{2}$/)),\n closes: z.string().check(z.regex(/^\\d{2}:\\d{2}$/)),\n});\n\n// Common schema.org LocalBusiness subtypes (extend as needed).\nconst LocalBusinessType = z.enum([\n 'LocalBusiness',\n 'Store',\n 'Restaurant',\n 'CafeOrCoffeeShop',\n 'ProfessionalService',\n 'MedicalBusiness',\n 'HealthAndBeautyBusiness',\n 'HomeAndConstructionBusiness',\n 'AutomotiveBusiness',\n 'FinancialService',\n 'LegalService',\n 'RealEstateAgent',\n 'Organization',\n]);\n\nconst LocationSchema = z.object({\n slug: z.optional(LocalizableSchema),\n name: LocalizableSchema,\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n geo: z.optional(GeoSchema),\n hours: z.optional(z.array(OpeningHoursSchema)),\n type: z.optional(LocalBusinessType),\n description: z.optional(LocalizableSchema),\n areaServed: z.optional(z.array(z.string())),\n priceRange: z.optional(z.string()),\n paymentAccepted: z.optional(z.array(z.string())),\n currenciesAccepted: z.optional(Iso4217),\n knowsLanguage: z.optional(z.array(z.string())),\n});\n\n// ── Organization (schema.org Organization) ──────────────────────────────────────\n\nconst OrganizationSchema = z.object({\n name: z.optional(LocalizableSchema),\n legalName: z.optional(z.string()),\n foundingDate: z.optional(IsoDate),\n logo: z.optional(ImageRefSchema),\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n taxID: z.optional(z.string()),\n vatID: z.optional(z.string()),\n /** Profile URLs → JSON-LD `sameAs` (mirrors `links`). */\n sameAs: z.optional(z.array(z.url())),\n});\n\n// ── DNS ──────────────────────────────────────────────────────────────────────\n\nconst DnsRecordType = z.enum(['A', 'AAAA', 'CNAME', 'TXT', 'MX', 'NS', 'SRV', 'CAA', 'PTR', 'SOA']);\n\nconst DnsRecordSchema = z.object({\n type: DnsRecordType,\n name: z.optional(z.string()),\n value: z.string(),\n ttl: z.optional(z.number().check(z.int(), z.positive())),\n proxied: z.optional(z.boolean()),\n});\n\nconst DnsDomainSchema = z.object({\n provider: z.optional(z.string()),\n nameservers: z.optional(z.array(z.string())),\n records: z.optional(z.array(DnsRecordSchema)),\n});\n\n// ── Environments ──────────────────────────────────────────────────────────────\n\nconst RobotsSchema = z.string(); // e.g. \"index,follow\" / \"noindex,nofollow\"\n\nconst EnvironmentSchema = z.object({\n url: z.url(),\n api: z.optional(z.url()),\n analytics: z.optional(z.boolean()),\n robots: z.optional(RobotsSchema),\n variant: z.optional(z.string()),\n});\n\n// ── A/B testing ─────────────────────────────────────────────────────────────────\n\nconst AbVariantSchema = z.object({\n environment: z.string(),\n description: z.optional(z.string()),\n // Deliberate escape hatch: overrides are deep-merged into the raw config\n // before validation, so their shape is the config's own.\n overrides: z.optional(z.record(z.string(), z.unknown())),\n});\n\n// ── Fonts (Astro Fonts API projection) ──────────────────────────────────────────\n// Font *loading* — a serialisable projection of Astro's `fonts:[…]` config. A\n// loader maps `provider` (string) → `fontProviders.<name>()`. Distinct from the\n// design-system font *tokens* (`designSystem.<theme>.fonts` / typography.families),\n// which reference the same `cssVariable`.\n\nconst FontProvider = z.enum([\n 'google',\n 'fontsource',\n 'adobe',\n 'bunny',\n 'fontshare',\n 'googleicons',\n 'npm',\n 'local',\n]);\nconst FontStyle = z.enum(['normal', 'italic']);\nconst FontDisplay = z.enum(['auto', 'block', 'swap', 'fallback', 'optional']);\nconst FontWeight = z.union([z.number(), z.string()]); // discrete, or a variable range like \"100 900\"\n\n/** A local-font face (`provider: 'local'`). */\nconst FontVariantSchema = z.object({\n src: z.array(z.string()),\n weight: z.optional(FontWeight),\n style: z.optional(FontStyle),\n unicodeRange: z.optional(z.array(z.string())),\n display: z.optional(FontDisplay),\n});\n\nconst FontSchema = z.object({\n name: z.string(),\n provider: FontProvider,\n cssVariable: z.string().check(z.regex(/^--/)),\n weights: z.optional(z.array(FontWeight)),\n styles: z.optional(z.array(FontStyle)),\n subsets: z.optional(z.array(z.string())),\n fallbacks: z.optional(z.array(z.string())),\n optimizedFallbacks: z.optional(z.boolean()),\n display: z.optional(FontDisplay),\n formats: z.optional(z.array(z.string())),\n unicodeRange: z.optional(z.array(z.string())),\n variants: z.optional(z.array(FontVariantSchema)), // local provider\n /** Emit `<Font preload />` for this family. */\n preload: z.optional(\n z.union([z.boolean(), z.array(z.object({ weight: FontWeight, style: z.optional(FontStyle) }))]),\n ),\n});\n\n// ── Templates (nav / form / nodes) ──────────────────────────────────────────────\n\nconst PresentSchema = z.optional(z.record(z.string(), z.unknown()));\n\nconst NavItemSchema: z.ZodMiniType = z.object({\n label: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n href: z.optional(z.string()),\n icon: z.optional(z.string()),\n attrs: AttrsSchema,\n itemAttrs: AttrsSchema,\n submenu: z.optional(\n z.object({\n present: PresentSchema,\n get items() {\n return z.optional(z.array(NavItemSchema));\n },\n }),\n ),\n});\n\nconst FormFieldType = z.enum([\n 'text',\n 'email',\n 'tel',\n 'url',\n 'number',\n 'password',\n 'textarea',\n 'select',\n 'checkbox',\n 'radio',\n 'date',\n 'file',\n 'hidden',\n]);\n\nconst FormFieldSchema = z.object({\n name: z.string(),\n type: FormFieldType,\n label: z.optional(LocalizableSchema),\n required: z.optional(z.boolean()),\n validation: z.optional(z.string()), // regex source or named rule\n options: z.optional(\n z.union([z.string(), z.array(z.object({ label: z.string(), value: z.string() }))]),\n ),\n attrs: AttrsSchema,\n});\n\nconst ContentNodeSchema: z.ZodMiniType = z.object({\n tag: z.string(),\n attrs: AttrsSchema,\n text: z.optional(z.string()),\n get children() {\n return z.optional(z.array(ContentNodeSchema));\n },\n});\n\nconst TemplateSchema = z.union([\n z.object({\n type: z.literal('nav'),\n tags: z.optional(z.array(z.string())),\n present: PresentSchema,\n items: z.optional(z.array(NavItemSchema)),\n }),\n z.object({\n type: z.literal('form'),\n tags: z.optional(z.array(z.string())),\n present: PresentSchema,\n action: z.optional(z.string()),\n method: z.optional(z.enum(['get', 'post'])),\n fields: z.optional(z.array(FormFieldSchema)),\n submit: z.optional(z.record(z.string(), AttrValue)),\n honeypot: z.optional(z.boolean()),\n }),\n z.object({\n type: z.literal('nodes'),\n tags: z.optional(z.array(z.string())),\n nodes: z.optional(z.array(ContentNodeSchema)),\n }),\n]);\n\n// ── Galleries / testimonials ────────────────────────────────────────────────────\n\nconst GalleryImageSchema = z.object({\n src: z.string(),\n alt: LocalizableSchema,\n caption: z.optional(LocalizableSchema),\n});\n\nconst GallerySchema = z.object({\n title: z.optional(LocalizableSchema),\n tags: z.optional(z.array(z.string())),\n images: z.array(GalleryImageSchema),\n});\n\nconst TestimonialItemSchema = z.object({\n quote: LocalizableSchema,\n name: z.string(),\n role: z.optional(z.string()),\n rating: z.optional(z.number().check(z.gte(0), z.lte(5))),\n date: z.optional(IsoDate),\n});\n\nconst TestimonialGroupSchema = z.object({\n title: z.optional(LocalizableSchema),\n items: z.array(TestimonialItemSchema),\n});\n\n// ── Services (schema.org Offer) ─────────────────────────────────────────────────\n\nconst OfferSchema = z.object({\n name: z.optional(LocalizableSchema),\n price: z.optional(z.union([z.string(), z.number()])),\n priceCurrency: z.optional(Iso4217),\n availability: z.optional(z.string()),\n url: z.optional(z.url()),\n validFrom: z.optional(IsoDate),\n priceValidUntil: z.optional(IsoDate),\n});\n\nconst ServiceSchema = z.object({\n name: LocalizableSchema,\n description: z.optional(LocalizableSchema),\n slug: z.optional(LocalizableSchema),\n offers: z.optional(z.array(OfferSchema)),\n});\n\n// ── SEO / social ─────────────────────────────────────────────────────────────\n\nconst OpenGraphSchema = z.object({\n type: z.optional(z.string()),\n siteName: z.optional(z.string()),\n title: z.optional(LocalizableSchema),\n description: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n locale: z.optional(z.string()),\n});\n\nconst TwitterSchema = z.object({\n card: z.optional(z.enum(['summary', 'summary_large_image', 'app', 'player'])),\n site: z.optional(z.string()),\n creator: z.optional(z.string()),\n title: z.optional(LocalizableSchema),\n description: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n});\n\n// ── Top-level schema ────────────────────────────────────────────────────────────\n\nexport const SiteConfigSchema = z.object({\n defaultLocale: z.string(),\n locales: z.record(z.string(), LocaleSchema),\n organization: z.optional(OrganizationSchema),\n contact: z.optional(ContactConfigSchema),\n domains: z.optional(\n z.object({\n canonical: z.url(),\n aliases: z.optional(z.array(DomainAliasSchema)),\n }),\n ),\n primaryLocation: z.optional(z.string()),\n locations: z.optional(z.record(z.string(), LocationSchema)),\n services: z.optional(z.record(z.string(), ServiceSchema)),\n links: z.optional(\n z.object({\n googleMaps: z.optional(z.url()),\n instagram: z.optional(z.url()),\n facebook: z.optional(z.url()),\n x: z.optional(z.url()),\n linkedin: z.optional(z.url()),\n youtube: z.optional(z.url()),\n github: z.optional(z.url()),\n }),\n ),\n dns: z.optional(z.record(z.string(), DnsDomainSchema)),\n // Deliberate escape hatch — provider-specific, out of scope to model here.\n cloudflare: z.optional(z.record(z.string(), z.unknown())),\n environments: z.record(z.string(), EnvironmentSchema),\n abTesting: z.optional(\n z.object({\n enabled: z.boolean(),\n cookieName: z.optional(z.string()),\n cookieMaxAge: z.optional(z.number().check(z.int(), z.positive())),\n splitRatio: z.optional(z.number().check(z.gte(0), z.lte(1))),\n variants: z.optional(z.record(z.string(), AbVariantSchema)),\n }),\n ),\n\n // Design system: named-theme map. `default` is the base; other entries may\n // `extends` another and supply a partial patch. Light/dark is automatic\n // (functional tokens flip per appearance), not a separate theme entry.\n designSystem: z.record(z.string(), DesignSystemEntry),\n defaultTheme: z.optional(z.string()), // convention: \"default\"\n defaultColorScheme: z.optional(z.enum(['light', 'dark'])), // initial appearance to render\n respectSystemPreference: z.optional(z.boolean()),\n\n // Font *loading* (Astro Fonts API). Font *tokens* live in `designSystem`.\n fonts: z.optional(z.array(FontSchema)),\n\n tags: z.optional(z.record(z.string(), z.unknown())),\n postTypes: z.optional(z.record(z.string(), z.unknown())),\n galleries: z.optional(z.record(z.string(), GallerySchema)),\n testimonials: z.optional(z.record(z.string(), TestimonialGroupSchema)),\n templates: z.optional(z.record(z.string(), TemplateSchema)),\n navigation: z.optional(\n z.object({\n activeTemplate: z.optional(\n z.object({\n default: z.optional(z.string()),\n breakpoints: z.optional(z.record(z.string(), z.string())),\n }),\n ),\n }),\n ),\n seo: z.optional(\n z.object({\n titleTemplate: z.optional(z.string()),\n descriptionTemplate: z.optional(z.string()),\n robots: z.optional(RobotsSchema),\n googleSiteVerification: z.optional(z.string()),\n bingSiteVerification: z.optional(z.string()),\n openGraph: z.optional(OpenGraphSchema),\n twitter: z.optional(TwitterSchema),\n }),\n ),\n analytics: z.optional(\n z.object({\n googleAnalyticsId: z.optional(z.string()),\n plausibleDomain: z.optional(z.string()),\n googleTagManagerId: z.optional(z.string()),\n }),\n ),\n notifications: z.optional(z.object({ email: z.optional(z.email()) })),\n tracking: z.optional(\n z.object({\n enabled: z.optional(z.boolean()),\n platforms: z.optional(z.array(z.string())),\n }),\n ),\n security: z.optional(\n z.object({\n turnstile: z.optional(z.object({ siteKey: z.optional(z.string()) })),\n }),\n ),\n legal: z.optional(\n z.object({\n privacyPolicy: z.optional(\n z.object({\n enabled: z.boolean(),\n url: z.optional(z.url()),\n lastUpdated: z.optional(IsoDate),\n }),\n ),\n termsOfService: z.optional(\n z.object({\n enabled: z.boolean(),\n url: z.optional(z.url()),\n lastUpdated: z.optional(z.nullable(IsoDate)),\n }),\n ),\n cookieConsent: z.optional(\n z.object({\n enabled: z.boolean(),\n type: z.optional(z.enum(['opt-in', 'opt-out'])),\n position: z.optional(z.enum(['top', 'bottom', 'center'])),\n categories: z.optional(z.array(z.string())),\n }),\n ),\n }),\n ),\n icons: z.optional(\n z.object({\n ui: z.optional(z.string()),\n brand: z.optional(z.string()),\n semantic: z.optional(z.array(z.string())),\n 'fa7-solid': z.optional(z.array(z.string())),\n 'fa7-regular': z.optional(z.array(z.string())),\n 'fa7-light': z.optional(z.array(z.string())),\n 'fa7-thin': z.optional(z.array(z.string())),\n 'fa7-brands': z.optional(z.array(z.string())),\n 'simple-icons': z.optional(z.array(z.string())),\n 'material-symbols': z.optional(z.array(z.string())),\n lucide: z.optional(z.array(z.string())),\n }),\n ),\n favicon: z.optional(\n z.object({\n source: z.string(),\n lowResSource: z.optional(z.string()),\n /** App name for the generated web manifest / PWA. */\n name: z.optional(z.string()),\n /** PWA theme color (also `<meta name=\"theme-color\">`). */\n themeColor: z.optional(z.string()),\n /** PWA background color. */\n backgroundColor: z.optional(z.string()),\n }),\n ),\n deployment: z.optional(\n z.object({\n platform: z.optional(z.string()),\n buildCommand: z.optional(z.string()),\n deployCommand: z.optional(z.string()),\n outputDirectory: z.optional(z.string()),\n type: z.optional(z.string()),\n }),\n ),\n});\n\nexport type SiteConfig = z.infer<typeof SiteConfigSchema>;\n\n// ── JSON Schema + validation ────────────────────────────────────────────────────\n\nexport const SITE_SCHEMA_URL = 'https://unpkg.com/@getvitops/generator/site.schema.json';\n\n/** The published JSON Schema (draft-2020-12), derived from the zod schema. */\nexport const siteJsonSchema = {\n $id: SITE_SCHEMA_URL,\n ...z.toJSONSchema(SiteConfigSchema, { target: 'draft-2020-12' }),\n};\n\nexport type SiteValidationResult =\n | { ok: true; data: SiteConfig; errors: [] }\n | { ok: false; data: undefined; errors: z.core.$ZodIssue[] };\n\ntype Issue = z.core.$ZodIssue;\nconst issue = (path: (string | number)[], message: string): Issue =>\n ({ code: 'custom', path, message }) as Issue;\n\n/**\n * Validate a raw (already parsed) config: shape via zod, then the cross-field\n * integrity that JSON Schema can't express (referential keys, extends acyclicity).\n * These live only here — the published JSON Schema enforces shape, not integrity.\n */\nexport function validateSite(input: unknown): SiteValidationResult {\n const parsed = z.safeParse(SiteConfigSchema, input);\n if (!parsed.success) return { ok: false, data: undefined, errors: parsed.error.issues };\n const cfg = parsed.data;\n const errors: Issue[] = [];\n const has = (m: Record<string, unknown> | undefined, k: string) => !!m && k in m;\n\n if (!has(cfg.locales, cfg.defaultLocale))\n errors.push(issue(['defaultLocale'], `defaultLocale \"${cfg.defaultLocale}\" is not in locales`));\n\n if (!has(cfg.designSystem, 'default') && cfg.defaultTheme == null)\n errors.push(issue(['designSystem'], 'designSystem must include a \"default\" theme'));\n\n if (cfg.defaultTheme != null && !has(cfg.designSystem, cfg.defaultTheme))\n errors.push(\n issue(['defaultTheme'], `defaultTheme \"${cfg.defaultTheme}\" is not in designSystem`),\n );\n\n for (const [key, entry] of Object.entries(cfg.designSystem)) {\n if (entry.extends != null && !has(cfg.designSystem, entry.extends))\n errors.push(\n issue(\n ['designSystem', key, 'extends'],\n `extends \"${entry.extends}\" is not a designSystem key`,\n ),\n );\n }\n // extends acyclicity + each resolved theme is a complete DesignSystem\n for (const key of Object.keys(cfg.designSystem)) {\n try {\n resolveTheme(cfg.designSystem as Record<string, DesignSystemEntryT>, key);\n } catch (e) {\n errors.push(issue(['designSystem', key], (e as Error).message));\n }\n }\n\n if (cfg.primaryLocation != null && !has(cfg.locations, cfg.primaryLocation))\n errors.push(\n issue(['primaryLocation'], `primaryLocation \"${cfg.primaryLocation}\" is not in locations`),\n );\n if (typeof cfg.contact === 'string' && !has(cfg.locations, cfg.contact))\n errors.push(issue(['contact'], `contact \"${cfg.contact}\" is not a locations key`));\n\n for (const [name, v] of Object.entries(cfg.abTesting?.variants ?? {}))\n if (!has(cfg.environments, v.environment))\n errors.push(\n issue(\n ['abTesting', 'variants', name, 'environment'],\n `environment \"${v.environment}\" is not in environments`,\n ),\n );\n for (const [i, a] of (cfg.domains?.aliases ?? []).entries())\n if (a.environment != null && !has(cfg.environments, a.environment))\n errors.push(\n issue(\n ['domains', 'aliases', i, 'environment'],\n `environment \"${a.environment}\" is not in environments`,\n ),\n );\n\n const templates = cfg.templates;\n const at = cfg.navigation?.activeTemplate;\n if (at?.default != null && !has(templates, at.default))\n errors.push(\n issue(\n ['navigation', 'activeTemplate', 'default'],\n `template \"${at.default}\" is not in templates`,\n ),\n );\n for (const [bp, tpl] of Object.entries(at?.breakpoints ?? {}))\n if (!has(templates, tpl))\n errors.push(\n issue(\n ['navigation', 'activeTemplate', 'breakpoints', bp],\n `template \"${tpl}\" is not in templates`,\n ),\n );\n\n if (errors.length) return { ok: false, data: undefined, errors };\n return { ok: true, data: cfg, errors: [] };\n}\n\n// ── Theme resolution (extends) ──────────────────────────────────────────────────\n\ntype DesignSystemEntryT = Partial<DesignSystem> & { displayName?: unknown; extends?: string };\n\n/**\n * Resolve a design-system theme by following its `extends` chain and deep-merging\n * base → child (child wins; arrays replace wholesale, correct for token overrides).\n * Throws on unknown keys or an `extends` cycle. The result is a plain\n * `DesignSystem` (validate it against `DesignSystemSchema` for completeness).\n */\nexport function resolveTheme(\n designSystem: Record<string, DesignSystemEntryT>,\n key: string,\n): DesignSystem {\n const chain: DesignSystemEntryT[] = [];\n const seen = new Set<string>();\n let cur: string | undefined = key;\n while (cur != null) {\n if (seen.has(cur)) throw new Error(`extends cycle in designSystem at \"${cur}\"`);\n seen.add(cur);\n const entry: DesignSystemEntryT | undefined = designSystem[cur];\n if (entry == null) throw new Error(`designSystem theme \"${cur}\" not found`);\n chain.unshift(entry);\n cur = entry.extends;\n }\n const out: Record<string, unknown> = {};\n for (const entry of chain) {\n const { extends: _e, displayName: _d, ...ds } = entry;\n deepMerge(out, ds as Record<string, unknown>);\n }\n return out as DesignSystem;\n}\n\n/**\n * Resolve a raw (already-parsed) config into a validated `SiteConfig`:\n * 1. strip YAML nulls,\n * 2. apply the active A/B variant's `overrides` (by `siteEnv`),\n * 3. normalise a bare-`DesignSystem` `designSystem` shorthand to `{ default: … }`,\n * 4. validate (shape + cross-field).\n * Pure — no YAML/env access. A loader supplies `siteEnv`.\n */\nexport function resolveSiteConfig(input: unknown, siteEnv = 'production'): SiteConfig {\n const raw = stripNulls(input) as Record<string, unknown>;\n\n const envConfig = (raw.environments as Record<string, { variant?: string }> | undefined)?.[\n siteEnv\n ];\n if (envConfig?.variant) {\n const overrides = (\n raw.abTesting as { variants?: Record<string, { overrides?: Record<string, unknown> }> }\n )?.variants?.[envConfig.variant]?.overrides;\n if (overrides) deepMerge(raw, overrides);\n }\n\n // Shorthand: a bare DesignSystem (has `colors`) → { default: … }.\n const ds = raw.designSystem as Record<string, unknown> | undefined;\n if (ds != null && 'colors' in ds) raw.designSystem = { default: ds };\n\n const result = validateSite(raw);\n if (!result.ok) {\n const msg = result.errors.map((e) => ` ${e.path.join('.')}: ${e.message}`).join('\\n');\n throw new Error(`Invalid site config:\\n${msg}`);\n }\n return result.data;\n}\n\n// ── Helpers ─────────────────────────────────────────────────────────────────────\n\n/** Strip nulls (YAML `~`/`null`) → undefined so optional fields validate. */\nexport function stripNulls(obj: unknown): unknown {\n if (obj === null) return undefined;\n if (Array.isArray(obj)) return obj.map(stripNulls);\n if (obj && typeof obj === 'object') {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const stripped = stripNulls(value);\n if (stripped !== undefined) result[key] = stripped;\n }\n return result;\n }\n return obj;\n}\n\n/** Deep-merge `source` into `target` (in place). Arrays replace wholesale. */\nexport function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>) {\n for (const key of Object.keys(source)) {\n const s = source[key];\n const t = target[key];\n if (\n s &&\n typeof s === 'object' &&\n !Array.isArray(s) &&\n t &&\n typeof t === 'object' &&\n !Array.isArray(t)\n ) {\n deepMerge(t as Record<string, unknown>, s as Record<string, unknown>);\n } else {\n target[key] = s;\n }\n }\n}\n","/**\n * @getvitops/generator — public API.\n *\n * Turn a `design-system.json` into platform outputs (Bricks, standalone CSS,\n * Tailwind v4). The `zod/mini` schema is the single source of truth: types,\n * validation, and the published JSON Schema all derive from it.\n */\nexport { generate } from './generate.ts';\nexport type { GenerateOptions, GenerateResult, Format } from './generate.ts';\n\nexport { generateDocs } from './docs.ts';\n\nexport { DesignSystemSchema, jsonSchema, SCHEMA_URL, validate } from './schema.ts';\nexport type { DesignSystem, ValidationResult } from './schema.ts';\nexport {\n SiteConfigSchema,\n siteJsonSchema,\n SITE_SCHEMA_URL,\n validateSite,\n resolveSiteConfig,\n resolveTheme,\n stripNulls,\n deepMerge,\n} from './site.ts';\nexport type { SiteConfig, SiteValidationResult } from './site.ts';\n\nimport { SCHEMA_URL, type DesignSystem } from './schema.ts';\n\n/**\n * A minimal but complete starter design system, used by `vitops init`. It\n * validates against the schema and generates real output in every format, so a\n * new project can `vitops generate` immediately and then tune from here.\n */\nexport function defaultConfig(): DesignSystem {\n return {\n $schema: SCHEMA_URL,\n colors: {\n // Each hue is generated as an 11-step OKLCH scale from its seed.\n palette: {\n brand: { seed: '#2e9b73' },\n ink: { seed: '#3f4a5c' },\n sky: { seed: '#2f7bc0' },\n sun: { seed: '#d08a1f' },\n rose: { seed: '#c74a42' },\n },\n // role → hue. Functional tokens (bg/text/solid/on-solid/…) derive from\n // the hue's scale; dark mode flips automatically.\n roles: {\n neutral: 'ink',\n surface: 'ink',\n 'ui-primary': 'brand',\n 'brand-primary': 'brand',\n info: 'sky',\n success: 'brand',\n warning: 'sun',\n danger: 'rose',\n },\n utilities: ['bg', 'text', 'border'],\n },\n shadows: {\n sm: '0 1px 2px rgb(0 0 0 / 0.08)',\n md: '0 4px 6px rgb(0 0 0 / 0.12)',\n lg: '0 10px 15px rgb(0 0 0 / 0.18)',\n },\n fonts: {\n display: 'system-ui, -apple-system, \"Segoe UI\", sans-serif',\n sans: 'system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif',\n mono: 'ui-monospace, \"SF Mono\", Menlo, monospace',\n },\n typeScale: {\n base: '1rem',\n names: ['2xs', 'xs', 's', 'm', 'l', 'xl', '2xl', '3xl'],\n baseStep: 4,\n baseline: 'm',\n ratio: 1.2,\n fluid: { minVw: '22.5rem', maxVw: '80rem', minRatio: 1.12 },\n },\n spaceScale: {\n base: '1rem',\n names: ['2xs', 'xs', 's', 'm', 'l', 'xl', '2xl', '3xl'],\n baseStep: 4,\n baseline: 'm',\n ratio: 1.25,\n fluid: { minVw: '22.5rem', maxVw: '80rem', minRatio: 1.2 },\n },\n patterns: {\n defaults: {\n ds: 'none',\n b: '1px solid var(--color-surface-xl)',\n br: '0.375rem',\n p: '1rem',\n fs: '1rem',\n },\n radii: { pill: '999px', circle: '50%', card: '0.5rem' },\n groups: {\n control: {\n ds: 'var(--ds-default)',\n b: 'var(--b-default)',\n br: 'var(--br-default)',\n p: '0.5em 1em',\n fs: 'var(--fs-default)',\n },\n panel: {\n ds: 'var(--shadow-md)',\n b: 'var(--b-default)',\n br: '0.5rem',\n p: '1rem',\n fs: 'var(--fs-default)',\n },\n },\n z: { raised: 1, sticky: 100, overlay: 200, top: 1000 },\n items: {\n button: {\n group: 'control',\n element: 'button',\n default_role: 'brand-primary',\n base: {\n padding: '0.6em 1.2em',\n 'border-radius': 'var(--br-control, 0.25rem)',\n border: 'none',\n 'font-weight': '600',\n color: '#fff',\n cursor: 'pointer',\n 'box-shadow': 'var(--shadow-sm)',\n },\n states: { hover: { step: 1 }, active: { scale: 0.97 }, 'focus-visible': { ring: true } },\n roles: [],\n },\n card: {\n group: 'panel',\n class: 'card',\n base: {\n 'border-radius': 'var(--br-card-group)',\n padding: '1.5rem',\n background: 'var(--color-surface-xxl)',\n border: 'var(--b-card-group)',\n 'box-shadow': 'var(--ds-card-group)',\n },\n states: {},\n roles: [],\n },\n },\n },\n typography: {\n families: {\n display: 'var(--font-display)',\n sans: 'var(--font-sans)',\n code: 'var(--font-mono, ui-monospace, monospace)',\n },\n roles: {\n display: {\n family: 'display',\n size: 'var(--text-3xl)',\n weight: 700,\n 'line-height': '1.05',\n tracking: '-0.03em',\n },\n heading: { family: 'display', size: 'var(--text-xl)', weight: 600, 'line-height': '1.3' },\n body: { family: 'sans', size: 'var(--text-m)', weight: 400, 'line-height': '1.55' },\n },\n headings: { h1: 'display', h2: 'heading', h3: 'heading' },\n },\n animations: {\n effects: {\n 'fade-in': { kf: 'composite', vars: { 'opacity-from': 0 } },\n 'slide-up': {\n kf: 'composite',\n vars: { 'translate-y-from': 'var(--slide-distance, 2rem)' },\n },\n },\n journeys: {\n base: { fade: { 'opacity-from': 0 }, slide: {} },\n compose: [['fade'], ['slide'], ['fade', 'slide']],\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAEhD,MAAM,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/C,MAAM,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;AAQ1C,MAAM,aAAa,EAAE,OAAO;CAC1B,MAAM,EAAE,OAAO;CACf,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AACD,MAAM,YAAY,EAAE,OAAO,EACzB,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EACxE,CAAC;AACD,MAAM,OAAO,EAAE,MAAM,CAAC,YAAY,SAAS,CAAC;AAE5C,MAAM,cAAc,EAAE,KAAK;CAAC;CAAM;CAAQ;CAAU;CAAW;CAAQ;AAAQ,CAAC;AAMhF,MAAM,SAAS,EAAE,OAAO;CACtB,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;CAClC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;CACtC,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA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AQ,OAAO;IAAC;GAClD;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/schema.ts","../src/shared.ts","../src/tokens.ts","../src/docs.ts","../src/generate.ts","../src/site.ts","../src/index.ts"],"sourcesContent":["/**\n * Canonical `design-system.json` schema — the single source of truth.\n *\n * Authored with `zod/mini` (tree-shakeable Zod v4). Everything else derives from it:\n * • the `DesignSystem` TS type (`z.infer`), used throughout the generator,\n * • the published JSON Schema (`toJSONSchema`), emitted to `schema.json` for `$schema` refs,\n * • runtime validation (`validate`) for the CLI and to gate `generate`,\n * • the generated `authoring.md` reference doc (walks `jsonSchema`'s descriptions).\n */\nimport * as z from 'zod/mini';\n\n/**\n * Attach a JSON-Schema `description`. zod/mini has no `.describe()` method; the\n * mini-API equivalent is `.check(z.describe(…))`, and `.check()` clones — so a\n * shared sub-schema (`Scale`, `CssDecls`, …) can carry a different description\n * per use-site without mutating the original.\n */\nexport const desc = <T extends { check(...checks: never[]): T }>(schema: T, text: string): T =>\n schema.check(z.describe(text) as never);\n\nconst CssDecls = desc(\n z.record(z.string(), z.string()),\n 'A CSS declaration block: property → value. Values stay strings (they can be hex, var(), clamp(), keywords, …); the generator, not the schema, interprets them.',\n);\nconst Scalar = z.union([z.string(), z.number()]);\nconst VarMap = z.record(z.string(), Scalar);\n\n// ── colors ──────────────────────────────────────────────────────────────────\nconst SeededRamp = desc(\n z.object({\n seed: desc(\n z.string(),\n 'Seed colour (hex or oklch()). An 11-step numeric scale (50…950, tinted near-white → tinted near-black) is generated in OKLCH from it; the seed is preserved at its natural step.',\n ),\n anchors: z.optional(\n desc(\n z.record(z.string(), z.string()),\n 'Step → colour overrides (hex or oklch()) that pin specific steps of the generated scale; the remaining steps interpolate around them.',\n ),\n ),\n }),\n 'Seeded hue: the 11-step scale is GENERATED in OKLCH from `seed` (anchors pin specific steps).',\n);\nconst FixedRamp = desc(\n z.object({\n tones: desc(\n z.union([z.array(z.string()), z.record(z.string(), z.string())]),\n 'Fixed brand kit: authored tones placed verbatim at their nearest steps plus tinted off-white/off-black endpoints; no interpolation. Either an ordered light → dark array or a step → colour map.',\n ),\n }),\n 'Fixed hue: authored brand tones used verbatim; no generation.',\n);\nconst Ramp = desc(\n z.union([SeededRamp, FixedRamp]),\n 'A palette hue, authored one of two ways: `{ seed, anchors? }` generates an 11-step numeric OKLCH scale (50…950) from the seed, or `{ tones }` supplies a fixed brand kit used verbatim.',\n);\n\nconst UtilityName = z.enum(['bg', 'text', 'border', 'outline', 'fill', 'stroke']);\n\nconst Colors = desc(\n z.object({\n palette: desc(\n z.record(z.string(), Ramp),\n 'Palette hues by name. Each becomes an 11-step numeric OKLCH scale (`--color-<hue>-50…950`).',\n ),\n roles: desc(\n z.record(z.string(), z.string()),\n \"Maps each semantic role (neutral, surface, ui-primary/secondary/accent, brand-primary/secondary, info, success, warning, danger) to the palette hue backing it. The generator derives every role's FUNCTIONAL tokens (`--<role>-{bg,bg-muted,border,border-bold,solid,solid-bold,on-solid,text,text-muted,text-x-muted}`) plus emphasis stops from the hue's scale, and dark mode flips automatically — there is no per-appearance scheme grammar.\",\n ),\n utilities: z.optional(\n desc(\n z.array(UtilityName),\n 'Which colour utility-class families to emit (`bg-*`, `text-*`, `border-*`, `outline-*`, `fill-*`, `stroke-*`). Defaults to bg, text, border.',\n ),\n ),\n }),\n 'The colour system (the only required section): `palette` hues become generated OKLCH scales; `roles` map semantic roles onto those hues, from which all functional tokens and dark mode derive.',\n);\n\n// ── fluid modular scale (type + space) ──────────────────────────────────────\nconst Scale = z.object({\n base: desc(z.string(), 'Anchor size (a CSS length, e.g. \"1rem\") — the value at `baseStep`.'),\n ratio: desc(z.number(), 'Modular ratio between adjacent steps at large viewports.'),\n steps: desc(\n z.optional(z.number()),\n 'Token count when `names` is absent (steps are then named 1..steps).',\n ),\n names: desc(\n z.optional(z.array(z.string())),\n 'Step names, smallest → largest (e.g. [\"xs\",\"sm\",\"md\",…]); each becomes a token suffix.',\n ),\n baseStep: desc(z.optional(z.number()), '1-based index of the step whose value is `base`.'),\n baseline: desc(\n z.optional(z.string()),\n 'Named step used as the fluid pivot / GUI scale centre (defaults to `baseStep`).',\n ),\n fluid: desc(\n z.optional(\n z.object({\n minVw: desc(z.string(), 'Viewport width (CSS length) where fluid scaling bottoms out.'),\n maxVw: desc(z.string(), 'Viewport width (CSS length) where fluid scaling tops out.'),\n minRatio: desc(z.number(), 'Modular ratio at/below `minVw` (usually < `ratio`).'),\n }),\n ),\n 'Makes the scale fluid: each step compiles to a clamp() that interpolates from `minRatio` at `minVw` to `ratio` at `maxVw`.',\n ),\n});\n\n// ── patterns ────────────────────────────────────────────────────────────────\nconst Pattern = desc(\n z.object({\n group: desc(\n z.optional(z.string()),\n 'Token-cascade group this pattern belongs to (e.g. tag / control / panel); base declarations resolve through `--<prop>-<group>` before `--<prop>-default`.',\n ),\n overrides: z.optional(\n desc(CssDecls, 'Per-pattern token overrides, emitted as `--<prop>-<name>-group` values.'),\n ),\n element: desc(\n z.optional(z.string()),\n 'Style at element level via zero-specificity `:where(<element>)` (instead of, or alongside, a class).',\n ),\n class: desc(z.optional(z.string()), \"Class name to emit (defaults to the pattern's key).\"),\n default_role: desc(\n z.optional(z.string()),\n 'Semantic colour role applied to the bare/default variant.',\n ),\n base: z.optional(\n desc(\n CssDecls,\n 'Base CSS declarations. Geometry properties (padding, border-radius, border, box-shadow, font-size) are wrapped in per-pattern override hooks (`--p-<name>`, `--br-<name>`, `--b-<name>`, `--ds-<name>`, `--fs-<name>`) so consumers can restyle one pattern by setting one variable.',\n ),\n ),\n states: desc(\n z.optional(z.record(z.string(), z.record(z.string(), z.unknown()))),\n 'Interaction states (hover / active / focus-visible), each a map of shortcuts: `step` (intensify fills/text by n emphasis stops), `scale` (transform scale), `lift` (translateY + shadow), `shadow` (a shadow name → drop-shadow(var(--shadow-<name>)), or true → lift shadow), `ring` (focus ring), or raw `css` declarations. Hover rules are wrapped in `@media (hover: hover)`.',\n ),\n roles: desc(\n z.optional(z.array(z.string())),\n 'Semantic colour role variants to emit as `<pattern>-<role>` classes (fills use the role solid / on-solid tokens).',\n ),\n }),\n 'One component pattern (button, link, badge, card, …): base declarations + interaction states + semantic role variants, resolved through the pattern token cascade.',\n);\n\nconst Patterns = desc(\n z.object({\n defaults: z.optional(\n desc(CssDecls, 'Cascade-wide fallback tokens, emitted as `--<prop>-default`.'),\n ),\n radii: z.optional(\n desc(CssDecls, 'Shape primitives, emitted as `--br-<name>` (referenced by pattern bases).'),\n ),\n groups: desc(\n z.optional(z.record(z.string(), CssDecls)),\n 'Group-level tokens, emitted as `--<prop>-<group>`; patterns opt in via their `group` key.',\n ),\n z: desc(z.optional(z.record(z.string(), z.number())), 'Z-index tiers → `--z-tier-<name>`.'),\n items: desc(\n z.optional(z.record(z.string(), Pattern)),\n 'The component patterns to emit, keyed by name.',\n ),\n }),\n 'Component patterns and their token cascade: `defaults` → `groups` → per-pattern `overrides`, plus shape (`radii`) and z-index primitives.',\n);\n\n// ── typography ──────────────────────────────────────────────────────────────\nconst TypographyRole = desc(\n z.record(z.string(), Scalar),\n 'An open bag of CSS-ish keys (family / size / weight / line-height / tracking / transform / decoration / text-wrap / …); the generator maps known keys and passes the rest through.',\n);\nconst Typography = desc(\n z.object({\n families: desc(\n z.optional(z.record(z.string(), z.string())),\n 'Role-facing family aliases → CSS font values, usually referencing the top-level `fonts` tokens (e.g. \"var(--font-display)\").',\n ),\n roles: desc(\n z.optional(z.record(z.string(), TypographyRole)),\n 'Semantic type roles (display, title, heading, body, quote, caption, eyebrow, code, lead, footnote, tag, …), each emitted as a `font-<role>` class.',\n ),\n headings: desc(\n z.optional(z.record(z.string(), z.string())),\n 'Maps heading elements (h1…h6) to type roles so bare headings pick up role styling.',\n ),\n }),\n 'Typography: family aliases, semantic type roles (→ `font-<role>` classes), and the heading-element → role mapping.',\n);\n\n// ── animations ──────────────────────────────────────────────────────────────\nconst AnimEffect = desc(\n z.object({\n kf: desc(\n z.string(),\n 'Keyframe family driving the effect: composite (transform/opacity), paint, or layout.',\n ),\n css: z.optional(desc(VarMap, 'Extra literal declarations merged into the effect class as-is.')),\n vars: z.optional(\n desc(\n VarMap,\n 'Effect endpoint variables (`--<key>: <value>`, e.g. opacity-from, translate-y-to) that override the keyframe defaults.',\n ),\n ),\n }),\n 'A named animation effect class — a pure value layer (`--_anim` + `--<prop>-from/-to`) over the static keyframe engine.',\n);\nconst Animations = desc(\n z.object({\n effects: desc(\n z.optional(z.record(z.string(), AnimEffect)),\n 'Effect classes to emit (`.fade-in`, `.reveal-left`, …), keyed by class name.',\n ),\n journeys: desc(\n z.optional(\n z.object({\n base: desc(\n z.optional(z.record(z.string(), VarMap)),\n 'Named journey building blocks: part name → var map.',\n ),\n compose: desc(\n z.optional(z.array(z.array(z.string()))),\n 'Combinations of base parts, each emitted as a `.<parts>-journey` class.',\n ),\n }),\n ),\n 'Multi-part journey classes composed from `base` building blocks.',\n ),\n }),\n 'Animation effect + journey classes (pure value layers). The animation engine itself — keyframes, drivers, floats, utilities — is static framework CSS, not configured here.',\n);\n\n// ── the design system ───────────────────────────────────────────────────────\nexport const DesignSystemSchema = z.object({\n $schema: desc(\n z.optional(z.string()),\n 'URL of the published JSON Schema (stamped by `vitops init`) so editors provide autocomplete + validation.',\n ),\n colors: Colors,\n shadows: desc(\n z.optional(z.record(z.string(), z.string())),\n 'Named shadows → `--shadow-<name>` tokens and `.drop-shadow-<name>` utilities. Values are shadow parameter lists (offset/blur/colour), applied via `filter: drop-shadow(…)`.',\n ),\n fonts: desc(\n z.optional(z.record(z.string(), z.string())),\n 'Raw font stacks by name, emitted as `--font-<name>` tokens (referenced by `typography.families`).',\n ),\n typeScale: desc(\n z.optional(Scale),\n 'Fluid modular TYPE scale → `--text-<name>` tokens, consumed by typography roles and text-size utilities.',\n ),\n spaceScale: desc(\n z.optional(Scale),\n 'Fluid modular SPACE scale → `--space-<name>` tokens, consumed by spacing/gap utilities and vertical rhythm.',\n ),\n patterns: z.optional(Patterns),\n typography: z.optional(Typography),\n animations: z.optional(Animations),\n});\n\nexport type DesignSystem = z.infer<typeof DesignSystemSchema>;\n\n// A deep-partial view used for theme deltas: `extends` patches and alternate\n// schemes supply only what they override, so every field (down through\n// colors → schemes → semantic) is optional. Reuses the same leaf schemas, so\n// there's no second source of truth. Completeness is enforced after merge\n// (validate the resolved theme against `DesignSystemSchema`).\nconst ColorsPatch = z.object({\n palette: z.optional(z.record(z.string(), Ramp)),\n roles: z.optional(z.record(z.string(), z.string())),\n utilities: z.optional(z.array(UtilityName)),\n});\nexport const DesignSystemPatchSchema = z.extend(z.partial(DesignSystemSchema), {\n colors: z.optional(ColorsPatch),\n});\nexport type DesignSystemPatch = z.infer<typeof DesignSystemPatchSchema>;\n\n/**\n * Stable URL of the published JSON Schema. Resolves once `@getvitops/generator` is on\n * npm (unpkg serves the packaged `schema.json`); `vitops init` stamps this into a\n * scaffolded config's `$schema` so editors light up autocomplete + validation.\n */\nexport const SCHEMA_URL = 'https://unpkg.com/@getvitops/generator/schema.json';\n\n/** The published JSON Schema (draft-2020-12), derived from the zod schema. */\nexport const jsonSchema = {\n $id: SCHEMA_URL,\n ...z.toJSONSchema(DesignSystemSchema, { target: 'draft-2020-12' }),\n};\n\nexport type ValidationResult =\n | { ok: true; data: DesignSystem; errors: [] }\n | { ok: false; data: undefined; errors: z.core.$ZodIssue[] };\n\n/** Validate an unknown value against the design-system schema. */\nexport function validate(input: unknown): ValidationResult {\n const result = z.safeParse(DesignSystemSchema, input);\n if (!result.success) return { ok: false, data: undefined, errors: result.error.issues };\n // Every role must point at a palette hue that exists.\n const { palette, roles } = result.data.colors;\n for (const [role, hue] of Object.entries(roles)) {\n if (palette[hue] == null) {\n return {\n ok: false,\n data: undefined,\n errors: [\n {\n code: 'custom',\n path: ['colors', 'roles', role],\n message: `role \"${role}\" references unknown palette hue \"${hue}\"`,\n } as z.core.$ZodIssue,\n ],\n };\n }\n }\n return { ok: true, data: result.data, errors: [] };\n}\n","/**\n * Data shared between the generator (`generate.ts`) and the docs bundle\n * (`docs.ts`). Lives in its own module because `generate.ts` imports `docs.ts` —\n * importing back the other way would be a cycle.\n */\n\n/**\n * Pattern base geometry props → per-pattern override-hook shorthand. Each hook\n * wraps the authored value (`padding: var(--p-button, 0.6em 1.2em)`) so a\n * consumer restyles one pattern by setting one variable.\n */\nexport const BASE_HOOK: Record<string, string> = {\n padding: 'p',\n 'border-radius': 'br',\n border: 'b',\n 'box-shadow': 'ds',\n 'font-size': 'fs',\n};\n\n/**\n * Framework utility classes whose names collide with Tailwind's own defaults.\n * The `tailwind` format strips any rule targeting these — Tailwind provides\n * them, so consumers use Tailwind's utilities for these names instead.\n */\nexport const TW_CLASH: ReadonlySet<string> = new Set<string>([\n 'block',\n 'inline',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-row',\n 'contents',\n 'hidden',\n 'list-item',\n 'static',\n 'fixed',\n 'absolute',\n 'relative',\n 'sticky',\n 'isolate',\n 'visible',\n 'invisible',\n 'collapse',\n 'sr-only',\n 'not-sr-only',\n 'flex-row',\n 'flex-row-reverse',\n 'flex-col',\n 'flex-col-reverse',\n 'flex-wrap',\n 'flex-nowrap',\n 'items-start',\n 'items-end',\n 'items-center',\n 'items-baseline',\n 'items-stretch',\n 'justify-start',\n 'justify-end',\n 'justify-center',\n 'justify-between',\n 'justify-around',\n 'justify-evenly',\n 'content-start',\n 'content-end',\n 'content-center',\n 'content-between',\n 'content-around',\n 'content-evenly',\n 'text-left',\n 'text-center',\n 'text-right',\n 'text-justify',\n 'text-start',\n 'text-end',\n]);\n","/**\n * Palette expansion + semantic functional tokens.\n *\n * A palette hue is authored one of two ways:\n * • `{ seed, anchors? }` — an 11-step numeric scale (50…950) generated in\n * OKLCH via @getvitops/utils/color (lightness transposed toward tinted\n * near-white/near-black, chroma dampened at the extremes),\n * • `{ tones }` — a fixed brand kit: authored tones placed verbatim at their\n * nearest steps + tinted endpoints; nothing else is invented (strict kits).\n *\n * Every role (from `colors.roles`) gets FUNCTIONAL tokens — the public API:\n * --<role>-bg / -bg-muted / -border / -border-bold / -solid / -solid-bold /\n * -on-solid / -text / -text-muted / -text-x-muted\n * plus the appearance-relative emphasis stops (x-muted · muted · bold · x-bold)\n * and, for `surface`, the translucent `--surface-glass` + `--overlay` scrim.\n * Dark mode flips the mapping automatically (solid stays mode-stable).\n */\nimport {\n contrastLc,\n generateOklchPalette,\n hexToOklch,\n oklchStringToHex,\n pickOn,\n} from '@getvitops/utils/color';\n\nexport const NUMERIC_STEPS = [\n '50',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n] as const;\ntype NumStep = (typeof NUMERIC_STEPS)[number];\n\n// Lightness centres of the numeric scale (mirrors the engine's internal curve).\nconst STEP_L: Record<NumStep, number> = {\n '50': 0.95,\n '100': 0.9,\n '200': 0.8,\n '300': 0.7,\n '400': 0.6,\n '500': 0.5,\n '600': 0.4,\n '700': 0.3,\n '800': 0.2,\n '900': 0.1,\n '950': 0.05,\n};\n\nexport interface ExpandedHue {\n /** Numeric steps (sparse for fixed-tone kits). */\n numeric: Partial<Record<NumStep, string>>;\n /** True when only authored tones + endpoints exist (no interpolation). */\n sparse?: boolean;\n}\n\ninterface SeedInput {\n seed: string;\n anchors?: Record<string, string>;\n}\ninterface TonesInput {\n tones: string[] | Record<string, string>;\n}\n\nconst isHex = (v: string) => v.startsWith('#');\nconst toOklchStr = (v: string) => {\n if (!isHex(v)) return v; // already oklch(...)\n const { l, c, h } = hexToOklch(v);\n return `oklch(${(l * 100).toFixed(2)}% ${c.toFixed(4)} ${h.toFixed(2)})`;\n};\nconst nearestStep = (l: number): NumStep =>\n NUMERIC_STEPS.reduce((best, s) =>\n Math.abs(l - STEP_L[s]) < Math.abs(l - STEP_L[best]) ? s : best,\n );\n\nfunction expandSeeded(input: SeedInput): ExpandedHue {\n // Seed + author anchors pinned at their natural (or explicit) steps, PLUS\n // implicit tinted near-white/near-black endpoint anchors (unless the author\n // pins 50/950 themselves). The engine then interpolates lightness/chroma\n // piecewise BETWEEN anchors — monotonic by construction, with the light side\n // actually reaching near-white (the original \"mid-gray light end\" bug) and\n // chroma tapering toward the tinted-neutral ends.\n const anchors: Record<string, string> = {};\n const seedStep = nearestStep(hexToOklch(input.seed).l);\n anchors[seedStep] = toOklchStr(input.seed);\n for (const [key, value] of Object.entries(input.anchors ?? {})) {\n const step = (NUMERIC_STEPS as readonly string[]).includes(key)\n ? key\n : nearestStep(hexToOklch(value).l);\n anchors[step] = toOklchStr(value);\n }\n const hue = hexToOklch(input.seed).h;\n anchors['50'] ??= `oklch(97% 0.008 ${hue.toFixed(2)})`;\n anchors['950'] ??= `oklch(13% 0.015 ${hue.toFixed(2)})`;\n const scale = generateOklchPalette(anchors) as Record<string, string>;\n const numeric: Partial<Record<NumStep, string>> = {};\n for (const s of NUMERIC_STEPS) if (scale[s] != null) numeric[s] = oklchStringToHex(scale[s]);\n return { numeric };\n}\n\nfunction expandTones(input: TonesInput): ExpandedHue {\n // Strict kit: authored tones verbatim at their nearest step; add tinted\n // endpoints (the one allowed exception); interpolate nothing else.\n const tones = Array.isArray(input.tones) ? input.tones : Object.values(input.tones);\n const numeric: Partial<Record<NumStep, string>> = {};\n for (const hex of tones) numeric[nearestStep(hexToOklch(hex).l)] = hex;\n const hue = hexToOklch(tones[0] ?? '#808080').h;\n numeric['50'] ??= oklchStringToHex(`oklch(97% 0.010 ${hue.toFixed(2)})`);\n numeric['950'] ??= oklchStringToHex(`oklch(15% 0.015 ${hue.toFixed(2)})`);\n return { numeric, sparse: true };\n}\n\n/** Snap to the nearest AVAILABLE numeric step (sparse kits). */\nfunction snap(numeric: Partial<Record<NumStep, string>>, want: NumStep): NumStep {\n if (numeric[want] != null) return want;\n const have = NUMERIC_STEPS.filter((s) => numeric[s] != null);\n return have.reduce((best, s) =>\n Math.abs(STEP_L[s] - STEP_L[want]) < Math.abs(STEP_L[best] - STEP_L[want]) ? s : best,\n );\n}\n\n/** Expand every palette hue into its numeric scale. */\nexport function expandPalette(raw: Record<string, unknown>): Record<string, ExpandedHue> {\n const out: Record<string, ExpandedHue> = {};\n for (const [name, entry] of Object.entries(raw)) {\n const e = entry as Partial<SeedInput & TonesInput>;\n if (typeof e?.seed === 'string') out[name] = expandSeeded(e as SeedInput);\n else if (e?.tones != null) out[name] = expandTones(e as TonesInput);\n else throw new Error(`palette hue \"${name}\" must have a \"seed\" or \"tones\"`);\n }\n return out;\n}\n\n// ── functional token mapping ─────────────────────────────────────────────────\n\ntype TokenMap = Record<string, NumStep>;\nconst LIGHT: TokenMap = {\n bg: '50',\n 'bg-muted': '100',\n border: '200',\n 'border-bold': '300',\n text: '950',\n 'text-muted': '800',\n 'text-x-muted': '600',\n};\nconst DARK: TokenMap = {\n bg: '950',\n 'bg-muted': '900',\n border: '800',\n 'border-bold': '700',\n text: '50',\n 'text-muted': '200',\n 'text-x-muted': '400',\n};\n// surface = background planes; elevation is lighter-when-raised in BOTH modes.\nconst SURFACE_LIGHT: TokenMap = { ...LIGHT, bg: '100', 'bg-muted': '200', 'bg-bold': '50' };\nconst SURFACE_DARK: TokenMap = { ...DARK, bg: '900', 'bg-muted': '950', 'bg-bold': '800' };\n// appearance-relative emphasis stops (base excluded — the bare name is functional).\nconst EMPHASIS_LIGHT: TokenMap = { 'x-muted': '100', muted: '300', bold: '700', 'x-bold': '900' };\nconst EMPHASIS_DARK: TokenMap = { 'x-muted': '900', muted: '700', bold: '300', 'x-bold': '100' };\n\nexport interface FunctionalRole {\n role: string;\n hue: string;\n /** token → CSS value, per appearance. */\n light: Record<string, string>;\n dark: Record<string, string>;\n}\n\n/** Resolve the functional token set for one role over its hue. */\nexport function functionalRole(role: string, hueName: string, hue: ExpandedHue): FunctionalRole {\n const numeric = hue.numeric;\n const v = (n: NumStep) => `var(--color-${hueName}-${snap(numeric, n)})`;\n const hex = (n: NumStep) => numeric[snap(numeric, n)] as string;\n\n // solid: the vivid tone — at least 500 (white text needs the depth), at most 700.\n const naturalRaw = NUMERIC_STEPS.find((s) => numeric[s] === hex('500')) ?? '500';\n const natural = Number(snap(numeric, naturalRaw));\n const solidStep = snap(numeric, String(Math.min(Math.max(natural, 500), 700)) as NumStep);\n const solidBold = snap(numeric, String(Math.min(Number(solidStep) + 100, 950)) as NumStep);\n const onSolid = pickOn(numeric[solidStep] as string);\n\n const isSurface = role === 'surface';\n const map = (table: TokenMap): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [token, step] of Object.entries(table)) out[token] = v(step as NumStep);\n return out;\n };\n const emphasis = (table: TokenMap, prefix: string): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [stop, step] of Object.entries(table)) out[`${prefix}-${stop}`] = v(step as NumStep);\n return out;\n };\n\n const light = {\n ...map(isSurface ? SURFACE_LIGHT : LIGHT),\n solid: v(solidStep),\n 'solid-bold': v(solidBold),\n 'on-solid': onSolid,\n ...emphasis(EMPHASIS_LIGHT, 'stop'),\n };\n const dark = {\n ...map(isSurface ? SURFACE_DARK : DARK),\n solid: v(solidStep),\n 'solid-bold': v(solidBold),\n 'on-solid': onSolid,\n ...emphasis(EMPHASIS_DARK, 'stop'),\n };\n return { role, hue: hueName, light, dark };\n}\n\n/** Verify a functional role's contrast targets. Returns human-readable failures. */\nexport function checkContrast(\n fr: FunctionalRole,\n numericOf: (hueName: string) => Partial<Record<NumStep, string>>,\n): string[] {\n const failures: string[] = [];\n const resolve = (val: string): string => {\n const m = /^var\\(--color-([a-z0-9-]+)-(\\d+)\\)$/.exec(val);\n if (!m) return val;\n return numericOf(m[1] as string)[m[2] as NumStep] ?? val;\n };\n for (const [name, tokens] of [\n ['light', fr.light],\n ['dark', fr.dark],\n ] as const) {\n const bg = resolve(tokens.bg as string);\n const checks: Array<[string, string, number]> = [\n ['text', resolve(tokens.text as string), 75],\n ['text-muted', resolve(tokens['text-muted'] as string), 60],\n ];\n for (const [token, hexV, min] of checks) {\n const lc = contrastLc(hexV, bg);\n if (lc < min)\n failures.push(`${fr.role}/${name}: ${token} Lc ${lc.toFixed(1)} < ${min} on bg ${bg}`);\n }\n const onLc = contrastLc(tokens['on-solid'] as string, resolve(tokens.solid as string));\n if (onLc < 60)\n failures.push(`${fr.role}/${name}: on-solid Lc ${onLc.toFixed(1)} < 60 on solid`);\n }\n return failures;\n}\n","/**\n * OKF documentation bundle generator (ported from the repo's `generate-docs.ts`).\n *\n * Pure: `generateDocs(ds, assetsDir)` returns a `{ relPath: markdown }` map for the\n * Open Knowledge Format tree (top index, css/, bricks/), reading the Bricks element\n * PHP from `<assetsDir>/bricks/elements`. No filesystem writes — the caller decides\n * where the bundle lands (e.g. `<outDir>/docs`).\n */\nimport { readFileSync, readdirSync, existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { jsonSchema, SCHEMA_URL, type DesignSystem } from './schema.ts';\nimport { BASE_HOOK, TW_CLASH } from './shared.ts';\nimport { expandPalette } from './tokens.ts';\n\nconst DS_PATH = 'design-system.json';\n\n// Curated element display order (by $name, sans the vitops- prefix). Unlisted\n// elements fall to the end alphabetically so new ones still appear.\nconst ORDER = [\n 'split',\n 'centered',\n 'carousel',\n 'color-scheme-toggle',\n 'copy-button',\n 'dismissable',\n 'entries',\n 'image-compare',\n 'sitenav',\n 'multi-field',\n 'split-link',\n 'split-panel',\n];\n\n// ── PHP array-literal parser ─────────────────────────────────────────────────\ntype Json = string | number | boolean | null | Json[] | { [k: string]: Json };\n\ninterface Tok {\n t: 'str' | 'num' | 'id' | 'punc' | 'arrow';\n v: string;\n}\n\nfunction tokenize(src: string): Tok[] {\n const toks: Tok[] = [];\n let i = 0;\n const n = src.length;\n while (i < n) {\n const c = src[i] as string;\n if (c === ' ' || c === '\\t' || c === '\\n' || c === '\\r') {\n i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '/') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '#') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '*') {\n i += 2;\n while (i < n && !(src[i] === '*' && src[i + 1] === '/')) i++;\n i += 2;\n continue;\n }\n if (c === \"'\" || c === '\"') {\n const quote = c;\n i++;\n let s = '';\n while (i < n && src[i] !== quote) {\n if (src[i] === '\\\\' && i + 1 < n) {\n const next = src[i + 1];\n s += next === 'n' ? '\\n' : next === 't' ? '\\t' : next;\n i += 2;\n } else {\n s += src[i++];\n }\n }\n i++;\n toks.push({ t: 'str', v: s });\n continue;\n }\n if (c === '=' && src[i + 1] === '>') {\n toks.push({ t: 'arrow', v: '=>' });\n i += 2;\n continue;\n }\n if ('[](){},'.includes(c)) {\n toks.push({ t: 'punc', v: c });\n i++;\n continue;\n }\n if (\n (c >= '0' && c <= '9') ||\n (c === '-' && (src[i + 1] as string) >= '0' && (src[i + 1] as string) <= '9')\n ) {\n let s = c;\n i++;\n while (i < n && (src[i] as string) >= '0' && (src[i] as string) <= '9') s += src[i++];\n toks.push({ t: 'num', v: s });\n continue;\n }\n if (/[A-Za-z_\\\\]/.test(c)) {\n let s = c;\n i++;\n while (i < n && /[A-Za-z0-9_\\\\]/.test(src[i] as string)) s += src[i++];\n toks.push({ t: 'id', v: s });\n continue;\n }\n i++;\n }\n return toks;\n}\n\nclass Parser {\n p = 0;\n toks: Tok[];\n constructor(toks: Tok[]) {\n this.toks = toks;\n }\n peek(): Tok | undefined {\n return this.toks[this.p];\n }\n next(): Tok | undefined {\n return this.toks[this.p++];\n }\n parseValue(): Json {\n const t = this.peek();\n if (!t) return null;\n if (t.t === 'str') {\n this.next();\n return t.v;\n }\n if (t.t === 'num') {\n this.next();\n return Number(t.v);\n }\n if (t.t === 'id') {\n this.next();\n if (t.v === 'true') return true;\n if (t.v === 'false') return false;\n if (t.v === 'null') return null;\n if (this.peek()?.t === 'punc' && this.peek()?.v === '(') {\n this.next();\n if (t.v === 'array') return this.parseBody(')');\n const args = this.parseCallArgs();\n return args.find((a) => typeof a === 'string') ?? args[0] ?? '';\n }\n return t.v;\n }\n if (t.t === 'punc' && t.v === '[') {\n this.next();\n return this.parseBody(']');\n }\n if (t.t === 'punc' && t.v === '(') {\n this.next();\n return this.parseBody(')');\n }\n this.next();\n return null;\n }\n private parseCallArgs(): Json[] {\n const args: Json[] = [];\n while (this.peek() && !(this.peek()!.t === 'punc' && this.peek()!.v === ')')) {\n args.push(this.parseValue());\n if (this.peek()?.t === 'punc' && this.peek()?.v === ',') this.next();\n }\n this.next();\n return args;\n }\n private parseBody(close: string): Json {\n const list: Json[] = [];\n const map: Record<string, Json> = {};\n let keyed = false;\n while (this.peek() && !(this.peek()!.t === 'punc' && this.peek()!.v === close)) {\n const first = this.parseValue();\n if (this.peek()?.t === 'arrow') {\n this.next();\n const val = this.parseValue();\n // PHP array keys are scalars; stringify objects defensively.\n map[typeof first === 'object' && first !== null ? JSON.stringify(first) : String(first)] =\n val;\n keyed = true;\n } else {\n list.push(first);\n }\n if (this.peek()?.t === 'punc' && this.peek()?.v === ',') this.next();\n }\n this.next();\n return keyed ? map : list;\n }\n}\n\nfunction parsePhpLiteral(text: string): Json {\n return new Parser(tokenize(text)).parseValue();\n}\n\n// ── Source-region helpers ────────────────────────────────────────────────────\nfunction matchBalanced(src: string, open: number): number {\n const pairs: Record<string, string> = { '(': ')', '[': ']', '{': '}' };\n const stack: string[] = [];\n let i = open;\n const n = src.length;\n while (i < n) {\n const c = src[i] as string;\n if (c === '/' && src[i + 1] === '/') {\n while (i < n && src[i] !== '\\n') i++;\n continue;\n }\n if (c === '/' && src[i + 1] === '*') {\n i += 2;\n while (i < n && !(src[i] === '*' && src[i + 1] === '/')) i++;\n i += 2;\n continue;\n }\n if (c === \"'\" || c === '\"') {\n i++;\n while (i < n && src[i] !== c) {\n if (src[i] === '\\\\') i++;\n i++;\n }\n i++;\n continue;\n }\n if (c in pairs) stack.push(pairs[c] as string);\n else if (c === ')' || c === ']' || c === '}') {\n if (stack.pop() !== c) {\n /* unbalanced — best effort */\n }\n if (stack.length === 0) return i + 1;\n }\n i++;\n }\n return n;\n}\n\nfunction methodBody(src: string, name: string): string | null {\n const m = new RegExp(`function\\\\s+${name}\\\\s*\\\\([^)]*\\\\)`).exec(src);\n if (!m) return null;\n const brace = src.indexOf('{', m.index + m[0].length);\n if (brace < 0) return null;\n const end = matchBalanced(src, brace);\n return src.slice(brace + 1, end - 1);\n}\n\nfunction literalAt(src: string, fromIdx: number): { text: string; end: number } | null {\n let i = fromIdx;\n while (i < src.length && /\\s/.test(src[i] as string)) i++;\n let open: number;\n if (src[i] === '[') open = i;\n else if (src.startsWith('array', i)) open = src.indexOf('(', i);\n else return null;\n const end = matchBalanced(src, open);\n return { text: src.slice(i, end), end };\n}\n\n// ── Per-element extraction ───────────────────────────────────────────────────\ninterface Control {\n key: string;\n def: Record<string, Json>;\n}\ninterface Element {\n name: string;\n label: string;\n nestable: boolean;\n docblock: string;\n controls: Control[];\n cssClass: string | null;\n children: string[];\n keywords: string[];\n}\n\nfunction firstString(re: RegExp, src: string): string | null {\n const m = re.exec(src);\n return m ? (m[1] ?? null) : null;\n}\n\nfunction extractDocblock(src: string): string {\n const m = /\\/\\*\\*([\\s\\S]*?)\\*\\//.exec(src);\n if (!m) return '';\n const lines = (m[1] as string)\n .split('\\n')\n .map((l) => l.replace(/^\\s*\\*?\\s?/, '').replace(/\\s+$/, ''));\n while (lines.length && lines[0] === '') lines.shift();\n if (lines.length && /Bricks Builder\\)\\./.test(lines[0] as string)) lines.shift();\n const owned = lines.findIndex((l) => l.startsWith('Owned by the framework repo'));\n const kept = (owned >= 0 ? lines.slice(0, owned) : lines).map((l) => l.replace(/^•\\s*/, '- '));\n while (kept.length && kept[kept.length - 1] === '') kept.pop();\n while (kept.length && kept[0] === '') kept.shift();\n return kept.join('\\n');\n}\n\nfunction extractControls(src: string): Control[] {\n const body = methodBody(src, 'set_controls');\n if (!body) return [];\n const controls: Control[] = [];\n const re = /\\$this->controls\\[\\s*'([^']+)'\\s*\\](\\[\\s*'([^']+)'\\s*\\])?\\s*=\\s*/g;\n let m: RegExpExecArray | null;\n while ((m = re.exec(body))) {\n const key = m[1] as string;\n if (m[2]) continue;\n const lit = literalAt(body, m.index + m[0].length);\n if (!lit) continue;\n const def = parsePhpLiteral(lit.text);\n if (def && typeof def === 'object' && !Array.isArray(def))\n controls.push({ key, def: def as Record<string, Json> });\n re.lastIndex = lit.end;\n }\n return controls;\n}\n\nfunction extractChildren(src: string): string[] {\n const body = methodBody(src, 'get_nestable_children');\n if (!body) return [];\n const labels: string[] = [];\n const re = /'label'\\s*=>\\s*esc_html__\\(\\s*'([^']*)'/g;\n let m: RegExpExecArray | null;\n while ((m = re.exec(body))) labels.push(m[1] as string);\n return labels;\n}\n\nfunction extractKeywords(src: string): string[] {\n const body = methodBody(src, 'get_keywords');\n if (!body) return [];\n const ret = /return\\s+/.exec(body);\n if (!ret) return [];\n const lit = literalAt(body, ret.index + ret[0].length);\n if (!lit) return [];\n const arr = parsePhpLiteral(lit.text);\n return Array.isArray(arr) ? arr.filter((x): x is string => typeof x === 'string') : [];\n}\n\nfunction parseElement(src: string): Element | null {\n const name = firstString(/public\\s+\\$name\\s*=\\s*'vitops-([^']+)'/, src);\n if (!name) return null;\n return {\n name,\n label:\n firstString(/function get_label\\(\\)[\\s\\S]*?return\\s+esc_html__\\(\\s*'([^']*)'/, src) ?? name,\n nestable: /public\\s+\\$nestable\\s*=\\s*true/.test(src),\n docblock: extractDocblock(src),\n controls: extractControls(src),\n cssClass: firstString(\n /\\$this->controls\\[\\s*'_cssClasses'\\s*\\]\\[\\s*'default'\\s*\\]\\s*=\\s*'([^']*)'/,\n src,\n ),\n children: extractChildren(src),\n keywords: extractKeywords(src),\n };\n}\n\n// ── Markdown rendering ───────────────────────────────────────────────────────\n/** Stringify a parsed-PHP Json value for prose (objects → JSON, not [object Object]). */\nconst asText = (v: Json | undefined): string =>\n v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v);\n\nfunction controlLine(c: Control): string {\n const def = c.def;\n if (def.type === 'info') return `- _Note:_ ${asText(def.content)}`;\n const label = (def.label as string) || c.key;\n const options =\n def.options && typeof def.options === 'object' && !Array.isArray(def.options)\n ? (def.options as Record<string, string>)\n : null;\n const meta: string[] = [];\n let type = (def.type as string) || 'text';\n if (def.units === true) type += '+units';\n meta.push(type);\n if (def.default !== undefined) {\n const raw = asText(def.default);\n const shown = options && options[raw] ? options[raw] : raw;\n meta.push(`default \\`${shown}\\``);\n }\n if (def.placeholder !== undefined && def.placeholder !== '')\n meta.push(`placeholder \\`${asText(def.placeholder)}\\``);\n if (def.min !== undefined || def.max !== undefined)\n meta.push(\n `range ${def.min != null ? asText(def.min) : '–'}–${def.max != null ? asText(def.max) : '∞'}`,\n );\n const tail: string[] = [];\n if (def.description) tail.push(asText(def.description));\n if (options)\n tail.push(\n `Options: ${Object.values(options)\n .map((o) => `\\`${o}\\``)\n .join(', ')}.`,\n );\n if (Array.isArray(def.css) && def.css.length) {\n const first = def.css[0];\n if (first && typeof first === 'object' && !Array.isArray(first) && 'property' in first)\n tail.push(`Bound to \\`${asText((first as Record<string, Json>).property)}\\`.`);\n }\n if (def.type === 'repeater' && def.fields && typeof def.fields === 'object') {\n const fields = Object.values(def.fields as Record<string, Json>)\n .map((f) =>\n f && typeof f === 'object' && !Array.isArray(f)\n ? asText((f as Record<string, Json>).label)\n : null,\n )\n .filter(Boolean);\n if (fields.length) tail.push(`Fields: ${fields.join(', ')}.`);\n }\n const head = `- **${label}** (${meta.join(', ')})`;\n return tail.length ? `${head} — ${tail.join(' ')}` : head;\n}\n\nfunction renderElement(el: Element): string {\n const out: string[] = [];\n const nest = el.nestable ? 'nestable' : 'not nestable';\n out.push(`## ${el.label} — \\`vitops-${el.name}\\` · ${nest}`);\n out.push('');\n if (el.docblock) {\n out.push(el.docblock);\n out.push('');\n }\n const real = el.controls.filter((c) => c.def.type !== 'info');\n if (real.length) {\n out.push('**Controls**');\n out.push('');\n for (const c of el.controls) out.push(controlLine(c));\n out.push('');\n } else {\n const notes = el.controls.filter((c) => c.def.type === 'info');\n if (notes.length) {\n for (const c of notes) out.push(controlLine(c));\n out.push('');\n }\n }\n if (el.cssClass) {\n out.push(\n `**Base CSS class:** \\`${el.cssClass}\\` (applied automatically; add ratio/modifier classes alongside it in the element's \"CSS classes\" field).`,\n );\n out.push('');\n }\n if (el.children.length) {\n out.push(`**Seeded children:** ${el.children.join(', ')}.`);\n out.push('');\n }\n if (el.keywords.length) {\n out.push(`**Keywords:** ${el.keywords.filter((k) => k !== 'vitops').join(', ')}.`);\n out.push('');\n }\n return out.join('\\n');\n}\n\n// ── OKF helpers ──────────────────────────────────────────────────────────────\ninterface Frontmatter {\n type: string;\n title: string;\n description: string;\n resource?: string;\n tags?: string[];\n}\nfunction frontmatter(fm: Frontmatter): string {\n const q = (s: string) => `\"${s.replace(/\"/g, '\\\\\"')}\"`;\n const lines = [\n `type: ${q(fm.type)}`,\n `title: ${q(fm.title)}`,\n `description: ${q(fm.description)}`,\n ];\n if (fm.resource) lines.push(`resource: ${q(fm.resource)}`);\n if (fm.tags) lines.push(`tags: [${fm.tags.join(', ')}]`);\n lines.push('generator: \"@getvitops/generator\"');\n return `---\\n${lines.join('\\n')}\\n---`;\n}\n\nconst INDEX_NOTE = `<!-- GENERATED by @getvitops/generator — do not edit; regenerate with \\`vitops generate\\`. -->`;\n\nconst ELEMENTS_FRONTMATTER = frontmatter({\n type: 'Bricks Elements Reference',\n title: 'Vitops — Bricks Builder elements reference',\n description:\n 'Every repo-owned Bricks element, its controls, defaults, seeded children and keywords, for driving the Bricks Builder UI.',\n resource: 'bricks/elements',\n tags: ['bricks', 'wordpress', 'elements', 'design-system'],\n});\n\nconst ELEMENTS_PREAMBLE = `${ELEMENTS_FRONTMATTER}\n\n# Vitops — Bricks Builder elements reference\n\nContext for driving the Bricks Builder UI (e.g. Claude for Chrome). Every section below\nis generated from the element's own source, so this reference always matches the elements\ncurrently deployed. See also the CSS class vocabulary in [/css/classes.md](../css/classes.md)\nand the integration guidance in [/bricks/index.md](index.md).\n\n## How they appear in the builder\n\n- The elements register from \\`dist/bricks/load.php\\` and group under a **\"Vitops\"** category\n pinned to the **top** of the element panel. Insert one by searching its **label** (e.g.\n \"Split\", \"Carousel\") or any of its **keywords** (listed per element).\n- Two rendering families:\n - **Web-component elements** render a Lit custom element (\\`<wc-*>\\`, \\`<copy-button>\\`, …)\n from \\`dist/elements.js\\` and progressively enhance. A few (Image Compare, Split Panel)\n show their children stacked in the builder canvas until the client-side upgrade runs —\n that is expected, not broken.\n - **CSS-pattern elements** (Split, Centered, Menu, Split Link) render plain markup styled\n by the framework CSS — no JS dependency.\n- **Nestable** elements accept child elements dropped into them; some seed starter children\n (listed as \"Seeded children\"). **Non-nestable** elements are configured entirely through\n their controls.\n\n## Configuring layout\n\nSome layout is set through **controls**; some through **CSS classes typed into the element's\nbuilt-in \"CSS classes\" field** (called out per element as modifier classes). Responsive\nsuffixes on those classes engage from a container breakpoint: \\`-sm\\` = 30rem, \\`-md\\` = 48rem,\n\\`-lg\\` = 64rem, \\`-xl\\` = 80rem.\n\nEach control below lists its type, default/placeholder, any select options, and the CSS\ncustom property it writes (when it drives one). Info notes flagged _Note:_ carry the\nmodifier-class and structural guidance from the element itself.\n\n---\n`;\n\nfunction renderElementsDoc(elementsDir: string): string {\n const files = existsSync(elementsDir)\n ? readdirSync(elementsDir).filter((f) => f.endsWith('.php'))\n : [];\n const elements: Element[] = [];\n for (const f of files) {\n try {\n const el = parseElement(readFileSync(join(elementsDir, f), 'utf8'));\n if (el) elements.push(el);\n } catch {\n /* skip unparseable element */\n }\n }\n elements.sort((a, b) => {\n const ia = ORDER.indexOf(a.name);\n const ib = ORDER.indexOf(b.name);\n if (ia >= 0 && ib >= 0) return ia - ib;\n if (ia >= 0) return -1;\n if (ib >= 0) return 1;\n return a.name.localeCompare(b.name);\n });\n const body = elements.map(renderElement).join('\\n---\\n\\n');\n return `${ELEMENTS_PREAMBLE}\\n${body}`;\n}\n\n// ── CSS framework reference (rule-summarized, from the config) ────────────────\nconst code = (xs: string[]) => xs.map((x) => `\\`${x}\\``).join(', ');\n\nfunction renderCssClasses(ds: DesignSystem): string {\n const expanded = expandPalette(ds.colors.palette as Record<string, unknown>);\n const ramps = Object.keys(expanded);\n const roles = Object.keys(ds.colors.roles ?? {});\n const utils = ds.colors.utilities ?? ['bg', 'text', 'border'];\n const typeRoles = Object.keys(ds.typography?.roles ?? {});\n const shadows = Object.keys(ds.shadows ?? {});\n const effects = Object.keys(ds.animations?.effects ?? {});\n const items = (ds.patterns?.items ?? {}) as Record<\n string,\n { roles?: string[]; default_role?: string }\n >;\n const patterns = Object.keys(items);\n const patternRoles = Array.from(\n new Set(\n Object.values(items).flatMap(\n (p) => [p.default_role, ...(p.roles ?? [])].filter(Boolean) as string[],\n ),\n ),\n );\n const spaceNames = ds.spaceScale?.names ?? [];\n const typeNames = ds.typeScale?.names ?? [];\n const families = Object.keys(ds.typography?.families ?? {});\n const radii = Object.keys(ds.patterns?.radii ?? {});\n\n return `${frontmatter({\n type: 'CSS Framework Reference',\n title: 'Vitops CSS framework — class vocabulary',\n description:\n 'Every utility and component class in the Vitops CSS framework, stated as a naming rule over the design tokens it expands.',\n resource: DS_PATH,\n tags: ['css', 'utilities', 'patterns', 'design-system'],\n })}\n\n# Vitops CSS framework — class vocabulary (LLM reference)\n\nA variable-driven CSS framework. Classes encode the design system's **tokens** (colour,\ntype, space, shadow), **responsive grammar**, and **interaction states** — so styling with\nthese classes stays consistent and theme-/dark-mode-aware. Prefer them over hand-written\nCSS or ad-hoc property values.\n\nThis is a **rule reference**, not an exhaustive list: each family below is a naming rule\nplus the set of tokens it expands over. Applying a rule to any listed token yields a valid\nclass (e.g. rule \\`bg-<color>\\` + colour \\`pine-xl\\` → \\`bg-pine-xl\\`).\n\nThe tokens themselves are authored in \\`design-system.json\\` — see\n[/authoring.md](../authoring.md); the systems behind them are explained in\n[/concepts/](../concepts/index.md); per-format output differences (including which of\nthese utilities Tailwind provides natively) in [/formats.md](../formats.md).\n\n## Responsive & state variant grammar\n\nEvery utility accepts a **container-breakpoint prefix**; animation utilities also accept a\n**state prefix**. In CSS/Bricks the separator is \\`-\\`; in Tailwind it is \\`:\\` / \\`@\\`.\n\n| Intent | CSS / Bricks | Tailwind |\n| ----------------- | -------------------------- | ----------------------------------------- |\n| responsive split | \\`md-split-1-2\\` | \\`@md:split-1-2\\` |\n| responsive align | \\`md-items-center\\` | \\`@md:items-center\\` |\n| hover effect | \\`transition hover-fade-in\\` | \\`transition fade-in hover:flip-fade-in\\` |\n\n- Breakpoint prefixes (bare): \\`sm-\\` = 30rem, \\`md-\\` = 48rem, \\`lg-\\` = 64rem, \\`xl-\\` = 80rem.\n- State prefixes (animation effects only): \\`hover-\\`, \\`active-\\`, \\`focus-\\`, and \\`flip-<effect>\\`\n (plays the effect in reverse on toggle). Effects require \\`transition\\` on the element.\n\n## Layout & structure\n\n- **\\`centered\\`** — named-track grid centering content in the reading \\`measure\\` track.\n Widen a **direct child** by adding \\`breakout\\`, \\`spotlight\\`, or \\`fullbleed\\` (each\n breakpoint-prefixable) to that child. Track widths are set via \\`--width-measure\\` /\n \\`--width-breakout\\` / \\`--width-spotlight\\` and \\`--gutter\\`.\n- **\\`rhythm\\`** — relationship-based vertical spacing (margins between headings, paragraphs,\n lists, media) driven by the space scale. Usually paired with \\`centered\\`.\n- **\\`split\\`** — equal flex columns. Ratio rule: **\\`split-<a>-<b>\\`** where \\`<a>-<b>\\` ∈\n \\`1-2\\`, \\`2-1\\`, \\`1-3\\`, \\`3-1\\`, \\`1-4\\`, \\`4-1\\`, \\`2-3\\`, \\`3-2\\` (breakpoint-prefixable).\n- **Flex** — \\`flex\\`, \\`flex-row\\`, \\`flex-col\\`; \\`g\\` for gap (space-scale token).\n- **Alignment** — \\`items-{start,center,end,stretch}\\`, \\`justify-{start,center,end,between}\\`,\n text align \\`text-{start,center,end}\\` (all breakpoint-prefixable).\n- **Display** — \\`block\\`, \\`inline\\`, \\`inline-block\\`, \\`flex\\`, \\`grid\\`, \\`hidden\\`\n (breakpoint-prefixable, e.g. \\`md-hidden\\`).\n- **Accessibility** — \\`sr-only\\` / \\`not-sr-only\\` (breakpoint-prefixable).\n- **State hooks** — \\`is-active\\`, \\`is-open\\` (styling flags toggled by JS / native state).\n\n## Spacing\n\nThe space scale is ${code(spaceNames)} exposed as \\`--space-<name>\\` tokens.\nGap (\\`g\\`) and \\`rhythm\\` margins consume these tokens; prefer \\`rhythm\\` for vertical flow\nrather than per-element margins.\n\n## Typography\n\nRule: **\\`font-<role>\\`** — role ∈ ${code(typeRoles)}. Each role carries its own family,\nsize (from the type scale ${code(typeNames)}), tracking, transform, and weight.\nFamilies: ${code(families)} (\\`--font-*\\`).\n\n## Colour\n\n**Functional tokens are the primary vocabulary** — classes name the *job*, not the tone, and\nevery one remaps automatically under \\`:root[data-brx-theme=\"dark\"]\\` (background/text ends\nswap; \\`solid\\` fills stay mode-stable with a computed \\`on-\\` foreground). Prefer these over\nraw steps. Rules (role ∈ ${code(roles)}):\n\n- **Surfaces** — \\`bg-<role>\\` (the role's background wash; for \\`surface\\` this is the\n card/panel plane), \\`bg-<role>-muted\\` (subtle / sunken), \\`bg-surface-bold\\` (raised plane).\n- **Solid fills** — \\`bg-<role>-solid\\`, \\`bg-<role>-solid-bold\\` (hover / emphasis), paired\n with \\`text-on-<role>\\` for guaranteed-contrast foreground.\n- **Content** — \\`text-<role>\\` (primary, contrast-guaranteed in both appearances),\n \\`text-<role>-muted\\` (secondary), \\`text-<role>-x-muted\\` (tertiary / disabled).\n- **Borders** — \\`border-<role>\\`, \\`border-<role>-bold\\`.\n- **Translucency** — \\`glass\\` (translucent surface + backdrop blur); \\`--overlay\\` scrim var.\n- **Emphasis stops** (appearance-relative vars for power use):\n \\`--color-<role>-{x-muted,muted,bold,x-bold}\\` — \\`muted\\` recedes toward the background\n extreme, \\`bold\\` advances toward the foreground, in *either* appearance.\n\nEveryday pairings: page \\`bg-neutral\\` + \\`text-neutral\\`; cards \\`bg-surface\\`; captions\n\\`text-neutral-muted\\`; buttons \\`bg-ui-primary-solid text-on-ui-primary\\`; status text\n\\`text-danger\\` / \\`text-success\\` / \\`text-warning\\` / \\`text-info\\`.\n\n**Raw scale** (secondary / fine control) — rule \\`<util>-<hue>-<step>\\` with util ∈\n${code(utils)}: every hue is an 11-step OKLCH scale generated from its seed (or fixed brand\ntones), numeric steps \\`50\\` … \\`950\\` (tinted near-white → tinted near-black) — e.g.\n\\`bg-${ramps[0] ?? 'brand'}-100\\`, \\`text-${ramps[0] ?? 'brand'}-800\\`. Hues: ${code(ramps)}.\nThe **bare** role name (\\`bg-<role>\\`, \\`text-<role>\\`) is always the functional token.\n\n## Shadows\n\nRule: **\\`drop-shadow-<size>\\`** — size ∈ ${code(shadows)} (applied as a \\`filter\\`, so it\nfollows non-rectangular shapes).\n\n## Animation\n\nRule: **\\`<effect>\\`** (with the state/flip prefixes above) — effect ∈ ${code(effects)}.\nComposed **journeys** chain multiple effects into one entrance: rule \\`<parts>-journey\\`\n(e.g. \\`fade-slide-journey\\`, \\`fade-scale-blur-journey\\`). All require \\`transition\\` on the\nelement; scroll-linked entrances resolve within the first portion of the element's scroll.\n\n## Component patterns\n\nEach pattern is a base class \\`<pattern>\\` with interaction states (hover/active/focus-visible)\nbaked in; coloured patterns add role variants via rule **\\`<pattern>-<role>\\`**. (How the\npattern CSS is assembled — token cascade, \\`--p-<pattern>\\`-style override hooks, state\nshortcuts — is explained in [/concepts/patterns.md](../concepts/patterns.md).)\n\n- Patterns: ${code(patterns)}.\n- Roles (for coloured patterns like \\`badge\\`, \\`tag\\`, \\`status\\`, \\`button\\`):\n ${code(patternRoles)} — e.g. \\`badge-success\\`, \\`button-danger\\`. The default (unsuffixed)\n variant uses the brand-primary role.\n- Shape primitives: \\`--br-<name>\\` radii — ${code(radii)}.\n`;\n}\n\n// ── design-system.json authoring reference (walked from the JSON Schema) ─────\n// Field docs are rendered from `jsonSchema`'s `description` metadata (authored\n// once in schema.ts via `desc()`), so this reference cannot drift from validation.\n\ninterface JsonSchemaNode {\n type?: string;\n description?: string;\n properties?: Record<string, JsonSchemaNode>;\n required?: string[];\n additionalProperties?: JsonSchemaNode | boolean;\n anyOf?: JsonSchemaNode[];\n items?: JsonSchemaNode;\n enum?: unknown[];\n}\n\nconst isPrimitive = (n: JsonSchemaNode): boolean =>\n !n.properties && !n.anyOf && n.type != null && n.type !== 'object' && n.type !== 'array';\n\nfunction typeLabel(node: JsonSchemaNode): string {\n if (node.enum) return node.enum.map(String).join(' | ');\n if (node.anyOf)\n return node.anyOf.every(isPrimitive) ? node.anyOf.map((v) => v.type).join(' | ') : 'one of';\n if (node.type === 'array') {\n const it = node.items;\n if (it?.enum) return `array of ${it.enum.map(String).join(' | ')}`;\n return it?.type && it.type !== 'object' ? `array of ${it.type}` : 'array';\n }\n if (node.type === 'object') {\n const ap = node.additionalProperties;\n return ap && typeof ap === 'object' ? 'map' : 'object';\n }\n return node.type ?? 'value';\n}\n\n/** A node's documentable children: object properties, map values, or array items. */\nfunction childEntries(\n node: JsonSchemaNode,\n): Array<{ label: string; node: JsonSchemaNode; required: boolean }> {\n if (node.properties) {\n const req = node.required ?? [];\n return Object.entries(node.properties).map(([k, v]) => ({\n label: k,\n node: v,\n required: req.includes(k),\n }));\n }\n const ap = node.additionalProperties;\n if (ap && typeof ap === 'object' && (ap.description || ap.properties || ap.anyOf))\n return [{ label: '<name>', node: ap, required: false }];\n if (node.items && (node.items.description || node.items.properties || node.items.anyOf))\n return [{ label: '[items]', node: node.items, required: false }];\n return [];\n}\n\nfunction renderSchemaNode(\n label: string,\n node: JsonSchemaNode,\n required: boolean,\n depth: number,\n out: string[],\n): void {\n const indent = ' '.repeat(depth);\n const meta = `(${typeLabel(node)}${required ? ', required' : ''})`;\n out.push(`${indent}- \\`${label}\\` ${meta}${node.description ? ` — ${node.description}` : ''}`);\n if (depth >= 3) return;\n if (node.anyOf && !node.anyOf.every(isPrimitive)) {\n for (const variant of node.anyOf) {\n out.push(`${indent} - *one of*${variant.description ? ` — ${variant.description}` : ''}`);\n for (const c of childEntries(variant))\n renderSchemaNode(c.label, c.node, c.required, depth + 2, out);\n }\n return;\n }\n for (const c of childEntries(node)) renderSchemaNode(c.label, c.node, c.required, depth + 1, out);\n}\n\nfunction renderAuthoring(): string {\n const schema = jsonSchema as unknown as JsonSchemaNode;\n const required = schema.required ?? [];\n const sections: string[] = [];\n for (const [key, node] of Object.entries(schema.properties ?? {})) {\n if (key === '$schema') continue;\n const parts: string[] = [`## \\`${key}\\`${required.includes(key) ? '' : ' *(optional)*'}`];\n if (node.description) parts.push('', node.description);\n const bullets: string[] = [];\n for (const c of childEntries(node)) renderSchemaNode(c.label, c.node, c.required, 0, bullets);\n if (bullets.length) parts.push('', ...bullets);\n sections.push(parts.join('\\n'));\n }\n return `${frontmatter({\n type: 'Config Reference',\n title: 'Vitops — design-system.json authoring reference',\n description:\n 'Every field of the design-system.json config, generated from the published JSON Schema so it always matches validation.',\n resource: DS_PATH,\n tags: ['config', 'schema', 'authoring', 'design-system'],\n })}\n\n# \\`design-system.json\\` authoring reference\n\nThe single source of truth every output format is generated from. Each consumer authors\ntheir own config — there is no shared canonical token set. The field docs below are\nrendered from the published JSON Schema, so they always match what \\`vitops validate\\`\nenforces.\n\n- Set \\`\"$schema\": \"${SCHEMA_URL}\"\\` in the config for editor autocomplete + validation.\n- Scaffold a starter config with \\`vitops init\\`; check one with \\`vitops validate\\`.\n- The *why* behind each section: [colour system](concepts/color.md),\n [type & space scales](concepts/scales.md), [component patterns](concepts/patterns.md).\n- What each output format does with these tokens: [formats.md](formats.md).\n\n${sections.join('\\n\\n')}\n`;\n}\n\n// ── Output formats reference ──────────────────────────────────────────────────\nfunction renderFormats(ds: DesignSystem): string {\n const clashList = Array.from(TW_CLASH).sort();\n const spaceName = ds.spaceScale?.baseline ?? ds.spaceScale?.names?.[0] ?? 'm';\n return `${frontmatter({\n type: 'Formats Reference',\n title: 'Vitops — output formats (tailwind vs css vs bricks)',\n description:\n 'What each vitops generate format emits, what the target platform provides instead, and the Tailwind-specific rules (which framework utilities are stripped in favour of Tailwind defaults).',\n resource: DS_PATH,\n tags: ['formats', 'tailwind', 'bricks', 'css', 'design-system'],\n })}\n\n# Output formats — \\`tailwind\\` vs \\`css\\` vs \\`bricks\\`\n\nOne config, three targets: \\`vitops generate --format <tailwind|css|bricks>\\`. The **class\nvocabulary is the same** everywhere (see [css/classes.md](css/classes.md)); what differs is\nwhich layers the generator emits versus which the platform provides, and the variant\nseparator (\\`-\\` in CSS/Bricks, \\`:\\` / \\`@\\` in Tailwind).\n\n## \\`tailwind\\` — single-file Tailwind v4 layer\n\nEmits one self-contained \\`tailwind.css\\` (plus \\`tokens.json\\`): \\`@import \"tailwindcss\"\\`,\n\\`@theme\\` tokens, the framework's structural CSS + component patterns inlined, and\n\\`@utility\\` definitions for the bespoke families (type roles, animation effects,\nsplit ratios, track placement).\n\n**Use Tailwind's own utilities for these class names.** The framework's rules for them are\ndeliberately stripped from the bundle because Tailwind provides them natively — writing\nthem still works, but they are Tailwind's, not the framework's:\n\n${clashList.map((c) => `\\`${c}\\``).join(', ')}\n\nOther Tailwind-specific behaviour:\n\n- **Variants are Tailwind's job.** No pre-expanded breakpoint/state classes are emitted\n (the framework's \\`@container (min-width: …)\\` variant blocks are dropped); use Tailwind\n syntax — \\`@md:split-1-2\\`, \\`hover:flip-fade-in\\`. Container breakpoints are registered as\n \\`--container-{sm,md,lg,xl}\\` = 30/48/64/80rem, backing the \\`@sm:\\`…\\`@xl:\\` variants.\n- **The space scale is NOT mapped into Tailwind's \\`--spacing-*\\` namespace** (that would\n corrupt Tailwind's numeric multipliers and \\`max-w-*\\` sizes). Numeric utilities like\n \\`p-4\\` keep Tailwind's 0.25rem meaning; use the design-system scale via arbitrary\n values — \\`p-(--space-${spaceName})\\`, \\`gap-(--space-${spaceName})\\`.\n- **Functional colour roles are plain \\`:root\\` variables, not \\`@theme\\` colours**, so\n Tailwind doesn't auto-derive utilities from them; the emitted \\`@utility\\` set\n (\\`bg-<role>\\`, \\`text-<role>-muted\\`, …) is the public API. The raw hue scales ARE\n \\`@theme\\` colours, so native \\`bg-<hue>-500\\`-style utilities work.\n\n## \\`css\\` — standalone bundle\n\nEmits a bundled, self-contained \\`styles.css\\` + \\`tokens.json\\` + \\`design-manifest.json\\`.\nThe colour and font/scale layers are fully included, and every utility family is\npre-expanded — including breakpoint/state variants with \\`-\\` separators\n(\\`md-split-1-2\\`, \\`hover-fade-in\\`). For non-Bricks, non-Tailwind consumers and the\ndocs build.\n\n## \\`bricks\\` — WordPress / Bricks Builder payload\n\nEmits the full deployable theme payload: \\`styles.min.css\\`, the Bricks import JSONs\n(\\`bricks-colors-{named,semantic}.json\\`, \\`bricks-variables.json\\`), \\`tokens.json\\`, the JS\nbundles (polyfills / elements / deferred), the Bricks element PHP under \\`bricks/\\`, and\nthis docs bundle under \\`docs/\\`.\n\n- **Bricks provides the token layer.** \\`color.css\\` and \\`type-tokens.css\\` are one-line\n stubs: the colour \\`:root\\` tokens, dark-mode overrides, colour utility classes, fonts,\n and type/space scales are generated live by Bricks' Color / Font / Variables Managers\n from the imported JSONs. Semantic palette entries carry \\`darkEnabled\\` + a \\`dark\\` ref so\n Bricks emits the dark-mode overrides on import.\n- Everything else (patterns, shadows, typography roles, animation effects, structural\n framework CSS) ships in \\`styles.min.css\\` as in the other formats.\n- Pattern states reference shadows by name, compiled to\n \\`filter: drop-shadow(var(--shadow-<name>))\\`.\n`;\n}\n\n// ── Concept docs (colour / scales / patterns) ─────────────────────────────────\nfunction renderColorConcept(ds: DesignSystem): string {\n const hues = Object.keys(ds.colors.palette ?? {});\n const roles = Object.keys(ds.colors.roles ?? {});\n return `${frontmatter({\n type: 'Design Concept',\n title: 'Vitops colour system — seeded scales, functional tokens, automatic dark mode',\n description:\n 'How palette hues become 11-step OKLCH scales, how semantic roles derive functional tokens from them, and how dark mode flips automatically.',\n resource: DS_PATH,\n tags: ['color', 'oklch', 'dark-mode', 'design-system'],\n })}\n\n# Colour system\n\nAuthoring is two maps in \\`design-system.json\\` (see [authoring.md](../authoring.md)):\n\\`colors.palette\\` (hues) and \\`colors.roles\\` (semantic role → hue). Everything else —\nscales, functional tokens, utilities, dark mode — is derived.\n\n## From seed to scale\n\nEach palette hue becomes an **11-step numeric OKLCH scale**, \\`--color-<hue>-50…950\\`,\nrunning tinted near-white → tinted near-black. Two authoring modes:\n\n- **Seeded** (\\`{ seed, anchors? }\\`): the scale is generated from one colour. The seed is\n preserved at its natural lightness step; \\`anchors\\` pin specific steps and the rest\n interpolate around them.\n- **Fixed** (\\`{ tones }\\`): a brand kit used verbatim — each authored tone lands at its\n nearest step, endpoints are tinted off-white/off-black, no interpolation.\n\nCurrent hues: ${code(hues)}.\n\n## Functional tokens (the public vocabulary)\n\nEach role in \\`colors.roles\\` (currently ${code(roles)}) derives a family of\n**job-named** tokens from its hue's scale:\n\n- \\`--<role>-bg\\`, \\`--<role>-bg-muted\\` — background washes.\n- \\`--<role>-border\\`, \\`--<role>-border-bold\\` — borders.\n- \\`--<role>-solid\\`, \\`--<role>-solid-bold\\` — opaque fills (buttons, badges), paired with\n \\`--<role>-on-solid\\` for a guaranteed-contrast foreground.\n- \\`--<role>-text\\`, \\`--<role>-text-muted\\`, \\`--<role>-text-x-muted\\` — content colours.\n- **Emphasis stops** \\`--color-<role>-{x-muted,muted,bold,x-bold}\\` — appearance-relative:\n \\`muted\\` recedes toward the background extreme and \\`bold\\` advances toward the\n foreground, in *either* light or dark.\n- Plus \\`--surface-glass\\` (translucent surface) and \\`--overlay\\` (scrim).\n\nClasses name the token, not the tone: \\`bg-<role>\\`, \\`text-<role>-muted\\`, \\`text-on-<role>\\`,\n\\`border-<role>\\` (see [css/classes.md](../css/classes.md)).\n\n## Automatic dark mode\n\nDark mode is a **functional flip** under \\`:root[data-brx-theme=\"dark\"]\\`: background and\ntext ends of each scale swap, while \\`solid\\` fills stay mode-stable with a recomputed\n\\`on-solid\\` foreground. There is no per-appearance scheme grammar to author and no named\nsteps — a role token means the same *job* in both appearances.\n\n## Contrast guarantees\n\nText tokens target APCA Lc ≥ 75 and muted text Lc ≥ 60, in **both** appearances —\nenforced by the generator's unit tests, not left to the author.\n`;\n}\n\nfunction renderScalesConcept(ds: DesignSystem): string {\n const t = ds.typeScale;\n const s = ds.spaceScale;\n const scaleLine = (label: string, sc: typeof t): string =>\n sc\n ? `- **${label}**: base \\`${sc.base}\\` at step \\`${sc.names?.[(sc.baseStep ?? 1) - 1] ?? sc.baseStep}\\`, ratio ${sc.ratio}${sc.fluid ? ` (${sc.fluid.minRatio} below ${sc.fluid.minVw})` : ''}; steps ${code(sc.names ?? [])}.`\n : `- **${label}**: not configured.`;\n return `${frontmatter({\n type: 'Design Concept',\n title: 'Vitops type & space scales — fluid modular scales',\n description:\n 'How typeScale and spaceScale compile to clamp()-based fluid modular scales, and which utilities consume the resulting tokens.',\n resource: DS_PATH,\n tags: ['typography', 'spacing', 'fluid', 'modular-scale', 'design-system'],\n })}\n\n# Type & space scales\n\nBoth scales share one model (authored in \\`design-system.json\\` as \\`typeScale\\` /\n\\`spaceScale\\` — see [authoring.md](../authoring.md)): a **fluid modular scale**.\n\n## The model\n\n- \\`base\\` anchors the value at \\`baseStep\\`; every other step is a power of the \\`ratio\\`\n away (step n = base × ratio^(n − baseStep)).\n- With \\`fluid\\`, each step compiles to a **\\`clamp()\\`**: the scale uses \\`fluid.minRatio\\`\n at/below \\`fluid.minVw\\` and grows to \\`ratio\\` at \\`fluid.maxVw\\`, interpolating between —\n so large steps spread apart on wide viewports and compress on phones, with no\n breakpoint jumps. \\`baseline\\` names the pivot step that stays closest to \\`base\\`.\n- \\`names\\` become the token suffixes.\n\n${scaleLine('Type', t)}\n${scaleLine('Space', s)}\n\n## What consumes them\n\n- **Type**: \\`--text-<name>\\` tokens → typography role sizes (\\`font-<role>\\` classes,\n heading defaults) and text-size utilities.\n- **Space**: \\`--space-<name>\\` tokens → gap (\\`g\\`), spacing utilities, and \\`rhythm\\`\n (relationship-based vertical margins between headings, paragraphs, lists, media).\n Prefer \\`rhythm\\` for vertical flow over per-element margins.\n- In the \\`tailwind\\` format these stay in their own namespaces (\\`--text-*\\` via \\`@theme\\`,\n \\`--space-*\\` as plain vars) — see [formats.md](../formats.md) for why \\`--spacing-*\\` is\n deliberately not used.\n`;\n}\n\nfunction renderPatternsConcept(ds: DesignSystem): string {\n const items = (ds.patterns?.items ?? {}) as Record<string, { group?: string }>;\n const groups = Object.keys(ds.patterns?.groups ?? {});\n const patternNames = Object.keys(items);\n const hookTable = Object.entries(BASE_HOOK)\n .map(([prop, sfx]) => `| \\`${prop}\\` | \\`--${sfx}-<pattern>\\` |`)\n .join('\\n');\n return `${frontmatter({\n type: 'Design Concept',\n title: 'Vitops component patterns — token cascade, override hooks, states',\n description:\n 'How pattern CSS is assembled: the token cascade (defaults → groups → per-pattern overrides), per-pattern override-hook variables, state shortcuts, and role variants.',\n resource: DS_PATH,\n tags: ['patterns', 'components', 'cascade', 'css', 'design-system'],\n })}\n\n# Component patterns — the CSS chain\n\nPatterns (currently ${code(patternNames)}) are authored declaratively under \\`patterns\\` in\n\\`design-system.json\\` (see [authoring.md](../authoring.md)) and compiled to CSS in the\n**\\`components\\` cascade layer** — so utility classes (declared in a later layer) always win\nover pattern styling without specificity fights.\n\n## 1 — Token cascade\n\nShared geometry resolves through a variable chain, most-specific first:\n\n- \\`patterns.defaults\\` → \\`--<prop>-default\\` (cascade-wide fallbacks).\n- \\`patterns.groups.<group>\\` → \\`--<prop>-<group>\\` (e.g. groups ${code(groups)}); a pattern\n opts in via its \\`group\\` key.\n- Per-pattern: each grouped pattern gets aliases \\`--<prop>-<name>-group\\` →\n \\`var(--<prop>-<group>)\\`, and \\`overrides\\` replace individual aliases with literal values.\n- \\`patterns.radii\\` → \\`--br-<name>\\` shape primitives; \\`patterns.z\\` → \\`--z-tier-<name>\\`.\n\n## 2 — Base declarations & override hooks\n\nEach pattern's \\`base\\` block is emitted on its selector — a class (\\`.<class ?? name>\\`) or,\nwith \\`element\\`, a **zero-specificity** \\`:where(<element>)\\` rule so author CSS can always\noverride it. Geometry properties are wrapped in a **per-pattern override hook**:\n\n| base property | hook variable |\n| --- | --- |\n${hookTable}\n\ne.g. \\`padding: var(--p-button, 0.6em 1.2em)\\` — a consumer restyles every button by setting\n\\`--p-button\\` on \\`:root\\`, without touching the pattern.\n\n## 3 — States\n\n\\`states\\` (hover / active / focus-visible) compile from shortcuts:\n\n- \\`step: n\\` — intensify the pattern's colour one emphasis stop: fills swap\n \\`--<role>-solid\\` → \\`--<role>-solid-bold\\`; text patterns swap the \\`bold\\` emphasis stop →\n \\`x-bold\\`.\n- \\`scale: 0.97\\` — transform scale; \\`lift: \"<length>\"\\` — \\`translate: 0 calc(-1 * <length>)\\`.\n- \\`shadow: \"<name>\"\\` — \\`filter: drop-shadow(var(--shadow-<name>))\\`; \\`shadow: true\\` — the\n generic lift box-shadow.\n- \\`ring: true\\` — focus ring (\\`box-shadow\\` in the role's \\`muted\\` stop, outline removed).\n- \\`css: { … }\\` — raw declarations escape hatch.\n\nAny pattern with states also gets a composed transition block (translate / scale / filter /\nbox-shadow / colours, \\`--interact-duration\\` / \\`--interact-easing\\` overridable). Hover\nrules are wrapped in \\`@media (hover: hover)\\` so touch devices never stick.\n\n## 4 — Role variants\n\n\\`roles\\` lists semantic colour variants: class patterns emit \\`.<pattern>-<role>\\`\n(\\`.badge-success\\`), element patterns emit \\`<element>.<role>\\` (\\`button.danger\\`). Fill\npatterns set \\`background-color: var(--<role>-solid)\\` + \\`color: var(--<role>-on-solid)\\`;\ntext patterns use the role's \\`bold\\` emphasis stop. \\`default_role\\` colours the bare,\nunsuffixed pattern. States re-apply per variant with the variant's role.\n`;\n}\n\n// ── Reserved index.md listings (no frontmatter) ──────────────────────────────\nfunction renderTopIndex(): string {\n return `${INDEX_NOTE}\n\n# Vitops design system\n\nLLM-oriented documentation bundle (Open Knowledge Format) for the Vitops design system — a\nvariable-driven CSS framework plus progressively-enhanced web components, generated from\n\\`design-system.json\\` and published alongside the deployed theme.\n\n# Contents\n\n* [Authoring reference](authoring.md) - every design-system.json field, generated from the JSON Schema\n* [Output formats](formats.md) - tailwind vs css vs bricks: what's emitted, what the platform provides, which utilities Tailwind owns\n* [Concepts](concepts/) - the colour system, type/space scales, and pattern CSS architecture\n* [CSS framework](css/) - the class vocabulary (colour, type, space, layout, animation, component patterns), stated as naming rules\n* [Bricks Builder](bricks/) - custom elements and how to style them\n`;\n}\n\nfunction renderConceptsIndex(): string {\n return `${INDEX_NOTE}\n\n# Design-system concepts\n\n# Contents\n\n* [Colour system](color.md) - seeded OKLCH scales, functional tokens, automatic dark mode\n* [Type & space scales](scales.md) - fluid modular scales and the tokens they emit\n* [Component patterns](patterns.md) - token cascade, override hooks, states, role variants\n`;\n}\n\nfunction renderCssIndex(): string {\n return `${INDEX_NOTE}\n\n# CSS framework\n\n# Contents\n\n* [Class vocabulary](classes.md) - every utility and component class, summarized by naming rule\n`;\n}\n\nfunction renderBricksIndex(): string {\n return `${INDEX_NOTE}\n\n# Bricks Builder integration\n\n# Styling\n\nPrefer adding the framework **CSS classes** — see [/css/classes.md](../css/classes.md) — in a\nBricks element's \"CSS classes\" field over hand-setting spacing, colour, or typography through\nthe Bricks Builder property panels. The classes encode the design system's tokens, responsive\ngrammar, and interaction states, so they stay consistent, respond to theme / dark mode, and\nupdate with the system. Values typed directly into Bricks' property controls are one-off,\ndrift from the system, and don't react to theme changes — reserve them for genuinely bespoke,\none-element cases.\n\n# Contents\n\n* [Elements reference](elements.md) - every custom Vitops element, its controls, defaults, seeded children and keywords\n* [Class vocabulary](../css/classes.md) - the framework CSS classes to apply to elements\n`;\n}\n\n/**\n * Build the OKF docs bundle for a config. Returns a `{ relPath: content }` map;\n * the caller writes it wherever the bundle should live (e.g. `<outDir>/docs`).\n */\nexport function generateDocs(ds: DesignSystem, assetsDir: string): Record<string, string> {\n const elementsDir = join(assetsDir, 'bricks', 'elements');\n return {\n 'index.md': renderTopIndex(),\n 'authoring.md': renderAuthoring(),\n 'formats.md': renderFormats(ds),\n 'concepts/index.md': renderConceptsIndex(),\n 'concepts/color.md': renderColorConcept(ds),\n 'concepts/scales.md': renderScalesConcept(ds),\n 'concepts/patterns.md': renderPatternsConcept(ds),\n 'css/index.md': renderCssIndex(),\n 'css/classes.md': renderCssClasses(ds),\n 'bricks/index.md': renderBricksIndex(),\n 'bricks/elements.md': renderElementsDoc(elementsDir),\n };\n}\n","/**\n * Pure, parameterized port of the Vitops design-system generator.\n *\n * `generate({ input, format, outDir })` reads a consumer's `design-system.json`,\n * validates it, and emits consumer-ready output for the chosen format into\n * `outDir`. Unlike the original CWD-bound script it mutates no shared state: every\n * generated token layer is built in memory and either bundled (css/bricks) or\n * inlined (tailwind) before writing.\n *\n * Framework-static assets (the hand-written CSS partials, the Bricks PHP + loader,\n * and the pre-built JS bundles) live under `assets/` in this package and are read /\n * copied from there — they are the same for every consumer.\n */\nimport { readFileSync, writeFileSync, mkdirSync, cpSync, existsSync, readdirSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createHash } from 'node:crypto';\nimport { transform } from 'lightningcss';\nimport { validate, type DesignSystem } from './schema.ts';\nimport { generateDocs } from './docs.ts';\nimport { BASE_HOOK, TW_CLASH } from './shared.ts';\nimport {\n expandPalette,\n functionalRole,\n NUMERIC_STEPS,\n type ExpandedHue,\n type FunctionalRole,\n} from './tokens.ts';\n\nexport type Format = 'bricks' | 'css' | 'tailwind';\n\nexport interface GenerateOptions {\n /** Path to a design-system.json, OR an already-parsed config object. */\n input: string | DesignSystem;\n /** Output target. Default: 'bricks'. */\n format?: Format;\n /** Directory to write outputs into. Default: 'dist'. */\n outDir?: string;\n /** Override the framework asset root (advanced/testing). */\n assetsDir?: string;\n}\n\nexport interface GenerateResult {\n format: Format;\n outDir: string;\n written: string[];\n}\n\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst DEFAULT_ASSETS = join(HERE, '..', 'assets');\n\n// ── colour machinery ─────────────────────────────────────────────────────────\n// Every hue is an 11-step numeric OKLCH scale (see tokens.ts); every role is a\n// hue reference that resolves to FUNCTIONAL tokens. No named steps, no scheme\n// grammar — dark mode is the automatic functional flip.\nconst UTILITY_PROPS: Record<string, string> = {\n bg: 'background-color',\n text: 'color',\n border: 'border-color',\n outline: 'outline-color',\n fill: 'fill',\n stroke: 'stroke',\n};\n\n// Functional-token var name: emphasis stops live in the --color-* namespace\n// (`stop-x-muted` → --color-<role>-x-muted); everything else is --<role>-<token>.\nconst fnVar = (role: string, token: string): string =>\n token.startsWith('stop-') ? `--color-${role}-${token.slice(5)}` : `--${role}-${token}`;\n// The functional utility classes for one role (bare name = functional default).\nconst fnUtilities = (role: string, utilities: string[], isSurface: boolean): string => {\n const rows: string[] = [];\n if (utilities.includes('bg')) {\n rows.push(`.bg-${role} { background-color: var(--${role}-bg); }`);\n rows.push(`.bg-${role}-muted { background-color: var(--${role}-bg-muted); }`);\n rows.push(`.bg-${role}-solid { background-color: var(--${role}-solid); }`);\n rows.push(`.bg-${role}-solid-bold { background-color: var(--${role}-solid-bold); }`);\n if (isSurface) rows.push(`.bg-${role}-bold { background-color: var(--${role}-bg-bold); }`);\n }\n if (utilities.includes('text')) {\n rows.push(`.text-${role} { color: var(--${role}-text); }`);\n rows.push(`.text-${role}-muted { color: var(--${role}-text-muted); }`);\n rows.push(`.text-${role}-x-muted { color: var(--${role}-text-x-muted); }`);\n rows.push(`.text-on-${role} { color: var(--${role}-on-solid); }`);\n }\n if (utilities.includes('border'))\n rows.push(\n `.border-${role} { border-color: var(--${role}-border); }`,\n `.border-${role}-bold { border-color: var(--${role}-border-bold); }`,\n );\n return rows.join('\\n');\n};\n\nconst decls = (obj: Record<string, string>, indent = ' ') =>\n Object.entries(obj)\n .map(([k, v]) => `${indent}${k}: ${v};`)\n .join('\\n');\n\n// ── fluid modular scale ───────────────────────────────────────────────────────\ninterface ScaleConfig {\n base: string;\n ratio: number;\n steps?: number;\n names?: string[];\n baseStep?: number;\n baseline?: string;\n fluid?: { minVw: string; maxVw: string; minRatio: number };\n}\ninterface ScaleStep {\n name: string;\n value: string;\n max: string;\n offset: number;\n}\nconst round = (n: number) => Number(n.toFixed(4)).toString();\nconst rem = (v: string) => parseFloat(v);\nconst buildScale = (s: ScaleConfig): ScaleStep[] => {\n const names = s.names ?? Array.from({ length: s.steps ?? 0 }, (_, i) => String(i + 1));\n const base = rem(s.base);\n const baseStep = s.baseStep ?? Math.ceil(names.length / 2);\n const baselineIdx = s.baseline ? names.indexOf(s.baseline) : baseStep - 1;\n return names.map((name, i) => {\n const k = i - (baseStep - 1);\n const vMax = base * Math.pow(s.ratio, k);\n const max = `${round(vMax)}rem`;\n let value = max;\n if (s.fluid) {\n const { minVw, maxVw, minRatio } = s.fluid;\n const vMin = base * Math.pow(minRatio, k);\n const lo = Math.min(vMin, vMax);\n const hi = Math.max(vMin, vMax);\n if (lo !== hi) {\n const slope = (vMax - vMin) / (rem(maxVw) - rem(minVw));\n const intercept = vMin - slope * rem(minVw);\n const sign = slope < 0 ? '-' : '+';\n const pref = `calc(${round(intercept)}rem ${sign} ${round(Math.abs(slope * 100))}vw)`;\n value = `clamp(${round(lo)}rem, ${pref}, ${round(hi)}rem)`;\n }\n }\n return { name, value, max, offset: i - baselineIdx };\n });\n};\n\n// ── typography ─────────────────────────────────────────────────────────────────\ninterface TypographyRole {\n family?: string;\n [key: string]: string | number | undefined;\n}\nconst TYPO_KEYMAP: Record<string, [string, string]> = {\n family: ['font-family', 'ff'],\n size: ['font-size', 'fs'],\n weight: ['font-weight', 'fw'],\n style: ['font-style', 'fst'],\n 'line-height': ['line-height', 'lh'],\n tracking: ['letter-spacing', 'ls'],\n 'text-decoration': ['text-decoration', 'td'],\n 'text-transform': ['text-transform', 'tt'],\n 'text-wrap': ['text-wrap', 'tw'],\n color: ['color', 'color'],\n};\nconst TYPO_IDENTITY: Record<string, string> = {\n 'font-style': 'normal',\n 'letter-spacing': 'normal',\n 'text-decoration': 'none',\n 'text-transform': 'none',\n 'text-wrap': 'wrap',\n};\n\n// ── animation state defaults ─────────────────────────────────────────────────\nconst STATE_DEFAULT: Record<string, string> = {\n opacity: '1',\n 'translate-x': '0',\n 'translate-y': '0',\n 'scale-x': '1',\n 'scale-y': '1',\n rotate: '0deg',\n blur: '0px',\n shadow: '0 0 0 transparent',\n brightness: '1',\n grayscale: '0',\n contrast: '1',\n saturate: '1',\n sepia: '0',\n 'hue-rotate': '0deg',\n clip: 'none',\n};\n\ninterface Pattern {\n group?: string;\n overrides?: Record<string, string>;\n element?: string;\n class?: string;\n default_role?: string;\n base?: Record<string, string>;\n states?: Record<string, Record<string, unknown>>;\n roles?: string[];\n}\n\nconst id = (key: string) => createHash('sha256').update(key).digest('hex').slice(0, 6);\n\n/**\n * The in-memory output of building a design system. String fields are CSS/JSON\n * ready to write; the generated CSS partials feed the css/bricks bundler.\n */\ninterface Built {\n generated: Record<string, string>; // filename (under generated/) -> css\n bricksColorsNamed: string;\n bricksColorsSemantic: string;\n bricksVariables: string;\n tokensJson: string;\n designManifest: string;\n tailwind: string;\n // captured for the tailwind bundler\n twTypeTokensCss: string;\n twPatternTokensCss: string;\n patternsCss: string;\n}\n\nfunction build(ds: DesignSystem, format: Format, assetsDir: string): Built {\n const BRICKS = format === 'bricks';\n // Every hue expands to its 11-step numeric OKLCH scale; every role resolves\n // to functional tokens over its hue. Dark mode is the automatic flip.\n const expandedPalette = expandPalette(ds.colors.palette as Record<string, unknown>);\n const roleMap = ds.colors.roles as Record<string, string>;\n const scaleRoles: FunctionalRole[] = [];\n for (const [role, hueName] of Object.entries(roleMap)) {\n const hue = expandedPalette[hueName];\n if (hue == null) throw new Error(`role \"${role}\" references unknown palette hue \"${hueName}\"`);\n scaleRoles.push(functionalRole(role, hueName, hue));\n }\n const surfaceRole = scaleRoles.find((r) => r.role === 'surface');\n const patterns = ds.patterns;\n const shadows = ds.shadows;\n const typography = ds.typography;\n const UTILITIES = (ds.colors.utilities ?? ['bg', 'text', 'border']).filter(\n (u) => u in UTILITY_PROPS,\n );\n\n const generated: Record<string, string> = {};\n\n // ── color.css ──────────────────────────────────────────────────────────────\n if (BRICKS) {\n generated['color.css'] =\n '/* Colours provided by Bricks (palette import generates tokens + utilities). */\\n';\n } else {\n let css = `/* GENERATED from design-system.json — do not edit by hand. */\\n:root {\\n`;\n css += ` color-scheme: light;\\n`;\n css += ` /* Hue scales (numeric steps, 50 = tinted near-white … 950 = tinted near-black) */\\n`;\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric))\n css += ` --color-${name}-${n}: ${hex};\\n`;\n css += `\\n /* Functional role tokens (the public API) */\\n`;\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.light)) css += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n if (surfaceRole) {\n css += `\\n /* Translucent surface + scrim */\\n`;\n css += ` --surface-glass: color-mix(in oklch, var(--surface-bg) 72%, transparent);\\n`;\n css += ` --overlay: color-mix(in oklch, var(--color-${surfaceRole.hue}-950) 45%, transparent);\\n`;\n }\n css += `}\\n\\n`;\n // Dark appearance: the automatic functional flip (solid stays mode-stable).\n {\n let fb = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.dark))\n if (fr.light[t] !== val) fb += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n if (surfaceRole)\n fb += ` --overlay: color-mix(in oklch, var(--color-${surfaceRole.hue}-950) 60%, transparent);\\n`;\n if (fb) {\n css += `/* Functional role tokens (dark) */\\n`;\n css += `:root[data-brx-theme=\"dark\"] {\\n color-scheme: dark;\\n${fb}}\\n\\n`;\n }\n }\n // Utilities: hue numeric steps + role emphasis stops, then the functional\n // set (emitted last so it wins ties, e.g. bg-<role>-muted).\n const allTokens: string[] = [];\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const n of Object.keys(hue.numeric)) allTokens.push(`${name}-${n}`);\n for (const fr of scaleRoles)\n for (const stop of ['x-muted', 'muted', 'bold', 'x-bold'])\n allTokens.push(`${fr.role}-${stop}`);\n css += `/* Colour utilities — ${UTILITIES.join(', ')} */\\n`;\n for (const token of allTokens)\n css +=\n UTILITIES.map(\n (cls) => `.${cls}-${token} { ${UTILITY_PROPS[cls]}: var(--color-${token}); }`,\n ).join('\\n') + '\\n';\n css += `\\n/* Functional utilities (the public API) */\\n`;\n for (const fr of scaleRoles)\n css += `${fnUtilities(fr.role, UTILITIES, fr.role === 'surface')}\\n`;\n if (surfaceRole)\n css += `.glass { background-color: var(--surface-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }\\n`;\n generated['color.css'] = css;\n }\n\n // ── shadows.css ──────────────────────────────────────────────────────────────\n {\n const entries = Object.entries(shadows ?? {});\n let sh = `/* GENERATED drop-shadow tokens + utilities — do not edit by hand. */\\n`;\n if (entries.length) {\n sh += `:root {\\n`;\n for (const [name, value] of entries) sh += ` --shadow-${name}: ${value};\\n`;\n sh += `}\\n\\n`;\n for (const [name] of entries)\n sh += `.drop-shadow-${name} { filter: drop-shadow(var(--shadow-${name})); }\\n`;\n }\n generated['shadows.css'] = sh;\n }\n\n // ── scales ───────────────────────────────────────────────────────────────────\n const typeSteps = ds.typeScale ? buildScale(ds.typeScale as ScaleConfig) : [];\n const spaceSteps = ds.spaceScale ? buildScale(ds.spaceScale as ScaleConfig) : [];\n const textMax: Record<string, string> = Object.fromEntries(\n typeSteps.map((s) => [`text-${s.name}`, s.max]),\n );\n\n const typographyFamilies = typography?.families ?? {};\n const withScaleFallback = (v: string) =>\n v.replace(/var\\(\\s*(--text-[\\w-]+)\\s*\\)/g, (m, name) =>\n textMax[name.slice(2)] ? `var(${name}, ${textMax[name.slice(2)]})` : m,\n );\n const roleDecls = (role: string, spec: TypographyRole): Record<string, string> => {\n const out: Record<string, string> = {};\n for (const [key, [prop, sfx]] of Object.entries(TYPO_KEYMAP)) {\n const identity = TYPO_IDENTITY[prop];\n if (spec[key] == null && identity == null) continue;\n const raw =\n spec[key] == null\n ? (identity as string)\n : key === 'family'\n ? (typographyFamilies[spec.family as string] ?? String(spec.family))\n : key === 'size'\n ? withScaleFallback(String(spec[key]))\n : String(spec[key]);\n out[prop] = `var(--${role}-${sfx}, ${raw})`;\n }\n return out;\n };\n\n // ── type-tokens.css ──────────────────────────────────────────────────────────\n let twTypeTokensCss = '';\n if (BRICKS) {\n generated['type-tokens.css'] =\n '/* Fonts + type/space scales provided by Bricks (Font + Variables managers). */\\n';\n } else {\n const root: Record<string, string> = {};\n for (const [name, stack] of Object.entries(ds.fonts ?? {})) root[`--font-${name}`] = stack;\n for (const s of typeSteps) root[`--text-${s.name}`] = s.value;\n for (const s of spaceSteps) root[`--space-${s.name}`] = s.value;\n const css = `/* GENERATED font families + fluid type/space scales — do not edit by hand. */\\n:root {\\n${decls(root)}\\n}\\n`;\n twTypeTokensCss = css;\n generated['type-tokens.css'] = css;\n }\n\n // ── tokens.css (pattern token cascade) ───────────────────────────────────────\n let twPatternTokensCss = '';\n {\n const tDefaults = patterns?.defaults ?? {};\n const tRadii = patterns?.radii ?? {};\n const tGroups = patterns?.groups ?? {};\n const tZ = patterns?.z ?? {};\n const tItems = (patterns?.items ?? {}) as Record<string, Pattern>;\n const root: Record<string, string> = {};\n for (const [prop, val] of Object.entries(tDefaults)) root[`--${prop}-default`] = val;\n if (!BRICKS) for (const [name, val] of Object.entries(tRadii)) root[`--br-${name}`] = val;\n for (const [group, props] of Object.entries(tGroups))\n for (const [prop, val] of Object.entries(props)) root[`--${prop}-${group}`] = val;\n for (const [name, n] of Object.entries(tZ)) root[`--z-tier-${name}`] = String(n);\n const aliases: Record<string, string> = {};\n for (const [name, p] of Object.entries(tItems)) {\n if (!p.group) continue;\n for (const prop of Object.keys(tGroups[p.group] ?? {}))\n aliases[`--${prop}-${name}-group`] = `var(--${prop}-${p.group})`;\n for (const [prop, val] of Object.entries(p.overrides ?? {}))\n aliases[`--${prop}-${name}-group`] = val;\n }\n let tok = `/* GENERATED pattern token cascade — do not edit by hand. */\\n:root {\\n`;\n tok += decls(root) + '\\n';\n if (Object.keys(aliases).length) tok += '\\n' + decls(aliases) + '\\n';\n tok += `}\\n`;\n twPatternTokensCss = tok;\n generated['tokens.css'] = tok;\n }\n\n // ── typography.css (.font-* roles) ───────────────────────────────────────────\n {\n const roles = (typography?.roles ?? {}) as Record<string, TypographyRole>;\n const headings = typography?.headings ?? {};\n let typo = `/* GENERATED typography roles — do not edit by hand. */\\n`;\n for (const [role, spec] of Object.entries(roles))\n typo += `.font-${role} {\\n${decls(roleDecls(role, spec))}\\n}\\n`;\n for (const [tag, role] of Object.entries(headings))\n if (roles[role]) typo += `${tag} {\\n${decls(roleDecls(role, roles[role]))}\\n}\\n`;\n generated['typography.css'] = typo;\n }\n\n // ── patterns.css (component interaction patterns) ────────────────────────────\n const stateRules = (\n sel: string,\n role: string | null,\n states: Record<string, Record<string, unknown>>,\n colorProp: 'background-color' | 'color' = 'background-color',\n ) => {\n let out = '';\n for (const [state, spec] of Object.entries(states)) {\n const body: string[] = [];\n // `step` intensifies the pattern's colour: fills swap solid → solid-bold;\n // text swaps the bold emphasis stop → x-bold.\n if (typeof spec.step === 'number' && role) {\n const stateVar =\n colorProp === 'background-color'\n ? `var(--${role}-${spec.step >= 1 ? 'solid-bold' : 'solid'})`\n : `var(--color-${role}-${spec.step >= 1 ? 'x-bold' : 'bold'})`;\n body.push(`${colorProp}: ${stateVar};`);\n }\n if (typeof spec.scale === 'number') body.push(`scale: ${spec.scale};`);\n if (typeof spec.lift === 'string') body.push(`translate: 0 calc(-1 * ${spec.lift});`);\n if (typeof spec.shadow === 'string' && shadows?.[spec.shadow])\n body.push(`filter: drop-shadow(var(--shadow-${spec.shadow}));`);\n else if (spec.shadow === true)\n body.push(`box-shadow: var(--lift-shadow, 0 8px 20px -6px rgb(0 0 0 / 0.25));`);\n if (spec.ring === true) {\n const ringColor = role ? `var(--color-${role}-muted)` : `var(--color-ui-primary-muted)`;\n body.push(`outline: none;`, `box-shadow: 0 0 0 3px ${ringColor};`);\n }\n if (spec.css && typeof spec.css === 'object')\n for (const [k, v] of Object.entries(spec.css as Record<string, string>))\n body.push(`${k}: ${v};`);\n if (!body.length) continue;\n const pseudo =\n state === 'hover'\n ? ':hover'\n : state === 'active'\n ? ':active'\n : state === 'focus-visible'\n ? ':focus-visible'\n : `:${state}`;\n const rule = `${sel}${pseudo} {\\n ${body.join('\\n ')}\\n}\\n`;\n out += state === 'hover' ? `@media (hover: hover) {\\n${rule}}\\n` : rule;\n }\n return out;\n };\n\n let pat = `/* GENERATED component patterns — do not edit by hand. */\\n`;\n pat += `/* Interaction transitions for patterned elements (independent props compose). */\\n`;\n for (const [pname, p] of Object.entries((patterns?.items ?? {}) as Record<string, Pattern>)) {\n if (!p.base) continue;\n const states = p.states ?? {};\n const isElement = !!p.element;\n const defaultSel = isElement ? `:where(${p.element})` : `.${p.class ?? pname}`;\n const defaultRole = p.default_role ?? null;\n const base = { ...p.base };\n const fills =\n pname === 'button' ||\n pname === 'badge' ||\n base['background-color'] != null ||\n base['background'] != null;\n const colorProp: 'background-color' | 'color' = fills ? 'background-color' : 'color';\n pat += `${defaultSel} {\\n`;\n const hasStates = Object.keys(states).length > 0;\n if (hasStates) {\n pat += ` transition-property: translate, scale, rotate, filter, box-shadow, background-color, color;\\n`;\n pat += ` transition-duration: var(--interact-duration, 200ms);\\n`;\n pat += ` transition-timing-function: var(--interact-easing, ease);\\n`;\n pat += ` translate: 0 0; scale: 1; rotate: 0deg;\\n`;\n }\n if (defaultRole && fills && base['background-color'] == null && base['background'] == null)\n base['background-color'] = `var(--${defaultRole}-solid)`;\n const wrappedBase: Record<string, string> = {};\n for (const [prop, val] of Object.entries(base)) {\n const sfx = BASE_HOOK[prop];\n wrappedBase[prop] = sfx ? `var(--${sfx}-${pname}, ${val})` : String(val);\n }\n pat += decls(wrappedBase) + '\\n}\\n';\n pat += stateRules(defaultSel, defaultRole, states, colorProp);\n for (const role of p.roles ?? []) {\n const variantSel = isElement ? `${p.element}.${role}` : `.${p.class ?? pname}-${role}`;\n // Fills sit on the role's solid + pair with on-solid; text variants use\n // the bold emphasis stop (readable accent in both appearances).\n const variantColorDecl = fills\n ? `background-color: var(--${role}-solid); color: var(--${role}-on-solid)`\n : `color: var(--color-${role}-bold)`;\n pat += `${variantSel} { ${variantColorDecl}; }\\n`;\n pat += stateRules(variantSel, role, states, colorProp);\n }\n pat += '\\n';\n }\n generated['patterns.css'] = pat;\n\n // ── animation-effects.css ────────────────────────────────────────────────────\n {\n const anim = ds.animations ?? {};\n const asStr = (v: string | number) => String(v);\n const block = (sel: string, d: Record<string, string>) => `.${sel} {\\n${decls(d)}\\n}\\n`;\n let out = `/* GENERATED animation effects + journeys — do not edit by hand. */\\n`;\n for (const [name, e] of Object.entries(anim.effects ?? {})) {\n const d: Record<string, string> = { '--_anim': e.kf };\n for (const [k, v] of Object.entries(e.css ?? {})) d[k] = asStr(v);\n for (const [k, v] of Object.entries(e.vars ?? {})) d[`--${k}`] = asStr(v);\n out += block(name, d);\n }\n const base = anim.journeys?.base ?? {};\n for (const parts of anim.journeys?.compose ?? []) {\n const d: Record<string, string> = {\n '--_anim': parts.map((p) => `${p}-journey`).join(', '),\n 'animation-range': 'entry exit',\n };\n for (const p of parts)\n for (const [k, v] of Object.entries(base[p] ?? {})) d[`--${k}`] = asStr(v);\n out += block(`${parts.join('-')}-journey`, d);\n }\n const STATES: [string, (s: string) => string][] = [\n ['hover', (s) => `.${s}:hover`],\n ['focus', (s) => `.${s}:focus-visible`],\n ['active', (s) => `.${s}.is-active, .${s}[data-active]`],\n ];\n out += `\\n/* State-flip variants — compose with .transition (hover-/focus-/active-<fx>). */\\n`;\n for (const [name, e] of Object.entries(anim.effects ?? {})) {\n if (e.kf !== 'composite' && e.kf !== 'paint') continue;\n const props: Record<string, { from?: string; to?: string }> = {};\n for (const [k, v] of Object.entries(e.vars ?? {})) {\n const m = /^(.*)-(from|to)$/.exec(k);\n if (m) (props[m[1] as string] ??= {})[m[2] as 'from' | 'to'] = asStr(v);\n }\n const rest: Record<string, string> = {};\n for (const [p, ft] of Object.entries(props)) {\n if (ft.from != null && ft.from !== STATE_DEFAULT[p]) rest[`--${p}-from`] = ft.from;\n if (ft.to != null && ft.to !== STATE_DEFAULT[p]) rest[`--${p}-to`] = ft.to;\n }\n const flip: Record<string, string> = Object.fromEntries(\n Object.keys(props).map((p) => [`--t-${p}`, `var(--${p}-to, ${STATE_DEFAULT[p]})`]),\n );\n if (Object.keys(rest).length)\n out += `${STATES.map(([s]) => `.${s}-${name}`).join(', ')} {\\n${decls(rest)}\\n}\\n`;\n for (const [s, sel] of STATES) out += `${sel(`${s}-${name}`)} {\\n${decls(flip)}\\n}\\n`;\n }\n generated['animation-effects.css'] = out;\n }\n\n // ── Bricks palettes ──────────────────────────────────────────────────────────\n // Named = the hue scales (numeric steps); Semantic = the functional role\n // tokens with their automatic light/dark pairing.\n const namedColors: unknown[] = [];\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric)) {\n const token = `${name}-${n}`;\n namedColors.push({\n raw: `var(--color-${token})`,\n light: hex,\n id: id(`named:${token}`),\n utilityClasses: UTILITIES,\n });\n }\n const semanticColors: unknown[] = [];\n for (const fr of scaleRoles)\n for (const [t, light] of Object.entries(fr.light)) {\n const dark = fr.dark[t] as string;\n semanticColors.push({\n raw: `var(${fnVar(fr.role, t)})`,\n light,\n darkModeEnabled: light !== dark,\n dark,\n id: id(`semantic:${fr.role}-${t}`),\n utilityClasses: UTILITIES,\n });\n }\n const bricksColorsNamed = JSON.stringify(\n { id: id('palette:named'), name: 'Named', colors: namedColors },\n null,\n 2,\n );\n const bricksColorsSemantic = JSON.stringify(\n { id: id('palette:semantic'), name: 'Semantic', colors: semanticColors },\n null,\n 2,\n );\n\n // ── Bricks Global Variables (fonts + scales) ─────────────────────────────────\n const bricksVariables = (() => {\n type BrxScale = { scale: number; scaleName: string };\n type BrxVar = { id: string; name: string; value: string; category?: string; scale?: BrxScale };\n type BrxCat = { id: string; name: string; scale: Record<string, unknown>; utilityClasses: [] };\n const scaleMeta = (scope: string, prefix: string, s: ScaleConfig, names: string[]) => {\n const px = Math.round(rem(s.base) * 16);\n const lo = s.fluid?.minRatio ?? s.ratio;\n return {\n scaleScope: scope,\n scaleType: 'tshirt',\n scaleNames: names,\n prefix,\n minFontSize: px,\n minScaleRatio: lo,\n minScaleRatioSelect: lo,\n maxFontSize: px,\n maxScaleRatio: s.ratio,\n maxScaleRatioSelect: s.ratio,\n baseline: s.baseline ?? names[Math.floor((names.length - 1) / 2)],\n };\n };\n const categories: BrxCat[] = [];\n const variables: BrxVar[] = [];\n const addScale = (\n label: string,\n scope: string,\n prefix: string,\n cfg: ScaleConfig | undefined,\n steps: ScaleStep[],\n ) => {\n if (!cfg || !steps.length) return;\n const names = steps.map((s) => s.name);\n const catId = id(`varcat:${scope}`);\n categories.push({\n id: catId,\n name: label,\n scale: scaleMeta(scope, prefix, cfg, names),\n utilityClasses: [],\n });\n for (const st of steps)\n variables.push({\n id: id(`var:${prefix}${st.name}`),\n name: `${prefix}${st.name}`,\n value: st.value,\n category: catId,\n scale: { scale: st.offset, scaleName: st.name },\n });\n };\n addScale('Typography', 'typography', 'text-', ds.typeScale as ScaleConfig, typeSteps);\n addScale('Spacing', 'spacing', 'space-', ds.spaceScale as ScaleConfig, spaceSteps);\n for (const [name, stack] of Object.entries(ds.fonts ?? {}))\n variables.push({ id: id(`var:font-${name}`), name: `font-${name}`, value: stack });\n for (const [name, val] of Object.entries(ds.patterns?.radii ?? {}))\n variables.push({ id: id(`var:br-${name}`), name: `br-${name}`, value: val });\n return JSON.stringify({ variables, categories }, null, 2);\n })();\n\n // ── tokens.json (trimmed token export for programmatic consumers) ────────────\n const numericPalette = Object.fromEntries(\n Object.entries(expandedPalette).map(([k, v]) => [k, v.numeric]),\n );\n const tokensJson = JSON.stringify(\n {\n colors: {\n palette: numericPalette,\n roles: roleMap,\n functional: Object.fromEntries(\n scaleRoles.map((fr) => [fr.role, { light: fr.light, dark: fr.dark }]),\n ),\n },\n fonts: ds.fonts ?? {},\n text: Object.fromEntries(typeSteps.map((s) => [s.name, s.value])),\n spacing: Object.fromEntries(spaceSteps.map((s) => [s.name, s.value])),\n shadows: shadows ?? {},\n radii: ds.patterns?.radii ?? {},\n },\n null,\n 2,\n );\n\n // ── design-manifest.json (live-editor manifest; css format) ──────────────────\n const designManifest = (() => {\n const reverseIndex: Record<string, string> = {};\n // Numeric steps are generated from the hue's seed — edits map back to it.\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const n of Object.keys(hue.numeric))\n reverseIndex[`--color-${name}-${n}`] = `colors.palette.${name}.seed`;\n const colorRoles = Object.entries(roleMap).map(([name, ramp]) => ({ name, ramp }));\n const typoRoles = (typography?.roles ?? {}) as Record<string, TypographyRole>;\n const hooks: Record<string, { prop: string; key: string }> = {};\n for (const [key, [prop, sfx]] of Object.entries(TYPO_KEYMAP)) hooks[sfx] = { prop, key };\n for (const [role, spec] of Object.entries(typoRoles))\n for (const [key, [, sfx]] of Object.entries(TYPO_KEYMAP))\n if (spec[key] != null) reverseIndex[`--${role}-${sfx}`] = `typography.roles.${role}.${key}`;\n const pDefaults = patterns?.defaults ?? {};\n const pRadii = patterns?.radii ?? {};\n const pGroups = patterns?.groups ?? {};\n const pItems = (patterns?.items ?? {}) as Record<string, Pattern>;\n for (const prop of Object.keys(pDefaults))\n reverseIndex[`--${prop}-default`] = `patterns.defaults.${prop}`;\n for (const name of Object.keys(pRadii)) reverseIndex[`--br-${name}`] = `patterns.radii.${name}`;\n for (const [group, props] of Object.entries(pGroups))\n for (const prop of Object.keys(props))\n reverseIndex[`--${prop}-${group}`] = `patterns.groups.${group}.${prop}`;\n const items = Object.entries(pItems).map(([name, p]) => {\n const base = p.base ?? {};\n const wrappable = Object.keys(base)\n .filter((prop) => prop in BASE_HOOK)\n .map((prop) => ({ sfx: BASE_HOOK[prop] as string, prop }));\n for (const { sfx, prop } of wrappable)\n reverseIndex[`--${sfx}-${name}`] = `patterns.items.${name}.base.${prop}`;\n return { name, group: p.group ?? null, base, wrappable, roles: p.roles ?? [] };\n });\n return JSON.stringify(\n {\n colors: {\n ramps: Object.keys(expandedPalette),\n steps: NUMERIC_STEPS,\n palette: numericPalette,\n roles: colorRoles,\n },\n typography: {\n roles: Object.keys(typoRoles),\n hooks,\n families: typographyFamilies,\n specs: typoRoles,\n },\n scales: {\n text: typeSteps.map((s) => ({ name: s.name, value: s.value, max: s.max })),\n space: spaceSteps.map((s) => ({ name: s.name, value: s.value, max: s.max })),\n },\n fonts: ds.fonts ?? {},\n patterns: { defaults: pDefaults, radii: pRadii, groups: pGroups, items },\n shadows: shadows ?? {},\n interaction: { duration: '200ms', easing: 'ease' },\n reverseIndex,\n },\n null,\n 2,\n );\n })();\n\n // ── Tailwind bundle ──────────────────────────────────────────────────────────\n const tailwind = emitTailwind({\n ds,\n expandedPalette,\n scaleRoles,\n shadows,\n typeSteps,\n spaceSteps,\n typography,\n roleDecls,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss: pat,\n assetsDir,\n });\n\n return {\n generated,\n bricksColorsNamed,\n bricksColorsSemantic,\n bricksVariables,\n tokensJson,\n designManifest,\n tailwind,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss: pat,\n };\n}\n\n// ── Tailwind emitter ──────────────────────────────────────────────────────────\ninterface TwCtx {\n ds: DesignSystem;\n expandedPalette: Record<string, ExpandedHue>;\n scaleRoles: FunctionalRole[];\n shadows: Record<string, string> | undefined;\n typeSteps: ScaleStep[];\n spaceSteps: ScaleStep[];\n typography: DesignSystem['typography'];\n roleDecls: (role: string, spec: TypographyRole) => Record<string, string>;\n twTypeTokensCss: string;\n twPatternTokensCss: string;\n patternsCss: string;\n assetsDir: string;\n}\n\nfunction emitTailwind(ctx: TwCtx): string {\n const {\n ds,\n expandedPalette,\n scaleRoles,\n shadows,\n typeSteps,\n spaceSteps,\n typography,\n roleDecls,\n twTypeTokensCss,\n twPatternTokensCss,\n patternsCss,\n assetsDir,\n } = ctx;\n const cssDir = join(assetsDir, 'css');\n const nl = (arr: string[]) => arr.filter(Boolean).join('\\n');\n const parts: string[] = [`/* GENERATED for Tailwind v4 (Astro) — do not edit by hand. */`];\n parts.push(`@import \"tailwindcss\";\\n`);\n\n const theme: string[] = [];\n theme.push(` /* Hue scales → bg-<hue>-<step> text-* border-* (numeric, 50…950) */`);\n for (const [name, hue] of Object.entries(expandedPalette))\n for (const [n, hex] of Object.entries(hue.numeric))\n theme.push(` --color-${name}-${n}: ${hex};`);\n theme.push(`\\n /* Fonts → font-* */`);\n for (const [name, stack] of Object.entries(ds.fonts ?? {}))\n theme.push(` --font-${name}: ${stack};`);\n theme.push(`\\n /* Fluid type scale → text-* */`);\n for (const s of typeSteps) theme.push(` --text-${s.name}: ${s.value};`);\n // Fluid space steps are NOT put in Tailwind's --spacing-* namespace: named\n // spacing keys shadow the size scales (e.g. `max-w-7xl` would resolve to\n // var(--spacing-7xl) ≈ 6rem and collapse layouts). They ship as --space-*\n // (matching the css format) in a plain :root below; use var(--space-<name>)\n // or the TW4 arbitrary form p-(--space-md). Numeric spacing (p-4 …) keeps\n // Tailwind's default --spacing multiplier.\n theme.push(`\\n /* Drop-shadows → shadow-* */`);\n for (const [name, value] of Object.entries(shadows ?? {}))\n theme.push(` --shadow-${name}: ${value};`);\n theme.push(`\\n /* Container breakpoints → @sm:/@md:/@lg:/@xl: */`);\n for (const [name, val] of [\n ['sm', '30rem'],\n ['md', '48rem'],\n ['lg', '64rem'],\n ['xl', '80rem'],\n ])\n theme.push(` --container-${name}: ${val};`);\n parts.push(`@theme {\\n${theme.join('\\n')}\\n}\\n`);\n\n if (spaceSteps.length)\n parts.push(\n `/* Fluid space scale — var(--space-<name>) or p-(--space-<name>) */\\n:root {\\n` +\n spaceSteps.map((s) => ` --space-${s.name}: ${s.value};`).join('\\n') +\n `\\n}\\n`,\n );\n\n // Functional role tokens (not --color-*, so a plain :root block — Tailwind\n // must not derive single-purpose utilities from them; the @utility set below\n // is the public API).\n if (scaleRoles.length) {\n let fn = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.light)) fn += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n const surface = scaleRoles.find((r) => r.role === 'surface');\n if (surface) {\n fn += ` --surface-glass: color-mix(in oklch, var(--surface-bg) 72%, transparent);\\n`;\n fn += ` --overlay: color-mix(in oklch, var(--color-${surface.hue}-950) 45%, transparent);\\n`;\n }\n parts.push(`/* Functional role tokens (the public API) */\\n:root {\\n${fn}}\\n`);\n }\n\n parts.push(\n `/* ── Framework tokens (consumed by the inlined components) ── */\\n` +\n `${twTypeTokensCss}\\n${twPatternTokensCss}`,\n );\n\n // Dark appearance: the automatic functional flip (solid stays mode-stable).\n let darkBlock = '';\n for (const fr of scaleRoles)\n for (const [t, val] of Object.entries(fr.dark))\n if (fr.light[t] !== val) darkBlock += ` ${fnVar(fr.role, t)}: ${val};\\n`;\n {\n const surface = scaleRoles.find((r) => r.role === 'surface');\n if (surface)\n darkBlock += ` --overlay: color-mix(in oklch, var(--color-${surface.hue}-950) 60%, transparent);\\n`;\n }\n if (darkBlock)\n parts.push(\n `/* Functional role tokens (dark) */\\n:root[data-brx-theme=\"dark\"] {\\n color-scheme: dark;\\n${darkBlock}}\\n`,\n );\n\n parts.push(\n `/* State variant for the active flip (hover/focus-visible are built in). */\\n` +\n `@custom-variant is-active (&.is-active, &[data-active]);\\n`,\n );\n\n const util: string[] = [];\n if (scaleRoles.length) {\n util.push(`/* Functional colour utilities (the public API) */`);\n for (const fr of scaleRoles)\n for (const row of fnUtilities(fr.role, ['bg', 'text', 'border'], fr.role === 'surface').split(\n '\\n',\n )) {\n const m = /^\\.([^ ]+) \\{ (.*) \\}$/.exec(row);\n if (m) util.push(`@utility ${m[1]} {\\n ${m[2]}\\n}`);\n }\n if (scaleRoles.some((r) => r.role === 'surface'))\n util.push(\n `@utility glass {\\n background-color: var(--surface-glass);\\n backdrop-filter: blur(12px);\\n -webkit-backdrop-filter: blur(12px);\\n}`,\n );\n }\n util.push(`/* Typography roles */`);\n for (const [role, spec] of Object.entries(\n (typography?.roles ?? {}) as Record<string, TypographyRole>,\n ))\n util.push(`@utility font-${role} {\\n${decls(roleDecls(role, spec))}\\n}`);\n util.push(`\\n/* Animation effects (pair with .transition or a driver) */`);\n const asStr = (v: string | number) => String(v);\n for (const [name, e] of Object.entries(ds.animations?.effects ?? {})) {\n const d: Record<string, string> = { '--_anim': e.kf };\n for (const [k, v] of Object.entries(e.css ?? {})) d[k] = asStr(v);\n for (const [k, v] of Object.entries(e.vars ?? {})) d[`--${k}`] = asStr(v);\n util.push(`@utility ${name} {\\n${decls(d)}\\n}`);\n if (e.kf !== 'composite' && e.kf !== 'paint') continue;\n const props = new Set<string>();\n for (const k of Object.keys(e.vars ?? {})) {\n const m = /^(.*)-(from|to)$/.exec(k);\n if (m) props.add(m[1] as string);\n }\n const flip = Object.fromEntries(\n [...props].map((p) => [`--t-${p}`, `var(--${p}-to, ${STATE_DEFAULT[p]})`]),\n );\n util.push(`@utility flip-${name} {\\n${decls(flip)}\\n}`);\n }\n util.push(`\\n/* Split — internal fractions (pair split with a ratio) */`);\n util.push(\n `@utility split {\\n display: flex;\\n` +\n ` & > * { flex: 1; }\\n` +\n ` & > :first-child { flex: var(--_split-a, 1); }\\n` +\n ` & > :last-child { flex: var(--_split-b, 1); }\\n}`,\n );\n const RATIOS: [number, number][] = [\n [1, 2],\n [2, 1],\n [1, 3],\n [3, 1],\n [1, 4],\n [4, 1],\n [2, 3],\n [3, 2],\n ];\n for (const [a, b] of RATIOS)\n util.push(`@utility split-${a}-${b} {\\n --_split-a: ${a};\\n --_split-b: ${b};\\n}`);\n util.push(`\\n/* Track placement (inside .centered) */`);\n for (const track of ['measure', 'breakout', 'spotlight', 'fullbleed'])\n util.push(`@utility ${track} {\\n grid-column: ${track};\\n}`);\n parts.push(util.join('\\n') + '\\n');\n\n // Structure mirrors layout.css (kept literal for parity with the original emitter).\n parts.push(`/* ── Structure (mirrors src/css/layout.css) ── */\n:root {\n --rhythm-scale: 1;\n --rhythm-base: calc(1rlh * var(--rhythm-scale));\n --rhythm-h-p: 0.4;\n --rhythm-p-p: 0.9;\n --rhythm-p-h: 1.6;\n --rhythm-h-h: 0.6;\n --rhythm-p-list: 0.5;\n --rhythm-list-p: 0.9;\n --rhythm-li-li: 0.3;\n --rhythm-text-media: 1.2;\n --rhythm-media-text: 1.2;\n --width-measure: 65ch;\n --width-breakout: 90ch;\n --width-spotlight: 120ch;\n --gutter: clamp(1rem, 4cqi, 3rem);\n}\n\nbody {\n container-type: inline-size;\n}\n\n/* Class-level structure rules live in \\`components\\` so track/spacing utilities\n (@layer utilities — later in the layer order) can override them; unlayered\n CSS would beat ALL layered utilities regardless of specificity (e.g.\n \\`.centered > *\\` pinning children to \\`measure\\` over \\`.spotlight\\`). */\n@layer components {\n.rhythm {\n display: flow-root;\n}\n.rhythm > * + * {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-p));\n}\n.rhythm > :where(h1, h2, h3, h4, h5, h6) + p {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-h-p));\n}\n.rhythm > p + :where(h1, h2, h3, h4, h5, h6) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-h));\n}\n.rhythm > :where(h1, h2, h3, h4, h5, h6) + :where(h1, h2, h3, h4, h5, h6) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-h-h));\n}\n.rhythm > p + :where(ul, ol) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-p-list));\n}\n.rhythm > :where(ul, ol) + p {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-list-p));\n}\n.rhythm :where(ul, ol) > li + li {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-li-li));\n}\n.rhythm > :where(p, h1, h2, h3, h4, h5, h6, ul, ol) + :where(figure, img, picture, video) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-text-media));\n}\n.rhythm > :where(figure, img, picture, video) + :where(p, h1, h2, h3, h4, h5, h6, ul, ol) {\n margin-top: calc(var(--rhythm-base) * var(--rhythm-media-text));\n}\n\n.centered {\n --_measure: min(var(--width-measure), 100% - var(--gutter) * 2);\n --_breakout: minmax(0, calc((var(--width-breakout) - var(--width-measure)) / 2));\n --_spotlight: minmax(0, calc((var(--width-spotlight) - var(--width-breakout)) / 2));\n position: relative;\n display: grid;\n grid-template-columns:\n [fullbleed-start] minmax(var(--gutter), 1fr)\n [spotlight-start] var(--_spotlight)\n [breakout-start] var(--_breakout)\n [measure-start] var(--_measure) [measure-end]\n var(--_breakout) [breakout-end]\n var(--_spotlight) [spotlight-end]\n minmax(var(--gutter), 1fr) [fullbleed-end];\n}\n.centered > * {\n grid-column: measure;\n}\n\n.region {\n padding-block: clamp(\n var(--region-space-min, 3rem),\n var(--region-space, 8vh),\n var(--region-space-max, 8rem)\n );\n}\n}\n`);\n\n // Same layering rationale as the structure block above.\n const animEngine = readFileSync(join(cssDir, 'animation.css'), 'utf8');\n parts.push(`/* ── Animation engine (animation.css) ── */\\n@layer components {\\n${animEngine}\\n}`);\n // Patterns live in Tailwind's `components` layer so single-purpose utilities\n // (@layer utilities — declared later in the layer order) override them, e.g.\n // `.text-on-ui-primary` beating the link pattern's element-level `a { color }`.\n // Unlayered CSS would win over ALL layered utilities regardless of specificity.\n parts.push(`/* ── Component patterns ── */\\n@layer components {\\n${patternsCss}\\n}`);\n\n // Component + structural partials: the full framework library, minus the\n // Tailwind-owned utility layer. Sourced live from the CSS partials (in index.css\n // cascade order) so this never goes stale, then run through stripForTailwind\n // (dropping the TW_CLASH names Tailwind provides itself).\n const droppedClashes = new Set<string>();\n let droppedVariantBlocks = 0;\n const stripForTailwind = (css: string): string => {\n const kept: string[] = [];\n let depth = 0;\n let start = 0;\n let preludeEnd = -1;\n for (let i = 0; i < css.length; i++) {\n const ch = css[i];\n if (ch === '/' && css[i + 1] === '*') {\n const end = css.indexOf('*/', i + 2);\n i = end === -1 ? css.length : end + 1;\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n i += 1;\n while (i < css.length && css[i] !== ch) i += css[i] === '\\\\' ? 2 : 1;\n continue;\n }\n if (ch === '{') {\n if (depth === 0) preludeEnd = i;\n depth++;\n } else if (ch === '}') {\n depth--;\n if (depth === 0) {\n const raw = css.slice(start, i + 1).trim();\n const prelude = css\n .slice(start, preludeEnd)\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .trim();\n const clash = /^\\.([A-Za-z0-9_-]+)/.exec(prelude);\n if (/^@container\\s*\\(\\s*min-width:/.test(prelude)) droppedVariantBlocks++;\n else if (clash && TW_CLASH.has(clash[1] as string))\n droppedClashes.add(clash[1] as string);\n else if (raw) kept.push(raw);\n start = i + 1;\n }\n }\n }\n return kept.join('\\n\\n');\n };\n\n const partials = componentPartialOrder(cssDir);\n const componentCss = partials\n .map((rel) => {\n const css = readFileSync(join(cssDir, rel), 'utf8');\n return `/* ── ${rel} ── */\\n${stripForTailwind(css)}`;\n })\n .join('\\n\\n');\n // Same layering rationale as the patterns block above.\n parts.push(\n `/* ── Component + structural partials (Tailwind-clashing utilities dropped) ── */\\n@layer components {\\n${componentCss}\\n}`,\n );\n\n return nl(parts) + '\\n';\n}\n\n/**\n * The component/structural CSS partials to inline into the Tailwind bundle, in\n * index.css cascade order. Everything the aggregator imports EXCEPT the engine\n * (global/animation), the layout utilities (Tailwind owns them), and the generated\n * token layer (Tailwind builds its own via @theme).\n */\nfunction componentPartialOrder(cssDir: string): string[] {\n const indexPath = join(cssDir, 'index.css');\n const skip = new Set(['global.css', 'animation.css', 'layout.css']);\n const order: string[] = [];\n const seen = new Set<string>();\n const text = existsSync(indexPath) ? readFileSync(indexPath, 'utf8') : '';\n for (const m of text.matchAll(/@import\\s+['\"]\\.\\/([^'\"]+)['\"]/g)) {\n const rel = m[1] as string;\n if (rel.startsWith('generated/')) continue;\n if (skip.has(rel)) continue;\n if (!seen.has(rel) && existsSync(join(cssDir, rel))) {\n seen.add(rel);\n order.push(rel);\n }\n }\n // Fallback: if no index.css, inline utilities + every pattern partial.\n if (!order.length) {\n if (existsSync(join(cssDir, 'utilities.css'))) order.push('utilities.css');\n const pdir = join(cssDir, 'patterns');\n if (existsSync(pdir))\n for (const f of readdirSync(pdir).sort()) if (f.endsWith('.css')) order.push(`patterns/${f}`);\n }\n return order;\n}\n\n// ── CSS bundling (css + bricks formats) ───────────────────────────────────────\n/**\n * Assemble the full stylesheet by resolving index.css's @import order against the\n * static partials (from assets) and the freshly generated token partials (in\n * memory), then minify with lightningcss. No @import survives, so no disk\n * resolution / shared `generated/` dir is needed.\n */\nfunction bundleCss(\n generated: Record<string, string>,\n assetsDir: string,\n minify: boolean,\n): { code: string; map: string | undefined } {\n const cssDir = join(assetsDir, 'css');\n const indexPath = join(cssDir, 'index.css');\n const index = readFileSync(indexPath, 'utf8');\n const chunks: string[] = [];\n for (const line of index.split('\\n')) {\n const m = /@import\\s+['\"]\\.\\/([^'\"]+)['\"]/.exec(line);\n if (!m) continue;\n const rel = m[1] as string;\n if (rel.startsWith('generated/')) {\n const name = rel.slice('generated/'.length);\n chunks.push(generated[name] ?? '');\n } else {\n chunks.push(readFileSync(join(cssDir, rel), 'utf8'));\n }\n }\n const merged = chunks.join('\\n');\n const res = transform({\n filename: 'styles.css',\n code: Buffer.from(merged),\n minify,\n sourceMap: minify,\n });\n return {\n code: res.code.toString(),\n map: res.map ? res.map.toString() : undefined,\n };\n}\n\n// ── public generate() ─────────────────────────────────────────────────────────\nfunction loadConfig(input: string | DesignSystem): DesignSystem {\n const raw = typeof input === 'string' ? JSON.parse(readFileSync(input, 'utf8')) : input;\n const result = validate(raw);\n if (!result.ok) {\n const lines = result.errors\n .slice(0, 12)\n .map((e) => ` • ${e.path.join('.') || '(root)'}: ${e.message}`)\n .join('\\n');\n throw new Error(`Invalid design-system.json:\\n${lines}`);\n }\n return result.data;\n}\n\nexport async function generate(options: GenerateOptions): Promise<GenerateResult> {\n const format: Format = options.format ?? 'bricks';\n const outDir = options.outDir ?? 'dist';\n const assetsDir = options.assetsDir ?? DEFAULT_ASSETS;\n const ds = loadConfig(options.input);\n const built = build(ds, format, assetsDir);\n mkdirSync(outDir, { recursive: true });\n const written: string[] = [];\n const put = (rel: string, content: string) => {\n const p = join(outDir, rel);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, content);\n written.push(p);\n };\n\n if (format === 'tailwind') {\n put('tailwind.css', built.tailwind);\n put('tokens.json', built.tokensJson);\n } else if (format === 'css') {\n const { code } = bundleCss(built.generated, assetsDir, true);\n put('styles.css', code);\n put('tokens.json', built.tokensJson);\n put('design-manifest.json', built.designManifest);\n } else {\n // bricks: bundled minified CSS + Bricks import JSON + copied JS/PHP/docs.\n const { code, map } = bundleCss(built.generated, assetsDir, true);\n put('styles.min.css', map ? code + `\\n/*# sourceMappingURL=styles.min.css.map */` : code);\n if (map) put('styles.min.css.map', map);\n put('bricks-colors-named.json', built.bricksColorsNamed);\n put('bricks-colors-semantic.json', built.bricksColorsSemantic);\n put('bricks-variables.json', built.bricksVariables);\n put('tokens.json', built.tokensJson);\n // Framework-static JS bundles → outDir root (theme enqueues them).\n const jsDir = join(assetsDir, 'js');\n if (existsSync(jsDir)) {\n cpSync(jsDir, outDir, { recursive: true });\n for (const f of readdirSync(jsDir)) written.push(join(outDir, f));\n }\n // Bricks PHP elements + loader → outDir/bricks.\n const bricksSrc = join(assetsDir, 'bricks');\n if (existsSync(bricksSrc)) {\n cpSync(bricksSrc, join(outDir, 'bricks'), { recursive: true });\n written.push(join(outDir, 'bricks'));\n }\n // OKF docs bundle (generated per-config) → outDir/docs.\n const docs = generateDocs(ds, assetsDir);\n for (const [rel, content] of Object.entries(docs)) put(join('docs', rel), content);\n }\n\n return { format, outDir, written };\n}\n","/**\n * Company / site-level configuration schema — the umbrella around a\n * `design-system.json`-compliant `designSystem`.\n *\n * Authored with `zod/mini` (same instance the design-system schema uses), so the\n * two compose: `DesignSystemSchema` is embedded as `designSystem.<theme>` and the\n * whole thing serialises to one JSON Schema via `z.toJSONSchema`. Everything a\n * generator needs derives from here: the `SiteConfig` type (`z.infer`), the\n * published JSON Schema (`siteJsonSchema`), and runtime validation (`validateSite`).\n *\n * Pure: no YAML/env/fs. `resolveSiteConfig` takes an already-parsed object; a\n * thin loader (reading YAML, injecting `SITE_ENV`) lives outside this module.\n */\nimport * as z from 'zod/mini';\nimport { desc, DesignSystemPatchSchema, type DesignSystem } from './schema.ts';\n\n// ── Primitives ────────────────────────────────────────────────────────────────\n\nconst LocalizableSchema = desc(\n z.union([z.string(), z.record(z.string(), z.string())]),\n 'A string, or a per-locale map of strings (`{ en: \"…\", fr: \"…\" }`).',\n);\n\nconst ImageRefSchema = z.union([\n z.string(),\n z.object({\n src: z.string(),\n alt: z.string(),\n width: z.optional(z.number()),\n height: z.optional(z.number()),\n }),\n]);\n\n// Attribute bags on generated HTML — constrained to serialisable scalars so the\n// exported JSON Schema still offers validation (vs. an opaque `unknown`).\nconst AttrValue = z.union([z.string(), z.number(), z.boolean()]);\nconst AttrsSchema = z.optional(z.record(z.string(), AttrValue));\n\nconst IsoDate = z.string().check(z.regex(/^\\d{4}-\\d{2}-\\d{2}$/)); // YYYY-MM-DD\nconst Iso4217 = z.string().check(z.regex(/^[A-Z]{3}$/)); // currency code\nconst DayOfWeek = z.enum([\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n 'Sunday',\n]);\n\n// ── Design system (named-theme map) ─────────────────────────────────────────────\n// Each entry is a full `DesignSystem` plus a localised `displayName` and an\n// optional `extends` (another entry's key). Entries are lenient (all top-level\n// fields optional) so an extending entry can be a partial patch; the resolved\n// theme is validated against the full `DesignSystemSchema` by `resolveTheme`.\n\nconst DesignSystemEntry = z.extend(DesignSystemPatchSchema, {\n displayName: desc(z.optional(LocalizableSchema), 'Human-readable theme name (localisable).'),\n extends: desc(\n z.optional(z.string()),\n 'Another `designSystem` key to inherit from; this entry then only supplies what it overrides.',\n ),\n});\n\n// ── Locales ─────────────────────────────────────────────────────────────────────\n\nconst LocaleSchema = z.object({\n name: desc(z.string(), 'Display name of the locale (e.g. \"English\").'),\n tagline: desc(z.optional(z.string()), 'Site tagline in this locale.'),\n basePath: desc(z.optional(z.string()), 'URL prefix for this locale (e.g. \"/fr\").'),\n});\n\n// ── Domains ─────────────────────────────────────────────────────────────────────\n\nconst HttpRedirect = z.union([z.literal(301), z.literal(302), z.literal(307), z.literal(308)]);\n\nconst DomainAliasSchema = z.object({\n domain: z.string(),\n redirectType: HttpRedirect,\n redirectTo: z.string(),\n environment: z.optional(z.string()),\n});\n\n// ── Contact / address (schema.org-aligned) ──────────────────────────────────────\n\nconst PostalAddressSchema = desc(\n z.object({\n streetAddress: z.string(),\n addressLocality: desc(z.string(), 'City.'),\n addressRegion: desc(z.optional(z.string()), 'State / province.'),\n postalCode: z.optional(z.string()),\n addressCountry: desc(z.string(), 'Country (ISO 3166-1 alpha-2 preferred).'),\n }),\n 'schema.org `PostalAddress` field names, so JSON-LD generation is lossless.',\n);\n\nconst ContactObjectSchema = z.object({\n name: z.optional(z.string()),\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n});\n\n// contact is either a string (location key reference) or an inline object\nconst ContactConfigSchema = z.union([z.string(), ContactObjectSchema]);\n\n// ── Locations (schema.org LocalBusiness) ────────────────────────────────────────\n\nconst GeoSchema = z.object({\n latitude: z.number().check(z.gte(-90), z.lte(90)),\n longitude: z.number().check(z.gte(-180), z.lte(180)),\n});\n\n/** schema.org `OpeningHoursSpecification` — per-day open/close (24h `HH:MM`). */\nconst OpeningHoursSchema = z.object({\n dayOfWeek: z.array(DayOfWeek),\n opens: z.string().check(z.regex(/^\\d{2}:\\d{2}$/)),\n closes: z.string().check(z.regex(/^\\d{2}:\\d{2}$/)),\n});\n\n// Common schema.org LocalBusiness subtypes (extend as needed).\nconst LocalBusinessType = z.enum([\n 'LocalBusiness',\n 'Store',\n 'Restaurant',\n 'CafeOrCoffeeShop',\n 'ProfessionalService',\n 'MedicalBusiness',\n 'HealthAndBeautyBusiness',\n 'HomeAndConstructionBusiness',\n 'AutomotiveBusiness',\n 'FinancialService',\n 'LegalService',\n 'RealEstateAgent',\n 'Organization',\n]);\n\nconst LocationSchema = z.object({\n slug: z.optional(LocalizableSchema),\n name: LocalizableSchema,\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n geo: z.optional(GeoSchema),\n hours: z.optional(z.array(OpeningHoursSchema)),\n type: z.optional(LocalBusinessType),\n description: z.optional(LocalizableSchema),\n areaServed: z.optional(z.array(z.string())),\n priceRange: z.optional(z.string()),\n paymentAccepted: z.optional(z.array(z.string())),\n currenciesAccepted: z.optional(Iso4217),\n knowsLanguage: z.optional(z.array(z.string())),\n});\n\n// ── Organization (schema.org Organization) ──────────────────────────────────────\n\nconst OrganizationSchema = z.object({\n name: z.optional(LocalizableSchema),\n legalName: z.optional(z.string()),\n foundingDate: z.optional(IsoDate),\n logo: z.optional(ImageRefSchema),\n email: z.optional(z.email()),\n phone: z.optional(z.string()),\n address: z.optional(PostalAddressSchema),\n taxID: z.optional(z.string()),\n vatID: z.optional(z.string()),\n sameAs: desc(z.optional(z.array(z.url())), 'Profile URLs → JSON-LD `sameAs` (mirrors `links`).'),\n});\n\n// ── DNS ──────────────────────────────────────────────────────────────────────\n\nconst DnsRecordType = z.enum(['A', 'AAAA', 'CNAME', 'TXT', 'MX', 'NS', 'SRV', 'CAA', 'PTR', 'SOA']);\n\nconst DnsRecordSchema = z.object({\n type: DnsRecordType,\n name: z.optional(z.string()),\n value: z.string(),\n ttl: z.optional(z.number().check(z.int(), z.positive())),\n proxied: z.optional(z.boolean()),\n});\n\nconst DnsDomainSchema = z.object({\n provider: z.optional(z.string()),\n nameservers: z.optional(z.array(z.string())),\n records: z.optional(z.array(DnsRecordSchema)),\n});\n\n// ── Environments ──────────────────────────────────────────────────────────────\n\nconst RobotsSchema = z.string(); // e.g. \"index,follow\" / \"noindex,nofollow\"\n\nconst EnvironmentSchema = z.object({\n url: desc(z.url(), 'Public origin of this environment.'),\n api: desc(z.optional(z.url()), 'API origin, when different from `url`.'),\n analytics: desc(z.optional(z.boolean()), 'Whether analytics fire in this environment.'),\n robots: desc(z.optional(RobotsSchema), 'Robots policy (e.g. \"noindex,nofollow\" for dev).'),\n variant: desc(z.optional(z.string()), 'Active `abTesting.variants` key for this environment.'),\n});\n\n// ── A/B testing ─────────────────────────────────────────────────────────────────\n\nconst AbVariantSchema = z.object({\n environment: z.string(),\n description: z.optional(z.string()),\n // Deliberate escape hatch: overrides are deep-merged into the raw config\n // before validation, so their shape is the config's own.\n overrides: z.optional(z.record(z.string(), z.unknown())),\n});\n\n// ── Fonts (Astro Fonts API projection) ──────────────────────────────────────────\n// Font *loading* — a serialisable projection of Astro's `fonts:[…]` config. A\n// loader maps `provider` (string) → `fontProviders.<name>()`. Distinct from the\n// design-system font *tokens* (`designSystem.<theme>.fonts` / typography.families),\n// which reference the same `cssVariable`.\n\nconst FontProvider = z.enum([\n 'google',\n 'fontsource',\n 'adobe',\n 'bunny',\n 'fontshare',\n 'googleicons',\n 'npm',\n 'local',\n]);\nconst FontStyle = z.enum(['normal', 'italic']);\nconst FontDisplay = z.enum(['auto', 'block', 'swap', 'fallback', 'optional']);\nconst FontWeight = z.union([z.number(), z.string()]); // discrete, or a variable range like \"100 900\"\n\n/** A local-font face (`provider: 'local'`). */\nconst FontVariantSchema = z.object({\n src: z.array(z.string()),\n weight: z.optional(FontWeight),\n style: z.optional(FontStyle),\n unicodeRange: z.optional(z.array(z.string())),\n display: z.optional(FontDisplay),\n});\n\nconst FontSchema = z.object({\n name: z.string(),\n provider: FontProvider,\n cssVariable: z.string().check(z.regex(/^--/)),\n weights: z.optional(z.array(FontWeight)),\n styles: z.optional(z.array(FontStyle)),\n subsets: z.optional(z.array(z.string())),\n fallbacks: z.optional(z.array(z.string())),\n optimizedFallbacks: z.optional(z.boolean()),\n display: z.optional(FontDisplay),\n formats: z.optional(z.array(z.string())),\n unicodeRange: z.optional(z.array(z.string())),\n variants: z.optional(z.array(FontVariantSchema)), // local provider\n preload: desc(\n z.optional(\n z.union([\n z.boolean(),\n z.array(z.object({ weight: FontWeight, style: z.optional(FontStyle) })),\n ]),\n ),\n 'Emit `<Font preload />` for this family (true, or a list of weight/style faces).',\n ),\n});\n\n// ── Templates (nav / form / nodes) ──────────────────────────────────────────────\n\nconst PresentSchema = z.optional(z.record(z.string(), z.unknown()));\n\nconst NavItemSchema: z.ZodMiniType = z.object({\n label: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n href: z.optional(z.string()),\n icon: z.optional(z.string()),\n attrs: AttrsSchema,\n itemAttrs: AttrsSchema,\n submenu: z.optional(\n z.object({\n present: PresentSchema,\n get items() {\n return z.optional(z.array(NavItemSchema));\n },\n }),\n ),\n});\n\nconst FormFieldType = z.enum([\n 'text',\n 'email',\n 'tel',\n 'url',\n 'number',\n 'password',\n 'textarea',\n 'select',\n 'checkbox',\n 'radio',\n 'date',\n 'file',\n 'hidden',\n]);\n\nconst FormFieldSchema = z.object({\n name: z.string(),\n type: FormFieldType,\n label: z.optional(LocalizableSchema),\n required: z.optional(z.boolean()),\n validation: z.optional(z.string()), // regex source or named rule\n options: z.optional(\n z.union([z.string(), z.array(z.object({ label: z.string(), value: z.string() }))]),\n ),\n attrs: AttrsSchema,\n});\n\nconst ContentNodeSchema: z.ZodMiniType = z.object({\n tag: z.string(),\n attrs: AttrsSchema,\n text: z.optional(z.string()),\n get children() {\n return z.optional(z.array(ContentNodeSchema));\n },\n});\n\nconst TemplateSchema = z.union([\n z.object({\n type: z.literal('nav'),\n tags: z.optional(z.array(z.string())),\n present: PresentSchema,\n items: z.optional(z.array(NavItemSchema)),\n }),\n z.object({\n type: z.literal('form'),\n tags: z.optional(z.array(z.string())),\n present: PresentSchema,\n action: z.optional(z.string()),\n method: z.optional(z.enum(['get', 'post'])),\n fields: z.optional(z.array(FormFieldSchema)),\n submit: z.optional(z.record(z.string(), AttrValue)),\n honeypot: z.optional(z.boolean()),\n }),\n z.object({\n type: z.literal('nodes'),\n tags: z.optional(z.array(z.string())),\n nodes: z.optional(z.array(ContentNodeSchema)),\n }),\n]);\n\n// ── Galleries / testimonials ────────────────────────────────────────────────────\n\nconst GalleryImageSchema = z.object({\n src: z.string(),\n alt: LocalizableSchema,\n caption: z.optional(LocalizableSchema),\n});\n\nconst GallerySchema = z.object({\n title: z.optional(LocalizableSchema),\n tags: z.optional(z.array(z.string())),\n images: z.array(GalleryImageSchema),\n});\n\nconst TestimonialItemSchema = z.object({\n quote: LocalizableSchema,\n name: z.string(),\n role: z.optional(z.string()),\n rating: z.optional(z.number().check(z.gte(0), z.lte(5))),\n date: z.optional(IsoDate),\n});\n\nconst TestimonialGroupSchema = z.object({\n title: z.optional(LocalizableSchema),\n items: z.array(TestimonialItemSchema),\n});\n\n// ── Services (schema.org Offer) ─────────────────────────────────────────────────\n\nconst OfferSchema = z.object({\n name: z.optional(LocalizableSchema),\n price: z.optional(z.union([z.string(), z.number()])),\n priceCurrency: z.optional(Iso4217),\n availability: z.optional(z.string()),\n url: z.optional(z.url()),\n validFrom: z.optional(IsoDate),\n priceValidUntil: z.optional(IsoDate),\n});\n\nconst ServiceSchema = z.object({\n name: LocalizableSchema,\n description: z.optional(LocalizableSchema),\n slug: z.optional(LocalizableSchema),\n offers: z.optional(z.array(OfferSchema)),\n});\n\n// ── SEO / social ─────────────────────────────────────────────────────────────\n\nconst OpenGraphSchema = z.object({\n type: z.optional(z.string()),\n siteName: z.optional(z.string()),\n title: z.optional(LocalizableSchema),\n description: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n locale: z.optional(z.string()),\n});\n\nconst TwitterSchema = z.object({\n card: z.optional(z.enum(['summary', 'summary_large_image', 'app', 'player'])),\n site: z.optional(z.string()),\n creator: z.optional(z.string()),\n title: z.optional(LocalizableSchema),\n description: z.optional(LocalizableSchema),\n image: z.optional(ImageRefSchema),\n});\n\n// ── Top-level schema ────────────────────────────────────────────────────────────\n\nexport const SiteConfigSchema = z.object({\n defaultLocale: desc(\n z.string(),\n 'The locale used when none is specified; must be a `locales` key.',\n ),\n locales: desc(\n z.record(z.string(), LocaleSchema),\n 'Locales the site is published in, keyed by BCP 47 tag (e.g. \"en\", \"fr\").',\n ),\n organization: desc(\n z.optional(OrganizationSchema),\n 'schema.org Organization details for JSON-LD (name, legalName, logo, tax IDs, sameAs profiles).',\n ),\n contact: desc(\n z.optional(ContactConfigSchema),\n 'Primary contact: either a `locations` key (string reference) or an inline name/email/phone/address object.',\n ),\n domains: desc(\n z.optional(\n z.object({\n canonical: desc(z.url(), 'The canonical origin used for absolute URLs and SEO.'),\n aliases: desc(\n z.optional(z.array(DomainAliasSchema)),\n 'Alias domains and how they redirect to the canonical one.',\n ),\n }),\n ),\n 'Canonical domain + redirecting aliases.',\n ),\n primaryLocation: desc(\n z.optional(z.string()),\n 'The main `locations` key (for JSON-LD and defaults).',\n ),\n locations: desc(\n z.optional(z.record(z.string(), LocationSchema)),\n 'Physical locations (schema.org LocalBusiness): address, geo, opening hours, service area.',\n ),\n services: desc(\n z.optional(z.record(z.string(), ServiceSchema)),\n 'Services offered (schema.org Service/Offer): name, description, slug, price offers.',\n ),\n links: desc(\n z.optional(\n z.object({\n googleMaps: z.optional(z.url()),\n instagram: z.optional(z.url()),\n facebook: z.optional(z.url()),\n x: z.optional(z.url()),\n linkedin: z.optional(z.url()),\n youtube: z.optional(z.url()),\n github: z.optional(z.url()),\n }),\n ),\n 'Public profile URLs (also feed JSON-LD `sameAs` via `organization.sameAs`).',\n ),\n dns: desc(\n z.optional(z.record(z.string(), DnsDomainSchema)),\n 'Desired DNS state per domain (provider, nameservers, records) — declarative reference, not applied automatically.',\n ),\n cloudflare: desc(\n z.optional(z.record(z.string(), z.unknown())),\n 'Deliberate escape hatch for provider-specific Cloudflare settings — out of scope to model here.',\n ),\n environments: desc(\n z.record(z.string(), EnvironmentSchema),\n 'Deploy environments (production, dev, …): URL, API origin, analytics toggle, robots policy, active A/B variant.',\n ),\n abTesting: desc(\n z.optional(\n z.object({\n enabled: z.boolean(),\n cookieName: z.optional(z.string()),\n cookieMaxAge: desc(z.optional(z.number().check(z.int(), z.positive())), 'Seconds.'),\n splitRatio: desc(\n z.optional(z.number().check(z.gte(0), z.lte(1))),\n 'Fraction of traffic sent to the variant (0–1).',\n ),\n variants: desc(\n z.optional(z.record(z.string(), AbVariantSchema)),\n 'Named variants; each targets an environment and may deep-merge config `overrides`.',\n ),\n }),\n ),\n 'A/B testing: cookie-based split plus named variants whose `overrides` patch the config per environment.',\n ),\n\n designSystem: desc(\n z.record(z.string(), DesignSystemEntry),\n 'Named-theme map of design systems. `default` is the base; other entries may `extends` another and supply a partial patch. Light/dark is automatic (functional tokens flip per appearance), not a separate theme entry. A bare design system (with `colors`) is shorthand for `{ default: … }`.',\n ),\n defaultTheme: desc(\n z.optional(z.string()),\n 'Which `designSystem` entry to use by default (convention: \"default\").',\n ),\n defaultColorScheme: desc(\n z.optional(z.enum(['light', 'dark'])),\n 'Initial appearance to render before any user/system preference applies.',\n ),\n respectSystemPreference: desc(\n z.optional(z.boolean()),\n \"Follow the user's OS light/dark preference.\",\n ),\n\n fonts: desc(\n z.optional(z.array(FontSchema)),\n 'Font LOADING (a serialisable projection of the Astro Fonts API: provider, weights, subsets, preload). Font TOKENS live in `designSystem.<theme>.fonts` and reference the same `cssVariable`.',\n ),\n\n tags: desc(\n z.optional(z.record(z.string(), z.unknown())),\n 'Free-form content-tag taxonomy (site-specific; not interpreted by the generator).',\n ),\n postTypes: desc(\n z.optional(z.record(z.string(), z.unknown())),\n 'Free-form content-type definitions (site-specific; not interpreted by the generator).',\n ),\n galleries: desc(\n z.optional(z.record(z.string(), GallerySchema)),\n 'Named image galleries (title, tags, images with localisable alt/caption).',\n ),\n testimonials: desc(\n z.optional(z.record(z.string(), TestimonialGroupSchema)),\n 'Named testimonial groups (quote, name, role, rating, date).',\n ),\n templates: desc(\n z.optional(z.record(z.string(), TemplateSchema)),\n 'Named content templates rendered at SSR time: `nav` (menu trees), `form` (field lists + submit), or `nodes` (raw element trees).',\n ),\n navigation: desc(\n z.optional(\n z.object({\n activeTemplate: desc(\n z.optional(\n z.object({\n default: desc(z.optional(z.string()), 'A `templates` key.'),\n breakpoints: desc(\n z.optional(z.record(z.string(), z.string())),\n 'Breakpoint name → `templates` key overrides.',\n ),\n }),\n ),\n 'Which nav template is active, optionally per breakpoint.',\n ),\n }),\n ),\n 'Site navigation settings (which nav template renders where).',\n ),\n seo: desc(\n z.optional(\n z.object({\n titleTemplate: desc(z.optional(z.string()), 'Page-title pattern (e.g. \"%s · Acme\").'),\n descriptionTemplate: z.optional(z.string()),\n robots: desc(z.optional(RobotsSchema), 'e.g. \"index,follow\" / \"noindex,nofollow\".'),\n googleSiteVerification: z.optional(z.string()),\n bingSiteVerification: z.optional(z.string()),\n openGraph: z.optional(OpenGraphSchema),\n twitter: z.optional(TwitterSchema),\n }),\n ),\n 'SEO defaults: title/description templates, robots policy, verification tokens, Open Graph + Twitter cards.',\n ),\n analytics: desc(\n z.optional(\n z.object({\n googleAnalyticsId: z.optional(z.string()),\n plausibleDomain: z.optional(z.string()),\n googleTagManagerId: z.optional(z.string()),\n }),\n ),\n 'Analytics provider IDs (gated per environment via `environments.<env>.analytics`).',\n ),\n notifications: desc(\n z.optional(z.object({ email: z.optional(z.email()) })),\n 'Where site notifications (e.g. form submissions) are sent.',\n ),\n tracking: desc(\n z.optional(\n z.object({\n enabled: z.optional(z.boolean()),\n platforms: z.optional(z.array(z.string())),\n }),\n ),\n 'Marketing/conversion tracking toggles per platform.',\n ),\n security: desc(\n z.optional(\n z.object({\n turnstile: z.optional(\n z.object({\n siteKey: desc(z.optional(z.string()), 'Cloudflare Turnstile site key (public).'),\n }),\n ),\n }),\n ),\n 'Security integrations (bot protection).',\n ),\n legal: desc(\n z.optional(\n z.object({\n privacyPolicy: z.optional(\n z.object({\n enabled: z.boolean(),\n url: z.optional(z.url()),\n lastUpdated: z.optional(IsoDate),\n }),\n ),\n termsOfService: z.optional(\n z.object({\n enabled: z.boolean(),\n url: z.optional(z.url()),\n lastUpdated: z.optional(z.nullable(IsoDate)),\n }),\n ),\n cookieConsent: z.optional(\n z.object({\n enabled: z.boolean(),\n type: desc(z.optional(z.enum(['opt-in', 'opt-out'])), 'Consent model.'),\n position: z.optional(z.enum(['top', 'bottom', 'center'])),\n categories: z.optional(z.array(z.string())),\n }),\n ),\n }),\n ),\n 'Legal pages + cookie-consent configuration.',\n ),\n icons: desc(\n z.optional(\n z.object({\n ui: desc(z.optional(z.string()), 'Icon set used for UI chrome (e.g. \"lucide\").'),\n brand: desc(z.optional(z.string()), 'Icon set used for brand marks.'),\n semantic: desc(z.optional(z.array(z.string())), 'Named semantic icons to include.'),\n 'fa7-solid': z.optional(z.array(z.string())),\n 'fa7-regular': z.optional(z.array(z.string())),\n 'fa7-light': z.optional(z.array(z.string())),\n 'fa7-thin': z.optional(z.array(z.string())),\n 'fa7-brands': z.optional(z.array(z.string())),\n 'simple-icons': z.optional(z.array(z.string())),\n 'material-symbols': z.optional(z.array(z.string())),\n lucide: z.optional(z.array(z.string())),\n }),\n ),\n 'Icon sets and the specific icons to bundle from each (keys are iconify collection names).',\n ),\n favicon: desc(\n z.optional(\n z.object({\n source: desc(z.string(), 'Source image (SVG/PNG) the favicon set is generated from.'),\n lowResSource: desc(\n z.optional(z.string()),\n 'Alternate source for small raster sizes (16/32px) when the main source scales down poorly.',\n ),\n name: desc(z.optional(z.string()), 'App name for the generated web manifest / PWA.'),\n themeColor: desc(\n z.optional(z.string()),\n 'PWA theme color (also `<meta name=\"theme-color\">`).',\n ),\n backgroundColor: desc(z.optional(z.string()), 'PWA background color.'),\n }),\n ),\n 'Favicon/PWA asset generation (consumed by `@getvitops/utils` favicon tooling).',\n ),\n deployment: desc(\n z.optional(\n z.object({\n platform: z.optional(z.string()),\n buildCommand: z.optional(z.string()),\n deployCommand: z.optional(z.string()),\n outputDirectory: z.optional(z.string()),\n type: z.optional(z.string()),\n }),\n ),\n 'How the site is built and deployed (platform, commands, output directory) — informational for tooling.',\n ),\n});\n\nexport type SiteConfig = z.infer<typeof SiteConfigSchema>;\n\n// ── JSON Schema + validation ────────────────────────────────────────────────────\n\nexport const SITE_SCHEMA_URL = 'https://unpkg.com/@getvitops/generator/site.schema.json';\n\n/** The published JSON Schema (draft-2020-12), derived from the zod schema. */\nexport const siteJsonSchema = {\n $id: SITE_SCHEMA_URL,\n ...z.toJSONSchema(SiteConfigSchema, { target: 'draft-2020-12' }),\n};\n\nexport type SiteValidationResult =\n | { ok: true; data: SiteConfig; errors: [] }\n | { ok: false; data: undefined; errors: z.core.$ZodIssue[] };\n\ntype Issue = z.core.$ZodIssue;\nconst issue = (path: (string | number)[], message: string): Issue =>\n ({ code: 'custom', path, message }) as Issue;\n\n/**\n * Validate a raw (already parsed) config: shape via zod, then the cross-field\n * integrity that JSON Schema can't express (referential keys, extends acyclicity).\n * These live only here — the published JSON Schema enforces shape, not integrity.\n */\nexport function validateSite(input: unknown): SiteValidationResult {\n const parsed = z.safeParse(SiteConfigSchema, input);\n if (!parsed.success) return { ok: false, data: undefined, errors: parsed.error.issues };\n const cfg = parsed.data;\n const errors: Issue[] = [];\n const has = (m: Record<string, unknown> | undefined, k: string) => !!m && k in m;\n\n if (!has(cfg.locales, cfg.defaultLocale))\n errors.push(issue(['defaultLocale'], `defaultLocale \"${cfg.defaultLocale}\" is not in locales`));\n\n if (!has(cfg.designSystem, 'default') && cfg.defaultTheme == null)\n errors.push(issue(['designSystem'], 'designSystem must include a \"default\" theme'));\n\n if (cfg.defaultTheme != null && !has(cfg.designSystem, cfg.defaultTheme))\n errors.push(\n issue(['defaultTheme'], `defaultTheme \"${cfg.defaultTheme}\" is not in designSystem`),\n );\n\n for (const [key, entry] of Object.entries(cfg.designSystem)) {\n if (entry.extends != null && !has(cfg.designSystem, entry.extends))\n errors.push(\n issue(\n ['designSystem', key, 'extends'],\n `extends \"${entry.extends}\" is not a designSystem key`,\n ),\n );\n }\n // extends acyclicity + each resolved theme is a complete DesignSystem\n for (const key of Object.keys(cfg.designSystem)) {\n try {\n resolveTheme(cfg.designSystem as Record<string, DesignSystemEntryT>, key);\n } catch (e) {\n errors.push(issue(['designSystem', key], (e as Error).message));\n }\n }\n\n if (cfg.primaryLocation != null && !has(cfg.locations, cfg.primaryLocation))\n errors.push(\n issue(['primaryLocation'], `primaryLocation \"${cfg.primaryLocation}\" is not in locations`),\n );\n if (typeof cfg.contact === 'string' && !has(cfg.locations, cfg.contact))\n errors.push(issue(['contact'], `contact \"${cfg.contact}\" is not a locations key`));\n\n for (const [name, v] of Object.entries(cfg.abTesting?.variants ?? {}))\n if (!has(cfg.environments, v.environment))\n errors.push(\n issue(\n ['abTesting', 'variants', name, 'environment'],\n `environment \"${v.environment}\" is not in environments`,\n ),\n );\n for (const [i, a] of (cfg.domains?.aliases ?? []).entries())\n if (a.environment != null && !has(cfg.environments, a.environment))\n errors.push(\n issue(\n ['domains', 'aliases', i, 'environment'],\n `environment \"${a.environment}\" is not in environments`,\n ),\n );\n\n const templates = cfg.templates;\n const at = cfg.navigation?.activeTemplate;\n if (at?.default != null && !has(templates, at.default))\n errors.push(\n issue(\n ['navigation', 'activeTemplate', 'default'],\n `template \"${at.default}\" is not in templates`,\n ),\n );\n for (const [bp, tpl] of Object.entries(at?.breakpoints ?? {}))\n if (!has(templates, tpl))\n errors.push(\n issue(\n ['navigation', 'activeTemplate', 'breakpoints', bp],\n `template \"${tpl}\" is not in templates`,\n ),\n );\n\n if (errors.length) return { ok: false, data: undefined, errors };\n return { ok: true, data: cfg, errors: [] };\n}\n\n// ── Theme resolution (extends) ──────────────────────────────────────────────────\n\ntype DesignSystemEntryT = Partial<DesignSystem> & { displayName?: unknown; extends?: string };\n\n/**\n * Resolve a design-system theme by following its `extends` chain and deep-merging\n * base → child (child wins; arrays replace wholesale, correct for token overrides).\n * Throws on unknown keys or an `extends` cycle. The result is a plain\n * `DesignSystem` (validate it against `DesignSystemSchema` for completeness).\n */\nexport function resolveTheme(\n designSystem: Record<string, DesignSystemEntryT>,\n key: string,\n): DesignSystem {\n const chain: DesignSystemEntryT[] = [];\n const seen = new Set<string>();\n let cur: string | undefined = key;\n while (cur != null) {\n if (seen.has(cur)) throw new Error(`extends cycle in designSystem at \"${cur}\"`);\n seen.add(cur);\n const entry: DesignSystemEntryT | undefined = designSystem[cur];\n if (entry == null) throw new Error(`designSystem theme \"${cur}\" not found`);\n chain.unshift(entry);\n cur = entry.extends;\n }\n const out: Record<string, unknown> = {};\n for (const entry of chain) {\n const { extends: _e, displayName: _d, ...ds } = entry;\n deepMerge(out, ds as Record<string, unknown>);\n }\n return out as DesignSystem;\n}\n\n/**\n * Resolve a raw (already-parsed) config into a validated `SiteConfig`:\n * 1. strip YAML nulls,\n * 2. apply the active A/B variant's `overrides` (by `siteEnv`),\n * 3. normalise a bare-`DesignSystem` `designSystem` shorthand to `{ default: … }`,\n * 4. validate (shape + cross-field).\n * Pure — no YAML/env access. A loader supplies `siteEnv`.\n */\nexport function resolveSiteConfig(input: unknown, siteEnv = 'production'): SiteConfig {\n const raw = stripNulls(input) as Record<string, unknown>;\n\n const envConfig = (raw.environments as Record<string, { variant?: string }> | undefined)?.[\n siteEnv\n ];\n if (envConfig?.variant) {\n const overrides = (\n raw.abTesting as { variants?: Record<string, { overrides?: Record<string, unknown> }> }\n )?.variants?.[envConfig.variant]?.overrides;\n if (overrides) deepMerge(raw, overrides);\n }\n\n // Shorthand: a bare DesignSystem (has `colors`) → { default: … }.\n const ds = raw.designSystem as Record<string, unknown> | undefined;\n if (ds != null && 'colors' in ds) raw.designSystem = { default: ds };\n\n const result = validateSite(raw);\n if (!result.ok) {\n const msg = result.errors.map((e) => ` ${e.path.join('.')}: ${e.message}`).join('\\n');\n throw new Error(`Invalid site config:\\n${msg}`);\n }\n return result.data;\n}\n\n// ── Helpers ─────────────────────────────────────────────────────────────────────\n\n/** Strip nulls (YAML `~`/`null`) → undefined so optional fields validate. */\nexport function stripNulls(obj: unknown): unknown {\n if (obj === null) return undefined;\n if (Array.isArray(obj)) return obj.map(stripNulls);\n if (obj && typeof obj === 'object') {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const stripped = stripNulls(value);\n if (stripped !== undefined) result[key] = stripped;\n }\n return result;\n }\n return obj;\n}\n\n/** Deep-merge `source` into `target` (in place). Arrays replace wholesale. */\nexport function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>) {\n for (const key of Object.keys(source)) {\n const s = source[key];\n const t = target[key];\n if (\n s &&\n typeof s === 'object' &&\n !Array.isArray(s) &&\n t &&\n typeof t === 'object' &&\n !Array.isArray(t)\n ) {\n deepMerge(t as Record<string, unknown>, s as Record<string, unknown>);\n } else {\n target[key] = s;\n }\n }\n}\n","/**\n * @getvitops/generator — public API.\n *\n * Turn a `design-system.json` into platform outputs (Bricks, standalone CSS,\n * Tailwind v4). The `zod/mini` schema is the single source of truth: types,\n * validation, and the published JSON Schema all derive from it.\n */\nexport { generate } from './generate.ts';\nexport type { GenerateOptions, GenerateResult, Format } from './generate.ts';\n\nexport { generateDocs } from './docs.ts';\nexport { TW_CLASH, BASE_HOOK } from './shared.ts';\n\nexport { DesignSystemSchema, jsonSchema, SCHEMA_URL, validate } from './schema.ts';\nexport type { DesignSystem, ValidationResult } from './schema.ts';\nexport {\n SiteConfigSchema,\n siteJsonSchema,\n SITE_SCHEMA_URL,\n validateSite,\n resolveSiteConfig,\n resolveTheme,\n stripNulls,\n deepMerge,\n} from './site.ts';\nexport type { SiteConfig, SiteValidationResult } from './site.ts';\n\nimport { SCHEMA_URL, type DesignSystem } from './schema.ts';\n\n/**\n * A minimal but complete starter design system, used by `vitops init`. It\n * validates against the schema and generates real output in every format, so a\n * new project can `vitops generate` immediately and then tune from here.\n */\nexport function defaultConfig(): DesignSystem {\n return {\n $schema: SCHEMA_URL,\n colors: {\n // Each hue is generated as an 11-step OKLCH scale from its seed.\n palette: {\n brand: { seed: '#2e9b73' },\n ink: { seed: '#3f4a5c' },\n sky: { seed: '#2f7bc0' },\n sun: { seed: '#d08a1f' },\n rose: { seed: '#c74a42' },\n },\n // role → hue. Functional tokens (bg/text/solid/on-solid/…) derive from\n // the hue's scale; dark mode flips automatically.\n roles: {\n neutral: 'ink',\n surface: 'ink',\n 'ui-primary': 'brand',\n 'brand-primary': 'brand',\n info: 'sky',\n success: 'brand',\n warning: 'sun',\n danger: 'rose',\n },\n utilities: ['bg', 'text', 'border'],\n },\n shadows: {\n sm: '0 1px 2px rgb(0 0 0 / 0.08)',\n md: '0 4px 6px rgb(0 0 0 / 0.12)',\n lg: '0 10px 15px rgb(0 0 0 / 0.18)',\n },\n fonts: {\n display: 'system-ui, -apple-system, \"Segoe UI\", sans-serif',\n sans: 'system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif',\n mono: 'ui-monospace, \"SF Mono\", Menlo, monospace',\n },\n typeScale: {\n base: '1rem',\n names: ['2xs', 'xs', 's', 'm', 'l', 'xl', '2xl', '3xl'],\n baseStep: 4,\n baseline: 'm',\n ratio: 1.2,\n fluid: { minVw: '22.5rem', maxVw: '80rem', minRatio: 1.12 },\n },\n spaceScale: {\n base: '1rem',\n names: ['2xs', 'xs', 's', 'm', 'l', 'xl', '2xl', '3xl'],\n baseStep: 4,\n baseline: 'm',\n ratio: 1.25,\n fluid: { minVw: '22.5rem', maxVw: '80rem', minRatio: 1.2 },\n },\n patterns: {\n defaults: {\n ds: 'none',\n b: '1px solid var(--color-surface-xl)',\n br: '0.375rem',\n p: '1rem',\n fs: '1rem',\n },\n radii: { pill: '999px', circle: '50%', card: '0.5rem' },\n groups: {\n control: {\n ds: 'var(--ds-default)',\n b: 'var(--b-default)',\n br: 'var(--br-default)',\n p: '0.5em 1em',\n fs: 'var(--fs-default)',\n },\n panel: {\n ds: 'var(--shadow-md)',\n b: 'var(--b-default)',\n br: '0.5rem',\n p: '1rem',\n fs: 'var(--fs-default)',\n },\n },\n z: { raised: 1, sticky: 100, overlay: 200, top: 1000 },\n items: {\n button: {\n group: 'control',\n element: 'button',\n default_role: 'brand-primary',\n base: {\n padding: '0.6em 1.2em',\n 'border-radius': 'var(--br-control, 0.25rem)',\n border: 'none',\n 'font-weight': '600',\n color: '#fff',\n cursor: 'pointer',\n 'box-shadow': 'var(--shadow-sm)',\n },\n states: { hover: { step: 1 }, active: { scale: 0.97 }, 'focus-visible': { ring: true } },\n roles: [],\n },\n card: {\n group: 'panel',\n class: 'card',\n base: {\n 'border-radius': 'var(--br-card-group)',\n padding: '1.5rem',\n background: 'var(--color-surface-xxl)',\n border: 'var(--b-card-group)',\n 'box-shadow': 'var(--ds-card-group)',\n },\n states: {},\n roles: [],\n },\n },\n },\n typography: {\n families: {\n display: 'var(--font-display)',\n sans: 'var(--font-sans)',\n code: 'var(--font-mono, ui-monospace, monospace)',\n },\n roles: {\n display: {\n family: 'display',\n size: 'var(--text-3xl)',\n weight: 700,\n 'line-height': '1.05',\n tracking: '-0.03em',\n },\n heading: { family: 'display', size: 'var(--text-xl)', weight: 600, 'line-height': '1.3' },\n body: { family: 'sans', size: 'var(--text-m)', weight: 400, 'line-height': '1.55' },\n },\n headings: { h1: 'display', h2: 'heading', h3: 'heading' },\n },\n animations: {\n effects: {\n 'fade-in': { kf: 'composite', vars: { 'opacity-from': 0 } },\n 'slide-up': {\n kf: 'composite',\n vars: { 'translate-y-from': 'var(--slide-distance, 2rem)' },\n },\n },\n journeys: {\n base: { fade: { 'opacity-from': 0 }, slide: {} },\n compose: [['fade'], ['slide'], ['fade', 'slide']],\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,QAAoD,QAAW,SAC1E,OAAO,MAAM,EAAE,SAAS,IAAI,CAAU;AAExC,MAAM,WAAW,KACf,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,GAC/B,gKACF;AACA,MAAM,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,E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