@unocss/preset-mini 0.16.2 → 0.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.16.2",
3
+ "version": "0.17.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.16.2"
64
+ "@unocss/core": "0.17.3"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",
@@ -1,142 +0,0 @@
1
- 'use strict';
2
-
3
- const core = require('@unocss/core');
4
-
5
- const directionMap = {
6
- "l": ["-left"],
7
- "r": ["-right"],
8
- "t": ["-top"],
9
- "b": ["-bottom"],
10
- "s": ["-inline-start"],
11
- "e": ["-inline-end"],
12
- "x": ["-left", "-right"],
13
- "y": ["-top", "-bottom"],
14
- "": [""],
15
- "a": [""]
16
- };
17
- const cornerMap = {
18
- "t": ["-top-left", "-top-right"],
19
- "r": ["-top-right", "-bottom-right"],
20
- "b": ["-bottom-left", "-bottom-right"],
21
- "l": ["-bottom-left", "-top-left"],
22
- "tl": ["-top-left"],
23
- "lt": ["-top-left"],
24
- "tr": ["-top-right"],
25
- "rt": ["-top-right"],
26
- "bl": ["-bottom-left"],
27
- "lb": ["-bottom-left"],
28
- "br": ["-bottom-right"],
29
- "rb": ["-bottom-right"],
30
- "": [""]
31
- };
32
- const xyzMap = {
33
- "x": ["-x"],
34
- "y": ["-y"],
35
- "z": ["-z"],
36
- "": ["-x", "-y"]
37
- };
38
-
39
- const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
40
- const numberRE = /^(-?[0-9.]+)$/i;
41
- const unitOnlyRE = /^(px)$/i;
42
- function rem(str) {
43
- if (str === "auto" || str === "a")
44
- return "auto";
45
- if (str.match(unitOnlyRE))
46
- return `1${str}`;
47
- const match = str.match(numberWithUnitRE);
48
- if (!match)
49
- return;
50
- const [, n, unit] = match;
51
- if (unit)
52
- return str;
53
- const num = parseFloat(n);
54
- if (!Number.isNaN(num))
55
- return `${num / 4}rem`;
56
- }
57
- function px(str) {
58
- if (str.match(unitOnlyRE))
59
- return `1${str}`;
60
- const match = str.match(numberWithUnitRE);
61
- if (!match)
62
- return;
63
- const [, n, unit] = match;
64
- if (unit)
65
- return str;
66
- const num = parseFloat(n);
67
- if (!Number.isNaN(num))
68
- return `${num}px`;
69
- }
70
- function number(str) {
71
- if (!numberRE.test(str))
72
- return;
73
- const num = parseFloat(str);
74
- if (!Number.isNaN(num))
75
- return num;
76
- }
77
- function percent(str) {
78
- if (str.endsWith("%"))
79
- str = str.slice(0, -1);
80
- const num = parseFloat(str);
81
- if (!Number.isNaN(num))
82
- return `${num / 100}`;
83
- }
84
- function fraction(str) {
85
- if (str === "full")
86
- return "100%";
87
- const [left, right] = str.split("/");
88
- const num = parseFloat(left) / parseFloat(right);
89
- if (!Number.isNaN(num))
90
- return `${num * 100}%`;
91
- }
92
- function bracket(str) {
93
- if (str && str[0] === "[" && str[str.length - 1] === "]") {
94
- return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
95
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
96
- });
97
- }
98
- }
99
- function cssvar(str) {
100
- if (str.startsWith("$"))
101
- return `var(--${str.slice(1)})`;
102
- }
103
- function time(str) {
104
- const duration = Number(str.replace(/(s|ms)$/, ""));
105
- if (isNaN(duration))
106
- return;
107
- if (/ms|s$/.test(str))
108
- return str;
109
- return `${str}ms`;
110
- }
111
- function global(str) {
112
- if (["inherit", "initial", "unset"].includes(str))
113
- return str;
114
- }
115
-
116
- const valueHandlers = {
117
- __proto__: null,
118
- rem: rem,
119
- px: px,
120
- number: number,
121
- percent: percent,
122
- fraction: fraction,
123
- bracket: bracket,
124
- cssvar: cssvar,
125
- time: time,
126
- global: global
127
- };
128
-
129
- const handler = core.createValueHandler(valueHandlers);
130
- const h = handler;
131
-
132
- function capitalize(str) {
133
- return str.charAt(0).toUpperCase() + str.slice(1);
134
- }
135
-
136
- exports.capitalize = capitalize;
137
- exports.cornerMap = cornerMap;
138
- exports.directionMap = directionMap;
139
- exports.h = h;
140
- exports.handler = handler;
141
- exports.valueHandlers = valueHandlers;
142
- exports.xyzMap = xyzMap;
@@ -1,134 +0,0 @@
1
- import { createValueHandler } from '@unocss/core';
2
-
3
- const directionMap = {
4
- "l": ["-left"],
5
- "r": ["-right"],
6
- "t": ["-top"],
7
- "b": ["-bottom"],
8
- "s": ["-inline-start"],
9
- "e": ["-inline-end"],
10
- "x": ["-left", "-right"],
11
- "y": ["-top", "-bottom"],
12
- "": [""],
13
- "a": [""]
14
- };
15
- const cornerMap = {
16
- "t": ["-top-left", "-top-right"],
17
- "r": ["-top-right", "-bottom-right"],
18
- "b": ["-bottom-left", "-bottom-right"],
19
- "l": ["-bottom-left", "-top-left"],
20
- "tl": ["-top-left"],
21
- "lt": ["-top-left"],
22
- "tr": ["-top-right"],
23
- "rt": ["-top-right"],
24
- "bl": ["-bottom-left"],
25
- "lb": ["-bottom-left"],
26
- "br": ["-bottom-right"],
27
- "rb": ["-bottom-right"],
28
- "": [""]
29
- };
30
- const xyzMap = {
31
- "x": ["-x"],
32
- "y": ["-y"],
33
- "z": ["-z"],
34
- "": ["-x", "-y"]
35
- };
36
-
37
- const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
38
- const numberRE = /^(-?[0-9.]+)$/i;
39
- const unitOnlyRE = /^(px)$/i;
40
- function rem(str) {
41
- if (str === "auto" || str === "a")
42
- return "auto";
43
- if (str.match(unitOnlyRE))
44
- return `1${str}`;
45
- const match = str.match(numberWithUnitRE);
46
- if (!match)
47
- return;
48
- const [, n, unit] = match;
49
- if (unit)
50
- return str;
51
- const num = parseFloat(n);
52
- if (!Number.isNaN(num))
53
- return `${num / 4}rem`;
54
- }
55
- function px(str) {
56
- if (str.match(unitOnlyRE))
57
- return `1${str}`;
58
- const match = str.match(numberWithUnitRE);
59
- if (!match)
60
- return;
61
- const [, n, unit] = match;
62
- if (unit)
63
- return str;
64
- const num = parseFloat(n);
65
- if (!Number.isNaN(num))
66
- return `${num}px`;
67
- }
68
- function number(str) {
69
- if (!numberRE.test(str))
70
- return;
71
- const num = parseFloat(str);
72
- if (!Number.isNaN(num))
73
- return num;
74
- }
75
- function percent(str) {
76
- if (str.endsWith("%"))
77
- str = str.slice(0, -1);
78
- const num = parseFloat(str);
79
- if (!Number.isNaN(num))
80
- return `${num / 100}`;
81
- }
82
- function fraction(str) {
83
- if (str === "full")
84
- return "100%";
85
- const [left, right] = str.split("/");
86
- const num = parseFloat(left) / parseFloat(right);
87
- if (!Number.isNaN(num))
88
- return `${num * 100}%`;
89
- }
90
- function bracket(str) {
91
- if (str && str[0] === "[" && str[str.length - 1] === "]") {
92
- return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
93
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
94
- });
95
- }
96
- }
97
- function cssvar(str) {
98
- if (str.startsWith("$"))
99
- return `var(--${str.slice(1)})`;
100
- }
101
- function time(str) {
102
- const duration = Number(str.replace(/(s|ms)$/, ""));
103
- if (isNaN(duration))
104
- return;
105
- if (/ms|s$/.test(str))
106
- return str;
107
- return `${str}ms`;
108
- }
109
- function global(str) {
110
- if (["inherit", "initial", "unset"].includes(str))
111
- return str;
112
- }
113
-
114
- const valueHandlers = {
115
- __proto__: null,
116
- rem: rem,
117
- px: px,
118
- number: number,
119
- percent: percent,
120
- fraction: fraction,
121
- bracket: bracket,
122
- cssvar: cssvar,
123
- time: time,
124
- global: global
125
- };
126
-
127
- const handler = createValueHandler(valueHandlers);
128
- const h = handler;
129
-
130
- function capitalize(str) {
131
- return str.charAt(0).toUpperCase() + str.slice(1);
132
- }
133
-
134
- export { capitalize as a, h as b, cornerMap as c, directionMap as d, handler as h, valueHandlers as v, xyzMap as x };