anubis-ui 1.2.21 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anubis-ui",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "Class-based css generator",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -35,25 +35,18 @@ const generateCssRules = (ruleInfos: IRuleInfo[]): string => {
35
35
 
36
36
  const mapClassIntoRule = (stringClass: string): IRuleInfo | null => {
37
37
  const params = getClassInfos(stringClass);
38
+ if (!params.utility) { return null }
38
39
 
39
- /**
40
- * _ If no variations are found, maybe it's just a color like bg-primary
41
- * _ So we need to check if the color exists to avoid useless computing
42
- * */
43
- if (!params.utility) {
44
- const { colorExists } = getColorInfos(params.color);
45
-
46
- if (!colorExists) {
47
- return null;
48
- }
49
- }
40
+ const needsColor = params.utility?.declaration?.includes('${color}')
41
+ const usesVariation = params.variationName
42
+ const hasDefaultVariation = !params.utility?.variations || Object.keys(params.utility?.variations || []).includes('default')
50
43
 
51
44
  /**
52
- * _ If the current QoL isn't standalone and doesn't have a variation (can be called without variation)
53
- * _ then no
54
- */
55
- if (!params.color && !Object.keys(params.utility?.variations || []).includes('default') && !params.variationName) {
56
- return null;
45
+ * If need color but doesn't have one or if need a variation but doesn't have one either
46
+ * this is a no go
47
+ */
48
+ if ((needsColor && !params.color) || (!hasDefaultVariation && !usesVariation)) {
49
+ return null
57
50
  }
58
51
 
59
52
  const ruleInfo = buildRuleInfo(params);