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

Function keyframes

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

Source from the content-addressed store, hash-verified

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

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