create-visualbuild-app 0.1.0 → 1.0.1

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.
Files changed (44) hide show
  1. package/README.md +919 -58
  2. package/docs/user-guide.md +759 -0
  3. package/package.json +92 -85
  4. package/scripts/create-builder-app.mjs +513 -501
  5. package/scripts/vb-dev.mjs +41 -32
  6. package/scripts/vb-generate.mjs +332 -224
  7. package/templates/default/app/.vercelignore +6 -0
  8. package/templates/default/app/README.md +56 -21
  9. package/templates/default/app/visualbuild/components.json +3 -0
  10. package/templates/default/app/visualbuild/config.d.ts +48 -0
  11. package/templates/default/app/visualbuild.config.ts +38 -0
  12. package/templates/default/builder/README.md +37 -21
  13. package/visual-app-builder/server/parseReactPage.ts +776 -571
  14. package/visual-app-builder/shared/createReactComponentSource.d.mts +2 -0
  15. package/visual-app-builder/shared/createReactComponentSource.mjs +45 -0
  16. package/visual-app-builder/shared/generateReactSource.d.mts +57 -37
  17. package/visual-app-builder/shared/generateReactSource.mjs +608 -443
  18. package/visual-app-builder/shared/npmBuildCommand.d.mts +17 -0
  19. package/visual-app-builder/shared/npmBuildCommand.mjs +26 -0
  20. package/visual-app-builder/shared/syncCustomComponentSource.d.mts +13 -0
  21. package/visual-app-builder/shared/syncCustomComponentSource.mjs +345 -0
  22. package/visual-app-builder/shared/vercelDeployment.d.mts +31 -0
  23. package/visual-app-builder/shared/vercelDeployment.mjs +266 -0
  24. package/visual-app-builder/shared/visualbuildConfig.d.mts +144 -0
  25. package/visual-app-builder/shared/visualbuildConfig.mjs +578 -0
  26. package/visual-app-builder/src/App.tsx +1090 -874
  27. package/visual-app-builder/src/components/Canvas.tsx +1116 -1059
  28. package/visual-app-builder/src/components/CodePanel.tsx +1147 -812
  29. package/visual-app-builder/src/components/ComponentSidebar.tsx +365 -302
  30. package/visual-app-builder/src/components/DeploymentModal.tsx +295 -0
  31. package/visual-app-builder/src/components/PageSwitcher.tsx +133 -133
  32. package/visual-app-builder/src/components/ProjectExplorer.tsx +1054 -1054
  33. package/visual-app-builder/src/components/PropertiesPanel.tsx +792 -692
  34. package/visual-app-builder/src/components/Topbar.tsx +257 -128
  35. package/visual-app-builder/src/data/componentRegistry.tsx +613 -292
  36. package/visual-app-builder/src/data/tailwindClassCatalog.ts +95 -0
  37. package/visual-app-builder/src/index.css +383 -111
  38. package/visual-app-builder/src/stores/useAppStore.ts +2385 -1265
  39. package/visual-app-builder/src/theme.ts +71 -0
  40. package/visual-app-builder/src/types/index.ts +350 -261
  41. package/visual-app-builder/src/utils/codegen.ts +90 -66
  42. package/visual-app-builder/src/utils/deployment.ts +54 -0
  43. package/visual-app-builder/src/utils/projectPersistence.ts +218 -177
  44. package/visual-app-builder/vite.config.ts +1946 -1479
