@unocss/preset-mini 0.15.3 → 0.16.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.
@@ -23,11 +23,13 @@ const parseColorUtil = (body, theme) => {
23
23
  if (!name)
24
24
  return;
25
25
  let color;
26
- const bracket = handler.bracket(main) || main;
27
- if (bracket.startsWith("#"))
28
- color = bracket.slice(1);
29
- if (bracket.startsWith("hex-"))
30
- color = bracket.slice(4);
26
+ const bracket = handler.bracket(main);
27
+ const bracketOrMain = bracket || main;
28
+ if (bracketOrMain.startsWith("#"))
29
+ color = bracketOrMain.slice(1);
30
+ if (bracketOrMain.startsWith("hex-"))
31
+ color = bracketOrMain.slice(4);
32
+ color = color || bracket;
31
33
  if (!color) {
32
34
  const colorData = theme.colors?.[name];
33
35
  if (typeof colorData === "string")
@@ -76,22 +78,6 @@ const textColors = [
76
78
  [/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
77
79
  [/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
78
80
  ];
79
- const textDecorationColors = [
80
- [/^underline-(.+)$/, (match, ctx) => {
81
- const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
82
- if (result) {
83
- return {
84
- "-webkit-text-decoration-color": result["text-decoration-color"],
85
- ...result
86
- };
87
- }
88
- }],
89
- [/^underline-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-line-opacity": handler.bracket.percent(opacity2) })]
90
- ];
91
- const textStrokeColors = [
92
- [/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
93
- [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity2) })]
94
- ];
95
81
  const bgColors = [
96
82
  [/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
97
83
  [/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
@@ -176,29 +162,21 @@ const placeholder = [
176
162
  ]
177
163
  ];
178
164
 
179
- const borderSizes = [
165
+ const borders = [
180
166
  [/^border$/, handlerBorder],
181
167
  [/^(?:border|b)(?:-([^-]+))?$/, handlerBorder],
182
- [/^(?:border|b)(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder]
183
- ];
184
- const borderRadius = [
185
- [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
186
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
187
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
188
- ];
189
- const borderStyles = [
168
+ [/^(?:border|b)(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder],
190
169
  ["border-solid", { "border-style": "solid" }],
191
170
  ["border-dashed", { "border-style": "dashed" }],
192
171
  ["border-dotted", { "border-style": "dotted" }],
193
172
  ["border-double", { "border-style": "double" }],
194
- ["border-none", { "border-style": "none" }]
173
+ ["border-none", { "border-style": "none" }],
174
+ [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
175
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
176
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded],
177
+ [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
178
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })]
195
179
  ];
196
- const borders = [
197
- borderSizes,
198
- borderColors,
199
- borderStyles,
200
- borderRadius
201
- ].flat(1);
202
180
  function handlerBorder([, a, b]) {
203
181
  const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
204
182
  const v = handler.bracket.px(s);
@@ -307,37 +285,27 @@ const transitions = [
307
285
  ];
308
286
 
309
287
  const flex = [
310
- ["flex-col", { "flex-direction": "column" }],
311
- ["flex-col-reverse", { "flex-direction": "column-reverse" }],
312
- ["flex-row", { "flex-direction": "row" }],
313
- ["flex-row-reverse", { "flex-direction": "row-reverse" }],
314
- ["flex-wrap", { "flex-wrap": "wrap" }],
315
- ["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
316
- ["flex-nowrap", { "flex-wrap": "nowrap" }],
288
+ ["flex", { display: "flex" }],
289
+ ["inline-flex", { display: "inline-flex" }],
290
+ ["flex-inline", { display: "inline-flex" }],
317
291
  ["flex-1", { flex: "1 1 0%" }],
318
292
  ["flex-auto", { flex: "1 1 auto" }],
319
293
  ["flex-initial", { flex: "0 1 auto" }],
320
294
  ["flex-none", { flex: "none" }],
321
295
  [/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
322
- ["flex-grow", { "flex-grow": 1 }],
323
- ["flex-grow-0", { "flex-grow": 0 }],
324
296
  ["flex-shrink", { "flex-shrink": 1 }],
325
297
  ["flex-shrink-0", { "flex-shrink": 0 }],
326
- ["flex", { display: "flex" }],
327
- ["inline-flex", { display: "inline-flex" }],
328
- ["flex-inline", { display: "inline-flex" }]
298
+ ["flex-grow", { "flex-grow": 1 }],
299
+ ["flex-grow-0", { "flex-grow": 0 }],
300
+ ["flex-row", { "flex-direction": "row" }],
301
+ ["flex-row-reverse", { "flex-direction": "row-reverse" }],
302
+ ["flex-col", { "flex-direction": "column" }],
303
+ ["flex-col-reverse", { "flex-direction": "column-reverse" }],
304
+ ["flex-wrap", { "flex-wrap": "wrap" }],
305
+ ["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
306
+ ["flex-nowrap", { "flex-wrap": "nowrap" }]
329
307
  ];
330
308
 
331
- const fontsFamilies = [
332
- [/^font-(\w+)$/, ([, d], { theme }) => {
333
- const font = theme.fontFamily?.[d];
334
- if (font) {
335
- return {
336
- "font-family": font
337
- };
338
- }
339
- }]
340
- ];
341
309
  const weightMap = {
342
310
  thin: "100",
343
311
  extralight: "200",
@@ -349,40 +317,48 @@ const weightMap = {
349
317
  extrabold: "800",
350
318
  black: "900"
351
319
  };
352
- const fontSizes = [
353
- [/^text-([^-]+)$/, ([, s = "base"], { theme }) => {
354
- const result = toArray(theme.fontSize?.[s] || handler.bracket.rem(s));
355
- if (result?.[0]) {
356
- const [size, height = "1"] = result;
320
+ const fonts = [
321
+ [/^font-(\w+)$/, ([, d], { theme }) => {
322
+ const font = theme.fontFamily?.[d];
323
+ if (font) {
357
324
  return {
358
- "font-size": size,
325
+ "font-family": font
326
+ };
327
+ }
328
+ }],
329
+ [/^text-(.+)$/, ([, s = "base"], { theme }) => {
330
+ const size = handler.bracket.rem(s);
331
+ if (size)
332
+ return { "font-size": size };
333
+ const themed = toArray(theme.fontSize?.[s]);
334
+ if (themed?.[0]) {
335
+ const [size2, height] = themed;
336
+ return {
337
+ "font-size": size2,
359
338
  "line-height": height
360
339
  };
361
340
  }
362
- }]
363
- ];
364
- const fontWeights = [
341
+ }],
342
+ [/^text-size-(.+)$/, ([, s]) => {
343
+ const raw = handler.bracket.rem(s);
344
+ if (raw)
345
+ return { "font-size": raw };
346
+ }],
365
347
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
366
348
  const v = weightMap[s] || handler.number(s);
367
349
  if (v)
368
350
  return { "font-weight": v };
369
- }]
370
- ];
371
- const leadings = [
351
+ }],
372
352
  [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
373
353
  const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
374
354
  if (v !== null)
375
355
  return { "line-height": v };
376
- }]
377
- ];
378
- const trackings = [
356
+ }],
379
357
  [/^tracking-([^-]+)$/, ([, s], { theme }) => {
380
358
  const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
381
359
  if (v !== null)
382
360
  return { "letter-spacing": v };
383
- }]
384
- ];
385
- const wordSpacings = [
361
+ }],
386
362
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
387
363
  const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
388
364
  if (v !== null)
@@ -402,20 +378,6 @@ const tabSizes = [
402
378
  }
403
379
  }]
404
380
  ];
405
- const textDecorationLengths = [
406
- [/^underline-([^-]+)$/, ([, s]) => {
407
- const v = s === "auto" ? s : handler.bracket.px(s);
408
- if (v != null)
409
- return { "text-decoration-thickness": v };
410
- }]
411
- ];
412
- const textDecorationOffsets = [
413
- [/^underline-offset-([^-]+)$/, ([, s]) => {
414
- const v = s === "auto" ? s : handler.bracket.px(s);
415
- if (v != null)
416
- return { "text-underline-offset": v };
417
- }]
418
- ];
419
381
  const textIndents = [
420
382
  [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
421
383
  const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s);
@@ -423,12 +385,14 @@ const textIndents = [
423
385
  return { "text-indent": v };
424
386
  }]
425
387
  ];
426
- const textStrokeWidths = [
388
+ const textStrokes = [
427
389
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
428
390
  const v = theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s);
429
391
  if (v != null)
430
392
  return { "-webkit-text-stroke-width": v };
431
- }]
393
+ }],
394
+ [/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
395
+ [/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
432
396
  ];
433
397
  const textShadows = [
434
398
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
@@ -437,11 +401,6 @@ const textShadows = [
437
401
  return { "text-shadow": v };
438
402
  }]
439
403
  ];
