import { Attribute as SelectableAttribute, ElementInfo } from "@opticss/element-analysis"; import { IdentityDictionary } from "@opticss/util"; import { Dictionary, MultiDictionary } from "typescript-collections"; import { BooleanExpression } from "./BooleanExpression"; import { TemplateIntegrationOptions } from "./TemplateIntegrationOptions"; export interface RewriteInformation { id: InfoType; class: InfoType; } export declare type RewriteableAttrName = keyof RewriteInformation; export declare const REWRITE_ATTRS: ("id" | "class")[]; export interface DynamicExpressions { [outputValue: string]: BooleanExpression | undefined; } export interface RewriteMapping { /** * attributes as they appear in the source template. */ inputs: Array; /** * output attributes that are always on the element independent of any dynamic changes. */ staticAttributes: RewriteInformation; /** * The numbers in the boolean expressions represents indexes into the inputAttributes array. * For attributes that are not whitespace delimited (E.g. id) only one value * will evaluate to true unless the element analysis itself is invalid. */ dynamicAttributes: RewriteInformation; } export interface SimpleTagname { ns?: string; tagname: string; } export declare function isSimpleTagname(v: Object): v is SimpleTagname; export interface SimpleAttribute { ns?: string; name: string; value: string; } export declare function isSimpleAttribute(v: Object): v is SimpleAttribute; export declare function simpleAttributeToString(attr: SimpleAttribute): string; export interface ElementAttributes { /** * A list of traits that should be on the element. */ existing: Array; /** * a list of traits that shouldn't be on the element. */ unless: Array; } interface PrimaryAttributeLink { /** * The optimized attribute that is linked to the source attribute. */ to: SimpleAttribute; /** * A list of traits that must be present to create the link. */ from: Array; /** * A list of traits that must not be present to to create the link. */ unless: Array; } export declare class StyleMapping { templateOptions: TemplateIntegrationOptions; replacedAttributes: Dictionary; linkedAttributes: MultiDictionary; sourceAttributes: IdentityDictionary; optimizedAttributes: IdentityDictionary; obsoleteAttributes: IdentityDictionary; constructor(templateOptions: TemplateIntegrationOptions); /** * Returns true if, after optimization, there is still a selector that * might match the attribute on at least one analyzed element. */ isStyledAfterOptimization(attr: SimpleAttribute): boolean; attributeIsObsolete(attr: SimpleAttribute): void; /** * Records a source attribute that was discovered from the styles before * optimization. */ addSourceAttribute(attr: SimpleAttribute): void; rewriteAttribute(from: SimpleAttribute, to: SimpleAttribute): void; linkAttributes(newAttr: SimpleAttribute, toAttrs: Array): void; getRewriteOf(from: SimpleAttribute): SimpleAttribute | undefined; private getInputs; rewriteMapping(element: ElementInfo): RewriteMapping; replacedAttributeCount(): number; private isRewritableAttrName; private toRewritableAttrName; attributeValues(attr: SelectableAttribute): SimpleAttribute[]; } export {}; //# sourceMappingURL=StyleMapping.d.ts.map