@unocss/preset-mini 0.16.3 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@unocss/core');
4
- const index = require('./index.cjs');
4
+ const utilities = require('./utilities.cjs');
5
5
  const pseudo = require('./pseudo.cjs');
6
6
 
7
7
  const verticalAlignAlias = {
@@ -21,19 +21,28 @@ const textAligns = [
21
21
 
22
22
  const parseColorUtil = (body, theme) => {
23
23
  const [main, opacity2] = body.split(/(?:\/|:)/);
24
- const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
24
+ const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
25
+ const [name] = colors;
25
26
  if (!name)
26
27
  return;
27
28
  let color;
28
- const bracket = index.handler.bracket(main);
29
+ const bracket = utilities.handler.bracket(main);
29
30
  const bracketOrMain = bracket || main;
30
31
  if (bracketOrMain.startsWith("#"))
31
32
  color = bracketOrMain.slice(1);
32
33
  if (bracketOrMain.startsWith("hex-"))
33
34
  color = bracketOrMain.slice(4);
34
35
  color = color || bracket;
36
+ let no = "DEFAULT";
35
37
  if (!color) {
36
- const colorData = theme.colors?.[name];
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
+ }
37
46
  if (typeof colorData === "string")
38
47
  color = colorData;
39
48
  else if (no && colorData)
@@ -54,7 +63,7 @@ const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
54
63
  const { opacity: opacity2, color, rgba } = data;
55
64
  if (!color)
56
65
  return;
57
- const a = opacity2 ? opacity2[0] === "[" ? index.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
66
+ const a = opacity2 ? opacity2[0] === "[" ? utilities.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
58
67
  if (rgba) {
59
68
  if (a != null && !Number.isNaN(a)) {
60
69
  rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
@@ -74,38 +83,158 @@ const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
74
83
  }
75
84
  };
76
85
  const opacity = [
77
- [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: index.handler.bracket.percent.cssvar(d) })]
86
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
78
87
  ];
79
88
  const textColors = [
80
89
  [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
81
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": index.handler.bracket.percent.cssvar(opacity2) })]
90
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
82
91
  ];
83
92
  const bgColors = [
84
93
  [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
85
- [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": index.handler.bracket.percent(opacity2) })]
94
+ [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
86
95
  ];
87
96
  const borderColors = [
88
97
  [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
89
- [/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity2) })]
98
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
90
99
  ];
91
100
  const ringColors = [
92
101
  [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
93
- [/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": index.handler.bracket.percent(opacity2) })]
102
+ [/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
94
103
  ];
95
104
  const ringOffsetColors = [
96
105
  [/^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) })]
106
+ [/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
98
107
  ];
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) })]
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
+ }]
103
232
  ];
104
233
 
105
234
  const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
106
235
  const parseOutlineSize = (s) => {
107
236
  const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
108
- const size = index.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-)/, ""));
237
+ const size = utilities.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
109
238
  if (size) {
110
239
  return {
111
240
  [`outline-${propName}`]: size
@@ -130,15 +259,15 @@ const outline = [
130
259
  "outline-style": d
131
260
  };
132
261
  }
133
- const sizeSheet = parseOutlineSize(d);
134
- if (sizeSheet)
135
- return sizeSheet;
136
262
  const colorSheet = colorResolver$1("outline-color", "outline-color")([
137
263
  match[0],
138
264
  match[1].replace(/^color-/, "")
139
265
  ], config);
140
266
  if (colorSheet)
141
267
  return colorSheet;
268
+ const sizeSheet = parseOutlineSize(d);
269
+ if (sizeSheet)
270
+ return sizeSheet;
142
271
  }
143
272
  ]
144
273
  ];
@@ -152,7 +281,7 @@ const placeholder = [
152
281
  [
153
282
  /^placeholder-opacity-(\d+)$/,
154
283
  ([, d]) => ({
155
- "placeholder-opacity": index.handler.bracket.percent(d)
284
+ "placeholder-opacity": utilities.handler.bracket.percent(d)
156
285
  })
157
286
  ],
158
287
  [
@@ -163,6 +292,19 @@ const placeholder = [
163
292
  }
164
293
  ]
165
294
  ];
295
+ const cssPropsStr = cssProps.join(", ");
296
+ const validateProperty$1 = (prop) => {
297
+ if (prop && !cssProps.includes(prop))
298
+ return;
299
+ return prop || cssPropsStr;
300
+ };
301
+ 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
+ }]
307
+ ];
166
308
 
