/
types.js
48 lines (38 loc) · 1.06 KB
/
types.js
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
/* @flow */
export type Variant = {
default: boolean,
key: string,
value: Pattern,
};
export type SelectExpression = {
type: string,
variants: Array<Variant>,
};
export type Placeable = {
type: string,
expression: SelectExpression,
}
export type PatternElement = {|
type: string,
value: string,
|} | Placeable;
export type Pattern = {
elements: Array<PatternElement>,
};
export type FluentAttribute = {
id: { name: string },
value: Pattern,
};
export type FluentAttributes = Array<FluentAttribute>;
export type FluentMessage = {
type: string,
value: Pattern,
attributes: ?FluentAttributes,
clone: () => FluentMessage,
equals: (any) => boolean,
};
// Type of syntax of the translation to show in the editor.
// `simple` => SimpleEditor (the message can be simplified to a single text element)
// `rich` => RichEditor (the message can be displayed in our rich interface)
// `complex` => SourceEditor (the message is not supported by other editor types)
export type SyntaxType = 'simple' | 'rich' | 'complex';