create-visualbuild-app 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +306 -123
- package/docs/user-guide.md +759 -0
- package/package.json +92 -85
- package/scripts/create-builder-app.mjs +513 -501
- package/scripts/vb-dev.mjs +41 -32
- package/scripts/vb-generate.mjs +332 -224
- package/templates/default/app/.vercelignore +6 -0
- package/templates/default/app/README.md +56 -21
- package/templates/default/app/visualbuild/components.json +3 -0
- package/templates/default/app/visualbuild/config.d.ts +48 -0
- package/templates/default/app/visualbuild.config.ts +38 -0
- package/templates/default/builder/README.md +37 -21
- package/visual-app-builder/server/parseReactPage.ts +776 -571
- package/visual-app-builder/shared/createReactComponentSource.d.mts +2 -0
- package/visual-app-builder/shared/createReactComponentSource.mjs +45 -0
- package/visual-app-builder/shared/generateReactSource.d.mts +57 -37
- package/visual-app-builder/shared/generateReactSource.mjs +608 -443
- package/visual-app-builder/shared/npmBuildCommand.d.mts +17 -0
- package/visual-app-builder/shared/npmBuildCommand.mjs +26 -0
- package/visual-app-builder/shared/syncCustomComponentSource.d.mts +13 -0
- package/visual-app-builder/shared/syncCustomComponentSource.mjs +345 -0
- package/visual-app-builder/shared/vercelDeployment.d.mts +31 -0
- package/visual-app-builder/shared/vercelDeployment.mjs +266 -0
- package/visual-app-builder/shared/visualbuildConfig.d.mts +144 -0
- package/visual-app-builder/shared/visualbuildConfig.mjs +578 -0
- package/visual-app-builder/src/App.tsx +1090 -874
- package/visual-app-builder/src/components/Canvas.tsx +1116 -1059
- package/visual-app-builder/src/components/CodePanel.tsx +1147 -812
- package/visual-app-builder/src/components/ComponentSidebar.tsx +365 -302
- package/visual-app-builder/src/components/DeploymentModal.tsx +295 -0
- package/visual-app-builder/src/components/PageSwitcher.tsx +133 -133
- package/visual-app-builder/src/components/ProjectExplorer.tsx +1054 -1054
- package/visual-app-builder/src/components/PropertiesPanel.tsx +792 -692
- package/visual-app-builder/src/components/Topbar.tsx +257 -128
- package/visual-app-builder/src/data/componentRegistry.tsx +613 -292
- package/visual-app-builder/src/data/tailwindClassCatalog.ts +95 -0
- package/visual-app-builder/src/index.css +383 -111
- package/visual-app-builder/src/stores/useAppStore.ts +2385 -1265
- package/visual-app-builder/src/theme.ts +71 -0
- package/visual-app-builder/src/types/index.ts +350 -261
- package/visual-app-builder/src/utils/codegen.ts +90 -66
- package/visual-app-builder/src/utils/deployment.ts +54 -0
- package/visual-app-builder/src/utils/projectPersistence.ts +218 -177
- package/visual-app-builder/vite.config.ts +1946 -1479
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { EditorTheme, EditorThemeChoice, ResolvedEditorTheme } from './types'
|
|
2
|
+
|
|
3
|
+
export const editorThemeStorageKey = 'visualbuild:editor-theme'
|
|
4
|
+
|
|
5
|
+
export function createEditorThemeStorageKey(projectName: string) {
|
|
6
|
+
return `${editorThemeStorageKey}:${encodeURIComponent(projectName)}`
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const editorThemeOptions: Array<{
|
|
10
|
+
id: EditorThemeChoice
|
|
11
|
+
label: string
|
|
12
|
+
description: string
|
|
13
|
+
swatches: [string, string, string]
|
|
14
|
+
}> = [
|
|
15
|
+
{
|
|
16
|
+
id: 'default',
|
|
17
|
+
label: 'VisualBuild Default',
|
|
18
|
+
description: 'The original deep navy editor',
|
|
19
|
+
swatches: ['#13151a', '#1a1d23', '#4f6ef7'],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'codex-dark',
|
|
23
|
+
label: 'Codex Dark',
|
|
24
|
+
description: 'Soft neutral charcoal surfaces',
|
|
25
|
+
swatches: ['#181818', '#202020', '#8b8bff'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'vs-light',
|
|
29
|
+
label: 'VS Code Light',
|
|
30
|
+
description: 'Bright editor with crisp borders',
|
|
31
|
+
swatches: ['#f3f3f3', '#ffffff', '#007acc'],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'vs-dark',
|
|
35
|
+
label: 'VS Code Dark',
|
|
36
|
+
description: 'Classic Visual Studio Code dark',
|
|
37
|
+
swatches: ['#181818', '#252526', '#007acc'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'system',
|
|
41
|
+
label: 'System',
|
|
42
|
+
description: 'VS Code Light or Dark automatically',
|
|
43
|
+
swatches: ['#f3f3f3', '#1e1e1e', '#007acc'],
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
const themeChoices = new Set<EditorThemeChoice>(
|
|
48
|
+
editorThemeOptions.map((theme) => theme.id)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
export function normalizeEditorTheme(theme: EditorTheme): EditorThemeChoice {
|
|
52
|
+
if (theme === 'dark') return 'default'
|
|
53
|
+
if (theme === 'light') return 'vs-light'
|
|
54
|
+
return theme
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function parseStoredEditorTheme(
|
|
58
|
+
value: string | null
|
|
59
|
+
): EditorThemeChoice | null {
|
|
60
|
+
return value && themeChoices.has(value as EditorThemeChoice)
|
|
61
|
+
? (value as EditorThemeChoice)
|
|
62
|
+
: null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function resolveEditorTheme(
|
|
66
|
+
theme: EditorThemeChoice,
|
|
67
|
+
prefersLight: boolean
|
|
68
|
+
): ResolvedEditorTheme {
|
|
69
|
+
if (theme === 'system') return prefersLight ? 'vs-light' : 'vs-dark'
|
|
70
|
+
return theme
|
|
71
|
+
}
|
|
@@ -1,261 +1,350 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
export type ComponentType =
|
|
4
|
-
| 'Navbar'
|
|
5
|
-
| 'Hero'
|
|
6
|
-
| 'Card'
|
|
7
|
-
| 'Button'
|
|
8
|
-
| 'Footer'
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
| '
|
|
103
|
-
| '
|
|
104
|
-
| '
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| '
|
|
112
|
-
| '
|
|
113
|
-
| '
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
export
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
) =>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
export type ComponentType =
|
|
4
|
+
| 'Navbar'
|
|
5
|
+
| 'Hero'
|
|
6
|
+
| 'Card'
|
|
7
|
+
| 'Button'
|
|
8
|
+
| 'Footer'
|
|
9
|
+
| 'Grid'
|
|
10
|
+
| 'Testimonials'
|
|
11
|
+
| 'Pricing'
|
|
12
|
+
| 'Form'
|
|
13
|
+
| 'Image'
|
|
14
|
+
| 'Features'
|
|
15
|
+
| 'Gallery'
|
|
16
|
+
| 'FAQ'
|
|
17
|
+
| 'ContactForm'
|
|
18
|
+
| 'LoginForm'
|
|
19
|
+
|
|
20
|
+
export type PrimitiveType =
|
|
21
|
+
| 'header'
|
|
22
|
+
| 'main'
|
|
23
|
+
| 'div'
|
|
24
|
+
| 'section'
|
|
25
|
+
| 'nav'
|
|
26
|
+
| 'article'
|
|
27
|
+
| 'aside'
|
|
28
|
+
| 'footer'
|
|
29
|
+
| 'address'
|
|
30
|
+
| 'hgroup'
|
|
31
|
+
| 'h1'
|
|
32
|
+
| 'h2'
|
|
33
|
+
| 'h3'
|
|
34
|
+
| 'h4'
|
|
35
|
+
| 'h5'
|
|
36
|
+
| 'h6'
|
|
37
|
+
| 'p'
|
|
38
|
+
| 'br'
|
|
39
|
+
| 'hr'
|
|
40
|
+
| 'pre'
|
|
41
|
+
| 'blockquote'
|
|
42
|
+
| 'span'
|
|
43
|
+
| 'strong'
|
|
44
|
+
| 'b'
|
|
45
|
+
| 'em'
|
|
46
|
+
| 'i'
|
|
47
|
+
| 'u'
|
|
48
|
+
| 's'
|
|
49
|
+
| 'small'
|
|
50
|
+
| 'mark'
|
|
51
|
+
| 'sub'
|
|
52
|
+
| 'sup'
|
|
53
|
+
| 'code'
|
|
54
|
+
| 'kbd'
|
|
55
|
+
| 'samp'
|
|
56
|
+
| 'var'
|
|
57
|
+
| 'abbr'
|
|
58
|
+
| 'cite'
|
|
59
|
+
| 'q'
|
|
60
|
+
| 'time'
|
|
61
|
+
| 'a'
|
|
62
|
+
| 'ul'
|
|
63
|
+
| 'ol'
|
|
64
|
+
| 'li'
|
|
65
|
+
| 'dl'
|
|
66
|
+
| 'dt'
|
|
67
|
+
| 'dd'
|
|
68
|
+
| 'menu'
|
|
69
|
+
| 'button'
|
|
70
|
+
| 'img'
|
|
71
|
+
| 'picture'
|
|
72
|
+
| 'source'
|
|
73
|
+
| 'figure'
|
|
74
|
+
| 'figcaption'
|
|
75
|
+
| 'video'
|
|
76
|
+
| 'audio'
|
|
77
|
+
| 'iframe'
|
|
78
|
+
| 'canvas'
|
|
79
|
+
| 'svg'
|
|
80
|
+
| 'form'
|
|
81
|
+
| 'label'
|
|
82
|
+
| 'input'
|
|
83
|
+
| 'textarea'
|
|
84
|
+
| 'select'
|
|
85
|
+
| 'option'
|
|
86
|
+
| 'optgroup'
|
|
87
|
+
| 'fieldset'
|
|
88
|
+
| 'legend'
|
|
89
|
+
| 'datalist'
|
|
90
|
+
| 'output'
|
|
91
|
+
| 'progress'
|
|
92
|
+
| 'meter'
|
|
93
|
+
| 'table'
|
|
94
|
+
| 'caption'
|
|
95
|
+
| 'thead'
|
|
96
|
+
| 'tbody'
|
|
97
|
+
| 'tfoot'
|
|
98
|
+
| 'tr'
|
|
99
|
+
| 'th'
|
|
100
|
+
| 'td'
|
|
101
|
+
| 'colgroup'
|
|
102
|
+
| 'col'
|
|
103
|
+
| 'details'
|
|
104
|
+
| 'summary'
|
|
105
|
+
| 'dialog'
|
|
106
|
+
|
|
107
|
+
export type AppShellSlot = 'header' | 'footer'
|
|
108
|
+
|
|
109
|
+
export type Viewport = 'mobile' | 'tablet' | 'desktop'
|
|
110
|
+
export type EditorThemeChoice =
|
|
111
|
+
| 'default'
|
|
112
|
+
| 'codex-dark'
|
|
113
|
+
| 'vs-light'
|
|
114
|
+
| 'vs-dark'
|
|
115
|
+
| 'system'
|
|
116
|
+
export type EditorTheme = EditorThemeChoice | 'dark' | 'light'
|
|
117
|
+
export type ResolvedEditorTheme = Exclude<EditorThemeChoice, 'system'>
|
|
118
|
+
|
|
119
|
+
export interface VisualBuildRuntimeConfig {
|
|
120
|
+
paths: {
|
|
121
|
+
sourceDir: string
|
|
122
|
+
pagesDir: string
|
|
123
|
+
layoutsDir: string
|
|
124
|
+
appFile: string
|
|
125
|
+
schemaFile: string
|
|
126
|
+
componentRegistryFile: string
|
|
127
|
+
generatedManifestFile: string
|
|
128
|
+
}
|
|
129
|
+
editor: {
|
|
130
|
+
theme: EditorTheme
|
|
131
|
+
defaultViewport: Viewport
|
|
132
|
+
responsiveWidths: {
|
|
133
|
+
mobile: number
|
|
134
|
+
tablet: number
|
|
135
|
+
desktop: number | 'fluid'
|
|
136
|
+
}
|
|
137
|
+
panels: {
|
|
138
|
+
leftOpen: boolean
|
|
139
|
+
leftTab: 'files' | 'elements'
|
|
140
|
+
rightOpen: boolean
|
|
141
|
+
rightTab: 'code' | 'properties'
|
|
142
|
+
codeView: 'page' | 'app' | 'layout' | 'schema' | 'file'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
generator: {
|
|
146
|
+
emitApp: boolean
|
|
147
|
+
emitLayout: boolean
|
|
148
|
+
cleanStaleFiles: boolean
|
|
149
|
+
}
|
|
150
|
+
deployment: {
|
|
151
|
+
provider: 'vercel'
|
|
152
|
+
outputDirectory: string
|
|
153
|
+
projectName?: string
|
|
154
|
+
teamId?: string
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type ProjectRefreshResult =
|
|
159
|
+
| 'updated'
|
|
160
|
+
| 'skipped-dirty'
|
|
161
|
+
| 'failed'
|
|
162
|
+
|
|
163
|
+
export type PropType =
|
|
164
|
+
| 'string'
|
|
165
|
+
| 'text'
|
|
166
|
+
| 'number'
|
|
167
|
+
| 'boolean'
|
|
168
|
+
| 'color'
|
|
169
|
+
| 'select'
|
|
170
|
+
| 'array'
|
|
171
|
+
| 'attributes'
|
|
172
|
+
|
|
173
|
+
export interface PropSchema {
|
|
174
|
+
type: PropType
|
|
175
|
+
label: string
|
|
176
|
+
default: unknown
|
|
177
|
+
options?: string[]
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface CustomComponentDefinition {
|
|
181
|
+
name: string
|
|
182
|
+
label: string
|
|
183
|
+
category: string
|
|
184
|
+
icon: string
|
|
185
|
+
description: string
|
|
186
|
+
importPath: string
|
|
187
|
+
exportName: 'default' | string
|
|
188
|
+
defaultProps: Record<string, unknown>
|
|
189
|
+
propSchema: Record<string, PropSchema>
|
|
190
|
+
acceptsChildren: boolean
|
|
191
|
+
preview?: {
|
|
192
|
+
rootTag: string
|
|
193
|
+
rootProps: Record<string, unknown>
|
|
194
|
+
children: VisualNode[]
|
|
195
|
+
rendersChildren: boolean
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface ComponentDefinition {
|
|
200
|
+
type: ComponentType
|
|
201
|
+
label: string
|
|
202
|
+
category: string
|
|
203
|
+
icon: string
|
|
204
|
+
description: string
|
|
205
|
+
defaultProps: Record<string, unknown>
|
|
206
|
+
propSchema: Record<string, PropSchema>
|
|
207
|
+
renderer: (
|
|
208
|
+
props: Record<string, unknown>,
|
|
209
|
+
context: ComponentRenderContext
|
|
210
|
+
) => ReactNode
|
|
211
|
+
generator: (props: Record<string, unknown>) => string
|
|
212
|
+
source: () => string
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface PrimitiveDefinition {
|
|
216
|
+
type: PrimitiveType
|
|
217
|
+
label: string
|
|
218
|
+
category: string
|
|
219
|
+
icon: string
|
|
220
|
+
description: string
|
|
221
|
+
defaultProps: Record<string, unknown>
|
|
222
|
+
propSchema: Record<string, PropSchema>
|
|
223
|
+
acceptsChildren: boolean
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface ComponentRenderContext {
|
|
227
|
+
pages: Page[]
|
|
228
|
+
activePageId: string
|
|
229
|
+
setActivePage: (id: string) => void
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface VisualNode {
|
|
233
|
+
id: string
|
|
234
|
+
type: PrimitiveType | string
|
|
235
|
+
label?: string
|
|
236
|
+
props: Record<string, unknown>
|
|
237
|
+
children: VisualNode[]
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface Page {
|
|
241
|
+
id: string
|
|
242
|
+
name: string
|
|
243
|
+
route: string
|
|
244
|
+
sourcePath: string
|
|
245
|
+
root: VisualNode
|
|
246
|
+
components: VisualNode[]
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface AppShell {
|
|
250
|
+
header: VisualNode | null
|
|
251
|
+
footer: VisualNode | null
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface AppState {
|
|
255
|
+
projectName: string
|
|
256
|
+
appShell: AppShell
|
|
257
|
+
pages: Page[]
|
|
258
|
+
activePageId: string
|
|
259
|
+
selectedComponentId: string | null
|
|
260
|
+
viewport: Viewport
|
|
261
|
+
previewMode: boolean
|
|
262
|
+
isProjectLoaded: boolean
|
|
263
|
+
customComponents: CustomComponentDefinition[]
|
|
264
|
+
projectConfig: VisualBuildRuntimeConfig
|
|
265
|
+
// Actions
|
|
266
|
+
loadProject: () => Promise<void>
|
|
267
|
+
refreshCustomComponents: () => Promise<void>
|
|
268
|
+
refreshProjectFromDisk: (
|
|
269
|
+
force?: boolean
|
|
270
|
+
) => Promise<ProjectRefreshResult>
|
|
271
|
+
saveProject: () => Promise<void>
|
|
272
|
+
addPage: (name: string, route: string) => Page
|
|
273
|
+
registerPage: (page: Page) => void
|
|
274
|
+
deletePage: (id: string) => void
|
|
275
|
+
setActivePage: (id: string) => void
|
|
276
|
+
setSelectedComponent: (id: string | null) => void
|
|
277
|
+
setViewport: (viewport: Viewport) => void
|
|
278
|
+
togglePreviewMode: () => void
|
|
279
|
+
addComponent: (pageId: string, type: ComponentType) => void
|
|
280
|
+
addComponentAt: (
|
|
281
|
+
pageId: string,
|
|
282
|
+
type: ComponentType,
|
|
283
|
+
index: number
|
|
284
|
+
) => void
|
|
285
|
+
addPrimitive: (pageId: string, type: PrimitiveType) => void
|
|
286
|
+
addPrimitiveAt: (
|
|
287
|
+
pageId: string,
|
|
288
|
+
type: PrimitiveType,
|
|
289
|
+
index: number
|
|
290
|
+
) => void
|
|
291
|
+
addPrimitiveToNode: (
|
|
292
|
+
parentNodeId: string,
|
|
293
|
+
type: PrimitiveType
|
|
294
|
+
) => void
|
|
295
|
+
addPrimitiveToNodeAt: (
|
|
296
|
+
parentNodeId: string,
|
|
297
|
+
type: PrimitiveType,
|
|
298
|
+
index: number
|
|
299
|
+
) => void
|
|
300
|
+
addComponentToNode: (
|
|
301
|
+
parentNodeId: string,
|
|
302
|
+
type: ComponentType
|
|
303
|
+
) => void
|
|
304
|
+
addComponentToNodeAt: (
|
|
305
|
+
parentNodeId: string,
|
|
306
|
+
type: ComponentType,
|
|
307
|
+
index: number
|
|
308
|
+
) => void
|
|
309
|
+
addCustomComponent: (pageId: string, name: string) => void
|
|
310
|
+
addCustomComponentAt: (pageId: string, name: string, index: number) => void
|
|
311
|
+
addCustomComponentToNode: (parentNodeId: string, name: string) => void
|
|
312
|
+
addCustomComponentToNodeAt: (
|
|
313
|
+
parentNodeId: string,
|
|
314
|
+
name: string,
|
|
315
|
+
index: number
|
|
316
|
+
) => void
|
|
317
|
+
registerCustomComponent: (definition: CustomComponentDefinition) => void
|
|
318
|
+
removeNode: (nodeId: string) => void
|
|
319
|
+
moveNode: (
|
|
320
|
+
pageId: string,
|
|
321
|
+
nodeId: string,
|
|
322
|
+
targetParentNodeId: string | null,
|
|
323
|
+
targetIndex: number
|
|
324
|
+
) => void
|
|
325
|
+
moveComponent: (
|
|
326
|
+
pageId: string,
|
|
327
|
+
nodeId: string,
|
|
328
|
+
targetIndex: number
|
|
329
|
+
) => void
|
|
330
|
+
removeComponent: (pageId: string, nodeId: string) => void
|
|
331
|
+
setAppShellComponent: (slot: AppShellSlot, type: ComponentType) => void
|
|
332
|
+
removeAppShellComponent: (slot: AppShellSlot) => void
|
|
333
|
+
updateComponentProps: (
|
|
334
|
+
pageId: string,
|
|
335
|
+
nodeId: string,
|
|
336
|
+
props: Record<string, unknown>
|
|
337
|
+
) => void
|
|
338
|
+
updateNodeProps: (nodeId: string, props: Record<string, unknown>) => void
|
|
339
|
+
updatePageRoot: (
|
|
340
|
+
pageId: string,
|
|
341
|
+
updates: {
|
|
342
|
+
type?: PrimitiveType
|
|
343
|
+
props?: Record<string, unknown>
|
|
344
|
+
}
|
|
345
|
+
) => void
|
|
346
|
+
updateAppShellProps: (
|
|
347
|
+
slot: AppShellSlot,
|
|
348
|
+
props: Record<string, unknown>
|
|
349
|
+
) => void
|
|
350
|
+
}
|