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