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

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

Update repo after prototype presentation

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