@unocss/rule-utils 66.1.0 → 66.1.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.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +18 -16
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,6 @@ declare function getStringComponents(str: string, separators: string | string[],
|
|
|
66
66
|
declare function variantMatcher<T extends object = object>(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject<T>;
|
|
67
67
|
declare function variantParentMatcher<T extends object = object>(name: string, parent: string): VariantObject<T>;
|
|
68
68
|
declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
|
|
69
|
-
declare function variantGetParameter(prefix: string
|
|
69
|
+
declare function variantGetParameter(prefix: Arrayable<string>, matcher: string, separators: string[]): string[] | undefined;
|
|
70
70
|
|
|
71
71
|
export { type CSSColorValue, type ParsedColorValue, type RGBAColorValue, type ValueHandler, type ValueHandlerCallback, alphaPlaceholders, alphaPlaceholdersRE, colorOpacityToString, colorToString, createValueHandler, cssColorFunctions, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,6 @@ declare function getStringComponents(str: string, separators: string | string[],
|
|
|
66
66
|
declare function variantMatcher<T extends object = object>(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject<T>;
|
|
67
67
|
declare function variantParentMatcher<T extends object = object>(name: string, parent: string): VariantObject<T>;
|
|
68
68
|
declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
|
|
69
|
-
declare function variantGetParameter(prefix: string
|
|
69
|
+
declare function variantGetParameter(prefix: Arrayable<string>, matcher: string, separators: string[]): string[] | undefined;
|
|
70
70
|
|
|
71
71
|
export { type CSSColorValue, type ParsedColorValue, type RGBAColorValue, type ValueHandler, type ValueHandlerCallback, alphaPlaceholders, alphaPlaceholdersRE, colorOpacityToString, colorToString, createValueHandler, cssColorFunctions, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
|
package/dist/index.mjs
CHANGED
|
@@ -400,22 +400,24 @@ function variantGetBracket(prefix, matcher, separators) {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
function variantGetParameter(prefix, matcher, separators) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
403
|
+
for (const p of toArray(prefix)) {
|
|
404
|
+
if (matcher.startsWith(p)) {
|
|
405
|
+
const body = variantGetBracket(p, matcher, separators);
|
|
406
|
+
if (body) {
|
|
407
|
+
const [label = "", rest = body[1]] = variantGetParameter("/", body[1], separators) ?? [];
|
|
408
|
+
return [body[0], rest, label];
|
|
409
|
+
}
|
|
410
|
+
for (const separator of separators.filter((x) => x !== "/")) {
|
|
411
|
+
const pos = matcher.indexOf(separator, p.length);
|
|
412
|
+
if (pos !== -1) {
|
|
413
|
+
const labelPos = matcher.indexOf("/", p.length);
|
|
414
|
+
const unlabelled = labelPos === -1 || pos <= labelPos;
|
|
415
|
+
return [
|
|
416
|
+
matcher.slice(p.length, unlabelled ? pos : labelPos),
|
|
417
|
+
matcher.slice(pos + separator.length),
|
|
418
|
+
unlabelled ? "" : matcher.slice(labelPos + 1, pos)
|
|
419
|
+
];
|
|
420
|
+
}
|
|
419
421
|
}
|
|
420
422
|
}
|
|
421
423
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/rule-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.1.
|
|
4
|
+
"version": "66.1.1",
|
|
5
5
|
"description": "Utilities for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"magic-string": "^0.30.17",
|
|
37
|
-
"@unocss/core": "^66.1.
|
|
37
|
+
"@unocss/core": "^66.1.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "unbuild",
|