{"_id":"@baukit/ui-tokens","_rev":"7-5025e263f430d68c6ea5327965f81fe2","name":"@baukit/ui-tokens","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@baukit/ui-tokens","version":"0.1.0","author":"Patrick Koss","license":"MIT","_id":"@baukit/ui-tokens@0.1.0","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"56af5960cccc7804f516422742995c0c57f741bd","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.1.0.tgz","fileCount":39,"integrity":"sha512-jTI83kCEtc/kPSHYCw5bMZAc3NZavTq6A7c4SmXhf6GzzxE8213/V4CyzKM+4dQ9KHg5Ko7Z2Fe5/nsb29BIgw==","signatures":[{"sig":"MEQCIAgMPhIV2fimrLbrkoSVvnwAxrQ0LgiowWSOb5mXw7iiAiAoy0h5ZIFO2zaJjave1GH5Yovx+Pu3BRMlc/uBJgprhw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73186},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"patrickkoss","email":"pati.koss@gmx.de"},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.1.0_1787683574570_0.3309608619140194","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@baukit/ui-tokens","version":"0.1.1","author":{"name":"Patrick Koss"},"license":"MIT","_id":"@baukit/ui-tokens@0.1.1","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"eca45059a57e7e9ada244360f405a012fe350b90","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.1.1.tgz","fileCount":39,"integrity":"sha512-iYUYkF8T6PeGtIMqGUxdIp5mZ8vzLr8+7f6Xw9KSXiAVMepmKdxykVsjUh92XrOIq5A4Bg+uPa0X9dVJJ1fdrA==","signatures":[{"sig":"MEYCIQCPqkcl4oon3LvbYZO0OMXXqQ7k2EG1XNAhp7+jGBTXpQIhAObKqBl+fuHnmuK+MQQNI4hTXO3Slpjbrn7qwJ8C5tIE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@baukit%2fui-tokens@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":73367},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"gitHead":"6f2299927c02c155eb071e4ece8ab4d84bf5195c","scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","prepare":"pnpm run build","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6124670e-1468-4a64-8877-8b088ce20d30"}},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"_npmVersion":"12.0.2","description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.1.1_1788301129904_0.9403056567494157","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@baukit/ui-tokens","version":"0.1.2","author":{"name":"Patrick Koss"},"license":"MIT","_id":"@baukit/ui-tokens@0.1.2","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"5989bbd034ba28e08319a2e5f4802b6707ed9cec","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.1.2.tgz","fileCount":39,"integrity":"sha512-qiggQ3yV8rAL7WS0nodMRJ6ksY59Osw6woa8NsPJXGjeCNOQBskLUnZ4VRYWXL+WEkLwCVBob1uobvcziYI3ow==","signatures":[{"sig":"MEUCIDD/sBQ7gku8e3aNoq4A0bUShqzn3j1H6IigetJeZ9FxAiEA0TZnbG8dIjR2K0xDHGH3de9bd4nqjMsC9moAHuV9M5s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@baukit%2fui-tokens@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":73367},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"gitHead":"b8dce5e22edf5e3bc4e8fb70b9fc279a9b1f0594","scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","prepare":"pnpm run build","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6124670e-1468-4a64-8877-8b088ce20d30"}},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"_npmVersion":"12.0.2","description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.1.2_1788302029556_0.5765208028085334","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@baukit/ui-tokens","version":"0.2.0","author":{"name":"Patrick Koss"},"license":"MIT","_id":"@baukit/ui-tokens@0.2.0","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"1721a9525e4af2260d16f8fd7fe384ca700207be","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.2.0.tgz","fileCount":39,"integrity":"sha512-4s46WKmfNedQ0Zpdkc2VwqZsGHr18DVr06c10tnNugXf8sfQ5ZQ3kfWDE/GAgdfxlhC1NbnSJNqZzl4ZkqKYlw==","signatures":[{"sig":"MEUCIQCSf4OBHkSGHhbOQfTk2dWgoB7nKC0u3kbo0w1JvGPfKAIgf+/3znbEFebDCh1q1FrnYWaXglCwXAJ+4td/zNmLHSo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@baukit%2fui-tokens@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":99218},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"gitHead":"78581ec3ed945955eae06105167bedbb85fd0da7","scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","prepare":"pnpm run build","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6124670e-1468-4a64-8877-8b088ce20d30"}},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"_npmVersion":"12.0.2","description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.2.0_1788423005522_0.7089889163635117","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@baukit/ui-tokens","version":"0.2.1","author":{"name":"Patrick Koss"},"license":"MIT","_id":"@baukit/ui-tokens@0.2.1","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"e92dcd1d617a5cbf1938dd87ea81c5a9b23a04d5","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.2.1.tgz","fileCount":39,"integrity":"sha512-a95+9WA9oInj8GfABhEvnsW5p0aHtghZtntRlL2rtNaqNRh16vRGRgOgMkc9PEBxUOeowIyRysPuJrG2uDSsow==","signatures":[{"sig":"MEUCID6xDj7kIpGvusnHrZq54u3msP3/gM4usZpUjBELzDOaAiEA/LV932Kivs9MeEkNuK4Mkd97GwzfBB6J48JlsrlbtAc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@baukit%2fui-tokens@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":99218},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"gitHead":"88f513be8ea771920471c88a0007a479470954a1","scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","prepare":"pnpm run build","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6124670e-1468-4a64-8877-8b088ce20d30"}},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"_npmVersion":"12.0.2","description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.2.1_1788436276254_0.8480458395101345","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@baukit/ui-tokens","version":"0.3.0","author":"Patrick Koss","license":"MIT","_id":"@baukit/ui-tokens@0.3.0","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"homepage":"https://github.com/PatrickKoss/baukit#readme","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"0051f02031581a462c4b7421713a2ee2cd140d2b","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.3.0.tgz","fileCount":39,"integrity":"sha512-eGnyFNu9aBAvI0QnJirtXwEz7r+ZSRIJwhQYLkmA34iApPun0fwnw7xAu11zAXrpcn2IfPhtalYm3AY71yKD1A==","signatures":[{"sig":"MEUCIBxZtYI3qprxrJXuKsIVfmSgmIEFHUAGM8K5hYjcsFGXAiEA6PqMvHqM4wmgFoStdqiBEJBy6BdMQG/W66YIkwZOdeo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCLH3qb+FBsONbykvJhjh1fNfKwpcrR30c7paPidZVTvgIgdKhGE09WFWuYCac/VMpLekRdUxQmjNsE+56gz/r+AD8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99184},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","format:check":"prettier --check src package.json tsconfig.json"},"_npmUser":{"name":"patrickkoss","email":"pati.koss@gmx.de"},"repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ui-tokens_0.3.0_1788545343177_0.0021485858481482545","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"_id":"@baukit/ui-tokens@0.4.0","bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"dist":{"shasum":"ae8b9df092442c3563a935afd544d99215f72727","tarball":"https://registry.npmjs.org/@baukit/ui-tokens/-/ui-tokens-0.4.0.tgz","fileCount":39,"integrity":"sha512-AzMSyCg0JGjt6rY618y1YnC03e/VwhrFOdgl7OPX+dRXK3FsUtzcknWgdugOeqLxISXPsMP36D+MSR0LovVDyg==","signatures":[{"sig":"MEQCIEqjTz0lvBEKnye10tnXjx1dsit7CHrpQe1wdcnTrgafAiAQyVvl2Osqqy7eg4Xp8y6xM85mj5sj2bbg7GP5fNvdxQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDT3eE7fG5IfzLD2FqRvPxf5nSr6VMbU0qay3T5uK2zAQIgQCBUFpZHBjmvac+dD6if+uyrYwamyr0tUyKOIHhiBMc="}],"unpackedSize":99184},"name":"@baukit/ui-tokens","type":"module","types":"./dist/index.d.ts","author":"Patrick Koss","engines":{"node":">=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.js"}},"license":"MIT","scripts":{"lint":"eslint src --max-warnings=0","test":"vitest run --config ../../vitest.config.ts","build":"tsc -p tsconfig.json","format:check":"prettier --check src package.json tsconfig.json"},"version":"0.4.0","_npmUser":{"name":"patrickkoss","email":"pati.koss@gmx.de"},"homepage":"https://github.com/PatrickKoss/baukit#readme","repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","directories":{},"maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.39.5","vitest":"4.1.10","typescript":"6.0.3","@types/estree":"1.0.9"},"peerDependencies":{"eslint":"^9.39.5"},"peerDependenciesMeta":{"eslint":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ui-tokens_0.4.0_1789245151535_0.06910360351254075"}}},"time":{"created":"2026-08-25T18:46:14.266Z","modified":"2026-09-12T20:32:31.781Z","0.1.0":"2026-08-25T18:46:14.699Z","0.1.1":"2026-09-01T22:18:50.498Z","0.1.2":"2026-09-01T22:33:49.693Z","0.2.0":"2026-09-03T08:10:05.672Z","0.2.1":"2026-09-03T11:51:16.455Z","0.3.0":"2026-09-04T18:09:03.338Z","0.4.0":"2026-09-12T20:32:31.611Z"},"bugs":{"url":"https://github.com/PatrickKoss/baukit/issues"},"author":"Patrick Koss","license":"MIT","homepage":"https://github.com/PatrickKoss/baukit#readme","repository":{"url":"git+https://github.com/PatrickKoss/baukit.git","type":"git","directory":"typescript/packages/ui-tokens"},"description":"Dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.","maintainers":[{"name":"patrickkoss","email":"pati.koss@gmx.de"}],"readme":"# `@baukit/ui-tokens`\n\nA dependency-free design-token schema, validator, accessibility checker, and deterministic compiler for web and React Native.\n\n## Define and validate tokens\n\n```ts\nimport { checkContrast, parseTokens, type DesignTokens } from '@baukit/ui-tokens';\n\nconst tokens = parseTokens(untrustedJson);\nconst violations = checkContrast(tokens);\n```\n\nColors are opaque `#RGB` or `#RRGGBB` sRGB values with light and dark variants. Color leaves require at least a semantic group and name. Typography, space, radius, motion, and elevation are named scales. `contrastPairs` declares foreground/background semantic paths; normal text must reach 4.5:1 and entries marked `largeText` must reach 3:1 in both themes. Validation errors include paths such as `$.color.text.primary.light`, while contrast failures include the calculated ratio.\n\nValidation is handwritten rather than Zod-based: the schema is small, this keeps production dependencies at zero, and it enables diagnostics tailored to semantic token paths.\n\n## Work with colors\n\nThe color helpers accept three- or six-digit hexadecimal sRGB colors, with an\noptional `#`. Normalized and calculated colors use lowercase `#rrggbb` form.\n\n```ts\nimport {\n  blendColors,\n  chooseReadableForeground,\n  hexToRgb,\n  normalizeHexColor,\n  rgbToHex,\n} from '@baukit/ui-tokens';\n\nnormalizeHexColor('09C'); // '#0099cc'\nhexToRgb('#0099cc'); // { r: 0, g: 153, b: 204 }\nrgbToHex({ r: 0, g: 153, b: 204 }); // '#0099cc'\nblendColors('#ffffff', '#000000', 0.25); // '#404040'\n\nconst foreground = chooseReadableForeground('#005fcc', ['#ffffff', '#111111'], 4.5);\n// { foreground: '#ffffff', ratio: 5.98..., meetsThreshold: true }\n```\n\n`blendColors` clamps its ratio to `[0, 1]`. `chooseReadableForeground` returns\nthe first candidate that meets the threshold. If none passes, it returns the\ncandidate with the highest ratio and sets `meetsThreshold` to `false`.\n\n## Check a semantic contrast matrix\n\n`DEFAULT_SEMANTIC_CONTRAST_REQUIREMENTS` defines these role paths:\n\n- `color.background.primary` and `color.background.elevated`\n- `color.text.primary` and `color.text.muted`\n- `color.border.primary` and `color.focus.ring`\n- `color.action.primary`, `color.action.onPrimary`, `color.action.secondary`, and `color.action.onSecondary`\n- `color.status.success`, `color.status.warning`, `color.status.danger`, and their `onSuccess`, `onWarning`, and `onDanger` foregrounds\n\nText and labeled foregrounds require 4.5:1. Borders and focus rings require\n3:1 against both background roles. The checker tests every requirement in the\nlight and dark variants and returns every failure.\n\n```ts\nimport {\n  checkSemanticContrastMatrix,\n  DEFAULT_SEMANTIC_CONTRAST_REQUIREMENTS,\n} from '@baukit/ui-tokens';\n\nconst failures = checkSemanticContrastMatrix(tokens, [\n  ...DEFAULT_SEMANTIC_CONTRAST_REQUIREMENTS,\n  {\n    foregroundRole: 'color.chart.label',\n    backgroundRole: 'color.chart.background',\n    minimumRatio: 4.5,\n  },\n]);\n```\n\nPass a different list to replace the defaults. A missing role or a minimum\noutside the possible WCAG range of 1 through 21 throws a descriptive error.\n\n## Calculate vertical layout\n\nProducts supply every dimension and threshold. Both functions reject negative\nor non-finite values.\n\n```ts\nimport { getUsableContentHeight, isShortViewport } from '@baukit/ui-tokens';\n\ngetUsableContentHeight(720, 112, 128); // 480\nisShortViewport(600, productLayout.shortViewportHeight); // true\n```\n\n## Compile\n\n```ts\nimport { toCssVariables, toReactNative } from '@baukit/ui-tokens';\n\nconst css = toCssVariables(tokens);\nconst nativeModule = toReactNative(tokens);\n```\n\n`toCssVariables` emits sorted `--bk-*` declarations in `:root`, then dark color overrides under `[data-theme=\"dark\"]`. `toReactNative` emits a sorted nested `tokens` constant with an inferred `Tokens` type. Accessibility declarations are build metadata and are omitted from generated runtime constants.\n\n## Enforce tokens with `no-raw-color`\n\nThe design-token schema is only worth having if colors stay out of components.\n`@baukit/ui-tokens/eslint` ships an ESLint flat-config plugin that reports CSS\ncolors written directly in application code.\n\n```js\nimport uiTokens from '@baukit/ui-tokens/eslint';\n\nexport default [\n  {\n    plugins: { '@baukit/ui-tokens': uiTokens },\n    rules: {\n      '@baukit/ui-tokens/no-raw-color': [\n        'error',\n        { allowedFiles: ['src/theme/tokens.ts', 'src/theme/**'] },\n      ],\n    },\n  },\n];\n```\n\n`configs.recommended` turns the rule on with defaults when a product needs no\noptions:\n\n```js\nimport { configs } from '@baukit/ui-tokens/eslint';\n\nexport default [configs.recommended];\n```\n\nThe rule reports `#rgb`, `#rrggbb`, and `#rrggbbaa` hex values plus\n`rgb()`, `rgba()`, `hsl()`, and `hsla()` anywhere they appear, in string and\ntemplate literals alike. CSS color keywords such as `crimson` are reported only\nin a style-like position: a color-named property, a `StyleSheet.create` call, a\n`style`, `color`, or `fill` JSX attribute, a `css` tagged template, or a\nvariable whose name ends in `style`, `theme`, `palette`, or `colors`. That\nrestriction keeps route names, test ids, and ordinary prose off the report.\n\nOptions:\n\n| Option                      | Default                                          | Meaning                                                                                                                              |\n| --------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |\n| `allowedFiles`              | `[]`                                             | Glob-like paths that may declare raw colors. `*` matches inside a path segment, `**` across segments. Put the token definition here. |\n| `allowedValues`             | `transparent`, `currentColor`, `inherit`, `none` | Literals allowed everywhere. Entries add to the defaults.                                                                            |\n| `additionalStyleProperties` | `[]`                                             | Extra property or attribute names treated as style-like.                                                                             |\n| `reportKeywords`            | `true`                                           | Set to `false` to report only hex and functional notations.                                                                          |\n\n## Boundaries\n\nThis package shares semantic values such as `color.background.primary`. It is deliberately not a\ndesign system and not a cross-platform component library: DOM and React Native components,\ninteraction behavior, raw brand-palette decisions, and product themes all stay outside it.\n\n`exampleTokens` demonstrates every group as a test fixture. It is not a Baukit visual language, and\ncopying it into a product as a starting palette is not what it is for.\n\nThe production entry point has no runtime dependencies. `eslint` is an optional peer dependency\nreached only through the `/eslint` subpath, so importing the package never loads it.\n","readmeFilename":""}