@nebutra/tokens 0.1.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/brands/README.md +66 -0
  3. package/brands/cosmos/DESIGN.md +356 -0
  4. package/brands/cosmos/brand.json +209 -0
  5. package/brands/cosmos/refero-tokens.json +312 -0
  6. package/brands/gsap/brand.json +1 -27
  7. package/brands/linear/DESIGN.md +478 -0
  8. package/brands/linear/brand.json +2 -19
  9. package/brands/notion/brand.json +2 -28
  10. package/brands/raycast/brand.json +2 -17
  11. package/brands/stripe/brand.json +1 -16
  12. package/brands/vanta/brand.json +1 -38
  13. package/brands/vercel/brand.json +1 -18
  14. package/dist/brand-package/index.d.ts +13 -7
  15. package/dist/brand-package/index.js +2290 -34
  16. package/dist/brand-package/index.js.map +1 -1
  17. package/dist/brand-package/use-brand.d.ts +1 -1
  18. package/dist/brand-package/use-brand.js +957 -5
  19. package/dist/brand-package/use-brand.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +2417 -22
  22. package/dist/index.js.map +1 -1
  23. package/dist/{use-brand-C8d4DPqE.d.ts → use-brand-ClmvK_lC.d.ts} +19 -3
  24. package/dist/values.d.ts +1192 -0
  25. package/dist/values.js +518 -0
  26. package/dist/values.js.map +1 -0
  27. package/package.json +16 -4
  28. package/recipe.css +36 -2
  29. package/skins/cosmos.css +239 -0
  30. package/skins/gsap.css +32 -20
  31. package/skins/linear.css +54 -17
  32. package/skins/notion.css +36 -25
  33. package/skins/raycast.css +37 -19
  34. package/skins/stripe.css +34 -15
  35. package/skins/vanta.css +34 -30
  36. package/skins/vercel.css +55 -19
  37. package/styles.css +492 -149
  38. package/dist/chunk-ALJTP5HL.js +0 -881
  39. package/dist/chunk-ALJTP5HL.js.map +0 -1
  40. package/dist/chunk-RGUJQOLH.js +0 -1582
  41. package/dist/chunk-RGUJQOLH.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme-provider.tsx","../src/index.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Custom ThemeProvider — replaces the upstream `next-themes` re-export.\n *\n * Why we own this: `next-themes@0.4.x` renders an inline `<script>` element\n * inside its Client-Component provider for FOUC prevention. React 19 +\n * Next.js 16 (Turbopack) now emit a console error when scripts appear\n * inside Client Components (\"Scripts inside React components are never\n * executed when rendering on the client\"). The script DID do its job at\n * SSR time, but the warning pollutes the dev console on every page load.\n *\n * Our architecture splits the two concerns cleanly:\n * - {@link ThemeProvider} (Client) — runtime state, OS sync, transitions\n * - {@link ThemeScript} (Server) — synchronous FOUC-prevention inline\n * script rendered into the SSR HTML\n *\n * The API surface mirrors next-themes so the migration is a drop-in for\n * callers (same prop names: `attribute`, `defaultTheme`, `enableSystem`,\n * `disableTransitionOnChange`, `storageKey`, `nonce`).\n */\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\ntype ResolvedTheme = \"light\" | \"dark\";\n\nconst THEMES = [\"light\", \"dark\", \"system\"] as const satisfies readonly Theme[];\n\n/**\n * Shared default storage key. Matches what `next-themes` uses, so any user\n * who already has a saved preference keeps it across the migration.\n */\nexport const THEME_STORAGE_KEY = \"theme\";\n\ninterface ThemeContextValue {\n /** Whether a real ThemeProvider is present above the consumer. */\n isProviderBound: boolean;\n /** The raw user preference. May be \"system\". */\n theme: Theme;\n /** Provider-level override for demos, locked routes, or embedded previews. */\n forcedTheme?: Theme | undefined;\n /** The concretely-applied theme — always \"light\" or \"dark\". */\n resolvedTheme: ResolvedTheme;\n /** The OS-level preference (always concrete). */\n systemTheme: ResolvedTheme;\n setTheme: (theme: Theme) => void;\n themes: readonly Theme[];\n}\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\n/**\n * Read the active theme state. Safe to call outside a provider — returns\n * a sane default in that case so consumers don't need to null-check.\n */\nexport function useTheme(): ThemeContextValue {\n const ctx = useContext(ThemeContext);\n if (ctx) return ctx;\n return {\n isProviderBound: false,\n theme: \"system\",\n forcedTheme: undefined,\n resolvedTheme: \"light\",\n systemTheme: \"light\",\n setTheme: () => {\n // no-op outside provider\n },\n themes: THEMES,\n };\n}\n\nfunction resolveSystemTheme(): ResolvedTheme {\n if (typeof window === \"undefined\") return \"light\";\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n}\n\nfunction readStoredTheme(storageKey: string, fallback: Theme): Theme {\n if (typeof window === \"undefined\") return fallback;\n try {\n const v = window.localStorage.getItem(storageKey);\n if (v === \"light\" || v === \"dark\" || v === \"system\") return v;\n } catch {\n // localStorage may be disabled (Safari private mode, etc.)\n }\n return fallback;\n}\n\n/** 1 year — long-lived because theme is a deliberate user choice. */\nconst THEME_COOKIE_MAX_AGE = 365 * 24 * 60 * 60;\n\n/**\n * Mirror the resolved theme into a cookie so the next request can be\n * server-rendered with the correct `<html>` class — eliminating the\n * need for an inline FOUC-prevention `<script>` (which React 19 warns\n * about). The cookie value is always concrete (\"light\" | \"dark\"), never\n * \"system\" — Server Components shouldn't try to guess the OS preference.\n */\nfunction writeThemeCookie(resolved: ResolvedTheme, cookieName: string) {\n if (typeof document === \"undefined\") return;\n document.cookie = `${cookieName}=${resolved}; Max-Age=${THEME_COOKIE_MAX_AGE}; Path=/; SameSite=Lax`;\n}\n\nfunction applyThemeToDom(\n resolved: ResolvedTheme,\n attribute: \"class\" | \"data-theme\",\n disableTransitionOnChange: boolean,\n nonce?: string,\n) {\n if (typeof document === \"undefined\") return;\n const root = document.documentElement;\n\n // Suppress CSS transitions during the swap so the change appears instant.\n if (disableTransitionOnChange) {\n const suppressor = document.createElement(\"style\");\n if (nonce) suppressor.setAttribute(\"nonce\", nonce);\n suppressor.appendChild(\n document.createTextNode(\n \"*,*::before,*::after{transition:none!important;animation-duration:0s!important}\",\n ),\n );\n document.head.appendChild(suppressor);\n // Force a reflow so the rule applies before we swap classes\n void window.getComputedStyle(suppressor).opacity;\n // Remove the rule on the next tick; transitions resume afterwards\n setTimeout(() => {\n if (suppressor.parentNode) suppressor.parentNode.removeChild(suppressor);\n }, 1);\n }\n\n if (attribute === \"class\") {\n root.classList.remove(\"light\", \"dark\");\n root.classList.add(resolved);\n } else {\n root.setAttribute(\"data-theme\", resolved);\n }\n}\n\nexport interface ThemeProviderProps {\n children: ReactNode;\n /** Which DOM attribute to set on `<html>`. Default: `\"class\"`. */\n attribute?: \"class\" | \"data-theme\";\n /** Default theme when no preference is stored. Default: `\"system\"`. */\n defaultTheme?: Theme;\n /** Whether `\"system\"` is a valid theme that tracks `prefers-color-scheme`. */\n enableSystem?: boolean;\n /** Lock the rendered theme and expose read-only state to controls. */\n forcedTheme?: Theme | undefined;\n /** Suppress CSS transitions during the swap. Default: `true`. */\n disableTransitionOnChange?: boolean;\n /** Storage key under which the preference is persisted. */\n storageKey?: string;\n /** CSP nonce — accepted for API compatibility, currently unused by client logic. */\n nonce?: string;\n}\n\nexport function ThemeProvider({\n children,\n attribute = \"class\",\n defaultTheme = \"system\",\n enableSystem = true,\n forcedTheme,\n disableTransitionOnChange = true,\n storageKey = THEME_STORAGE_KEY,\n nonce,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<Theme>(() => readStoredTheme(storageKey, defaultTheme));\n const [systemTheme, setSystemTheme] = useState<ResolvedTheme>(() => resolveSystemTheme());\n\n const effectiveTheme = forcedTheme ?? theme;\n const resolvedTheme: ResolvedTheme =\n effectiveTheme === \"system\" ? (enableSystem ? systemTheme : \"light\") : effectiveTheme;\n\n const setTheme = useCallback(\n (next: Theme) => {\n if (forcedTheme !== undefined) return;\n setThemeState(next);\n try {\n if (next === \"system\") {\n window.localStorage.removeItem(storageKey);\n } else {\n window.localStorage.setItem(storageKey, next);\n }\n } catch {\n // localStorage may be disabled — accept the loss\n }\n },\n [forcedTheme, storageKey],\n );\n\n // Apply the resolved theme to the DOM AND sync the cookie so the next\n // SSR can render the correct <html> class directly (no inline script,\n // no React 19 \"script in component\" warning).\n useEffect(() => {\n applyThemeToDom(resolvedTheme, attribute, disableTransitionOnChange, nonce);\n writeThemeCookie(resolvedTheme, storageKey);\n }, [resolvedTheme, attribute, disableTransitionOnChange, nonce, storageKey]);\n\n // Follow OS preference changes when in `system` mode\n useEffect(() => {\n if (!enableSystem) return;\n const mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handler = (event: MediaQueryListEvent) =>\n setSystemTheme(event.matches ? \"dark\" : \"light\");\n mq.addEventListener(\"change\", handler);\n return () => mq.removeEventListener(\"change\", handler);\n }, [enableSystem]);\n\n // Sync across tabs / windows\n useEffect(() => {\n const handler = (event: StorageEvent) => {\n if (event.key !== storageKey) return;\n const next = event.newValue;\n if (next === \"light\" || next === \"dark\" || next === \"system\") {\n setThemeState(next);\n } else if (next === null) {\n setThemeState(defaultTheme);\n }\n };\n window.addEventListener(\"storage\", handler);\n return () => window.removeEventListener(\"storage\", handler);\n }, [storageKey, defaultTheme]);\n\n const value = useMemo<ThemeContextValue>(\n () => ({\n isProviderBound: true,\n theme,\n forcedTheme,\n resolvedTheme,\n systemTheme,\n setTheme,\n themes: THEMES,\n }),\n [theme, forcedTheme, resolvedTheme, systemTheme, setTheme],\n );\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n","/**\n * @nebutra/tokens — Runtime theme tokens & theme switching\n *\n * This package is the SINGLE SOURCE OF TRUTH for runtime design tokens.\n *\n * CSS tokens: @import \"@nebutra/tokens/styles.css\"\n * → Brand color scales (--nebutra-blue-*, --nebutra-cyan-*)\n * → 12-step functional scales (--neutral-1..12, --blue-1..12, --cyan-1..12)\n * → Semantic variables (--primary, --background, --border, etc.)\n * → Light/dark mode via :root / .dark\n * → Display-P3 wide gamut with sRGB fallback\n * → Tailwind v4 @theme integration\n *\n * JS exports: ThemeProvider, useTheme, THEME_STORAGE_KEY (custom — no next-themes)\n * → App-level light/dark mode switching\n * → ThemeProvider writes BOTH localStorage AND a cookie of the same name.\n * Server Components read the cookie via `next/headers` cookies() and\n * inject the resolved class directly into <html> — zero inline script,\n * zero React 19 \"script in component\" warning, zero FOUC risk.\n *\n * Related packages:\n * @nebutra/brand → brand primitives (color definitions, motion language)\n * @nebutra/theme → design-language catalog (Brand Package global swap)\n * @nebutra/ui → component library (consumes tokens via CSS variables)\n */\n\nexport {\n THEME_STORAGE_KEY,\n ThemeProvider,\n type ThemeProviderProps,\n useTheme,\n} from \"./theme-provider\";\n\nexport const THEME_IDS = [\"light\", \"dark\"] as const;\nexport type ThemeId = (typeof THEME_IDS)[number];\n\nexport const DEFAULT_THEME: ThemeId = \"dark\";\n\n/** Create Center brand package: carrier contract + runtime apply */\nexport {\n applyBrandCss,\n applyBrandPackage,\n applyBrandToIframe,\n BRAND_STORAGE_KEY,\n type BrandColorRoles,\n type BrandElevationTokens,\n type BrandFontFace,\n type BrandPackage,\n type BrandRadii,\n type BrandRecipe,\n type CompileResult,\n clearBrand,\n compileReferoTokens,\n emitBrandCss,\n getActiveBrandId,\n hexToHslChannels,\n inferRecipeFromDesignMd,\n normalizeBrandPackage,\n restorePersistedBrand,\n rolesFromSemantic,\n semanticFromRoles,\n useBrand,\n useBrandIframePreview,\n type ValidationResult,\n validateBrandPackage,\n} from \"./brand-package\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsNE;AAjNT,IAAM,SAAS,CAAC,SAAS,QAAQ,QAAQ;AAMlC,IAAM,oBAAoB;AAiBjC,IAAM,eAAe,cAAwC,IAAI;AAM1D,SAAS,WAA8B;AAC5C,QAAM,MAAM,WAAW,YAAY;AACnC,MAAI,IAAK,QAAO;AAChB,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAe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AS,MAAM;AACxB,sBAAc,YAAY;AAAA,MAC5B;AAAA,IACF;AACA,WAAO,iBAAiB,WAAW,OAAO;AAC1C,WAAO,MAAM,OAAO,oBAAoB,WAAW,OAAO;AAAA,EAC5D,GAAG,CAAC,YAAY,YAAY,CAAC;AAE7B,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,iBAAiB;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,OAAO,aAAa,eAAe,aAAa,QAAQ;AAAA,EAC3D;AAEA,SAAO,oBAAC,aAAa,UAAb,EAAsB,OAAe,UAAS;AACxD;;;ACpNO,IAAM,YAAY,CAAC,SAAS,MAAM;AAGlC,IAAM,gBAAyB;","names":[]}
