-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathindex.d.ts
More file actions
59 lines (51 loc) · 1.61 KB
/
index.d.ts
File metadata and controls
59 lines (51 loc) · 1.61 KB
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
// From DefinitelyTyped by Adam Thompson-Sharpe (https://github.com/MysteryBlokHed) with some modifications.
import { AcceptedPlugin, Root } from 'postcss'
declare namespace postcssJs {
/** CSS-in-JS object */
type CssInJs = Record<string, any>
/**
* Create a PostCSS processor with a simple API
* @param plugins Synchronous plugins to use with PostCSS
* @returns A processor function that accepts (idk) and returns a CSS-in-JS object
*/
function sync(
plugins?: readonly AcceptedPlugin[]
): (input: CssInJs) => CssInJs
function sync(...plugins: AcceptedPlugin[]): (input: CssInJs) => CssInJs
/**
* Create a PostCSS processor with a simple API, allowing asynchronous plugins
* @param plugins Plugins to use with PostCSS
* @returns A processor function that accepts (idk) and returns a CSS-in-JS object
*/
function async(
plugins?: readonly AcceptedPlugin[]
): (input: CssInJs) => Promise<CssInJs>
function async(
...plugins: AcceptedPlugin[]
): (input: CssInJs) => Promise<CssInJs>
/**
* Parse a CSS-in-JS object into a PostCSS `Root`
* @param obj The CSS-in-JS to parse
* @returns A PostCSS `Root`
*/
function parse(obj: CssInJs): Root
interface ObjectifyOptions {
stringifyImportant?: boolean | undefined
}
/**
* Convert a PostCSS `Root` into a CSS-in-JS object
* @param root The root to convert
* @returns CSS-in-JS object
*/
function objectify(root: Root, options?: ObjectifyOptions): CssInJs
export {
CssInJs,
ObjectifyOptions,
sync,
async,
objectify,
parse,
postcssJs as default
}
}
export = postcssJs