@stylable/core
Version:
CSS for Components
79 lines • 4.06 kB
TypeScript
import postcss from 'postcss';
import { Diagnostics } from './diagnostics';
import { SelectorAstNode } from './selector-utils';
import { Imported, RefedMixin, StylableDirectives, StylableMeta } from './stylable-meta';
export * from './stylable-meta';
export declare const processorWarnings: {
UNSCOPED_CLASS(name: string): string;
UNSCOPED_ELEMENT(name: string): string;
FORBIDDEN_DEF_IN_COMPLEX_SELECTOR(name: string): string;
ROOT_AFTER_SPACING(): string;
DEFAULT_IMPORT_IS_LOWER_CASE(): string;
ILLEGAL_PROP_IN_IMPORT(propName: string): string;
STATE_DEFINITION_IN_ELEMENT(): string;
STATE_DEFINITION_IN_COMPLEX(): string;
REDECLARE_SYMBOL(name: string): string;
REDECLARE_SYMBOL_KEYFRAMES(name: string): string;
CANNOT_RESOLVE_EXTEND(name: string): string;
CANNOT_EXTEND_IN_COMPLEX(): string;
UNKNOWN_MIXIN(name: string): string;
OVERRIDE_MIXIN(): string;
OVERRIDE_TYPED_RULE(key: string, name: string): string;
FROM_PROP_MISSING_IN_IMPORT(): string;
INVALID_NAMESPACE_DEF(): string;
EMPTY_NAMESPACE_DEF(): string;
EMPTY_IMPORT_FROM(): string;
MULTIPLE_FROM_IN_IMPORT(): string;
NO_VARS_DEF_IN_ST_SCOPE(): string;
NO_IMPORT_IN_ST_SCOPE(): string;
NO_KEYFRAMES_IN_ST_SCOPE(): string;
SCOPE_PARAM_NOT_SIMPLE_SELECTOR(selector: string): string;
MISSING_SCOPING_PARAM(): string;
ILLEGAL_GLOBAL_CSS_VAR(name: string): string;
GLOBAL_CSS_VAR_MISSING_COMMA(name: string): string;
ILLEGAL_CSS_VAR_USE(name: string): string;
ILLEGAL_CSS_VAR_ARGS(name: string): string;
};
export declare class StylableProcessor {
protected diagnostics: Diagnostics;
private resolveNamespace;
protected meta: StylableMeta;
constructor(diagnostics?: Diagnostics, resolveNamespace?: typeof processNamespace);
process(root: postcss.Root): StylableMeta;
insertCustomSelectorsStubs(): (postcss.Rule | null)[];
handleCustomSelectors(rule: postcss.Rule): void;
protected handleAtRules(root: postcss.Root): void;
private handleNamespaceReference;
protected handleRule(rule: SRule, inStScope?: boolean): void;
protected checkRedeclareSymbol(symbolName: string, node: postcss.Node): void;
protected checkRedeclareKeyframes(symbolName: string, node: postcss.Node): import("./stylable-meta").KeyframesSymbol;
protected addElementSymbolOnce(name: string, rule: postcss.Rule): void;
protected addClassSymbolOnce(name: string, rule: postcss.Rule): void;
protected addImportSymbols(importDef: Imported): void;
protected addVarSymbols(rule: postcss.Rule): void;
protected handleCSSVarUse(decl: postcss.Declaration): void;
protected addCSSVarFromProp(decl: postcss.Declaration): void;
protected addCSSVar(varName: string, decl: postcss.Declaration): void;
protected handleDirectives(rule: SRule, decl: postcss.Declaration): void;
protected setClassGlobalMapping(decl: postcss.Declaration, rule: postcss.Rule): void;
protected extendTypedRule(node: postcss.Node, selector: string, key: keyof StylableDirectives, value: any): void;
protected handleImport(rule: postcss.Rule): Imported;
}
export declare function validateScopingSelector(atRule: postcss.AtRule, { selector: scopingSelector, isSimpleSelector }: SRule, diagnostics: Diagnostics): void;
export declare function createEmptyMeta(root: postcss.Root, diagnostics: Diagnostics): StylableMeta;
export declare function processNamespace(namespace: string, source: string): string;
export declare function process(root: postcss.Root, diagnostics?: Diagnostics, resolveNamespace?: typeof processNamespace): StylableMeta;
export interface SRule extends postcss.Rule {
selectorAst: SelectorAstNode;
isSimpleSelector: boolean;
selectorType: 'class' | 'element' | 'complex';
mixins?: RefedMixin[];
stScopeSelector?: string;
}
export interface DeclStylableProps {
sourceValue: string;
}
export interface SDecl extends postcss.Declaration {
stylable: DeclStylableProps;
}
//# sourceMappingURL=stylable-processor.d.ts.map