-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.d.ts
114 lines (103 loc) · 3.09 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { AcceptedPlugin } from 'postcss';
import { Config } from 'tailwindcss';
/**
* The entry point to retrieve 'tailwindcss'
*
* @param options {@link TailwindcssOptions}
* @example
* const tailwindConfig: TailwindConfig = {
* theme: {
* extend: {
* colors: {
* marcherry: 'red',
* },
* },
* },
* };
* const tailwindCss = tailwindcssFactory({ tailwindConfig });
*/
export function createTailwindcss(
options?: TailwindcssOptions,
): Tailwindcss;
export interface TailwindcssOptions {
/**
* The tailwind configuration to use.
*/
tailwindConfig?: TailwindConfig;
}
export interface Tailwindcss {
/**
* Update the current Tailwind configuration.
*
* @param tailwindConfig The new Tailwind configuration.
*/
setTailwindConfig: (tailwindConfig: TailwindConfig) => void;
/**
* Generate styles using Tailwindcss.
*
* This generates CSS using the Tailwind JIT compiler. It uses the Tailwind configuration that has
* previously been passed to {@link createTailwindcss}.
*
* @param css The CSS to process. Only one CSS file can be processed at a time.
* @param content All content that contains CSS classes to extract.
* @returns The CSS generated by the Tailwind JIT compiler. It has been optimized for the given
* content.
* @example
* tailwindcss.generateStylesFromContent(
* css,
* [myHtmlCode]
* )
*/
generateStylesFromContent: (css: string, content: (Content | string)[]) => Promise<string>;
}
/**
* Lower level API to create a PostCSS Tailwindcss Plugin
* @internal might change in the future
* @example
* const processor = postcss([createTailwindcssPlugin({ tailwindConfig, content })]);
* const { css } = await processor.process(css, { from: undefined });
*/
export function createTailwindcssPlugin(
options: TailwindCssPluginOptions
): AcceptedPlugin;
export interface TailwindCssPluginOptions {
/**
* The tailwind configuration to use.
*/
tailwindConfig?: TailwindConfig;
/**
* All content that contains CSS classes to extract.
*/
content: (Content | string)[];
}
/**
* Contains the content of CSS classes to extract.
* With optional "extension" key, which might be relevant
* to properly extract css classed based on the content language.
*/
export interface Content {
content: string;
extension?: string;
}
/**
* Client side api to generate css via tailwind jit in the browser
*
* @deprecated with 0.2.0
*/
declare function jitBrowserTailwindcss(tailwindMainCss: string, jitContent: string, userTailwindConfig?: TailwindConfig): Promise<string>;
export { jitBrowserTailwindcss };
export default jitBrowserTailwindcss;
// This way we Omit `content`, somehow, Omit<> doesnt work.
export interface TailwindConfig {
important?: Config['important'];
prefix?: Config['prefix'];
separator?: Config['separator'];
safelist?: Config['safelist'];
presets?: Config['presets'];
future?: Config['future'];
experimental?: Config['experimental'];
darkMode?: Config['darkMode'];
theme?: Config['theme'];
corePlugins?: Config['corePlugins'];
plugins?: Config['plugins'];
}