@unocss/preset-mini 0.55.7 → 0.56.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.
package/dist/utils.cjs CHANGED
@@ -1,111 +1,30 @@
1
1
  'use strict';
2
2
 
3
- const colors = require('./shared/preset-mini.b4ad509c.cjs');
4
- const core = require('@unocss/core');
3
+ const utils = require('./shared/preset-mini.3a376028.cjs');
4
+ const ruleUtils = require('@unocss/rule-utils');
5
+ require('@unocss/core');
5
6
 
6
- function variantMatcher(name, handler) {
7
- let re;
8
- return {
9
- name,
10
- match(input, ctx) {
11
- if (!re)
12
- re = new RegExp(`^${core.escapeRegExp(name)}(?:${ctx.generator.config.separators.join("|")})`);
13
- const match = input.match(re);
14
- if (match) {
15
- return {
16
- matcher: input.slice(match[0].length),
17
- handle: (input2, next) => next({
18
- ...input2,
19
- ...handler(input2)
20
- })
21
- };
22
- }
23
- },
24
- autocomplete: `${name}:`
25
- };
26
- }
27
- function variantParentMatcher(name, parent) {
28
- let re;
29
- return {
30
- name,
31
- match(input, ctx) {
32
- if (!re)
33
- re = new RegExp(`^${core.escapeRegExp(name)}(?:${ctx.generator.config.separators.join("|")})`);
34
- const match = input.match(re);
35
- if (match) {
36
- return {
37
- matcher: input.slice(match[0].length),
38
- handle: (input2, next) => next({
39
- ...input2,
40
- parent: `${input2.parent ? `${input2.parent} $$ ` : ""}${parent}`
41
- })
42
- };
43
- }
44
- },
45
- autocomplete: `${name}:`
46
- };
47
- }
48
- function variantGetBracket(prefix, matcher, separators) {
49
- if (matcher.startsWith(`${prefix}[`)) {
50
- const [match, rest] = colors.getBracket(matcher.slice(prefix.length), "[", "]") ?? [];
51
- if (match && rest) {
52
- for (const separator of separators) {
53
- if (rest.startsWith(separator))
54
- return [match, rest.slice(separator.length), separator];
55
- }
56
- return [match, rest, ""];
57
- }
58
- }
59
- }
60
- function variantGetParameter(prefix, matcher, separators) {
61
- if (matcher.startsWith(prefix)) {
62
- const body = variantGetBracket(prefix, matcher, separators);
63
- if (body) {
64
- const [label = "", rest = body[1]] = variantGetParameter("/", body[1], separators) ?? [];
65
- return [body[0], rest, label];
66
- }
67
- for (const separator of separators.filter((x) => x !== "/")) {
68
- const pos = matcher.indexOf(separator, prefix.length);
69
- if (pos !== -1) {
70
- const labelPos = matcher.indexOf("/", prefix.length);
71
- const unlabelled = labelPos === -1 || pos <= labelPos;
72
- return [
73
- matcher.slice(prefix.length, unlabelled ? pos : labelPos),
74
- matcher.slice(pos + separator.length),
75
- unlabelled ? "" : matcher.slice(labelPos + 1, pos)
76
- ];
77
- }
78
- }
79
- }
80
- }
81
7
 