167
309
  const borders = [
168
310
  [/^border$/, handlerBorder],
@@ -172,7 +314,7 @@ const borders = [
172
314
  [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
173
315
  [/^(?:border|b)()-(.+)$/, handlerBorderColor],
174
316
  [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
175
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity) })],
317
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
176
318
  ["border-solid", { "border-style": "solid" }],
177
319
  ["border-dashed", { "border-style": "dashed" }],
178
320
  ["border-dotted", { "border-style": "dotted" }],
@@ -192,11 +334,11 @@ function handlerBorder(m) {
192
334
  }
193
335
  }
194
336
  function handlerBorderSize([, a, b]) {
195
- const [d, s = "1"] = index.directionMap[a] ? [a, b] : ["", a];
196
- const v = index.handler.bracket.px(s);
337
+ const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
338
+ const v = utilities.handler.bracket.px(s);
197
339
  if (v != null) {
198
340
  return [
199
- ...index.directionMap[d].map((i) => [`border${i}-width`, v])
341
+ ...utilities.directionMap[d].map((i) => [`border${i}-width`, v])
200
342
  ];
201
343
  }
202
344
  }
@@ -204,7 +346,7 @@ function handlerBorderColor([, a, c], ctx) {
204
346
  if (c !== void 0) {
205
347
  const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
206
348
  if (ofColor) {
207
- const borders2 = index.directionMap[index.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
349
+ const borders2 = utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
208
350
  const borderObject = {};
209
351
  Object.assign(borderObject, ...borders2);
210
352
  return borderObject;
@@ -212,70 +354,16 @@ function handlerBorderColor([, a, c], ctx) {
212
354
  }
213
355
  }
214
356
  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);
357
+ const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
358
+ const v = theme.borderRadius?.[s] || utilities.handler.bracket.fraction.rem(s);
217
359
  if (v != null)
218
- return index.cornerMap[d].map((i) => [`border${i}-radius`, v]);
360
+ return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
219
361
  }
220
362
 
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"
247
- ];
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"
267
- ];
268
363
  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
275
- ];
276
- const transitionPropsStr = transitionProps.join(", ");
364
+ const transitionPropsStr = cssProps.join(", ");
277
365
  const validateProperty = (prop) => {
278
- if (prop && ![...transitionProps, ...transitionSwitchProps].includes(prop))
366
+ if (prop && ![...cssProps, ...transitionSwitchProps].includes(prop))
279
367
  return;
280
368
  return prop || transitionPropsStr;
281
369
  };
@@ -351,7 +439,7 @@ const fonts = [
351
439
  }
352
440
  }],
353
441
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
354
- const size = index.handler.bracket.rem(s);
442
+ const size = utilities.handler.bracket.rem(s);
355
443
  if (size)
356
444
  return { "font-size": size };
357
445
  const themed = core.toArray(theme.fontSize?.[s]);
@@ -364,27 +452,27 @@ const fonts = [
364
452
  }
365
453
  }],
366
454
  [/^text-size-(.+)$/, ([, s]) => {
367
- const raw = index.handler.bracket.rem(s);
455
+ const raw = utilities.handler.bracket.rem(s);
368
456
  if (raw)
369
457
  return { "font-size": raw };
370
458
  }],
371
459
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
372
- const v = weightMap[s] || index.handler.number(s);
460
+ const v = weightMap[s] || utilities.handler.number(s);
373
461
  if (v)
374
462
  return { "font-weight": v };
375
463
  }],
376
464
  [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
377
- const v = theme.lineHeight?.[s] || index.handler.bracket.rem(s);
465
+ const v = theme.lineHeight?.[s] || utilities.handler.bracket.rem(s);
378
466
  if (v !== null)
379
467
  return { "line-height": v };
380
468
  }],
381
469
  [/^tracking-([^-]+)$/, ([, s], { theme }) => {
382
- const v = theme.letterSpacing?.[s] || index.handler.bracket.rem(s);
470
+ const v = theme.letterSpacing?.[s] || utilities.handler.bracket.rem(s);
383
471
  if (v !== null)
384
472
  return { "letter-spacing": v };
385
473
  }],
386
474
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
387
- const v = theme.wordSpacing?.[s] || index.handler.bracket.rem(s);
475
+ const v = theme.wordSpacing?.[s] || utilities.handler.bracket.rem(s);
388
476
  if (v !== null)
389
477
  return { "word-spacing": v };
390
478
  }]
