@unocss/preset-mini 0.24.3 → 0.26.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.
@@ -7,7 +7,7 @@ function hex2rgba(hex = "") {
7
7
  const color = parseHexColor(hex);
8
8
  if (color != null) {
9
9
  const { components, alpha } = color;
10
- if (alpha === void 0)
10
+ if (alpha == null)
11
11
  return components;
12
12
  return [...components, alpha];
13
13
  }
@@ -20,7 +20,7 @@ function parseCssColor(str = "") {
20
20
  const type = casedType.toLowerCase();
21
21
  if (components.length === 0)
22
22
  return;
23
- if (["rgba", "hsla"].includes(type) && alpha === void 0)
23
+ if (["rgba", "hsla"].includes(type) && alpha == null)
24
24
  return;
25
25
  if (cssColorFunctions.includes(type) && components.length !== 3)
26
26
  return;
@@ -58,7 +58,7 @@ function parseColor$1(str) {
58
58
  return color;
59
59
  }
60
60
  function parseHexColor(str) {
61
- const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
61
+ const [, body] = str.match(/^#([\da-f]+)$/i) || [];
62
62
  if (!body)
63
63
  return;
64
64
  switch (body.length) {
@@ -354,7 +354,8 @@ const cssProps = [
354
354
  "mask-size",
355
355
  "mask-border",
356
356
  "clip-path",
357
- "clip"
357
+ "clip",
358
+ "border-radius"
358
359
  ];
359
360
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
360
361
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -419,13 +420,30 @@ function fraction(str) {
419
420
  if (!Number.isNaN(num))
420
421
  return `${round(num * 100)}%`;
421
422
  }
422
- function bracket(str) {
423
- if (str && str[0] === "[" && str[str.length - 1] === "]") {
424
- return str.slice(1, -1).replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
425
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
426
- });
423
+ function bracketWithType(str, type) {
424
+ if (str && str.startsWith("[") && str.endsWith("]")) {
425
+ let base;
426
+ const match = str.match(/^\[(color|length):/i);
427
+ if (!match)
428
+ base = str.slice(1, -1);
429
+ else if (type && match[1] === type)
430
+ base = str.slice(match[0].length, -1);
431
+ if (base !== void 0) {
432
+ return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
433
+ return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
434
+ });
435
+ }
427
436
  }
428
437
  }
438
+ function bracket(str) {
439
+ return bracketWithType(str);
440
+ }
441
+ function bracketOfColor(str) {
442
+ return bracketWithType(str, "color");
443
+ }
444
+ function bracketOfLength(str) {
445
+ return bracketWithType(str, "length");
446
+ }
429
447
  function cssvar(str) {
430
448
  if (str.match(/^\$\S/))
431
449
  return `var(--${core.escapeSelector(str.slice(1))})`;
@@ -470,6 +488,8 @@ const valueHandlers = {
470
488
  percent: percent,
471
489
  fraction: fraction,
472
490
  bracket: bracket,
491
+ bracketOfColor: bracketOfColor,
492
+ bracketOfLength: bracketOfLength,
473
493
  cssvar: cssvar,
474
494
  time: time,
475
495
  degree: degree,
@@ -482,23 +502,30 @@ const h = handler;
482
502
 
483
503
  const directionSize = (propertyPrefix) => ([_, direction, size]) => {
484
504
  const v = handler.bracket.cssvar.auto.fraction.rem(size);
485
- if (v !== void 0)
505
+ if (v != null)
486
506
  return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
487
507
  };
488
508
  const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
489
509
  const parseColor = (body, theme) => {
490
- const [main, opacity] = body.split(/(?:\/|:)/);
510
+ const split = body.split(/(?:\/|:)/);
511
+ let main, opacity;
512
+ if (split[0] === "[color") {
513
+ main = split.slice(0, 2).join(":");
514
+ opacity = split[2];
515
+ } else {
516
+ [main, opacity] = split;
517
+ }
491
518
  const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
492
519
  const [name] = colors;
493
520
  if (!name)
494
521
  return;
495
522
  let color;
496
- const bracket = handler.bracket(main);
523
+ const bracket = handler.bracketOfColor(main);
497
524
  const bracketOrMain = bracket || main;
498
525
  if (bracketOrMain.startsWith("#"))
499
- color = bracketOrMain.slice(1);
526
+ color = bracketOrMain;
500
527
  else if (bracketOrMain.startsWith("hex-"))
501
- color = bracketOrMain.slice(4);
528
+ color = `#${bracketOrMain.slice(4)}`;
502
529
  else if (main.startsWith("$"))
503
530
  color = handler.cssvar(main);
504
531
  color = color || bracket;
@@ -566,6 +593,9 @@ const colorableShadows = (shadows, colorVar) => {
566
593
  }
567
594
  return colored;
568
595
  };
596
+ const hasParseableColor = (color, theme) => {
597
+ return color != null && !!parseColor(color, theme)?.color;
598
+ };
569
599
 
570
600
  exports.colorResolver = colorResolver;
571
601
  exports.colorToString = colorToString;
@@ -576,6 +606,7 @@ exports.directionSize = directionSize;
576
606
  exports.getComponents = getComponents;
577
607
  exports.h = h;
578
608
  exports.handler = handler;
609
+ exports.hasParseableColor = hasParseableColor;
579
610
  exports.hex2rgba = hex2rgba;
580
611
  exports.insetMap = insetMap;
581
612
  exports.parseColor = parseColor;
@@ -5,7 +5,7 @@ function hex2rgba(hex = "") {
5
5
  const color = parseHexColor(hex);
6
6
  if (color != null) {
7
7
  const { components, alpha } = color;
8
- if (alpha === void 0)
8
+ if (alpha == null)
9
9
  return components;
10
10
  return [...components, alpha];
11
11
  }
@@ -18,7 +18,7 @@ function parseCssColor(str = "") {
18
18
  const type = casedType.toLowerCase();
19
19
  if (components.length === 0)
20
20
  return;
21
- if (["rgba", "hsla"].includes(type) && alpha === void 0)
21
+ if (["rgba", "hsla"].includes(type) && alpha == null)
22
22
  return;
23
23
  if (cssColorFunctions.includes(type) && components.length !== 3)
24
24
  return;
@@ -56,7 +56,7 @@ function parseColor$1(str) {
56
56
  return color;
57
57
  }
58
58
  function parseHexColor(str) {
59
- const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
59
+ const [, body] = str.match(/^#([\da-f]+)$/i) || [];
60
60
  if (!body)
61
61
  return;
62
62
  switch (body.length) {
@@ -352,7 +352,8 @@ const cssProps = [
352
352
  "mask-size",
353
353
  "mask-border",
354
354
  "clip-path",
355
- "clip"
355
+ "clip",
356
+ "border-radius"
356
357
  ];
357
358
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
358
359
  const numberRE = /^(-?[0-9.]+)$/i;
@@ -417,13 +418,30 @@ function fraction(str) {
417
418
  if (!Number.isNaN(num))
418
419
  return `${round(num * 100)}%`;
419
420
  }
420
- function bracket(str) {
421
- if (str && str[0] === "[" && str[str.length - 1] === "]") {
422
- return str.slice(1, -1).replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
423
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
424
- });
421
+ function bracketWithType(str, type) {
422
+ if (str && str.startsWith("[") && str.endsWith("]")) {
423
+ let base;
424
+ const match = str.match(/^\[(color|length):/i);
425
+ if (!match)
426
+ base = str.slice(1, -1);
427
+ else if (type && match[1] === type)
428
+ base = str.slice(match[0].length, -1);
429
+ if (base !== void 0) {
430
+ return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
431
+ return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
432
+ });
433
+ }
425
434
  }
426
435
  }
436
+ function bracket(str) {
437
+ return bracketWithType(str);
438
+ }
439
+ function bracketOfColor(str) {
440
+ return bracketWithType(str, "color");
441
+ }
442
+ function bracketOfLength(str) {
443
+ return bracketWithType(str, "length");
444
+ }
427
445
  function cssvar(str) {
428
446
  if (str.match(/^\$\S/))
429
447
  return `var(--${escapeSelector(str.slice(1))})`;
@@ -468,6 +486,8 @@ const valueHandlers = {
468
486
  percent: percent,
469
487
  fraction: fraction,
470
488
  bracket: bracket,
489
+ bracketOfColor: bracketOfColor,
490
+ bracketOfLength: bracketOfLength,
471
491
  cssvar: cssvar,
472
492
  time: time,
473
493
  degree: degree,
@@ -480,23 +500,30 @@ const h = handler;
480
500
 
481
501
  const directionSize = (propertyPrefix) => ([_, direction, size]) => {
482
502
  const v = handler.bracket.cssvar.auto.fraction.rem(size);
483
- if (v !== void 0)
503
+ if (v != null)
484
504
  return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
485
505
  };
486
506
  const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
487
507
  const parseColor = (body, theme) => {
488
- const [main, opacity] = body.split(/(?:\/|:)/);
508
+ const split = body.split(/(?:\/|:)/);
509
+ let main, opacity;
510
+ if (split[0] === "[color") {
511
+ main = split.slice(0, 2).join(":");
512
+ opacity = split[2];
513
+ } else {
514
+ [main, opacity] = split;
515
+ }
489
516
  const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
490
517
  const [name] = colors;
491
518
  if (!name)
492
519
  return;
493
520
  let color;
494
- const bracket = handler.bracket(main);
521
+ const bracket = handler.bracketOfColor(main);
495
522
  const bracketOrMain = bracket || main;
496
523
  if (bracketOrMain.startsWith("#"))
497
- color = bracketOrMain.slice(1);
524
+ color = bracketOrMain;
498
525
  else if (bracketOrMain.startsWith("hex-"))
499
- color = bracketOrMain.slice(4);
526
+ color = `#${bracketOrMain.slice(4)}`;
500
527
  else if (main.startsWith("$"))
501
528
  color = handler.cssvar(main);
502
529
  color = color || bracket;
@@ -564,5 +591,8 @@ const colorableShadows = (shadows, colorVar) => {
564
591
  }
565
592
  return colored;
566
593
  };
594
+ const hasParseableColor = (color, theme) => {
595
+ return color != null && !!parseColor(color, theme)?.color;
596
+ };
567
597
 
568
- export { colorToString as a, cornerMap as b, colorResolver as c, directionMap as d, colorableShadows as e, directionSize as f, positionMap as g, handler as h, insetMap as i, hex2rgba as j, parseCssColor as k, getComponents as l, h as m, parseColor as p, valueHandlers as v, xyzMap as x };
598
+ export { hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f, directionSize as g, handler as h, insetMap as i, positionMap as j, hex2rgba as k, parseCssColor as l, getComponents as m, h as n, parseColor as p, valueHandlers as v, xyzMap as x };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-f185ef8d';
1
+ import { T as Theme } from './types-20b16474';
2
2
 
3
3
  declare const colors: Theme['colors'];
4
4
 
package/dist/colors.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as colors } from './colors-06de139a';
2
- import './types-f185ef8d';
1
+ export { c as colors } from './colors-e269d6e0';
2
+ import './types-20b16474';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-f185ef8d';
1
+ import { T as Theme } from './types-20b16474';
2
2
 
3
3
  declare const theme: Theme;
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { PresetOptions, Preset } from '@unocss/core';
2
- import { T as Theme } from './types-f185ef8d';
3
- export { T as Theme, a as ThemeAnimation } from './types-f185ef8d';
4
- export { t as theme } from './default-595a2a04';
5
- export { c as colors } from './colors-06de139a';
6
- export { p as parseColor } from './utilities-df1ea892';
2
+ import { T as Theme } from './types-20b16474';
3
+ export { T as Theme, a as ThemeAnimation } from './types-20b16474';
4
+ export { t as theme } from './default-c3837f44';
5
+ export { c as colors } from './colors-e269d6e0';
6
+ export { p as parseColor } from './utilities-9f0998a3';
7
7
 
8
8
  interface PresetMiniOptions extends PresetOptions {
9
9
  /**
package/dist/rules.cjs CHANGED
@@ -44,7 +44,6 @@ exports.questionMark = _default.questionMark;
44
44
  exports.resizes = _default.resizes;
45
45
  exports.rings = _default.rings;
46
46
  exports.rules = _default.rules;
47
- exports.shadowBase = _default.shadowBase;
48
47
  exports.sizes = _default.sizes;
49
48
  exports.svgUtilities = _default.svgUtilities;
50
49
  exports.tabSizes = _default.tabSizes;
package/dist/rules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './types-f185ef8d';
2
+ import { T as Theme } from './types-20b16474';
3
3
 
4
4
  declare const verticalAligns: Rule[];
5
5
  declare const textAligns: Rule[];
@@ -26,7 +26,7 @@ declare const flex: Rule[];
26
26
 
27
27
  declare const gaps: Rule[];
28
28
 
29
- declare const grids: Rule[];
29
+ declare const grids: Rule<Theme>[];
30
30
 
31
31
  declare const overflows: Rule[];
32
32
 
@@ -49,13 +49,6 @@ declare const questionMark: Rule[];
49
49
 
50
50
  declare const rings: Rule<Theme>[];
51
51
 
52
- declare const shadowBase: {
53
- "$$shortcut-no-merge": string;
54
- '--un-ring-offset-shadow': string;
55
- '--un-ring-shadow': string;
56
- '--un-shadow-inset': string;
57
- '--un-shadow': string;
58
- };
59
52
  declare const boxShadows: Rule<Theme>[];
60
53
 
61
54
  declare const sizes: Rule<Theme>[];
@@ -96,4 +89,4 @@ declare const cssProperty: Rule[];
96
89
 
97
90
  declare const textDecorations: Rule[];
98
91
 
99
- export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, shadowBase, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
92
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
package/dist/rules.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { l as alignments, a as appearance, H as appearances, C as aspectRatio, e as bgColors, b as borders, A as boxShadows, s as boxSizing, O as breaks, N as contents, a0 as cssProperty, $ as cssVariables, I as cursors, G as displays, f as flex, q as floats, S as fontSmoothings, R as fontStyles, W as fonts, g as gaps, h as grids, n as insets, j as justifies, E as margins, c as opacity, k as orders, o as outline, i as overflows, D as paddings, m as placements, J as pointerEvents, p as positions, u as questionMark, K as resizes, x as rings, r as rules, y as shadowBase, B as sizes, T as svgUtilities, X as tabSizes, t as textAligns, d as textColors, a1 as textDecorations, Y as textIndents, P as textOverflows, _ as textShadows, Z as textStrokes, Q as textTransforms, U as transforms, V as transitions, L as userSelects, F as varEmpty, v as verticalAligns, M as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
1
+ export { l as alignments, a as appearance, G as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, N as breaks, M as contents, $ as cssProperty, _ as cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, V as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, I as pointerEvents, p as positions, u as questionMark, J as resizes, x as rings, r as rules, A as sizes, S as svgUtilities, W as tabSizes, t as textAligns, d as textColors, a0 as textDecorations, X as textIndents, O as textOverflows, Z as textShadows, Y as textStrokes, P as textTransforms, T as transforms, U as transitions, K as userSelects, E as varEmpty, v as verticalAligns, L as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
package/dist/theme.cjs CHANGED
@@ -17,6 +17,12 @@ exports.dropShadow = _default.dropShadow;
17
17
  exports.easing = _default.easing;
18
18
  exports.fontFamily = _default.fontFamily;
19
19
  exports.fontSize = _default.fontSize;
20
+ exports.gridAutoColumn = _default.gridAutoColumn;
21
+ exports.gridAutoRow = _default.gridAutoRow;
22
+ exports.gridColumn = _default.gridColumn;
23
+ exports.gridRow = _default.gridRow;
24
+ exports.gridTemplateColumn = _default.gridTemplateColumn;
25
+ exports.gridTemplateRow = _default.gridTemplateRow;
20
26
  exports.height = _default.height;
21
27
  exports.letterSpacing = _default.letterSpacing;
22
28
  exports.lineHeight = _default.lineHeight;
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { c as colors } from './colors-06de139a';
2
- export { t as theme } from './default-595a2a04';
3
- import { T as Theme } from './types-f185ef8d';
4
- export { T as Theme, a as ThemeAnimation } from './types-f185ef8d';
1
+ export { c as colors } from './colors-e269d6e0';
2
+ export { t as theme } from './default-c3837f44';
3
+ import { T as Theme } from './types-20b16474';
4
+ export { T as Theme, a as ThemeAnimation } from './types-20b16474';
5
5
 
6
6
  declare const blur: {
7
7
  DEFAULT: string;
@@ -36,6 +36,45 @@ declare const lineHeight: Theme['lineHeight'];
36
36
  declare const letterSpacing: Theme['letterSpacing'];
37
37
  declare const wordSpacing: Theme['wordSpacing'];
38
38
 
39
+ declare const gridAutoColumn: {
40
+ xs: string;
41
+ sm: string;
42
+ base: string;
43
+ lg: string;
44
+ xl: string;
45
+ '2xl': string;
46
+ '3xl': string;
47
+ '4xl': string;
48
+ '5xl': string;
49
+ '6xl': string;
50
+ '7xl': string;
51
+ '8xl': string;
52
+ '9xl': string;
53
+ };
54
+ declare const gridAutoRow: {
55
+ xs: string;
56
+ sm: string;
57
+ base: string;
58
+ lg: string;
59
+ xl: string;
60
+ '2xl': string;
61
+ '3xl': string;
62
+ '4xl': string;
63
+ '5xl': string;
64
+ '6xl': string;
65
+ '7xl': string;
66
+ '8xl': string;
67
+ '9xl': string;
68
+ };
69
+ declare const gridColumn: {};
70
+ declare const gridRow: {};
71
+ declare const gridTemplateColumn: {
72
+ none: string;
73
+ };
74
+ declare const gridTemplateRow: {
75
+ none: string;
76
+ };
77
+
39
78
  declare const breakpoints: {
40
79
  sm: string;
41
80
  md: string;
@@ -158,4 +197,4 @@ declare const maxHeight: {
158
197
  none: string;
159
198
  };
160
199
 
161
- export { baseSize, blur, borderRadius, boxShadow, breakpoints, dropShadow, easing, fontFamily, fontSize, height, letterSpacing, lineHeight, maxHeight, maxWidth, textIndent, textShadow, textStrokeWidth, verticalBreakpoints, width, wordSpacing };
200
+ export { baseSize, blur, borderRadius, boxShadow, breakpoints, dropShadow, easing, fontFamily, fontSize, gridAutoColumn, gridAutoRow, gridColumn, gridRow, gridTemplateColumn, gridTemplateRow, height, letterSpacing, lineHeight, maxHeight, maxWidth, textIndent, textShadow, textStrokeWidth, verticalBreakpoints, width, wordSpacing };
package/dist/theme.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  export { c as colors } from './chunks/colors.mjs';
2
- export { n as baseSize, b as blur, j as borderRadius, k as boxShadow, i as breakpoints, d as dropShadow, m as easing, f as fontFamily, a as fontSize, q as height, h as letterSpacing, l as lineHeight, r as maxHeight, p as maxWidth, c as textIndent, g as textShadow, e as textStrokeWidth, t as theme, v as verticalBreakpoints, o as width, w as wordSpacing } from './chunks/default.mjs';
2
+ export { u as baseSize, b as blur, q as borderRadius, r as boxShadow, p as breakpoints, d as dropShadow, s as easing, f as fontFamily, a as fontSize, i as gridAutoColumn, j as gridAutoRow, k as gridColumn, m as gridRow, n as gridTemplateColumn, o as gridTemplateRow, z as height, h as letterSpacing, l as lineHeight, A as maxHeight, y as maxWidth, c as textIndent, g as textShadow, e as textStrokeWidth, t as theme, v as verticalBreakpoints, x as width, w as wordSpacing } from './chunks/default.mjs';
@@ -33,7 +33,14 @@ interface Theme {
33
33
  blur?: Record<string, string>;
34
34
  dropShadow?: Record<string, string | string[]>;
35
35
  easing?: Record<string, string>;
36
+ media?: Record<string, string>;
36
37
  animation?: ThemeAnimation;
38
+ gridAutoColumn?: Record<string, string>;
39
+ gridAutoRow?: Record<string, string>;
40
+ gridColumn?: Record<string, string>;
41
+ gridRow?: Record<string, string>;
42
+ gridTemplateColumn?: Record<string, string>;
43
+ gridTemplateRow?: Record<string, string>;
37
44
  }
38
45
 
39
46
  export { Theme as T, ThemeAnimation as a };
@@ -1,23 +1,22 @@
1
- import { DynamicMatcher, ParsedColorValue } from '@unocss/core';
2
- import { T as Theme } from './types-f185ef8d';
1
+ import { CSSEntries, ParsedColorValue, RuleContext, CSSObject } from '@unocss/core';
2
+ import { T as Theme } from './types-20b16474';
3
3
 
4
4
  /**
5
5
  * Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
6
6
  *
7
7
  * @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
8
- * @return {DynamicMatcher} {@link DynamicMatcher}
8
+ * @return {@link DynamicMatcher} object.
9
9
  * @see {@link directionMap}
10
10
  */
11
- declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
11
+ declare const directionSize: (propertyPrefix: string) => ([_, direction, size]: string[]) => CSSEntries | undefined;
12
12
  /**
13
- * Parse color string into rgba (if possible) with opacity. Color value will be matched to theme object before converting to rgb value.
13
+ * Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
14
+ * See also color.tests.ts for more examples.
14
15
  *
15
16
  * @example Parseable strings:
16
17
  * 'red' // From theme, if 'red' is available
17
18
  * 'red-100' // From theme, plus scale
18
19
  * 'red-100/20' // From theme, plus scale/opacity
19
- * '#f12' // Hex color
20
- * 'hex-f12' // Alternative hex color
21
20
  * '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
22
21
  *
23
22
  * @param {string} body - Color string to be parsed.
@@ -36,21 +35,22 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
36
35
  *
37
36
  * @example Resolving 'red-100' from theme:
38
37
  * colorResolver('background-color', 'background')('', 'red-100')
39
- * return { '--un-background-opacity': '1', 'background-color': 'rgb(254,226,226,var(--un-bg-opacity))' }
38
+ * return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
40
39
  *
41
40
  * @example Resolving 'red-100/20' from theme:
42
41
  * colorResolver('background-color', 'background')('', 'red-100/20')
43
- * return { 'background-color': 'rgb(204,251,241,0.22)' }
42
+ * return { 'background-color': 'rgba(204,251,241,0.22)' }
44
43
  *
45
44
  * @example Resolving 'hex-124':
46
45
  * colorResolver('color', 'text')('', 'hex-124')
47
- * return { '--un-text-opacity': '1', 'color': 'rgb(17,34,68,var(--un-text-opacity))' }
46
+ * return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
48
47
  *
49
48
  * @param {string} property - Property for the css value to be created.
50
49
  * @param {string} varName - Base name for the opacity variable.
51
- * @return {DynamicMatcher} {@link DynamicMatcher} object.
50
+ * @return {@link DynamicMatcher} object.
52
51
  */
53
- declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
52
+ declare const colorResolver: (property: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => CSSObject | undefined;
54
53
  declare const colorableShadows: (shadows: string | string[], colorVar: string) => string[];
54
+ declare const hasParseableColor: (color: string | undefined, theme: Theme) => boolean;
55
55
 
56
- export { colorableShadows as a, colorResolver as c, directionSize as d, parseColor as p };
56
+ export { colorableShadows as a, colorResolver as c, directionSize as d, hasParseableColor as h, parseColor as p };
package/dist/utils.cjs CHANGED
@@ -17,6 +17,7 @@ exports.directionSize = utilities.directionSize;
17
17
  exports.getComponents = utilities.getComponents;
18
18
  exports.h = utilities.h;
19
19
  exports.handler = utilities.handler;
20
+ exports.hasParseableColor = utilities.hasParseableColor;
20
21
  exports.hex2rgba = utilities.hex2rgba;
21
22
  exports.insetMap = utilities.insetMap;
22
23
  exports.parseColor = utilities.parseColor;
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { RGBAColorValue, CSSColorValue, VariantHandler } from '@unocss/core';
3
- export { c as colorResolver, a as colorableShadows, d as directionSize, p as parseColor } from './utilities-df1ea892';
4
- import './types-f185ef8d';
3
+ export { c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor } from './utilities-9f0998a3';
4
+ import './types-20b16474';
5
5
 
6
6
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
7
  declare function parseCssColor(str?: string): CSSColorValue | undefined;
@@ -22,6 +22,8 @@ declare function number(str: string): string | undefined;
22
22
  declare function percent(str: string): string | undefined;
23
23
  declare function fraction(str: string): string | undefined;
24
24
  declare function bracket(str: string): string | undefined;
25
+ declare function bracketOfColor(str: string): string | undefined;
26
+ declare function bracketOfLength(str: string): string | undefined;
25
27
  declare function cssvar(str: string): string | undefined;
26
28
  declare function time(str: string): string | undefined;
27
29
  declare function degree(str: string): string | undefined;
@@ -36,6 +38,8 @@ declare const handlers_number: typeof number;
36
38
  declare const handlers_percent: typeof percent;
37
39
  declare const handlers_fraction: typeof fraction;
38
40
  declare const handlers_bracket: typeof bracket;
41
+ declare const handlers_bracketOfColor: typeof bracketOfColor;
42
+ declare const handlers_bracketOfLength: typeof bracketOfLength;
39
43
  declare const handlers_cssvar: typeof cssvar;
40
44
  declare const handlers_time: typeof time;
41
45
  declare const handlers_degree: typeof degree;
@@ -51,6 +55,8 @@ declare namespace handlers {
51
55
  handlers_percent as percent,
52
56
  handlers_fraction as fraction,
53
57
  handlers_bracket as bracket,
58
+ handlers_bracketOfColor as bracketOfColor,
59
+ handlers_bracketOfLength as bracketOfLength,
54
60
  handlers_cssvar as cssvar,
55
61
  handlers_time as time,
56
62
  handlers_degree as degree,
@@ -59,8 +65,8 @@ declare namespace handlers {
59
65
  };
60
66
  }
61
67
 
62
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
63
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
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">;
64
70
 
65
71
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
66
72
  declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
package/dist/utils.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { c as colorResolver, a as colorToString, e as colorableShadows, b as cornerMap, d as directionMap, f as directionSize, l as getComponents, m as h, h as handler, j as hex2rgba, i as insetMap, p as parseColor, k as parseCssColor, g as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
1
+ export { c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, g as directionSize, m as getComponents, n as h, h as handler, a as hasParseableColor, k as hex2rgba, i as insetMap, p as parseColor, l as parseCssColor, j as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
2
2
  export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
3
3
  import '@unocss/core';
package/dist/variants.cjs CHANGED
@@ -12,15 +12,16 @@ exports.partClasses = _default.partClasses;
12
12
  exports.variantBreakpoints = _default.variantBreakpoints;
13
13
  exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
14
14
  exports.variantCombinators = _default.variantCombinators;
15
+ exports.variantCustomMedia = _default.variantCustomMedia;
15
16
  exports.variantImportant = _default.variantImportant;
16
17
  exports.variantLanguageDirections = _default.variantLanguageDirections;
17
18
  exports.variantLayer = _default.variantLayer;
18
- exports.variantMotions = _default.variantMotions;
19
19
  exports.variantNegative = _default.variantNegative;
20
- exports.variantOrientations = _default.variantOrientations;
21
20
  exports.variantPrint = _default.variantPrint;
22
21
  exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
23
22
  exports.variantPseudoClasses = _default.variantPseudoClasses;
24
23
  exports.variantPseudoElements = _default.variantPseudoElements;
24
+ exports.variantScope = _default.variantScope;
25
+ exports.variantSelector = _default.variantSelector;
25
26
  exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
26
27
  exports.variants = _default.variants;
@@ -1,17 +1,16 @@
1
1
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
2
- import { T as Theme } from './types-f185ef8d';
2
+ import { T as Theme } from './types-20b16474';
3
3
  import { PresetMiniOptions } from './index';
4
- import './default-595a2a04';
5
- import './colors-06de139a';
6
- import './utilities-df1ea892';
4
+ import './default-c3837f44';
5
+ import './colors-e269d6e0';
6
+ import './utilities-9f0998a3';
7
7
 
8
8
  declare const variantBreakpoints: Variant<Theme>;
9
9
 
10
10
  declare const variantCombinators: Variant[];
11
11
 
12
- declare const variantMotions: VariantFunction[];
13
- declare const variantOrientations: VariantFunction[];
14
12
  declare const variantPrint: VariantFunction;
13
+ declare const variantCustomMedia: VariantFunction;
15
14
 
16
15
  declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => VariantFunction[];
17
16
 
@@ -19,7 +18,9 @@ declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
19
18
 
20
19
  declare const variantLanguageDirections: Variant[];
21
20
 
21
+ declare const variantSelector: Variant;
22
22
  declare const variantLayer: Variant;
23
+ declare const variantScope: Variant;
23
24
  declare const variantImportant: Variant;
24
25
  declare const variantNegative: Variant;
25
26
 
@@ -29,4 +30,4 @@ declare const variantPseudoClassFunctions: VariantObject;
29
30
  declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
30
31
  declare const partClasses: VariantObject;
31
32
 
32
- export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantLayer, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantTaggedPseudoClasses, variants };
33
+ export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCustomMedia, variantImportant, variantLanguageDirections, variantLayer, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantScope, variantSelector, variantTaggedPseudoClasses, variants };
package/dist/variants.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { p as partClasses, a as variantBreakpoints, f as variantColorsMediaOrClass, b as variantCombinators, i as variantImportant, g as variantLanguageDirections, h as variantLayer, c as variantMotions, j as variantNegative, d as variantOrientations, e as variantPrint, m as variantPseudoClassFunctions, l as variantPseudoClasses, k as variantPseudoElements, n as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
1
+ export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint, n as variantPseudoClassFunctions, m as variantPseudoClasses, l as variantPseudoElements, i as variantScope, g as variantSelector, o as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
2
2
  import './chunks/variants.mjs';
3
3
  import '@unocss/core';