UNPKG

3.49 kBTypeScriptView Raw
1import * as postcss from 'postcss';
2import postcssValueParser from 'postcss-value-parser';
3import { Diagnostics } from './diagnostics';
4import { ParsedValue, StateParsedValue } from './types';
5export declare const valueParserWarnings: {
6 VALUE_CANNOT_BE_STRING(): string;
7 CSS_MIXIN_FORCE_NAMED_PARAMS(): string;
8 INVALID_NAMED_IMPORT_AS(name: string): string;
9 INVALID_NESTED_KEYFRAMES(name: string): string;
10};
11export interface MappedStates {
12 [s: string]: StateParsedValue | string | null;
13}
14export interface TypedClass {
15 '-st-root'?: boolean;
16 '-st-states'?: string[] | MappedStates;
17 '-st-extends'?: string;
18}
19export interface MixinValue {
20 type: string;
21 options: Array<{
22 value: string;
23 }> | Record<string, string>;
24 partial?: boolean;
25}
26export interface ArgValue {
27 type: string;
28 value: string;
29}
30export interface ExtendsValue {
31 symbolName: string;
32 args: ArgValue[][] | null;
33}
34export declare type ReportWarning = (message: string, options?: {
35 word: string;
36}) => void;
37export declare const rootValueMapping: {
38 vars: ":vars";
39 import: ":import";
40 stScope: "st-scope";
41 namespace: "namespace";
42};
43export declare const valueMapping: {
44 from: "-st-from";
45 named: "-st-named";
46 default: "-st-default";
47 root: "-st-root";
48 states: "-st-states";
49 extends: "-st-extends";
50 mixin: "-st-mixin";
51 partialMixin: "-st-partial-mixin";
52 global: "-st-global";
53};
54export declare const mixinDeclRegExp: RegExp;
55export declare type stKeys = keyof typeof valueMapping;
56export declare const stValues: string[];
57export declare const stValuesMap: Record<string, boolean>;
58export declare const STYLABLE_VALUE_MATCHER: RegExp;
59export declare const STYLABLE_NAMED_MATCHER: RegExp;
60export declare const SBTypesParsers: {
61 '-st-root'(value: string): boolean;
62 '-st-global'(decl: postcss.Declaration, _diagnostics: Diagnostics): any;
63 '-st-states'(value: string, decl: postcss.Declaration, diagnostics: Diagnostics): MappedStates;
64 '-st-extends'(value: string): {
65 ast: postcssValueParser.ParsedValue;
66 types: ExtendsValue[];
67 };
68 '-st-named'(value: string, node: postcss.Declaration, diagnostics: Diagnostics): {
69 namedMap: Record<string, string>;
70 keyframesMap: Record<string, string>;
71 };
72 '-st-mixin'(mixinNode: postcss.Declaration, strategy: (type: string) => 'named' | 'args', diagnostics?: Diagnostics | undefined): MixinValue[];
73 '-st-partial-mixin'(mixinNode: postcss.Declaration, strategy: (type: string) => 'named' | 'args', diagnostics?: Diagnostics | undefined): MixinValue[];
74};
75export declare function getNamedArgs(node: ParsedValue): ParsedValue[][];
76export declare function getFormatterArgs(node: ParsedValue, allowComments?: boolean, _reportWarning?: ReportWarning, perserveQuotes?: boolean): string[];
77export declare function getStringValue(nodes: ParsedValue | ParsedValue[]): string;
78export declare function groupValues(nodes: any[], divType?: string): any[];
79export declare const strategies: {
80 named: (node: any, reportWarning?: ReportWarning | undefined) => Record<string, string>;
81 args: (node: any, reportWarning?: ReportWarning | undefined) => {
82 value: string;
83 }[];
84};
85export declare function listOptions(node: any): string[];
86export declare function validateAllowedNodesUntil(node: ParsedValue, i: number, untilType?: string, allowed?: string[]): boolean;
87//# sourceMappingURL=stylable-value-parsers.d.ts.map
\No newline at end of file