Install
Not published on npm. Download from the workbench or run npm pack ./dist/packages/chatter, then:
npm install /path/to/cranberry-forge-chatter-0.1.0.tgzThe main import has no browser or renderer dependency. @cranberry-forge/chatter/dom is an optional browser presentation adapter; neither import requires another Cranberry Forge package. MIT license and TypeScript declarations are included.
Save and resume
const saved = JSON.stringify(talk.toSnapshot());
const restored = Conversation.fromSnapshot(story, saved);Snapshots preserve current node, variables, visit counts, used one-time choices and ended state. A non-cryptographic fingerprint rejects saves from a different normalized story definition. It is an accidental mismatch check, not authentication. Changing the story requires a deliberate save migration; even reordering object keys can change the fingerprint. Game progress outside the conversation must be saved by your game.
Optional dialogue box
mountDialogue(container,talk,{charactersPerSecond=45,onEnd}) returns {finishLine(),dispose()}. Use 0 to reveal lines instantly; range is 0–500. The adapter honors reduced-motion preference, uses safe textContent, provides native focusable buttons, a full-line screen-reader announcement, and cancels animation when disposed. Buttons are keyboard-operable with Tab/Enter/Space; a “Show full line” button skips typing. Wrap it in your own modal dialog if you need focus trapping or Escape-to-close.
Theme through --chatter-text, --chatter-accent, --chatter-border, --chatter-button, and --chatter-hover. The adapter is deliberately small; use view to implement subtitles, portraits, gamepad navigation, localization, voiced timing or a 3D UI yourself.