Skip to content

DirtyTalk

DirtyTalk is the family of packages BlaC is built on. They answer one question: after a mutation, what changed, who cares, and when do we tell them?

You do not need to install or import these to use BlaC — @blac/core wires them up for you. This page exists so the layering is on record.

A renderer mutates a scene and must repaint. A state container mutates state and must notify subscribers. Both face the same three questions, and the naive answer pushes the work down to every consumer — re-walking the whole state tree once per subscriber, or repainting the whole canvas because a single dirty bit lost track of where the change was.

DirtyTalk computes “what changed” once, at the source, as a Region — a value with empty, union, and intersects. Each subscriber declares an interest region. Waking the right subscribers is then one cheap intersects check each, against one shared dirty region: work proportional to the number of subscribers, not to the size of the state times the number of subscribers.

PackageRoleA Region is
@dirtytalk/engineThe abstract algebra and scheduling glue: the Space<Region> and Scheduler interfaces, and DirtyChannel<Region>. Ships no concrete Region.abstract — you supply one
@dirtytalk/spatialThe 2D-rendering instantiation. RectSpace, a SceneNode / SceneRoot tree, and a PointerRouter.a list of damage rects
@dirtytalk/structuralThe state-container instantiation. PathSetSpace, a PathInterner, the trackRender proxy recorder, and diff helpers.a set of interned path IDs

Each domain package answers the same algebra in its own terms. “Union two dirty regions” means concatenating damage lists in spatial and set-union in structural. The DirtyChannel machinery — coalescing, selective fan-out, re-entrancy handling, error isolation — is written once in the engine and reused by both.

@blac/core is a consumer of @dirtytalk/structural: BlaC’s per-consumer path tracking is that package’s path-set model. BlaC also re-exports untracked from it.

All three are standalone and framework-agnostic — usable with no React and no BlaC — but they are documented here only at this level. For BlaC itself, start at the introduction.