@llmnative/react 0.1.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.
Files changed (150) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +375 -0
  3. package/bin/cli.js +99 -0
  4. package/dist/index.css +1 -0
  5. package/dist/index.js +838 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +12161 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/types/src/App.d.ts +64 -0
  10. package/dist/types/src/Config.d.ts +65 -0
  11. package/dist/types/src/Global.d.ts +12 -0
  12. package/dist/types/src/Head.d.ts +193 -0
  13. package/dist/types/src/Theme.d.ts +335 -0
  14. package/dist/types/src/auth.d.ts +27 -0
  15. package/dist/types/src/components/Component.d.ts +55 -0
  16. package/dist/types/src/components/FormEnhancer.d.ts +26 -0
  17. package/dist/types/src/components/Template.d.ts +18 -0
  18. package/dist/types/src/components/blocks/Brand.d.ts +14 -0
  19. package/dist/types/src/components/blocks/Breadcrumbs.d.ts +8 -0
  20. package/dist/types/src/components/blocks/Carousel.d.ts +19 -0
  21. package/dist/types/src/components/blocks/Dropdown.d.ts +64 -0
  22. package/dist/types/src/components/blocks/Menu.d.ts +24 -0
  23. package/dist/types/src/components/blocks/Notifications.d.ts +15 -0
  24. package/dist/types/src/components/blocks/Search.d.ts +7 -0
  25. package/dist/types/src/components/index.d.ts +52 -0
  26. package/dist/types/src/components/types.d.ts +11 -0
  27. package/dist/types/src/components/ui/Alert.d.ts +13 -0
  28. package/dist/types/src/components/ui/Badge.d.ts +27 -0
  29. package/dist/types/src/components/ui/Buttons.d.ts +57 -0
  30. package/dist/types/src/components/ui/Card.d.ts +15 -0
  31. package/dist/types/src/components/ui/Code.d.ts +25 -0
  32. package/dist/types/src/components/ui/Gallery.d.ts +55 -0
  33. package/dist/types/src/components/ui/GridSystem.d.ts +21 -0
  34. package/dist/types/src/components/ui/Icon.d.ts +13 -0
  35. package/dist/types/src/components/ui/Image.d.ts +19 -0
  36. package/dist/types/src/components/ui/ImageAvatar.d.ts +16 -0
  37. package/dist/types/src/components/ui/LayoutBuilder.d.ts +19 -0
  38. package/dist/types/src/components/ui/Loader.d.ts +11 -0
  39. package/dist/types/src/components/ui/Modal.d.ts +39 -0
  40. package/dist/types/src/components/ui/Pagination.d.ts +18 -0
  41. package/dist/types/src/components/ui/Percentage.d.ts +19 -0
  42. package/dist/types/src/components/ui/Repeat.d.ts +18 -0
  43. package/dist/types/src/components/ui/Tab.d.ts +20 -0
  44. package/dist/types/src/components/ui/TabDynamic.d.ts +20 -0
  45. package/dist/types/src/components/ui/Table.d.ts +43 -0
  46. package/dist/types/src/components/ui/fields/AssistantAI.d.ts +23 -0
  47. package/dist/types/src/components/ui/fields/Command.d.ts +15 -0
  48. package/dist/types/src/components/ui/fields/Crop.d.ts +27 -0
  49. package/dist/types/src/components/ui/fields/ImageUrl.d.ts +7 -0
  50. package/dist/types/src/components/ui/fields/Input.d.ts +62 -0
  51. package/dist/types/src/components/ui/fields/Prompt.d.ts +31 -0
  52. package/dist/types/src/components/ui/fields/Select.d.ts +38 -0
  53. package/dist/types/src/components/ui/fields/Upload.d.ts +25 -0
  54. package/dist/types/src/components/ui/fields/UploadCSV.d.ts +26 -0
  55. package/dist/types/src/components/ui/useRecordSelection.d.ts +20 -0
  56. package/dist/types/src/components/ui/useStableRecordKey.d.ts +5 -0
  57. package/dist/types/src/components/widgets/Form.d.ts +129 -0
  58. package/dist/types/src/components/widgets/Grid.d.ts +6 -0
  59. package/dist/types/src/components/widgets/ImageEditor.d.ts +14 -0
  60. package/dist/types/src/components/widgets/MarkdownReader.d.ts +14 -0
  61. package/dist/types/src/components/widgets/Prompt.d.ts +31 -0
  62. package/dist/types/src/components/widgets/TabDynamic.d.ts +20 -0
  63. package/dist/types/src/components/widgets/grid-core/GridArray.d.ts +5 -0
  64. package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +5 -0
  65. package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +5 -0
  66. package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +5 -0
  67. package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +5 -0
  68. package/dist/types/src/components/widgets/grid-core/index.d.ts +7 -0
  69. package/dist/types/src/components/widgets/grid-core/resolveGridPathFromUrl.d.ts +1 -0
  70. package/dist/types/src/components/widgets/grid-core/types.d.ts +227 -0
  71. package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +49 -0
  72. package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +10 -0
  73. package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +10 -0
  74. package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +10 -0
  75. package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +13 -0
  76. package/dist/types/src/components/widgets/grid-core/utils.d.ts +14 -0
  77. package/dist/types/src/conf/Prompt.d.ts +84 -0
  78. package/dist/types/src/constant.d.ts +96 -0
  79. package/dist/types/src/index.d.ts +56 -0
  80. package/dist/types/src/libs/cache.d.ts +9 -0
  81. package/dist/types/src/libs/cn.d.ts +2 -0
  82. package/dist/types/src/libs/converter.d.ts +28 -0
  83. package/dist/types/src/libs/database.d.ts +3 -0
  84. package/dist/types/src/libs/email.d.ts +16 -0
  85. package/dist/types/src/libs/fetch.d.ts +9 -0
  86. package/dist/types/src/libs/imageBuilder.d.ts +112 -0
  87. package/dist/types/src/libs/index.d.ts +14 -0
  88. package/dist/types/src/libs/locale.d.ts +24 -0
  89. package/dist/types/src/libs/log.d.ts +2 -0
  90. package/dist/types/src/libs/order.d.ts +14 -0
  91. package/dist/types/src/libs/path.d.ts +26 -0
  92. package/dist/types/src/libs/sanitizer.d.ts +38 -0
  93. package/dist/types/src/libs/seo.d.ts +8 -0
  94. package/dist/types/src/libs/storage.d.ts +2 -0
  95. package/dist/types/src/libs/utils.d.ts +57 -0
  96. package/dist/types/src/motion.d.ts +38 -0
  97. package/dist/types/src/pages/Blog.d.ts +3 -0
  98. package/dist/types/src/pages/BlogPost.d.ts +16 -0
  99. package/dist/types/src/pages/Helper.d.ts +8 -0
  100. package/dist/types/src/pages/NotFound.d.ts +3 -0
  101. package/dist/types/src/pages/Users.d.ts +3 -0
  102. package/dist/types/src/pages/index.d.ts +3 -0
  103. package/dist/types/src/providers/ProviderConfiguration.d.ts +12 -0
  104. package/dist/types/src/providers/ai/index.d.ts +134 -0
  105. package/dist/types/src/providers/auth/AuthProvider.d.ts +22 -0
  106. package/dist/types/src/providers/auth/AuthProviderContext.d.ts +12 -0
  107. package/dist/types/src/providers/auth/dropbox/DropboxAuthProvider.d.ts +16 -0
  108. package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +44 -0
  109. package/dist/types/src/providers/auth/google/GoogleAuthProvider.d.ts +12 -0
  110. package/dist/types/src/providers/auth/google/apis/auth.d.ts +4 -0
  111. package/dist/types/src/providers/auth/google/auth.d.ts +3 -0
  112. package/dist/types/src/providers/data/DataProvider.d.ts +58 -0
  113. package/dist/types/src/providers/data/DataProviderContext.d.ts +12 -0
  114. package/dist/types/src/providers/data/firebase.d.ts +21 -0
  115. package/dist/types/src/providers/data/mock.d.ts +20 -0
  116. package/dist/types/src/providers/data/supabase.d.ts +19 -0
  117. package/dist/types/src/providers/email/EmailProvider.d.ts +10 -0
  118. package/dist/types/src/providers/email/EmailProviderContext.d.ts +12 -0
  119. package/dist/types/src/providers/email/google/GmailEmailProvider.d.ts +7 -0
  120. package/dist/types/src/providers/email/google/apis/email.d.ts +7 -0
  121. package/dist/types/src/providers/email/google/email.d.ts +13 -0
  122. package/dist/types/src/providers/firebase-init.d.ts +10 -0
  123. package/dist/types/src/providers/icon/IconProvider.d.ts +10 -0
  124. package/dist/types/src/providers/icon/IconProviderContext.d.ts +48 -0
  125. package/dist/types/src/providers/icon/LucideIconProvider.d.ts +5 -0
  126. package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +10 -0
  127. package/dist/types/src/providers/icon/index.d.ts +6 -0
  128. package/dist/types/src/providers/manifest.d.ts +42 -0
  129. package/dist/types/src/providers/scrape/index.d.ts +10 -0
  130. package/dist/types/src/providers/seo/google/keyword.d.ts +14 -0
  131. package/dist/types/src/providers/seo/google/trend.d.ts +25 -0
  132. package/dist/types/src/providers/storage/StorageProvider.d.ts +7 -0
  133. package/dist/types/src/providers/storage/StorageProviderContext.d.ts +12 -0
  134. package/dist/types/src/providers/storage/dropbox.d.ts +48 -0
  135. package/dist/types/src/providers/storage/firebase.d.ts +13 -0
  136. package/dist/types/src/providers/storage/supabase.d.ts +19 -0
  137. package/dist/types/src/types/Block.d.ts +4 -0
  138. package/dist/types/src/types/FormFields.d.ts +33 -0
  139. package/dist/types/src/types/Layout.d.ts +9 -0
  140. package/dist/types/src/types/Section.d.ts +4 -0
  141. package/dist/types/themes/cyber.d.ts +7 -0
  142. package/dist/types/themes/default.d.ts +7 -0
  143. package/dist/types/themes/flat.d.ts +7 -0
  144. package/package.json +126 -0
  145. package/scripts/cli/create-section.js +65 -0
  146. package/scripts/cli/setup-devtools.js +85 -0
  147. package/scripts/cli/setup-project.js +484 -0
  148. package/themes/cyber.ts +405 -0
  149. package/themes/default.ts +405 -0
  150. package/themes/flat.ts +405 -0
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { StorageProviderAdapter } from './StorageProvider';
3
+ type StorageProviderContextValue = {
4
+ registry: Record<string, StorageProviderAdapter>;
5
+ defaultKey: string;
6
+ };
7
+ declare const StorageProviderContext: React.Context<StorageProviderContextValue | null>;
8
+ export declare const StorageProvider: ({ registry, defaultKey, children, }: StorageProviderContextValue & {
9
+ children: React.ReactNode;
10
+ }) => React.JSX.Element;
11
+ export declare const useStorageProvider: (name?: string) => StorageProviderAdapter | null;
12
+ export default StorageProviderContext;
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import type { IButton } from "../../components/ui/Buttons";
3
+ interface ListFoldersParams {
4
+ path?: string;
5
+ recursive?: boolean;
6
+ }
7
+ type PathEntry = {
8
+ from: string;
9
+ to: string;
10
+ };
11
+ type ThumbnailEntry = {
12
+ path: string;
13
+ [key: string]: any;
14
+ };
15
+ type ThumbnailRequestOptions = {
16
+ thumbnailsRequest: ThumbnailEntry[];
17
+ size?: 'w32h32' | 'w64h64' | 'w128h128' | 'w256h256' | 'w480h320' | 'w640h480' | 'w960h640' | 'w1024h768' | 'w2048h1536';
18
+ format?: 'jpg' | 'jpeg' | 'png' | 'tiff' | 'tif' | 'gif' | 'webp' | 'ppm' | 'bmp';
19
+ mode?: 'strict' | 'bestfit' | 'fitone_bestfit' | 'original';
20
+ };
21
+ type ThumbnailResult = {
22
+ [path: string]: {
23
+ path: string;
24
+ thumbnail: string;
25
+ mimetype: string;
26
+ width: number;
27
+ height: number;
28
+ [key: string]: any;
29
+ };
30
+ };
31
+ export declare const resolvePath: (path: string, includeHost?: boolean) => string;
32
+ export declare const listFolders: ({ path, recursive }?: ListFoldersParams) => Promise<any[]>;
33
+ export declare const useDropBoxConnect: (renew?: boolean) => boolean;
34
+ export declare const DropBoxConnectButton: (options?: IButton) => React.ReactElement;
35
+ export declare const dropBox: {
36
+ setRootPath: (path: string) => void;
37
+ resolvePath: (path: string, includeHost?: boolean) => string;
38
+ createFolders: (paths: string[], basePath?: string) => Promise<any>;
39
+ deleteBulk: (paths: string[], basePath?: string) => Promise<any>;
40
+ addTags: (paths: Record<string, string[]>, basePath?: string) => Promise<void>;
41
+ listFolders: ({ path, recursive }?: ListFoldersParams) => Promise<any[]>;
42
+ getThumbnails: ({ thumbnailsRequest, size, format, mode, }: ThumbnailRequestOptions, setThumbnails?: (thumbs: ThumbnailResult) => void) => Promise<ThumbnailResult>;
43
+ search: (jobPath: string, startPath?: string, removeExtension?: boolean) => Promise<Record<string, string>>;
44
+ upload: (path: string, fileBase64: string) => Promise<void>;
45
+ copy: (paths: PathEntry[]) => Promise<any[]>;
46
+ move: (paths: PathEntry[]) => Promise<void>;
47
+ };
48
+ export {};
@@ -0,0 +1,13 @@
1
+ import "firebase/compat/storage";
2
+ import { StorageProviderAdapter } from "./StorageProvider";
3
+ import type { ProviderConfigurationState } from "../ProviderConfiguration";
4
+ export declare class FirebaseStorageProvider implements StorageProviderAdapter {
5
+ getConfigurationState(): ProviderConfigurationState;
6
+ isConfigured(): boolean;
7
+ upload: (file: string, path: string) => Promise<string | undefined>;
8
+ getURL: (path: string) => Promise<string | undefined>;
9
+ download: (path: string) => Promise<Blob | undefined>;
10
+ delete: (path: string) => Promise<boolean>;
11
+ }
12
+ declare const _default: FirebaseStorageProvider;
13
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { StorageProviderAdapter } from "./StorageProvider";
2
+ import { type ProviderConfigurationState } from "../ProviderConfiguration";
3
+ interface SupabaseStorageConfig {
4
+ url: string;
5
+ anonKey: string;
6
+ bucket?: string;
7
+ }
8
+ export declare class SupabaseStorageProvider implements StorageProviderAdapter {
9
+ private config;
10
+ constructor(config: SupabaseStorageConfig);
11
+ getConfigurationState(): ProviderConfigurationState;
12
+ isConfigured(): boolean;
13
+ private get bucket();
14
+ upload: (file: string, path: string) => Promise<string | undefined>;
15
+ getURL: (path: string) => Promise<string | undefined>;
16
+ download: (path: string) => Promise<Blob | undefined>;
17
+ delete: (path: string) => Promise<boolean>;
18
+ }
19
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface ComponentBlockMap {
2
+ }
3
+ declare const componentBlock: ComponentBlockMap;
4
+ export default componentBlock;
@@ -0,0 +1,33 @@
1
+ import { FieldFactory } from "../components/Component";
2
+ import { InputProps, TextAreaProps, CheckboxProps } from "../components/ui/fields/Input";
3
+ import { SelectProps } from "../components/ui/fields/Select";
4
+ import { ImageUrlProps } from "../components/ui/fields/ImageUrl";
5
+ import { UploadDocumentProps, UploadImageProps } from "../components/ui/fields/Upload";
6
+ import { PromptProps } from "../components/widgets/Prompt";
7
+ export interface ComponentFormFieldsMap {
8
+ string: FieldFactory<Partial<InputProps>>;
9
+ number: FieldFactory<Partial<InputProps>>;
10
+ email: FieldFactory<Partial<InputProps>>;
11
+ password: FieldFactory<Partial<InputProps>>;
12
+ color: FieldFactory<Partial<InputProps>>;
13
+ date: FieldFactory<Partial<InputProps>>;
14
+ time: FieldFactory<Partial<InputProps>>;
15
+ datetime: FieldFactory<Partial<InputProps>>;
16
+ week: FieldFactory<Partial<InputProps>>;
17
+ month: FieldFactory<Partial<InputProps>>;
18
+ textarea: FieldFactory<Partial<TextAreaProps>>;
19
+ checkbox: FieldFactory<Partial<CheckboxProps>>;
20
+ switch: FieldFactory<Partial<CheckboxProps>>;
21
+ select: FieldFactory<Partial<SelectProps>>;
22
+ autocomplete: FieldFactory<Partial<SelectProps>>;
23
+ checklist: FieldFactory<Partial<SelectProps>>;
24
+ uploadImage: FieldFactory<Partial<UploadImageProps>>;
25
+ uploadDocument: FieldFactory<Partial<UploadDocumentProps>>;
26
+ prompt: FieldFactory<Partial<PromptProps>>;
27
+ imageUrl: FieldFactory<Partial<ImageUrlProps>>;
28
+ menu: FieldFactory<{
29
+ defaultValue?: string;
30
+ }>;
31
+ }
32
+ declare const componentFormFields: ComponentFormFieldsMap;
33
+ export default componentFormFields;
@@ -0,0 +1,9 @@
1
+ import { Container, Wrapper, Row, Col } from "../components/ui/GridSystem";
2
+ export interface ComponentLayoutMap {
3
+ container: typeof Container;
4
+ wrapper: typeof Wrapper;
5
+ row: typeof Row;
6
+ col: typeof Col;
7
+ }
8
+ declare const componentLayout: ComponentLayoutMap;
9
+ export default componentLayout;
@@ -0,0 +1,4 @@
1
+ export interface ComponentSectionMap {
2
+ }
3
+ declare const componentSection: ComponentSectionMap;
4
+ export default componentSection;
@@ -0,0 +1,7 @@
1
+ import type { Theme, ThemeDefinition, ThemePresetConfig } from '../src/Theme';
2
+ import type { MotionRegistry } from '../src/motion';
3
+ export declare const preset: ThemePresetConfig;
4
+ export declare const motion: MotionRegistry;
5
+ export declare const components: Theme;
6
+ declare const definition: ThemeDefinition;
7
+ export default definition;
@@ -0,0 +1,7 @@
1
+ import type { Theme, ThemeDefinition, ThemePresetConfig } from '../src/Theme';
2
+ import type { MotionRegistry } from '../src/motion';
3
+ export declare const preset: ThemePresetConfig;
4
+ export declare const motion: MotionRegistry;
5
+ export declare const components: Theme;
6
+ declare const definition: ThemeDefinition;
7
+ export default definition;
@@ -0,0 +1,7 @@
1
+ import type { Theme, ThemeDefinition, ThemePresetConfig } from '../src/Theme';
2
+ import type { MotionRegistry } from '../src/motion';
3
+ export declare const preset: ThemePresetConfig;
4
+ export declare const motion: MotionRegistry;
5
+ export declare const components: Theme;
6
+ declare const definition: ThemeDefinition;
7
+ export default definition;
package/package.json ADDED
@@ -0,0 +1,126 @@
1
+ {
2
+ "name": "@llmnative/react",
3
+ "version": "0.1.0",
4
+ "description": "LLM-native React framework for deterministic UI generation. Data-driven by default, schema-driven optional. Ultra-low token consumption — built for AI agents, not just humans.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/types/src/index.d.ts",
8
+ "style": "dist/index.css",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./dist/index.css": "./dist/index.css"
16
+ },
17
+ "scripts": {
18
+ "prebuild": "node scripts/dev/build-local.js --restore-only",
19
+ "build": "vite build && tsc --emitDeclarationOnly",
20
+ "build:dev": "vite build --mode development && tsc --emitDeclarationOnly",
21
+ "watch:dev": "vite build --watch",
22
+ "build:local": "node scripts/dev/build-local.js",
23
+ "prepublishOnly": "npm run build",
24
+ "updateReadme": "node scripts/dev/updateReadme.js",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "test:coverage": "vitest run --coverage"
28
+ },
29
+ "bin": {
30
+ "llmnative": "./bin/cli.js"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "dist/**/*.map",
35
+ "bin",
36
+ "scripts/cli",
37
+ "themes"
38
+ ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/sherpadvisorylab/llmnative-react.git"
42
+ },
43
+ "keywords": [
44
+ "react",
45
+ "admin",
46
+ "dashboard",
47
+ "crud",
48
+ "schema-driven",
49
+ "admin-panel",
50
+ "backoffice",
51
+ "internal-tools",
52
+ "ai-first",
53
+ "ai-assisted",
54
+ "provider-agnostic",
55
+ "framework",
56
+ "typescript",
57
+ "tailwind",
58
+ "vite"
59
+ ],
60
+ "author": "wolfgan",
61
+ "license": "Apache-2.0",
62
+ "bugs": {
63
+ "url": "https://github.com/sherpadvisorylab/llmnative-react/issues"
64
+ },
65
+ "homepage": "https://github.com/sherpadvisorylab/llmnative-react#readme",
66
+ "peerDependencies": {
67
+ "@phosphor-icons/react": "^2.0.0",
68
+ "firebase": "^10.14.0",
69
+ "lucide-react": "^0.400.0",
70
+ "react": "^18.2.0",
71
+ "react-dom": "^18.2.0",
72
+ "react-router-dom": "^6.22.0"
73
+ },
74
+ "peerDependenciesMeta": {
75
+ "@phosphor-icons/react": {
76
+ "optional": true
77
+ },
78
+ "lucide-react": {
79
+ "optional": true
80
+ }
81
+ },
82
+ "devDependencies": {
83
+ "@babel/core": "^7.25.7",
84
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
85
+ "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
86
+ "@babel/preset-env": "^7.25.7",
87
+ "@babel/preset-react": "^7.25.7",
88
+ "@babel/preset-typescript": "^7.25.7",
89
+ "@phosphor-icons/react": "^2.1.10",
90
+ "@tailwindcss/postcss": "^4.2.4",
91
+ "@testing-library/jest-dom": "^6.9.1",
92
+ "@testing-library/react": "^16.3.2",
93
+ "@testing-library/user-event": "^14.6.1",
94
+ "@types/papaparse": "^5.3.16",
95
+ "@types/prismjs": "^1.26.5",
96
+ "@types/react": "^18.2.0",
97
+ "@types/react-dom": "^18.2.0",
98
+ "@vitest/coverage-v8": "2.1",
99
+ "autoprefixer": "^10.5.0",
100
+ "googleapis": "^171.4.0",
101
+ "happy-dom": "^20.9.0",
102
+ "jsdom": "^29.1.1",
103
+ "lucide-react": "^1.14.0",
104
+ "postcss": "^8.5.14",
105
+ "react": "^19.2.5",
106
+ "react-dom": "^19.2.5",
107
+ "react-router-dom": "^6.30.3",
108
+ "tailwindcss": "^4.2.4",
109
+ "typescript": "^5.6.2",
110
+ "vite": "^5.4.21",
111
+ "vitest": "2.1"
112
+ },
113
+ "dependencies": {
114
+ "buffer": "^6.0.3",
115
+ "clsx": "^2.1.1",
116
+ "papaparse": "^5.5.3",
117
+ "prismjs": "^ 1.30.0",
118
+ "react-markdown": "^10.1.0",
119
+ "rehype-autolink-headings": "^7.1.0",
120
+ "rehype-sanitize": "^6.0.0",
121
+ "rehype-slug": "^6.0.0",
122
+ "remark-gfm": "^4.0.1",
123
+ "tailwind-merge": "^3.5.0",
124
+ "tui-image-editor": "^3.15.3"
125
+ }
126
+ }
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const sectionName = process.argv[2];
7
+
8
+ if (!sectionName) {
9
+ console.error('❌ Devi specificare il nome della sezione. Esempio: node create-section.js Hero');
10
+ process.exit(1);
11
+ }
12
+
13
+ const sectionFileName = `${sectionName}.js`;
14
+ const targetDir = path.join(__dirname, 'src', 'templates', 'sections');
15
+ const targetPath = path.join(targetDir, sectionFileName);
16
+
17
+ if (fs.existsSync(targetPath)) {
18
+ console.error(`❌ La sezione "${sectionName}" esiste già.`);
19
+ process.exit(1);
20
+ }
21
+
22
+ const content = `
23
+ // ${sectionName}.js - generato con create-section
24
+
25
+ const ${sectionName}Model = [
26
+ { name: 'title', type: 'text', label: 'Titolo' }
27
+ ];
28
+
29
+ function ${sectionName}EditorLayout({ fields }) {
30
+ return (
31
+ <div className="${sectionName.toLowerCase()}-editor">
32
+ <FormFields fields={fields} />
33
+ </div>
34
+ );
35
+ }
36
+
37
+ function ${sectionName}HtmlLayout({ fields }) {
38
+ return (
39
+ <div className="${sectionName.toLowerCase()}-html">
40
+ <StaticFields fields={fields} />
41
+ </div>
42
+ );
43
+ }
44
+
45
+ export function ${sectionName}Editor() {
46
+ return (
47
+ <Form model={${sectionName}Model}>
48
+ {(fields) => <${sectionName}EditorLayout fields={fields} />}
49
+ </Form>
50
+ );
51
+ }
52
+
53
+ export function ${sectionName}Html() {
54
+ return (
55
+ <StaticRenderer model={${sectionName}Model}>
56
+ {(fields) => <${sectionName}HtmlLayout fields={fields} />}
57
+ </StaticRenderer>
58
+ );
59
+ }
60
+ `;
61
+
62
+ fs.mkdirSync(targetDir, { recursive: true });
63
+ fs.writeFileSync(targetPath, content.trimStart());
64
+
65
+ console.log(`✅ Sezione "${sectionName}" creata in: ${targetPath}`);
@@ -0,0 +1,85 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const root = process.cwd();
5
+
6
+ function ensureFile(filePath, content) {
7
+ if (!fs.existsSync(filePath)) {
8
+ fs.writeFileSync(filePath, content.trimStart());
9
+ console.log(`Created file: ${filePath}`);
10
+ }
11
+ }
12
+
13
+ function setupDevTools() {
14
+ console.log('Setting up Vite + React + TypeScript');
15
+
16
+ ensureFile(path.join(root, 'tsconfig.json'), `
17
+ {
18
+ "compilerOptions": {
19
+ "target": "ES2021",
20
+ "useDefineForClassFields": true,
21
+ "lib": ["DOM", "DOM.Iterable", "ES2021"],
22
+ "allowJs": false,
23
+ "skipLibCheck": true,
24
+ "esModuleInterop": true,
25
+ "allowSyntheticDefaultImports": true,
26
+ "strict": true,
27
+ "forceConsistentCasingInFileNames": true,
28
+ "module": "ESNext",
29
+ "moduleResolution": "Bundler",
30
+ "resolveJsonModule": true,
31
+ "isolatedModules": true,
32
+ "noEmit": true,
33
+ "jsx": "react-jsx"
34
+ },
35
+ "include": ["src"],
36
+ "references": [{ "path": "./tsconfig.node.json" }]
37
+ }
38
+ `);
39
+
40
+ ensureFile(path.join(root, 'tsconfig.node.json'), `
41
+ {
42
+ "compilerOptions": {
43
+ "composite": true,
44
+ "skipLibCheck": true,
45
+ "module": "ESNext",
46
+ "moduleResolution": "Bundler",
47
+ "allowSyntheticDefaultImports": true,
48
+ "strict": true
49
+ },
50
+ "include": ["vite.config.ts"]
51
+ }
52
+ `);
53
+
54
+ ensureFile(path.join(root, 'vite.config.ts'), `
55
+ import { defineConfig } from 'vite';
56
+ import react from '@vitejs/plugin-react';
57
+
58
+ export default defineConfig(({ mode }) => {
59
+ return {
60
+ plugins: [react()],
61
+ resolve: {
62
+ dedupe: ['react', 'react-dom', 'react-router-dom'],
63
+ },
64
+ build: {
65
+ cssMinify: false,
66
+ chunkSizeWarningLimit: 10000,
67
+ },
68
+ define: {
69
+ 'process.env.NODE_ENV': JSON.stringify(mode === 'production' ? 'production' : 'development'),
70
+ },
71
+ };
72
+ });
73
+ `);
74
+
75
+ ensureFile(path.join(root, 'postcss.config.js'), `
76
+ export default {
77
+ plugins: {
78
+ '@tailwindcss/postcss': {},
79
+ autoprefixer: {},
80
+ },
81
+ };
82
+ `);
83
+ }
84
+
85
+ module.exports = { setupDevTools };