ANNOUNCE V0.27.0 BETA
@fzlt/core/announce
Game events read out to screen readers through one polite live region, rate-limited. The game says what happened on the event ring (in its steps, as it already does for sound and effects); words turns an event into a sentence in render; the region speaks at most once per gap seconds. const a = announce(engine, { words: (e) => e.type === "score" ? Score ${e.a} : e.type === "over" ? "Game over" : null, }); a.say("lives", "2 lives left"); // or directly, from a HUD or a menu - One region per page, shared by every engine: [data-fz-announce], role status, polite, atomic, visually hidden. Made on the first word, never before; destroy() removes it if this one made it. - Coalesced by key (an event's type): a newer sentence for the same key replaces the waiting one, so a score that ticks ten times a second is read once, as its latest value. Waiting sentences are read together, in the order their keys first came, joined with ". ". - The same sentence twice is read twice (a trailing no-break space alternates). - Nothing in step; in render it reads the ring only. One timer while something waits, none after. - Recall: destroy() (or the engine's) removes the system, the timer and the region it made.
@fzlt/core/announce · GZIP612 B0.6 KB of a 0.6 KB budget
Measured on this build: minified and gzipped with everything it imports, the way npm run size checks the budget in CI.