@unocss/preset-mini 0.26.2 → 0.27.0

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.
@@ -284,8 +284,8 @@ const handleGap = ([, d = "", s], { theme }) => {
284
284
  }
285
285
  };
286
286
  const gaps = [
287
- [/^(?:flex-|grid-)?gap-()(.+)$/, handleGap],
288
- [/^(?:flex-|grid-)?gap-([xy])-(.+)$/, handleGap]
287
+ [/^(?:flex-|grid-)?gap-?()(.+)$/, handleGap],
288
+ [/^(?:flex-|grid-)?gap-([xy])-?(.+)$/, handleGap]
289
289
  ];
290
290
 
291
291
  const rowCol = (s) => s.replace("col", "column");
@@ -433,6 +433,7 @@ const floats = [
433
433
  ["clear-none", { clear: "none" }]
434
434
  ];
435
435
  const zIndexes = [
436
+ [/^z([\d.]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })],
436
437
  [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.auto.number(v) })]
437
438
  ];
438
439
  const boxSizing = [
@@ -594,7 +595,7 @@ function getSizeValue(minmax, hw, theme, prop) {
594
595
  return utilities.handler.bracket.cssvar.auto.fraction.rem(prop);
595
596
  }
596
597
  const sizes = [
597
- [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
598
+ [/^(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
598
599
  [/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
599
600
  [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.verticalBreakpoints?.[s] })],
600
601
  [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
@@ -282,8 +282,8 @@ const handleGap = ([, d = "", s], { theme }) => {
282
282
  }
283
283
  };
284
284
  const gaps = [
285
- [/^(?:flex-|grid-)?gap-()(.+)$/, handleGap],
286
- [/^(?:flex-|grid-)?gap-([xy])-(.+)$/, handleGap]
285
+ [/^(?:flex-|grid-)?gap-?()(.+)$/, handleGap],
286
+ [/^(?:flex-|grid-)?gap-([xy])-?(.+)$/, handleGap]
287
287
  ];
288
288
 
289
289
  const rowCol = (s) => s.replace("col", "column");
@@ -431,6 +431,7 @@ const floats = [
431
431
  ["clear-none", { clear: "none" }]
432
432
  ];
433
433
  const zIndexes = [
434
+ [/^z([\d.]+)$/, ([, v]) => ({ "z-index": handler.number(v) })],
434
435
  [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.auto.number(v) })]
435
436
  ];
436
437
  const boxSizing = [
@@ -592,7 +593,7 @@ function getSizeValue(minmax, hw, theme, prop) {
592
593
  return handler.bracket.cssvar.auto.fraction.rem(prop);
593
594
  }
594
595
  const sizes = [
595
- [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
596
+ [/^(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
596
597
  [/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
597
598
  [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.verticalBreakpoints?.[s] })],
598
599
  [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
@@ -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.27.0",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -10,15 +10,20 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/unocss/unocss/issues"
12
12
  },
13
+ "license": "MIT",
13
14
  "repository": {
14
15
  "type": "git",
15
16
  "url": "git+https://github.com/unocss/unocss.git",
16
17
  "directory": "packages/preset-mini"
17
18
  },
18
19
  "funding": "https://github.com/sponsors/antfu",
19
- "license": "MIT",
20
20
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
21
21
  "sideEffects": false,
22
+ "files": [
23
+ "dist",
24
+ "*.d.ts",
25
+ "*.css"
26
+ ],
22
27
  "exports": {
23
28
  ".": {
24
29
  "require": "./dist/index.cjs",
@@ -55,13 +60,8 @@
55
60
  "main": "dist/index.cjs",
56
61
  "module": "dist/index.mjs",
57
62
  "types": "dist/index.d.ts",
58
- "files": [
59
- "dist",
60
- "*.d.ts",
61
- "*.css"
62
- ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.26.2"
64
+ "@unocss/core": "0.27.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",