@unocss/preset-mini 0.16.2 → 0.17.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.
@@ -0,0 +1,283 @@
1
+ import { createValueHandler, hex2rgba } from '@unocss/core';
2
+
3
+ const directionMap = {
4
+ "l": ["-left"],
5
+ "r": ["-right"],
6
+ "t": ["-top"],
7
+ "b": ["-bottom"],
8
+ "s": ["-inline-start"],
9
+ "e": ["-inline-end"],
10
+ "x": ["-left", "-right"],
11
+ "y": ["-top", "-bottom"],
12
+ "": [""],
13
+ "a": [""]
14
+ };
15
+ const cornerMap = {
16
+ "t": ["-top-left", "-top-right"],
17
+ "r": ["-top-right", "-bottom-right"],
18
+ "b": ["-bottom-left", "-bottom-right"],
19
+ "l": ["-bottom-left", "-top-left"],
20
+ "tl": ["-top-left"],
21
+ "lt": ["-top-left"],
22
+ "tr": ["-top-right"],
23
+ "rt": ["-top-right"],
24
+ "bl": ["-bottom-left"],
25
+ "lb": ["-bottom-left"],
26
+ "br": ["-bottom-right"],
27
+ "rb": ["-bottom-right"],
28
+ "": [""]
29
+ };
30
+ const xyzMap = {
31
+ "x": ["-x"],
32
+ "y": ["-y"],
33
+ "z": ["-z"],
34
+ "": ["-x", "-y"]
35
+ };
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
+ ];
91
+ const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
92
+ const numberRE = /^(-?[0-9.]+)$/i;
93
+ const unitOnlyRE = /^(px)$/i;
94
+ function numberWithUnit(str) {
95
+ const match = str.match(numberWithUnitRE);
96
+ if (!match)
97
+ return;
98
+ const [, , unit] = match;
99
+ if (unit)
100
+ return str;
101
+ }
102
+ function auto(str) {
103
+ if (str === "auto" || str === "a")
104
+ return "auto";
105
+ }
106
+ function rem(str) {
107
+ if (str.match(unitOnlyRE))
108
+ return `1${str}`;
109
+ const match = str.match(numberWithUnitRE);
110
+ if (!match)
111
+ return;
112
+ const [, n, unit] = match;
113
+ if (unit)
114
+ return str;
115
+ const num = parseFloat(n);
116
+ if (!Number.isNaN(num))
117
+ return `${num / 4}rem`;
118
+ }
119
+ function px(str) {
120
+ if (str.match(unitOnlyRE))
121
+ return `1${str}`;
122
+ const match = str.match(numberWithUnitRE);
123
+ if (!match)
124
+ return;
125
+ const [, n, unit] = match;
126
+ if (unit)
127
+ return str;
128
+ const num = parseFloat(n);
129
+ if (!Number.isNaN(num))
130
+ return `${num}px`;
131
+ }
132
+ function number(str) {
133
+ if (!numberRE.test(str))
134
+ return;
135
+ const num = parseFloat(str);
136
+ if (!Number.isNaN(num))
137
+ return num;
138
+ }
139
+ function percent(str) {
140
+ if (str.endsWith("%"))
141
+ str = str.slice(0, -1);
142
+ const num = parseFloat(str);
143
+ if (!Number.isNaN(num))
144
+ return `${num / 100}`;
145
+ }
146
+ function fraction(str) {
147
+ if (str === "full")
148
+ return "100%";
149
+ const [left, right] = str.split("/");
150
+ const num = parseFloat(left) / parseFloat(right);
151
+ if (!Number.isNaN(num))
152
+ return `${num * 100}%`;
153
+ }
154
+ function bracket(str) {
155
+ if (str && str[0] === "[" && str[str.length - 1] === "]") {
156
+ return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
157
+ return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
158
+ });
159
+ }
160
+ }
161
+ function cssvar(str) {
162
+ if (str.startsWith("$"))
163
+ return `var(--${str.slice(1)})`;
164
+ }
165
+ function time(str) {
166
+ const duration = Number(str.replace(/(s|ms)$/, ""));
167
+ if (isNaN(duration))
168
+ return;
169
+ if (/(s|ms)$/.test(str))
170
+ return str;
171
+ return `${str}ms`;
172
+ }
173
+ function global(str) {
174
+ if (["inherit", "initial", "revert", "unset"].includes(str))
175
+ return str;
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
+ }
186
+
187
+ const valueHandlers = {
188
+ __proto__: null,
189
+ numberWithUnit: numberWithUnit,
190
+ auto: auto,
191
+ rem: rem,
192
+ px: px,
193
+ number: number,
194
+ percent: percent,
195
+ fraction: fraction,
196
+ bracket: bracket,
197
+ cssvar: cssvar,
198
+ time: time,
199
+ global: global,
200
+ properties: properties
201
+ };
202
+
203
+ const handler = createValueHandler(valueHandlers);
204
+ const h = handler;
205
+
206
+ function capitalize(str) {
207
+ return str.charAt(0).toUpperCase() + str.slice(1);
208
+ }
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
+ }
281
+ };
282
+
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,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  const variantMatcher = (name, selector) => {
4
- const length = name.length + 1;
5
- const re = new RegExp(`^${name}[:-]`);
4
+ const re = new RegExp(`^(${name})[:-]`);
6
5
  return (input) => {
7
- return input.match(re) ? {
8
- matcher: input.slice(length),
9
- selector
10
- } : void 0;
6
+ const match = input.match(re);
7
+ if (match) {
8
+ return {
9
+ matcher: input.slice(match[1].length + 1),
10
+ selector
11
+ };
12
+ }
11
13
  };
12
14
  };
