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

Function keyframes

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

Source from the content-addressed store, hash-verified

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

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