Reducer
Pure state reducer implementing the MVI pattern.
(State, Intent) → State. No side effects, no mutation of the input state.
Undo model: snapshot-based. Each intent that mutates elements in a way the user would expect to undo (insert, delete, recolor, z-order, transform-commit) pushes the previous element list onto history and clears future. The per-pixel update intents (UpdateLatestPath, UpdateLatestShape, MoveSelected, SetElementBounds, SetElementRotation) do NOT push to history — the caller is expected to dispatch Intent.BeginTransform once at the start of the gesture.