๐จ Theme Builder
Composition API: undo/redo history lives in a #[Persist] array โ per-connection server state, no signals. Click swatches to repaint the preview card server-side.
$this->historyIdx, redo increments it. History truncation on branch is a single array_slice.$this->history entry every render.#ffffff
#6366f1
#1e293b
#e2e8f0
#f59e0b
Welcome! This preview card reflects your current theme in real time โ every color stored and rendered on the server.
โก Signals
history
array Persist [default theme] #[Persist] undo/redo stack. Per-connection instance state โ not a signal, never sent to the client.
historyIdx
int Persist 0 #[Persist] index of the active history entry. Undo/redo move this pointer.
๐ฏ Actions
setColor
Reads ?slot= and ?color= params, validates against the swatch whitelist, pushes to history, calls $ctx->sync().
undo
Decrements $this->historyIdx and re-renders via $ctx->sync().
redo
Increments $this->historyIdx and re-renders via $ctx->sync().
reset
Resets history to the single default theme entry.
๐ Views
theme_builder.html.twig
Unchanged from the closure version. Preview uses inline CSS from the current history entry. Full demo block re-renders on each action.