1
+ {"version":3,"sources":["../src/theme-provider.tsx","../src/brand-package/emit-css.ts","../src/brand-package/hex-to-hsl.ts","../src/brand-package/normalize.ts","../src/brand-package/apply-brand.ts","../src/brand-package/compile-helpers.ts","../src/brand-package/infer-recipe.ts","../src/brand-package/presets/recipe.ts","../src/brand-package/presets/generic.ts","../src/brand-package/presets/gsap.ts","../src/brand-package/presets/linear.ts","../src/brand-package/presets/notion.ts","../src/brand-package/presets/raycast.ts","../src/brand-package/presets/stripe.ts","../src/brand-package/presets/vanta.ts","../src/brand-package/presets/vercel.ts","../src/brand-package/presets/index.ts","../src/brand-package/compile-refero.ts","../src/brand-package/validate.ts","../src/brand-package/use-brand.ts","../src/index.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Custom ThemeProvider — replaces the upstream `next-themes` re-export.\n *\n * Why we own this: `next-themes@0.4.x` renders an inline `<script>` element\n * inside its Client-Component provider for FOUC prevention. React 19 +\n * Next.js 16 (Turbopack) now emit a console error when scripts appear\n * inside Client Components (\"Scripts inside React components are never\n * executed when rendering on the client\"). The script DID do its job at\n * SSR time, but the warning pollutes the dev console on every page load.\n *\n * Our architecture splits the two concerns cleanly:\n * - {@link ThemeProvider} (Client) — runtime state, OS sync, transitions\n * - {@link ThemeScript} (Server) — synchronous FOUC-prevention inline\n * script rendered into the SSR HTML\n *\n * The API surface mirrors next-themes so the migration is a drop-in for\n * callers (same prop names: `attribute`, `defaultTheme`, `enableSystem`,\n * `disableTransitionOnChange`, `storageKey`, `nonce`).\n */\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\ntype ResolvedTheme = \"light\" | \"dark\";\n\nconst THEMES = [\"light\", \"dark\", \"system\"] as const satisfies readonly Theme[];\n\n/**\n * Shared default storage key. Matches what `next-themes` uses, so any user\n * who already has a saved preference keeps it across the migration.\n */\nexport const THEME_STORAGE_KEY = \"theme\";\n\ninterface ThemeContextValue {\n /** Whether a real ThemeProvider is present above the consumer. */\n isProviderBound: boolean;\n /** The raw user preference. May be \"system\". */\n theme: Theme;\n /** Provider-level override for demos, locked routes, or embedded previews. */\n forcedTheme?: Theme | undefined;\n /** The concretely-applied theme — always \"light\" or \"dark\". */\n resolvedTheme: ResolvedTheme;\n /** The OS-level preference (always concrete). */\n systemTheme: ResolvedTheme;\n setTheme: (theme: Theme) => void;\n themes: readonly Theme[];\n}\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\n/**\n * Read the active theme state. Safe to call outside a provider — returns\n * a sane default in that case so consumers don't need to null-check.\n */\nexport function useTheme(): ThemeContextValue {\n const ctx = useContext(ThemeContext);\n if (ctx) return ctx;\n return {\n isProviderBound: false,\n theme: \"system\",\n forcedTheme: undefined,\n resolvedTheme: \"light\",\n systemTheme: \"light\",\n setTheme: () => {\n // no-op outside provider\n },\n themes: THEMES,\n };\n}\n\nfunction resolveSystemTheme(): ResolvedTheme {\n if (typeof window === \"undefined\") return \"light\";\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n}\n\nfunction readStoredTheme(storageKey: string, fallback: Theme): Theme {\n if (typeof window === \"undefined\") return fallback;\n try {\n const v = window.localStorage.getItem(storageKey);\n if (v === \"light\" || v === \"dark\" || v === \"system\") return v;\n } catch {\n // localStorage may be disabled (Safari private mode, etc.)\n }\n return fallback;\n}\n\n/** 1 year — long-lived because theme is a deliberate user choice. */\nconst THEME_COOKIE_MAX_AGE = 365 * 24 * 60 * 60;\n\n/**\n * Mirror the resolved theme into a cookie so the next request can be\n * server-rendered with the correct `<html>` class — eliminating the\n * need for an inline FOUC-prevention `<script>` (which React 19 warns\n * about). The cookie value is always concrete (\"light\" | \"dark\"), never\n * \"system\" — Server Components shouldn't try to guess the OS preference.\n */\nfunction writeThemeCookie(resolved: ResolvedTheme, cookieName: string) {\n if (typeof document === \"undefined\") return;\n document.cookie = `${cookieName}=${resolved}; Max-Age=${THEME_COOKIE_MAX_AGE}; Path=/; SameSite=Lax`;\n}\n\nfunction applyThemeToDom(\n resolved: ResolvedTheme,\n attribute: \"class\" | \"data-theme\",\n disableTransitionOnChange: boolean,\n nonce?: string,\n) {\n if (typeof document === \"undefined\") return;\n const root = document.documentElement;\n\n // Suppress CSS transitions during the swap so the change appears instant.\n if (disableTransitionOnChange) {\n const suppressor = document.createElement(\"style\");\n if (nonce) suppressor.setAttribute(\"nonce\", nonce);\n suppressor.appendChild(\n document.createTextNode(\n \"*,*::before,*::after{transition:none!important;animation-duration:0s!important}\",\n ),\n );\n document.head.appendChild(suppressor);\n // Force a reflow so the rule applies before we swap classes\n void window.getComputedStyle(suppressor).opacity;\n // Remove the rule on the next tick; transitions resume afterwards\n setTimeout(() => {\n if (suppressor.parentNode) suppressor.parentNode.removeChild(suppressor);\n }, 1);\n }\n\n if (attribute === \"class\") {\n root.classList.remove(\"light\", \"dark\");\n root.classList.add(resolved);\n } else {\n root.setAttribute(\"data-theme\", resolved);\n }\n}\n\nexport interface ThemeProviderProps {\n children: ReactNode;\n /** Which DOM attribute to set on `<html>`. Default: `\"class\"`. */\n attribute?: \"class\" | \"data-theme\";\n /** Default theme when no preference is stored. Default: `\"system\"`. */\n defaultTheme?: Theme;\n /** Whether `\"system\"` is a valid theme that tracks `prefers-color-scheme`. */\n enableSystem?: boolean;\n /** Lock the rendered theme and expose read-only state to controls. */\n forcedTheme?: Theme | undefined;\n /** Suppress CSS transitions during the swap. Default: `true`. */\n disableTransitionOnChange?: boolean;\n /** Storage key under which the preference is persisted. */\n storageKey?: string;\n /** CSP nonce — accepted for API compatibility, currently unused by client logic. */\n nonce?: string;\n}\n\nexport function ThemeProvider({\n children,\n attribute = \"class\",\n defaultTheme = \"system\",\n enableSystem = true,\n forcedTheme,\n disableTransitionOnChange = true,\n storageKey = THEME_STORAGE_KEY,\n nonce,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<Theme>(() => readStoredTheme(storageKey, defaultTheme));\n const [systemTheme, setSystemTheme] = useState<ResolvedTheme>(() => resolveSystemTheme());\n\n const effectiveTheme = forcedTheme ?? theme;\n const resolvedTheme: ResolvedTheme =\n effectiveTheme === \"system\" ? (enableSystem ? systemTheme : \"light\") : effectiveTheme;\n\n const setTheme = useCallback(\n (next: Theme) => {\n if (forcedTheme !== undefined) return;\n setThemeState(next);\n try {\n if (next === \"system\") {\n window.localStorage.removeItem(storageKey);\n } else {\n window.localStorage.setItem(storageKey, next);\n }\n } catch {\n // localStorage may be disabled — accept the loss\n }\n },\n [forcedTheme, storageKey],\n );\n\n // Apply the resolved theme to the DOM AND sync the cookie so the next\n // SSR can render the correct <html> class directly (no inline script,\n // no React 19 \"script in component\" warning).\n useEffect(() => {\n applyThemeToDom(resolvedTheme, attribute, disableTransitionOnChange, nonce);\n writeThemeCookie(resolvedTheme, storageKey);\n }, [resolvedTheme, attribute, disableTransitionOnChange, nonce, storageKey]);\n\n // Follow OS preference changes when in `system` mode\n useEffect(() => {\n if (!enableSystem) return;\n const mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handler = (event: MediaQueryListEvent) =>\n setSystemTheme(event.matches ? \"dark\" : \"light\");\n mq.addEventListener(\"change\", handler);\n return () => mq.removeEventListener(\"change\", handler);\n }, [enableSystem]);\n\n // Sync across tabs / windows\n useEffect(() => {\n const handler = (event: StorageEvent) => {\n if (event.key !== storageKey) return;\n const next = event.newValue;\n if (next === \"light\" || next === \"dark\" || next === \"system\") {\n setThemeState(next);\n } else if (next === null) {\n setThemeState(defaultTheme);\n }\n };\n window.addEventListener(\"storage\", handler);\n return () => window.removeEventListener(\"storage\", handler);\n }, [storageKey, defaultTheme]);\n\n const value = useMemo<ThemeContextValue>(\n () => ({\n isProviderBound: true,\n theme,\n forcedTheme,\n resolvedTheme,\n systemTheme,\n setTheme,\n themes: THEMES,\n }),\n [theme, forcedTheme, resolvedTheme, systemTheme, setTheme],\n );\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n","/**\n * Emit carrier CSS from a normalized Brand Package.\n * Components bind: --primary (= action), --brand-mark, --elevation-*, --radius-*.\n */\n\n// The source subpath, not the built entry: this module is consumed by\n// emit-skins at build time, and depending on another package's dist made the\n// skin pipeline fail whenever turbo scheduled the two builds side by side.\nimport { withNearestRegistryFont } from \"@nebutra/fonts/registry\";\nimport { isDualModeBrand, normalizeBrandPackage } from \"./normalize\";\nimport type {\n BrandColorRoles,\n BrandFontFace,\n BrandMotion,\n BrandPackage,\n BrandRecipe,\n BrandSemanticColors,\n BrandSpacing,\n} from \"./types\";\n\n/**\n * Resolve a declared stack to something that can actually render.\n *\n * Biome's CSS formatter prefers double quotes, and `withNearestRegistryFont`\n * prepends the first family in the stack that the app self-hosts — without it a\n * bare `Inter` in a brand stack does not reach next/font's hashed face and the\n * whole chain falls through to `ui-sans-serif`.\n */\nfunction cssFontStack(stack: string): string {\n return (withNearestRegistryFont(stack) ?? stack).replace(/'/g, '\"');\n}\n\n/** The generic families that end a stack — nothing after one is ever reached. */\nconst GENERIC_FAMILIES = new Set([\n \"ui-sans-serif\",\n \"ui-serif\",\n \"ui-monospace\",\n \"system-ui\",\n \"sans-serif\",\n \"serif\",\n \"monospace\",\n \"-apple-system\",\n \"BlinkMacSystemFont\",\n]);\n\n/**\n * Keep Chinese readable in every design language.\n *\n * Inter, Geist, Söhne and Mori carry no CJK glyphs, and a generic family always\n * resolves — so `\"Inter\", ui-sans-serif, sans-serif` hands every Han character\n * to whatever the OS picks, and the careful MiSans / PingFang order that\n * the default stack spells out is lost the moment a visitor picks a language.\n *\n * The tail goes in ahead of the first generic family, which is the last point\n * at which it can still be reached.\n */\nfunction withCjkTail(stack: string): string {\n const families = stack.split(\",\").map((f) => f.trim());\n const cut = families.findIndex((f) => GENERIC_FAMILIES.has(f.replace(/\"/g, \"\")));\n if (cut === -1 || families.some((f) => f.includes(\"MiSans\"))) return stack;\n const cjk = ['var(--font-misans, \"MiSans\")', '\"PingFang SC\"'];\n return [...families.slice(0, cut), ...cjk, ...families.slice(cut)].join(\", \");\n}\n\n/**\n * Timing for one language.\n *\n * Emits both spellings the shared sheet ships — `--duration-flow` and\n * `--motion-duration-flow` — because both are already consumed and a skin that\n * set only one would leave half the surface on the default ramp, which reads as\n * a language that moves at two speeds.\n *\n * Only the keys the package declares are written. An omitted curve inherits the\n * shared ramp rather than being reset to it, so a language can adjust its\n * durations without also restating curves it does not care about.\n */\nfunction motionVars(motion: BrandMotion | undefined): string[] {\n if (!motion) return [];\n const lines: string[] = [];\n // Both rails, for the same reason the durations write both spellings: the\n // utility layer reads --motion-ease-*, hand-written CSS reads --ease-*, and a\n // skin that moved only one would animate its utilities and its stylesheets at\n // different speeds.\n const curves: Array<[keyof BrandMotion, string]> = [\n [\"easeOut\", \"ease-out\"],\n [\"easeInOut\", \"ease-in-out\"],\n [\"easeSpring\", \"ease-spring\"],\n ];\n for (const [key, name] of curves) {\n const value = motion[key];\n if (typeof value !== \"string\" || !value.trim()) continue;\n lines.push(` --${name}: ${value};`);\n lines.push(` --motion-${name}: ${value};`);\n }\n const durations: Array<[keyof BrandMotion, string]> = [\n [\"micro\", \"micro\"],\n [\"flow\", \"flow\"],\n [\"reveal\", \"reveal\"],\n [\"cinematic\", \"cinematic\"],\n ];\n for (const [key, name] of durations) {\n const value = motion[key];\n if (typeof value !== \"number\" || !Number.isFinite(value)) continue;\n lines.push(` --duration-${name}: ${value}ms;`);\n lines.push(` --motion-duration-${name}: ${value}ms;`);\n }\n return lines.length ? [``, ` /* Motion */`, ...lines] : [];\n}\n\n/**\n * Breathing room for one language.\n *\n * Writes only `--space-source-*`. Consumers read those vars directly\n * (`var(--space-source-md, …)`). We deliberately do NOT also emit\n * `--spacing-sm|md|…` into @theme: Tailwind v4 treats every --spacing-{key}\n * as a size token, so max-w-sm / max-w-2xl would resolve to the breathing\n * lengths (0.75rem…3rem) instead of the container scale (24rem…42rem).\n */\nfunction spacingVars(spacing: BrandSpacing | undefined): string[] {\n if (!spacing) return [];\n const lines: string[] = [];\n const steps: Array<[keyof BrandSpacing, string]> = [\n [\"xs\", \"xs\"],\n [\"sm\", \"sm\"],\n [\"md\", \"md\"],\n [\"lg\", \"lg\"],\n [\"xl\", \"xl\"],\n [\"2xl\", \"2xl\"],\n ];\n for (const [key, name] of steps) {\n const value = spacing[key];\n if (typeof value !== \"string\" || !value.trim()) continue;\n lines.push(` --space-source-${name}: ${value};`);\n }\n return lines.length ? [``, ` /* Spacing */`, ...lines] : [];\n}\n\nfunction recipeVars(recipe: BrandRecipe): string[] {\n const radii = recipe.radii;\n const elev = recipe.elevationTokens;\n\n const lines: string[] = [\n ` /* Shape slots */`,\n ` --btn-default-radius: ${radii.button};`,\n ` --radius-button: ${radii.button};`,\n ` --radius-buttons: ${radii.button};`,\n // A step on the size scale, not the button role.\n //\n // Aliasing it straight to `radii.button` is fine while a language's buttons\n // are modestly rounded — five of the seven are 4–8px and never noticed. It\n // breaks for the two whose buttons are pills: GSAP emitted\n // `--radius-md: 100px` and Vanta 999px, and forty-two files read that step\n // for panels and surfaces. The Combobox popover under GSAP came out as a\n // lozenge, which is what a 100px radius does to a 260px-wide panel.\n //\n // `min()` keeps every language whose button is the tighter of the two\n // exactly where it was, and stops a pill from escaping its role. A pill is\n // a control decision; it has no business setting the radius of a surface.\n ` --radius-md: min(${radii.button}, ${radii.card});`,\n ` --radius-card: ${radii.card};`,\n ` --radius-lg: ${radii.card};`,\n ` --radius-badge: ${radii.badge ?? \"9999px\"};`,\n ` --badge-default-radius: ${radii.badge ?? \"9999px\"};`,\n ` --radius-inputs: ${radii.input ?? radii.button};`,\n ` --input-radius: ${radii.input ?? radii.button};`,\n ` --radius-pill: ${radii.pill ?? \"9999px\"};`,\n ``,\n ` /* Free elevation (carrier-provided CSS shadows) */`,\n ` --elevation-card: ${elev.card};`,\n ` --elevation-control: ${elev.control ?? \"0 0 #0000\"};`,\n ` --elevation-raised: ${elev.raised ?? elev.card};`,\n // --elevation-*, not --shadow-*. The theme block maps `--shadow-md` to\n // `var(--elevation-md)` and inlines that into `.shadow-md`, so a skin that\n // set --shadow-md was writing to the alias while the utility read the\n // source. Every language's shadows were therefore byte-identical in the\n // browser — measured across all seven with getComputedStyle — while the\n // token files disagreed convincingly. Setting the source is what a brand\n // switch needs; the alias takes care of itself.\n ` --elevation-xs: ${elev.control ?? \"0 0 #0000\"};`,\n ` --elevation-sm: ${elev.card};`,\n ` --elevation-md: ${elev.raised ?? elev.card};`,\n ` --elevation-lg: ${elev.raised ?? elev.card};`,\n ` --btn-default-shadow: 0 0 #0000;`,\n ];\n\n switch (recipe.buttonDefault) {\n case \"outline\": {\n const edge = recipe.outlineBorder ?? \"hsl(var(--foreground))\";\n lines.push(\" --btn-default-bg: transparent;\");\n lines.push(\" --btn-default-fg: hsl(var(--foreground));\");\n lines.push(\" --btn-default-border-width: 1px;\");\n lines.push(\" --btn-default-border: transparent;\");\n lines.push(` --btn-default-stroke-gradient: linear-gradient(${edge}, ${edge});`);\n lines.push(\" --btn-default-hover-bg: hsl(var(--foreground) / 0.06);\");\n break;\n }\n case \"gradient-stroke\": {\n const grad =\n recipe.primaryStrokeGradient ??\n \"linear-gradient(135deg, hsl(var(--primary)), color-mix(in srgb, hsl(var(--primary)) 55%, white))\";\n lines.push(\" --btn-default-bg: transparent;\");\n lines.push(\" --btn-default-fg: hsl(var(--foreground));\");\n lines.push(\" --btn-default-border-width: 1.5px;\");\n lines.push(\" --btn-default-border: transparent;\");\n lines.push(` --btn-default-stroke-gradient: ${grad};`);\n lines.push(\" --btn-default-hover-bg: hsl(var(--primary) / 0.08);\");\n break;\n }\n default:\n lines.push(\" --btn-default-bg: hsl(var(--primary));\");\n lines.push(\" --btn-default-fg: hsl(var(--primary-foreground));\");\n lines.push(\" --btn-default-border-width: 0px;\");\n lines.push(\" --btn-default-border: transparent;\");\n // A gradient, not `transparent`. This slot is a background-image layer:\n // a colour invalidates the whole declaration and takes the solid fill\n // above it with it, leaving the button with no background. Every solid\n // skin goes through this branch, so the one wrong word reached them all.\n lines.push(\" --btn-default-stroke-gradient: linear-gradient(transparent, transparent);\");\n lines.push(\n \" --btn-default-hover-bg: color-mix(in srgb, hsl(var(--primary)) 90%, transparent);\",\n );\n break;\n }\n\n const badgeMode = recipe.badgeDefault ?? \"match-action\";\n if (badgeMode === \"outline\") {\n const edge = recipe.outlineBorder ?? \"hsl(var(--border))\";\n lines.push(\" --badge-default-bg: transparent;\");\n lines.push(\" --badge-default-fg: hsl(var(--foreground));\");\n lines.push(` --badge-default-border: ${edge};`);\n lines.push(\" --badge-default-hover-bg: hsl(var(--foreground) / 0.06);\");\n } else if (badgeMode === \"muted\") {\n lines.push(\" --badge-default-bg: hsl(var(--secondary));\");\n lines.push(\" --badge-default-fg: hsl(var(--secondary-foreground));\");\n lines.push(\" --badge-default-border: transparent;\");\n lines.push(\" --badge-default-hover-bg: color-mix(in srgb, hsl(var(--secondary)) 90%, white);\");\n } else if (badgeMode === \"brand\") {\n lines.push(\" --badge-default-bg: hsl(var(--brand-mark, var(--accent)));\");\n lines.push(\n \" --badge-default-fg: hsl(var(--brand-mark-foreground, var(--accent-foreground)));\",\n );\n lines.push(\" --badge-default-border: transparent;\");\n lines.push(\n \" --badge-default-hover-bg: color-mix(in srgb, hsl(var(--brand-mark, var(--accent))) 85%, transparent);\",\n );\n } else if (recipe.buttonDefault === \"outline\" || recipe.buttonDefault === \"gradient-stroke\") {\n const edge = recipe.outlineBorder ?? \"hsl(var(--foreground))\";\n lines.push(\" --badge-default-bg: transparent;\");\n lines.push(\" --badge-default-fg: hsl(var(--foreground));\");\n lines.push(` --badge-default-border: ${edge};`);\n lines.push(\" --badge-default-hover-bg: hsl(var(--foreground) / 0.06);\");\n } else {\n // match-action\n lines.push(\" --badge-default-bg: hsl(var(--primary));\");\n lines.push(\" --badge-default-fg: hsl(var(--primary-foreground));\");\n lines.push(\" --badge-default-border: transparent;\");\n lines.push(\n \" --badge-default-hover-bg: color-mix(in srgb, hsl(var(--primary)) 80%, transparent);\",\n );\n }\n\n if (recipe.density === \"compact\") {\n lines.push(\" --btn-default-padding-y: 0.5rem;\");\n lines.push(\" --btn-default-padding-x: 0.875rem;\");\n lines.push(\" --control-height-tiny: 1.25rem;\");\n lines.push(\" --control-height-sm: 1.75rem;\");\n lines.push(\" --control-height-md: 2rem;\");\n lines.push(\" --control-height-lg: 2.5rem;\");\n lines.push(\" --control-height-icon-sm: 1.5rem;\");\n lines.push(\" --control-height-icon-md: 1.75rem;\");\n lines.push(\" --control-height-icon-lg: 2rem;\");\n lines.push(\" --control-font-size-md: 0.8125rem;\");\n } else if (recipe.density === \"spacious\") {\n lines.push(\" --btn-default-padding-y: 0.875rem;\");\n lines.push(\" --btn-default-padding-x: 1.5rem;\");\n lines.push(\" --control-height-tiny: 1.75rem;\");\n lines.push(\" --control-height-sm: 2.25rem;\");\n lines.push(\" --control-height-md: 2.75rem;\");\n lines.push(\" --control-height-lg: 3.25rem;\");\n lines.push(\" --control-height-icon-sm: 2rem;\");\n lines.push(\" --control-height-icon-md: 2.25rem;\");\n lines.push(\" --control-height-icon-lg: 2.5rem;\");\n }\n\n return lines;\n}\n\n/**\n * A skin may only @font-face something the app's own origin can serve.\n *\n * The seven built-in languages between them declared nine faces: four pulled\n * Inter/Geist from a public CDN, which every app's `font-src 'self' data:` CSP\n * blocked, and five pointed at `/brand-assets/*.woff2` files that are not in\n * the repo and never can be — they are other companies' licensed typefaces.\n * Nine declarations, zero fonts, no error anywhere: the stylesheet parsed, the\n * rule was present, the browser simply refused the fetch.\n *\n * Same-origin is the line because it is the one the CSP already draws. A\n * customer who owns Söhne drops the file in `public/` and the face works; a\n * skin cannot quietly reintroduce a third-party runtime dependency, and there\n * is no CSP to widen for it.\n */\nfunction isServableFaceUrl(url: string): boolean {\n return url.startsWith(\"/\") && !url.startsWith(\"//\");\n}\n\nfunction emitFontFaces(faces: BrandFontFace[] | undefined): string[] {\n const servable = faces?.filter((face) => face.src.every((s) => isServableFaceUrl(s.url)));\n if (!servable?.length) return [];\n const out: string[] = [\"/* Brand font faces */\"];\n for (const face of servable) {\n const src = face.src\n .map((s) => {\n const fmt = s.format ? ` format(\"${s.format}\")` : \"\";\n return `url(\"${s.url}\")${fmt}`;\n })\n .join(\", \");\n out.push(\"@font-face {\");\n out.push(` font-family: \"${face.family}\";`);\n out.push(` src: ${src};`);\n if (face.weight != null) out.push(` font-weight: ${face.weight};`);\n if (face.style) out.push(` font-style: ${face.style};`);\n out.push(` font-display: ${face.display ?? \"swap\"};`);\n if (face.unicodeRange) out.push(` unicode-range: ${face.unicodeRange};`);\n out.push(\"}\");\n out.push(\"\");\n }\n return out;\n}\n\nexport type EmitBrandCssMode =\n /** Single-skin import / Create Center inject — also binds :root (global swap) */\n | \"global\"\n /** Multi-language catalog — only activates under html[data-brand] */\n | \"scoped\";\n\nexport interface EmitBrandCssOptions {\n /**\n * `global` (default): `:root` + `<root>[data-brand]` — one import recolors the app.\n * Single-mode dark packs also include `.dark`.\n * Dual-mode packs (`modes.light` + `modes.dark`) emit separate light/dark color blocks.\n * `scoped`: only `<root>[data-brand]` (+ `<root>.dark[data-brand]` when dual).\n */\n mode?: EmitBrandCssMode;\n /**\n * Element the carrier attaches to. Defaults to `html` — the app-level swap.\n * A subtree preview passes its own root (e.g. `.theme-preview-artboard`) so\n * the emitted CSS cannot leak out of the preview.\n */\n root?: string;\n}\n\n/** Global single-skin selector list — single-mode packs only. */\nexport function emitGlobalSkinSelector(\n brandId: string,\n darkDefault: boolean,\n root = \"html\",\n): string {\n if (darkDefault) {\n return `:root,\\n.dark,\\n${root}[data-brand=\"${brandId}\"] {`;\n }\n return `:root,\\n${root}[data-brand=\"${brandId}\"] {`;\n}\n\n/** Light mode selector (dual-mode). */\nexport function emitLightModeSelector(\n brandId: string,\n mode: EmitBrandCssMode,\n root = \"html\",\n): string {\n if (mode === \"scoped\") return `${root}[data-brand=\"${brandId}\"] {`;\n return `:root,\\n${root}[data-brand=\"${brandId}\"] {`;\n}\n\n/** Dark mode selector (dual-mode) — never paints light colors under .dark. */\nexport function emitDarkModeSelector(\n brandId: string,\n mode: EmitBrandCssMode,\n root = \"html\",\n): string {\n if (mode === \"scoped\") return `${root}.dark[data-brand=\"${brandId}\"] {`;\n return `.dark,\\n${root}.dark[data-brand=\"${brandId}\"] {`;\n}\n\n/**\n * The 12-step neutral ramp, re-anchored on the language's own roles.\n *\n * `--neutral-1 … --neutral-12` is a fixed slate scale that no skin touched, so\n * `text-neutral-11` and `bg-neutral-2` rendered identically under every design\n * language — 1065 call sites across web, landing and the component library.\n * Under a language whose canvas is dark that is not a small drift: the navbar\n * links came out at 1.84:1, dark slate text on a dark canvas, unreadable.\n *\n * A neutral ramp IS part of a design language, so it belongs in the skin. The\n * anchors are the roles the package already declares, in the positions\n * CLAUDE.md gives them — 1 app background, 2 subtle background, 7 default\n * border, 11 secondary text, 12 primary text — and the steps between are mixed\n * in Oklab, which keeps the ramp perceptually even instead of bunching in the\n * middle the way an sRGB blend does.\n *\n * Deriving rather than hand-listing means a language cannot ship a ramp that\n * disagrees with its own surfaces, and a new language gets one for free.\n */\nfunction neutralRamp(s: BrandSemanticColors, r: BrandColorRoles | undefined): string[] {\n const hsl = (triple: string) => `hsl(${triple})`;\n const anchors: Array<[number, string]> = [\n [1, hsl(r?.canvas ?? s.background)],\n [2, hsl(r?.surface ?? s.card)],\n [7, hsl(r?.border ?? s.border)],\n [11, hsl(r?.mutedForeground ?? s.mutedForeground)],\n [12, hsl(r?.canvasForeground ?? s.foreground)],\n ];\n\n const lines = [``, ` /* ── Neutral ramp, anchored on this language's roles ── */`];\n for (let step = 1; step <= 12; step++) {\n const exact = anchors.find(([n]) => n === step);\n if (exact) {\n lines.push(` --neutral-${step}: ${exact[1]};`);\n continue;\n }\n const lower = [...anchors].reverse().find(([n]) => n < step);\n const upper = anchors.find(([n]) => n > step);\n if (!lower || !upper) continue;\n const t = Math.round(((step - lower[0]) / (upper[0] - lower[0])) * 100);\n lines.push(` --neutral-${step}: color-mix(in oklab, ${upper[1]} ${t}%, ${lower[1]});`);\n }\n return lines;\n}\n\nfunction emitColorVars(s: BrandSemanticColors, r: BrandColorRoles | undefined): string[] {\n const roleLines: string[] = [\n ` /* ── Color roles (carrier) ── */`,\n ` --role-canvas: ${r?.canvas ?? s.background};`,\n ` --role-canvas-fg: ${r?.canvasForeground ?? s.foreground};`,\n ` --role-surface: ${r?.surface ?? s.card};`,\n ` --role-surface-fg: ${r?.surfaceForeground ?? s.cardForeground};`,\n ` --role-action: ${r?.action ?? s.primary};`,\n ` --role-action-fg: ${r?.actionForeground ?? s.primaryForeground};`,\n ` --role-quiet: ${r?.quiet ?? s.secondary};`,\n ` --role-quiet-fg: ${r?.quietForeground ?? s.secondaryForeground};`,\n ` --role-muted: ${r?.muted ?? s.muted};`,\n ` --role-muted-fg: ${r?.mutedForeground ?? s.mutedForeground};`,\n ` --role-border: ${r?.border ?? s.border};`,\n ` --role-input: ${r?.input ?? s.input ?? s.border};`,\n ` --role-ring: ${r?.ring ?? s.ring};`,\n ];\n if (r?.brand) {\n roleLines.push(` --role-brand: ${r.brand};`);\n roleLines.push(\n ` --role-brand-fg: ${r.brandForeground ?? r.actionForeground ?? s.primaryForeground};`,\n );\n roleLines.push(` --brand-mark: ${r.brand};`);\n roleLines.push(\n ` --brand-mark-foreground: ${r.brandForeground ?? r.actionForeground ?? s.primaryForeground};`,\n );\n }\n\n const semantic = [\n ``,\n ` /* ── shadcn bridge (primary = action CTA) ── */`,\n ` --background: ${s.background};`,\n ` --foreground: ${s.foreground};`,\n ` --card: ${s.card};`,\n ` --card-foreground: ${s.cardForeground};`,\n ` --popover: ${s.popover};`,\n ` --popover-foreground: ${s.popoverForeground};`,\n ` --primary: ${s.primary};`,\n ` --primary-foreground: ${s.primaryForeground};`,\n ` --secondary: ${s.secondary};`,\n ` --secondary-foreground: ${s.secondaryForeground};`,\n ` --muted: ${s.muted};`,\n ` --muted-foreground: ${s.mutedForeground};`,\n ` --accent: ${s.accent};`,\n ` --accent-foreground: ${s.accentForeground};`,\n ` --destructive: ${s.destructive};`,\n ` --destructive-foreground: ${s.destructiveForeground};`,\n ` --border: ${s.border};`,\n // Field stroke, not field fill: --input reaches the DOM only through\n // `border-input`. A language that omits it inherits the hairline colour,\n // which is always a visible boundary — writing the surface colour here\n // drew the outline in the same colour as what sits behind it.\n ` --input: ${s.input ?? s.border};`,\n ` --ring: ${s.ring};`,\n ];\n\n if (s.success) semantic.push(` --success: ${s.success};`);\n if (s.successForeground) semantic.push(` --success-foreground: ${s.successForeground};`);\n if (s.warning) semantic.push(` --warning: ${s.warning};`);\n if (s.warningForeground) semantic.push(` --warning-foreground: ${s.warningForeground};`);\n if (s.info) semantic.push(` --info: ${s.info};`);\n if (s.infoForeground) semantic.push(` --info-foreground: ${s.infoForeground};`);\n\n semantic.push(\n ` --sidebar: ${s.card};`,\n ` --sidebar-foreground: ${s.foreground};`,\n ` --sidebar-primary: ${s.primary};`,\n ` --sidebar-primary-foreground: ${s.primaryForeground};`,\n ` --sidebar-accent: ${s.accent};`,\n ` --sidebar-accent-foreground: ${s.accentForeground};`,\n ` --sidebar-border: ${s.border};`,\n ` --sidebar-ring: ${s.ring};`,\n // The identity aliases, taken over by the language.\n //\n // These were the one family a Brand Package did not reach: --brand-primary\n // and --brand-accent are declared in styles.css as Nebutra's own #0033FE and\n // #0BF1C3, and no skin overrode them. Switching to Linear moved three\n // thousand semantic usages and left seventy-five sitting in Nebutra's cyan —\n // a page that reads as half-switched rather than as another language.\n //\n // A language has exactly two vivid hues to offer, and they are `roles.brand`\n // — the identity mark — and `roles.action`, the product fill. Notion is blue\n // on black, Raycast coral behind near-white chrome, Stripe indigo on\n // midnight. --brand-primary takes the mark, --brand-accent the action, and a\n // language declaring no separate mark simply shows one hue in both, which is\n // true of it rather than a gap to paper over.\n //\n // NOT `semantic.accent`: that is the shadcn hover-surface role, and mapping\n // it here produced --brand-accent: 220 14% 96% for Linear and 70 5% 25% for\n // GSAP. The glow elevations would have tinted themselves with a hover grey.\n // Same slot-versus-role confusion as --radius-md and --input, one family out.\n //\n // --brand-tertiary falls back to the accent rather than inventing a third\n // hue: two honest hues beat three where one is made up.\n //\n // Emitted as complete colours, not channel triples. --brand-accent is read\n // inside `color-mix(in srgb, var(--brand-accent) 8%, transparent)` by the\n // glow elevations, and a bare triple there voids the whole declaration —\n // silently, which is the failure this codebase keeps relearning.\n ` --brand-primary: hsl(${r?.brand ?? s.primary});`,\n ` --brand-accent: hsl(${s.primary});`,\n ` --brand-accent-foreground: hsl(${s.primaryForeground});`,\n ` --brand-tertiary: hsl(${s.primary});`,\n ` --brand-gradient: hsl(var(--primary));`,\n ` --brand-gradient-reverse: hsl(var(--primary));`,\n ` --brand-gradient-vertical: hsl(var(--primary));`,\n ` --brand-gradient-radial: hsl(var(--primary));`,\n );\n\n return [...roleLines, ...semantic, ...neutralRamp(s, r)];\n}\n\n/**\n * Emit a single opt-in skin CSS file from a Brand Package.\n */\nexport function emitBrandCss(brand: BrandPackage, options: EmitBrandCssOptions = {}): string {\n const mode = options.mode ?? \"global\";\n const root = options.root ?? \"html\";\n const b = normalizeBrandPackage(brand);\n const t = b.typography;\n const dual = isDualModeBrand(b);\n\n const parts: string[] = [\n `/**`,\n ` * Brand carrier skin: ${b.name} (${b.id}) v${b.version}`,\n ` * darkDefault=${b.darkDefault} dualMode=${dual} button=${b.recipe.buttonDefault}`,\n ` * fonts=${t.faces?.length ?? 0} mode=${mode}`,\n ` * Contract: roles.action → --primary; roles.brand → --brand-mark (never default CTA)`,\n ` */`,\n ``,\n ...emitFontFaces(t.faces),\n ];\n\n // Biome CSS formatter prefers double-quoted font families.\n const fontSans = withCjkTail(cssFontStack(t.fontSans));\n const fontDisplay = withCjkTail(cssFontStack(t.fontDisplay ?? t.fontSans));\n const typeLines = [\n ` --font-sans: ${fontSans};`,\n // The CJK-locale rule in base.css sets body's font-family from --font-cn,\n // which sits above --font-sans in specificity. A skin that left it alone\n // was silently overruled on every Chinese page: picking a design language\n // changed nothing about the type. The tail is already in fontSans, so the\n // two stacks are the same stack.\n ` --font-cn: ${fontSans};`,\n ` --font-heading: ${fontDisplay};`,\n ` --font-display: ${fontDisplay};`,\n ];\n if (t.fontMono) typeLines.push(` --font-mono: ${cssFontStack(t.fontMono)};`);\n if (t.headingWeight != null) {\n typeLines.push(` --font-weight-heading: ${t.headingWeight};`);\n }\n\n const cats = b.extensions?.categories;\n const decorative = b.extensions?.decorative;\n const extLines: string[] = [];\n if (cats) {\n for (const [key, value] of Object.entries(cats)) {\n const safe = key.replace(/[^a-z0-9_-]/gi, \"-\").toLowerCase();\n extLines.push(` --brand-category-${safe}: ${value};`);\n }\n }\n if (decorative) {\n for (const [key, value] of Object.entries(decorative)) {\n const safe = key.replace(/[^a-z0-9_-]/gi, \"-\").toLowerCase();\n extLines.push(` --brand-decorative-${safe}: ${value};`);\n }\n }\n\n const sharedChrome = [\n ``,\n ` /* Recipe (action language + free elev/radii) */`,\n ...recipeVars(b.recipe),\n ``,\n ` /* Typography */`,\n ...typeLines,\n ...motionVars(b.motion),\n ...spacingVars(b.spacing),\n ...(extLines.length\n ? [\"\", \" /* Taxonomy / decorative (not product CTA) */\", ...extLines]\n : []),\n ];\n\n if (dual && b.modes?.light?.semantic && b.modes?.dark?.semantic) {\n // Light block: colors + shared chrome\n parts.push(emitLightModeSelector(b.id, mode, root));\n parts.push(\n ...emitColorVars(b.modes.light.semantic, b.modes.light.roles),\n ...sharedChrome,\n `}`,\n ``,\n );\n // Dark block: colors only (chrome inherits)\n parts.push(emitDarkModeSelector(b.id, mode, root));\n parts.push(...emitColorVars(b.modes.dark.semantic, b.modes.dark.roles), `}`, ``);\n } else {\n // Single-mode: one selector + full block\n const selector =\n mode === \"scoped\"\n ? `${root}[data-brand=\"${b.id}\"] {`\n : emitGlobalSkinSelector(b.id, b.darkDefault, root);\n parts.push(selector);\n parts.push(...emitColorVars(b.semantic, b.roles), ...sharedChrome, `}`, ``);\n }\n\n return parts.join(\"\\n\");\n}\n","/** Convert #rgb / #rrggbb to HSL channel triple \"H S% L%\" for shadcn-style vars. */\nexport function hexToHslChannels(hex: string): string {\n let h = hex.trim().replace(/^#/, \"\");\n if (h.length === 3) {\n h = h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n if (h.length !== 6 || !/^[0-9a-fA-F]+$/.test(h)) {\n throw new Error(`Invalid hex color: ${hex}`);\n }\n const r = Number.parseInt(h.slice(0, 2), 16) / 255;\n const g = Number.parseInt(h.slice(2, 4), 16) / 255;\n const b = Number.parseInt(h.slice(4, 6), 16) / 255;\n return srgbToHslChannels(r, g, b);\n}\n\nfunction srgbToHslChannels(r: number, g: number, b: number): string {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n let s = 0;\n let hue = 0;\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n hue = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n hue = (b - r) / d + 2;\n break;\n default:\n hue = (r - g) / d + 4;\n }\n hue /= 6;\n }\n const H = Math.round(hue * 360);\n const S = Math.round(s * 100);\n const L = Math.round(l * 100);\n return `${H} ${S}% ${L}%`;\n}\n\n/** Already a shadcn-style channel triple? e.g. \"228 85% 56%\" */\nconst HSL_CHANNELS_RE = /^(\\d+(?:\\.\\d+)?)\\s+(\\d+(?:\\.\\d+)?)%\\s+(\\d+(?:\\.\\d+)?)%$/;\n\n/**\n * Normalize any common color input to HSL channel triple \"H S% L%\".\n * Accepts: #hex, \"H S% L%\", hsl()/hsla(), rgb()/rgba().\n */\nexport function colorToHslChannels(color: string): string {\n const t = color.trim();\n if (!t) throw new Error(\"Empty color\");\n\n const channels = t.match(HSL_CHANNELS_RE);\n if (channels) {\n return `${Math.round(Number(channels[1]))} ${Math.round(Number(channels[2]))}% ${Math.round(Number(channels[3]))}%`;\n }\n\n // Parse hsl()/rgb() without open-ended \\s* quantifiers (ReDoS-safe).\n const hslPrefix = t.match(/^hsla?\\(/i);\n if (hslPrefix) {\n const inner = t.slice(hslPrefix[0].length).split(\")\")[0] ?? \"\";\n const nums = inner.match(/[\\d.]+/g) ?? [];\n if (nums.length >= 3) {\n return `${Math.round(Number(nums[0]))} ${Math.round(Number(nums[1]))}% ${Math.round(Number(nums[2]))}%`;\n }\n }\n\n const rgbPrefix = t.match(/^rgba?\\(/i);\n if (rgbPrefix) {\n const inner = t.slice(rgbPrefix[0].length).split(\")\")[0] ?? \"\";\n const nums = inner.match(/[\\d.]+/g) ?? [];\n if (nums.length >= 3) {\n return srgbToHslChannels(Number(nums[0]) / 255, Number(nums[1]) / 255, Number(nums[2]) / 255);\n }\n }\n\n if (t.startsWith(\"#\") || /^[0-9a-fA-F]{3,8}$/.test(t)) {\n return hexToHslChannels(t.startsWith(\"#\") ? t : `#${t}`);\n }\n\n throw new Error(`Unsupported color: ${color}`);\n}\n\n/** Prefer {@link colorToHslChannels}; hex-only name kept for call sites. */\nexport function tryHexToHsl(hex: string | undefined, fallback: string): string {\n return tryColorToHsl(hex, fallback);\n}\n\nexport function tryColorToHsl(color: string | undefined, fallback: string): string {\n if (!color) return fallback;\n try {\n return colorToHslChannels(color);\n } catch {\n return fallback;\n }\n}\n","/**\n * Normalize Brand Packages into the carrier contract.\n * Accepts legacy recipe fields and missing roles; always outputs full roles + free elev/radii.\n */\n\nimport { tryHexToHsl } from \"./hex-to-hsl\";\nimport type {\n BrandColorRoles,\n BrandElevationTokens,\n BrandModePalette,\n BrandModes,\n BrandPackage,\n BrandPackageInput,\n BrandRadii,\n BrandRecipe,\n BrandRecipeInput,\n BrandSemanticColors,\n ElevationStyle,\n} from \"./types\";\n\nconst NONE = \"0 0 #0000\";\n\nconst KEY_SHADOW =\n \"rgba(255, 255, 255, 0.05) 0px 1px 0px 0px inset, rgba(255, 255, 255, 0.25) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px -1px 0px 0px inset\";\n\nconst HAIRLINE_SHADOW = \"rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgb(250, 250, 250) 0px 0px 0px 1px\";\n\n// Inlined, not `var(--shadow-sm, …)`. The theme block maps --shadow-sm to\n// var(--elevation-sm) and the skin sets --elevation-sm from these, so the\n// reference closed a loop onto itself: the fallback rescued it in the browser\n// while validateBrandPackage — correctly — refused the package. A default that\n// only works because its own fallback fires is not a default.\nconst SOFT_CARD = \"0 1px 2px 0 rgb(0 0 0 / 0.05)\";\nconst SOFT_CONTROL = \"0 1px 2px 0 rgb(0 0 0 / 0.04)\";\nconst SOFT_RAISED = \"0 4px 6px -1px rgb(0 0 0 / 0.1)\";\n\n/** Ensure role color is HSL channels (accept hex for convenience). */\nfunction asChannels(value: string | undefined): string | undefined {\n if (value == null || value === \"\") return undefined;\n const v = value.trim();\n if (v.startsWith(\"#\")) return tryHexToHsl(v, \"0 0% 50%\");\n return v;\n}\n\n/** Expand elevation preset → free CSS tokens. */\nexport function elevationPresetToTokens(\n preset: ElevationStyle | undefined,\n cardShadow?: string,\n): BrandElevationTokens {\n switch (preset) {\n case \"none\":\n return { card: NONE, control: NONE, raised: NONE };\n case \"key\":\n return {\n card: cardShadow ?? KEY_SHADOW,\n control: NONE,\n raised: cardShadow ?? KEY_SHADOW,\n };\n case \"hairline\":\n return {\n card: cardShadow ?? HAIRLINE_SHADOW,\n control: NONE,\n raised: cardShadow ?? HAIRLINE_SHADOW,\n };\n case \"raised\":\n return { card: SOFT_RAISED, control: SOFT_CONTROL, raised: SOFT_RAISED };\n default:\n return { card: SOFT_CARD, control: SOFT_CONTROL, raised: SOFT_RAISED };\n }\n}\n\nexport function rolesFromSemantic(\n s: BrandSemanticColors,\n brandMark?: { brand?: string; brandForeground?: string },\n): BrandColorRoles {\n const roles: BrandColorRoles = {\n canvas: s.background,\n canvasForeground: s.foreground,\n surface: s.card,\n surfaceForeground: s.cardForeground,\n action: s.primary,\n actionForeground: s.primaryForeground,\n quiet: s.secondary,\n quietForeground: s.secondaryForeground,\n muted: s.muted,\n mutedForeground: s.mutedForeground,\n border: s.border,\n ring: s.ring,\n destructive: s.destructive,\n destructiveForeground: s.destructiveForeground,\n };\n // Optional under exactOptionalPropertyTypes: an absent field stroke must stay\n // absent so the emitter derives it from border, not become an explicit\n // undefined the emitter's ?? would then have to defend against twice.\n if (s.input) roles.input = s.input;\n const brand = asChannels(brandMark?.brand);\n if (brand) roles.brand = brand;\n const brandFg = asChannels(brandMark?.brandForeground);\n if (brandFg) roles.brandForeground = brandFg;\n if (s.success) roles.success = s.success;\n if (s.successForeground) roles.successForeground = s.successForeground;\n if (s.warning) roles.warning = s.warning;\n if (s.warningForeground) roles.warningForeground = s.warningForeground;\n if (s.info) roles.info = s.info;\n if (s.infoForeground) roles.infoForeground = s.infoForeground;\n return roles;\n}\n\n/** roles → shadcn semantic: primary ALWAYS tracks action (CTA), never brand mark. */\nexport function semanticFromRoles(r: BrandColorRoles): BrandSemanticColors {\n const accent = r.brand ?? r.quiet;\n const accentFg = r.brandForeground ?? r.quietForeground;\n const semantic: BrandSemanticColors = {\n background: r.canvas,\n foreground: r.canvasForeground,\n card: r.surface,\n cardForeground: r.surfaceForeground,\n popover: r.surface,\n popoverForeground: r.surfaceForeground,\n primary: r.action,\n primaryForeground: r.actionForeground,\n secondary: r.quiet,\n secondaryForeground: r.quietForeground,\n muted: r.muted,\n mutedForeground: r.mutedForeground,\n accent,\n accentForeground: accentFg,\n destructive: r.destructive,\n destructiveForeground: r.destructiveForeground,\n border: r.border,\n ring: r.ring,\n };\n if (r.input) semantic.input = r.input;\n if (r.success) semantic.success = r.success;\n if (r.successForeground) semantic.successForeground = r.successForeground;\n if (r.warning) semantic.warning = r.warning;\n if (r.warningForeground) semantic.warningForeground = r.warningForeground;\n if (r.info) semantic.info = r.info;\n if (r.infoForeground) semantic.infoForeground = r.infoForeground;\n return semantic;\n}\n\nfunction normalizeRadii(recipe: BrandRecipeInput): BrandRadii {\n const button = recipe.radii?.button ?? recipe.buttonRadius ?? \"0.375rem\";\n const card = recipe.radii?.card ?? recipe.cardRadius ?? \"0.75rem\";\n const radii: BrandRadii = {\n button,\n card,\n badge: recipe.radii?.badge ?? recipe.badgeRadius ?? \"9999px\",\n input: recipe.radii?.input ?? recipe.inputRadius ?? button,\n pill: recipe.radii?.pill ?? \"9999px\",\n };\n return radii;\n}\n\nfunction normalizeElevation(recipe: BrandRecipeInput): BrandElevationTokens {\n if (recipe.elevationTokens?.card) {\n const elev: BrandElevationTokens = { card: recipe.elevationTokens.card };\n elev.control = recipe.elevationTokens.control ?? NONE;\n elev.raised = recipe.elevationTokens.raised ?? recipe.elevationTokens.card;\n return elev;\n }\n return elevationPresetToTokens(recipe.elevation, recipe.cardShadow);\n}\n\nfunction normalizeBadgeDefault(\n badge: BrandRecipeInput[\"badgeDefault\"],\n): NonNullable<BrandRecipe[\"badgeDefault\"]> {\n if (!badge || badge === \"match-primary\") return \"match-action\";\n return badge;\n}\n\nfunction categoryBrandMark(brand: BrandPackage | BrandPackageInput): string | undefined {\n return typeof brand.extensions?.categories?.brand === \"string\"\n ? brand.extensions.categories.brand\n : undefined;\n}\n\n/** Canonicalize one mode palette → full roles + semantic. */\nexport function normalizeModePalette(\n palette: BrandModePalette,\n categoryBrand?: string,\n): { roles: BrandColorRoles; semantic: BrandSemanticColors } {\n let baseRoles: BrandColorRoles;\n if (palette.roles) {\n baseRoles = { ...palette.roles };\n } else if (palette.semantic) {\n const mark: { brand?: string; brandForeground?: string } = {\n brandForeground: palette.semantic.primaryForeground,\n };\n if (categoryBrand) mark.brand = categoryBrand;\n baseRoles = rolesFromSemantic(palette.semantic, mark);\n } else {\n throw new Error(\"BrandModePalette requires roles or semantic\");\n }\n\n const roles: BrandColorRoles = {\n canvas: baseRoles.canvas,\n canvasForeground: baseRoles.canvasForeground,\n surface: baseRoles.surface,\n surfaceForeground: baseRoles.surfaceForeground,\n action: baseRoles.action,\n actionForeground: baseRoles.actionForeground,\n quiet: baseRoles.quiet,\n quietForeground: baseRoles.quietForeground,\n muted: baseRoles.muted,\n mutedForeground: baseRoles.mutedForeground,\n border: baseRoles.border,\n ring: baseRoles.ring,\n destructive: baseRoles.destructive,\n destructiveForeground: baseRoles.destructiveForeground,\n };\n if (baseRoles.input) roles.input = baseRoles.input;\n const brandCh = asChannels(baseRoles.brand);\n if (brandCh) roles.brand = brandCh;\n const brandFg = asChannels(baseRoles.brandForeground) ?? baseRoles.actionForeground;\n if (brandCh) roles.brandForeground = brandFg;\n if (baseRoles.success) roles.success = baseRoles.success;\n if (baseRoles.successForeground) roles.successForeground = baseRoles.successForeground;\n if (baseRoles.warning) roles.warning = baseRoles.warning;\n if (baseRoles.warningForeground) roles.warningForeground = baseRoles.warningForeground;\n if (baseRoles.info) roles.info = baseRoles.info;\n if (baseRoles.infoForeground) roles.infoForeground = baseRoles.infoForeground;\n\n return { roles, semantic: semanticFromRoles(roles) };\n}\n\nfunction normalizeModes(\n brand: BrandPackage | BrandPackageInput,\n categoryBrand?: string,\n): BrandModes | undefined {\n const raw = brand.modes;\n if (!raw?.light && !raw?.dark) return undefined;\n\n const modes: BrandModes = {};\n if (raw.light) {\n const n = normalizeModePalette(raw.light, categoryBrand);\n modes.light = { roles: n.roles, semantic: n.semantic };\n }\n if (raw.dark) {\n const n = normalizeModePalette(raw.dark, categoryBrand);\n modes.dark = { roles: n.roles, semantic: n.semantic };\n }\n // Dual-mode complete: both present\n if (modes.light && modes.dark) return modes;\n // Partial modes still useful (e.g. only dark override)\n return modes;\n}\n\n/** Ensure package has roles + free radii/elev; strip legacy recipe aliases from output. */\nexport function normalizeBrandPackage(brand: BrandPackage | BrandPackageInput): BrandPackage {\n const categoryBrand = categoryBrandMark(brand);\n const modes = normalizeModes(brand, categoryBrand);\n\n // Default mode palette: dual-mode prefers modes[darkDefault], else top-level semantic/roles\n const defaultModeKey = brand.darkDefault ? \"dark\" : \"light\";\n const defaultMode = modes?.[defaultModeKey] ?? modes?.light ?? modes?.dark;\n\n let primaryPalette: BrandModePalette;\n if (defaultMode?.roles || defaultMode?.semantic) {\n primaryPalette = {};\n if (defaultMode.roles) primaryPalette.roles = defaultMode.roles;\n if (defaultMode.semantic) primaryPalette.semantic = defaultMode.semantic;\n } else {\n primaryPalette = { semantic: brand.semantic };\n if (brand.roles) primaryPalette.roles = brand.roles;\n }\n\n const { roles, semantic } = normalizeModePalette(primaryPalette, categoryBrand);\n\n const looseRecipe = brand.recipe as BrandRecipeInput;\n const radii = normalizeRadii(looseRecipe);\n const elevationTokens = normalizeElevation(looseRecipe);\n\n const recipe: BrandRecipe = {\n buttonDefault: looseRecipe.buttonDefault,\n density: looseRecipe.density ?? \"comfortable\",\n badgeDefault: normalizeBadgeDefault(looseRecipe.badgeDefault),\n radii,\n elevationTokens,\n };\n if (looseRecipe.primaryStrokeGradient) {\n recipe.primaryStrokeGradient = looseRecipe.primaryStrokeGradient;\n }\n if (looseRecipe.outlineBorder) {\n recipe.outlineBorder = looseRecipe.outlineBorder;\n }\n\n const out: BrandPackage = {\n ...brand,\n roles,\n semantic,\n recipe,\n };\n if (modes) out.modes = modes;\n else delete (out as { modes?: BrandModes }).modes;\n return out;\n}\n\n/** True when package has full dual light+dark palettes. */\nexport function isDualModeBrand(brand: BrandPackage): boolean {\n return Boolean(brand.modes?.light?.semantic && brand.modes?.dark?.semantic);\n}\n","import { emitBrandCss } from \"./emit-css\";\nimport type { BrandPackage } from \"./types\";\n\nexport const BRAND_STYLE_ELEMENT_ID = \"nebutra-brand-skin\";\nexport const BRAND_STORAGE_KEY = \"nebutra-brand-package\";\n\nexport interface ApplyBrandOptions {\n /** Persist package JSON to localStorage for Create Center preview reload */\n persist?: boolean;\n /** Target document (iframe preview support) */\n doc?: Document;\n}\n\nfunction targetDoc(doc?: Document): Document | null {\n if (doc) return doc;\n if (typeof document === \"undefined\") return null;\n return document;\n}\n\n/**\n * Inject brand skin CSS at runtime (Create Center preview / tenant switch).\n * Does not require rebuilding app CSS — overrides semantic + recipe vars.\n */\nexport function applyBrandCss(\n css: string,\n brandId?: string,\n options: ApplyBrandOptions = {},\n): void {\n const d = targetDoc(options.doc);\n if (!d) return;\n\n let el = d.getElementById(BRAND_STYLE_ELEMENT_ID) as HTMLStyleElement | null;\n if (!el) {\n el = d.createElement(\"style\");\n el.id = BRAND_STYLE_ELEMENT_ID;\n el.setAttribute(\"data-nebutra-brand\", brandId ?? \"custom\");\n d.head.appendChild(el);\n }\n el.textContent = css;\n if (brandId) {\n d.documentElement.dataset.brand = brandId;\n }\n}\n\n/** Apply a full Brand Package (emit CSS + optional persist). */\nexport function applyBrandPackage(brand: BrandPackage, options: ApplyBrandOptions = {}): void {\n const css = emitBrandCss(brand);\n applyBrandCss(css, brand.id, options);\n\n if (options.persist && typeof localStorage !== \"undefined\") {\n try {\n localStorage.setItem(BRAND_STORAGE_KEY, JSON.stringify(brand));\n } catch {\n // quota / private mode — ignore\n }\n }\n}\n\n/** Remove runtime brand skin and restore default Nebutra tokens. */\nexport function clearBrand(options: ApplyBrandOptions = {}): void {\n const d = targetDoc(options.doc);\n if (!d) return;\n d.getElementById(BRAND_STYLE_ELEMENT_ID)?.remove();\n delete d.documentElement.dataset.brand;\n if (options.persist && typeof localStorage !== \"undefined\") {\n try {\n localStorage.removeItem(BRAND_STORAGE_KEY);\n } catch {\n // ignore\n }\n }\n}\n\n/** Restore brand package previously persisted by applyBrandPackage({ persist: true }). */\nexport function restorePersistedBrand(options: ApplyBrandOptions = {}): BrandPackage | null {\n if (typeof localStorage === \"undefined\") return null;\n try {\n const raw = localStorage.getItem(BRAND_STORAGE_KEY);\n if (!raw) return null;\n const brand = JSON.parse(raw) as BrandPackage;\n if (!brand?.id || !brand?.semantic || !brand?.recipe) return null;\n applyBrandPackage(brand, { ...options, persist: false });\n return brand;\n } catch {\n return null;\n }\n}\n\nexport function getActiveBrandId(doc?: Document): string | null {\n const d = targetDoc(doc);\n return d?.documentElement.dataset.brand ?? null;\n}\n","/**\n * Shared helpers for Refero → Brand Package compilation.\n * Preset builders live in compile-refero.ts; keep color/font extraction here.\n */\n\nexport type Json = Record<string, unknown>;\n\nexport type PresetId =\n | \"linear\"\n | \"gsap\"\n | \"raycast\"\n | \"vercel\"\n | \"vanta\"\n | \"stripe\"\n | \"notion\"\n | \"generic\";\n\nexport function leafHex(tree: Json | undefined, path: string[]): string | undefined {\n let cur: unknown = tree;\n for (const p of path) {\n if (!cur || typeof cur !== \"object\") return undefined;\n cur = (cur as Json)[p];\n }\n if (!cur || typeof cur !== \"object\") return undefined;\n const v = (cur as Json).$value ?? (cur as Json).value;\n return typeof v === \"string\" ? v : undefined;\n}\n\nexport function detectPreset(idHint: string, colors: Record<string, string>): PresetId {\n const id = idHint.toLowerCase();\n if (id.includes(\"linear\")) return \"linear\";\n if (id.includes(\"gsap\")) return \"gsap\";\n if (id.includes(\"raycast\")) return \"raycast\";\n if (id.includes(\"vercel\")) return \"vercel\";\n if (id.includes(\"vanta\")) return \"vanta\";\n if (id.includes(\"stripe\")) return \"stripe\";\n if (id.includes(\"notion\")) return \"notion\";\n // Heuristics from Refero extractions\n if (colors[\"paper-white\"] && colors.obsidian && colors.hairline) return \"vercel\";\n if (colors[\"coral-pulse\"] || (colors[\"void-black\"] && colors.mist && colors.ink)) {\n return \"raycast\";\n }\n if (colors[\"acid-lime\"] || colors.void) return \"linear\";\n if (colors[\"shockingly-green\"] || colors[\"surface-cream\"] || colors[\"just-black\"]) return \"gsap\";\n if (colors[\"just-black\"] && colors[\"surface-cream\"]) return \"gsap\";\n // Notion: warm paper canvas + single blue CTA + ink hierarchy\n if (\n (colors[\"notion-blue\"] || colors[\"paper-warmth\"]) &&\n (colors[\"paper-warmth\"] || colors[\"ink-black\"]) &&\n (colors[\"sky-tint\"] || colors.marigold || colors.coral)\n ) {\n return \"notion\";\n }\n // Stripe: indigo-ink action + pure-white canvas + frost borders + midnight text\n if (\n colors[\"indigo-ink\"] &&\n colors[\"pure-white\"] &&\n (colors.frost || colors[\"lavender-border\"] || colors[\"midnight-ink\"]) &&\n !colors[\"paper-warmth\"]\n ) {\n return \"stripe\";\n }\n // Vanta: indigo-ink as logo + vivid-violet CTA + parchment (not pure-white ledger)\n if (\n (colors[\"indigo-ink\"] || colors[\"vivid-violet\"]) &&\n (colors.parchment || colors[\"lavender-wash\"] || colors.paper) &&\n !colors[\"pure-white\"]\n ) {\n return \"vanta\";\n }\n return \"generic\";\n}\n\n/** First font family leaf that is UI/sans (not display/serif display faces). */\nexport function pickUiFontFamily(font: Json): string | undefined {\n const preferUi = /(inter|geist|manrope|dm sans|sans|ui)/i;\n const avoidDisplay = /(reckless|serif|display|editorial|playfair|lora|source serif)/i;\n const entries = Object.entries(font);\n for (const [k, v] of entries) {\n if (!v || typeof v !== \"object\") continue;\n const name = String((v as Json).$value ?? (v as Json).value ?? \"\");\n if (!name || avoidDisplay.test(k) || avoidDisplay.test(name)) continue;\n if (preferUi.test(k) || preferUi.test(name) || entries.length === 1) return name;\n }\n for (const [k, v] of entries) {\n if (!v || typeof v !== \"object\") continue;\n const name = String((v as Json).$value ?? (v as Json).value ?? \"\");\n if (name && !avoidDisplay.test(k) && !avoidDisplay.test(name)) return name;\n }\n return undefined;\n}\n\nexport function pickDisplayFontFamily(font: Json): string | undefined {\n const prefer = /(reckless|serif|display|editorial|playfair|lora|source serif|mori)/i;\n for (const [k, v] of Object.entries(font)) {\n if (!v || typeof v !== \"object\") continue;\n const name = String((v as Json).$value ?? (v as Json).value ?? \"\");\n if (name && (prefer.test(k) || prefer.test(name))) return name;\n }\n return undefined;\n}\n\n/**\n * shadcn / Appearance / playground token names → keys generic + presets already pick.\n * Kebab and camel both land on the same slot so compileReferoTokens works for imports.\n */\nconst COLOR_KEY_ALIASES: Record<string, string[]> = {\n background: [\"background\", \"canvas\", \"page-canvas\"],\n foreground: [\"foreground\", \"ink\", \"ink-black\"],\n card: [\"card\", \"card-surface\", \"surface\"],\n \"card-foreground\": [\"card-foreground\"],\n cardForeground: [\"card-foreground\"],\n primary: [\"primary\", \"action\"],\n \"primary-foreground\": [\"primary-foreground\"],\n primaryForeground: [\"primary-foreground\"],\n secondary: [\"secondary\", \"quiet\"],\n \"secondary-foreground\": [\"secondary-foreground\"],\n secondaryForeground: [\"secondary-foreground\"],\n muted: [\"muted\"],\n \"muted-foreground\": [\"muted-foreground\", \"mutedForeground\", \"stone\"],\n mutedForeground: [\"muted-foreground\", \"stone\"],\n accent: [\"accent\"],\n \"accent-foreground\": [\"accent-foreground\"],\n accentForeground: [\"accent-foreground\"],\n border: [\"border\", \"hairline\"],\n input: [\"input\"],\n ring: [\"ring\"],\n destructive: [\"destructive\"],\n \"destructive-foreground\": [\"destructive-foreground\"],\n destructiveForeground: [\"destructive-foreground\"],\n success: [\"success\"],\n popover: [\"popover\"],\n \"popover-foreground\": [\"popover-foreground\"],\n popoverForeground: [\"popover-foreground\"],\n};\n\nfunction isUsableColorValue(val: string): boolean {\n const t = val.trim();\n if (!t) return false;\n if (t.startsWith(\"#\")) return true;\n if (/^\\d+(\\.\\d+)?\\s+\\d+(\\.\\d+)?%\\s+\\d+(\\.\\d+)?%$/.test(t)) return true;\n if (/^hsla?\\(/i.test(t) || /^rgba?\\(/i.test(t)) return true;\n // oklch/lab left out of compile path (no reliable SSR convert); Appearance still has canvas probe\n return false;\n}\n\nexport function collectColors(colorRoot: Json | undefined): Record<string, string> {\n const raw: Record<string, string> = {};\n if (!colorRoot || typeof colorRoot !== \"object\") return raw;\n for (const [k, v] of Object.entries(colorRoot)) {\n if (!v || typeof v !== \"object\") continue;\n const val = (v as Json).$value ?? (v as Json).value;\n if (typeof val === \"string\" && isUsableColorValue(val)) raw[k] = val.trim();\n }\n\n // Expand aliases so shadcn-named imports hit preset pick() keys\n const out: Record<string, string> = { ...raw };\n for (const [key, value] of Object.entries(raw)) {\n const aliases = COLOR_KEY_ALIASES[key];\n if (!aliases) continue;\n for (const alias of aliases) {\n if (!out[alias]) out[alias] = value;\n }\n }\n return out;\n}\n\nexport function collectSurfaces(surfaceRoot: Json | undefined): Record<string, string> {\n return collectColors(surfaceRoot as Json | undefined);\n}\n","import type { ButtonDefaultStyle, Density, ElevationStyle } from \"./types\";\n\nexport interface InferredRecipeHints {\n buttonDefault?: ButtonDefaultStyle;\n elevationPreset?: ElevationStyle;\n density?: Density;\n /** Free radii slots from DESIGN.md tables / free-text */\n radii?: { button?: string; card?: string };\n notes: string[];\n}\n\n/**\n * Infer control recipe from DESIGN.md / agent prompt text.\n * Used for generic brands and to refine known fixtures.\n */\nexport function inferRecipeFromDesignMd(designMd: string): InferredRecipeHints {\n const t = designMd.toLowerCase();\n const notes: string[] = [];\n const hints: InferredRecipeHints = { notes };\n\n const outlineFirst =\n t.includes(\"outlined-only\") ||\n t.includes(\"outline-only\") ||\n t.includes(\"ghost pill\") ||\n t.includes(\"ghost-pill\") ||\n t.includes(\"no filled\") ||\n t.includes(\"don't add filled\") ||\n t.includes(\"do not add filled\") ||\n t.includes(\"never fill\") ||\n (t.includes(\"outlined\") && t.includes(\"button\") && !t.includes(\"filled cta\"));\n\n // Require explicit stroke CTA language — do NOT match hero artwork \"gradient\"\n const gradientStroke =\n t.includes(\"gradient-stroked\") ||\n t.includes(\"gradient stroke\") ||\n t.includes(\"gradient-stroked cta\") ||\n t.includes(\"border-image\") ||\n (t.includes(\"gradient border\") && (t.includes(\"cta\") || t.includes(\"button\")));\n\n // Raycast-style neutral CTA — do NOT match mere color-token name \"mist\" + \"filled button\"\n const neutralFilled =\n t.includes(\"no chromatic\") ||\n t.includes(\"deliberately neutral\") ||\n t.includes(\"neutral rather than chromatic\") ||\n t.includes(\"no chromatic action\") ||\n t.includes(\"don't use chromatic action\") ||\n t.includes(\"do not use chromatic action\") ||\n (t.includes(\"mist\") && t.includes(\"filled\") && (t.includes(\"iron\") || t.includes(\"neutral\")));\n\n const solidCta =\n neutralFilled ||\n (t.includes(\"filled\") &&\n (t.includes(\"primary\") ||\n t.includes(\"cta\") ||\n t.includes(\"download\") ||\n t.includes(\"action button\") ||\n t.includes(\"primary action\") ||\n t.includes(\"filled button\")));\n\n if (gradientStroke) {\n hints.buttonDefault = \"gradient-stroke\";\n notes.push(\"DESIGN.md: gradient-stroke CTA\");\n } else if (outlineFirst && !solidCta) {\n hints.buttonDefault = \"outline\";\n notes.push(\"DESIGN.md: outline-first controls\");\n } else if (solidCta) {\n hints.buttonDefault = \"solid\";\n if (neutralFilled) notes.push(\"DESIGN.md: neutral filled CTA (not chromatic)\");\n }\n\n // Explicit ban on all elevation shadows (Stripe/Vanta ledger systems)\n const forbidsAnyShadow =\n t.includes(\"avoids shadows\") ||\n t.includes(\"avoid shadows\") ||\n t.includes(\"avoids shadows entirely\") ||\n t.includes(\"no card has a box-shadow\") ||\n t.includes(\"no button has a shadow\") ||\n t.includes(\"never from box-shadow\") ||\n t.includes(\"never from elevation\") ||\n t.includes(\"depth comes from background tint\") ||\n t.includes(\"depth comes from background\") ||\n t.includes(\"no shadows, blurs\") ||\n t.includes(\"do not use shadows\") ||\n t.includes(\"don't use shadows\") ||\n t.includes(\"rejects drop shadows\") ||\n t.includes(\"reject drop shadows\") ||\n t.includes(\"don't drop shadows\") ||\n t.includes(\"do not drop shadows\") ||\n t.includes(\"don't apply drop shadows\") ||\n t.includes(\"do not apply drop shadows\") ||\n t.includes(\"don't add drop-shadows\") ||\n t.includes(\"do not add drop-shadows\") ||\n t.includes(\"never use drop-shadows\") ||\n t.includes(\"no drop shadow\") ||\n t.includes(\"no box-shadow\") ||\n t.includes(\"never via box-shadow\") ||\n t.includes(\"border is the elevation\") ||\n t.includes(\"no shadow — the border\") ||\n t.includes(\"no shadow - the border\") ||\n t.includes(\"depth is communicated only\") ||\n (t.includes(\"no shadow\") && t.includes(\"border\")) ||\n (t.includes(\"flat\") && t.includes(\"1px\") && t.includes(\"border\"));\n\n const keyElev =\n t.includes(\"keyboard key\") ||\n t.includes(\"key shadow\") ||\n t.includes(\"key cap\") ||\n (t.includes(\"inset top\") && t.includes(\"highlight\") && t.includes(\"shadow\"));\n\n // Vercel-style: affirmative *use* of stacked box-shadow rings (not \"never box-shadow\")\n const hairlineRingElev =\n !forbidsAnyShadow &&\n (t.includes(\"stacked box-shadow\") ||\n t.includes(\"double-ring\") ||\n t.includes(\"build depth with hairline\") ||\n (t.includes(\"hairline\") &&\n t.includes(\"box-shadow\") &&\n (t.includes(\"never with drop-shadow\") ||\n t.includes(\"never use drop-shadow\") ||\n t.includes(\"not with drop-shadow\"))));\n\n if (keyElev) {\n hints.elevationPreset = \"key\";\n notes.push(\"DESIGN.md: key/inset elevation\");\n } else if (forbidsAnyShadow) {\n hints.elevationPreset = \"none\";\n notes.push(\"DESIGN.md: elevation=none (no box-shadow / tint+border depth)\");\n } else if (hairlineRingElev) {\n hints.elevationPreset = \"hairline\";\n notes.push(\"DESIGN.md: hairline ring elevation\");\n }\n\n // Density: explicit catalog line beats incidental \"compact pill padding\"\n if (\n /\\*\\*density:\\*\\*\\s*comfortable|density:\\s*comfortable|\\bdensity\\b[^\\n]{0,20}comfortable/i.test(\n designMd,\n )\n ) {\n hints.density = \"comfortable\";\n } else if (/\\*\\*density:\\*\\*\\s*spacious|density:\\s*spacious/i.test(designMd)) {\n hints.density = \"spacious\";\n } else if (/\\*\\*density:\\*\\*\\s*compact|density:\\s*compact/i.test(designMd)) {\n hints.density = \"compact\";\n } else if (\n (t.includes(\"compact density\") || t.includes(\"8–12px\") || t.includes(\"8-12px\")) &&\n !t.includes(\"comfortable\")\n ) {\n hints.density = \"compact\";\n } else if (t.includes(\"comfortable\") || t.includes(\"spacious\")) {\n hints.density = t.includes(\"spacious\") ? \"spacious\" : \"comfortable\";\n }\n\n // Radius: **token table rows win** over free-text / agent-prompt noise.\n // e.g. Notion \"| buttons | 8px |\" must beat incidental \"border-radius 4px\" on a tertiary control.\n const tableButton = designMd.match(/\\|\\s*buttons\\s*\\|\\s*(\\d+px|9999?px)\\s*\\|/i);\n const tableCards = designMd.match(/\\|\\s*cards\\s*\\|\\s*(\\d+px|9999?px)\\s*\\|/i);\n const tableButtonRadius = tableButton?.[1];\n const tableCardsRadius = tableCards?.[1];\n const radii: { button?: string; card?: string } = {};\n if (tableButtonRadius) {\n radii.button = tableButtonRadius;\n notes.push(`DESIGN.md: table buttons radius ${tableButtonRadius}`);\n } else if (\n t.includes(\"4px border-radius on all buttons\") ||\n t.includes(\"use 4px border-radius on all\") ||\n (t.includes(\"never pill\") && t.includes(\"4px\") && t.includes(\"button\"))\n ) {\n radii.button = \"4px\";\n notes.push(\"DESIGN.md: 4px control radius (not pill)\");\n } else if (\n ((t.includes(\"999px\") || t.includes(\"9999px\")) &&\n (t.includes(\"button\") || t.includes(\"pill-shaped\")) &&\n !t.includes(\"never pill\") &&\n !t.includes(\"not pill\") &&\n !t.includes(\"pills only\")) ||\n (t.includes(\"pill-shaped\") && t.includes(\"button\"))\n ) {\n radii.button = t.includes(\"9999px\") ? \"9999px\" : \"999px\";\n notes.push(\"DESIGN.md: full pill control radius\");\n } else if (/\\bbuttons?\\b[^\\n.|]{0,48}\\b8px\\b/.test(t) || t.includes(\"8px for buttons\")) {\n radii.button = \"8px\";\n } else if (/\\bbuttons?\\b[^\\n.|]{0,48}\\b6px\\b/.test(t) || t.includes(\"button radius to 6px\")) {\n radii.button = \"6px\";\n } else if (t.includes(\"100px\") && (t.includes(\"button\") || t.includes(\"pill button\"))) {\n radii.button = \"100px\";\n }\n\n if (tableCardsRadius) {\n radii.card = tableCardsRadius;\n notes.push(`DESIGN.md: table cards radius ${tableCardsRadius}`);\n }\n\n if (radii.button != null || radii.card != null) {\n hints.radii = radii;\n }\n\n return hints;\n}\n","/**\n * Canonical recipe builder for compile presets.\n * Output: free radii + free elevationTokens only.\n */\n\nimport { elevationPresetToTokens } from \"../normalize\";\nimport type {\n BadgeDefaultStyle,\n BrandElevationTokens,\n BrandRadii,\n BrandRecipe,\n ButtonDefaultStyle,\n Density,\n ElevationStyle,\n} from \"../types\";\n\nexport interface RecipeInput {\n buttonDefault: ButtonDefaultStyle;\n density?: Density;\n /** Free radii slots (preferred API) */\n radii?: Partial<BrandRadii>;\n /**\n * Elevation preset expanded to elevationTokens when elevationTokens omitted.\n * Prefer passing elevationTokens for free CSS stacks.\n */\n elevationPreset?: ElevationStyle;\n elevationTokens?: BrandElevationTokens;\n badgeDefault?: BadgeDefaultStyle;\n primaryStrokeGradient?: string;\n outlineBorder?: string;\n /** Used when expanding elevationPreset key/hairline */\n cardShadow?: string;\n}\n\n/** Build a canonical BrandRecipe (radii + elevationTokens only). */\nexport function buildRecipe(input: RecipeInput): BrandRecipe {\n const button = input.radii?.button ?? \"0.375rem\";\n const card = input.radii?.card ?? \"0.75rem\";\n const badge = input.radii?.badge ?? \"9999px\";\n const radii: BrandRadii = {\n button,\n card,\n badge,\n input: input.radii?.input ?? button,\n pill: input.radii?.pill ?? \"9999px\",\n };\n const elevationPreset = input.elevationPreset ?? \"soft\";\n const elevationTokens =\n input.elevationTokens ?? elevationPresetToTokens(elevationPreset, input.cardShadow);\n\n const recipe: BrandRecipe = {\n buttonDefault: input.buttonDefault,\n density: input.density ?? \"comfortable\",\n radii,\n elevationTokens,\n };\n if (input.badgeDefault) recipe.badgeDefault = input.badgeDefault;\n if (input.primaryStrokeGradient) recipe.primaryStrokeGradient = input.primaryStrokeGradient;\n if (input.outlineBorder) recipe.outlineBorder = input.outlineBorder;\n return recipe;\n}\n","/**\n * Generic heuristic compile path for unknown brands.\n */\nimport { leafHex, pickDisplayFontFamily, pickUiFontFamily } from \"../compile-helpers\";\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildGeneric(ctx: CompileContext): BrandPackage {\n ctx.warnings.push(\n \"Unknown brand layout — compiled with heuristic recipe. Review mapping in Create Center.\",\n );\n ctx.warnings.push(...ctx.recipeHints.notes);\n const entries = Object.entries(ctx.colors);\n const pick = (...keys: string[]) => {\n for (const k of keys) {\n if (ctx.colors[k]) return ctx.colors[k];\n }\n return undefined;\n };\n // Page canvas first (warm paper / parchment), then pure white, then dark voids.\n // Notion: paper-warmth is canvas; pure-white is card — never invert.\n const bg =\n pick(\n \"paper-warmth\",\n \"paper-white\",\n \"page-canvas\",\n \"parchment\",\n \"pure-white\",\n \"paper\",\n \"background\",\n \"canvas\",\n \"void-black\",\n \"void\",\n \"just-black\",\n \"off-black\",\n ) ?? \"#0a0a0a\";\n\n // Detect light canvas early so fg/primary picks don't invert\n const isLightCanvas = (() => {\n try {\n const m = tryHexToHsl(bg, \"0 0% 4%\").match(/(\\d+)%\\s*$/);\n return m ? Number(m[1]) >= 50 : false;\n } catch {\n return false;\n }\n })();\n\n // Light: ink/carbon text — never pure-white; prefer ink-black over decorative midnight.\n const fg = isLightCanvas\n ? (pick(\n \"ink-black\",\n \"carbon\",\n \"charcoal\",\n \"obsidian\",\n \"foreground\",\n \"ink\",\n \"midnight-ink\",\n \"deep-violet\",\n \"slate\",\n ) ?? \"#181822\")\n : (pick(\"pure-white\", \"paper\", \"surface-cream\", \"bone\", \"mist\", \"foreground\", \"white\") ??\n \"#ffffff\");\n\n // Chromatic *action* tokens only — never canvas/surface/decorative wash names\n const primary =\n pick(\n \"notion-blue\",\n \"indigo-ink\",\n \"vivid-violet\",\n \"primary\",\n \"acid-lime\",\n \"obsidian\",\n \"shockingly-green\",\n \"brand\",\n \"accent\",\n \"mid-violet\",\n \"amethyst-edge\",\n \"signal-blue\",\n ) ??\n entries.find(\n ([k]) =>\n !/void|black|canvas|graphite|paper|hairline|ash|parchment|fog|lavender|steel|slate|carbon|mist|frost|smoke|white|midnight|warmth|tint|wash|marigold|coral|saffron|mocha|vermillion|sky/i.test(\n k,\n ),\n )?.[1] ??\n (isLightCanvas ? \"#171717\" : \"#3b82f6\");\n\n // Brand-mark ≠ action: logo inks — not decorative midnight/coral washes by default\n const brandMarkHex =\n pick(\"ink-black\", \"coral-pulse\", \"brand-mark\", \"logo\", \"wordmark\", \"charcoal\", \"deep-violet\") ??\n undefined;\n\n const border = isLightCanvas\n ? (pick(\"frost\", \"hairline\", \"border\", \"ash\", \"carbon\", \"lilac-border\", \"slate\") ?? \"#e5e5e5\")\n : (pick(\"hairline\", \"border\", \"slate\", \"graphite\", \"surface-25\", \"smoke\") ?? \"#333333\");\n const mutedFg =\n pick(\n \"stone\",\n \"charcoal\",\n \"graphite\",\n \"steel\",\n \"slate\",\n \"muted\",\n \"smoke\",\n \"ash\",\n \"fog\",\n \"surface-50\",\n ) ?? \"#888888\";\n const card = isLightCanvas\n ? (pick(\"pure-white\", \"paper\", \"card-surface\", \"card\") ?? \"#ffffff\")\n : (pick(\"ink\", \"carbon\", \"off-black\", \"obsidian\", \"card\") ?? bg);\n\n const quiet = isLightCanvas\n ? (pick(\"sky-tint\", \"periwinkle-wash\", \"lavender-wash\", \"mist\", \"fog\", \"ash\", \"secondary\") ??\n border)\n : (pick(\"graphite\", \"obsidian\", \"smoke\", \"secondary\") ?? border);\n\n const uiFont = pickUiFontFamily(ctx.font) ?? \"Inter\";\n const displayFont = pickDisplayFontFamily(ctx.font);\n\n let elevationPreset = ctx.recipeHints.elevationPreset ?? \"soft\";\n if (elevationPreset === \"key\" && isLightCanvas) elevationPreset = \"hairline\";\n\n const brand: BrandPackage = {\n id: ctx.id,\n name: ctx.siteName,\n darkDefault: !isLightCanvas,\n version: \"0.1.0\",\n semantic: isLightCanvas\n ? {\n background: tryHexToHsl(bg, \"0 0% 98%\"),\n foreground: tryHexToHsl(fg, \"0 0% 9%\"),\n card: tryHexToHsl(card, \"0 0% 100%\"),\n cardForeground: tryHexToHsl(fg, \"0 0% 9%\"),\n popover: tryHexToHsl(card, \"0 0% 100%\"),\n popoverForeground: tryHexToHsl(fg, \"0 0% 9%\"),\n primary: tryHexToHsl(primary, \"0 0% 9%\"),\n primaryForeground: tryHexToHsl(card, \"0 0% 100%\"),\n secondary: tryHexToHsl(quiet, \"0 0% 92%\"),\n secondaryForeground: tryHexToHsl(fg, \"0 0% 9%\"),\n muted: tryHexToHsl(quiet, \"0 0% 92%\"),\n mutedForeground: tryHexToHsl(mutedFg, \"0 0% 40%\"),\n accent: tryHexToHsl(quiet, \"0 0% 92%\"),\n accentForeground: tryHexToHsl(fg, \"0 0% 9%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: \"0 0% 100%\",\n border: tryHexToHsl(border, \"0 0% 20%\"),\n input: tryHexToHsl(card, \"0 0% 100%\"),\n ring: tryHexToHsl(primary, \"0 0% 9%\"),\n }\n : {\n background: tryHexToHsl(bg, \"0 0% 4%\"),\n foreground: tryHexToHsl(fg, \"0 0% 98%\"),\n card: tryHexToHsl(card, \"0 0% 8%\"),\n cardForeground: tryHexToHsl(fg, \"0 0% 98%\"),\n popover: tryHexToHsl(card, \"0 0% 8%\"),\n popoverForeground: tryHexToHsl(fg, \"0 0% 98%\"),\n primary: tryHexToHsl(primary, \"217 91% 60%\"),\n primaryForeground: tryHexToHsl(bg, \"0 0% 4%\"),\n secondary: tryHexToHsl(border, \"0 0% 20%\"),\n secondaryForeground: tryHexToHsl(fg, \"0 0% 98%\"),\n muted: tryHexToHsl(card, \"0 0% 8%\"),\n mutedForeground: tryHexToHsl(mutedFg, \"0 0% 53%\"),\n accent: tryHexToHsl(border, \"0 0% 20%\"),\n accentForeground: tryHexToHsl(primary, \"217 91% 60%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: \"0 0% 100%\",\n border: tryHexToHsl(border, \"0 0% 20%\"),\n input: tryHexToHsl(border, \"0 0% 20%\"),\n ring: tryHexToHsl(primary, \"217 91% 60%\"),\n },\n recipe: buildRecipe({\n buttonDefault: ctx.recipeHints.buttonDefault ?? \"solid\",\n radii: {\n button:\n ctx.recipeHints.radii?.button ??\n leafHex(ctx.radius, [\"buttons\"]) ??\n leafHex(ctx.radius, [\"md\"]) ??\n \"0.375rem\",\n card:\n ctx.recipeHints.radii?.card ??\n leafHex(ctx.radius, [\"cards\"]) ??\n leafHex(ctx.radius, [\"xl\"]) ??\n leafHex(ctx.radius, [\"lg\"]) ??\n \"0.75rem\",\n badge: leafHex(ctx.radius, [\"pills\"]) ?? leafHex(ctx.radius, [\"badges\"]) ?? \"9999px\",\n input: leafHex(ctx.radius, [\"inputs\"]) ?? ctx.recipeHints.radii?.button ?? \"0.375rem\",\n },\n elevationPreset,\n density: ctx.recipeHints.density ?? \"comfortable\",\n outlineBorder: isLightCanvas ? border : fg,\n badgeDefault: brandMarkHex ? \"muted\" : \"match-action\",\n }),\n typography: {\n fontSans: `'${uiFont}', ui-sans-serif, system-ui, sans-serif`,\n ...(displayFont ? { fontDisplay: `'${displayFont}', ui-serif, Georgia, serif` } : {}),\n headingWeight: isLightCanvas ? 500 : 600,\n },\n extensions: {\n ...(typeof ctx.refero.url === \"string\" ? { sourceUrl: ctx.refero.url } : {}),\n ...(brandMarkHex ? { categories: { brand: brandMarkHex } } : {}),\n notes: [\n \"Generic compile — verify primary + buttonDefault in Create Center.\",\n ...(brandMarkHex\n ? [\"Detected separate brand-mark color (categories.brand → --brand-mark).\"]\n : []),\n ],\n },\n };\n\n return brand;\n}\n","/**\n * gsap design-language compile preset (stress fixture).\n */\nimport { leafHex } from \"../compile-helpers\";\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage, ButtonDefaultStyle, Density } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildGsap(ctx: CompileContext): BrandPackage {\n const canvas = ctx.colors[\"just-black\"] ?? ctx.colors.canvas ?? \"#0e100f\";\n const cream = ctx.colors[\"surface-cream\"] ?? ctx.colors[\"cream-surface\"] ?? \"#fffce1\";\n const muted = ctx.colors[\"surface-50\"] ?? \"#7c7c6f\";\n const hairline = ctx.colors[\"surface-25\"] ?? \"#42433d\";\n const nested = ctx.colors[\"off-black\"] ?? ctx.colors[\"nested-panel\"] ?? \"#191919\";\n const green = ctx.colors[\"shockingly-green\"] ?? \"#0ae448\";\n // DESIGN: do NOT promote shockingly-green to filled primary CTA\n ctx.warnings.push(\n \"GSAP: shockingly-green is accent/link only — buttonDefault=outline (no solid green fill).\",\n );\n\n const buttonDefault: ButtonDefaultStyle = ctx.recipeHints.buttonDefault ?? \"gradient-stroke\";\n\n const brand: BrandPackage = {\n id: \"gsap\",\n name: \"GSAP\",\n darkDefault: true,\n version: \"1.0.0\",\n semantic: {\n // Primary for *links/accents* — filled solid CTAs are disabled by recipe\n background: tryHexToHsl(canvas, \"150 8% 6%\"),\n foreground: tryHexToHsl(cream, \"54 100% 94%\"),\n card: tryHexToHsl(nested, \"0 0% 10%\"),\n cardForeground: tryHexToHsl(cream, \"54 100% 94%\"),\n popover: tryHexToHsl(nested, \"0 0% 10%\"),\n popoverForeground: tryHexToHsl(cream, \"54 100% 94%\"),\n primary: tryHexToHsl(green, \"136 91% 47%\"),\n primaryForeground: tryHexToHsl(canvas, \"150 8% 6%\"),\n secondary: tryHexToHsl(hairline, \"60 5% 25%\"),\n secondaryForeground: tryHexToHsl(cream, \"54 100% 94%\"),\n muted: tryHexToHsl(nested, \"0 0% 10%\"),\n mutedForeground: tryHexToHsl(muted, \"60 6% 46%\"),\n accent: tryHexToHsl(hairline, \"60 5% 25%\"),\n accentForeground: tryHexToHsl(green, \"136 91% 47%\"),\n destructive: tryHexToHsl(ctx.colors[\"lipstick-pink\"] ?? \"#f100cb\", \"310 100% 47%\"),\n destructiveForeground: tryHexToHsl(cream, \"54 100% 94%\"),\n border: tryHexToHsl(hairline, \"60 5% 25%\"),\n input: tryHexToHsl(hairline, \"60 5% 25%\"),\n ring: tryHexToHsl(green, \"136 91% 47%\"),\n info: tryHexToHsl(ctx.colors.blue ?? \"#00bae2\", \"191 100% 44%\"),\n infoForeground: tryHexToHsl(canvas, \"150 8% 6%\"),\n success: tryHexToHsl(green, \"136 91% 47%\"),\n successForeground: tryHexToHsl(canvas, \"150 8% 6%\"),\n },\n recipe: buildRecipe({\n buttonDefault,\n radii: {\n button: ctx.recipeHints.radii?.button ?? leafHex(ctx.radius, [\"full\"]) ?? \"100px\",\n card: leafHex(ctx.radius, [\"lg\"]) ?? \"8px\",\n },\n elevationPreset: ctx.recipeHints.elevationPreset ?? \"none\",\n density: (ctx.recipeHints.density ?? \"comfortable\") satisfies Density,\n outlineBorder: cream,\n primaryStrokeGradient: \"linear-gradient(114.41deg, #0ae448 20.74%, #abff84 65.5%)\",\n }),\n // Performs. This is the one language where motion is the message, so the\n // ramp is long enough to be watched and the spring is allowed to overshoot\n // well past its resting state.\n motion: {\n easeOut: \"cubic-bezier(0.22, 1, 0.36, 1)\",\n easeInOut: \"cubic-bezier(0.65, 0, 0.35, 1)\",\n easeSpring: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\",\n micro: 120,\n flow: 250,\n reveal: 400,\n cinematic: 700,\n },\n // Room for the performance to land — more air than the product-chrome trio.\n spacing: {\n xs: \"0.5rem\",\n sm: \"0.875rem\",\n md: \"1.25rem\",\n lg: \"1.75rem\",\n xl: \"2.5rem\",\n \"2xl\": \"3.5rem\",\n },\n typography: {\n fontSans: `'Mori', 'Inter Tight', 'DM Sans', ui-sans-serif, system-ui, sans-serif`,\n fontDisplay: `'Mori', 'Inter Tight', ui-sans-serif, system-ui, sans-serif`,\n headingWeight: 600,\n },\n extensions: {\n categories: {\n gsap: green,\n scroll: ctx.colors.pink ?? \"#fec5fb\",\n svg: ctx.colors.orangey ?? \"#ff8709\",\n text: ctx.colors.lilac ?? \"#9d95ff\",\n ui: ctx.colors.blue ?? \"#00bae2\",\n other: ctx.colors[\"light-green\"] ?? \"#abff84\",\n },\n displaySizePx: 224,\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://gsap.com\",\n notes: [\n \"Outline-first product controls; category ctx.colors are marketing extensions.\",\n \"Replace typography.faces[].src with Create Center hosted ctx.font URLs.\",\n ],\n },\n };\n return brand;\n}\n","/**\n * linear design-language compile preset (stress fixture).\n * Dual-mode: dark void default + light monochrome paper (acid-lime CTA both modes).\n */\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage, BrandSemanticColors } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nfunction linearDarkSemantic(\n voidC: string,\n carbon: string,\n graphite: string,\n ash: string,\n paper: string,\n lime: string,\n coral: string,\n pulse: string,\n colors: Record<string, string>,\n): BrandSemanticColors {\n return {\n background: tryHexToHsl(voidC, \"210 11% 4%\"),\n foreground: tryHexToHsl(paper, \"0 0% 100%\"),\n card: tryHexToHsl(carbon, \"210 6% 6%\"),\n cardForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n popover: tryHexToHsl(colors.obsidian ?? \"#161718\", \"210 5% 9%\"),\n popoverForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n primary: tryHexToHsl(lime, \"66 89% 54%\"),\n primaryForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n secondary: tryHexToHsl(graphite, \"220 7% 15%\"),\n secondaryForeground: tryHexToHsl(colors.mist ?? \"#d0d6e0\", \"220 20% 85%\"),\n muted: tryHexToHsl(colors.obsidian ?? \"#161718\", \"210 5% 9%\"),\n mutedForeground: tryHexToHsl(ash, \"220 5% 41%\"),\n accent: tryHexToHsl(graphite, \"220 7% 15%\"),\n accentForeground: tryHexToHsl(lime, \"66 89% 54%\"),\n destructive: tryHexToHsl(coral, \"0 79% 63%\"),\n destructiveForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n border: tryHexToHsl(graphite, \"220 7% 15%\"),\n input: tryHexToHsl(graphite, \"220 7% 15%\"),\n ring: tryHexToHsl(lime, \"66 89% 54%\"),\n success: tryHexToHsl(pulse, \"136 61% 40%\"),\n successForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n info: tryHexToHsl(colors[\"signal-teal\"] ?? \"#02b8cc\", \"187 98% 40%\"),\n infoForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n };\n}\n\n/** Light shell — paper canvas, same acid-lime CTA, graphite chrome. */\nfunction linearLightSemantic(\n voidC: string,\n ash: string,\n paper: string,\n lime: string,\n coral: string,\n pulse: string,\n colors: Record<string, string>,\n): BrandSemanticColors {\n return {\n background: \"0 0% 100%\",\n foreground: tryHexToHsl(voidC, \"210 11% 4%\"),\n card: \"0 0% 98%\",\n cardForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n popover: \"0 0% 100%\",\n popoverForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n primary: tryHexToHsl(lime, \"66 89% 54%\"),\n primaryForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n secondary: \"220 14% 96%\",\n secondaryForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n muted: \"220 14% 96%\",\n mutedForeground: tryHexToHsl(ash, \"220 5% 41%\"),\n accent: \"220 14% 96%\",\n accentForeground: tryHexToHsl(voidC, \"210 11% 4%\"),\n destructive: tryHexToHsl(coral, \"0 79% 63%\"),\n destructiveForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n border: \"220 13% 91%\",\n input: \"0 0% 100%\",\n ring: tryHexToHsl(lime, \"66 89% 54%\"),\n success: tryHexToHsl(pulse, \"136 61% 40%\"),\n successForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n info: tryHexToHsl(colors[\"signal-teal\"] ?? \"#02b8cc\", \"187 98% 40%\"),\n infoForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n };\n}\n\nexport function buildLinear(ctx: CompileContext): BrandPackage {\n const voidC = ctx.colors.void ?? ctx.colors[\"just-black\"] ?? \"#08090a\";\n const carbon = ctx.colors.carbon ?? \"#0f1011\";\n const graphite = ctx.colors.graphite ?? \"#23252a\";\n const ash = ctx.colors.ash ?? \"#62666d\";\n const paper = ctx.colors.paper ?? \"#ffffff\";\n const lime = ctx.colors[\"acid-lime\"] ?? \"#e4f222\";\n const coral = ctx.colors[\"coral-red\"] ?? \"#eb5757\";\n const pulse = ctx.colors[\"pulse-green\"] ?? \"#27a644\";\n\n const dark = linearDarkSemantic(\n voidC,\n carbon,\n graphite,\n ash,\n paper,\n lime,\n coral,\n pulse,\n ctx.colors,\n );\n const light = linearLightSemantic(voidC, ash, paper, lime, coral, pulse, ctx.colors);\n\n const brand: BrandPackage = {\n id: \"linear\",\n name: \"Linear\",\n darkDefault: true,\n version: \"1.0.0\",\n semantic: dark,\n modes: {\n dark: { semantic: dark },\n light: { semantic: light },\n },\n recipe: buildRecipe({\n buttonDefault: \"solid\",\n radii: { button: \"6px\", card: \"12px\" },\n elevationPreset: \"soft\",\n density: \"compact\",\n }),\n // Resolves before the eye asks it to. Linear's interfaces answer on the\n // frame you click; the expo-out curve spends its whole budget decelerating,\n // which is what makes a 140ms move read as instant rather than abrupt. No\n // spring — nothing in this language overshoots.\n motion: {\n easeOut: \"cubic-bezier(0.16, 1, 0.3, 1)\",\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n micro: 80,\n flow: 140,\n reveal: 200,\n cinematic: 320,\n },\n // Sits close to the content it chrome — the densest of the seven.\n spacing: {\n xs: \"0.375rem\",\n sm: \"0.5rem\",\n md: \"0.75rem\",\n lg: \"1rem\",\n xl: \"1.5rem\",\n \"2xl\": \"2rem\",\n },\n typography: {\n fontSans: `'Inter Variable', 'Inter', ui-sans-serif, system-ui, sans-serif`,\n fontMono: `'Berkeley Mono', 'JetBrains Mono', ui-monospace, monospace`,\n headingWeight: 510,\n },\n extensions: {\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://linear.app\",\n notes: [\"Dual-mode: dark void default + light paper; acid-lime solid CTA in both modes.\"],\n },\n };\n return brand;\n}\n","/**\n * notion design-language compile preset (stress fixture).\n */\nimport { leafHex } from \"../compile-helpers\";\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildNotion(ctx: CompileContext): BrandPackage {\n const paper = ctx.colors[\"paper-warmth\"] ?? \"#f6f5f4\";\n const white = ctx.colors[\"pure-white\"] ?? \"#ffffff\";\n const ink = ctx.colors[\"ink-black\"] ?? \"#000000\";\n const charcoal = ctx.colors.charcoal ?? \"#111111\";\n const stone = ctx.colors.stone ?? \"#757575\";\n const graphite = ctx.colors.graphite ?? \"#615d59\";\n const blue = ctx.colors[\"notion-blue\"] ?? \"#0075de\";\n const sky = ctx.colors[\"sky-tint\"] ?? \"#e6f3fe\";\n const marigold = ctx.colors.marigold ?? \"#ffb110\";\n const coral = ctx.colors.coral ?? \"#f64932\";\n const midnight = ctx.colors[\"midnight-ink\"] ?? \"#02093a\";\n const signal = ctx.colors[\"signal-blue\"] ?? \"#097fe8\";\n\n ctx.warnings.push(\n \"Notion: notion-blue is the only filled CTA; marigold/coral/midnight are decorative card washes (never default action).\",\n );\n ctx.warnings.push(\n \"Notion: content cards use 1px hairline + elev=none; soft shadows only for sticky nav / product mockups (raised slot).\",\n );\n\n const brand: BrandPackage = {\n id: \"notion\",\n name: \"Notion\",\n darkDefault: false,\n version: \"1.0.0\",\n roles: {\n canvas: tryHexToHsl(paper, \"30 9% 96%\"),\n canvasForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n surface: tryHexToHsl(white, \"0 0% 100%\"),\n surfaceForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n action: tryHexToHsl(blue, \"208 100% 44%\"),\n actionForeground: tryHexToHsl(white, \"0 0% 100%\"),\n // Logo / wordmark / ink hierarchy — not blue CTA\n brand: tryHexToHsl(ink, \"0 0% 0%\"),\n brandForeground: tryHexToHsl(white, \"0 0% 100%\"),\n // Ghost CTA wash\n quiet: tryHexToHsl(sky, \"206 90% 95%\"),\n quietForeground: tryHexToHsl(blue, \"208 100% 44%\"),\n muted: tryHexToHsl(sky, \"206 90% 95%\"),\n mutedForeground: tryHexToHsl(stone, \"0 0% 46%\"),\n // Approx hairline rgba(0,0,0,0.08) on warm paper\n border: \"30 5% 88%\",\n input: tryHexToHsl(white, \"0 0% 100%\"),\n ring: tryHexToHsl(blue, \"208 100% 44%\"),\n destructive: tryHexToHsl(coral, \"6 91% 58%\"),\n destructiveForeground: tryHexToHsl(white, \"0 0% 100%\"),\n warning: tryHexToHsl(marigold, \"40 100% 53%\"),\n warningForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n info: tryHexToHsl(signal, \"207 93% 47%\"),\n infoForeground: tryHexToHsl(white, \"0 0% 100%\"),\n },\n semantic: {\n background: tryHexToHsl(paper, \"30 9% 96%\"),\n foreground: tryHexToHsl(ink, \"0 0% 0%\"),\n card: tryHexToHsl(white, \"0 0% 100%\"),\n cardForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n popover: tryHexToHsl(white, \"0 0% 100%\"),\n popoverForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n primary: tryHexToHsl(blue, \"208 100% 44%\"),\n primaryForeground: tryHexToHsl(white, \"0 0% 100%\"),\n secondary: tryHexToHsl(sky, \"206 90% 95%\"),\n secondaryForeground: tryHexToHsl(blue, \"208 100% 44%\"),\n muted: tryHexToHsl(sky, \"206 90% 95%\"),\n mutedForeground: tryHexToHsl(stone, \"0 0% 46%\"),\n accent: tryHexToHsl(sky, \"206 90% 95%\"),\n accentForeground: tryHexToHsl(blue, \"208 100% 44%\"),\n destructive: tryHexToHsl(coral, \"6 91% 58%\"),\n destructiveForeground: tryHexToHsl(white, \"0 0% 100%\"),\n border: \"30 5% 88%\",\n input: tryHexToHsl(white, \"0 0% 100%\"),\n ring: tryHexToHsl(blue, \"208 100% 44%\"),\n warning: tryHexToHsl(marigold, \"40 100% 53%\"),\n warningForeground: tryHexToHsl(ink, \"0 0% 0%\"),\n info: tryHexToHsl(signal, \"207 93% 47%\"),\n infoForeground: tryHexToHsl(white, \"0 0% 100%\"),\n },\n recipe: buildRecipe({\n buttonDefault: ctx.recipeHints.buttonDefault ?? \"solid\",\n radii: {\n button:\n ctx.recipeHints.radii?.button ??\n leafHex(ctx.radius, [\"buttons\"]) ??\n leafHex(ctx.radius, [\"lg\"]) ??\n \"8px\",\n card:\n ctx.recipeHints.radii?.card ??\n leafHex(ctx.radius, [\"cards\"]) ??\n leafHex(ctx.radius, [\"xl\"]) ??\n \"12px\",\n badge: leafHex(ctx.radius, [\"pills\"]) ?? leafHex(ctx.radius, [\"full\"]) ?? \"9999px\",\n input: leafHex(ctx.radius, [\"buttons\"]) ?? leafHex(ctx.radius, [\"lg\"]) ?? \"8px\",\n },\n elevationPreset: ctx.recipeHints.elevationPreset ?? \"none\",\n density: ctx.recipeHints.density ?? \"comfortable\",\n badgeDefault: \"muted\",\n outlineBorder: ink,\n // Sticky nav soft shadow lives in raised; cards stay flat\n elevationTokens: {\n card: \"0 0 #0000\",\n control: \"0 0 #0000\",\n raised: \"0px 0.7px 1.462px 0px rgb(0 0 0 / 0.015), 0px 3px 9px 0px rgb(0 0 0 / 0.03)\",\n },\n }),\n // Settles rather than snaps. A document surface is read, not operated, so\n // motion here is slow enough to follow with the eye and never competes with\n // the text it is moving.\n motion: {\n easeOut: \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n micro: 120,\n flow: 200,\n reveal: 280,\n cinematic: 460,\n },\n // Editorial — a document wants margin, not chrome density.\n spacing: {\n xs: \"0.625rem\",\n sm: \"1rem\",\n md: \"1.5rem\",\n lg: \"2rem\",\n xl: \"2.75rem\",\n \"2xl\": \"3.75rem\",\n },\n typography: {\n fontSans: `'NotionInter', 'Inter', ui-sans-serif, system-ui, sans-serif`,\n fontDisplay: `'NotionInter', 'Inter', ui-sans-serif, system-ui, sans-serif`,\n headingWeight: 700,\n },\n extensions: {\n categories: {\n brand: ink,\n action: blue,\n ghost: sky,\n marigold,\n coral,\n midnight,\n charcoal,\n graphite,\n },\n decorative: {\n marigold,\n coral,\n saffron: ctx.colors.saffron ?? \"#e89d01\",\n \"sky-wash\": ctx.colors[\"sky-wash\"] ?? \"#62aef0\",\n midnight,\n },\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://www.notion.com\",\n notes: [\n \"roles.action = Notion Blue (only filled CTA). Accent hues are decorative card washes.\",\n \"roles.brand = Ink Black (logo / wordmark / text hierarchy via alpha).\",\n \"Canvas = Paper Warmth; cards = Pure White — never invert.\",\n \"Card elev=none + hairline border; sticky nav soft shadow → elevation raised slot.\",\n \"Buttons 8px, cards 12px, pills 9999px.\",\n \"Lyon Text is editorial accent only — not product chrome UI.\",\n ],\n },\n };\n return brand;\n}\n","/**\n * raycast design-language compile preset (stress fixture).\n */\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildRaycast(ctx: CompileContext): BrandPackage {\n const canvas = ctx.colors[\"void-black\"] ?? ctx.colors.canvas ?? \"#040506\";\n const ink = ctx.colors.ink ?? ctx.colors.card ?? \"#07080a\";\n const obsidian = ctx.colors.obsidian ?? ctx.colors.recessed ?? \"#111214\";\n const graphite = ctx.colors.graphite ?? ctx.colors.badge ?? \"#1b1c1e\";\n const smoke = ctx.colors.smoke ?? \"#6a6b6c\";\n const ash = ctx.colors.ash ?? \"#9c9c9d\";\n const mist = ctx.colors.mist ?? \"#e6e6e6\";\n const iron = ctx.colors.iron ?? \"#454647\";\n const slate = ctx.colors.slate ?? \"#2f3031\";\n const paper = ctx.colors[\"pure-white\"] ?? \"#ffffff\";\n const coral = ctx.colors[\"coral-pulse\"] ?? \"#ff6363\";\n const success = ctx.colors[\"success-green\"] ?? \"#59d499\";\n const info = ctx.colors[\"info-blue\"] ?? \"#56c2ff\";\n\n ctx.warnings.push(\n \"Raycast: coral-pulse is brand mark only — primary CTA is Mist/Iron neutral solid.\",\n );\n\n const brand: BrandPackage = {\n id: \"raycast\",\n name: \"Raycast\",\n darkDefault: true,\n version: \"1.0.0\",\n semantic: {\n background: tryHexToHsl(canvas, \"210 20% 2%\"),\n foreground: tryHexToHsl(paper, \"0 0% 100%\"),\n card: tryHexToHsl(ink, \"220 18% 3%\"),\n cardForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n popover: tryHexToHsl(ink, \"220 18% 3%\"),\n popoverForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n // Filled CTA = Mist on dark (not coral)\n primary: tryHexToHsl(mist, \"0 0% 90%\"),\n primaryForeground: tryHexToHsl(iron, \"210 1% 27%\"),\n secondary: tryHexToHsl(graphite, \"220 4% 11%\"),\n secondaryForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n muted: tryHexToHsl(obsidian, \"220 6% 7%\"),\n mutedForeground: tryHexToHsl(smoke, \"240 1% 42%\"),\n // Coral as accent for brand-adjacent UI (badges that opt-in to accent)\n accent: tryHexToHsl(coral, \"0 100% 69%\"),\n accentForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n border: tryHexToHsl(slate, \"210 2% 19%\"),\n input: tryHexToHsl(obsidian, \"220 6% 7%\"),\n ring: tryHexToHsl(ash, \"240 1% 61%\"),\n success: tryHexToHsl(success, \"150 58% 59%\"),\n successForeground: tryHexToHsl(canvas, \"210 20% 2%\"),\n info: tryHexToHsl(info, \"200 100% 67%\"),\n infoForeground: tryHexToHsl(canvas, \"210 20% 2%\"),\n },\n recipe: buildRecipe({\n buttonDefault: \"solid\",\n radii: {\n button: ctx.recipeHints.radii?.button ?? \"8px\",\n card: \"16px\",\n badge: \"6px\",\n input: \"8px\",\n },\n elevationPreset: ctx.recipeHints.elevationPreset ?? \"key\",\n density: ctx.recipeHints.density ?? \"comfortable\",\n badgeDefault: \"muted\",\n }),\n // Native-feeling: quick, with a small overshoot on things that appear. The\n // spring is the point — a launcher should feel like it was already there.\n motion: {\n easeOut: \"cubic-bezier(0.16, 1, 0.3, 1)\",\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeSpring: \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n micro: 90,\n flow: 160,\n reveal: 220,\n cinematic: 340,\n },\n // Command-palette density — compact, but not as tight as Linear.\n spacing: {\n xs: \"0.375rem\",\n sm: \"0.5rem\",\n md: \"0.75rem\",\n lg: \"1rem\",\n xl: \"1.375rem\",\n \"2xl\": \"2rem\",\n },\n typography: {\n fontSans: `'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif`,\n fontMono: `'Geist Mono', 'GeistMono', ui-monospace, Menlo, monospace`,\n fontDisplay: `'Inter', ui-sans-serif, system-ui, sans-serif`,\n headingWeight: 400,\n },\n extensions: {\n categories: {\n brand: coral,\n ember: ctx.colors[\"ember-hush\"] ?? \"#452324\",\n sky: ctx.colors[\"electric-sky\"] ?? \"#63a1ff\",\n },\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://raycast.com\",\n notes: [\n \"Primary CTA = Mist fill + Iron text (neutral solid).\",\n \"Coral Pulse is brand mark only — do not use for general product chrome CTAs.\",\n \"Cards use elevation=key (keyboard-key inset shadow stack).\",\n ],\n },\n };\n return brand;\n}\n","/**\n * stripe design-language compile preset (stress fixture).\n */\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildStripe(ctx: CompileContext): BrandPackage {\n const white = ctx.colors[\"pure-white\"] ?? \"#ffffff\";\n const mist = ctx.colors.mist ?? \"#f8fafd\";\n const frost = ctx.colors.frost ?? \"#e5edf5\";\n const midnight = ctx.colors[\"midnight-ink\"] ?? \"#061b31\";\n const slate = ctx.colors.slate ?? \"#64748d\";\n const steel = ctx.colors.steel ?? \"#50617a\";\n const indigo = ctx.colors[\"indigo-ink\"] ?? \"#533afd\";\n const indigoHover = ctx.colors[\"indigo-hover\"] ?? \"#7389ff\";\n const lavender = ctx.colors[\"lavender-border\"] ?? \"#b9b9f9\";\n const periwinkle = ctx.colors[\"periwinkle-wash\"] ?? \"#e8e9ff\";\n const deep = ctx.colors[\"deep-violet\"] ?? \"#182659\";\n const smoke = ctx.colors.smoke ?? \"#839bc8\";\n\n ctx.warnings.push(\n \"Stripe: indigo-ink is action CTA only; midnight-ink is brand-mark/wordmark (never default CTA fill).\",\n );\n ctx.warnings.push(\n \"Stripe: elevation=none — depth via white→mist→frost tints + 1px frost rules, never box-shadow.\",\n );\n\n const brand: BrandPackage = {\n id: \"stripe\",\n name: \"Stripe\",\n darkDefault: false,\n version: \"1.0.0\",\n roles: {\n canvas: tryHexToHsl(white, \"0 0% 100%\"),\n canvasForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n surface: tryHexToHsl(white, \"0 0% 100%\"),\n surfaceForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n action: tryHexToHsl(indigo, \"248 98% 61%\"),\n actionForeground: tryHexToHsl(white, \"0 0% 100%\"),\n brand: tryHexToHsl(midnight, \"208 78% 11%\"),\n brandForeground: tryHexToHsl(white, \"0 0% 100%\"),\n quiet: tryHexToHsl(periwinkle, \"238 100% 95%\"),\n quietForeground: tryHexToHsl(indigo, \"248 98% 61%\"),\n muted: tryHexToHsl(mist, \"210 56% 98%\"),\n mutedForeground: tryHexToHsl(slate, \"215 16% 47%\"),\n border: tryHexToHsl(frost, \"210 36% 93%\"),\n input: tryHexToHsl(white, \"0 0% 100%\"),\n ring: tryHexToHsl(indigo, \"248 98% 61%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(white, \"0 0% 100%\"),\n info: tryHexToHsl(indigoHover, \"230 100% 73%\"),\n infoForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n },\n semantic: {\n background: tryHexToHsl(white, \"0 0% 100%\"),\n foreground: tryHexToHsl(midnight, \"208 78% 11%\"),\n card: tryHexToHsl(white, \"0 0% 100%\"),\n cardForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n popover: tryHexToHsl(white, \"0 0% 100%\"),\n popoverForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n primary: tryHexToHsl(indigo, \"248 98% 61%\"),\n primaryForeground: tryHexToHsl(white, \"0 0% 100%\"),\n secondary: tryHexToHsl(periwinkle, \"238 100% 95%\"),\n secondaryForeground: tryHexToHsl(indigo, \"248 98% 61%\"),\n muted: tryHexToHsl(mist, \"210 56% 98%\"),\n mutedForeground: tryHexToHsl(slate, \"215 16% 47%\"),\n accent: tryHexToHsl(indigo, \"248 98% 61%\"),\n accentForeground: tryHexToHsl(white, \"0 0% 100%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(white, \"0 0% 100%\"),\n border: tryHexToHsl(frost, \"210 36% 93%\"),\n input: tryHexToHsl(white, \"0 0% 100%\"),\n ring: tryHexToHsl(indigo, \"248 98% 61%\"),\n info: tryHexToHsl(indigoHover, \"230 100% 73%\"),\n infoForeground: tryHexToHsl(midnight, \"208 78% 11%\"),\n },\n recipe: buildRecipe({\n buttonDefault: ctx.recipeHints.buttonDefault ?? \"solid\",\n radii: {\n button: ctx.recipeHints.radii?.button ?? \"4px\",\n card: \"4px\",\n badge: \"9999px\",\n input: \"4px\",\n },\n elevationPreset: ctx.recipeHints.elevationPreset ?? \"none\",\n density: ctx.recipeHints.density ?? \"comfortable\",\n badgeDefault: \"muted\",\n // Ghost outline companion uses lavender hairline, not carbon\n outlineBorder: lavender,\n }),\n // Deliberate and even. Stripe's motion never draws attention to itself;\n // the curve is symmetric so a panel leaves the way it arrived.\n motion: {\n easeOut: \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n easeInOut: \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n micro: 100,\n flow: 180,\n reveal: 260,\n cinematic: 400,\n },\n // Clean commerce chrome — a touch more generous than the app-shell trio.\n spacing: {\n xs: \"0.5rem\",\n sm: \"0.75rem\",\n md: \"1.125rem\",\n lg: \"1.75rem\",\n xl: \"2.25rem\",\n \"2xl\": \"3.25rem\",\n },\n typography: {\n fontSans: `'sohne-var', 'Inter Tight', 'Inter', ui-sans-serif, system-ui, sans-serif`,\n fontDisplay: `'sohne-var', 'Inter Tight', ui-sans-serif, system-ui, sans-serif`,\n // Whisper weight is the Stripe signature (even at 56px display)\n headingWeight: 300,\n },\n extensions: {\n categories: {\n brand: midnight,\n action: indigo,\n link: indigo,\n hover: indigoHover,\n ghostBorder: lavender,\n wash: periwinkle,\n deep: deep,\n smoke,\n steel,\n },\n decorative: {\n \"section-band\": mist,\n frost,\n },\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://stripe.com\",\n notes: [\n \"roles.action = Indigo Ink filled CTA; roles.brand = Midnight Ink wordmark.\",\n \"Elevation none — tint ladder + 1px frost rules; never box-shadow.\",\n \"Control ctx.radius 4px (not pill); tags may stay full-pill.\",\n \"Typography weight 300 is the product signature (Inter Tight substitute).\",\n \"Pair solid CTA with ghost outline (lavender border) as secondary.\",\n ],\n },\n };\n return brand;\n}\n","/**\n * vanta design-language compile preset (stress fixture).\n */\nimport { leafHex } from \"../compile-helpers\";\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nexport function buildVanta(ctx: CompileContext): BrandPackage {\n const parchment = ctx.colors.parchment ?? ctx.colors[\"page-canvas\"] ?? \"#f7f8fa\";\n const paper = ctx.colors.paper ?? ctx.colors[\"card-surface\"] ?? \"#ffffff\";\n const carbon = ctx.colors.carbon ?? \"#181822\";\n const graphite = ctx.colors.graphite ?? \"#6d6e87\";\n const steel = ctx.colors.steel ?? \"#9e9fb7\";\n const ash = ctx.colors.ash ?? \"#dfdfe9\";\n const fog = ctx.colors.fog ?? \"#eaeaf1\";\n const lavender = ctx.colors[\"lavender-wash\"] ?? \"#ddd6ff\";\n const vivid = ctx.colors[\"vivid-violet\"] ?? \"#5e05c4\";\n const indigo = ctx.colors[\"indigo-ink\"] ?? \"#260048\";\n const mid = ctx.colors[\"mid-violet\"] ?? \"#8f47d5\";\n const amber = ctx.colors[\"amber-signal\"] ?? \"#ffbe0f\";\n\n ctx.warnings.push(\n \"Vanta: vivid-violet is action CTA only; indigo-ink is brand-mark/logo (never default CTA fill).\",\n );\n ctx.warnings.push(\"Vanta: elevation=none — cards use 1px carbon border, not box-shadow.\");\n\n const brand: BrandPackage = {\n id: \"vanta\",\n name: \"Vanta\",\n darkDefault: false,\n version: \"1.0.0\",\n roles: {\n canvas: tryHexToHsl(parchment, \"220 23% 97%\"),\n canvasForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n surface: tryHexToHsl(paper, \"0 0% 100%\"),\n surfaceForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n // Action = single saturated CTA moment\n action: tryHexToHsl(vivid, \"268 95% 39%\"),\n actionForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n // Brand mark = logo / wordmark / decorative ink (≠ action)\n brand: tryHexToHsl(indigo, \"273 100% 14%\"),\n brandForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n // Quiet = lavender informational chips (not violet fill)\n quiet: tryHexToHsl(lavender, \"249 100% 92%\"),\n quietForeground: tryHexToHsl(indigo, \"273 100% 14%\"),\n muted: tryHexToHsl(fog, \"240 14% 93%\"),\n mutedForeground: tryHexToHsl(graphite, \"237 11% 48%\"),\n border: tryHexToHsl(carbon, \"240 14% 11%\"),\n input: tryHexToHsl(paper, \"0 0% 100%\"),\n ring: tryHexToHsl(vivid, \"268 95% 39%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n warning: tryHexToHsl(amber, \"44 100% 53%\"),\n warningForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n info: tryHexToHsl(mid, \"269 63% 56%\"),\n infoForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n },\n // semantic filled by normalize from roles\n semantic: {\n background: tryHexToHsl(parchment, \"220 23% 97%\"),\n foreground: tryHexToHsl(carbon, \"240 14% 11%\"),\n card: tryHexToHsl(paper, \"0 0% 100%\"),\n cardForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n popover: tryHexToHsl(paper, \"0 0% 100%\"),\n popoverForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n primary: tryHexToHsl(vivid, \"268 95% 39%\"),\n primaryForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n secondary: tryHexToHsl(lavender, \"249 100% 92%\"),\n secondaryForeground: tryHexToHsl(indigo, \"273 100% 14%\"),\n muted: tryHexToHsl(fog, \"240 14% 93%\"),\n mutedForeground: tryHexToHsl(graphite, \"237 11% 48%\"),\n accent: tryHexToHsl(indigo, \"273 100% 14%\"),\n accentForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n border: tryHexToHsl(carbon, \"240 14% 11%\"),\n input: tryHexToHsl(paper, \"0 0% 100%\"),\n ring: tryHexToHsl(vivid, \"268 95% 39%\"),\n warning: tryHexToHsl(amber, \"44 100% 53%\"),\n warningForeground: tryHexToHsl(carbon, \"240 14% 11%\"),\n info: tryHexToHsl(mid, \"269 63% 56%\"),\n infoForeground: tryHexToHsl(paper, \"0 0% 100%\"),\n },\n recipe: buildRecipe({\n buttonDefault: ctx.recipeHints.buttonDefault ?? \"solid\",\n // Prefer structural ctx.radius tokens (full=pill, 2xl=cards) over free-text\n radii: {\n button:\n leafHex(ctx.radius, [\"buttons\"]) ??\n leafHex(ctx.radius, [\"full\"]) ??\n ctx.recipeHints.radii?.button ??\n \"999px\",\n card: leafHex(ctx.radius, [\"cards\"]) ?? leafHex(ctx.radius, [\"2xl\"]) ?? \"16px\",\n badge:\n leafHex(ctx.radius, [\"badges\"]) ??\n leafHex(ctx.radius, [\"full\"]) ??\n ctx.recipeHints.radii?.button ??\n \"999px\",\n input:\n leafHex(ctx.radius, [\"inputs\"]) ??\n leafHex(ctx.radius, [\"full\"]) ??\n ctx.recipeHints.radii?.button ??\n \"999px\",\n },\n elevationPreset: ctx.recipeHints.elevationPreset ?? \"none\",\n density: ctx.recipeHints.density ?? \"comfortable\",\n // Informational chips = lavender wash + indigo (quiet), not violet CTA fill\n badgeDefault: \"muted\",\n outlineBorder: carbon,\n }),\n // Atmospheric. Backdrops drift rather than move, so even the micro step is\n // slow and nothing snaps.\n motion: {\n easeOut: \"cubic-bezier(0.33, 1, 0.68, 1)\",\n easeInOut: \"cubic-bezier(0.37, 0, 0.63, 1)\",\n micro: 120,\n flow: 240,\n reveal: 380,\n cinematic: 620,\n },\n // The most spacious of the seven — serif editorial wants the most air.\n spacing: {\n xs: \"0.75rem\",\n sm: \"1.125rem\",\n md: \"1.75rem\",\n lg: \"2.5rem\",\n xl: \"3.5rem\",\n \"2xl\": \"5rem\",\n },\n typography: {\n fontSans: `'Inter Variable', 'Inter', ui-sans-serif, system-ui, sans-serif`,\n fontDisplay: `'Reckless', 'Source Serif 4', 'Lora', ui-serif, Georgia, serif`,\n headingWeight: 500,\n },\n extensions: {\n categories: {\n brand: indigo,\n action: vivid,\n link: mid,\n heroWash: lavender,\n warning: amber,\n steel,\n ash,\n },\n decorative: {\n \"hero-wash\": lavender,\n },\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://www.vanta.com\",\n notes: [\n \"roles.action = Vivid Violet (filled CTA only).\",\n \"roles.brand = Indigo Ink (logo / wordmark / brand-mark).\",\n \"Elevation none — 1px carbon borders frame cards; no drop-shadow.\",\n \"Full-pill controls (999px); cards 16px.\",\n \"UI = Inter Variable; marketing display = Reckless serif.\",\n \"Lavender wash is marketing hero surface (decorative), not product chrome fill.\",\n ],\n },\n };\n return brand;\n}\n","/**\n * vercel design-language compile preset (stress fixture).\n * Dual-mode: light monochrome + dark monochrome (orthogonal to ThemeProvider class).\n */\nimport { tryHexToHsl } from \"../hex-to-hsl\";\nimport type { BrandPackage, BrandSemanticColors } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildRecipe } from \"./recipe\";\n\nfunction vercelLightSemantic(\n paper: string,\n pure: string,\n hairline: string,\n charcoal: string,\n stone: string,\n obsidian: string,\n terminal: string,\n): BrandSemanticColors {\n return {\n background: tryHexToHsl(paper, \"0 0% 98%\"),\n foreground: tryHexToHsl(obsidian, \"0 0% 9%\"),\n card: tryHexToHsl(pure, \"0 0% 100%\"),\n cardForeground: tryHexToHsl(obsidian, \"0 0% 9%\"),\n popover: tryHexToHsl(pure, \"0 0% 100%\"),\n popoverForeground: tryHexToHsl(obsidian, \"0 0% 9%\"),\n // Filled black button\n primary: tryHexToHsl(obsidian, \"0 0% 9%\"),\n primaryForeground: tryHexToHsl(pure, \"0 0% 100%\"),\n secondary: tryHexToHsl(hairline, \"0 0% 92%\"),\n secondaryForeground: tryHexToHsl(charcoal, \"0 0% 30%\"),\n muted: tryHexToHsl(hairline, \"0 0% 92%\"),\n mutedForeground: tryHexToHsl(stone, \"0 0% 40%\"),\n accent: tryHexToHsl(hairline, \"0 0% 92%\"),\n accentForeground: tryHexToHsl(obsidian, \"0 0% 9%\"),\n destructive: \"0 72% 51%\",\n destructiveForeground: tryHexToHsl(pure, \"0 0% 100%\"),\n border: tryHexToHsl(hairline, \"0 0% 92%\"),\n input: tryHexToHsl(pure, \"0 0% 100%\"),\n ring: tryHexToHsl(obsidian, \"0 0% 9%\"),\n success: tryHexToHsl(terminal, \"133 49% 32%\"),\n successForeground: tryHexToHsl(pure, \"0 0% 100%\"),\n info: tryHexToHsl(charcoal, \"0 0% 30%\"),\n infoForeground: tryHexToHsl(pure, \"0 0% 100%\"),\n };\n}\n\n/** Dark shell monochrome — white CTA on carbon, hairline borders. */\nfunction vercelDarkSemantic(terminal: string): BrandSemanticColors {\n return {\n background: \"0 0% 0%\",\n foreground: \"0 0% 93%\",\n card: \"0 0% 4%\",\n cardForeground: \"0 0% 93%\",\n popover: \"0 0% 4%\",\n popoverForeground: \"0 0% 93%\",\n primary: \"0 0% 100%\",\n primaryForeground: \"0 0% 0%\",\n secondary: \"0 0% 12%\",\n secondaryForeground: \"0 0% 93%\",\n muted: \"0 0% 12%\",\n mutedForeground: \"0 0% 63%\",\n accent: \"0 0% 12%\",\n accentForeground: \"0 0% 93%\",\n destructive: \"0 72% 51%\",\n destructiveForeground: \"0 0% 100%\",\n border: \"0 0% 16%\",\n input: \"0 0% 4%\",\n ring: \"0 0% 100%\",\n success: tryHexToHsl(terminal, \"133 49% 40%\"),\n successForeground: \"0 0% 100%\",\n info: \"0 0% 70%\",\n infoForeground: \"0 0% 0%\",\n };\n}\n\nexport function buildVercel(ctx: CompileContext): BrandPackage {\n const paper = ctx.colors[\"paper-white\"] ?? ctx.colors[\"page-canvas\"] ?? \"#fafafa\";\n const pure = ctx.colors[\"pure-white\"] ?? ctx.colors[\"card-surface\"] ?? \"#ffffff\";\n const hairline = ctx.colors.hairline ?? \"#ebebeb\";\n const charcoal = ctx.colors.charcoal ?? \"#4d4d4d\";\n const stone = ctx.colors.stone ?? \"#666666\";\n const obsidian = ctx.colors.obsidian ?? ctx.colors[\"inverted-surface\"] ?? \"#171717\";\n const carbon = ctx.colors.carbon ?? \"#000000\";\n const terminal = ctx.colors[\"terminal-green\"] ?? \"#297a3a\";\n\n ctx.warnings.push(\n \"Vercel: monochrome dual-mode — no chromatic CTA; Terminal Green is support only.\",\n );\n\n const light = vercelLightSemantic(paper, pure, hairline, charcoal, stone, obsidian, terminal);\n const dark = vercelDarkSemantic(terminal);\n\n const brand: BrandPackage = {\n id: \"vercel\",\n name: \"Vercel\",\n darkDefault: false,\n version: \"1.0.0\",\n semantic: light,\n modes: {\n light: { semantic: light },\n dark: { semantic: dark },\n },\n recipe: buildRecipe({\n buttonDefault: \"solid\",\n radii: {\n button: ctx.recipeHints.radii?.button ?? \"6px\",\n card: \"6px\",\n badge: \"6px\",\n input: \"6px\",\n },\n elevationPreset:\n ctx.recipeHints.elevationPreset === \"key\"\n ? \"hairline\"\n : (ctx.recipeHints.elevationPreset ?? \"hairline\"),\n density: ctx.recipeHints.density ?? \"compact\",\n badgeDefault: \"muted\",\n cardShadow: \"rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgb(250, 250, 250) 0px 0px 0px 1px\",\n outlineBorder: hairline,\n }),\n // Neutral and quick. Geist treats motion as feedback rather than\n // expression, so the ramp is short and the curve is the platform default.\n motion: {\n easeOut: \"cubic-bezier(0, 0, 0.2, 1)\",\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n micro: 100,\n flow: 150,\n reveal: 200,\n cinematic: 300,\n },\n // Geist's default rhythm — the middle of the seven, same figures as the\n // shared fallback rail so a page with no language selected still matches it.\n spacing: {\n xs: \"0.5rem\",\n sm: \"0.75rem\",\n md: \"1rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n \"2xl\": \"3rem\",\n },\n typography: {\n fontSans: `'Geist Sans', 'Geist', ui-sans-serif, system-ui, sans-serif`,\n fontMono: `'Geist Mono', ui-monospace, Menlo, monospace`,\n fontDisplay: `'Geist Sans', 'Geist', ui-sans-serif, system-ui, sans-serif`,\n headingWeight: 450,\n },\n extensions: {\n categories: {\n carbon: carbon,\n terminal: terminal,\n },\n sourceUrl: typeof ctx.refero.url === \"string\" ? ctx.refero.url : \"https://vercel.com\",\n notes: [\n \"Dual-mode monochrome — light: Obsidian CTA; dark: white CTA on carbon.\",\n \"Elevation is hairline double-ring, never drop-shadow.\",\n \"Spectrum/solar gradients are marketing-only decorative (not product chrome).\",\n ],\n },\n };\n return brand;\n}\n","import type { PresetId } from \"../compile-helpers\";\nimport type { BrandPackage } from \"../types\";\nimport type { CompileContext } from \"./context\";\nimport { buildGeneric } from \"./generic\";\nimport { buildGsap } from \"./gsap\";\nimport { buildLinear } from \"./linear\";\nimport { buildNotion } from \"./notion\";\nimport { buildRaycast } from \"./raycast\";\nimport { buildStripe } from \"./stripe\";\nimport { buildVanta } from \"./vanta\";\nimport { buildVercel } from \"./vercel\";\n\nexport type { CompileContext } from \"./context\";\n\nconst PRESET_BUILDERS: Record<\n Exclude<PresetId, \"generic\">,\n (ctx: CompileContext) => BrandPackage\n> = {\n linear: buildLinear,\n gsap: buildGsap,\n raycast: buildRaycast,\n vercel: buildVercel,\n notion: buildNotion,\n stripe: buildStripe,\n vanta: buildVanta,\n};\n\nexport function buildPresetBrand(preset: PresetId, ctx: CompileContext): BrandPackage {\n if (preset === \"generic\") return buildGeneric(ctx);\n return PRESET_BUILDERS[preset](ctx);\n}\n","/**\n * Compile Refero DTCG tokens.json (+ optional DESIGN.md) into a Brand Package.\n *\n * Structure:\n * compile-helpers.ts — detectPreset, color/font leaf helpers\n * presets/* — named fixture builders (linear…notion) + generic\n * compile-refero.ts — orchestration only\n *\n * Named fixtures are stress-test carriers (not mood presets). Prefer extending\n * the generic path + DESIGN.md inference over adding one-off hacks.\n */\n\nimport { collectColors, collectSurfaces, detectPreset, type Json } from \"./compile-helpers\";\nimport { emitBrandCss } from \"./emit-css\";\nimport { inferRecipeFromDesignMd } from \"./infer-recipe\";\nimport { normalizeBrandPackage } from \"./normalize\";\nimport { buildPresetBrand } from \"./presets\";\nimport type { BrandPackage, CompileResult } from \"./types\";\n\nfunction finish(brand: BrandPackage, warnings: string[]): CompileResult {\n const b = normalizeBrandPackage(brand);\n return { brand: b, css: emitBrandCss(b), warnings };\n}\n\n/**\n * Compile a Refero-style DTCG tokens.json (+ optional DESIGN.md text) into a Brand Package.\n * Known fixtures get opinionated recipes; generic brands get solid CTAs.\n */\nexport function compileReferoTokens(input: {\n tokens: Json;\n id?: string;\n name?: string;\n designMd?: string;\n}): CompileResult {\n const warnings: string[] = [];\n const color = (input.tokens.color ?? {}) as Json;\n const surface = (input.tokens.surface ?? {}) as Json;\n const font = (input.tokens.font ?? {}) as Json;\n const radius = (input.tokens.radius ?? {}) as Json;\n const ext = (input.tokens.$extensions ?? {}) as Json;\n const refero = (ext[\"com.refero.extraction\"] ?? {}) as Json;\n\n const colors = { ...collectColors(color), ...collectSurfaces(surface) };\n const siteName =\n (typeof refero.siteName === \"string\" && refero.siteName) || input.name || \"Custom Brand\";\n const id =\n input.id ||\n siteName\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\") ||\n \"custom\";\n\n const preset = detectPreset(id, colors);\n const recipeHints = inferRecipeFromDesignMd(input.designMd ?? \"\");\n\n const brand = buildPresetBrand(preset, {\n colors,\n font,\n radius,\n refero,\n recipeHints,\n warnings,\n id,\n siteName,\n });\n\n return finish(brand, warnings);\n}\n","import { normalizeBrandPackage } from \"./normalize\";\nimport type { BrandPackage, BrandSpacing, ButtonDefaultStyle } from \"./types\";\n\nconst BUTTON_STYLES = new Set<ButtonDefaultStyle>([\"solid\", \"outline\", \"gradient-stroke\"]);\n\nexport interface ValidationResult {\n ok: boolean;\n errors: string[];\n warnings: string[];\n}\n\n/** Validate carrier contract before Create Center publish. */\nexport function validateBrandPackage(brand: unknown): ValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n if (!brand || typeof brand !== \"object\") {\n return { ok: false, errors: [\"Brand package must be an object\"], warnings };\n }\n let b: BrandPackage;\n try {\n b = normalizeBrandPackage(brand as BrandPackage);\n } catch (e) {\n return { ok: false, errors: [`normalize failed: ${(e as Error).message}`], warnings };\n }\n\n if (!b.id || typeof b.id !== \"string\") errors.push(\"id is required\");\n if (!b.name || typeof b.name !== \"string\") errors.push(\"name is required\");\n if (!b.version || typeof b.version !== \"string\") errors.push(\"version is required\");\n\n if (!b.roles) {\n errors.push(\"roles missing after normalize\");\n } else {\n for (const key of [\"canvas\", \"action\", \"actionForeground\", \"border\"] as const) {\n if (!b.roles[key]) errors.push(`roles.${key} is required`);\n }\n if (b.roles.brand && b.roles.brand === b.roles.action) {\n warnings.push(\n \"roles.brand equals roles.action — brand mark is not separated from CTA (often intentional)\",\n );\n }\n }\n\n if (!b.semantic || typeof b.semantic !== \"object\") {\n errors.push(\"semantic is required\");\n } else {\n for (const key of [\n \"background\",\n \"foreground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"ring\",\n ] as const) {\n if (!b.semantic[key]) errors.push(`semantic.${key} is required`);\n }\n // Contract: primary must track action\n if (b.roles && b.semantic.primary !== b.roles.action) {\n errors.push(\"semantic.primary must equal roles.action (CTA bridge)\");\n }\n }\n\n if (!b.recipe || typeof b.recipe !== \"object\") {\n errors.push(\"recipe is required\");\n } else {\n if (!BUTTON_STYLES.has(b.recipe.buttonDefault as ButtonDefaultStyle)) {\n errors.push(`recipe.buttonDefault must be one of ${[...BUTTON_STYLES].join(\", \")}`);\n }\n if (!b.recipe.radii?.button) errors.push(\"recipe.radii.button is required\");\n if (!b.recipe.radii?.card) errors.push(\"recipe.radii.card is required\");\n if (!b.recipe.elevationTokens?.card) {\n errors.push(\"recipe.elevationTokens.card is required (free CSS box-shadow)\");\n }\n if (b.recipe.buttonDefault === \"gradient-stroke\" && !b.recipe.primaryStrokeGradient) {\n warnings.push(\n \"gradient-stroke without primaryStrokeGradient — border falls back to solid primary\",\n );\n }\n }\n if (!b.typography?.fontSans) errors.push(\"typography.fontSans is required\");\n\n if (b.typography?.faces) {\n b.typography.faces.forEach((face, i) => {\n if (!face.family) errors.push(`typography.faces[${i}].family is required`);\n if (!face.src?.length) errors.push(`typography.faces[${i}].src must be non-empty`);\n else {\n for (const [j, src] of face.src.entries()) {\n if (!src.url) errors.push(`typography.faces[${i}].src[${j}].url is required`);\n }\n }\n });\n }\n\n // An elevation value that reads --shadow-* is circular: the theme block maps\n // --shadow-md to var(--elevation-md), so a skin writing\n // `--elevation-md: var(--shadow-md, …)` puts the property in a cycle. CSS\n // then treats it as guaranteed-invalid — the fallback does NOT rescue it,\n // because a fallback only applies to an undefined variable, not a cyclic one.\n // linear shipped exactly this, written back when the skin set the alias\n // rather than the source, and it read as a plausible \"use the Tailwind\n // default\" until the names were corrected.\n for (const [key, value] of Object.entries(b.recipe?.elevationTokens ?? {})) {\n if (typeof value === \"string\" && /var\\(\\s*--(?:shadow|elevation)-/.test(value)) {\n errors.push(\n `recipe.elevationTokens.${key} references a shadow/elevation variable — ` +\n \"that is a cycle once the skin sets the source. Inline the value.\",\n );\n }\n }\n\n if (b.motion) {\n // Durations are milliseconds, and the emitter appends the unit. A package\n // that wrote \"200ms\" here would emit `200msms` — invalid, so the whole\n // declaration is dropped and that language silently keeps the shared timing.\n for (const key of [\"micro\", \"flow\", \"reveal\", \"cinematic\"] as const) {\n const value = b.motion[key];\n if (value == null) continue;\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n errors.push(`motion.${key} must be a non-negative number of milliseconds`);\n } else if (value > 2000) {\n warnings.push(`motion.${key} is ${value}ms — long enough to read as a stall`);\n }\n }\n for (const key of [\"easeOut\", \"easeInOut\", \"easeSpring\"] as const) {\n const value = b.motion[key];\n if (value == null) continue;\n if (typeof value !== \"string\" || !value.trim()) {\n errors.push(`motion.${key} must be a non-empty timing function`);\n }\n }\n const { micro, flow, reveal, cinematic } = b.motion;\n const ramp = [micro, flow, reveal, cinematic].filter((v): v is number => typeof v === \"number\");\n if (ramp.length > 1 && ramp.some((v, i) => i > 0 && v < (ramp[i - 1] ?? v))) {\n warnings.push(\n \"motion durations are not ascending — micro should be the shortest and cinematic the longest\",\n );\n }\n }\n\n if (b.spacing) {\n // Values are full CSS lengths, and the emitter writes them verbatim into a\n // custom property — a bare number (\"16\") is a syntactically valid\n // declaration that Tailwind's spacing utilities then read as unitless and\n // silently treat as 0, so the language quietly loses that step rather than\n // erroring.\n const UNIT = /^-?\\d*\\.?\\d+(rem|em|px|%|vh|vw|ch)$/;\n const order: Array<[keyof BrandSpacing, number]> = [];\n for (const key of [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const) {\n const value = b.spacing[key];\n if (value == null) continue;\n if (typeof value !== \"string\" || !UNIT.test(value.trim())) {\n errors.push(\n `spacing.${key} must be a CSS length with a unit (e.g. \"1rem\"), got ${JSON.stringify(value)}`,\n );\n continue;\n }\n order.push([key, Number.parseFloat(value)]);\n }\n if (order.length > 1 && order.some(([, v], i) => i > 0 && v < (order[i - 1]?.[1] ?? v))) {\n warnings.push(\n \"spacing steps are not ascending — xs should be the smallest and 2xl the largest\",\n );\n }\n }\n\n if (\n b.recipe?.buttonDefault === \"solid\" &&\n b.semantic?.primary === b.semantic?.primaryForeground\n ) {\n warnings.push(\"primary and primaryForeground are identical — check contrast\");\n }\n\n return { ok: errors.length === 0, errors, warnings };\n}\n","\"use client\";\n\nimport { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n type ApplyBrandOptions,\n applyBrandPackage,\n clearBrand,\n getActiveBrandId,\n restorePersistedBrand,\n} from \"./apply-brand\";\nimport { emitBrandCss } from \"./emit-css\";\nimport type { BrandPackage } from \"./types\";\n\nexport interface UseBrandOptions {\n /** Restore from localStorage on mount */\n autoRestore?: boolean;\n /** Persist apply/clear to localStorage */\n persist?: boolean;\n}\n\nexport interface UseBrandResult {\n brand: BrandPackage | null;\n brandId: string | null;\n apply: (brand: BrandPackage) => void;\n clear: () => void;\n restore: () => BrandPackage | null;\n}\n\n/**\n * Create Center / app-level brand state for the host document.\n */\nexport function useBrand(options: UseBrandOptions = {}): UseBrandResult {\n const { autoRestore = false, persist = true } = options;\n const [brand, setBrand] = useState<BrandPackage | null>(null);\n const [brandId, setBrandId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!autoRestore) return;\n const restored = restorePersistedBrand({ persist: false });\n if (restored) {\n setBrand(restored);\n setBrandId(restored.id);\n } else {\n setBrandId(getActiveBrandId());\n }\n }, [autoRestore]);\n\n const apply = useCallback(\n (next: BrandPackage) => {\n applyBrandPackage(next, { persist });\n setBrand(next);\n setBrandId(next.id);\n },\n [persist],\n );\n\n const clear = useCallback(() => {\n clearBrand({ persist });\n setBrand(null);\n setBrandId(null);\n }, [persist]);\n\n const restore = useCallback(() => {\n const restored = restorePersistedBrand({ persist: false });\n if (restored) {\n setBrand(restored);\n setBrandId(restored.id);\n }\n return restored;\n }, []);\n\n return { brand, brandId, apply, clear, restore };\n}\n\nexport interface BrandIframePreviewOptions {\n /**\n * Stylesheets the iframe must load before the brand skin\n * (e.g. app CSS URL that already includes tokens + recipe).\n */\n baseStylesheetHrefs?: string[];\n /** Extra head HTML (fonts CDN, etc.) */\n headHtml?: string;\n /** Minimal body wrapper class */\n bodyClassName?: string;\n /** Called after brand CSS is injected into the iframe */\n onApplied?: (brand: BrandPackage | null) => void;\n}\n\nexport interface UseBrandIframePreviewResult {\n iframeRef: RefObject<HTMLIFrameElement | null>;\n brand: BrandPackage | null;\n /** Write/update brand inside the iframe document */\n apply: (brand: BrandPackage) => void;\n clear: () => void;\n /**\n * Optional: write a self-contained preview document.\n * Use when the iframe has no host app styles yet.\n */\n writePreviewDocument: (brand: BrandPackage, bodyHtml?: string) => void;\n}\n\nfunction ensureIframeDoc(iframe: HTMLIFrameElement | null): Document | null {\n if (!iframe) return null;\n try {\n return iframe.contentDocument;\n } catch {\n return null; // cross-origin\n }\n}\n\nfunction injectBaseStyles(doc: Document, hrefs: string[] | undefined): void {\n if (!hrefs?.length) return;\n for (const href of hrefs) {\n const id = `nebutra-base-${hashHref(href)}`;\n if (doc.getElementById(id)) continue;\n const link = doc.createElement(\"link\");\n link.id = id;\n link.rel = \"stylesheet\";\n link.href = href;\n doc.head.appendChild(link);\n }\n}\n\nfunction hashHref(href: string): string {\n let h = 0;\n for (let i = 0; i < href.length; i++) h = (h * 31 + href.charCodeAt(i)) | 0;\n return Math.abs(h).toString(36);\n}\n\n/**\n * Multi-tenant / Create Center iframe preview.\n * Applies Brand Packages into the iframe's document without touching the host shell.\n */\nexport function useBrandIframePreview(\n options: BrandIframePreviewOptions = {},\n): UseBrandIframePreviewResult {\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const [brand, setBrand] = useState<BrandPackage | null>(null);\n const optsRef = useRef(options);\n optsRef.current = options;\n\n const apply = useCallback((next: BrandPackage) => {\n const doc = ensureIframeDoc(iframeRef.current);\n if (!doc?.documentElement) {\n setBrand(next);\n return;\n }\n injectBaseStyles(doc, optsRef.current.baseStylesheetHrefs);\n applyBrandPackage(next, { doc, persist: false });\n setBrand(next);\n optsRef.current.onApplied?.(next);\n }, []);\n\n const clear = useCallback(() => {\n const doc = ensureIframeDoc(iframeRef.current);\n if (doc) clearBrand({ doc, persist: false });\n setBrand(null);\n optsRef.current.onApplied?.(null);\n }, []);\n\n const writePreviewDocument = useCallback((next: BrandPackage, bodyHtml = \"\") => {\n const iframe = iframeRef.current;\n if (!iframe) return;\n const css = emitBrandCss(next);\n const links = (optsRef.current.baseStylesheetHrefs ?? [])\n .map((href) => `<link rel=\"stylesheet\" href=\"${href}\" />`)\n .join(\"\\n\");\n const html = `<!DOCTYPE html>\n<html lang=\"en\" data-brand=\"${next.id}\" class=\"${next.darkDefault ? \"dark\" : \"\"}\">\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n ${links}\n ${optsRef.current.headHtml ?? \"\"}\n <style id=\"nebutra-brand-skin\">${css}</style>\n <style>\n html, body { margin: 0; min-height: 100%; }\n body {\n font-family: var(--font-sans, system-ui, sans-serif);\n background: hsl(var(--background));\n color: hsl(var(--foreground));\n }\n </style>\n</head>\n<body class=\"${optsRef.current.bodyClassName ?? \"\"} bg-background text-foreground\">\n ${bodyHtml}\n</body>\n</html>`;\n iframe.srcdoc = html;\n setBrand(next);\n optsRef.current.onApplied?.(next);\n }, []);\n\n return { iframeRef, brand, apply, clear, writePreviewDocument };\n}\n\n/** Imperative helper for non-hook call sites */\nexport function applyBrandToIframe(\n iframe: HTMLIFrameElement,\n brand: BrandPackage,\n options: ApplyBrandOptions & { baseStylesheetHrefs?: string[] } = {},\n): void {\n const doc = iframe.contentDocument;\n if (!doc) return;\n injectBaseStyles(doc, options.baseStylesheetHrefs);\n applyBrandPackage(brand, { ...options, doc, persist: false });\n}\n","/**\n * @nebutra/tokens — Runtime theme tokens & theme switching\n *\n * This package is the SINGLE SOURCE OF TRUTH for runtime design tokens.\n *\n * CSS tokens: @import \"@nebutra/tokens/styles.css\"\n * → Brand color scales (--nebutra-blue-*, --nebutra-cyan-*)\n * → 12-step functional scales (--neutral-1..12, --blue-1..12, --cyan-1..12)\n * → Semantic variables (--primary, --background, --border, etc.)\n * → Light/dark mode via :root / .dark\n * → Display-P3 wide gamut with sRGB fallback\n * → Tailwind v4 @theme integration\n *\n * JS exports: ThemeProvider, useTheme, THEME_STORAGE_KEY (custom — no next-themes)\n * → App-level light/dark mode switching\n * → ThemeProvider writes BOTH localStorage AND a cookie of the same name.\n * Server Components read the cookie via `next/headers` cookies() and\n * inject the resolved class directly into <html> — zero inline script,\n * zero React 19 \"script in component\" warning, zero FOUC risk.\n *\n * Related packages:\n * @nebutra/brand → brand primitives (color definitions, motion language)\n * @nebutra/theme → design-language catalog (Brand Package global swap)\n * @nebutra/ui → component library (consumes tokens via CSS variables)\n */\n\nexport {\n THEME_STORAGE_KEY,\n ThemeProvider,\n type ThemeProviderProps,\n useTheme,\n} from \"./theme-provider\";\n\nexport const THEME_IDS = [\"light\", \"dark\"] as const;\nexport type ThemeId = (typeof THEME_IDS)[number];\n\nexport const DEFAULT_THEME: ThemeId = \"dark\";\n\n/** Create Center brand package: carrier contract + runtime apply (server-safe) */\nexport {\n applyBrandCss,\n applyBrandPackage,\n BRAND_STORAGE_KEY,\n type BrandColorRoles,\n type BrandElevationTokens,\n type BrandFontFace,\n type BrandPackage,\n type BrandRadii,\n type BrandRecipe,\n type CompileResult,\n clearBrand,\n compileReferoTokens,\n emitBrandCss,\n getActiveBrandId,\n hexToHslChannels,\n inferRecipeFromDesignMd,\n normalizeBrandPackage,\n restorePersistedBrand,\n rolesFromSemantic,\n semanticFromRoles,\n type ValidationResult,\n validateBrandPackage,\n} from \"./brand-package\";\n\n/** Client-only brand hooks — separate entry so brand-package stays RSC-safe */\nexport {\n applyBrandToIframe,\n type BrandIframePreviewOptions,\n type UseBrandOptions,\n type UseBrandResult,\n useBrand,\n useBrandIframePreview,\n} from \"./brand-package/use-brand\";\n"],"mappings":";AAsBA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsNE;AAjNT,IAAM,SAAS,CAAC,SAAS,QAAQ,QAAQ;AAMlC,IAAM,oBAAoB;AAiBjC,IAAM,eAAe,cAAwC,IAAI;AAM1D,SAAS,WAA8B;AAC5C,QAAM,MAAM,WAAW,YAAY;AACnC,MAAI,IAAK,QAAO;AAChB,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,UAAU,MAAM;AAAA,IAEhB;AAAA,IACA,QAAQ;AAAA,EACV;AACF;AAEA,SAAS,qBAAoC;AAC3C,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,SAAO,OAAO,WAAW,8BAA8B,EAAE,UAAU,SAAS;AAC9E;AAEA,SAAS,gBAAgB,YAAoB,UAAwB;AACnE,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,MAAI;AACF,UAAM,IAAI,OAAO,aAAa,QAAQ,UAAU;AAChD,QAAI,MAAM,WAAW,MAAM,UAAU,MAAM,SAAU,QAAO;AAAA,EAC9D,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAGA,IAAM,uBAAuB,MAAM,KAAK,KAAK;AAS7C,SAAS,iBAAiB,UAAyB,YAAoB;AACrE,MAAI,OAAO,aAAa,YAAa;AACrC,WAAS,SAAS,GAAG,U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,CAAC,SAAS,gCAAgC,IAAI,MAAM,EACxD,KAAK,IAAI;AACZ,UAAM,OAAO;AAAA,8BACa,KAAK,EAAE,YAAY,KAAK,cAAc,SAAS,EAAE;AAAA;AAAA;AAAA;AAAA,IAI3E,KAAK;AAAA,IACL,QAAQ,QAAQ,YAAY,EAAE;AAAA,mCACC,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAUvB,QAAQ,QAAQ,iBAAiB,EAAE;AAAA,IAC9C,QAAQ;AAAA;AAAA;AAGR,WAAO,SAAS;AAChB,aAAS,IAAI;AACb,YAAQ,QAAQ,YAAY,IAAI;AAAA,EAClC,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,WAAW,OAAO,OAAO,OAAO,qBAAqB;AAChE;AAGO,SAAS,mBACd,QACA,OACA,UAAkE,CAAC,GAC7D;AACN,QAAM,MAAM,OAAO;AACnB,MAAI,CAAC,IAAK;AACV,mBAAiB,KAAK,QAAQ,mBAAmB;AACjD,oBAAkB,OAAO,EAAE,GAAG,SAAS,KAAK,SAAS,MAAM,CAAC;AAC9D;;;AC7KO,IAAM,YAAY,CAAC,SAAS,MAAM;AAGlC,IAAM,gBAAyB;","names":["useCallback","useEffect","useState","useState","useEffect","useCallback"]}
@@ -56,7 +56,15 @@ interface BrandColorRoles {
56
56
  muted: HslChannels;
57
57
  mutedForeground: HslChannels;
58
58
  border: HslChannels;
59
- input: HslChannels;
59
+ /**
60
+ * Field stroke. `--input` is consumed only as a border colour (`border-input`
61
+ * on Input, Textarea, Select, Combobox, InputOTP) — never as a fill. Omit it
62
+ * and it derives from `border`, which is what every language wants: six of
63
+ * the seven built-ins had written their own card fill here, producing a field
64
+ * whose outline was the same colour as the surface behind it. Set it only to
65
+ * give fields a stroke that genuinely differs from every other hairline.
66
+ */
67
+ input?: HslChannels;
60
68
  ring: HslChannels;
61
69
  destructive: HslChannels;
62
70
  destructiveForeground: HslChannels;
@@ -107,7 +115,15 @@ interface BrandSemanticColors {
107
115
  destructive: HslChannels;
108
116
  destructiveForeground: HslChannels;
109
117
  border: HslChannels;
110
- input: HslChannels;
118
+ /**
119
+ * Field stroke. `--input` is consumed only as a border colour (`border-input`
120
+ * on Input, Textarea, Select, Combobox, InputOTP) — never as a fill. Omit it
121
+ * and it derives from `border`, which is what every language wants: six of
122
+ * the seven built-ins had written their own card fill here, producing a field
123
+ * whose outline was the same colour as the surface behind it. Set it only to
124
+ * give fields a stroke that genuinely differs from every other hairline.
125
+ */
126
+ input?: HslChannels;
111
127
  ring: HslChannels;
112
128
  success?: HslChannels;
113
129
  successForeground?: HslChannels;
@@ -368,4 +384,4 @@ declare function applyBrandToIframe(iframe: HTMLIFrameElement, brand: BrandPacka
368
384
  baseStylesheetHrefs?: string[];
369
385
  }): void;
370
386
 
371
- export { type ApplyBrandOptions as A, BRAND_STORAGE_KEY as B, type CompileResult as C, type Density as D, type ElevationStyle as E, type CssColor as F, type UseBrandOptions as G, type HslChannels as H, type UseBrandResult as I, type UseBrandIframePreviewResult as U, type BrandColorRoles as a, type BrandElevationTokens as b, type BrandFontFace as c, type BrandPackage as d, type BrandRadii as e, type BrandRecipe as f, applyBrandCss as g, applyBrandPackage as h, applyBrandToIframe as i, clearBrand as j, getActiveBrandId as k, useBrandIframePreview as l, type ButtonDefaultStyle as m, type BrandPackageInput as n, type BrandSemanticColors as o, type BrandModePalette as p, BRAND_STYLE_ELEMENT_ID as q, restorePersistedBrand as r, type BadgeDefaultStyle as s, type BrandExtensions as t, useBrand as u, type BrandFontSource as v, type BrandIframePreviewOptions as w, type BrandModes as x, type BrandRecipeInput as y, type BrandTypography as z };
387
+ export { type ApplyBrandOptions as A, BRAND_STORAGE_KEY as B, type CompileResult as C, type Density as D, type ElevationStyle as E, type BrandTypography as F, type CssColor as G, type HslChannels as H, type UseBrandIframePreviewResult as I, type UseBrandOptions as U, type BrandColorRoles as a, type BrandElevationTokens as b, type BrandFontFace as c, type BrandIframePreviewOptions as d, type BrandPackage as e, type BrandRadii as f, type BrandRecipe as g, type UseBrandResult as h, applyBrandCss as i, applyBrandPackage as j, applyBrandToIframe as k, clearBrand as l, getActiveBrandId as m, useBrandIframePreview as n, type ButtonDefaultStyle as o, type BrandPackageInput as p, type BrandSemanticColors as q, restorePersistedBrand as r, type BrandModePalette as s, BRAND_STYLE_ELEMENT_ID as t, useBrand as u, type BadgeDefaultStyle as v, type BrandExtensions as w, type BrandFontSource as x, type BrandModes as y, type BrandRecipeInput as z };