|
| 1 | +import { Plugin } from 'postcss'; |
| 2 | + |
| 3 | +declare namespace PostcssUnitProcessor { |
| 4 | + interface Options { |
| 5 | + /** |
| 6 | + * A function to process the value and unit. |
| 7 | + * @param value The numeric value to process. |
| 8 | + * @param unit The unit of the value (e.g., 'px', 'rem'). |
| 9 | + * @param node The PostCSS node being processed. |
| 10 | + * @param root The root PostCSS node. |
| 11 | + * @returns The processed value as a number, string, or an object with value and unit. |
| 12 | + */ |
| 13 | + processor?: (value: number, unit: string, node: any, root: any) => number | string | { value: number | string; unit?: string }; |
| 14 | + |
| 15 | + /** |
| 16 | + * The precision for rounding unit values. |
| 17 | + * @default 5 |
| 18 | + */ |
| 19 | + unitPrecision?: number; |
| 20 | + |
| 21 | + /** |
| 22 | + * List of selectors to exclude from processing. |
| 23 | + * @default [] |
| 24 | + */ |
| 25 | + selectorBlackList?: Array<string | RegExp>; |
| 26 | + |
| 27 | + /** |
| 28 | + * List of properties to process. Supports wildcards and negation. |
| 29 | + * @default ['*'] |
| 30 | + */ |
| 31 | + propList?: string[]; |
| 32 | + |
| 33 | + /** |
| 34 | + * Whether to replace the original declaration or add a new one. |
| 35 | + * @default true |
| 36 | + */ |
| 37 | + replace?: boolean; |
| 38 | + |
| 39 | + /** |
| 40 | + * Whether to process units in media queries. |
| 41 | + * @default false |
| 42 | + */ |
| 43 | + mediaQuery?: boolean; |
| 44 | + |
| 45 | + /** |
| 46 | + * Pattern or function to exclude files from processing. |
| 47 | + * @default /node_modules/i |
| 48 | + */ |
| 49 | + exclude?: RegExp | string | ((filePath: string) => boolean); |
| 50 | + |
| 51 | + /** |
| 52 | + * Custom units to support in addition to default units. |
| 53 | + * @default [] |
| 54 | + */ |
| 55 | + customUnitList?: string[]; |
| 56 | + } |
| 57 | +} |
| 58 | + |
| 59 | +/** |
| 60 | + * A PostCSS plugin to process units in CSS declarations and media queries. |
| 61 | + * @param options Configuration options for the plugin. |
| 62 | + * @returns A PostCSS plugin instance. |
| 63 | + */ |
| 64 | +declare function PostcssUnitProcessor(options?: PostcssUnitProcessor.Options): Plugin; |
| 65 | + |
| 66 | +export = PostcssUnitProcessor; |
0 commit comments