PURPOSE

Holds accessibility flags shared across the engine and metagame UI. Owns the SKIP_REWARD_ANIMATIONS flag along with its persistence to localStorage, plus stub flags for TEXT_SCALE, HIGH_CONTRAST, and COLOR_MODE.

OWNS

  • ACCESSIBILITY object — single in-memory record of accessibility flags.
  • TEXT_SCALE — numeric scale multiplier for text (default 1.0).
  • HIGH_CONTRAST — boolean high-contrast toggle (default false).
  • COLOR_MODE — color mode string (default 'normal').
  • SKIP_REWARD_ANIMATIONS — boolean to bypass reward animations.
  • loadSkipRewardAnimations() — reads the persisted skip flag, syncs into memory, returns the parsed value.
  • setSkipRewardAnimations(value) — writes the skip flag to localStorage and updates the in-memory copy.
  • isSkipRewardAnimations() — reads the current in-memory value.
  • Module-load side effect calls loadSkipRewardAnimations() so the flag is hydrated as soon as the module is imported.

READS FROM

  • localStorage via the ss_skip_reward_anim key.
  • No other module imports.

PUSHES TO

  • localStorage via the ss_skip_reward_anim key (string 'true' or 'false').
  • Mutates the exported ACCESSIBILITY object in place; consumers read flag state by reference.

DOES NOT

  • Does not render UI or wire toggles to any settings screen.
  • Does not enforce TEXT_SCALE, HIGH_CONTRAST, or COLOR_MODE anywhere — those fields exist as placeholders and are not persisted.
  • Does not validate or migrate stored values; any string other than 'true' is treated as false.
  • Does not emit events or notify subscribers when flags change.
  • Does not throw if localStorage is unavailable — load returns false, set silently keeps the in-memory value.

Signals

  • Persistence key: ss_skip_reward_anim (constant SKIP_ANIM_KEY).
  • Stored value format: literal strings 'true' or 'false'.
  • Missing key (raw === null) resolves to false.

Entry points

  • loadSkipRewardAnimations() — called once on module load; callers may re-invoke to re-sync from storage.
  • setSkipRewardAnimations(value) — accessibility-setting toggles.
  • isSkipRewardAnimations() — runtime check before playing a reward animation.
  • Direct field access on ACCESSIBILITY — anything reading the flag at runtime.

Pattern notes

  • Plain mutable singleton: flags live on one exported object, no getter/setter wrapping.
  • Storage access is wrapped in try/catch so SSR or private-mode browsers degrade to in-memory defaults without throwing.
  • The in-memory ACCESSIBILITY.SKIP_REWARD_ANIMATIONS is the source of truth for runtime reads; localStorage is only consulted at load.
  • Three of four flags (TEXT_SCALE, HIGH_CONTRAST, COLOR_MODE) are declared but not yet persisted or wired — scaffolding for future accessibility work.