-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
39 lines (31 loc) · 1.02 KB
/
types.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 harvestedPropTypes from 'harvestPropTypes/propTypes'
import {
primitiveComponentPropTypes,
layoutComponentPropTypes,
} from 'components/builtInComponents'
export const libraryPropTypes = harvestedPropTypes
export const componentPropTypes = {
...primitiveComponentPropTypes,
...layoutComponentPropTypes,
...libraryPropTypes,
} as const
type ComponentPropTypes = typeof componentPropTypes
export type ComponentId = string
export type ComponentType = keyof ComponentPropTypes
export type ComponentPropValue = string | number | boolean | Array<string>
export type ComponentProps = Record<string, ComponentPropValue>
export interface SavedComponentConfig {
componentType: ComponentType
props: ComponentProps
childComponentIds: Array<ComponentId>
parentComponentId: ComponentId
}
export const rootComponentId = '__root__'
export type SavedComponentConfigs = {
[key: ComponentId]: SavedComponentConfig
} & {
[rootComponentId]: {
childComponentIds: Array<ComponentId>
parentComponentId: '__null__'
}
}