-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathshared.ts
63 lines (57 loc) · 1.38 KB
/
shared.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export type FormatSettingsOptions = [string | [string, string], 0 | 1][];
export type FormatSettingsScale = "sm" | "md" | "lg";
export type FormatSettings = {
version: string;
options: { [k: string]: FormatSettingsOptions };
singleNode?: boolean;
tab?: string;
tabIndex?: number;
prefixIgnore: string;
scale: FormatSettingsScale;
suffixSlot: string;
valueOptional: string;
};
export type PluginMessageType = "RESULT" | "CONFIG" | "FORMAT";
interface PluginMessageResult {
type: Extract<PluginMessageType, "RESULT">;
results: FormatResult[];
settings: FormatSettings;
}
interface PluginMessageFormat {
type: Extract<PluginMessageType, "FORMAT">;
language: FormatLanguage;
lines: string[];
index: number;
}
interface PluginMessageConfig {
type: Extract<PluginMessageType, "CONFIG">;
settings: FormatSettings;
codegen?: boolean;
}
export type PluginMessage =
| PluginMessageResult
| PluginMessageConfig
| PluginMessageFormat;
export type FormatLanguage =
| "angular"
| "ts"
| "tsx"
| "jsx"
| "json"
| "html"
| "vue";
export interface FormatResult {
label: string;
items: FormatResultItem[];
}
export interface FormatResultItemCode {
label?: string;
language: FormatLanguage;
lines: string[];
}
export interface FormatResultItem {
label: string;
code: FormatResultItemCode[];
options: FormatSettingsOptions;
optionsKey?: string;
}