@unocss/preset-mini 0.16.1 → 0.17.2

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,6 +1,6 @@
1
- import { hex2rgba, toArray } from '@unocss/core';
2
- import { h as handler, d as directionMap, c as cornerMap, a as capitalize, x as xyzMap } from './index.mjs';
3
- import { C as CONTROL_BYPASS_PSEUDO } from './pseudo.mjs';
1
+ import { c as colorResolver$1, h as handler, d as directionMap, a as cornerMap, p as parseColor, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
2
+ import { toArray } from '@unocss/core';
3
+ import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
4
4
 
5
5
  const verticalAlignAlias = {
6
6
  mid: "middle",
@@ -17,93 +17,10 @@ const textAligns = [
17
17
  ["text-justify", { "text-align": "justify" }]
18
18
  ];
19
19
 
20
- const parseColorUtil = (body, theme) => {
21
- const [main, opacity2] = body.split(/(?:\/|:)/);
22
- const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
23
- if (!name)
24
- return;
25
- let color;
26
- const bracket = handler.bracket(main);
27
- const bracketOrMain = bracket || main;
28
- if (bracketOrMain.startsWith("#"))
29
- color = bracketOrMain.slice(1);
30
- if (bracketOrMain.startsWith("hex-"))
31
- color = bracketOrMain.slice(4);
32
- color = color || bracket;
33
- if (!color) {
34
- const colorData = theme.colors?.[name];
35
- if (typeof colorData === "string")
36
- color = colorData;
37
- else if (no && colorData)
38
- color = colorData[no];
39
- }
40
- return {
41
- opacity: opacity2,
42
- name,
43
- no,
44
- color,
45
- rgba: hex2rgba(color)
46
- };
47
- };
48
- const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
49
- const data = parseColorUtil(body, theme);
50
- if (!data)
51
- return;
52
- const { opacity: opacity2, color, rgba } = data;
53
- if (!color)
54
- return;
55
- const a = opacity2 ? opacity2[0] === "[" ? handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
56
- if (rgba) {
57
- if (a != null && !Number.isNaN(a)) {
58
- rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
59
- return {
60
- [attribute]: `rgba(${rgba.join(",")})`
61
- };
62
- } else {
63
- return {
64
- [`--un-${varName}-opacity`]: 1,
65
- [attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
66
- };
67
- }
68
- } else {
69
- return {
70
- [attribute]: color.replace("%alpha", `${a || 1}`)
71
- };
72
- }
73
- };
74
- const opacity = [
75
- [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
76
- ];
77
- const textColors = [
78
- [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
79
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
80
- ];
81
- const bgColors = [
82
- [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
83
- [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
84
- ];
85
- const borderColors = [
86
- [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
87
- [/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": handler.bracket.percent(opacity2) })]
88
- ];
89
- const ringColors = [
90
- [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
91
- [/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity2) })]
92
- ];
93
- const ringOffsetColors = [
94
- [/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
95
- [/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity2) })]
96
- ];
97
- const fillColors = [
98
- ["fill-none", { fill: "none" }],
99
- [/^fill-(.+)$/, colorResolver$1("fill", "fill")],
100
- [/^fill-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity2) })]
101
- ];
102
-
103
- const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
20
+ const outlineStyle = ["auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
104
21
  const parseOutlineSize = (s) => {
105
22
  const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
106
- const size = handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-)/, ""));
23
+ const size = handler.bracket.fraction.auto.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
107
24
  if (size) {
108
25
  return {
109
26
  [`outline-${propName}`]: size
@@ -111,34 +28,28 @@ const parseOutlineSize = (s) => {
111
28
  }
112
29
  };
113
30
  const outline = [
114
- ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
115
31
  ["outline", { "outline-style": "solid" }],
116
32
  [
117
33
  /^outline-(.+)$/,
118
34
  (match, config) => {
119
35
  const [, d] = match;
120
- if (d === "none") {
121
- return {
122
- "outline": "2px solid transparent",
123
- "outline-offset": "2px"
124
- };
125
- }
126
36
  if (outlineStyle.includes(d)) {
127
37
  return {
128
38
  "outline-style": d
129
39
  };
130
40
  }
131
- const sizeSheet = parseOutlineSize(d);
132
- if (sizeSheet)
133
- return sizeSheet;
134
41
  const colorSheet = colorResolver$1("outline-color", "outline-color")([
135
42
  match[0],
136
43
  match[1].replace(/^color-/, "")
137
44
  ], config);
138
45
  if (colorSheet)
139
46
  return colorSheet;
47
+ const sizeSheet = parseOutlineSize(d);
48
+ if (sizeSheet)
49
+ return sizeSheet;
140
50
  }
141
- ]
51
+ ],
52
+ ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
142
53
  ];
