@specverse/engines 4.1.5 → 4.1.7

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 (122) hide show
  1. package/dist/libs/instance-factories/applications/templates/generic/backend-env-generator.js +22 -0
  2. package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +66 -0
  3. package/dist/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.js +54 -0
  4. package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +290 -0
  5. package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +530 -0
  6. package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +437 -0
  7. package/dist/libs/instance-factories/applications/templates/react/api-types-generator.js +146 -0
  8. package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +73 -0
  9. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +18 -0
  10. package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +99 -0
  11. package/dist/libs/instance-factories/applications/templates/react/gitignore-generator.js +35 -0
  12. package/dist/libs/instance-factories/applications/templates/react/index-css-generator.js +9 -0
  13. package/dist/libs/instance-factories/applications/templates/react/index-html-generator.js +23 -0
  14. package/dist/libs/instance-factories/applications/templates/react/main-tsx-generator.js +29 -0
  15. package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +49 -0
  16. package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +156 -0
  17. package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +935 -0
  18. package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +143 -0
  19. package/dist/libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.js +101 -0
  20. package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +50 -0
  21. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +646 -0
  22. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +65 -0
  23. package/dist/libs/instance-factories/applications/templates/react/tsconfig-generator.js +28 -0
  24. package/dist/libs/instance-factories/applications/templates/react/use-api-hooks-generator.js +132 -0
  25. package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +143 -0
  26. package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +143 -0
  27. package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +355 -0
  28. package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +91 -0
  29. package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +79 -0
  30. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +42 -0
  31. package/dist/libs/instance-factories/cli/templates/commander/cli-bin-wrapper-generator.js +11 -0
  32. package/dist/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +111 -0
  33. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +928 -0
  34. package/dist/libs/instance-factories/communication/templates/eventemitter/bus-generator.js +83 -0
  35. package/dist/libs/instance-factories/communication/templates/eventemitter/publisher-generator.js +91 -0
  36. package/dist/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.js +86 -0
  37. package/dist/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.js +93 -0
  38. package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +280 -0
  39. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +125 -0
  40. package/dist/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.js +25 -0
  41. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +371 -0
  42. package/dist/libs/instance-factories/orms/templates/prisma/services-generator.js +266 -0
  43. package/dist/libs/instance-factories/scaffolding/templates/generic/env-example-generator.js +51 -0
  44. package/dist/libs/instance-factories/scaffolding/templates/generic/env-generator.js +61 -0
  45. package/dist/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.js +59 -0
  46. package/dist/libs/instance-factories/scaffolding/templates/generic/package-json-generator.js +126 -0
  47. package/dist/libs/instance-factories/scaffolding/templates/generic/readme-generator.js +159 -0
  48. package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.js +56 -0
  49. package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js +37 -0
  50. package/dist/libs/instance-factories/sdks/templates/python/sdk-generator.js +29 -0
  51. package/dist/libs/instance-factories/sdks/templates/typescript/sdk-generator.js +28 -0
  52. package/dist/libs/instance-factories/services/templates/memory/generate-interpreter.js +14 -0
  53. package/dist/libs/instance-factories/services/templates/memory/step-conventions-memory.js +415 -0
  54. package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +177 -0
  55. package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +413 -0
  56. package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +243 -0
  57. package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +264 -0
  58. package/dist/libs/instance-factories/services/templates/shared-patterns.js +24 -0
  59. package/dist/libs/instance-factories/shared/path-resolver.js +59 -0
  60. package/dist/libs/instance-factories/storage/templates/mongodb/config-generator.js +13 -0
  61. package/dist/libs/instance-factories/storage/templates/mongodb/docker-generator.js +16 -0
  62. package/dist/libs/instance-factories/storage/templates/postgresql/config-generator.js +45 -0
  63. package/dist/libs/instance-factories/storage/templates/postgresql/docker-generator.js +46 -0
  64. package/dist/libs/instance-factories/storage/templates/redis/config-generator.js +14 -0
  65. package/dist/libs/instance-factories/storage/templates/redis/docker-generator.js +16 -0
  66. package/dist/libs/instance-factories/test-generation.js +145 -0
  67. package/dist/libs/instance-factories/testing/templates/vitest/tests-generator.js +30 -0
  68. package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +149 -0
  69. package/dist/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.js +232 -0
  70. package/dist/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.js +49 -0
  71. package/dist/libs/instance-factories/tools/templates/mcp/static/src/index.js +18 -0
  72. package/dist/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.js +0 -0
  73. package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.js +97 -0
  74. package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.js +64 -0
  75. package/dist/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.js +182 -0
  76. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.js +1210 -0
  77. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.js +172 -0
  78. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.js +240 -0
  79. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.js +147 -0
  80. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.js +281 -0
  81. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.js +409 -0
  82. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.js +414 -0
  83. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.js +467 -0
  84. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.js +135 -0
  85. package/dist/libs/instance-factories/tools/templates/mcp/static/src/types/index.js +0 -0
  86. package/dist/libs/instance-factories/tools/templates/vscode/static/extension.js +965 -0
  87. package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +238 -0
  88. package/dist/libs/instance-factories/validation/templates/zod/validation-generator.js +25 -0
  89. package/dist/libs/instance-factories/views/index.js +48 -0
  90. package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +742 -0
  91. package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +824 -0
  92. package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +719 -0
  93. package/dist/libs/instance-factories/views/templates/react/app-generator.js +45 -0
  94. package/dist/libs/instance-factories/views/templates/react/components-generator.js +779 -0
  95. package/dist/libs/instance-factories/views/templates/react/forms-generator.js +285 -0
  96. package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +46 -0
  97. package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +111 -0
  98. package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +9 -0
  99. package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +23 -0
  100. package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +21 -0
  101. package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +299 -0
  102. package/dist/libs/instance-factories/views/templates/react/router-generator.js +136 -0
  103. package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +107 -0
  104. package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +179 -0
  105. package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +7 -0
  106. package/dist/libs/instance-factories/views/templates/react/types-generator.js +56 -0
  107. package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +27 -0
  108. package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +29 -0
  109. package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +261 -0
  110. package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +34 -0
  111. package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +800 -0
  112. package/dist/libs/instance-factories/views/templates/shared/base-generator.js +305 -0
  113. package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +517 -0
  114. package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
  115. package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +445 -0
  116. package/dist/libs/instance-factories/views/templates/shared/index.js +80 -0
  117. package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +210 -0
  118. package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +492 -0
  119. package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +321 -0
  120. package/dist/realize/index.js +36 -12
  121. package/dist/realize/index.js.map +1 -1
  122. package/package.json +3 -2
