@unocss/preset-mini 0.57.7 → 0.58.1

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.
Files changed (48) hide show
  1. package/dist/colors.d.cts +1 -1
  2. package/dist/colors.d.mts +1 -1
  3. package/dist/colors.d.ts +1 -1
  4. package/dist/index.cjs +12 -12
  5. package/dist/index.d.cts +6 -6
  6. package/dist/index.d.mts +6 -6
  7. package/dist/index.d.ts +6 -6
  8. package/dist/index.mjs +7 -7
  9. package/dist/rules.cjs +50 -972
  10. package/dist/rules.d.cts +2 -6
  11. package/dist/rules.d.mts +2 -6
  12. package/dist/rules.d.ts +2 -6
  13. package/dist/rules.mjs +5 -931
  14. package/dist/shared/{preset-mini.MACvs-wn.cjs → preset-mini.-3Qybdh5.cjs} +49 -39
  15. package/dist/shared/{preset-mini.Stl9mkMB.mjs → preset-mini.0CcynBZx.mjs} +45 -26
  16. package/dist/shared/{preset-mini.dPVVIvNm.mjs → preset-mini.0UJFjS_1.mjs} +16 -6
  17. package/dist/shared/{preset-mini.XmVozI6N.d.mts → preset-mini.20fUBpHS.d.cts} +4 -3
  18. package/dist/shared/{preset-mini.QW22c5Df.d.ts → preset-mini.8w2rXvMk.d.ts} +4 -3
  19. package/dist/shared/preset-mini.AVP8I7_j.mjs +747 -0
  20. package/dist/shared/preset-mini.ORVb5Lu8.mjs +978 -0
  21. package/dist/shared/{preset-mini.ImRm63ih.cjs → preset-mini.UhMMbd34.cjs} +44 -26
  22. package/dist/shared/{preset-mini.4DxDu2I8.d.mts → preset-mini.YxT4AwuI.d.cts} +1 -1
  23. package/dist/shared/preset-mini.fgwIVvur.cjs +322 -0
  24. package/dist/shared/preset-mini.g6cWGZM2.cjs +1021 -0
  25. package/dist/shared/{preset-mini.5daNC9yh.d.ts → preset-mini.gVNz4b9u.d.ts} +1 -1
  26. package/dist/shared/{preset-mini.7XoWRZIl.d.mts → preset-mini.hpPpX7ws.d.cts} +1 -1
  27. package/dist/shared/{preset-mini.7XoWRZIl.d.ts → preset-mini.hpPpX7ws.d.mts} +1 -1
  28. package/dist/shared/{preset-mini.7XoWRZIl.d.cts → preset-mini.hpPpX7ws.d.ts} +1 -1
  29. package/dist/shared/preset-mini.jXC5Sr98.cjs +772 -0
  30. package/dist/shared/{preset-mini.Jpc0QYPj.d.cts → preset-mini.nzD7Hw_0.d.mts} +4 -3
  31. package/dist/shared/{preset-mini.5-XKlNyK.d.cts → preset-mini.vMrmsD3H.d.mts} +1 -1
  32. package/dist/shared/preset-mini.zC_vZg74.mjs +291 -0
  33. package/dist/theme.cjs +34 -318
  34. package/dist/theme.d.cts +3 -3
  35. package/dist/theme.d.mts +3 -3
  36. package/dist/theme.d.ts +3 -3
  37. package/dist/theme.mjs +5 -293
  38. package/dist/utils.cjs +23 -23
  39. package/dist/utils.d.cts +4 -4
  40. package/dist/utils.d.mts +4 -4
  41. package/dist/utils.d.ts +4 -4
  42. package/dist/utils.mjs +1 -1
  43. package/dist/variants.cjs +31 -739
  44. package/dist/variants.d.cts +5 -5
  45. package/dist/variants.d.mts +5 -5
  46. package/dist/variants.d.ts +5 -5
  47. package/dist/variants.mjs +4 -716
  48. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const utils = require('./preset-mini.ImRm63ih.cjs');
3
+ const utilities = require('./preset-mini.UhMMbd34.cjs');
4
4
 
5
5
  const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
6
6
  const containValues = ["none", "strict", "content", "size", "inline-size", "layout", "style", "paint"];
