-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.d.ts
82 lines (74 loc) · 2.36 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
import { type IDisposable, type languages, type MonacoEditor } from 'monaco-types'
import { type Config } from 'tailwindcss'
/**
* A Tailwind configuration, but without content.
*/
export type TailwindConfig = Omit<Config, 'content'>
export interface MonacoTailwindcssOptions {
/**
* @default defaultLanguageSelector
*/
languageSelector?: languages.LanguageSelector
/**
* The tailwind configuration to use.
*
* This may be either the Tailwind configuration object, or a string that gets processed in the
* worker.
*/
tailwindConfig?: TailwindConfig | 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
}
export interface MonacoTailwindcss extends IDisposable {
/**
* Update the current Tailwind configuration.
*
* @param tailwindConfig
* The new Tailwind configuration.
*/
setTailwindConfig: (tailwindConfig: TailwindConfig | string) => 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 configureMonacoTailwindcss}.
*
* @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
* monacoTailwindcss.generateStylesFromContent(
* css,
* editor.getModels().filter((model) => model.getLanguageId() === 'html')
* )
*/
generateStylesFromContent: (css: string, content: (Content | string)[]) => Promise<string>
}
/**
* Configure `monaco-tailwindcss`.
*
* @param monaco
* The `monaco-editor` module.
* @param options
* Options for customizing the `monaco-tailwindcss`.
*/
export function configureMonacoTailwindcss(
monaco: MonacoEditor,
options?: MonacoTailwindcssOptions
): MonacoTailwindcss
/**
* This data can be used with the default Monaco CSS support to support tailwind directives.
*
* It will provider hover information from the Tailwindcss documentation, including a link.
*/
export const tailwindcssData: languages.css.CSSDataV1