@@ -0,0 +1,742 @@
1
+ function renderProps(properties, exclude = []) {
2
+ return Object.entries(properties).filter(([key]) => !exclude.includes(key)).map(([key, value]) => {
3
+ if (typeof value === "boolean") return value ? key : "";
4
+ if (typeof value === "string") return `${key}="${value}"`;
5
+ return `${key}={${JSON.stringify(value)}}`;
6
+ }).filter(Boolean).join(" ");
7
+ }
8
+ const antdAdapter = {
9
+ name: "Ant Design",
10
+ version: "5.x",
11
+ description: "Ant Design (antd) component library adapter",
12
+ baseDependencies: [
13
+ { name: "antd", version: "^5.15.0" },
14
+ { name: "@ant-design/icons", version: "^5.2.0" }
15
+ ],
16
+ config: {
17
+ importPrefix: "antd",
18
+ importStyle: "named"
19
+ },
20
+ components: {
21
+ // ====================================================================
22
+ // DATA DISPLAY (9 types)
23
+ // ====================================================================
24
+ table: {
25
+ imports: ["import { Table } from 'antd'"],
26
+ render: (ctx) => {
27
+ const { properties, model } = ctx;
28
+ const columns = properties.columns || ["id"];
29
+ const modelVar = model?.name?.toLowerCase() || "item";
30
+ return `<Table
31
+ dataSource={${modelVar}s}
32
+ columns={[
33
+ ${columns.map((col) => `{ title: '${col}', dataIndex: '${col}', key: '${col}'${properties.sortable !== false ? ", sorter: true" : ""} }`).join(",\n ")}
34
+ ]}
35
+ ${properties.pagination !== false ? `pagination={{ pageSize: ${properties.pageSize || 10} }}` : "pagination={false}"}
36
+ ${properties.size ? `size="${properties.size}"` : ""}
37
+ ${properties.bordered ? "bordered" : ""}
38
+ rowKey="id"
39
+ />`;
40
+ }
41
+ },
42
+ list: {
43
+ imports: ["import { List } from 'antd'"],
44
+ render: (ctx) => {
45
+ const { properties, model } = ctx;
46
+ const modelVar = model?.name?.toLowerCase() || "item";
47
+ return `<List
48
+ dataSource={${modelVar}s}
49
+ ${properties.bordered ? "bordered" : ""}
50
+ ${properties.size ? `size="${properties.size}"` : ""}
51
+ ${properties.grid ? `grid={${JSON.stringify(properties.grid)}}` : ""}
52
+ renderItem={(${modelVar}) => (
53
+ <List.Item>
54
+ <List.Item.Meta
55
+ ${properties.showAvatar ? `avatar={<Avatar src={${modelVar}.avatar} />}` : ""}
56
+ title={${modelVar}.${properties.primaryField || "name"}}
57
+ ${properties.secondaryField ? `description={${modelVar}.${properties.secondaryField}}` : ""}
58
+ />
59
+ </List.Item>
60
+ )}
61
+ />`;
62
+ }
63
+ },
64
+ grid: {
65
+ imports: ["import { Row, Col } from 'antd'"],
66
+ render: (ctx) => {
67
+ const { properties, children } = ctx;
68
+ const gutter = properties.gutter || 16;
69
+ return `<Row gutter={${gutter}}>
70
+ {items?.map((item) => (
71
+ <Col xs={${properties.xs || 24}} sm={${properties.sm || 12}} md={${properties.md || 8}} lg={${properties.lg || 6}} key={item.id}>
72
+ ${children || "{/* Item content */}"}
73
+ </Col>
74
+ ))}
75
+ </Row>`;
76
+ }
77
+ },
78
+ card: {
79
+ imports: ["import { Card } from 'antd'"],
80
+ render: (ctx) => {
81
+ const { properties, children } = ctx;
82
+ return `<Card
83
+ ${properties.title ? `title="${properties.title}"` : ""}
84
+ ${properties.bordered !== false ? "bordered" : "bordered={false}"}
85
+ ${properties.hoverable ? "hoverable" : ""}
86
+ ${properties.size ? `size="${properties.size}"` : ""}
87
+ ${properties.image ? `cover={<img alt="${properties.title || "Card"}" src="${properties.image}" />}` : ""}
88
+ ${properties.actions ? `actions={[${properties.actions.map((a) => `<${a} />`).join(", ")}]}` : ""}
89
+ >
90
+ ${children || "{content}"}
91
+ </Card>`;
92
+ }
93
+ },
94
+ chart: {
95
+ imports: [
96
+ "// Note: Ant Design doesn't include charts. Use @ant-design/charts or recharts",
97
+ "// import { Line, Bar, Pie } from '@ant-design/charts'"
98
+ ],
99
+ render: (ctx) => {
100
+ const { properties } = ctx;
101
+ const chartType = properties.chartType || "line";
102
+ const ChartComponent = chartType === "line" ? "Line" : chartType === "bar" ? "Bar" : "Pie";
103
+ return `{/* TODO: Integrate @ant-design/charts */}
104
+ {/* <${ChartComponent}
105
+ data={data}
106
+ ${chartType !== "pie" ? 'xField="name" yField="value"' : 'angleField="value" colorField="name"'}
107
+ ${properties.responsive !== false ? "responsive" : ""}
108
+ ${properties.showLegend !== false ? "" : "legend={false}"}
109
+ /> */}`;
110
+ },
111
+ dependencies: [
112
+ { name: "@ant-design/charts", version: "^2.0.0" }
113
+ ]
114
+ },
115
+ tree: {
116
+ imports: ["import { Tree } from 'antd'"],
117
+ render: (ctx) => {
118
+ const { properties } = ctx;
119
+ return `<Tree
120
+ treeData={treeData}
121
+ ${properties.checkable ? "checkable" : ""}
122
+ ${properties.defaultExpanded ? "defaultExpandAll" : ""}
123
+ ${properties.selectable !== false ? "" : "selectable={false}"}
124
+ ${properties.showLine ? "showLine" : ""}
125
+ />`;
126
+ }
127
+ },
128
+ timeline: {
129
+ imports: ["import { Timeline } from 'antd'"],
130
+ render: (ctx) => {
131
+ const { properties } = ctx;
132
+ const mode = properties.position === "alternate" ? "alternate" : properties.position === "right" ? "right" : "left";
133
+ return `<Timeline mode="${mode}">
134
+ {events?.map((event) => (
135
+ <Timeline.Item key={event.id} ${properties.showDateMarkers ? `label={event.date}` : ""}>
136
+ {event.title}
137
+ </Timeline.Item>
138
+ ))}
139
+ </Timeline>`;
140
+ }
141
+ },
142
+ avatar: {
143
+ imports: ["import { Avatar } from 'antd'"],
144
+ render: (ctx) => {
145
+ const { properties } = ctx;
146
+ const size = properties.size === "small" ? "small" : properties.size === "large" ? "large" : "default";
147
+ return `<Avatar
148
+ ${properties.src ? `src="${properties.src}"` : ""}
149
+ ${properties.icon ? `icon={<${properties.icon} />}` : ""}
150
+ size={${typeof properties.size === "number" ? properties.size : `"${size}"`}}
151
+ ${properties.shape ? `shape="${properties.shape}"` : ""}
152
+ >
153
+ ${!properties.src && !properties.icon ? "{initials}" : ""}
154
+ </Avatar>`;
155
+ }
156
+ },
157
+ image: {
158
+ imports: ["import { Image } from 'antd'"],
159
+ render: (ctx) => {
160
+ const { properties } = ctx;
161
+ return `<Image
162
+ src="${properties.src}"
163
+ alt="${properties.alt || "Image"}"
164
+ ${properties.width ? `width={${properties.width}}` : ""}
165
+ ${properties.height ? `height={${properties.height}}` : ""}
166
+ ${properties.preview !== false ? "" : "preview={false}"}
167
+ ${properties.placeholder ? "placeholder" : ""}
168
+ />`;
169
+ }
170
+ },
171
+ // ====================================================================
172
+ // FORMS & INPUTS (11 types)
173
+ // ====================================================================
174
+ form: {
175
+ imports: ["import { Form } from 'antd'"],
176
+ render: (ctx) => {
177
+ const { properties, children } = ctx;
178
+ return `<Form
179
+ layout="${properties.layout || "vertical"}"
180
+ onFinish={handleSubmit}
181
+ ${properties.initialValues ? "initialValues={initialValues}" : ""}
182
+ >
183
+ ${children || "{/* Form items */}"}
184
+ </Form>`;
185
+ }
186
+ },
187
+ input: {
188
+ imports: ["import { Input, Form } from 'antd'"],
189
+ render: (ctx) => {
190
+ const { properties } = ctx;
191
+ return `<Form.Item
192
+ label="${properties.label || ""}"
193
+ name="${properties.name || "field"}"
194
+ ${properties.required ? 'rules={[{ required: true, message: "Please input!" }]}' : ""}
195
+ >
196
+ <Input
197
+ type="${properties.type || "text"}"
198
+ placeholder="${properties.placeholder || ""}"
199
+ ${properties.disabled ? "disabled" : ""}
200
+ ${properties.prefix ? `prefix={<${properties.prefix} />}` : ""}
201
+ ${properties.suffix ? `suffix={<${properties.suffix} />}` : ""}
202
+ />
203
+ </Form.Item>`;
204
+ }
205
+ },
206
+ textarea: {
207
+ imports: ["import { Input, Form } from 'antd'"],
208
+ render: (ctx) => {
209
+ const { properties } = ctx;
210
+ return `<Form.Item
211
+ label="${properties.label || ""}"
212
+ name="${properties.name || "field"}"
213
+ ${properties.required ? "rules={[{ required: true }]}" : ""}
214
+ >
215
+ <Input.TextArea
216
+ placeholder="${properties.placeholder || ""}"
217
+ rows={${properties.rows || 4}}
218
+ ${properties.maxLength ? `maxLength={${properties.maxLength}}` : ""}
219
+ ${properties.showCount ? "showCount" : ""}
220
+ />
221
+ </Form.Item>`;
222
+ }
223
+ },
224
+ select: {
225
+ imports: ["import { Select, Form } from 'antd'"],
226
+ render: (ctx) => {
227
+ const { properties } = ctx;
228
+ return `<Form.Item
229
+ label="${properties.label || "Select"}"
230
+ name="${properties.name || "field"}"
231
+ ${properties.required ? "rules={[{ required: true }]}" : ""}
232
+ >
233
+ <Select
234
+ placeholder="${properties.placeholder || "Select..."}"
235
+ ${properties.mode ? `mode="${properties.mode}"` : ""}
236
+ ${properties.allowClear ? "allowClear" : ""}
237
+ ${properties.showSearch ? "showSearch" : ""}
238
+ options={${properties.options || "options"}}
239
+ />
240
+ </Form.Item>`;
241
+ }
242
+ },
243
+ checkbox: {
244
+ imports: ["import { Checkbox, Form } from 'antd'"],
245
+ render: (ctx) => {
246
+ const { properties } = ctx;
247
+ return `<Form.Item name="${properties.name || "field"}" valuePropName="checked">
248
+ <Checkbox ${properties.disabled ? "disabled" : ""}>
249
+ ${properties.label || ""}
250
+ </Checkbox>
251
+ </Form.Item>`;
252
+ }
253
+ },
254
+ radio: {
255
+ imports: ["import { Radio, Form } from 'antd'"],
256
+ render: (ctx) => {
257
+ const { properties } = ctx;
258
+ return `<Form.Item label="${properties.label || "Options"}" name="${properties.name || "field"}">
259
+ <Radio.Group ${properties.buttonStyle ? `buttonStyle="${properties.buttonStyle}"` : ""}>
260
+ {${properties.options || "options"}?.map((option) => (
261
+ <Radio${properties.buttonStyle ? ".Button" : ""} key={option.value} value={option.value}>
262
+ {option.label}
263
+ </Radio${properties.buttonStyle ? ".Button" : ""}>
264
+ ))}
265
+ </Radio.Group>
266
+ </Form.Item>`;
267
+ }
268
+ },
269
+ slider: {
270
+ imports: ["import { Slider, Form } from 'antd'"],
271
+ render: (ctx) => {
272
+ const { properties } = ctx;
273
+ return `<Form.Item label="${properties.label || ""}" name="${properties.name || "field"}">
274
+ <Slider
275
+ min={${properties.min || 0}}
276
+ max={${properties.max || 100}}
277
+ step={${properties.step || 1}}
278
+ ${properties.marks ? "marks={marks}" : ""}
279
+ ${properties.range ? "range" : ""}
280
+ ${properties.vertical ? "vertical" : ""}
281
+ />
282
+ </Form.Item>`;
283
+ }
284
+ },
285
+ switch: {
286
+ imports: ["import { Switch, Form } from 'antd'"],
287
+ render: (ctx) => {
288
+ const { properties } = ctx;
289
+ return `<Form.Item label="${properties.label || ""}" name="${properties.name || "field"}" valuePropName="checked">
290
+ <Switch
291
+ ${properties.disabled ? "disabled" : ""}
292
+ ${properties.checkedChildren ? `checkedChildren="${properties.checkedChildren}"` : ""}
293
+ ${properties.unCheckedChildren ? `unCheckedChildren="${properties.unCheckedChildren}"` : ""}
294
+ />
295
+ </Form.Item>`;
296
+ }
297
+ },
298
+ autocomplete: {
299
+ imports: ["import { AutoComplete, Form } from 'antd'"],
300
+ render: (ctx) => {
301
+ const { properties } = ctx;
302
+ return `<Form.Item label="${properties.label || ""}" name="${properties.name || "field"}">
303
+ <AutoComplete
304
+ options={${properties.options || "options"}}
305
+ placeholder="${properties.placeholder || "Type to search..."}"
306
+ filterOption={(inputValue, option) =>
307
+ option!.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
308
+ }
309
+ ${properties.allowClear ? "allowClear" : ""}
310
+ />
311
+ </Form.Item>`;
312
+ }
313
+ },
314
+ datepicker: {
315
+ imports: ["import { DatePicker, Form } from 'antd'"],
316
+ render: (ctx) => {
317
+ const { properties } = ctx;
318
+ return `<Form.Item label="${properties.label || "Select Date"}" name="${properties.name || "field"}">
319
+ <DatePicker
320
+ ${properties.format ? `format="${properties.format}"` : ""}
321
+ ${properties.showTime ? "showTime" : ""}
322
+ ${properties.picker ? `picker="${properties.picker}"` : ""}
323
+ style={{ width: '100%' }}
324
+ />
325
+ </Form.Item>`;
326
+ }
327
+ },
328
+ timepicker: {
329
+ imports: ["import { TimePicker, Form } from 'antd'"],
330
+ render: (ctx) => {
331
+ const { properties } = ctx;
332
+ return `<Form.Item label="${properties.label || "Select Time"}" name="${properties.name || "field"}">
333
+ <TimePicker
334
+ ${properties.format ? `format="${properties.format}"` : ""}
335
+ ${properties.use12Hours ? "use12Hours" : ""}
336
+ style={{ width: '100%' }}
337
+ />
338
+ </Form.Item>`;
339
+ }
340
+ },
341
+ // ====================================================================
342
+ // ACTIONS (5 types)
343
+ // ====================================================================
344
+ button: {
345
+ imports: ["import { Button } from 'antd'"],
346
+ render: (ctx) => {
347
+ const { properties } = ctx;
348
+ const type = { primary: "primary", secondary: "default", danger: "primary" }[properties.variant || "primary"] || "default";
349
+ const danger = properties.variant === "danger";
350
+ return `<Button
351
+ type="${type}"
352
+ ${danger ? "danger" : ""}
353
+ size="${properties.size || "middle"}"
354
+ ${properties.disabled ? "disabled" : ""}
355
+ ${properties.loading ? "loading" : ""}
356
+ ${properties.block ? "block" : ""}
357
+ ${properties.icon ? `icon={<${properties.icon} />}` : ""}
358
+ ${properties.shape ? `shape="${properties.shape}"` : ""}
359
+ onClick={handleClick}
360
+ >
361
+ ${properties.label || "Button"}
362
+ </Button>`;
363
+ }
364
+ },
365
+ "button-group": {
366
+ imports: ["import { Button, Space } from 'antd'"],
367
+ render: (ctx) => {
368
+ const { properties, children } = ctx;
369
+ return `<Space.Compact ${properties.size ? `size="${properties.size}"` : ""}>
370
+ ${children || "{/* Buttons */}"}
371
+ </Space.Compact>`;
372
+ }
373
+ },
374
+ link: {
375
+ imports: ["import { Typography } from 'antd'"],
376
+ render: (ctx) => {
377
+ const { properties } = ctx;
378
+ return `<Typography.Link
379
+ href="${properties.href || "#"}"
380
+ ${properties.disabled ? "disabled" : ""}
381
+ ${properties.underline === false ? "underline={false}" : ""}
382
+ ${properties.external ? 'target="_blank"' : ""}
383
+ >
384
+ ${properties.label || "Link"}
385
+ </Typography.Link>`;
386
+ }
387
+ },
388
+ icon: {
389
+ imports: ["// Import specific icons: import { HomeOutlined, SettingOutlined } from '@ant-design/icons'"],
390
+ render: (ctx) => {
391
+ const { properties } = ctx;
392
+ return `<${properties.name || "Icon"}Outlined style={{ fontSize: '${properties.size === "small" ? "12px" : properties.size === "large" ? "24px" : "16px"}' }} />`;
393
+ }
394
+ },
395
+ menu: {
396
+ imports: ["import { Menu, Dropdown, Button } from 'antd'", "import { MoreOutlined } from '@ant-design/icons'"],
397
+ render: (ctx) => {
398
+ const { properties } = ctx;
399
+ return `<Dropdown
400
+ menu={{
401
+ items: ${properties.items || "menuItems"},
402
+ onClick: handleMenuClick
403
+ }}
404
+ trigger={['click']}
405
+ >
406
+ <Button icon={<MoreOutlined />} />
407
+ </Dropdown>`;
408
+ }
409
+ },
410
+ // ====================================================================
411
+ // OVERLAYS & FEEDBACK (9 types)
412
+ // ====================================================================
413
+ modal: {
414
+ imports: ["import { Modal } from 'antd'"],
415
+ render: (ctx) => {
416
+ const { properties, children } = ctx;
417
+ return `<Modal
418
+ title="${properties.title || "Modal"}"
419
+ open={open}
420
+ onOk={handleOk}
421
+ onCancel={handleCancel}
422
+ ${properties.width ? `width={${properties.width}}` : ""}
423
+ ${properties.centered ? "centered" : ""}
424
+ ${properties.footer === false ? "footer={null}" : ""}
425
+ >
426
+ ${children || "{/* Content */}"}
427
+ </Modal>`;
428
+ }
429
+ },
430
+ dialog: {
431
+ imports: ["import { Modal } from 'antd'"],
432
+ render: (ctx) => {
433
+ const { properties, children } = ctx;
434
+ return `<Modal
435
+ title="${properties.title || "Dialog"}"
436
+ open={open}
437
+ onOk={handleOk}
438
+ onCancel={handleCancel}
439
+ ${properties.closable !== false ? "" : "closable={false}"}
440
+ ${properties.maskClosable !== false ? "" : "maskClosable={false}"}
441
+ >
442
+ ${children || "{/* Content */}"}
443
+ </Modal>`;
444
+ }
445
+ },
446
+ drawer: {
447
+ imports: ["import { Drawer } from 'antd'"],
448
+ render: (ctx) => {
449
+ const { properties, children } = ctx;
450
+ const placement = properties.position === "left" ? "left" : properties.position === "right" ? "right" : properties.position === "top" ? "top" : "bottom";
451
+ return `<Drawer
452
+ title="${properties.title || "Drawer"}"
453
+ placement="${placement}"
454
+ open={open}
455
+ onClose={handleClose}
456
+ ${properties.width ? `width={${properties.width}}` : ""}
457
+ ${properties.height ? `height={${properties.height}}` : ""}
458
+ >
459
+ ${children || "{/* Content */}"}
460
+ </Drawer>`;
461
+ }
462
+ },
463
+ popover: {
464
+ imports: ["import { Popover, Button } from 'antd'"],
465
+ render: (ctx) => {
466
+ const { properties, children } = ctx;
467
+ return `<Popover
468
+ content={${properties.content ? `"${properties.content}"` : "content"}}
469
+ title="${properties.title || ""}"
470
+ trigger="${properties.trigger || "click"}"
471
+ placement="${properties.placement || "top"}"
472
+ >
473
+ ${children || "<Button>Trigger</Button>"}
474
+ </Popover>`;
475
+ }
476
+ },
477
+ tooltip: {
478
+ imports: ["import { Tooltip } from 'antd'"],
479
+ render: (ctx) => {
480
+ const { properties, children } = ctx;
481
+ return `<Tooltip
482
+ title="${properties.content || ""}"
483
+ placement="${properties.placement || "top"}"
484
+ ${properties.color ? `color="${properties.color}"` : ""}
485
+ >
486
+ ${children || "<span>{children}</span>"}
487
+ </Tooltip>`;
488
+ }
489
+ },
490
+ alert: {
491
+ imports: ["import { Alert } from 'antd'"],
492
+ render: (ctx) => {
493
+ const { properties } = ctx;
494
+ const type = properties.variant === "error" ? "error" : properties.variant === "warning" ? "warning" : properties.variant === "success" ? "success" : "info";
495
+ return `<Alert
496
+ message="${properties.title || ""}"
497
+ description="${properties.message || ""}"
498
+ type="${type}"
499
+ ${properties.closable ? "closable" : ""}
500
+ ${properties.showIcon !== false ? "showIcon" : ""}
501
+ ${properties.banner ? "banner" : ""}
502
+ />`;
503
+ }
504
+ },
505
+ snackbar: {
506
+ imports: ["import { message } from 'antd'"],
507
+ render: (ctx) => {
508
+ const { properties } = ctx;
509
+ return `{/* Use Ant Design message API */}
510
+ {/* message.${properties.variant || "info"}('${properties.message || "Notification"}', ${properties.duration || 3}) */}`;
511
+ }
512
+ },
513
+ badge: {
514
+ imports: ["import { Badge } from 'antd'"],
515
+ render: (ctx) => {
516
+ const { properties, children } = ctx;
517
+ return `<Badge
518
+ count={${properties.count || 0}}
519
+ ${properties.dot ? "dot" : ""}
520
+ ${properties.status ? `status="${properties.status}"` : ""}
521
+ ${properties.color ? `color="${properties.color}"` : ""}
522
+ ${properties.overflowCount ? `overflowCount={${properties.overflowCount}}` : ""}
523
+ >
524
+ ${children || "{children}"}
525
+ </Badge>`;
526
+ }
527
+ },
528
+ spinner: {
529
+ imports: ["import { Spin } from 'antd'"],
530
+ render: (ctx) => {
531
+ const { properties } = ctx;
532
+ const size = properties.size === "small" ? "small" : properties.size === "large" ? "large" : "default";
533
+ return `<Spin size="${size}" ${properties.tip ? `tip="${properties.tip}"` : ""} />`;
534
+ }
535
+ },
536
+ // ====================================================================
537
+ // NAVIGATION (5 types)
538
+ // ====================================================================
539
+ tabs: {
540
+ imports: ["import { Tabs } from 'antd'"],
541
+ render: (ctx) => {
542
+ const { properties } = ctx;
543
+ return `<Tabs
544
+ activeKey={activeKey}
545
+ onChange={handleChange}
546
+ ${properties.type ? `type="${properties.type}"` : ""}
547
+ ${properties.tabPosition ? `tabPosition="${properties.tabPosition}"` : ""}
548
+ items={${properties.items || "tabItems"}}
549
+ />`;
550
+ }
551
+ },
552
+ breadcrumb: {
553
+ imports: ["import { Breadcrumb } from 'antd'"],
554
+ render: (ctx) => {
555
+ const { properties } = ctx;
556
+ return `<Breadcrumb
557
+ items={${properties.items || "breadcrumbItems"}}
558
+ ${properties.separator ? `separator="${properties.separator}"` : ""}
559
+ />`;
560
+ }
561
+ },
562
+ navbar: {
563
+ imports: ["import { Layout, Menu } from 'antd'", "const { Header } = Layout"],
564
+ render: (ctx) => {
565
+ const { properties, children } = ctx;
566
+ return `<Header ${properties.className ? `className="${properties.className}"` : ""}>
567
+ <div style={{ float: 'left', color: '#fff', fontSize: '18px', fontWeight: 'bold' }}>
568
+ ${properties.brand || "App"}
569
+ </div>
570
+ ${children || '<Menu theme="dark" mode="horizontal" items={menuItems} />'}
571
+ </Header>`;
572
+ }
573
+ },
574
+ sidebar: {
575
+ imports: ["import { Layout, Menu } from 'antd'", "const { Sider } = Layout"],
576
+ render: (ctx) => {
577
+ const { properties } = ctx;
578
+ return `<Sider
579
+ ${properties.collapsible ? "collapsible" : ""}
580
+ ${properties.collapsed !== void 0 ? `collapsed={${properties.collapsed}}` : ""}
581
+ width={${properties.width || 200}}
582
+ ${properties.theme ? `theme="${properties.theme}"` : ""}
583
+ >
584
+ <Menu
585
+ mode="inline"
586
+ ${properties.theme ? `theme="${properties.theme}"` : ""}
587
+ items={${properties.items || "menuItems"}}
588
+ />
589
+ </Sider>`;
590
+ }
591
+ },
592
+ pagination: {
593
+ imports: ["import { Pagination } from 'antd'"],
594
+ render: (ctx) => {
595
+ const { properties } = ctx;
596
+ return `<Pagination
597
+ current={current}
598
+ total={${properties.total || 100}}
599
+ pageSize={${properties.pageSize || 10}}
600
+ onChange={handleChange}
601
+ ${properties.showSizeChanger ? "showSizeChanger" : ""}
602
+ ${properties.showQuickJumper ? "showQuickJumper" : ""}
603
+ ${properties.showTotal ? `showTotal={(total) => \`Total \${total} items\`}` : ""}
604
+ ${properties.size ? `size="${properties.size}"` : ""}
605
+ />`;
606
+ }
607
+ },
608
+ // ====================================================================
609
+ // LAYOUT (6 types)
610
+ // ====================================================================
611
+ accordion: {
612
+ imports: ["import { Collapse } from 'antd'"],
613
+ render: (ctx) => {
614
+ const { properties } = ctx;
615
+ return `<Collapse
616
+ ${properties.accordion ? "accordion" : ""}
617
+ ${properties.bordered !== false ? "" : "bordered={false}"}
618
+ ${properties.expandIconPosition ? `expandIconPosition="${properties.expandIconPosition}"` : ""}
619
+ items={${properties.items || "collapseItems"}}
620
+ />`;
621
+ }
622
+ },
623
+ carousel: {
624
+ imports: ["import { Carousel } from 'antd'"],
625
+ render: (ctx) => {
626
+ const { properties } = ctx;
627
+ return `<Carousel
628
+ ${properties.autoplay ? "autoplay" : ""}
629
+ ${properties.autoplaySpeed ? `autoplaySpeed={${properties.autoplaySpeed}}` : ""}
630
+ ${properties.dots !== false ? "" : "dots={false}"}
631
+ ${properties.effect ? `effect="${properties.effect}"` : ""}
632
+ >
633
+ {items?.map((item) => (
634
+ <div key={item.id}>{item.content}</div>
635
+ ))}
636
+ </Carousel>`;
637
+ }
638
+ },
639
+ container: {
640
+ imports: ["import { Layout } from 'antd'", "const { Content } = Layout"],
641
+ render: (ctx) => {
642
+ const { properties, children } = ctx;
643
+ return `<Content style={{ padding: '${properties.padding || "24px"}', ${properties.maxWidth ? `maxWidth: '${properties.maxWidth}'` : ""} }}>
644
+ ${children || "{/* Content */}"}
645
+ </Content>`;
646
+ }
647
+ },
648
+ divider: {
649
+ imports: ["import { Divider } from 'antd'"],
650
+ render: (ctx) => {
651
+ const { properties } = ctx;
652
+ return `<Divider
653
+ ${properties.type === "vertical" ? 'type="vertical"' : ""}
654
+ ${properties.dashed ? "dashed" : ""}
655
+ ${properties.orientation ? `orientation="${properties.orientation}"` : ""}
656
+ >
657
+ ${properties.text || ""}
658
+ </Divider>`;
659
+ }
660
+ },
661
+ header: {
662
+ imports: ["import { Layout, Typography } from 'antd'", "const { Header } = Layout", "const { Title } = Typography"],
663
+ render: (ctx) => {
664
+ const { properties, children } = ctx;
665
+ return `<Header style={{ padding: '16px 24px', background: '#fff', borderBottom: '1px solid #f0f0f0' }}>
666
+ ${properties.title ? `<Title level={4}>${properties.title}</Title>` : ""}
667
+ ${properties.subtitle ? `<Typography.Text type="secondary">${properties.subtitle}</Typography.Text>` : ""}
668
+ ${children || ""}
669
+ </Header>`;
670
+ }
671
+ },
672
+ footer: {
673
+ imports: ["import { Layout, Typography } from 'antd'", "const { Footer } = Layout"],
674
+ render: (ctx) => {
675
+ const { properties, children } = ctx;
676
+ return `<Footer style={{ textAlign: 'center', padding: '24px 50px' }}>
677
+ ${properties.copyright ? `<Typography.Text>${properties.copyright}</Typography.Text>` : ""}
678
+ ${children || ""}
679
+ </Footer>`;
680
+ }
681
+ },
682
+ // ====================================================================
683
+ // PROGRESS (2 types)
684
+ // ====================================================================
685
+ "progress-bar": {
686
+ imports: ["import { Progress } from 'antd'"],
687
+ render: (ctx) => {
688
+ const { properties } = ctx;
689
+ return `<Progress
690
+ percent={${properties.value || 0}}
691
+ ${properties.status ? `status="${properties.status}"` : ""}
692
+ ${properties.showInfo !== false ? "" : "showInfo={false}"}
693
+ ${properties.strokeColor ? `strokeColor="${properties.strokeColor}"` : ""}
694
+ ${properties.size ? `size="${properties.size}"` : ""}
695
+ />`;
696
+ }
697
+ },
698
+ "progress-circle": {
699
+ imports: ["import { Progress } from 'antd'"],
700
+ render: (ctx) => {
701
+ const { properties } = ctx;
702
+ return `<Progress
703
+ type="circle"
704
+ percent={${properties.value || 0}}
705
+ ${properties.status ? `status="${properties.status}"` : ""}
706
+ ${properties.width ? `width={${properties.width}}` : ""}
707
+ ${properties.strokeColor ? `strokeColor="${properties.strokeColor}"` : ""}
708
+ />`;
709
+ }
710
+ },
711
+ // ====================================================================
712
+ // SPECIALIZED (2 types)
713
+ // ====================================================================
714
+ searchBar: {
715
+ imports: ["import { Input } from 'antd'", "import { SearchOutlined } from '@ant-design/icons'"],
716
+ render: (ctx) => {
717
+ const { properties } = ctx;
718
+ return `<Input.Search
719
+ placeholder="${properties.placeholder || "Search..."}"
720
+ ${properties.enterButton !== false ? "enterButton" : ""}
721
+ ${properties.loading ? "loading" : ""}
722
+ ${properties.size ? `size="${properties.size}"` : ""}
723
+ onSearch={handleSearch}
724
+ />`;
725
+ }
726
+ },
727
+ filterPanel: {
728
+ imports: ["import { Card, Space } from 'antd'"],
729
+ render: (ctx) => {
730
+ const { properties, children } = ctx;
731
+ return `<Card title="Filters" ${properties.bordered !== false ? "" : "bordered={false}"}>
732
+ <Space direction="vertical" style={{ width: '100%' }}>
733
+ ${children || "{/* Filter controls */}"}
734
+ </Space>
735
+ </Card>`;
736
+ }
737
+ }
738
+ }
739
+ };
740
+ export {
741
+ antdAdapter
742
+ };