@specverse/engines 4.1.5 → 4.1.6
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/dist/libs/instance-factories/applications/templates/generic/backend-env-generator.js +22 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +66 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.js +54 -0
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +290 -0
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +530 -0
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +437 -0
- package/dist/libs/instance-factories/applications/templates/react/api-types-generator.js +146 -0
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +73 -0
- package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +18 -0
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +99 -0
- package/dist/libs/instance-factories/applications/templates/react/gitignore-generator.js +35 -0
- package/dist/libs/instance-factories/applications/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/applications/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/applications/templates/react/main-tsx-generator.js +29 -0
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +49 -0
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +156 -0
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +935 -0
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.js +101 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +50 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +646 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +65 -0
- package/dist/libs/instance-factories/applications/templates/react/tsconfig-generator.js +28 -0
- package/dist/libs/instance-factories/applications/templates/react/use-api-hooks-generator.js +132 -0
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +355 -0
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +91 -0
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +79 -0
- package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +42 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-bin-wrapper-generator.js +11 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +111 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +928 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/bus-generator.js +83 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/publisher-generator.js +91 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.js +86 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.js +93 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +280 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +125 -0
- package/dist/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.js +25 -0
- package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +371 -0
- package/dist/libs/instance-factories/orms/templates/prisma/services-generator.js +266 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-example-generator.js +51 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-generator.js +61 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.js +59 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/package-json-generator.js +126 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/readme-generator.js +159 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.js +56 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js +37 -0
- package/dist/libs/instance-factories/sdks/templates/python/sdk-generator.js +29 -0
- package/dist/libs/instance-factories/sdks/templates/typescript/sdk-generator.js +28 -0
- package/dist/libs/instance-factories/services/templates/memory/generate-interpreter.js +14 -0
- package/dist/libs/instance-factories/services/templates/memory/step-conventions-memory.js +415 -0
- package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +177 -0
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +413 -0
- package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +243 -0
- package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +264 -0
- package/dist/libs/instance-factories/services/templates/shared-patterns.js +24 -0
- package/dist/libs/instance-factories/shared/path-resolver.js +59 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/config-generator.js +13 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/docker-generator.js +16 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/config-generator.js +45 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/docker-generator.js +46 -0
- package/dist/libs/instance-factories/storage/templates/redis/config-generator.js +14 -0
- package/dist/libs/instance-factories/storage/templates/redis/docker-generator.js +16 -0
- package/dist/libs/instance-factories/test-generation.js +145 -0
- package/dist/libs/instance-factories/testing/templates/vitest/tests-generator.js +30 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +149 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.js +232 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.js +49 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/index.js +18 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.js +0 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.js +97 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.js +64 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.js +182 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.js +1210 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.js +172 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.js +240 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.js +147 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.js +281 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.js +409 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.js +414 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.js +467 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.js +135 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/types/index.js +0 -0
- package/dist/libs/instance-factories/tools/templates/vscode/static/extension.js +965 -0
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +238 -0
- package/dist/libs/instance-factories/validation/templates/zod/validation-generator.js +25 -0
- package/dist/libs/instance-factories/views/index.js +48 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +742 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +824 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +719 -0
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +45 -0
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +779 -0
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +285 -0
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +46 -0
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +111 -0
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +21 -0
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +299 -0
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +136 -0
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +107 -0
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +179 -0
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +7 -0
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +56 -0
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +27 -0
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +29 -0
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +261 -0
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +34 -0
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +800 -0
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +305 -0
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +517 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +445 -0
- package/dist/libs/instance-factories/views/templates/shared/index.js +80 -0
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +210 -0
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +492 -0
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +321 -0
- package/package.json +3 -2
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
const shadcnAdapter = {
|
|
2
|
+
name: "shadcn/ui",
|
|
3
|
+
version: "latest",
|
|
4
|
+
description: "shadcn/ui component library adapter",
|
|
5
|
+
baseDependencies: [
|
|
6
|
+
{ name: "react", version: "^18.2.0" },
|
|
7
|
+
{ name: "react-dom", version: "^18.2.0" },
|
|
8
|
+
{ name: "tailwindcss", version: "^3.4.0" },
|
|
9
|
+
{ name: "@radix-ui/react-icons", version: "^1.3.0" },
|
|
10
|
+
{ name: "class-variance-authority", version: "^0.7.0" },
|
|
11
|
+
{ name: "clsx", version: "^2.0.0" },
|
|
12
|
+
{ name: "tailwind-merge", version: "^2.0.0" }
|
|
13
|
+
],
|
|
14
|
+
config: {
|
|
15
|
+
importPrefix: "@/components/ui",
|
|
16
|
+
importStyle: "named"
|
|
17
|
+
},
|
|
18
|
+
components: {
|
|
19
|
+
// =====================================================================
|
|
20
|
+
// DATA DISPLAY (9 types)
|
|
21
|
+
// =====================================================================
|
|
22
|
+
table: {
|
|
23
|
+
imports: [
|
|
24
|
+
"import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell } from '@/components/ui/table'"
|
|
25
|
+
],
|
|
26
|
+
render: (ctx) => {
|
|
27
|
+
const { properties, model, name } = ctx;
|
|
28
|
+
const columns = properties.columns || ["id"];
|
|
29
|
+
const modelVar = model?.name?.toLowerCase() || "item";
|
|
30
|
+
const pluralVar = `${modelVar}s`;
|
|
31
|
+
return `<Table>
|
|
32
|
+
<TableHeader>
|
|
33
|
+
<TableRow>
|
|
34
|
+
${columns.map((col) => `<TableHead>${col}</TableHead>`).join("\n ")}
|
|
35
|
+
</TableRow>
|
|
36
|
+
</TableHeader>
|
|
37
|
+
<TableBody>
|
|
38
|
+
{${pluralVar}?.map((${modelVar}) => (
|
|
39
|
+
<TableRow key={${modelVar}.id}>
|
|
40
|
+
${columns.map((col) => `<TableCell>{${modelVar}.${col}}</TableCell>`).join("\n ")}
|
|
41
|
+
</TableRow>
|
|
42
|
+
))}
|
|
43
|
+
</TableBody>
|
|
44
|
+
</Table>`;
|
|
45
|
+
},
|
|
46
|
+
dependencies: [{ name: "@/components/ui/table", version: "latest" }]
|
|
47
|
+
},
|
|
48
|
+
list: {
|
|
49
|
+
imports: ["import { ScrollArea } from '@/components/ui/scroll-area'"],
|
|
50
|
+
render: (ctx) => {
|
|
51
|
+
const { properties, children } = ctx;
|
|
52
|
+
const className = properties.dense ? "space-y-1" : "space-y-4";
|
|
53
|
+
return `<ScrollArea className="${className}">
|
|
54
|
+
${children || "/* List items */"}
|
|
55
|
+
</ScrollArea>`;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
grid: {
|
|
59
|
+
imports: [],
|
|
60
|
+
render: (ctx) => {
|
|
61
|
+
const { properties, children } = ctx;
|
|
62
|
+
const columns = properties.columns || 3;
|
|
63
|
+
const gap = properties.gap === "small" ? "2" : properties.gap === "large" ? "8" : "4";
|
|
64
|
+
return `<div className="grid grid-cols-${columns} gap-${gap}">
|
|
65
|
+
${children || "/* Grid items */"}
|
|
66
|
+
</div>`;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
card: {
|
|
70
|
+
imports: [
|
|
71
|
+
"import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@/components/ui/card'"
|
|
72
|
+
],
|
|
73
|
+
render: (ctx) => {
|
|
74
|
+
const { properties, children } = ctx;
|
|
75
|
+
const { title, subtitle, variant } = properties;
|
|
76
|
+
if (variant === "metric") {
|
|
77
|
+
return `<Card>
|
|
78
|
+
<CardHeader>
|
|
79
|
+
<CardTitle className="text-sm font-medium">${title || properties.metric || "Metric"}</CardTitle>
|
|
80
|
+
</CardHeader>
|
|
81
|
+
<CardContent>
|
|
82
|
+
<div className="text-2xl font-bold">{/* Value */}</div>
|
|
83
|
+
${properties.showTrend ? '<p className="text-xs text-muted-foreground">\u2191 12% from last month</p>' : ""}
|
|
84
|
+
</CardContent>
|
|
85
|
+
</Card>`;
|
|
86
|
+
}
|
|
87
|
+
return `<Card>
|
|
88
|
+
${title ? `<CardHeader>
|
|
89
|
+
<CardTitle>${title}</CardTitle>
|
|
90
|
+
${subtitle ? `<CardDescription>${subtitle}</CardDescription>` : ""}
|
|
91
|
+
</CardHeader>` : ""}
|
|
92
|
+
<CardContent>
|
|
93
|
+
${children || "/* Card content */"}
|
|
94
|
+
</CardContent>
|
|
95
|
+
</Card>`;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
chart: {
|
|
99
|
+
imports: [
|
|
100
|
+
"import { LineChart, Line, BarChart, Bar, PieChart, Pie, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'"
|
|
101
|
+
],
|
|
102
|
+
render: (ctx) => {
|
|
103
|
+
const { properties } = ctx;
|
|
104
|
+
const chartType = properties.chartType || "line";
|
|
105
|
+
const chartMap = {
|
|
106
|
+
line: '<LineChart data={data}><CartesianGrid strokeDasharray="3 3" /><XAxis dataKey="name" /><YAxis /><Tooltip /><Legend /><Line type="monotone" dataKey="value" stroke="#8884d8" /></LineChart>',
|
|
107
|
+
bar: '<BarChart data={data}><CartesianGrid strokeDasharray="3 3" /><XAxis dataKey="name" /><YAxis /><Tooltip /><Legend /><Bar dataKey="value" fill="#8884d8" /></BarChart>',
|
|
108
|
+
pie: '<PieChart><Pie data={data} dataKey="value" nameKey="name" cx="50%" cy="50%" outerRadius={80} fill="#8884d8" label /></PieChart>',
|
|
109
|
+
trend: '<LineChart data={data}><Line type="monotone" dataKey="value" stroke="#8884d8" strokeWidth={2} dot={false} /></LineChart>'
|
|
110
|
+
};
|
|
111
|
+
const chart = chartMap[chartType] || chartMap.line;
|
|
112
|
+
return `<ResponsiveContainer width="100%" height={${properties.height || 300}}>
|
|
113
|
+
${chart}
|
|
114
|
+
</ResponsiveContainer>`;
|
|
115
|
+
},
|
|
116
|
+
dependencies: [{ name: "recharts", version: "^2.10.0" }]
|
|
117
|
+
},
|
|
118
|
+
tree: {
|
|
119
|
+
imports: [],
|
|
120
|
+
render: () => `<div className="tree-view">
|
|
121
|
+
{/* TODO: Implement tree component */}
|
|
122
|
+
</div>`
|
|
123
|
+
},
|
|
124
|
+
timeline: {
|
|
125
|
+
imports: [],
|
|
126
|
+
render: (ctx) => {
|
|
127
|
+
const { properties, children } = ctx;
|
|
128
|
+
const orientation = properties.orientation || "vertical";
|
|
129
|
+
return `<div className="relative ${orientation === "horizontal" ? "flex space-x-8" : "space-y-8"}">
|
|
130
|
+
${children || "/* Timeline items */"}
|
|
131
|
+
</div>`;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
avatar: {
|
|
135
|
+
imports: ["import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar'"],
|
|
136
|
+
render: (ctx) => {
|
|
137
|
+
const { properties } = ctx;
|
|
138
|
+
const size = properties.size === "large" ? "h-16 w-16" : properties.size === "small" ? "h-8 w-8" : "h-12 w-12";
|
|
139
|
+
return `<Avatar className="${size}">
|
|
140
|
+
<AvatarImage src={${properties.src || "user.avatar"}} alt="${properties.alt || "Avatar"}" />
|
|
141
|
+
<AvatarFallback>${properties.initials || "U"}</AvatarFallback>
|
|
142
|
+
</Avatar>`;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
image: {
|
|
146
|
+
imports: [],
|
|
147
|
+
render: (ctx) => {
|
|
148
|
+
const { properties } = ctx;
|
|
149
|
+
return `<img
|
|
150
|
+
src={${properties.src || "imageSrc"}}
|
|
151
|
+
alt="${properties.alt || ""}"
|
|
152
|
+
className="${properties.objectFit === "cover" ? "object-cover" : "object-contain"} ${properties.lazy ? 'loading="lazy"' : ""}"
|
|
153
|
+
/>`;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// =====================================================================
|
|
157
|
+
// FORMS & INPUTS (11 types)
|
|
158
|
+
// =====================================================================
|
|
159
|
+
form: {
|
|
160
|
+
imports: ["import { Form } from '@/components/ui/form'"],
|
|
161
|
+
render: (ctx) => {
|
|
162
|
+
const { children } = ctx;
|
|
163
|
+
return `<Form {...form}>
|
|
164
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
165
|
+
${children || "/* Form fields */"}
|
|
166
|
+
</form>
|
|
167
|
+
</Form>`;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
input: {
|
|
171
|
+
imports: ["import { Input } from '@/components/ui/input'", "import { Label } from '@/components/ui/label'"],
|
|
172
|
+
render: (ctx) => {
|
|
173
|
+
const { properties } = ctx;
|
|
174
|
+
return `<div className="grid w-full items-center gap-1.5">
|
|
175
|
+
${properties.label ? `<Label htmlFor="${properties.name || "input"}">${properties.label}${properties.required ? " *" : ""}</Label>` : ""}
|
|
176
|
+
<Input
|
|
177
|
+
type="${properties.type || "text"}"
|
|
178
|
+
id="${properties.name || "input"}"
|
|
179
|
+
placeholder="${properties.placeholder || ""}"
|
|
180
|
+
${properties.required ? "required" : ""}
|
|
181
|
+
${properties.disabled ? "disabled" : ""}
|
|
182
|
+
/>
|
|
183
|
+
${properties.helperText ? `<p className="text-sm text-muted-foreground">${properties.helperText}</p>` : ""}
|
|
184
|
+
</div>`;
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
textarea: {
|
|
188
|
+
imports: ["import { Textarea } from '@/components/ui/textarea'", "import { Label } from '@/components/ui/label'"],
|
|
189
|
+
render: (ctx) => {
|
|
190
|
+
const { properties } = ctx;
|
|
191
|
+
return `<div className="grid w-full gap-1.5">
|
|
192
|
+
${properties.label ? `<Label htmlFor="${properties.name || "textarea"}">${properties.label}</Label>` : ""}
|
|
193
|
+
<Textarea
|
|
194
|
+
id="${properties.name || "textarea"}"
|
|
195
|
+
placeholder="${properties.placeholder || ""}"
|
|
196
|
+
rows={${properties.rows || 4}}
|
|
197
|
+
${properties.required ? "required" : ""}
|
|
198
|
+
/>
|
|
199
|
+
</div>`;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
select: {
|
|
203
|
+
imports: [
|
|
204
|
+
"import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'",
|
|
205
|
+
"import { Label } from '@/components/ui/label'"
|
|
206
|
+
],
|
|
207
|
+
render: (ctx) => {
|
|
208
|
+
const { properties } = ctx;
|
|
209
|
+
const options = properties.options || [];
|
|
210
|
+
return `<div className="grid w-full gap-1.5">
|
|
211
|
+
${properties.label ? `<Label>${properties.label}${properties.required ? " *" : ""}</Label>` : ""}
|
|
212
|
+
<Select>
|
|
213
|
+
<SelectTrigger>
|
|
214
|
+
<SelectValue placeholder="${properties.placeholder || "Select option"}" />
|
|
215
|
+
</SelectTrigger>
|
|
216
|
+
<SelectContent>
|
|
217
|
+
${options.map((opt) => `<SelectItem value="${opt}">${opt}</SelectItem>`).join("\n ")}
|
|
218
|
+
</SelectContent>
|
|
219
|
+
</Select>
|
|
220
|
+
</div>`;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
checkbox: {
|
|
224
|
+
imports: ["import { Checkbox } from '@/components/ui/checkbox'", "import { Label } from '@/components/ui/label'"],
|
|
225
|
+
render: (ctx) => {
|
|
226
|
+
const { properties } = ctx;
|
|
227
|
+
return `<div className="flex items-center space-x-2">
|
|
228
|
+
<Checkbox id="${properties.name || "checkbox"}" ${properties.checked ? "checked" : ""} ${properties.disabled ? "disabled" : ""} />
|
|
229
|
+
${properties.label ? `<Label htmlFor="${properties.name || "checkbox"}">${properties.label}</Label>` : ""}
|
|
230
|
+
</div>`;
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
radio: {
|
|
234
|
+
imports: ["import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'", "import { Label } from '@/components/ui/label'"],
|
|
235
|
+
render: (ctx) => {
|
|
236
|
+
const { properties } = ctx;
|
|
237
|
+
const options = properties.options || [];
|
|
238
|
+
return `<div className="grid gap-2">
|
|
239
|
+
${properties.label ? `<Label>${properties.label}</Label>` : ""}
|
|
240
|
+
<RadioGroup>
|
|
241
|
+
${options.map((opt) => `<div className="flex items-center space-x-2">
|
|
242
|
+
<RadioGroupItem value="${opt}" id="${opt}" />
|
|
243
|
+
<Label htmlFor="${opt}">${opt}</Label>
|
|
244
|
+
</div>`).join("\n ")}
|
|
245
|
+
</RadioGroup>
|
|
246
|
+
</div>`;
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
slider: {
|
|
250
|
+
imports: ["import { Slider } from '@/components/ui/slider'", "import { Label } from '@/components/ui/label'"],
|
|
251
|
+
render: (ctx) => {
|
|
252
|
+
const { properties } = ctx;
|
|
253
|
+
return `<div className="grid gap-2">
|
|
254
|
+
${properties.label ? `<Label>${properties.label}</Label>` : ""}
|
|
255
|
+
<Slider
|
|
256
|
+
min={${properties.min || 0}}
|
|
257
|
+
max={${properties.max || 100}}
|
|
258
|
+
step={${properties.step || 1}}
|
|
259
|
+
defaultValue={[${properties.value || 50}]}
|
|
260
|
+
/>
|
|
261
|
+
${properties.showValue ? '<span className="text-sm text-muted-foreground">{value}</span>' : ""}
|
|
262
|
+
</div>`;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
switch: {
|
|
266
|
+
imports: ["import { Switch } from '@/components/ui/switch'", "import { Label } from '@/components/ui/label'"],
|
|
267
|
+
render: (ctx) => {
|
|
268
|
+
const { properties } = ctx;
|
|
269
|
+
return `<div className="flex items-center space-x-2">
|
|
270
|
+
<Switch id="${properties.name || "switch"}" ${properties.checked ? "checked" : ""} ${properties.disabled ? "disabled" : ""} />
|
|
271
|
+
${properties.label ? `<Label htmlFor="${properties.name || "switch"}">${properties.label}</Label>` : ""}
|
|
272
|
+
</div>`;
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
autocomplete: {
|
|
276
|
+
imports: [
|
|
277
|
+
"import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from '@/components/ui/command'",
|
|
278
|
+
"import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'",
|
|
279
|
+
"import { Button } from '@/components/ui/button'"
|
|
280
|
+
],
|
|
281
|
+
render: (ctx) => {
|
|
282
|
+
const { properties } = ctx;
|
|
283
|
+
return `<Popover>
|
|
284
|
+
<PopoverTrigger asChild>
|
|
285
|
+
<Button variant="outline" role="combobox">
|
|
286
|
+
{selected || "${properties.placeholder || "Select..."}"}
|
|
287
|
+
</Button>
|
|
288
|
+
</PopoverTrigger>
|
|
289
|
+
<PopoverContent className="w-[200px] p-0">
|
|
290
|
+
<Command>
|
|
291
|
+
<CommandInput placeholder="${properties.label || "Search..."}" />
|
|
292
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
293
|
+
<CommandGroup>
|
|
294
|
+
{/* Options */}
|
|
295
|
+
</CommandGroup>
|
|
296
|
+
</Command>
|
|
297
|
+
</PopoverContent>
|
|
298
|
+
</Popover>`;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
datepicker: {
|
|
302
|
+
imports: [
|
|
303
|
+
"import { Calendar } from '@/components/ui/calendar'",
|
|
304
|
+
"import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'",
|
|
305
|
+
"import { Button } from '@/components/ui/button'",
|
|
306
|
+
"import { format } from 'date-fns'"
|
|
307
|
+
],
|
|
308
|
+
render: (ctx) => {
|
|
309
|
+
const { properties } = ctx;
|
|
310
|
+
return `<Popover>
|
|
311
|
+
<PopoverTrigger asChild>
|
|
312
|
+
<Button variant="outline">
|
|
313
|
+
{date ? format(date, "${properties.format || "PPP"}") : <span>Pick a date</span>}
|
|
314
|
+
</Button>
|
|
315
|
+
</PopoverTrigger>
|
|
316
|
+
<PopoverContent className="w-auto p-0">
|
|
317
|
+
<Calendar mode="single" selected={date} onSelect={setDate} initialFocus />
|
|
318
|
+
</PopoverContent>
|
|
319
|
+
</Popover>`;
|
|
320
|
+
},
|
|
321
|
+
dependencies: [{ name: "date-fns", version: "^3.0.0" }]
|
|
322
|
+
},
|
|
323
|
+
timepicker: {
|
|
324
|
+
imports: ["import { Input } from '@/components/ui/input'", "import { Label } from '@/components/ui/label'"],
|
|
325
|
+
render: (ctx) => {
|
|
326
|
+
const { properties } = ctx;
|
|
327
|
+
return `<div className="grid w-full gap-1.5">
|
|
328
|
+
${properties.label ? `<Label>${properties.label}</Label>` : ""}
|
|
329
|
+
<Input type="time" ${properties.required ? "required" : ""} />
|
|
330
|
+
</div>`;
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
// =====================================================================
|
|
334
|
+
// ACTIONS (5 types)
|
|
335
|
+
// =====================================================================
|
|
336
|
+
button: {
|
|
337
|
+
imports: ["import { Button } from '@/components/ui/button'"],
|
|
338
|
+
render: (ctx) => {
|
|
339
|
+
const { properties } = ctx;
|
|
340
|
+
const variants = {
|
|
341
|
+
primary: "default",
|
|
342
|
+
secondary: "secondary",
|
|
343
|
+
danger: "destructive",
|
|
344
|
+
ghost: "ghost",
|
|
345
|
+
link: "link"
|
|
346
|
+
};
|
|
347
|
+
const variant = variants[properties.variant || "primary"] || "default";
|
|
348
|
+
return `<Button
|
|
349
|
+
variant="${variant}"
|
|
350
|
+
size="${properties.size || "default"}"
|
|
351
|
+
${properties.disabled ? "disabled" : ""}
|
|
352
|
+
${properties.type ? `type="${properties.type}"` : ""}
|
|
353
|
+
>
|
|
354
|
+
${properties.icon ? `<${properties.icon} className="mr-2 h-4 w-4" />` : ""}
|
|
355
|
+
${properties.label || "Button"}
|
|
356
|
+
</Button>`;
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"button-group": {
|
|
360
|
+
imports: [],
|
|
361
|
+
render: (ctx) => {
|
|
362
|
+
const { properties, children } = ctx;
|
|
363
|
+
const orientation = properties.orientation || "horizontal";
|
|
364
|
+
return `<div className="flex ${orientation === "vertical" ? "flex-col" : "flex-row"} gap-2">
|
|
365
|
+
${children || "/* Buttons */"}
|
|
366
|
+
</div>`;
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
link: {
|
|
370
|
+
imports: ["import Link from 'next/link'"],
|
|
371
|
+
render: (ctx) => {
|
|
372
|
+
const { properties } = ctx;
|
|
373
|
+
return `<Link
|
|
374
|
+
href="${properties.href || "#"}"
|
|
375
|
+
className="${properties.underline === false ? "no-underline" : "underline"}"
|
|
376
|
+
${properties.external ? 'target="_blank" rel="noopener noreferrer"' : ""}
|
|
377
|
+
>
|
|
378
|
+
${properties.label || "Link"}
|
|
379
|
+
</Link>`;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
icon: {
|
|
383
|
+
imports: [],
|
|
384
|
+
render: (ctx) => {
|
|
385
|
+
const { properties } = ctx;
|
|
386
|
+
const sizeMap = { small: "h-4 w-4", medium: "h-6 w-6", large: "h-8 w-8" };
|
|
387
|
+
const size = sizeMap[properties.size || "medium"] || "h-6 w-6";
|
|
388
|
+
return `<${properties.name || "Icon"} className="${size} ${properties.color ? `text-${properties.color}` : ""}" />`;
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
menu: {
|
|
392
|
+
imports: [
|
|
393
|
+
"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'"
|
|
394
|
+
],
|
|
395
|
+
render: (ctx) => {
|
|
396
|
+
const { children } = ctx;
|
|
397
|
+
return `<DropdownMenu>
|
|
398
|
+
<DropdownMenuTrigger>Menu</DropdownMenuTrigger>
|
|
399
|
+
<DropdownMenuContent>
|
|
400
|
+
${children || "/* Menu items */"}
|
|
401
|
+
</DropdownMenuContent>
|
|
402
|
+
</DropdownMenu>`;
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
// =====================================================================
|
|
406
|
+
// OVERLAYS & FEEDBACK (9 types)
|
|
407
|
+
// =====================================================================
|
|
408
|
+
modal: {
|
|
409
|
+
imports: [
|
|
410
|
+
"import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'"
|
|
411
|
+
],
|
|
412
|
+
render: (ctx) => {
|
|
413
|
+
const { properties, children } = ctx;
|
|
414
|
+
return `<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
415
|
+
<DialogContent className="${properties.size === "small" ? "sm:max-w-[425px]" : properties.size === "large" ? "sm:max-w-[725px]" : "sm:max-w-[525px]"}">
|
|
416
|
+
${properties.title ? `<DialogHeader>
|
|
417
|
+
<DialogTitle>${properties.title}</DialogTitle>
|
|
418
|
+
</DialogHeader>` : ""}
|
|
419
|
+
<div className="py-4">
|
|
420
|
+
${children || "/* Modal content */"}
|
|
421
|
+
</div>
|
|
422
|
+
${properties.footer ? "<DialogFooter>{/* Footer actions */}</DialogFooter>" : ""}
|
|
423
|
+
</DialogContent>
|
|
424
|
+
</Dialog>`;
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
dialog: {
|
|
428
|
+
imports: ["import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'"],
|
|
429
|
+
render: (ctx) => {
|
|
430
|
+
const { properties } = ctx;
|
|
431
|
+
return `<AlertDialog>
|
|
432
|
+
<AlertDialogContent>
|
|
433
|
+
<AlertDialogHeader>
|
|
434
|
+
<AlertDialogTitle>${properties.title || "Alert"}</AlertDialogTitle>
|
|
435
|
+
<AlertDialogDescription>${properties.message || ""}</AlertDialogDescription>
|
|
436
|
+
</AlertDialogHeader>
|
|
437
|
+
<AlertDialogFooter>
|
|
438
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
439
|
+
<AlertDialogAction>Continue</AlertDialogAction>
|
|
440
|
+
</AlertDialogFooter>
|
|
441
|
+
</AlertDialogContent>
|
|
442
|
+
</AlertDialog>`;
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
drawer: {
|
|
446
|
+
imports: ["import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'"],
|
|
447
|
+
render: (ctx) => {
|
|
448
|
+
const { properties, children } = ctx;
|
|
449
|
+
return `<Sheet>
|
|
450
|
+
<SheetContent side="${properties.position || "right"}">
|
|
451
|
+
<SheetHeader>
|
|
452
|
+
<SheetTitle>${properties.title || ""}</SheetTitle>
|
|
453
|
+
</SheetHeader>
|
|
454
|
+
<div className="py-4">
|
|
455
|
+
${children || "/* Drawer content */"}
|
|
456
|
+
</div>
|
|
457
|
+
</SheetContent>
|
|
458
|
+
</Sheet>`;
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
popover: {
|
|
462
|
+
imports: ["import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'"],
|
|
463
|
+
render: (ctx) => {
|
|
464
|
+
const { children } = ctx;
|
|
465
|
+
return `<Popover>
|
|
466
|
+
<PopoverTrigger>Trigger</PopoverTrigger>
|
|
467
|
+
<PopoverContent>
|
|
468
|
+
${children || "Popover content"}
|
|
469
|
+
</PopoverContent>
|
|
470
|
+
</Popover>`;
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
tooltip: {
|
|
474
|
+
imports: ["import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'"],
|
|
475
|
+
render: (ctx) => {
|
|
476
|
+
const { properties } = ctx;
|
|
477
|
+
return `<TooltipProvider>
|
|
478
|
+
<Tooltip>
|
|
479
|
+
<TooltipTrigger>Hover</TooltipTrigger>
|
|
480
|
+
<TooltipContent>
|
|
481
|
+
<p>${properties.content || "Tooltip content"}</p>
|
|
482
|
+
</TooltipContent>
|
|
483
|
+
</Tooltip>
|
|
484
|
+
</TooltipProvider>`;
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
alert: {
|
|
488
|
+
imports: ["import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'"],
|
|
489
|
+
render: (ctx) => {
|
|
490
|
+
const { properties } = ctx;
|
|
491
|
+
return `<Alert variant="${properties.variant || "default"}">
|
|
492
|
+
${properties.title ? `<AlertTitle>${properties.title}</AlertTitle>` : ""}
|
|
493
|
+
<AlertDescription>${properties.message || ""}</AlertDescription>
|
|
494
|
+
</Alert>`;
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
snackbar: {
|
|
498
|
+
imports: ["import { useToast } from '@/components/ui/use-toast'"],
|
|
499
|
+
render: (ctx) => {
|
|
500
|
+
const { properties } = ctx;
|
|
501
|
+
return `toast({
|
|
502
|
+
title: "${properties.message || "Notification"}",
|
|
503
|
+
duration: ${properties.duration || 3e3},
|
|
504
|
+
})`;
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
badge: {
|
|
508
|
+
imports: ["import { Badge } from '@/components/ui/badge'"],
|
|
509
|
+
render: (ctx) => {
|
|
510
|
+
const { properties } = ctx;
|
|
511
|
+
return `<Badge variant="${properties.variant || "default"}">${properties.content || ""}</Badge>`;
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
spinner: {
|
|
515
|
+
imports: [],
|
|
516
|
+
render: (ctx) => {
|
|
517
|
+
const { properties } = ctx;
|
|
518
|
+
const sizeMap = { small: "h-4 w-4", medium: "h-8 w-8", large: "h-12 w-12" };
|
|
519
|
+
const size = sizeMap[properties.size || "medium"] || "h-8 w-8";
|
|
520
|
+
return `<div className="flex items-center justify-center">
|
|
521
|
+
<div className="${size} animate-spin rounded-full border-b-2 border-gray-900"></div>
|
|
522
|
+
</div>`;
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
// =====================================================================
|
|
526
|
+
// NAVIGATION (5 types)
|
|
527
|
+
// =====================================================================
|
|
528
|
+
tabs: {
|
|
529
|
+
imports: ["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'"],
|
|
530
|
+
render: (ctx) => {
|
|
531
|
+
const { properties, children } = ctx;
|
|
532
|
+
const sections = properties.sections || ["tab1", "tab2"];
|
|
533
|
+
return `<Tabs defaultValue="${sections[0]}">
|
|
534
|
+
<TabsList>
|
|
535
|
+
${sections.map((section) => `<TabsTrigger value="${section}">${section}</TabsTrigger>`).join("\n ")}
|
|
536
|
+
</TabsList>
|
|
537
|
+
${sections.map((section) => `<TabsContent value="${section}">
|
|
538
|
+
{/* ${section} content */}
|
|
539
|
+
</TabsContent>`).join("\n ")}
|
|
540
|
+
</Tabs>`;
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
breadcrumb: {
|
|
544
|
+
imports: [],
|
|
545
|
+
render: (ctx) => {
|
|
546
|
+
return `<nav className="flex" aria-label="Breadcrumb">
|
|
547
|
+
<ol className="inline-flex items-center space-x-1">
|
|
548
|
+
{/* Breadcrumb items */}
|
|
549
|
+
</ol>
|
|
550
|
+
</nav>`;
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
navbar: {
|
|
554
|
+
imports: [],
|
|
555
|
+
render: (ctx) => {
|
|
556
|
+
const { properties, children } = ctx;
|
|
557
|
+
return `<nav className="${properties.sticky ? "sticky top-0" : ""} bg-background border-b">
|
|
558
|
+
<div className="container flex h-16 items-center justify-between">
|
|
559
|
+
${children || "/* Navigation items */"}
|
|
560
|
+
</div>
|
|
561
|
+
</nav>`;
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
sidebar: {
|
|
565
|
+
imports: [],
|
|
566
|
+
render: (ctx) => {
|
|
567
|
+
const { properties, children } = ctx;
|
|
568
|
+
return `<aside className="w-${properties.width || 64} border-r ${properties.position === "right" ? "order-last" : ""}">
|
|
569
|
+
<div className="h-full px-3 py-4">
|
|
570
|
+
${children || "/* Sidebar items */"}
|
|
571
|
+
</div>
|
|
572
|
+
</aside>`;
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
pagination: {
|
|
576
|
+
imports: [
|
|
577
|
+
"import { Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from '@/components/ui/pagination'"
|
|
578
|
+
],
|
|
579
|
+
render: (ctx) => {
|
|
580
|
+
return `<Pagination>
|
|
581
|
+
<PaginationContent>
|
|
582
|
+
<PaginationItem>
|
|
583
|
+
<PaginationPrevious href="#" />
|
|
584
|
+
</PaginationItem>
|
|
585
|
+
{/* Page numbers */}
|
|
586
|
+
<PaginationItem>
|
|
587
|
+
<PaginationNext href="#" />
|
|
588
|
+
</PaginationItem>
|
|
589
|
+
</PaginationContent>
|
|
590
|
+
</Pagination>`;
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
// =====================================================================
|
|
594
|
+
// LAYOUT (6 types)
|
|
595
|
+
// =====================================================================
|
|
596
|
+
accordion: {
|
|
597
|
+
imports: ["import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'"],
|
|
598
|
+
render: (ctx) => {
|
|
599
|
+
const { children } = ctx;
|
|
600
|
+
return `<Accordion type="single" collapsible>
|
|
601
|
+
${children || "/* Accordion items */"}
|
|
602
|
+
</Accordion>`;
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
carousel: {
|
|
606
|
+
imports: [],
|
|
607
|
+
render: (ctx) => {
|
|
608
|
+
const { children } = ctx;
|
|
609
|
+
return `<div className="relative">
|
|
610
|
+
{/* Carousel implementation */}
|
|
611
|
+
${children || ""}
|
|
612
|
+
</div>`;
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
container: {
|
|
616
|
+
imports: [],
|
|
617
|
+
render: (ctx) => {
|
|
618
|
+
const { properties, children } = ctx;
|
|
619
|
+
const layout = properties.layout || "vertical";
|
|
620
|
+
const className = layout === "horizontal" ? "flex flex-row" : layout === "grid" ? "grid" : "flex flex-col";
|
|
621
|
+
return `<div className="${className} ${properties.gap ? `gap-${properties.gap}` : ""} ${properties.scrollable ? "overflow-auto" : ""}">
|
|
622
|
+
${children || "/* Container content */"}
|
|
623
|
+
</div>`;
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
divider: {
|
|
627
|
+
imports: ["import { Separator } from '@/components/ui/separator'"],
|
|
628
|
+
render: (ctx) => {
|
|
629
|
+
const { properties } = ctx;
|
|
630
|
+
return `<Separator orientation="${properties.orientation || "horizontal"}" />`;
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
header: {
|
|
634
|
+
imports: [],
|
|
635
|
+
render: (ctx) => {
|
|
636
|
+
const { properties, children } = ctx;
|
|
637
|
+
return `<header>
|
|
638
|
+
${properties.title ? `<h1 className="text-3xl font-bold">${properties.title}</h1>` : ""}
|
|
639
|
+
${properties.subtitle ? `<p className="text-muted-foreground">${properties.subtitle}</p>` : ""}
|
|
640
|
+
${children || ""}
|
|
641
|
+
</header>`;
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
footer: {
|
|
645
|
+
imports: [],
|
|
646
|
+
render: (ctx) => {
|
|
647
|
+
const { properties, children } = ctx;
|
|
648
|
+
return `<footer className="${properties.sticky ? "sticky bottom-0" : ""} border-t bg-background">
|
|
649
|
+
<div className="container py-6">
|
|
650
|
+
${children || "/* Footer content */"}
|
|
651
|
+
${properties.copyright ? `<p className="text-sm text-muted-foreground">${properties.copyright}</p>` : ""}
|
|
652
|
+
</div>
|
|
653
|
+
</footer>`;
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
// =====================================================================
|
|
657
|
+
// PROGRESS (2 types)
|
|
658
|
+
// =====================================================================
|
|
659
|
+
"progress-bar": {
|
|
660
|
+
imports: ["import { Progress } from '@/components/ui/progress'"],
|
|
661
|
+
render: (ctx) => {
|
|
662
|
+
const { properties } = ctx;
|
|
663
|
+
return `<div className="space-y-2">
|
|
664
|
+
${properties.label ? `<div className="flex justify-between text-sm"><span>Progress</span><span>{${properties.value || 0}}%</span></div>` : ""}
|
|
665
|
+
<Progress value={${properties.value || 0}} max={${properties.max || 100}} />
|
|
666
|
+
</div>`;
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
"progress-circle": {
|
|
670
|
+
imports: [],
|
|
671
|
+
render: (ctx) => {
|
|
672
|
+
const { properties } = ctx;
|
|
673
|
+
const size = properties.size === "large" ? "h-32 w-32" : properties.size === "small" ? "h-16 w-16" : "h-24 w-24";
|
|
674
|
+
return `<div className="${size} relative">
|
|
675
|
+
<svg className="rotate-[-90deg]" viewBox="0 0 100 100">
|
|
676
|
+
<circle cx="50" cy="50" r="40" stroke="currentColor" strokeWidth="${properties.thickness || 4}" fill="none" className="text-muted" />
|
|
677
|
+
<circle cx="50" cy="50" r="40" stroke="currentColor" strokeWidth="${properties.thickness || 4}" fill="none" strokeDasharray="251.2" strokeDashoffset={251.2 - (251.2 * ${properties.value || 0}) / 100} className="text-primary transition-all" />
|
|
678
|
+
</svg>
|
|
679
|
+
${properties.label ? '<div className="absolute inset-0 flex items-center justify-center text-lg font-bold">{value}%</div>' : ""}
|
|
680
|
+
</div>`;
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
// =====================================================================
|
|
684
|
+
// SPECIALIZED (2 types)
|
|
685
|
+
// =====================================================================
|
|
686
|
+
searchBar: {
|
|
687
|
+
imports: ["import { Input } from '@/components/ui/input'", "import { Search } from 'lucide-react'"],
|
|
688
|
+
render: (ctx) => {
|
|
689
|
+
const { properties } = ctx;
|
|
690
|
+
return `<div className="relative">
|
|
691
|
+
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
692
|
+
<Input
|
|
693
|
+
type="search"
|
|
694
|
+
placeholder="${properties.placeholder || "Search..."}"
|
|
695
|
+
className="pl-8"
|
|
696
|
+
${properties.autofocus ? "autoFocus" : ""}
|
|
697
|
+
/>
|
|
698
|
+
</div>`;
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
filterPanel: {
|
|
702
|
+
imports: ["import { Card } from '@/components/ui/card'"],
|
|
703
|
+
render: (ctx) => {
|
|
704
|
+
const { properties, children } = ctx;
|
|
705
|
+
return `<Card className="${properties.position === "sidebar" ? "w-64" : "w-full"} ${properties.collapsible ? "collapsible" : ""}">
|
|
706
|
+
<div className="p-4 space-y-4">
|
|
707
|
+
<h3 className="font-semibold">Filters</h3>
|
|
708
|
+
${children || "/* Filter controls */"}
|
|
709
|
+
</div>
|
|
710
|
+
</Card>`;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
var stdin_default = shadcnAdapter;
|
|
716
|
+
export {
|
|
717
|
+
stdin_default as default,
|
|
718
|
+
shadcnAdapter
|
|
719
|
+
};
|