@hussmartinez/ui 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +151 -3
- package/dist/react.js +557 -100
- package/dist/react.js.map +1 -1
- package/dist/styles.css +161 -0
- package/dist/ui.d.ts +151 -3
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DENSITY_TOKENS"],"sources":["../src/tokens/base.ts","../src/tokens/contrast.ts","../src/theme/css-value.ts","../src/theme/color.ts","../src/theme/contrast-check.ts","../src/tokens/definitions.ts","../src/tokens/themes.ts","../src/theme/css-writer.ts","../src/theme/create-theme.ts","../src/theme/theme-to-css.ts"],"sourcesContent":["import type { BaseTokenName } from \"./definitions.js\";\n\n/**\n * Values of the base tokens, shared by the built-in light and dark themes.\n * Colours are OKLCH, so each palette's steps are evenly spaced in perceived\n * lightness. Lengths are in rem, so they follow the user's font size.\n */\nexport const baseValues: Readonly<Record<BaseTokenName, string>> = {\n \"gray-50\": \"oklch(0.985 0.008 260)\",\n \"gray-100\": \"oklch(0.965 0.008 260)\",\n \"gray-200\": \"oklch(0.925 0.009 260)\",\n \"gray-300\": \"oklch(0.87 0.011 260)\",\n \"gray-400\": \"oklch(0.78 0.012 260)\",\n \"gray-500\": \"oklch(0.68 0.012 260)\",\n \"gray-600\": \"oklch(0.585 0.012 260)\",\n \"gray-700\": \"oklch(0.5 0.012 260)\",\n \"gray-800\": \"oklch(0.42 0.011 260)\",\n \"gray-900\": \"oklch(0.34 0.01 260)\",\n \"gray-950\": \"oklch(0.26 0.01 260)\",\n \"blue-50\": \"oklch(0.985 0.024 258)\",\n \"blue-100\": \"oklch(0.965 0.05 258)\",\n \"blue-200\": \"oklch(0.925 0.09 258)\",\n \"blue-300\": \"oklch(0.87 0.14 258)\",\n \"blue-400\": \"oklch(0.78 0.18 258)\",\n \"blue-500\": \"oklch(0.68 0.2 258)\",\n \"blue-600\": \"oklch(0.585 0.2 258)\",\n \"blue-700\": \"oklch(0.5 0.184 258)\",\n \"blue-800\": \"oklch(0.42 0.16 258)\",\n \"blue-900\": \"oklch(0.34 0.13 258)\",\n \"blue-950\": \"oklch(0.26 0.1 258)\",\n \"red-50\": \"oklch(0.985 0.025 25)\",\n \"red-100\": \"oklch(0.965 0.052 25)\",\n \"red-200\": \"oklch(0.925 0.095 25)\",\n \"red-300\": \"oklch(0.87 0.147 25)\",\n \"red-400\": \"oklch(0.78 0.189 25)\",\n \"red-500\": \"oklch(0.68 0.21 25)\",\n \"red-600\": \"oklch(0.585 0.21 25)\",\n \"red-700\": \"oklch(0.5 0.193 25)\",\n \"red-800\": \"oklch(0.42 0.168 25)\",\n \"red-900\": \"oklch(0.34 0.137 25)\",\n \"red-950\": \"oklch(0.26 0.105 25)\",\n \"green-50\": \"oklch(0.985 0.02 150)\",\n \"green-100\": \"oklch(0.965 0.043 150)\",\n \"green-200\": \"oklch(0.925 0.077 150)\",\n \"green-300\": \"oklch(0.87 0.119 150)\",\n \"green-400\": \"oklch(0.78 0.153 150)\",\n \"green-500\": \"oklch(0.68 0.17 150)\",\n \"green-600\": \"oklch(0.585 0.17 150)\",\n \"green-700\": \"oklch(0.5 0.156 150)\",\n \"green-800\": \"oklch(0.42 0.136 150)\",\n \"green-900\": \"oklch(0.34 0.111 150)\",\n \"green-950\": \"oklch(0.26 0.085 150)\",\n \"amber-50\": \"oklch(0.985 0.02 70)\",\n \"amber-100\": \"oklch(0.965 0.043 70)\",\n \"amber-200\": \"oklch(0.925 0.077 70)\",\n \"amber-300\": \"oklch(0.87 0.119 70)\",\n \"amber-400\": \"oklch(0.78 0.153 70)\",\n \"amber-500\": \"oklch(0.68 0.17 70)\",\n \"amber-600\": \"oklch(0.585 0.17 70)\",\n \"amber-700\": \"oklch(0.5 0.156 70)\",\n \"amber-800\": \"oklch(0.42 0.136 70)\",\n \"amber-900\": \"oklch(0.34 0.111 70)\",\n \"amber-950\": \"oklch(0.26 0.085 70)\",\n white: \"oklch(1 0 0)\",\n black: \"oklch(0 0 0)\",\n \"space-1\": \"0.25rem\",\n \"space-2\": \"0.5rem\",\n \"space-3\": \"0.75rem\",\n \"space-4\": \"1rem\",\n \"space-5\": \"1.25rem\",\n \"space-6\": \"1.5rem\",\n \"space-7\": \"2rem\",\n \"space-8\": \"2.5rem\",\n \"space-9\": \"3rem\",\n \"space-10\": \"4rem\",\n \"space-11\": \"5rem\",\n \"space-12\": \"6rem\",\n \"radius-none\": \"0\",\n \"radius-sm\": \"0.25rem\",\n \"radius-md\": \"0.375rem\",\n \"radius-lg\": \"0.5rem\",\n \"radius-full\": \"9999px\",\n \"border-width-1\": \"1px\",\n \"border-width-2\": \"2px\",\n \"font-sans\": 'system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n \"font-mono\": 'ui-monospace, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n \"font-size-1\": \"0.75rem\",\n \"font-size-2\": \"0.8125rem\",\n \"font-size-3\": \"0.875rem\",\n \"font-size-4\": \"1rem\",\n \"font-size-5\": \"1.125rem\",\n \"font-size-6\": \"1.25rem\",\n \"font-size-7\": \"1.5rem\",\n \"font-weight-400\": \"400\",\n \"font-weight-500\": \"500\",\n \"font-weight-600\": \"600\",\n \"font-weight-700\": \"700\",\n \"leading-tight\": \"1.25\",\n \"leading-normal\": \"1.5\",\n \"leading-relaxed\": \"1.75\",\n \"duration-fast\": \"100ms\",\n \"duration-normal\": \"200ms\",\n \"duration-slow\": \"300ms\",\n \"easing-standard\": \"cubic-bezier(0.2, 0, 0, 1)\",\n \"easing-decelerate\": \"cubic-bezier(0, 0, 0, 1)\",\n \"easing-accelerate\": \"cubic-bezier(0.3, 0, 1, 1)\",\n};\n","import type { SemanticTokenName } from \"./definitions.js\";\n\n/**\n * A foreground token that must contrast with a background token, and the\n * smallest WCAG 2.2 ratio it needs.\n *\n * @public\n */\nexport interface ContrastPair {\n readonly foreground: SemanticTokenName;\n readonly background: SemanticTokenName;\n /** 4.5 for text (WCAG 1.4.3), 3 for boundaries and focus indicators (WCAG 1.4.11). */\n readonly minimum: 4.5 | 3;\n}\n\nconst TEXT = 4.5;\nconst NON_TEXT = 3;\n\nconst SURFACES = [\"color-bg\", \"color-surface\", \"color-surface-raised\"] as const;\n\n/** Builds the pairs. A function, so importing this module has no side effects. */\nfunction buildPairs(): readonly ContrastPair[] {\n const pairs: ContrastPair[] = [];\n const needs = (\n foreground: SemanticTokenName,\n backgrounds: readonly SemanticTokenName[],\n minimum: 4.5 | 3,\n ): void => {\n for (const background of backgrounds) {\n pairs.push({ foreground, background, minimum });\n }\n };\n\n // Text on every surface.\n needs(\"color-text\", [...SURFACES, \"color-surface-sunken\"], TEXT);\n needs(\"color-text-muted\", SURFACES, TEXT);\n needs(\"color-accent-text\", SURFACES, TEXT);\n needs(\"color-danger-text\", [...SURFACES, \"color-danger-subtle\"], TEXT);\n needs(\"color-warning-text\", [...SURFACES, \"color-warning-subtle\"], TEXT);\n needs(\"color-success-text\", [...SURFACES, \"color-success-subtle\"], TEXT);\n // Text on controls and fills, including their hover and pressed states.\n needs(\"color-text\", [\"color-control\", \"color-control-hover\", \"color-control-active\"], TEXT);\n needs(\"color-text\", [\"color-accent-subtle\"], TEXT);\n needs(\"color-on-accent\", [\"color-accent\", \"color-accent-hover\", \"color-accent-active\"], TEXT);\n needs(\"color-on-danger\", [\"color-danger\", \"color-danger-hover\"], TEXT);\n needs(\"color-on-warning\", [\"color-warning\"], TEXT);\n needs(\"color-on-success\", [\"color-success\"], TEXT);\n // Boundaries and indicators that identify a control or its state.\n needs(\"color-border-strong\", SURFACES, NON_TEXT);\n needs(\"color-accent\", SURFACES, NON_TEXT);\n // The fill of a progress bar against its track.\n needs(\"color-accent\", [\"color-surface-sunken\"], NON_TEXT);\n needs(\"focus-ring-color\", SURFACES, NON_TEXT);\n return Object.freeze(pairs);\n}\n\n/**\n * The colour pairs every theme must meet, as checked by `createTheme` in\n * development and by the tests for the built-in themes.\n *\n * @public\n */\nexport const contrastPairs: readonly ContrastPair[] = /* @__PURE__ */ buildPairs();\n","import type { TokenType } from \"../tokens/definitions.js\";\n\n/**\n * An allowlist parser for token values. Theme values can come from users, for\n * example a brand colour typed into a settings page, and they end up in a\n * `<style>` element. So values aren't escaped: they're parsed into this small\n * tree, anything outside the grammar is rejected, and the CSS is written back\n * from the tree. Characters that could end a declaration, a rule or the\n * `<style>` element (`; { } < > \\ @ !`), comments, `url()` and every other\n * function outside the list below never reach the output.\n */\nexport type CssNode =\n | { readonly kind: \"ident\"; readonly value: string }\n | { readonly kind: \"number\"; readonly value: number; readonly unit: string }\n | { readonly kind: \"hash\"; readonly value: string }\n | { readonly kind: \"string\"; readonly value: string }\n | { readonly kind: \"comma\" }\n | { readonly kind: \"slash\" }\n | { readonly kind: \"operator\"; readonly value: \"+\" | \"-\" | \"*\" }\n | { readonly kind: \"function\"; readonly name: string; readonly args: readonly CssNode[] };\n\n/** A value that parsed, as nodes separated by whitespace at the top level. */\nexport interface ParsedValue {\n readonly nodes: readonly CssNode[];\n /** The value written back from the nodes. */\n readonly css: string;\n}\n\n/** Why a value was rejected, in words for developers. */\nexport class CssValueError extends Error {\n override readonly name = \"CssValueError\";\n}\n\nconst MAX_LENGTH = 1000;\nconst MAX_DEPTH = 8;\n\n/** Joins sets. A function, so importing this module has no side effects. */\nfunction union(...parts: Iterable<string>[]): ReadonlySet<string> {\n return new Set(parts.flatMap((part) => [...part]));\n}\n\nconst COLOR_FUNCTIONS = /* @__PURE__ */ new Set([\n \"rgb\",\n \"rgba\",\n \"hsl\",\n \"hsla\",\n \"hwb\",\n \"lab\",\n \"lch\",\n \"oklab\",\n \"oklch\",\n \"color\",\n \"color-mix\",\n \"light-dark\",\n]);\nconst MATH_FUNCTIONS = /* @__PURE__ */ new Set([\"calc\", \"min\", \"max\", \"clamp\"]);\nconst EASING_FUNCTIONS = /* @__PURE__ */ new Set([\"cubic-bezier\", \"steps\", \"linear\"]);\nconst FUNCTIONS = /* @__PURE__ */ union(COLOR_FUNCTIONS, MATH_FUNCTIONS, EASING_FUNCTIONS, [\"var\"]);\n\nconst LENGTH_UNITS = /* @__PURE__ */ new Set([\n \"px\",\n \"rem\",\n \"em\",\n \"ch\",\n \"ex\",\n \"lh\",\n \"%\",\n \"vw\",\n \"vh\",\n \"vmin\",\n \"vmax\",\n \"cqw\",\n \"cqh\",\n \"cqi\",\n \"cqb\",\n]);\nconst TIME_UNITS = /* @__PURE__ */ new Set([\"ms\", \"s\"]);\nconst NUMBER_UNITS = /* @__PURE__ */ union(LENGTH_UNITS, TIME_UNITS, [\n \"deg\",\n \"turn\",\n \"rad\",\n \"grad\",\n \"\",\n]);\n\n/** Custom properties a value may reference: only the family's own. */\nexport const HM_PROPERTY = /^--hm-[a-z0-9]+(?:-[a-z0-9]+)*$/;\nconst IDENT = /^-?[A-Za-z_][A-Za-z0-9_-]*/;\nconst NUMBER = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?/;\nconst UNIT = /^(?:[A-Za-z]+|%)/;\nconst HASH = /^#[0-9A-Fa-f]+/;\nconst STRING_CONTENT = /^[A-Za-z0-9 _.-]*$/;\n\nclass Parser {\n private index = 0;\n private readonly input: string;\n\n constructor(input: string) {\n this.input = input;\n }\n\n parse(): CssNode[][] {\n const groups = this.sequence(0, false);\n if (this.index < this.input.length) {\n throw new CssValueError(`unexpected \"${this.input.charAt(this.index)}\"`);\n }\n return groups;\n }\n\n /**\n * Parses nodes until the end of the input, or until `)` when inside a\n * function. Returns the nodes grouped by top-level whitespace, so\n * `1px solid red` is three groups and `rgb(0 0 0)` is one.\n */\n private sequence(depth: number, inFunction: boolean): CssNode[][] {\n const groups: CssNode[][] = [];\n let current: CssNode[] = [];\n const flush = (): void => {\n if (current.length > 0) {\n groups.push(current);\n current = [];\n }\n };\n while (this.index < this.input.length) {\n const rest = this.input.slice(this.index);\n const char = rest.charAt(0);\n if (/^\\s/.test(char)) {\n this.index += (/^\\s+/.exec(rest)?.[0] ?? \" \").length;\n flush();\n continue;\n }\n if (char === \")\") {\n if (!inFunction) {\n throw new CssValueError('unbalanced \")\"');\n }\n flush();\n return groups;\n }\n if (char === \",\") {\n flush();\n groups.push([{ kind: \"comma\" }]);\n this.index += 1;\n continue;\n }\n if (char === \"/\") {\n if (rest.startsWith(\"/*\")) {\n throw new CssValueError(\"comments aren't allowed\");\n }\n flush();\n groups.push([{ kind: \"slash\" }]);\n this.index += 1;\n continue;\n }\n if (char === \"*\" || ((char === \"+\" || char === \"-\") && /^[+-]\\s/.test(rest))) {\n if (!inFunction) {\n throw new CssValueError(`\"${char}\" is only allowed inside calc()`);\n }\n flush();\n groups.push([{ kind: \"operator\", value: char as \"+\" | \"-\" | \"*\" }]);\n this.index += 1;\n continue;\n }\n if (char === '\"' || char === \"'\") {\n current.push(this.string(char));\n continue;\n }\n if (char === \"#\") {\n const hash = HASH.exec(rest)?.[0];\n if (!hash || ![4, 5, 7, 9].includes(hash.length)) {\n throw new CssValueError(\"hex colours have 3, 4, 6 or 8 digits\");\n }\n current.push({ kind: \"hash\", value: hash.toLowerCase() });\n this.index += hash.length;\n continue;\n }\n const number = NUMBER.exec(rest)?.[0];\n if (number) {\n this.index += number.length;\n const unit = UNIT.exec(this.input.slice(this.index))?.[0] ?? \"\";\n if (!NUMBER_UNITS.has(unit.toLowerCase())) {\n throw new CssValueError(`the unit \"${unit}\" isn't allowed`);\n }\n this.index += unit.length;\n current.push({ kind: \"number\", value: Number(number), unit: unit.toLowerCase() });\n continue;\n }\n if (rest.startsWith(\"--\")) {\n const name = /^--[A-Za-z0-9_-]*/.exec(rest)?.[0] ?? \"--\";\n if (!HM_PROPERTY.test(name)) {\n throw new CssValueError(`only --hm-* custom properties can be referenced, not \"${name}\"`);\n }\n current.push({ kind: \"ident\", value: name });\n this.index += name.length;\n continue;\n }\n const ident = IDENT.exec(rest)?.[0];\n if (ident) {\n this.index += ident.length;\n if (this.input.charAt(this.index) === \"(\") {\n current.push(this.function(ident.toLowerCase(), depth));\n } else {\n current.push({ kind: \"ident\", value: ident.toLowerCase() });\n }\n continue;\n }\n throw new CssValueError(`the character \"${char}\" isn't allowed`);\n }\n if (inFunction) {\n throw new CssValueError('unbalanced \"(\"');\n }\n flush();\n return groups;\n }\n\n private function(name: string, depth: number): CssNode {\n if (!FUNCTIONS.has(name)) {\n throw new CssValueError(`the function \"${name}()\" isn't allowed`);\n }\n if (depth >= MAX_DEPTH) {\n throw new CssValueError(\"functions are nested too deeply\");\n }\n this.index += 1;\n const args = this.sequence(depth + 1, true).flat();\n this.index += 1;\n if (name === \"var\") {\n const [property, comma] = args;\n if (property?.kind !== \"ident\" || !HM_PROPERTY.test(property.value)) {\n throw new CssValueError(\"var() must name a --hm-* custom property\");\n }\n if (args.length > 1 && comma?.kind !== \"comma\") {\n throw new CssValueError(\"var() takes a property name and an optional fallback\");\n }\n }\n return { kind: \"function\", name, args };\n }\n\n private string(quote: string): CssNode {\n const end = this.input.indexOf(quote, this.index + 1);\n if (end === -1) {\n throw new CssValueError(\"unterminated string\");\n }\n const value = this.input.slice(this.index + 1, end);\n if (!STRING_CONTENT.test(value)) {\n throw new CssValueError(\"strings may only contain letters, digits, spaces, _ . and -\");\n }\n this.index = end + 1;\n return { kind: \"string\", value };\n }\n}\n\nfunction serializeNode(node: CssNode): string {\n switch (node.kind) {\n case \"ident\":\n return node.value;\n case \"number\":\n return `${node.value}${node.unit}`;\n case \"hash\":\n return node.value;\n case \"string\":\n return `\"${node.value}\"`;\n case \"comma\":\n return \",\";\n case \"slash\":\n return \"/\";\n case \"operator\":\n return node.value;\n case \"function\":\n return `${node.name}(${serializeNodes(node.args)})`;\n }\n}\n\n/** Writes nodes back as CSS, with normalised spacing. */\nexport function serializeNodes(nodes: readonly CssNode[]): string {\n let css = \"\";\n nodes.forEach((node, index) => {\n if (node.kind === \"comma\") {\n css += \",\";\n return;\n }\n if (index > 0) {\n css += \" \";\n }\n css += serializeNode(node);\n });\n return css;\n}\n\n/**\n * Parses a token value against the allowlist grammar, without checking its\n * type. Throws {@link CssValueError} when the value isn't allowed.\n */\nexport function parseValue(input: string): ParsedValue {\n if (typeof input !== \"string\") {\n throw new CssValueError(\"values must be strings\");\n }\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new CssValueError(\"the value is empty\");\n }\n if (trimmed.length > MAX_LENGTH) {\n throw new CssValueError(`the value is longer than ${MAX_LENGTH} characters`);\n }\n const nodes = new Parser(trimmed).parse().flat();\n return { nodes, css: serializeNodes(nodes) };\n}\n\nconst isVar = (node: CssNode): boolean => node.kind === \"function\" && node.name === \"var\";\nconst isMath = (node: CssNode): boolean =>\n node.kind === \"function\" && MATH_FUNCTIONS.has(node.name);\n\nfunction isColor(node: CssNode): boolean {\n if (isVar(node) || node.kind === \"hash\") {\n return true;\n }\n if (node.kind === \"function\") {\n return COLOR_FUNCTIONS.has(node.name);\n }\n return (\n node.kind === \"ident\" && [\"transparent\", \"currentcolor\", \"black\", \"white\"].includes(node.value)\n );\n}\n\nfunction isLength(node: CssNode): boolean {\n if (isVar(node) || isMath(node)) {\n return true;\n }\n return (\n node.kind === \"number\" &&\n (LENGTH_UNITS.has(node.unit) || (node.unit === \"\" && node.value === 0))\n );\n}\n\nfunction isPlainNumber(node: CssNode, integer = false): boolean {\n if (isVar(node) || isMath(node)) {\n return true;\n }\n return node.kind === \"number\" && node.unit === \"\" && (!integer || Number.isInteger(node.value));\n}\n\n/** Splits nodes at top-level commas. */\nfunction splitByComma(nodes: readonly CssNode[]): CssNode[][] {\n const lists: CssNode[][] = [[]];\n for (const node of nodes) {\n if (node.kind === \"comma\") {\n lists.push([]);\n } else {\n lists[lists.length - 1]?.push(node);\n }\n }\n return lists;\n}\n\nconst OUTLINE_STYLES = /* @__PURE__ */ new Set([\n \"solid\",\n \"dashed\",\n \"dotted\",\n \"double\",\n \"auto\",\n \"none\",\n]);\nconst EASING_KEYWORDS = /* @__PURE__ */ new Set([\n \"linear\",\n \"ease\",\n \"ease-in\",\n \"ease-out\",\n \"ease-in-out\",\n \"step-start\",\n \"step-end\",\n]);\n\nconst typeCheckers: Record<TokenType, (nodes: readonly CssNode[]) => boolean> = {\n color: (nodes) => nodes.length === 1 && isColor(nodes[0] as CssNode),\n length: (nodes) => nodes.length === 1 && isLength(nodes[0] as CssNode),\n duration: (nodes) => {\n const [node] = nodes;\n return (\n nodes.length === 1 &&\n node !== undefined &&\n (isVar(node) || isMath(node) || (node.kind === \"number\" && TIME_UNITS.has(node.unit)))\n );\n },\n easing: (nodes) => {\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return false;\n }\n if (node.kind === \"ident\") {\n return EASING_KEYWORDS.has(node.value);\n }\n return isVar(node) || (node.kind === \"function\" && EASING_FUNCTIONS.has(node.name));\n },\n number: (nodes) => nodes.length === 1 && isPlainNumber(nodes[0] as CssNode),\n integer: (nodes) => nodes.length === 1 && isPlainNumber(nodes[0] as CssNode, true),\n \"font-weight\": (nodes) => {\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return false;\n }\n if (node.kind === \"ident\") {\n return node.value === \"normal\" || node.value === \"bold\";\n }\n return (\n isVar(node) ||\n (node.kind === \"number\" && node.unit === \"\" && node.value >= 1 && node.value <= 1000)\n );\n },\n \"font-family\": (nodes) =>\n splitByComma(nodes).every(\n (family) =>\n family.length > 0 &&\n (family.every((node) => node.kind === \"ident\") ||\n (family.length === 1 && (family[0]?.kind === \"string\" || isVar(family[0] as CssNode)))),\n ),\n shadow: (nodes) => {\n if (nodes.length === 1 && nodes[0]?.kind === \"ident\" && nodes[0].value === \"none\") {\n return true;\n }\n return splitByComma(nodes).every((layer) => {\n const lengths = layer.filter((node) => isLength(node) && !isVar(node)).length;\n const vars = layer.filter(isVar).length;\n const colors = layer.filter((node) => !isVar(node) && isColor(node)).length;\n const inset = layer.filter((node) => node.kind === \"ident\" && node.value === \"inset\").length;\n return (\n layer.length === lengths + vars + colors + inset &&\n colors <= 1 &&\n inset <= 1 &&\n (vars > 0 || (lengths >= 2 && lengths <= 4))\n );\n });\n },\n outline: (nodes) =>\n nodes.length >= 1 &&\n nodes.length <= 3 &&\n nodes.every(\n (node) =>\n isLength(node) ||\n isColor(node) ||\n (node.kind === \"ident\" && OUTLINE_STYLES.has(node.value)),\n ),\n \"color-scheme\": (nodes) =>\n nodes.length === 1 &&\n nodes[0]?.kind === \"ident\" &&\n (nodes[0].value === \"light\" || nodes[0].value === \"dark\"),\n};\n\n/**\n * Parses a value and checks it against a token type. Returns the CSS written\n * back from the parsed value. Throws {@link CssValueError} when the value\n * isn't allowed or doesn't fit the type.\n */\nexport function validateValue(input: string, type: TokenType | undefined): string {\n const parsed = parseValue(input);\n if (type && !typeCheckers[type](parsed.nodes)) {\n throw new CssValueError(`\"${parsed.css}\" isn't a valid ${type} value`);\n }\n return parsed.css;\n}\n","import { type CssNode, parseValue } from \"./css-value.js\";\n\n/** A colour in sRGB, with channels and alpha from 0 to 1. */\nexport interface Rgba {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n readonly alpha: number;\n}\n\nconst clamp = (value: number): number => Math.min(1, Math.max(0, value));\n\n/** Reads a number or percentage argument; `scale` is what 100% means. */\nfunction channel(node: CssNode | undefined, scale: number): number | undefined {\n if (node?.kind !== \"number\") {\n return undefined;\n }\n if (node.unit === \"%\") {\n return (node.value / 100) * scale;\n }\n return node.unit === \"\" ? node.value : undefined;\n}\n\nfunction hue(node: CssNode | undefined): number | undefined {\n if (node?.kind !== \"number\") {\n return undefined;\n }\n switch (node.unit) {\n case \"\":\n case \"deg\":\n return node.value;\n case \"turn\":\n return node.value * 360;\n case \"rad\":\n return (node.value * 180) / Math.PI;\n case \"grad\":\n return node.value * 0.9;\n default:\n return undefined;\n }\n}\n\n/** Splits `rgb(1 2 3 / 0.5)` or `rgb(1, 2, 3, 0.5)` into channels and alpha. */\nfunction functionArguments(args: readonly CssNode[]): {\n channels: CssNode[];\n alpha: number | undefined;\n} {\n const values = args.filter((node) => node.kind !== \"comma\");\n const slash = values.findIndex((node) => node.kind === \"slash\");\n const channels = slash === -1 ? values.slice(0, 3) : values.slice(0, slash);\n const alphaNode = slash === -1 ? values[3] : values[slash + 1];\n return { channels, alpha: alphaNode ? channel(alphaNode, 1) : 1 };\n}\n\nfunction fromHex(hex: string): Rgba {\n const digits = hex.slice(1);\n const full = digits.length <= 4 ? [...digits].map((digit) => digit + digit).join(\"\") : digits;\n const byte = (index: number): number => Number.parseInt(full.slice(index, index + 2), 16) / 255;\n return { r: byte(0), g: byte(2), b: byte(4), alpha: full.length === 8 ? byte(6) : 1 };\n}\n\nfunction fromHsl(h: number, s: number, l: number, alpha: number): Rgba {\n const f = (n: number): number => {\n const k = (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n };\n return { r: f(0), g: f(8), b: f(4), alpha };\n}\n\nconst toGamma = (linear: number): number =>\n linear <= 0.0031308 ? 12.92 * linear : 1.055 * linear ** (1 / 2.4) - 0.055;\nconst toLinear = (gamma: number): number =>\n gamma <= 0.04045 ? gamma / 12.92 : ((gamma + 0.055) / 1.055) ** 2.4;\n\n/** OKLab to sRGB, clipped to the sRGB gamut. */\nfunction fromOklab(l: number, a: number, b: number, alpha: number): Rgba {\n const l_ = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;\n const m_ = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;\n const s_ = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;\n return {\n r: toGamma(clamp(4.0767416621 * l_ - 3.3077115913 * m_ + 0.2309699292 * s_)),\n g: toGamma(clamp(-1.2684380046 * l_ + 2.6097574011 * m_ - 0.3413193965 * s_)),\n b: toGamma(clamp(-0.0041960863 * l_ - 0.7034186147 * m_ + 1.707614701 * s_)),\n alpha,\n };\n}\n\nfunction fromFunction(name: string, args: readonly CssNode[]): Rgba | undefined {\n const { channels, alpha } = functionArguments(args);\n if (alpha === undefined || channels.length !== 3) {\n return undefined;\n }\n const [first, second, third] = channels;\n switch (name) {\n case \"rgb\":\n case \"rgba\": {\n const [r, g, b] = [first, second, third].map((node) => channel(node, 255));\n if (r === undefined || g === undefined || b === undefined) {\n return undefined;\n }\n return { r: clamp(r / 255), g: clamp(g / 255), b: clamp(b / 255), alpha: clamp(alpha) };\n }\n case \"hsl\":\n case \"hsla\": {\n const h = hue(first);\n const s = channel(second, 100);\n const l = channel(third, 100);\n if (h === undefined || s === undefined || l === undefined) {\n return undefined;\n }\n return fromHsl(((h % 360) + 360) % 360, clamp(s / 100), clamp(l / 100), clamp(alpha));\n }\n case \"oklch\": {\n const l = channel(first, 1);\n const c = channel(second, 0.4);\n const h = hue(third);\n if (l === undefined || c === undefined || h === undefined) {\n return undefined;\n }\n const radians = (h * Math.PI) / 180;\n return fromOklab(l, c * Math.cos(radians), c * Math.sin(radians), clamp(alpha));\n }\n case \"oklab\": {\n const l = channel(first, 1);\n const a = channel(second, 0.4);\n const b = channel(third, 0.4);\n if (l === undefined || a === undefined || b === undefined) {\n return undefined;\n }\n return fromOklab(l, a, b, clamp(alpha));\n }\n default:\n return undefined;\n }\n}\n\n/**\n * Resolves a colour value to sRGB. `lookup` returns the value of another\n * token, for `var(--hm-…)` references. Returns `undefined` when the colour\n * can't be computed statically, such as `color-mix()` or a reference to a\n * token outside the theme.\n */\nexport function resolveColor(\n value: string,\n lookup: (token: string) => string | undefined,\n depth = 0,\n): Rgba | undefined {\n if (depth > 16) {\n return undefined;\n }\n let nodes: readonly CssNode[];\n try {\n nodes = parseValue(value).nodes;\n } catch {\n return undefined;\n }\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return undefined;\n }\n switch (node.kind) {\n case \"hash\":\n return fromHex(node.value);\n case \"ident\":\n return node.value === \"white\"\n ? { r: 1, g: 1, b: 1, alpha: 1 }\n : node.value === \"black\"\n ? { r: 0, g: 0, b: 0, alpha: 1 }\n : undefined;\n case \"function\": {\n if (node.name === \"var\") {\n const [property] = node.args;\n const referenced =\n property?.kind === \"ident\" ? lookup(property.value.slice(\"--hm-\".length)) : undefined;\n return referenced === undefined ? undefined : resolveColor(referenced, lookup, depth + 1);\n }\n return fromFunction(node.name, node.args);\n }\n default:\n return undefined;\n }\n}\n\n/** Composites a translucent colour over an opaque one, as browsers do. */\nfunction composite(top: Rgba, bottom: Rgba): Rgba {\n const mix = (a: number, b: number): number => a * top.alpha + b * (1 - top.alpha);\n return { r: mix(top.r, bottom.r), g: mix(top.g, bottom.g), b: mix(top.b, bottom.b), alpha: 1 };\n}\n\n/** WCAG 2.x relative luminance of an opaque sRGB colour. */\nexport function relativeLuminance(color: Rgba): number {\n return 0.2126 * toLinear(color.r) + 0.7152 * toLinear(color.g) + 0.0722 * toLinear(color.b);\n}\n\n/**\n * The WCAG 2.x contrast ratio of a foreground over a background, from 1 to 21.\n * A translucent foreground is composited over the background first. Returns\n * `undefined` for a translucent background, whose contrast depends on what's\n * behind it.\n */\nexport function contrastRatio(foreground: Rgba, background: Rgba): number | undefined {\n if (background.alpha < 1) {\n return undefined;\n }\n const front = foreground.alpha < 1 ? composite(foreground, background) : foreground;\n const lighter = Math.max(relativeLuminance(front), relativeLuminance(background));\n const darker = Math.min(relativeLuminance(front), relativeLuminance(background));\n return (lighter + 0.05) / (darker + 0.05);\n}\n","import { baseValues } from \"../tokens/base.js\";\nimport { contrastPairs } from \"../tokens/contrast.js\";\nimport { contrastRatio, resolveColor } from \"./color.js\";\nimport type { Theme } from \"./types.js\";\n\n/**\n * Result of checking a theme's colour pairs against WCAG 2.2 AA.\n *\n * @public\n */\nexport interface ContrastReport {\n /** Pairs below their minimum ratio, with the ratio they have. */\n readonly failures: readonly {\n readonly foreground: string;\n readonly background: string;\n readonly ratio: number;\n readonly minimum: number;\n }[];\n /**\n * Pairs that couldn't be checked, because a colour can't be computed\n * without a browser, such as `color-mix()`, or its background is translucent.\n */\n readonly unchecked: readonly { readonly foreground: string; readonly background: string }[];\n}\n\n/**\n * Checks a theme's text, boundary and focus colours against WCAG 2.2 AA\n * contrast. References to base tokens the theme doesn't set resolve to the\n * built-in values, as they do on the page.\n *\n * @public\n */\nexport function checkContrast(theme: Theme): ContrastReport {\n const lookup = (token: string): string | undefined =>\n theme.tokens[token] ?? (baseValues as Record<string, string>)[token];\n const failures: ContrastReport[\"failures\"][number][] = [];\n const unchecked: ContrastReport[\"unchecked\"][number][] = [];\n for (const { foreground, background, minimum } of contrastPairs) {\n const front = lookup(foreground);\n const back = lookup(background);\n const frontColor = front === undefined ? undefined : resolveColor(front, lookup);\n const backColor = back === undefined ? undefined : resolveColor(back, lookup);\n const ratio = frontColor && backColor ? contrastRatio(frontColor, backColor) : undefined;\n if (ratio === undefined) {\n unchecked.push({ foreground, background });\n } else if (ratio < minimum) {\n failures.push({ foreground, background, ratio: Math.round(ratio * 100) / 100, minimum });\n }\n }\n return { failures, unchecked };\n}\n","/**\n * The token definitions: every token's name, level, category, value type and\n * purpose. This is the single source the CSS, the types and the token\n * reference are generated from (ADR 0006).\n */\n\n/**\n * The value types a token can have. Each type has its own grammar, which\n * {@link createTheme} checks values against.\n *\n * @public\n */\nexport type TokenType =\n | \"color\"\n | \"length\"\n | \"duration\"\n | \"easing\"\n | \"number\"\n | \"integer\"\n | \"font-family\"\n | \"font-weight\"\n | \"shadow\"\n | \"outline\"\n | \"color-scheme\";\n\n/**\n * What a token is for, used to group the token reference.\n *\n * @public\n */\nexport type TokenCategory =\n | \"color\"\n | \"typography\"\n | \"space\"\n | \"size\"\n | \"shape\"\n | \"shadow\"\n | \"motion\"\n | \"z-index\"\n | \"opacity\"\n | \"focus\";\n\n/**\n * Base tokens are raw scales that only other tokens use. Semantic tokens name\n * a purpose, and are what components use (ADR 0006).\n *\n * @public\n */\nexport type TokenLevel = \"base\" | \"semantic\" | \"component\";\n\n/**\n * What a token is, for tooling: its name, level, category and value type.\n * What each token is for is documented in the token reference,\n * `docs/tokens.md`, rather than shipped to applications (docs/adr/0001).\n *\n * @public\n */\nexport interface TokenDefinition {\n /** The name without the `--hm-` prefix, such as `color-accent`. */\n readonly name: string;\n /** Base, semantic or component (ADR 0006). */\n readonly level: TokenLevel;\n /** What the token styles, used to group the token reference. */\n readonly category: TokenCategory;\n /** The grammar its values must follow. */\n readonly type: TokenType;\n /**\n * Whether density changes the token. Density tokens are set by\n * `data-hm-density`, not by the colour mode.\n */\n readonly density: boolean;\n /**\n * For component tokens, the semantic token they fall back to. `ui` never\n * declares component tokens; components read them as\n * `var(--hm-<name>, var(--hm-<fallback>))`, so a theme or host can set them\n * on any ancestor (docs/adr/0001).\n */\n readonly fallback?: SemanticTokenName;\n}\n\n/** The hues of the base colour palettes. */\nexport const HUES = [\"gray\", \"blue\", \"red\", \"green\", \"amber\"] as const;\n/** The steps of every base colour palette, from lightest to darkest. */\nexport const STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;\n\n/**\n * The names of the base tokens: the raw colour, space, radius, border, type\n * and motion scales.\n *\n * @public\n */\nexport type BaseTokenName =\n | `${\"gray\" | \"blue\" | \"red\" | \"green\" | \"amber\"}-${50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950}`\n | \"white\"\n | \"black\"\n | `space-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`\n | \"radius-none\"\n | \"radius-sm\"\n | \"radius-md\"\n | \"radius-lg\"\n | \"radius-full\"\n | \"border-width-1\"\n | \"border-width-2\"\n | \"font-sans\"\n | \"font-mono\"\n | `font-size-${1 | 2 | 3 | 4 | 5 | 6 | 7}`\n | \"font-weight-400\"\n | \"font-weight-500\"\n | \"font-weight-600\"\n | \"font-weight-700\"\n | \"leading-tight\"\n | \"leading-normal\"\n | \"leading-relaxed\"\n | \"duration-fast\"\n | \"duration-normal\"\n | \"duration-slow\"\n | \"easing-standard\"\n | \"easing-decelerate\"\n | \"easing-accelerate\";\n\n/**\n * The names of the semantic tokens, which components use.\n *\n * @public\n */\nexport type SemanticTokenName =\n | \"color-scheme\"\n | \"color-bg\"\n | \"color-surface\"\n | \"color-surface-raised\"\n | \"color-surface-sunken\"\n | \"color-overlay\"\n | \"color-text\"\n | \"color-text-muted\"\n | \"color-text-disabled\"\n | \"color-border\"\n | \"color-border-strong\"\n | \"color-control\"\n | \"color-control-hover\"\n | \"color-control-active\"\n | \"color-accent\"\n | \"color-accent-hover\"\n | \"color-accent-active\"\n | \"color-on-accent\"\n | \"color-accent-subtle\"\n | \"color-accent-text\"\n | \"color-danger\"\n | \"color-danger-hover\"\n | \"color-on-danger\"\n | \"color-danger-subtle\"\n | \"color-danger-text\"\n | \"color-warning\"\n | \"color-on-warning\"\n | \"color-warning-subtle\"\n | \"color-warning-text\"\n | \"color-success\"\n | \"color-on-success\"\n | \"color-success-subtle\"\n | \"color-success-text\"\n | \"focus-ring-color\"\n | \"focus-ring-width\"\n | \"focus-ring-offset\"\n | \"focus-ring\"\n | \"font-family\"\n | \"font-family-mono\"\n | \"font-size-small\"\n | \"font-size-body\"\n | \"font-size-title\"\n | \"font-weight-regular\"\n | \"font-weight-strong\"\n | \"line-height-body\"\n | \"line-height-tight\"\n | \"letter-spacing\"\n | \"control-height\"\n | \"control-height-small\"\n | \"control-padding-x\"\n | \"control-gap\"\n | \"icon-size\"\n | \"target-size\"\n | \"gap-tight\"\n | \"gap-normal\"\n | \"gap-loose\"\n | \"inset-tight\"\n | \"inset-normal\"\n | \"inset-loose\"\n | \"surface-width-small\"\n | \"surface-width-medium\"\n | \"surface-width-large\"\n | \"track-size\"\n | \"radius-control\"\n | \"radius-surface\"\n | \"radius-round\"\n | \"border-width\"\n | \"shadow-raised\"\n | \"shadow-overlay\"\n | \"motion-duration-feedback\"\n | \"motion-duration-enter\"\n | \"motion-duration-exit\"\n | \"motion-easing-standard\"\n | \"motion-easing-enter\"\n | \"motion-easing-exit\"\n | \"motion-duration-loop\"\n | \"motion-easing-loop\"\n | \"z-raised\"\n | \"z-sticky\"\n | \"z-overlay\"\n | \"opacity-disabled\";\n\n/**\n * The semantic tokens that density changes: control sizes, gaps and insets.\n *\n * @public\n */\nexport type DensityTokenName =\n | \"control-height\"\n | \"control-height-small\"\n | \"control-padding-x\"\n | \"control-gap\"\n | \"icon-size\"\n | \"target-size\"\n | \"gap-tight\"\n | \"gap-normal\"\n | \"gap-loose\"\n | \"inset-tight\"\n | \"inset-normal\"\n | \"inset-loose\";\n\ntype SemanticSpec = {\n readonly category: TokenCategory;\n readonly type: TokenType;\n readonly density?: true;\n};\n\nconst semantic = {\n \"color-scheme\": {\n category: \"color\",\n type: \"color-scheme\",\n },\n \"color-bg\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface-raised\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface-sunken\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-overlay\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-text\": { category: \"color\", type: \"color\" },\n \"color-text-muted\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-text-disabled\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-border\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-border-strong\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control-active\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-active\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-on-accent\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-on-danger\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning\": { category: \"color\", type: \"color\" },\n \"color-on-warning\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success\": { category: \"color\", type: \"color\" },\n \"color-on-success\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"focus-ring-color\": {\n category: \"focus\",\n type: \"color\",\n },\n \"focus-ring-width\": {\n category: \"focus\",\n type: \"length\",\n },\n \"focus-ring-offset\": {\n category: \"focus\",\n type: \"length\",\n },\n \"focus-ring\": {\n category: \"focus\",\n type: \"outline\",\n },\n \"font-family\": {\n category: \"typography\",\n type: \"font-family\",\n },\n \"font-family-mono\": {\n category: \"typography\",\n type: \"font-family\",\n },\n \"font-size-small\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-size-body\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-size-title\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-weight-regular\": {\n category: \"typography\",\n type: \"font-weight\",\n },\n \"font-weight-strong\": {\n category: \"typography\",\n type: \"font-weight\",\n },\n \"line-height-body\": {\n category: \"typography\",\n type: \"number\",\n },\n \"line-height-tight\": {\n category: \"typography\",\n type: \"number\",\n },\n \"letter-spacing\": {\n category: \"typography\",\n type: \"length\",\n },\n \"control-height\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"control-height-small\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"control-padding-x\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"control-gap\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"icon-size\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"target-size\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"gap-tight\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"gap-normal\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"gap-loose\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-tight\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-normal\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-loose\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"surface-width-small\": { category: \"size\", type: \"length\" },\n \"surface-width-medium\": { category: \"size\", type: \"length\" },\n \"surface-width-large\": { category: \"size\", type: \"length\" },\n \"track-size\": { category: \"size\", type: \"length\" },\n \"radius-control\": {\n category: \"shape\",\n type: \"length\",\n },\n \"radius-surface\": {\n category: \"shape\",\n type: \"length\",\n },\n \"radius-round\": {\n category: \"shape\",\n type: \"length\",\n },\n \"border-width\": { category: \"shape\", type: \"length\" },\n \"shadow-raised\": {\n category: \"shadow\",\n type: \"shadow\",\n },\n \"shadow-overlay\": {\n category: \"shadow\",\n type: \"shadow\",\n },\n \"motion-duration-feedback\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-duration-enter\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-duration-exit\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-easing-standard\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-easing-enter\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-easing-exit\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-duration-loop\": { category: \"motion\", type: \"duration\" },\n \"motion-easing-loop\": { category: \"motion\", type: \"easing\" },\n \"z-raised\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"z-sticky\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"z-overlay\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"opacity-disabled\": {\n category: \"opacity\",\n type: \"number\",\n },\n} as const satisfies Record<SemanticTokenName, SemanticSpec>;\n\n// The unions above are written out so the API reads plainly; these checks keep\n// them in step with the definitions.\ntype Exact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype Assert<T extends true> = T;\ntype DensityKeys<T> = { [K in keyof T]: T[K] extends { density: true } ? K : never }[keyof T];\nexport type NamesMatch = Assert<Exact<SemanticTokenName, keyof typeof semantic>>;\nexport type DensityMatches = Assert<Exact<DensityTokenName, DensityKeys<typeof semantic>>>;\nexport type ComponentNamesMatch = Assert<Exact<ComponentTokenName, keyof typeof component>>;\n\n/**\n * The name of any token `@hussmartinez/ui` defines.\n *\n * @public\n */\nexport type TokenName = BaseTokenName | SemanticTokenName | ComponentTokenName;\n\n/**\n * The names of `ui`'s component tokens: fine-grained overrides for one\n * component, each falling back to a semantic token.\n *\n * @public\n */\nexport type ComponentTokenName =\n | \"button-height\"\n | \"button-small-height\"\n | \"button-padding-x\"\n | \"button-gap\"\n | \"button-icon-size\"\n | \"button-radius\"\n | \"button-font-weight\"\n | \"button-bg\"\n | \"button-bg-hover\"\n | \"button-bg-active\"\n | \"button-fg\"\n | \"button-border-color\"\n | \"button-primary-bg\"\n | \"button-primary-bg-hover\"\n | \"button-primary-bg-active\"\n | \"button-primary-fg\"\n | \"button-quiet-bg-hover\"\n | \"button-quiet-bg-active\"\n | \"button-danger-bg\"\n | \"button-danger-bg-hover\"\n | \"button-danger-fg\"\n | \"button-pressed-bg\"\n | \"button-pressed-border-color\"\n | \"button-pressed-fg\"\n | \"toolbar-bg\"\n | \"toolbar-border-color\"\n | \"toolbar-radius\"\n | \"toolbar-padding\"\n | \"toolbar-gap\"\n | \"toolbar-group-gap\"\n | \"toolbar-separator-color\"\n | \"segmented-control-height\"\n | \"segmented-control-small-height\"\n | \"segmented-control-padding\"\n | \"segmented-control-gap\"\n | \"segmented-control-radius\"\n | \"segmented-control-bg\"\n | \"segmented-control-border-color\"\n | \"segmented-control-option-padding-x\"\n | \"segmented-control-option-fg\"\n | \"segmented-control-option-bg-hover\"\n | \"segmented-control-option-checked-bg\"\n | \"segmented-control-option-checked-fg\"\n | \"segmented-control-option-checked-border-color\"\n | \"dialog-bg\"\n | \"dialog-fg\"\n | \"dialog-border-color\"\n | \"dialog-radius\"\n | \"dialog-shadow\"\n | \"dialog-padding\"\n | \"dialog-gap\"\n | \"dialog-backdrop\"\n | \"dialog-title-font-size\"\n | \"dialog-small-width\"\n | \"dialog-width\"\n | \"dialog-large-width\"\n | \"spinner-size\"\n | \"spinner-thickness\"\n | \"spinner-color\"\n | \"spinner-track-color\"\n | \"spinner-duration\"\n | \"progress-height\"\n | \"progress-radius\"\n | \"progress-track-color\"\n | \"progress-fill-color\"\n | \"progress-duration\"\n | \"slider-track-size\"\n | \"slider-track-color\"\n | \"slider-radius\"\n | \"slider-thumb-size\"\n | \"slider-thumb-color\"\n | \"slider-thumb-color-hover\"\n | \"slider-thumb-color-active\"\n | \"field-gap\"\n | \"field-label-fg\"\n | \"field-label-font-weight\"\n | \"field-description-fg\"\n | \"field-error-fg\"\n | \"field-message-font-size\"\n | \"number-field-height\"\n | \"number-field-padding-x\"\n | \"number-field-radius\"\n | \"number-field-bg\"\n | \"number-field-fg\"\n | \"number-field-border-color\"\n | \"number-field-invalid-border-color\"\n | \"file-drop-zone-gap\"\n | \"file-drop-zone-padding\"\n | \"file-drop-zone-radius\"\n | \"file-drop-zone-border-color\"\n | \"file-drop-zone-dragging-border-color\"\n | \"file-drop-zone-dragging-bg\"\n | \"file-drop-zone-hint-fg\"\n | \"tooltip-bg\"\n | \"tooltip-fg\"\n | \"tooltip-radius\"\n | \"tooltip-padding\"\n | \"tooltip-font-size\"\n | \"tooltip-shadow\"\n | \"tooltip-max-width\"\n | \"tooltip-offset\"\n | \"text-field-height\"\n | \"text-field-padding-x\"\n | \"text-field-radius\"\n | \"text-field-bg\"\n | \"text-field-fg\"\n | \"text-field-placeholder-fg\"\n | \"text-field-border-color\"\n | \"text-field-invalid-border-color\"\n | \"text-area-padding-y\"\n | \"reorderable-list-gap\"\n | \"reorderable-list-row-height\"\n | \"reorderable-list-row-padding-x\"\n | \"reorderable-list-row-radius\"\n | \"reorderable-list-row-fg\"\n | \"reorderable-list-row-bg-hover\"\n | \"reorderable-list-row-selected-bg\"\n | \"reorderable-list-row-selected-border-color\"\n | \"timeline-track-bg\"\n | \"timeline-track-radius\"\n | \"timeline-lane-height\"\n | \"timeline-playhead-color\"\n | \"timeline-clip-bg\"\n | \"timeline-clip-fg\"\n | \"timeline-clip-border-color\"\n | \"timeline-clip-radius\"\n | \"timeline-clip-padding-x\"\n | \"timeline-clip-selected-bg\"\n | \"timeline-clip-selected-border-color\"\n | \"timeline-clip-edge-size\"\n | \"color-field-gap\"\n | \"color-field-swatch-size\"\n | \"color-field-swatch-radius\"\n | \"color-field-swatch-border-color\"\n | \"color-field-swatch-checked-border-color\";\n\ntype ComponentSpec = { readonly fallback: SemanticTokenName };\n\nconst component = {\n \"button-height\": { fallback: \"control-height\" },\n \"button-small-height\": {\n fallback: \"control-height-small\",\n },\n \"button-padding-x\": { fallback: \"control-padding-x\" },\n \"button-gap\": { fallback: \"control-gap\" },\n \"button-icon-size\": { fallback: \"icon-size\" },\n \"button-radius\": { fallback: \"radius-control\" },\n \"button-font-weight\": {\n fallback: \"font-weight-strong\",\n },\n \"button-bg\": { fallback: \"color-control\" },\n \"button-bg-hover\": {\n fallback: \"color-control-hover\",\n },\n \"button-bg-active\": {\n fallback: \"color-control-active\",\n },\n \"button-fg\": { fallback: \"color-text\" },\n \"button-border-color\": {\n fallback: \"color-border-strong\",\n },\n \"button-primary-bg\": { fallback: \"color-accent\" },\n \"button-primary-bg-hover\": {\n fallback: \"color-accent-hover\",\n },\n \"button-primary-bg-active\": {\n fallback: \"color-accent-active\",\n },\n \"button-primary-fg\": { fallback: \"color-on-accent\" },\n \"button-quiet-bg-hover\": {\n fallback: \"color-control-hover\",\n },\n \"button-quiet-bg-active\": {\n fallback: \"color-control-active\",\n },\n \"button-danger-bg\": { fallback: \"color-danger\" },\n \"button-danger-bg-hover\": {\n fallback: \"color-danger-hover\",\n },\n \"button-danger-fg\": { fallback: \"color-on-danger\" },\n \"button-pressed-bg\": {\n fallback: \"color-accent-subtle\",\n },\n \"button-pressed-border-color\": {\n fallback: \"color-accent\",\n },\n \"button-pressed-fg\": {\n fallback: \"color-text\",\n },\n \"toolbar-bg\": { fallback: \"color-surface\" },\n \"toolbar-border-color\": { fallback: \"color-border\" },\n \"toolbar-radius\": { fallback: \"radius-surface\" },\n \"toolbar-padding\": { fallback: \"inset-tight\" },\n \"toolbar-gap\": { fallback: \"gap-tight\" },\n \"toolbar-group-gap\": { fallback: \"gap-tight\" },\n \"toolbar-separator-color\": { fallback: \"color-border\" },\n \"segmented-control-height\": { fallback: \"control-height\" },\n \"segmented-control-small-height\": { fallback: \"control-height-small\" },\n \"segmented-control-padding\": { fallback: \"gap-tight\" },\n \"segmented-control-gap\": { fallback: \"gap-tight\" },\n \"segmented-control-radius\": { fallback: \"radius-control\" },\n \"segmented-control-bg\": { fallback: \"color-surface-sunken\" },\n \"segmented-control-border-color\": { fallback: \"color-border-strong\" },\n \"segmented-control-option-padding-x\": { fallback: \"control-padding-x\" },\n \"segmented-control-option-fg\": { fallback: \"color-text\" },\n \"segmented-control-option-bg-hover\": { fallback: \"color-control-hover\" },\n \"segmented-control-option-checked-bg\": { fallback: \"color-surface-raised\" },\n \"segmented-control-option-checked-fg\": { fallback: \"color-text\" },\n \"segmented-control-option-checked-border-color\": { fallback: \"color-border-strong\" },\n \"dialog-bg\": { fallback: \"color-surface-raised\" },\n \"dialog-fg\": { fallback: \"color-text\" },\n \"dialog-border-color\": { fallback: \"color-border\" },\n \"dialog-radius\": { fallback: \"radius-surface\" },\n \"dialog-shadow\": { fallback: \"shadow-overlay\" },\n \"dialog-padding\": { fallback: \"inset-loose\" },\n \"dialog-gap\": { fallback: \"gap-loose\" },\n \"dialog-backdrop\": { fallback: \"color-overlay\" },\n \"dialog-title-font-size\": { fallback: \"font-size-title\" },\n \"dialog-small-width\": { fallback: \"surface-width-small\" },\n \"dialog-width\": { fallback: \"surface-width-medium\" },\n \"dialog-large-width\": { fallback: \"surface-width-large\" },\n \"spinner-size\": { fallback: \"icon-size\" },\n \"spinner-thickness\": { fallback: \"focus-ring-width\" },\n \"spinner-color\": { fallback: \"color-accent\" },\n \"spinner-track-color\": { fallback: \"color-border\" },\n \"spinner-duration\": { fallback: \"motion-duration-loop\" },\n \"progress-height\": { fallback: \"track-size\" },\n \"progress-radius\": { fallback: \"radius-round\" },\n \"progress-track-color\": { fallback: \"color-surface-sunken\" },\n \"progress-fill-color\": { fallback: \"color-accent\" },\n \"progress-duration\": { fallback: \"motion-duration-loop\" },\n \"slider-track-size\": { fallback: \"track-size\" },\n \"slider-track-color\": { fallback: \"color-border-strong\" },\n \"slider-radius\": { fallback: \"radius-round\" },\n \"slider-thumb-size\": { fallback: \"icon-size\" },\n \"slider-thumb-color\": { fallback: \"color-accent\" },\n \"slider-thumb-color-hover\": { fallback: \"color-accent-hover\" },\n \"slider-thumb-color-active\": { fallback: \"color-accent-active\" },\n \"field-gap\": { fallback: \"gap-tight\" },\n \"field-label-fg\": { fallback: \"color-text\" },\n \"field-label-font-weight\": { fallback: \"font-weight-strong\" },\n \"field-description-fg\": { fallback: \"color-text-muted\" },\n \"field-error-fg\": { fallback: \"color-danger-text\" },\n \"field-message-font-size\": { fallback: \"font-size-small\" },\n \"number-field-height\": { fallback: \"control-height\" },\n \"number-field-padding-x\": { fallback: \"control-padding-x\" },\n \"number-field-radius\": { fallback: \"radius-control\" },\n \"number-field-bg\": { fallback: \"color-surface\" },\n \"number-field-fg\": { fallback: \"color-text\" },\n \"number-field-border-color\": { fallback: \"color-border-strong\" },\n \"number-field-invalid-border-color\": { fallback: \"color-danger-text\" },\n \"file-drop-zone-gap\": { fallback: \"gap-normal\" },\n \"file-drop-zone-padding\": { fallback: \"inset-loose\" },\n \"file-drop-zone-radius\": { fallback: \"radius-surface\" },\n \"file-drop-zone-border-color\": { fallback: \"color-border-strong\" },\n \"file-drop-zone-dragging-border-color\": { fallback: \"color-accent\" },\n \"file-drop-zone-dragging-bg\": { fallback: \"color-accent-subtle\" },\n \"file-drop-zone-hint-fg\": { fallback: \"color-text-muted\" },\n \"tooltip-bg\": { fallback: \"color-text\" },\n \"tooltip-fg\": { fallback: \"color-bg\" },\n \"tooltip-radius\": { fallback: \"radius-control\" },\n \"tooltip-padding\": { fallback: \"inset-tight\" },\n \"tooltip-font-size\": { fallback: \"font-size-small\" },\n \"tooltip-shadow\": { fallback: \"shadow-raised\" },\n \"tooltip-max-width\": { fallback: \"surface-width-small\" },\n \"tooltip-offset\": { fallback: \"gap-tight\" },\n \"text-field-height\": { fallback: \"control-height\" },\n \"text-field-padding-x\": { fallback: \"control-padding-x\" },\n \"text-field-radius\": { fallback: \"radius-control\" },\n \"text-field-bg\": { fallback: \"color-surface\" },\n \"text-field-fg\": { fallback: \"color-text\" },\n \"text-field-placeholder-fg\": { fallback: \"color-text-muted\" },\n \"text-field-border-color\": { fallback: \"color-border-strong\" },\n \"text-field-invalid-border-color\": { fallback: \"color-danger-text\" },\n \"text-area-padding-y\": { fallback: \"inset-tight\" },\n \"reorderable-list-gap\": { fallback: \"gap-tight\" },\n \"reorderable-list-row-height\": { fallback: \"control-height\" },\n \"reorderable-list-row-padding-x\": { fallback: \"control-padding-x\" },\n \"reorderable-list-row-radius\": { fallback: \"radius-control\" },\n \"reorderable-list-row-fg\": { fallback: \"color-text\" },\n \"reorderable-list-row-bg-hover\": { fallback: \"color-control-hover\" },\n \"reorderable-list-row-selected-bg\": { fallback: \"color-accent-subtle\" },\n \"reorderable-list-row-selected-border-color\": { fallback: \"color-accent\" },\n \"timeline-track-bg\": { fallback: \"color-surface-sunken\" },\n \"timeline-track-radius\": { fallback: \"radius-control\" },\n \"timeline-lane-height\": { fallback: \"control-height\" },\n \"timeline-playhead-color\": { fallback: \"color-accent\" },\n \"timeline-clip-bg\": { fallback: \"color-control\" },\n \"timeline-clip-fg\": { fallback: \"color-text\" },\n \"timeline-clip-border-color\": { fallback: \"color-border-strong\" },\n \"timeline-clip-radius\": { fallback: \"radius-control\" },\n \"timeline-clip-padding-x\": { fallback: \"gap-tight\" },\n \"timeline-clip-selected-bg\": { fallback: \"color-accent-subtle\" },\n \"timeline-clip-selected-border-color\": { fallback: \"color-accent\" },\n \"timeline-clip-edge-size\": { fallback: \"gap-normal\" },\n \"color-field-gap\": { fallback: \"gap-tight\" },\n \"color-field-swatch-size\": { fallback: \"control-height-small\" },\n \"color-field-swatch-radius\": { fallback: \"radius-control\" },\n \"color-field-swatch-border-color\": { fallback: \"color-border-strong\" },\n \"color-field-swatch-checked-border-color\": { fallback: \"color-text\" },\n} as const satisfies Record<ComponentTokenName, ComponentSpec>;\n\nfunction baseDefinitions(): TokenDefinition[] {\n const list: TokenDefinition[] = [];\n const add = (name: BaseTokenName, category: TokenCategory, type: TokenType): void => {\n list.push({ name, level: \"base\", category, type, density: false });\n };\n for (const hue of HUES) {\n for (const step of STEPS) {\n add(`${hue}-${step}`, \"color\", \"color\");\n }\n }\n add(\"white\", \"color\", \"color\");\n add(\"black\", \"color\", \"color\");\n for (let step = 1; step <= 12; step++) {\n add(`space-${step}` as BaseTokenName, \"space\", \"length\");\n }\n for (const size of [\"none\", \"sm\", \"md\", \"lg\", \"full\"] as const) {\n add(`radius-${size}`, \"shape\", \"length\");\n }\n add(\"border-width-1\", \"shape\", \"length\");\n add(\"border-width-2\", \"shape\", \"length\");\n add(\"font-sans\", \"typography\", \"font-family\");\n add(\"font-mono\", \"typography\", \"font-family\");\n for (let step = 1; step <= 7; step++) {\n add(`font-size-${step}` as BaseTokenName, \"typography\", \"length\");\n }\n for (const weight of [400, 500, 600, 700] as const) {\n add(`font-weight-${weight}`, \"typography\", \"font-weight\");\n }\n for (const leading of [\"tight\", \"normal\", \"relaxed\"] as const) {\n add(`leading-${leading}`, \"typography\", \"number\");\n }\n for (const speed of [\"fast\", \"normal\", \"slow\"] as const) {\n add(`duration-${speed}`, \"motion\", \"duration\");\n }\n for (const easing of [\"standard\", \"decelerate\", \"accelerate\"] as const) {\n add(`easing-${easing}`, \"motion\", \"easing\");\n }\n return list;\n}\n\nfunction semanticDefinitions(): TokenDefinition[] {\n return Object.entries(semantic).map(([name, spec]) => ({\n name,\n level: \"semantic\",\n category: spec.category,\n type: spec.type,\n density: \"density\" in spec,\n }));\n}\n\n/**\n * Every token `@hussmartinez/ui` defines, base tokens first, in a stable\n * order. Use it to build token documentation or tooling.\n *\n * @public\n */\nexport const tokens: readonly TokenDefinition[] = /* @__PURE__ */ allDefinitions();\n\n/** Every definition, frozen. A function, so importing this module has no side effects. */\nfunction allDefinitions(): readonly TokenDefinition[] {\n const semanticList = semanticDefinitions();\n return Object.freeze(\n [...baseDefinitions(), ...semanticList, ...componentDefinitions(semanticList)].map(\n (definition) => Object.freeze(definition),\n ),\n );\n}\n\n/** Component tokens take their category and type from their fallback. */\nfunction componentDefinitions(semanticList: readonly TokenDefinition[]): TokenDefinition[] {\n const byFallback = new Map(semanticList.map((definition) => [definition.name, definition]));\n return Object.entries(component).map(([name, spec]) => {\n const fallback = byFallback.get(spec.fallback) as TokenDefinition;\n return {\n name,\n level: \"component\",\n category: fallback.category,\n type: fallback.type,\n density: false,\n fallback: spec.fallback,\n };\n });\n}\n\n/** Token definitions by name. */\nexport const tokensByName: ReadonlyMap<string, TokenDefinition> = /* @__PURE__ */ byName(tokens);\n\nfunction byName(list: readonly TokenDefinition[]): ReadonlyMap<string, TokenDefinition> {\n return new Map(list.map((definition) => [definition.name, definition]));\n}\n\n/** The names of the density tokens, in definition order. */\nexport const densityTokenNames: readonly DensityTokenName[] = /* @__PURE__ */ densityNames();\n\nfunction densityNames(): DensityTokenName[] {\n return tokens\n .filter((definition) => definition.density)\n .map((definition) => definition.name as DensityTokenName);\n}\n","import type { DensityTokenName, SemanticTokenName } from \"./definitions.js\";\n\n/** Semantic tokens set by the colour mode: everything except density tokens. */\nexport type SchemeTokenName = Exclude<SemanticTokenName, DensityTokenName>;\n\n/** Values shared by both built-in themes: type, shape, motion and stacking. */\nconst shared = {\n \"focus-ring-width\": \"2px\",\n \"focus-ring-offset\": \"2px\",\n \"focus-ring\": \"var(--hm-focus-ring-width) solid var(--hm-focus-ring-color)\",\n \"font-family\": \"var(--hm-font-sans)\",\n \"font-family-mono\": \"var(--hm-font-mono)\",\n \"font-size-small\": \"var(--hm-font-size-2)\",\n \"font-size-body\": \"var(--hm-font-size-3)\",\n \"font-size-title\": \"var(--hm-font-size-6)\",\n \"font-weight-regular\": \"var(--hm-font-weight-400)\",\n \"font-weight-strong\": \"var(--hm-font-weight-600)\",\n \"line-height-body\": \"var(--hm-leading-normal)\",\n \"line-height-tight\": \"var(--hm-leading-tight)\",\n \"letter-spacing\": \"0\",\n \"radius-control\": \"var(--hm-radius-md)\",\n \"radius-surface\": \"var(--hm-radius-lg)\",\n \"radius-round\": \"var(--hm-radius-full)\",\n \"border-width\": \"var(--hm-border-width-1)\",\n \"motion-duration-feedback\": \"var(--hm-duration-fast)\",\n \"motion-duration-enter\": \"var(--hm-duration-normal)\",\n \"motion-duration-exit\": \"var(--hm-duration-fast)\",\n \"motion-easing-standard\": \"var(--hm-easing-standard)\",\n \"motion-easing-enter\": \"var(--hm-easing-decelerate)\",\n \"motion-easing-exit\": \"var(--hm-easing-accelerate)\",\n \"z-raised\": \"1\",\n \"z-sticky\": \"10\",\n \"z-overlay\": \"100\",\n \"opacity-disabled\": \"0.5\",\n \"surface-width-small\": \"24rem\",\n \"surface-width-medium\": \"32rem\",\n \"surface-width-large\": \"48rem\",\n \"track-size\": \"0.375rem\",\n \"motion-duration-loop\": \"1s\",\n \"motion-easing-loop\": \"linear\",\n} as const;\n\n/** Semantic values of the built-in light theme. */\n/**\n * Adds the shared values. A pure call with plain-data arguments rather than\n * a spread at module scope, which bundlers can't drop, because spreading\n * could run getters. The values are literal strings for the same reason.\n */\nfunction withShared<T extends object>(values: T): typeof shared & T {\n return { ...shared, ...values };\n}\n\nexport const lightValues: Readonly<Record<SchemeTokenName, string>> = /* @__PURE__ */ withShared({\n \"color-scheme\": \"light\",\n \"color-bg\": \"var(--hm-white)\",\n \"color-surface\": \"var(--hm-gray-50)\",\n \"color-surface-raised\": \"var(--hm-white)\",\n \"color-surface-sunken\": \"var(--hm-gray-100)\",\n \"color-overlay\": \"oklch(0.26 0.01 260 / 0.5)\",\n \"color-text\": \"var(--hm-gray-900)\",\n \"color-text-muted\": \"var(--hm-gray-700)\",\n \"color-text-disabled\": \"var(--hm-gray-400)\",\n \"color-border\": \"var(--hm-gray-200)\",\n \"color-border-strong\": \"var(--hm-gray-600)\",\n \"color-control\": \"var(--hm-gray-100)\",\n \"color-control-hover\": \"var(--hm-gray-200)\",\n \"color-control-active\": \"var(--hm-gray-300)\",\n \"color-accent\": \"var(--hm-blue-700)\",\n \"color-accent-hover\": \"var(--hm-blue-800)\",\n \"color-accent-active\": \"var(--hm-blue-900)\",\n \"color-on-accent\": \"var(--hm-white)\",\n \"color-accent-subtle\": \"var(--hm-blue-100)\",\n \"color-accent-text\": \"var(--hm-blue-700)\",\n \"color-danger\": \"var(--hm-red-600)\",\n \"color-danger-hover\": \"var(--hm-red-700)\",\n \"color-on-danger\": \"var(--hm-white)\",\n \"color-danger-subtle\": \"var(--hm-red-100)\",\n \"color-danger-text\": \"var(--hm-red-700)\",\n \"color-warning\": \"var(--hm-amber-400)\",\n \"color-on-warning\": \"var(--hm-gray-950)\",\n \"color-warning-subtle\": \"var(--hm-amber-100)\",\n \"color-warning-text\": \"var(--hm-amber-800)\",\n \"color-success\": \"var(--hm-green-700)\",\n \"color-on-success\": \"var(--hm-white)\",\n \"color-success-subtle\": \"var(--hm-green-100)\",\n \"color-success-text\": \"var(--hm-green-700)\",\n \"focus-ring-color\": \"var(--hm-blue-700)\",\n \"shadow-raised\": \"0 1px 2px oklch(0 0 0 / 0.06), 0 4px 12px oklch(0 0 0 / 0.08)\",\n \"shadow-overlay\": \"0 8px 24px oklch(0 0 0 / 0.12), 0 24px 48px oklch(0 0 0 / 0.12)\",\n});\n\n/** Semantic values of the built-in dark theme. */\nexport const darkValues: Readonly<Record<SchemeTokenName, string>> = /* @__PURE__ */ withShared({\n \"color-scheme\": \"dark\",\n \"color-bg\": \"var(--hm-gray-950)\",\n \"color-surface\": \"var(--hm-gray-900)\",\n \"color-surface-raised\": \"var(--hm-gray-800)\",\n \"color-surface-sunken\": \"var(--hm-black)\",\n \"color-overlay\": \"oklch(0 0 0 / 0.6)\",\n \"color-text\": \"var(--hm-gray-50)\",\n \"color-text-muted\": \"var(--hm-gray-300)\",\n \"color-text-disabled\": \"var(--hm-gray-600)\",\n \"color-border\": \"var(--hm-gray-800)\",\n \"color-border-strong\": \"var(--hm-gray-400)\",\n \"color-control\": \"var(--hm-gray-800)\",\n \"color-control-hover\": \"var(--hm-gray-700)\",\n \"color-control-active\": \"var(--hm-gray-900)\",\n \"color-accent\": \"var(--hm-blue-400)\",\n \"color-accent-hover\": \"var(--hm-blue-300)\",\n \"color-accent-active\": \"var(--hm-blue-200)\",\n \"color-on-accent\": \"var(--hm-gray-950)\",\n \"color-accent-subtle\": \"var(--hm-blue-900)\",\n \"color-accent-text\": \"var(--hm-blue-300)\",\n \"color-danger\": \"var(--hm-red-400)\",\n \"color-danger-hover\": \"var(--hm-red-300)\",\n \"color-on-danger\": \"var(--hm-gray-950)\",\n \"color-danger-subtle\": \"var(--hm-red-950)\",\n \"color-danger-text\": \"var(--hm-red-300)\",\n \"color-warning\": \"var(--hm-amber-400)\",\n \"color-on-warning\": \"var(--hm-gray-950)\",\n \"color-warning-subtle\": \"var(--hm-amber-950)\",\n \"color-warning-text\": \"var(--hm-amber-300)\",\n \"color-success\": \"var(--hm-green-400)\",\n \"color-on-success\": \"var(--hm-gray-950)\",\n \"color-success-subtle\": \"var(--hm-green-950)\",\n \"color-success-text\": \"var(--hm-green-300)\",\n \"focus-ring-color\": \"var(--hm-blue-400)\",\n \"shadow-raised\": \"0 1px 2px oklch(0 0 0 / 0.4), 0 4px 12px oklch(0 0 0 / 0.4)\",\n \"shadow-overlay\": \"0 8px 24px oklch(0 0 0 / 0.5), 0 24px 48px oklch(0 0 0 / 0.5)\",\n});\n\n/** Density values: comfortable is the default. */\nexport const comfortableValues: Readonly<Record<DensityTokenName, string>> = {\n \"control-height\": \"2rem\",\n \"control-height-small\": \"1.5rem\",\n \"control-padding-x\": \"var(--hm-space-3)\",\n \"control-gap\": \"var(--hm-space-2)\",\n \"icon-size\": \"1.25rem\",\n \"target-size\": \"1.5rem\",\n \"gap-tight\": \"var(--hm-space-1)\",\n \"gap-normal\": \"var(--hm-space-2)\",\n \"gap-loose\": \"var(--hm-space-4)\",\n \"inset-tight\": \"var(--hm-space-2)\",\n \"inset-normal\": \"var(--hm-space-3)\",\n \"inset-loose\": \"var(--hm-space-5)\",\n};\n\n/** Compact density: one step tighter, never below the 24 px target size. */\nexport const compactValues: Readonly<Partial<Record<DensityTokenName, string>>> = {\n \"control-height\": \"1.75rem\",\n \"control-padding-x\": \"var(--hm-space-2)\",\n \"control-gap\": \"var(--hm-space-1)\",\n \"icon-size\": \"1rem\",\n \"gap-tight\": \"0.125rem\",\n \"gap-normal\": \"var(--hm-space-1)\",\n \"gap-loose\": \"var(--hm-space-3)\",\n \"inset-tight\": \"var(--hm-space-1)\",\n \"inset-normal\": \"var(--hm-space-2)\",\n \"inset-loose\": \"var(--hm-space-4)\",\n};\n\n/**\n * Coarse pointers, such as touch screens, get 44 px targets in every density\n * (ADR 0014).\n */\nexport const coarsePointerValues: Readonly<Partial<Record<DensityTokenName, string>>> = {\n \"control-height\": \"2.75rem\",\n \"control-height-small\": \"2.75rem\",\n \"target-size\": \"2.75rem\",\n};\n","import { UiError } from \"../errors/ui-error.js\";\nimport { densityTokenNames, tokens } from \"../tokens/definitions.js\";\nimport type { Theme } from \"./types.js\";\n\n/**\n * Writes validated themes as CSS: the rules shared by the built-in token CSS,\n * `themeToCss` and `ThemeProvider`. Nothing here validates token values;\n * callers pass themes from `createTheme`.\n */\n\nconst DENSITY_TOKENS = /* @__PURE__ */ new Set<string>(densityTokenNames);\nconst TOKEN_ORDER = /* @__PURE__ */ tokenOrder();\n\nfunction tokenOrder(): ReadonlyMap<string, number> {\n return new Map(tokens.map((definition, index) => [definition.name, index]));\n}\n\nconst MAX_SELECTOR_LENGTH = 500;\n\n/** The layer statements of styles.css (ADR 0005, docs/adr/0001). */\nexport const LAYER_ORDER =\n \"@layer hm.tokens, hm.base, hm.components, hm.sdk;\\n@layer hm.tokens.default, hm.tokens.theme;\";\n/**\n * Characters a selector may contain. Everything that could end the `@scope`\n * prelude or the stylesheet is missing: `{ } ; @ \\ < /` and so comments too.\n */\nconst SELECTOR_CHARACTERS = /^[A-Za-z0-9\\s_\\-.#:[\\]=\"'()*>+~,|^$]+$/;\n\nfunction invalidSelector(selector: string, reason: string): UiError {\n return new UiError(\n \"INVALID_THEME_SELECTOR\",\n `The selector \"${selector.slice(0, 200)}\" can't be used: ${reason}.`,\n { details: { selector: selector.slice(0, 200), reason } },\n );\n}\n\n/**\n * Checks that a selector is a plain selector list, and returns it with\n * normalised whitespace. Throws a {@link UiError} with the code\n * `INVALID_THEME_SELECTOR` otherwise.\n */\nexport function validateSelector(selector: unknown): string {\n if (typeof selector !== \"string\") {\n throw invalidSelector(String(selector), \"selectors must be strings\");\n }\n const trimmed = selector.trim().replace(/\\s+/g, \" \");\n if (trimmed.length === 0 || trimmed.length > MAX_SELECTOR_LENGTH) {\n throw invalidSelector(selector, `selectors must have 1 to ${MAX_SELECTOR_LENGTH} characters`);\n }\n if (!SELECTOR_CHARACTERS.test(trimmed)) {\n throw invalidSelector(selector, \"it contains a character that isn't allowed\");\n }\n const stack: string[] = [];\n let quote: string | undefined;\n for (const char of trimmed) {\n if (quote) {\n if (char === quote) {\n quote = undefined;\n } else if (!/[A-Za-z0-9 _.:-]/.test(char)) {\n throw invalidSelector(\n selector,\n \"quoted values may only contain letters, digits, spaces, _ . : and -\",\n );\n }\n continue;\n }\n if (char === '\"' || char === \"'\") {\n if (stack.at(-1) !== \"[\") {\n throw invalidSelector(selector, \"quotes are only allowed in attribute selectors\");\n }\n quote = char;\n } else if (char === \"(\" || char === \"[\") {\n stack.push(char);\n } else if (char === \")\" || char === \"]\") {\n if (stack.pop() !== (char === \")\" ? \"(\" : \"[\")) {\n throw invalidSelector(selector, \"brackets aren't balanced\");\n }\n }\n }\n if (quote || stack.length > 0) {\n throw invalidSelector(selector, \"brackets or quotes aren't balanced\");\n }\n return trimmed;\n}\n\nfunction byTokenOrder(a: string, b: string): number {\n const left = TOKEN_ORDER.get(a) ?? Number.MAX_SAFE_INTEGER;\n const right = TOKEN_ORDER.get(b) ?? Number.MAX_SAFE_INTEGER;\n return left - right || (a < b ? -1 : a > b ? 1 : 0);\n}\n\n/** One CSS rule: selectors and declarations, before indentation. */\nexport interface CssBlock {\n readonly selectors: readonly string[];\n readonly values: Readonly<Record<string, string>>;\n /** A condition the rule sits in, such as `(prefers-color-scheme: dark)`. */\n readonly media?: string;\n}\n\n/** Biome's line width; generated CSS is formatted the way Biome would format it. */\nconst LINE_WIDTH = 100;\n\nfunction declaration(indent: string, name: string, value: string): string {\n const line = `${indent}--hm-${name}: ${value};`;\n return line.length <= LINE_WIDTH ? line : `${indent}--hm-${name}:\\n${indent} ${value};`;\n}\n\n/** Writes rules with deterministic order and indentation. */\nexport function renderBlocks(blocks: readonly CssBlock[], indent: string): string {\n return blocks\n .filter((block) => Object.keys(block.values).length > 0)\n .map((block) => {\n const inner = block.media ? `${indent} ` : indent;\n const declarations = Object.keys(block.values)\n .sort(byTokenOrder)\n .map((name) => declaration(`${inner} `, name, block.values[name] as string))\n .join(\"\\n\");\n const rule = `${inner}${block.selectors.join(`,\\n${inner}`)} {\\n${declarations}\\n${inner}}`;\n return block.media ? `${indent}@media ${block.media} {\\n${rule}\\n${indent}}` : rule;\n })\n .join(\"\\n\\n\");\n}\n\n/** Splits a theme's tokens into the colour-mode part and the density part. */\nexport function splitTokens(values: Readonly<Record<string, string>>): {\n scheme: Record<string, string>;\n density: Record<string, string>;\n} {\n const scheme: Record<string, string> = {};\n const density: Record<string, string> = {};\n for (const [name, value] of Object.entries(values)) {\n (DENSITY_TOKENS.has(name) ? density : scheme)[name] = value;\n }\n return { scheme, density };\n}\n\n/**\n * Selectors for a theme applied at a root (`:root` for the built-in themes,\n * `:scope` inside `@scope` for custom ones), so the same rules serve both.\n */\nexport function themeBlocks(root: string, light: Theme, dark: Theme | undefined): CssBlock[] {\n const lightTokens = splitTokens(light.tokens);\n const density: CssBlock[] = [\n { selectors: [root, '[data-hm-density=\"comfortable\"]'], values: lightTokens.density },\n {\n selectors: [`${root}[data-hm-density=\"compact\"]`, '[data-hm-density=\"compact\"]'],\n values: light.compact,\n },\n {\n media: \"(pointer: coarse)\",\n selectors: [root, `${root}[data-hm-density]`, \"[data-hm-density]\"],\n values: light.coarsePointer,\n },\n ];\n if (!dark) {\n return [{ selectors: [root], values: lightTokens.scheme }, ...density];\n }\n const darkTokens = splitTokens(dark.tokens).scheme;\n return [\n {\n selectors: [root, '[data-hm-theme=\"light\"]', '[data-hm-theme=\"system\"]'],\n values: lightTokens.scheme,\n },\n {\n media: \"(prefers-color-scheme: dark)\",\n selectors: [root, '[data-hm-theme=\"system\"]'],\n values: darkTokens,\n },\n // Repeated after the media rule, so a forced theme on the root itself\n // beats the system preference.\n {\n selectors: [`${root}[data-hm-theme=\"light\"]`, '[data-hm-theme=\"light\"]'],\n values: lightTokens.scheme,\n },\n {\n selectors: [`${root}[data-hm-theme=\"dark\"]`, '[data-hm-theme=\"dark\"]'],\n values: darkTokens,\n },\n ...density,\n ];\n}\n\n/**\n * Writes validated themes as a stylesheet scoped to `selector`. The selector\n * is validated here; the themes must come from `createTheme`.\n */\nexport function writeThemeCss(light: Theme, dark: Theme | undefined, selector: string): string {\n const scope = validateSelector(selector);\n const body = renderBlocks(themeBlocks(\":scope\", light, dark), \" \");\n // The layer order is set by the first stylesheet that names a layer. Repeating\n // it here keeps custom themes above the built-in ones even when this CSS\n // loads before styles.css.\n const css = `${LAYER_ORDER}\\n\\n@layer hm.tokens.theme {\\n @scope (${scope}) {\\n${body}\\n }\\n}\\n`;\n if (css.includes(\"<\")) {\n // Unreachable: values and selectors are allowlisted. Kept as the last\n // line of defence, because this string goes into a <style> element.\n throw new UiError(\"INVALID_THEME_TOKEN\", \"The theme produced unsafe CSS.\", {\n details: { token: \"theme\", value: \"\", reason: \"the CSS contains <\" },\n });\n }\n return css;\n}\n","import { UiError } from \"../errors/ui-error.js\";\nimport { warnInDevelopment } from \"../internal/development.js\";\nimport { baseValues } from \"../tokens/base.js\";\nimport { densityTokenNames, tokens, tokensByName } from \"../tokens/definitions.js\";\nimport {\n coarsePointerValues,\n comfortableValues,\n compactValues,\n darkValues,\n lightValues,\n} from \"../tokens/themes.js\";\nimport { checkContrast } from \"./contrast-check.js\";\nimport { CssValueError, validateValue } from \"./css-value.js\";\nimport { writeThemeCss } from \"./css-writer.js\";\nimport { cssWriterOf, registerTheme } from \"./registry.js\";\nimport type { Theme, ThemeInput } from \"./types.js\";\n\ndeclare const process: { readonly env: { readonly NODE_ENV?: string } };\n\n/**\n * Names of component tokens, which `ui` can't list because SDKs add their\n * own: at least two lowercase words, such as `button-radius`.\n */\nconst COMPONENT_TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/;\nconst DENSITY_TOKENS = /* @__PURE__ */ new Set<string>(densityTokenNames);\nconst REQUIRED_TOKENS = /* @__PURE__ */ requiredTokens();\n\n/** Semantic tokens a theme without `extends` must set. */\nfunction requiredTokens(): string[] {\n return tokens\n .filter((definition) => definition.level === \"semantic\" && definition.name !== \"color-scheme\")\n .map((definition) => definition.name);\n}\n\nfunction invalidToken(token: string, value: unknown, reason: string): UiError {\n const shown = typeof value === \"string\" ? value.slice(0, 200) : typeof value;\n return new UiError(\n \"INVALID_THEME_TOKEN\",\n `The theme token \"${token}\" can't be used: ${reason}.`,\n { details: { token, value: shown, reason } },\n );\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\n/**\n * Validates a map of token values and returns the CSS written back from each.\n * `allowed` limits which names are accepted, for density maps.\n */\nfunction validateTokens(\n input: unknown,\n where: string,\n allowed?: ReadonlySet<string>,\n): Record<string, string> {\n if (input === undefined) {\n return {};\n }\n if (!isPlainObject(input)) {\n throw invalidToken(where, input, `${where} must be a plain object`);\n }\n const output: Record<string, string> = {};\n for (const [name, value] of Object.entries(input)) {\n const definition = tokensByName.get(name);\n if (name === \"color-scheme\") {\n throw invalidToken(name, value, \"set the colour scheme with the colorScheme option\");\n }\n if (allowed && !allowed.has(name)) {\n throw invalidToken(name, value, `only density tokens can be set in ${where}`);\n }\n if (!definition && !COMPONENT_TOKEN.test(name)) {\n throw invalidToken(name, value, \"it isn't a token name\");\n }\n if (typeof value !== \"string\") {\n throw invalidToken(name, value, \"values must be strings\");\n }\n try {\n output[name] = validateValue(value, definition?.type);\n } catch (error) {\n if (error instanceof CssValueError) {\n throw invalidToken(name, value, error.message);\n }\n throw error;\n }\n }\n return output;\n}\n\nfunction freeze(theme: Theme): Theme {\n Object.freeze(theme.tokens);\n Object.freeze(theme.compact);\n Object.freeze(theme.coarsePointer);\n Object.freeze(theme);\n registerTheme(theme, writeThemeCss);\n return theme;\n}\n\n/** Built-in themes are written in this repository, and checked by tests. */\nfunction builtInTheme(colorScheme: \"light\" | \"dark\", values: Record<string, string>): Theme {\n return freeze({\n colorScheme,\n tokens: { ...baseValues, ...values, ...comfortableValues },\n compact: { ...compactValues },\n coarsePointer: { ...coarsePointerValues },\n });\n}\n\n/**\n * The built-in light theme.\n *\n * @public\n */\nexport const lightTheme: Theme = /* @__PURE__ */ builtInTheme(\"light\", lightValues);\n\n/**\n * The built-in dark theme.\n *\n * @public\n */\nexport const darkTheme: Theme = /* @__PURE__ */ builtInTheme(\"dark\", darkValues);\n\nfunction warnAboutContrast(theme: Theme): void {\n const { failures, unchecked } = checkContrast(theme);\n if (failures.length > 0) {\n const list = failures\n .map((f) => `${f.foreground} on ${f.background}: ${f.ratio}:1, needs ${f.minimum}:1`)\n .join(\"; \");\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnInDevelopment(`This theme is below WCAG 2.2 AA contrast. ${list}.`);\n }\n }\n if (unchecked.length > 0) {\n const list = unchecked.map((u) => `${u.foreground} on ${u.background}`).join(\"; \");\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnInDevelopment(\n `These colour pairs couldn't be checked for contrast, so check them by hand: ${list}.`,\n );\n }\n }\n}\n\nfunction resolveParent(parent: ThemeInput[\"extends\"]): Theme | undefined {\n if (parent === undefined) {\n return undefined;\n }\n if (parent === \"light\") {\n return lightTheme;\n }\n if (parent === \"dark\") {\n return darkTheme;\n }\n return toTheme(parent);\n}\n\n/**\n * Creates a theme: a validated, frozen set of token values that\n * {@link themeToCss} and `ThemeProvider` apply.\n *\n * - With `extends`, only the tokens that change are needed.\n * - Without it, every semantic token is needed, so a theme can replace the\n * whole look.\n *\n * Every value is checked against its token's type and an allowlist grammar,\n * so a value can't break out of its CSS declaration, even when it comes from\n * a user. Invalid input throws a {@link UiError} with the code\n * `INVALID_THEME_TOKEN`. In development, it also warns when text, boundary or\n * focus colours fall below WCAG 2.2 AA contrast.\n *\n * @example\n * ```ts\n * const brand = createTheme({\n * extends: \"light\",\n * tokens: { \"color-accent\": \"#6d28d9\", \"radius-control\": \"0\" },\n * });\n * ```\n *\n * @public\n */\nexport function createTheme(input: ThemeInput): Theme {\n if (!isPlainObject(input)) {\n throw invalidToken(\"theme\", input, \"createTheme takes an options object\");\n }\n const parent = resolveParent(input.extends);\n const own = validateTokens(input.tokens, \"tokens\");\n if (!parent) {\n const missing = REQUIRED_TOKENS.filter((name) => !(name in own));\n if (missing.length > 0) {\n throw invalidToken(\n missing[0] as string,\n undefined,\n `a theme without \"extends\" needs every semantic token; missing ${missing.join(\", \")}`,\n );\n }\n }\n const colorScheme = input.colorScheme ?? parent?.colorScheme ?? \"light\";\n if (colorScheme !== \"light\" && colorScheme !== \"dark\") {\n throw invalidToken(\"color-scheme\", colorScheme, 'colorScheme must be \"light\" or \"dark\"');\n }\n const theme = freeze({\n colorScheme,\n tokens: { ...parent?.tokens, ...own, \"color-scheme\": colorScheme },\n compact: {\n ...(parent?.compact ?? {}),\n ...validateTokens(input.density?.compact, \"density.compact\", DENSITY_TOKENS),\n },\n coarsePointer: {\n ...(parent?.coarsePointer ?? coarsePointerValues),\n ...validateTokens(input.coarsePointer, \"coarsePointer\", DENSITY_TOKENS),\n },\n });\n // Inline, so production bundles drop the contrast check and its colour maths.\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnAboutContrast(theme);\n }\n return theme;\n}\n\n/**\n * Returns a theme that's safe to write into CSS. Themes from\n * {@link createTheme} are returned as they are. Anything else, such as a\n * theme parsed from JSON, is validated again.\n */\nexport function toTheme(value: unknown): Theme {\n if (cssWriterOf(value)) {\n return value as Theme;\n }\n if (!isPlainObject(value) || !isPlainObject(value[\"tokens\"])) {\n throw invalidToken(\"theme\", value, \"expected a theme from createTheme\");\n }\n const scheme = value[\"colorScheme\"];\n const { \"color-scheme\": _ignored, ...tokenValues } = value[\"tokens\"];\n const compact = value[\"compact\"];\n const coarsePointer = value[\"coarsePointer\"];\n return createTheme({\n extends: undefined,\n colorScheme: scheme === \"dark\" ? \"dark\" : \"light\",\n tokens: tokenValues as never,\n ...(isPlainObject(compact) ? { density: { compact } } : {}),\n ...(isPlainObject(coarsePointer) ? { coarsePointer } : {}),\n });\n}\n","import { toTheme } from \"./create-theme.js\";\nimport { writeThemeCss } from \"./css-writer.js\";\nimport { isThemePair } from \"./pair.js\";\nimport type { Theme, ThemePair } from \"./types.js\";\n\n/**\n * Writes a theme, or a light and dark pair, as a static stylesheet: for\n * build-time theming, server rendering without JavaScript, and strict\n * Content Security Policies.\n *\n * - **A single theme** applies to the elements `selector` matches, and\n * everything inside them.\n * - **A pair** follows `prefers-color-scheme` in pure CSS, and descendants can\n * force a mode with `data-hm-theme=\"light|dark|system\"`.\n * - **Density** follows `data-hm-density`, and coarse pointers get 44 px\n * targets.\n *\n * The rules sit in the `hm.tokens.theme` cascade layer, so they beat the\n * built-in themes whatever order stylesheets load in, and a host's unlayered\n * CSS still beats them. They're wrapped in `@scope`, so when themes are\n * nested, the closest one wins.\n *\n * Themes that didn't come from {@link createTheme} are validated again, and\n * the selector must be a plain selector list. Invalid input throws a\n * {@link UiError}. The output never contains `<`, so it's safe inside a\n * `<style>` element.\n *\n * @param theme - A theme from `createTheme`, or a `{ light, dark }` pair.\n * @param selector - Where the theme applies. Defaults to `:root`.\n *\n * @example\n * ```ts\n * // brand.css.ts, run at build time\n * export default themeToCss({ light: brandLight, dark: brandDark });\n * ```\n *\n * @public\n */\nexport function themeToCss(theme: Theme | ThemePair, selector = \":root\"): string {\n const isPair = typeof theme === \"object\" && theme !== null && isThemePair(theme);\n const light = toTheme(isPair ? theme.light : theme);\n const dark = isPair ? toTheme(theme.dark) : undefined;\n return writeThemeCss(light, dark, selector);\n}\n"],"mappings":";;AAOA,IAAa,aAAsD;CACjE,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW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,uBAAuB;EACrB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,uBAAuB;EACrB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,gBAAgB;EACd,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,uBAAuB;EACrB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,iBAAiB;EAAE,UAAU;EAAS,MAAM;CAAQ;CACpD,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,wBAAwB;EACtB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,iBAAiB;EAAE,UAAU;EAAS,MAAM;CAAQ;CACpD,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,wBAAwB;EACtB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,cAAc;EACZ,UAAU;EACV,MAAM;CACR;CACA,eAAe;EACb,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,kBAAkB;EAChB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,uBAAuB;EACrB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,k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,eAAe,MAAM,eAAe,iBAAiB,cAAc;EACxE;CACF,CAAC;CAED,IAAI,OAAO,YAAY,eAAA,QAAA,IAAA,aAAwC,cAC7D,kBAAkB,KAAK;CAEzB,OAAO;AACT;AAOA,SAAgB,QAAQ,OAAuB;CAC7C,IAAI,YAAY,KAAK,GACnB,OAAO;CAET,IAAI,CAAC,cAAc,KAAK,KAAK,CAAC,cAAc,MAAM,SAAS,GACzD,MAAM,aAAa,SAAS,OAAO,mCAAmC;CAExE,MAAM,SAAS,MAAM;CACrB,MAAM,EAAE,gBAAgB,UAAU,GAAG,gBAAgB,MAAM;CAC3D,MAAM,UAAU,MAAM;CACtB,MAAM,gBAAgB,MAAM;CAC5B,OAAO,YAAY;EACjB,SAAS,KAAA;EACT,aAAa,WAAW,SAAS,SAAS;EAC1C,QAAQ;EACR,GAAI,cAAc,OAAO,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC;EACzD,GAAI,cAAc,aAAa,IAAI,EAAE,cAAc,IAAI,CAAC;CAC1D,CAAC;AACH;;AC/MA,SAAgB,WAAW,OAA0B,WAAW,SAAiB;CAC/E,MAAM,SAAS,OAAO,UAAU,YAAY,UAAU,QAAQ,YAAY,KAAK;CAG/E,OAAO,cAFO,QAAQ,SAAS,MAAM,QAAQ,KAExB,GADR,SAAS,QAAQ,MAAM,IAAI,IAAI,KAAA,GACV,QAAQ;AAC5C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DENSITY_TOKENS"],"sources":["../src/tokens/base.ts","../src/tokens/contrast.ts","../src/theme/css-value.ts","../src/theme/color.ts","../src/theme/contrast-check.ts","../src/tokens/definitions.ts","../src/tokens/themes.ts","../src/theme/css-writer.ts","../src/theme/create-theme.ts","../src/theme/theme-to-css.ts"],"sourcesContent":["import type { BaseTokenName } from \"./definitions.js\";\n\n/**\n * Values of the base tokens, shared by the built-in light and dark themes.\n * Colours are OKLCH, so each palette's steps are evenly spaced in perceived\n * lightness. Lengths are in rem, so they follow the user's font size.\n */\nexport const baseValues: Readonly<Record<BaseTokenName, string>> = {\n \"gray-50\": \"oklch(0.985 0.008 260)\",\n \"gray-100\": \"oklch(0.965 0.008 260)\",\n \"gray-200\": \"oklch(0.925 0.009 260)\",\n \"gray-300\": \"oklch(0.87 0.011 260)\",\n \"gray-400\": \"oklch(0.78 0.012 260)\",\n \"gray-500\": \"oklch(0.68 0.012 260)\",\n \"gray-600\": \"oklch(0.585 0.012 260)\",\n \"gray-700\": \"oklch(0.5 0.012 260)\",\n \"gray-800\": \"oklch(0.42 0.011 260)\",\n \"gray-900\": \"oklch(0.34 0.01 260)\",\n \"gray-950\": \"oklch(0.26 0.01 260)\",\n \"blue-50\": \"oklch(0.985 0.024 258)\",\n \"blue-100\": \"oklch(0.965 0.05 258)\",\n \"blue-200\": \"oklch(0.925 0.09 258)\",\n \"blue-300\": \"oklch(0.87 0.14 258)\",\n \"blue-400\": \"oklch(0.78 0.18 258)\",\n \"blue-500\": \"oklch(0.68 0.2 258)\",\n \"blue-600\": \"oklch(0.585 0.2 258)\",\n \"blue-700\": \"oklch(0.5 0.184 258)\",\n \"blue-800\": \"oklch(0.42 0.16 258)\",\n \"blue-900\": \"oklch(0.34 0.13 258)\",\n \"blue-950\": \"oklch(0.26 0.1 258)\",\n \"red-50\": \"oklch(0.985 0.025 25)\",\n \"red-100\": \"oklch(0.965 0.052 25)\",\n \"red-200\": \"oklch(0.925 0.095 25)\",\n \"red-300\": \"oklch(0.87 0.147 25)\",\n \"red-400\": \"oklch(0.78 0.189 25)\",\n \"red-500\": \"oklch(0.68 0.21 25)\",\n \"red-600\": \"oklch(0.585 0.21 25)\",\n \"red-700\": \"oklch(0.5 0.193 25)\",\n \"red-800\": \"oklch(0.42 0.168 25)\",\n \"red-900\": \"oklch(0.34 0.137 25)\",\n \"red-950\": \"oklch(0.26 0.105 25)\",\n \"green-50\": \"oklch(0.985 0.02 150)\",\n \"green-100\": \"oklch(0.965 0.043 150)\",\n \"green-200\": \"oklch(0.925 0.077 150)\",\n \"green-300\": \"oklch(0.87 0.119 150)\",\n \"green-400\": \"oklch(0.78 0.153 150)\",\n \"green-500\": \"oklch(0.68 0.17 150)\",\n \"green-600\": \"oklch(0.585 0.17 150)\",\n \"green-700\": \"oklch(0.5 0.156 150)\",\n \"green-800\": \"oklch(0.42 0.136 150)\",\n \"green-900\": \"oklch(0.34 0.111 150)\",\n \"green-950\": \"oklch(0.26 0.085 150)\",\n \"amber-50\": \"oklch(0.985 0.02 70)\",\n \"amber-100\": \"oklch(0.965 0.043 70)\",\n \"amber-200\": \"oklch(0.925 0.077 70)\",\n \"amber-300\": \"oklch(0.87 0.119 70)\",\n \"amber-400\": \"oklch(0.78 0.153 70)\",\n \"amber-500\": \"oklch(0.68 0.17 70)\",\n \"amber-600\": \"oklch(0.585 0.17 70)\",\n \"amber-700\": \"oklch(0.5 0.156 70)\",\n \"amber-800\": \"oklch(0.42 0.136 70)\",\n \"amber-900\": \"oklch(0.34 0.111 70)\",\n \"amber-950\": \"oklch(0.26 0.085 70)\",\n white: \"oklch(1 0 0)\",\n black: \"oklch(0 0 0)\",\n \"space-1\": \"0.25rem\",\n \"space-2\": \"0.5rem\",\n \"space-3\": \"0.75rem\",\n \"space-4\": \"1rem\",\n \"space-5\": \"1.25rem\",\n \"space-6\": \"1.5rem\",\n \"space-7\": \"2rem\",\n \"space-8\": \"2.5rem\",\n \"space-9\": \"3rem\",\n \"space-10\": \"4rem\",\n \"space-11\": \"5rem\",\n \"space-12\": \"6rem\",\n \"radius-none\": \"0\",\n \"radius-sm\": \"0.25rem\",\n \"radius-md\": \"0.375rem\",\n \"radius-lg\": \"0.5rem\",\n \"radius-full\": \"9999px\",\n \"border-width-1\": \"1px\",\n \"border-width-2\": \"2px\",\n \"font-sans\": 'system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n \"font-mono\": 'ui-monospace, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n \"font-size-1\": \"0.75rem\",\n \"font-size-2\": \"0.8125rem\",\n \"font-size-3\": \"0.875rem\",\n \"font-size-4\": \"1rem\",\n \"font-size-5\": \"1.125rem\",\n \"font-size-6\": \"1.25rem\",\n \"font-size-7\": \"1.5rem\",\n \"font-weight-400\": \"400\",\n \"font-weight-500\": \"500\",\n \"font-weight-600\": \"600\",\n \"font-weight-700\": \"700\",\n \"leading-tight\": \"1.25\",\n \"leading-normal\": \"1.5\",\n \"leading-relaxed\": \"1.75\",\n \"duration-fast\": \"100ms\",\n \"duration-normal\": \"200ms\",\n \"duration-slow\": \"300ms\",\n \"easing-standard\": \"cubic-bezier(0.2, 0, 0, 1)\",\n \"easing-decelerate\": \"cubic-bezier(0, 0, 0, 1)\",\n \"easing-accelerate\": \"cubic-bezier(0.3, 0, 1, 1)\",\n};\n","import type { SemanticTokenName } from \"./definitions.js\";\n\n/**\n * A foreground token that must contrast with a background token, and the\n * smallest WCAG 2.2 ratio it needs.\n *\n * @public\n */\nexport interface ContrastPair {\n readonly foreground: SemanticTokenName;\n readonly background: SemanticTokenName;\n /** 4.5 for text (WCAG 1.4.3), 3 for boundaries and focus indicators (WCAG 1.4.11). */\n readonly minimum: 4.5 | 3;\n}\n\nconst TEXT = 4.5;\nconst NON_TEXT = 3;\n\nconst SURFACES = [\"color-bg\", \"color-surface\", \"color-surface-raised\"] as const;\n\n/** Builds the pairs. A function, so importing this module has no side effects. */\nfunction buildPairs(): readonly ContrastPair[] {\n const pairs: ContrastPair[] = [];\n const needs = (\n foreground: SemanticTokenName,\n backgrounds: readonly SemanticTokenName[],\n minimum: 4.5 | 3,\n ): void => {\n for (const background of backgrounds) {\n pairs.push({ foreground, background, minimum });\n }\n };\n\n // Text on every surface.\n needs(\"color-text\", [...SURFACES, \"color-surface-sunken\"], TEXT);\n needs(\"color-text-muted\", SURFACES, TEXT);\n needs(\"color-accent-text\", SURFACES, TEXT);\n needs(\"color-danger-text\", [...SURFACES, \"color-danger-subtle\"], TEXT);\n needs(\"color-warning-text\", [...SURFACES, \"color-warning-subtle\"], TEXT);\n needs(\"color-success-text\", [...SURFACES, \"color-success-subtle\"], TEXT);\n // Text on controls and fills, including their hover and pressed states.\n needs(\"color-text\", [\"color-control\", \"color-control-hover\", \"color-control-active\"], TEXT);\n needs(\"color-text\", [\"color-accent-subtle\"], TEXT);\n needs(\"color-on-accent\", [\"color-accent\", \"color-accent-hover\", \"color-accent-active\"], TEXT);\n needs(\"color-on-danger\", [\"color-danger\", \"color-danger-hover\"], TEXT);\n needs(\"color-on-warning\", [\"color-warning\"], TEXT);\n needs(\"color-on-success\", [\"color-success\"], TEXT);\n // Boundaries and indicators that identify a control or its state.\n needs(\"color-border-strong\", SURFACES, NON_TEXT);\n needs(\"color-accent\", SURFACES, NON_TEXT);\n // The fill of a progress bar against its track.\n needs(\"color-accent\", [\"color-surface-sunken\"], NON_TEXT);\n needs(\"focus-ring-color\", SURFACES, NON_TEXT);\n return Object.freeze(pairs);\n}\n\n/**\n * The colour pairs every theme must meet, as checked by `createTheme` in\n * development and by the tests for the built-in themes.\n *\n * @public\n */\nexport const contrastPairs: readonly ContrastPair[] = /* @__PURE__ */ buildPairs();\n","import type { TokenType } from \"../tokens/definitions.js\";\n\n/**\n * An allowlist parser for token values. Theme values can come from users, for\n * example a brand colour typed into a settings page, and they end up in a\n * `<style>` element. So values aren't escaped: they're parsed into this small\n * tree, anything outside the grammar is rejected, and the CSS is written back\n * from the tree. Characters that could end a declaration, a rule or the\n * `<style>` element (`; { } < > \\ @ !`), comments, `url()` and every other\n * function outside the list below never reach the output.\n */\nexport type CssNode =\n | { readonly kind: \"ident\"; readonly value: string }\n | { readonly kind: \"number\"; readonly value: number; readonly unit: string }\n | { readonly kind: \"hash\"; readonly value: string }\n | { readonly kind: \"string\"; readonly value: string }\n | { readonly kind: \"comma\" }\n | { readonly kind: \"slash\" }\n | { readonly kind: \"operator\"; readonly value: \"+\" | \"-\" | \"*\" }\n | { readonly kind: \"function\"; readonly name: string; readonly args: readonly CssNode[] };\n\n/** A value that parsed, as nodes separated by whitespace at the top level. */\nexport interface ParsedValue {\n readonly nodes: readonly CssNode[];\n /** The value written back from the nodes. */\n readonly css: string;\n}\n\n/** Why a value was rejected, in words for developers. */\nexport class CssValueError extends Error {\n override readonly name = \"CssValueError\";\n}\n\nconst MAX_LENGTH = 1000;\nconst MAX_DEPTH = 8;\n\n/** Joins sets. A function, so importing this module has no side effects. */\nfunction union(...parts: Iterable<string>[]): ReadonlySet<string> {\n return new Set(parts.flatMap((part) => [...part]));\n}\n\nconst COLOR_FUNCTIONS = /* @__PURE__ */ new Set([\n \"rgb\",\n \"rgba\",\n \"hsl\",\n \"hsla\",\n \"hwb\",\n \"lab\",\n \"lch\",\n \"oklab\",\n \"oklch\",\n \"color\",\n \"color-mix\",\n \"light-dark\",\n]);\nconst MATH_FUNCTIONS = /* @__PURE__ */ new Set([\"calc\", \"min\", \"max\", \"clamp\"]);\nconst EASING_FUNCTIONS = /* @__PURE__ */ new Set([\"cubic-bezier\", \"steps\", \"linear\"]);\nconst FUNCTIONS = /* @__PURE__ */ union(COLOR_FUNCTIONS, MATH_FUNCTIONS, EASING_FUNCTIONS, [\"var\"]);\n\nconst LENGTH_UNITS = /* @__PURE__ */ new Set([\n \"px\",\n \"rem\",\n \"em\",\n \"ch\",\n \"ex\",\n \"lh\",\n \"%\",\n \"vw\",\n \"vh\",\n \"vmin\",\n \"vmax\",\n \"cqw\",\n \"cqh\",\n \"cqi\",\n \"cqb\",\n]);\nconst TIME_UNITS = /* @__PURE__ */ new Set([\"ms\", \"s\"]);\nconst NUMBER_UNITS = /* @__PURE__ */ union(LENGTH_UNITS, TIME_UNITS, [\n \"deg\",\n \"turn\",\n \"rad\",\n \"grad\",\n \"\",\n]);\n\n/** Custom properties a value may reference: only the family's own. */\nexport const HM_PROPERTY = /^--hm-[a-z0-9]+(?:-[a-z0-9]+)*$/;\nconst IDENT = /^-?[A-Za-z_][A-Za-z0-9_-]*/;\nconst NUMBER = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?/;\nconst UNIT = /^(?:[A-Za-z]+|%)/;\nconst HASH = /^#[0-9A-Fa-f]+/;\nconst STRING_CONTENT = /^[A-Za-z0-9 _.-]*$/;\n\nclass Parser {\n private index = 0;\n private readonly input: string;\n\n constructor(input: string) {\n this.input = input;\n }\n\n parse(): CssNode[][] {\n const groups = this.sequence(0, false);\n if (this.index < this.input.length) {\n throw new CssValueError(`unexpected \"${this.input.charAt(this.index)}\"`);\n }\n return groups;\n }\n\n /**\n * Parses nodes until the end of the input, or until `)` when inside a\n * function. Returns the nodes grouped by top-level whitespace, so\n * `1px solid red` is three groups and `rgb(0 0 0)` is one.\n */\n private sequence(depth: number, inFunction: boolean): CssNode[][] {\n const groups: CssNode[][] = [];\n let current: CssNode[] = [];\n const flush = (): void => {\n if (current.length > 0) {\n groups.push(current);\n current = [];\n }\n };\n while (this.index < this.input.length) {\n const rest = this.input.slice(this.index);\n const char = rest.charAt(0);\n if (/^\\s/.test(char)) {\n this.index += (/^\\s+/.exec(rest)?.[0] ?? \" \").length;\n flush();\n continue;\n }\n if (char === \")\") {\n if (!inFunction) {\n throw new CssValueError('unbalanced \")\"');\n }\n flush();\n return groups;\n }\n if (char === \",\") {\n flush();\n groups.push([{ kind: \"comma\" }]);\n this.index += 1;\n continue;\n }\n if (char === \"/\") {\n if (rest.startsWith(\"/*\")) {\n throw new CssValueError(\"comments aren't allowed\");\n }\n flush();\n groups.push([{ kind: \"slash\" }]);\n this.index += 1;\n continue;\n }\n if (char === \"*\" || ((char === \"+\" || char === \"-\") && /^[+-]\\s/.test(rest))) {\n if (!inFunction) {\n throw new CssValueError(`\"${char}\" is only allowed inside calc()`);\n }\n flush();\n groups.push([{ kind: \"operator\", value: char as \"+\" | \"-\" | \"*\" }]);\n this.index += 1;\n continue;\n }\n if (char === '\"' || char === \"'\") {\n current.push(this.string(char));\n continue;\n }\n if (char === \"#\") {\n const hash = HASH.exec(rest)?.[0];\n if (!hash || ![4, 5, 7, 9].includes(hash.length)) {\n throw new CssValueError(\"hex colours have 3, 4, 6 or 8 digits\");\n }\n current.push({ kind: \"hash\", value: hash.toLowerCase() });\n this.index += hash.length;\n continue;\n }\n const number = NUMBER.exec(rest)?.[0];\n if (number) {\n this.index += number.length;\n const unit = UNIT.exec(this.input.slice(this.index))?.[0] ?? \"\";\n if (!NUMBER_UNITS.has(unit.toLowerCase())) {\n throw new CssValueError(`the unit \"${unit}\" isn't allowed`);\n }\n this.index += unit.length;\n current.push({ kind: \"number\", value: Number(number), unit: unit.toLowerCase() });\n continue;\n }\n if (rest.startsWith(\"--\")) {\n const name = /^--[A-Za-z0-9_-]*/.exec(rest)?.[0] ?? \"--\";\n if (!HM_PROPERTY.test(name)) {\n throw new CssValueError(`only --hm-* custom properties can be referenced, not \"${name}\"`);\n }\n current.push({ kind: \"ident\", value: name });\n this.index += name.length;\n continue;\n }\n const ident = IDENT.exec(rest)?.[0];\n if (ident) {\n this.index += ident.length;\n if (this.input.charAt(this.index) === \"(\") {\n current.push(this.function(ident.toLowerCase(), depth));\n } else {\n current.push({ kind: \"ident\", value: ident.toLowerCase() });\n }\n continue;\n }\n throw new CssValueError(`the character \"${char}\" isn't allowed`);\n }\n if (inFunction) {\n throw new CssValueError('unbalanced \"(\"');\n }\n flush();\n return groups;\n }\n\n private function(name: string, depth: number): CssNode {\n if (!FUNCTIONS.has(name)) {\n throw new CssValueError(`the function \"${name}()\" isn't allowed`);\n }\n if (depth >= MAX_DEPTH) {\n throw new CssValueError(\"functions are nested too deeply\");\n }\n this.index += 1;\n const args = this.sequence(depth + 1, true).flat();\n this.index += 1;\n if (name === \"var\") {\n const [property, comma] = args;\n if (property?.kind !== \"ident\" || !HM_PROPERTY.test(property.value)) {\n throw new CssValueError(\"var() must name a --hm-* custom property\");\n }\n if (args.length > 1 && comma?.kind !== \"comma\") {\n throw new CssValueError(\"var() takes a property name and an optional fallback\");\n }\n }\n return { kind: \"function\", name, args };\n }\n\n private string(quote: string): CssNode {\n const end = this.input.indexOf(quote, this.index + 1);\n if (end === -1) {\n throw new CssValueError(\"unterminated string\");\n }\n const value = this.input.slice(this.index + 1, end);\n if (!STRING_CONTENT.test(value)) {\n throw new CssValueError(\"strings may only contain letters, digits, spaces, _ . and -\");\n }\n this.index = end + 1;\n return { kind: \"string\", value };\n }\n}\n\nfunction serializeNode(node: CssNode): string {\n switch (node.kind) {\n case \"ident\":\n return node.value;\n case \"number\":\n return `${node.value}${node.unit}`;\n case \"hash\":\n return node.value;\n case \"string\":\n return `\"${node.value}\"`;\n case \"comma\":\n return \",\";\n case \"slash\":\n return \"/\";\n case \"operator\":\n return node.value;\n case \"function\":\n return `${node.name}(${serializeNodes(node.args)})`;\n }\n}\n\n/** Writes nodes back as CSS, with normalised spacing. */\nexport function serializeNodes(nodes: readonly CssNode[]): string {\n let css = \"\";\n nodes.forEach((node, index) => {\n if (node.kind === \"comma\") {\n css += \",\";\n return;\n }\n if (index > 0) {\n css += \" \";\n }\n css += serializeNode(node);\n });\n return css;\n}\n\n/**\n * Parses a token value against the allowlist grammar, without checking its\n * type. Throws {@link CssValueError} when the value isn't allowed.\n */\nexport function parseValue(input: string): ParsedValue {\n if (typeof input !== \"string\") {\n throw new CssValueError(\"values must be strings\");\n }\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new CssValueError(\"the value is empty\");\n }\n if (trimmed.length > MAX_LENGTH) {\n throw new CssValueError(`the value is longer than ${MAX_LENGTH} characters`);\n }\n const nodes = new Parser(trimmed).parse().flat();\n return { nodes, css: serializeNodes(nodes) };\n}\n\nconst isVar = (node: CssNode): boolean => node.kind === \"function\" && node.name === \"var\";\nconst isMath = (node: CssNode): boolean =>\n node.kind === \"function\" && MATH_FUNCTIONS.has(node.name);\n\nfunction isColor(node: CssNode): boolean {\n if (isVar(node) || node.kind === \"hash\") {\n return true;\n }\n if (node.kind === \"function\") {\n return COLOR_FUNCTIONS.has(node.name);\n }\n return (\n node.kind === \"ident\" && [\"transparent\", \"currentcolor\", \"black\", \"white\"].includes(node.value)\n );\n}\n\nfunction isLength(node: CssNode): boolean {\n if (isVar(node) || isMath(node)) {\n return true;\n }\n return (\n node.kind === \"number\" &&\n (LENGTH_UNITS.has(node.unit) || (node.unit === \"\" && node.value === 0))\n );\n}\n\nfunction isPlainNumber(node: CssNode, integer = false): boolean {\n if (isVar(node) || isMath(node)) {\n return true;\n }\n return node.kind === \"number\" && node.unit === \"\" && (!integer || Number.isInteger(node.value));\n}\n\n/** Splits nodes at top-level commas. */\nfunction splitByComma(nodes: readonly CssNode[]): CssNode[][] {\n const lists: CssNode[][] = [[]];\n for (const node of nodes) {\n if (node.kind === \"comma\") {\n lists.push([]);\n } else {\n lists[lists.length - 1]?.push(node);\n }\n }\n return lists;\n}\n\nconst OUTLINE_STYLES = /* @__PURE__ */ new Set([\n \"solid\",\n \"dashed\",\n \"dotted\",\n \"double\",\n \"auto\",\n \"none\",\n]);\nconst EASING_KEYWORDS = /* @__PURE__ */ new Set([\n \"linear\",\n \"ease\",\n \"ease-in\",\n \"ease-out\",\n \"ease-in-out\",\n \"step-start\",\n \"step-end\",\n]);\n\nconst typeCheckers: Record<TokenType, (nodes: readonly CssNode[]) => boolean> = {\n color: (nodes) => nodes.length === 1 && isColor(nodes[0] as CssNode),\n length: (nodes) => nodes.length === 1 && isLength(nodes[0] as CssNode),\n duration: (nodes) => {\n const [node] = nodes;\n return (\n nodes.length === 1 &&\n node !== undefined &&\n (isVar(node) || isMath(node) || (node.kind === \"number\" && TIME_UNITS.has(node.unit)))\n );\n },\n easing: (nodes) => {\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return false;\n }\n if (node.kind === \"ident\") {\n return EASING_KEYWORDS.has(node.value);\n }\n return isVar(node) || (node.kind === \"function\" && EASING_FUNCTIONS.has(node.name));\n },\n number: (nodes) => nodes.length === 1 && isPlainNumber(nodes[0] as CssNode),\n integer: (nodes) => nodes.length === 1 && isPlainNumber(nodes[0] as CssNode, true),\n \"font-weight\": (nodes) => {\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return false;\n }\n if (node.kind === \"ident\") {\n return node.value === \"normal\" || node.value === \"bold\";\n }\n return (\n isVar(node) ||\n (node.kind === \"number\" && node.unit === \"\" && node.value >= 1 && node.value <= 1000)\n );\n },\n \"font-family\": (nodes) =>\n splitByComma(nodes).every(\n (family) =>\n family.length > 0 &&\n (family.every((node) => node.kind === \"ident\") ||\n (family.length === 1 && (family[0]?.kind === \"string\" || isVar(family[0] as CssNode)))),\n ),\n shadow: (nodes) => {\n if (nodes.length === 1 && nodes[0]?.kind === \"ident\" && nodes[0].value === \"none\") {\n return true;\n }\n return splitByComma(nodes).every((layer) => {\n const lengths = layer.filter((node) => isLength(node) && !isVar(node)).length;\n const vars = layer.filter(isVar).length;\n const colors = layer.filter((node) => !isVar(node) && isColor(node)).length;\n const inset = layer.filter((node) => node.kind === \"ident\" && node.value === \"inset\").length;\n return (\n layer.length === lengths + vars + colors + inset &&\n colors <= 1 &&\n inset <= 1 &&\n (vars > 0 || (lengths >= 2 && lengths <= 4))\n );\n });\n },\n outline: (nodes) =>\n nodes.length >= 1 &&\n nodes.length <= 3 &&\n nodes.every(\n (node) =>\n isLength(node) ||\n isColor(node) ||\n (node.kind === \"ident\" && OUTLINE_STYLES.has(node.value)),\n ),\n \"color-scheme\": (nodes) =>\n nodes.length === 1 &&\n nodes[0]?.kind === \"ident\" &&\n (nodes[0].value === \"light\" || nodes[0].value === \"dark\"),\n};\n\n/**\n * Parses a value and checks it against a token type. Returns the CSS written\n * back from the parsed value. Throws {@link CssValueError} when the value\n * isn't allowed or doesn't fit the type.\n */\nexport function validateValue(input: string, type: TokenType | undefined): string {\n const parsed = parseValue(input);\n if (type && !typeCheckers[type](parsed.nodes)) {\n throw new CssValueError(`\"${parsed.css}\" isn't a valid ${type} value`);\n }\n return parsed.css;\n}\n","import { type CssNode, parseValue } from \"./css-value.js\";\n\n/** A colour in sRGB, with channels and alpha from 0 to 1. */\nexport interface Rgba {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n readonly alpha: number;\n}\n\nconst clamp = (value: number): number => Math.min(1, Math.max(0, value));\n\n/** Reads a number or percentage argument; `scale` is what 100% means. */\nfunction channel(node: CssNode | undefined, scale: number): number | undefined {\n if (node?.kind !== \"number\") {\n return undefined;\n }\n if (node.unit === \"%\") {\n return (node.value / 100) * scale;\n }\n return node.unit === \"\" ? node.value : undefined;\n}\n\nfunction hue(node: CssNode | undefined): number | undefined {\n if (node?.kind !== \"number\") {\n return undefined;\n }\n switch (node.unit) {\n case \"\":\n case \"deg\":\n return node.value;\n case \"turn\":\n return node.value * 360;\n case \"rad\":\n return (node.value * 180) / Math.PI;\n case \"grad\":\n return node.value * 0.9;\n default:\n return undefined;\n }\n}\n\n/** Splits `rgb(1 2 3 / 0.5)` or `rgb(1, 2, 3, 0.5)` into channels and alpha. */\nfunction functionArguments(args: readonly CssNode[]): {\n channels: CssNode[];\n alpha: number | undefined;\n} {\n const values = args.filter((node) => node.kind !== \"comma\");\n const slash = values.findIndex((node) => node.kind === \"slash\");\n const channels = slash === -1 ? values.slice(0, 3) : values.slice(0, slash);\n const alphaNode = slash === -1 ? values[3] : values[slash + 1];\n return { channels, alpha: alphaNode ? channel(alphaNode, 1) : 1 };\n}\n\nfunction fromHex(hex: string): Rgba {\n const digits = hex.slice(1);\n const full = digits.length <= 4 ? [...digits].map((digit) => digit + digit).join(\"\") : digits;\n const byte = (index: number): number => Number.parseInt(full.slice(index, index + 2), 16) / 255;\n return { r: byte(0), g: byte(2), b: byte(4), alpha: full.length === 8 ? byte(6) : 1 };\n}\n\nfunction fromHsl(h: number, s: number, l: number, alpha: number): Rgba {\n const f = (n: number): number => {\n const k = (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n };\n return { r: f(0), g: f(8), b: f(4), alpha };\n}\n\nconst toGamma = (linear: number): number =>\n linear <= 0.0031308 ? 12.92 * linear : 1.055 * linear ** (1 / 2.4) - 0.055;\nconst toLinear = (gamma: number): number =>\n gamma <= 0.04045 ? gamma / 12.92 : ((gamma + 0.055) / 1.055) ** 2.4;\n\n/** OKLab to sRGB, clipped to the sRGB gamut. */\nfunction fromOklab(l: number, a: number, b: number, alpha: number): Rgba {\n const l_ = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;\n const m_ = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;\n const s_ = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;\n return {\n r: toGamma(clamp(4.0767416621 * l_ - 3.3077115913 * m_ + 0.2309699292 * s_)),\n g: toGamma(clamp(-1.2684380046 * l_ + 2.6097574011 * m_ - 0.3413193965 * s_)),\n b: toGamma(clamp(-0.0041960863 * l_ - 0.7034186147 * m_ + 1.707614701 * s_)),\n alpha,\n };\n}\n\nfunction fromFunction(name: string, args: readonly CssNode[]): Rgba | undefined {\n const { channels, alpha } = functionArguments(args);\n if (alpha === undefined || channels.length !== 3) {\n return undefined;\n }\n const [first, second, third] = channels;\n switch (name) {\n case \"rgb\":\n case \"rgba\": {\n const [r, g, b] = [first, second, third].map((node) => channel(node, 255));\n if (r === undefined || g === undefined || b === undefined) {\n return undefined;\n }\n return { r: clamp(r / 255), g: clamp(g / 255), b: clamp(b / 255), alpha: clamp(alpha) };\n }\n case \"hsl\":\n case \"hsla\": {\n const h = hue(first);\n const s = channel(second, 100);\n const l = channel(third, 100);\n if (h === undefined || s === undefined || l === undefined) {\n return undefined;\n }\n return fromHsl(((h % 360) + 360) % 360, clamp(s / 100), clamp(l / 100), clamp(alpha));\n }\n case \"oklch\": {\n const l = channel(first, 1);\n const c = channel(second, 0.4);\n const h = hue(third);\n if (l === undefined || c === undefined || h === undefined) {\n return undefined;\n }\n const radians = (h * Math.PI) / 180;\n return fromOklab(l, c * Math.cos(radians), c * Math.sin(radians), clamp(alpha));\n }\n case \"oklab\": {\n const l = channel(first, 1);\n const a = channel(second, 0.4);\n const b = channel(third, 0.4);\n if (l === undefined || a === undefined || b === undefined) {\n return undefined;\n }\n return fromOklab(l, a, b, clamp(alpha));\n }\n default:\n return undefined;\n }\n}\n\n/**\n * Resolves a colour value to sRGB. `lookup` returns the value of another\n * token, for `var(--hm-…)` references. Returns `undefined` when the colour\n * can't be computed statically, such as `color-mix()` or a reference to a\n * token outside the theme.\n */\nexport function resolveColor(\n value: string,\n lookup: (token: string) => string | undefined,\n depth = 0,\n): Rgba | undefined {\n if (depth > 16) {\n return undefined;\n }\n let nodes: readonly CssNode[];\n try {\n nodes = parseValue(value).nodes;\n } catch {\n return undefined;\n }\n const [node] = nodes;\n if (nodes.length !== 1 || node === undefined) {\n return undefined;\n }\n switch (node.kind) {\n case \"hash\":\n return fromHex(node.value);\n case \"ident\":\n return node.value === \"white\"\n ? { r: 1, g: 1, b: 1, alpha: 1 }\n : node.value === \"black\"\n ? { r: 0, g: 0, b: 0, alpha: 1 }\n : undefined;\n case \"function\": {\n if (node.name === \"var\") {\n const [property] = node.args;\n const referenced =\n property?.kind === \"ident\" ? lookup(property.value.slice(\"--hm-\".length)) : undefined;\n return referenced === undefined ? undefined : resolveColor(referenced, lookup, depth + 1);\n }\n return fromFunction(node.name, node.args);\n }\n default:\n return undefined;\n }\n}\n\n/** Composites a translucent colour over an opaque one, as browsers do. */\nfunction composite(top: Rgba, bottom: Rgba): Rgba {\n const mix = (a: number, b: number): number => a * top.alpha + b * (1 - top.alpha);\n return { r: mix(top.r, bottom.r), g: mix(top.g, bottom.g), b: mix(top.b, bottom.b), alpha: 1 };\n}\n\n/** WCAG 2.x relative luminance of an opaque sRGB colour. */\nexport function relativeLuminance(color: Rgba): number {\n return 0.2126 * toLinear(color.r) + 0.7152 * toLinear(color.g) + 0.0722 * toLinear(color.b);\n}\n\n/**\n * The WCAG 2.x contrast ratio of a foreground over a background, from 1 to 21.\n * A translucent foreground is composited over the background first. Returns\n * `undefined` for a translucent background, whose contrast depends on what's\n * behind it.\n */\nexport function contrastRatio(foreground: Rgba, background: Rgba): number | undefined {\n if (background.alpha < 1) {\n return undefined;\n }\n const front = foreground.alpha < 1 ? composite(foreground, background) : foreground;\n const lighter = Math.max(relativeLuminance(front), relativeLuminance(background));\n const darker = Math.min(relativeLuminance(front), relativeLuminance(background));\n return (lighter + 0.05) / (darker + 0.05);\n}\n","import { baseValues } from \"../tokens/base.js\";\nimport { contrastPairs } from \"../tokens/contrast.js\";\nimport { contrastRatio, resolveColor } from \"./color.js\";\nimport type { Theme } from \"./types.js\";\n\n/**\n * Result of checking a theme's colour pairs against WCAG 2.2 AA.\n *\n * @public\n */\nexport interface ContrastReport {\n /** Pairs below their minimum ratio, with the ratio they have. */\n readonly failures: readonly {\n readonly foreground: string;\n readonly background: string;\n readonly ratio: number;\n readonly minimum: number;\n }[];\n /**\n * Pairs that couldn't be checked, because a colour can't be computed\n * without a browser, such as `color-mix()`, or its background is translucent.\n */\n readonly unchecked: readonly { readonly foreground: string; readonly background: string }[];\n}\n\n/**\n * Checks a theme's text, boundary and focus colours against WCAG 2.2 AA\n * contrast. References to base tokens the theme doesn't set resolve to the\n * built-in values, as they do on the page.\n *\n * @public\n */\nexport function checkContrast(theme: Theme): ContrastReport {\n const lookup = (token: string): string | undefined =>\n theme.tokens[token] ?? (baseValues as Record<string, string>)[token];\n const failures: ContrastReport[\"failures\"][number][] = [];\n const unchecked: ContrastReport[\"unchecked\"][number][] = [];\n for (const { foreground, background, minimum } of contrastPairs) {\n const front = lookup(foreground);\n const back = lookup(background);\n const frontColor = front === undefined ? undefined : resolveColor(front, lookup);\n const backColor = back === undefined ? undefined : resolveColor(back, lookup);\n const ratio = frontColor && backColor ? contrastRatio(frontColor, backColor) : undefined;\n if (ratio === undefined) {\n unchecked.push({ foreground, background });\n } else if (ratio < minimum) {\n failures.push({ foreground, background, ratio: Math.round(ratio * 100) / 100, minimum });\n }\n }\n return { failures, unchecked };\n}\n","/**\n * The token definitions: every token's name, level, category, value type and\n * purpose. This is the single source the CSS, the types and the token\n * reference are generated from (ADR 0006).\n */\n\n/**\n * The value types a token can have. Each type has its own grammar, which\n * {@link createTheme} checks values against.\n *\n * @public\n */\nexport type TokenType =\n | \"color\"\n | \"length\"\n | \"duration\"\n | \"easing\"\n | \"number\"\n | \"integer\"\n | \"font-family\"\n | \"font-weight\"\n | \"shadow\"\n | \"outline\"\n | \"color-scheme\";\n\n/**\n * What a token is for, used to group the token reference.\n *\n * @public\n */\nexport type TokenCategory =\n | \"color\"\n | \"typography\"\n | \"space\"\n | \"size\"\n | \"shape\"\n | \"shadow\"\n | \"motion\"\n | \"z-index\"\n | \"opacity\"\n | \"focus\";\n\n/**\n * Base tokens are raw scales that only other tokens use. Semantic tokens name\n * a purpose, and are what components use (ADR 0006).\n *\n * @public\n */\nexport type TokenLevel = \"base\" | \"semantic\" | \"component\";\n\n/**\n * What a token is, for tooling: its name, level, category and value type.\n * What each token is for is documented in the token reference,\n * `docs/tokens.md`, rather than shipped to applications (docs/adr/0001).\n *\n * @public\n */\nexport interface TokenDefinition {\n /** The name without the `--hm-` prefix, such as `color-accent`. */\n readonly name: string;\n /** Base, semantic or component (ADR 0006). */\n readonly level: TokenLevel;\n /** What the token styles, used to group the token reference. */\n readonly category: TokenCategory;\n /** The grammar its values must follow. */\n readonly type: TokenType;\n /**\n * Whether density changes the token. Density tokens are set by\n * `data-hm-density`, not by the colour mode.\n */\n readonly density: boolean;\n /**\n * For component tokens, the semantic token they fall back to. `ui` never\n * declares component tokens; components read them as\n * `var(--hm-<name>, var(--hm-<fallback>))`, so a theme or host can set them\n * on any ancestor (docs/adr/0001).\n */\n readonly fallback?: SemanticTokenName;\n}\n\n/** The hues of the base colour palettes. */\nexport const HUES = [\"gray\", \"blue\", \"red\", \"green\", \"amber\"] as const;\n/** The steps of every base colour palette, from lightest to darkest. */\nexport const STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;\n\n/**\n * The names of the base tokens: the raw colour, space, radius, border, type\n * and motion scales.\n *\n * @public\n */\nexport type BaseTokenName =\n | `${\"gray\" | \"blue\" | \"red\" | \"green\" | \"amber\"}-${50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950}`\n | \"white\"\n | \"black\"\n | `space-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`\n | \"radius-none\"\n | \"radius-sm\"\n | \"radius-md\"\n | \"radius-lg\"\n | \"radius-full\"\n | \"border-width-1\"\n | \"border-width-2\"\n | \"font-sans\"\n | \"font-mono\"\n | `font-size-${1 | 2 | 3 | 4 | 5 | 6 | 7}`\n | \"font-weight-400\"\n | \"font-weight-500\"\n | \"font-weight-600\"\n | \"font-weight-700\"\n | \"leading-tight\"\n | \"leading-normal\"\n | \"leading-relaxed\"\n | \"duration-fast\"\n | \"duration-normal\"\n | \"duration-slow\"\n | \"easing-standard\"\n | \"easing-decelerate\"\n | \"easing-accelerate\";\n\n/**\n * The names of the semantic tokens, which components use.\n *\n * @public\n */\nexport type SemanticTokenName =\n | \"color-scheme\"\n | \"color-bg\"\n | \"color-surface\"\n | \"color-surface-raised\"\n | \"color-surface-sunken\"\n | \"color-overlay\"\n | \"color-text\"\n | \"color-text-muted\"\n | \"color-text-disabled\"\n | \"color-border\"\n | \"color-border-strong\"\n | \"color-control\"\n | \"color-control-hover\"\n | \"color-control-active\"\n | \"color-accent\"\n | \"color-accent-hover\"\n | \"color-accent-active\"\n | \"color-on-accent\"\n | \"color-accent-subtle\"\n | \"color-accent-text\"\n | \"color-danger\"\n | \"color-danger-hover\"\n | \"color-on-danger\"\n | \"color-danger-subtle\"\n | \"color-danger-text\"\n | \"color-warning\"\n | \"color-on-warning\"\n | \"color-warning-subtle\"\n | \"color-warning-text\"\n | \"color-success\"\n | \"color-on-success\"\n | \"color-success-subtle\"\n | \"color-success-text\"\n | \"focus-ring-color\"\n | \"focus-ring-width\"\n | \"focus-ring-offset\"\n | \"focus-ring\"\n | \"font-family\"\n | \"font-family-mono\"\n | \"font-size-small\"\n | \"font-size-body\"\n | \"font-size-title\"\n | \"font-weight-regular\"\n | \"font-weight-strong\"\n | \"line-height-body\"\n | \"line-height-tight\"\n | \"letter-spacing\"\n | \"control-height\"\n | \"control-height-small\"\n | \"control-padding-x\"\n | \"control-gap\"\n | \"icon-size\"\n | \"target-size\"\n | \"gap-tight\"\n | \"gap-normal\"\n | \"gap-loose\"\n | \"inset-tight\"\n | \"inset-normal\"\n | \"inset-loose\"\n | \"surface-width-small\"\n | \"surface-width-medium\"\n | \"surface-width-large\"\n | \"track-size\"\n | \"radius-control\"\n | \"radius-surface\"\n | \"radius-round\"\n | \"border-width\"\n | \"shadow-raised\"\n | \"shadow-overlay\"\n | \"motion-duration-feedback\"\n | \"motion-duration-enter\"\n | \"motion-duration-exit\"\n | \"motion-easing-standard\"\n | \"motion-easing-enter\"\n | \"motion-easing-exit\"\n | \"motion-duration-loop\"\n | \"motion-easing-loop\"\n | \"z-raised\"\n | \"z-sticky\"\n | \"z-overlay\"\n | \"opacity-disabled\";\n\n/**\n * The semantic tokens that density changes: control sizes, gaps and insets.\n *\n * @public\n */\nexport type DensityTokenName =\n | \"control-height\"\n | \"control-height-small\"\n | \"control-padding-x\"\n | \"control-gap\"\n | \"icon-size\"\n | \"target-size\"\n | \"gap-tight\"\n | \"gap-normal\"\n | \"gap-loose\"\n | \"inset-tight\"\n | \"inset-normal\"\n | \"inset-loose\";\n\ntype SemanticSpec = {\n readonly category: TokenCategory;\n readonly type: TokenType;\n readonly density?: true;\n};\n\nconst semantic = {\n \"color-scheme\": {\n category: \"color\",\n type: \"color-scheme\",\n },\n \"color-bg\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface-raised\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-surface-sunken\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-overlay\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-text\": { category: \"color\", type: \"color\" },\n \"color-text-muted\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-text-disabled\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-border\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-border-strong\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-control-active\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-active\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-on-accent\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-accent-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-hover\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-on-danger\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-danger-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning\": { category: \"color\", type: \"color\" },\n \"color-on-warning\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-warning-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success\": { category: \"color\", type: \"color\" },\n \"color-on-success\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success-subtle\": {\n category: \"color\",\n type: \"color\",\n },\n \"color-success-text\": {\n category: \"color\",\n type: \"color\",\n },\n \"focus-ring-color\": {\n category: \"focus\",\n type: \"color\",\n },\n \"focus-ring-width\": {\n category: \"focus\",\n type: \"length\",\n },\n \"focus-ring-offset\": {\n category: \"focus\",\n type: \"length\",\n },\n \"focus-ring\": {\n category: \"focus\",\n type: \"outline\",\n },\n \"font-family\": {\n category: \"typography\",\n type: \"font-family\",\n },\n \"font-family-mono\": {\n category: \"typography\",\n type: \"font-family\",\n },\n \"font-size-small\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-size-body\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-size-title\": {\n category: \"typography\",\n type: \"length\",\n },\n \"font-weight-regular\": {\n category: \"typography\",\n type: \"font-weight\",\n },\n \"font-weight-strong\": {\n category: \"typography\",\n type: \"font-weight\",\n },\n \"line-height-body\": {\n category: \"typography\",\n type: \"number\",\n },\n \"line-height-tight\": {\n category: \"typography\",\n type: \"number\",\n },\n \"letter-spacing\": {\n category: \"typography\",\n type: \"length\",\n },\n \"control-height\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"control-height-small\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"control-padding-x\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"control-gap\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"icon-size\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"target-size\": {\n category: \"size\",\n type: \"length\",\n density: true,\n },\n \"gap-tight\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"gap-normal\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"gap-loose\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-tight\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-normal\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"inset-loose\": {\n category: \"space\",\n type: \"length\",\n density: true,\n },\n \"surface-width-small\": { category: \"size\", type: \"length\" },\n \"surface-width-medium\": { category: \"size\", type: \"length\" },\n \"surface-width-large\": { category: \"size\", type: \"length\" },\n \"track-size\": { category: \"size\", type: \"length\" },\n \"radius-control\": {\n category: \"shape\",\n type: \"length\",\n },\n \"radius-surface\": {\n category: \"shape\",\n type: \"length\",\n },\n \"radius-round\": {\n category: \"shape\",\n type: \"length\",\n },\n \"border-width\": { category: \"shape\", type: \"length\" },\n \"shadow-raised\": {\n category: \"shadow\",\n type: \"shadow\",\n },\n \"shadow-overlay\": {\n category: \"shadow\",\n type: \"shadow\",\n },\n \"motion-duration-feedback\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-duration-enter\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-duration-exit\": {\n category: \"motion\",\n type: \"duration\",\n },\n \"motion-easing-standard\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-easing-enter\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-easing-exit\": {\n category: \"motion\",\n type: \"easing\",\n },\n \"motion-duration-loop\": { category: \"motion\", type: \"duration\" },\n \"motion-easing-loop\": { category: \"motion\", type: \"easing\" },\n \"z-raised\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"z-sticky\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"z-overlay\": {\n category: \"z-index\",\n type: \"integer\",\n },\n \"opacity-disabled\": {\n category: \"opacity\",\n type: \"number\",\n },\n} as const satisfies Record<SemanticTokenName, SemanticSpec>;\n\n// The unions above are written out so the API reads plainly; these checks keep\n// them in step with the definitions.\ntype Exact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype Assert<T extends true> = T;\ntype DensityKeys<T> = { [K in keyof T]: T[K] extends { density: true } ? K : never }[keyof T];\nexport type NamesMatch = Assert<Exact<SemanticTokenName, keyof typeof semantic>>;\nexport type DensityMatches = Assert<Exact<DensityTokenName, DensityKeys<typeof semantic>>>;\nexport type ComponentNamesMatch = Assert<Exact<ComponentTokenName, keyof typeof component>>;\n\n/**\n * The name of any token `@hussmartinez/ui` defines.\n *\n * @public\n */\nexport type TokenName = BaseTokenName | SemanticTokenName | ComponentTokenName;\n\n/**\n * The names of `ui`'s component tokens: fine-grained overrides for one\n * component, each falling back to a semantic token.\n *\n * @public\n */\nexport type ComponentTokenName =\n | \"button-height\"\n | \"button-small-height\"\n | \"button-padding-x\"\n | \"button-gap\"\n | \"button-icon-size\"\n | \"button-radius\"\n | \"button-font-weight\"\n | \"button-bg\"\n | \"button-bg-hover\"\n | \"button-bg-active\"\n | \"button-fg\"\n | \"button-border-color\"\n | \"button-primary-bg\"\n | \"button-primary-bg-hover\"\n | \"button-primary-bg-active\"\n | \"button-primary-fg\"\n | \"button-quiet-bg-hover\"\n | \"button-quiet-bg-active\"\n | \"button-danger-bg\"\n | \"button-danger-bg-hover\"\n | \"button-danger-fg\"\n | \"button-pressed-bg\"\n | \"button-pressed-border-color\"\n | \"button-pressed-fg\"\n | \"toolbar-bg\"\n | \"toolbar-border-color\"\n | \"toolbar-radius\"\n | \"toolbar-padding\"\n | \"toolbar-gap\"\n | \"toolbar-group-gap\"\n | \"toolbar-separator-color\"\n | \"segmented-control-height\"\n | \"segmented-control-small-height\"\n | \"segmented-control-padding\"\n | \"segmented-control-gap\"\n | \"segmented-control-radius\"\n | \"segmented-control-bg\"\n | \"segmented-control-border-color\"\n | \"segmented-control-option-padding-x\"\n | \"segmented-control-option-fg\"\n | \"segmented-control-option-bg-hover\"\n | \"segmented-control-option-checked-bg\"\n | \"segmented-control-option-checked-fg\"\n | \"segmented-control-option-checked-border-color\"\n | \"dialog-bg\"\n | \"dialog-fg\"\n | \"dialog-border-color\"\n | \"dialog-radius\"\n | \"dialog-shadow\"\n | \"dialog-padding\"\n | \"dialog-gap\"\n | \"dialog-backdrop\"\n | \"dialog-title-font-size\"\n | \"dialog-small-width\"\n | \"dialog-width\"\n | \"dialog-large-width\"\n | \"spinner-size\"\n | \"spinner-thickness\"\n | \"spinner-color\"\n | \"spinner-track-color\"\n | \"spinner-duration\"\n | \"progress-height\"\n | \"progress-radius\"\n | \"progress-track-color\"\n | \"progress-fill-color\"\n | \"progress-duration\"\n | \"slider-track-size\"\n | \"slider-track-color\"\n | \"slider-radius\"\n | \"slider-thumb-size\"\n | \"slider-thumb-color\"\n | \"slider-thumb-color-hover\"\n | \"slider-thumb-color-active\"\n | \"field-gap\"\n | \"field-label-fg\"\n | \"field-label-font-weight\"\n | \"field-description-fg\"\n | \"field-error-fg\"\n | \"field-message-font-size\"\n | \"number-field-height\"\n | \"number-field-padding-x\"\n | \"number-field-radius\"\n | \"number-field-bg\"\n | \"number-field-fg\"\n | \"number-field-border-color\"\n | \"number-field-invalid-border-color\"\n | \"file-drop-zone-gap\"\n | \"file-drop-zone-padding\"\n | \"file-drop-zone-radius\"\n | \"file-drop-zone-border-color\"\n | \"file-drop-zone-dragging-border-color\"\n | \"file-drop-zone-dragging-bg\"\n | \"file-drop-zone-hint-fg\"\n | \"tooltip-bg\"\n | \"tooltip-fg\"\n | \"tooltip-radius\"\n | \"tooltip-padding\"\n | \"tooltip-font-size\"\n | \"tooltip-shadow\"\n | \"tooltip-max-width\"\n | \"tooltip-offset\"\n | \"text-field-height\"\n | \"text-field-padding-x\"\n | \"text-field-radius\"\n | \"text-field-bg\"\n | \"text-field-fg\"\n | \"text-field-placeholder-fg\"\n | \"text-field-border-color\"\n | \"text-field-invalid-border-color\"\n | \"text-area-padding-y\"\n | \"reorderable-list-gap\"\n | \"reorderable-list-row-height\"\n | \"reorderable-list-row-padding-x\"\n | \"reorderable-list-row-radius\"\n | \"reorderable-list-row-fg\"\n | \"reorderable-list-row-bg-hover\"\n | \"reorderable-list-row-selected-bg\"\n | \"reorderable-list-row-selected-border-color\"\n | \"timeline-track-bg\"\n | \"timeline-track-radius\"\n | \"timeline-lane-height\"\n | \"timeline-playhead-color\"\n | \"timeline-clip-bg\"\n | \"timeline-clip-fg\"\n | \"timeline-clip-border-color\"\n | \"timeline-clip-radius\"\n | \"timeline-clip-padding-x\"\n | \"timeline-clip-selected-bg\"\n | \"timeline-clip-selected-border-color\"\n | \"timeline-clip-edge-size\"\n | \"timeline-header-max-width\"\n | \"timeline-header-bg\"\n | \"timeline-lane-border-color\"\n | \"timeline-clip-moving-shadow\"\n | \"timeline-clip-refused-border-color\"\n | \"color-field-gap\"\n | \"color-field-swatch-size\"\n | \"color-field-swatch-radius\"\n | \"color-field-swatch-border-color\"\n | \"color-field-swatch-checked-border-color\";\n\ntype ComponentSpec = { readonly fallback: SemanticTokenName };\n\nconst component = {\n \"button-height\": { fallback: \"control-height\" },\n \"button-small-height\": {\n fallback: \"control-height-small\",\n },\n \"button-padding-x\": { fallback: \"control-padding-x\" },\n \"button-gap\": { fallback: \"control-gap\" },\n \"button-icon-size\": { fallback: \"icon-size\" },\n \"button-radius\": { fallback: \"radius-control\" },\n \"button-font-weight\": {\n fallback: \"font-weight-strong\",\n },\n \"button-bg\": { fallback: \"color-control\" },\n \"button-bg-hover\": {\n fallback: \"color-control-hover\",\n },\n \"button-bg-active\": {\n fallback: \"color-control-active\",\n },\n \"button-fg\": { fallback: \"color-text\" },\n \"button-border-color\": {\n fallback: \"color-border-strong\",\n },\n \"button-primary-bg\": { fallback: \"color-accent\" },\n \"button-primary-bg-hover\": {\n fallback: \"color-accent-hover\",\n },\n \"button-primary-bg-active\": {\n fallback: \"color-accent-active\",\n },\n \"button-primary-fg\": { fallback: \"color-on-accent\" },\n \"button-quiet-bg-hover\": {\n fallback: \"color-control-hover\",\n },\n \"button-quiet-bg-active\": {\n fallback: \"color-control-active\",\n },\n \"button-danger-bg\": { fallback: \"color-danger\" },\n \"button-danger-bg-hover\": {\n fallback: \"color-danger-hover\",\n },\n \"button-danger-fg\": { fallback: \"color-on-danger\" },\n \"button-pressed-bg\": {\n fallback: \"color-accent-subtle\",\n },\n \"button-pressed-border-color\": {\n fallback: \"color-accent\",\n },\n \"button-pressed-fg\": {\n fallback: \"color-text\",\n },\n \"toolbar-bg\": { fallback: \"color-surface\" },\n \"toolbar-border-color\": { fallback: \"color-border\" },\n \"toolbar-radius\": { fallback: \"radius-surface\" },\n \"toolbar-padding\": { fallback: \"inset-tight\" },\n \"toolbar-gap\": { fallback: \"gap-tight\" },\n \"toolbar-group-gap\": { fallback: \"gap-tight\" },\n \"toolbar-separator-color\": { fallback: \"color-border\" },\n \"segmented-control-height\": { fallback: \"control-height\" },\n \"segmented-control-small-height\": { fallback: \"control-height-small\" },\n \"segmented-control-padding\": { fallback: \"gap-tight\" },\n \"segmented-control-gap\": { fallback: \"gap-tight\" },\n \"segmented-control-radius\": { fallback: \"radius-control\" },\n \"segmented-control-bg\": { fallback: \"color-surface-sunken\" },\n \"segmented-control-border-color\": { fallback: \"color-border-strong\" },\n \"segmented-control-option-padding-x\": { fallback: \"control-padding-x\" },\n \"segmented-control-option-fg\": { fallback: \"color-text\" },\n \"segmented-control-option-bg-hover\": { fallback: \"color-control-hover\" },\n \"segmented-control-option-checked-bg\": { fallback: \"color-surface-raised\" },\n \"segmented-control-option-checked-fg\": { fallback: \"color-text\" },\n \"segmented-control-option-checked-border-color\": { fallback: \"color-border-strong\" },\n \"dialog-bg\": { fallback: \"color-surface-raised\" },\n \"dialog-fg\": { fallback: \"color-text\" },\n \"dialog-border-color\": { fallback: \"color-border\" },\n \"dialog-radius\": { fallback: \"radius-surface\" },\n \"dialog-shadow\": { fallback: \"shadow-overlay\" },\n \"dialog-padding\": { fallback: \"inset-loose\" },\n \"dialog-gap\": { fallback: \"gap-loose\" },\n \"dialog-backdrop\": { fallback: \"color-overlay\" },\n \"dialog-title-font-size\": { fallback: \"font-size-title\" },\n \"dialog-small-width\": { fallback: \"surface-width-small\" },\n \"dialog-width\": { fallback: \"surface-width-medium\" },\n \"dialog-large-width\": { fallback: \"surface-width-large\" },\n \"spinner-size\": { fallback: \"icon-size\" },\n \"spinner-thickness\": { fallback: \"focus-ring-width\" },\n \"spinner-color\": { fallback: \"color-accent\" },\n \"spinner-track-color\": { fallback: \"color-border\" },\n \"spinner-duration\": { fallback: \"motion-duration-loop\" },\n \"progress-height\": { fallback: \"track-size\" },\n \"progress-radius\": { fallback: \"radius-round\" },\n \"progress-track-color\": { fallback: \"color-surface-sunken\" },\n \"progress-fill-color\": { fallback: \"color-accent\" },\n \"progress-duration\": { fallback: \"motion-duration-loop\" },\n \"slider-track-size\": { fallback: \"track-size\" },\n \"slider-track-color\": { fallback: \"color-border-strong\" },\n \"slider-radius\": { fallback: \"radius-round\" },\n \"slider-thumb-size\": { fallback: \"icon-size\" },\n \"slider-thumb-color\": { fallback: \"color-accent\" },\n \"slider-thumb-color-hover\": { fallback: \"color-accent-hover\" },\n \"slider-thumb-color-active\": { fallback: \"color-accent-active\" },\n \"field-gap\": { fallback: \"gap-tight\" },\n \"field-label-fg\": { fallback: \"color-text\" },\n \"field-label-font-weight\": { fallback: \"font-weight-strong\" },\n \"field-description-fg\": { fallback: \"color-text-muted\" },\n \"field-error-fg\": { fallback: \"color-danger-text\" },\n \"field-message-font-size\": { fallback: \"font-size-small\" },\n \"number-field-height\": { fallback: \"control-height\" },\n \"number-field-padding-x\": { fallback: \"control-padding-x\" },\n \"number-field-radius\": { fallback: \"radius-control\" },\n \"number-field-bg\": { fallback: \"color-surface\" },\n \"number-field-fg\": { fallback: \"color-text\" },\n \"number-field-border-color\": { fallback: \"color-border-strong\" },\n \"number-field-invalid-border-color\": { fallback: \"color-danger-text\" },\n \"file-drop-zone-gap\": { fallback: \"gap-normal\" },\n \"file-drop-zone-padding\": { fallback: \"inset-loose\" },\n \"file-drop-zone-radius\": { fallback: \"radius-surface\" },\n \"file-drop-zone-border-color\": { fallback: \"color-border-strong\" },\n \"file-drop-zone-dragging-border-color\": { fallback: \"color-accent\" },\n \"file-drop-zone-dragging-bg\": { fallback: \"color-accent-subtle\" },\n \"file-drop-zone-hint-fg\": { fallback: \"color-text-muted\" },\n \"tooltip-bg\": { fallback: \"color-text\" },\n \"tooltip-fg\": { fallback: \"color-bg\" },\n \"tooltip-radius\": { fallback: \"radius-control\" },\n \"tooltip-padding\": { fallback: \"inset-tight\" },\n \"tooltip-font-size\": { fallback: \"font-size-small\" },\n \"tooltip-shadow\": { fallback: \"shadow-raised\" },\n \"tooltip-max-width\": { fallback: \"surface-width-small\" },\n \"tooltip-offset\": { fallback: \"gap-tight\" },\n \"text-field-height\": { fallback: \"control-height\" },\n \"text-field-padding-x\": { fallback: \"control-padding-x\" },\n \"text-field-radius\": { fallback: \"radius-control\" },\n \"text-field-bg\": { fallback: \"color-surface\" },\n \"text-field-fg\": { fallback: \"color-text\" },\n \"text-field-placeholder-fg\": { fallback: \"color-text-muted\" },\n \"text-field-border-color\": { fallback: \"color-border-strong\" },\n \"text-field-invalid-border-color\": { fallback: \"color-danger-text\" },\n \"text-area-padding-y\": { fallback: \"inset-tight\" },\n \"reorderable-list-gap\": { fallback: \"gap-tight\" },\n \"reorderable-list-row-height\": { fallback: \"control-height\" },\n \"reorderable-list-row-padding-x\": { fallback: \"control-padding-x\" },\n \"reorderable-list-row-radius\": { fallback: \"radius-control\" },\n \"reorderable-list-row-fg\": { fallback: \"color-text\" },\n \"reorderable-list-row-bg-hover\": { fallback: \"color-control-hover\" },\n \"reorderable-list-row-selected-bg\": { fallback: \"color-accent-subtle\" },\n \"reorderable-list-row-selected-border-color\": { fallback: \"color-accent\" },\n \"timeline-track-bg\": { fallback: \"color-surface-sunken\" },\n \"timeline-track-radius\": { fallback: \"radius-control\" },\n \"timeline-lane-height\": { fallback: \"control-height\" },\n \"timeline-playhead-color\": { fallback: \"color-accent\" },\n \"timeline-clip-bg\": { fallback: \"color-control\" },\n \"timeline-clip-fg\": { fallback: \"color-text\" },\n \"timeline-clip-border-color\": { fallback: \"color-border-strong\" },\n \"timeline-clip-radius\": { fallback: \"radius-control\" },\n \"timeline-clip-padding-x\": { fallback: \"gap-tight\" },\n \"timeline-clip-selected-bg\": { fallback: \"color-accent-subtle\" },\n \"timeline-clip-selected-border-color\": { fallback: \"color-accent\" },\n \"timeline-clip-edge-size\": { fallback: \"gap-normal\" },\n \"timeline-header-max-width\": { fallback: \"surface-width-small\" },\n \"timeline-header-bg\": { fallback: \"color-surface\" },\n \"timeline-lane-border-color\": { fallback: \"color-border\" },\n \"timeline-clip-moving-shadow\": { fallback: \"shadow-raised\" },\n \"timeline-clip-refused-border-color\": { fallback: \"color-danger-text\" },\n \"color-field-gap\": { fallback: \"gap-tight\" },\n \"color-field-swatch-size\": { fallback: \"control-height-small\" },\n \"color-field-swatch-radius\": { fallback: \"radius-control\" },\n \"color-field-swatch-border-color\": { fallback: \"color-border-strong\" },\n \"color-field-swatch-checked-border-color\": { fallback: \"color-text\" },\n} as const satisfies Record<ComponentTokenName, ComponentSpec>;\n\nfunction baseDefinitions(): TokenDefinition[] {\n const list: TokenDefinition[] = [];\n const add = (name: BaseTokenName, category: TokenCategory, type: TokenType): void => {\n list.push({ name, level: \"base\", category, type, density: false });\n };\n for (const hue of HUES) {\n for (const step of STEPS) {\n add(`${hue}-${step}`, \"color\", \"color\");\n }\n }\n add(\"white\", \"color\", \"color\");\n add(\"black\", \"color\", \"color\");\n for (let step = 1; step <= 12; step++) {\n add(`space-${step}` as BaseTokenName, \"space\", \"length\");\n }\n for (const size of [\"none\", \"sm\", \"md\", \"lg\", \"full\"] as const) {\n add(`radius-${size}`, \"shape\", \"length\");\n }\n add(\"border-width-1\", \"shape\", \"length\");\n add(\"border-width-2\", \"shape\", \"length\");\n add(\"font-sans\", \"typography\", \"font-family\");\n add(\"font-mono\", \"typography\", \"font-family\");\n for (let step = 1; step <= 7; step++) {\n add(`font-size-${step}` as BaseTokenName, \"typography\", \"length\");\n }\n for (const weight of [400, 500, 600, 700] as const) {\n add(`font-weight-${weight}`, \"typography\", \"font-weight\");\n }\n for (const leading of [\"tight\", \"normal\", \"relaxed\"] as const) {\n add(`leading-${leading}`, \"typography\", \"number\");\n }\n for (const speed of [\"fast\", \"normal\", \"slow\"] as const) {\n add(`duration-${speed}`, \"motion\", \"duration\");\n }\n for (const easing of [\"standard\", \"decelerate\", \"accelerate\"] as const) {\n add(`easing-${easing}`, \"motion\", \"easing\");\n }\n return list;\n}\n\nfunction semanticDefinitions(): TokenDefinition[] {\n return Object.entries(semantic).map(([name, spec]) => ({\n name,\n level: \"semantic\",\n category: spec.category,\n type: spec.type,\n density: \"density\" in spec,\n }));\n}\n\n/**\n * Every token `@hussmartinez/ui` defines, base tokens first, in a stable\n * order. Use it to build token documentation or tooling.\n *\n * @public\n */\nexport const tokens: readonly TokenDefinition[] = /* @__PURE__ */ allDefinitions();\n\n/** Every definition, frozen. A function, so importing this module has no side effects. */\nfunction allDefinitions(): readonly TokenDefinition[] {\n const semanticList = semanticDefinitions();\n return Object.freeze(\n [...baseDefinitions(), ...semanticList, ...componentDefinitions(semanticList)].map(\n (definition) => Object.freeze(definition),\n ),\n );\n}\n\n/** Component tokens take their category and type from their fallback. */\nfunction componentDefinitions(semanticList: readonly TokenDefinition[]): TokenDefinition[] {\n const byFallback = new Map(semanticList.map((definition) => [definition.name, definition]));\n return Object.entries(component).map(([name, spec]) => {\n const fallback = byFallback.get(spec.fallback) as TokenDefinition;\n return {\n name,\n level: \"component\",\n category: fallback.category,\n type: fallback.type,\n density: false,\n fallback: spec.fallback,\n };\n });\n}\n\n/** Token definitions by name. */\nexport const tokensByName: ReadonlyMap<string, TokenDefinition> = /* @__PURE__ */ byName(tokens);\n\nfunction byName(list: readonly TokenDefinition[]): ReadonlyMap<string, TokenDefinition> {\n return new Map(list.map((definition) => [definition.name, definition]));\n}\n\n/** The names of the density tokens, in definition order. */\nexport const densityTokenNames: readonly DensityTokenName[] = /* @__PURE__ */ densityNames();\n\nfunction densityNames(): DensityTokenName[] {\n return tokens\n .filter((definition) => definition.density)\n .map((definition) => definition.name as DensityTokenName);\n}\n","import type { DensityTokenName, SemanticTokenName } from \"./definitions.js\";\n\n/** Semantic tokens set by the colour mode: everything except density tokens. */\nexport type SchemeTokenName = Exclude<SemanticTokenName, DensityTokenName>;\n\n/** Values shared by both built-in themes: type, shape, motion and stacking. */\nconst shared = {\n \"focus-ring-width\": \"2px\",\n \"focus-ring-offset\": \"2px\",\n \"focus-ring\": \"var(--hm-focus-ring-width) solid var(--hm-focus-ring-color)\",\n \"font-family\": \"var(--hm-font-sans)\",\n \"font-family-mono\": \"var(--hm-font-mono)\",\n \"font-size-small\": \"var(--hm-font-size-2)\",\n \"font-size-body\": \"var(--hm-font-size-3)\",\n \"font-size-title\": \"var(--hm-font-size-6)\",\n \"font-weight-regular\": \"var(--hm-font-weight-400)\",\n \"font-weight-strong\": \"var(--hm-font-weight-600)\",\n \"line-height-body\": \"var(--hm-leading-normal)\",\n \"line-height-tight\": \"var(--hm-leading-tight)\",\n \"letter-spacing\": \"0\",\n \"radius-control\": \"var(--hm-radius-md)\",\n \"radius-surface\": \"var(--hm-radius-lg)\",\n \"radius-round\": \"var(--hm-radius-full)\",\n \"border-width\": \"var(--hm-border-width-1)\",\n \"motion-duration-feedback\": \"var(--hm-duration-fast)\",\n \"motion-duration-enter\": \"var(--hm-duration-normal)\",\n \"motion-duration-exit\": \"var(--hm-duration-fast)\",\n \"motion-easing-standard\": \"var(--hm-easing-standard)\",\n \"motion-easing-enter\": \"var(--hm-easing-decelerate)\",\n \"motion-easing-exit\": \"var(--hm-easing-accelerate)\",\n \"z-raised\": \"1\",\n \"z-sticky\": \"10\",\n \"z-overlay\": \"100\",\n \"opacity-disabled\": \"0.5\",\n \"surface-width-small\": \"24rem\",\n \"surface-width-medium\": \"32rem\",\n \"surface-width-large\": \"48rem\",\n \"track-size\": \"0.375rem\",\n \"motion-duration-loop\": \"1s\",\n \"motion-easing-loop\": \"linear\",\n} as const;\n\n/** Semantic values of the built-in light theme. */\n/**\n * Adds the shared values. A pure call with plain-data arguments rather than\n * a spread at module scope, which bundlers can't drop, because spreading\n * could run getters. The values are literal strings for the same reason.\n */\nfunction withShared<T extends object>(values: T): typeof shared & T {\n return { ...shared, ...values };\n}\n\nexport const lightValues: Readonly<Record<SchemeTokenName, string>> = /* @__PURE__ */ withShared({\n \"color-scheme\": \"light\",\n \"color-bg\": \"var(--hm-white)\",\n \"color-surface\": \"var(--hm-gray-50)\",\n \"color-surface-raised\": \"var(--hm-white)\",\n \"color-surface-sunken\": \"var(--hm-gray-100)\",\n \"color-overlay\": \"oklch(0.26 0.01 260 / 0.5)\",\n \"color-text\": \"var(--hm-gray-900)\",\n \"color-text-muted\": \"var(--hm-gray-700)\",\n \"color-text-disabled\": \"var(--hm-gray-400)\",\n \"color-border\": \"var(--hm-gray-200)\",\n \"color-border-strong\": \"var(--hm-gray-600)\",\n \"color-control\": \"var(--hm-gray-100)\",\n \"color-control-hover\": \"var(--hm-gray-200)\",\n \"color-control-active\": \"var(--hm-gray-300)\",\n \"color-accent\": \"var(--hm-blue-700)\",\n \"color-accent-hover\": \"var(--hm-blue-800)\",\n \"color-accent-active\": \"var(--hm-blue-900)\",\n \"color-on-accent\": \"var(--hm-white)\",\n \"color-accent-subtle\": \"var(--hm-blue-100)\",\n \"color-accent-text\": \"var(--hm-blue-700)\",\n \"color-danger\": \"var(--hm-red-600)\",\n \"color-danger-hover\": \"var(--hm-red-700)\",\n \"color-on-danger\": \"var(--hm-white)\",\n \"color-danger-subtle\": \"var(--hm-red-100)\",\n \"color-danger-text\": \"var(--hm-red-700)\",\n \"color-warning\": \"var(--hm-amber-400)\",\n \"color-on-warning\": \"var(--hm-gray-950)\",\n \"color-warning-subtle\": \"var(--hm-amber-100)\",\n \"color-warning-text\": \"var(--hm-amber-800)\",\n \"color-success\": \"var(--hm-green-700)\",\n \"color-on-success\": \"var(--hm-white)\",\n \"color-success-subtle\": \"var(--hm-green-100)\",\n \"color-success-text\": \"var(--hm-green-700)\",\n \"focus-ring-color\": \"var(--hm-blue-700)\",\n \"shadow-raised\": \"0 1px 2px oklch(0 0 0 / 0.06), 0 4px 12px oklch(0 0 0 / 0.08)\",\n \"shadow-overlay\": \"0 8px 24px oklch(0 0 0 / 0.12), 0 24px 48px oklch(0 0 0 / 0.12)\",\n});\n\n/** Semantic values of the built-in dark theme. */\nexport const darkValues: Readonly<Record<SchemeTokenName, string>> = /* @__PURE__ */ withShared({\n \"color-scheme\": \"dark\",\n \"color-bg\": \"var(--hm-gray-950)\",\n \"color-surface\": \"var(--hm-gray-900)\",\n \"color-surface-raised\": \"var(--hm-gray-800)\",\n \"color-surface-sunken\": \"var(--hm-black)\",\n \"color-overlay\": \"oklch(0 0 0 / 0.6)\",\n \"color-text\": \"var(--hm-gray-50)\",\n \"color-text-muted\": \"var(--hm-gray-300)\",\n \"color-text-disabled\": \"var(--hm-gray-600)\",\n \"color-border\": \"var(--hm-gray-800)\",\n \"color-border-strong\": \"var(--hm-gray-400)\",\n \"color-control\": \"var(--hm-gray-800)\",\n \"color-control-hover\": \"var(--hm-gray-700)\",\n \"color-control-active\": \"var(--hm-gray-900)\",\n \"color-accent\": \"var(--hm-blue-400)\",\n \"color-accent-hover\": \"var(--hm-blue-300)\",\n \"color-accent-active\": \"var(--hm-blue-200)\",\n \"color-on-accent\": \"var(--hm-gray-950)\",\n \"color-accent-subtle\": \"var(--hm-blue-900)\",\n \"color-accent-text\": \"var(--hm-blue-300)\",\n \"color-danger\": \"var(--hm-red-400)\",\n \"color-danger-hover\": \"var(--hm-red-300)\",\n \"color-on-danger\": \"var(--hm-gray-950)\",\n \"color-danger-subtle\": \"var(--hm-red-950)\",\n \"color-danger-text\": \"var(--hm-red-300)\",\n \"color-warning\": \"var(--hm-amber-400)\",\n \"color-on-warning\": \"var(--hm-gray-950)\",\n \"color-warning-subtle\": \"var(--hm-amber-950)\",\n \"color-warning-text\": \"var(--hm-amber-300)\",\n \"color-success\": \"var(--hm-green-400)\",\n \"color-on-success\": \"var(--hm-gray-950)\",\n \"color-success-subtle\": \"var(--hm-green-950)\",\n \"color-success-text\": \"var(--hm-green-300)\",\n \"focus-ring-color\": \"var(--hm-blue-400)\",\n \"shadow-raised\": \"0 1px 2px oklch(0 0 0 / 0.4), 0 4px 12px oklch(0 0 0 / 0.4)\",\n \"shadow-overlay\": \"0 8px 24px oklch(0 0 0 / 0.5), 0 24px 48px oklch(0 0 0 / 0.5)\",\n});\n\n/** Density values: comfortable is the default. */\nexport const comfortableValues: Readonly<Record<DensityTokenName, string>> = {\n \"control-height\": \"2rem\",\n \"control-height-small\": \"1.5rem\",\n \"control-padding-x\": \"var(--hm-space-3)\",\n \"control-gap\": \"var(--hm-space-2)\",\n \"icon-size\": \"1.25rem\",\n \"target-size\": \"1.5rem\",\n \"gap-tight\": \"var(--hm-space-1)\",\n \"gap-normal\": \"var(--hm-space-2)\",\n \"gap-loose\": \"var(--hm-space-4)\",\n \"inset-tight\": \"var(--hm-space-2)\",\n \"inset-normal\": \"var(--hm-space-3)\",\n \"inset-loose\": \"var(--hm-space-5)\",\n};\n\n/** Compact density: one step tighter, never below the 24 px target size. */\nexport const compactValues: Readonly<Partial<Record<DensityTokenName, string>>> = {\n \"control-height\": \"1.75rem\",\n \"control-padding-x\": \"var(--hm-space-2)\",\n \"control-gap\": \"var(--hm-space-1)\",\n \"icon-size\": \"1rem\",\n \"gap-tight\": \"0.125rem\",\n \"gap-normal\": \"var(--hm-space-1)\",\n \"gap-loose\": \"var(--hm-space-3)\",\n \"inset-tight\": \"var(--hm-space-1)\",\n \"inset-normal\": \"var(--hm-space-2)\",\n \"inset-loose\": \"var(--hm-space-4)\",\n};\n\n/**\n * Coarse pointers, such as touch screens, get 44 px targets in every density\n * (ADR 0014).\n */\nexport const coarsePointerValues: Readonly<Partial<Record<DensityTokenName, string>>> = {\n \"control-height\": \"2.75rem\",\n \"control-height-small\": \"2.75rem\",\n \"target-size\": \"2.75rem\",\n};\n","import { UiError } from \"../errors/ui-error.js\";\nimport { densityTokenNames, tokens } from \"../tokens/definitions.js\";\nimport type { Theme } from \"./types.js\";\n\n/**\n * Writes validated themes as CSS: the rules shared by the built-in token CSS,\n * `themeToCss` and `ThemeProvider`. Nothing here validates token values;\n * callers pass themes from `createTheme`.\n */\n\nconst DENSITY_TOKENS = /* @__PURE__ */ new Set<string>(densityTokenNames);\nconst TOKEN_ORDER = /* @__PURE__ */ tokenOrder();\n\nfunction tokenOrder(): ReadonlyMap<string, number> {\n return new Map(tokens.map((definition, index) => [definition.name, index]));\n}\n\nconst MAX_SELECTOR_LENGTH = 500;\n\n/** The layer statements of styles.css (ADR 0005, docs/adr/0001). */\nexport const LAYER_ORDER =\n \"@layer hm.tokens, hm.base, hm.components, hm.sdk;\\n@layer hm.tokens.default, hm.tokens.theme;\";\n/**\n * Characters a selector may contain. Everything that could end the `@scope`\n * prelude or the stylesheet is missing: `{ } ; @ \\ < /` and so comments too.\n */\nconst SELECTOR_CHARACTERS = /^[A-Za-z0-9\\s_\\-.#:[\\]=\"'()*>+~,|^$]+$/;\n\nfunction invalidSelector(selector: string, reason: string): UiError {\n return new UiError(\n \"INVALID_THEME_SELECTOR\",\n `The selector \"${selector.slice(0, 200)}\" can't be used: ${reason}.`,\n { details: { selector: selector.slice(0, 200), reason } },\n );\n}\n\n/**\n * Checks that a selector is a plain selector list, and returns it with\n * normalised whitespace. Throws a {@link UiError} with the code\n * `INVALID_THEME_SELECTOR` otherwise.\n */\nexport function validateSelector(selector: unknown): string {\n if (typeof selector !== \"string\") {\n throw invalidSelector(String(selector), \"selectors must be strings\");\n }\n const trimmed = selector.trim().replace(/\\s+/g, \" \");\n if (trimmed.length === 0 || trimmed.length > MAX_SELECTOR_LENGTH) {\n throw invalidSelector(selector, `selectors must have 1 to ${MAX_SELECTOR_LENGTH} characters`);\n }\n if (!SELECTOR_CHARACTERS.test(trimmed)) {\n throw invalidSelector(selector, \"it contains a character that isn't allowed\");\n }\n const stack: string[] = [];\n let quote: string | undefined;\n for (const char of trimmed) {\n if (quote) {\n if (char === quote) {\n quote = undefined;\n } else if (!/[A-Za-z0-9 _.:-]/.test(char)) {\n throw invalidSelector(\n selector,\n \"quoted values may only contain letters, digits, spaces, _ . : and -\",\n );\n }\n continue;\n }\n if (char === '\"' || char === \"'\") {\n if (stack.at(-1) !== \"[\") {\n throw invalidSelector(selector, \"quotes are only allowed in attribute selectors\");\n }\n quote = char;\n } else if (char === \"(\" || char === \"[\") {\n stack.push(char);\n } else if (char === \")\" || char === \"]\") {\n if (stack.pop() !== (char === \")\" ? \"(\" : \"[\")) {\n throw invalidSelector(selector, \"brackets aren't balanced\");\n }\n }\n }\n if (quote || stack.length > 0) {\n throw invalidSelector(selector, \"brackets or quotes aren't balanced\");\n }\n return trimmed;\n}\n\nfunction byTokenOrder(a: string, b: string): number {\n const left = TOKEN_ORDER.get(a) ?? Number.MAX_SAFE_INTEGER;\n const right = TOKEN_ORDER.get(b) ?? Number.MAX_SAFE_INTEGER;\n return left - right || (a < b ? -1 : a > b ? 1 : 0);\n}\n\n/** One CSS rule: selectors and declarations, before indentation. */\nexport interface CssBlock {\n readonly selectors: readonly string[];\n readonly values: Readonly<Record<string, string>>;\n /** A condition the rule sits in, such as `(prefers-color-scheme: dark)`. */\n readonly media?: string;\n}\n\n/** Biome's line width; generated CSS is formatted the way Biome would format it. */\nconst LINE_WIDTH = 100;\n\nfunction declaration(indent: string, name: string, value: string): string {\n const line = `${indent}--hm-${name}: ${value};`;\n return line.length <= LINE_WIDTH ? line : `${indent}--hm-${name}:\\n${indent} ${value};`;\n}\n\n/** Writes rules with deterministic order and indentation. */\nexport function renderBlocks(blocks: readonly CssBlock[], indent: string): string {\n return blocks\n .filter((block) => Object.keys(block.values).length > 0)\n .map((block) => {\n const inner = block.media ? `${indent} ` : indent;\n const declarations = Object.keys(block.values)\n .sort(byTokenOrder)\n .map((name) => declaration(`${inner} `, name, block.values[name] as string))\n .join(\"\\n\");\n const rule = `${inner}${block.selectors.join(`,\\n${inner}`)} {\\n${declarations}\\n${inner}}`;\n return block.media ? `${indent}@media ${block.media} {\\n${rule}\\n${indent}}` : rule;\n })\n .join(\"\\n\\n\");\n}\n\n/** Splits a theme's tokens into the colour-mode part and the density part. */\nexport function splitTokens(values: Readonly<Record<string, string>>): {\n scheme: Record<string, string>;\n density: Record<string, string>;\n} {\n const scheme: Record<string, string> = {};\n const density: Record<string, string> = {};\n for (const [name, value] of Object.entries(values)) {\n (DENSITY_TOKENS.has(name) ? density : scheme)[name] = value;\n }\n return { scheme, density };\n}\n\n/**\n * Selectors for a theme applied at a root (`:root` for the built-in themes,\n * `:scope` inside `@scope` for custom ones), so the same rules serve both.\n */\nexport function themeBlocks(root: string, light: Theme, dark: Theme | undefined): CssBlock[] {\n const lightTokens = splitTokens(light.tokens);\n const density: CssBlock[] = [\n { selectors: [root, '[data-hm-density=\"comfortable\"]'], values: lightTokens.density },\n {\n selectors: [`${root}[data-hm-density=\"compact\"]`, '[data-hm-density=\"compact\"]'],\n values: light.compact,\n },\n {\n media: \"(pointer: coarse)\",\n selectors: [root, `${root}[data-hm-density]`, \"[data-hm-density]\"],\n values: light.coarsePointer,\n },\n ];\n if (!dark) {\n return [{ selectors: [root], values: lightTokens.scheme }, ...density];\n }\n const darkTokens = splitTokens(dark.tokens).scheme;\n return [\n {\n selectors: [root, '[data-hm-theme=\"light\"]', '[data-hm-theme=\"system\"]'],\n values: lightTokens.scheme,\n },\n {\n media: \"(prefers-color-scheme: dark)\",\n selectors: [root, '[data-hm-theme=\"system\"]'],\n values: darkTokens,\n },\n // Repeated after the media rule, so a forced theme on the root itself\n // beats the system preference.\n {\n selectors: [`${root}[data-hm-theme=\"light\"]`, '[data-hm-theme=\"light\"]'],\n values: lightTokens.scheme,\n },\n {\n selectors: [`${root}[data-hm-theme=\"dark\"]`, '[data-hm-theme=\"dark\"]'],\n values: darkTokens,\n },\n ...density,\n ];\n}\n\n/**\n * Writes validated themes as a stylesheet scoped to `selector`. The selector\n * is validated here; the themes must come from `createTheme`.\n */\nexport function writeThemeCss(light: Theme, dark: Theme | undefined, selector: string): string {\n const scope = validateSelector(selector);\n const body = renderBlocks(themeBlocks(\":scope\", light, dark), \" \");\n // The layer order is set by the first stylesheet that names a layer. Repeating\n // it here keeps custom themes above the built-in ones even when this CSS\n // loads before styles.css.\n const css = `${LAYER_ORDER}\\n\\n@layer hm.tokens.theme {\\n @scope (${scope}) {\\n${body}\\n }\\n}\\n`;\n if (css.includes(\"<\")) {\n // Unreachable: values and selectors are allowlisted. Kept as the last\n // line of defence, because this string goes into a <style> element.\n throw new UiError(\"INVALID_THEME_TOKEN\", \"The theme produced unsafe CSS.\", {\n details: { token: \"theme\", value: \"\", reason: \"the CSS contains <\" },\n });\n }\n return css;\n}\n","import { UiError } from \"../errors/ui-error.js\";\nimport { warnInDevelopment } from \"../internal/development.js\";\nimport { baseValues } from \"../tokens/base.js\";\nimport { densityTokenNames, tokens, tokensByName } from \"../tokens/definitions.js\";\nimport {\n coarsePointerValues,\n comfortableValues,\n compactValues,\n darkValues,\n lightValues,\n} from \"../tokens/themes.js\";\nimport { checkContrast } from \"./contrast-check.js\";\nimport { CssValueError, validateValue } from \"./css-value.js\";\nimport { writeThemeCss } from \"./css-writer.js\";\nimport { cssWriterOf, registerTheme } from \"./registry.js\";\nimport type { Theme, ThemeInput } from \"./types.js\";\n\ndeclare const process: { readonly env: { readonly NODE_ENV?: string } };\n\n/**\n * Names of component tokens, which `ui` can't list because SDKs add their\n * own: at least two lowercase words, such as `button-radius`.\n */\nconst COMPONENT_TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/;\nconst DENSITY_TOKENS = /* @__PURE__ */ new Set<string>(densityTokenNames);\nconst REQUIRED_TOKENS = /* @__PURE__ */ requiredTokens();\n\n/** Semantic tokens a theme without `extends` must set. */\nfunction requiredTokens(): string[] {\n return tokens\n .filter((definition) => definition.level === \"semantic\" && definition.name !== \"color-scheme\")\n .map((definition) => definition.name);\n}\n\nfunction invalidToken(token: string, value: unknown, reason: string): UiError {\n const shown = typeof value === \"string\" ? value.slice(0, 200) : typeof value;\n return new UiError(\n \"INVALID_THEME_TOKEN\",\n `The theme token \"${token}\" can't be used: ${reason}.`,\n { details: { token, value: shown, reason } },\n );\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\n/**\n * Validates a map of token values and returns the CSS written back from each.\n * `allowed` limits which names are accepted, for density maps.\n */\nfunction validateTokens(\n input: unknown,\n where: string,\n allowed?: ReadonlySet<string>,\n): Record<string, string> {\n if (input === undefined) {\n return {};\n }\n if (!isPlainObject(input)) {\n throw invalidToken(where, input, `${where} must be a plain object`);\n }\n const output: Record<string, string> = {};\n for (const [name, value] of Object.entries(input)) {\n const definition = tokensByName.get(name);\n if (name === \"color-scheme\") {\n throw invalidToken(name, value, \"set the colour scheme with the colorScheme option\");\n }\n if (allowed && !allowed.has(name)) {\n throw invalidToken(name, value, `only density tokens can be set in ${where}`);\n }\n if (!definition && !COMPONENT_TOKEN.test(name)) {\n throw invalidToken(name, value, \"it isn't a token name\");\n }\n if (typeof value !== \"string\") {\n throw invalidToken(name, value, \"values must be strings\");\n }\n try {\n output[name] = validateValue(value, definition?.type);\n } catch (error) {\n if (error instanceof CssValueError) {\n throw invalidToken(name, value, error.message);\n }\n throw error;\n }\n }\n return output;\n}\n\nfunction freeze(theme: Theme): Theme {\n Object.freeze(theme.tokens);\n Object.freeze(theme.compact);\n Object.freeze(theme.coarsePointer);\n Object.freeze(theme);\n registerTheme(theme, writeThemeCss);\n return theme;\n}\n\n/** Built-in themes are written in this repository, and checked by tests. */\nfunction builtInTheme(colorScheme: \"light\" | \"dark\", values: Record<string, string>): Theme {\n return freeze({\n colorScheme,\n tokens: { ...baseValues, ...values, ...comfortableValues },\n compact: { ...compactValues },\n coarsePointer: { ...coarsePointerValues },\n });\n}\n\n/**\n * The built-in light theme.\n *\n * @public\n */\nexport const lightTheme: Theme = /* @__PURE__ */ builtInTheme(\"light\", lightValues);\n\n/**\n * The built-in dark theme.\n *\n * @public\n */\nexport const darkTheme: Theme = /* @__PURE__ */ builtInTheme(\"dark\", darkValues);\n\nfunction warnAboutContrast(theme: Theme): void {\n const { failures, unchecked } = checkContrast(theme);\n if (failures.length > 0) {\n const list = failures\n .map((f) => `${f.foreground} on ${f.background}: ${f.ratio}:1, needs ${f.minimum}:1`)\n .join(\"; \");\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnInDevelopment(`This theme is below WCAG 2.2 AA contrast. ${list}.`);\n }\n }\n if (unchecked.length > 0) {\n const list = unchecked.map((u) => `${u.foreground} on ${u.background}`).join(\"; \");\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnInDevelopment(\n `These colour pairs couldn't be checked for contrast, so check them by hand: ${list}.`,\n );\n }\n }\n}\n\nfunction resolveParent(parent: ThemeInput[\"extends\"]): Theme | undefined {\n if (parent === undefined) {\n return undefined;\n }\n if (parent === \"light\") {\n return lightTheme;\n }\n if (parent === \"dark\") {\n return darkTheme;\n }\n return toTheme(parent);\n}\n\n/**\n * Creates a theme: a validated, frozen set of token values that\n * {@link themeToCss} and `ThemeProvider` apply.\n *\n * - With `extends`, only the tokens that change are needed.\n * - Without it, every semantic token is needed, so a theme can replace the\n * whole look.\n *\n * Every value is checked against its token's type and an allowlist grammar,\n * so a value can't break out of its CSS declaration, even when it comes from\n * a user. Invalid input throws a {@link UiError} with the code\n * `INVALID_THEME_TOKEN`. In development, it also warns when text, boundary or\n * focus colours fall below WCAG 2.2 AA contrast.\n *\n * @example\n * ```ts\n * const brand = createTheme({\n * extends: \"light\",\n * tokens: { \"color-accent\": \"#6d28d9\", \"radius-control\": \"0\" },\n * });\n * ```\n *\n * @public\n */\nexport function createTheme(input: ThemeInput): Theme {\n if (!isPlainObject(input)) {\n throw invalidToken(\"theme\", input, \"createTheme takes an options object\");\n }\n const parent = resolveParent(input.extends);\n const own = validateTokens(input.tokens, \"tokens\");\n if (!parent) {\n const missing = REQUIRED_TOKENS.filter((name) => !(name in own));\n if (missing.length > 0) {\n throw invalidToken(\n missing[0] as string,\n undefined,\n `a theme without \"extends\" needs every semantic token; missing ${missing.join(\", \")}`,\n );\n }\n }\n const colorScheme = input.colorScheme ?? parent?.colorScheme ?? \"light\";\n if (colorScheme !== \"light\" && colorScheme !== \"dark\") {\n throw invalidToken(\"color-scheme\", colorScheme, 'colorScheme must be \"light\" or \"dark\"');\n }\n const theme = freeze({\n colorScheme,\n tokens: { ...parent?.tokens, ...own, \"color-scheme\": colorScheme },\n compact: {\n ...(parent?.compact ?? {}),\n ...validateTokens(input.density?.compact, \"density.compact\", DENSITY_TOKENS),\n },\n coarsePointer: {\n ...(parent?.coarsePointer ?? coarsePointerValues),\n ...validateTokens(input.coarsePointer, \"coarsePointer\", DENSITY_TOKENS),\n },\n });\n // Inline, so production bundles drop the contrast check and its colour maths.\n if (typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\") {\n warnAboutContrast(theme);\n }\n return theme;\n}\n\n/**\n * Returns a theme that's safe to write into CSS. Themes from\n * {@link createTheme} are returned as they are. Anything else, such as a\n * theme parsed from JSON, is validated again.\n */\nexport function toTheme(value: unknown): Theme {\n if (cssWriterOf(value)) {\n return value as Theme;\n }\n if (!isPlainObject(value) || !isPlainObject(value[\"tokens\"])) {\n throw invalidToken(\"theme\", value, \"expected a theme from createTheme\");\n }\n const scheme = value[\"colorScheme\"];\n const { \"color-scheme\": _ignored, ...tokenValues } = value[\"tokens\"];\n const compact = value[\"compact\"];\n const coarsePointer = value[\"coarsePointer\"];\n return createTheme({\n extends: undefined,\n colorScheme: scheme === \"dark\" ? \"dark\" : \"light\",\n tokens: tokenValues as never,\n ...(isPlainObject(compact) ? { density: { compact } } : {}),\n ...(isPlainObject(coarsePointer) ? { coarsePointer } : {}),\n });\n}\n","import { toTheme } from \"./create-theme.js\";\nimport { writeThemeCss } from \"./css-writer.js\";\nimport { isThemePair } from \"./pair.js\";\nimport type { Theme, ThemePair } from \"./types.js\";\n\n/**\n * Writes a theme, or a light and dark pair, as a static stylesheet: for\n * build-time theming, server rendering without JavaScript, and strict\n * Content Security Policies.\n *\n * - **A single theme** applies to the elements `selector` matches, and\n * everything inside them.\n * - **A pair** follows `prefers-color-scheme` in pure CSS, and descendants can\n * force a mode with `data-hm-theme=\"light|dark|system\"`.\n * - **Density** follows `data-hm-density`, and coarse pointers get 44 px\n * targets.\n *\n * The rules sit in the `hm.tokens.theme` cascade layer, so they beat the\n * built-in themes whatever order stylesheets load in, and a host's unlayered\n * CSS still beats them. They're wrapped in `@scope`, so when themes are\n * nested, the closest one wins.\n *\n * Themes that didn't come from {@link createTheme} are validated again, and\n * the selector must be a plain selector list. Invalid input throws a\n * {@link UiError}. The output never contains `<`, so it's safe inside a\n * `<style>` element.\n *\n * @param theme - A theme from `createTheme`, or a `{ light, dark }` pair.\n * @param selector - Where the theme applies. Defaults to `:root`.\n *\n * @example\n * ```ts\n * // brand.css.ts, run at build time\n * export default themeToCss({ light: brandLight, dark: brandDark });\n * ```\n *\n * @public\n */\nexport function themeToCss(theme: Theme | ThemePair, selector = \":root\"): string {\n const isPair = typeof theme === \"object\" && theme !== null && isThemePair(theme);\n const light = toTheme(isPair ? theme.light : theme);\n const dark = isPair ? toTheme(theme.dark) : undefined;\n return writeThemeCss(light, dark, selector);\n}\n"],"mappings":";;AAOA,IAAa,aAAsD;CACjE,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,YAAY;CACZ,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,YAAY;CACZ,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,OAAO;CACP,OAAO;CACP,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,YAAY;C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;CACpD,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,wBAAwB;EACtB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,iBAAiB;EAAE,UAAU;EAAS,MAAM;CAAQ;CACpD,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,wBAAwB;EACtB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,cAAc;EACZ,UAAU;EACV,MAAM;CACR;CACA,eAAe;EACb,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,kBAAkB;EAChB,UAAU;EACV,MAAM;CACR;CACA,mBAAmB;EACjB,UAAU;EACV,MAAM;CACR;CACA,uBAAuB;EACrB,UAAU;EACV,MAAM;CACR;CACA,sBAAsB;EACpB,UAAU;EACV,MAAM;CACR;CACA,oBAAoB;EAClB,UAAU;EACV,MAAM;CACR;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;CACR;CACA,kBAAkB;EAChB,UAAU;EACV,MAAM;CACR;CACA,kBAAkB;EAChB,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,wBAAwB;EACtB,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,qBAAqB;EACnB,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,eAAe;EACb,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,aAAa;EACX,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,eAAe;EACb,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,aAAa;EACX,UAAU;EACV,MAAM;EACN,SAAS;CACX;CACA,cAAc;EACZ,UAAU;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