@unocss/preset-mini 0.23.0 → 0.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import { escapeSelector, createValueHandler } from '@unocss/core';
1
+ import { escapeSelector, createValueHandler, toArray } from '@unocss/core';
2
2
 
3
+ const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
3
4
  function hex2rgba(hex = "") {
4
5
  const color = parseHexColor(hex);
5
6
  if (color != null) {
@@ -9,41 +10,32 @@ function hex2rgba(hex = "") {
9
10
  return [...components, alpha];
10
11
  }
11
12
  }
12
- function parseHexColor(str) {
13
- const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
14
- if (!body)
15
- return;
16
- switch (body.length) {
17
- case 3:
18
- case 4:
19
- const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
20
- return {
21
- type: "rgb",
22
- components: digits.slice(0, 3),
23
- alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
24
- };
25
- case 6:
26
- case 8:
27
- const value = Number.parseInt(body, 16);
28
- return {
29
- type: "rgb",
30
- components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
31
- alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
32
- };
33
- }
34
- }
35
13
  function parseCssColor(str = "") {
36
14
  const color = parseColor$1(str);
37
15
  if (color == null)
38
16
  return;
39
17
  const { type: casedType, components, alpha } = color;
40
18
  const type = casedType.toLowerCase();
19
+ if (components.length === 0)
20
+ return;
41
21
  if (["rgba", "hsla"].includes(type) && alpha === void 0)
42
22
  return;
43
- if (["rgb", "hsl", "hwb", "lab", "lch", "oklab", "oklch"].includes(type) && components.length !== 3)
23
+ if (cssColorFunctions.includes(type) && components.length !== 3)
44
24
  return;
45
25
  return { type, components, alpha };
46
26
  }
27
+ function colorToString(color, alphaOverride) {
28
+ const { components } = color;
29
+ let { alpha, type } = color;
30
+ alpha = alphaOverride ?? alpha;
31
+ type = type.toLowerCase();
32
+ if (["hsla", "hsl", "rgba", "rgb"].includes(type))
33
+ return `${type.replace("a", "")}a(${components.join(",")}${alpha == null ? "" : `,${alpha}`})`;
34
+ alpha = alpha == null ? "" : ` / ${alpha}`;
35
+ if (cssColorFunctions.includes(type))
36
+ return `${type}(${components.join(" ")}${alpha})`;
37
+ return `color(${type} ${components.join(" ")}${alpha})`;
38
+ }
47
39
  function parseColor$1(str) {
48
40
  if (!str)
49
41
  return;
@@ -63,10 +55,32 @@ function parseColor$1(str) {
63
55
  if (color != null)
64
56
  return color;
65
57
  }
58
+ function parseHexColor(str) {
59
+ const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
60
+ if (!body)
61
+ return;
62
+ switch (body.length) {
63
+ case 3:
64
+ case 4:
65
+ const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
66
+ return {
67
+ type: "rgb",
68
+ components: digits.slice(0, 3),
69
+ alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
70
+ };
71
+ case 6:
72
+ case 8:
73
+ const value = Number.parseInt(body, 16);
74
+ return {
75
+ type: "rgb",
76
+ components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
77
+ alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
78
+ };
79
+ }
80
+ }
66
81
  function cssColorKeyword(str) {
67
82
  const color = {
68
- rebeccapurple: [102, 51, 153, 1],
69
- transparent: [0, 0, 0, 0]
83
+ rebeccapurple: [102, 51, 153, 1]
70
84
  }[str];
71
85
  if (color != null) {
72
86
  return {
@@ -76,54 +90,13 @@ function cssColorKeyword(str) {
76
90
  };
77
91
  }
78
92
  }
79
- function getComponent(separator, str) {
80
- const component = str.trim();
81
- if (component === "")
82
- return;
83
- const l = str.length;
84
- let parenthesis = 0;
85
- for (let i = 0; i < l; i++) {
86
- switch (str[i]) {
87
- case "(":
88
- parenthesis++;
89
- break;
90
- case ")":
91
- if (--parenthesis < 0)
92
- return;
93
- break;
94
- case separator:
95
- if (parenthesis === 0) {
96
- const component2 = str.slice(0, i).trim();
97
- if (component2 === "")
98
- return;
99
- return [
100
- str.slice(0, i).trim(),
101
- str.slice(i + 1).trim()
102
- ];
103
- }
104
- }
105
- }
106
- return [
107
- str.trim(),
108
- ""
109
- ];
110
- }
111
93
  function parseCssCommaColorFunction(color) {
112
94
  const match = color.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i);
113
95
  if (!match)
114
96
  return;
115
97
  const [, type, componentString] = match;
116
- const components = [];
117
- let cs = componentString;
118
- for (let c = 5; c > 0 && cs !== ""; --c) {
119
- const componentValue = getComponent(",", cs);
120
- if (!componentValue)
121
- return;
122
- const [component, rest] = componentValue;
123
- components.push(component);
124
- cs = rest;
125
- }
126
- if ([3, 4].includes(components.length)) {
98
+ const components = getComponents(componentString, ",", 5);
99
+ if (components && [3, 4].includes(components.length)) {
127
100
  return {
128
101
  type,
129
102
  components: components.slice(0, 3),
@@ -131,8 +104,9 @@ function parseCssCommaColorFunction(color) {
131
104
  };
132
105
  }
133
106
  }
107
+ const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
134
108
  function parseCssSpaceColorFunction(color) {
135
- const match = color.match(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\((.+)\)$/i);
109
+ const match = color.match(cssColorFunctionsRe);
136
110
  if (!match)
137
111
  return;
138
112
  const [, fn, componentString] = match;
@@ -161,16 +135,9 @@ function parseCssColorFunction(color) {
161
135
  }
162
136
  }
163
137
  function parseCssSpaceColorValues(componentString) {
164
- let cs = componentString;
165
- const components = [];
166
- while (cs !== "") {
167
- const cc = getComponent(" ", cs);
168
- if (!cc)
169
- return;
170
- const [component, rest] = cc;
171
- components.push(component);
172
- cs = rest;
173
- }
138
+ const components = getComponents(componentString);
139
+ if (!components)
140
+ return;
174
141
  let totalComponents = components.length;
175
142
  if (components[totalComponents - 2] === "/") {
176
143
  return {
@@ -178,21 +145,14 @@ function parseCssSpaceColorValues(componentString) {
178
145
  alpha: components[totalComponents - 1]
179
146
  };
180
147
  }
181
- if (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/")) {
148
+ if (components[totalComponents - 2] != null && (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/"))) {
182
149
  const removed = components.splice(totalComponents - 2);
183
150
  components.push(removed.join(" "));
184
151
  --totalComponents;
185
152
  }
186
- cs = components[totalComponents - 1];
187
- const withAlpha = [];
188
- while (cs !== "") {
189
- const cc = getComponent("/", cs);
190
- if (!cc)
191
- return;
192
- const [component, rest] = cc;
193
- withAlpha.push(component);
194
- cs = rest;
195
- }
153
+ const withAlpha = getComponents(components[totalComponents - 1], "/", 3);
154
+ if (!withAlpha)
155
+ return;
196
156
  if (withAlpha.length === 1 || withAlpha[withAlpha.length - 1] === "")
197
157
  return { components };
198
158
  const alpha = withAlpha.pop();
@@ -202,6 +162,58 @@ function parseCssSpaceColorValues(componentString) {
202
162
  alpha
203
163
  };
204
164
  }
165
+ function getComponent(str, separator) {
166
+ str = str.trim();
167
+ if (str === "")
168
+ return;
169
+ const l = str.length;
170
+ let parenthesis = 0;
171
+ for (let i = 0; i < l; i++) {
172
+ switch (str[i]) {
173
+ case "(":
174
+ parenthesis++;
175
+ break;
176
+ case ")":
177
+ if (--parenthesis < 0)
178
+ return;
179
+ break;
180
+ case separator:
181
+ if (parenthesis === 0) {
182
+ const component = str.slice(0, i).trim();
183
+ if (component === "")
184
+ return;
185
+ return [
186
+ component,
187
+ str.slice(i + 1).trim()
188
+ ];
189
+ }
190
+ }
191
+ }
192
+ return [
193
+ str,
194
+ ""
195
+ ];
196
+ }
197
+ function getComponents(str, separator, limit) {
198
+ separator = separator ?? " ";
199
+ if (separator.length !== 1)
200
+ return;
201
+ limit = limit ?? 10;
202
+ const components = [];
203
+ let i = 0;
204
+ while (str !== "") {
205
+ if (++i > limit)
206
+ return;
207
+ const componentPair = getComponent(str, separator);
208
+ if (!componentPair)
209
+ return;
210
+ const [component, rest] = componentPair;
211
+ components.push(component);
212
+ str = rest;
213
+ }
214
+ if (components.length > 0)
215
+ return components;
216
+ }
205
217
 
206
218
  const directionMap = {
207
219
  "l": ["-left"],
@@ -507,48 +519,50 @@ const parseColor = (body, theme) => {
507
519
  else if (no && colorData)
508
520
  color = colorData[no];
509
521
  }
510
- const rgba = hex2rgba(color);
511
- const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
512
- const hasAlpha = alpha != null && !Number.isNaN(alpha);
513
- if (rgba) {
514
- if (hasAlpha) {
515
- rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
516
- } else {
517
- rgba.splice(3);
518
- }
519
- }
520
522
  return {
521
523
  opacity,
522
524
  name,
523
525
  no,
524
526
  color,
525
- rgba,
526
- alpha: hasAlpha ? alpha : void 0
527
+ cssColor: parseCssColor(color),
528
+ alpha: handler.bracket.cssvar.percent(opacity ?? "")
527
529
  };
528
530
  };
529
531
  const colorResolver = (property, varName) => ([, body], { theme }) => {
530
532
  const data = parseColor(body, theme);
531
533
  if (!data)
532
534
  return;
533
- const { alpha, opacity, color, rgba } = data;
534
- if (!color)
535
- return;
536
- if (rgba) {
535
+ const { alpha, color, cssColor } = data;
536
+ if (cssColor) {
537
537
  if (alpha != null) {
538
538
  return {
539
- [property]: `rgba(${rgba.join(",")})`
539
+ [property]: colorToString(cssColor, alpha)
540
540
  };
541
541
  } else {
542
542
  return {
543
- [`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
544
- [property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
543
+ [`--un-${varName}-opacity`]: cssColor.alpha ?? 1,
544
+ [property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
545
545
  };
546
546
  }
547
- } else {
547
+ } else if (color) {
548
548
  return {
549
- [property]: color.replace("%alpha", `${alpha || 1}`)
549
+ [property]: color.replace("%alpha", `${alpha ?? 1}`)
550
550
  };
551
551
  }
552
552
  };
553
+ const colorableShadows = (shadows, colorVar) => {
554
+ const colored = [];
555
+ shadows = toArray(shadows);
556
+ for (let i = 0; i < shadows.length; i++) {
557
+ const components = getComponents(shadows[i], " ", 6);
558
+ if (!components || components.length < 3)
559
+ return shadows;
560
+ const color = parseCssColor(components.pop());
561
+ if (color == null)
562
+ return shadows;
563
+ colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
564
+ }
565
+ return colored;
566
+ };
553
567
 
554
- export { cornerMap as a, directionSize as b, colorResolver as c, directionMap as d, positionMap as e, hex2rgba as f, parseCssColor as g, handler as h, insetMap as i, h as j, parseColor as p, valueHandlers as v, xyzMap as x };
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 };
@@ -25,4 +25,4 @@ const variantParentMatcher = (name, parent) => {
25
25
  };
26
26
  };
27
27
 
28
- export { variantParentMatcher as a, variantMatcher as v };
28
+ export { variantMatcher as a, variantParentMatcher as v };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-154878eb';
1
+ import { T as Theme } from './types-f185ef8d';
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-db01a23e';
2
- import './types-154878eb';
1
+ export { c as colors } from './colors-06de139a';
2
+ import './types-f185ef8d';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-154878eb';
1
+ import { T as Theme } from './types-f185ef8d';
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-154878eb';
3
- export { T as Theme, a as ThemeAnimation } from './types-154878eb';
4
- export { t as theme } from './default-c46850c2';
5
- export { c as colors } from './colors-db01a23e';
6
- export { p as parseColor } from './utilities-8c324eff';
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';
7
7
 
8
8
  interface PresetMiniOptions extends PresetOptions {
9
9
  /**
package/dist/rules.cjs CHANGED
@@ -17,7 +17,6 @@ exports.borders = _default.borders;
17
17
  exports.boxShadows = _default.boxShadows;
18
18
  exports.boxSizing = _default.boxSizing;
19
19
  exports.breaks = _default.breaks;
20
- exports.colorableShadows = _default.colorableShadows;
21
20
  exports.contents = _default.contents;
22
21
  exports.cssProperty = _default.cssProperty;
23
22
  exports.cssVariables = _default.cssVariables;
package/dist/rules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './types-154878eb';
2
+ import { T as Theme } from './types-f185ef8d';
3
3
 
4
4
  declare const verticalAligns: Rule[];
5
5
  declare const textAligns: Rule[];
@@ -56,7 +56,6 @@ declare const shadowBase: {
56
56
  '--un-shadow-inset': string;
57
57
  '--un-shadow': string;
58
58
  };
59
- declare const colorableShadows: (shadows: string | string[], colorVar: string) => string[];
60
59
  declare const boxShadows: Rule<Theme>[];
61
60
 
62
61
  declare const sizes: Rule<Theme>[];
@@ -97,4 +96,4 @@ declare const cssProperty: Rule[];
97
96
 
98
97
  declare const textDecorations: Rule[];
99
98
 
100
- export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, colorableShadows, 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 };
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 };
package/dist/rules.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { l as alignments, a as appearance, I as appearances, D as aspectRatio, e as bgColors, b as borders, B as boxShadows, s as boxSizing, P as breaks, A as colorableShadows, O as contents, a1 as cssProperty, a0 as cssVariables, J as cursors, H as displays, f as flex, q as floats, T as fontSmoothings, S as fontStyles, X as fonts, g as gaps, h as grids, n as insets, j as justifies, F as margins, c as opacity, k as orders, o as outline, i as overflows, E as paddings, m as placements, K as pointerEvents, p as positions, u as questionMark, L as resizes, x as rings, r as rules, y as shadowBase, C as sizes, U as svgUtilities, Y as tabSizes, t as textAligns, d as textColors, a2 as textDecorations, Z as textIndents, Q as textOverflows, $ as textShadows, _ as textStrokes, R as textTransforms, V as transforms, W as transitions, M as userSelects, G as varEmpty, v as verticalAligns, N as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
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';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
package/dist/theme.cjs CHANGED
@@ -26,5 +26,6 @@ exports.textIndent = _default.textIndent;
26
26
  exports.textShadow = _default.textShadow;
27
27
  exports.textStrokeWidth = _default.textStrokeWidth;
28
28
  exports.theme = _default.theme;
29
+ exports.verticalBreakpoints = _default.verticalBreakpoints;
29
30
  exports.width = _default.width;
30
31
  exports.wordSpacing = _default.wordSpacing;
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { c as colors } from './colors-db01a23e';
2
- export { t as theme } from './default-c46850c2';
3
- import { T as Theme } from './types-154878eb';
4
- export { T as Theme, a as ThemeAnimation } from './types-154878eb';
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';
5
5
 
6
6
  declare const blur: {
7
7
  DEFAULT: string;
@@ -43,6 +43,13 @@ declare const breakpoints: {
43
43
  xl: string;
44
44
  '2xl': string;
45
45
  };
46
+ declare const verticalBreakpoints: {
47
+ sm: string;
48
+ md: string;
49
+ lg: string;
50
+ xl: string;
51
+ '2xl': string;
52
+ };
46
53
  declare const borderRadius: {
47
54
  DEFAULT: string;
48
55
  none: string;
@@ -151,4 +158,4 @@ declare const maxHeight: {
151
158
  none: string;
152
159
  };
153
160
 
154
- export { baseSize, blur, borderRadius, boxShadow, breakpoints, dropShadow, easing, fontFamily, fontSize, height, letterSpacing, lineHeight, maxHeight, maxWidth, textIndent, textShadow, textStrokeWidth, width, wordSpacing };
161
+ export { baseSize, blur, borderRadius, boxShadow, breakpoints, dropShadow, easing, fontFamily, fontSize, 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, o as width, w as wordSpacing } from './chunks/default.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';
@@ -19,6 +19,7 @@ interface Theme {
19
19
  minBlockSize?: Record<string, string>;
20
20
  borderRadius?: Record<string, string>;
21
21
  breakpoints?: Record<string, string>;
22
+ verticalBreakpoints?: Record<string, string>;
22
23
  colors?: Record<string, string | Record<string, string>>;
23
24
  fontFamily?: Record<string, string>;
24
25
  fontSize?: Record<string, [string, string]>;
@@ -1,5 +1,5 @@
1
1
  import { DynamicMatcher, ParsedColorValue } from '@unocss/core';
2
- import { T as Theme } from './types-154878eb';
2
+ import { T as Theme } from './types-f185ef8d';
3
3
 
4
4
  /**
5
5
  * Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
@@ -36,20 +36,21 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
36
36
  *
37
37
  * @example Resolving 'red-100' from theme:
38
38
  * colorResolver('background-color', 'background')('', 'red-100')
39
- * return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
39
+ * return { '--un-background-opacity': '1', 'background-color': 'rgb(254,226,226,var(--un-bg-opacity))' }
40
40
  *
41
41
  * @example Resolving 'red-100/20' from theme:
42
42
  * colorResolver('background-color', 'background')('', 'red-100/20')
43
- * return { 'background-color': 'rgba(204,251,241,0.22)' }
43
+ * return { 'background-color': 'rgb(204,251,241,0.22)' }
44
44
  *
45
45
  * @example Resolving 'hex-124':
46
46
  * colorResolver('color', 'text')('', 'hex-124')
47
- * return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
47
+ * return { '--un-text-opacity': '1', 'color': 'rgb(17,34,68,var(--un-text-opacity))' }
48
48
  *
49
49
  * @param {string} property - Property for the css value to be created.
50
50
  * @param {string} varName - Base name for the opacity variable.
51
51
  * @return {DynamicMatcher} {@link DynamicMatcher} object.
52
52
  */
53
53
  declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
54
+ declare const colorableShadows: (shadows: string | string[], colorVar: string) => string[];
54
55
 
55
- export { colorResolver as c, directionSize as d, parseColor as p };
56
+ export { colorableShadows as a, colorResolver as c, directionSize as d, parseColor as p };
package/dist/utils.cjs CHANGED
@@ -9,9 +9,12 @@ require('@unocss/core');
9
9
 
10
10
 
11
11
  exports.colorResolver = utilities.colorResolver;
12
+ exports.colorToString = utilities.colorToString;
13
+ exports.colorableShadows = utilities.colorableShadows;
12
14
  exports.cornerMap = utilities.cornerMap;
13
15
  exports.directionMap = utilities.directionMap;
14
16
  exports.directionSize = utilities.directionSize;
17
+ exports.getComponents = utilities.getComponents;
15
18
  exports.h = utilities.h;
16
19
  exports.handler = utilities.handler;
17
20
  exports.hex2rgba = utilities.hex2rgba;
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { RGBAColorValue, CSSColorValue, VariantHandler } from '@unocss/core';
3
- export { c as colorResolver, d as directionSize, p as parseColor } from './utilities-8c324eff';
4
- import './types-154878eb';
3
+ export { c as colorResolver, a as colorableShadows, d as directionSize, p as parseColor } from './utilities-df1ea892';
4
+ import './types-f185ef8d';
5
5
 
6
6
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
7
  declare function parseCssColor(str?: string): CSSColorValue | undefined;
8
+ declare function colorToString(color: CSSColorValue, alphaOverride?: string | number): string;
9
+ declare function getComponents(str: string, separator?: string, limit?: number): string[] | undefined;
8
10
 
9
11
  declare const directionMap: Record<string, string[]>;
10
12
  declare const insetMap: Record<string, string[]>;
@@ -63,4 +65,4 @@ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit"
63
65
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
64
66
  declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
65
67
 
66
- export { cornerMap, directionMap, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
68
+ export { colorToString, cornerMap, directionMap, getComponents, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { c as colorResolver, a as cornerMap, d as directionMap, b as directionSize, j as h, h as handler, f as hex2rgba, i as insetMap, p as parseColor, g as parseCssColor, e as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
2
- export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
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';
2
+ export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
3
3
  import '@unocss/core';
@@ -1,9 +1,9 @@
1
1
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
2
- import { T as Theme } from './types-154878eb';
2
+ import { T as Theme } from './types-f185ef8d';
3
3
  import { PresetMiniOptions } from './index';
4
- import './default-c46850c2';
5
- import './colors-db01a23e';
6
- import './utilities-8c324eff';
4
+ import './default-595a2a04';
5
+ import './colors-06de139a';
6
+ import './utilities-df1ea892';
7
7
 
8
8
  declare const variantBreakpoints: Variant<Theme>;
9
9
 
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.23.0",
3
+ "version": "0.24.3",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
7
7
  "unocss-preset"
8
8
  ],
9
- "homepage": "https://github.com/antfu/unocss/tree/main/packages/preset-mini#readme",
9
+ "homepage": "https://github.com/unocss/unocss/tree/main/packages/preset-mini#readme",
10
10
  "bugs": {
11
- "url": "https://github.com/antfu/unocss/issues"
11
+ "url": "https://github.com/unocss/unocss/issues"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/antfu/unocss.git",
15
+ "url": "git+https://github.com/unocss/unocss.git",
16
16
  "directory": "packages/preset-mini"
17
17
  },
18
18
  "funding": "https://github.com/sponsors/antfu",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.23.0"
64
+ "@unocss/core": "0.24.3"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",