{"_id":"@adysre/rules-ui","name":"@adysre/rules-ui","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adysre/rules-ui","version":"0.1.0","type":"module","description":"The visual rule builder: React components over @adysre/rules-react, styled with design tokens.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-ui"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"main":"./dist/index.js","types":"./dist/index.d.ts","devDependencies":{"@types/node":"^20.16.10","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","eslint-plugin-react-hooks":"^7.1.1","react":"^19.0.0","react-dom":"^19.0.0","tsx":"^4.19.1","typescript":"^5.6.3","vitest":"^2.1.2","@adysre/config":"0.1.0"},"dependencies":{"@adysre/rules-core":"0.1.0","@adysre/rules-react":"0.1.0","@adysre/rules-renderer":"0.1.0","@adysre/rules-theme":"0.1.0","@adysre/rules-types":"0.1.0","adysre":"0.2.0"},"peerDependencies":{"react":"^19.0.0"},"keywords":["rules-engine","business-rules","rule-builder","json-logic","decision-engine","typescript"],"engines":{"node":">=20.0.0"},"sideEffects":false,"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.build.json && node ../config/scripts/fix-declarations.mjs","lint":"eslint src","typecheck":"tsc --noEmit","test":"vitest run","clean":"rm -rf dist .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo"},"_id":"@adysre/rules-ui@0.1.0","bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"homepage":"https://github.com/abhisheksahu093/Adysre#readme","_integrity":"sha512-j11SQUOgIY66ytRY2+yMLM2fK6MyNLew3C5wprR+Fq+L6Dy5cBBAMBwwdSorU5gdOHpr4t+gg2PMO3yEn7F+bQ==","_resolved":"/private/var/folders/xx/vrjl61fs7dlb3dhyq5_lgzkm0000gn/T/0c0d6c651ca2a47d1a5036837cc5bcc3/adysre-rules-ui-0.1.0.tgz","_from":"file:adysre-rules-ui-0.1.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-j11SQUOgIY66ytRY2+yMLM2fK6MyNLew3C5wprR+Fq+L6Dy5cBBAMBwwdSorU5gdOHpr4t+gg2PMO3yEn7F+bQ==","shasum":"11bc0c7be31db1550441cff95537bf4623cbfda5","tarball":"https://registry.npmjs.org/@adysre/rules-ui/-/rules-ui-0.1.0.tgz","fileCount":82,"unpackedSize":164481,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCyNeSsupWlpiddINLbaIjipld0lAHR1FVGKdPUkx9OzwIgHIhFcDZcvtZSvm/x/JINZaSH5EvkA0lOTjFgxfWOMgo="}]},"_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-ui_0.1.0_1785148449658_0.20724627255501527"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T10:34:09.458Z","0.1.0":"2026-07-27T10:34:09.801Z","modified":"2026-07-27T10:34:10.085Z"},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"description":"The visual rule builder: React components over @adysre/rules-react, styled with design tokens.","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-ui"},"bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"license":"MIT","readme":"# @adysre/rules-ui\n\nThe visual builder. A projection of the AST, like everything else in this\nengine.\n\n```tsx\nconst registry = createRegistry(builtinPlugins, { fields: [schema], actions: [reject] });\n\n<RuleBuilder\n  rule={document}\n  registry={registry}\n  sample={order}          // runs the rule as it is edited\n  onChange={setDocument}\n  onSave={save}\n/>\n```\n\n## It edits the tree and nothing else\n\nNo state of its own beyond what a text box needs between keystrokes. Every edit\nis a dispatch into `@adysre/rules-react`, so undo, per-node validation and\ndirtiness behave here exactly as they do for a host driving the store without a\nscreen, and `state.rule` still goes straight to `stringifyRule`,\n`evaluateRule` or `describeRule`.\n\n## Everything it can do comes from a plugin\n\nThe builder holds no table of what `between` needs or which operators suit a\ndate. `arity` says how many value boxes to draw, `accepts` says which operators\nto offer for the type on the left, `returns` types a function operand, and\n`requiresTarget` decides whether an action shows a target. Register\n`withinBusinessHours` and it appears in the right rows, with the right number of\nboxes, without this package hearing about it.\n\n## The decisions live outside the components\n\n| Module | Answers |\n| --- | --- |\n| `labels` | every word the builder says, and what to call a plugin |\n| `operators` | which operators fit a type, how many boxes each draws |\n| `operands` | what type an operand produces, what changing its source does |\n| `values` | text in a box to JSON and back |\n| `actions` | which actions suit a rule kind, which boxes each one shows |\n\nAll plain functions, all tested without a renderer. A decision that can only be\nreached by rendering something is a decision nobody tests.\n\n## Decisions worth knowing\n\n**An empty box is `null`, for every type.** Not `\"\"` and not `0`. A box nobody\nfilled in is a value nobody chose, `validateRule` can see the condition is\nincomplete, and an untouched row never looks like a deliberate comparison\nagainst the empty string. Someone who means \"has no value\" has `isEmpty`.\n\n**A typed box never guesses; a list always does.** A string field holding `3`\nstays text. A list has no declared element type to consult, so `gold, 3` becomes\n`[\"gold\", 3]` and `isOneOf` can match either.\n\n**A `null` literal types as `any`.** Every new condition starts as one, and\nreading it as the `null` type would leave a fresh row offering almost no\noperators.\n\n**An unknown operator still draws, and keeps its values.** The row says this\ndeployment has no such operator; it does not silently rewrite the rule to\nwhichever operator happened to be first in the list.\n\n**Switching an operand's source starts empty.** A path is not a variable name.\nCarrying text across would put a plausible wrong value where an obviously empty\nslot belongs.\n\n**Reordering is buttons, not drag and drop.** A tree is reordered from the\nkeyboard as often as with a mouse, and dragging with no keyboard equivalent is\nwhere a builder's accessibility usually goes.\n\n**The preview is rendered from segments.** `describeRule` returns typed pieces,\nso the field being edited can be highlighted, the verdict that decided a\ncondition can be coloured, and clicking a line can select the node it describes.\nNone of that survives being flattened to a string first.\n\n**The clock is fixed at mount.** A preview whose `today` advanced on every\nkeystroke would mean something different halfway through writing a condition\nabout it. Pass `now` to fix it yourself.\n\n## English lives in one record\n\nPlugins carry `labelKey` and never a label. `BuilderLabels` is the whole\nvocabulary, so a locale is `labels={de}` rather than a fork, and a host that\ncalls a field an attribute changes one string. Overrides merge, so adding a\nlabel for your own operator does not lose the ones that shipped.\n\n**ADYSRE ships the builder in English only, deliberately.** The seam is a `labels`\nprop and not a translation runtime: the engine has no i18n dependency, and a host\nthat needs another language supplies one record. Wiring it to the app's\ncatalogues would put a hundred keys per locale in front of a package whose\naudience is developers authoring rules, so it stays a capability rather than a\ncommitment.\n\n## Composition\n\nEvery part is exported, not just the whole: `GroupRow`, `ConditionRow`,\n`OperandEditor`, `ActionList`, `RulePreview`, `MetaEditor`, `RuleToolbar`. A\nhost that wants the condition tree inside its own form should not have to take\nthe toolbar with it. They read the builder's context, so they belong inside a\n`RuleBuilder`.\n\nSee [`documents/RULES_ENGINE.md`](../../documents/RULES_ENGINE.md).\n","readmeFilename":"README.md","_rev":"1-959525fbbb62a6ee02dc635411d4076f"}