MCPcopy Create free account
hub / github.com/adobe/react-spectrum / keyframes

Function keyframes

packages/@react-spectrum/s2/style/style-macro.ts:1127–1147  ·  view source on GitHub ↗
(this: MacroContext | void, css: string)

Source from the content-addressed store, hash-verified

1125}
1126
1127export function keyframes(this: MacroContext | void, css: string): string {
1128 // Check if `this` is undefined, which means style was not called as a macro but as a normal function.
1129 // We also check if this is globalThis, which happens in non-strict mode bundles.
1130 // Also allow style to be called as a normal function in tests.
1131 // @ts-ignore
1132
1133 if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') {
1134 throw new Error('The keyframes macro must be imported with {type: "macro"}.');
1135 }
1136 let name = generateArbitraryValueSelector(css, true);
1137 css = `@keyframes ${name} {
1138 ${css}
1139}`;
1140 if (this && typeof this.addAsset === 'function') {
1141 this.addAsset({
1142 type: 'css',
1143 content: css
1144 });
1145 }
1146 return name;
1147}

Callers 7

Home.tsxFile · 0.90
CodePlatter.tsxFile · 0.90
MobileHeader.tsxFile · 0.90
ProgressCircle.tsxFile · 0.90
ProgressBar.tsxFile · 0.90
CoachMark.tsxFile · 0.90
ColorLoupeFunction · 0.90

Calls 2

addAssetMethod · 0.65

Tested by

no test coverage detected