(parsed: ParsedDocument, selector: string)
| 1206 | } |
| 1207 | |
| 1208 | function handleDeleteAllForSelector(parsed: ParsedDocument, selector: string): MutationResult { |
| 1209 | const script = getGsapScript(parsed.document); |
| 1210 | if (!script) return EMPTY; |
| 1211 | const parsedForWrite = parseGsapScriptAcornForWrite(script); |
| 1212 | if (!parsedForWrite) return EMPTY; |
| 1213 | // Compare quote-insensitively: [data-hf-id='x'] and [data-hf-id="x"] are the |
| 1214 | // same selector. A strict === missed the alternate quote style and matched |
| 1215 | // nothing while can() reported ok. |
| 1216 | const wanted = selector.replace(/'/g, '"'); |
| 1217 | const matching = parsedForWrite.located.filter( |
| 1218 | (l) => l.animation.targetSelector.replace(/'/g, '"') === wanted, |
| 1219 | ); |
| 1220 | if (matching.length === 0) return EMPTY; |
| 1221 | let newScript = script; |
| 1222 | for (const m of [...matching].reverse()) { |
| 1223 | newScript = removeAnimationFromScript(newScript, m.id); |
| 1224 | } |
| 1225 | if (newScript === script) return EMPTY; |
| 1226 | setGsapScript(parsed.document, newScript); |
| 1227 | // ponytail: skips stripStudioEditsFromTarget (data-hf-studio-path-offset cleanup) — |
| 1228 | // studio path offset is cosmetic once all animations are gone; session reloads after write |
| 1229 | return gsapScriptChange(script, newScript); |
| 1230 | } |
| 1231 | |
| 1232 | function resolveKeyframe(parsed: ParsedDocument, animationId: string, keyframeIndex: number) { |
| 1233 | const script = getGsapScript(parsed.document); |
no test coverage detected