import * as postcss from 'postcss'; import { Container } from '../container'; import { NodeProps } from '../node'; import type * as sassInternal from '../sass-internal'; import { Expression } from '.'; import { IfEntry, IfEntryProps } from './if-entry'; /** * The initializer properties for {@link IfExpression}. * * @category Expression */ export interface IfExpressionProps extends NodeProps { raws?: IfExpressionRaws; nodes: Array; } /** * The type of new node pairs that can be passed into an `if()` expression. * * @category Expression */ export type NewNodeForIfExpression = IfEntry | IfEntryProps | ReadonlyArray | ReadonlyArray | undefined; /** * Raws indicating how to precisely serialize a {@link IfExpression}. * * @category Expression */ export interface IfExpressionRaws { /** * The whitespace between the opening parenthesis and the first expression. */ afterOpen?: string; /** * The whitespace between the last semicolon and the closing bracket. * * This is only set automatically for expressions with trailing semicolons. */ beforeClose?: string; /** * Whether this expression has a trailing semicolon. * * Ignored if the expression has zero elements. */ trailingSemi?: boolean; } /** * An expression representing an `if()` function in Sass. * * **Note:** Unlike other expression types, this can't be constructed from a * property object alone, because [IfExpressionProps] may be ambiguous with * [MapExpressionProps]. Instead, call `new IfExpression()` explicitly: For * example: * * ```ts * string.text.append(new IfExpression([ * [{variableName: 'important'}, {text: ' !important'}], * ['else', {text: ''}], * ])); * ``` * * @category Expression */ export declare class IfExpression extends Expression implements Container { #private; readonly sassType: "if-expr"; raws: IfExpressionRaws; get nodes(): ReadonlyArray; /** @hidden */ set nodes(nodes: Array); private _nodes?; constructor(defaults: IfExpressionProps | Array); /** @hidden */ constructor(_: undefined, inner: sassInternal.IfExpression); clone(overrides?: Partial): this; toJSON(): object; /** @hidden */ toJSON(_: string, inputs: Map): object; append(...nodes: NewNodeForIfExpression[]): this; each(callback: (node: IfEntry, index: number) => false | void): false | undefined; every(condition: (node: IfEntry, index: number, nodes: ReadonlyArray) => boolean): boolean; index(child: IfEntry | number): number; insertAfter(oldNode: IfEntry | number, newNode: NewNodeForIfExpression): this; insertBefore(oldNode: IfEntry | number, newNode: NewNodeForIfExpression): this; prepend(...nodes: NewNodeForIfExpression[]): this; push(child: IfEntry): this; removeAll(): this; removeChild(child: IfEntry | number): this; some(condition: (node: IfEntry, index: number, nodes: ReadonlyArray) => boolean): boolean; get first(): IfEntry | undefined; get last(): IfEntry | undefined; /** @hidden */ toString(): string; /** * Normalizes a single argument declaration or list of arguments. */ private _normalize; /** Like {@link _normalize}, but also flattens a list of nodes. */ private _normalizeList; /** @hidden */ get nonStatementChildren(): ReadonlyArray; }