@@ -38,7 +38,26 @@ export function sheetCompiler(object: ClassesObjectType | CustomHTMLType, base62
3838 const isPseudoOrMediaClass = property . startsWith ( '@' ) ? isClassInc || isElementInc : classIndex || elementIndex ;
3939 let colon = '' ;
4040
41- if ( typeof value === 'string' || typeof value === 'number' ) {
41+ if ( property . startsWith ( '@keyframes' ) ) {
42+ let keyframesRule = `${ property } {\n` ;
43+ for ( const keyframe in value as PropertyType ) {
44+ if ( Object . prototype . hasOwnProperty . call ( value , keyframe ) ) {
45+ const keyframeValue = ( value as PropertyType ) [ keyframe ] ;
46+ keyframesRule += `${ innerIndent } ${ keyframe } {\n` ;
47+ if ( typeof keyframeValue === 'object' && keyframeValue !== null ) {
48+ for ( const prop in keyframeValue ) {
49+ if ( Object . prototype . hasOwnProperty . call ( keyframeValue , prop ) ) {
50+ const propValue = keyframeValue [ prop ] ;
51+ keyframesRule += `${ innerIndent } ${ camelToKebabCase ( prop ) } : ${ propValue } ;\n` ;
52+ }
53+ }
54+ }
55+ keyframesRule += `${ innerIndent } }\n` ;
56+ }
57+ }
58+ keyframesRule += `}\n` ;
59+ cssRule += keyframesRule ;
60+ } else if ( typeof value === 'string' || typeof value === 'number' ) {
4261 const CSSProp = camelToKebabCase ( property ) ;
4362 const applyValue = applyCssValue ( value , CSSProp ) ;
4463 cssRule += `${ bigIndent ? ' ' : ' ' } ${ CSSProp } : ${ applyValue } ;\n` ;
@@ -106,7 +125,10 @@ export function sheetCompiler(object: ClassesObjectType | CustomHTMLType, base62
106125 if ( Object . prototype . hasOwnProperty . call ( styles , property ) ) {
107126 const value = ( styles as PropertyType ) [ property ] as unknown as PropertyType ;
108127 if ( isClassesObjectType ( value ) ) {
109- if ( property . startsWith ( '@media' ) ) {
128+ if ( property . startsWith ( '@keyframes' ) ) {
129+ const keyframesStyles = stringConverter ( '' , { [ property ] : value } , currentIndentLevel ) ;
130+ styleSheet += '\n' + Object . values ( keyframesStyles ) [ 0 ] ;
131+ } else if ( property . startsWith ( '@media' ) ) {
110132 bigIndent = true ;
111133 const mediaStyles = createStyles ( value , currentIndentLevel + 1 ) ;
112134 styleSheet += `\n${ indent } ${ property } {${ mediaStyles } ${ indent } }\n` ;
0 commit comments