UNPKG

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