@unocss/rule-utils 66.0.0 → 66.1.0-beta.10

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 CHANGED
@@ -32,7 +32,9 @@ interface ParsedColorValue {
32
32
  */
33
33
  alpha: string | number | undefined;
34
34
  }
35
+ declare const cssColorFunctions: string[];
35
36
  declare const alphaPlaceholders: string[];
37
+ declare const alphaPlaceholdersRE: RegExp;
36
38
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
37
39
  declare function parseCssColor(str?: string): CSSColorValue | undefined;
38
40
  declare function colorOpacityToString(color: CSSColorValue): string | number;
@@ -61,9 +63,9 @@ declare function getBracket(str: string, open: string, close: string): string[]
61
63
  declare function getStringComponent(str: string, open: string, close: string, separators: string | string[]): string[] | undefined;
62
64
  declare function getStringComponents(str: string, separators: string | string[], limit?: number): string[] | undefined;
63
65
 
64
- declare function variantMatcher(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject;
65
- declare function variantParentMatcher(name: string, parent: string): VariantObject;
66
+ declare function variantMatcher<T extends object = object>(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject<T>;
67
+ declare function variantParentMatcher<T extends object = object>(name: string, parent: string): VariantObject<T>;
66
68
  declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
67
69
  declare function variantGetParameter(prefix: string, matcher: string, separators: string[]): string[] | undefined;
68
70
 
69
- export { type CSSColorValue, type ParsedColorValue, type RGBAColorValue, type ValueHandler, type ValueHandlerCallback, alphaPlaceholders, colorOpacityToString, colorToString, createValueHandler, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
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
@@ -32,7 +32,9 @@ interface ParsedColorValue {
32
32
  */
33
33
  alpha: string | number | undefined;
34
34
  }
35
+ declare const cssColorFunctions: string[];
35
36
  declare const alphaPlaceholders: string[];
37
+ declare const alphaPlaceholdersRE: RegExp;
36
38
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
37
39
  declare function parseCssColor(str?: string): CSSColorValue | undefined;
38
40
  declare function colorOpacityToString(color: CSSColorValue): string | number;
@@ -61,9 +63,9 @@ declare function getBracket(str: string, open: string, close: string): string[]
61
63
  declare function getStringComponent(str: string, open: string, close: string, separators: string | string[]): string[] | undefined;
62
64
  declare function getStringComponents(str: string, separators: string | string[], limit?: number): string[] | undefined;
63
65
 
64
- declare function variantMatcher(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject;
65
- declare function variantParentMatcher(name: string, parent: string): VariantObject;
66
+ declare function variantMatcher<T extends object = object>(name: string, handler: Arrayable<(input: VariantHandlerContext) => Record<string, any>>): VariantObject<T>;
67
+ declare function variantParentMatcher<T extends object = object>(name: string, parent: string): VariantObject<T>;
66
68
  declare function variantGetBracket(prefix: string, matcher: string, separators: string[]): string[] | undefined;
67
69
  declare function variantGetParameter(prefix: string, matcher: string, separators: string[]): string[] | undefined;
68
70
 
69
- export { type CSSColorValue, type ParsedColorValue, type RGBAColorValue, type ValueHandler, type ValueHandlerCallback, alphaPlaceholders, colorOpacityToString, colorToString, createValueHandler, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
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
@@ -89,7 +89,7 @@ function getStringComponents(str, separators, limit) {
89
89
 
90
90
  const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
91
91
  const alphaPlaceholders = ["%alpha", "<alpha-value>"];
92
- const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|"));
92
+ const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|"), "g");
93
93
  function hex2rgba(hex = "") {
94
94
  const color = parseHexColor(hex);
95
95
  if (color != null) {
@@ -421,4 +421,4 @@ function variantGetParameter(prefix, matcher, separators) {
421
421
  }
422
422
  }
423
423
 
424
- export { alphaPlaceholders, colorOpacityToString, colorToString, createValueHandler, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
424
+ export { alphaPlaceholders, alphaPlaceholdersRE, colorOpacityToString, colorToString, createValueHandler, cssColorFunctions, getBracket, getStringComponent, getStringComponents, hasIconFn, hasThemeFn, hex2rgba, iconFnRE, parseCssColor, themeFnRE, transformThemeFn, transformThemeString, variantGetBracket, variantGetParameter, variantMatcher, variantParentMatcher };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/rule-utils",
3
3
  "type": "module",
4
- "version": "66.0.0",
4
+ "version": "66.1.0-beta.10",
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.0.0"
37
+ "@unocss/core": "^66.1.0-beta.10"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",