(script: string, id: HfId)
| 890 | } |
| 891 | |
| 892 | function cascadeRemoveAnimations(script: string, id: HfId): string { |
| 893 | // Re-parse after each removal: animation ids are positional, so removing one |
| 894 | // tween renumbers the survivors — ids from a single up-front parse go stale and |
| 895 | // no-op, orphaning later tweens on the removed element. Same fix as |
| 896 | // stripGsapForId in htmlParser.ts (R3 #3); this is its SDK-side twin. |
| 897 | let current = script; |
| 898 | for (;;) { |
| 899 | const parsedGsap = parseGsapScriptAcornForWrite(current); |
| 900 | if (!parsedGsap) return current; |
| 901 | const match = parsedGsap.located.find((l) => selectorMatchesId(l.animation.targetSelector, id)); |
| 902 | if (!match) return current; |
| 903 | const next = removeAnimationFromScript(current, match.id); |
| 904 | if (next === current) return current; // guard against a non-removing match |
| 905 | current = next; |
| 906 | } |
| 907 | } |
| 908 | |
| 909 | // ─── addWithKeyframes / replaceWithKeyframes handlers ──────────────────────── |
| 910 |
no test coverage detected