Skip to content

Sugar

@mantaq/sugar wraps core primitives with convenience helpers. Every helper compiles to the same behavior you could write yourself.

HelperPurpose
states(), events()Batch create states/events
matches(), isIn(), activeLeaves(), tag()State matching and grouping
ActorMap, broadcast()Dynamic child management
withPromise(), withTimeout()Effect helpers
actorSpec, definePart, withPartsSplit setup across files
Terminal window
npm install @mantaq/sugar

Requires @mantaq/core. Single entry point:

import { matches, states, events } from "@mantaq/sugar";

Use sugar when many states/events, frequent state checks, dynamic children, or promise effects. Skip when few states, minimal checks, no dynamic children, or custom effect patterns.

Core is sufficient for everything. Sugar saves typing.