{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cn",
  "type": "registry:lib",
  "title": "cn — class-name merge utility",
  "description": "@interlace/ui — the cn() helper, alias-compatible with shadcn. Merges Tailwind class lists deterministically.",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "foundation",
    "util"
  ],
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/interlace-ui/lib/cn.ts",
      "target": "lib/utils.ts",
      "type": "registry:lib",
      "content": "import { clsx, type ClassValue } from 'clsx';\n\n// @interlace/cn v1.1.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/cn\n// What changed since: https://ds.interlace.tools/c/cn#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n/**\n * The DS type scale, as declared in `styles/foundation.css`.\n *\n * Tailwind v4 generates a `text-<name>` utility for every `--text-<name>` theme\n * key, which collides head-on with `text-<color>`. tailwind-merge cannot tell\n * them apart from the class name alone — `text-ui` looks exactly like a colour\n * utility — so **with no configuration it files our size tokens under\n * `text-color` and deletes them whenever a real colour utility is also\n * present.**\n *\n * That is not theoretical. `twMerge('text-ui-sm font-medium text-foreground')`\n * returns `'font-medium text-foreground'`: the size is gone. It was shipping in\n * the rendered DOM in at least eight places — ProgressLabel, ProgressValue,\n * ToastTitle, ToastDescription, the CodeBlock header, its copy button, its\n * `<pre>` (which lost `text-code`), and `<Typography variant=\"ui\" tone=\"muted\">`,\n * which lost the size that is the entire point of the variant.\n *\n * Keep this list in sync with `--text-*` in `foundation.css`. A token added\n * there and forgotten here does not error — it silently loses its size at the\n * first `cn()` that also sets a colour, which is the worst possible failure\n * mode, so `__tests__/cn-type-scale-lock.test.ts` asserts the two agree.\n */\nexport const DS_FONT_SIZES = [\n  'h1',\n  'h2',\n  'h3',\n  'h4',\n  'h5',\n  'h6',\n  'body',\n  'long',\n  'ui',\n  'ui-sm',\n  'caption',\n  'code',\n] as const;\n\nconst twMerge = extendTailwindMerge({\n  extend: {\n    classGroups: {\n      // Registering these as font-size means tailwind-merge treats them as\n      // mutually exclusive with each other (`text-ui text-body` → `text-body`,\n      // correct) and orthogonal to colour (`text-ui text-foreground` keeps\n      // both, which is the bug this fixes).\n      'font-size': DS_FONT_SIZES.map((size) => `text-${size}`),\n    },\n  },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n"
    }
  ],
  "meta": {
    "tier": "util",
    "client": false,
    "minViewport": null,
    "loading": false,
    "version": "1.1.0",
    "since": "1.0.0"
  },
  "docs": "## @interlace/cn\n\nInstalled to `lib/utils.ts`.\n\n```tsx\nimport { /* … */ } from '@/lib/utils';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/cn"
}