@@ -392,7 +480,7 @@ const fonts = [
392
480
  const tabSizes = [
393
481
  [/^tab-?([^-]*)$/, ([, s]) => {
394
482
  s = s || "4";
395
- const v = index.handler.bracket.global.number(s);
483
+ const v = utilities.handler.bracket.global.number(s);
396
484
  if (v !== null) {
397
485
  return {
398
486
  "-moz-tab-size": v,
@@ -404,23 +492,23 @@ const tabSizes = [
404
492
  ];
405
493
  const textIndents = [
406
494
  [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
407
- const v = theme.textIndent?.[s || "DEFAULT"] || index.handler.bracket.cssvar.fraction.rem(s);
495
+ const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s);
408
496
  if (v != null)
409
497
  return { "text-indent": v };
410
498
  }]
411
499
  ];
412
500
  const textStrokes = [
413
501
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
414
- const v = theme.textStrokeWidth?.[s || "DEFAULT"] || index.handler.bracket.cssvar.px(s);
502
+ const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
415
503
  if (v != null)
416
504
  return { "-webkit-text-stroke-width": v };
417
505
  }],
418
506
  [/^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) })]
507
+ [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
420
508
  ];
421
509
  const textShadows = [
422
510
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
423
- const v = theme.textShadow?.[s || "DEFAULT"] || index.handler.bracket.cssvar(s);
511
+ const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
424
512
  if (v != null)
425
513
  return { "text-shadow": v };
426
514
  }]
