import * as postcss from 'postcss'; import { Container } from '../container'; import { NodeProps } from '../node'; import type * as sassInternal from '../sass-internal'; import { AnyExpression, Expression, ExpressionProps } from '.'; /** * Possible separators for Sass lists. `' '` indicates a list that's separated * on expression boundaries, not necessarily a space character specifically. * `null` indicates a zero- or one-element list that doesn't explicitly specify * a separator. * * @category Expression */ export type ListSeparator = ' ' | ',' | '/' | null; /** * The initializer properties for {@link ListExpression}. * * @category Expression */ export interface ListExpressionProps extends NodeProps { raws?: ListExpressionRaws; separator: ListSeparator; nodes: Array; brackets?: boolean; } /** * The type of new nodes that can be passed into a list expression. * * @category Expression */ export type NewNodeForListExpression = AnyExpression | ReadonlyArray | ExpressionProps | ReadonlyArray | undefined; /** * Raws indicating how to precisely serialize a {@link ListExpression}. * * @category Expression */ export interface ListExpressionRaws { /** * The whitespace between the opening bracket and the first expression. * * For zero-element lists, this is the whitespace between the brackets. * * This is ignored for unbracketed lists with more than zero elements. */ afterOpen?: string; /** * The whitespace between the last comma and the closing bracket. * * This is only set automatically for lists with trailing commas. * * This is ignored for unbracketed lists with more than zero elements. */ beforeClose?: string; /** * Whether this list has a trailing comma. * * Ignored if {@link ListExpression.separator} isn't `','`, or if the * expression has fewer than two elements. */ trailingComma?: boolean; /** * The whitespace before and after each expression in the list. * * For space-separated lists, `before` is never automatically set. For comma- * or slash-separated lists, `before` is the whitespace between the previous * separator and the expression and `after` is the whitespace between the * expression and the next separator or the closing bracket. */ expressions?: Array<{ before?: string; after?: string; } | undefined>; } /** * An expression representing a list literal in Sass. * * @category Expression */ export declare class ListExpression extends Expression implements Container { #private; readonly sassType: "list"; raws: ListExpressionRaws; /** This list's separator. */ get separator(): ListSeparator; set separator(separator: ListSeparator); private _separator; /** * Whether the list has square brackets (as opposed to no brackets). This * defaults to false. */ get brackets(): boolean; set brackets(brackets: boolean); private _brackets; get nodes(): ReadonlyArray; /** @hidden */ set nodes(nodes: Array); private _nodes?; constructor(defaults: ListExpressionProps); /** @hidden */ constructor(_: undefined, inner: sassInternal.ListExpression); clone(overrides?: Partial): this; toJSON(): object; /** @hidden */ toJSON(_: string, inputs: Map): object; append(...nodes: NewNodeForListExpression[]): this; each(callback: (node: AnyExpression, index: number) => false | void): false | undefined; every(condition: (node: AnyExpression, index: number, nodes: ReadonlyArray) => boolean): boolean; index(child: AnyExpression | number): number; insertAfter(oldNode: AnyExpression | number, newNode: NewNodeForListExpression): this; insertBefore(oldNode: AnyExpression | number, newNode: NewNodeForListExpression): this; prepend(...nodes: NewNodeForListExpression[]): this; push(child: AnyExpression): this; removeAll(): this; removeChild(child: AnyExpression | number): this; some(condition: (node: AnyExpression, index: number, nodes: ReadonlyArray) => boolean): boolean; get first(): AnyExpression | undefined; get last(): AnyExpression | 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; }