UNPKG

3.85 kBTypeScriptView Raw
1import postcss from 'postcss';
2import { Diagnostics } from './diagnostics';
3import { SelectorAstNode } from './selector-utils';
4import { Imported, RefedMixin, StylableDirectives, StylableMeta } from './stylable-meta';
5export * from './stylable-meta';
6export declare const processorWarnings: {
7 UNSCOPED_CLASS(name: string): string;
8 UNSCOPED_ELEMENT(name: string): string;
9 FORBIDDEN_DEF_IN_COMPLEX_SELECTOR(name: string): string;
10 ROOT_AFTER_SPACING(): string;
11 DEFAULT_IMPORT_IS_LOWER_CASE(): string;
12 ILLEGAL_PROP_IN_IMPORT(propName: string): string;
13 STATE_DEFINITION_IN_ELEMENT(): string;
14 STATE_DEFINITION_IN_COMPLEX(): string;
15 REDECLARE_SYMBOL(name: string): string;
16 CANNOT_RESOLVE_EXTEND(name: string): string;
17 CANNOT_EXTEND_IN_COMPLEX(): string;
18 UNKNOWN_MIXIN(name: string): string;
19 OVERRIDE_MIXIN(): string;
20 OVERRIDE_TYPED_RULE(key: string, name: string): string;
21 FROM_PROP_MISSING_IN_IMPORT(): string;
22 INVALID_NAMESPACE_DEF(): string;
23 EMPTY_NAMESPACE_DEF(): string;
24 EMPTY_IMPORT_FROM(): string;
25 MULTIPLE_FROM_IN_IMPORT(): string;
26 NO_VARS_DEF_IN_ST_SCOPE(): string;
27 NO_IMPORT_IN_ST_SCOPE(): string;
28 NO_KEYFRAMES_IN_ST_SCOPE(): string;
29 SCOPE_PARAM_NOT_SIMPLE_SELECTOR(selector: string): string;
30 MISSING_SCOPING_PARAM(): string;
31 ILLEGAL_GLOBAL_CSS_VAR(name: string): string;
32 GLOBAL_CSS_VAR_MISSING_COMMA(name: string): string;
33 ILLEGAL_CSS_VAR_USE(name: string): string;
34 ILLEGAL_CSS_VAR_ARGS(name: string): string;
35};
36export declare class StylableProcessor {
37 protected diagnostics: Diagnostics;
38 private resolveNamespace;
39 protected meta: StylableMeta;
40 constructor(diagnostics?: Diagnostics, resolveNamespace?: typeof processNamespace);
41 process(root: postcss.Root): StylableMeta;
42 insertCustomSelectorsStubs(): (postcss.Rule | null)[];
43 handleCustomSelectors(rule: postcss.Rule): void;
44 protected handleAtRules(root: postcss.Root): void;
45 private handleNamespaceReference;
46 protected handleRule(rule: SRule, inStScope?: boolean): void;
47 protected checkRedeclareSymbol(symbolName: string, node: postcss.Node): void;
48 protected addElementSymbolOnce(name: string, rule: postcss.Rule): void;
49 protected addClassSymbolOnce(name: string, rule: postcss.Rule): void;
50 protected addImportSymbols(importDef: Imported): void;
51 protected addVarSymbols(rule: postcss.Rule): void;
52 protected handleCSSVarUse(decl: postcss.Declaration): void;
53 protected addCSSVarFromProp(decl: postcss.Declaration): void;
54 protected addCSSVar(varName: string, decl: postcss.Declaration): void;
55 protected handleDirectives(rule: SRule, decl: postcss.Declaration): void;
56 protected setClassGlobalMapping(decl: postcss.Declaration, rule: postcss.Rule): void;
57 protected extendTypedRule(node: postcss.Node, selector: string, key: keyof StylableDirectives, value: any): void;
58 protected handleImport(rule: postcss.Rule): Imported;
59}
60export declare function validateScopingSelector(atRule: postcss.AtRule, { selector: scopingSelector, isSimpleSelector }: SRule, diagnostics: Diagnostics): void;
61export declare function createEmptyMeta(root: postcss.Root, diagnostics: Diagnostics): StylableMeta;
62export declare function processNamespace(namespace: string, source: string): string;
63export declare function process(root: postcss.Root, diagnostics?: Diagnostics, resolveNamespace?: typeof processNamespace): StylableMeta;
64export interface SRule extends postcss.Rule {
65 selectorAst: SelectorAstNode;
66 isSimpleSelector: boolean;
67 selectorType: 'class' | 'element' | 'complex';
68 mixins?: RefedMixin[];
69}
70export interface DeclStylableProps {
71 sourceValue: string;
72}
73export interface SDecl extends postcss.Declaration {
74 stylable: DeclStylableProps;
75}
76//# sourceMappingURL=stylable-processor.d.ts.map
\No newline at end of file