@unocss/preset-mini 0.16.4 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { createValueHandler } from '@unocss/core';
1
+ import { createValueHandler, hex2rgba } from '@unocss/core';
2
2
 
3
3
  const directionMap = {
4
4
  "l": ["-left"],
@@ -34,12 +34,64 @@ const xyzMap = {
34
34
  "": ["-x", "-y"]
35
35
  };
36
36
 
37
+ const cssBasicProps = [
38
+ "color",
39
+ "border-color",
40
+ "background-color",
41
+ "flex-grow",
42
+ "flex",
43
+ "flex-shrink",
44
+ "caret-color",
45
+ "font",
46
+ "gap",
47
+ "opacity",
48
+ "visibility",
49
+ "z-index",
50
+ "font-weight",
51
+ "zoom",
52
+ "text-shadow",
53
+ "transform",
54
+ "box-shadow"
55
+ ];
56
+ const cssPositionProps = [
57
+ "backround-position",
58
+ "left",
59
+ "right",
60
+ "top",
61
+ "bottom",
62
+ "object-position"
63
+ ];
64
+ const cssSizeProps = [
65
+ "max-height",
66
+ "min-height",
67
+ "max-width",
68
+ "min-width",
69
+ "height",
70
+ "width",
71
+ "border-width",
72
+ "margin",
73
+ "padding",
74
+ "outline-width",
75
+ "outline-offset",
76
+ "font-size",
77
+ "line-height",
78
+ "text-indent",
79
+ "vertical-align",
80
+ "border-spacing",
81
+ "letter-spacing",
82
+ "word-spacing"
83
+ ];
84
+ const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
85
+ const cssProps = [
86
+ ...cssBasicProps,
87
+ ...cssPositionProps,
88
+ ...cssSizeProps,
89
+ ...cssEnhanceProps
90
+ ];
37
91
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
38
92
  const numberRE = /^(-?[0-9.]+)$/i;
39
93
  const unitOnlyRE = /^(px)$/i;
40
94
  function numberWithUnit(str) {
41
- if (str === "auto" || str === "a")
42
- return "auto";
43
95
  const match = str.match(numberWithUnitRE);
44
96
  if (!match)
45
97
  return;
@@ -47,9 +99,11 @@ function numberWithUnit(str) {
47
99
  if (unit)
48
100
  return str;
49
101
  }
50
- function rem(str) {
102
+ function auto(str) {
51
103
  if (str === "auto" || str === "a")
52
104
  return "auto";
105
+ }
106
+ function rem(str) {
53
107
  if (str.match(unitOnlyRE))
54
108
  return `1${str}`;
55
109
  const match = str.match(numberWithUnitRE);
@@ -120,10 +174,20 @@ function global(str) {
120
174
  if (["inherit", "initial", "revert", "unset"].includes(str))
121
175
  return str;
122
176
  }
177
+ function properties(str) {
178
+ if (str === void 0)
179
+ return;
180
+ for (const prop of str.split(",")) {
181
+ if (!cssProps.includes(prop))
182
+ return;
183
+ }
184
+ return str;
185
+ }
123
186
 
124
187
  const valueHandlers = {
125
188
  __proto__: null,
126
189
  numberWithUnit: numberWithUnit,
190
+ auto: auto,
127
191
  rem: rem,
128
192
  px: px,
129
193
  number: number,
@@ -132,7 +196,8 @@ const valueHandlers = {
132
196
  bracket: bracket,
133
197
  cssvar: cssvar,
134
198
  time: time,
135
- global: global
199
+ global: global,
200
+ properties: properties
136
201
  };
137
202
 
138
203
  const handler = createValueHandler(valueHandlers);
@@ -141,10 +206,78 @@ const h = handler;
141
206
  function capitalize(str) {
142
207
  return str.charAt(0).toUpperCase() + str.slice(1);
143
208
  }
144
- const directionSize = (prefix) => ([_, direction, size]) => {
145
- const v = handler.bracket.rem.fraction.cssvar(size);
146
- if (v)
147
- return directionMap[direction].map((i) => [prefix + i, v]);
209
+ const directionSize = (propertyPrefix) => ([_, direction, size]) => {
210
+ const v = handler.bracket.auto.rem.fraction.cssvar(size);
211
+ if (v !== void 0)
212
+ return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
213
+ };
214
+ const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
215
+ const parseColor = (body, theme) => {
216
+ const [main, opacity] = body.split(/(?:\/|:)/);
217
+ const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
218
+ const [name] = colors;
219
+ if (!name)
220
+ return;
221
+ let color;
222
+ const bracket = handler.bracket(main);
223
+ const bracketOrMain = bracket || main;
224
+ if (bracketOrMain.startsWith("#"))
225
+ color = bracketOrMain.slice(1);
226
+ if (bracketOrMain.startsWith("hex-"))
227
+ color = bracketOrMain.slice(4);
228
+ color = color || bracket;
229
+ let no = "DEFAULT";
230
+ if (!color) {
231
+ let colorData;
232
+ const [scale] = colors.slice(-1);
233
+ if (scale.match(/^\d+$/)) {
234
+ no = scale;
235
+ colorData = getThemeColor(theme, colors.slice(0, -1));
236
+ } else {
237
+ colorData = getThemeColor(theme, colors);
238
+ if (!colorData) {
239
+ [, no = no] = colors;
240
+ colorData = getThemeColor(theme, [name]);
241
+ }
242
+ }
243
+ if (typeof colorData === "string")
244
+ color = colorData;
245
+ else if (no && colorData)
246
+ color = colorData[no];
247
+ }
248
+ return {
249
+ opacity,
250
+ name,
251
+ no,
252
+ color,
253
+ rgba: hex2rgba(color)
254
+ };
255
+ };
256
+ const colorResolver = (property, varName) => ([, body], { theme }) => {
257
+ const data = parseColor(body, theme);
258
+ if (!data)
259
+ return;
260
+ const { opacity, color, rgba } = data;
261
+ if (!color)
262
+ return;
263
+ const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
264
+ if (rgba) {
265
+ if (a != null && !Number.isNaN(a)) {
266
+ rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
267
+ return {
268
+ [property]: `rgba(${rgba.join(",")})`
269
+ };
270
+ } else {
271
+ return {
272
+ [`--un-${varName}-opacity`]: 1,
273
+ [property]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
274
+ };
275
+ }
276
+ } else {
277
+ return {
278
+ [property]: color.replace("%alpha", `${a || 1}`)
279
+ };
280
+ }
148
281
  };
149
282
 
150
- export { capitalize as a, directionSize as b, cornerMap as c, directionMap as d, h as e, handler as h, valueHandlers as v, xyzMap as x };
283
+ export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e, h as f, handler as h, parseColor as p, valueHandlers as v, xyzMap as x };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-7963d0b3';
1
+ import { T as Theme } from './types-a2d2b52f';
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-d6b5a5b4';
2
- import './types-7963d0b3';
1
+ export { c as colors } from './colors-6d634692';
2
+ import './types-a2d2b52f';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-7963d0b3';
1
+ import { T as Theme } from './types-a2d2b52f';
2
2
 
3
3
  declare const theme: Theme;
4
4
 
package/dist/index.cjs CHANGED
@@ -6,8 +6,8 @@ const _default = require('./chunks/default.cjs');
6
6
  const _default$1 = require('./chunks/default2.cjs');
7
7
  const _default$2 = require('./chunks/default3.cjs');
8
8
  const colors = require('./chunks/colors.cjs');
9
- require('@unocss/core');
10
9
  require('./chunks/utilities.cjs');
10
+ require('@unocss/core');
11
11
  require('./chunks/pseudo.cjs');
12
12
  require('./chunks/variants.cjs');
13
13
 
@@ -15,10 +15,7 @@ const presetMini = (options = {}) => ({
15
15
  name: "@unocss/preset-mini",
16
16
  theme: _default.theme,
17
17
  rules: _default$1.rules,
18
- variants: [
19
- ..._default$2.variants,
20
- ...options.dark === "media" ? _default$2.variantColorsMedia : _default$2.variantColorsClass
21
- ],
18
+ variants: _default$2.variants(options),
22
19
  options
23
20
  });
24
21
 
package/dist/index.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { Preset } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
3
- export { T as Theme } from './types-7963d0b3';
4
- export { t as theme } from './default-c7c67d23';
5
- export { c as colors } from './colors-d6b5a5b4';
2
+ import { T as Theme } from './types-a2d2b52f';
3
+ export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
4
+ export { t as theme } from './default-958434b6';
5
+ export { c as colors } from './colors-6d634692';
6
6
 
7
7
  interface PresetMiniOptions {
8
8
  /**
9
9
  * @default 'class'
10
10
  */
11
11
  dark?: 'class' | 'media';
12
+ /**
13
+ * @default false
14
+ */
15
+ attributifyPseudo?: Boolean;
12
16
  }
13
17
  declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
14
18
 
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { t as theme } from './chunks/default.mjs';
2
2
  export { t as theme } from './chunks/default.mjs';
3
3
  import { r as rules } from './chunks/default2.mjs';
4
- import { v as variants, a as variantColorsMedia, b as variantColorsClass } from './chunks/default3.mjs';
4
+ import { v as variants } from './chunks/default3.mjs';
5
5
  export { c as colors } from './chunks/colors.mjs';
6
- import '@unocss/core';
7
6
  import './chunks/utilities.mjs';
7
+ import '@unocss/core';
8
8
  import './chunks/pseudo.mjs';
9
9
  import './chunks/variants.mjs';
10
10
 
@@ -12,10 +12,7 @@ const presetMini = (options = {}) => ({
12
12
  name: "@unocss/preset-mini",
13
13
  theme,
14
14
  rules,
15
- variants: [
16
- ...variants,
17
- ...options.dark === "media" ? variantColorsMedia : variantColorsClass
18
- ],
15
+ variants: variants(options),
19
16
  options
20
17
  });
21
18
 
package/dist/rules.cjs CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const _default = require('./chunks/default2.cjs');
6
- require('@unocss/core');
7
6
  require('./chunks/utilities.cjs');
7
+ require('@unocss/core');
8
8
  require('./chunks/pseudo.cjs');
9
9
 
10
10
 
@@ -14,14 +14,11 @@ exports.appearance = _default.appearance;
14
14
  exports.appearances = _default.appearances;
15
15
  exports.aspectRatio = _default.aspectRatio;
16
16
  exports.bgColors = _default.bgColors;
17
- exports.borderColors = _default.borderColors;
18
17
  exports.borders = _default.borders;
19
18
  exports.boxShadows = _default.boxShadows;
20
19
  exports.boxSizing = _default.boxSizing;
21
20
  exports.breaks = _default.breaks;
22
- exports.colorResolver = _default.colorResolver;
23
21
  exports.contents = _default.contents;
24
- exports.cssProps = _default.cssProps;
25
22
  exports.cssVariables = _default.cssVariables;
26
23
  exports.cursors = _default.cursors;
27
24
  exports.displays = _default.displays;
@@ -40,15 +37,11 @@ exports.orders = _default.orders;
40
37
  exports.outline = _default.outline;
41
38
  exports.overflows = _default.overflows;
42
39
  exports.paddings = _default.paddings;
43
- exports.parseColorUtil = _default.parseColorUtil;
44
- exports.placeholder = _default.placeholder;
45
40
  exports.placements = _default.placements;
46
41
  exports.pointerEvents = _default.pointerEvents;
47
42
  exports.positions = _default.positions;
48
43
  exports.questionMark = _default.questionMark;
49
44
  exports.resizes = _default.resizes;
50
- exports.ringColors = _default.ringColors;
51
- exports.ringOffsetColors = _default.ringOffsetColors;
52
45
  exports.rings = _default.rings;
53
46
  exports.rules = _default.rules;
54
47
  exports.sizes = _default.sizes;
package/dist/rules.d.ts CHANGED
@@ -1,26 +1,15 @@
1
- import { Rule, RuleContext } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
1
+ import { Rule } from '@unocss/core';
2
+ import { T as Theme } from './types-a2d2b52f';
3
3
 
4
4
  declare const verticalAligns: Rule[];
5
5
  declare const textAligns: Rule[];
6
6
 
7
7
  declare const outline: Rule[];
8
8
  declare const appearance: Rule[];
9
- declare const placeholder: Rule[];
10
9
  declare const willChange: Rule[];
11
10
 
12
11
  declare const borders: Rule[];
13
12
 
14
- declare const parseColorUtil: (body: string, theme: Theme) => {
15
- opacity: string;
16
- name: string;
17
- no: string;
18
- color: string | undefined;
19
- rgba: [number, number, number, number] | [number, number, number] | undefined;
20
- } | undefined;
21
- declare const colorResolver: (attribute: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => {
22
- [x: string]: string | number;
23
- } | undefined;
24
13
  /**
25
14
  * @example op10 op-30 opacity-100
26
15
  */
@@ -30,9 +19,6 @@ declare const opacity: Rule[];
30
19
  */
31
20
  declare const textColors: Rule[];
32
21
  declare const bgColors: Rule[];
33
- declare const borderColors: Rule[];
34
- declare const ringColors: Rule[];
35
- declare const ringOffsetColors: Rule[];
36
22
 
37
23
  declare const rules: Rule[];
38
24
 
@@ -71,7 +57,6 @@ declare const aspectRatio: Rule[];
71
57
  declare const paddings: Rule[];
72
58
  declare const margins: Rule[];
73
59
 
74
- declare const cssProps: string[];
75
60
  declare const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
76
61
  declare const displays: Rule[];
77
62
  declare const appearances: Rule[];
@@ -103,4 +88,4 @@ declare const cssVariables: Rule[];
103
88
 
104
89
  declare const textDecorations: Rule[];
105
90
 
106
- export { alignments, appearance, appearances, aspectRatio, bgColors, borderColors, borders, boxShadows, boxSizing, breaks, colorResolver, contents, cssProps, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, parseColorUtil, placeholder, placements, pointerEvents, positions, questionMark, resizes, ringColors, ringOffsetColors, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
91
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, 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,4 +1,4 @@
1
- export { x as alignments, a as appearance, N as appearances, H as aspectRatio, g as bgColors, h as borderColors, b as borders, F as boxShadows, C as boxSizing, U as breaks, d as colorResolver, T as contents, K as cssProps, a5 as cssVariables, O as cursors, M as displays, k as flex, A as floats, Y as fontSmoothings, X as fontStyles, a0 as fonts, l as gaps, m as grids, z as insets, s as justifies, J as margins, e as opacity, u as orders, o as outline, n as overflows, I as paddings, c as parseColorUtil, p as placeholder, y as placements, P as pointerEvents, q as positions, D as questionMark, Q as resizes, i as ringColors, j as ringOffsetColors, E as rings, r as rules, G as sizes, Z as svgUtilities, a1 as tabSizes, t as textAligns, f as textColors, a6 as textDecorations, a2 as textIndents, V as textOverflows, a4 as textShadows, a3 as textStrokes, W as textTransforms, _ as transforms, $ as transitions, R as userSelects, L as varEmpty, v as verticalAligns, S as whitespaces, w as willChange, B as zIndexes } from './chunks/default2.mjs';
2
- import '@unocss/core';
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 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, $ 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';
3
2
  import './chunks/utilities.mjs';
3
+ import '@unocss/core';
4
4
  import './chunks/pseudo.mjs';
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { c as colors } from './colors-d6b5a5b4';
2
- export { t as theme } from './default-c7c67d23';
3
- import { T as Theme } from './types-7963d0b3';
4
- export { T as Theme } from './types-7963d0b3';
1
+ export { c as colors } from './colors-6d634692';
2
+ export { t as theme } from './default-958434b6';
3
+ import { T as Theme } from './types-a2d2b52f';
4
+ export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
5
5
 
6
6
  declare const blur: {
7
7
  DEFAULT: string;
@@ -1,3 +1,9 @@
1
+ interface ThemeAnimation {
2
+ keyframes?: Record<string, string>;
3
+ durations?: Record<string, string>;
4
+ timingFns?: Record<string, string>;
5
+ properties?: Record<string, object>;
6
+ }
1
7
  interface Theme {
2
8
  width?: Record<string, string>;
3
9
  height?: Record<string, string>;
@@ -19,6 +25,7 @@ interface Theme {
19
25
  textStrokeWidth?: Record<string, string>;
20
26
  blur?: Record<string, string>;
21
27
  dropShadow?: Record<string, string | string[]>;
28
+ animation?: ThemeAnimation;
22
29
  }
23
30
 
24
- export { Theme as T };
31
+ export { Theme as T, ThemeAnimation as a };
package/dist/utils.cjs CHANGED
@@ -9,11 +9,13 @@ require('@unocss/core');
9
9
 
10
10
 
11
11
  exports.capitalize = utilities.capitalize;
12
+ exports.colorResolver = utilities.colorResolver;
12
13
  exports.cornerMap = utilities.cornerMap;
13
14
  exports.directionMap = utilities.directionMap;
14
15
  exports.directionSize = utilities.directionSize;
15
16
  exports.h = utilities.h;
16
17
  exports.handler = utilities.handler;
18
+ exports.parseColor = utilities.parseColor;
17
19
  exports.valueHandlers = utilities.valueHandlers;
18
20
  exports.xyzMap = utilities.xyzMap;
19
21
  exports.variantMatcher = variants.variantMatcher;
package/dist/utils.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { VariantHandler, CSSEntries } from '@unocss/core';
2
+ import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
3
+ import { T as Theme } from './types-a2d2b52f';
3
4
 
4
5
  declare const directionMap: Record<string, string[]>;
5
6
  declare const cornerMap: Record<string, string[]>;
6
7
  declare const xyzMap: Record<string, string[]>;
7
8
 
8
9
  declare function numberWithUnit(str: string): string | undefined;
10
+ declare function auto(str: string): "auto" | undefined;
9
11
  declare function rem(str: string): string | undefined;
10
12
  declare function px(str: string): string | undefined;
11
13
  declare function number(str: string): number | undefined;
@@ -15,8 +17,10 @@ declare function bracket(str: string): string | undefined;
15
17
  declare function cssvar(str: string): string | undefined;
16
18
  declare function time(str: string): string | undefined;
17
19
  declare function global(str: string): string | undefined;
20
+ declare function properties(str: string): string | undefined;
18
21
 
19
22
  declare const handlers_numberWithUnit: typeof numberWithUnit;
23
+ declare const handlers_auto: typeof auto;
20
24
  declare const handlers_rem: typeof rem;
21
25
  declare const handlers_px: typeof px;
22
26
  declare const handlers_number: typeof number;
@@ -26,9 +30,11 @@ declare const handlers_bracket: typeof bracket;
26
30
  declare const handlers_cssvar: typeof cssvar;
27
31
  declare const handlers_time: typeof time;
28
32
  declare const handlers_global: typeof global;
33
+ declare const handlers_properties: typeof properties;
29
34
  declare namespace handlers {
30
35
  export {
31
36
  handlers_numberWithUnit as numberWithUnit,
37
+ handlers_auto as auto,
32
38
  handlers_rem as rem,
33
39
  handlers_px as px,
34
40
  handlers_number as number,
@@ -38,15 +44,65 @@ declare namespace handlers {
38
44
  handlers_cssvar as cssvar,
39
45
  handlers_time as time,
40
46
  handlers_global as global,
47
+ handlers_properties as properties,
41
48
  };
42
49
  }
43
50
 
44
- declare const handler: _unocss_core.ValueHandler<"number" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
45
- declare const h: _unocss_core.ValueHandler<"number" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
51
+ declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
52
+ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
46
53
 
47
54
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
48
55
 
49
56
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
50
- declare const directionSize: (prefix: string) => ([_, direction, size]: string[]) => CSSEntries | undefined;
57
+ /**
58
+ * Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
59
+ *
60
+ * @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
61
+ * @return {DynamicMatcher} {@link DynamicMatcher}
62
+ * @see {@link directionMap}
63
+ */
64
+ declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
65
+ /**
66
+ * Parse color string into rgba (if possible) with opacity opacity. Color value will be matched to theme object before converting to rgb value.
67
+ *
68
+ * @example Parseable strings:
69
+ * 'red' // From theme, if 'red' is available
70
+ * 'red-100' // From theme, plus scale
71
+ * 'red-100/20' // From theme, plus scale/opacity
72
+ * '#f12' // Hex color
73
+ * 'hex-f12' // Alternative hex color
74
+ * '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
75
+ *
76
+ * @param {string} body - Color string to be parsed.
77
+ * @param {Theme} theme - {@link Theme} object.
78
+ * @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
79
+ */
80
+ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
81
+ /**
82
+ * Provide {@link DynamicMatcher} function to produce color value matched from rule.
83
+ *
84
+ * @see {@link parseColor}
85
+ *
86
+ * @example Resolving 'red' from theme:
87
+ * colorResolver('background-color', 'background')('', 'red')
88
+ * return { 'background-color': '#f12' }
89
+ *
90
+ * @example Resolving 'red-100' from theme:
91
+ * colorResolver('background-color', 'background')('', 'red-100')
92
+ * return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
93
+ *
94
+ * @example Resolving 'red-100/20' from theme:
95
+ * colorResolver('background-color', 'background')('', 'red-100/20')
96
+ * return { 'background-color': 'rgba(204,251,241,0.22)' }
97
+ *
98
+ * @example Resolving 'hex-124':
99
+ * colorResolver('color', 'text')('', 'hex-124')
100
+ * return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
101
+ *
102
+ * @param {string} property - Property for the css value to be created.
103
+ * @param {string} varName - Base name for the opacity variable.
104
+ * @return {DynamicMatcher} {@link DynamicMatcher} object.
105
+ */
106
+ declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
51
107
 
52
- export { capitalize, cornerMap, directionMap, directionSize, h, handler, handlers as valueHandlers, variantMatcher, xyzMap };
108
+ export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { a as capitalize, c as cornerMap, d as directionMap, b as directionSize, e as h, h as handler, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
1
+ export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, f as h, h as handler, p as parseColor, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
2
2
  export { v as variantMatcher } from './chunks/variants.mjs';
3
3
  import '@unocss/core';
package/dist/variants.cjs CHANGED
@@ -18,6 +18,8 @@ exports.variantNegative = _default.variantNegative;
18
18
  exports.variantSpace = _default.variantSpace;
19
19
  exports.variants = _default.variants;
20
20
  exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
21
- exports.PseudoClasses = pseudo.PseudoClasses;
21
+ exports.partClasses = pseudo.partClasses;
22
+ exports.variantPseudoClassFunctions = pseudo.variantPseudoClassFunctions;
22
23
  exports.variantPseudoClasses = pseudo.variantPseudoClasses;
23
24
  exports.variantPseudoElements = pseudo.variantPseudoElements;
25
+ exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
@@ -1,5 +1,8 @@
1
1
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
2
+ import { T as Theme } from './types-a2d2b52f';
3
+ import { PresetMiniOptions } from './index';
4
+ import './default-958434b6';
5
+ import './colors-6d634692';
3
6
 
4
7
  declare const variantBreakpoints: Variant<Theme>;
5
8
 
@@ -8,15 +11,17 @@ declare const variantCombinators: Variant[];
8
11
  declare const variantColorsClass: Variant[];
9
12
  declare const variantColorsMedia: Variant[];
10
13
 
11
- declare const variants: Variant<Theme>[];
14
+ declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
12
15
 
13
16
  declare const variantImportant: Variant;
14
17
  declare const variantNegative: Variant;
15
18
  declare const variantSpace: Variant;
16
19
 
17
20
  declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
18
- declare const PseudoClasses: Record<string, string | undefined>;
19
21
  declare const variantPseudoElements: VariantFunction;
20
22
  declare const variantPseudoClasses: VariantObject;
23
+ declare const variantPseudoClassFunctions: VariantObject;
24
+ declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject;
25
+ declare const partClasses: VariantObject;
21
26
 
22
- export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variants };
27
+ export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as variantBreakpoints, b as variantColorsClass, a as variantColorsMedia, d as variantCombinators, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
2
- export { C as CONTROL_BYPASS_PSEUDO_CLASS, P as PseudoClasses, v as variantPseudoClasses, a as variantPseudoElements } from './chunks/pseudo.mjs';
1
+ export { a as variantBreakpoints, c as variantColorsClass, d as variantColorsMedia, b as variantCombinators, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
2
+ export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
3
3
  import './chunks/variants.mjs';
4
4
  import '@unocss/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.16.4",
3
+ "version": "0.18.1",
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.16.4"
64
+ "@unocss/core": "0.18.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",