143
54
  const appearance = [
144
55
  ["appearance-none", {
@@ -161,15 +72,18 @@ const placeholder = [
161
72
  }
162
73
  ]
163
74
  ];
75
+ const willChange = [
76
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.global(p) })]
77
+ ];
164
78
 
165
79
  const borders = [
166
80
  [/^border$/, handlerBorder],
167
81
  [/^(?:border|b)()-(.+)$/, handlerBorder],
168
- [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorder],
82
+ [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
169
83
  [/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
170
84
  [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
171
85
  [/^(?:border|b)()-(.+)$/, handlerBorderColor],
172
- [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorderColor],
86
+ [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
173
87
  [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
174
88
  ["border-solid", { "border-style": "solid" }],
175
89
  ["border-dashed", { "border-style": "dashed" }],
@@ -177,8 +91,8 @@ const borders = [
177
91
  ["border-double", { "border-style": "double" }],
178
92
  ["border-none", { "border-style": "none" }],
179
93
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
180
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
181
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
94
+ [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
95
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded]
182
96
  ];
183
97
  function handlerBorder(m) {
184
98
  const borderSizes = handlerBorderSize(m);
@@ -192,116 +106,71 @@ function handlerBorder(m) {
192
106
  function handlerBorderSize([, a, b]) {
193
107
  const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
194
108
  const v = handler.bracket.px(s);
195
- if (v != null) {
196
- return [
197
- ...directionMap[d].map((i) => [`border${i}-width`, v])
198
- ];
199
- }
109
+ if (v !== void 0)
110
+ return directionMap[d].map((i) => [`border${i}-width`, v]);
200
111
  }
201
112
  function handlerBorderColor([, a, c], ctx) {
202
- const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
203
- if (ofColor) {
204
- const borders2 = directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
205
- const borderObject = {};
206
- Object.assign(borderObject, ...borders2);
207
- return borderObject;
113
+ if (c !== void 0 && colorResolver$1("border-color", "border")(["", c], ctx)) {
114
+ return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx)));
208
115
  }
209
116
  }
210
117
  function handlerRounded([, a, b], { theme }) {
211
118
  const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
212
- const v = theme.borderRadius?.[s] || handler.bracket.fraction.rem(s);
213
- if (v != null)
119
+ const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
120
+ if (v !== void 0)
214
121
  return cornerMap[d].map((i) => [`border${i}-radius`, v]);
215
122
  }
216
123
 
217
- const transitionBasicProps = [
218
- "color",
219
- "border-color",
220
- "background-color",
221
- "flex-grow",
222
- "flex",
223
- "flex-shrink",
224
- "caret-color",
225
- "font",
226
- "gap",
227
- "opacity",
228
- "visibility",
229
- "z-index",
230
- "font-weight",
231
- "zoom",
232
- "text-shadow",
233
- "transform",
234
- "box-shadow"
235
- ];
236
- const transitionPositionProps = [
237
- "backround-position",
238
- "left",
239
- "right",
240
- "top",
241
- "bottom",
242
- "object-position"
243
- ];
244
- const transitionSizeProps = [
245
- "max-height",
246
- "min-height",
247
- "max-width",
248
- "min-width",
249
- "height",
250
- "width",
251
- "border-width",
252
- "margin",
253
- "padding",
254
- "outline-width",
255
- "outline-offset",
256
- "font-size",
257
- "line-height",
258
- "text-indent",
259
- "vertical-align",
260
- "border-spacing",
261
- "letter-spacing",
262
- "word-spacing"
263
- ];
264
- const transitionSwitchProps = ["all", "none"];
265
- const transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
266
- const transitionProps = [
267
- ...transitionBasicProps,
268
- ...transitionPositionProps,
269
- ...transitionSizeProps,
270
- ...transitionEnhanceProps
271
- ];
272
- const transitionPropsStr = transitionProps.join(", ");
273
- const validateProperty = (prop) => {
274
- if (prop && ![...transitionProps, ...transitionSwitchProps].includes(prop))
275
- return;
276
- return prop || transitionPropsStr;
124
+ const opacity = [
125
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
126
+ ];
127
+ const textColors = [
128
+ [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
129
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
130
+ ];
131
+ const bgColors = [
132
+ [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
133
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
134
+ ];
135
+ const borderColors = [
136
+ [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
137
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-border-opacity": handler.bracket.percent(opacity2) })]
138
+ ];
139
+ const ringColors = [
140
+ [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
141
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity2) })]
142
+ ];
143
+ const ringOffsetColors = [
144
+ [/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
145
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity2) })]
146
+ ];
147
+
148
+ const transitionProperty = (prop) => {
149
+ return handler.properties(prop) || (prop === "all" ? prop : void 0);
277
150
  };
278
151
  const transitions = [
279
- [/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
280
- const transitionProperty = validateProperty(prop);
281
- if (!transitionProperty)
282
- return;
283
- return {
284
- "transition-property": transitionProperty,
285
- "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
286
- "transition-duration": `${duration}ms`
287
- };
288
- }],
289
- [/^duration-(\d+)$/, ([, duration = "150"]) => {
290
- return {
291
- "transition-duration": `${duration}ms`
292
- };
152
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
153
+ const p = transitionProperty(prop);
154
+ if (p) {
155
+ return {
156
+ "transition-property": p,
157
+ "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
158
+ "transition-duration": `${duration}ms`
159
+ };
160
+ }
293
161
  }],
162
+ [/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
294
163
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
164
+ ["ease-linear", { "transition-timing-function": "linear" }],
295
165
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
296
166
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
297
167
  ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
298
168
  [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
299
169
  [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
300
- [/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
301
- const transitionProperty = validateProperty(v);
302
- if (transitionProperty)
303
- return { "transition-property": transitionProperty };
304
- }]
170
+ [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
171
+ ["transition-property-none", { "transition-property": "none" }],
172
+ ["property-none", { "transition-property": "none" }],
173
+ ["transition-none", { transition: "none" }]
305
174
  ];
306
175
 
307
176
  const flex = [
@@ -347,7 +216,7 @@ const fonts = [
347
216
  }
348
217
  }],
349
218
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
350
- const size = handler.bracket.rem(s);
219
+ const size = handler.bracket.auto.rem(s);
351
220
  if (size)
352
221
  return { "font-size": size };
353
222
  const themed = toArray(theme.fontSize?.[s]);
@@ -360,7 +229,7 @@ const fonts = [
360
229
  }
361
230
  }],
362
231
  [/^text-size-(.+)$/, ([, s]) => {
363
- const raw = handler.bracket.rem(s);
232
+ const raw = handler.bracket.auto.rem(s);
364
233
  if (raw)
365
234
  return { "font-size": raw };
366
235
  }],
@@ -370,17 +239,17 @@ const fonts = [
370
239
  return { "font-weight": v };
371
240
  }],
372
241
  [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
373
- const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
242
+ const v = theme.lineHeight?.[s] || handler.bracket.auto.rem(s);
374
243
  if (v !== null)
375
244
  return { "line-height": v };
376
245
  }],
377
246
  [/^tracking-([^-]+)$/, ([, s], { theme }) => {
378
- const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
247
+ const v = theme.letterSpacing?.[s] || handler.bracket.auto.rem(s);
379
248
  if (v !== null)
380
249
  return { "letter-spacing": v };
381
250
  }],
382
251
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
383
- const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
252
+ const v = theme.wordSpacing?.[s] || handler.bracket.auto.rem(s);
384
253
  if (v !== null)
385
254
  return { "word-spacing": v };
386
255
  }]