82
- exports.CONTROL_MINI_NO_NEGATIVE = colors.CONTROL_MINI_NO_NEGATIVE;
83
- exports.colorOpacityToString = colors.colorOpacityToString;
84
- exports.colorResolver = colors.colorResolver;
85
- exports.colorToString = colors.colorToString;
86
- exports.colorableShadows = colors.colorableShadows;
87
- exports.cornerMap = colors.cornerMap;
88
- exports.directionMap = colors.directionMap;
89
- exports.directionSize = colors.directionSize;
90
- exports.getBracket = colors.getBracket;
91
- exports.getComponent = colors.getComponent;
92
- exports.getComponents = colors.getComponents;
93
- exports.globalKeywords = colors.globalKeywords;
94
- exports.h = colors.h;
95
- exports.handler = colors.handler;
96
- exports.hasParseableColor = colors.hasParseableColor;
97
- exports.hex2rgba = colors.hex2rgba;
98
- exports.insetMap = colors.insetMap;
99
- exports.makeGlobalStaticRules = colors.makeGlobalStaticRules;
100
- exports.parseColor = colors.parseColor;
101
- exports.parseCssColor = colors.parseCssColor;
102
- exports.positionMap = colors.positionMap;
103
- exports.resolveBreakpoints = colors.resolveBreakpoints;
104
- exports.resolveVerticalBreakpoints = colors.resolveVerticalBreakpoints;
105
- exports.splitShorthand = colors.splitShorthand;
106
- exports.valueHandlers = colors.valueHandlers;
107
- exports.xyzMap = colors.xyzMap;
108
- exports.variantGetBracket = variantGetBracket;
109
- exports.variantGetParameter = variantGetParameter;
110
- exports.variantMatcher = variantMatcher;
111
- exports.variantParentMatcher = variantParentMatcher;
8
+
9
+ exports.CONTROL_MINI_NO_NEGATIVE = utils.CONTROL_MINI_NO_NEGATIVE;
10
+ exports.colorResolver = utils.colorResolver;
11
+ exports.colorableShadows = utils.colorableShadows;
12
+ exports.cornerMap = utils.cornerMap;
13
+ exports.directionMap = utils.directionMap;
14
+ exports.directionSize = utils.directionSize;
15
+ exports.globalKeywords = utils.globalKeywords;
16
+ exports.h = utils.h;
17
+ exports.handler = utils.handler;
18
+ exports.hasParseableColor = utils.hasParseableColor;
19
+ exports.insetMap = utils.insetMap;
20
+ exports.makeGlobalStaticRules = utils.makeGlobalStaticRules;
21
+ exports.parseColor = utils.parseColor;
22
+ exports.positionMap = utils.positionMap;
23
+ exports.resolveBreakpoints = utils.resolveBreakpoints;
24
+ exports.resolveVerticalBreakpoints = utils.resolveVerticalBreakpoints;
25
+ exports.splitShorthand = utils.splitShorthand;
26
+ exports.valueHandlers = utils.valueHandlers;
27
+ exports.xyzMap = utils.xyzMap;
28
+ Object.keys(ruleUtils).forEach(function (k) {
29
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = ruleUtils[k];
30
+ });
package/dist/utils.d.cts CHANGED
@@ -1,13 +1,9 @@
1
- import * as _unocss_core from '@unocss/core';
2
- import { RGBAColorValue, CSSColorValue, VariantHandlerContext, VariantObject } from '@unocss/core';
3
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, g as getBracket, e as getComponent, f as getComponents, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.f9bfbfc9.cjs';
1
+ import * as _unocss_rule_utils from '@unocss/rule-utils';
2
+ export * from '@unocss/rule-utils';
3
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.d62ae954.cjs';
4
+ import '@unocss/core';
4
5
  import './shared/preset-mini.bc674518.cjs';
5
6
 
6
- declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
- declare function parseCssColor(str?: string): CSSColorValue | undefined;
8
- declare function colorOpacityToString(color: CSSColorValue): string | number;
9
- declare function colorToString(color: CSSColorValue | string, alphaOverride?: string | number): string;
10
-
11
7
  declare const directionMap: Record<string, string[]>;
12
8
  declare const insetMap: Record<string, string[]>;
13
9
  declare const cornerMap: Record<string, string[]>;
@@ -54,12 +50,7 @@ declare namespace handlers {
54
50
  export { handlers_auto as auto, handlers_bracket as bracket, handlers_bracketOfColor as bracketOfColor, handlers_bracketOfLength as bracketOfLength, handlers_bracketOfPosition as bracketOfPosition, handlers_cssvar as cssvar, handlers_degree as degree, handlers_fraction as fraction, handlers_global as global, handlers_number as number, handlers_numberWithUnit as numberWithUnit, handlers_percent as percent, handlers_position as position, handlers_properties as properties, handlers_px as px, handlers_rem as rem, handlers_time as time };
55
51
  }
56
52
 
57
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
58
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
59
-
60
- declare function variantMatcher(name: string, handler: (input: VariantHandlerContext) => Record<string, any>): VariantObject;
61
- declare function variantParentMatcher(name: string, parent: string): VariantObject;
62
- declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
63
- declare function variantGetParameter(prefix: string, matcher: string, separators: string[]): string[] | undefined;
53
+ declare const handler: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
54
+ declare const h: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
64
55
 
