1 | import Container, { ContainerProps } from './container.js'
|
2 | import { ProcessOptions } from './postcss.js'
|
3 | import Result from './result.js'
|
4 | import Root, { RootProps } from './root.js'
|
5 |
|
6 | export interface DocumentProps extends ContainerProps {
|
7 | nodes?: Root[]
|
8 |
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | raws?: Record<string, any>
|
16 | }
|
17 |
|
18 | type ChildNode = Root
|
19 | type ChildProps = RootProps
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export default class Document extends Container<Root> {
|
36 | type: 'document'
|
37 | parent: undefined
|
38 |
|
39 | constructor(defaults?: DocumentProps)
|
40 |
|
41 | /**
|
42 | * Returns a `Result` instance representing the document’s CSS roots.
|
43 | *
|
44 | * ```js
|
45 | * const root1 = postcss.parse(css1, { from: 'a.css' })
|
46 | * const root2 = postcss.parse(css2, { from: 'b.css' })
|
47 | * const document = postcss.document()
|
48 | * document.append(root1)
|
49 | * document.append(root2)
|
50 | * const result = document.toResult({ to: 'all.css', map: true })
|
51 | * ```
|
52 | *
|
53 | * @param opts Options.
|
54 | * @return Result with current document’s CSS.
|
55 | */
|
56 | toResult(options?: ProcessOptions): Result
|
57 | }
|