import * as postcss from 'postcss'; import { ContainerWithChildren } from 'postcss/lib/container'; import { Container } from '../container'; import { Node, NodeProps } from '../node'; import * as sassInternal from '../sass-internal'; import { CssComment, CssCommentProps } from './css-comment'; import { SassComment, SassCommentChildProps } from './sass-comment'; import { GenericAtRule, GenericAtRuleProps } from './generic-at-rule'; import { ContentRule, ContentRuleProps } from './content-rule'; import { DebugRule, DebugRuleProps } from './debug-rule'; import { Declaration, DeclarationProps } from './declaration'; import { EachRule, EachRuleProps } from './each-rule'; import { ElseRule, ElseRuleProps } from './else-rule'; import { ErrorRule, ErrorRuleProps } from './error-rule'; import { ForRule, ForRuleProps } from './for-rule'; import { ForwardRule, ForwardRuleProps } from './forward-rule'; import { FunctionRule, FunctionRuleProps } from './function-rule'; import { IfRule, IfRuleProps } from './if-rule'; import { ImportRule, ImportRuleProps } from './import-rule'; import { IncludeRule, IncludeRuleProps } from './include-rule'; import { MixinRule, MixinRuleProps } from './mixin-rule'; import { ReturnRule, ReturnRuleProps } from './return-rule'; import { Root } from './root'; import { Rule, RuleProps } from './rule'; import { UseRule, UseRuleProps } from './use-rule'; import { VariableDeclaration, VariableDeclarationProps } from './variable-declaration'; import { WarnRule, WarnRuleProps } from './warn-rule'; import { WhileRule, WhileRuleProps } from './while-rule'; /** * The union type of all Sass statements. * * @category Statement */ export type AnyStatement = Comment | Root | Rule | AtRule | AnyDeclaration; /** * Sass statement types. * * This is a superset of the node types PostCSS exposes, and is provided * alongside `Node.type` to disambiguate between the wide range of statements * that Sass parses as distinct types. * * @category Statement */ export type StatementType = 'root' | 'rule' | 'atrule' | 'comment' | 'content-rule' | 'decl' | 'debug-rule' | 'each-rule' | 'else-rule' | 'error-rule' | 'for-rule' | 'forward-rule' | 'function-rule' | 'if-rule' | 'import-rule' | 'include-rule' | 'mixin-rule' | 'return-rule' | 'sass-comment' | 'use-rule' | 'variable-declaration' | 'warn-rule' | 'while-rule'; /** * All Sass statements that are also at-rules. * * @category Statement */ export type AtRule = ContentRule | DebugRule | EachRule | ElseRule | ErrorRule | ForRule | ForwardRule | FunctionRule | GenericAtRule | IfRule | ImportRule | IncludeRule | MixinRule | ReturnRule | UseRule | WarnRule | WhileRule; /** * All Sass statements that are declarations. * * @category Statement */ export type AnyDeclaration = VariableDeclaration | Declaration; /** * All Sass statements that are comments. * * @category Statement */ export type Comment = CssComment | SassComment; /** * All Sass statements that are valid children of other statements. * * The Sass equivalent of PostCSS's `ChildNode`. * * @category Statement */ export type ChildNode = Rule | AtRule | Comment | AnyDeclaration; /** * The properties that can be used to construct {@link ChildNode}s. * * The Sass equivalent of PostCSS's `ChildProps`. * * @category Statement */ export type ChildProps = postcss.ChildProps | (ContentRuleProps & { contentArguments: ContentRuleProps['contentArguments']; }) | CssCommentProps | DebugRuleProps | DeclarationProps | EachRuleProps | (ElseRuleProps & { elseCondition: ElseRuleProps['elseCondition']; }) | ErrorRuleProps | ForRuleProps | ForwardRuleProps | FunctionRuleProps | GenericAtRuleProps | IfRuleProps | ImportRuleProps | IncludeRuleProps | MixinRuleProps | ReturnRuleProps | RuleProps | SassCommentChildProps | UseRuleProps | VariableDeclarationProps | WarnRuleProps | WhileRuleProps; /** * The Sass eqivalent of PostCSS's `ContainerProps`. * * @category Statement */ export interface ContainerProps extends NodeProps { nodes?: ReadonlyArray; } /** * A {@link Statement} that has actual child nodes. * * @category Statement */ export type StatementWithChildren = ContainerWithChildren & Container & AnyStatement; /** * A statement in a Sass stylesheet. * * In addition to implementing the standard PostCSS behavior, this provides * extra information to help disambiguate different types that Sass parses * differently. * * @category Statement */ export interface Statement extends postcss.Node, Node { /** The type of this statement. */ readonly sassType: StatementType; parent: StatementWithChildren | undefined; } /** Appends parsed versions of `internal`'s children to `container`. */ export declare function appendInternalChildren(container: postcss.Container, children: sassInternal.Statement[] | null): void; /** * The type of nodes that can be passed as new child nodes to PostCSS methods. */ export type NewNode = ChildProps | ReadonlyArray | postcss.Node | ReadonlyArray | string | ReadonlyArray | undefined; /** * An override of {@link postcssNormalize} that supports Sass nodes as arguments * and converts PostCSS-style arguments to Sass. */ export declare function normalize(self: StatementWithChildren, node: NewNode, sample?: postcss.Node): ChildNode[];