13
15
 
@@ -1,11 +1,13 @@
1
1
  const variantMatcher = (name, selector) => {
2
- const length = name.length + 1;
3
- const re = new RegExp(`^${name}[:-]`);
2
+ const re = new RegExp(`^(${name})[:-]`);
4
3
  return (input) => {
5
- return input.match(re) ? {
6
- matcher: input.slice(length),
7
- selector
8
- } : void 0;
4
+ const match = input.match(re);
5
+ if (match) {
6
+ return {
7
+ matcher: input.slice(match[1].length + 1),
8
+ selector
9
+ };
10
+ }
9
11
  };
10
12
  };
11
13
 
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('./chunks/utilities.cjs');
9
10
  require('@unocss/core');
10
- require('./chunks/index.cjs');
11
11
  require('./chunks/pseudo.cjs');
12
12
  require('./chunks/variants.cjs');
13
13
 
package/dist/index.mjs CHANGED
@@ -3,8 +3,8 @@ export { t as theme } from './chunks/default.mjs';
3
3
  import { r as rules } from './chunks/default2.mjs';
4
4
  import { v as variants, a as variantColorsMedia, b as variantColorsClass } from './chunks/default3.mjs';
5
5
  export { c as colors } from './chunks/colors.mjs';
6
+ import './chunks/utilities.mjs';
6
7
  import '@unocss/core';
7
- import './chunks/index.mjs';
8
8
  import './chunks/pseudo.mjs';
9
9
  import './chunks/variants.mjs';
10
10
 
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('./chunks/utilities.cjs');
6
7
  require('@unocss/core');
7
- require('./chunks/index.cjs');
8
8
  require('./chunks/pseudo.cjs');
9
9
 
10
10
 
@@ -14,17 +14,14 @@ 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
22
  exports.cssVariables = _default.cssVariables;
25
23
  exports.cursors = _default.cursors;
26
24
  exports.displays = _default.displays;
27
- exports.fillColors = _default.fillColors;
28
25
  exports.flex = _default.flex;
29
26
  exports.floats = _default.floats;
30
27
  exports.fontSmoothings = _default.fontSmoothings;
@@ -40,18 +37,15 @@ 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;
48
+ exports.svgUtilities = _default.svgUtilities;
55
49
  exports.tabSizes = _default.tabSizes;
56
50
  exports.textAligns = _default.textAligns;
57
51
  exports.textColors = _default.textColors;
@@ -67,4 +61,5 @@ exports.userSelects = _default.userSelects;
67
61
  exports.varEmpty = _default.varEmpty;
68
62
  exports.verticalAligns = _default.verticalAligns;
69
63
  exports.whitespaces = _default.whitespaces;
64
+ exports.willChange = _default.willChange;
70
65
  exports.zIndexes = _default.zIndexes;
package/dist/rules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Rule, RuleContext } from '@unocss/core';
1
+ import { Rule } from '@unocss/core';
2
2
  import { T as Theme } from './types-7963d0b3';
3
3
 
4
4
  declare const verticalAligns: Rule[];
@@ -6,20 +6,10 @@ declare const textAligns: Rule[];
6
6
 
7
7
  declare const outline: Rule[];
8
8
  declare const appearance: Rule[];
9
- declare const placeholder: Rule[];
9
+ declare const willChange: Rule[];
10
10
 
11
11
  declare const borders: Rule[];
12
12
 
