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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
export type List = {
type: "list";
icon?: string;
title: string;
dynamic?: boolean;
isShowingDetail?: boolean;
items: ListItem[];
};
export type ListItem = {
title: string;
subtitle?: string;
icon?: string;
id?: string;
detail?: {
markdown: string;
metadata?: MetadataItem[];
};
actions?: Action[];
};
export type Form = {
type: "form";
icon?: string;
title: string;
onSubmit:
| {
type: "push";
url?: string;
}
| {
type: "run";
url?: string;
onSuccess?: "reload" | "pop";
};
items: FormItem[];
};
export type FormItemProps = {
id: string;
title: string;
required?: boolean;
};
type TextField = FormItemProps & {
type: "textfield";
placeholder?: string;
value?: string;
};
type TextArea = FormItemProps & {
type: "textarea";
placeholder?: string;
value?: string;
};
type Checkbox = FormItemProps & {
type: "checkbox";
label: string;
title?: string;
value?: boolean;
};
type Select = FormItemProps & {
type: "dropdown";
items: SelectItem[];
value?: string;
};
type File = FormItemProps & {
type: "file";
};
type SelectItem = {
title: string;
value: string;
};
export type FormItem = TextField | Checkbox | TextArea | Select | File;
export type Detail = {
title: string;
icon?: string;
metadata?: MetadataItem[];
type: "detail";
markdown: string;
actions?: Action[];
};
export type MetadataLink = {
type: "link";
url: string;
title: string;
text: string;
};
export type MetadataSeparator = {
type: "separator";
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 24, 2024