@unocss/preset-mini 0.20.4 → 0.21.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.
@@ -74,7 +74,7 @@ const textShadow = {
74
74
  DEFAULT: "0px 0px 1px rgb(0 0 0/20%), 0px 0px 1px rgb(1 0 5/10%)",
75
75
  sm: "1px 1px 3px rgb(36 37 47 / 25%)",
76
76
  md: "0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)",
77
- lg: "3px 3px 6px rgb(0 0 0 / 26%), 0 0 5px rgb(15 3 86 / 22%)",
77
+ lg: "3px 3px 6px rgb(0 0 0 / 26%), 0px 0px 5px rgb(15 3 86 / 22%)",
78
78
  xl: "1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)",
79
79
  none: "none"
80
80
  };
@@ -115,14 +115,14 @@ const borderRadius = {
115
115
  "full": "9999px"
116
116
  };
117
117
  const boxShadow = {
118
- "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
118
+ "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px -1px rgba(var(--un-shadow-color), 0.1)",
119
119
  "sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
120
- "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
121
- "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
122
- "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
120
+ "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -2px rgba(var(--un-shadow-color), 0.1)",
121
+ "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -4px rgba(var(--un-shadow-color), 0.1)",
122
+ "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 8px 10px -6px rgba(var(--un-shadow-color), 0.1)",
123
123
  "2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
124
- "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
125
- "none": "none"
124
+ "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.05)",
125
+ "none": "0 0 #0000"
126
126
  };
127
127
 
