@unocss/preset-mini 0.21.2 → 0.22.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.
@@ -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,6 +46,16 @@ const variantCombinators = [
46
46
  variants$1.variantMatcher("svg", (input) => `${input} svg *`)
47
47
  ];
48
48
 
49
+ const variantMotions = [
50
+ variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
51
+ variants$1.variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
52
+ ];
53
+ const variantOrientations = [
54
+ variants$1.variantParentMatcher("landscape", "@media (orientation: landscape)"),
55
+ variants$1.variantParentMatcher("portrait", "@media (orientation: portrait)")
56
+ ];
57
+ const variantPrint = variants$1.variantParentMatcher("print", "@media print");
58
+
49
59
  const variantColorsMediaOrClass = (options = {}) => {
50
60
  if (options?.dark === "class") {
51
61
  return [
@@ -98,17 +108,147 @@ const variantNegative = {
98
108
  }
99
109
  };
100
110
 
101
- const variantMotions = [
102
- variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
103
- variants$1.variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
104
- ];
105
-
106
- const variantOrientations = [
107
- variants$1.variantParentMatcher("landscape", "@media (orientation: landscape)"),
108
- variants$1.variantParentMatcher("portrait", "@media (orientation: portrait)")
111
+ const PseudoClasses = Object.fromEntries([
112
+ "any-link",
113
+ "link",
114
+ "visited",
115
+ "target",
116
+ ["open", "[open]"],
117
+ "hover",
118
+ "active",
119
+ "focus-visible",
120
+ "focus-within",
121
+ "focus",
122
+ "autofill",
123
+ "enabled",
124
+ "disabled",
125
+ "read-only",
126
+ "read-write",
127
+ "placeholder-shown",
128
+ "default",
129
+ "checked",
130
+ "indeterminate",
131
+ "valid",
132
+ "invalid",
133
+ "in-range",
134
+ "out-of-range",
135
+ "required",
136
+ "optional",
137
+ "root",
138
+ "empty",
139
+ ["even-of-type", ":nth-of-type(even)"],
140
+ ["even", ":nth-child(even)"],
141
+ ["odd-of-type", ":nth-of-type(odd)"],
142
+ ["odd", ":nth-child(odd)"],
143
+ "first-of-type",
144
+ ["first", ":first-child"],
145
+ "last-of-type",
146
+ ["last", ":last-child"],
147
+ "only-child",
148
+ "only-of-type"
149
+ ].map(core.toArray));
150
+ const PseudoElements = Object.fromEntries([
151
+ "placeholder",
152
+ "before",
153
+ "after",
154
+ "first-letter",
155
+ "first-line",
156
+ "selection",
157
+ "marker",
158
+ ["file", "::file-selector-button"]
159
+ ].map(core.toArray));
160
+ const PseudoClassFunctions = [
161
+ "not",
162
+ "is",
163
+ "where",
164
+ "has"
109
165
  ];
110
-
111
- const variantPrint = variants$1.variantParentMatcher("print", "@media print");
166
+ const PseudoElementsStr = Object.keys(PseudoElements).join("|");
167
+ const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
168
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
169
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
170
+ const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
171
+ const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
172
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
173
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
174
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
175
+ const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
176
+ return (input) => {
177
+ const match = input.match(re);
178
+ if (match) {
179
+ let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
180
+ if (match[2])
181
+ pseudo = `:${match[2]}(${pseudo})`;
182
+ return {
183
+ matcher: input.slice(match[1].length + tag.length + 2),
184
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
185
+ };
186
+ }
187
+ };
188
+ };
189
+ const variantPseudoElements = (input) => {
190
+ const match = input.match(PseudoElementsRE);
191
+ if (match) {
192
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
193
+ return {
194
+ matcher: input.slice(match[1].length + 1),
195
+ selector: (s) => `${s}${pseudo}`
196
+ };
197
+ }
198
+ };
199
+ const variantPseudoClasses = {
200
+ match: (input) => {
201
+ const match = input.match(PseudoClassesRE);
202
+ if (match) {
203
+ const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
204
+ return {
205
+ matcher: input.slice(match[1].length + 1),
206
+ selector: (s) => `${s}${pseudo}`
207
+ };
208
+ }
209
+ },
210
+ multiPass: true
211
+ };
212
+ const variantPseudoClassFunctions = {
213
+ match: (input) => {
214
+ const match = input.match(PseudoClassFunctionsRE);
215
+ if (match) {
216
+ const fn = match[1];
217
+ const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
218
+ return {
219
+ matcher: input.slice(match[1].length + match[2].length + 2),
220
+ selector: (s) => `${s}:${fn}(${pseudo})`
221
+ };
222
+ }
223
+ },
224
+ multiPass: true
225
+ };
226
+ const variantTaggedPseudoClasses = (options = {}) => {
227
+ const attributify = !!options?.attributifyPseudo;
228
+ return [
229
+ {
230
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
231
+ multiPass: true
232
+ },
233
+ {
234
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
235
+ multiPass: true
236
+ }
237
+ ];
238
+ };
239
+ const partClasses = {
240
+ match: (input) => {
241
+ const match = input.match(PartClassesRE);
242
+ if (match) {
243
+ const part = `part(${match[2]})`;
244
+ return {
245
+ matcher: input.slice(match[1].length),
246
+ selector: (s) => `${s}::${part}`
247
+ };
248
+ }
249
+ },
250
+ multiPass: true
251
+ };
112
252
 
113
253
  const variants = (options) => [
114
254
  variantNegative,
@@ -118,15 +258,16 @@ const variants = (options) => [
118
258
  ...variantMotions,
119
259
  variantBreakpoints,
120
260
  ...variantCombinators,
121
- pseudo.variantPseudoClasses,
122
- pseudo.variantPseudoClassFunctions,
123
- ...pseudo.variantTaggedPseudoClasses(options),
124
- pseudo.variantPseudoElements,
125
- pseudo.partClasses,
261
+ variantPseudoClasses,
262
+ variantPseudoClassFunctions,
263
+ ...variantTaggedPseudoClasses(options),
264
+ variantPseudoElements,
265
+ partClasses,
126
266
  ...variantColorsMediaOrClass(options),
127
267
  ...variantLanguageDirections
128
268
  ];
129
269
 
270
+ exports.partClasses = partClasses;
130
271
  exports.variantBreakpoints = variantBreakpoints;
131
272
  exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
132
273
  exports.variantCombinators = variantCombinators;
@@ -136,4 +277,8 @@ exports.variantMotions = variantMotions;
136
277
  exports.variantNegative = variantNegative;
137
278
  exports.variantOrientations = variantOrientations;
138
279
  exports.variantPrint = variantPrint;
280
+ exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
281
+ exports.variantPseudoClasses = variantPseudoClasses;
282
+ exports.variantPseudoElements = variantPseudoElements;
283
+ exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
139
284
  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,6 +44,16 @@ const variantCombinators = [
44
44
  variantMatcher("svg", (input) => `${input} svg *`)
45
45
  ];
46
46
 
47
+ const variantMotions = [
48
+ variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
49
+ variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
50
+ ];
51
+ const variantOrientations = [
52
+ variantParentMatcher("landscape", "@media (orientation: landscape)"),
53
+ variantParentMatcher("portrait", "@media (orientation: portrait)")
54
+ ];
55
+ const variantPrint = variantParentMatcher("print", "@media print");
56
+
47
57
  const variantColorsMediaOrClass = (options = {}) => {
48
58
  if (options?.dark === "class") {
49
59
  return [
@@ -96,17 +106,147 @@ const variantNegative = {
96
106
  }
97
107
  };
98
108
 
99
- const variantMotions = [
100
- variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
101
- variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
102
- ];
103
-
104
- const variantOrientations = [
105
- variantParentMatcher("landscape", "@media (orientation: landscape)"),
106
- variantParentMatcher("portrait", "@media (orientation: portrait)")
109
+ const PseudoClasses = Object.fromEntries([
110
+ "any-link",
111
+ "link",
112
+ "visited",
113
+ "target",
114
+ ["open", "[open]"],
115
+ "hover",
116
+ "active",
117
+ "focus-visible",
118
+ "focus-within",
119
+ "focus",
120
+ "autofill",
121
+ "enabled",
122
+ "disabled",
123
+ "read-only",
124
+ "read-write",
125
+ "placeholder-shown",
126
+ "default",
127
+ "checked",
128
+ "indeterminate",
129
+ "valid",
130
+ "invalid",
131
+ "in-range",
132
+ "out-of-range",
133
+ "required",
134
+ "optional",
135
+ "root",
136
+ "empty",
137
+ ["even-of-type", ":nth-of-type(even)"],
138
+ ["even", ":nth-child(even)"],
139
+ ["odd-of-type", ":nth-of-type(odd)"],
140
+ ["odd", ":nth-child(odd)"],
141
+ "first-of-type",
142
+ ["first", ":first-child"],
143
+ "last-of-type",
144
+ ["last", ":last-child"],
145
+ "only-child",
146
+ "only-of-type"
147
+ ].map(toArray));
148
+ const PseudoElements = Object.fromEntries([
149
+ "placeholder",
150
+ "before",
151
+ "after",
152
+ "first-letter",
153
+ "first-line",
154
+ "selection",
155
+ "marker",
156
+ ["file", "::file-selector-button"]
157
+ ].map(toArray));
158
+ const PseudoClassFunctions = [
159
+ "not",
160
+ "is",
161
+ "where",
162
+ "has"
107
163
  ];
108
-
109
- const variantPrint = variantParentMatcher("print", "@media print");
164
+ const PseudoElementsStr = Object.keys(PseudoElements).join("|");
165
+ const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
166
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
167
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
168
+ const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
169
+ const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
170
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
171
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
172
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
173
+ const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
174
+ return (input) => {
175
+ const match = input.match(re);
176
+ if (match) {
177
+ let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
178
+ if (match[2])
179
+ pseudo = `:${match[2]}(${pseudo})`;
180
+ return {
181
+ matcher: input.slice(match[1].length + tag.length + 2),
182
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
183
+ };
184
+ }
185
+ };
186
+ };
187
+ const variantPseudoElements = (input) => {
188
+ const match = input.match(PseudoElementsRE);
189
+ if (match) {
190
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
191
+ return {
192
+ matcher: input.slice(match[1].length + 1),
193
+ selector: (s) => `${s}${pseudo}`
194
+ };
195
+ }
196
+ };
197
+ const variantPseudoClasses = {
198
+ match: (input) => {
199
+ const match = input.match(PseudoClassesRE);
200
+ if (match) {
201
+ const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
202
+ return {
203
+ matcher: input.slice(match[1].length + 1),
204
+ selector: (s) => `${s}${pseudo}`
205
+ };
206
+ }
207
+ },
208
+ multiPass: true
209
+ };
210
+ const variantPseudoClassFunctions = {
211
+ match: (input) => {
212
+ const match = input.match(PseudoClassFunctionsRE);
213
+ if (match) {
214
+ const fn = match[1];
215
+ const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
216
+ return {
217
+ matcher: input.slice(match[1].length + match[2].length + 2),
218
+ selector: (s) => `${s}:${fn}(${pseudo})`
219
+ };
220
+ }
221
+ },
222
+ multiPass: true
223
+ };
224
+ const variantTaggedPseudoClasses = (options = {}) => {
225
+ const attributify = !!options?.attributifyPseudo;
226
+ return [
227
+ {
228
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
229
+ multiPass: true
230
+ },
231
+ {
232
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
233
+ multiPass: true
234
+ }
235
+ ];
236
+ };
237
+ const partClasses = {
238
+ match: (input) => {
239
+ const match = input.match(PartClassesRE);
240
+ if (match) {
241
+ const part = `part(${match[2]})`;
242
+ return {
243
+ matcher: input.slice(match[1].length),
244
+ selector: (s) => `${s}::${part}`
245
+ };
246
+ }
247
+ },
248
+ multiPass: true
249
+ };
110
250
 
111
251
  const variants = (options) => [
112
252
  variantNegative,
@@ -125,4 +265,4 @@ const variants = (options) => [
125
265
  ...variantLanguageDirections
126
266
  ];
127
267
 
128
- 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 };
268
+ export { variantBreakpoints as a, variantCombinators as b, variantMotions as c, variantOrientations as d, variantPrint as e, variantColorsMediaOrClass as f, variantLanguageDirections as g, variantImportant as h, variantNegative as i, variantPseudoElements as j, variantPseudoClasses as k, variantPseudoClassFunctions as l, variantTaggedPseudoClasses as m, partClasses as p, variants as v };
@@ -12,13 +12,29 @@ const directionMap = {
12
12
  "x": ["-left", "-right"],
13
13
  "y": ["-top", "-bottom"],
14
14
  "": [""],
15
- "a": [""]
15
+ "bs": ["-block-start"],
16
+ "be": ["-block-end"],
17
+ "is": ["-inline-start"],
18
+ "ie": ["-inline-end"],
19
+ "block": ["-block-start", "-block-end"],
20
+ "inline": ["-inline-start", "-inline-end"]
21
+ };
22
+ const insetMap = {
23
+ ...directionMap,
24
+ s: ["-inset-inline-start"],
25
+ e: ["-inset-inline-end"],
26
+ bs: ["-inset-block-start"],
27
+ be: ["-inset-block-end"],
28
+ is: ["-inset-inline-start"],
29
+ ie: ["-inset-inline-end"],
30
+ block: ["-inset-block-start", "-inset-block-end"],
31
+ inline: ["-inset-inline-start", "-inset-inline-end"]
16
32
  };
17
33
  const cornerMap = {
18
- "t": ["-top-left", "-top-right"],
34
+ "l": ["-top-left", "-bottom-left"],
19
35
  "r": ["-top-right", "-bottom-right"],
36
+ "t": ["-top-left", "-top-right"],
20
37
  "b": ["-bottom-left", "-bottom-right"],
21
- "l": ["-bottom-left", "-top-left"],
22
38
  "tl": ["-top-left"],
23
39
  "lt": ["-top-left"],
24
40
  "tr": ["-top-right"],
@@ -27,7 +43,19 @@ const cornerMap = {
27
43
  "lb": ["-bottom-left"],
28
44
  "br": ["-bottom-right"],
29
45
  "rb": ["-bottom-right"],
30
- "": [""]
46
+ "": [""],
47
+ "bs": ["-start-start", "-start-end"],
48
+ "be": ["-end-start", "-end-end"],
49
+ "is": ["-end-start", "-start-start"],
50
+ "ie": ["-start-end", "-end-end"],
51
+ "bs-is": ["-start-start"],
52
+ "is-bs": ["-start-start"],
53
+ "bs-ie": ["-start-end"],
54
+ "ie-bs": ["-start-end"],
55
+ "be-is": ["-end-start"],
56
+ "is-be": ["-end-start"],
57
+ "be-ie": ["-end-end"],
58
+ "ie-be": ["-end-end"]
31
59
  };
32
60
  const xyzMap = {
33
61
  "x": ["-x"],
@@ -178,7 +206,7 @@ function fraction(str) {
178
206
  }
179
207
  function bracket(str) {
180
208
  if (str && str[0] === "[" && str[str.length - 1] === "]") {
181
- return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
209
+ return str.slice(1, -1).replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(?<!\\)_/g, " ").replace(/calc\((.*)/g, (v) => {
182
210
  return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
183
211
  });
184
212
  }
@@ -197,7 +225,7 @@ function time(str) {
197
225
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
198
226
  }
199
227
  function degree(str) {
200
- const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
228
+ const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
201
229
  if (!match)
202
230
  return;
203
231
  const [, n, unit] = match;
@@ -237,11 +265,8 @@ const valueHandlers = {
237
265
  const handler = core.createValueHandler(valueHandlers);
238
266
  const h = handler;
239
267
 
240
- function capitalize(str) {
241
- return str.charAt(0).toUpperCase() + str.slice(1);
242
- }
243
268
  const directionSize = (propertyPrefix) => ([_, direction, size]) => {
244
- const v = handler.bracket.auto.rem.fraction.cssvar(size);
269
+ const v = handler.bracket.cssvar.auto.fraction.rem(size);
245
270
  if (v !== void 0)
246
271
  return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
247
272
  };
@@ -325,13 +350,13 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
325
350
  }
326
351
  };
327
352
 
328
- exports.capitalize = capitalize;
329
353
  exports.colorResolver = colorResolver;
330
354
  exports.cornerMap = cornerMap;
331
355
  exports.directionMap = directionMap;
332
356
  exports.directionSize = directionSize;
333
357
  exports.h = h;
334
358
  exports.handler = handler;
359
+ exports.insetMap = insetMap;
335
360
  exports.parseColor = parseColor;
336
361
  exports.positionMap = positionMap;
337
362
  exports.valueHandlers = valueHandlers;
@@ -10,13 +10,29 @@ const directionMap = {
10
10
  "x": ["-left", "-right"],
11
11
  "y": ["-top", "-bottom"],
12
12
  "": [""],
13
- "a": [""]
13
+ "bs": ["-block-start"],
14
+ "be": ["-block-end"],
15
+ "is": ["-inline-start"],
16
+ "ie": ["-inline-end"],
17
+ "block": ["-block-start", "-block-end"],
18
+ "inline": ["-inline-start", "-inline-end"]
19
+ };
20
+ const insetMap = {
21
+ ...directionMap,
22
+ s: ["-inset-inline-start"],
23
+ e: ["-inset-inline-end"],
24
+ bs: ["-inset-block-start"],
25
+ be: ["-inset-block-end"],
26
+ is: ["-inset-inline-start"],
27
+ ie: ["-inset-inline-end"],
28
+ block: ["-inset-block-start", "-inset-block-end"],
29
+ inline: ["-inset-inline-start", "-inset-inline-end"]
14
30
  };
15
31
  const cornerMap = {
16
- "t": ["-top-left", "-top-right"],
32
+ "l": ["-top-left", "-bottom-left"],
17
33
  "r": ["-top-right", "-bottom-right"],
34
+ "t": ["-top-left", "-top-right"],
18
35
  "b": ["-bottom-left", "-bottom-right"],
19
- "l": ["-bottom-left", "-top-left"],
20
36
  "tl": ["-top-left"],
21
37
  "lt": ["-top-left"],
22
38
  "tr": ["-top-right"],
@@ -25,7 +41,19 @@ const cornerMap = {
25
41
  "lb": ["-bottom-left"],
26
42
  "br": ["-bottom-right"],
27
43
  "rb": ["-bottom-right"],
28
- "": [""]
44
+ "": [""],
45
+ "bs": ["-start-start", "-start-end"],
46
+ "be": ["-end-start", "-end-end"],
47
+ "is": ["-end-start", "-start-start"],
48
+ "ie": ["-start-end", "-end-end"],
49
+ "bs-is": ["-start-start"],
50
+ "is-bs": ["-start-start"],
51
+ "bs-ie": ["-start-end"],
52
+ "ie-bs": ["-start-end"],
53
+ "be-is": ["-end-start"],
54
+ "is-be": ["-end-start"],
55
+ "be-ie": ["-end-end"],
56
+ "ie-be": ["-end-end"]
29
57
  };
30
58
  const xyzMap = {
31
59
  "x": ["-x"],
@@ -176,7 +204,7 @@ function fraction(str) {
176
204
  }
177
205
  function bracket(str) {
178
206
  if (str && str[0] === "[" && str[str.length - 1] === "]") {
179
- return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
207
+ return str.slice(1, -1).replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(?<!\\)_/g, " ").replace(/calc\((.*)/g, (v) => {
180
208
  return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
181
209
  });
182
210
  }
@@ -195,7 +223,7 @@ function time(str) {
195
223
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
196
224
  }
197
225
  function degree(str) {
198
- const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
226
+ const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
199
227
  if (!match)
200
228
  return;
201
229
  const [, n, unit] = match;
@@ -235,11 +263,8 @@ const valueHandlers = {
235
263
  const handler = createValueHandler(valueHandlers);
236
264
  const h = handler;
237
265
 
238
- function capitalize(str) {
239
- return str.charAt(0).toUpperCase() + str.slice(1);
240
- }
241
266
  const directionSize = (propertyPrefix) => ([_, direction, size]) => {
242
- const v = handler.bracket.auto.rem.fraction.cssvar(size);
267
+ const v = handler.bracket.cssvar.auto.fraction.rem(size);
243
268
  if (v !== void 0)
244
269
  return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
245
270
  };
@@ -323,4 +348,4 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
323
348
  }
324
349
  };
325
350
 
326
- export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e, positionMap as f, h as g, handler as h, parseColor as p, valueHandlers as v, xyzMap as x };
351
+ export { cornerMap as a, directionSize as b, colorResolver as c, directionMap as d, positionMap as e, h as f, handler as h, insetMap as i, parseColor as p, valueHandlers as v, xyzMap as x };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-a2d2b52f';
1
+ import { T as Theme } from './types-c14b808b';
2
2
 
3
3
  declare const colors: Theme['colors'];
4
4
 
package/dist/colors.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as colors } from './colors-6d634692';
2
- import './types-a2d2b52f';
1
+ export { c as colors } from './colors-338f482c';
2
+ import './types-c14b808b';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-a2d2b52f';
1
+ import { T as Theme } from './types-c14b808b';
2
2
 
3
3
  declare const theme: Theme;
4
4
 
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 = {}) => {
@@ -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
@@ -1,8 +1,9 @@
1
1
  import { PresetOptions, Preset } from '@unocss/core';
2
- import { T as Theme } from './types-a2d2b52f';
3
- export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
4
- export { t as theme } from './default-958434b6';
5
- export { c as colors } from './colors-6d634692';
2
+ import { T as Theme } from './types-c14b808b';
3
+ export { T as Theme, a as ThemeAnimation } from './types-c14b808b';
4
+ export { t as theme } from './default-17948303';
5
+ export { c as colors } from './colors-338f482c';
6
+ export { p as parseColor } from './utilities-29b01158';
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 = {}) => {
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
 
@@ -18,7 +17,9 @@ exports.borders = _default.borders;
18
17
  exports.boxShadows = _default.boxShadows;
19
18
  exports.boxSizing = _default.boxSizing;
20
19
  exports.breaks = _default.breaks;
20
+ exports.colorableShadows = _default.colorableShadows;
21
21
  exports.contents = _default.contents;
22
+ exports.cssProperty = _default.cssProperty;
22
23
  exports.cssVariables = _default.cssVariables;
23
24
  exports.cursors = _default.cursors;
24
25
  exports.displays = _default.displays;
@@ -44,6 +45,7 @@ exports.questionMark = _default.questionMark;
44
45
  exports.resizes = _default.resizes;
45
46
  exports.rings = _default.rings;
46
47
  exports.rules = _default.rules;
48
+ exports.shadowBase = _default.shadowBase;
47
49
  exports.sizes = _default.sizes;
48
50
  exports.svgUtilities = _default.svgUtilities;
49
51
  exports.tabSizes = _default.tabSizes;