65
- export { colorOpacityToString, colorToString, cornerMap, directionMap, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher, xyzMap };
56
+ export { cornerMap, directionMap, globalKeywords, h, handler, insetMap, positionMap, handlers as valueHandlers, xyzMap };
package/dist/utils.d.mts CHANGED
@@ -1,13 +1,9 @@
1
- import * as _unocss_core from '@unocss/core';
2
- import { RGBAColorValue, CSSColorValue, VariantHandlerContext, VariantObject } from '@unocss/core';
3
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, g as getBracket, e as getComponent, f as getComponents, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.8ff442ab.mjs';
1
+ import * as _unocss_rule_utils from '@unocss/rule-utils';
2
+ export * from '@unocss/rule-utils';
3
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.97d1ec1e.mjs';
4
+ import '@unocss/core';
4
5
  import './shared/preset-mini.bc674518.mjs';
5
6
 
6
- declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
- declare function parseCssColor(str?: string): CSSColorValue | undefined;
8
- declare function colorOpacityToString(color: CSSColorValue): string | number;
9
- declare function colorToString(color: CSSColorValue | string, alphaOverride?: string | number): string;
10
-
11
7
  declare const directionMap: Record<string, string[]>;
12
8
  declare const insetMap: Record<string, string[]>;
13
9
  declare const cornerMap: Record<string, string[]>;
@@ -54,12 +50,7 @@ declare namespace handlers {
54
50
  export { handlers_auto as auto, handlers_bracket as bracket, handlers_bracketOfColor as bracketOfColor, handlers_bracketOfLength as bracketOfLength, handlers_bracketOfPosition as bracketOfPosition, handlers_cssvar as cssvar, handlers_degree as degree, handlers_fraction as fraction, handlers_global as global, handlers_number as number, handlers_numberWithUnit as numberWithUnit, handlers_percent as percent, handlers_position as position, handlers_properties as properties, handlers_px as px, handlers_rem as rem, handlers_time as time };
55
51
  }
56
52
 
57
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
58
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
59
-
60
- declare function variantMatcher(name: string, handler: (input: VariantHandlerContext) => Record<string, any>): VariantObject;
61
- declare function variantParentMatcher(name: string, parent: string): VariantObject;
62
- declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
63
- declare function variantGetParameter(prefix: string, matcher: string, separators: string[]): string[] | undefined;
53
+ declare const handler: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
54
+ declare const h: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
64
55
 
65
- export { colorOpacityToString, colorToString, cornerMap, directionMap, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher, xyzMap };
56
+ export { cornerMap, directionMap, globalKeywords, h, handler, insetMap, positionMap, handlers as valueHandlers, xyzMap };
package/dist/utils.d.ts CHANGED
@@ -1,13 +1,9 @@
1
- import * as _unocss_core from '@unocss/core';
2
- import { RGBAColorValue, CSSColorValue, VariantHandlerContext, VariantObject } from '@unocss/core';
3
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, g as getBracket, e as getComponent, f as getComponents, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.c0e4a0cc.js';
1
+ import * as _unocss_rule_utils from '@unocss/rule-utils';
2
+ export * from '@unocss/rule-utils';
3
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints, s as splitShorthand } from './shared/preset-mini.79297e15.js';
4
+ import '@unocss/core';
4
5
  import './shared/preset-mini.bc674518.js';
5
6
 
6
- declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
- declare function parseCssColor(str?: string): CSSColorValue | undefined;
8
- declare function colorOpacityToString(color: CSSColorValue): string | number;
9
- declare function colorToString(color: CSSColorValue | string, alphaOverride?: string | number): string;
10
-
11
7
  declare const directionMap: Record<string, string[]>;
12
8
  declare const insetMap: Record<string, string[]>;
13
9
  declare const cornerMap: Record<string, string[]>;
