source: trip-planner-front/node_modules/postcss/lib/declaration.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
1import Container from './container.js'
2import Node from './node.js'
3
4interface DeclarationRaws {
5 /**
6 * The space symbols before the node. It also stores `*`
7 * and `_` symbols before the declaration (IE hack).
8 */
9 before?: string
10
11 /**
12 * The symbols between the property and value for declarations.
13 */
14 between?: string
15
16 /**
17 * The content of the important statement, if it is not just `!important`.
18 */
19 important?: string
20
21 /**
22 * Declaration value with comments.
23 */
24 value: {
25 value: string
26 raw: string
27 }
28}
29
30export interface DeclarationProps {
31 /** Name of the declaration. */
32 prop: string
33 /** Value of the declaration. */
34 value: string
35 /** Whether the declaration has an `!important` annotation. */
36 important?: boolean
37 /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
38 raws?: DeclarationRaws
39}
40
41/**
42 * Represents a CSS declaration.
43 *
44 * ```js
45 * Once (root, { Declaration }) {
46 * let color = new Declaration({ prop: 'color', value: 'black' })
47 * root.append(color)
48 * }
49 * ```
50 *
51 * ```js
52 * const root = postcss.parse('a { color: black }')
53 * const decl = root.first.first
54 * decl.type //=> 'decl'
55 * decl.toString() //=> ' color: black'
56 * ```
57 */
58export default class Declaration extends Node {
59 type: 'decl'
60 parent: Container | undefined
61 raws: DeclarationRaws
62
63 /**
64 * The declaration's property name.
65 *
66 * ```js
67 * const root = postcss.parse('a { color: black }')
68 * const decl = root.first.first
69 * decl.prop //=> 'color'
70 * ```
71 */
72 prop: string
73
74 /**
75 * The declaration’s value.
76 *
77 * This value will be cleaned of comments. If the source value contained
78 * comments, those comments will be available in the `raws` property.
79 * If you have not changed the value, the result of `decl.toString()`
80 * will include the original raws value (comments and all).
81 *
82 * ```js
83 * const root = postcss.parse('a { color: black }')
84 * const decl = root.first.first
85 * decl.value //=> 'black'
86 * ```
87 */
88 value: string
89
90 /**
91 * `true` if the declaration has an `!important` annotation.
92 *
93 * ```js
94 * const root = postcss.parse('a { color: black !important; color: red }')
95 * root.first.first.important //=> true
96 * root.first.last.important //=> undefined
97 * ```
98 */
99 important: boolean
100
101 /**
102 * `true` if declaration is declaration of CSS Custom Property
103 * or Sass variable.
104 *
105 * ```js
106 * const root = postcss.parse(':root { --one: 1 }')
107 * let one = root.first.first
108 * one.variable //=> true
109 * ```
110 *
111 * ```js
112 * const root = postcss.parse('$one: 1')
113 * let one = root.first
114 * one.variable //=> true
115 * ```
116 */
117 variable: boolean
118
119 constructor(defaults?: DeclarationProps)
120 assign(overrides: object | DeclarationProps): this
121 clone(overrides?: Partial<DeclarationProps>): this
122 cloneBefore(overrides?: Partial<DeclarationProps>): this
123 cloneAfter(overrides?: Partial<DeclarationProps>): this
124}
Note: See TracBrowser for help on using the repository browser.