1 | import postcss from 'postcss';
|
2 | import { Box } from './custom-values';
|
3 | import { StylableMeta } from './stylable-meta';
|
4 | import { StylableResults } from './stylable-transformer';
|
5 |
|
6 | export type PartialObject<T> = Partial<T> & object;
|
7 | export type CSSObject = any & object;
|
8 |
|
9 | export interface ParsedValue {
|
10 | type: string;
|
11 | value: string;
|
12 | nodes?: any;
|
13 | resolvedValue?: string | Box<string, unknown>;
|
14 | url?: string;
|
15 | }
|
16 |
|
17 | export interface StateTypeValidator {
|
18 | name: string;
|
19 | args: string[];
|
20 | }
|
21 |
|
22 | export type StateArguments = Array<StateTypeValidator | string>;
|
23 |
|
24 | export interface StateParsedValue {
|
25 | type: string;
|
26 | defaultValue?: string;
|
27 | arguments: StateArguments;
|
28 | }
|
29 |
|
30 | export interface IStylableOptimizer {
|
31 | classNameOptimizer: IStylableClassNameOptimizer;
|
32 | namespaceOptimizer: IStylableNamespaceOptimizer;
|
33 | minifyCSS(css: string): string;
|
34 | optimize(
|
35 | config: object,
|
36 | stylableResult: StylableResults,
|
37 | usageMapping: Record<string, boolean>,
|
38 | delimiter?: string
|
39 | ): void;
|
40 | removeStylableDirectives(root: postcss.Root, shouldComment: boolean): void;
|
41 | }
|
42 |
|
43 | export interface IStylableClassNameOptimizer {
|
44 | context: {
|
45 | names: Record<string, string>;
|
46 | };
|
47 | rewriteSelector(
|
48 | selector: string,
|
49 | usageMapping: Record<string, boolean>,
|
50 | globals: Record<string, boolean>
|
51 | ): string;
|
52 | generateName(name: string): string;
|
53 | optimizeAstAndExports(
|
54 | ast: postcss.Root,
|
55 | exported: Record<string, string>,
|
56 | classes: string[],
|
57 | usageMapping: Record<string, boolean>,
|
58 | globals?: Record<string, boolean>
|
59 | ): void;
|
60 | }
|
61 |
|
62 | export interface IStylableNamespaceOptimizer {
|
63 | index: number;
|
64 | namespacePrefix: string;
|
65 | namespaceMapping: Record<string, string>;
|
66 | getNamespace(meta: StylableMeta, ..._env: any[]): string;
|
67 | }
|
68 |
|
69 | export type ModuleResolver = (directoryPath: string, request: string) => string;
|