Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | import Container from './container.js'
|
---|
2 | import Node, { NodeProps } from './node.js'
|
---|
3 |
|
---|
4 | interface CommentRaws {
|
---|
5 | /**
|
---|
6 | * The space symbols before the node.
|
---|
7 | */
|
---|
8 | before?: string
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * The space symbols between `/*` and the comment’s text.
|
---|
12 | */
|
---|
13 | left?: string
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * The space symbols between the comment’s text.
|
---|
17 | */
|
---|
18 | right?: string
|
---|
19 | }
|
---|
20 |
|
---|
21 | export interface CommentProps extends NodeProps {
|
---|
22 | /** Content of the comment. */
|
---|
23 | text: string
|
---|
24 | /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
---|
25 | raws?: CommentRaws
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Represents a comment between declarations or statements (rule and at-rules).
|
---|
30 | *
|
---|
31 | * ```js
|
---|
32 | * Once (root, { Comment }) {
|
---|
33 | * let note = new Comment({ text: 'Note: …' })
|
---|
34 | * root.append(note)
|
---|
35 | * }
|
---|
36 | * ```
|
---|
37 | *
|
---|
38 | * Comments inside selectors, at-rule parameters, or declaration values
|
---|
39 | * will be stored in the `raws` properties explained above.
|
---|
40 | */
|
---|
41 | export default class Comment extends Node {
|
---|
42 | type: 'comment'
|
---|
43 | parent: Container | undefined
|
---|
44 | raws: CommentRaws
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * The comment's text.
|
---|
48 | */
|
---|
49 | text: string
|
---|
50 |
|
---|
51 | constructor(defaults?: CommentProps)
|
---|
52 | assign(overrides: object | CommentProps): this
|
---|
53 | clone(overrides?: Partial<CommentProps>): this
|
---|
54 | cloneBefore(overrides?: Partial<CommentProps>): this
|
---|
55 | cloneAfter(overrides?: Partial<CommentProps>): this
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.