@unocss/preset-mini 0.26.2 → 0.26.3

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.
@@ -14,7 +14,7 @@ function hex2rgba(hex = "") {
14
14
  }
15
15
  function parseCssColor(str = "") {
16
16
  const color = parseColor$1(str);
17
- if (color == null)
17
+ if (color == null || color === false)
18
18
  return;
19
19
  const { type: casedType, components, alpha } = color;
20
20
  const type = casedType.toLowerCase();
@@ -22,7 +22,7 @@ function parseCssColor(str = "") {
22
22
  return;
23
23
  if (["rgba", "hsla"].includes(type) && alpha == null)
24
24
  return;
25
- if (cssColorFunctions.includes(type) && components.length !== 3)
25
+ if (cssColorFunctions.includes(type) && ![1, 3].includes(components.length))
26
26
  return;
27
27
  return { type, components, alpha };
28
28
  }
@@ -98,12 +98,16 @@ function parseCssCommaColorFunction(color) {
98
98
  return;
99
99
  const [, type, componentString] = match;
100
100
  const components = getComponents(componentString, ",", 5);
101
- if (components && [3, 4].includes(components.length)) {
102
- return {
103
- type,
104
- components: components.slice(0, 3),
105
- alpha: components[3]
106
- };
101
+ if (components) {
102
+ if ([3, 4].includes(components.length)) {
103
+ return {
104
+ type,
105
+ components: components.slice(0, 3),
106
+ alpha: components[3]
107
+ };
108
+ } else if (components.length !== 1) {
109
+ return false;
110
+ }
107
111
  }
108
112
  }
109
113
  const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
@@ -12,7 +12,7 @@ function hex2rgba(hex = "") {
12
12
  }
13
13
  function parseCssColor(str = "") {
14
14
  const color = parseColor$1(str);
15
- if (color == null)
15
+ if (color == null || color === false)
16
16
  return;
17
17
  const { type: casedType, components, alpha } = color;
18
18
  const type = casedType.toLowerCase();
@@ -20,7 +20,7 @@ function parseCssColor(str = "") {
20
20
  return;
21
21
  if (["rgba", "hsla"].includes(type) && alpha == null)
22
22
  return;
23
- if (cssColorFunctions.includes(type) && components.length !== 3)
23
+ if (cssColorFunctions.includes(type) && ![1, 3].includes(components.length))
24
24
  return;
25
25
  return { type, components, alpha };
26
26
  }
@@ -96,12 +96,16 @@ function parseCssCommaColorFunction(color) {
96
96
  return;
97
97
  const [, type, componentString] = match;
98
98
  const components = getComponents(componentString, ",", 5);
99
- if (components && [3, 4].includes(components.length)) {
100
- return {
101
- type,
102
- components: components.slice(0, 3),
103
- alpha: components[3]
104
- };
99
+ if (components) {
100
+ if ([3, 4].includes(components.length)) {
101
+ return {
102
+ type,
103
+ components: components.slice(0, 3),
104
+ alpha: components[3]
105
+ };
106
+ } else if (components.length !== 1) {
107
+ return false;
108
+ }
105
109
  }
106
110
  }
107
111
  const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.26.2",
3
+ "version": "0.26.3",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.26.2"
64
+ "@unocss/core": "0.26.3"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",