@tdesign-react/chat 1.0.2-alpha.9 → 1.1.0-alpha.2
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/es/_chunks/dep-870f0d35.js +839 -0
- package/es/_chunks/dep-870f0d35.js.map +1 -0
- package/es/_chunks/dep-f2051ebd.js +839 -0
- package/es/_chunks/dep-f2051ebd.js.map +1 -0
- package/es/_util/reactify.js +1 -1
- package/es/_util/useDynamicStyle.js +1 -1
- package/es/attachments/index.js +1 -1
- package/es/chat-actionbar/index.js +1 -1
- package/es/chat-engine/components/a2ui/A2UIActivityRenderer.d.ts +196 -0
- package/es/chat-engine/components/a2ui/A2UIActivityRenderer.js +301 -0
- package/es/chat-engine/components/a2ui/A2UIActivityRenderer.js.map +1 -0
- package/es/chat-engine/components/a2ui/A2UIComponentRenderer.d.ts +37 -0
- package/es/chat-engine/components/a2ui/A2UIComponentRenderer.js +116 -0
- package/es/chat-engine/components/a2ui/A2UIComponentRenderer.js.map +1 -0
- package/es/chat-engine/components/a2ui/A2UIErrorBoundary.d.ts +42 -0
- package/es/chat-engine/components/a2ui/A2UIErrorBoundary.js +113 -0
- package/es/chat-engine/components/a2ui/A2UIErrorBoundary.js.map +1 -0
- package/es/chat-engine/components/a2ui/A2UISkeleton.d.ts +60 -0
- package/es/chat-engine/components/a2ui/A2UISkeleton.js +197 -0
- package/es/chat-engine/components/a2ui/A2UISkeleton.js.map +1 -0
- package/es/chat-engine/components/a2ui/A2UISurfaceRenderer.d.ts +44 -0
- package/es/chat-engine/components/a2ui/A2UISurfaceRenderer.js +139 -0
- package/es/chat-engine/components/a2ui/A2UISurfaceRenderer.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/A2UICard.d.ts +22 -0
- package/es/chat-engine/components/a2ui/containers/A2UICard.js +82 -0
- package/es/chat-engine/components/a2ui/containers/A2UICard.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/A2UIColumn.d.ts +18 -0
- package/es/chat-engine/components/a2ui/containers/A2UIColumn.js +81 -0
- package/es/chat-engine/components/a2ui/containers/A2UIColumn.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/A2UIList.d.ts +14 -0
- package/es/chat-engine/components/a2ui/containers/A2UIList.js +62 -0
- package/es/chat-engine/components/a2ui/containers/A2UIList.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/A2UIRow.d.ts +20 -0
- package/es/chat-engine/components/a2ui/containers/A2UIRow.js +84 -0
- package/es/chat-engine/components/a2ui/containers/A2UIRow.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/A2UITabs.d.ts +14 -0
- package/es/chat-engine/components/a2ui/containers/A2UITabs.js +69 -0
- package/es/chat-engine/components/a2ui/containers/A2UITabs.js.map +1 -0
- package/es/chat-engine/components/a2ui/containers/index.d.ts +8 -0
- package/es/chat-engine/components/a2ui/containers/index.js +30 -0
- package/es/chat-engine/components/a2ui/containers/index.js.map +1 -0
- package/es/chat-engine/components/a2ui/index.d.ts +11 -0
- package/es/chat-engine/components/a2ui/index.js +62 -0
- package/es/chat-engine/components/a2ui/index.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIButton.d.ts +33 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIButton.js +80 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIButton.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckBox.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckBox.js +43 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckBox.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckboxGroup.d.ts +50 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckboxGroup.js +54 -0
- package/es/chat-engine/components/a2ui/primitives/A2UICheckboxGroup.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIChoicePicker.d.ts +13 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIChoicePicker.js +89 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIChoicePicker.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIDivider.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIDivider.js +25 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIDivider.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIIcon.d.ts +13 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIIcon.js +138942 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIIcon.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIImage.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIImage.js +75 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIImage.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIInput.d.ts +20 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIInput.js +63 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIInput.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIRadioGroup.d.ts +56 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIRadioGroup.js +64 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIRadioGroup.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UISlider.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UISlider.js +55 -0
- package/es/chat-engine/components/a2ui/primitives/A2UISlider.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIText.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIText.js +104 -0
- package/es/chat-engine/components/a2ui/primitives/A2UIText.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/A2UITextField.d.ts +12 -0
- package/es/chat-engine/components/a2ui/primitives/A2UITextField.js +80 -0
- package/es/chat-engine/components/a2ui/primitives/A2UITextField.js.map +1 -0
- package/es/chat-engine/components/a2ui/primitives/index.d.ts +15 -0
- package/es/chat-engine/components/a2ui/primitives/index.js +39 -0
- package/es/chat-engine/components/a2ui/primitives/index.js.map +1 -0
- package/es/chat-engine/components/a2ui/registry.d.ts +35 -0
- package/es/chat-engine/components/a2ui/registry.js +74 -0
- package/es/chat-engine/components/a2ui/registry.js.map +1 -0
- package/es/chat-engine/components/activity/index.js +1 -1
- package/es/chat-engine/components/activity/registry.d.ts +1 -1
- package/es/chat-engine/components/activity/registry.js +1 -1
- package/es/chat-engine/components/activity/registry.js.map +1 -1
- package/es/chat-engine/components/activity/render.d.ts +2 -2
- package/es/chat-engine/components/activity/render.js +1 -1
- package/es/chat-engine/components/activity/render.js.map +1 -1
- package/es/chat-engine/components/activity/types.js +1 -1
- package/es/chat-engine/components/index.d.ts +1 -0
- package/es/chat-engine/components/index.js +57 -9
- package/es/chat-engine/components/index.js.map +1 -1
- package/es/chat-engine/components/json-render/A2UIJsonRenderActivityRenderer.d.ts +36 -0
- package/es/chat-engine/components/json-render/A2UIJsonRenderActivityRenderer.js +36 -0
- package/es/chat-engine/components/json-render/A2UIJsonRenderActivityRenderer.js.map +1 -0
- package/es/chat-engine/components/json-render/JsonRenderActivityRenderer.d.ts +46 -0
- package/es/chat-engine/components/json-render/JsonRenderActivityRenderer.js +36 -0
- package/es/chat-engine/components/json-render/JsonRenderActivityRenderer.js.map +1 -0
- package/es/chat-engine/components/json-render/SurfaceStateManager.d.ts +113 -0
- package/es/chat-engine/components/json-render/SurfaceStateManager.js +195 -0
- package/es/chat-engine/components/json-render/SurfaceStateManager.js.map +1 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-to-jsonrender.d.ts +49 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-to-jsonrender.js +307 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-to-jsonrender.js.map +1 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-types.d.ts +96 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-types.js +7 -0
- package/es/chat-engine/components/json-render/adapters/a2ui-types.js.map +1 -0
- package/es/chat-engine/components/json-render/adapters/index.d.ts +7 -0
- package/es/chat-engine/components/json-render/adapters/index.js +11 -0
- package/es/chat-engine/components/json-render/adapters/index.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-binding.d.ts +64 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-binding.js +36 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-binding.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-registry.d.ts +78 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-registry.js +36 -0
- package/es/chat-engine/components/json-render/catalog/a2ui-registry.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/button.d.ts +14 -0
- package/es/chat-engine/components/json-render/catalog/button.js +71 -0
- package/es/chat-engine/components/json-render/catalog/button.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/card.d.ts +11 -0
- package/es/chat-engine/components/json-render/catalog/card.js +57 -0
- package/es/chat-engine/components/json-render/catalog/card.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/index.d.ts +128 -0
- package/es/chat-engine/components/json-render/catalog/index.js +36 -0
- package/es/chat-engine/components/json-render/catalog/index.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/input.d.ts +20 -0
- package/es/chat-engine/components/json-render/catalog/input.js +36 -0
- package/es/chat-engine/components/json-render/catalog/input.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/layout.d.ts +44 -0
- package/es/chat-engine/components/json-render/catalog/layout.js +129 -0
- package/es/chat-engine/components/json-render/catalog/layout.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog/text.d.ts +11 -0
- package/es/chat-engine/components/json-render/catalog/text.js +31 -0
- package/es/chat-engine/components/json-render/catalog/text.js.map +1 -0
- package/es/chat-engine/components/json-render/catalog.d.ts +614 -0
- package/es/chat-engine/components/json-render/catalog.js +559 -0
- package/es/chat-engine/components/json-render/catalog.js.map +1 -0
- package/es/chat-engine/components/json-render/config.d.ts +154 -0
- package/es/chat-engine/components/json-render/config.js +36 -0
- package/es/chat-engine/components/json-render/config.js.map +1 -0
- package/es/chat-engine/components/json-render/contexts/actions.d.ts +74 -0
- package/es/chat-engine/components/json-render/contexts/actions.js +290 -0
- package/es/chat-engine/components/json-render/contexts/actions.js.map +1 -0
- package/es/chat-engine/components/json-render/contexts/data.d.ts +45 -0
- package/es/chat-engine/components/json-render/contexts/data.js +104 -0
- package/es/chat-engine/components/json-render/contexts/data.js.map +1 -0
- package/es/chat-engine/components/json-render/contexts/validation.d.ts +59 -0
- package/es/chat-engine/components/json-render/contexts/validation.js +151 -0
- package/es/chat-engine/components/json-render/contexts/validation.js.map +1 -0
- package/es/chat-engine/components/json-render/contexts/visibility.d.ts +29 -0
- package/es/chat-engine/components/json-render/contexts/visibility.js +56 -0
- package/es/chat-engine/components/json-render/contexts/visibility.js.map +1 -0
- package/es/chat-engine/components/json-render/engine.d.ts +58 -0
- package/es/chat-engine/components/json-render/engine.js +88 -0
- package/es/chat-engine/components/json-render/engine.js.map +1 -0
- package/es/chat-engine/components/json-render/index.d.ts +36 -0
- package/es/chat-engine/components/json-render/index.js +36 -0
- package/es/chat-engine/components/json-render/index.js.map +1 -0
- package/es/chat-engine/components/json-render/performance.d.ts +91 -0
- package/es/chat-engine/components/json-render/performance.js +135 -0
- package/es/chat-engine/components/json-render/performance.js.map +1 -0
- package/es/chat-engine/components/json-render/renderer.d.ts +71 -0
- package/es/chat-engine/components/json-render/renderer.js +124 -0
- package/es/chat-engine/components/json-render/renderer.js.map +1 -0
- package/es/chat-engine/components/json-render/types.d.ts +69 -0
- package/es/chat-engine/components/json-render/types.js +7 -0
- package/es/chat-engine/components/json-render/types.js.map +1 -0
- package/es/chat-engine/components/provider/agent-state.js +39 -2
- package/es/chat-engine/components/provider/agent-state.js.map +1 -1
- package/es/chat-engine/components/toolcall/index.js +32 -2
- package/es/chat-engine/components/toolcall/index.js.map +1 -1
- package/es/chat-engine/components/toolcall/registry.js +1 -1
- package/es/chat-engine/components/toolcall/render.d.ts +1 -1
- package/es/chat-engine/components/toolcall/render.js +33 -4
- package/es/chat-engine/components/toolcall/render.js.map +1 -1
- package/es/chat-engine/components/toolcall/types.js +1 -1
- package/es/chat-engine/core/a2ui/index.d.ts +10 -0
- package/es/chat-engine/core/a2ui/index.js +24 -0
- package/es/chat-engine/core/a2ui/index.js.map +1 -0
- package/es/chat-engine/core/a2ui/processor/A2uiMessageProcessor.d.ts +197 -0
- package/es/chat-engine/core/a2ui/processor/A2uiMessageProcessor.js +438 -0
- package/es/chat-engine/core/a2ui/processor/A2uiMessageProcessor.js.map +1 -0
- package/es/chat-engine/core/a2ui/processor/ComponentTree.d.ts +53 -0
- package/es/chat-engine/core/a2ui/processor/ComponentTree.js +158 -0
- package/es/chat-engine/core/a2ui/processor/ComponentTree.js.map +1 -0
- package/es/chat-engine/core/a2ui/processor/DataStore.d.ts +63 -0
- package/es/chat-engine/core/a2ui/processor/DataStore.js +172 -0
- package/es/chat-engine/core/a2ui/processor/DataStore.js.map +1 -0
- package/es/chat-engine/core/a2ui/processor/PathResolver.d.ts +47 -0
- package/es/chat-engine/core/a2ui/processor/PathResolver.js +99 -0
- package/es/chat-engine/core/a2ui/processor/PathResolver.js.map +1 -0
- package/es/chat-engine/core/a2ui/types/index.d.ts +4 -0
- package/es/chat-engine/core/a2ui/types/index.js +9 -0
- package/es/chat-engine/core/a2ui/types/index.js.map +1 -0
- package/es/chat-engine/core/a2ui/types/types.d.ts +770 -0
- package/es/chat-engine/core/a2ui/types/types.js +104 -0
- package/es/chat-engine/core/a2ui/types/types.js.map +1 -0
- package/es/chat-engine/core/a2ui/utils/binding.d.ts +34 -0
- package/es/chat-engine/core/a2ui/utils/binding.js +1784 -0
- package/es/chat-engine/core/a2ui/utils/binding.js.map +1 -0
- package/es/chat-engine/core/a2ui/utils/index.d.ts +5 -0
- package/es/chat-engine/core/a2ui/utils/index.js +13 -0
- package/es/chat-engine/core/a2ui/utils/index.js.map +1 -0
- package/es/chat-engine/core/a2ui/utils/validation.d.ts +70 -0
- package/es/chat-engine/core/a2ui/utils/validation.js +333 -0
- package/es/chat-engine/core/a2ui/utils/validation.js.map +1 -0
- package/es/chat-engine/core/adapters/agui/activity-manager.d.ts +102 -0
- package/es/chat-engine/core/adapters/agui/activity-manager.js +144 -0
- package/es/chat-engine/core/adapters/agui/activity-manager.js.map +1 -0
- package/es/chat-engine/core/adapters/agui/event-mapper.d.ts +42 -2
- package/es/chat-engine/core/adapters/agui/event-mapper.js +90 -50
- package/es/chat-engine/core/adapters/agui/event-mapper.js.map +1 -1
- package/es/chat-engine/core/adapters/agui/events.d.ts +222 -222
- package/es/chat-engine/core/adapters/agui/events.js +34 -34
- package/es/chat-engine/core/adapters/agui/events.js.map +1 -1
- package/es/chat-engine/core/adapters/agui/index.d.ts +22 -2
- package/es/chat-engine/core/adapters/agui/index.js +34 -14
- package/es/chat-engine/core/adapters/agui/index.js.map +1 -1
- package/es/chat-engine/core/adapters/agui/state-manager.js +1 -1
- package/es/chat-engine/core/adapters/agui/types.d.ts +57 -56
- package/es/chat-engine/core/adapters/agui/types.js +5 -5
- package/es/chat-engine/core/adapters/agui/types.js.map +1 -1
- package/es/chat-engine/core/adapters/agui/utils.d.ts +9 -3
- package/es/chat-engine/core/adapters/agui/utils.js +23 -4
- package/es/chat-engine/core/adapters/agui/utils.js.map +1 -1
- package/es/chat-engine/core/event-bus/ChatEventBus.d.ts +88 -0
- package/es/chat-engine/core/event-bus/ChatEventBus.js +295 -0
- package/es/chat-engine/core/event-bus/ChatEventBus.js.map +1 -0
- package/es/chat-engine/core/event-bus/index.d.ts +5 -0
- package/es/chat-engine/core/event-bus/index.js +13 -0
- package/es/chat-engine/core/event-bus/index.js.map +1 -0
- package/es/chat-engine/core/event-bus/types.d.ts +230 -0
- package/es/chat-engine/core/event-bus/types.js +32 -0
- package/es/chat-engine/core/event-bus/types.js.map +1 -0
- package/es/chat-engine/core/index.d.ts +16 -1
- package/es/chat-engine/core/index.js +174 -17
- package/es/chat-engine/core/index.js.map +1 -1
- package/es/chat-engine/core/processor/index.js +1 -1
- package/es/chat-engine/core/server/batch-client.js +1 -1
- package/es/chat-engine/core/server/connection-manager.js +1 -1
- package/es/chat-engine/core/server/errors.js +1 -1
- package/es/chat-engine/core/server/index.js +1 -1
- package/es/chat-engine/core/server/llm-service.js +17 -15
- package/es/chat-engine/core/server/llm-service.js.map +1 -1
- package/es/chat-engine/core/server/sse-client.js +1 -1
- package/es/chat-engine/core/server/sse-parser.js +1 -1
- package/es/chat-engine/core/server/types.js +1 -1
- package/es/chat-engine/core/store/message.js +2 -2
- package/es/chat-engine/core/store/message.js.map +1 -1
- package/es/chat-engine/core/store/model.js +1 -1
- package/es/chat-engine/core/store/reactiveState.js +1 -1
- package/es/chat-engine/core/type.d.ts +18 -2
- package/es/chat-engine/core/type.js +1 -1
- package/es/chat-engine/core/utils/eventEmitter.js +1 -1
- package/es/chat-engine/core/utils/index.js +1 -1
- package/es/chat-engine/core/utils/logger.js +1 -1
- package/es/chat-engine/hooks/a2ui/A2UIContext.d.ts +90 -0
- package/es/chat-engine/hooks/a2ui/A2UIContext.js +97 -0
- package/es/chat-engine/hooks/a2ui/A2UIContext.js.map +1 -0
- package/es/chat-engine/hooks/a2ui/index.d.ts +12 -0
- package/es/chat-engine/hooks/a2ui/index.js +19 -0
- package/es/chat-engine/hooks/a2ui/index.js.map +1 -0
- package/es/chat-engine/hooks/a2ui/useA2UIAction.d.ts +40 -0
- package/es/chat-engine/hooks/a2ui/useA2UIAction.js +74 -0
- package/es/chat-engine/hooks/a2ui/useA2UIAction.js.map +1 -0
- package/es/chat-engine/hooks/a2ui/useA2UISurface.d.ts +36 -0
- package/es/chat-engine/hooks/a2ui/useA2UISurface.js +39 -0
- package/es/chat-engine/hooks/a2ui/useA2UISurface.js.map +1 -0
- package/es/chat-engine/hooks/a2ui/useDataBinding.d.ts +53 -0
- package/es/chat-engine/hooks/a2ui/useDataBinding.js +111 -0
- package/es/chat-engine/hooks/a2ui/useDataBinding.js.map +1 -0
- package/es/chat-engine/hooks/index.js +38 -4
- package/es/chat-engine/hooks/index.js.map +1 -1
- package/es/chat-engine/hooks/useAgentActivity.d.ts +1 -2
- package/es/chat-engine/hooks/useAgentActivity.js +1 -1
- package/es/chat-engine/hooks/useAgentActivity.js.map +1 -1
- package/es/chat-engine/hooks/useAgentState.js +39 -2
- package/es/chat-engine/hooks/useAgentState.js.map +1 -1
- package/es/chat-engine/hooks/useAgentToolcall.js +1 -1
- package/es/chat-engine/hooks/useChat.d.ts +3 -3
- package/es/chat-engine/hooks/useChat.js +40 -2
- package/es/chat-engine/hooks/useChat.js.map +1 -1
- package/es/chat-engine/hooks/useJsonRenderActivity.d.ts +56 -0
- package/es/chat-engine/hooks/useJsonRenderActivity.js +63 -0
- package/es/chat-engine/hooks/useJsonRenderActivity.js.map +1 -0
- package/es/chat-engine/index.d.ts +1 -3
- package/es/chat-engine/index.js +30 -8
- package/es/chat-engine/index.js.map +1 -1
- package/es/chat-filecard/index.js +1 -1
- package/es/chat-loading/index.js +1 -1
- package/es/chat-markdown/index.js +1 -1
- package/es/chat-message/index.js +1 -1
- package/es/chat-sender/index.js +1 -1
- package/es/chat-thinking/index.js +1 -1
- package/es/chatbot/docs/react-best-practice.d.ts +13 -0
- package/es/chatbot/index.js +1 -1
- package/es/index.js +27 -5
- package/es/index.js.map +1 -1
- package/es/style/index.js +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tdesign v1.1.0-alpha.1
|
|
3
|
+
* (c) 2026 tdesign
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
8
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
|
+
import { createCatalog } from '@json-render/core';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
var tdesignCatalog = createCatalog({
|
|
15
|
+
name: "tdesign",
|
|
16
|
+
components: {
|
|
17
|
+
Button: {
|
|
18
|
+
props: z.object({
|
|
19
|
+
label: z.string().optional(),
|
|
20
|
+
children: z.string().optional(),
|
|
21
|
+
variant: z["enum"](["base", "outline", "dashed", "text"]).nullable(),
|
|
22
|
+
theme: z["enum"](["default", "primary", "success", "warning", "danger"]).nullable(),
|
|
23
|
+
size: z["enum"](["small", "medium", "large"]).nullable(),
|
|
24
|
+
disabled: z["boolean"]().nullable(),
|
|
25
|
+
loading: z["boolean"]().nullable(),
|
|
26
|
+
block: z["boolean"]().nullable(),
|
|
27
|
+
action: z.union([z.string(), z.object({
|
|
28
|
+
name: z.string(),
|
|
29
|
+
params: z.record(z.any()).optional()
|
|
30
|
+
})]).nullable()
|
|
31
|
+
}),
|
|
32
|
+
description: "TDesign Button component with action support"
|
|
33
|
+
},
|
|
34
|
+
Input: {
|
|
35
|
+
props: z.object({
|
|
36
|
+
value: z.string().nullable(),
|
|
37
|
+
placeholder: z.string().nullable(),
|
|
38
|
+
type: z["enum"](["text", "password", "number"]).nullable(),
|
|
39
|
+
disabled: z["boolean"]().nullable(),
|
|
40
|
+
clearable: z["boolean"]().nullable(),
|
|
41
|
+
maxlength: z.number().nullable(),
|
|
42
|
+
showLimitNumber: z["boolean"]().nullable()
|
|
43
|
+
}),
|
|
44
|
+
description: "TDesign Input component"
|
|
45
|
+
},
|
|
46
|
+
TextField: {
|
|
47
|
+
props: z.object({
|
|
48
|
+
label: z.string(),
|
|
49
|
+
name: z.string().optional(),
|
|
50
|
+
valuePath: z.string(),
|
|
51
|
+
placeholder: z.string().nullable(),
|
|
52
|
+
required: z["boolean"]().nullable(),
|
|
53
|
+
type: z["enum"](["text", "password", "email", "number", "tel"]).nullable(),
|
|
54
|
+
disabled: z["boolean"]().nullable(),
|
|
55
|
+
helperText: z.string().nullable()
|
|
56
|
+
}),
|
|
57
|
+
description: "Form text field with label and data binding (combines Input + label)"
|
|
58
|
+
},
|
|
59
|
+
Text: {
|
|
60
|
+
props: z.object({
|
|
61
|
+
content: z.string(),
|
|
62
|
+
variant: z["enum"](["body", "caption", "label"]).nullable(),
|
|
63
|
+
color: z["enum"](["default", "primary", "secondary", "success", "warning", "error"]).nullable(),
|
|
64
|
+
weight: z["enum"](["normal", "medium", "bold"]).nullable()
|
|
65
|
+
}),
|
|
66
|
+
description: "Text display component"
|
|
67
|
+
},
|
|
68
|
+
Card: {
|
|
69
|
+
props: z.object({
|
|
70
|
+
title: z.string().nullable(),
|
|
71
|
+
description: z.string().nullable(),
|
|
72
|
+
bordered: z["boolean"]().nullable(),
|
|
73
|
+
shadow: z["boolean"]().nullable(),
|
|
74
|
+
loading: z["boolean"]().nullable()
|
|
75
|
+
}),
|
|
76
|
+
hasChildren: true,
|
|
77
|
+
description: "TDesign Card container"
|
|
78
|
+
},
|
|
79
|
+
Row: {
|
|
80
|
+
props: z.object({
|
|
81
|
+
gutter: z.number().nullable(),
|
|
82
|
+
justify: z["enum"](["start", "end", "center", "space-around", "space-between"]).nullable(),
|
|
83
|
+
align: z["enum"](["top", "middle", "bottom"]).nullable()
|
|
84
|
+
}),
|
|
85
|
+
hasChildren: true,
|
|
86
|
+
description: "Grid row layout"
|
|
87
|
+
},
|
|
88
|
+
Col: {
|
|
89
|
+
props: z.object({
|
|
90
|
+
span: z.number().min(1).max(24).nullable(),
|
|
91
|
+
offset: z.number().nullable()
|
|
92
|
+
}),
|
|
93
|
+
hasChildren: true,
|
|
94
|
+
description: "Grid column layout"
|
|
95
|
+
},
|
|
96
|
+
Space: {
|
|
97
|
+
props: z.object({
|
|
98
|
+
direction: z["enum"](["horizontal", "vertical"]).nullable(),
|
|
99
|
+
size: z.union([z["enum"](["small", "medium", "large"]), z.number(), z.string()]).nullable(),
|
|
100
|
+
align: z["enum"](["start", "center", "end", "baseline"]).nullable()
|
|
101
|
+
}),
|
|
102
|
+
hasChildren: true,
|
|
103
|
+
description: "Space layout component"
|
|
104
|
+
},
|
|
105
|
+
Column: {
|
|
106
|
+
props: z.object({
|
|
107
|
+
gap: z.number().nullable(),
|
|
108
|
+
align: z["enum"](["start", "center", "end", "stretch"]).nullable()
|
|
109
|
+
}),
|
|
110
|
+
hasChildren: true,
|
|
111
|
+
description: "Vertical column layout"
|
|
112
|
+
},
|
|
113
|
+
Divider: {
|
|
114
|
+
props: z.object({
|
|
115
|
+
layout: z["enum"](["horizontal", "vertical"]).nullable(),
|
|
116
|
+
dashed: z["boolean"]().nullable()
|
|
117
|
+
}),
|
|
118
|
+
description: "Divider line"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
actions: {
|
|
122
|
+
submit: {
|
|
123
|
+
description: "Submit form data to server"
|
|
124
|
+
},
|
|
125
|
+
reset: {
|
|
126
|
+
description: "Reset form to initial state (handled by Button component automatically)"
|
|
127
|
+
},
|
|
128
|
+
cancel: {
|
|
129
|
+
description: "Cancel current operation"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
validation: "strict"
|
|
133
|
+
});
|
|
134
|
+
function createCustomCatalog(customConfig) {
|
|
135
|
+
var tdesignComponents = tdesignCatalog.components;
|
|
136
|
+
var tdesignActions = tdesignCatalog.actions;
|
|
137
|
+
return createCatalog({
|
|
138
|
+
name: customConfig.name,
|
|
139
|
+
components: _objectSpread(_objectSpread({}, tdesignComponents), customConfig.components || {}),
|
|
140
|
+
actions: _objectSpread(_objectSpread({}, tdesignActions), customConfig.actions || {}),
|
|
141
|
+
validation: customConfig.validation || "strict"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
var tdesignComponentList = tdesignCatalog.componentNames;
|
|
145
|
+
var tdesignActionList = tdesignCatalog.actionNames;
|
|
146
|
+
var BUILTIN_COMPONENT_DOCS = {
|
|
147
|
+
Button: {
|
|
148
|
+
description: "Button component with action support",
|
|
149
|
+
props: {
|
|
150
|
+
label: "string - Button text (alternative to children)",
|
|
151
|
+
children: "string - Button text",
|
|
152
|
+
variant: '"base" | "outline" | "dashed" | "text" - Button style variant',
|
|
153
|
+
theme: '"default" | "primary" | "success" | "warning" | "danger" - Color theme',
|
|
154
|
+
size: '"small" | "medium" | "large" - Button size',
|
|
155
|
+
disabled: "boolean - Whether button is disabled",
|
|
156
|
+
loading: "boolean - Whether to show loading state",
|
|
157
|
+
block: "boolean - Whether button should be full width",
|
|
158
|
+
action: "string | { name: string, params?: object } - Action to trigger on click"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
Input: {
|
|
162
|
+
description: "Input component for text entry",
|
|
163
|
+
props: {
|
|
164
|
+
value: "string - Input value",
|
|
165
|
+
placeholder: "string - Placeholder text",
|
|
166
|
+
type: '"text" | "password" | "number" - Input type',
|
|
167
|
+
disabled: "boolean - Whether input is disabled",
|
|
168
|
+
clearable: "boolean - Whether to show clear button",
|
|
169
|
+
maxlength: "number - Maximum input length",
|
|
170
|
+
showLimitNumber: "boolean - Whether to show character count"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
TextField: {
|
|
174
|
+
description: "Form text field with label and data binding",
|
|
175
|
+
props: {
|
|
176
|
+
label: "string (required) - Field label",
|
|
177
|
+
name: "string - Form field name",
|
|
178
|
+
valuePath: "string (required) - Data binding path in data model",
|
|
179
|
+
placeholder: "string - Placeholder text",
|
|
180
|
+
required: "boolean - Whether field is required",
|
|
181
|
+
type: '"text" | "password" | "email" | "number" | "tel" - Input type',
|
|
182
|
+
disabled: "boolean - Whether field is disabled",
|
|
183
|
+
disabledPath: "string - Data path to control disabled state dynamically",
|
|
184
|
+
helperText: "string - Helper text below the field"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
Text: {
|
|
188
|
+
description: "Text display component",
|
|
189
|
+
props: {
|
|
190
|
+
content: "string (required) - Text content to display",
|
|
191
|
+
variant: '"body" | "caption" | "label" - Text style variant',
|
|
192
|
+
color: '"default" | "primary" | "secondary" | "success" | "warning" | "error" - Text color',
|
|
193
|
+
weight: '"normal" | "medium" | "bold" - Font weight'
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
Card: {
|
|
197
|
+
description: "Card container component",
|
|
198
|
+
props: {
|
|
199
|
+
title: "string - Card title",
|
|
200
|
+
description: "string - Card description",
|
|
201
|
+
bordered: "boolean - Whether to show border",
|
|
202
|
+
shadow: "boolean - Whether to show shadow",
|
|
203
|
+
loading: "boolean - Whether to show loading state"
|
|
204
|
+
},
|
|
205
|
+
hasChildren: true
|
|
206
|
+
},
|
|
207
|
+
Row: {
|
|
208
|
+
description: "Grid row layout (24-column grid system)",
|
|
209
|
+
props: {
|
|
210
|
+
gutter: "number - Gap between columns in pixels",
|
|
211
|
+
justify: '"start" | "end" | "center" | "space-around" | "space-between" - Horizontal alignment',
|
|
212
|
+
align: '"top" | "middle" | "bottom" - Vertical alignment'
|
|
213
|
+
},
|
|
214
|
+
hasChildren: true
|
|
215
|
+
},
|
|
216
|
+
Col: {
|
|
217
|
+
description: "Grid column layout (use inside Row)",
|
|
218
|
+
props: {
|
|
219
|
+
span: "number (1-24) - Column width, out of 24 total",
|
|
220
|
+
offset: "number - Column offset from left"
|
|
221
|
+
},
|
|
222
|
+
hasChildren: true
|
|
223
|
+
},
|
|
224
|
+
Space: {
|
|
225
|
+
description: "Space layout component for spacing children",
|
|
226
|
+
props: {
|
|
227
|
+
direction: '"horizontal" | "vertical" - Layout direction',
|
|
228
|
+
size: '"small" | "medium" | "large" | number - Gap size',
|
|
229
|
+
align: '"start" | "center" | "end" | "baseline" - Alignment'
|
|
230
|
+
},
|
|
231
|
+
hasChildren: true
|
|
232
|
+
},
|
|
233
|
+
Column: {
|
|
234
|
+
description: "Vertical column layout",
|
|
235
|
+
props: {
|
|
236
|
+
gap: "number - Gap between children in pixels",
|
|
237
|
+
align: '"start" | "center" | "end" | "stretch" - Horizontal alignment'
|
|
238
|
+
},
|
|
239
|
+
hasChildren: true
|
|
240
|
+
},
|
|
241
|
+
Divider: {
|
|
242
|
+
description: "Divider line",
|
|
243
|
+
props: {
|
|
244
|
+
layout: '"horizontal" | "vertical" - Divider direction',
|
|
245
|
+
dashed: "boolean - Whether to use dashed line"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
function zodSchemaToPropsDoc(schema) {
|
|
250
|
+
var result = {};
|
|
251
|
+
var shape = schema.shape;
|
|
252
|
+
for (var _i = 0, _Object$entries = Object.entries(shape); _i < _Object$entries.length; _i++) {
|
|
253
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
254
|
+
key = _Object$entries$_i[0],
|
|
255
|
+
value = _Object$entries$_i[1];
|
|
256
|
+
result[key] = zodTypeToString(value);
|
|
257
|
+
}
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
function zodTypeToString(type) {
|
|
261
|
+
if (type instanceof z.ZodNullable) {
|
|
262
|
+
return "".concat(zodTypeToString(type.unwrap()), " (nullable)");
|
|
263
|
+
}
|
|
264
|
+
if (type instanceof z.ZodOptional) {
|
|
265
|
+
return "".concat(zodTypeToString(type.unwrap()), " (optional)");
|
|
266
|
+
}
|
|
267
|
+
if (type instanceof z.ZodEnum) {
|
|
268
|
+
var values = type.options;
|
|
269
|
+
return values.map(function (v) {
|
|
270
|
+
return "\"".concat(v, "\"");
|
|
271
|
+
}).join(" | ");
|
|
272
|
+
}
|
|
273
|
+
if (type instanceof z.ZodUnion) {
|
|
274
|
+
var options = type._def.options;
|
|
275
|
+
return options.map(function (o) {
|
|
276
|
+
return zodTypeToString(o);
|
|
277
|
+
}).join(" | ");
|
|
278
|
+
}
|
|
279
|
+
if (type instanceof z.ZodString) return "string";
|
|
280
|
+
if (type instanceof z.ZodNumber) return "number";
|
|
281
|
+
if (type instanceof z.ZodBoolean) return "boolean";
|
|
282
|
+
if (type instanceof z.ZodObject) return "object";
|
|
283
|
+
if (type instanceof z.ZodArray) return "array";
|
|
284
|
+
return "any";
|
|
285
|
+
}
|
|
286
|
+
function normalizeComponentDoc(doc) {
|
|
287
|
+
var props;
|
|
288
|
+
if (doc.props instanceof z.ZodObject) {
|
|
289
|
+
props = zodSchemaToPropsDoc(doc.props);
|
|
290
|
+
} else {
|
|
291
|
+
props = doc.props;
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
description: doc.description,
|
|
295
|
+
props: props,
|
|
296
|
+
hasChildren: doc.hasChildren
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function generateCatalogPrompt() {
|
|
300
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
301
|
+
var _options$name = options.name,
|
|
302
|
+
name = _options$name === void 0 ? "tdesign" : _options$name,
|
|
303
|
+
_options$components = options.components,
|
|
304
|
+
components = _options$components === void 0 ? {} : _options$components,
|
|
305
|
+
_options$actions = options.actions,
|
|
306
|
+
actions = _options$actions === void 0 ? {} : _options$actions,
|
|
307
|
+
_options$includeExamp = options.includeExample,
|
|
308
|
+
includeExample = _options$includeExamp === void 0 ? true : _options$includeExamp,
|
|
309
|
+
_options$templateMode = options.templateMode,
|
|
310
|
+
templateMode = _options$templateMode === void 0 ? "default" : _options$templateMode,
|
|
311
|
+
customTemplate = options.customTemplate;
|
|
312
|
+
var mergedComponents = _objectSpread(_objectSpread({}, BUILTIN_COMPONENT_DOCS), components);
|
|
313
|
+
var allComponents = {};
|
|
314
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(mergedComponents); _i2 < _Object$entries2.length; _i2++) {
|
|
315
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
316
|
+
key = _Object$entries2$_i[0],
|
|
317
|
+
doc = _Object$entries2$_i[1];
|
|
318
|
+
allComponents[key] = normalizeComponentDoc(doc);
|
|
319
|
+
}
|
|
320
|
+
var builtinActions = {
|
|
321
|
+
submit: {
|
|
322
|
+
description: "Submit form data to server"
|
|
323
|
+
},
|
|
324
|
+
reset: {
|
|
325
|
+
description: "Reset form to initial state"
|
|
326
|
+
},
|
|
327
|
+
cancel: {
|
|
328
|
+
description: "Cancel current operation"
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
var allActions = _objectSpread(_objectSpread({}, builtinActions), actions);
|
|
332
|
+
if (templateMode === "custom" && customTemplate) {
|
|
333
|
+
return customTemplate({
|
|
334
|
+
name: name,
|
|
335
|
+
components: allComponents,
|
|
336
|
+
actions: allActions
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (templateMode === "a2ui") {
|
|
340
|
+
return generateA2UIPrompt({
|
|
341
|
+
name: name,
|
|
342
|
+
components: allComponents,
|
|
343
|
+
actions: allActions,
|
|
344
|
+
includeExample: includeExample
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
var lines = ["# ".concat(name, " UI Component Catalog"), "", "You can generate dynamic UI using the following components and JSON schema format.", "", "## Output Format", "", "Generate a JSON object with this structure:", "```json", "{", ' "root": "element_id", // ID of the root element', ' "elements": {', ' "element_id": {', ' "key": "element_id", // Same as the key in elements object', ' "type": "ComponentName", // One of the available components', ' "props": { ... }, // Component-specific props', ' "children": ["child_id_1", "child_id_2"] // Optional: IDs of child elements', " }", " },", ' "data": { // Optional: Initial data model for data binding', ' "fieldName": "value"', " }", "}", "```", "", "## Available Components", ""];
|
|
348
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(allComponents); _i3 < _Object$entries3.length; _i3++) {
|
|
349
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
350
|
+
name2 = _Object$entries3$_i[0],
|
|
351
|
+
_doc = _Object$entries3$_i[1];
|
|
352
|
+
lines.push("### ".concat(name2));
|
|
353
|
+
lines.push(_doc.description);
|
|
354
|
+
if (_doc.hasChildren) {
|
|
355
|
+
lines.push("*This component can have children.*");
|
|
356
|
+
}
|
|
357
|
+
lines.push("");
|
|
358
|
+
lines.push("**Props:**");
|
|
359
|
+
for (var _i4 = 0, _Object$entries4 = Object.entries(_doc.props); _i4 < _Object$entries4.length; _i4++) {
|
|
360
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
|
|
361
|
+
propName = _Object$entries4$_i[0],
|
|
362
|
+
propDesc = _Object$entries4$_i[1];
|
|
363
|
+
lines.push("- `".concat(propName, "`: ").concat(propDesc));
|
|
364
|
+
}
|
|
365
|
+
lines.push("");
|
|
366
|
+
}
|
|
367
|
+
lines.push("## Available Actions");
|
|
368
|
+
lines.push("");
|
|
369
|
+
lines.push("Actions can be triggered by Button components. Use the `action` prop:");
|
|
370
|
+
lines.push('- Simple: `"action": "actionName"`');
|
|
371
|
+
lines.push('- With params: `"action": { "name": "actionName", "params": { ... } }`');
|
|
372
|
+
lines.push("");
|
|
373
|
+
for (var _i5 = 0, _Object$entries5 = Object.entries(allActions); _i5 < _Object$entries5.length; _i5++) {
|
|
374
|
+
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
|
|
375
|
+
_name = _Object$entries5$_i[0],
|
|
376
|
+
def = _Object$entries5$_i[1];
|
|
377
|
+
lines.push("- `".concat(_name, "`: ").concat(def.description));
|
|
378
|
+
}
|
|
379
|
+
lines.push("");
|
|
380
|
+
lines.push("## Data Binding");
|
|
381
|
+
lines.push("");
|
|
382
|
+
lines.push("Use `valuePath` to bind form fields to the data model:");
|
|
383
|
+
lines.push('- `"valuePath": "user.name"` binds to `data.user.name`');
|
|
384
|
+
lines.push('- `"disabledPath": "formDisabled"` controls disabled state from `data.formDisabled`');
|
|
385
|
+
lines.push("");
|
|
386
|
+
if (includeExample) {
|
|
387
|
+
lines.push("## Example");
|
|
388
|
+
lines.push("");
|
|
389
|
+
lines.push("A simple form with two text fields and a submit button:");
|
|
390
|
+
lines.push("```json");
|
|
391
|
+
lines.push(JSON.stringify({
|
|
392
|
+
root: "card1",
|
|
393
|
+
elements: {
|
|
394
|
+
card1: {
|
|
395
|
+
key: "card1",
|
|
396
|
+
type: "Card",
|
|
397
|
+
props: {
|
|
398
|
+
title: "User Information"
|
|
399
|
+
},
|
|
400
|
+
children: ["form_column"]
|
|
401
|
+
},
|
|
402
|
+
form_column: {
|
|
403
|
+
key: "form_column",
|
|
404
|
+
type: "Column",
|
|
405
|
+
props: {
|
|
406
|
+
gap: 16
|
|
407
|
+
},
|
|
408
|
+
children: ["name_field", "email_field", "button_row"]
|
|
409
|
+
},
|
|
410
|
+
name_field: {
|
|
411
|
+
key: "name_field",
|
|
412
|
+
type: "TextField",
|
|
413
|
+
props: {
|
|
414
|
+
label: "Name",
|
|
415
|
+
valuePath: "user.name",
|
|
416
|
+
placeholder: "Enter your name",
|
|
417
|
+
required: true
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
email_field: {
|
|
421
|
+
key: "email_field",
|
|
422
|
+
type: "TextField",
|
|
423
|
+
props: {
|
|
424
|
+
label: "Email",
|
|
425
|
+
valuePath: "user.email",
|
|
426
|
+
placeholder: "Enter your email",
|
|
427
|
+
type: "email"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
button_row: {
|
|
431
|
+
key: "button_row",
|
|
432
|
+
type: "Space",
|
|
433
|
+
props: {
|
|
434
|
+
direction: "horizontal",
|
|
435
|
+
size: "medium"
|
|
436
|
+
},
|
|
437
|
+
children: ["submit_btn", "cancel_btn"]
|
|
438
|
+
},
|
|
439
|
+
submit_btn: {
|
|
440
|
+
key: "submit_btn",
|
|
441
|
+
type: "Button",
|
|
442
|
+
props: {
|
|
443
|
+
children: "Submit",
|
|
444
|
+
theme: "primary",
|
|
445
|
+
action: {
|
|
446
|
+
name: "submit",
|
|
447
|
+
params: {
|
|
448
|
+
source: "form"
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
cancel_btn: {
|
|
454
|
+
key: "cancel_btn",
|
|
455
|
+
type: "Button",
|
|
456
|
+
props: {
|
|
457
|
+
children: "Cancel",
|
|
458
|
+
variant: "outline",
|
|
459
|
+
action: "cancel"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
data: {
|
|
464
|
+
user: {
|
|
465
|
+
name: "",
|
|
466
|
+
email: ""
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}, null, 2));
|
|
470
|
+
lines.push("```");
|
|
471
|
+
}
|
|
472
|
+
return lines.join("\n");
|
|
473
|
+
}
|
|
474
|
+
function generateA2UIPrompt(context) {
|
|
475
|
+
var name = context.name,
|
|
476
|
+
components = context.components,
|
|
477
|
+
actions = context.actions,
|
|
478
|
+
_context$includeExamp = context.includeExample,
|
|
479
|
+
includeExample = _context$includeExamp === void 0 ? true : _context$includeExamp;
|
|
480
|
+
var lines = ["# ".concat(name, " A2UI Component Catalog"), "", "You can generate dynamic UI using A2UI protocol messages.", "", "## A2UI Message Types", "", "### createSurface", "Create a new UI surface with initial elements:", "```json", "{", ' "type": "createSurface",', ' "surfaceId": "unique_surface_id",', ' "ui": {', ' "root": "element_id",', ' "elements": { ... }', " },", ' "data": { ... }', "}", "```", "", "### updateComponents", "Update existing UI elements:", "```json", "{", ' "type": "updateComponents",', ' "surfaceId": "existing_surface_id",', ' "elements": { ... }', "}", "```", "", "### updateDataModel", "Update data model without changing UI:", "```json", "{", ' "type": "updateDataModel",', ' "surfaceId": "existing_surface_id",', ' "data": { ... }', "}", "```", "", "### deleteSurface", "Remove a UI surface:", "```json", "{", ' "type": "deleteSurface",', ' "surfaceId": "surface_to_delete"', "}", "```", "", "## Available Components", ""];
|
|
481
|
+
for (var _i6 = 0, _Object$entries6 = Object.entries(components); _i6 < _Object$entries6.length; _i6++) {
|
|
482
|
+
var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
|
|
483
|
+
compName = _Object$entries6$_i[0],
|
|
484
|
+
doc = _Object$entries6$_i[1];
|
|
485
|
+
lines.push("### ".concat(compName));
|
|
486
|
+
lines.push(doc.description);
|
|
487
|
+
if (doc.hasChildren) {
|
|
488
|
+
lines.push("*This component can have children.*");
|
|
489
|
+
}
|
|
490
|
+
lines.push("");
|
|
491
|
+
lines.push("**Props:**");
|
|
492
|
+
for (var _i7 = 0, _Object$entries7 = Object.entries(doc.props); _i7 < _Object$entries7.length; _i7++) {
|
|
493
|
+
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i7], 2),
|
|
494
|
+
propName = _Object$entries7$_i[0],
|
|
495
|
+
propDesc = _Object$entries7$_i[1];
|
|
496
|
+
lines.push("- `".concat(propName, "`: ").concat(propDesc));
|
|
497
|
+
}
|
|
498
|
+
lines.push("");
|
|
499
|
+
}
|
|
500
|
+
lines.push("## Available Actions");
|
|
501
|
+
lines.push("");
|
|
502
|
+
for (var _i8 = 0, _Object$entries8 = Object.entries(actions); _i8 < _Object$entries8.length; _i8++) {
|
|
503
|
+
var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i8], 2),
|
|
504
|
+
actionName = _Object$entries8$_i[0],
|
|
505
|
+
def = _Object$entries8$_i[1];
|
|
506
|
+
lines.push("- `".concat(actionName, "`: ").concat(def.description));
|
|
507
|
+
}
|
|
508
|
+
lines.push("");
|
|
509
|
+
if (includeExample) {
|
|
510
|
+
lines.push("## Example");
|
|
511
|
+
lines.push("");
|
|
512
|
+
lines.push("Create a form surface:");
|
|
513
|
+
lines.push("```json");
|
|
514
|
+
lines.push(JSON.stringify({
|
|
515
|
+
type: "createSurface",
|
|
516
|
+
surfaceId: "user_form_1",
|
|
517
|
+
ui: {
|
|
518
|
+
root: "form_card",
|
|
519
|
+
elements: {
|
|
520
|
+
form_card: {
|
|
521
|
+
key: "form_card",
|
|
522
|
+
type: "Card",
|
|
523
|
+
props: {
|
|
524
|
+
title: "User Form"
|
|
525
|
+
},
|
|
526
|
+
children: ["name_field", "submit_btn"]
|
|
527
|
+
},
|
|
528
|
+
name_field: {
|
|
529
|
+
key: "name_field",
|
|
530
|
+
type: "TextField",
|
|
531
|
+
props: {
|
|
532
|
+
label: "Name",
|
|
533
|
+
valuePath: "user.name"
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
submit_btn: {
|
|
537
|
+
key: "submit_btn",
|
|
538
|
+
type: "Button",
|
|
539
|
+
props: {
|
|
540
|
+
children: "Submit",
|
|
541
|
+
theme: "primary",
|
|
542
|
+
action: "submit"
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
data: {
|
|
548
|
+
user: {
|
|
549
|
+
name: ""
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}, null, 2));
|
|
553
|
+
lines.push("```");
|
|
554
|
+
}
|
|
555
|
+
return lines.join("\n");
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export { createCustomCatalog, generateCatalogPrompt, tdesignActionList, tdesignCatalog, tdesignComponentList };
|
|
559
|
+
//# sourceMappingURL=catalog.js.map
|