@@ -54,12 +50,7 @@ declare namespace handlers {
54
50
  export { handlers_auto as auto, handlers_bracket as bracket, handlers_bracketOfColor as bracketOfColor, handlers_bracketOfLength as bracketOfLength, handlers_bracketOfPosition as bracketOfPosition, handlers_cssvar as cssvar, handlers_degree as degree, handlers_fraction as fraction, handlers_global as global, handlers_number as number, handlers_numberWithUnit as numberWithUnit, handlers_percent as percent, handlers_position as position, handlers_properties as properties, handlers_px as px, handlers_rem as rem, handlers_time as time };
55
51
  }
56
52
 
57
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
58
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
59
-
60
- declare function variantMatcher(name: string, handler: (input: VariantHandlerContext) => Record<string, any>): VariantObject;
61
- declare function variantParentMatcher(name: string, parent: string): VariantObject;
62
- declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
63
- declare function variantGetParameter(prefix: string, matcher: string, separators: string[]): string[] | undefined;
53
+ declare const handler: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
54
+ declare const h: _unocss_rule_utils.ValueHandler<"number" | "auto" | "position" | "global" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
64
55
 
65
- export { colorOpacityToString, colorToString, cornerMap, directionMap, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher, xyzMap };
56
+ export { cornerMap, directionMap, globalKeywords, h, handler, insetMap, positionMap, handlers as valueHandlers, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,81 +1,3 @@
1
- import { e as getBracket } from './shared/preset-mini.f1fe435e.mjs';
2
- export { C as CONTROL_MINI_NO_NEGATIVE, j as colorOpacityToString, c as colorResolver, k as colorToString, b as colorableShadows, o as cornerMap, l as directionMap, r as directionSize, w as getComponent, y as getComponents, g as globalKeywords, h, q as handler, a as hasParseableColor, f as hex2rgba, n as insetMap, m as makeGlobalStaticRules, p as parseColor, i as parseCssColor, d as positionMap, t as resolveBreakpoints, u as resolveVerticalBreakpoints, s as splitShorthand, v as valueHandlers, x as xyzMap } from './shared/preset-mini.f1fe435e.mjs';
3
- import { escapeRegExp } from '@unocss/core';
4
-
5
- function variantMatcher(name, handler) {
6
- let re;
7
- return {
8
- name,
9
- match(input, ctx) {
10
- if (!re)
11
- re = new RegExp(`^${escapeRegExp(name)}(?:${ctx.generator.config.separators.join("|")})`);
12
- const match = input.match(re);
13
- if (match) {
14
- return {
15
- matcher: input.slice(match[0].length),
16
- handle: (input2, next) => next({
17
- ...input2,
18
- ...handler(input2)
19
- })
20
- };
21
- }
22
- },
23
- autocomplete: `${name}:`
24
- };
25
- }
26
- function variantParentMatcher(name, parent) {
27
- let re;
28
- return {
29
- name,
30
- match(input, ctx) {
31
- if (!re)
32
- re = new RegExp(`^${escapeRegExp(name)}(?:${ctx.generator.config.separators.join("|")})`);
33
- const match = input.match(re);
34
- if (match) {
35
- return {
36
- matcher: input.slice(match[0].length),
37
- handle: (input2, next) => next({
38
- ...input2,
39
- parent: `${input2.parent ? `${input2.parent} $$ ` : ""}${parent}`
40
- })
41
- };
42
- }
43
- },
44
- autocomplete: `${name}:`
45
- };
46
- }
47
- function variantGetBracket(prefix, matcher, separators) {
48
- if (matcher.startsWith(`${prefix}[`)) {
49
- const [match, rest] = getBracket(matcher.slice(prefix.length), "[", "]") ?? [];
50
- if (match && rest) {
51
- for (const separator of separators) {
52
- if (rest.startsWith(separator))
53
- return [match, rest.slice(separator.length), separator];
54
- }
55
- return [match, rest, ""];
56
- }
57
- }
58
- }
59
- function variantGetParameter(prefix, matcher, separators) {
60
- if (matcher.startsWith(prefix)) {
61
- const body = variantGetBracket(prefix, matcher, separators);
62
- if (body) {
63
- const [label = "", rest = body[1]] = variantGetParameter("/", body[1], separators) ?? [];
64
- return [body[0], rest, label];
65
- }
66
- for (const separator of separators.filter((x) => x !== "/")) {
67
- const pos = matcher.indexOf(separator, prefix.length);
68
- if (pos !== -1) {
69
- const labelPos = matcher.indexOf("/", prefix.length);
70
- const unlabelled = labelPos === -1 || pos <= labelPos;
71
- return [
72
- matcher.slice(prefix.length, unlabelled ? pos : labelPos),
73
- matcher.slice(pos + separator.length),
74
- unlabelled ? "" : matcher.slice(labelPos + 1, pos)
75
- ];
76
- }
77
- }
78
- }
79
- }
80
-
81
- export { getBracket, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
1
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, b as colorableShadows, f as cornerMap, e as directionMap, k as directionSize, g as globalKeywords, h, l as handler, a as hasParseableColor, i as insetMap, m as makeGlobalStaticRules, p as parseColor, d as positionMap, j as resolveBreakpoints, r as resolveVerticalBreakpoints, s as splitShorthand, v as valueHandlers, x as xyzMap } from './shared/preset-mini.8929b018.mjs';
2
+ export * from '@unocss/rule-utils';
3
+ import '@unocss/core';
package/dist/variants.cjs CHANGED
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const utils = require('./utils.cjs');
4
- const colors = require('./shared/preset-mini.b4ad509c.cjs');
3
+ const ruleUtils = require('@unocss/rule-utils');
4
+ const utils = require('./shared/preset-mini.3a376028.cjs');
5
5
  const core = require('@unocss/core');
6
6
 
7
7
  const variantAria = {
8
8
  name: "aria",
9
9
  match(matcher, ctx) {
10
- const variant = utils.variantGetParameter("aria-", matcher, ctx.generator.config.separators);
10
+ const variant = ruleUtils.variantGetParameter("aria-", matcher, ctx.generator.config.separators);
11
11
  if (variant) {
12
12
  const [match, rest] = variant;
13
- const aria = colors.h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
13
+ const aria = utils.h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
14
14
  if (aria) {
15
15
  return {
16
16
  matcher: rest,
@@ -35,7 +35,7 @@ function variantBreakpoints() {
35
35
  return {
36
36
  name: "breakpoints",
37
37
  match(matcher, context) {
38
- const variantEntries = Object.entries(colors.resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
38
+ const variantEntries = Object.entries(utils.resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
39
39
  for (const [point, size, idx] of variantEntries) {
40
40
  if (!regexCache[point])
41
41
  regexCache[point] = new RegExp(`^((?:([al]t-|[<~]|max-))?${point}(?:${context.generator.config.separators.join("|")}))`);
@@ -93,7 +93,7 @@ function scopeMatcher(name, combinator) {
93
93
  if (!matcher.startsWith(name))
94
94
  return;
95
95
  const separators = ctx.generator.config.separators;
96
- let body = utils.variantGetBracket(`${name}-`, matcher, separators);
96
+ let body = ruleUtils.variantGetBracket(`${name}-`, matcher, separators);
97
97
  if (!body) {
98
98
  for (const separator of separators) {
99
99
  if (matcher.startsWith(`${name}${separator}`)) {
@@ -104,7 +104,7 @@ function scopeMatcher(name, combinator) {
104
104
  if (!body)
105
105
  return;
106
106
  }
107
- let bracketValue = colors.h.bracket(body[0]) ?? "";
107
+ let bracketValue = utils.h.bracket(body[0]) ?? "";
108
108
  if (bracketValue === "")
109
109
  bracketValue = "*";
110
110
  return {
@@ -128,13 +128,13 @@ const variantContainerQuery = {
128
128
  match(matcher, ctx) {
129
129
  if (matcher.startsWith("@container"))
130
130
  return;
131
- const variant = utils.variantGetParameter("@", matcher, ctx.generator.config.separators);
131
+ const variant = ruleUtils.variantGetParameter("@", matcher, ctx.generator.config.separators);
132
132
  if (variant) {
133
133
  const [match, rest, label] = variant;
134
- const unbracket = colors.h.bracket(match);
134
+ const unbracket = utils.h.bracket(match);
135
135
  let container;
136
136
  if (unbracket) {
137
- const minWidth = colors.h.numberWithUnit(unbracket);
137
+ const minWidth = utils.h.numberWithUnit(unbracket);
138
138
  if (minWidth)
139
139
  container = `(min-width: ${minWidth})`;
140
140
  } else {
@@ -159,23 +159,23 @@ function variantColorsMediaOrClass(options = {}) {
159
159
  if (options?.dark === "class" || typeof options.dark === "object") {
160
160
  const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
161
161
  return [
162
- utils.variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
163
- utils.variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
162
+ ruleUtils.variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
163
+ ruleUtils.variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
164
164
  ];
165
165
  }
166
166
  return [
167
- utils.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
168
- utils.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
167
+ ruleUtils.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
168
+ ruleUtils.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
169
169
  ];
170
170
  }
171
171
 
172
172
  const variantDataAttribute = {
173
173
  name: "data",
174
174
  match(matcher, ctx) {
175
- const variant = utils.variantGetParameter("data-", matcher, ctx.generator.config.separators);
175
+ const variant = ruleUtils.variantGetParameter("data-", matcher, ctx.generator.config.separators);
176
176
  if (variant) {
177
177
  const [match, rest] = variant;
178
- const dataAttribute = colors.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
178
+ const dataAttribute = utils.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
179
179
  if (dataAttribute) {
180
180
  return {
181
181
  matcher: rest,
@@ -188,10 +188,10 @@ const variantDataAttribute = {
188
188
  const variantGroupDataAttribute = {
189
189
  name: "group-data",
190
190
  match(matcher, ctx) {
191
- const variant = utils.variantGetParameter("group-data-", matcher, ctx.generator.config.separators);
191
+ const variant = ruleUtils.variantGetParameter("group-data-", matcher, ctx.generator.config.separators);
192
192
  if (variant) {
193
193
  const [match, rest] = variant;
194
- const dataAttribute = colors.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
194
+ const dataAttribute = utils.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
195
195
  if (dataAttribute) {
196
196
  return {
197
197
  matcher: `group-[[data-${dataAttribute}]]:${rest}`
@@ -202,17 +202,17 @@ const variantGroupDataAttribute = {
202
202
  };
203
203
 
204
204
  const variantLanguageDirections = [
205
- utils.variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
206
- utils.variantMatcher("ltr", (input) => ({ prefix: `[dir="ltr"] $$ ${input.prefix}` }))
205
+ ruleUtils.variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
206
+ ruleUtils.variantMatcher("ltr", (input) => ({ prefix: `[dir="ltr"] $$ ${input.prefix}` }))
207
207
  ];
208
208
 
209
209
  const variantSelector = {
210
210
  name: "selector",
211
211
  match(matcher, ctx) {
212
- const variant = utils.variantGetBracket("selector-", matcher, ctx.generator.config.separators);
212
+ const variant = ruleUtils.variantGetBracket("selector-", matcher, ctx.generator.config.separators);
213
213
  if (variant) {
214
214
  const [match, rest] = variant;
215
- const selector = colors.h.bracket(match);
215
+ const selector = utils.h.bracket(match);
216
216
  if (selector) {
217
217
  return {
218
218
  matcher: rest,
@@ -225,10 +225,10 @@ const variantSelector = {
225
225
  const variantCssLayer = {
226
226
  name: "layer",
227
227
  match(matcher, ctx) {
228
- const variant = utils.variantGetParameter("layer-", matcher, ctx.generator.config.separators);
228
+ const variant = ruleUtils.variantGetParameter("layer-", matcher, ctx.generator.config.separators);
229
229
  if (variant) {
230
230
  const [match, rest] = variant;
231
- const layer = colors.h.bracket(match) ?? match;
231
+ const layer = utils.h.bracket(match) ?? match;
232
232
  if (layer) {
233
233
  return {
234
234
  matcher: rest,
@@ -244,10 +244,10 @@ const variantCssLayer = {
244
244
  const variantInternalLayer = {
245
245
  name: "uno-layer",
246
246
  match(matcher, ctx) {
247
- const variant = utils.variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
247
+ const variant = ruleUtils.variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
248
248
  if (variant) {
249
249
  const [match, rest] = variant;
250
- const layer = colors.h.bracket(match) ?? match;
250
+ const layer = utils.h.bracket(match) ?? match;
251
251
  if (layer) {
252
252
  return {
253
253
  matcher: rest,
@@ -260,10 +260,10 @@ const variantInternalLayer = {
260
260
  const variantScope = {
261
261
  name: "scope",
262
262
  match(matcher, ctx) {
263
- const variant = utils.variantGetBracket("scope-", matcher, ctx.generator.config.separators);
263
+ const variant = ruleUtils.variantGetBracket("scope-", matcher, ctx.generator.config.separators);
264
264
  if (variant) {
265
265
  const [match, rest] = variant;
266
- const scope = colors.h.bracket(match);
266
+ const scope = utils.h.bracket(match);
267
267
  if (scope) {
268
268
  return {
269
269
  matcher: rest,
@@ -278,7 +278,7 @@ const variantVariables = {
278
278
  match(matcher, ctx) {
279
279
  if (!matcher.startsWith("["))
280
280
  return;
281
- const [match, rest] = colors.getBracket(matcher, "[", "]") ?? [];
281
+ const [match, rest] = ruleUtils.getBracket(matcher, "[", "]") ?? [];
282
282
  if (!(match && rest))
283
283
  return;
284
284
  let newMatcher;
@@ -290,7 +290,7 @@ const variantVariables = {
290
290
  }
291
291
  if (newMatcher == null)
292
292
  return;
293
- const variant = colors.h.bracket(match) ?? "";
293
+ const variant = utils.h.bracket(match) ?? "";
294
294
  const useParent = variant.startsWith("@");
295
295
  if (!(useParent || variant.includes("&")))
296
296
  return;
@@ -319,7 +319,7 @@ const ignoreProps = [
319
319
  function negateFunctions(value) {
320
320
  const match = value.match(/^(calc|clamp|max|min)\s*(\(.*)/);
321
321
  if (match) {
322
- const [fnBody, rest] = colors.getComponent(match[2], "(", ")", " ") ?? [];
322
+ const [fnBody, rest] = ruleUtils.getStringComponent(match[2], "(", ")", " ") ?? [];
323
323
  if (fnBody)
324
324
  return `calc(${match[1]}${fnBody} * -1)${rest ? ` ${rest}` : ""}`;
325
325
  }
@@ -332,7 +332,7 @@ const variantNegative = {
332
332
  return {
333
333
  matcher: matcher.slice(1),
334
334
  body: (body) => {
335
- if (body.find((v) => v[0] === colors.CONTROL_MINI_NO_NEGATIVE))
335
+ if (body.find((v) => v[0] === utils.CONTROL_MINI_NO_NEGATIVE))
336
336
  return;
337
337
  let changed = false;
338
338
  body.forEach((v) => {
@@ -387,14 +387,14 @@ function variantImportant() {
387
387
  };
388
388
  }
389
389
 
390
- const variantPrint = utils.variantParentMatcher("print", "@media print");
390
+ const variantPrint = ruleUtils.variantParentMatcher("print", "@media print");
391
391
  const variantCustomMedia = {
392
392
  name: "media",
393
393
  match(matcher, ctx) {
394
- const variant = utils.variantGetParameter("media-", matcher, ctx.generator.config.separators);
394
+ const variant = ruleUtils.variantGetParameter("media-", matcher, ctx.generator.config.separators);
395
395
  if (variant) {
396
396
  const [match, rest] = variant;
397
- let media = colors.h.bracket(match) ?? "";
397
+ let media = utils.h.bracket(match) ?? "";
398
398
  if (media === "")
399
399
  media = ctx.theme.media?.[match] ?? "";
400
400
  if (media) {
@@ -414,10 +414,10 @@ const variantCustomMedia = {
414
414
  const variantSupports = {
415
415
  name: "supports",
416
416
  match(matcher, ctx) {
417
- const variant = utils.variantGetParameter("supports-", matcher, ctx.generator.config.separators);
417
+ const variant = ruleUtils.variantGetParameter("supports-", matcher, ctx.generator.config.separators);
418
418
  if (variant) {
419
419
  const [match, rest] = variant;
420
- let supports = colors.h.bracket(match) ?? "";
420
+ let supports = utils.h.bracket(match) ?? "";
421
421
  if (supports === "")
422
422
  supports = ctx.theme.supports?.[match] ?? "";
423
423
  if (supports) {
@@ -511,11 +511,11 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
511
511
  let pseudoColonRE;
512
512
  let pseudoVarRE;
513
513
  const matchBracket = (input) => {
514
- const body = utils.variantGetBracket(`${tag}-`, input, []);
514
+ const body = ruleUtils.variantGetBracket(`${tag}-`, input, []);
515
515
  if (!body)
516
516
  return;
517
517
  const [match, rest] = body;
518
- const bracketValue = colors.h.bracket(match);
518
+ const bracketValue = utils.h.bracket(match);
519
519
  if (bracketValue == null)
520
520
  return;
521
521
  const label = rest.split(splitRE, 1)?.[0] ?? "";
@@ -650,8 +650,8 @@ function variantPseudoClassFunctions() {
650
650
  const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE) || input.match(PseudoClassVarFunctionRE);
651
651
  if (match) {
652
652
  const fn = match[1];
653
- const fnVal = colors.getBracket(match[2], "[", "]");
654
- const pseudo = fnVal ? colors.h.bracket(match[2]) : PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
653
+ const fnVal = ruleUtils.getBracket(match[2], "[", "]");
654
+ const pseudo = fnVal ? utils.h.bracket(match[2]) : PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
655
655
  return {
656
656
  matcher: input.slice(match[0].length),
657
657
  selector: (s) => `${s}:${fn}(${pseudo})`
@@ -3,7 +3,7 @@ import { PresetMiniOptions } from './index.cjs';
3
3
  import { T as Theme } from './shared/preset-mini.bc674518.cjs';
4
4
  import './shared/preset-mini.302bff75.cjs';
5
5
  import './colors.cjs';
6
- import './shared/preset-mini.f9bfbfc9.cjs';
6
+ import './shared/preset-mini.d62ae954.cjs';
7
7
 
8
8
  declare const variantAria: VariantObject;
9
9
 
@@ -3,7 +3,7 @@ import { PresetMiniOptions } from './index.mjs';
3
3
  import { T as Theme } from './shared/preset-mini.bc674518.mjs';
4
4
  import './shared/preset-mini.f12010ce.mjs';
5
5
  import './colors.mjs';
6
- import './shared/preset-mini.8ff442ab.mjs';
6
+ import './shared/preset-mini.97d1ec1e.mjs';
7
7
 
8
8
  declare const variantAria: VariantObject;
9
9
 
@@ -3,7 +3,7 @@ import { PresetMiniOptions } from './index.js';
3
3
  import { T as Theme } from './shared/preset-mini.bc674518.js';
4
4
  import './shared/preset-mini.0a392a7c.js';
5
5
  import './colors.js';
6
- import './shared/preset-mini.c0e4a0cc.js';
6
+ import './shared/preset-mini.79297e15.js';
7
7
 
8
8
  declare const variantAria: VariantObject;
9
9
 
package/dist/variants.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { variantGetParameter, variantGetBracket, variantMatcher, variantParentMatcher } from './utils.mjs';
2
- import { h, t as resolveBreakpoints, e as getBracket, C as CONTROL_MINI_NO_NEGATIVE, w as getComponent } from './shared/preset-mini.f1fe435e.mjs';
1
+ import { variantGetParameter, variantGetBracket, variantMatcher, variantParentMatcher, getBracket, getStringComponent } from '@unocss/rule-utils';
2
+ import { h, j as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE } from './shared/preset-mini.8929b018.mjs';
3
3
  import { warnOnce, escapeRegExp, escapeSelector } from '@unocss/core';
4
4
 
5
5
  const variantAria = {
@@ -317,7 +317,7 @@ const ignoreProps = [
317
317
  function negateFunctions(value) {
318
318
  const match = value.match(/^(calc|clamp|max|min)\s*(\(.*)/);
319
319
  if (match) {
320
- const [fnBody, rest] = getComponent(match[2], "(", ")", " ") ?? [];
320
+ const [fnBody, rest] = getStringComponent(match[2], "(", ")", " ") ?? [];
321
321
  if (fnBody)
322
322
  return `calc(${match[1]}${fnBody} * -1)${rest ? ` ${rest}` : ""}`;
323
323
  }