128
128
  const blur = {
@@ -137,7 +137,7 @@ const blur = {
137
137
  };
138
138
  const dropShadow = {
139
139
  "DEFAULT": ["0 1px 2px rgba(0, 0, 0, 0.1)", "0 1px 1px rgba(0, 0, 0, 0.06)"],
140
- "sm": "0 1px 1px rgba(0,0,0,0.05)",
140
+ "sm": "0 1px 1px rgba(0, 0, 0, 0.05)",
141
141
  "md": ["0 4px 3px rgba(0, 0, 0, 0.07)", "0 2px 2px rgba(0, 0, 0, 0.06)"],
142
142
  "lg": ["0 10px 8px rgba(0, 0, 0, 0.04)", "0 4px 3px rgba(0, 0, 0, 0.1)"],
143
143
  "xl": ["0 20px 13px rgba(0, 0, 0, 0.03)", "0 8px 5px rgba(0, 0, 0, 0.08)"],
@@ -157,8 +157,6 @@ const baseSize = {
157
157
  "5xl": "64rem",
158
158
  "6xl": "72rem",
159
159
  "7xl": "80rem",
160
- "min": "min-content",
161
- "max": "max-content",
162
160
  "prose": "65ch"
163
161
  };
164
162
  const width = {
@@ -72,7 +72,7 @@ const textShadow = {
72
72
  DEFAULT: "0px 0px 1px rgb(0 0 0/20%), 0px 0px 1px rgb(1 0 5/10%)",
73
73
  sm: "1px 1px 3px rgb(36 37 47 / 25%)",
74
74
  md: "0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)",
75
- lg: "3px 3px 6px rgb(0 0 0 / 26%), 0 0 5px rgb(15 3 86 / 22%)",
75
+ lg: "3px 3px 6px rgb(0 0 0 / 26%), 0px 0px 5px rgb(15 3 86 / 22%)",
76
76
  xl: "1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)",
77
77
  none: "none"
78
78
  };
@@ -113,14 +113,14 @@ const borderRadius = {
113
113
  "full": "9999px"
114
114
  };
115
115
  const boxShadow = {
116
- "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
116
+ "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px -1px rgba(var(--un-shadow-color), 0.1)",
117
117
  "sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
118
- "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
119
- "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
120
- "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
118
+ "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -2px rgba(var(--un-shadow-color), 0.1)",
119
+ "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -4px rgba(var(--un-shadow-color), 0.1)",
120
+ "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 8px 10px -6px rgba(var(--un-shadow-color), 0.1)",
121
121
  "2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
122
- "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
123
- "none": "none"
122
+ "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.05)",
123
+ "none": "0 0 #0000"
124
124
  };
125
125
 
126
126
  const blur = {
@@ -135,7 +135,7 @@ const blur = {
135
135
  };
136
136
  const dropShadow = {
137
137
  "DEFAULT": ["0 1px 2px rgba(0, 0, 0, 0.1)", "0 1px 1px rgba(0, 0, 0, 0.06)"],
138
- "sm": "0 1px 1px rgba(0,0,0,0.05)",
138
+ "sm": "0 1px 1px rgba(0, 0, 0, 0.05)",
139
139
  "md": ["0 4px 3px rgba(0, 0, 0, 0.07)", "0 2px 2px rgba(0, 0, 0, 0.06)"],
140
140
  "lg": ["0 10px 8px rgba(0, 0, 0, 0.04)", "0 4px 3px rgba(0, 0, 0, 0.1)"],
141
141
  "xl": ["0 20px 13px rgba(0, 0, 0, 0.03)", "0 8px 5px rgba(0, 0, 0, 0.08)"],
@@ -155,8 +155,6 @@ const baseSize = {
155
155
  "5xl": "64rem",
156
156
  "6xl": "72rem",
157
157
  "7xl": "80rem",
158
- "min": "min-content",
159
- "max": "max-content",
160
158
  "prose": "65ch"
161
159
  };
162
160
  const width = {
@@ -10,7 +10,7 @@ const verticalAlignAlias = {
10
10
  btm: "bottom"
11
11
  };
12
12
  const verticalAligns = [
13
- [/^(?:vertical|align|v)-(baseline|top|bottom|middle|text-top|text-bottom|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
13
+ [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
14
14
  ];
15
15
  const textAligns = [
16
16
  ["text-center", { "text-align": "center" }],
@@ -24,7 +24,7 @@ const outline = [
24
24
  [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
25
25
  [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
26
26
  ["outline", { "outline-style": "solid" }],
27
- [/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
27
+ [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
28
28
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
29
29
  ];
30
30
  const appearance = [
@@ -34,7 +34,7 @@ const appearance = [
34
34
  }]
35
35
  ];
36
36
  const willChange = [
37
- [/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
37
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.auto.global(p) })]
38
38
  ];
39
39
 
40
40
  const borders = [
@@ -182,10 +182,10 @@ const flex = [
182
182
  ["flex-initial", { flex: "0 1 auto" }],
183
183
  ["flex-none", { flex: "none" }],
184
184
  [/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
185
- ["flex-shrink", { "flex-shrink": 1 }],
186
- ["flex-shrink-0", { "flex-shrink": 0 }],
187
- ["flex-grow", { "flex-grow": 1 }],
188
- ["flex-grow-0", { "flex-grow": 0 }],
185
+ [/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
186
+ [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
187
+ [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
188
+ [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
189
189
  [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
190
190
  ["flex-row", { "flex-direction": "row" }],
191
191
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
@@ -229,7 +229,7 @@ const fonts = [
229
229
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
230
230
  ];
231
231
  const tabSizes = [
232
- [/^tab-?([^-]*)$/, ([, s]) => {
232
+ [/^tab(?:-([^-]+))?$/, ([, s]) => {
233
233
  const v = utilities.handler.bracket.global.number(s || "4");
234
234
  if (v != null) {
235
235
  return {
@@ -271,53 +271,47 @@ const gaps = [
271
271
  [/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
272
272
  ];
273
273
 
274
- const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
274
+ const rowCol = (s) => s.replace("col", "column");
275
275
  const autoDirection = (selector, theme) => {
276
- if (selector === "min")
277
- return "min-content";
278
- else if (selector === "max")
279
- return "max-content";
280
- else if (selector === "fr")
281
- return "minmax(0,1fr)";
282
- return calSize(selector, theme);
276
+ const v = theme.fontSize?.[selector];
277
+ if (v != null)
278
+ return core.toArray(v)[0];
279
+ switch (selector) {
280
+ case "min":
281
+ return "min-content";
282
+ case "max":
283
+ return "max-content";
284
+ case "fr":
285
+ return "minmax(0,1fr)";
286
+ }
287
+ return utilities.handler.bracket.auto.rem(selector);
283
288
  };
284
289
  const grids = [
285
290
  ["grid", { display: "grid" }],
286
291
  ["inline-grid", { display: "inline-grid" }],
287
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
288
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
289
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
290
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
291
- [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
292
- const key = d === "row" ? "grid-row" : "grid-column";
293
- let raw = utilities.handler.bracket(v);
294
- if (raw)
295
- return { [key]: raw };
296
- const parts = v.split("-");
297
- if (parts.length === 1 && parts[0] === "auto")
298
- return { [key]: parts[0] };
299
- if (parts[0] === "span") {
300
- if (parts[1] === "full")
301
- return { [key]: "1/-1" };
302
- raw = utilities.handler.number.bracket(parts[1]);
303
- if (raw)
304
- return { [key]: `span ${raw}/span ${raw}` };
305
- }
292
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: utilities.handler.bracket.auto(v) })],
293
+ [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
294
+ if (s === "full")
295
+ return { [`grid-${rowCol(c)}`]: "1/-1" };
296
+ const v = utilities.handler.bracket.number(s);
297
+ if (v != null)
298
+ return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
306
299
  }],
307
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
308
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
309
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
310
- [/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": utilities.handler.bracket(v) })],
311
- [/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": utilities.handler.bracket(v) })],
312
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
313
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
314
- [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
315
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
300
+ [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
301
+ [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
302
+ [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
303
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
304
+ [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: utilities.handler.bracket(v) })],
305
+ [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
306
+ [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
307
+ ["grid-rows-none", { "grid-template-rows": "none" }],
308
+ ["grid-cols-none", { "grid-template-columns": "none" }]
316
309
  ];
317
310
 
318
311
  const overflowValues = [
319
312
  "auto",
320
313
  "hidden",
314
+ "clip",
321
315
  "visible",
322
316
  "scroll"
323
317
  ];
@@ -399,7 +393,7 @@ function handleInsetValues([, d, v]) {
399
393
  return utilities.directionMap[d].map((i) => [i.slice(1), r]);
400
394
  }
401
395
  const insets = [
402
- [/^(?:position-|pos-)?inset-()(.+)$/, handleInsetValues],
396
+ [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
403
397
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
404
398
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
405
399
  ];
@@ -464,7 +458,7 @@ const contents = [
464
458
  ];
465
459
  const breaks = [
466
460
  ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
467
- ["break-word", { "overflow-wrap": "break-word" }],
461
+ ["break-words", { "overflow-wrap": "break-word" }],
468
462
  ["break-all", { "word-break": "break-all" }]
469
463
  ];
470
464
  const textOverflows = [
@@ -496,14 +490,14 @@ const fontSmoothings = [
496
490
  ];
497
491
 
498
492
  const rings = [
499
- [/^ring-?(.*)$/, ([, d]) => {
493
+ [/^ring(?:-(.+))?$/, ([, d]) => {
500
494
  const value = utilities.handler.px(d || "1");
501
495
  if (value) {
502
496
  return {
503
497
  "--un-ring-inset": varEmpty,
504
498
  "--un-ring-offset-width": "0px",
505
499
  "--un-ring-offset-color": "#fff",
506
- "--un-ring-color": "rgba(59, 130, 246, .5)",
500
+ "--un-ring-color": "rgba(147, 197, 253, .5)",
507
501
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
508
502
  "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
509
503
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
@@ -537,7 +531,7 @@ const shadowColorResolver = (body, theme) => {
537
531
  }
538
532
  };
539
533
  const boxShadows = [
540
- [/^shadow-?(.*)$/, ([, d], { theme }) => {
534
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
541
535
  const value = theme.boxShadow?.[d || "DEFAULT"];
542
536
  if (value) {
543
537
  return {
@@ -555,37 +549,38 @@ const boxShadows = [
555
549
  function getPropName(minmax, hw) {
556
550
  return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
557
551
  }
558
- function getThemeValue(minmax, hw, theme, prop) {
552
+ function getSizeValue(minmax, hw, theme, prop) {
559
553
  let str = `${hw === "h" ? "height" : "width"}`;
560
554
  if (minmax)
561
555
  str = `${minmax}${utilities.capitalize(str)}`;
562
- return theme[str]?.[prop];
556
+ const v = theme[str]?.[prop];
557
+ if (v != null)
558
+ return v;
559
+ switch (prop) {
560
+ case "fit":
561
+ case "max":
562
+ case "min":
563
+ return `${prop}-content`;
564
+ }
565
+ return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
563
566
  }
564
567
  const sizes = [
565
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
566
- const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
567
- if (v != null)
568
- return { [getPropName(m, w)]: v };
569
- }],
570
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => {
571
- const v = theme.breakpoints?.[s];
572
- if (v != null)
573
- return { [getPropName(m, w)]: v };
574
- }]
575
- ];
568
+ [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
569
+ [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
570
+ ];
571
+ function getAspectRatio(prop) {
572
+ if (/^\d+\/\d+$/.test(prop))
573
+ return prop;
574
+ switch (prop) {
575
+ case "square":
576
+ return "1/1";
577
+ case "video":
578
+ return "16/9";
579
+ }
580
+ return utilities.handler.bracket.cssvar.auto.number(prop);
581
+ }
576
582
  const aspectRatio = [
577
- [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
578
- if (/^\d+\/\d+$/.test(d))
579
- return { "aspect-ratio": d };
580
- const v = {
581
- auto: "auto",
582
- square: "1/1",
583
- video: "16/9"
584
- }[d];
585
- if (v != null)
586
- return { "aspect-ratio": v };
587
- return { "aspect-ratio": utilities.handler.bracket.cssvar.number(d) };
588
- }]
583
+ [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
589
584
  ];
590
585
 
591
586
  const paddings = [
@@ -621,19 +616,19 @@ const transformBase = {
621
616
  };
622
617
  const transforms = [
623
618
  ["transform", transformBase],
624
- [/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
625
- [/^translate()-(.+)$/, handleTranslate],
619
+ [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
620
+ [/^translate-()(.+)$/, handleTranslate],
626
621
  [/^translate-([xyz])-(.+)$/, handleTranslate],
627
- [/^scale()-(.+)$/, handleScale],
628
- [/^scale-([xyz])-(.+)$/, handleScale],
629
622
  [/^rotate-(.+)$/, handleRotate],
630
- [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
623
+ [/^skew-()(.+)$/, handleSkew],
631
624
  [/^skew-([xy])-(.+)$/, handleSkew],
632
- [/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
625
+ [/^scale-()(.+)$/, handleScale],
626
+ [/^scale-([xyz])-(.+)$/, handleScale],
627
+ ["preserve-3d", { "transform-style": "preserve-3d" }],
628
+ ["preserve-flat", { "transform-style": "flat" }],
633
629
  ["transform-gpu", transformGpu],
634
630
  ["transform-cpu", transformCpu],
635
- ["transform-none", { transform: "none" }],
636
- [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })]
631
+ ["transform-none", { transform: "none" }]
637
632
  ];
638
633
  function handleTranslate([, d, b]) {
639
634
  const v = utilities.handler.bracket.fraction.auto.rem(b);
@@ -653,17 +648,8 @@ function handleScale([, d, b]) {
653
648
  ];
654
649
  }
655
650
  }
656
- function handleRotateWithUnit([, b]) {
657
- const v = utilities.handler.bracket.number(b);
658
- if (v != null) {
659
- return [
660
- transformBase,
661
- { "--un-rotate": `${v}deg` }
662
- ];
663
- }
664
- }
665
651
  function handleRotate([, b]) {
666
- const v = utilities.handler.bracket(b);
652
+ const v = utilities.handler.bracket.degree(b);
667
653
  if (v != null) {
668
654
  return [
669
655
  transformBase,
@@ -671,17 +657,8 @@ function handleRotate([, b]) {
671
657
  ];
672
658
  }
673
659
  }
674
- function handleSkewWithUnit([, d, b]) {
675
- const v = utilities.handler.bracket.number(b);
676
- if (v != null) {
677
- return [
678
- transformBase,
679
- { [`--un-skew-${d}`]: `${v}deg` }
680
- ];
681
- }
682
- }
683
660
  function handleSkew([, d, b]) {
684
- const v = utilities.handler.bracket(b);
661
+ const v = utilities.handler.bracket.degree(b);
685
662
  if (v != null) {
686
663
  return [
687
664
  transformBase,
@@ -734,10 +711,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
734
711
  ];
735
712
 
736
713
  const textDecorations = [
737
- ["underline", { "text-decoration": "underline" }],
738
- ["line-through", { "text-decoration": "line-through" }],
739
- ["decoration-underline", { "text-decoration": "underline" }],
740
- ["decoration-line-through", { "text-decoration": "line-through" }],
714
+ ["underline", { "text-decoration-line": "underline" }],
715
+ ["overline", { "text-decoration-line": "overline" }],
716
+ ["line-through", { "text-decoration-line": "line-through" }],
717
+ ["decoration-underline", { "text-decoration-line": "underline" }],
718
+ ["decoration-line-through", { "text-decoration-line": "line-through" }],
741
719
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
742
720
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
743
721
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -8,7 +8,7 @@ const verticalAlignAlias = {
8
8
  btm: "bottom"
9
9
  };
10
10
  const verticalAligns = [
11
- [/^(?:vertical|align|v)-(baseline|top|bottom|middle|text-top|text-bottom|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
11
+ [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
12
12
  ];
13
13
  const textAligns = [
14
14
  ["text-center", { "text-align": "center" }],
@@ -22,7 +22,7 @@ const outline = [
22
22
  [/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
23
23
  [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
24
24
  ["outline", { "outline-style": "solid" }],
25
- [/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
25
+ [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
26
26
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
27
27
  ];
28
28
  const appearance = [
@@ -32,7 +32,7 @@ const appearance = [
32
32
  }]
33
33
  ];
34
34
  const willChange = [
35
- [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.global(p) })]
35
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.auto.global(p) })]
36
36
  ];
37
37
 
38
38
  const borders = [
@@ -180,10 +180,10 @@ const flex = [
180
180
  ["flex-initial", { flex: "0 1 auto" }],
181
181
  ["flex-none", { flex: "none" }],
182
182
  [/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
183
- ["flex-shrink", { "flex-shrink": 1 }],
184
- ["flex-shrink-0", { "flex-shrink": 0 }],
185
- ["flex-grow", { "flex-grow": 1 }],
186
- ["flex-grow-0", { "flex-grow": 0 }],
183
+ [/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
184
+ [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
185
+ [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
186
+ [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
187
187
  [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
188
188
  ["flex-row", { "flex-direction": "row" }],
189
189
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
@@ -227,7 +227,7 @@ const fonts = [
227
227
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
228
228
  ];
229
229
  const tabSizes = [
230
- [/^tab-?([^-]*)$/, ([, s]) => {
230
+ [/^tab(?:-([^-]+))?$/, ([, s]) => {
231
231
  const v = handler.bracket.global.number(s || "4");
232
232
  if (v != null) {
233
233
  return {
@@ -269,53 +269,47 @@ const gaps = [
269
269
  [/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
270
270
  ];
271
271
 
272
- const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.auto.rem(s))[0];
272
+ const rowCol = (s) => s.replace("col", "column");
273
273
  const autoDirection = (selector, theme) => {
274
- if (selector === "min")
275
- return "min-content";
276
- else if (selector === "max")
277
- return "max-content";
278
- else if (selector === "fr")
279
- return "minmax(0,1fr)";
280
- return calSize(selector, theme);
274
+ const v = theme.fontSize?.[selector];
275
+ if (v != null)
276
+ return toArray(v)[0];
277
+ switch (selector) {
278
+ case "min":
279
+ return "min-content";
280
+ case "max":
281
+ return "max-content";
282
+ case "fr":
283
+ return "minmax(0,1fr)";
284
+ }
285
+ return handler.bracket.auto.rem(selector);
281
286
  };
282
287
  const grids = [
283
288
  ["grid", { display: "grid" }],
284
289
  ["inline-grid", { display: "inline-grid" }],
285
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
286
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
287
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
288
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
289
- [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
290
- const key = d === "row" ? "grid-row" : "grid-column";
291
- let raw = handler.bracket(v);
292
- if (raw)
293
- return { [key]: raw };
294
- const parts = v.split("-");
295
- if (parts.length === 1 && parts[0] === "auto")
296
- return { [key]: parts[0] };
297
- if (parts[0] === "span") {
298
- if (parts[1] === "full")
299
- return { [key]: "1/-1" };
300
- raw = handler.number.bracket(parts[1]);
301
- if (raw)
302
- return { [key]: `span ${raw}/span ${raw}` };
303
- }
290
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
291
+ [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
292
+ if (s === "full")
293
+ return { [`grid-${rowCol(c)}`]: "1/-1" };
294
+ const v = handler.bracket.number(s);
295
+ if (v != null)
296
+ return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
304
297
  }],
305
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
306
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
307
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
308
- [/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": handler.bracket(v) })],
309
- [/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": handler.bracket(v) })],
310
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
311
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
312
- [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
313
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
298
+ [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
299
+ [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
300
+ [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
301
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
302
+ [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket(v) })],
303
+ [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
304
+ [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
305
+ ["grid-rows-none", { "grid-template-rows": "none" }],
306
+ ["grid-cols-none", { "grid-template-columns": "none" }]
314
307
  ];
315
308
 
316
309
  const overflowValues = [
317
310
  "auto",
318
311
  "hidden",
312
+ "clip",
319
313
  "visible",
320
314
  "scroll"
321
315
  ];
@@ -397,7 +391,7 @@ function handleInsetValues([, d, v]) {
397
391
  return directionMap[d].map((i) => [i.slice(1), r]);
398
392
  }
399
393
  const insets = [
400
- [/^(?:position-|pos-)?inset-()(.+)$/, handleInsetValues],
394
+ [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
401
395
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
402
396
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
403
397
  ];
@@ -462,7 +456,7 @@ const contents = [
462
456
  ];
463
457
  const breaks = [
464
458
  ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
465
- ["break-word", { "overflow-wrap": "break-word" }],
459
+ ["break-words", { "overflow-wrap": "break-word" }],
466
460
  ["break-all", { "word-break": "break-all" }]
467
461
  ];
468
462
  const textOverflows = [
@@ -494,14 +488,14 @@ const fontSmoothings = [
494
488
  ];
495
489
 
496
490
  const rings = [
497
- [/^ring-?(.*)$/, ([, d]) => {
491
+ [/^ring(?:-(.+))?$/, ([, d]) => {
498
492
  const value = handler.px(d || "1");
499
493
  if (value) {
500
494
  return {
501
495
  "--un-ring-inset": varEmpty,
502
496
  "--un-ring-offset-width": "0px",
503
497
  "--un-ring-offset-color": "#fff",
504
- "--un-ring-color": "rgba(59, 130, 246, .5)",
498
+ "--un-ring-color": "rgba(147, 197, 253, .5)",
505
499
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
506
500
  "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
507
501
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
@@ -535,7 +529,7 @@ const shadowColorResolver = (body, theme) => {
535
529
  }
536
530
  };
537
531
  const boxShadows = [
538
- [/^shadow-?(.*)$/, ([, d], { theme }) => {
532
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
539
533
  const value = theme.boxShadow?.[d || "DEFAULT"];
540
534
  if (value) {
541
535
  return {
@@ -553,37 +547,38 @@ const boxShadows = [
553
547
  function getPropName(minmax, hw) {
554
548
  return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
555
549
  }
556
- function getThemeValue(minmax, hw, theme, prop) {
550
+ function getSizeValue(minmax, hw, theme, prop) {
557
551
  let str = `${hw === "h" ? "height" : "width"}`;
558
552
  if (minmax)
559
553
  str = `${minmax}${capitalize(str)}`;
560
- return theme[str]?.[prop];
554
+ const v = theme[str]?.[prop];
555
+ if (v != null)
556
+ return v;
557
+ switch (prop) {
558
+ case "fit":
559
+ case "max":
560
+ case "min":
561
+ return `${prop}-content`;
562
+ }
563
+ return handler.bracket.cssvar.fraction.auto.rem(prop);
561
564
  }
562
565
  const sizes = [
563
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
564
- const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.auto.rem(s);
565
- if (v != null)
566
- return { [getPropName(m, w)]: v };
567
- }],
568
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => {
569
- const v = theme.breakpoints?.[s];
570
- if (v != null)
571
- return { [getPropName(m, w)]: v };
572
- }]
573
- ];
566
+ [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
567
+ [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
568
+ ];
569
+ function getAspectRatio(prop) {
570
+ if (/^\d+\/\d+$/.test(prop))
571
+ return prop;
572
+ switch (prop) {
573
+ case "square":
574
+ return "1/1";
575
+ case "video":
576
+ return "16/9";
577
+ }
578
+ return handler.bracket.cssvar.auto.number(prop);
579
+ }
574
580
  const aspectRatio = [
575
- [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
576
- if (/^\d+\/\d+$/.test(d))
577
- return { "aspect-ratio": d };
578
- const v = {
579
- auto: "auto",
580
- square: "1/1",
581
- video: "16/9"
582
- }[d];
583
- if (v != null)
584
- return { "aspect-ratio": v };
585
- return { "aspect-ratio": handler.bracket.cssvar.number(d) };
586
- }]
581
+ [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
587
582
  ];
588
583
 
589
584
  const paddings = [
@@ -619,19 +614,19 @@ const transformBase = {
619
614
  };
620
615
  const transforms = [
621
616
  ["transform", transformBase],
622
- [/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
623
- [/^translate()-(.+)$/, handleTranslate],
617
+ [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
618
+ [/^translate-()(.+)$/, handleTranslate],
624
619
  [/^translate-([xyz])-(.+)$/, handleTranslate],
625
- [/^scale()-(.+)$/, handleScale],
626
- [/^scale-([xyz])-(.+)$/, handleScale],
627
620
  [/^rotate-(.+)$/, handleRotate],
628
- [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
621
+ [/^skew-()(.+)$/, handleSkew],
629
622
  [/^skew-([xy])-(.+)$/, handleSkew],
630
- [/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
623
+ [/^scale-()(.+)$/, handleScale],
624
+ [/^scale-([xyz])-(.+)$/, handleScale],
625
+ ["preserve-3d", { "transform-style": "preserve-3d" }],
626
+ ["preserve-flat", { "transform-style": "flat" }],
631
627
  ["transform-gpu", transformGpu],
632
628
  ["transform-cpu", transformCpu],
633
- ["transform-none", { transform: "none" }],
634
- [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })]
629
+ ["transform-none", { transform: "none" }]
635
630
  ];
636
631
  function handleTranslate([, d, b]) {
637
632
  const v = handler.bracket.fraction.auto.rem(b);
@@ -651,17 +646,8 @@ function handleScale([, d, b]) {
651
646
  ];
652
647
  }
653
648
  }
654
- function handleRotateWithUnit([, b]) {
655
- const v = handler.bracket.number(b);
656
- if (v != null) {
657
- return [
658
- transformBase,
659
- { "--un-rotate": `${v}deg` }
660
- ];
661
- }
662
- }
663
649
  function handleRotate([, b]) {
664
- const v = handler.bracket(b);
650
+ const v = handler.bracket.degree(b);
665
651
  if (v != null) {
666
652
  return [
667
653
  transformBase,
@@ -669,17 +655,8 @@ function handleRotate([, b]) {
669
655
  ];
670
656
  }
671
657
  }
672
- function handleSkewWithUnit([, d, b]) {
673
- const v = handler.bracket.number(b);
674
- if (v != null) {
675
- return [
676
- transformBase,
677
- { [`--un-skew-${d}`]: `${v}deg` }
678
- ];
679
- }
680
- }
681
658
  function handleSkew([, d, b]) {
682
- const v = handler.bracket(b);
659
+ const v = handler.bracket.degree(b);
683
660
  if (v != null) {
684
661
  return [
685
662
  transformBase,
@@ -732,10 +709,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
732
709
  ];
733
710
 
734
711
  const textDecorations = [
735
- ["underline", { "text-decoration": "underline" }],
736
- ["line-through", { "text-decoration": "line-through" }],
737
- ["decoration-underline", { "text-decoration": "underline" }],
738
- ["decoration-line-through", { "text-decoration": "line-through" }],
712
+ ["underline", { "text-decoration-line": "underline" }],
713
+ ["overline", { "text-decoration-line": "overline" }],
714
+ ["line-through", { "text-decoration-line": "line-through" }],
715
+ ["decoration-underline", { "text-decoration-line": "underline" }],
716
+ ["decoration-line-through", { "text-decoration-line": "line-through" }],
739
717
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
740
718
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
741
719
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -46,24 +46,18 @@ const variantCombinators = [
46
46
  variants$1.variantMatcher("svg", (input) => `${input} svg *`)
47
47
  ];
48
48
 
49
- const variantColorsMediaOrClass = [
50
- (v, { options: { dark } }) => {
51
- if (dark === "class")
52
- return variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
53
- },
54
- (v, { options: { dark } }) => {
55
- if (dark === "class")
56
- return variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
57
- },
58
- (v, { options: { dark } }) => {
59
- if (dark === "media")
60
- return variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
61
- },
62
- (v, { options: { dark } }) => {
63
- if (dark === "media")
64
- return variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
49
+ const variantColorsMediaOrClass = (options = {}) => {
50
+ if (options?.dark === "class") {
51
+ return [
52
+ variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`),
53
+ variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)
54
+ ];
65
55
  }
66
- ];
56
+ return [
57
+ variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
58
+ variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
59
+ ];
60
+ };
67
61
 
68
62
  const variantLanguageDirections = [
69
63
  variants$1.variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
@@ -116,7 +110,7 @@ const variantOrientations = [
116
110
 
117
111
  const variantPrint = variants$1.variantParentMatcher("print", "@media print");
118
112
 
119
- const variants = [
113
+ const variants = (options) => [
120
114
  variantNegative,
121
115
  variantImportant,
122
116
  variantPrint,
@@ -126,10 +120,10 @@ const variants = [
126
120
  ...variantCombinators,
127
121
  pseudo.variantPseudoClasses,
128
122
  pseudo.variantPseudoClassFunctions,
129
- pseudo.variantTaggedPseudoClasses,
123
+ ...pseudo.variantTaggedPseudoClasses(options),
130
124
  pseudo.variantPseudoElements,
131
125
  pseudo.partClasses,
132
- ...variantColorsMediaOrClass,
126
+ ...variantColorsMediaOrClass(options),
133
127
  ...variantLanguageDirections
134
128
  ];
135
129
 
@@ -44,24 +44,18 @@ const variantCombinators = [
44
44
  variantMatcher("svg", (input) => `${input} svg *`)
45
45
  ];
46
46
 
47
- const variantColorsMediaOrClass = [
48
- (v, { options: { dark } }) => {
49
- if (dark === "class")
50
- return variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
51
- },
52
- (v, { options: { dark } }) => {
53
- if (dark === "class")
54
- return variantMatcher("light", (input) => `.light $$ ${input}`)(v);
55
- },
56
- (v, { options: { dark } }) => {
57
- if (dark === "media")
58
- return variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
59
- },
60
- (v, { options: { dark } }) => {
61
- if (dark === "media")
62
- return variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
47
+ const variantColorsMediaOrClass = (options = {}) => {
48
+ if (options?.dark === "class") {
49
+ return [
50
+ variantMatcher("dark", (input) => `.dark $$ ${input}`),
51
+ variantMatcher("light", (input) => `.light $$ ${input}`)
52
+ ];
63
53
  }
64
- ];
54
+ return [
55
+ variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
56
+ variantParentMatcher("light", "@media (prefers-color-scheme: light)")
57
+ ];
58
+ };
65
59
 
66
60
  const variantLanguageDirections = [
67
61
  variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
@@ -114,7 +108,7 @@ const variantOrientations = [
114
108
 
115
109
  const variantPrint = variantParentMatcher("print", "@media print");
116
110
 
117
- const variants = [
111
+ const variants = (options) => [
118
112
  variantNegative,
119
113
  variantImportant,
120
114
  variantPrint,
@@ -124,10 +118,10 @@ const variants = [
124
118
  ...variantCombinators,
125
119
  variantPseudoClasses,
126
120
  variantPseudoClassFunctions,
127
- variantTaggedPseudoClasses,
121
+ ...variantTaggedPseudoClasses(options),
128
122
  variantPseudoElements,
129
123
  partClasses,
130
- ...variantColorsMediaOrClass,
124
+ ...variantColorsMediaOrClass(options),
131
125
  ...variantLanguageDirections
132
126
  ];
133
127
 
@@ -123,16 +123,18 @@ const variantPseudoClassFunctions = {
123
123
  },
124
124
  multiPass: true
125
125
  };
126
- const variantTaggedPseudoClasses = {
127
- match: (input, { options: { attributifyPseudo } }) => {
128
- const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
129
- if (g)
130
- return g;
131
- const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
132
- if (p)
133
- return p;
134
- },
135
- multiPass: true
126
+ const variantTaggedPseudoClasses = (options = {}) => {
127
+ const attributify = !!options?.attributifyPseudo;
128
+ return [
129
+ {
130
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
131
+ multiPass: true
132
+ },
133
+ {
134
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
135
+ multiPass: true
136
+ }
137
+ ];
136
138
  };
137
139
  const partClasses = {
138
140
  match: (input) => {
@@ -121,16 +121,18 @@ const variantPseudoClassFunctions = {
121
121
  },
122
122
  multiPass: true
123
123
  };
124
- const variantTaggedPseudoClasses = {
125
- match: (input, { options: { attributifyPseudo } }) => {
126
- const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
127
- if (g)
128
- return g;
129
- const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
130
- if (p)
131
- return p;
132
- },
133
- multiPass: true
124
+ const variantTaggedPseudoClasses = (options = {}) => {
125
+ const attributify = !!options?.attributifyPseudo;
126
+ return [
127
+ {
128
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
129
+ multiPass: true
130
+ },
131
+ {
132
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
133
+ multiPass: true
134
+ }
135
+ ];
134
136
  };
135
137
  const partClasses = {
136
138
  match: (input) => {
@@ -61,7 +61,7 @@ const basePositionMap = [
61
61
  ];
62
62
  const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
63
63
 
64
- const cssBasicProps = [
64
+ const cssProps = [
65
65
  "color",
66
66
  "border-color",
67
67
  "background-color",
@@ -78,17 +78,13 @@ const cssBasicProps = [
78
78
  "zoom",
79
79
  "text-shadow",
80
80
  "transform",
81
- "box-shadow"
82
- ];
83
- const cssPositionProps = [
81
+ "box-shadow",
84
82
  "backround-position",
85
83
  "left",
86
84
  "right",
87
85
  "top",
88
86
  "bottom",
89
- "object-position"
90
- ];
91
- const cssSizeProps = [
87
+ "object-position",
92
88
  "max-height",
93
89
  "min-height",
94
90
  "max-width",
@@ -106,14 +102,16 @@ const cssSizeProps = [
106
102
  "vertical-align",
107
103
  "border-spacing",
108
104
  "letter-spacing",
109
- "word-spacing"
110
- ];
111
- const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
112
- const cssProps = [
113
- ...cssBasicProps,
114
- ...cssPositionProps,
115
- ...cssSizeProps,
116
- ...cssEnhanceProps
105
+ "word-spacing",
106
+ "stroke",
107
+ "filter",
108
+ "backdrop-filter",
109
+ "fill",
110
+ "mask",
111
+ "mask-size",
112
+ "mask-border",
113
+ "clip-path",
114
+ "clip"
117
115
  ];
118
116
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
119
117
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -198,6 +196,15 @@ function time(str) {
198
196
  if (!Number.isNaN(num))
199
197
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
200
198
  }
199
+ function degree(str) {
200
+ const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
201
+ if (!match)
202
+ return;
203
+ const [, n, unit] = match;
204
+ const num = parseFloat(n);
205
+ if (!Number.isNaN(num))
206
+ return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
207
+ }
201
208
  function global(str) {
202
209
  if (["inherit", "initial", "revert", "unset"].includes(str))
203
210
  return str;
@@ -222,6 +229,7 @@ const valueHandlers = {
222
229
  bracket: bracket,
223
230
  cssvar: cssvar,
224
231
  time: time,
232
+ degree: degree,
225
233
  global: global,
226
234
  properties: properties
227
235
  };
@@ -59,7 +59,7 @@ const basePositionMap = [
59
59
  ];
60
60
  const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
61
61
 
62
- const cssBasicProps = [
62
+ const cssProps = [
63
63
  "color",
64
64
  "border-color",
65
65
  "background-color",
@@ -76,17 +76,13 @@ const cssBasicProps = [
76
76
  "zoom",
77
77
  "text-shadow",
78
78
  "transform",
79
- "box-shadow"
80
- ];
81
- const cssPositionProps = [
79
+ "box-shadow",
82
80
  "backround-position",
83
81
  "left",
84
82
  "right",
85
83
  "top",
86
84
  "bottom",
87
- "object-position"
88
- ];
89
- const cssSizeProps = [
85
+ "object-position",
90
86
  "max-height",
91
87
  "min-height",
92
88
  "max-width",
@@ -104,14 +100,16 @@ const cssSizeProps = [
104
100
  "vertical-align",
105
101
  "border-spacing",
106
102
  "letter-spacing",
107
- "word-spacing"
108
- ];
109
- const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
110
- const cssProps = [
111
- ...cssBasicProps,
112
- ...cssPositionProps,
113
- ...cssSizeProps,
114
- ...cssEnhanceProps
103
+ "word-spacing",
104
+ "stroke",
105
+ "filter",
106
+ "backdrop-filter",
107
+ "fill",
108
+ "mask",
109
+ "mask-size",
110
+ "mask-border",
111
+ "clip-path",
112
+ "clip"
115
113
  ];
116
114
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
117
115
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -196,6 +194,15 @@ function time(str) {
196
194
  if (!Number.isNaN(num))
197
195
  return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
198
196
  }
197
+ function degree(str) {
198
+ const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
199
+ if (!match)
200
+ return;
201
+ const [, n, unit] = match;
202
+ const num = parseFloat(n);
203
+ if (!Number.isNaN(num))
204
+ return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
205
+ }
199
206
  function global(str) {
200
207
  if (["inherit", "initial", "revert", "unset"].includes(str))
201
208
  return str;
@@ -220,6 +227,7 @@ const valueHandlers = {
220
227
  bracket: bracket,
221
228
  cssvar: cssvar,
222
229
  time: time,
230
+ degree: degree,
223
231
  global: global,
224
232
  properties: properties
225
233
  };
package/dist/index.cjs CHANGED
@@ -18,7 +18,7 @@ const presetMini = (options = {}) => {
18
18
  name: "@unocss/preset-mini",
19
19
  theme: _default.theme,
20
20
  rules: _default$1.rules,
21
- variants: _default$2.variants,
21
+ variants: _default$2.variants(options),
22
22
  options,
23
23
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
24
24
  };
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ const presetMini = (options = {}) => {
15
15
  name: "@unocss/preset-mini",
16
16
  theme,
17
17
  rules,
18
- variants,
18
+ variants: variants(options),
19
19
  options,
20
20
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
21
21
  };
package/dist/theme.d.ts CHANGED
@@ -77,8 +77,6 @@ declare const baseSize: {
77
77
  '5xl': string;
78
78
  '6xl': string;
79
79
  '7xl': string;
80
- min: string;
81
- max: string;
82
80
  prose: string;
83
81
  };
84
82
  declare const width: {
@@ -94,8 +92,6 @@ declare const width: {
94
92
  '5xl': string;
95
93
  '6xl': string;
96
94
  '7xl': string;
97
- min: string;
98
- max: string;
99
95
  prose: string;
100
96
  auto: string;
101
97
  };
@@ -112,8 +108,6 @@ declare const maxWidth: {
112
108
  '5xl': string;
113
109
  '6xl': string;
114
110
  '7xl': string;
115
- min: string;
116
- max: string;
117
111
  prose: string;
118
112
  none: string;
119
113
  };
@@ -130,8 +124,6 @@ declare const height: {
130
124
  '5xl': string;
131
125
  '6xl': string;
132
126
  '7xl': string;
133
- min: string;
134
- max: string;
135
127
  prose: string;
136
128
  auto: string;
137
129
  };
@@ -148,8 +140,6 @@ declare const maxHeight: {
148
140
  '5xl': string;
149
141
  '6xl': string;
150
142
  '7xl': string;
151
- min: string;
152
- max: string;
153
143
  prose: string;
154
144
  none: string;
155
145
  };
package/dist/utils.d.ts CHANGED
@@ -17,6 +17,7 @@ declare function fraction(str: string): string | undefined;
17
17
  declare function bracket(str: string): string | undefined;
18
18
  declare function cssvar(str: string): string | undefined;
19
19
  declare function time(str: string): string | undefined;
20
+ declare function degree(str: string): string | undefined;
20
21
  declare function global(str: string): string | undefined;
21
22
  declare function properties(str: string): string | undefined;
22
23
 
@@ -30,6 +31,7 @@ declare const handlers_fraction: typeof fraction;
30
31
  declare const handlers_bracket: typeof bracket;
31
32
  declare const handlers_cssvar: typeof cssvar;
32
33
  declare const handlers_time: typeof time;
34
+ declare const handlers_degree: typeof degree;
33
35
  declare const handlers_global: typeof global;
34
36
  declare const handlers_properties: typeof properties;
35
37
  declare namespace handlers {
@@ -44,13 +46,14 @@ declare namespace handlers {
44
46
  handlers_bracket as bracket,
45
47
  handlers_cssvar as cssvar,
46
48
  handlers_time as time,
49
+ handlers_degree as degree,
47
50
  handlers_global as global,
48
51
  handlers_properties as properties,
49
52
  };
50
53
  }
51
54
 
52
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
53
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
55
+ declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
56
+ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
54
57
 
55
58
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
56
59
  declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
@@ -1,16 +1,19 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
3
3
  import { T as Theme } from './types-a2d2b52f';
4
+ import { PresetMiniOptions } from './index';
5
+ import './default-958434b6';
6
+ import './colors-6d634692';
4
7
 
5
8
  declare const variantBreakpoints: Variant<Theme>;
6
9
 
7
10
  declare const variantCombinators: Variant[];
8
11
 
9
- declare const variantColorsMediaOrClass: Variant[];
12
+ declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => VariantFunction[];
10
13
 
11
14
  declare const variantLanguageDirections: Variant[];
12
15
 
13
- declare const variants: Variant<Theme>[];
16
+ declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
14
17
 
15
18
  declare const variantImportant: Variant;
16
19
  declare const variantNegative: Variant;
@@ -25,7 +28,7 @@ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
25
28
  declare const variantPseudoElements: VariantFunction;
26
29
  declare const variantPseudoClasses: VariantObject;
27
30
  declare const variantPseudoClassFunctions: VariantObject;
28
- declare const variantTaggedPseudoClasses: VariantObject;
31
+ declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
29
32
  declare const partClasses: VariantObject;
30
33
 
31
34
  export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantTaggedPseudoClasses, variants };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.20.4",
3
+ "version": "0.21.0",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.20.4"
64
+ "@unocss/core": "0.21.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",