import * as postcss from 'postcss'; import type { AtRuleRaws } from 'postcss/lib/at-rule'; import { Configuration, ConfigurationProps } from '../configuration'; import { NodeProps } from '../node'; import { RawWithValue } from '../raw-with-value'; import * as sassInternal from '../sass-internal'; import { Statement, StatementWithChildren } from '.'; import { _AtRule } from './at-rule-internal'; /** * A list of member names that are shown or hidden by a {@link ForwardRule}. At * least one of {@link mixinsAndFunctions} or {@link variables} must contain at * least one element, or this can't be represented as Sass source code. * * @category Statement */ export interface ForwardMemberList { /** Mixin and function names to show or hide. */ mixinsAndFunctions: Set; /** Variable names to show or hide, without `$`. */ variables: Set; } /** * The set of raws supported by {@link ForwardRule}. * * @category Statement */ export interface ForwardRuleRaws extends Omit { /** The representation of {@link ForwardRule.forwardUrl}. */ url?: RawWithValue; /** * The text of the added prefix, including `as` and any whitespace before it. * * Only used if {@link prefix.value} matches {@link ForwardRule.prefix}. */ prefix?: RawWithValue; /** * The text of the list of members to forward, including `show` and any * whitespace before it. * * Only used if {@link show.value} matches {@link ForwardRule.show}. */ show?: RawWithValue; /** * The text of the list of members not to forward, including `hide` and any * whitespace before it. * * Only used if {@link hide.value} matches {@link ForwardRule.hide}. */ hide?: RawWithValue; /** * The whitespace between the URL or prefix and the `with` keyword. * * Unused if the rule doesn't have a `with` clause. */ beforeWith?: string; /** * The whitespace between the `with` keyword and the configuration map. * * Unused unless the rule has a non-empty configuration. */ afterWith?: string; } /** The initializer properties for {@link ForwardMemberList}. */ export interface ForwardMemberProps { mixinsAndFunctions?: Iterable; variables?: Iterable; } /** * The initializer properties for {@link ForwardRule}. * * @category Statement */ export type ForwardRuleProps = NodeProps & { raws?: ForwardRuleRaws; forwardUrl: string; prefix?: string; configuration?: Configuration | ConfigurationProps; } & ({ show?: ForwardMemberProps; hide?: never; } | { hide?: ForwardMemberProps; show?: never; }); /** * A `@forward` rule. Extends [`postcss.AtRule`]. * * [`postcss.AtRule`]: https://postcss.org/api/#atrule * * @category Statement */ export declare class ForwardRule extends _AtRule> implements Statement { readonly sassType: "forward-rule"; parent: StatementWithChildren | undefined; raws: ForwardRuleRaws; readonly nodes: undefined; /** The URL loaded by the `@forward` rule. */ forwardUrl: string; /** * The prefix added to the beginning of mixin, variable, and function names * loaded by this rule. Defaults to ''. */ prefix: string; /** * The allowlist of names of members to forward from the loaded module. * * If this is defined, {@link hide} must be undefined. If this and {@link * hide} are both undefined, all members are forwarded. * * Setting this to a non-`undefined` value automatically sets {@link hide} to * `undefined`. */ get show(): ForwardMemberList | undefined; set show(value: ForwardMemberProps | undefined); _show?: ForwardMemberList; /** * The blocklist of names of members to forward from the loaded module. * * If this is defined, {@link show} must be undefined. If this and {@link * show} are both undefined, all members are forwarded. * * Setting this to a non-`undefined` value automatically sets {@link show} to * `undefined`. */ get hide(): ForwardMemberList | undefined; set hide(value: ForwardMemberProps | undefined); _hide?: ForwardMemberList; get name(): string; set name(value: string); get params(): string; set params(value: string | number | undefined); /** The variables whose defaults are set when loading this module. */ get configuration(): Configuration; set configuration(configuration: Configuration | ConfigurationProps); private _configuration; constructor(defaults: ForwardRuleProps); /** @hidden */ constructor(_: undefined, inner: sassInternal.ForwardRule); /** * Serializes {@link members} to string, respecting {@link raws} if it's * defined and matches. */ private _serializeMemberList; /** * Returns whether {@link list1} and {@link list2} contain the same values. */ private _memberListsEqual; clone(overrides?: Partial): this; toJSON(): object; /** @hidden */ toJSON(_: string, inputs: Map): object; /** @hidden */ toString(stringifier?: postcss.Stringifier | postcss.Syntax): string; /** @hidden */ get nonStatementChildren(): ReadonlyArray; }