440
- const fonts = [
441
- fontsFamilies,
442
- fontSizes,
443
- fontWeights
444
- ].flat(1);
445
404
 
446
405
  const gaps = [
447
406
  [/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
@@ -486,12 +445,10 @@ const autoDirection = (selector, theme) => {
486
445
  const grids = [
487
446
  ["grid", { display: "grid" }],
488
447
  ["inline-grid", { display: "inline-grid" }],
489
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
490
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
491
- [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
492
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
493
- [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
494
- [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })],
448
+ [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
449
+ [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
450
+ [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
451
+ [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
495
452
  [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
496
453
  const key = d === "row" ? "grid-row" : "grid-column";
497
454
  let raw = handler.bracket(v);
@@ -508,13 +465,15 @@ const grids = [
508
465
  return { [key]: `span ${raw}/span ${raw}` };
509
466
  }
510
467
  }],
468
+ [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
511
469
  [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
512
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
513
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
514
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
515
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
516
470
  [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
517
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })]
471
+ [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
472
+ [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
473
+ [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
474
+ [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
475
+ [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
476
+ [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
518
477
  ];
519
478
 
520
479
  const overflowValues = [
@@ -528,6 +487,7 @@ const overflows = [
528
487
  [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
529
488
  ];
530
489
 
490
+ const basicSet = ["auto", "start", "end", "center", "stretch"];
531
491
  const positions = [
532
492
  ["relative", { position: "relative" }],
533
493
  ["absolute", { position: "absolute" }],
@@ -541,47 +501,42 @@ const justifies = [
541
501
  ["justify-center", { "justify-content": "center" }],
542
502
  ["justify-between", { "justify-content": "space-between" }],
543
503
  ["justify-around", { "justify-content": "space-around" }],
544
- ["justify-evenly", { "justify-content": "space-evenly" }]
504
+ ["justify-evenly", { "justify-content": "space-evenly" }],
505
+ ...basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]),
506
+ ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
545
507
  ];
546
508
  const orders = [
547
509
  [/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || handler.bracket.number(v) })]
548
510
  ];
549
- const basicSet = ["auto", "start", "end", "center", "stretch"];
550
- const justifyItems = basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]);
551
- const justifySelfs = basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }]);
552
- const alignContents = [
511
+ const alignments = [
553
512
  ["content-start", { "align-content": "flex-start" }],
554
513
  ["content-end", { "align-content": "flex-end" }],
555
514
  ["content-center", { "align-content": "center" }],
556
515
  ["content-between", { "align-content": "space-between" }],
557
516
  ["content-around", { "align-content": "space-around" }],
558
- ["content-evenly", { "align-content": "space-evenly" }]
559
- ];
560
- const alignItems = [
517
+ ["content-evenly", { "align-content": "space-evenly" }],
561
518
  ["items-start", { "align-items": "flex-start" }],
562
519
  ["items-end", { "align-items": "flex-end" }],
563
520
  ["items-center", { "align-items": "center" }],
564
521
  ["items-baseline", { "align-items": "baseline" }],
565
- ["items-stretch", { "align-items": "stretch" }]
566
- ];
567
- const alignSelfs = [
522
+ ["items-stretch", { "align-items": "stretch" }],
568
523
  ["self-auto", { "align-self": "auto" }],
569
524
  ["self-start", { "align-self": "flex-start" }],
570
525
  ["self-end", { "align-self": "flex-end" }],
571
526
  ["self-center", { "align-self": "center" }],
572
527
  ["self-stretch", { "align-items": "stretch" }]
573
528
  ];
574
- const placeContents = [
529
+ const placements = [
575
530
  ["place-content-start", { "place-content": "start" }],
576
531
  ["place-content-end", { "place-content": "end" }],
577
532
  ["place-content-center", { "place-content": "center" }],
578
533
  ["place-content-between", { "place-content": "space-between" }],
579
534
  ["place-content-around", { "place-content": "space-around" }],
580
535
  ["place-content-evenly", { "place-content": "space-evenly" }],
581
- ["place-content-stretch", { "place-content": "stretch" }]
536
+ ["place-content-stretch", { "place-content": "stretch" }],
537
+ ...basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]),
538
+ ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
582
539
  ];
583
- const placeItems = basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]);
584
- const placeSelfs = basicSet.map((i) => [`place-self-${i}`, { "place-self": i }]);
585
540
  function handleInsetValue(v) {
586
541
  return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.rem(v);
587
542
  }
@@ -772,17 +727,6 @@ const textTransforms = [
772
727
  ["case-capital", { "text-transform": "capitalize" }],
773
728
  ["case-normal", { "text-transform": "none" }]
774
729
  ];
775
- const textDecorations = [
776
- ["underline", { "text-decoration": "underline" }],
777
- ["line-through", { "text-decoration": "line-through" }],
778
- ["no-underline", { "text-decoration": "none" }]
779
- ];
780
- const textDecorationStyles = [
781
- ["underline-solid", { "text-decoration-style": "solid" }],
782
- ["underline-double", { "text-decoration-style": "double" }],
783
- ["underline-dotted", { "text-decoration-style": "dotted" }],
784
- ["underline-dashed", { "text-decoration-style": "dashed" }]
785
- ];
786
730
  const fontStyles = [
787
731
  ["italic", { "font-style": "italic" }],
788
732
  ["not-italic", { "font-style": "normal" }]
@@ -800,6 +744,14 @@ const fontSmoothings = [
800
744
  }]
801
745
  ];
802
746
 
747
+ const transformGpu = {
748
+ 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))",
749
+ [CONTROL_BYPASS_PSEUDO]: ""
750
+ };
751
+ const transformCpu = {
752
+ 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))",
753
+ [CONTROL_BYPASS_PSEUDO]: ""
754
+ };
803
755
  const transformBase = {
804
756
  "--un-rotate": 0,
805
757
  "--un-scale-x": 1,
@@ -810,8 +762,7 @@ const transformBase = {
810
762
  "--un-translate-x": 0,
811
763
  "--un-translate-y": 0,
812
764
  "--un-translate-z": 0,
813
- "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))",
814
- [CONTROL_BYPASS_PSEUDO]: ""
765
+ ...transformCpu
815
766
  };
816
767
  const transforms = [
817
768
  ["transform", transformBase],
@@ -821,6 +772,9 @@ const transforms = [
821
772
  [/^scale()-([^-]+)$/, handleScale],
822
773
  [/^scale-([xyz])-([^-]+)$/, handleScale],
823
774
  [/^rotate-([^-]+)(?:deg)?$/, handleRotate],
775
+ ["transform-gpu", transformGpu],
776
+ ["transform-cpu", transformCpu],
777
+ ["transform-none", { transform: "none" }],
824
778
  ["origin-center", { "transform-origin": "center" }],
825
779
  ["origin-top", { "transform-origin": "top" }],
826
780
  ["origin-top-right", { "transform-origin": "top right" }],
@@ -872,17 +826,8 @@ const variablesAbbrMap = {
872
826
  "break": "word-break",
873
827
  "color": "color",
874
828
  "case": "text-transform",
875
- "write": "writing-mode",
876
- "write-orient": "text-orientation",
877
829
  "origin": "transform-origin",
878
830
  "bg": "background-color",
879
- "bg-blend": "background-blend-mode",
880
- "bg-clip": "-webkit-background-clip",
881
- "bg-gradient": "linear-gradient",
882
- "bg-origin-border": "background-origin",
883
- "bg-position": "background-position",
884
- "bg-repeat": "background-repeat",
885
- "bg-size": "background-size",
886
831
  "bg-opacity": "background-opacity",
887
832
  "tab": "tab-size",
888
833
  "underline": "text-decoration-thickness",
@@ -897,9 +842,7 @@ const variablesAbbrMap = {
897
842
  "content": "align-content",
898
843
  "items": "align-items",
899
844
  "self": "align-self",
900
- "object": "object-fit",
901
- "mix-blend": "mix-blend-mode",
902
- "animate-speed": "animation-speed"
845
+ "object": "object-fit"
903
846
  };
904
847
  const cssVariables = [[
905
848
  /^(.+)-\$(.+)$/,
@@ -924,6 +867,33 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
924
867
  ]
925
868
  ];
926
869
 
870
+ const textDecorations = [
871
+ ["underline", { "text-decoration": "underline" }],
872
+ ["line-through", { "text-decoration": "line-through" }],
873
+ ["no-underline", { "text-decoration": "none" }],
874
+ ["decoration-underline", { "text-decoration": "underline" }],
875
+ ["decoration-line-through", { "text-decoration": "line-through" }],
876
+ ["decoration-none", { "text-decoration": "none" }],
877
+ [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
878
+ [/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : handler.bracket.px(s) })],
879
+ [/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
880
+ [/^underline-offset-([^-]+)$/, ([, s]) => {
881
+ const v = s === "auto" ? s : handler.bracket.px(s);
882
+ if (v != null)
883
+ return { "text-underline-offset": v };
884
+ }],
885
+ [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
886
+ const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
887
+ if (result) {
888
+ return {
889
+ "-webkit-text-decoration-color": result["text-decoration-color"],
890
+ ...result
891
+ };
892
+ }
893
+ }],
894
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })]
895
+ ];
896
+
927
897
  const rules = [
928
898
  cssVariables,
929
899
  paddings,
@@ -939,12 +909,7 @@ const rules = [
939
909
  textIndents,
940
910
  textOverflows,
941
911
  textDecorations,
942
- textDecorationStyles,
943
- textDecorationColors,
944
- textDecorationLengths,
945
- textDecorationOffsets,
946
- textStrokeWidths,
947
- textStrokeColors,
912
+ textStrokes,
948
913
  textShadows,
949
914
  textTransforms,
950
915
  textAligns,
@@ -967,9 +932,6 @@ const rules = [
967
932
  userSelects,
968
933
  whitespaces,
969
934
  breaks,
970
- trackings,
971
- wordSpacings,
972
- leadings,
973
935
  overflows,
974
936
  outline,
975
937
  appearance,
@@ -977,14 +939,8 @@ const rules = [
977
939
  positions,
978
940
  orders,
979
941
  justifies,
980
- justifyItems,
981
- justifySelfs,
982
- alignContents,
983
- alignItems,
984
- alignSelfs,
985
- placeContents,
986
- placeItems,
987
- placeSelfs,
942
+ alignments,
943
+ placements,
988
944
  insets,
989
945
  floats,
990
946
  zIndexes,
@@ -994,4 +950,4 @@ const rules = [
994
950
  questionMark
995
951
  ].flat(1);
996
952
 
997
- export { userSelects as $, justifies as A, orders as B, justifyItems as C, justifySelfs as D, alignContents as E, alignItems as F, alignSelfs as G, placeContents as H, placeItems as I, placeSelfs as J, insets as K, floats as L, zIndexes as M, boxSizing as N, questionMark as O, rings as P, boxShadows as Q, sizes as R, aspectRatio as S, paddings as T, margins as U, varEmpty as V, displays as W, appearances as X, cursors as Y, pointerEvents as Z, resizes as _, appearance as a, whitespaces as a0, contents as a1, breaks as a2, textOverflows as a3, textTransforms as a4, textDecorations as a5, textDecorationStyles as a6, fontStyles as a7, fontSmoothings as a8, transforms as a9, transitions as aa, fontsFamilies as ab, fontSizes as ac, fontWeights as ad, leadings as ae, trackings as af, wordSpacings as ag, tabSizes as ah, textDecorationLengths as ai, textDecorationOffsets as aj, textIndents as ak, textStrokeWidths as al, textShadows as am, fonts as an, cssVariables as ao, borderSizes as b, borderRadius as c, borderStyles as d, borders as e, parseColorUtil as f, colorResolver$1 as g, opacity as h, textColors as i, textDecorationColors as j, textStrokeColors as k, bgColors as l, borderColors as m, ringColors as n, outline as o, placeholder as p, ringOffsetColors as q, rules as r, fillColors as s, textAligns as t, flex as u, verticalAligns as v, gaps as w, grids as x, overflows as y, positions as z };
953
+ export { tabSizes as $, floats as A, zIndexes as B, boxSizing as C, questionMark as D, rings as E, boxShadows as F, sizes as G, aspectRatio as H, paddings as I, margins as J, varEmpty as K, displays as L, appearances as M, cursors as N, pointerEvents as O, resizes as P, userSelects as Q, whitespaces as R, contents as S, breaks as T, textOverflows as U, textTransforms as V, fontStyles as W, fontSmoothings as X, transforms as Y, transitions as Z, fonts as _, appearance as a, textIndents as a0, textStrokes as a1, textShadows as a2, cssVariables as a3, textDecorations as a4, borders as b, parseColorUtil as c, colorResolver$1 as d, opacity as e, textColors as f, bgColors as g, borderColors as h, ringColors as i, ringOffsetColors as j, fillColors as k, flex as l, gaps as m, grids as n, outline as o, placeholder as p, overflows as q, rules as r, positions as s, textAligns as t, justifies as u, verticalAligns as v, orders as w, alignments as x, placements as y, insets as z };
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const core = require('@unocss/core');
4
+
3
5
  const directionMap = {
4
6
  "l": ["-left"],
5
7
  "r": ["-right"],
@@ -36,9 +38,12 @@ const xyzMap = {
36
38
 
37
39
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
38
40
  const numberRE = /^(-?[0-9.]+)$/i;
41
+ const unitOnlyRE = /^(px)$/i;
39
42
  function rem(str) {
40
43
  if (str === "auto" || str === "a")
41
44
  return "auto";
45
+ if (str.match(unitOnlyRE))
46
+ return `1${str}`;
42
47
  const match = str.match(numberWithUnitRE);
43
48
  if (!match)
44
49
  return;
@@ -50,6 +55,8 @@ function rem(str) {
50
55
  return `${num / 4}rem`;
51
56
  }
52
57
  function px(str) {
58
+ if (str.match(unitOnlyRE))
59
+ return `1${str}`;
53
60
  const match = str.match(numberWithUnitRE);
54
61
  if (!match)
55
62
  return;
@@ -106,7 +113,7 @@ function global(str) {
106
113
  return str;
107
114
  }
108
115
 
109
- const handlers = {
116
+ const valueHandlers = {
110
117
  __proto__: null,
111
118
  rem: rem,
112
119
  px: px,
@@ -119,51 +126,17 @@ const handlers = {
119
126
  global: global
120
127
  };
121
128
 
122
- const handlersNames = Object.keys(handlers);
123
- const handler = function(str) {
124
- const s = this.__options?.sequence || [];
125
- this.__options.sequence = [];
126
- for (const n of s) {
127
- const res = handlers[n](str);
128
- if (res != null)
129
- return res;
130
- }
131
- return void 0;
132
- };
133
- function addProcessor(that, name) {
134
- if (!that.__options) {
135
- that.__options = {
136
- sequence: []
137
- };
138
- }
139
- that.__options.sequence.push(name);
140
- return that;
141
- }
142
- handlersNames.forEach((i) => {
143
- Object.defineProperty(handler, i, {
144
- enumerable: true,
145
- get() {
146
- return addProcessor(this, i);
147
- }
148
- });
149
- });
129
+ const handler = core.createValueHandler(valueHandlers);
130
+ const h = handler;
150
131
 
151
132
  function capitalize(str) {
152
133
  return str.charAt(0).toUpperCase() + str.slice(1);
153
134
  }
154
135
 
155
- exports.bracket = bracket;
156
136
  exports.capitalize = capitalize;
157
137
  exports.cornerMap = cornerMap;
158
- exports.cssvar = cssvar;
159
138
  exports.directionMap = directionMap;
160
- exports.fraction = fraction;
161
- exports.global = global;
139
+ exports.h = h;
162
140
  exports.handler = handler;
163
- exports.handlersNames = handlersNames;
164
- exports.number = number;
165
- exports.percent = percent;
166
- exports.px = px;
167
- exports.rem = rem;
168
- exports.time = time;
141
+ exports.valueHandlers = valueHandlers;
169
142
  exports.xyzMap = xyzMap;