Feature Plan: State Presets

Overview

A DSL-driven system for saving and loading UI/visibility states, allowing performers to prepare starting configurations and recall them during performance.

Motivation

Proposed DSL

state(save:clean_start)              // Save current visibility states
state(load:clean_start)              // Load and apply to all clients
state(load:clean_start, sync:false)  // Load locally only
state(load:clean_start, auto:true)   // Auto-load on startup

Usage in Score

SVG elements with state cue IDs:

<g id="button(click:1) state(save:rehearsal)">...</g>
<g id="button(click:1) state(load:rehearsal)">...</g>

Storage

Per-project state files:

scores/polygonfield/states/clean_start.json
scores/polygonfield/states/rehearsal.json

State File Format

{
  "version": 1,
  "name": "clean_start",
  "created": "2026-04-02T20:00:00Z",
  "states": {
    "polygon1": { "visible": false },
    "polygon2": { "visible": true },
    "mixer_faders": { "visible": false }
  }
}

Implementation Phases

Phase 1: Simple JSON Persistence (Current)

Phase 2: Named Presets

Phase 3: Extended States (Future)

Could extend to capture:

Technical Notes

Files to Modify

  1. public/js/cues/state.js (new) - cue handler
  2. public/js/cues/animShared.js - hook visibility changes
  3. public/js/system/socket.js - sync message handlers
  4. server.js - state file endpoints
  5. public/js/parser/parser.js - recognize state() expressions

WebSocket Messages

// Save broadcast (informational)
{ type: "state_saved", project: "polygonfield", name: "clean_start" }

// Load sync (all clients apply)
{ type: "state_load", project: "polygonfield", name: "clean_start", states: {...} }

Considerations

Status