source: node_modules/tailwindcss/dist/plugin.d.ts@ 2058e5c

Last change on this file since 2058e5c was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Working / before login

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