@unocss/preset-mini 0.16.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const utilities = require('./utilities.cjs');
3
4
  const core = require('@unocss/core');
4
- const index = require('./index.cjs');
5
5
  const pseudo = require('./pseudo.cjs');
6
6
 
7
7
  const verticalAlignAlias = {
@@ -19,128 +19,13 @@ 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 [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
25
- if (!name)
26
- return;
27
- let color;
28
- const bracket = index.handler.bracket(main);
29
- const bracketOrMain = bracket || main;
30
- if (bracketOrMain.startsWith("#"))
31
- color = bracketOrMain.slice(1);
32
- if (bracketOrMain.startsWith("hex-"))
33
- color = bracketOrMain.slice(4);
34
- color = color || bracket;
35
- if (!color) {
36
- const colorData = theme.colors?.[name];
37
- if (typeof colorData === "string")
38
- color = colorData;
39
- else if (no && colorData)
40
- color = colorData[no];
41
- }
42
- return {
43
- opacity: opacity2,
44
- name,
45
- no,
46
- color,
47
- rgba: core.hex2rgba(color)
48
- };
49
- };
50
- const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
51
- const data = parseColorUtil(body, theme);
52
- if (!data)
53
- return;
54
- const { opacity: opacity2, color, rgba } = data;
55
- if (!color)
56
- return;
57
- const a = opacity2 ? opacity2[0] === "[" ? index.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
58
- if (rgba) {
59
- if (a != null && !Number.isNaN(a)) {
60
- rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
61
- return {
62
- [attribute]: `rgba(${rgba.join(",")})`
63
- };
64
- } else {
65
- return {
66
- [`--un-${varName}-opacity`]: 1,
67
- [attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
68
- };
69
- }
70
- } else {
71
- return {
72
- [attribute]: color.replace("%alpha", `${a || 1}`)
73
- };
74
- }
75
- };
76
- const opacity = [
77
- [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: index.handler.bracket.percent.cssvar(d) })]
78
- ];
79
- const textColors = [
80
- [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
81
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": index.handler.bracket.percent.cssvar(opacity2) })]
82
- ];
83
- const bgColors = [
84
- [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
85
- [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": index.handler.bracket.percent(opacity2) })]
86
- ];
87
- const borderColors = [
88
- [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
89
- [/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity2) })]
90
- ];
91
- const ringColors = [
92
- [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
93
- [/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": index.handler.bracket.percent(opacity2) })]
94
- ];
95
- const ringOffsetColors = [
96
- [/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
97
- [/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": index.handler.bracket.percent(opacity2) })]
98
- ];
99
- const fillColors = [
100
- ["fill-none", { fill: "none" }],
101
- [/^fill-(.+)$/, colorResolver$1("fill", "fill")],
102
- [/^fill-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-fill-opacity": index.handler.bracket.percent(opacity2) })]
103
- ];
104
-
105
- const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
106
- const parseOutlineSize = (s) => {
107
- const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
108
- const size = index.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-)/, ""));
109
- if (size) {
110
- return {
111
- [`outline-${propName}`]: size
112
- };
113
- }
114
- };
115
22
  const outline = [
116
- ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
23
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.fraction.auto.rem(d) })],
24
+ [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
25
+ [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
117
26
  ["outline", { "outline-style": "solid" }],
118
- [
119
- /^outline-(.+)$/,
120
- (match, config) => {
121
- const [, d] = match;
122
- if (d === "none") {
123
- return {
124
- "outline": "2px solid transparent",
125
- "outline-offset": "2px"
126
- };
127
- }
128
- if (outlineStyle.includes(d)) {
129
- return {
130
- "outline-style": d
131
- };
132
- }
133
- const sizeSheet = parseOutlineSize(d);
134
- if (sizeSheet)
135
- return sizeSheet;
136
- const colorSheet = colorResolver$1("outline-color", "outline-color")([
137
- match[0],
138
- match[1].replace(/^color-/, "")
139
- ], config);
140
- if (colorSheet)
141
- return colorSheet;
142
- }
143
- ]
27
+ [/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
28
+ ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
144
29
  ];
145
30
  const appearance = [
146
31
  ["appearance-none", {
@@ -148,20 +33,8 @@ const appearance = [
148
33
  "-webkit-appearance": "none"
149
34
  }]
150
35
  ];
151
- const placeholder = [
152
- [
153
- /^placeholder-opacity-(\d+)$/,
154
- ([, d]) => ({
155
- "placeholder-opacity": index.handler.bracket.percent(d)
156
- })
157
- ],
158
- [
159
- /^placeholder-(?!opacity)(.+)$/,
160
- (match, config) => {
161
- match[1] = match[1].replace(/^color-/, "");
162
- return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
163
- }
164
- ]
36
+ const willChange = [
37
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
165
38
  ];
166
39
 
167
40
  const borders = [
@@ -172,16 +45,59 @@ const borders = [
172
45
  [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
173
46
  [/^(?:border|b)()-(.+)$/, handlerBorderColor],
174
47
  [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
175
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity) })],
48
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
49
+ [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
50
+ const v = utilities.handler.bracket.percent(opacity);
51
+ const d = utilities.directionMap[a];
52
+ if (v !== void 0 && d)
53
+ return d.map((i) => [`--un-border${i}-opacity`, v]);
54
+ }],
55
+ [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
56
+ [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
57
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
176
58
  ["border-solid", { "border-style": "solid" }],
177
59
  ["border-dashed", { "border-style": "dashed" }],
178
60
  ["border-dotted", { "border-style": "dotted" }],
179
61
  ["border-double", { "border-style": "double" }],
180
- ["border-none", { "border-style": "none" }],
181
- [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
182
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
183
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
62
+ ["border-none", { "border-style": "none" }]
184
63
  ];
64
+ const borderHasColor = (color, { theme }) => {
65
+ return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
66
+ };
67
+ const borderColorResolver = (direction) => ([, body], { theme }) => {
68
+ const data = utilities.parseColor(body, theme);
69
+ if (!data)
70
+ return;
71
+ const { opacity, color, rgba } = data;
72
+ if (!color)
73
+ return;
74
+ const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
75
+ if (rgba) {
76
+ if (a != null && !Number.isNaN(a)) {
77
+ rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
78
+ return {
79
+ [`border${direction}-color`]: `rgba(${rgba.join(",")})`
80
+ };
81
+ } else {
82
+ if (direction === "") {
83
+ return {
84
+ "--un-border-opacity": 1,
85
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
86
+ };
87
+ } else {
88
+ return {
89
+ "--un-border-opacity": 1,
90
+ [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
91
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
92
+ };
93
+ }
94
+ }
95
+ } else {
96
+ return {
97
+ [`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
98
+ };
99
+ }
100
+ };
185
101
  function handlerBorder(m) {
186
102
  const borderSizes = handlerBorderSize(m);
187
103
  if (borderSizes) {
@@ -192,120 +108,61 @@ function handlerBorder(m) {
192
108
  }
193
109
  }
194
110
  function handlerBorderSize([, a, b]) {
195
- const [d, s = "1"] = index.directionMap[a] ? [a, b] : ["", a];
196
- const v = index.handler.bracket.px(s);
197
- if (v != null) {
198
- return [
199
- ...index.directionMap[d].map((i) => [`border${i}-width`, v])
200
- ];
201
- }
111
+ const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
112
+ const v = utilities.handler.bracket.px(s);
113
+ if (v !== void 0)
114
+ return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
202
115
  }
203
116
  function handlerBorderColor([, a, c], ctx) {
204
- if (c !== void 0) {
205
- const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
206
- if (ofColor) {
207
- const borders2 = index.directionMap[index.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
208
- const borderObject = {};
209
- Object.assign(borderObject, ...borders2);
210
- return borderObject;
211
- }
117
+ if (borderHasColor(c, ctx)) {
118
+ return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
212
119
  }
213
120
  }
214
121
  function handlerRounded([, a, b], { theme }) {
215
- const [d, s = "DEFAULT"] = index.cornerMap[a] ? [a, b] : ["", a];
216
- const v = theme.borderRadius?.[s] || index.handler.bracket.fraction.rem(s);
217
- if (v != null)
218
- return index.cornerMap[d].map((i) => [`border${i}-radius`, v]);
122
+ const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
123
+ const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
124
+ if (v !== void 0)
125
+ return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
219
126
  }
220
127
 
221
- const transitionBasicProps = [
222
- "color",
223
- "border-color",
224
- "background-color",
225
- "flex-grow",
226
- "flex",
227
- "flex-shrink",
228
- "caret-color",
229
- "font",
230
- "gap",
231
- "opacity",
232
- "visibility",
233
- "z-index",
234
- "font-weight",
235
- "zoom",
236
- "text-shadow",
237
- "transform",
238
- "box-shadow"
239
- ];
240
- const transitionPositionProps = [
241
- "backround-position",
242
- "left",
243
- "right",
244
- "top",
245
- "bottom",
246
- "object-position"
128
+ const opacity = [
129
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
247
130
  ];
248
- const transitionSizeProps = [
249
- "max-height",
250
- "min-height",
251
- "max-width",
252
- "min-width",
253
- "height",
254
- "width",
255
- "border-width",
256
- "margin",
257
- "padding",
258
- "outline-width",
259
- "outline-offset",
260
- "font-size",
261
- "line-height",
262
- "text-indent",
263
- "vertical-align",
264
- "border-spacing",
265
- "letter-spacing",
266
- "word-spacing"
131
+ const textColors = [
132
+ [/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text")],
133
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
267
134
  ];
268
- const transitionSwitchProps = ["all", "none"];
269
- const transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
270
- const transitionProps = [
271
- ...transitionBasicProps,
272
- ...transitionPositionProps,
273
- ...transitionSizeProps,
274
- ...transitionEnhanceProps
135
+ const bgColors = [
136
+ [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
137
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
275
138
  ];
276
- const transitionPropsStr = transitionProps.join(", ");
277
- const validateProperty = (prop) => {
278
- if (prop && ![...transitionProps, ...transitionSwitchProps].includes(prop))
279
- return;
280
- return prop || transitionPropsStr;
139
+
140
+ const transitionProperty = (prop) => {
141
+ return utilities.handler.properties(prop) || (prop === "all" ? prop : void 0);
281
142
  };
282
143
  const transitions = [
283
- [/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
284
- const transitionProperty = validateProperty(prop);
285
- if (!transitionProperty)
286
- return;
287
- return {
288
- "transition-property": transitionProperty,
289
- "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
290
- "transition-duration": `${duration}ms`
291
- };
292
- }],
293
- [/^duration-(\d+)$/, ([, duration = "150"]) => {
294
- return {
295
- "transition-duration": `${duration}ms`
296
- };
144
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
145
+ const p = transitionProperty(prop);
146
+ if (p) {
147
+ return {
148
+ "transition-property": p,
149
+ "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
150
+ "transition-duration": `${duration}ms`
151
+ };
152
+ }
297
153
  }],
154
+ [/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
298
155
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
156
+ ["ease-linear", { "transition-timing-function": "linear" }],
299
157
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
300
158
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
301
159
  ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
302
160
  [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
303
161
  [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
304
- [/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
305
- const transitionProperty = validateProperty(v);
306
- if (transitionProperty)
307
- return { "transition-property": transitionProperty };
308
- }]
162
+ [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
163
+ ["transition-property-none", { "transition-property": "none" }],
164
+ ["property-none", { "transition-property": "none" }],
165
+ ["transition-none", { transition: "none" }]
309
166
  ];
310
167
 
311
168
  const flex = [
@@ -351,7 +208,7 @@ const fonts = [
351
208
  }
352
209
  }],
353
210
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
354
- const size = index.handler.bracket.rem(s);
211
+ const size = utilities.handler.bracket.auto.rem(s);
355
212
  if (size)
356
213
  return { "font-size": size };
357
214
  const themed = core.toArray(theme.fontSize?.[s]);
@@ -364,27 +221,27 @@ const fonts = [
364
221
  }
365
222
  }],
366
223
  [/^text-size-(.+)$/, ([, s]) => {
367
- const raw = index.handler.bracket.rem(s);
224
+ const raw = utilities.handler.bracket.auto.rem(s);
368
225
  if (raw)
369
226
  return { "font-size": raw };
370
227
  }],
371
228
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
372
- const v = weightMap[s] || index.handler.number(s);
229
+ const v = weightMap[s] || utilities.handler.number(s);
373
230
  if (v)
374
231
  return { "font-weight": v };
375
232
  }],
376
233
  [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
377
- const v = theme.lineHeight?.[s] || index.handler.bracket.rem(s);
234
+ const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
378
235
  if (v !== null)
379
236
  return { "line-height": v };
380
237
  }],
381
238
  [/^tracking-([^-]+)$/, ([, s], { theme }) => {
382
- const v = theme.letterSpacing?.[s] || index.handler.bracket.rem(s);
239
+ const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
383
240
  if (v !== null)
384
241
  return { "letter-spacing": v };
385
242
  }],
386
243
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
387
- const v = theme.wordSpacing?.[s] || index.handler.bracket.rem(s);
244
+ const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
388
245
  if (v !== null)
389
246
  return { "word-spacing": v };
390
247
  }]
@@ -392,7 +249,7 @@ const fonts = [
392
249
  const tabSizes = [
393
250
  [/^tab-?([^-]*)$/, ([, s]) => {
394
251
  s = s || "4";
395
- const v = index.handler.bracket.global.number(s);
252
+ const v = utilities.handler.bracket.global.number(s);
396
253
  if (v !== null) {
397
254
  return {
398
255
  "-moz-tab-size": v,
@@ -404,59 +261,46 @@ const tabSizes = [
404
261
  ];
405
262
  const textIndents = [
406
263
  [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
407
- const v = theme.textIndent?.[s || "DEFAULT"] || index.handler.bracket.cssvar.fraction.rem(s);
264
+ const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
408
265
  if (v != null)
409
266
  return { "text-indent": v };
410
267
  }]
411
268
  ];
412
269
  const textStrokes = [
413
270
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
414
- const v = theme.textStrokeWidth?.[s || "DEFAULT"] || index.handler.bracket.cssvar.px(s);
271
+ const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
415
272
  if (v != null)
416
273
  return { "-webkit-text-stroke-width": v };
417
274
  }],
418
- [/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
419
- [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": index.handler.bracket.percent(opacity) })]
275
+ [/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
276
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
420
277
  ];
421
278
  const textShadows = [
422
279
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
423
- const v = theme.textShadow?.[s || "DEFAULT"] || index.handler.bracket.cssvar(s);
280
+ const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
424
281
  if (v != null)
425
282
  return { "text-shadow": v };
426
283
  }]
427
284
  ];
428
285
 
429
286
  const gaps = [
430
- [/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
431
- const v = index.handler.bracket.rem(s);
287
+ [/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
288
+ const v = utilities.handler.bracket.auto.rem(s);
432
289
  if (v != null) {
290
+ const direction = {
291
+ "": "",
292
+ "x-": "column-",
293
+ "y-": "row-"
294
+ }[d];
433
295
  return {
434
- "grid-gap": v,
435
- "gap": v
436
- };
437
- }
438
- }],
439
- [/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
440
- const v = index.handler.bracket.rem(s);
441
- if (v != null) {
442
- return {
443
- "grid-column-gap": v,
444
- "column-gap": v
445
- };
446
- }
447
- }],
448
- [/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
449
- const v = index.handler.bracket.rem(s);
450
- if (v != null) {
451
- return {
452
- "grid-row-gap": v,
453
- "row-gap": v
296
+ [`grid-${direction}gap`]: v,
297
+ [`${direction}gap`]: v
454
298
  };
455
299
  }
456
300
  }]
457
301
  ];
458
302
 
459
- const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || index.handler.bracket.rem(s))[0];
303
+ const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
460
304
  const autoDirection = (selector, theme) => {
461
305
  if (selector === "min")
462
306
  return "min-content";
@@ -469,13 +313,13 @@ const autoDirection = (selector, theme) => {
469
313
  const grids = [
470
314
  ["grid", { display: "grid" }],
471
315
  ["inline-grid", { display: "inline-grid" }],
472
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
473
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
474
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
475
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
316
+ [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
317
+ [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
318
+ [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
319
+ [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
476
320
  [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
477
321
  const key = d === "row" ? "grid-row" : "grid-column";
478
- let raw = index.handler.bracket(v);
322
+ let raw = utilities.handler.bracket(v);
479
323
  if (raw)
480
324
  return { [key]: raw };
481
325
  const parts = v.split("-");
@@ -484,16 +328,16 @@ const grids = [
484
328
  if (parts[0] === "span") {
485
329
  if (parts[1] === "full")
486
330
  return { [key]: "1/-1" };
487
- raw = index.handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
331
+ raw = utilities.handler.number.bracket(parts[1]);
488
332
  if (raw)
489
333
  return { [key]: `span ${raw}/span ${raw}` };
490
334
  }
491
335
  }],
492
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
493
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
494
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
495
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
496
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
336
+ [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
337
+ [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
338
+ [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
339
+ [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
340
+ [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
497
341
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
498
342
  [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
499
343
  [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
@@ -530,7 +374,10 @@ const justifies = [
530
374
  ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
531
375
  ];
532
376
  const orders = [
533
- [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || index.handler.bracket.number(v) })]
377
+ [/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
378
+ ["order-first", { order: "-9999" }],
379
+ ["order-last", { order: "9999" }],
380
+ ["order-none", { order: "0" }]
534
381
  ];
535
382
  const alignments = [
536
383
  ["content-start", { "align-content": "flex-start" }],
@@ -548,7 +395,7 @@ const alignments = [
548
395
  ["self-start", { "align-self": "flex-start" }],
549
396
  ["self-end", { "align-self": "flex-end" }],
550
397
  ["self-center", { "align-self": "center" }],
551
- ["self-stretch", { "align-items": "stretch" }]
398
+ ["self-stretch", { "align-self": "stretch" }]
552
399
  ];
553
400
  const placements = [
554
401
  ["place-content-start", { "place-content": "start" }],
@@ -562,64 +409,139 @@ const placements = [
562
409
  ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
563
410
  ];
564
411
  function handleInsetValue(v) {
565
- return { auto: "auto", full: "100%" }[v] ?? index.handler.bracket.fraction.cssvar.rem(v);
412
+ return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
566
413
  }
567
414
  const insets = [
568
415
  [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
569
416
  [/^inset-([xy])-(.+)$/, ([, d, v]) => {
570
417
  const r = handleInsetValue(v);
571
- if (r != null && d in index.directionMap)
572
- return index.directionMap[d].map((i) => [i.slice(1), r]);
418
+ if (r != null && d in utilities.directionMap)
419
+ return utilities.directionMap[d].map((i) => [i.slice(1), r]);
573
420
  }]
574
421
  ];
575
422
  const floats = [
576
- [/^float-(left|right|none)$/, ([, value]) => ({ float: value })],
577
- [/^clear-(left|right|both|none)$/, ([, value]) => ({ clear: value })]
423
+ ["float-left", { float: "left" }],
424
+ ["float-right", { float: "right" }],
425
+ ["float-none", { float: "none" }],
426
+ ["clear-left", { clear: "left" }],
427
+ ["clear-right", { clear: "right" }],
428
+ ["clear-both", { clear: "both" }],
429
+ ["clear-none", { clear: "none" }]
578
430
  ];
579
431
  const zIndexes = [
580
432
  ["z-auto", { "z-index": "auto" }],
581
- [/^z-([^-]+)$/, ([, v]) => ({ "z-index": index.handler.number(v) })]
433
+ [/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
582
434
  ];
583
435
  const boxSizing = [
584
- [
585
- /^box-(border|content)$/,
586
- ([, value]) => ({
587
- "box-sizing": `${value}-box`
588
- })
589
- ]
436
+ ["box-border", { "box-sizing": "border-box" }],
437
+ ["box-content", { "box-sizing": "content-box" }]
438
+ ];
439
+
440
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
441
+ const displays = [
442
+ ["inline", { display: "inline" }],
443
+ ["block", { display: "block" }],
444
+ ["inline-block", { display: "inline-block" }],
445
+ ["contents", { display: "contents" }],
446
+ ["flow-root", { display: "flow-root" }],
447
+ ["list-item", { display: "list-item" }],
448
+ ["hidden", { display: "none" }]
449
+ ];
450
+ const appearances = [
451
+ ["visible", { visibility: "visible" }],
452
+ ["invisible", { visibility: "hidden" }],
453
+ ["backface-visible", { "backface-visibility": "visible" }],
454
+ ["backface-hidden", { "backface-visibility": "hidden" }]
455
+ ];
456
+ const cursors = [
457
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
458
+ ];
459
+ const pointerEvents = [
460
+ ["pointer-events-auto", { "pointer-events": "auto" }],
461
+ ["pointer-events-none", { "pointer-events": "none" }]
462
+ ];
463
+ const resizes = [
464
+ ["resize-x", { resize: "horizontal" }],
465
+ ["resize-y", { resize: "vertical" }],
466
+ ["resize", { resize: "both" }],
467
+ ["resize-none", { resize: "none" }]
468
+ ];
469
+ const userSelects = [
470
+ ["select-auto", { "user-select": "auto" }],
471
+ ["select-all", { "user-select": "all" }],
472
+ ["select-text", { "user-select": "text" }],
473
+ ["select-none", { "user-select": "none" }]
474
+ ];
475
+ const whitespaces = [
476
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
477
+ ];
478
+ const contents = [
479
+ ["content-empty", { content: '""' }]
480
+ ];
481
+ const breaks = [
482
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
483
+ ["break-word", { "overflow-wrap": "break-word" }],
484
+ ["break-all", { "word-break": "break-all" }]
485
+ ];
486
+ const textOverflows = [
487
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
488
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
489
+ ["text-clip", { "text-overflow": "clip" }]
490
+ ];
491
+ const textTransforms = [
492
+ ["case-upper", { "text-transform": "uppercase" }],
493
+ ["case-lower", { "text-transform": "lowercase" }],
494
+ ["case-capital", { "text-transform": "capitalize" }],
495
+ ["case-normal", { "text-transform": "none" }]
496
+ ];
497
+ const fontStyles = [
498
+ ["italic", { "font-style": "italic" }],
499
+ ["not-italic", { "font-style": "normal" }]
500
+ ];
501
+ const fontSmoothings = [
502
+ ["antialiased", {
503
+ "-webkit-font-smoothing": "antialiased",
504
+ "-moz-osx-font-smoothing": "grayscale",
505
+ "font-smoothing": "grayscale"
506
+ }],
507
+ ["subpixel-antialiased", {
508
+ "-webkit-font-smoothing": "auto",
509
+ "-moz-osx-font-smoothing": "auto",
510
+ "font-smoothing": "auto"
511
+ }]
590
512
  ];
591
513
 
592
514
  const rings = [
593
515
  [/^ring-?(.*)$/, ([, d]) => {
594
- const value = index.handler.px(d || "1");
516
+ const value = utilities.handler.px(d || "1");
595
517
  if (value) {
596
518
  return {
597
- "--un-ring-inset": "var(--un-empty, )",
519
+ "--un-ring-inset": varEmpty,
598
520
  "--un-ring-offset-width": "0px",
599
521
  "--un-ring-offset-color": "#fff",
600
522
  "--un-ring-color": "rgba(59, 130, 246, .5)",
601
523
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
602
524
  "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
603
- "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);",
604
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);"
525
+ "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
526
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
605
527
  };
606
528
  }
607
529
  }],
608
- [/^ring-offset-?(.*)$/, ([, d]) => {
609
- const value = index.handler.px(d || "1");
610
- if (value) {
611
- return {
612
- "--un-ring-offset-width": value
613
- };
614
- }
530
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
531
+ [/^ring-offset-(.+)$/, ([, d]) => {
532
+ const value = utilities.handler.px(d || "1");
533
+ if (value)
534
+ return { "--un-ring-offset-width": value };
615
535
  }],
616
- ["ring-inset", { "--un-ring-inset": "inset" }],
617
- ...ringColors,
618
- ...ringOffsetColors
536
+ [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
537
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
538
+ [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
539
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) })],
540
+ ["ring-inset", { "--un-ring-inset": "inset" }]
619
541
  ];
620
542
 
621
543
  const colorResolver = (body, theme) => {
622
- const data = parseColorUtil(body, theme);
544
+ const data = utilities.parseColor(body, theme);
623
545
  if (!data)
624
546
  return;
625
547
  const { color, rgba } = data;
@@ -637,7 +559,7 @@ const colorResolver = (body, theme) => {
637
559
  };
638
560
  const boxShadows = [
639
561
  [/^shadow-?(.*)$/, ([, d], { theme }) => {
640
- const value = theme?.boxShadow?.[d || "DEFAULT"];
562
+ const value = theme.boxShadow?.[d || "DEFAULT"];
641
563
  if (value) {
642
564
  return {
643
565
  "--un-shadow-color": "0,0,0",
@@ -645,10 +567,8 @@ const boxShadows = [
645
567
  "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
646
568
  };
647
569
  }
648
- const color = colorResolver(d, theme);
649
- if (color)
650
- return color;
651
- }]
570
+ }],
571
+ [/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
652
572
  ];
653
573
 
654
574
  function getPropName(minmax, hw) {
@@ -657,12 +577,12 @@ function getPropName(minmax, hw) {
657
577
  function getThemeValue(minmax, hw, theme, prop) {
658
578
  let str = `${hw === "h" ? "height" : "width"}`;
659
579
  if (minmax)
660
- str = `${minmax}${index.capitalize(str)}`;
580
+ str = `${minmax}${utilities.capitalize(str)}`;
661
581
  return theme[str]?.[prop];
662
582
  }
663
583
  const sizes = [
664
584
  [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
665
- const v = getThemeValue(m, w, theme, s) || index.handler.bracket.cssvar.fraction.rem(s);
585
+ const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
666
586
  if (v != null)
667
587
  return { [getPropName(m, w)]: v };
668
588
  }],
@@ -675,106 +595,30 @@ const sizes = [
675
595
  const aspectRatio = [
676
596
  ["aspect-ratio-auto", { "aspect-ratio": "auto" }],
677
597
  [/^aspect-ratio-(.+)$/, ([, d]) => {
678
- const v = (/^\d+\/\d+$/.test(d) ? d : null) || index.handler.bracket.cssvar.number(d);
598
+ const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
679
599
  if (v != null)
680
600
  return { "aspect-ratio": v };
681
601
  }]
682
602
  ];
683
603
 
684
- const directionSize = (prefix) => ([_, direction, size]) => {
685
- const v = index.handler.bracket.rem.fraction.cssvar(size);
686
- if (v)
687
- return index.directionMap[direction].map((i) => [prefix + i, v]);
688
- };
689
604
  const paddings = [
690
- [/^pa?()-?(-?.+)$/, directionSize("padding")],
691
- [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
692
- [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
605
+ [/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
606
+ [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
607
+ [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
693
608
  ];
694
609
  const margins = [
695
- [/^ma?()-?(-?.+)$/, directionSize("margin")],
696
- [/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
697
- [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
698
- ];
699
-
700
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
701
- const displays = [
702
- ["inline", { display: "inline" }],
703
- ["block", { display: "block" }],
704
- ["inline-block", { display: "inline-block" }],
705
- ["contents", { display: "contents" }],
706
- ["flow-root", { display: "flow-root" }],
707
- ["list-item", { display: "list-item" }],
708
- ["hidden", { display: "none" }]
709
- ];
710
- const appearances = [
711
- ["visible", { visibility: "visible" }],
712
- ["invisible", { visibility: "hidden" }],
713
- ["backface-visible", { "backface-visibility": "visible" }],
714
- ["backface-hidden", { "backface-visibility": "hidden" }]
715
- ];
716
- const cursors = [
717
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
718
- ];
719
- const pointerEvents = [
720
- ["pointer-events-none", { "pointer-events": "none" }],
721
- ["pointer-events-auto", { "pointer-events": "auto" }]
722
- ];
723
- const resizes = [
724
- ["resize-none", { resize: "none" }],
725
- ["resize-x", { resize: "horizontal" }],
726
- ["resize-y", { resize: "vertical" }],
727
- ["resize", { resize: "both" }]
728
- ];
729
- const userSelects = [
730
- [/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
731
- ];
732
- const whitespaces = [
733
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
734
- ];
735
- const contents = [
736
- ["content-empty", { content: '""' }]
737
- ];
738
- const breaks = [
739
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
740
- ["break-word", { "overflow-wrap": "break-word" }],
741
- ["break-all", { "word-break": "break-all" }]
742
- ];
743
- const textOverflows = [
744
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
745
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
746
- ["text-clip", { "text-overflow": "clip" }]
747
- ];
748
- const textTransforms = [
749
- ["case-upper", { "text-transform": "uppercase" }],
750
- ["case-lower", { "text-transform": "lowercase" }],
751
- ["case-capital", { "text-transform": "capitalize" }],
752
- ["case-normal", { "text-transform": "none" }]
753
- ];
754
- const fontStyles = [
755
- ["italic", { "font-style": "italic" }],
756
- ["not-italic", { "font-style": "normal" }]
757
- ];
758
- const fontSmoothings = [
759
- ["antialiased", {
760
- "-webkit-font-smoothing": "antialiased",
761
- "-moz-osx-font-smoothing": "grayscale",
762
- "font-smoothing": "grayscale"
763
- }],
764
- ["subpixel-antialiased", {
765
- "-webkit-font-smoothing": "auto",
766
- "-moz-osx-font-smoothing": "auto",
767
- "font-smoothing": "auto"
768
- }]
610
+ [/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
611
+ [/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
612
+ [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
769
613
  ];
770
614
 
771
615
  const transformGpu = {
772
616
  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))",
773
- [pseudo.CONTROL_BYPASS_PSEUDO]: ""
617
+ [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
774
618
  };
775
619
  const transformCpu = {
776
620
  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))",
777
- [pseudo.CONTROL_BYPASS_PSEUDO]: ""
621
+ [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
778
622
  };
779
623
  const transformBase = {
780
624
  "--un-rotate": 0,
@@ -791,11 +635,14 @@ const transformBase = {
791
635
  const transforms = [
792
636
  ["transform", transformBase],
793
637
  [/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
794
- [/^translate()-([^-]+)$/, handleTranslate],
795
- [/^translate-([xyz])-([^-]+)$/, handleTranslate],
796
- [/^scale()-([^-]+)$/, handleScale],
797
- [/^scale-([xyz])-([^-]+)$/, handleScale],
798
- [/^rotate-([^-]+)(?:deg)?$/, handleRotate],
638
+ [/^translate()-(.+)$/, handleTranslate],
639
+ [/^translate-([xyz])-(.+)$/, handleTranslate],
640
+ [/^scale()-(.+)$/, handleScale],
641
+ [/^scale-([xyz])-(.+)$/, handleScale],
642
+ [/^rotate-(.+)$/, handleRotate],
643
+ [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
644
+ [/^skew-([xy])-(.+)$/, handleSkew],
645
+ [/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
799
646
  ["transform-gpu", transformGpu],
800
647
  ["transform-cpu", transformCpu],
801
648
  ["transform-none", { transform: "none" }],
@@ -810,29 +657,29 @@ const transforms = [
810
657
  ["origin-top-left", { "transform-origin": "top left" }]
811
658
  ];
812
659
  function handleTranslate([, d, b]) {
813
- const v = index.handler.bracket.fraction.rem(b);
660
+ const v = utilities.handler.bracket.fraction.auto.rem(b);
814
661
  if (v != null) {
815
662
  return [
816
663
  transformBase,
817
664
  [
818
- ...index.xyzMap[d].map((i) => [`--un-translate${i}`, v])
665
+ ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
819
666
  ]
820
667
  ];
821
668
  }
822
669
  }
823
670
  function handleScale([, d, b]) {
824
- const v = index.handler.bracket.fraction.percent(b);
671
+ const v = utilities.handler.bracket.fraction.percent(b);
825
672
  if (v != null) {
826
673
  return [
827
674
  transformBase,
828
675
  [
829
- ...index.xyzMap[d].map((i) => [`--un-scale${i}`, v])
676
+ ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
830
677
  ]
831
678
  ];
832
679
  }
833
680
  }
834
- function handleRotate([, b]) {
835
- const v = index.handler.bracket.number(b);
681
+ function handleRotateWithUnit([, b]) {
682
+ const v = utilities.handler.bracket.number(b);
836
683
  if (v != null) {
837
684
  return [
838
685
  transformBase,
@@ -840,6 +687,33 @@ function handleRotate([, b]) {
840
687
  ];
841
688
  }
842
689
  }
690
+ function handleRotate([, b]) {
691
+ const v = utilities.handler.bracket(b);
692
+ if (v != null) {
693
+ return [
694
+ transformBase,
695
+ { "--un-rotate": v }
696
+ ];
697
+ }
698
+ }
699
+ function handleSkewWithUnit([, d, b]) {
700
+ const v = utilities.handler.bracket.number(b);
701
+ if (v != null) {
702
+ return [
703
+ transformBase,
704
+ { [`--un-skew-${d}`]: `${v}deg` }
705
+ ];
706
+ }
707
+ }
708
+ function handleSkew([, d, b]) {
709
+ const v = utilities.handler.bracket(b);
710
+ if (v != null) {
711
+ return [
712
+ transformBase,
713
+ { [`--un-skew-${d}`]: v }
714
+ ];
715
+ }
716
+ }
843
717
 
844
718
  const variablesAbbrMap = {
845
719
  "visible": "visibility",
@@ -880,8 +754,8 @@ const cssVariables = [
880
754
  }
881
755
  }],
882
756
  [/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
883
- if (a in index.directionMap)
884
- return index.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
757
+ if (a in utilities.directionMap)
758
+ return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
885
759
  }]
886
760
  ];
887
761
 
@@ -899,20 +773,12 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
899
773
  const textDecorations = [
900
774
  ["underline", { "text-decoration": "underline" }],
901
775
  ["line-through", { "text-decoration": "line-through" }],
902
- ["no-underline", { "text-decoration": "none" }],
903
776
  ["decoration-underline", { "text-decoration": "underline" }],
904
777
  ["decoration-line-through", { "text-decoration": "line-through" }],
905
- ["decoration-none", { "text-decoration": "none" }],
906
- [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
907
- [/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : index.handler.bracket.px(s) })],
908
- [/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": index.handler.bracket.px(d) })],
909
- [/^underline-offset-([^-]+)$/, ([, s]) => {
910
- const v = s === "auto" ? s : index.handler.bracket.px(s);
911
- if (v != null)
912
- return { "text-underline-offset": v };
913
- }],
778
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
779
+ [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
914
780
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
915
- const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
781
+ const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
916
782
  if (result) {
917
783
  return {
918
784
  "-webkit-text-decoration-color": result["text-decoration-color"],
@@ -920,7 +786,25 @@ const textDecorations = [
920
786
  };
921
787
  }
922
788
  }],
923
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": index.handler.bracket.percent(opacity) })]
789
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
790
+ [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.px(s) })],
791
+ [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
792
+ ["no-underline", { "text-decoration": "none" }],
793
+ ["decoration-none", { "text-decoration": "none" }]
794
+ ];
795
+
796
+ const svgUtilities = [
797
+ [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
798
+ [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
799
+ ["fill-none", { fill: "none" }],
800
+ [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
801
+ const v = utilities.handler.bracket.fraction.px.number(s);
802
+ if (v)
803
+ return { "stroke-width": v };
804
+ }],
805
+ [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
806
+ [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
807
+ ["stroke-none", { stroke: "none" }]
924
808
  ];
925
809
 
926
810
  const rules = [
@@ -930,7 +814,7 @@ const rules = [
930
814
  displays,
931
815
  opacity,
932
816
  bgColors,
933
- fillColors,
817
+ svgUtilities,
934
818
  borders,
935
819
  contents,
936
820
  fonts,
@@ -964,7 +848,6 @@ const rules = [
964
848
  overflows,
965
849
  outline,
966
850
  appearance,
967
- placeholder,
968
851
  positions,
969
852
  orders,
970
853
  justifies,
@@ -976,6 +859,7 @@ const rules = [
976
859
  boxSizing,
977
860
  transitions,
978
861
  transforms,
862
+ willChange,
979
863
  questionMark
980
864
  ].flat(1);
981
865
 
@@ -984,17 +868,14 @@ exports.appearance = appearance;
984
868
  exports.appearances = appearances;
985
869
  exports.aspectRatio = aspectRatio;
986
870
  exports.bgColors = bgColors;
987
- exports.borderColors = borderColors;
988
871
  exports.borders = borders;
989
872
  exports.boxShadows = boxShadows;
990
873
  exports.boxSizing = boxSizing;
991
874
  exports.breaks = breaks;
992
- exports.colorResolver = colorResolver$1;
993
875
  exports.contents = contents;
994
876
  exports.cssVariables = cssVariables;
995
877
  exports.cursors = cursors;
996
878
  exports.displays = displays;
997
- exports.fillColors = fillColors;
998
879
  exports.flex = flex;
999
880
  exports.floats = floats;
1000
881
  exports.fontSmoothings = fontSmoothings;
@@ -1010,18 +891,15 @@ exports.orders = orders;
1010
891
  exports.outline = outline;
1011
892
  exports.overflows = overflows;
1012
893
  exports.paddings = paddings;
1013
- exports.parseColorUtil = parseColorUtil;
1014
- exports.placeholder = placeholder;
1015
894
  exports.placements = placements;
1016
895
  exports.pointerEvents = pointerEvents;
1017
896
  exports.positions = positions;
1018
897
  exports.questionMark = questionMark;
1019
898
  exports.resizes = resizes;
1020
- exports.ringColors = ringColors;
1021
- exports.ringOffsetColors = ringOffsetColors;
1022
899
  exports.rings = rings;
1023
900
  exports.rules = rules;
1024
901
  exports.sizes = sizes;
902
+ exports.svgUtilities = svgUtilities;
1025
903
  exports.tabSizes = tabSizes;
1026
904
  exports.textAligns = textAligns;
1027
905
  exports.textColors = textColors;
@@ -1037,4 +915,5 @@ exports.userSelects = userSelects;
1037
915
  exports.varEmpty = varEmpty;
1038
916
  exports.verticalAligns = verticalAligns;
1039
917
  exports.whitespaces = whitespaces;
918
+ exports.willChange = willChange;
1040
919
  exports.zIndexes = zIndexes;