MCPcopy Create free account
hub / github.com/angular/angular / _scopeAnimationKeyframe

Method _scopeAnimationKeyframe

packages/compiler/src/shadow_css.ts:317–328  ·  view source on GitHub ↗

* Function used to scope a keyframes name (obtained from an animation declaration) * using an existing set of unscopedKeyframes names to discern if the scoping needs to be * performed (keyframes names of keyframes not defined in the component's css need not to be * scoped). * * @param

(
    keyframe: string,
    scopeSelector: string,
    unscopedKeyframesSet: ReadonlySet<string>,
  )

Source from the content-addressed store, hash-verified

315 * scoped.
316 */
317 private _scopeAnimationKeyframe(
318 keyframe: string,
319 scopeSelector: string,
320 unscopedKeyframesSet: ReadonlySet<string>,
321 ): string {
322 return keyframe.replace(/^(\s*)(['"]?)(.+?)\2(\s*)$/, (_, spaces1, quote, name, spaces2) => {
323 name = `${
324 unscopedKeyframesSet.has(unescapeQuotes(name, quote)) ? scopeSelector + '_' : ''
325 }${name}`;
326 return `${spaces1}${quote}${name}${quote}${spaces2}`;
327 });
328 }
329
330 /**
331 * Regular expression used to extrapolate the possible keyframes from an

Callers 1

_scopeAnimationRuleMethod · 0.95

Calls 3

unescapeQuotesFunction · 0.85
hasMethod · 0.65
replaceMethod · 0.45

Tested by

no test coverage detected