feat(sdk): stage 4 — canUndo/canRedo, removeElement GSAP cascade, override-set cleanup#1431
Conversation
This was referenced Jun 14, 2026
Collaborator
Author
This was referenced Jun 14, 2026
…rride-set cleanup
edb9a98 to
d4d2899
Compare
04ba6aa to
ff4dca2
Compare
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Stage 4 of the SDK — three features that complete the public history/editing API:
canUndo()/canRedo()onComposition— exposes the history module's existing state predicates on the public interface so hosts can enable/disable undo buttons without keeping their own patch counter.removeElementGSAP cascade — when removing an element, its targeting GSAP animations are also removed from the script and the change is folded into the same forward/inverse patch pair. Undo restores both the element and its animations atomically.Override-set orphan cleanup — after removing an element, its per-property override-set keys (
hf-x.style.fontSize,hf-x.text, etc.) are purged. Keeps T3 serialized override-sets compact and avoids stale key replay on future session opens.Also extracted
selectorMatchesId/cascadeRemoveAnimationshelpers to deduplicate the GSAP-target-matching pattern fromhandleSetTimingand reduce cognitive complexity.Why
canUndo/canRedoare needed for Studio toolbar state and any playground UI.Changes
src/types.tscanUndo(): boolean/canRedo(): booleantoCompositioninterfacesrc/session.tscanUndo/canRedodelegating tohistoryModule; add override-set orphan purge in_dispatchsrc/engine/mutate.tshandleRemoveElementGSAP cascade via newcascadeRemoveAnimations/selectorMatchesIdhelpers; same helpers used byhandleSetTimingto eliminate duplicationsrc/session.test.tscanUndo/canRedolifecycle tests (6 cases); override-set orphan cleanup tests (2 cases)src/engine/mutate.gsap.test.tsremoveElementGSAP cascade tests (5 cases)Test plan
bun run testinpackages/sdk— 156 tests passcomp.setStyle(id, ...)thencomp.removeElement(id); verifygetOverrides()shows noid.*keyscomp.canUndo()returns false before mutations, true after, false after undo back to start🤖 Generated with Claude Code