2023-07-24 03:13:08 +00:00
|
|
|
|
import Container from './container.js'
|
|
|
|
|
import Node, { NodeProps } from './node.js'
|
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
|
declare namespace Comment {
|
|
|
|
|
export interface CommentRaws extends Record<string, unknown> {
|
|
|
|
|
/**
|
|
|
|
|
* The space symbols before the node.
|
|
|
|
|
*/
|
|
|
|
|
before?: string
|
2023-07-24 03:13:08 +00:00
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
|
/**
|
|
|
|
|
* The space symbols between `/*` and the comment’s text.
|
|
|
|
|
*/
|
|
|
|
|
left?: string
|
2023-07-24 03:13:08 +00:00
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
|
/**
|
|
|
|
|
* The space symbols between the comment’s text.
|
|
|
|
|
*/
|
|
|
|
|
right?: string
|
|
|
|
|
}
|
2023-07-24 03:13:08 +00:00
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
|
export interface CommentProps extends NodeProps {
|
|
|
|
|
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
|
|
|
|
raws?: CommentRaws
|
|
|
|
|
/** Content of the comment. */
|
|
|
|
|
text: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
|
|
|
export { Comment_ as default }
|
2023-07-24 03:13:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-09-06 01:51:55 +00:00
|
|
|
|
* It represents a class that handles
|
|
|
|
|
* [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments)
|
2023-07-24 03:13:08 +00:00
|
|
|
|
*
|
|
|
|
|
* ```js
|
|
|
|
|
* Once (root, { Comment }) {
|
2023-09-06 01:51:55 +00:00
|
|
|
|
* const note = new Comment({ text: 'Note: …' })
|
2023-07-24 03:13:08 +00:00
|
|
|
|
* root.append(note)
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
*
|
2023-09-06 01:51:55 +00:00
|
|
|
|
* Remember that CSS comments inside selectors, at-rule parameters,
|
|
|
|
|
* or declaration values will be stored in the `raws` properties
|
|
|
|
|
* explained above.
|
2023-07-24 03:13:08 +00:00
|
|
|
|
*/
|
2023-09-06 01:51:55 +00:00
|
|
|
|
declare class Comment_ extends Node {
|
2023-07-24 03:13:08 +00:00
|
|
|
|
parent: Container | undefined
|
2023-09-06 01:51:55 +00:00
|
|
|
|
raws: Comment.CommentRaws
|
2023-07-24 03:13:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* The comment's text.
|
|
|
|
|
*/
|
|
|
|
|
text: string
|
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
|
type: 'comment'
|
|
|
|
|
|
|
|
|
|
constructor(defaults?: Comment.CommentProps)
|
|
|
|
|
assign(overrides: Comment.CommentProps | object): this
|
|
|
|
|
clone(overrides?: Partial<Comment.CommentProps>): Comment
|
|
|
|
|
cloneAfter(overrides?: Partial<Comment.CommentProps>): Comment
|
|
|
|
|
cloneBefore(overrides?: Partial<Comment.CommentProps>): Comment
|
2023-07-24 03:13:08 +00:00
|
|
|
|
}
|
2023-09-06 01:51:55 +00:00
|
|
|
|
|
|
|
|
|
declare class Comment extends Comment_ {}
|
|
|
|
|
|
|
|
|
|
export = Comment
|