AK-21/Graphite-Industrial-Intelligence
0
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?: string11 12 /**13 * The symbols between the property and value for declarations.14 */15 between?: string16 17 /**18 * The content of the important statement, if it is not just `!important`.19 */20 important?: string21 22 /**23 * Declaration value with comments.24 */25 value?: {26 raw: string27 value: string28 }29 }30 31 export interface DeclarationProps {32 /** Whether the declaration has an `!important` annotation. */33 important?: boolean34 /** Name of the declaration. */35 prop: string36 /** Information used to generate byte-to-byte equal node string as it was in the origin input. */37 raws?: DeclarationRaws38 /** Value of the declaration. */39 value: string40 }41 42 export { Declaration_ as default }43}44 45/**46 * It represents a class that handles47 * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations)48 *49 * ```js50 * Once (root, { Declaration }) {51 * const color = new Declaration({ prop: 'color', value: 'black' })52 * root.append(color)53 * }54 * ```55 *56 * ```js57 * const root = postcss.parse('a { color: black }')58 * const decl = root.first?.first59 *60 * decl.type //=> 'decl'61 * decl.toString() //=> ' color: black'62 * ```63 */64declare class Declaration_ extends Node {65 parent: ContainerWithChildren | undefined66 raws: Declaration.DeclarationRaws67 68 type: 'decl'69 70 /**71 * It represents a specificity of the declaration.72 *73 * If true, the CSS declaration will have an74 * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important)75 * specifier.76 *77 * ```js78 * const root = postcss.parse('a { color: black !important; color: red }')79 *80 * root.first.first.important //=> true81 * root.first.last.important //=> undefined82 * ```83 */84 get important(): boolean85 set important(value: boolean)86 87 /**88 * The property name for a CSS declaration.89 *90 * ```js91 * const root = postcss.parse('a { color: black }')92 * const decl = root.first.first93 *94 * decl.prop //=> 'color'95 * ```96 */97 get prop(): string98 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 in106 * the `raws` property.107 *108 * Assigning new `value` would ignore the comments in `raws`109 * property while compiling node to string.110 *111 * ```js112 * const root = postcss.parse('a { color: black }')113 * const decl = root.first.first114 *115 * decl.value //=> 'black'116 * ```117 */118 get value(): string119 set value(value: string)120 121 /**122 * It represents a getter that returns `true` if a declaration starts with123 * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.124 *125 * ```js126 * const root = postcss.parse(':root { --one: 1 }')127 * const one = root.first.first128 *129 * one.variable //=> true130 * ```131 *132 * ```js133 * const root = postcss.parse('$one: 1')134 * const one = root.first135 *136 * one.variable //=> true137 * ```138 */139 get variable(): boolean140 constructor(defaults?: Declaration.DeclarationProps)141 142 assign(overrides: Declaration.DeclarationProps | object): this143 clone(overrides?: Partial<Declaration.DeclarationProps>): this144 cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this145 cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this146}147 148declare class Declaration extends Declaration_ {}149 150export = Declaration151 