import * as postcss from 'postcss'; import type { DeclarationRaws as PostcssDeclarationRaws } from 'postcss/lib/declaration'; import { AnyExpression, ExpressionProps } from '../expression'; import { Interpolation, InterpolationProps } from '../interpolation'; import * as sassInternal from '../sass-internal'; import { ChildNode, ChildProps, ContainerProps, NewNode, Statement, StatementWithChildren } from '.'; import { _DeclarationWithChildren } from './declaration-internal'; /** * The set of raws supported by {@link Declaration}. * * @category Statement */ export interface DeclarationRaws extends Omit { /** * The space symbols between the end of the declaration's value and the * semicolon or the opening `{`. Always empty for a declaration that isn't * followed by a semicolon, and ignored if the declaration has children but no * value. */ afterValue?: string; /** * The space symbols between the last child of the node and the `}`. Ignored * if the declaration has no children. */ after?: string; /** * The text of the semicolon after the declaration's children. Ignored if the * declaration has no children. */ ownSemicolon?: string; /** * Contains `true` if the last child has an (optional) semicolon. Ignored if * the declaration has no children. */ semicolon?: boolean; } /** * The initializer properties for {@link Declaration}. * * @category Statement */ export type DeclarationProps = ContainerProps & { raws?: DeclarationRaws; } & ({ propInterpolation: Interpolation | InterpolationProps; prop?: never; } | { prop: string; propInterpolation?: never; }) & ({ expression: AnyExpression | ExpressionProps; value?: never; } | { value: string; expression?: never; } | { nodes: ReadonlyArray; }); /** * A Sass property declaration. Extends [`postcss.Declaration`]. * * [`postcss.Declaration`]: https://postcss.org/api/#declaration * * @category Statement */ export declare class Declaration extends _DeclarationWithChildren> implements Statement { readonly sassType: "decl"; parent: StatementWithChildren | undefined; raws: DeclarationRaws; nodes: ChildNode[] | undefined; get prop(): string; set prop(value: string); /** * The interpolation that represents this declaration's property name. */ get propInterpolation(): Interpolation; set propInterpolation(value: Interpolation | InterpolationProps); private _propInterpolation?; /** * The declaration's value. * * **Note:** In Sass, custom properties can't have SassScript values without * being surrounded by interpolation. Custom properties are always parsed as * unquoted string values, and if they're set to other SassScript values they * may not be evaluated as expected. */ get expression(): AnyExpression | undefined; set expression(value: AnyExpression | ExpressionProps | undefined); private _expression?; get value(): string; set value(value: string | undefined); get important(): boolean; set important(value: boolean); get variable(): boolean; constructor(defaults: DeclarationProps); /** @hidden */ constructor(_: undefined, inner: sassInternal.Declaration); append(...children: NewNode[]): this; prepend(...children: NewNode[]): this; clone(overrides?: Partial): this; toJSON(): object; /** @hidden */ toJSON(_: string, inputs: Map): object; /** @hidden */ toString(stringifier?: postcss.Stringifier | postcss.Syntax): string; /** @hidden */ get nonStatementChildren(): ReadonlyArray; /** @hidden */ normalize(node: NewNode, sample?: postcss.Node): ChildNode[]; }