-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistry.ts
More file actions
86 lines (80 loc) · 2.06 KB
/
Copy pathregistry.ts
File metadata and controls
86 lines (80 loc) · 2.06 KB
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
/**
* The default registry: Constructive node types → components.
*
* It is split into three layers so a host can take only what it wants — the
* widgets without the page chrome, say — and compose the rest itself.
*/
import type { BlockRegistry } from 'blocks-renderer';
import { ActionBarBlock, ButtonBlock, MarkdownBlock, StatCardBlock } from './blocks';
import {
FormBlock,
GridBlock,
GridColumnBlock,
PageBlock,
SectionBlock,
TabBlock,
TabsBlock,
} from './containers';
import { NavBlock, NavGroupBlock, NavLinkBlock } from './nav';
import {
CheckboxBlock,
CodeBlock,
DatePickerBlock,
DateTimePickerBlock,
FileUploadBlock,
InputBlock,
NumberInputBlock,
PhoneInputBlock,
RadioGroupBlock,
SelectBlock,
SwitchBlock,
TextareaBlock,
TimePickerBlock,
} from './widgets';
/** Every field widget in `WIDGET_NODE_TYPES`. */
export const widgetRegistry: BlockRegistry = {
Input: InputBlock,
Textarea: TextareaBlock,
Select: SelectBlock,
RadioGroup: RadioGroupBlock,
Checkbox: CheckboxBlock,
Switch: SwitchBlock,
NumberInput: NumberInputBlock,
DatePicker: DatePickerBlock,
DateTimePicker: DateTimePickerBlock,
TimePicker: TimePickerBlock,
PhoneInput: PhoneInputBlock,
CodeEditor: CodeBlock,
MarkdownEditor: CodeBlock,
JsonEditor: CodeBlock,
FileUpload: FileUploadBlock,
};
/** Every layout type in `CONTAINER_NODE_TYPES`. */
export const containerRegistry: BlockRegistry = {
Page: PageBlock,
Form: FormBlock,
Section: SectionBlock,
Grid: GridBlock,
GridColumn: GridColumnBlock,
Tabs: TabsBlock,
Tab: TabBlock,
};
/** The blocks that need no data source. */
export const blockRegistry: BlockRegistry = {
Button: ButtonBlock,
ActionBar: ActionBarBlock,
Markdown: MarkdownBlock,
StatCard: StatCardBlock,
Nav: NavBlock,
NavGroup: NavGroupBlock,
NavLink: NavLinkBlock,
};
/**
* Everything above, ready to render a generated document. Layer over it rather
* than editing it: `composeRegistry(defaultBlockRegistry, myRegistry)`.
*/
export const defaultBlockRegistry: BlockRegistry = {
...widgetRegistry,
...containerRegistry,
...blockRegistry,
};