import postcss from 'postcss'; import { FileProcessor } from './cached-process-file'; import { Diagnostics } from './diagnostics'; import { SelectorAstNode, SelectorChunk2 } from './selector-utils'; import { ClassSymbol, ElementSymbol, StylableMeta, StylableSymbol } from './stylable-processor'; import { CSSResolve, StylableResolver } from './stylable-resolver'; export interface ResolvedElement { name: string; type: string; resolved: Array>; } export interface KeyFrameWithNode { value: string; node: postcss.Node; } export interface StylableExports { classes: Record; vars: Record; stVars: Record; keyframes: Record; } export interface StylableResults { meta: StylableMeta; exports: StylableExports; } export interface ScopedSelectorResults { current: StylableMeta; symbol: StylableSymbol | null; selectorAst: SelectorAstNode; selector: string; elements: ResolvedElement[][]; } export declare type replaceValueHook = (value: string, name: string | { name: string; args: string[]; }, isLocal: boolean, passedThrough: string[]) => string; export declare type postProcessor = (stylableResults: StylableResults, transformer: StylableTransformer) => StylableResults & T; export interface TransformHooks { postProcessor?: postProcessor; replaceValueHook?: replaceValueHook; } declare type EnvMode = 'production' | 'development'; export interface TransformerOptions { fileProcessor: FileProcessor; requireModule: (modulePath: string) => any; diagnostics: Diagnostics; delimiter?: string; keepValues?: boolean; replaceValueHook?: replaceValueHook; postProcessor?: postProcessor; mode?: EnvMode; } export interface AdditionalSelector { selectorNode: SelectorAstNode; node: SelectorAstNode; customElementChunk: string; } export declare const transformerWarnings: { UNKNOWN_PSEUDO_ELEMENT(name: string): string; IMPORT_ISNT_EXTENDABLE(): string; CANNOT_EXTEND_UNKNOWN_SYMBOL(name: string): string; CANNOT_EXTEND_JS(): string; KEYFRAME_NAME_RESERVED(name: string): string; UNKNOWN_IMPORT_ALIAS(name: string): string; SCOPE_PARAM_NOT_ROOT(name: string): string; SCOPE_PARAM_NOT_CSS(name: string): string; UNKNOWN_SCOPING_PARAM(name: string): string; }; export declare class StylableTransformer { fileProcessor: FileProcessor; diagnostics: Diagnostics; resolver: StylableResolver; delimiter: string; keepValues: boolean; replaceValueHook: replaceValueHook | undefined; postProcessor: postProcessor | undefined; mode: EnvMode; private metaParts; constructor(options: TransformerOptions); transform(meta: StylableMeta): StylableResults; transformAst(ast: postcss.Root, meta: StylableMeta, metaExports?: StylableExports, variableOverride?: Record, path?: string[], mixinTransform?: boolean): void; exportLocalVars(meta: StylableMeta, stVarsExport: Record, variableOverride?: Record): void; exportCSSVars(cssVarsMapping: Record, varsExport: Record): void; exportKeyframes(keyframeMapping: Record, keyframesExport: Record): void; exportRootClass(meta: StylableMeta, classesExport: Record): void; exportClass(meta: StylableMeta, name: string, classSymbol: ClassSymbol, metaExports?: Record): string; scopeKeyframes(ast: postcss.Root, meta: StylableMeta): Record; createCSSVarsMapping(_ast: postcss.Root, meta: StylableMeta): Record; getScopedCSSVar(decl: postcss.Declaration, meta: StylableMeta, cssVarsMapping: Record): string; addGlobalsToMeta(selectorAst: SelectorAstNode[], meta?: StylableMeta): void; transformGlobals(ast: postcss.Root, meta: StylableMeta): void; resolveSelectorElements(meta: StylableMeta, selector: string): ResolvedElement[][]; scopeSelector(originMeta: StylableMeta, selector: string, classesExport?: Record, calcPaths?: boolean, rule?: postcss.Rule): ScopedSelectorResults; addAdditionalSelectors(addedSelectors: AdditionalSelector[], selectorAst: SelectorAstNode): void; applyRootScoping(meta: StylableMeta, selectorAst: SelectorAstNode): void; scopeRule(meta: StylableMeta, rule: postcss.Rule, _classesExport?: Record): string; handleClass(meta: StylableMeta, node: SelectorAstNode, name: string, classesExport?: Record, rule?: postcss.Rule, originMeta?: StylableMeta): CSSResolve; handleElement(meta: StylableMeta, node: SelectorAstNode, name: string, originMeta?: StylableMeta): CSSResolve | { meta: StylableMeta; symbol: StylableSymbol; }; handlePseudoElement(meta: StylableMeta, node: SelectorAstNode, name: string, selectorNode: SelectorAstNode, addedSelectors: AdditionalSelector[], rule?: postcss.Rule, originMeta?: StylableMeta): CSSResolve; scope(name: string, namespace: string, delimiter?: string): string; exportClasses(meta: StylableMeta): Record; getPartExports(resolved: Array>): string[]; scopeSelector2(originMeta: StylableMeta, selector: string, _classesExport?: Record, _calcPaths?: boolean, rule?: postcss.Rule): { selector: string; elements: ResolvedElement[][]; }; scopeSelectorAst(context: ScopeContext): SelectorAstNode; private handleChunkNode; private handleCustomSelector; private scopeClassNode; private resolveMetaParts; private addDevRules; private resetTransformProperties; } export declare function removeSTDirective(root: postcss.Root): void; interface ScopeAnchor { type: 'class' | 'element' | 'pseudo-element'; name: string; resolved: Array>; } declare class ScopeContext { originMeta: StylableMeta; selectorAst: SelectorAstNode; rule: postcss.Rule; additionalSelectors: Array<() => void>; selectorIndex: number; elements: any[]; transformGlobals: boolean; metaParts?: MetaParts; chunks?: SelectorChunk2[]; chunk?: SelectorChunk2; node?: SelectorAstNode; currentAnchor?: ScopeAnchor; constructor(originMeta: StylableMeta, selectorAst: SelectorAstNode, rule: postcss.Rule); initRootAnchor(anchor: ScopeAnchor): void; setCurrentAnchor(anchor: ScopeAnchor): void; createNestedContext(selectorAst: SelectorAstNode): ScopeContext; } interface MetaParts { class: Record>>; element: Record>>; } export {}; //# sourceMappingURL=stylable-transformer.d.ts.map