-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbuttons-config.ts
39 lines (35 loc) · 1.2 KB
/
buttons-config.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
import { Type, Static } from '@sinclair/typebox';
export const ButtonConfigSchema = Type.Object({
enabled: Type.Boolean(),
background: Type.Optional(Type.String()),
text: Type.Optional(Type.String()),
cssClass: Type.Optional(Type.String()),
position: Type.Object({
left: Type.Number(),
top: Type.Number(),
width: Type.Optional(Type.Number()),
height: Type.Optional(Type.Number()),
}),
anchor: Type.Optional(
Type.Object({
x: Type.Number(),
y: Type.Number(),
}),
),
action: Type.Optional(Type.String()),
actionType: Type.Optional(Type.String()),
scriptClickable: Type.Optional(Type.Boolean()),
tag: Type.Optional(Type.String()),
});
export type ButtonConfig = Static<typeof ButtonConfigSchema>;
export const ButtonsListSchema = Type.Record(Type.String(), ButtonConfigSchema);
export type ButtonsList = Static<typeof ButtonsListSchema>;
export const ButtonsConfigSchema = Type.Object({
buttons: ButtonsListSchema,
clickableDuringScriptsByDefault: Type.Optional(Type.Boolean()),
});
export type ButtonsConfig = Static<typeof ButtonsConfigSchema>;
export const defaultButtonsConfig: ButtonsConfig = {
buttons: {},
clickableDuringScriptsByDefault: false,
};