13
- declare const parseColorUtil: (body: string, theme: Theme) => {
14
- opacity: string;
15
- name: string;
16
- no: string;
17
- color: string | undefined;
18
- rgba: [number, number, number, number] | [number, number, number] | undefined;
19
- } | undefined;
20
- declare const colorResolver: (attribute: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => {
21
- [x: string]: string | number;
22
- } | undefined;
23
13
  /**
24
14
  * @example op10 op-30 opacity-100
25
15
  */
@@ -29,10 +19,6 @@ declare const opacity: Rule[];
29
19
  */
30
20
  declare const textColors: Rule[];
31
21
  declare const bgColors: Rule[];
32
- declare const borderColors: Rule[];
33
- declare const ringColors: Rule[];
34
- declare const ringOffsetColors: Rule[];
35
- declare const fillColors: Rule[];
36
22
 
37
23
  declare const rules: Rule[];
38
24
 
@@ -86,6 +72,8 @@ declare const textTransforms: Rule[];
86
72
  declare const fontStyles: Rule[];
87
73
  declare const fontSmoothings: Rule[];
88
74
 
75
+ declare const svgUtilities: Rule[];
76
+
89
77
  declare const transforms: Rule[];
90
78
 
91
79
  declare const transitions: Rule[];
@@ -100,4 +88,4 @@ declare const cssVariables: Rule[];
100
88
 
101
89
  declare const textDecorations: Rule[];
102
90
 
103
- export { alignments, appearance, appearances, aspectRatio, bgColors, borderColors, borders, boxShadows, boxSizing, breaks, colorResolver, contents, cssVariables, cursors, displays, fillColors, 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, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, 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, M as appearances, H as aspectRatio, g as bgColors, h as borderColors, b as borders, F as boxShadows, C as boxSizing, T as breaks, d as colorResolver, S as contents, a3 as cssVariables, N as cursors, L as displays, k as fillColors, l as flex, A as floats, X as fontSmoothings, W as fontStyles, _ as fonts, m as gaps, n as grids, z as insets, u as justifies, J as margins, e as opacity, w as orders, o as outline, q as overflows, I as paddings, c as parseColorUtil, p as placeholder, y as placements, O as pointerEvents, s as positions, D as questionMark, P as resizes, i as ringColors, j as ringOffsetColors, E as rings, r as rules, G as sizes, $ as tabSizes, t as textAligns, f as textColors, a4 as textDecorations, a0 as textIndents, U as textOverflows, a2 as textShadows, a1 as textStrokes, V as textTransforms, Y as transforms, Z as transitions, Q as userSelects, K as varEmpty, v as verticalAligns, R as whitespaces, B 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 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';
2
+ import './chunks/utilities.mjs';
2
3
  import '@unocss/core';
3
- import './chunks/index.mjs';
4
4
  import './chunks/pseudo.mjs';
package/dist/utils.cjs CHANGED
@@ -2,17 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./chunks/index.cjs');
5
+ const utilities = require('./chunks/utilities.cjs');
6
6
  const variants = require('./chunks/variants.cjs');
7
7
  require('@unocss/core');
8
8
 
9
9
 
10
10
 
11
- exports.capitalize = index.capitalize;
12
- exports.cornerMap = index.cornerMap;
13
- exports.directionMap = index.directionMap;
14
- exports.h = index.h;
15
- exports.handler = index.handler;
16
- exports.valueHandlers = index.valueHandlers;
17
- exports.xyzMap = index.xyzMap;
11
+ exports.capitalize = utilities.capitalize;
12
+ exports.colorResolver = utilities.colorResolver;
13
+ exports.cornerMap = utilities.cornerMap;
14
+ exports.directionMap = utilities.directionMap;
15
+ exports.directionSize = utilities.directionSize;
16
+ exports.h = utilities.h;
17
+ exports.handler = utilities.handler;
18
+ exports.parseColor = utilities.parseColor;
19
+ exports.valueHandlers = utilities.valueHandlers;
20
+ exports.xyzMap = utilities.xyzMap;
18
21
  exports.variantMatcher = variants.variantMatcher;
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { VariantHandler } from '@unocss/core';
2
+ import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
3
+ import { T as Theme } from './types-7963d0b3';
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
 
9
+ declare function numberWithUnit(str: string): string | undefined;
10
+ declare function auto(str: string): "auto" | undefined;
8
11
  declare function rem(str: string): string | undefined;
9
12
  declare function px(str: string): string | undefined;
10
13
  declare function number(str: string): number | undefined;
@@ -14,7 +17,10 @@ declare function bracket(str: string): string | undefined;
14
17
  declare function cssvar(str: string): string | undefined;
15
18
  declare function time(str: string): string | undefined;
16
19
  declare function global(str: string): string | undefined;
20
+ declare function properties(str: string): string | undefined;
17
21
 
22
+ declare const handlers_numberWithUnit: typeof numberWithUnit;
23
+ declare const handlers_auto: typeof auto;
18
24
  declare const handlers_rem: typeof rem;
19
25
  declare const handlers_px: typeof px;
20
26
  declare const handlers_number: typeof number;
@@ -24,8 +30,11 @@ declare const handlers_bracket: typeof bracket;
24
30
  declare const handlers_cssvar: typeof cssvar;
25
31
  declare const handlers_time: typeof time;
26
32
  declare const handlers_global: typeof global;
33
+ declare const handlers_properties: typeof properties;
27
34
  declare namespace handlers {
28
35
  export {
36
+ handlers_numberWithUnit as numberWithUnit,
37
+ handlers_auto as auto,
29
38
  handlers_rem as rem,
30
39
  handlers_px as px,
31
40
  handlers_number as number,
@@ -35,14 +44,65 @@ declare namespace handlers {
35
44
  handlers_cssvar as cssvar,
36
45
  handlers_time as time,
37
46
  handlers_global as global,
47
+ handlers_properties as properties,
38
48
  };
39
49
  }
40
50
 
41
- declare const handler: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
42
- declare const h: _unocss_core.ValueHandler<"number" | "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">;
43
53
 
44
54
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
45
55
 
46
56
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
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;
47
107
 
48
- export { capitalize, cornerMap, directionMap, 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 h, h as handler, v as valueHandlers, x as xyzMap } from './chunks/index.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
@@ -10,14 +10,15 @@ require('@unocss/core');
10
10
 
11
11
 
12
12
  exports.variantBreakpoints = _default.variantBreakpoints;
13
- exports.variantChildren = _default.variantChildren;
14
13
  exports.variantColorsClass = _default.variantColorsClass;
15
14
  exports.variantColorsMedia = _default.variantColorsMedia;
15
+ exports.variantCombinators = _default.variantCombinators;
16
16
  exports.variantImportant = _default.variantImportant;
17
17
  exports.variantNegative = _default.variantNegative;
18
18
  exports.variantSpace = _default.variantSpace;
19
19
  exports.variants = _default.variants;
20
- exports.CONTROL_BYPASS_PSEUDO = pseudo.CONTROL_BYPASS_PSEUDO;
20
+ exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
21
21
  exports.PseudoClasses = pseudo.PseudoClasses;
22
+ exports.partClasses = pseudo.partClasses;
22
23
  exports.variantPseudoClasses = pseudo.variantPseudoClasses;
23
24
  exports.variantPseudoElements = pseudo.variantPseudoElements;
@@ -3,7 +3,7 @@ import { T as Theme } from './types-7963d0b3';
3
3
 
4
4
  declare const variantBreakpoints: Variant<Theme>;
5
5
 
6
- declare const variantChildren: Variant[];
6
+ declare const variantCombinators: Variant[];
7
7
 
8
8
  declare const variantColorsClass: Variant[];
9
9
  declare const variantColorsMedia: Variant[];
@@ -14,9 +14,10 @@ declare const variantImportant: Variant;
14
14
  declare const variantNegative: Variant;
15
15
  declare const variantSpace: Variant;
16
16
 
17
- declare const CONTROL_BYPASS_PSEUDO = "$$no-pseudo";
17
+ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
18
18
  declare const PseudoClasses: Record<string, string | undefined>;
19
19
  declare const variantPseudoElements: VariantFunction;
20
20
  declare const variantPseudoClasses: VariantObject;
21
+ declare const partClasses: VariantObject;
21
22
 
22
- export { CONTROL_BYPASS_PSEUDO, PseudoClasses, variantBreakpoints, variantChildren, variantColorsClass, variantColorsMedia, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variants };
23
+ export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variants };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as variantBreakpoints, d as variantChildren, b as variantColorsClass, a as variantColorsMedia, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
2
- export { C as CONTROL_BYPASS_PSEUDO, P as PseudoClasses, v as variantPseudoClasses, a as variantPseudoElements } from './chunks/pseudo.mjs';
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, p as partClasses, v as variantPseudoClasses, a as variantPseudoElements } from './chunks/pseudo.mjs';
3
3
  import './chunks/variants.mjs';
4
4
  import '@unocss/core';