@unocss/preset-mini 0.16.4 → 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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const core = require('@unocss/core');
4
3
  const utilities = require('./utilities.cjs');
4
+ const core = require('@unocss/core');
5
5
  const pseudo = require('./pseudo.cjs');
6
6
 
7
7
  const verticalAlignAlias = {
@@ -19,222 +19,10 @@ const textAligns = [
19
19
  ["text-justify", { "text-align": "justify" }]
20
20
  ];
21
21
 
22
- const parseColorUtil = (body, theme) => {
23
- const [main, opacity2] = body.split(/(?:\/|:)/);
24
- const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
25
- const [name] = colors;
26
- if (!name)
27
- return;
28
- let color;
29
- const bracket = utilities.handler.bracket(main);
30
- const bracketOrMain = bracket || main;
31
- if (bracketOrMain.startsWith("#"))
32
- color = bracketOrMain.slice(1);
33
- if (bracketOrMain.startsWith("hex-"))
34
- color = bracketOrMain.slice(4);
35
- color = color || bracket;
36
- let no = "DEFAULT";
37
- if (!color) {
38
- let colorData = theme.colors?.[name];
39
- if (colorData) {
40
- [, no = no] = colors;
41
- } else {
42
- if (colors.slice(-1)[0].match(/^\d+$/))
43
- no = colors.pop();
44
- colorData = theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
45
- }
46
- if (typeof colorData === "string")
47
- color = colorData;
48
- else if (no && colorData)
49
- color = colorData[no];
50
- }
51
- return {
52
- opacity: opacity2,
53
- name,
54
- no,
55
- color,
56
- rgba: core.hex2rgba(color)
57
- };
58
- };
59
- const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
60
- const data = parseColorUtil(body, theme);
61
- if (!data)
62
- return;
63
- const { opacity: opacity2, color, rgba } = data;
64
- if (!color)
65
- return;
66
- const a = opacity2 ? opacity2[0] === "[" ? utilities.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
67
- if (rgba) {
68
- if (a != null && !Number.isNaN(a)) {
69
- rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
70
- return {
71
- [attribute]: `rgba(${rgba.join(",")})`
72
- };
73
- } else {
74
- return {
75
- [`--un-${varName}-opacity`]: 1,
76
- [attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
77
- };
78
- }
79
- } else {
80
- return {
81
- [attribute]: color.replace("%alpha", `${a || 1}`)
82
- };
83
- }
84
- };
85
- const opacity = [
86
- [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
87
- ];
88
- const textColors = [
89
- [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
90
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
91
- ];
92
- const bgColors = [
93
- [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
94
- [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
95
- ];
96
- const borderColors = [
97
- [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
98
- [/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
99
- ];
100
- const ringColors = [
101
- [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
102
- [/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
103
- ];
104
- const ringOffsetColors = [
105
- [/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
106
- [/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
107
- ];
108
-
109
- const cssBasicProps = [
110
- "color",
111
- "border-color",
112
- "background-color",
113
- "flex-grow",
114
- "flex",
115
- "flex-shrink",
116
- "caret-color",
117
- "font",
118
- "gap",
119
- "opacity",
120
- "visibility",
121
- "z-index",
122
- "font-weight",
123
- "zoom",
124
- "text-shadow",
125
- "transform",
126
- "box-shadow"
127
- ];
128
- const cssPositionProps = [
129
- "backround-position",
130
- "left",
131
- "right",
132
- "top",
133
- "bottom",
134
- "object-position"
135
- ];
136
- const cssSizeProps = [
137
- "max-height",
138
- "min-height",
139
- "max-width",
140
- "min-width",
141
- "height",
142
- "width",
143
- "border-width",
144
- "margin",
145
- "padding",
146
- "outline-width",
147
- "outline-offset",
148
- "font-size",
149
- "line-height",
150
- "text-indent",
151
- "vertical-align",
152
- "border-spacing",
153
- "letter-spacing",
154
- "word-spacing"
155
- ];
156
- const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
157
- const cssProps = [
158
- ...cssBasicProps,
159
- ...cssPositionProps,
160
- ...cssSizeProps,
161
- ...cssEnhanceProps
162
- ];
163
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
164
- const displays = [
165
- ["inline", { display: "inline" }],
166
- ["block", { display: "block" }],
167
- ["inline-block", { display: "inline-block" }],
168
- ["contents", { display: "contents" }],
169
- ["flow-root", { display: "flow-root" }],
170
- ["list-item", { display: "list-item" }],
171
- ["hidden", { display: "none" }]
172
- ];
173
- const appearances = [
174
- ["visible", { visibility: "visible" }],
175
- ["invisible", { visibility: "hidden" }],
176
- ["backface-visible", { "backface-visibility": "visible" }],
177
- ["backface-hidden", { "backface-visibility": "hidden" }]
178
- ];
179
- const cursors = [
180
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
181
- ];
182
- const pointerEvents = [
183
- ["pointer-events-none", { "pointer-events": "none" }],
184
- ["pointer-events-auto", { "pointer-events": "auto" }]
185
- ];
186
- const resizes = [
187
- ["resize-none", { resize: "none" }],
188
- ["resize-x", { resize: "horizontal" }],
189
- ["resize-y", { resize: "vertical" }],
190
- ["resize", { resize: "both" }]
191
- ];
192
- const userSelects = [
193
- [/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
194
- ];
195
- const whitespaces = [
196
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
197
- ];
198
- const contents = [
199
- ["content-empty", { content: '""' }]
200
- ];
201
- const breaks = [
202
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
203
- ["break-word", { "overflow-wrap": "break-word" }],
204
- ["break-all", { "word-break": "break-all" }]
205
- ];
206
- const textOverflows = [
207
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
208
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
209
- ["text-clip", { "text-overflow": "clip" }]
210
- ];
211
- const textTransforms = [
212
- ["case-upper", { "text-transform": "uppercase" }],
213
- ["case-lower", { "text-transform": "lowercase" }],
214
- ["case-capital", { "text-transform": "capitalize" }],
215
- ["case-normal", { "text-transform": "none" }]
216
- ];
217
- const fontStyles = [
218
- ["italic", { "font-style": "italic" }],
219
- ["not-italic", { "font-style": "normal" }]
220
- ];
221
- const fontSmoothings = [
222
- ["antialiased", {
223
- "-webkit-font-smoothing": "antialiased",
224
- "-moz-osx-font-smoothing": "grayscale",
225
- "font-smoothing": "grayscale"
226
- }],
227
- ["subpixel-antialiased", {
228
- "-webkit-font-smoothing": "auto",
229
- "-moz-osx-font-smoothing": "auto",
230
- "font-smoothing": "auto"
231
- }]
232
- ];
233
-
234
- const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
22
+ const outlineStyle = ["auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
235
23
  const parseOutlineSize = (s) => {
236
24
  const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
237
- const size = utilities.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
25
+ const size = utilities.handler.bracket.fraction.auto.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
238
26
  if (size) {
239
27
  return {
240
28
  [`outline-${propName}`]: size
@@ -242,24 +30,17 @@ const parseOutlineSize = (s) => {
242
30
  }
243
31
  };
244
32
  const outline = [
245
- ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
246
33
  ["outline", { "outline-style": "solid" }],
247
34
  [
248
35
  /^outline-(.+)$/,
249
36
  (match, config) => {
250
37
  const [, d] = match;
251
- if (d === "none") {
252
- return {
253
- "outline": "2px solid transparent",
254
- "outline-offset": "2px"
255
- };
256
- }
257
38
  if (outlineStyle.includes(d)) {
258
39
  return {
259
40
  "outline-style": d
260
41
  };
261
42
  }
262
- const colorSheet = colorResolver$1("outline-color", "outline-color")([
43
+ const colorSheet = utilities.colorResolver("outline-color", "outline-color")([
263
44
  match[0],
264
45
  match[1].replace(/^color-/, "")
265
46
  ], config);
@@ -269,7 +50,8 @@ const outline = [
269
50
  if (sizeSheet)
270
51
  return sizeSheet;
271
52
  }
272
- ]
53
+ ],
54
+ ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
273
55
  ];
274
56
  const appearance = [
275
57
  ["appearance-none", {
@@ -288,22 +70,12 @@ const placeholder = [
288
70
  /^placeholder-(?!opacity)(.+)$/,
289
71
  (match, config) => {
290
72
  match[1] = match[1].replace(/^color-/, "");
291
- return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
73
+ return utilities.colorResolver("placeholder-color", "placeholder-color")(match, config);
292
74
  }
293
75
  ]
294
76
  ];
295
- const cssPropsStr = cssProps.join(", ");
296
- const validateProperty$1 = (prop) => {
297
- if (prop && !cssProps.includes(prop))
298
- return;
299
- return prop || cssPropsStr;
300
- };
301
77
  const willChange = [
302
- [/^will-change-(.*)/, ([, p]) => {
303
- const w = validateProperty$1(p) || utilities.handler.global(p);
304
- if (w)
305
- return { "will-change": w };
306
- }]
78
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
307
79
  ];
308
80
 
309
81
  const borders = [
@@ -321,8 +93,8 @@ const borders = [
321
93
  ["border-double", { "border-style": "double" }],
322
94
  ["border-none", { "border-style": "none" }],
323
95
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
324
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
325
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
96
+ [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
97
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded]
326
98
  ];
327
99
  function handlerBorder(m) {
328
100
  const borderSizes = handlerBorderSize(m);
@@ -336,64 +108,71 @@ function handlerBorder(m) {
336
108
  function handlerBorderSize([, a, b]) {
337
109
  const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
338
110
  const v = utilities.handler.bracket.px(s);
339
- if (v != null) {
340
- return [
341
- ...utilities.directionMap[d].map((i) => [`border${i}-width`, v])
342
- ];
343
- }
111
+ if (v !== void 0)
112
+ return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
344
113
  }
345
114
  function handlerBorderColor([, a, c], ctx) {
346
- if (c !== void 0) {
347
- const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
348
- if (ofColor) {
349
- const borders2 = utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
350
- const borderObject = {};
351
- Object.assign(borderObject, ...borders2);
352
- return borderObject;
353
- }
115
+ if (c !== void 0 && utilities.colorResolver("border-color", "border")(["", c], ctx)) {
116
+ return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => utilities.colorResolver(`border${i}-color`, "border")(["", c], ctx)));
354
117
  }
355
118
  }
356
119
  function handlerRounded([, a, b], { theme }) {
357
120
  const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
358
- const v = theme.borderRadius?.[s] || utilities.handler.bracket.fraction.rem(s);
359
- if (v != null)
121
+ const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
122
+ if (v !== void 0)
360
123
  return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
361
124
  }
362
125
 
363
- const transitionSwitchProps = ["all", "none"];
364
- const transitionPropsStr = cssProps.join(", ");
365
- const validateProperty = (prop) => {
366
- if (prop && ![...cssProps, ...transitionSwitchProps].includes(prop))
367
- return;
368
- return prop || transitionPropsStr;
126
+ const opacity = [
127
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
128
+ ];
129
+ const textColors = [
130
+ [/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text")],
131
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
132
+ ];
133
+ const bgColors = [
134
+ [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
135
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
136
+ ];
137
+ const borderColors = [
138
+ [/^(?:border|b)-(.+)$/, utilities.colorResolver("border-color", "border")],
139
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
140
+ ];
141
+ const ringColors = [
142
+ [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
143
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
144
+ ];
145
+ const ringOffsetColors = [
146
+ [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
147
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
148
+ ];
149
+
150
+ const transitionProperty = (prop) => {
151
+ return utilities.handler.properties(prop) || (prop === "all" ? prop : void 0);
369
152
  };
370
153
  const transitions = [
371
- [/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
372
- const transitionProperty = validateProperty(prop);
373
- if (!transitionProperty)
374
- return;
375
- return {
376
- "transition-property": transitionProperty,
377
- "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
378
- "transition-duration": `${duration}ms`
379
- };
380
- }],
381
- [/^duration-(\d+)$/, ([, duration = "150"]) => {
382
- return {
383
- "transition-duration": `${duration}ms`
384
- };
154
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
155
+ const p = transitionProperty(prop);
156
+ if (p) {
157
+ return {
158
+ "transition-property": p,
159
+ "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
160
+ "transition-duration": `${duration}ms`
161
+ };
162
+ }
385
163
  }],
164
+ [/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
386
165
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
166
+ ["ease-linear", { "transition-timing-function": "linear" }],
387
167
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
388
168
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
389
169
  ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
390
170
  [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
391
171
  [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
392
- [/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
393
- const transitionProperty = validateProperty(v);
394
- if (transitionProperty)
395
- return { "transition-property": transitionProperty };
396
- }]
172
+ [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
173
+ ["transition-property-none", { "transition-property": "none" }],
174
+ ["property-none", { "transition-property": "none" }],
175
+ ["transition-none", { transition: "none" }]
397
176
  ];
398
177
 
399
178
  const flex = [
@@ -439,7 +218,7 @@ const fonts = [
439
218
  }
440
219
  }],
441
220
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
442
- const size = utilities.handler.bracket.rem(s);
221
+ const size = utilities.handler.bracket.auto.rem(s);
443
222
  if (size)
444
223
  return { "font-size": size };
445
224
  const themed = core.toArray(theme.fontSize?.[s]);
@@ -452,7 +231,7 @@ const fonts = [
452
231
  }
453
232
  }],
454
233
  [/^text-size-(.+)$/, ([, s]) => {
455
- const raw = utilities.handler.bracket.rem(s);
234
+ const raw = utilities.handler.bracket.auto.rem(s);
456
235
  if (raw)
457
236
  return { "font-size": raw };
458
237
  }],
@@ -462,17 +241,17 @@ const fonts = [
462
241
  return { "font-weight": v };
463
242
  }],
464
243
  [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
465
- const v = theme.lineHeight?.[s] || utilities.handler.bracket.rem(s);
244
+ const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
466
245
  if (v !== null)
467
246
  return { "line-height": v };
468
247
  }],
469
248
  [/^tracking-([^-]+)$/, ([, s], { theme }) => {
470
- const v = theme.letterSpacing?.[s] || utilities.handler.bracket.rem(s);
249
+ const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
471
250
  if (v !== null)
472
251
  return { "letter-spacing": v };
473
252
  }],
474
253
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
475
- const v = theme.wordSpacing?.[s] || utilities.handler.bracket.rem(s);
254
+ const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
476
255
  if (v !== null)
477
256
  return { "word-spacing": v };
478
257
  }]
@@ -492,7 +271,7 @@ const tabSizes = [
492
271
  ];
493
272
  const textIndents = [
494
273
  [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
495
- const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s);
274
+ const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
496
275
  if (v != null)
497
276
  return { "text-indent": v };
498
277
  }]
@@ -503,8 +282,8 @@ const textStrokes = [
503
282
  if (v != null)
504
283
  return { "-webkit-text-stroke-width": v };
505
284
  }],
506
- [/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
507
- [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
285
+ [/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
286
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
508
287
  ];
509
288
  const textShadows = [
510
289
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
@@ -516,7 +295,7 @@ const textShadows = [
516
295
 
517
296
  const gaps = [
518
297
  [/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
519
- const v = utilities.handler.bracket.rem(s);
298
+ const v = utilities.handler.bracket.auto.rem(s);
520
299
  if (v != null) {
521
300
  return {
522
301
  "grid-gap": v,
@@ -525,7 +304,7 @@ const gaps = [
525
304
  }
526
305
  }],
527
306
  [/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
528
- const v = utilities.handler.bracket.rem(s);
307
+ const v = utilities.handler.bracket.auto.rem(s);
529
308
  if (v != null) {
530
309
  return {
531
310
  "grid-column-gap": v,
@@ -534,7 +313,7 @@ const gaps = [
534
313
  }
535
314
  }],
536
315
  [/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
537
- const v = utilities.handler.bracket.rem(s);
316
+ const v = utilities.handler.bracket.auto.rem(s);
538
317
  if (v != null) {
539
318
  return {
540
319
  "grid-row-gap": v,
@@ -544,7 +323,7 @@ const gaps = [
544
323
  }]
545
324
  ];
546
325
 
547
- const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.rem(s))[0];
326
+ const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
548
327
  const autoDirection = (selector, theme) => {
549
328
  if (selector === "min")
550
329
  return "min-content";
@@ -557,10 +336,10 @@ const autoDirection = (selector, theme) => {
557
336
  const grids = [
558
337
  ["grid", { display: "grid" }],
559
338
  ["inline-grid", { display: "inline-grid" }],
560
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
561
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
562
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
563
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
339
+ [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
340
+ [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
341
+ [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
342
+ [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
564
343
  [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
565
344
  const key = d === "row" ? "grid-row" : "grid-column";
566
345
  let raw = utilities.handler.bracket(v);
@@ -577,11 +356,11 @@ const grids = [
577
356
  return { [key]: `span ${raw}/span ${raw}` };
578
357
  }
579
358
  }],
580
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
581
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
582
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
583
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
584
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
359
+ [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
360
+ [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
361
+ [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
362
+ [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
363
+ [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
585
364
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
586
365
  [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
587
366
  [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
@@ -618,7 +397,8 @@ const justifies = [
618
397
  ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
619
398
  ];
620
399
  const orders = [
621
- [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || utilities.handler.bracket.number(v) })]
400
+ [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999" }[v] || utilities.handler.bracket.number(v) })],
401
+ ["order-none", { order: "0" }]
622
402
  ];
623
403
  const alignments = [
624
404
  ["content-start", { "align-content": "flex-start" }],
@@ -636,7 +416,7 @@ const alignments = [
636
416
  ["self-start", { "align-self": "flex-start" }],
637
417
  ["self-end", { "align-self": "flex-end" }],
638
418
  ["self-center", { "align-self": "center" }],
639
- ["self-stretch", { "align-items": "stretch" }]
419
+ ["self-stretch", { "align-self": "stretch" }]
640
420
  ];
641
421
  const placements = [
642
422
  ["place-content-start", { "place-content": "start" }],
@@ -650,7 +430,7 @@ const placements = [
650
430
  ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
651
431
  ];
652
432
  function handleInsetValue(v) {
653
- return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.rem(v);
433
+ return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
654
434
  }
655
435
  const insets = [
656
436
  [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
@@ -661,8 +441,10 @@ const insets = [
661
441
  }]
662
442
  ];
663
443
  const floats = [
664
- [/^float-(left|right|none)$/, ([, value]) => ({ float: value })],
665
- [/^clear-(left|right|both|none)$/, ([, value]) => ({ clear: value })]
444
+ [/^float-(left|right)$/, ([, value]) => ({ float: value })],
445
+ ["float-none", { float: "none" }],
446
+ [/^clear-(left|right|both)$/, ([, value]) => ({ clear: value })],
447
+ ["clear-none", { clear: "none" }]
666
448
  ];
667
449
  const zIndexes = [
668
450
  ["z-auto", { "z-index": "auto" }],
@@ -677,12 +459,84 @@ const boxSizing = [
677
459
  ]
678
460
  ];
679
461
 
462
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
463
+ const displays = [
464
+ ["inline", { display: "inline" }],
465
+ ["block", { display: "block" }],
466
+ ["inline-block", { display: "inline-block" }],
467
+ ["contents", { display: "contents" }],
468
+ ["flow-root", { display: "flow-root" }],
469
+ ["list-item", { display: "list-item" }],
470
+ ["hidden", { display: "none" }]
471
+ ];
472
+ const appearances = [
473
+ ["visible", { visibility: "visible" }],
474
+ ["invisible", { visibility: "hidden" }],
475
+ ["backface-visible", { "backface-visibility": "visible" }],
476
+ ["backface-hidden", { "backface-visibility": "hidden" }]
477
+ ];
478
+ const cursors = [
479
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
480
+ ];
481
+ const pointerEvents = [
482
+ ["pointer-events-auto", { "pointer-events": "auto" }],
483
+ ["pointer-events-none", { "pointer-events": "none" }]
484
+ ];
485
+ const resizes = [
486
+ ["resize-x", { resize: "horizontal" }],
487
+ ["resize-y", { resize: "vertical" }],
488
+ ["resize", { resize: "both" }],
489
+ ["resize-none", { resize: "none" }]
490
+ ];
491
+ const userSelects = [
492
+ [/^select-(text|all|auto)$/, ([, v]) => ({ "user-select": v })],
493
+ ["select-none", { "user-select": "none" }]
494
+ ];
495
+ const whitespaces = [
496
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
497
+ ];
498
+ const contents = [
499
+ ["content-empty", { content: '""' }]
500
+ ];
501
+ const breaks = [
502
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
503
+ ["break-word", { "overflow-wrap": "break-word" }],
504
+ ["break-all", { "word-break": "break-all" }]
505
+ ];
506
+ const textOverflows = [
507
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
508
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
509
+ ["text-clip", { "text-overflow": "clip" }]
510
+ ];
511
+ const textTransforms = [
512
+ ["case-upper", { "text-transform": "uppercase" }],
513
+ ["case-lower", { "text-transform": "lowercase" }],
514
+ ["case-capital", { "text-transform": "capitalize" }],
515
+ ["case-normal", { "text-transform": "none" }]
516
+ ];
517
+ const fontStyles = [
518
+ ["italic", { "font-style": "italic" }],
519
+ ["not-italic", { "font-style": "normal" }]
520
+ ];
521
+ const fontSmoothings = [
522
+ ["antialiased", {
523
+ "-webkit-font-smoothing": "antialiased",
524
+ "-moz-osx-font-smoothing": "grayscale",
525
+ "font-smoothing": "grayscale"
526
+ }],
527
+ ["subpixel-antialiased", {
528
+ "-webkit-font-smoothing": "auto",
529
+ "-moz-osx-font-smoothing": "auto",
530
+ "font-smoothing": "auto"
531
+ }]
532
+ ];
533
+
680
534
  const rings = [
681
535
  [/^ring-?(.*)$/, ([, d]) => {
682
536
  const value = utilities.handler.px(d || "1");
683
537
  if (value) {
684
538
  return {
685
- "--un-ring-inset": "var(--un-empty, )",
539
+ "--un-ring-inset": varEmpty,
686
540
  "--un-ring-offset-width": "0px",
687
541
  "--un-ring-offset-color": "#fff",
688
542
  "--un-ring-color": "rgba(59, 130, 246, .5)",
@@ -693,13 +547,11 @@ const rings = [
693
547
  };
694
548
  }
695
549
  }],
696
- [/^ring-offset-?(.*)$/, ([, d]) => {
550
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
551
+ [/^ring-offset-(.+)$/, ([, d]) => {
697
552
  const value = utilities.handler.px(d || "1");
698
- if (value) {
699
- return {
700
- "--un-ring-offset-width": value
701
- };
702
- }
553
+ if (value)
554
+ return { "--un-ring-offset-width": value };
703
555
  }],
704
556
  ["ring-inset", { "--un-ring-inset": "inset" }],
705
557
  ...ringColors,
@@ -707,7 +559,7 @@ const rings = [
707
559
  ];
708
560
 
709
561
  const colorResolver = (body, theme) => {
710
- const data = parseColorUtil(body, theme);
562
+ const data = utilities.parseColor(body, theme);
711
563
  if (!data)
712
564
  return;
713
565
  const { color, rgba } = data;
@@ -725,7 +577,7 @@ const colorResolver = (body, theme) => {
725
577
  };
726
578
  const boxShadows = [
727
579
  [/^shadow-?(.*)$/, ([, d], { theme }) => {
728
- const value = theme?.boxShadow?.[d || "DEFAULT"];
580
+ const value = theme.boxShadow?.[d || "DEFAULT"];
729
581
  if (value) {
730
582
  return {
731
583
  "--un-shadow-color": "0,0,0",
@@ -750,7 +602,7 @@ function getThemeValue(minmax, hw, theme, prop) {
750
602
  }
751
603
  const sizes = [
752
604
  [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
753
- const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.rem(s);
605
+ const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
754
606
  if (v != null)
755
607
  return { [getPropName(m, w)]: v };
756
608
  }],
@@ -823,7 +675,7 @@ const transforms = [
823
675
  ["origin-top-left", { "transform-origin": "top left" }]
824
676
  ];
825
677
  function handleTranslate([, d, b]) {
826
- const v = utilities.handler.bracket.fraction.rem(b);
678
+ const v = utilities.handler.bracket.fraction.auto.rem(b);
827
679
  if (v != null) {
828
680
  return [
829
681
  transformBase,
@@ -921,20 +773,18 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
921
773
  const textDecorations = [
922
774
  ["underline", { "text-decoration": "underline" }],
923
775
  ["line-through", { "text-decoration": "line-through" }],
924
- ["no-underline", { "text-decoration": "none" }],
925
776
  ["decoration-underline", { "text-decoration": "underline" }],
926
777
  ["decoration-line-through", { "text-decoration": "line-through" }],
927
- ["decoration-none", { "text-decoration": "none" }],
928
778
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
929
779
  [/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : utilities.handler.bracket.px(s) })],
930
- [/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(d) })],
780
+ [/^decoration-(.+)$/, ([, d]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(d) })],
931
781
  [/^underline-offset-([^-]+)$/, ([, s]) => {
932
782
  const v = s === "auto" ? s : utilities.handler.bracket.px(s);
933
783
  if (v != null)
934
784
  return { "text-underline-offset": v };
935
785
  }],
936
786
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
937
- const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
787
+ const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
938
788
  if (result) {
939
789
  return {
940
790
  "-webkit-text-decoration-color": result["text-decoration-color"],
@@ -942,20 +792,22 @@ const textDecorations = [
942
792
  };
943
793
  }
944
794
  }],
945
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })]
795
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
796
+ ["no-underline", { "text-decoration": "none" }],
797
+ ["decoration-none", { "text-decoration": "none" }]
946
798
  ];
947
799
 
948
800
  const svgUtilities = [
949
- [/^fill-(.+)$/, colorResolver$1("fill", "fill")],
950
- [/^fill-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
801
+ [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
802
+ [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
951
803
  ["fill-none", { fill: "none" }],
952
804
  [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
953
805
  const v = utilities.handler.bracket.fraction.px.number(s);
954
806
  if (v)
955
807
  return { "stroke-width": v };
956
808
  }],
957
- [/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
958
- [/^stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
809
+ [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
810
+ [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
959
811
  ["stroke-none", { stroke: "none" }]
960
812
  ];
961
813
 
@@ -1026,9 +878,7 @@ exports.borders = borders;
1026
878
  exports.boxShadows = boxShadows;
1027
879
  exports.boxSizing = boxSizing;
1028
880
  exports.breaks = breaks;
1029
- exports.colorResolver = colorResolver$1;
1030
881
  exports.contents = contents;
1031
- exports.cssProps = cssProps;
1032
882
  exports.cssVariables = cssVariables;
1033
883
  exports.cursors = cursors;
1034
884
  exports.displays = displays;
@@ -1047,7 +897,6 @@ exports.orders = orders;
1047
897
  exports.outline = outline;
1048
898
  exports.overflows = overflows;
1049
899
  exports.paddings = paddings;
1050
- exports.parseColorUtil = parseColorUtil;
1051
900
  exports.placeholder = placeholder;
1052
901
  exports.placements = placements;
1053
902
  exports.pointerEvents = pointerEvents;