@@ -428,7 +516,7 @@ const textShadows = [
428
516
 
429
517
  const gaps = [
430
518
  [/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
431
- const v = index.handler.bracket.rem(s);
519
+ const v = utilities.handler.bracket.rem(s);
432
520
  if (v != null) {
433
521
  return {
434
522
  "grid-gap": v,
@@ -437,7 +525,7 @@ const gaps = [
437
525
  }
438
526
  }],
439
527
  [/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
440
- const v = index.handler.bracket.rem(s);
528
+ const v = utilities.handler.bracket.rem(s);
441
529
  if (v != null) {
442
530
  return {
443
531
  "grid-column-gap": v,
@@ -446,7 +534,7 @@ const gaps = [
446
534
  }
447
535
  }],
448
536
  [/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
449
- const v = index.handler.bracket.rem(s);
537
+ const v = utilities.handler.bracket.rem(s);
450
538
  if (v != null) {
451
539
  return {
452
540
  "grid-row-gap": v,
@@ -456,7 +544,7 @@ const gaps = [
456
544
  }]
457
545
  ];
458
546
 
459
- const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || index.handler.bracket.rem(s))[0];
547
+ const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.rem(s))[0];
460
548
  const autoDirection = (selector, theme) => {
461
549
  if (selector === "min")
462
550
  return "min-content";
@@ -475,7 +563,7 @@ const grids = [
475
563
  [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
476
564
  [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
477
565
  const key = d === "row" ? "grid-row" : "grid-column";
478
- let raw = index.handler.bracket(v);
566
+ let raw = utilities.handler.bracket(v);
479
567
  if (raw)
480
568
  return { [key]: raw };
481
569
  const parts = v.split("-");
@@ -484,7 +572,7 @@ const grids = [
484
572
  if (parts[0] === "span") {
485
573
  if (parts[1] === "full")
486
574
  return { [key]: "1/-1" };
487
- raw = index.handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
575
+ raw = utilities.handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
488
576
  if (raw)
489
577
  return { [key]: `span ${raw}/span ${raw}` };
490
578
  }
@@ -530,7 +618,7 @@ const justifies = [
530
618
  ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
531
619
  ];
532
620
  const orders = [
533
- [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || index.handler.bracket.number(v) })]
621
+ [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || utilities.handler.bracket.number(v) })]
534
622
  ];
535
623
  const alignments = [
536
624
  ["content-start", { "align-content": "flex-start" }],
@@ -562,14 +650,14 @@ const placements = [
562
650
  ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
563
651
  ];
564
652
  function handleInsetValue(v) {
565
- return { auto: "auto", full: "100%" }[v] ?? index.handler.bracket.fraction.cssvar.rem(v);
653
+ return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.rem(v);
566
654
  }
567
655
  const insets = [
568
656
  [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
569
657
  [/^inset-([xy])-(.+)$/, ([, d, v]) => {
570
658
  const r = handleInsetValue(v);
571
- if (r != null && d in index.directionMap)
572
- return index.directionMap[d].map((i) => [i.slice(1), r]);
659
+ if (r != null && d in utilities.directionMap)
660
+ return utilities.directionMap[d].map((i) => [i.slice(1), r]);
573
661
  }]
574
662
  ];
575
663
  const floats = [
@@ -578,7 +666,7 @@ const floats = [
578
666
  ];
579
667
  const zIndexes = [
580
668
  ["z-auto", { "z-index": "auto" }],
581
- [/^z-([^-]+)$/, ([, v]) => ({ "z-index": index.handler.number(v) })]
669
+ [/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
582
670
  ];
583
671
  const boxSizing = [
584
672
  [
@@ -591,7 +679,7 @@ const boxSizing = [
591
679
 
592
680
  const rings = [
593
681
  [/^ring-?(.*)$/, ([, d]) => {
594
- const value = index.handler.px(d || "1");
682
+ const value = utilities.handler.px(d || "1");
595
683
  if (value) {
596
684
  return {
597
685
  "--un-ring-inset": "var(--un-empty, )",
@@ -600,13 +688,13 @@ const rings = [
600
688
  "--un-ring-color": "rgba(59, 130, 246, .5)",
601
689
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
602
690
  "--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);"
691
+ "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
692
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
605
693
  };
606
694
  }
607
695
  }],
608
696
  [/^ring-offset-?(.*)$/, ([, d]) => {
609
- const value = index.handler.px(d || "1");
697
+ const value = utilities.handler.px(d || "1");
610
698
  if (value) {
611
699
  return {
612
700
  "--un-ring-offset-width": value
@@ -657,12 +745,12 @@ function getPropName(minmax, hw) {
657
745
  function getThemeValue(minmax, hw, theme, prop) {
658
746
  let str = `${hw === "h" ? "height" : "width"}`;
659
747
  if (minmax)
660
- str = `${minmax}${index.capitalize(str)}`;
748
+ str = `${minmax}${utilities.capitalize(str)}`;
661
749
  return theme[str]?.[prop];
662
750
  }
663
751
  const sizes = [
664
752
  [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
665
- const v = getThemeValue(m, w, theme, s) || index.handler.bracket.cssvar.fraction.rem(s);
753
+ const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.rem(s);
666
754
  if (v != null)
667
755
  return { [getPropName(m, w)]: v };
668
756
  }],
@@ -675,106 +763,30 @@ const sizes = [
675
763
  const aspectRatio = [
676
764
  ["aspect-ratio-auto", { "aspect-ratio": "auto" }],
677
765
  [/^aspect-ratio-(.+)$/, ([, d]) => {
678
- const v = (/^\d+\/\d+$/.test(d) ? d : null) || index.handler.bracket.cssvar.number(d);
766
+ const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
679
767
  if (v != null)
680
768
  return { "aspect-ratio": v };
681
769
  }]
682
770
  ];
683
771
 
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
772
  const paddings = [
690
- [/^pa?()-?(-?.+)$/, directionSize("padding")],
691
- [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
692
- [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
773
+ [/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
774
+ [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
775
+ [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
693
776
  ];
694
777
  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
- }]
778
+ [/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
779
+ [/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
780
+ [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
769
781
  ];
770
782
 
771
783
  const transformGpu = {
772
784
  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]: ""
785
+ [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
774
786
  };
775
787
  const transformCpu = {
776
788
  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]: ""
789
+ [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
778
790
  };
779
791
  const transformBase = {
780
792
  "--un-rotate": 0,
@@ -791,11 +803,12 @@ const transformBase = {
791
803
  const transforms = [
792
804
  ["transform", transformBase],
793
805
  [/^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],
806
+ [/^translate()-(.+)$/, handleTranslate],
807
+ [/^translate-([xyz])-(.+)$/, handleTranslate],
808
+ [/^scale()-(.+)$/, handleScale],
809
+ [/^scale-([xyz])-(.+)$/, handleScale],
810
+ [/^rotate-(.+)$/, handleRotate],
811
+ [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
799
812
  ["transform-gpu", transformGpu],
800
813
  ["transform-cpu", transformCpu],
801
814
  ["transform-none", { transform: "none" }],
@@ -810,29 +823,29 @@ const transforms = [
810
823
  ["origin-top-left", { "transform-origin": "top left" }]
811
824
  ];
812
825
  function handleTranslate([, d, b]) {
813
- const v = index.handler.bracket.fraction.rem(b);
826
+ const v = utilities.handler.bracket.fraction.rem(b);
814
827
  if (v != null) {
815
828
  return [
816
829
  transformBase,
817
830
  [
818
- ...index.xyzMap[d].map((i) => [`--un-translate${i}`, v])
831
+ ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
819
832
  ]
820
833
  ];
821
834
  }
822
835
  }
823
836
  function handleScale([, d, b]) {
824
- const v = index.handler.bracket.fraction.percent(b);
837
+ const v = utilities.handler.bracket.fraction.percent(b);
825
838
  if (v != null) {
826
839
  return [
827
840
  transformBase,
828
841
  [
829
- ...index.xyzMap[d].map((i) => [`--un-scale${i}`, v])
842
+ ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
830
843
  ]
831
844
  ];
832
845
  }
833
846
  }
834
- function handleRotate([, b]) {
835
- const v = index.handler.bracket.number(b);
847
+ function handleRotateWithUnit([, b]) {
848
+ const v = utilities.handler.bracket.number(b);
836
849
  if (v != null) {
837
850
  return [
838
851
  transformBase,
@@ -840,6 +853,15 @@ function handleRotate([, b]) {
840
853
  ];
841
854
  }
842
855
  }
856
+ function handleRotate([, b]) {
857
+ const v = utilities.handler.bracket(b);
858
+ if (v != null) {
859
+ return [
860
+ transformBase,
861
+ { "--un-rotate": v }
862
+ ];
863
+ }
864
+ }
843
865
 
844
866
  const variablesAbbrMap = {
845
867
  "visible": "visibility",
@@ -880,8 +902,8 @@ const cssVariables = [
880
902
  }
881
903
  }],
882
904
  [/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
883
- if (a in index.directionMap)
884
- return index.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
905
+ if (a in utilities.directionMap)
906
+ return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
885
907
  }]
886
908
  ];
887
909
 
@@ -904,10 +926,10 @@ const textDecorations = [
904
926
  ["decoration-line-through", { "text-decoration": "line-through" }],
905
927
  ["decoration-none", { "text-decoration": "none" }],
906
928
  [/^(?: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) })],
929
+ [/^(?: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) })],
909
931
  [/^underline-offset-([^-]+)$/, ([, s]) => {
910
- const v = s === "auto" ? s : index.handler.bracket.px(s);
932
+ const v = s === "auto" ? s : utilities.handler.bracket.px(s);
911
933
  if (v != null)
912
934
  return { "text-underline-offset": v };
913
935
  }],
@@ -920,7 +942,21 @@ const textDecorations = [
920
942
  };
921
943
  }
922
944
  }],
923
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": index.handler.bracket.percent(opacity) })]
945
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })]
946
+ ];
947
+
948
+ const svgUtilities = [
949
+ [/^fill-(.+)$/, colorResolver$1("fill", "fill")],
950
+ [/^fill-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
951
+ ["fill-none", { fill: "none" }],
952
+ [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
953
+ const v = utilities.handler.bracket.fraction.px.number(s);
954
+ if (v)
955
+ return { "stroke-width": v };
956
+ }],
957
+ [/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
958
+ [/^stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
959
+ ["stroke-none", { stroke: "none" }]
924
960
  ];
925
961
 
926
962
  const rules = [
@@ -930,7 +966,7 @@ const rules = [
930
966
  displays,
931
967
  opacity,
932
968
  bgColors,
933
- fillColors,
969
+ svgUtilities,
934
970
  borders,
935
971
  contents,
936
972
  fonts,
@@ -976,6 +1012,7 @@ const rules = [
976
1012
  boxSizing,
977
1013
  transitions,
978
1014
  transforms,
1015
+ willChange,
979
1016
  questionMark
980
1017
  ].flat(1);
981
1018
 
@@ -991,10 +1028,10 @@ exports.boxSizing = boxSizing;
991
1028
  exports.breaks = breaks;
992
1029
  exports.colorResolver = colorResolver$1;
993
1030
  exports.contents = contents;
1031
+ exports.cssProps = cssProps;
994
1032
  exports.cssVariables = cssVariables;
995
1033
  exports.cursors = cursors;
996
1034
  exports.displays = displays;
997
- exports.fillColors = fillColors;
998
1035
  exports.flex = flex;
999
1036
  exports.floats = floats;
1000
1037
  exports.fontSmoothings = fontSmoothings;
@@ -1022,6 +1059,7 @@ exports.ringOffsetColors = ringOffsetColors;
1022
1059
  exports.rings = rings;
1023
1060
  exports.rules = rules;
1024
1061
  exports.sizes = sizes;
1062
+ exports.svgUtilities = svgUtilities;
1025
1063
  exports.tabSizes = tabSizes;
1026
1064
  exports.textAligns = textAligns;
1027
1065
  exports.textColors = textColors;
@@ -1037,4 +1075,5 @@ exports.userSelects = userSelects;
1037
1075
  exports.varEmpty = varEmpty;
1038
1076
  exports.verticalAligns = verticalAligns;
1039
1077
  exports.whitespaces = whitespaces;
1078
+ exports.willChange = willChange;
1040
1079
  exports.zIndexes = zIndexes;