@@ -400,7 +269,7 @@ const tabSizes = [
400
269
  ];
401
270
  const textIndents = [
402
271
  [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
403
- const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s);
272
+ const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s);
404
273
  if (v != null)
405
274
  return { "text-indent": v };
406
275
  }]
@@ -412,7 +281,7 @@ const textStrokes = [
412
281
  return { "-webkit-text-stroke-width": v };
413
282
  }],
414
283
  [/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
415
- [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
284
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
416
285
  ];
417
286
  const textShadows = [
418
287
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
@@ -424,7 +293,7 @@ const textShadows = [
424
293
 
425
294
  const gaps = [
426
295
  [/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
427
- const v = handler.bracket.rem(s);
296
+ const v = handler.bracket.auto.rem(s);
428
297
  if (v != null) {
429
298
  return {
430
299
  "grid-gap": v,
@@ -433,7 +302,7 @@ const gaps = [
433
302
  }
434
303
  }],
435
304
  [/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
436
- const v = handler.bracket.rem(s);
305
+ const v = handler.bracket.auto.rem(s);
437
306
  if (v != null) {
438
307
  return {
439
308
  "grid-column-gap": v,
@@ -442,7 +311,7 @@ const gaps = [
442
311
  }
443
312
  }],
444
313
  [/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
445
- const v = handler.bracket.rem(s);
314
+ const v = handler.bracket.auto.rem(s);
446
315
  if (v != null) {
447
316
  return {
448
317
  "grid-row-gap": v,
@@ -452,7 +321,7 @@ const gaps = [
452
321
  }]
453
322
  ];
454
323
 
455
- const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.rem(s))[0];
324
+ const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.auto.rem(s))[0];
456
325
  const autoDirection = (selector, theme) => {
457
326
  if (selector === "min")
458
327
  return "min-content";
@@ -465,10 +334,10 @@ const autoDirection = (selector, theme) => {
465
334
  const grids = [
466
335
  ["grid", { display: "grid" }],
467
336
  ["inline-grid", { display: "inline-grid" }],
468
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
469
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
470
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
471
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
337
+ [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
338
+ [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
339
+ [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
340
+ [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
472
341
  [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
473
342
  const key = d === "row" ? "grid-row" : "grid-column";
474
343
  let raw = handler.bracket(v);
@@ -485,11 +354,11 @@ const grids = [
485
354
  return { [key]: `span ${raw}/span ${raw}` };
486
355
  }
487
356
  }],
488
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
489
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
490
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
491
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
492
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
357
+ [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
358
+ [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
359
+ [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
360
+ [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
361
+ [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
493
362
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
494
363
  [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
495
364
  [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
@@ -526,7 +395,8 @@ const justifies = [
526
395
  ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
527
396
  ];
528
397
  const orders = [
529
- [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || handler.bracket.number(v) })]
398
+ [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999" }[v] || handler.bracket.number(v) })],
399
+ ["order-none", { order: "0" }]
530
400
  ];
531
401
  const alignments = [
532
402
  ["content-start", { "align-content": "flex-start" }],
@@ -544,7 +414,7 @@ const alignments = [
544
414
  ["self-start", { "align-self": "flex-start" }],
545
415
  ["self-end", { "align-self": "flex-end" }],
546
416
  ["self-center", { "align-self": "center" }],
547
- ["self-stretch", { "align-items": "stretch" }]
417
+ ["self-stretch", { "align-self": "stretch" }]
548
418
  ];
549
419
  const placements = [
550
420
  ["place-content-start", { "place-content": "start" }],
@@ -558,7 +428,7 @@ const placements = [
558
428
  ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
559
429
  ];
560
430
  function handleInsetValue(v) {
561
- return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.rem(v);
431
+ return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
562
432
  }
563
433
  const insets = [
564
434
  [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
@@ -569,8 +439,10 @@ const insets = [
569
439
  }]
570
440
  ];
571
441
  const floats = [
572
- [/^float-(left|right|none)$/, ([, value]) => ({ float: value })],
573
- [/^clear-(left|right|both|none)$/, ([, value]) => ({ clear: value })]
442
+ [/^float-(left|right)$/, ([, value]) => ({ float: value })],
443
+ ["float-none", { float: "none" }],
444
+ [/^clear-(left|right|both)$/, ([, value]) => ({ clear: value })],
445
+ ["clear-none", { clear: "none" }]
574
446
  ];
575
447
  const zIndexes = [
576
448
  ["z-auto", { "z-index": "auto" }],
@@ -585,29 +457,99 @@ const boxSizing = [
585
457
  ]
586
458
  ];
587
459
 
460
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
461
+ const displays = [
462
+ ["inline", { display: "inline" }],
463
+ ["block", { display: "block" }],
464
+ ["inline-block", { display: "inline-block" }],
465
+ ["contents", { display: "contents" }],
466
+ ["flow-root", { display: "flow-root" }],
467
+ ["list-item", { display: "list-item" }],
468
+ ["hidden", { display: "none" }]
469
+ ];
470
+ const appearances = [
471
+ ["visible", { visibility: "visible" }],
472
+ ["invisible", { visibility: "hidden" }],
473
+ ["backface-visible", { "backface-visibility": "visible" }],
474
+ ["backface-hidden", { "backface-visibility": "hidden" }]
475
+ ];
476
+ const cursors = [
477
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
478
+ ];
479
+ const pointerEvents = [
480
+ ["pointer-events-auto", { "pointer-events": "auto" }],
481
+ ["pointer-events-none", { "pointer-events": "none" }]
482
+ ];
483
+ const resizes = [
484
+ ["resize-x", { resize: "horizontal" }],
485
+ ["resize-y", { resize: "vertical" }],
486
+ ["resize", { resize: "both" }],
487
+ ["resize-none", { resize: "none" }]
488
+ ];
489
+ const userSelects = [
490
+ [/^select-(text|all|auto)$/, ([, v]) => ({ "user-select": v })],
491
+ ["select-none", { "user-select": "none" }]
492
+ ];
493
+ const whitespaces = [
494
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
495
+ ];
496
+ const contents = [
497
+ ["content-empty", { content: '""' }]
498
+ ];
499
+ const breaks = [
500
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
501
+ ["break-word", { "overflow-wrap": "break-word" }],
502
+ ["break-all", { "word-break": "break-all" }]
503
+ ];
504
+ const textOverflows = [
505
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
506
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
507
+ ["text-clip", { "text-overflow": "clip" }]
508
+ ];
509
+ const textTransforms = [
510
+ ["case-upper", { "text-transform": "uppercase" }],
511
+ ["case-lower", { "text-transform": "lowercase" }],
512
+ ["case-capital", { "text-transform": "capitalize" }],
513
+ ["case-normal", { "text-transform": "none" }]
514
+ ];
515
+ const fontStyles = [
516
+ ["italic", { "font-style": "italic" }],
517
+ ["not-italic", { "font-style": "normal" }]
518
+ ];
519
+ const fontSmoothings = [
520
+ ["antialiased", {
521
+ "-webkit-font-smoothing": "antialiased",
522
+ "-moz-osx-font-smoothing": "grayscale",
523
+ "font-smoothing": "grayscale"
524
+ }],
525
+ ["subpixel-antialiased", {
526
+ "-webkit-font-smoothing": "auto",
527
+ "-moz-osx-font-smoothing": "auto",
528
+ "font-smoothing": "auto"
529
+ }]
530
+ ];
531
+
588
532
  const rings = [
589
533
  [/^ring-?(.*)$/, ([, d]) => {
590
534
  const value = handler.px(d || "1");
591
535
  if (value) {
592
536
  return {
593
- "--un-ring-inset": "var(--un-empty, )",
537
+ "--un-ring-inset": varEmpty,
594
538
  "--un-ring-offset-width": "0px",
595
539
  "--un-ring-offset-color": "#fff",
596
540
  "--un-ring-color": "rgba(59, 130, 246, .5)",
597
541
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
598
542
  "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
599
- "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);",
600
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);"
543
+ "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
544
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
601
545
  };
602
546
  }
603
547
  }],
604
- [/^ring-offset-?(.*)$/, ([, d]) => {
548
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
549
+ [/^ring-offset-(.+)$/, ([, d]) => {
605
550
  const value = handler.px(d || "1");
606
- if (value) {
607
- return {
608
- "--un-ring-offset-width": value
609
- };
610
- }
551
+ if (value)
552
+ return { "--un-ring-offset-width": value };
611
553
  }],
612
554
  ["ring-inset", { "--un-ring-inset": "inset" }],
613
555
  ...ringColors,
@@ -615,7 +557,7 @@ const rings = [
615
557
  ];
616
558
 
617
559
  const colorResolver = (body, theme) => {
618
- const data = parseColorUtil(body, theme);
560
+ const data = parseColor(body, theme);
619
561
  if (!data)
620
562
  return;
621
563
  const { color, rgba } = data;
@@ -633,7 +575,7 @@ const colorResolver = (body, theme) => {
633
575
  };
634
576
  const boxShadows = [
635
577
  [/^shadow-?(.*)$/, ([, d], { theme }) => {
636
- const value = theme?.boxShadow?.[d || "DEFAULT"];
578
+ const value = theme.boxShadow?.[d || "DEFAULT"];
637
579
  if (value) {
638
580
  return {
639
581
  "--un-shadow-color": "0,0,0",
@@ -658,7 +600,7 @@ function getThemeValue(minmax, hw, theme, prop) {
658
600
  }
659
601
  const sizes = [
660
602
  [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
661
- const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.rem(s);
603
+ const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.auto.rem(s);
662
604
  if (v != null)
663
605
  return { [getPropName(m, w)]: v };
664
606
  }],
@@ -677,11 +619,6 @@ const aspectRatio = [
677
619
  }]
678
620
  ];
679
621
 
680
- const directionSize = (prefix) => ([_, direction, size]) => {
681
- const v = handler.bracket.rem.fraction.cssvar(size);
682
- if (v)
683
- return directionMap[direction].map((i) => [prefix + i, v]);
684
- };
685
622
  const paddings = [
686
623
  [/^pa?()-?(-?.+)$/, directionSize("padding")],
687
624
  [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
@@ -693,84 +630,13 @@ const margins = [
693
630
  [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
694
631
  ];
695
632
 
696
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
697
- const displays = [
698
- ["inline", { display: "inline" }],
699
- ["block", { display: "block" }],
700
- ["inline-block", { display: "inline-block" }],
701
- ["contents", { display: "contents" }],
702
- ["flow-root", { display: "flow-root" }],
703
- ["list-item", { display: "list-item" }],
704
- ["hidden", { display: "none" }]
705
- ];
706
- const appearances = [
707
- ["visible", { visibility: "visible" }],
708
- ["invisible", { visibility: "hidden" }],
709
- ["backface-visible", { "backface-visibility": "visible" }],
710
- ["backface-hidden", { "backface-visibility": "hidden" }]
711
- ];
712
- const cursors = [
713
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
714
- ];
715
- const pointerEvents = [
716
- ["pointer-events-none", { "pointer-events": "none" }],
717
- ["pointer-events-auto", { "pointer-events": "auto" }]
718
- ];
719
- const resizes = [
720
- ["resize-none", { resize: "none" }],
721
- ["resize-x", { resize: "horizontal" }],
722
- ["resize-y", { resize: "vertical" }],
723
- ["resize", { resize: "both" }]
724
- ];
725
- const userSelects = [
726
- [/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
727
- ];
728
- const whitespaces = [
729
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
730
- ];
731
- const contents = [
732
- ["content-empty", { content: '""' }]
733
- ];
734
- const breaks = [
735
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
736
- ["break-word", { "overflow-wrap": "break-word" }],
737
- ["break-all", { "word-break": "break-all" }]
738
- ];
739
- const textOverflows = [
740
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
741
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
742
- ["text-clip", { "text-overflow": "clip" }]
743
- ];
744
- const textTransforms = [
745
- ["case-upper", { "text-transform": "uppercase" }],
746
- ["case-lower", { "text-transform": "lowercase" }],
747
- ["case-capital", { "text-transform": "capitalize" }],
748
- ["case-normal", { "text-transform": "none" }]
749
- ];
750
- const fontStyles = [
751
- ["italic", { "font-style": "italic" }],
752
- ["not-italic", { "font-style": "normal" }]
753
- ];
754
- const fontSmoothings = [
755
- ["antialiased", {
756
- "-webkit-font-smoothing": "antialiased",
757
- "-moz-osx-font-smoothing": "grayscale",
758
- "font-smoothing": "grayscale"
759
- }],
760
- ["subpixel-antialiased", {
761
- "-webkit-font-smoothing": "auto",
762
- "-moz-osx-font-smoothing": "auto",
763
- "font-smoothing": "auto"
764
- }]
765
- ];
766
-
767
633
  const transformGpu = {
768
634
  transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
769
- [CONTROL_BYPASS_PSEUDO]: ""
635
+ [CONTROL_BYPASS_PSEUDO_CLASS]: ""
770
636
  };
771
637
  const transformCpu = {
772
638
  transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
773
- [CONTROL_BYPASS_PSEUDO]: ""
639
+ [CONTROL_BYPASS_PSEUDO_CLASS]: ""
774
640
  };
775
641
  const transformBase = {
776
642
  "--un-rotate": 0,
@@ -787,11 +653,12 @@ const transformBase = {
787
653
  const transforms = [
788
654
  ["transform", transformBase],
789
655
  [/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
790
- [/^translate()-([^-]+)$/, handleTranslate],
791
- [/^translate-([xyz])-([^-]+)$/, handleTranslate],
792
- [/^scale()-([^-]+)$/, handleScale],
793
- [/^scale-([xyz])-([^-]+)$/, handleScale],
794
- [/^rotate-([^-]+)(?:deg)?$/, handleRotate],
656
+ [/^translate()-(.+)$/, handleTranslate],
657
+ [/^translate-([xyz])-(.+)$/, handleTranslate],
658
+ [/^scale()-(.+)$/, handleScale],
659
+ [/^scale-([xyz])-(.+)$/, handleScale],
660
+ [/^rotate-(.+)$/, handleRotate],
661
+ [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
795
662
  ["transform-gpu", transformGpu],
796
663
  ["transform-cpu", transformCpu],
797
664
  ["transform-none", { transform: "none" }],
@@ -806,7 +673,7 @@ const transforms = [
806
673
  ["origin-top-left", { "transform-origin": "top left" }]
807
674
  ];
808
675
  function handleTranslate([, d, b]) {
809
- const v = handler.bracket.fraction.rem(b);
676
+ const v = handler.bracket.fraction.auto.rem(b);
810
677
  if (v != null) {
811
678
  return [
812
679
  transformBase,
@@ -827,7 +694,7 @@ function handleScale([, d, b]) {
827
694
  ];
828
695
  }
829
696
  }
830
- function handleRotate([, b]) {
697
+ function handleRotateWithUnit([, b]) {
831
698
  const v = handler.bracket.number(b);
832
699
  if (v != null) {
833
700
  return [
@@ -836,6 +703,15 @@ function handleRotate([, b]) {
836
703
  ];
837
704
  }
838
705
  }
706
+ function handleRotate([, b]) {
707
+ const v = handler.bracket(b);
708
+ if (v != null) {
709
+ return [
710
+ transformBase,
711
+ { "--un-rotate": v }
712
+ ];
713
+ }
714
+ }
839
715
 
840
716
  const variablesAbbrMap = {
841
717
  "visible": "visibility",
@@ -885,7 +761,7 @@ const questionMark = [
885
761
  [
886
762
  /^(where|\?)$/,
887
763
  (_, { constructCSS, generator }) => {
888
- if (generator.config.envMode === "dev")
764
+ if (generator.userConfig.envMode === "dev")
889
765
  return `@keyframes __un_qm{0%{box-shadow:inset 4px 4px #ff1e90, inset -4px -4px #ff1e90}100%{box-shadow:inset 8px 8px #3399ff, inset -8px -8px #3399ff}}
890
766
  ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
891
767
  }
@@ -895,13 +771,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
895
771
  const textDecorations = [
896
772
  ["underline", { "text-decoration": "underline" }],
897
773
  ["line-through", { "text-decoration": "line-through" }],
898
- ["no-underline", { "text-decoration": "none" }],
899
774
  ["decoration-underline", { "text-decoration": "underline" }],
900
775
  ["decoration-line-through", { "text-decoration": "line-through" }],
901
- ["decoration-none", { "text-decoration": "none" }],
902
776
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
903
777
  [/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : handler.bracket.px(s) })],
904
- [/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
778
+ [/^decoration-(.+)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
905
779
  [/^underline-offset-([^-]+)$/, ([, s]) => {
906
780
  const v = s === "auto" ? s : handler.bracket.px(s);
907
781
  if (v != null)
@@ -916,7 +790,23 @@ const textDecorations = [
916
790
  };
917
791
  }
918
792
  }],
919
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })]
793
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
794
+ ["no-underline", { "text-decoration": "none" }],
795
+ ["decoration-none", { "text-decoration": "none" }]
796
+ ];
797
+
798
+ const svgUtilities = [
799
+ [/^fill-(.+)$/, colorResolver$1("fill", "fill")],
800
+ [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
801
+ ["fill-none", { fill: "none" }],
802
+ [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
803
+ const v = handler.bracket.fraction.px.number(s);
804
+ if (v)
805
+ return { "stroke-width": v };
806
+ }],
807
+ [/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
808
+ [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
809
+ ["stroke-none", { stroke: "none" }]
920
810
  ];
921
811
 
922
812
  const rules = [
@@ -926,7 +816,7 @@ const rules = [
926
816
  displays,
927
817
  opacity,
928
818
  bgColors,
929
- fillColors,
819
+ svgUtilities,
930
820
  borders,
931
821
  contents,
932
822
  fonts,
@@ -972,7 +862,8 @@ const rules = [
972
862
  boxSizing,
973
863
  transitions,
974
864
  transforms,
865
+ willChange,
975
866
  questionMark
976
867
  ].flat(1);
977
868
 
978
- export { tabSizes as $, floats as A, zIndexes as B, boxSizing as C, questionMark as D, rings as E, boxShadows as F, sizes as G, aspectRatio as H, paddings as I, margins as J, varEmpty as K, displays as L, appearances as M, cursors as N, pointerEvents as O, resizes as P, userSelects as Q, whitespaces as R, contents as S, breaks as T, textOverflows as U, textTransforms as V, fontStyles as W, fontSmoothings as X, transforms as Y, transitions as Z, fonts as _, appearance as a, textIndents as a0, textStrokes as a1, textShadows as a2, cssVariables as a3, textDecorations as a4, borders as b, parseColorUtil as c, colorResolver$1 as d, opacity as e, textColors as f, bgColors as g, borderColors as h, ringColors as i, ringOffsetColors as j, fillColors as k, flex as l, gaps as m, grids as n, outline as o, placeholder as p, overflows as q, rules as r, positions as s, textAligns as t, justifies as u, verticalAligns as v, orders as w, alignments as x, placements as y, insets as z };
869
+ export { textIndents as $, boxSizing as A, questionMark as B, rings as C, boxShadows as D, sizes as E, aspectRatio as F, paddings as G, margins as H, varEmpty as I, displays as J, appearances as K, cursors as L, pointerEvents as M, resizes as N, userSelects as O, whitespaces as P, contents as Q, breaks as R, textOverflows as S, textTransforms as T, fontStyles as U, fontSmoothings as V, svgUtilities as W, transforms as X, transitions as Y, fonts as Z, tabSizes as _, appearance as a, textStrokes as a0, textShadows as a1, cssVariables as a2, textDecorations as a3, borders as b, opacity as c, textColors as d, bgColors as e, borderColors as f, ringColors as g, ringOffsetColors as h, flex as i, gaps as j, grids as k, overflows as l, positions as m, justifies as n, outline as o, placeholder as p, orders as q, rules as r, alignments as s, textAligns as t, placements as u, verticalAligns as v, willChange as w, insets as x, floats as y, zIndexes as z };