Generic ECS world + command-sourcing infrastructure. Powers OpenPCB's schematic + PCB designer; reusable for any editor with undo/redo + multi-client revision tracking.
ecs/—EcsWorld,Entity,Component,System,Query(generic overTComponent)commands/—CommandEnvelope<TCommand>,CommandResult,CommandHistory, patch + invert + applyrevision/—Revision,RevisionConflict,nextRevision()events/—InvalidationEvent
import {
EcsWorld,
type CommandEnvelope,
type CommandResult,
} from "@openpcb/command-pattern";
const world = new EcsWorld<MyComponent>();
// dispatch CommandEnvelope → handler → apply patches → emit InvalidationEventPure logic — no DB, no HTTP, no DOM. Browser + Node + Bun safe.
{ "dependencies": { "@openpcb/command-pattern": "github:OpenPCB-app/shared#command-pattern-v0.1.0", }, }