@@ -13,24 +13,24 @@ const displays = [
13
13
  ["flow-root", { display: "flow-root" }],
14
14
  ["list-item", { display: "list-item" }],
15
15
  ["hidden", { display: "none" }],
16
- [/^display-(.+)$/, ([, c]) => ({ display: utils.h.bracket.cssvar.global(c) })]
16
+ [/^display-(.+)$/, ([, c]) => ({ display: utilities.h.bracket.cssvar.global(c) })]
17
17
  ];
18
18
  const appearances = [
19
19
  ["visible", { visibility: "visible" }],
20
20
  ["invisible", { visibility: "hidden" }],
21
21
  ["backface-visible", { "backface-visibility": "visible" }],
22
22
  ["backface-hidden", { "backface-visibility": "hidden" }],
23
- ...utils.makeGlobalStaticRules("backface", "backface-visibility")
23
+ ...utilities.makeGlobalStaticRules("backface", "backface-visibility")
24
24
  ];
25
25
  const cursors = [
26
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: utils.h.bracket.cssvar.global(c) })],
26
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: utilities.h.bracket.cssvar.global(c) })],
27
27
  ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
28
28
  ];
29
29
  const contains = [
30
30
  [/^contain-(.*)$/, ([, d]) => {
31
- if (utils.h.bracket(d) != null) {
31
+ if (utilities.h.bracket(d) != null) {
32
32
  return {
33
- contain: utils.h.bracket(d).split(" ").map((e) => utils.h.cssvar.fraction(e) ?? e).join(" ")
33
+ contain: utilities.h.bracket(d).split(" ").map((e) => utilities.h.cssvar.fraction(e) ?? e).join(" ")
34
34
  };
35
35
  }
36
36
  return containValues.includes(d) ? { contain: d } : void 0;
@@ -39,38 +39,38 @@ const contains = [
39
39
  const pointerEvents = [
40
40
  ["pointer-events-auto", { "pointer-events": "auto" }],
41
41
  ["pointer-events-none", { "pointer-events": "none" }],
42
- ...utils.makeGlobalStaticRules("pointer-events")
42
+ ...utilities.makeGlobalStaticRules("pointer-events")
43
43
  ];
44
44
  const resizes = [
45
45
  ["resize-x", { resize: "horizontal" }],
46
46
  ["resize-y", { resize: "vertical" }],
47
47
  ["resize", { resize: "both" }],
48
48
  ["resize-none", { resize: "none" }],
49
- ...utils.makeGlobalStaticRules("resize")
49
+ ...utilities.makeGlobalStaticRules("resize")
50
50
  ];
51
51
  const userSelects = [
52
52
  ["select-auto", { "-webkit-user-select": "auto", "user-select": "auto" }],
53
53
  ["select-all", { "-webkit-user-select": "all", "user-select": "all" }],
54
54
  ["select-text", { "-webkit-user-select": "text", "user-select": "text" }],
55
55
  ["select-none", { "-webkit-user-select": "none", "user-select": "none" }],
56
- ...utils.makeGlobalStaticRules("select", "user-select")
56
+ ...utilities.makeGlobalStaticRules("select", "user-select")
57
57
  ];
58
58
  const whitespaces = [
59
59
  [
60
60
  /^(?:whitespace-|ws-)([-\w]+)$/,
61
- ([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...utils.globalKeywords].includes(v) ? { "white-space": v } : void 0,
61
+ ([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...utilities.globalKeywords].includes(v) ? { "white-space": v } : void 0,
62
62
  { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
63
63
  ]
64
64
  ];
65
65
  const contentVisibility = [
66
- [/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size": utils.h.bracket.cssvar.global.fraction.rem(d) }), { autocomplete: "intrinsic-size-<num>" }],
66
+ [/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size": utilities.h.bracket.cssvar.global.fraction.rem(d) }), { autocomplete: "intrinsic-size-<num>" }],
67
67
  ["content-visibility-visible", { "content-visibility": "visible" }],
68
68
  ["content-visibility-hidden", { "content-visibility": "hidden" }],
69
69
  ["content-visibility-auto", { "content-visibility": "auto" }],
70
- ...utils.makeGlobalStaticRules("content-visibility")
70
+ ...utilities.makeGlobalStaticRules("content-visibility")
71
71
  ];
72
72
  const contents = [
73
- [/^content-(.+)$/, ([, v]) => ({ content: utils.h.bracket.cssvar(v) })],
73
+ [/^content-(.+)$/, ([, v]) => ({ content: utilities.h.bracket.cssvar(v) })],
74
74
  ["content-empty", { content: '""' }],
75
75
  ["content-none", { content: "none" }]
76
76
  ];
@@ -84,7 +84,8 @@ const breaks = [
84
84
  const textWraps = [
85
85
  ["text-wrap", { "text-wrap": "wrap" }],
86
86
  ["text-nowrap", { "text-wrap": "nowrap" }],
87
- ["text-balance", { "text-wrap": "balance" }]
87
+ ["text-balance", { "text-wrap": "balance" }],
88
+ ["text-pretty", { "text-wrap": "pretty" }]
88
89
  ];
89
90
  const textOverflows = [
90
91
  ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
@@ -97,7 +98,7 @@ const textTransforms = [
97
98
  ["case-lower", { "text-transform": "lowercase" }],
98
99
  ["case-capital", { "text-transform": "capitalize" }],
99
100
  ["case-normal", { "text-transform": "none" }],
100
- ...utils.makeGlobalStaticRules("case", "text-transform")
101
+ ...utilities.makeGlobalStaticRules("case", "text-transform")
101
102
  ];
102
103
  const fontStyles = [
103
104
  ["italic", { "font-style": "italic" }],
@@ -129,9 +130,9 @@ const ringBase = {
129
130
  "--un-shadow": "0 0 rgb(0 0 0 / 0)"
130
131
  };
131
132
  const rings = [
132
- // size
133
+ // ring
133
134
  [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
134
- const value = theme.ringWidth?.[d || "DEFAULT"] ?? utils.h.px(d || "1");
135
+ const value = theme.ringWidth?.[d || "DEFAULT"] ?? utilities.h.px(d || "1");
135
136
  if (value) {
136
137
  return {
137
138
  "--un-ring-width": value,
@@ -141,19 +142,28 @@ const rings = [
141
142
  };
142
143
  }
143
144
  }, { autocomplete: "ring-$ringWidth" }],
144
- [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
145
+ // size
146
+ [/^ring-(?:width-|size-)(.+)$/, handleWidth, { autocomplete: "ring-(width|size)-$lineWidth" }],
145
147
  // offset size
146
148
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
147
- [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
149
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utilities.h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
148
150
  // colors
149
- [/^ring-(.+)$/, utils.colorResolver("--un-ring-color", "ring", "borderColor"), { autocomplete: "ring-$colors" }],
150
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
151
+ [/^ring-(.+)$/, handleColorOrWidth, { autocomplete: "ring-$colors" }],
152
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
151
153
  // offset color
152
- [/^ring-offset-(.+)$/, utils.colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
153
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
154
+ [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
155
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
154
156
  // style
155
157
  ["ring-inset", { "--un-ring-inset": "inset" }]
156
158
  ];
159
+ function handleWidth([, b], { theme }) {
160
+ return { "--un-ring-width": theme.ringWidth?.[b] ?? utilities.h.bracket.cssvar.px(b) };
161
+ }
162
+ function handleColorOrWidth(match, ctx) {
163
+ if (utilities.isCSSMathFn(utilities.h.bracket(match[1])))
164
+ return handleWidth(match, ctx);
165
+ return utilities.colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
166
+ }
157
167
 
158
168
  const boxShadowsBase = {
159
169
  "--un-ring-offset-shadow": "0 0 rgb(0 0 0 / 0)",
@@ -167,16 +177,16 @@ const boxShadows = [
167
177
  const [, d] = match;
168
178
  const { theme } = context;
169
179
  const v = theme.boxShadow?.[d || "DEFAULT"];
170
- const c = d ? utils.h.bracket.cssvar(d) : void 0;
171
- if ((v != null || c != null) && !utils.hasParseableColor(c, theme, "shadowColor")) {
180
+ const c = d ? utilities.h.bracket.cssvar(d) : void 0;
181
+ if ((v != null || c != null) && !utilities.hasParseableColor(c, theme, "shadowColor")) {
172
182
  return {
173
- "--un-shadow": utils.colorableShadows(v || c, "--un-shadow-color").join(","),
183
+ "--un-shadow": utilities.colorableShadows(v || c, "--un-shadow-color").join(","),
174
184
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
175
185
  };
176
186
  }
177
- return utils.colorResolver("--un-shadow-color", "shadow", "shadowColor")(match, context);
187
+ return utilities.colorResolver("--un-shadow-color", "shadow", "shadowColor")(match, context);
178
188
  }, { autocomplete: ["shadow-$colors", "shadow-$boxShadow"] }],
179
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
189
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
180
190
  // inset
181
191
  ["shadow-inset", { "--un-shadow-inset": "inset" }]
182
192
  ];
@@ -229,10 +239,10 @@ const transformBase = {
229
239
  };
230
240
  const transforms = [
231
241
  // origins
232
- [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utils.positionMap[s] ?? utils.h.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utils.positionMap).join("|")})`, `origin-(${Object.keys(utils.positionMap).join("|")})`] }],
242
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.h.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utilities.positionMap).join("|")})`, `origin-(${Object.keys(utilities.positionMap).join("|")})`] }],
233
243
  // perspectives
234
244
  [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
235
- const v = utils.h.bracket.cssvar.px.numberWithUnit(s);
245
+ const v = utilities.h.bracket.cssvar.px.numberWithUnit(s);
236
246
  if (v != null) {
237
247
  return {
238
248
  "-webkit-perspective": v,
@@ -242,7 +252,7 @@ const transforms = [
242
252
  }],
243
253
  // skip 1 & 2 letters shortcut
244
254
  [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
245
- const v = utils.h.bracket.cssvar(s) ?? (s.length >= 3 ? utils.positionMap[s] : void 0);
255
+ const v = utilities.h.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
246
256
  if (v != null) {
247
257
  return {
248
258
  "-webkit-perspective-origin": v,
@@ -267,28 +277,28 @@ const transforms = [
267
277
  ["transform-cpu", { transform: transformCpu }],
268
278
  ["transform-gpu", { transform: transformGpu }],
269
279
  ["transform-none", { transform: "none" }],
270
- ...utils.makeGlobalStaticRules("transform")
280
+ ...utilities.makeGlobalStaticRules("transform")
271
281
  ];
272
282
  function handleTranslate([, d, b], { theme }) {
273
- const v = theme.spacing?.[b] ?? utils.h.bracket.cssvar.fraction.rem(b);
283
+ const v = theme.spacing?.[b] ?? utilities.h.bracket.cssvar.fraction.rem(b);
274
284
  if (v != null) {
275
285
  return [
276
- ...utils.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
286
+ ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
277
287
  ["transform", transformCpu]
278
288
  ];
279
289
  }
280
290
  }
281
291
  function handleScale([, d, b]) {
282
- const v = utils.h.bracket.cssvar.fraction.percent(b);
292
+ const v = utilities.h.bracket.cssvar.fraction.percent(b);
283
293
  if (v != null) {
284
294
  return [
285
- ...utils.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
295
+ ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
286
296
  ["transform", transformCpu]
287
297
  ];
288
298
  }
289
299
  }
290
300
  function handleRotate([, d = "", b]) {
291
- const v = utils.h.bracket.cssvar.degree(b);
301
+ const v = utilities.h.bracket.cssvar.degree(b);
292
302
  if (v != null) {
293
303
  if (d) {
294
304
  return {
@@ -308,10 +318,10 @@ function handleRotate([, d = "", b]) {
308
318
  }
309
319
  }
310
320
  function handleSkew([, d, b]) {
311
- const v = utils.h.bracket.cssvar.degree(b);
321
+ const v = utilities.h.bracket.cssvar.degree(b);
312
322
  if (v != null) {
313
323
  return [
314
- ...utils.xyzMap[d].map((i) => [`--un-skew${i}`, v]),
324
+ ...utilities.xyzMap[d].map((i) => [`--un-skew${i}`, v]),
315
325
  ["transform", transformCpu]
316
326
  ];
317
327
  }
@@ -1,5 +1,5 @@
1
- import { createValueHandler, parseCssColor, colorToString, colorOpacityToString, getStringComponents } from '@unocss/rule-utils';
2
1
  import { escapeSelector, toArray } from '@unocss/core';
2
+ import { createValueHandler, getStringComponent, parseCssColor, colorToString, colorOpacityToString, getStringComponents } from '@unocss/rule-utils';
3
3
 
4
4
  const directionMap = {
5
5
  "l": ["-left"],
@@ -106,11 +106,12 @@ const globalKeywords = [
106
106
  "revert-layer",
107
107
  "unset"
108
108
  ];
109
- const cssMathFnRE = /(?:calc|clamp|min|max)\s*\(.*\)/;
109
+ const cssMathFnRE = /^(calc|clamp|min|max)\s*\((.+)\)(.*)/;
110
110
 
111
111
  const numberWithUnitRE = /^(-?\d*(?:\.\d+)?)(px|pt|pc|%|r?(?:em|ex|lh|cap|ch|ic)|(?:[sld]?v|cq)(?:[whib]|min|max)|in|cm|mm|rpx)?$/i;
112
112
  const numberRE = /^(-?\d*(?:\.\d+)?)$/i;
113
113
  const unitOnlyRE = /^(px)$/i;
114
+ const bracketTypeRe = /^\[(color|length|position|quoted|string):/i;
114
115
 
115
116
  const cssProps = [
116
117
  // basic props
@@ -186,7 +187,7 @@ function auto(str) {
186
187
  return "auto";
187
188
  }
188
189
  function rem(str) {
189
- if (str.match(unitOnlyRE))
190
+ if (unitOnlyRE.test(str))
190
191
  return `1${str}`;
191
192
  const match = str.match(numberWithUnitRE);
192
193
  if (!match)
@@ -200,7 +201,7 @@ function rem(str) {
200
201
  }
201
202
  }
202
203
  function px(str) {
203
- if (str.match(unitOnlyRE))
204
+ if (unitOnlyRE.test(str))
204
205
  return `1${str}`;
205
206
  const match = str.match(numberWithUnitRE);
206
207
  if (!match)
@@ -237,7 +238,6 @@ function fraction(str) {
237
238
  return `${round(num * 100)}%`;
238
239
  }
239
240
  }
240
- const bracketTypeRe = /^\[(color|length|position|quoted|string):/i;
241
241
  function bracketWithType(str, requiredType) {
242
242
  if (str && str.startsWith("[") && str.endsWith("]")) {
243
243
  let base;
@@ -296,8 +296,10 @@ function bracketOfPosition(str) {
296
296
  return bracketWithType(str, "position");
297
297
  }
298
298
  function cssvar(str) {
299
- if (str.match(/^\$[^\s'"`;{}]/))
300
- return `var(--${escapeSelector(str.slice(1))})`;
299
+ if (/^\$[^\s'"`;{}]/.test(str)) {
300
+ const [name, defaultValue] = str.slice(1).split(",");
301
+ return `var(--${escapeSelector(name)}${defaultValue ? `, ${defaultValue}` : ""})`;
302
+ }
301
303
  }
302
304
  function time(str) {
303
305
  const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
@@ -390,17 +392,18 @@ function getThemeColor(theme, colors, key) {
390
392
  return getThemeColorForKey(theme, colors, key) || getThemeColorForKey(theme, colors, "colors");
391
393
  }
392
394
  function splitShorthand(body, type) {
393
- const split = body.split(/(?:\/|:)/);
394
- if (split[0] === `[${type}`) {
395
- return [
396
- split.slice(0, 2).join(":"),
397
- split[2]
398
- ];
395
+ const [front, rest] = getStringComponent(body, "[", "]", ["/", ":"]) ?? [];
396
+ if (front != null) {
397
+ const match = (front.match(bracketTypeRe) ?? [])[1];
398
+ if (match == null || match === type)
399
+ return [front, rest];
399
400
  }
400
- return split;
401
401
  }
402
402
  function parseColor(body, theme, key) {
403
- const [main, opacity] = splitShorthand(body, "color");
403
+ const split = splitShorthand(body, "color");
404
+ if (!split)
405
+ return;
406
+ const [main, opacity] = split;
404
407
  const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
405
408
  const [name] = colors;
406
409
  if (!name)
@@ -410,9 +413,9 @@ function parseColor(body, theme, key) {
410
413
  const bracketOrMain = bracket || main;
411
414
  if (h.numberWithUnit(bracketOrMain))
412
415
  return;
413
- if (bracketOrMain.match(/^#[\da-fA-F]+/g))
416
+ if (/^#[\da-fA-F]+/.test(bracketOrMain))
414
417
  color = bracketOrMain;
415
- else if (bracketOrMain.match(/^hex-[\da-fA-F]+/g))
418
+ else if (/^hex-[\da-fA-F]+/.test(bracketOrMain))
416
419
  color = `#${bracketOrMain.slice(4)}`;
417
420
  else if (main.startsWith("$"))
418
421
  color = h.cssvar(main);
@@ -426,7 +429,7 @@ function parseColor(body, theme, key) {
426
429
  if (!color) {
427
430
  let colorData;
428
431
  const [scale] = colors.slice(-1);
429
- if (scale.match(/^\d+$/)) {
432
+ if (/^\d+$/.test(scale)) {
430
433
  no = scale;
431
434
  colorData = getThemeColor(theme, colors.slice(0, -1), key);
432
435
  if (!colorData || typeof colorData === "string")
@@ -465,11 +468,22 @@ function colorResolver(property, varName, key, shouldPass) {
465
468
  if (alpha != null) {
466
469
  css[property] = colorToString(cssColor, alpha);
467
470
  } else {
468
- css[`--un-${varName}-opacity`] = colorOpacityToString(cssColor);
469
- css[property] = colorToString(cssColor, `var(--un-${varName}-opacity)`);
471
+ const opacityVar = `--un-${varName}-opacity`;
472
+ const result = colorToString(cssColor, `var(${opacityVar})`);
473
+ if (result.includes(opacityVar))
474
+ css[opacityVar] = colorOpacityToString(cssColor);
475
+ css[property] = result;
470
476
  }
471
477
  } else if (color) {
472
- css[property] = colorToString(color, alpha);
478
+ if (alpha != null) {
479
+ css[property] = colorToString(color, alpha);
480
+ } else {
481
+ const opacityVar = `--un-${varName}-opacity`;
482
+ const result = colorToString(color, `var(${opacityVar})`);
483
+ if (result.includes(opacityVar))
484
+ css[opacityVar] = 1;
485
+ css[property] = result;
486
+ }
473
487
  }
474
488
  if (shouldPass?.(css) !== false)
475
489
  return css;
@@ -482,10 +496,15 @@ function colorableShadows(shadows, colorVar) {
482
496
  const components = getStringComponents(shadows[i], " ", 6);
483
497
  if (!components || components.length < 3)
484
498
  return shadows;
485
- const color = parseCssColor(components.pop());
486
- if (color == null)
499
+ if (parseCssColor(components.at(0)))
487
500
  return shadows;
488
- colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
501
+ let colorVarValue = "";
502
+ if (parseCssColor(components.at(-1))) {
503
+ const color = parseCssColor(components.pop());
504
+ if (color)
505
+ colorVarValue = `, ${colorToString(color)}`;
506
+ }
507
+ colored.push(`${components.join(" ")} var(${colorVar}${colorVarValue})`);
489
508
  }
490
509
  return colored;
491
510
  }
@@ -507,7 +526,7 @@ function makeGlobalStaticRules(prefix, property) {
507
526
  return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
508
527
  }
509
528
  function isCSSMathFn(value) {
510
- return cssMathFnRE.test(value);
529
+ return value != null && cssMathFnRE.test(value);
511
530
  }
512
531
  function isSize(str) {
513
532
  if (str[0] === "[" && str.slice(-1) === "]")
@@ -515,4 +534,4 @@ function isSize(str) {
515
534
  return cssMathFnRE.test(str) || numberWithUnitRE.test(str);
516
535
  }
517
536
 
518
- export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorableShadows as b, colorResolver as c, positionMap as d, directionMap as e, cornerMap as f, globalKeywords as g, h, isCSSMathFn as i, isSize as j, insetMap as k, directionSize as l, makeGlobalStaticRules as m, numberWithUnitRE as n, cssMathFnRE as o, parseColor as p, handler as q, resolveBreakpoints as r, splitShorthand as s, resolveVerticalBreakpoints as t, valueHandlers as v, xyzMap as x };
537
+ export { CONTROL_MINI_NO_NEGATIVE as C, cssMathFnRE as a, h as b, cornerMap as c, directionMap as d, directionSize as e, parseColor as f, globalKeywords as g, handler as h, insetMap as i, colorResolver as j, colorableShadows as k, hasParseableColor as l, resolveVerticalBreakpoints as m, makeGlobalStaticRules as n, isCSSMathFn as o, positionMap as p, isSize as q, resolveBreakpoints as r, splitShorthand as s, valueHandlers as v, xyzMap as x };
@@ -1,4 +1,4 @@
1
- import { h, m as makeGlobalStaticRules, g as globalKeywords, c as colorResolver, a as hasParseableColor, b as colorableShadows, d as positionMap, x as xyzMap } from './preset-mini.Stl9mkMB.mjs';
1
+ import { b as h, n as makeGlobalStaticRules, g as globalKeywords, j as colorResolver, o as isCSSMathFn, l as hasParseableColor, k as colorableShadows, p as positionMap, x as xyzMap } from './preset-mini.0CcynBZx.mjs';
2
2
 
3
3
  const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
4
4
  const containValues = ["none", "strict", "content", "size", "inline-size", "layout", "style", "paint"];
@@ -82,7 +82,8 @@ const breaks = [
82
82
  const textWraps = [
83
83
  ["text-wrap", { "text-wrap": "wrap" }],
84
84
  ["text-nowrap", { "text-wrap": "nowrap" }],
85
- ["text-balance", { "text-wrap": "balance" }]
85
+ ["text-balance", { "text-wrap": "balance" }],
86
+ ["text-pretty", { "text-wrap": "pretty" }]
86
87
  ];
87
88
  const textOverflows = [
88
89
  ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
@@ -127,7 +128,7 @@ const ringBase = {
127
128
  "--un-shadow": "0 0 rgb(0 0 0 / 0)"
128
129
  };
129
130
  const rings = [
130
- // size
131
+ // ring
131
132
  [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
132
133
  const value = theme.ringWidth?.[d || "DEFAULT"] ?? h.px(d || "1");
133
134
  if (value) {
@@ -139,12 +140,13 @@ const rings = [
139
140
  };
140
141
  }
141
142
  }, { autocomplete: "ring-$ringWidth" }],
142
- [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? h.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
143
+ // size
144
+ [/^ring-(?:width-|size-)(.+)$/, handleWidth, { autocomplete: "ring-(width|size)-$lineWidth" }],
143
145
  // offset size
144
146
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
145
147
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
146
148
  // colors
147
- [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring", "borderColor"), { autocomplete: "ring-$colors" }],
149
+ [/^ring-(.+)$/, handleColorOrWidth, { autocomplete: "ring-$colors" }],
148
150
  [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
149
151
  // offset color
150
152
  [/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
@@ -152,6 +154,14 @@ const rings = [
152
154
  // style
153
155
  ["ring-inset", { "--un-ring-inset": "inset" }]
154
156
  ];
157
+ function handleWidth([, b], { theme }) {
158
+ return { "--un-ring-width": theme.ringWidth?.[b] ?? h.bracket.cssvar.px(b) };
159
+ }
160
+ function handleColorOrWidth(match, ctx) {
161
+ if (isCSSMathFn(h.bracket(match[1])))
162
+ return handleWidth(match, ctx);
163
+ return colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
164
+ }
155
165
 
156
166
  const boxShadowsBase = {
157
167
  "--un-ring-offset-shadow": "0 0 rgb(0 0 0 / 0)",
@@ -315,4 +325,4 @@ function handleSkew([, d, b]) {
315
325
  }
316
326
  }
317
327
 
318
- export { contents as a, boxShadowsBase as b, contentVisibility as c, displays as d, textOverflows as e, textTransforms as f, fontStyles as g, fontSmoothings as h, boxShadows as i, rings as j, cursors as k, appearances as l, resizes as m, breaks as n, transforms as o, pointerEvents as p, contains as q, ringBase as r, textWraps as s, transformBase as t, userSelects as u, varEmpty as v, whitespaces as w };
328
+ export { rings as a, boxShadowsBase as b, boxShadows as c, displays as d, appearances as e, cursors as f, contains as g, resizes as h, contentVisibility as i, contents as j, breaks as k, textOverflows as l, textTransforms as m, fontStyles as n, fontSmoothings as o, pointerEvents as p, transformBase as q, ringBase as r, transforms as s, textWraps as t, userSelects as u, varEmpty as v, whitespaces as w };
@@ -1,5 +1,5 @@
1
1
  import { DynamicMatcher, ParsedColorValue, CSSObject, VariantContext, StaticRule } from '@unocss/core';
2
- import { T as Theme } from './preset-mini.7XoWRZIl.mjs';
2
+ import { T as Theme } from './preset-mini.hpPpX7ws.cjs';
3
3
 
4
4
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
5
5
  /**
@@ -13,7 +13,7 @@ type ThemeColorKeys = 'colors' | 'borderColor' | 'backgroundColor' | 'textColor'
13
13
  /**
14
14
  * Split utility shorthand delimited by / or :
15
15
  */
16
- declare function splitShorthand(body: string, type: string): string[];
16
+ declare function splitShorthand(body: string, type: string): string[] | undefined;
17
17
  /**
18
18
  * Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
19
19
  * See also color.tests.ts for more examples.
@@ -52,6 +52,7 @@ declare function parseColor(body: string, theme: Theme, key?: ThemeColorKeys): P
52
52
  *
53
53
  * @param property - Property for the css value to be created.
54
54
  * @param varName - Base name for the opacity variable.
55
+ * @param [key] - Theme key to select the color from.
55
56
  * @param [shouldPass] - Function to decide whether to pass the css.
56
57
  * @return object.
57
58
  */
@@ -67,7 +68,7 @@ declare function resolveVerticalBreakpoints(context: Readonly<VariantContext<The
67
68
  size: string;
68
69
  }[] | undefined;
69
70
  declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
70
- declare function isCSSMathFn(value: string): boolean;
71
+ declare function isCSSMathFn(value: string | undefined): boolean;
71
72
  declare function isSize(str: string): boolean;
72
73
 
73
74
  export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, isSize as e, hasParseableColor as h, isCSSMathFn as i, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
@@ -1,5 +1,5 @@
1
1
  import { DynamicMatcher, ParsedColorValue, CSSObject, VariantContext, StaticRule } from '@unocss/core';
2
- import { T as Theme } from './preset-mini.7XoWRZIl.js';
2
+ import { T as Theme } from './preset-mini.hpPpX7ws.js';
3
3
 
4
4
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
5
5
  /**
@@ -13,7 +13,7 @@ type ThemeColorKeys = 'colors' | 'borderColor' | 'backgroundColor' | 'textColor'
13
13
  /**
14
14
  * Split utility shorthand delimited by / or :
15
15
  */
16
- declare function splitShorthand(body: string, type: string): string[];
16
+ declare function splitShorthand(body: string, type: string): string[] | undefined;
17
17
  /**
18
18
  * Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
19
19
  * See also color.tests.ts for more examples.
@@ -52,6 +52,7 @@ declare function parseColor(body: string, theme: Theme, key?: ThemeColorKeys): P
52
52
  *
53
53
  * @param property - Property for the css value to be created.
54
54
  * @param varName - Base name for the opacity variable.
55
+ * @param [key] - Theme key to select the color from.
55
56
  * @param [shouldPass] - Function to decide whether to pass the css.
56
57
  * @return object.
57
58
  */
@@ -67,7 +68,7 @@ declare function resolveVerticalBreakpoints(context: Readonly<VariantContext<The
67
68
  size: string;
68
69
  }[] | undefined;
69
70
  declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
70
- declare function isCSSMathFn(value: string): boolean;
71
+ declare function isCSSMathFn(value: string | undefined): boolean;
71
72
  declare function isSize(str: string): boolean;
72
73
 
73
74
  export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, isSize as e, hasParseableColor as h, isCSSMathFn as i, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };