@bemedev/todo
v0.1.0
Published
A todo state machine built with BemeDev libraries
Downloads
33
Readme
@bemedev/todo
A TypeScript library for managing todo items as hierarchical trees, powered
by a state machine built with @bemedev/app-ts.
Features
Todo/Todo2schemas — Valibot-validated todo items with optionalparentsreferences for building treesgenerateDeck— converts a flat list ofTodoitems into aTodo2[]tree (roots at top level, children nested recursively; a todo with multiple parents is duplicated under each)- State machine — full lifecycle management (auth, save, sync) via
@bemedev/app-ts createfactory — schema-validated object factory helper
Installation
pnpm add @bemedev/todoUsage
import { generateDeck, type Todo } from '@bemedev/todo';
const todos: Todo[] = [
{ id: 'aaa', label: 'Root task' },
{ id: 'bbb', label: 'Child task', parents: ['aaa'] },
{ id: 'ccc', label: 'Grandchild', parents: ['bbb'] },
];
const tree = generateDeck(...todos);
// tree[0].label => 'Root task'
// tree[0].children[0] => { label: 'Child task', children: [...] }Licence
MIT
CHANGELOG
Read CHANGELOG.md for more details about the changes.
Auteur
chlbri ([email protected])
