@specverse/engines 4.1.30 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/assets/examples/manifests/frontend-only.yaml +3 -6
  2. package/assets/examples/manifests/fullstack-app.yaml +5 -7
  3. package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
  4. package/assets/templates/default/specs/main.specly +65 -0
  5. package/dist/inference/comprehensive-engine.d.ts.map +1 -1
  6. package/dist/inference/comprehensive-engine.js +3 -19
  7. package/dist/inference/comprehensive-engine.js.map +1 -1
  8. package/dist/inference/core/rule-engine.d.ts +31 -0
  9. package/dist/inference/core/rule-engine.d.ts.map +1 -1
  10. package/dist/inference/core/rule-engine.js +117 -33
  11. package/dist/inference/core/rule-engine.js.map +1 -1
  12. package/dist/inference/core/rule-file-types.d.ts +0 -2
  13. package/dist/inference/core/rule-file-types.d.ts.map +1 -1
  14. package/dist/inference/core/rule-file-types.js +3 -6
  15. package/dist/inference/core/rule-file-types.js.map +1 -1
  16. package/dist/inference/core/rule-loader.d.ts +5 -15
  17. package/dist/inference/core/rule-loader.d.ts.map +1 -1
  18. package/dist/inference/core/rule-loader.js +43 -132
  19. package/dist/inference/core/rule-loader.js.map +1 -1
  20. package/dist/inference/core/types.d.ts +0 -6
  21. package/dist/inference/core/types.d.ts.map +1 -1
  22. package/dist/inference/core/types.js +0 -4
  23. package/dist/inference/core/types.js.map +1 -1
  24. package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
  25. package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
  26. package/dist/inference/logical/generators/component-type-resolver.js +0 -19
  27. package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
  28. package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
  29. package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
  30. package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
  31. package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
  32. package/dist/inference/logical/generators/view-generator.d.ts +4 -14
  33. package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
  34. package/dist/inference/logical/generators/view-generator.js +6 -26
  35. package/dist/inference/logical/generators/view-generator.js.map +1 -1
  36. package/dist/inference/logical/index.d.ts +2 -2
  37. package/dist/inference/logical/index.d.ts.map +1 -1
  38. package/dist/inference/logical/logical-engine.d.ts.map +1 -1
  39. package/dist/inference/logical/logical-engine.js +17 -80
  40. package/dist/inference/logical/logical-engine.js.map +1 -1
  41. package/dist/inference/quint-transpiler.d.ts +5 -3
  42. package/dist/inference/quint-transpiler.d.ts.map +1 -1
  43. package/dist/inference/quint-transpiler.js +11 -6
  44. package/dist/inference/quint-transpiler.js.map +1 -1
  45. package/dist/libs/instance-factories/CURVED-INTERFACE.md +278 -0
  46. package/dist/libs/instance-factories/README.md +73 -0
  47. package/dist/libs/instance-factories/applications/README.md +51 -0
  48. package/dist/libs/instance-factories/applications/generic-app.yaml +52 -0
  49. package/{libs/instance-factories/applications/react-app.yaml → dist/libs/instance-factories/applications/react-app-runtime.yaml} +30 -77
  50. package/dist/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  51. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +24 -2
  52. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +54 -33
  53. package/dist/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  54. package/dist/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.js +69 -0
  55. package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
  56. package/dist/libs/instance-factories/applications/templates/react-starter/belongs-to.js +40 -0
  57. package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +129 -0
  58. package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +80 -0
  59. package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +217 -0
  60. package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +51 -0
  61. package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
  62. package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +56 -0
  63. package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +41 -0
  64. package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
  65. package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
  66. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  67. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  68. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  69. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  70. package/dist/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.js +95 -0
  71. package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +81 -0
  72. package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
  73. package/dist/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
  74. package/dist/libs/instance-factories/cli/README.md +43 -0
  75. package/dist/libs/instance-factories/cli/commander-js.yaml +55 -0
  76. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +63 -12
  77. package/dist/libs/instance-factories/communication/README.md +47 -0
  78. package/dist/libs/instance-factories/communication/event-emitter.yaml +60 -0
  79. package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
  80. package/dist/libs/instance-factories/controllers/README.md +42 -0
  81. package/dist/libs/instance-factories/controllers/fastify.yaml +139 -0
  82. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +29 -2
  83. package/dist/libs/instance-factories/infrastructure/README.md +29 -0
  84. package/dist/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
  85. package/dist/libs/instance-factories/orms/README.md +54 -0
  86. package/dist/libs/instance-factories/orms/prisma.yaml +89 -0
  87. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +2 -2
  88. package/dist/libs/instance-factories/scaffolding/README.md +49 -0
  89. package/dist/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
  90. package/dist/libs/instance-factories/sdks/README.md +28 -0
  91. package/dist/libs/instance-factories/sdks/python-sdk.yaml +66 -0
  92. package/dist/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
  93. package/dist/libs/instance-factories/services/README.md +55 -0
  94. package/dist/libs/instance-factories/services/prisma-services.yaml +71 -0
  95. package/dist/libs/instance-factories/storage/README.md +34 -0
  96. package/dist/libs/instance-factories/storage/mongodb.yaml +79 -0
  97. package/dist/libs/instance-factories/storage/postgresql.yaml +75 -0
  98. package/dist/libs/instance-factories/storage/redis.yaml +79 -0
  99. package/dist/libs/instance-factories/testing/README.md +40 -0
  100. package/dist/libs/instance-factories/testing/vitest-tests.yaml +63 -0
  101. package/dist/libs/instance-factories/tools/README.md +70 -0
  102. package/dist/libs/instance-factories/tools/mcp.yaml +36 -0
  103. package/dist/libs/instance-factories/tools/vscode.yaml +35 -0
  104. package/dist/libs/instance-factories/validation/README.md +38 -0
  105. package/dist/libs/instance-factories/validation/zod.yaml +56 -0
  106. package/dist/realize/engines/code-generator.d.ts.map +1 -1
  107. package/dist/realize/engines/code-generator.js +3 -0
  108. package/dist/realize/engines/code-generator.js.map +1 -1
  109. package/dist/realize/index.d.ts.map +1 -1
  110. package/dist/realize/index.js +15 -22
  111. package/dist/realize/index.js.map +1 -1
  112. package/dist/registry/utils/manifest-adapter.d.ts +8 -1
  113. package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
  114. package/dist/registry/utils/manifest-adapter.js +8 -1
  115. package/dist/registry/utils/manifest-adapter.js.map +1 -1
  116. package/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  117. package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -2
  118. package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +54 -33
  119. package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  120. package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
  121. package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +146 -0
  122. package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +188 -0
  123. package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
  124. package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
  125. package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
  126. package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +184 -0
  127. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
  128. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
  129. package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
  130. package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
  131. package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
  132. package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
  133. package/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.ts +98 -0
  134. package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
  135. package/libs/instance-factories/applications/templates/react-starter/belongs-to.ts +82 -0
  136. package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +189 -0
  137. package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
  138. package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +383 -0
  139. package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +66 -0
  140. package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
  141. package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +146 -0
  142. package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +95 -0
  143. package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
  144. package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
  145. package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  146. package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  147. package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  148. package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  149. package/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.ts +124 -0
  150. package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +209 -0
  151. package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
  152. package/libs/instance-factories/cli/templates/commander/command-generator.ts +63 -12
  153. package/libs/instance-factories/controllers/fastify.yaml +7 -0
  154. package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +36 -2
  155. package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +11 -4
  156. package/package.json +3 -3
  157. package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
  158. package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
  159. package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
  160. package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
  161. package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
  162. package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
  163. package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
  164. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
  165. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
  166. package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
  167. package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
  168. package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
  169. package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
  170. package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
  171. package/dist/libs/instance-factories/views/index.js +0 -48
  172. package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
  173. package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
  174. package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
  175. package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
  176. package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
  177. package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
  178. package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
  179. package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
  180. package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
  181. package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
  182. package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
  183. package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
  184. package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
  185. package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
  186. package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
  187. package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
  188. package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
  189. package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
  190. package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
  191. package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
  192. package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
  193. package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
  194. package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
  195. package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
  196. package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
  197. package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
  198. package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
  199. package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
  200. package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
  201. package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
  202. package/dist/realize/index.js.bak +0 -758
  203. package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
  204. package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
  205. package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
  206. package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
  207. package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
  208. package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
  209. package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
  210. package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
  211. package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
  212. package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
  213. package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
  214. package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
  215. package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
  216. package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
  217. package/libs/instance-factories/views/README.md +0 -62
  218. package/libs/instance-factories/views/index.d.ts +0 -13
  219. package/libs/instance-factories/views/index.d.ts.map +0 -1
  220. package/libs/instance-factories/views/index.js +0 -18
  221. package/libs/instance-factories/views/index.js.map +0 -1
  222. package/libs/instance-factories/views/index.ts +0 -45
  223. package/libs/instance-factories/views/react-components.yaml +0 -129
  224. package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
  225. package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
  226. package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
  227. package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
  228. package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
  229. package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
  230. package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
  231. package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
  232. package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
  233. package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
  234. package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
  235. package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
  236. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
  237. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
  238. package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
  239. package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
  240. package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
  241. package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
  242. package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
  243. package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
  244. package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
  245. package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
  246. package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
  247. package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
  248. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
  249. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
  250. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
  251. package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
  252. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
  253. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
  254. package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
  255. package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
  256. package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
  257. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
  258. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
  259. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
  260. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
  261. package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
  262. package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
  263. package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
  264. package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
  265. package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
  266. package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
  267. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
  268. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
  269. package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
  270. package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
  271. package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
  272. package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
  273. package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
  274. package/libs/instance-factories/views/templates/shared/index.ts +0 -68
  275. package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
  276. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
  277. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
  278. package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
  279. package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
  280. package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
  281. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
  282. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
  283. package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
  284. package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
  285. package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
