@cssfn/cssfn
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -214,2 +214,11 @@ import { | ||
} | ||
else if (ruleData[0].startsWith('@keyframes ')) { | ||
// the @keyframes is allowed to have an empty style | ||
// update: | ||
style.set(symbolProp, [ | ||
// already been finalizeSelector() => CssRawSelector|CssFinalSelector => CssFinalSelector | ||
ruleData[0], | ||
new Map() // an empty style | ||
]); | ||
} | ||
else { | ||
@@ -216,0 +225,0 @@ // delete: |
@@ -151,13 +151,15 @@ import { | ||
#renderSelector(finalSelector, finalStyle) { | ||
if (!finalStyle // no style defined | ||
|| | ||
// a style defined, but: | ||
( | ||
// there is no any prop: | ||
// in case of the parentRule is only containing nestedRule(s) | ||
!hasPropKeys(finalStyle.keys()) | ||
&& | ||
// there is no any PropRule: | ||
// in case of the @keyframes rule is always contains PropRule(s) but not contains nestedRule(s) | ||
!this.#hasPropRule(finalStyle))) { | ||
if (!finalSelector?.startsWith('@keyframes ') // an empty `@keyframes noAnimation {}` is allowed | ||
&& | ||
(!finalStyle // no style defined | ||
|| | ||
// a style defined, but doesn't have any property: | ||
( | ||
// there is no any prop: | ||
// in case of the parentRule is only containing nestedRule(s) | ||
!hasPropKeys(finalStyle.keys()) | ||
&& | ||
// there is no any PropRule: | ||
// in case of a something like @keyframes rule, that is always contains PropRule(s) but not contains nestedRule(s) | ||
!this.#hasPropRule(finalStyle)))) { | ||
return; // empty style => no need to render the .selector { /* empty style */ } | ||
@@ -164,0 +166,0 @@ } // if |
{ | ||
"name": "@cssfn/cssfn", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Writes, imports, and exports css stylesheets as javascript modules.", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "2d4e18d5d1ce428983bb5f6068d33de7a63ba3f5" | ||
"gitHead": "f4b67f3d5749de87396888395833cd843e0846b2" | ||
} |
@@ -336,2 +336,12 @@ // cssfn: | ||
} | ||
else if ((ruleData[0] as CssFinalSelector).startsWith('@keyframes ')) { | ||
// the @keyframes is allowed to have an empty style | ||
// update: | ||
(style as CssFinalRuleMap).set(symbolProp, [ | ||
// already been finalizeSelector() => CssRawSelector|CssFinalSelector => CssFinalSelector | ||
ruleData[0] as CssFinalSelector, // [0]: CssRawSelector|CssFinalSelector // [1]: CssStyleCollection|CssFinalStyleMap | ||
new Map() as CssFinalStyleMap // an empty style | ||
]); | ||
} | ||
else { | ||
@@ -338,0 +348,0 @@ // delete: |
@@ -267,15 +267,19 @@ // cssfn: | ||
if ( | ||
!finalStyle // no style defined | ||
|| | ||
// a style defined, but: | ||
!finalSelector?.startsWith('@keyframes ') // an empty `@keyframes noAnimation {}` is allowed | ||
&& | ||
( | ||
// there is no any prop: | ||
// in case of the parentRule is only containing nestedRule(s) | ||
!hasPropKeys(finalStyle.keys()) | ||
&& | ||
// there is no any PropRule: | ||
// in case of the @keyframes rule is always contains PropRule(s) but not contains nestedRule(s) | ||
!this.#hasPropRule(finalStyle) | ||
!finalStyle // no style defined | ||
|| | ||
// a style defined, but doesn't have any property: | ||
( | ||
// there is no any prop: | ||
// in case of the parentRule is only containing nestedRule(s) | ||
!hasPropKeys(finalStyle.keys()) | ||
&& | ||
// there is no any PropRule: | ||
// in case of a something like @keyframes rule, that is always contains PropRule(s) but not contains nestedRule(s) | ||
!this.#hasPropRule(finalStyle) | ||
) | ||
) | ||
@@ -282,0 +286,0 @@ ) |
Sorry, the diff of this file is too big to display
558275
15632