| 1 | import { N as NamedUtilityValue, P as PluginUtils } from './resolve-config-QUZ9b-Gn.mjs';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * The source code for one or more nodes in the AST
|
|---|
| 5 | *
|
|---|
| 6 | * This generally corresponds to a stylesheet
|
|---|
| 7 | */
|
|---|
| 8 | interface Source {
|
|---|
| 9 | /**
|
|---|
| 10 | * The path to the file that contains the referenced source code
|
|---|
| 11 | *
|
|---|
| 12 | * If this references the *output* source code, this is `null`.
|
|---|
| 13 | */
|
|---|
| 14 | file: string | null;
|
|---|
| 15 | /**
|
|---|
| 16 | * The referenced source code
|
|---|
| 17 | */
|
|---|
| 18 | code: string;
|
|---|
| 19 | }
|
|---|
| 20 | /**
|
|---|
| 21 | * The file and offsets within it that this node covers
|
|---|
| 22 | *
|
|---|
| 23 | * This can represent either:
|
|---|
| 24 | * - A location in the original CSS which caused this node to be created
|
|---|
| 25 | * - A location in the output CSS where this node resides
|
|---|
| 26 | */
|
|---|
| 27 | type SourceLocation = [source: Source, start: number, end: number];
|
|---|
| 28 |
|
|---|
| 29 | type Config = UserConfig;
|
|---|
| 30 | type PluginFn = (api: PluginAPI) => void;
|
|---|
| 31 | type PluginWithConfig = {
|
|---|
| 32 | handler: PluginFn;
|
|---|
| 33 | config?: UserConfig;
|
|---|
| 34 | /** @internal */
|
|---|
| 35 | reference?: boolean;
|
|---|
| 36 | src?: SourceLocation | undefined;
|
|---|
| 37 | };
|
|---|
| 38 | type PluginWithOptions<T> = {
|
|---|
| 39 | (options?: T): PluginWithConfig;
|
|---|
| 40 | __isOptionsFunction: true;
|
|---|
| 41 | };
|
|---|
| 42 | type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
|
|---|
| 43 | type PluginAPI = {
|
|---|
| 44 | addBase(base: CssInJs): void;
|
|---|
| 45 | addVariant(name: string, variant: string | string[] | CssInJs): void;
|
|---|
| 46 | matchVariant<T = string>(name: string, cb: (value: T | string, extra: {
|
|---|
| 47 | modifier: string | null;
|
|---|
| 48 | }) => string | string[], options?: {
|
|---|
| 49 | values?: Record<string, T>;
|
|---|
| 50 | sort?(a: {
|
|---|
| 51 | value: T | string;
|
|---|
| 52 | modifier: string | null;
|
|---|
| 53 | }, b: {
|
|---|
| 54 | value: T | string;
|
|---|
| 55 | modifier: string | null;
|
|---|
| 56 | }): number;
|
|---|
| 57 | }): void;
|
|---|
| 58 | addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
|
|---|
| 59 | matchUtilities(utilities: Record<string, (value: string, extra: {
|
|---|
| 60 | modifier: string | null;
|
|---|
| 61 | }) => CssInJs | CssInJs[]>, options?: Partial<{
|
|---|
| 62 | type: string | string[];
|
|---|
| 63 | supportsNegativeValues: boolean;
|
|---|
| 64 | values: Record<string, string> & {
|
|---|
| 65 | __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
|---|
| 66 | };
|
|---|
| 67 | modifiers: 'any' | Record<string, string>;
|
|---|
| 68 | }>): void;
|
|---|
| 69 | addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
|
|---|
| 70 | matchComponents(utilities: Record<string, (value: string, extra: {
|
|---|
| 71 | modifier: string | null;
|
|---|
| 72 | }) => CssInJs>, options?: Partial<{
|
|---|
| 73 | type: string | string[];
|
|---|
| 74 | supportsNegativeValues: boolean;
|
|---|
| 75 | values: Record<string, string> & {
|
|---|
| 76 | __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
|---|
| 77 | };
|
|---|
| 78 | modifiers: 'any' | Record<string, string>;
|
|---|
| 79 | }>): void;
|
|---|
| 80 | theme(path: string, defaultValue?: any): any;
|
|---|
| 81 | config(path?: string, defaultValue?: any): any;
|
|---|
| 82 | prefix(className: string): string;
|
|---|
| 83 | };
|
|---|
| 84 | type CssInJs = {
|
|---|
| 85 | [key: string]: string | string[] | CssInJs | CssInJs[];
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
|
|---|
| 89 | type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
|
|---|
| 90 | type ThemeConfig = Record<string, ThemeValue> & {
|
|---|
| 91 | extend?: Record<string, ThemeValue>;
|
|---|
| 92 | };
|
|---|
| 93 | type ContentFile = string | {
|
|---|
| 94 | raw: string;
|
|---|
| 95 | extension?: string;
|
|---|
| 96 | };
|
|---|
| 97 | type DarkModeStrategy = false | 'media' | 'class' | ['class', string] | 'selector' | ['selector', string] | ['variant', string | string[]];
|
|---|
| 98 | interface UserConfig {
|
|---|
| 99 | presets?: UserConfig[];
|
|---|
| 100 | theme?: ThemeConfig;
|
|---|
| 101 | plugins?: Plugin[];
|
|---|
| 102 | }
|
|---|
| 103 | interface UserConfig {
|
|---|
| 104 | content?: ContentFile[] | {
|
|---|
| 105 | relative?: boolean;
|
|---|
| 106 | files: ContentFile[];
|
|---|
| 107 | };
|
|---|
| 108 | }
|
|---|
| 109 | interface UserConfig {
|
|---|
| 110 | darkMode?: DarkModeStrategy;
|
|---|
| 111 | }
|
|---|
| 112 | interface UserConfig {
|
|---|
| 113 | prefix?: string;
|
|---|
| 114 | }
|
|---|
| 115 | interface UserConfig {
|
|---|
| 116 | blocklist?: string[];
|
|---|
| 117 | }
|
|---|
| 118 | interface UserConfig {
|
|---|
| 119 | important?: boolean | string;
|
|---|
| 120 | }
|
|---|
| 121 | interface UserConfig {
|
|---|
| 122 | future?: 'all' | Record<string, boolean>;
|
|---|
| 123 | }
|
|---|
| 124 | interface UserConfig {
|
|---|
| 125 | experimental?: 'all' | Record<string, boolean>;
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | export type { Config as C, Plugin as P, SourceLocation as S, ThemeConfig as T, UserConfig as U, PluginFn as a, PluginWithConfig as b, PluginWithOptions as c, PluginAPI as d };
|
|---|