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

Function keyframes

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

Source from the content-addressed store, hash-verified

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

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