{"_id":"@adysre/rules-theme","name":"@adysre/rules-theme","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adysre/rules-theme","version":"0.1.0","type":"module","description":"Design tokens for the rule builder, and a contrast audit that proves a theme is readable.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-theme"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./tokens.css":"./dist/tokens.css","./package.json":"./package.json"},"main":"./dist/index.js","types":"./dist/index.d.ts","sideEffects":["*.css"],"devDependencies":{"@types/node":"^20.16.10","tsx":"^4.19.1","typescript":"^5.6.3","@adysre/config":"0.1.0"},"dependencies":{"@adysre/rules-types":"0.1.0"},"keywords":["rules-engine","business-rules","rule-builder","json-logic","decision-engine","typescript"],"engines":{"node":">=20.0.0"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.build.json && cp src/tokens.css dist/tokens.css && node ../config/scripts/fix-declarations.mjs","lint":"eslint src","typecheck":"tsc --noEmit","test":"tsx --test 'src/**/*.test.ts'","clean":"rm -rf dist .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo"},"_id":"@adysre/rules-theme@0.1.0","bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"homepage":"https://github.com/abhisheksahu093/Adysre#readme","_integrity":"sha512-nmeE9VZ2eN94+ba4KBe6k23Oi5b0zidFXJVIRVWXfcre8nfvNdT1yd79MjNlAyIDi9GWnNjkfCfSKrgMxGqwdA==","_resolved":"/private/var/folders/xx/vrjl61fs7dlb3dhyq5_lgzkm0000gn/T/c8d0a73c76ccef01a6ce4aa84fa6b751/adysre-rules-theme-0.1.0.tgz","_from":"file:adysre-rules-theme-0.1.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-nmeE9VZ2eN94+ba4KBe6k23Oi5b0zidFXJVIRVWXfcre8nfvNdT1yd79MjNlAyIDi9GWnNjkfCfSKrgMxGqwdA==","shasum":"2727a8f0a7a927f0ca884b5ddd1a2aa59c7459ce","tarball":"https://registry.npmjs.org/@adysre/rules-theme/-/rules-theme-0.1.0.tgz","fileCount":19,"unpackedSize":43038,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/rkTVzXPZbQjyasEuv4e2X/rkucUj4O64aq0ZNrVfCQIgEqwNUulkL50DvHQMsqxtVDd7sJ8LXWdO2nqSGqvmANA="}]},"_npmUser":{"name":"adysre","email":"abhisheksahu093@gmail.com"},"directories":{},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rules-theme_0.1.0_1785148637969_0.8461019146381199"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T10:37:17.834Z","0.1.0":"2026-07-27T10:37:18.163Z","modified":"2026-07-27T10:37:18.392Z"},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"description":"Design tokens for the rule builder, and a contrast audit that proves a theme is readable.","homepage":"https://github.com/abhisheksahu093/Adysre#readme","keywords":["rules-engine","business-rules","rule-builder","json-logic","decision-engine","typescript"],"repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-theme"},"bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"license":"MIT","readme":"# @adysre/rules-theme\n\nThe builder's colours, and proof they can be read.\n\n```tsx\n<RuleBuilder theme={darkRulesTheme} … />\n```\n\n```ts\nconst audit = auditTheme(myTokens);\nif (!audit.passes) throw new Error(auditReport(audit));\n// \"warning on card (a warning) is 2.14:1, needs 4.5:1\"\n```\n\n## The audit is the point\n\n\"WCAG AA\" is otherwise a claim somebody makes in a pull request. It is\narithmetic, so it can be checked — and a theme package that shipped colours\nwithout checking them would be the one place in the system where an\naccessibility failure is invisible to every other test.\n\n`CONTRAST_PAIRS` lists the combinations the builder **actually renders** —\n`text-danger` on a card, `text-muted-foreground` on a muted panel — so a failure\nis something you can point at on screen rather than a theoretical clash between\ntwo tokens that never meet.\n\nIt found one in this package's own dark theme: white on blue-500 is 3.68:1, and\ndarkening the fill until white passes puts a near-black button on a near-black\npage. The dark theme uses a light fill with a dark label because the audit made\nthat an answer instead of a matter of taste.\n\n**It does not guess.** A token pointing at `var(--brand)` or an `oklch()` is\nreported as `unchecked` rather than assumed to pass. An audit that quietly skips\nwhat it cannot read is an audit that always passes.\n\n**Borders are not audited.** WCAG 1.4.11 holds interface parts to 3:1, and\n`input` and `ring` are here because both carry information you need to operate\nthe thing: where a text box begins, and what has focus. The decorative outline\naround a condition row is not — a row is identified by what is written in it,\nand holding a subtle separator to a control's standard forces every theme into\nheavy grey outlines to satisfy a rule that does not apply.\n\n## Tokens are named after ADYSRE's\n\nDeliberately. A host that already has a design system defines\n`--background`, `--muted-foreground` and the rest already, so the builder\n**inherits** it rather than imposing a second palette on the page. That is what\n`ThemePlugin` meant by carrying token names and never colour literals.\n\nA host with no design system imports the stylesheet and gets a readable default:\n\n```css\n@import '@adysre/rules-theme/tokens.css';\n```\n\nThe list comes from what the components use — every `bg-`, `text-`, `border-`\nand `ring-` class in `rules-ui` and `rules-devtools`. A token nobody uses is a\npromise a host keeps for nothing; one the components use and the list omits is a\ntheme that silently half-applies.\n\n## The defaults are not a brand palette\n\nA brand palette is chosen for large surfaces — a button, a banner, a chart. The\nbuilder renders dense small text. `#f59e0b` reads beautifully as a filled badge\nand sits at **2.14:1** as a sentence, which is a fail. So each accent here is the\ntext-safe variant of the same hue, and the audit proves it rather than a comment\nclaiming it.\n\n## Applying one\n\n`themeStyle` returns custom properties, so a theme **scopes to a subtree**: two\nbuilders on one page can wear different themes, which a stylesheet cannot do\nwithout a class per theme. The debugger needs no theme prop — custom properties\ninherit, so a `RuleDebugger` inside a themed builder is already themed.\n\n`createRulesTheme` fills gaps from a base, so \"ADYSRE, but a different accent\"\ndoes not mean restating eighteen values. It **throws** on a token this build has\nno name for: a typo in a theme is a programming error, and the moment to find it\nis when the theme is declared rather than when somebody notices one panel is the\nwrong colour.\n\n## Drift\n\n`tokens.css` restates what `themes.ts` holds, because a stylesheet cannot import\na TypeScript record. A test parses the CSS and compares all three blocks —\nlight, `.dark`, and the `prefers-color-scheme` copy — against the audited sets.\nWithout it the audit would keep passing against the TS values while the CSS a\nhost actually loads had gone stale.\n\nSee [`documents/RULES_ENGINE.md`](../../documents/RULES_ENGINE.md).\n","readmeFilename":"README.md","_rev":"1-54a293fc4e977f569c9d771a90911e56"}