source: frontend/node_modules/postcss/lib/declaration.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 3.7 KB
Line 
1import { ContainerWithChildren } from './container.js'
2import Node from './node.js'
3
4declare namespace Declaration {
5 export interface DeclarationRaws extends Record<string, unknown> {
6 /**
7 * The space symbols before the node. It also stores `*`
8 * and `_` symbols before the declaration (IE hack).
9 */
10 before?: string
11
12 /**
13 * The symbols between the property and value for declarations.
14 */
15 between?: string
16
17 /**
18 * The content of the important statement, if it is not just `!important`.
19 */
20 important?: string
21
22 /**
23 * Declaration value with comments.
24 */
25 value?: {
26 raw: string
27 value: string
28 }
29 }
30
31 export interface DeclarationProps {
32 /** Whether the declaration has an `!important` annotation. */
33 important?: boolean
34 /** Name of the declaration. */
35 prop: string
36 /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
37 raws?: DeclarationRaws
38 /** Value of the declaration. */
39 value: string
40 }
41
42 export { Declaration_ as default }
43}
44
45/**
46 * It represents a class that handles
47 * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations)
48 *
49 * ```js
50 * Once (root, { Declaration }) {
51 * const color = new Declaration({ prop: 'color', value: 'black' })
52 * root.append(color)
53 * }
54 * ```
55 *
56 * ```js
57 * const root = postcss.parse('a { color: black }')
58 * const decl = root.first?.first
59 *
60 * decl.type //=> 'decl'
61 * decl.toString() //=> ' color: black'
62 * ```
63 */
64declare class Declaration_ extends Node {
65 parent: ContainerWithChildren | undefined
66 raws: Declaration.DeclarationRaws
67
68 type: 'decl'
69
70 /**
71 * It represents a specificity of the declaration.
72 *
73 * If true, the CSS declaration will have an
74 * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important)
75 * specifier.
76 *
77 * ```js
78 * const root = postcss.parse('a { color: black !important; color: red }')
79 *
80 * root.first.first.important //=> true
81 * root.first.last.important //=> undefined
82 * ```
83 */
84 get important(): boolean
85 set important(value: boolean)
86
87 /**
88 * The property name for a CSS declaration.
89 *
90 * ```js
91 * const root = postcss.parse('a { color: black }')
92 * const decl = root.first.first
93 *
94 * decl.prop //=> 'color'
95 * ```
96 */
97 get prop(): string
98
99 set prop(value: string)
100
101 /**
102 * The property value for a CSS declaration.
103 *
104 * Any CSS comments inside the value string will be filtered out.
105 * CSS comments present in the source value will be available in
106 * the `raws` property.
107 *
108 * Assigning new `value` would ignore the comments in `raws`
109 * property while compiling node to string.
110 *
111 * ```js
112 * const root = postcss.parse('a { color: black }')
113 * const decl = root.first.first
114 *
115 * decl.value //=> 'black'
116 * ```
117 */
118 get value(): string
119 set value(value: string)
120
121 /**
122 * It represents a getter that returns `true` if a declaration starts with
123 * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
124 *
125 * ```js
126 * const root = postcss.parse(':root { --one: 1 }')
127 * const one = root.first.first
128 *
129 * one.variable //=> true
130 * ```
131 *
132 * ```js
133 * const root = postcss.parse('$one: 1')
134 * const one = root.first
135 *
136 * one.variable //=> true
137 * ```
138 */
139 get variable(): boolean
140 constructor(defaults?: Declaration.DeclarationProps)
141
142 assign(overrides: Declaration.DeclarationProps | object): this
143 clone(overrides?: Partial<Declaration.DeclarationProps>): this
144 cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
145 cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
146}
147
148declare class Declaration extends Declaration_ {}
149
150export = Declaration
Note: See TracBrowser for help on using the repository browser.