@onioneko/boardkit-blocks
v0.6.0
Published
BoardKit's reference block pack: checklist, status, metric, chart, form and rule block types for the BoardKit engine.
Maintainers
Readme
@onioneko/boardkit-blocks
BoardKit's reference block pack: six stateful document
components you register yourself, like any block type — pass starterBlocks
via createEngine({ blocks }), or add individual types with
engine.registerBlock. Nothing registers by default; hosts may trim or
replace this pack wholesale — it is not part of the core API.
import { createEngine } from "@onioneko/boardkit-core";
import { starterBlocks } from "@onioneko/boardkit-blocks";
const engine = createEngine({
storage,
blocks: starterBlocks,
});Blocks
| Block | State (attrs) | Transition events | Affordances | text projection | html projection |
|---|---|---|---|---|---|
| checklist | items[{id,label,done}] | checklist.item.done / .undone | toggle(itemId) | - [ ] / - [x] list | interactive checkboxes (data-intent) |
| status | states[] (ordered), value, note | status.changed | transition(to) | **STATUS**: pending | badge + transition buttons (data-intent); current value in data-state |
| metric | label, source, view, thresholds? | — | — | label: value (live via source id) | labeled value |
| chart | type, source, spec (opaque chart-source DSL) | — | — | spec verbatim (machine-readable) | <pre> fallback |
| form | fields[{id,label,type,options?}], status, answer? | form.answered | answer(values) | question text + options | form fields |
| rule | when, do (opaque strings), enabled | rule.enabled | toggle() | rule text with state | switch (data-intent) |
Notes and deviations
- The
checklistitem transition is directional.items[].doneemitschecklist.item.doneonfalse→trueandchecklist.item.undoneontrue→false; both events also carry thefrom/tobooleans. chartrenders as<pre>in html. The library does not know chart libraries; hosts register their own block type (or renderer) to replace the fallback. The text projection always emits the spec verbatim.- Schemas are plain JSON Schema literals (no @sinclair/typebox in this package) — one artifact, zero codegen, contributor-friendly.
- Interactive html hooks annotate elements with
data-intentpayloads; the html projection's sanitize schema allowsclassName,id,data-intent,data-sourceanddata-state. View adapters translate those annotations into Intents. The blocks in this pack never put attr values intoclassName: thestatusblock renders<div class="status" data-state="…">, so style a state with.status[data-state="approved"].
