You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

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