UNPKG

1.87 kBTypeScriptView Raw
1import postcss from 'postcss';
2import { Box } from './custom-values';
3import { StylableMeta } from './stylable-meta';
4import { StylableResults } from './stylable-transformer';
5export declare type PartialObject<T> = Partial<T> & object;
6export declare type CSSObject = any & object;
7export interface ParsedValue {
8 type: string;
9 value: string;
10 nodes?: any;
11 resolvedValue?: string | Box<string, unknown>;
12 url?: string;
13}
14export interface StateTypeValidator {
15 name: string;
16 args: string[];
17}
18export declare type StateArguments = Array<StateTypeValidator | string>;
19export interface StateParsedValue {
20 type: string;
21 defaultValue?: string;
22 arguments: StateArguments;
23}
24export interface IStylableOptimizer {
25 classNameOptimizer: IStylableClassNameOptimizer;
26 namespaceOptimizer: IStylableNamespaceOptimizer;
27 minifyCSS(css: string): string;
28 optimize(config: object, stylableResult: StylableResults, usageMapping: Record<string, boolean>, delimiter?: string): void;
29 removeStylableDirectives(root: postcss.Root, shouldComment: boolean): void;
30}
31export interface IStylableClassNameOptimizer {
32 context: {
33 names: Record<string, string>;
34 };
35 rewriteSelector(selector: string, usageMapping: Record<string, boolean>, globals: Record<string, boolean>): string;
36 generateName(name: string): string;
37 optimizeAstAndExports(ast: postcss.Root, exported: Record<string, string>, classes: string[], usageMapping: Record<string, boolean>, globals?: Record<string, boolean>): void;
38}
39export interface IStylableNamespaceOptimizer {
40 index: number;
41 namespacePrefix: string;
42 namespaceMapping: Record<string, string>;
43 getNamespace(meta: StylableMeta, ..._env: any[]): string;
44}
45export declare type ModuleResolver = (directoryPath: string, request: string) => string;
46//# sourceMappingURL=types.d.ts.map
\No newline at end of file