@@ -1,953 +0,0 @@
1
- /**
2
- * Material-UI (MUI) Adapter
3
- *
4
- * Maps all 49 atomic component types to Material-UI components.
5
- *
6
- * @see https://mui.com/material-ui/
7
- * @see ../../shared/atomic-components-registry.ts
8
- */
9
-
10
- import type { ComponentLibraryAdapter, RenderContext } from '../../shared/adapter-types.js';
11
-
12
- /**
13
- * Helper to render props object
14
- */
15
- function renderProps(properties: Record<string, any>, exclude: string[] = []): string {
16
- return Object.entries(properties)
17
- .filter(([key]) => !exclude.includes(key))
18
- .map(([key, value]) => {
19
- if (typeof value === 'boolean') return value ? key : '';
20
- if (typeof value === 'string') return `${key}="${value}"`;
21
- return `${key}={${JSON.stringify(value)}}`;
22
- })
23
- .filter(Boolean)
24
- .join(' ');
25
- }
26
-
27
- /**
28
- * Material-UI Component Library Adapter
29
- */
30
- export const muiAdapter: ComponentLibraryAdapter = {
31
- name: 'Material-UI',
32
- version: '5.x',
33
- description: 'Material-UI (MUI) component library adapter',
34
-
35
- baseDependencies: [
36
- { name: '@mui/material', version: '^5.15.0' },
37
- { name: '@mui/icons-material', version: '^5.15.0' },
38
- { name: '@emotion/react', version: '^11.11.0' },
39
- { name: '@emotion/styled', version: '^11.11.0' },
40
- ],
41
-
42
- config: {
43
- importPrefix: '@mui/material',
44
- importStyle: 'named',
45
- },
46
-
47
- components: {
48
- // ====================================================================
49
- // DATA DISPLAY (9 types)
50
- // ====================================================================
51
-
52
- table: {
53
- imports: [
54
- "import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, TablePagination, TableSortLabel } from '@mui/material'",
55
- ],
56
- render: (ctx: RenderContext) => {
57
- const { properties, model } = ctx;
58
- const columns = properties.columns || ['id'];
59
- const modelVar = model?.name?.toLowerCase() || 'item';
60
- const sortable = properties.sortable !== false;
61
- const pagination = properties.pagination !== false;
62
-
63
- return `<TableContainer component={Paper}>
64
- <Table ${properties.size ? `size="${properties.size}"` : ''}>
65
- <TableHead>
66
- <TableRow>
67
- ${columns.map((col: string) =>
68
- sortable
69
- ? `<TableCell><TableSortLabel>{${JSON.stringify(col)}}</TableSortLabel></TableCell>`
70
- : `<TableCell>{${JSON.stringify(col)}}</TableCell>`
71
- ).join('\n ')}
72
- </TableRow>
73
- </TableHead>
74
- <TableBody>
75
- {${modelVar}s?.map((${modelVar}) => (
76
- <TableRow key={${modelVar}.id}>
77
- ${columns.map((col: string) => `<TableCell>{${modelVar}.${col}}</TableCell>`).join('\n ')}
78
- </TableRow>
79
- ))}
80
- </TableBody>
81
- </Table>
82
- ${pagination ? `<TablePagination rowsPerPageOptions={[5, 10, 25]} component="div" count={total} rowsPerPage={rowsPerPage} page={page} onPageChange={handlePageChange} onRowsPerPageChange={handleRowsPerPageChange} />` : ''}
83
- </TableContainer>`;
84
- },
85
- },
86
-
87
- list: {
88
- imports: ["import { List, ListItem, ListItemText, ListItemIcon, ListItemButton, Divider } from '@mui/material'"],
89
- render: (ctx: RenderContext) => {
90
- const { properties, model } = ctx;
91
- const modelVar = model?.name?.toLowerCase() || 'item';
92
-
93
- return `<List ${properties.dense ? 'dense' : ''}>
94
- {${modelVar}s?.map((${modelVar}) => (
95
- <React.Fragment key={${modelVar}.id}>
96
- <ListItem${properties.clickable ? 'Button' : ''}>
97
- ${properties.showIcon ? `<ListItemIcon>{/* Icon */}</ListItemIcon>` : ''}
98
- <ListItemText
99
- primary={${modelVar}.${properties.primaryField || 'name'}}
100
- ${properties.secondaryField ? `secondary={${modelVar}.${properties.secondaryField}}` : ''}
101
- />
102
- </ListItem>
103
- ${properties.dividers ? '<Divider />' : ''}
104
- </React.Fragment>
105
- ))}
106
- </List>`;
107
- },
108
- },
109
-
110
- grid: {
111
- imports: ["import { Grid } from '@mui/material'"],
112
- render: (ctx: RenderContext) => {
113
- const { properties, children } = ctx;
114
- const spacing = properties.spacing || 2;
115
-
116
- return `<Grid container spacing={${spacing}}>
117
- {items?.map((item) => (
118
- <Grid item xs={${properties.xs || 12}} sm={${properties.sm || 6}} md={${properties.md || 4}} lg={${properties.lg || 3}} key={item.id}>
119
- ${children || '{/* Item content */}'}
120
- </Grid>
121
- ))}
122
- </Grid>`;
123
- },
124
- },
125
-
126
- card: {
127
- imports: ["import { Card, CardContent, CardMedia, CardActions, CardHeader, Typography } from '@mui/material'"],
128
- render: (ctx: RenderContext) => {
129
- const { properties, children } = ctx;
130
-
131
- return `<Card ${properties.variant ? `variant="${properties.variant}"` : ''}>
132
- ${properties.image ? `<CardMedia component="img" height="${properties.imageHeight || 140}" image={${properties.image}} alt="${properties.title || 'Card'}" />` : ''}
133
- ${properties.title ? `<CardHeader title="${properties.title}" ${properties.subtitle ? `subheader="${properties.subtitle}"` : ''} />` : ''}
134
- <CardContent>
135
- ${children || '<Typography variant="body2" color="text.secondary">{content}</Typography>'}
136
- </CardContent>
137
- ${properties.actions ? `<CardActions>{/* Actions */}</CardActions>` : ''}
138
- </Card>`;
139
- },
140
- },
141
-
142
- chart: {
143
- imports: [
144
- "import { Box } from '@mui/material'",
145
- "// Note: MUI doesn't include charts. Use @mui/x-charts or recharts",
146
- "// import { LineChart, Line, BarChart, Bar, PieChart, Pie, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'",
147
- ],
148
- render: (ctx: RenderContext) => {
149
- const { properties } = ctx;
150
- const chartType = properties.chartType || 'line';
151
-
152
- return `<Box sx={{ width: '100%', height: ${properties.height || 400} }}>
153
- {/* TODO: Integrate @mui/x-charts or recharts */}
154
- {/* <ResponsiveContainer width="100%" height="100%">
155
- <${chartType === 'line' ? 'LineChart' : chartType === 'bar' ? 'BarChart' : 'PieChart'} data={data}>
156
- ${chartType !== 'pie' ? '<CartesianGrid strokeDasharray="3 3" /><XAxis dataKey="name" /><YAxis />' : ''}
157
- <Tooltip />${properties.showLegend !== false ? '<Legend />' : ''}
158
- <${chartType === 'line' ? 'Line' : chartType === 'bar' ? 'Bar' : 'Pie'} dataKey="value" fill="#8884d8" />
159
- </${chartType === 'line' ? 'LineChart' : chartType === 'bar' ? 'BarChart' : 'PieChart'}>
160
- </ResponsiveContainer> */}
161
- </Box>`;
162
- },
163
- dependencies: [
164
- { name: '@mui/x-charts', version: '^6.0.0' },
165
- ],
166
- },
167
-
168
- tree: {
169
- imports: ["import { TreeView, TreeItem } from '@mui/lab'", "import { ExpandMore, ChevronRight } from '@mui/icons-material'"],
170
- render: (ctx: RenderContext) => {
171
- const { properties } = ctx;
172
-
173
- return `<TreeView
174
- defaultCollapseIcon={<ExpandMore />}
175
- defaultExpandIcon={<ChevronRight />}
176
- ${properties.defaultExpanded ? 'defaultExpanded={defaultExpanded}' : ''}
177
- >
178
- {renderTree(data)}
179
- </TreeView>`;
180
- },
181
- dependencies: [
182
- { name: '@mui/lab', version: '^5.0.0-alpha.170' },
183
- ],
184
- },
185
-
186
- timeline: {
187
- imports: ["import { Timeline, TimelineItem, TimelineSeparator, TimelineConnector, TimelineContent, TimelineDot, TimelineOppositeContent } from '@mui/lab'"],
188
- render: (ctx: RenderContext) => {
189
- const { properties } = ctx;
190
- const position = properties.position || 'right';
191
-
192
- return `<Timeline position="${position}">
193
- {events?.map((event) => (
194
- <TimelineItem key={event.id}>
195
- ${properties.showDateMarkers ? `<TimelineOppositeContent color="text.secondary">{event.date}</TimelineOppositeContent>` : ''}
196
- <TimelineSeparator>
197
- <TimelineDot />
198
- <TimelineConnector />
199
- </TimelineSeparator>
200
- <TimelineContent>{event.title}</TimelineContent>
201
- </TimelineItem>
202
- ))}
203
- </Timeline>`;
204
- },
205
- dependencies: [
206
- { name: '@mui/lab', version: '^5.0.0-alpha.170' },
207
- ],
208
- },
209
-
210
- avatar: {
211
- imports: ["import { Avatar, AvatarGroup } from '@mui/material'"],
212
- render: (ctx: RenderContext) => {
213
- const { properties } = ctx;
214
- const size = properties.size === 'small' ? 'small' : properties.size === 'large' ? 'large' : 'medium';
215
-
216
- return `<Avatar
217
- src={${properties.src || 'undefined'}}
218
- alt="${properties.alt || ''}"
219
- ${properties.variant ? `variant="${properties.variant}"` : ''}
220
- sx={{ width: ${properties.size === 'small' ? 32 : properties.size === 'large' ? 56 : 40}, height: ${properties.size === 'small' ? 32 : properties.size === 'large' ? 56 : 40} }}
221
- >
222
- ${!properties.src ? '{initials}' : ''}
223
- </Avatar>`;
224
- },
225
- },
226
-
227
- image: {
228
- imports: ["import { Box, CardMedia } from '@mui/material'"],
229
- render: (ctx: RenderContext) => {
230
- const { properties } = ctx;
231
-
232
- return `<CardMedia
233
- component="img"
234
- image={${properties.src}}
235
- alt="${properties.alt || 'Image'}"
236
- ${properties.height ? `height={${properties.height}}` : ''}
237
- sx={{ objectFit: '${properties.objectFit || 'cover'}', ${properties.rounded ? 'borderRadius: 1' : ''} }}
238
- />`;
239
- },
240
- },
241
-
242
- // ====================================================================
243
- // FORMS & INPUTS (11 types)
244
- // ====================================================================
245
-
246
- form: {
247
- imports: ["import { Box } from '@mui/material'"],
248
- render: (ctx: RenderContext) => {
249
- const { properties, children } = ctx;
250
-
251
- return `<Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}>
252
- ${children || '{/* Form fields */}'}
253
- </Box>`;
254
- },
255
- },
256
-
257
- input: {
258
- imports: ["import { TextField } from '@mui/material'"],
259
- render: (ctx: RenderContext) => {
260
- const { properties } = ctx;
261
- const variant = properties.variant || 'outlined';
262
-
263
- return `<TextField
264
- label="${properties.label || ''}"
265
- type="${properties.type || 'text'}"
266
- placeholder="${properties.placeholder || ''}"
267
- variant="${variant}"
268
- fullWidth={${properties.fullWidth !== false}}
269
- required={${properties.required === true}}
270
- disabled={${properties.disabled === true}}
271
- ${properties.helperText ? `helperText="${properties.helperText}"` : ''}
272
- ${properties.error ? 'error' : ''}
273
- />`;
274
- },
275
- },
276
-
277
- textarea: {
278
- imports: ["import { TextField } from '@mui/material'"],
279
- render: (ctx: RenderContext) => {
280
- const { properties } = ctx;
281
-
282
- return `<TextField
283
- label="${properties.label || ''}"
284
- placeholder="${properties.placeholder || ''}"
285
- multiline
286
- rows={${properties.rows || 4}}
287
- variant="${properties.variant || 'outlined'}"
288
- fullWidth={${properties.fullWidth !== false}}
289
- required={${properties.required === true}}
290
- />`;
291
- },
292
- },
293
-
294
- select: {
295
- imports: ["import { FormControl, InputLabel, Select, MenuItem } from '@mui/material'"],
296
- render: (ctx: RenderContext) => {
297
- const { properties } = ctx;
298
-
299
- return `<FormControl fullWidth variant="${properties.variant || 'outlined'}">
300
- <InputLabel>${properties.label || 'Select'}</InputLabel>
301
- <Select
302
- value={value}
303
- label="${properties.label || 'Select'}"
304
- onChange={handleChange}
305
- ${properties.multiple ? 'multiple' : ''}
306
- >
307
- {${properties.options || 'options'}?.map((option) => (
308
- <MenuItem key={option.value} value={option.value}>
309
- {option.label}
310
- </MenuItem>
311
- ))}
312
- </Select>
313
- </FormControl>`;
314
- },
315
- },
316
-
317
- checkbox: {
318
- imports: ["import { FormControlLabel, Checkbox } from '@mui/material'"],
319
- render: (ctx: RenderContext) => {
320
- const { properties } = ctx;
321
-
322
- return `<FormControlLabel
323
- control={<Checkbox ${properties.checked ? 'checked' : ''} ${properties.disabled ? 'disabled' : ''} />}
324
- label="${properties.label || ''}"
325
- />`;
326
- },
327
- },
328
-
329
- radio: {
330
- imports: ["import { FormControl, FormLabel, RadioGroup, FormControlLabel, Radio } from '@mui/material'"],
331
- render: (ctx: RenderContext) => {
332
- const { properties } = ctx;
333
-
334
- return `<FormControl>
335
- <FormLabel>${properties.label || 'Options'}</FormLabel>
336
- <RadioGroup row={${properties.orientation === 'horizontal'}}>
337
- {${properties.options || 'options'}?.map((option) => (
338
- <FormControlLabel key={option.value} value={option.value} control={<Radio />} label={option.label} />
339
- ))}
340
- </RadioGroup>
341
- </FormControl>`;
342
- },
343
- },
344
-
345
- slider: {
346
- imports: ["import { Slider, Box, Typography } from '@mui/material'"],
347
- render: (ctx: RenderContext) => {
348
- const { properties } = ctx;
349
-
350
- return `<Box sx={{ width: '100%' }}>
351
- ${properties.label ? `<Typography gutterBottom>${properties.label}</Typography>` : ''}
352
- <Slider
353
- value={value}
354
- onChange={handleChange}
355
- min={${properties.min || 0}}
356
- max={${properties.max || 100}}
357
- step={${properties.step || 1}}
358
- ${properties.marks ? 'marks' : ''}
359
- valueLabelDisplay="${properties.showValue ? 'on' : 'auto'}"
360
- />
361
- </Box>`;
362
- },
363
- },
364
-
365
- switch: {
366
- imports: ["import { FormControlLabel, Switch } from '@mui/material'"],
367
- render: (ctx: RenderContext) => {
368
- const { properties } = ctx;
369
-
370
- return `<FormControlLabel
371
- control={<Switch ${properties.checked ? 'checked' : ''} ${properties.disabled ? 'disabled' : ''} />}
372
- label="${properties.label || ''}"
373
- />`;
374
- },
375
- },
376
-
377
- autocomplete: {
378
- imports: ["import { Autocomplete, TextField } from '@mui/material'"],
379
- render: (ctx: RenderContext) => {
380
- const { properties } = ctx;
381
-
382
- return `<Autocomplete
383
- options={${properties.options || 'options'}}
384
- ${properties.multiple ? 'multiple' : ''}
385
- ${properties.freeSolo ? 'freeSolo' : ''}
386
- renderInput={(params) => (
387
- <TextField {...params} label="${properties.label || 'Search'}" placeholder="${properties.placeholder || ''}" />
388
- )}
389
- />`;
390
- },
391
- },
392
-
393
- datepicker: {
394
- imports: [
395
- "import { DatePicker } from '@mui/x-date-pickers/DatePicker'",
396
- "import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'",
397
- "import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'",
398
- ],
399
- render: (ctx: RenderContext) => {
400
- const { properties } = ctx;
401
-
402
- return `<LocalizationProvider dateAdapter={AdapterDayjs}>
403
- <DatePicker
404
- label="${properties.label || 'Select Date'}"
405
- value={value}
406
- onChange={handleChange}
407
- />
408
- </LocalizationProvider>`;
409
- },
410
- dependencies: [
411
- { name: '@mui/x-date-pickers', version: '^6.0.0' },
412
- { name: 'dayjs', version: '^1.11.0' },
413
- ],
414
- },
415
-
416
- timepicker: {
417
- imports: [
418
- "import { TimePicker } from '@mui/x-date-pickers/TimePicker'",
419
- "import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'",
420
- "import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'",
421
- ],
422
- render: (ctx: RenderContext) => {
423
- const { properties } = ctx;
424
-
425
- return `<LocalizationProvider dateAdapter={AdapterDayjs}>
426
- <TimePicker
427
- label="${properties.label || 'Select Time'}"
428
- value={value}
429
- onChange={handleChange}
430
- />
431
- </LocalizationProvider>`;
432
- },
433
- dependencies: [
434
- { name: '@mui/x-date-pickers', version: '^6.0.0' },
435
- { name: 'dayjs', version: '^1.11.0' },
436
- ],
437
- },
438
-
439
- // ====================================================================
440
- // ACTIONS (5 types)
441
- // ====================================================================
442
-
443
- button: {
444
- imports: ["import { Button } from '@mui/material'"],
445
- render: (ctx: RenderContext) => {
446
- const { properties } = ctx;
447
- const variant = { primary: 'contained', secondary: 'outlined', danger: 'contained' }[properties.variant || 'primary'] || 'contained';
448
- const color = properties.variant === 'danger' ? 'error' : 'primary';
449
-
450
- return `<Button
451
- variant="${variant}"
452
- color="${color}"
453
- size="${properties.size || 'medium'}"
454
- ${properties.disabled ? 'disabled' : ''}
455
- ${properties.fullWidth ? 'fullWidth' : ''}
456
- startIcon={${properties.icon ? `<${properties.icon} />` : 'undefined'}}
457
- >
458
- ${properties.label || 'Button'}
459
- </Button>`;
460
- },
461
- },
462
-
463
- 'button-group': {
464
- imports: ["import { ButtonGroup, Button } from '@mui/material'"],
465
- render: (ctx: RenderContext) => {
466
- const { properties, children } = ctx;
467
-
468
- return `<ButtonGroup
469
- variant="${properties.variant || 'outlined'}"
470
- orientation="${properties.orientation || 'horizontal'}"
471
- size="${properties.size || 'medium'}"
472
- >
473
- ${children || '{/* Buttons */}'}
474
- </ButtonGroup>`;
475
- },
476
- },
477
-
478
- link: {
479
- imports: ["import { Link } from '@mui/material'"],
480
- render: (ctx: RenderContext) => {
481
- const { properties } = ctx;
482
-
483
- return `<Link
484
- href="${properties.href || '#'}"
485
- underline="${properties.underline || 'hover'}"
486
- ${properties.color ? `color="${properties.color}"` : ''}
487
- ${properties.external ? 'target="_blank" rel="noopener noreferrer"' : ''}
488
- >
489
- ${properties.label || 'Link'}
490
- </Link>`;
491
- },
492
- },
493
-
494
- icon: {
495
- imports: ["import { Icon } from '@mui/material'", "// Import specific icons: import { Home, Settings } from '@mui/icons-material'"],
496
- render: (ctx: RenderContext) => {
497
- const { properties } = ctx;
498
- const size = properties.size === 'small' ? 'small' : properties.size === 'large' ? 'large' : 'medium';
499
-
500
- return `<${properties.name || 'Icon'} fontSize="${size}" ${properties.color ? `color="${properties.color}"` : ''} />`;
501
- },
502
- },
503
-
504
- menu: {
505
- imports: ["import { Menu, MenuItem, IconButton } from '@mui/material'", "import { MoreVert } from '@mui/icons-material'"],
506
- render: (ctx: RenderContext) => {
507
- const { properties } = ctx;
508
-
509
- return `<>
510
- <IconButton onClick={handleClick}>
511
- <MoreVert />
512
- </IconButton>
513
- <Menu anchorEl={anchorEl} open={open} onClose={handleClose}>
514
- {${properties.items || 'menuItems'}?.map((item) => (
515
- <MenuItem key={item.id} onClick={handleClose}>
516
- {item.label}
517
- </MenuItem>
518
- ))}
519
- </Menu>
520
- </>`;
521
- },
522
- },
523
-
524
- // ====================================================================
525
- // OVERLAYS & FEEDBACK (9 types)
526
- // ====================================================================
527
-
528
- modal: {
529
- imports: ["import { Modal, Box, Typography } from '@mui/material'"],
530
- render: (ctx: RenderContext) => {
531
- const { properties, children } = ctx;
532
-
533
- return `<Modal
534
- open={open}
535
- onClose={handleClose}
536
- aria-labelledby="modal-title"
537
- >
538
- <Box sx={{
539
- position: 'absolute',
540
- top: '50%',
541
- left: '50%',
542
- transform: 'translate(-50%, -50%)',
543
- width: ${properties.width || 400},
544
- bgcolor: 'background.paper',
545
- boxShadow: 24,
546
- p: 4
547
- }}>
548
- ${properties.title ? `<Typography id="modal-title" variant="h6" component="h2">${properties.title}</Typography>` : ''}
549
- ${children || '{/* Content */}'}
550
- </Box>
551
- </Modal>`;
552
- },
553
- },
554
-
555
- dialog: {
556
- imports: ["import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material'"],
557
- render: (ctx: RenderContext) => {
558
- const { properties, children } = ctx;
559
-
560
- return `<Dialog open={open} onClose={handleClose} maxWidth="${properties.size || 'sm'}" fullWidth>
561
- ${properties.title ? `<DialogTitle>${properties.title}</DialogTitle>` : ''}
562
- <DialogContent>
563
- ${children || '{/* Content */}'}
564
- </DialogContent>
565
- <DialogActions>
566
- <Button onClick={handleClose}>Cancel</Button>
567
- <Button onClick={handleConfirm} variant="contained">Confirm</Button>
568
- </DialogActions>
569
- </Dialog>`;
570
- },
571
- },
572
-
573
- drawer: {
574
- imports: ["import { Drawer, Box } from '@mui/material'"],
575
- render: (ctx: RenderContext) => {
576
- const { properties, children } = ctx;
577
- const anchor = properties.position === 'left' ? 'left' : properties.position === 'right' ? 'right' : properties.position === 'top' ? 'top' : 'bottom';
578
-
579
- return `<Drawer
580
- anchor="${anchor}"
581
- open={open}
582
- onClose={handleClose}
583
- ${properties.variant === 'persistent' ? 'variant="persistent"' : ''}
584
- >
585
- <Box sx={{ width: ${properties.width || 250}, p: 2 }}>
586
- ${children || '{/* Content */}'}
587
- </Box>
588
- </Drawer>`;
589
- },
590
- },
591
-
592
- popover: {
593
- imports: ["import { Popover, Typography } from '@mui/material'"],
594
- render: (ctx: RenderContext) => {
595
- const { properties, children } = ctx;
596
-
597
- return `<Popover
598
- open={open}
599
- anchorEl={anchorEl}
600
- onClose={handleClose}
601
- anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
602
- >
603
- <Typography sx={{ p: 2 }}>
604
- ${children || properties.content || 'Popover content'}
605
- </Typography>
606
- </Popover>`;
607
- },
608
- },
609
-
610
- tooltip: {
611
- imports: ["import { Tooltip } from '@mui/material'"],
612
- render: (ctx: RenderContext) => {
613
- const { properties, children } = ctx;
614
- const placement = properties.placement || 'top';
615
-
616
- return `<Tooltip title="${properties.content || ''}" placement="${placement}" ${properties.arrow ? 'arrow' : ''}>
617
- ${children || '<span>{children}</span>'}
618
- </Tooltip>`;
619
- },
620
- },
621
-
622
- alert: {
623
- imports: ["import { Alert, AlertTitle } from '@mui/material'"],
624
- render: (ctx: RenderContext) => {
625
- const { properties } = ctx;
626
- const severity = properties.variant === 'error' ? 'error' : properties.variant === 'warning' ? 'warning' : properties.variant === 'success' ? 'success' : 'info';
627
-
628
- return `<Alert severity="${severity}" ${properties.closable ? 'onClose={handleClose}' : ''}>
629
- ${properties.title ? `<AlertTitle>${properties.title}</AlertTitle>` : ''}
630
- ${properties.message || 'Alert message'}
631
- </Alert>`;
632
- },
633
- },
634
-
635
- snackbar: {
636
- imports: ["import { Snackbar, Alert } from '@mui/material'"],
637
- render: (ctx: RenderContext) => {
638
- const { properties } = ctx;
639
- const vertical = properties.position?.includes('top') ? 'top' : 'bottom';
640
- const horizontal = properties.position?.includes('left') ? 'left' : properties.position?.includes('right') ? 'right' : 'center';
641
-
642
- return `<Snackbar
643
- open={open}
644
- autoHideDuration={${properties.duration || 6000}}
645
- onClose={handleClose}
646
- anchorOrigin={{ vertical: '${vertical}', horizontal: '${horizontal}' }}
647
- >
648
- <Alert onClose={handleClose} severity="${properties.variant || 'info'}" sx={{ width: '100%' }}>
649
- ${properties.message || 'Notification'}
650
- </Alert>
651
- </Snackbar>`;
652
- },
653
- },
654
-
655
- badge: {
656
- imports: ["import { Badge } from '@mui/material'"],
657
- render: (ctx: RenderContext) => {
658
- const { properties, children } = ctx;
659
-
660
- return `<Badge
661
- badgeContent={${properties.count || 0}}
662
- color="${properties.color || 'primary'}"
663
- ${properties.variant === 'dot' ? 'variant="dot"' : ''}
664
- ${properties.max ? `max={${properties.max}}` : ''}
665
- >
666
- ${children || '{children}'}
667
- </Badge>`;
668
- },
669
- },
670
-
671
- spinner: {
672
- imports: ["import { CircularProgress, Box } from '@mui/material'"],
673
- render: (ctx: RenderContext) => {
674
- const { properties } = ctx;
675
- const size = properties.size === 'small' ? 20 : properties.size === 'large' ? 60 : 40;
676
-
677
- return `<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
678
- <CircularProgress size={${size}} ${properties.color ? `color="${properties.color}"` : ''} />
679
- </Box>`;
680
- },
681
- },
682
-
683
- // ====================================================================
684
- // NAVIGATION (5 types)
685
- // ====================================================================
686
-
687
- tabs: {
688
- imports: ["import { Tabs, Tab, Box } from '@mui/material'"],
689
- render: (ctx: RenderContext) => {
690
- const { properties } = ctx;
691
-
692
- return `<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
693
- <Tabs
694
- value={value}
695
- onChange={handleChange}
696
- ${properties.variant === 'scrollable' ? 'variant="scrollable" scrollButtons="auto"' : ''}
697
- ${properties.centered ? 'centered' : ''}
698
- >
699
- {${properties.tabs || 'tabs'}?.map((tab) => (
700
- <Tab key={tab.value} label={tab.label} value={tab.value} />
701
- ))}
702
- </Tabs>
703
- </Box>`;
704
- },
705
- },
706
-
707
- breadcrumb: {
708
- imports: ["import { Breadcrumbs, Link, Typography } from '@mui/material'", "import { NavigateNext } from '@mui/icons-material'"],
709
- render: (ctx: RenderContext) => {
710
- const { properties } = ctx;
711
-
712
- return `<Breadcrumbs separator={<NavigateNext fontSize="small" />}>
713
- {${properties.items || 'breadcrumbs'}?.map((item, index) =>
714
- index === breadcrumbs.length - 1 ? (
715
- <Typography key={item.label} color="text.primary">{item.label}</Typography>
716
- ) : (
717
- <Link key={item.label} underline="hover" color="inherit" href={item.href}>{item.label}</Link>
718
- )
719
- )}
720
- </Breadcrumbs>`;
721
- },
722
- },
723
-
724
- navbar: {
725
- imports: ["import { AppBar, Toolbar, Typography, Button, IconButton } from '@mui/material'", "import { Menu as MenuIcon } from '@mui/icons-material'"],
726
- render: (ctx: RenderContext) => {
727
- const { properties, children } = ctx;
728
- const position = properties.fixed ? 'fixed' : 'static';
729
-
730
- return `<AppBar position="${position}" color="${properties.color || 'primary'}">
731
- <Toolbar>
732
- ${properties.showMenuButton ? '<IconButton edge="start" color="inherit" onClick={handleMenuClick}><MenuIcon /></IconButton>' : ''}
733
- <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
734
- ${properties.brand || 'App'}
735
- </Typography>
736
- ${children || '{/* Navigation items */}'}
737
- </Toolbar>
738
- </AppBar>`;
739
- },
740
- },
741
-
742
- sidebar: {
743
- imports: ["import { Drawer, List, ListItem, ListItemIcon, ListItemText, ListItemButton } from '@mui/material'"],
744
- render: (ctx: RenderContext) => {
745
- const { properties } = ctx;
746
- const variant = properties.variant === 'permanent' ? 'permanent' : properties.variant === 'persistent' ? 'persistent' : 'temporary';
747
-
748
- return `<Drawer
749
- variant="${variant}"
750
- anchor="${properties.position || 'left'}"
751
- open={open}
752
- ${variant === 'temporary' ? 'onClose={handleClose}' : ''}
753
- sx={{ width: ${properties.width || 240}, flexShrink: 0, '& .MuiDrawer-paper': { width: ${properties.width || 240}, boxSizing: 'border-box' } }}
754
- >
755
- <List>
756
- {${properties.items || 'menuItems'}?.map((item) => (
757
- <ListItemButton key={item.id}>
758
- {item.icon && <ListItemIcon>{item.icon}</ListItemIcon>}
759
- <ListItemText primary={item.label} />
760
- </ListItemButton>
761
- ))}
762
- </List>
763
- </Drawer>`;
764
- },
765
- },
766
-
767
- pagination: {
768
- imports: ["import { Pagination, Stack } from '@mui/material'"],
769
- render: (ctx: RenderContext) => {
770
- const { properties } = ctx;
771
-
772
- return `<Stack spacing={2} alignItems="center">
773
- <Pagination
774
- count={${properties.total || 10}}
775
- page={page}
776
- onChange={handleChange}
777
- color="${properties.color || 'primary'}"
778
- size="${properties.size || 'medium'}"
779
- ${properties.showFirstLast ? 'showFirstButton showLastButton' : ''}
780
- />
781
- </Stack>`;
782
- },
783
- },
784
-
785
- // ====================================================================
786
- // LAYOUT (6 types)
787
- // ====================================================================
788
-
789
- accordion: {
790
- imports: ["import { Accordion, AccordionSummary, AccordionDetails, Typography } from '@mui/material'", "import { ExpandMore } from '@mui/icons-material'"],
791
- render: (ctx: RenderContext) => {
792
- const { properties } = ctx;
793
-
794
- return `{${properties.items || 'accordionItems'}?.map((item) => (
795
- <Accordion key={item.id} ${properties.multiple ? '' : 'disableGutters'}>
796
- <AccordionSummary expandIcon={<ExpandMore />}>
797
- <Typography>{item.title}</Typography>
798
- </AccordionSummary>
799
- <AccordionDetails>
800
- <Typography>{item.content}</Typography>
801
- </AccordionDetails>
802
- </Accordion>
803
- ))}`;
804
- },
805
- },
806
-
807
- carousel: {
808
- imports: ["import { Box } from '@mui/material'", "// Note: MUI doesn't include carousel. Use react-material-ui-carousel or swiper"],
809
- render: (ctx: RenderContext) => {
810
- const { properties } = ctx;
811
-
812
- return `<Box sx={{ maxWidth: '100%', flexGrow: 1 }}>
813
- {/* TODO: Integrate react-material-ui-carousel or swiper */}
814
- {/* <Carousel autoPlay={${properties.autoplay !== false}} interval={${properties.interval || 3000}}>
815
- {items?.map((item) => (
816
- <Box key={item.id}>{item.content}</Box>
817
- ))}
818
- </Carousel> */}
819
- </Box>`;
820
- },
821
- dependencies: [
822
- { name: 'react-material-ui-carousel', version: '^3.4.0' },
823
- ],
824
- },
825
-
826
- container: {
827
- imports: ["import { Container } from '@mui/material'"],
828
- render: (ctx: RenderContext) => {
829
- const { properties, children } = ctx;
830
-
831
- return `<Container maxWidth="${properties.maxWidth || 'lg'}" ${properties.fixed ? 'fixed' : ''}>
832
- ${children || '{/* Content */}'}
833
- </Container>`;
834
- },
835
- },
836
-
837
- divider: {
838
- imports: ["import { Divider } from '@mui/material'"],
839
- render: (ctx: RenderContext) => {
840
- const { properties } = ctx;
841
-
842
- return `<Divider ${properties.orientation === 'vertical' ? 'orientation="vertical"' : ''} ${properties.variant ? `variant="${properties.variant}"` : ''} />`;
843
- },
844
- },
845
-
846
- header: {
847
- imports: ["import { Box, Typography } from '@mui/material'"],
848
- render: (ctx: RenderContext) => {
849
- const { properties, children } = ctx;
850
-
851
- return `<Box component="header" sx={{ py: 2, borderBottom: 1, borderColor: 'divider' }}>
852
- ${properties.title ? `<Typography variant="h4" component="h1">${properties.title}</Typography>` : ''}
853
- ${properties.subtitle ? `<Typography variant="subtitle1" color="text.secondary">${properties.subtitle}</Typography>` : ''}
854
- ${children || ''}
855
- </Box>`;
856
- },
857
- },
858
-
859
- footer: {
860
- imports: ["import { Box, Container, Typography } from '@mui/material'"],
861
- render: (ctx: RenderContext) => {
862
- const { properties, children } = ctx;
863
-
864
- return `<Box component="footer" sx={{ py: 3, px: 2, mt: 'auto', backgroundColor: 'background.paper', borderTop: 1, borderColor: 'divider' }}>
865
- <Container maxWidth="lg">
866
- ${properties.copyright ? `<Typography variant="body2" color="text.secondary" align="center">${properties.copyright}</Typography>` : ''}
867
- ${children || ''}
868
- </Container>
869
- </Box>`;
870
- },
871
- },
872
-
873
- // ====================================================================
874
- // PROGRESS (2 types)
875
- // ====================================================================
876
-
877
- 'progress-bar': {
878
- imports: ["import { LinearProgress, Box, Typography } from '@mui/material'"],
879
- render: (ctx: RenderContext) => {
880
- const { properties } = ctx;
881
-
882
- return `<Box sx={{ width: '100%' }}>
883
- ${properties.label ? `<Typography variant="body2" color="text.secondary">${properties.label}</Typography>` : ''}
884
- <LinearProgress
885
- variant="${properties.indeterminate ? 'indeterminate' : 'determinate'}"
886
- value={${properties.value || 0}}
887
- color="${properties.color || 'primary'}"
888
- />
889
- ${properties.showValue ? `<Typography variant="body2" color="text.secondary">{value}%</Typography>` : ''}
890
- </Box>`;
891
- },
892
- },
893
-
894
- 'progress-circle': {
895
- imports: ["import { CircularProgress, Box, Typography } from '@mui/material'"],
896
- render: (ctx: RenderContext) => {
897
- const { properties } = ctx;
898
-
899
- return `<Box sx={{ position: 'relative', display: 'inline-flex' }}>
900
- <CircularProgress
901
- variant="${properties.indeterminate ? 'indeterminate' : 'determinate'}"
902
- value={${properties.value || 0}}
903
- size={${properties.size || 40}}
904
- color="${properties.color || 'primary'}"
905
- />
906
- ${properties.showValue ? `
907
- <Box sx={{ top: 0, left: 0, bottom: 0, right: 0, position: 'absolute', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
908
- <Typography variant="caption" component="div" color="text.secondary">{value}%</Typography>
909
- </Box>` : ''}
910
- </Box>`;
911
- },
912
- },
913
-
914
- // ====================================================================
915
- // SPECIALIZED (2 types)
916
- // ====================================================================
917
-
918
- searchBar: {
919
- imports: ["import { TextField, InputAdornment } from '@mui/material'", "import { Search } from '@mui/icons-material'"],
920
- render: (ctx: RenderContext) => {
921
- const { properties } = ctx;
922
-
923
- return `<TextField
924
- placeholder="${properties.placeholder || 'Search...'}"
925
- variant="${properties.variant || 'outlined'}"
926
- fullWidth={${properties.fullWidth !== false}}
927
- InputProps={{
928
- startAdornment: (
929
- <InputAdornment position="start">
930
- <Search />
931
- </InputAdornment>
932
- ),
933
- }}
934
- />`;
935
- },
936
- },
937
-
938
- filterPanel: {
939
- imports: ["import { Paper, Box, Typography, Divider } from '@mui/material'"],
940
- render: (ctx: RenderContext) => {
941
- const { properties, children } = ctx;
942
-
943
- return `<Paper sx={{ p: 2, mb: 2 }}>
944
- <Typography variant="h6" gutterBottom>Filters</Typography>
945
- <Divider sx={{ mb: 2 }} />
946
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
947
- ${children || '{/* Filter controls */}'}
948
- </Box>
949
- </Paper>`;
950
- },
951
- },
952
- },
953
- };