1 | import Container from './container.js'
|
---|
2 | import Node, { NodeProps } from './node.js'
|
---|
3 |
|
---|
4 | declare namespace Comment {
|
---|
5 | export interface CommentRaws extends Record<string, unknown> {
|
---|
6 | /**
|
---|
7 | * The space symbols before the node.
|
---|
8 | */
|
---|
9 | before?: string
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * The space symbols between `/*` and the comment’s text.
|
---|
13 | */
|
---|
14 | left?: string
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * The space symbols between the comment’s text.
|
---|
18 | */
|
---|
19 | right?: string
|
---|
20 | }
|
---|
21 |
|
---|
22 | export interface CommentProps extends NodeProps {
|
---|
23 | /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
---|
24 | raws?: CommentRaws
|
---|
25 | /** Content of the comment. */
|
---|
26 | text: string
|
---|
27 | }
|
---|
28 |
|
---|
29 | // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
---|
30 | export { Comment_ as default }
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * It represents a class that handles
|
---|
35 | * [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments)
|
---|
36 | *
|
---|
37 | * ```js
|
---|
38 | * Once (root, { Comment }) {
|
---|
39 | * const note = new Comment({ text: 'Note: …' })
|
---|
40 | * root.append(note)
|
---|
41 | * }
|
---|
42 | * ```
|
---|
43 | *
|
---|
44 | * Remember that CSS comments inside selectors, at-rule parameters,
|
---|
45 | * or declaration values will be stored in the `raws` properties
|
---|
46 | * explained above.
|
---|
47 | */
|
---|
48 | declare class Comment_ extends Node {
|
---|
49 | parent: Container | undefined
|
---|
50 | raws: Comment.CommentRaws
|
---|
51 | /**
|
---|
52 | * The comment's text.
|
---|
53 | */
|
---|
54 | get text(): string
|
---|
55 | set text(value: string)
|
---|
56 |
|
---|
57 | type: 'comment'
|
---|
58 |
|
---|
59 | constructor(defaults?: Comment.CommentProps)
|
---|
60 | assign(overrides: Comment.CommentProps | object): this
|
---|
61 | clone(overrides?: Partial<Comment.CommentProps>): Comment
|
---|
62 | cloneAfter(overrides?: Partial<Comment.CommentProps>): Comment
|
---|
63 | cloneBefore(overrides?: Partial<Comment.CommentProps>): Comment
|
---|
64 | }
|
---|
65 |
|
---|
66 | declare class Comment extends Comment_ {}
|
---|
67 |
|
---|
68 | export = Comment
|
---|