@ramme-io/create-app 1.1.9 → 1.2.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/package.json +4 -3
- package/template/pkg.json +16 -13
- package/template/src/App.tsx +14 -7
- package/template/src/blocks/SmartTable.tsx +191 -0
- package/template/src/components/AutoForm.tsx +128 -0
- package/template/src/components/DynamicBlock.tsx +37 -31
- package/template/src/components/dev/GhostOverlay.tsx +26 -59
- package/template/src/config/app.manifest.ts +48 -48
- package/template/src/core/component-registry.tsx +21 -41
- package/template/src/core/data-seeder.ts +35 -0
- package/template/src/data/mockData.ts +163 -34
- package/template/src/generated/hooks.ts +34 -55
- package/template/src/hooks/useDataQuery.ts +84 -0
- package/template/src/hooks/useSignal.ts +43 -33
- package/template/src/hooks/useWorkflowEngine.ts +6 -0
- package/template/src/pages/Dashboard.tsx +43 -90
- package/template/src/pages/DynamicPage.tsx +54 -22
- package/template/src/templates/dashboard/DashboardLayout.tsx +2 -0
- package/template/src/templates/dashboard/dashboard.sitemap.ts +23 -73
- package/template/src/types/schema.ts +84 -31
|
@@ -1,85 +1,138 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
|
-
// 1.
|
|
4
|
+
// 1. DATA RESOURCE DEFINITIONS (SaaS Layer)
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
export const FieldSchema = z.object({
|
|
8
|
+
key: z.string(),
|
|
9
|
+
label: z.string(),
|
|
10
|
+
type: z.enum(['text', 'number', 'currency', 'date', 'boolean', 'status', 'email', 'image', 'textarea']),
|
|
11
|
+
required: z.boolean().optional(),
|
|
12
|
+
description: z.string().optional(),
|
|
13
|
+
defaultValue: z.any().optional(),
|
|
14
|
+
});
|
|
15
|
+
export type FieldDefinition = z.infer<typeof FieldSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResourceSchema = z.object({
|
|
18
|
+
id: z.string(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
fields: z.array(FieldSchema),
|
|
21
|
+
defaultView: z.enum(['table', 'grid', 'list']).optional(),
|
|
22
|
+
features: z.object({
|
|
23
|
+
searchable: z.boolean().optional(),
|
|
24
|
+
creatable: z.boolean().optional(),
|
|
25
|
+
editable: z.boolean().optional(),
|
|
26
|
+
deletable: z.boolean().optional(),
|
|
27
|
+
exportable: z.boolean().optional(),
|
|
28
|
+
}).optional(),
|
|
29
|
+
});
|
|
30
|
+
export type ResourceDefinition = z.infer<typeof ResourceSchema>;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// ------------------------------------------------------------------
|
|
34
|
+
// 2. SIGNAL & IOT DEFINITIONS (Physical Layer)
|
|
35
|
+
// ------------------------------------------------------------------
|
|
36
|
+
|
|
6
37
|
export const SignalSchema = z.object({
|
|
7
38
|
id: z.string().min(1, "Signal ID is required"),
|
|
8
39
|
label: z.string(),
|
|
9
40
|
description: z.string().optional(),
|
|
10
|
-
|
|
11
|
-
// Classification
|
|
12
41
|
kind: z.enum(['sensor', 'actuator', 'setpoint', 'metric', 'status', 'kpi']),
|
|
13
|
-
|
|
14
|
-
// Data Source Configuration
|
|
15
42
|
source: z.enum(['mock', 'mqtt', 'http', 'derived', 'local']),
|
|
16
43
|
|
|
17
|
-
//
|
|
18
|
-
topic: z.string().optional(),
|
|
19
|
-
endpoint: z.string().optional(),
|
|
20
|
-
jsonPath: z.string().optional(),
|
|
44
|
+
// Connectivity
|
|
45
|
+
topic: z.string().optional(),
|
|
46
|
+
endpoint: z.string().optional(),
|
|
47
|
+
jsonPath: z.string().optional(),
|
|
21
48
|
refreshRate: z.number().optional().default(1000),
|
|
22
49
|
|
|
23
|
-
//
|
|
50
|
+
// Values
|
|
24
51
|
defaultValue: z.any().optional(),
|
|
25
52
|
unit: z.string().optional(),
|
|
26
|
-
|
|
27
|
-
// Validation
|
|
28
53
|
min: z.number().optional(),
|
|
29
54
|
max: z.number().optional(),
|
|
30
55
|
});
|
|
31
|
-
|
|
32
56
|
export type SignalDefinition = z.infer<typeof SignalSchema>;
|
|
33
57
|
|
|
34
|
-
|
|
35
|
-
// ------------------------------------------------------------------
|
|
36
|
-
// 2. Entity Schema
|
|
37
|
-
// ------------------------------------------------------------------
|
|
38
58
|
export const EntitySchema = z.object({
|
|
39
59
|
id: z.string(),
|
|
40
60
|
name: z.string(),
|
|
41
61
|
description: z.string().optional(),
|
|
42
|
-
|
|
43
|
-
// Taxonomy
|
|
44
62
|
type: z.string(),
|
|
45
63
|
category: z.string().default('logical'),
|
|
46
|
-
|
|
47
|
-
// Linkage
|
|
48
64
|
signals: z.array(z.string()),
|
|
49
|
-
|
|
50
|
-
// UI Hints
|
|
51
65
|
ui: z.object({
|
|
52
66
|
icon: z.string().optional(),
|
|
53
67
|
color: z.string().optional(),
|
|
54
68
|
dashboardComponent: z.string().optional(),
|
|
55
69
|
}).optional(),
|
|
56
70
|
});
|
|
57
|
-
|
|
58
|
-
// <--- THIS WAS MISSING
|
|
59
71
|
export type EntityDefinition = z.infer<typeof EntitySchema>;
|
|
60
72
|
|
|
61
73
|
|
|
62
74
|
// ------------------------------------------------------------------
|
|
63
|
-
// 3.
|
|
75
|
+
// 3. UI LAYOUT DEFINITIONS (Presentation Layer)
|
|
64
76
|
// ------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
export const BlockSchema = z.object({
|
|
79
|
+
id: z.string(),
|
|
80
|
+
type: z.string(),
|
|
81
|
+
// ✅ FIX: Explicitly define Key and Value types
|
|
82
|
+
props: z.record(z.string(), z.any()),
|
|
83
|
+
layout: z.object({
|
|
84
|
+
colSpan: z.number().optional(),
|
|
85
|
+
rowSpan: z.number().optional(),
|
|
86
|
+
}).optional(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const PageSectionSchema = z.object({
|
|
90
|
+
id: z.string(),
|
|
91
|
+
title: z.string().optional(),
|
|
92
|
+
description: z.string().optional(),
|
|
93
|
+
layout: z.object({
|
|
94
|
+
columns: z.number().optional(),
|
|
95
|
+
variant: z.enum(['grid', 'stack', 'split']).optional()
|
|
96
|
+
}).optional(),
|
|
97
|
+
blocks: z.array(BlockSchema),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const PageSchema = z.object({
|
|
101
|
+
id: z.string(),
|
|
102
|
+
slug: z.string(),
|
|
103
|
+
title: z.string(),
|
|
104
|
+
description: z.string().optional(),
|
|
105
|
+
icon: z.string().optional(),
|
|
106
|
+
sections: z.array(PageSectionSchema),
|
|
107
|
+
});
|
|
108
|
+
export type PageDefinition = z.infer<typeof PageSchema>;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// MASTER APP SPECIFICATION
|
|
65
112
|
export const AppSpecificationSchema = z.object({
|
|
66
113
|
meta: z.object({
|
|
67
114
|
name: z.string(),
|
|
68
115
|
version: z.string(),
|
|
69
116
|
description: z.string().optional(),
|
|
70
117
|
author: z.string().optional(),
|
|
71
|
-
createdAt: z.string().optional(),
|
|
118
|
+
createdAt: z.string().optional(), // <--- ADD THIS LINE
|
|
119
|
+
}),
|
|
120
|
+
|
|
121
|
+
config: z.object({
|
|
122
|
+
theme: z.enum(['light', 'dark', 'system', 'corporate', 'midnight', 'blueprint']).default('system'),
|
|
123
|
+
mockMode: z.boolean().default(true),
|
|
124
|
+
brokerUrl: z.string().optional(),
|
|
72
125
|
}),
|
|
126
|
+
|
|
127
|
+
modules: z.array(z.string()).optional(),
|
|
128
|
+
resources: z.array(ResourceSchema).optional(),
|
|
73
129
|
|
|
74
130
|
domain: z.object({
|
|
75
131
|
signals: z.array(SignalSchema),
|
|
76
132
|
entities: z.array(EntitySchema),
|
|
77
133
|
}),
|
|
78
134
|
|
|
79
|
-
|
|
80
|
-
theme: z.enum(['light', 'dark', 'system', 'corporate', 'midnight', 'blueprint']).default('system'),
|
|
81
|
-
mockMode: z.boolean().default(true),
|
|
82
|
-
}),
|
|
135
|
+
pages: z.array(PageSchema).optional(),
|
|
83
136
|
});
|
|
84
137
|
|
|
85
138
|
export type AppSpecification = z.infer<typeof AppSpecificationSchema>;
|