import * as postcss from 'postcss'; import { Container } from './container'; import { AnyExpression, ExpressionProps } from './expression'; import { Node, NodeProps } from './node'; import { RawWithValue } from './raw-with-value'; import type * as sassInternal from './sass-internal'; /** * The type of new nodes that can be passed into an interpolation. * * Note that unlike in PostCSS, a `string` here is treated as a raw string for * interpolation rather than parsed as an expression. * * @category Expression */ export type NewNodeForInterpolation = Interpolation | ReadonlyArray | AnyExpression | ReadonlyArray | ExpressionProps | ReadonlyArray | string | ReadonlyArray | undefined; /** * The initializer properties for {@link Interpolation} passed as an options * object. * * @category Expression */ export interface InterpolationObjectProps extends NodeProps { nodes: ReadonlyArray; raws?: InterpolationRaws; } /** * The initializer properties for {@link Interpolation}. * * A plain string is interpreted as a plain-text interpolation. * * @category Expression */ export type InterpolationProps = InterpolationObjectProps | ReadonlyArray | string; /** * Raws indicating how to precisely serialize an {@link Interpolation} node. * * @category Expression */ export interface InterpolationRaws { /** * The text written in the stylesheet for the plain-text portions of the * interpolation, without any interpretation of escape sequences. * * Any indices for which {@link Interpolation.nodes} doesn't contain a string * are ignored. */ text?: Array | undefined>; /** * The whitespace before and after each interpolated expression. * * Any indices for which {@link Interpolation.nodes} doesn't contain an * expression are ignored. */ expressions?: Array<{ before?: string; after?: string; } | undefined>; } /** * Sass text that can contian expressions interpolated within it. * * This is not itself an expression. Instead, it's used as a field of * expressions and statements, and acts as a container for further expressions. * * @category Expression */ export declare class Interpolation extends Node implements Container { #private; readonly sassType: "interpolation"; raws: InterpolationRaws; /** * An array containing the contents of the interpolation. * * Strings in this array represent the raw text in which interpolation (might) * appear, and expressions represent the interpolated Sass expressions. * * This shouldn't be modified directly; instead, the various methods defined * in {@link Interpolation} should be used to modify it. */ get nodes(): ReadonlyArray; /** @hidden */ set nodes(nodes: Array); private _nodes?; /** Returns whether this contains no interpolated expressions. */ get isPlain(): boolean; /** * If this contains no interpolated expressions, returns its text contents. * Otherwise, returns `null`. */ get asPlain(): string | null; constructor(defaults?: InterpolationProps); /** @hidden */ constructor(_: undefined, inner: sassInternal.Interpolation); clone(overrides?: Partial): this; toJSON(): object; /** @hidden */ toJSON(_: string, inputs: Map): object; append(...nodes: NewNodeForInterpolation[]): this; each(callback: (node: string | AnyExpression, index: number) => false | void): false | undefined; every(condition: (node: string | AnyExpression, index: number, nodes: ReadonlyArray) => boolean): boolean; index(child: string | AnyExpression | number): number; insertAfter(oldNode: string | AnyExpression | number, newNode: NewNodeForInterpolation): this; insertBefore(oldNode: string | AnyExpression | number, newNode: NewNodeForInterpolation): this; prepend(...nodes: NewNodeForInterpolation[]): this; push(child: string | AnyExpression): this; removeAll(): this; removeChild(child: string | AnyExpression | number): this; some(condition: (node: string | AnyExpression, index: number, nodes: ReadonlyArray) => boolean): boolean; get first(): string | AnyExpression | undefined; get last(): string | AnyExpression | undefined; /** @hidden */ toString(): string; /** * Normalizes the many types of node that can be used with Interpolation * methods. */ private _normalize; /** Like {@link _normalize}, but also flattens a list of nodes. */ private _normalizeList; /** @hidden */ get nonStatementChildren(): ReadonlyArray; }