@@ -1,21 +1,56 @@
1
- # __DISPLAY_NAME__
2
-
3
- This is the deployable React application generated by VisualBuild. It contains
4
- only the source and dependencies required to run the application.
5
-
6
- ## Run
7
-
8
- ```powershell
9
- npm install
10
- npm.cmd run dev
11
- ```
12
-
13
- ## Build
14
-
15
- ```powershell
16
- npm.cmd run build
17
- ```
18
-
19
- The visual schema lives in `visualbuild/pages.json`. The optional sibling
20
- `visual-builder` project can edit this application visually and regenerate its
21
- managed React files. This application remains runnable without that editor.
1
+ # __DISPLAY_NAME__
2
+
3
+ This is the deployable React application generated by VisualBuild. It contains
4
+ only the source and dependencies required to run the application.
5
+
6
+ The complete workspace guide is available at
7
+ [`../VISUALBUILD-GUIDE.md`](../VISUALBUILD-GUIDE.md). It explains the editor,
8
+ page and component registration, source ownership, two-way synchronization,
9
+ configuration, deployment, limits, and recovery.
10
+
11
+ ## Run
12
+
13
+ ```powershell
14
+ npm install
15
+ npm.cmd run dev
16
+ ```
17
+
18
+ ## Build
19
+
20
+ ```powershell
21
+ npm.cmd run build
22
+ ```
23
+
24
+ The visual schema lives in `visualbuild/pages.json`. The optional sibling
25
+ `visual-builder` project can edit this application visually and regenerate its
26
+ managed React files. This application remains runnable without that editor.
27
+
28
+ ## VisualBuild configuration
29
+
30
+ Edit `visualbuild.config.ts` to customize source, page, layout, schema,
31
+ component-registry, and generated-manifest paths; initial editor panels and
32
+ viewport widths; editor theme preference; and App/layout/stale-file generation.
33
+ The `deployment` block configures the static output folder plus optional Vercel
34
+ project and team identifiers.
35
+ The file imports types only, so the deployable app has no VisualBuild runtime
36
+ dependency. Restart the sibling visual builder after changing configured paths.
37
+
38
+ The editor theme setting accepts `default`, `codex-dark`, `vs-light`,
39
+ `vs-dark`, or `system`. A theme selected from the editor's top-bar palette is
40
+ saved for this project. Editor palettes never change the styling of this
41
+ deployable application.
42
+
43
+ ## Deploy from VisualBuild
44
+
45
+ Set `VERCEL_TOKEN` in the terminal that starts the sibling visual builder, then
46
+ use **Deploy** in the editor top bar:
47
+
48
+ ```powershell
49
+ $env:VERCEL_TOKEN = 'your-token'
50
+ npm.cmd run visual-builder
51
+ ```
52
+
53
+ VisualBuild saves and builds this app locally and sends only the generated
54
+ `dist` files to Vercel. The editor package, `visualbuild` metadata,
55
+ `node_modules`, configuration source, and access token are never uploaded.
56
+ Use `VERCEL_TEAM_ID` or the optional Team ID field for a team-owned project.
@@ -0,0 +1,3 @@
1
+ {
2
+ "components": []
3
+ }
@@ -0,0 +1,48 @@
1
+ export type VisualBuildTheme =
2
+ | 'default'
3
+ | 'codex-dark'
4
+ | 'vs-light'
5
+ | 'vs-dark'
6
+ | 'system'
7
+ | 'dark'
8
+ | 'light'
9
+ export type VisualBuildViewport = 'mobile' | 'tablet' | 'desktop'
10
+
11
+ export interface VisualBuildConfig {
12
+ paths?: {
13
+ sourceDir?: string
14
+ pagesDir?: string
15
+ layoutsDir?: string
16
+ appFile?: string
17
+ schemaFile?: string
18
+ componentRegistryFile?: string
19
+ generatedManifestFile?: string
20
+ }
21
+ editor?: {
22
+ theme?: VisualBuildTheme
23
+ defaultViewport?: VisualBuildViewport
24
+ responsiveWidths?: {
25
+ mobile?: number
26
+ tablet?: number
27
+ desktop?: number | 'fluid'
28
+ }
29
+ panels?: {
30
+ leftOpen?: boolean
31
+ leftTab?: 'files' | 'elements'
32
+ rightOpen?: boolean
33
+ rightTab?: 'code' | 'properties'
34
+ codeView?: 'page' | 'app' | 'layout' | 'schema' | 'file'
35
+ }
36
+ }
37
+ generator?: {
38
+ emitApp?: boolean
39
+ emitLayout?: boolean
40
+ cleanStaleFiles?: boolean
41
+ }
42
+ deployment?: {
43
+ provider?: 'vercel'
44
+ outputDirectory?: string
45
+ projectName?: string
46
+ teamId?: string
47
+ }
48
+ }
@@ -0,0 +1,38 @@
1
+ import type { VisualBuildConfig } from './visualbuild/config'
2
+
3
+ export default {
4
+ paths: {
5
+ sourceDir: 'src',
6
+ pagesDir: 'src/pages',
7
+ layoutsDir: 'src/layouts',
8
+ appFile: 'src/App.tsx',
9
+ schemaFile: 'visualbuild/pages.json',
10
+ componentRegistryFile: 'visualbuild/components.json',
11
+ generatedManifestFile: 'visualbuild/generated-files.json',
12
+ },
13
+ editor: {
14
+ theme: 'default',
15
+ defaultViewport: 'desktop',
16
+ responsiveWidths: {
17
+ mobile: 390,
18
+ tablet: 768,
19
+ desktop: 'fluid',
20
+ },
21
+ panels: {
22
+ leftOpen: true,
23
+ leftTab: 'elements',
24
+ rightOpen: true,
25
+ rightTab: 'properties',
26
+ codeView: 'page',
27
+ },
28
+ },
29
+ generator: {
30
+ emitApp: true,
31
+ emitLayout: true,
32
+ cleanStaleFiles: true,
33
+ },
34
+ deployment: {
35
+ provider: 'vercel',
36
+ outputDirectory: 'dist',
37
+ },
38
+ } satisfies VisualBuildConfig
@@ -1,21 +1,37 @@
1
- # VisualBuild Editor
2
-
3
- This package contains the optional VisualBuild editor and generator for the
4
- sibling `__PROJECT_NAME__` React application.
5
-
6
- ## Run
7
-
8
- ```powershell
9
- npm install
10
- npm.cmd run visual-builder
11
- ```
12
-
13
- ## Generate Without Opening The Editor
14
-
15
- ```powershell
16
- npm.cmd run vb:generate
17
- ```
18
-
19
- The editor reads and writes `../__PROJECT_NAME__/visualbuild/pages.json` and
20
- manages generated files in `../__PROJECT_NAME__/src`. It is intentionally
21
- separate from the deployable application and does not need to be deployed.
1
+ # VisualBuild Editor
2
+
3
+ This package contains the optional VisualBuild editor and generator for the
4
+ sibling `__PROJECT_NAME__` React application.
5
+
6
+ Read [`../VISUALBUILD-GUIDE.md`](../VISUALBUILD-GUIDE.md) for the complete
7
+ visual editing, registry, code workspace, synchronization, configuration,
8
+ deployment, and recovery workflow.
9
+
10
+ ## Run
11
+
12
+ ```powershell
13
+ npm install
14
+ npm.cmd run visual-builder
15
+ ```
16
+
17
+ To enable one-click Vercel deployment, set the access token in this terminal
18
+ before starting the editor:
19
+
20
+ ```powershell
21
+ $env:VERCEL_TOKEN = 'your-token'
22
+ npm.cmd run visual-builder
23
+ ```
24
+
25
+ The token remains in this local process and is never written to the app or sent
26
+ to the browser. An optional `VERCEL_TEAM_ID` scopes deployments to a team.
27
+
28
+ ## Generate Without Opening The Editor
29
+
30
+ ```powershell
31
+ npm.cmd run vb:generate
32
+ ```
33
+
34
+ The editor reads and writes `../__PROJECT_NAME__/visualbuild/pages.json` and
35
+ manages generated files in `../__PROJECT_NAME__/src`. It is intentionally
36
+ separate from the deployable application and does not need to be deployed.
37
+ The Deploy action builds the sibling app and uploads only its static output.