source: imaps-frontend/node_modules/postcss/lib/declaration.d.ts@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 3.8 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 // eslint-disable-next-line @typescript-eslint/no-use-before-define
43 export { Declaration_ as default }
44}
45
46/**
47 * It represents a class that handles
48 * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations)
49 *
50 * ```js
51 * Once (root, { Declaration }) {
52 * const color = new Declaration({ prop: 'color', value: 'black' })
53 * root.append(color)
54 * }
55 * ```
56 *
57 * ```js
58 * const root = postcss.parse('a { color: black }')
59 * const decl = root.first?.first
60 *
61 * decl.type //=> 'decl'
62 * decl.toString() //=> ' color: black'
63 * ```
64 */
65declare class Declaration_ extends Node {
66 parent: ContainerWithChildren | undefined
67 raws: Declaration.DeclarationRaws
68
69 type: 'decl'
70
71 constructor(defaults?: Declaration.DeclarationProps)
72 assign(overrides: Declaration.DeclarationProps | object): this
73
74 clone(overrides?: Partial<Declaration.DeclarationProps>): this
75
76 cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
77
78 cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
79 /**
80 * It represents a specificity of the declaration.
81 *
82 * If true, the CSS declaration will have an
83 * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important)
84 * specifier.
85 *
86 * ```js
87 * const root = postcss.parse('a { color: black !important; color: red }')
88 *
89 * root.first.first.important //=> true
90 * root.first.last.important //=> undefined
91 * ```
92 */
93 get important(): boolean
94
95 set important(value: boolean)
96 /**
97 * The property name for a CSS declaration.
98 *
99 * ```js
100 * const root = postcss.parse('a { color: black }')
101 * const decl = root.first.first
102 *
103 * decl.prop //=> 'color'
104 * ```
105 */
106 get prop(): string
107
108 set prop(value: string)
109 /**
110 * The property value for a CSS declaration.
111 *
112 * Any CSS comments inside the value string will be filtered out.
113 * CSS comments present in the source value will be available in
114 * the `raws` property.
115 *
116 * Assigning new `value` would ignore the comments in `raws`
117 * property while compiling node to string.
118 *
119 * ```js
120 * const root = postcss.parse('a { color: black }')
121 * const decl = root.first.first
122 *
123 * decl.value //=> 'black'
124 * ```
125 */
126 get value(): string
127 set value(value: string)
128 /**
129 * It represents a getter that returns `true` if a declaration starts with
130 * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
131 *
132 * ```js
133 * const root = postcss.parse(':root { --one: 1 }')
134 * const one = root.first.first
135 *
136 * one.variable //=> true
137 * ```
138 *
139 * ```js
140 * const root = postcss.parse('$one: 1')
141 * const one = root.first
142 *
143 * one.variable //=> true
144 * ```
145 */
146 get variable(): boolean
147}
148
149declare class Declaration extends Declaration_ {}
150
151export = Declaration
Note: See TracBrowser for help on using the repository browser.