@unocss/preset-mini 0.29.0 → 0.29.3

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.
@@ -9,7 +9,7 @@ const verticalAlignAlias = {
9
9
  btm: "bottom"
10
10
  };
11
11
  const verticalAligns = [
12
- [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
12
+ [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v }), { autocomplete: "(vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)" }]
13
13
  ];
14
14
  const textAligns = [
15
15
  ["text-center", { "text-align": "center" }],
@@ -19,11 +19,11 @@ const textAligns = [
19
19
  ];
20
20
 
21
21
  const outline = [
22
- [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
23
- [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
24
- [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
22
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
23
+ [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
24
+ [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
25
25
  ["outline", { "outline-style": "solid" }],
26
- [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
26
+ [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c }), { autocomplete: "outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)" }],
27
27
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
28
28
  ];
29
29
  const appearance = [
@@ -48,22 +48,22 @@ const borders = [
48
48
  [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
49
49
  [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
50
50
  [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
51
- [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: "(border|b)-<num>" }],
51
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
52
52
  [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
53
53
  [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
54
54
  [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
55
55
  [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
56
- [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: "(border|b)-$colors" }],
56
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
57
57
  [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
58
58
  [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
59
59
  [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
60
60
  [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
61
- [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<precent>" }],
61
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
62
62
  [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
63
63
  [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
64
64
  [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
65
65
  [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
66
- [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded-|rd-)<num>", "(rounded-|rd-)<num>"] }],
66
+ [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded|rd)", "(border|b)-(rounded|rd)-<num>", "(rounded|rd)", "(rounded|rd)-<num>"] }],
67
67
  [/^(?:border-|b-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
68
68
  [/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
69
69
  [/^(?:border-|b-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
@@ -139,11 +139,11 @@ const opacity = [
139
139
  ];
140
140
  const textColors = [
141
141
  [/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
142
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<precent>" }]
142
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
143
143
  ];
144
144
  const bgColors = [
145
- [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
146
- [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
145
+ [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg"), { autocomplete: "bg-$colors" }],
146
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
147
147
  ];
148
148
 
149
149
  const transitionPropertyGroup = {
@@ -568,7 +568,7 @@ const rings = [
568
568
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
569
569
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
570
570
  [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
571
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<precent>" }],
571
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
572
572
  [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
573
573
  [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) })],
574
574
  ["ring-inset", { "--un-ring-inset": "inset" }]
@@ -640,9 +640,9 @@ const aspectRatio = [
640
640
  ];
641
641
 
642
642
  const paddings = [
643
- [/^pa?()-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
643
+ [/^pa?()-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
644
644
  [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
645
- [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")],
645
+ [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
646
646
  [/^p-(block|inline)-(-?.+)$/, utilities.directionSize("padding")],
647
647
  [/^p-?([bi][se])-?(-?.+)$/, utilities.directionSize("padding")]
648
648
  ];
@@ -838,9 +838,9 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
838
838
  ];
839
839
 
840
840
  const textDecorations = [
841
- [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
842
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px(s) })],
843
- [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
841
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
842
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
843
+ [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
844
844
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
845
845
  const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
846
846
  if (result) {
@@ -849,10 +849,10 @@ const textDecorations = [
849
849
  ...result
850
850
  };
851
851
  }
852
- }],
853
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
854
- [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utilities.handler.auto.bracket.cssvar.px(s) })],
855
- [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
852
+ }, { autocomplete: "(underline|decoration)-$colors" }],
853
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
854
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utilities.handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
855
+ [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d }), { autocomplete: "(underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)" }],
856
856
  ["no-underline", { "text-decoration": "none" }],
857
857
  ["decoration-none", { "text-decoration": "none" }]
858
858
  ];
@@ -7,7 +7,7 @@ const verticalAlignAlias = {
7
7
  btm: "bottom"
8
8
  };
9
9
  const verticalAligns = [
10
- [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
10
+ [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v }), { autocomplete: "(vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)" }]
11
11
  ];
12
12
  const textAligns = [
13
13
  ["text-center", { "text-align": "center" }],
@@ -17,11 +17,11 @@ const textAligns = [
17
17
  ];
18
18
 
19
19
  const outline = [
20
- [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) })],
21
- [/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
22
- [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) })],
20
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
21
+ [/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
22
+ [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
23
23
  ["outline", { "outline-style": "solid" }],
24
- [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
24
+ [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c }), { autocomplete: "outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)" }],
25
25
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
26
26
  ];
27
27
  const appearance = [
@@ -46,22 +46,22 @@ const borders = [
46
46
  [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
47
47
  [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
48
48
  [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
49
- [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: "(border|b)-<num>" }],
49
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
50
50
  [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
51
51
  [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
52
52
  [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
53
53
  [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
54
- [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: "(border|b)-$colors" }],
54
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
55
55
  [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
56
56
  [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
57
57
  [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
58
58
  [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
59
- [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<precent>" }],
59
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
60
60
  [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
61
61
  [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
62
62
  [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
63
63
  [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
64
- [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded-|rd-)<num>", "(rounded-|rd-)<num>"] }],
64
+ [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded|rd)", "(border|b)-(rounded|rd)-<num>", "(rounded|rd)", "(rounded|rd)-<num>"] }],
65
65
  [/^(?:border-|b-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
66
66
  [/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
67
67
  [/^(?:border-|b-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
@@ -137,11 +137,11 @@ const opacity = [
137
137
  ];
138
138
  const textColors = [
139
139
  [/^(?:text|color|c)-(.+)$/, colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
140
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<precent>" }]
140
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
141
141
  ];
142
142
  const bgColors = [
143
- [/^bg-(.+)$/, colorResolver("background-color", "bg")],
144
- [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
143
+ [/^bg-(.+)$/, colorResolver("background-color", "bg"), { autocomplete: "bg-$colors" }],
144
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
145
145
  ];
146
146
 
147
147
  const transitionPropertyGroup = {
@@ -566,7 +566,7 @@ const rings = [
566
566
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
567
567
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) })],
568
568
  [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
569
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<precent>" }],
569
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
570
570
  [/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
571
571
  [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) })],
572
572
  ["ring-inset", { "--un-ring-inset": "inset" }]
@@ -638,9 +638,9 @@ const aspectRatio = [
638
638
  ];
639
639
 
640
640
  const paddings = [
641
- [/^pa?()-?(-?.+)$/, directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
641
+ [/^pa?()-?(-?.+)$/, directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
642
642
  [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
643
- [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
643
+ [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
644
644
  [/^p-(block|inline)-(-?.+)$/, directionSize("padding")],
645
645
  [/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
646
646
  ];
@@ -836,9 +836,9 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
836
836
  ];
837
837
 
838
838
  const textDecorations = [
839
- [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
840
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? handler.bracket.cssvar.px(s) })],
841
- [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
839
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
840
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
841
+ [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
842
842
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
843
843
  const result = colorResolver("text-decoration-color", "line")(match, ctx);
844
844
  if (result) {
@@ -847,10 +847,10 @@ const textDecorations = [
847
847
  ...result
848
848
  };
849
849
  }
850
- }],
851
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
852
- [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? handler.auto.bracket.cssvar.px(s) })],
853
- [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
850
+ }, { autocomplete: "(underline|decoration)-$colors" }],
851
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
852
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
853
+ [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d }), { autocomplete: "(underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)" }],
854
854
  ["no-underline", { "text-decoration": "none" }],
855
855
  ["decoration-none", { "text-decoration": "none" }]
856
856
  ];
@@ -10,40 +10,43 @@ const calcMaxWidthBySize = (size) => {
10
10
  const maxWidth = parseFloat(value) - 0.1;
11
11
  return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
12
12
  };
13
- const variantBreakpoints = (matcher, { theme }) => {
14
- const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
15
- for (const [point, size, idx] of variantEntries) {
16
- if (!regexCache[point])
17
- regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
18
- const match = matcher.match(regexCache[point]);
19
- if (!match)
20
- continue;
21
- const [, pre] = match;
22
- const m = matcher.slice(pre.length);
23
- if (m === "container")
24
- continue;
25
- const isLtPrefix = pre.startsWith("lt-");
26
- const isAtPrefix = pre.startsWith("at-");
27
- let order = 1e3;
28
- if (isLtPrefix) {
29
- order -= idx + 1;
13
+ const variantBreakpoints = {
14
+ match(matcher, { theme }) {
15
+ const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
16
+ for (const [point, size, idx] of variantEntries) {
17
+ if (!regexCache[point])
18
+ regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
19
+ const match = matcher.match(regexCache[point]);
20
+ if (!match)
21
+ continue;
22
+ const [, pre] = match;
23
+ const m = matcher.slice(pre.length);
24
+ if (m === "container")
25
+ continue;
26
+ const isLtPrefix = pre.startsWith("lt-");
27
+ const isAtPrefix = pre.startsWith("at-");
28
+ let order = 1e3;
29
+ if (isLtPrefix) {
30
+ order -= idx + 1;
31
+ return {
32
+ matcher: m,
33
+ parent: [`@media (max-width: ${calcMaxWidthBySize(size)})`, order]
34
+ };
35
+ }
36
+ order += idx + 1;
37
+ if (isAtPrefix && idx < variantEntries.length - 1) {
38
+ return {
39
+ matcher: m,
40
+ parent: [`@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`, order]
41
+ };
42
+ }
30
43
  return {
31
44
  matcher: m,
32
- parent: [`@media (max-width: ${calcMaxWidthBySize(size)})`, order]
45
+ parent: [`@media (min-width: ${size})`, order]
33
46
  };
34
47
  }
35
- order += idx + 1;
36
- if (isAtPrefix && idx < variantEntries.length - 1) {
37
- return {
38
- matcher: m,
39
- parent: [`@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`, order]
40
- };
41
- }
42
- return {
43
- matcher: m,
44
- parent: [`@media (min-width: ${size})`, order]
45
- };
46
- }
48
+ },
49
+ autocomplete: "(at-|lt-|)$breakpoints:"
47
50
  };
48
51
 
49
52
  const scopeMatcher = (strict, name, template) => {
@@ -250,15 +253,18 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
250
253
  }
251
254
  };
252
255
  };
253
- const variantPseudoElements = (input) => {
254
- const match = input.match(PseudoElementsRE);
255
- if (match) {
256
- const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
257
- return {
258
- matcher: input.slice(match[0].length),
259
- selector: (s) => `${s}${pseudo}`
260
- };
261
- }
256
+ const variantPseudoElements = {
257
+ match: (input) => {
258
+ const match = input.match(PseudoElementsRE);
259
+ if (match) {
260
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
261
+ return {
262
+ matcher: input.slice(match[0].length),
263
+ selector: (s) => `${s}${pseudo}`
264
+ };
265
+ }
266
+ },
267
+ autocomplete: `(${PseudoElementsStr}):`
262
268
  };
263
269
  const variantPseudoClasses = {
264
270
  match: (input) => {
@@ -272,7 +278,8 @@ const variantPseudoClasses = {
272
278
  };
273
279
  }
274
280
  },
275
- multiPass: true
281
+ multiPass: true,
282
+ autocomplete: `(${PseudoClassesStr}):`
276
283
  };
277
284
  const variantPseudoClassFunctions = {
278
285
  match: (input) => {
@@ -286,7 +293,8 @@ const variantPseudoClassFunctions = {
286
293
  };
287
294
  }
288
295
  },
289
- multiPass: true
296
+ multiPass: true,
297
+ autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
290
298
  };
291
299
  const variantTaggedPseudoClasses = (options = {}) => {
292
300
  const attributify = !!options?.attributifyPseudo;
@@ -8,40 +8,43 @@ const calcMaxWidthBySize = (size) => {
8
8
  const maxWidth = parseFloat(value) - 0.1;
9
9
  return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
10
10
  };
11
- const variantBreakpoints = (matcher, { theme }) => {
12
- const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
13
- for (const [point, size, idx] of variantEntries) {
14
- if (!regexCache[point])
15
- regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
16
- const match = matcher.match(regexCache[point]);
17
- if (!match)
18
- continue;
19
- const [, pre] = match;
20
- const m = matcher.slice(pre.length);
21
- if (m === "container")
22
- continue;
23
- const isLtPrefix = pre.startsWith("lt-");
24
- const isAtPrefix = pre.startsWith("at-");
25
- let order = 1e3;
26
- if (isLtPrefix) {
27
- order -= idx + 1;
11
+ const variantBreakpoints = {
12
+ match(matcher, { theme }) {
13
+ const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
14
+ for (const [point, size, idx] of variantEntries) {
15
+ if (!regexCache[point])
16
+ regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
17
+ const match = matcher.match(regexCache[point]);
18
+ if (!match)
19
+ continue;
20
+ const [, pre] = match;
21
+ const m = matcher.slice(pre.length);
22
+ if (m === "container")
23
+ continue;
24
+ const isLtPrefix = pre.startsWith("lt-");
25
+ const isAtPrefix = pre.startsWith("at-");
26
+ let order = 1e3;
27
+ if (isLtPrefix) {
28
+ order -= idx + 1;
29
+ return {
30
+ matcher: m,
31
+ parent: [`@media (max-width: ${calcMaxWidthBySize(size)})`, order]
32
+ };
33
+ }
34
+ order += idx + 1;
35
+ if (isAtPrefix && idx < variantEntries.length - 1) {
36
+ return {
37
+ matcher: m,
38
+ parent: [`@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`, order]
39
+ };
40
+ }
28
41
  return {
29
42
  matcher: m,
30
- parent: [`@media (max-width: ${calcMaxWidthBySize(size)})`, order]
43
+ parent: [`@media (min-width: ${size})`, order]
31
44
  };
32
45
  }
33
- order += idx + 1;
34
- if (isAtPrefix && idx < variantEntries.length - 1) {
35
- return {
36
- matcher: m,
37
- parent: [`@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`, order]
38
- };
39
- }
40
- return {
41
- matcher: m,
42
- parent: [`@media (min-width: ${size})`, order]
43
- };
44
- }
46
+ },
47
+ autocomplete: "(at-|lt-|)$breakpoints:"
45
48
  };
46
49
 
47
50
  const scopeMatcher = (strict, name, template) => {
@@ -248,15 +251,18 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
248
251
  }
249
252
  };
250
253
  };
251
- const variantPseudoElements = (input) => {
252
- const match = input.match(PseudoElementsRE);
253
- if (match) {
254
- const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
255
- return {
256
- matcher: input.slice(match[0].length),
257
- selector: (s) => `${s}${pseudo}`
258
- };
259
- }
254
+ const variantPseudoElements = {
255
+ match: (input) => {
256
+ const match = input.match(PseudoElementsRE);
257
+ if (match) {
258
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
259
+ return {
260
+ matcher: input.slice(match[0].length),
261
+ selector: (s) => `${s}${pseudo}`
262
+ };
263
+ }
264
+ },
265
+ autocomplete: `(${PseudoElementsStr}):`
260
266
  };
261
267
  const variantPseudoClasses = {
262
268
  match: (input) => {
@@ -270,7 +276,8 @@ const variantPseudoClasses = {
270
276
  };
271
277
  }
272
278
  },
273
- multiPass: true
279
+ multiPass: true,
280
+ autocomplete: `(${PseudoClassesStr}):`
274
281
  };
275
282
  const variantPseudoClassFunctions = {
276
283
  match: (input) => {
@@ -284,7 +291,8 @@ const variantPseudoClassFunctions = {
284
291
  };
285
292
  }
286
293
  },
287
- multiPass: true
294
+ multiPass: true,
295
+ autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
288
296
  };
289
297
  const variantTaggedPseudoClasses = (options = {}) => {
290
298
  const attributify = !!options?.attributifyPseudo;
@@ -4,26 +4,32 @@ const core = require('@unocss/core');
4
4
 
5
5
  const variantMatcher = (name, selector) => {
6
6
  const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
7
- return (input) => {
8
- const match = input.match(re);
9
- if (match) {
10
- return {
11
- matcher: input.slice(match[0].length),
12
- selector
13
- };
14
- }
7
+ return {
8
+ match: (input) => {
9
+ const match = input.match(re);
10
+ if (match) {
11
+ return {
12
+ matcher: input.slice(match[0].length),
13
+ selector
14
+ };
15
+ }
16
+ },
17
+ autocomplete: `${name}:`
15
18
  };
16
19
  };
17
20
  const variantParentMatcher = (name, parent) => {
18
21
  const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
19
- return (input) => {
20
- const match = input.match(re);
21
- if (match) {
22
- return {
23
- matcher: input.slice(match[0].length),
24
- parent
25
- };
26
- }
22
+ return {
23
+ match: (input) => {
24
+ const match = input.match(re);
25
+ if (match) {
26
+ return {
27
+ matcher: input.slice(match[0].length),
28
+ parent
29
+ };
30
+ }
31
+ },
32
+ autocomplete: `${name}:`
27
33
  };
28
34
  };
29
35
 
@@ -2,26 +2,32 @@ import { escapeRegExp } from '@unocss/core';
2
2
 
3
3
  const variantMatcher = (name, selector) => {
4
4
  const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
5
- return (input) => {
6
- const match = input.match(re);
7
- if (match) {
8
- return {
9
- matcher: input.slice(match[0].length),
10
- selector
11
- };
12
- }
5
+ return {
6
+ match: (input) => {
7
+ const match = input.match(re);
8
+ if (match) {
9
+ return {
10
+ matcher: input.slice(match[0].length),
11
+ selector
12
+ };
13
+ }
14
+ },
15
+ autocomplete: `${name}:`
13
16
  };
14
17
  };
15
18
  const variantParentMatcher = (name, parent) => {
16
19
  const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
17
- return (input) => {
18
- const match = input.match(re);
19
- if (match) {
20
- return {
21
- matcher: input.slice(match[0].length),
22
- parent
23
- };
24
- }
20
+ return {
21
+ match: (input) => {
22
+ const match = input.match(re);
23
+ if (match) {
24
+ return {
25
+ matcher: input.slice(match[0].length),
26
+ parent
27
+ };
28
+ }
29
+ },
30
+ autocomplete: `${name}:`
25
31
  };
26
32
  };
27
33
 
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { RGBAColorValue, CSSColorValue, VariantHandler } from '@unocss/core';
2
+ import { RGBAColorValue, CSSColorValue, VariantObject } from '@unocss/core';
3
3
  export { c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor } from './utilities-820bcff8.js';
4
4
  import './types-f7b2c653.js';
5
5
 
@@ -65,10 +65,10 @@ declare namespace handlers {
65
65
  };
66
66
  }
67
67
 
68
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "cssvar" | "time" | "degree" | "global" | "properties">;
69
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "cssvar" | "time" | "degree" | "global" | "properties">;
68
+ declare const handler: _unocss_core.ValueHandler<"number" | "global" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "cssvar" | "time" | "degree" | "properties">;
69
+ declare const h: _unocss_core.ValueHandler<"number" | "global" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "cssvar" | "time" | "degree" | "properties">;
70
70
 
71
- declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
72
- declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
71
+ declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => VariantObject;
72
+ declare const variantParentMatcher: (name: string, parent: string) => VariantObject;
73
73
 
74
74
  export { colorToString, cornerMap, directionMap, getComponents, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
@@ -9,10 +9,10 @@ declare const variantBreakpoints: Variant<Theme>;
9
9
 
10
10
  declare const variantCombinators: Variant[];
11
11
 
12
- declare const variantPrint: VariantFunction;
12
+ declare const variantPrint: Variant;
13
13
  declare const variantCustomMedia: VariantFunction;
14
14
 
15
- declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => VariantFunction[];
15
+ declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => Variant[];
16
16
 
17
17
  declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
18
18
 
@@ -24,7 +24,7 @@ declare const variantScope: Variant;
24
24
  declare const variantImportant: Variant;
25
25
  declare const variantNegative: Variant;
26
26
 
27
- declare const variantPseudoElements: VariantFunction;
27
+ declare const variantPseudoElements: VariantObject;
28
28
  declare const variantPseudoClasses: VariantObject;
29
29
  declare const variantPseudoClassFunctions: VariantObject;
30
30
  declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.29.0",
3
+ "version": "0.29.3",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  ],
62
62
  "sideEffects": false,
63
63
  "dependencies": {
64
- "@unocss/core": "0.29.0"
64
+ "@unocss/core": "0.29.3"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",