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

Function surfaceCssKeyframes

packages/cli/src/commands/keyframes.ts:369–394  ·  view source on GitHub ↗
(rawCss: string)

Source from the content-addressed store, hash-verified

367}
368
369function surfaceCssKeyframes(rawCss: string): SurfacedCssKeyframes[] {
370 const css = stripCssComments(rawCss);
371 if (!css.trim()) return [];
372 const { keyframes, ranges } = collectKeyframeBlocks(css);
373 if (keyframes.length === 0) return [];
374
375 const selectorsByName = new Map<string, Set<string>>();
376 for (const kf of keyframes) selectorsByName.set(kf.name, new Set());
377 const knownNames = new Set(keyframes.map((kf) => kf.name));
378 const cssWithoutKeyframes = stripRanges(css, ranges);
379 const ruleRe = /([^{}@]+)\{([^{}]*animation[^{}]*)\}/g;
380 let rule: RegExpExecArray | null;
381 while ((rule = ruleRe.exec(cssWithoutKeyframes))) {
382 const selector = rule[1]!.trim().replace(/\s+/g, " ");
383 if (!selector) continue;
384 for (const name of animationNamesFromDeclarations(rule[2]!, knownNames)) {
385 selectorsByName.get(name)?.add(selector);
386 }
387 }
388
389 return keyframes.map((kf) => ({
390 name: kf.name,
391 selectors: [...(selectorsByName.get(kf.name) ?? new Set<string>())],
392 keyframes: kf.stops,
393 }));
394}
395
396function valuesFromProperty(
397 script: string,

Callers 1

surfaceCompositionFunction · 0.85

Calls 7

collectKeyframeBlocksFunction · 0.85
stripRangesFunction · 0.85
addMethod · 0.80
getMethod · 0.80
stripCssCommentsFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected