@unocss/preset-mini 0.20.4 → 0.22.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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const variants$1 = require('./variants.cjs');
4
- const pseudo = require('./pseudo.cjs');
4
+ const core = require('@unocss/core');
5
5
 
6
6
  const regexCache = {};
7
7
  const variantBreakpoints = (matcher, { theme }) => {
@@ -46,24 +46,18 @@ const variantCombinators = [
46
46
  variants$1.variantMatcher("svg", (input) => `${input} svg *`)
47
47
  ];
48
48
 
49
- const variantColorsMediaOrClass = [
50
- (v, { options: { dark } }) => {
51
- if (dark === "class")
52
- return variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
53
- },
54
- (v, { options: { dark } }) => {
55
- if (dark === "class")
56
- return variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
57
- },
58
- (v, { options: { dark } }) => {
59
- if (dark === "media")
60
- return variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
61
- },
62
- (v, { options: { dark } }) => {
63
- if (dark === "media")
64
- return variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
49
+ const variantColorsMediaOrClass = (options = {}) => {
50
+ if (options?.dark === "class") {
51
+ return [
52
+ variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`),
53
+ variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)
54
+ ];
65
55
  }
66
- ];
56
+ return [
57
+ variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
58
+ variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
59
+ ];
60
+ };
67
61
 
68
62
  const variantLanguageDirections = [
69
63
  variants$1.variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
@@ -116,7 +110,157 @@ const variantOrientations = [
116
110
 
117
111
  const variantPrint = variants$1.variantParentMatcher("print", "@media print");
118
112
 
119
- const variants = [
113
+ const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
114
+ const PseudoClasses = Object.fromEntries([
115
+ "any-link",
116
+ "link",
117
+ "visited",
118
+ "target",
119
+ ["open", "[open]"],
120
+ "hover",
121
+ "active",
122
+ "focus-visible",
123
+ "focus-within",
124
+ "focus",
125
+ "autofill",
126
+ "enabled",
127
+ "disabled",
128
+ "read-only",
129
+ "read-write",
130
+ "placeholder-shown",
131
+ "default",
132
+ "checked",
133
+ "indeterminate",
134
+ "valid",
135
+ "invalid",
136
+ "in-range",
137
+ "out-of-range",
138
+ "required",
139
+ "optional",
140
+ "root",
141
+ "empty",
142
+ ["even-of-type", ":nth-of-type(even)"],
143
+ ["even", ":nth-child(even)"],
144
+ ["odd-of-type", ":nth-of-type(odd)"],
145
+ ["odd", ":nth-child(odd)"],
146
+ "first-of-type",
147
+ ["first", ":first-child"],
148
+ "last-of-type",
149
+ ["last", ":last-child"],
150
+ "only-child",
151
+ "only-of-type"
152
+ ].map(core.toArray));
153
+ const PseudoElements = Object.fromEntries([
154
+ "placeholder",
155
+ "before",
156
+ "after",
157
+ "first-letter",
158
+ "first-line",
159
+ "selection",
160
+ "marker",
161
+ ["file", "::file-selector-button"]
162
+ ].map(core.toArray));
163
+ const PseudoClassFunctions = [
164
+ "not",
165
+ "is",
166
+ "where",
167
+ "has"
168
+ ];
169
+ const PseudoElementsStr = Object.keys(PseudoElements).join("|");
170
+ const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
171
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
172
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
173
+ const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
174
+ const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
175
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
176
+ function shouldAdd(entires) {
177
+ return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
178
+ }
179
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
180
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
181
+ const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
182
+ return (input) => {
183
+ const match = input.match(re);
184
+ if (match) {
185
+ let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
186
+ if (match[2])
187
+ pseudo = `:${match[2]}(${pseudo})`;
188
+ return {
189
+ matcher: input.slice(match[1].length + tag.length + 2),
190
+ selector: (s, body) => {
191
+ return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
192
+ }
193
+ };
194
+ }
195
+ };
196
+ };
197
+ const variantPseudoElements = (input) => {
198
+ const match = input.match(PseudoElementsRE);
199
+ if (match) {
200
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
201
+ return {
202
+ matcher: input.slice(match[1].length + 1),
203
+ selector: (s) => `${s}${pseudo}`
204
+ };
205
+ }
206
+ };
207
+ const variantPseudoClasses = {
208
+ match: (input) => {
209
+ const match = input.match(PseudoClassesRE);
210
+ if (match) {
211
+ const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
212
+ return {
213
+ matcher: input.slice(match[1].length + 1),
214
+ selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
215
+ };
216
+ }
217
+ },
218
+ multiPass: true
219
+ };
220
+ const variantPseudoClassFunctions = {
221
+ match: (input) => {
222
+ const match = input.match(PseudoClassFunctionsRE);
223
+ if (match) {
224
+ const fn = match[1];
225
+ const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
226
+ return {
227
+ matcher: input.slice(match[1].length + match[2].length + 2),
228
+ selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
229
+ };
230
+ }
231
+ },
232
+ multiPass: true
233
+ };
234
+ const variantTaggedPseudoClasses = (options = {}) => {
235
+ const attributify = !!options?.attributifyPseudo;
236
+ return [
237
+ {
238
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
239
+ multiPass: true
240
+ },
241
+ {
242
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
243
+ multiPass: true
244
+ }
245
+ ];
246
+ };
247
+ const partClasses = {
248
+ match: (input) => {
249
+ const match = input.match(PartClassesRE);
250
+ if (match) {
251
+ const part = `part(${match[2]})`;
252
+ return {
253
+ matcher: input.slice(match[1].length),
254
+ selector: (s, body) => {
255
+ return shouldAdd(body) && `${s}::${part}`;
256
+ }
257
+ };
258
+ }
259
+ },
260
+ multiPass: true
261
+ };
262
+
263
+ const variants = (options) => [
120
264
  variantNegative,
121
265
  variantImportant,
122
266
  variantPrint,
@@ -124,15 +268,17 @@ const variants = [
124
268
  ...variantMotions,
125
269
  variantBreakpoints,
126
270
  ...variantCombinators,
127
- pseudo.variantPseudoClasses,
128
- pseudo.variantPseudoClassFunctions,
129
- pseudo.variantTaggedPseudoClasses,
130
- pseudo.variantPseudoElements,
131
- pseudo.partClasses,
132
- ...variantColorsMediaOrClass,
271
+ variantPseudoClasses,
272
+ variantPseudoClassFunctions,
273
+ ...variantTaggedPseudoClasses(options),
274
+ variantPseudoElements,
275
+ partClasses,
276
+ ...variantColorsMediaOrClass(options),
133
277
  ...variantLanguageDirections
134
278
  ];
135
279
 
280
+ exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
281
+ exports.partClasses = partClasses;
136
282
  exports.variantBreakpoints = variantBreakpoints;
137
283
  exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
138
284
  exports.variantCombinators = variantCombinators;
@@ -142,4 +288,8 @@ exports.variantMotions = variantMotions;
142
288
  exports.variantNegative = variantNegative;
143
289
  exports.variantOrientations = variantOrientations;
144
290
  exports.variantPrint = variantPrint;
291
+ exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
292
+ exports.variantPseudoClasses = variantPseudoClasses;
293
+ exports.variantPseudoElements = variantPseudoElements;
294
+ exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
145
295
  exports.variants = variants;
@@ -1,5 +1,5 @@
1
1
  import { v as variantMatcher, a as variantParentMatcher } from './variants.mjs';
2
- import { v as variantPseudoClasses, a as variantPseudoClassFunctions, b as variantTaggedPseudoClasses, c as variantPseudoElements, p as partClasses } from './pseudo.mjs';
2
+ import { toArray, escapeRegExp } from '@unocss/core';
3
3
 
4
4
  const regexCache = {};
5
5
  const variantBreakpoints = (matcher, { theme }) => {
@@ -44,24 +44,18 @@ const variantCombinators = [
44
44
  variantMatcher("svg", (input) => `${input} svg *`)
45
45
  ];
46
46
 
47
- const variantColorsMediaOrClass = [
48
- (v, { options: { dark } }) => {
49
- if (dark === "class")
50
- return variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
51
- },
52
- (v, { options: { dark } }) => {
53
- if (dark === "class")
54
- return variantMatcher("light", (input) => `.light $$ ${input}`)(v);
55
- },
56
- (v, { options: { dark } }) => {
57
- if (dark === "media")
58
- return variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
59
- },
60
- (v, { options: { dark } }) => {
61
- if (dark === "media")
62
- return variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
47
+ const variantColorsMediaOrClass = (options = {}) => {
48
+ if (options?.dark === "class") {
49
+ return [
50
+ variantMatcher("dark", (input) => `.dark $$ ${input}`),
51
+ variantMatcher("light", (input) => `.light $$ ${input}`)
52
+ ];
63
53
  }
64
- ];
54
+ return [
55
+ variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
56
+ variantParentMatcher("light", "@media (prefers-color-scheme: light)")
57
+ ];
58
+ };
65
59
 
66
60
  const variantLanguageDirections = [
67
61
  variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
@@ -114,7 +108,157 @@ const variantOrientations = [
114
108
 
115
109
  const variantPrint = variantParentMatcher("print", "@media print");
116
110
 
117
- const variants = [
111
+ const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
112
+ const PseudoClasses = Object.fromEntries([
113
+ "any-link",
114
+ "link",
115
+ "visited",
116
+ "target",
117
+ ["open", "[open]"],
118
+ "hover",
119
+ "active",
120
+ "focus-visible",
121
+ "focus-within",
122
+ "focus",
123
+ "autofill",
124
+ "enabled",
125
+ "disabled",
126
+ "read-only",
127
+ "read-write",
128
+ "placeholder-shown",
129
+ "default",
130
+ "checked",
131
+ "indeterminate",
132
+ "valid",
133
+ "invalid",
134
+ "in-range",
135
+ "out-of-range",
136
+ "required",
137
+ "optional",
138
+ "root",
139
+ "empty",
140
+ ["even-of-type", ":nth-of-type(even)"],
141
+ ["even", ":nth-child(even)"],
142
+ ["odd-of-type", ":nth-of-type(odd)"],
143
+ ["odd", ":nth-child(odd)"],
144
+ "first-of-type",
145
+ ["first", ":first-child"],
146
+ "last-of-type",
147
+ ["last", ":last-child"],
148
+ "only-child",
149
+ "only-of-type"
150
+ ].map(toArray));
151
+ const PseudoElements = Object.fromEntries([
152
+ "placeholder",
153
+ "before",
154
+ "after",
155
+ "first-letter",
156
+ "first-line",
157
+ "selection",
158
+ "marker",
159
+ ["file", "::file-selector-button"]
160
+ ].map(toArray));
161
+ const PseudoClassFunctions = [
162
+ "not",
163
+ "is",
164
+ "where",
165
+ "has"
166
+ ];
167
+ const PseudoElementsStr = Object.keys(PseudoElements).join("|");
168
+ const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
169
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
170
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
171
+ const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
172
+ const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
173
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
174
+ function shouldAdd(entires) {
175
+ return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
176
+ }
177
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
178
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
179
+ const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
180
+ return (input) => {
181
+ const match = input.match(re);
182
+ if (match) {
183
+ let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
184
+ if (match[2])
185
+ pseudo = `:${match[2]}(${pseudo})`;
186
+ return {
187
+ matcher: input.slice(match[1].length + tag.length + 2),
188
+ selector: (s, body) => {
189
+ return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
190
+ }
191
+ };
192
+ }
193
+ };
194
+ };
195
+ const variantPseudoElements = (input) => {
196
+ const match = input.match(PseudoElementsRE);
197
+ if (match) {
198
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
199
+ return {
200
+ matcher: input.slice(match[1].length + 1),
201
+ selector: (s) => `${s}${pseudo}`
202
+ };
203
+ }
204
+ };
205
+ const variantPseudoClasses = {
206
+ match: (input) => {
207
+ const match = input.match(PseudoClassesRE);
208
+ if (match) {
209
+ const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
210
+ return {
211
+ matcher: input.slice(match[1].length + 1),
212
+ selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
213
+ };
214
+ }
215
+ },
216
+ multiPass: true
217
+ };
218
+ const variantPseudoClassFunctions = {
219
+ match: (input) => {
220
+ const match = input.match(PseudoClassFunctionsRE);
221
+ if (match) {
222
+ const fn = match[1];
223
+ const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
224
+ return {
225
+ matcher: input.slice(match[1].length + match[2].length + 2),
226
+ selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
227
+ };
228
+ }
229
+ },
230
+ multiPass: true
231
+ };
232
+ const variantTaggedPseudoClasses = (options = {}) => {
233
+ const attributify = !!options?.attributifyPseudo;
234
+ return [
235
+ {
236
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
237
+ multiPass: true
238
+ },
239
+ {
240
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
241
+ multiPass: true
242
+ }
243
+ ];
244
+ };
245
+ const partClasses = {
246
+ match: (input) => {
247
+ const match = input.match(PartClassesRE);
248
+ if (match) {
249
+ const part = `part(${match[2]})`;
250
+ return {
251
+ matcher: input.slice(match[1].length),
252
+ selector: (s, body) => {
253
+ return shouldAdd(body) && `${s}::${part}`;
254
+ }
255
+ };
256
+ }
257
+ },
258
+ multiPass: true
259
+ };
260
+
261
+ const variants = (options) => [
118
262
  variantNegative,
119
263
  variantImportant,
120
264
  variantPrint,
@@ -124,11 +268,11 @@ const variants = [
124
268
  ...variantCombinators,
125
269
  variantPseudoClasses,
126
270
  variantPseudoClassFunctions,
127
- variantTaggedPseudoClasses,
271
+ ...variantTaggedPseudoClasses(options),
128
272
  variantPseudoElements,
129
273
  partClasses,
130
- ...variantColorsMediaOrClass,
274
+ ...variantColorsMediaOrClass(options),
131
275
  ...variantLanguageDirections
132
276
  ];
133
277
 
134
- export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f, variantMotions as g, variantOrientations as h, variantPrint as i, variants as v };
278
+ export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f, variantMotions as g, variantOrientations as h, variantPrint as i, variantPseudoElements as j, variantPseudoClasses as k, variantPseudoClassFunctions as l, variantTaggedPseudoClasses as m, partClasses as p, variants as v };
@@ -61,7 +61,7 @@ const basePositionMap = [
61
61
  ];
62
62
  const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
63
63
 
64
- const cssBasicProps = [
64
+ const cssProps = [
65
65
  "color",
66
66
  "border-color",
67
67
  "background-color",
@@ -78,17 +78,13 @@ const cssBasicProps = [
78
78
  "zoom",
79
79
  "text-shadow",
80
80
  "transform",
81
- "box-shadow"
82
- ];
83
- const cssPositionProps = [
81
+ "box-shadow",
84
82
  "backround-position",
85
83
  "left",
86
84
  "right",
87
85
  "top",
88
86
  "bottom",
89
- "object-position"
90
- ];
91
- const cssSizeProps = [
87
+ "object-position",
92
88
  "max-height",
93
89
  "min-height",
94
90
  "max-width",
@@ -106,14 +102,16 @@ const cssSizeProps = [
106
102
  "vertical-align",
107
103
  "border-spacing",
108
104
  "letter-spacing",
109
- "word-spacing"
110
- ];
111
- const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
112
- const cssProps = [
113
- ...cssBasicProps,
114
- ...cssPositionProps,
115
- ...cssSizeProps,
116
- ...cssEnhanceProps
105
+ "word-spacing",
106
+ "stroke",
107
+ "filter",
108
+ "backdrop-filter",
109
+ "fill",
110
+ "mask",
111
+ "mask-size",
112
+ "mask-border",
113
+ "clip-path",
114
+ "clip"
117
115
  ];
118
116
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
119
117
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -198,6 +196,15 @@ function time(str) {
198
196
  if (!Number.isNaN(num))
199
197
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
200
198
  }
199
+ function degree(str) {
200
+ const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
201
+ if (!match)
202
+ return;
203
+ const [, n, unit] = match;
204
+ const num = parseFloat(n);
205
+ if (!Number.isNaN(num))
206
+ return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
207
+ }
201
208
  function global(str) {
202
209
  if (["inherit", "initial", "revert", "unset"].includes(str))
203
210
  return str;
@@ -222,6 +229,7 @@ const valueHandlers = {
222
229
  bracket: bracket,
223
230
  cssvar: cssvar,
224
231
  time: time,
232
+ degree: degree,
225
233
  global: global,
226
234
  properties: properties
227
235
  };
@@ -59,7 +59,7 @@ const basePositionMap = [
59
59
  ];
60
60
  const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
61
61
 
62
- const cssBasicProps = [
62
+ const cssProps = [
63
63
  "color",
64
64
  "border-color",
65
65
  "background-color",
@@ -76,17 +76,13 @@ const cssBasicProps = [
76
76
  "zoom",
77
77
  "text-shadow",
78
78
  "transform",
79
- "box-shadow"
80
- ];
81
- const cssPositionProps = [
79
+ "box-shadow",
82
80
  "backround-position",
83
81
  "left",
84
82
  "right",
85
83
  "top",
86
84
  "bottom",
87
- "object-position"
88
- ];
89
- const cssSizeProps = [
85
+ "object-position",
90
86
  "max-height",
91
87
  "min-height",
92
88
  "max-width",
@@ -104,14 +100,16 @@ const cssSizeProps = [
104
100
  "vertical-align",
105
101
  "border-spacing",
106
102
  "letter-spacing",
107
- "word-spacing"
108
- ];
109
- const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
110
- const cssProps = [
111
- ...cssBasicProps,
112
- ...cssPositionProps,
113
- ...cssSizeProps,
114
- ...cssEnhanceProps
103
+ "word-spacing",
104
+ "stroke",
105
+ "filter",
106
+ "backdrop-filter",
107
+ "fill",
108
+ "mask",
109
+ "mask-size",
110
+ "mask-border",
111
+ "clip-path",
112
+ "clip"
115
113
  ];
116
114
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
117
115
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -196,6 +194,15 @@ function time(str) {
196
194
  if (!Number.isNaN(num))
197
195
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
198
196
  }
197
+ function degree(str) {
198
+ const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
199
+ if (!match)
200
+ return;
201
+ const [, n, unit] = match;
202
+ const num = parseFloat(n);
203
+ if (!Number.isNaN(num))
204
+ return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
205
+ }
199
206
  function global(str) {
200
207
  if (["inherit", "initial", "revert", "unset"].includes(str))
201
208
  return str;
@@ -220,6 +227,7 @@ const valueHandlers = {
220
227
  bracket: bracket,
221
228
  cssvar: cssvar,
222
229
  time: time,
230
+ degree: degree,
223
231
  global: global,
224
232
  properties: properties
225
233
  };
package/dist/index.cjs CHANGED
@@ -6,9 +6,8 @@ const _default = require('./chunks/default.cjs');
6
6
  const _default$1 = require('./chunks/default2.cjs');
7
7
  const _default$2 = require('./chunks/default3.cjs');
8
8
  const colors = require('./chunks/colors.cjs');
9
- require('./chunks/utilities.cjs');
9
+ const utilities = require('./chunks/utilities.cjs');
10
10
  require('@unocss/core');
11
- require('./chunks/pseudo.cjs');
12
11
  require('./chunks/variants.cjs');
13
12
 
14
13
  const presetMini = (options = {}) => {
@@ -18,7 +17,7 @@ const presetMini = (options = {}) => {
18
17
  name: "@unocss/preset-mini",
19
18
  theme: _default.theme,
20
19
  rules: _default$1.rules,
21
- variants: _default$2.variants,
20
+ variants: _default$2.variants(options),
22
21
  options,
23
22
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
24
23
  };
@@ -35,5 +34,6 @@ function VarPrefixPostprocessor(prefix) {
35
34
 
36
35
  exports.theme = _default.theme;
37
36
  exports.colors = colors.colors;
37
+ exports.parseColor = utilities.parseColor;
38
38
  exports["default"] = presetMini;
39
39
  exports.presetMini = presetMini;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { T as Theme } from './types-a2d2b52f';
3
3
  export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
4
4
  export { t as theme } from './default-958434b6';
5
5
  export { c as colors } from './colors-6d634692';
6
+ export { p as parseColor } from './utilities-22a522e2';
6
7
 
7
8
  interface PresetMiniOptions extends PresetOptions {
8
9
  /**
package/dist/index.mjs CHANGED
@@ -3,9 +3,8 @@ export { t as theme } from './chunks/default.mjs';
3
3
  import { r as rules } from './chunks/default2.mjs';
4
4
  import { v as variants } from './chunks/default3.mjs';
5
5
  export { c as colors } from './chunks/colors.mjs';
6
- import './chunks/utilities.mjs';
6
+ export { p as parseColor } from './chunks/utilities.mjs';
7
7
  import '@unocss/core';
8
- import './chunks/pseudo.mjs';
9
8
  import './chunks/variants.mjs';
10
9
 
11
10
  const presetMini = (options = {}) => {
@@ -15,7 +14,7 @@ const presetMini = (options = {}) => {
15
14
  name: "@unocss/preset-mini",
16
15
  theme,
17
16
  rules,
18
- variants,
17
+ variants: variants(options),
19
18
  options,
20
19
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
21
20
  };
package/dist/rules.cjs CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const _default = require('./chunks/default2.cjs');
6
6
  require('./chunks/utilities.cjs');
7
7
  require('@unocss/core');
8
- require('./chunks/pseudo.cjs');
9
8
 
10
9
 
11
10
 
package/dist/rules.mjs CHANGED
@@ -1,4 +1,3 @@
1
1
  export { l as alignments, a as appearance, G as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, N as breaks, M as contents, _ as cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, V as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, I as pointerEvents, p as positions, u as questionMark, J as resizes, x as rings, r as rules, A as sizes, S as svgUtilities, W as tabSizes, t as textAligns, d as textColors, $ as textDecorations, X as textIndents, O as textOverflows, Z as textShadows, Y as textStrokes, P as textTransforms, T as transforms, U as transitions, K as userSelects, E as varEmpty, v as verticalAligns, L as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
4
- import './chunks/pseudo.mjs';