MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / handleDeleteAllForSelector

Function handleDeleteAllForSelector

packages/sdk/src/engine/mutate.ts:1208–1230  ·  view source on GitHub ↗
(parsed: ParsedDocument, selector: string)

Source from the content-addressed store, hash-verified

1206}
1207
1208function 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
1232function resolveKeyframe(parsed: ParsedDocument, animationId: string, keyframeIndex: number) {
1233 const script = getGsapScript(parsed.document);

Callers 1

applyGsapOpFunction · 0.85

Calls 5

getGsapScriptFunction · 0.85
setGsapScriptFunction · 0.85
gsapScriptChangeFunction · 0.85

Tested by

no test coverage detected