import { Attribute as Attr } from "@opticss/element-analysis"; import { AttrToken } from "../BlockSyntax"; import { ResolvedConfiguration } from "../configuration"; import { Attribute } from "./Attribute"; import { AttrValue } from "./AttrValue"; import { Block } from "./Block"; import { RulesetContainer } from "./RulesetContainer"; import { Style } from "./Style"; import { Styles } from "./Styles"; export interface Composition { style: Styles; conditions: AttrValue[]; path: string; } /** * Represents a Class present in the Block. */ export declare class BlockClass extends Style { private _sourceAttribute; private _composedStyles; private _resolvedComposedStyles; readonly rulesets: RulesetContainer; constructor(name: string, parent: Block); protected get ChildConstructor(): typeof Attribute; /** @returns This BlockClass' class name. */ get name(): string; get isRoot(): boolean; attributes(): Attribute[]; getAttributes(): Attribute[]; getAttribute(token: AttrToken | string): Attribute | null; resolveAttribute(token: AttrToken | string): Attribute | null; /** * Ensure that an `Attribute` with the given name exists. If the `Attribute` * does not exist, it is created. * @param name The Attribute to ensure exists. * @returns The Attribute object. */ ensureAttribute(token: AttrToken | string): Attribute; /** * Returns all concrete AttrValues defined on this class. * Does not take inheritance into account. */ allAttributeValues(): AttrValue[]; getAttributeValues(token: AttrToken | string, filter?: string): AttrValue[]; /** * Resolves all AttrValues from this Attribute's inheritance * chain. Returns an empty object if no * @param token The AttrToken or attribute BlockPath of the Attribute to resolve. */ resolveAttributeValues(token?: AttrToken | string): Map; /** * AttrValue getter. Returns the AttrValue object in the requested Attribute, without inheritance. * @param token `AttrToken` or attribute `BlockPath` string for lookup. * @returns The `AttrValue` that was requested, or null. */ getAttributeValue(token: AttrToken | string): AttrValue | null; /** * AttrValue getter. Returns the AttrValue object in the requested Attribute, with inheritance. * @param token `AttrToken` or attribute `BlockPath` string for lookup. * @returns The `AttrValue` that was requested, or null. */ resolveAttributeValue(token: AttrToken | string): AttrValue | null; /** * Ensure that an `AttrValue` within the provided Attribute exists. If the `AttrValue` * does not exist, it is created. * @param token The AttrValue to ensure exists. This may either be an `AttrToken`, * or a string of the format `[namespace|name(="value")]` * @returns The AttrValue object. */ ensureAttributeValue(token: AttrToken | string): AttrValue; /** * @returns All AttrValue objects who's value is `ATTR_PRESENT` and are the only values in their attribute. */ booleanAttributeValues(): AttrValue[]; /** * Export as original class name. * @param scope Optional scope to resolve this name relative to. If `true`, return the Block name instead of `:scope`. If a Block object, return with the local name instead of `:scope`. * @returns String representing original class. */ asSource(scope?: Block | boolean): string; /** * Emit analysis attributes for the class value this * block class represents in it's authored source format. * * @param optionalRoot The root class is optional on root-level * Attributes. So when these attributes are being used in conjunction * with attributes, this value is set to true. */ asSourceAttributes(optionalRoot?: boolean): Attr[]; /** * Export as new class name. * @param config Option hash configuring output mode. * @returns String representing output class. */ cssClass(config: ResolvedConfiguration, reservedClassNames: Set): string; /** * Return array self and all children. * @param shallow Pass false to not include children. * @returns Array of Styles. */ all(shallow?: boolean): Styles[]; getGroupsNames(): Set; /** * Returns the composed styles for this Block Object, and * all ancestors in its inheritance tree. * * @returns The set of Style objects. */ resolveComposedStyles(): Set; /** * Returns the styles that are composed by this style. * * @returns The set of Style objects. */ composedStyles(): Set; /** * Adds a new Style for this Style to compose. * TODO: Currently, conditions are grouped exclusively by the 'and' operator. * We can abstract boolean operators to keep an internal representation * of logic between css and template files and only resolve them to the * requested language interface at rewrite time. */ addComposedStyle(style: Styles, conditions: AttrValue[], path: string): void; /** * Checks whether this style composes another style. */ composes(style: Styles, resolve?: boolean): boolean; /** * Debug utility to help test BlockClasses. * @param options Options to pass to BlockClass' asDebug method. * @return Array of debug strings for this BlockClass */ debug(config: ResolvedConfiguration): string[]; } export declare function isBlockClass(o: object): o is BlockClass; //# sourceMappingURL=BlockClass.d.ts.map