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
@@ -0,0 +1,2 @@
1
+ export function toReactComponentName(fileName: string): string
2
+ export function createReactComponentSource(fileName: string): string
@@ -0,0 +1,45 @@
1
+ export function toReactComponentName(fileName) {
2
+ const baseName = String(fileName)
3
+ .replace(/\.(jsx|tsx)$/i, '')
4
+ .trim()
5
+ const name = baseName
6
+ .split(/[^A-Za-z0-9]+/)
7
+ .filter(Boolean)
8
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
9
+ .join('')
10
+ const candidate = name || 'Component'
11
+
12
+ return /^[A-Za-z_$]/.test(candidate)
13
+ ? candidate
14
+ : `Component${candidate}`
15
+ }
16
+
17
+ export function createReactComponentSource(fileName) {
18
+ const extension = String(fileName).split('.').pop()?.toLowerCase()
19
+
20
+ if (extension !== 'jsx' && extension !== 'tsx') {
21
+ return ''
22
+ }
23
+
24
+ const componentName = toReactComponentName(fileName)
25
+
26
+ if (extension === 'tsx') {
27
+ return `export default function ${componentName}() {
28
+ return (
29
+ <div>
30
+ <h1>${componentName}</h1>
31
+ </div>
32
+ )
33
+ }
34
+ `
35
+ }
36
+
37
+ return `export default function ${componentName}() {
38
+ return (
39
+ <div>
40
+ <h1>${componentName}</h1>
41
+ </div>
42
+ )
43
+ }
44
+ `
45
+ }
@@ -1,37 +1,57 @@
1
- export interface SourceVisualNode {
2
- id?: string
3
- type: string
4
- props?: Record<string, unknown>
5
- children?: SourceVisualNode[]
6
- }
7
-
8
- export interface SourcePage {
9
- id?: string
10
- name: string
11
- route: string
12
- sourcePath?: string
13
- root?: SourceVisualNode
14
- components?: SourceVisualNode[]
15
- }
16
-
17
- export interface SourceAppShell {
18
- header: SourceVisualNode | null
19
- footer: SourceVisualNode | null
20
- }
21
-
22
- export function generatePageSource(page: SourcePage): string
23
- export function generateAppSource(
24
- pages: SourcePage[],
25
- appShell?: SourceAppShell
26
- ): string
27
- export function generateLayoutSource(appShell: SourceAppShell): string
28
- export function generateNodeSource(
29
- node: SourceVisualNode,
30
- indent?: string
31
- ): string
32
- export function toPageComponentName(name: string): string
33
- export function getPageSourcePath(
34
- page: Pick<SourcePage, 'name' | 'sourcePath'>
35
- ): string
36
- export function createPageSourcePath(name: string): string
37
- export function normalizeProjectPath(value: string): string
1
+ export interface SourceVisualNode {
2
+ id?: string
3
+ type: string
4
+ props?: Record<string, unknown>
5
+ children?: SourceVisualNode[]
6
+ }
7
+
8
+ export interface SourceCustomComponent {
9
+ name: string
10
+ importPath: string
11
+ exportName: 'default' | string
12
+ }
13
+
14
+ export interface SourcePage {
15
+ id?: string
16
+ name: string
17
+ route: string
18
+ sourcePath?: string
19
+ root?: SourceVisualNode
20
+ components?: SourceVisualNode[]
21
+ }
22
+
23
+ export interface SourceAppShell {
24
+ header: SourceVisualNode | null
25
+ footer: SourceVisualNode | null
26
+ }
27
+
28
+ export function generatePageSource(
29
+ page: SourcePage,
30
+ customComponents?: SourceCustomComponent[]
31
+ ): string
32
+ export function generateAppSource(
33
+ pages: SourcePage[],
34
+ appShell?: SourceAppShell,
35
+ options?: {
36
+ appFile?: string
37
+ layoutFile?: string
38
+ emitLayout?: boolean
39
+ }
40
+ ): string
41
+ export function generateLayoutSource(
42
+ appShell: SourceAppShell,
43
+ customComponents?: SourceCustomComponent[],
44
+ options?: {
45
+ layoutFile?: string
46
+ }
47
+ ): string
48
+ export function generateNodeSource(
49
+ node: SourceVisualNode,
50
+ indent?: string
51
+ ): string
52
+ export function toPageComponentName(name: string): string
53
+ export function getPageSourcePath(
54
+ page: Pick<SourcePage, 'name' | 'sourcePath'>
55
+ ): string
56
+ export function createPageSourcePath(name: string, pagesDir?: string): string
57
+ export function normalizeProjectPath(value: string): string