@tdesign-react/chat 1.0.2-alpha.9 → 1.1.0-alpha.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/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 +127 -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 +549 -0
- package/es/chat-engine/components/json-render/catalog.js +147 -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 +34 -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 @@
|
|
|
1
|
+
{"version":3,"file":"A2UITextField.js","sources":["../../../../../../pro-components/chat/chat-engine/components/a2ui/primitives/A2UITextField.tsx"],"sourcesContent":["/**\n * A2UI TextField 组件\n * A2UI v0.9 标准输入框组件\n */\n\nimport React, { useCallback } from 'react';\nimport { Input, Textarea } from 'tdesign-react';\nimport { useDataBinding, useTwoWayBinding } from '../../../hooks/a2ui/useDataBinding';\nimport type { A2UITextFieldComponent } from '../../../core/a2ui';\n\nexport interface A2UITextFieldProps extends Omit<A2UITextFieldComponent, 'component'> {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport const A2UITextField: React.FC<A2UITextFieldProps> = ({\n id,\n label,\n text,\n usageHint = 'shortText',\n validationRegexp,\n placeholder,\n disabled,\n className,\n style,\n}) => {\n // 解析标签\n const resolvedLabel = useDataBinding<React.ReactNode>(label);\n // 双向绑定文本值\n const [inputValue, setInputValue] = useTwoWayBinding<string>(text, '');\n // 解析禁用状态\n const resolvedDisabled = useDataBinding<boolean | undefined>(disabled);\n\n // 处理 onChange\n const handleChange = useCallback(\n (val: string) => {\n // 如果有验证正则,进行验证\n if (validationRegexp && typeof validationRegexp === 'string') {\n const regex = new RegExp(validationRegexp);\n if (!regex.test(val) && val !== '') {\n return; // 不符合正则,不更新\n }\n }\n setInputValue(val);\n },\n [setInputValue, validationRegexp]\n );\n\n // 根据 usageHint 决定渲染组件\n if (usageHint === 'longText') {\n return (\n <div className={className} style={style}>\n {resolvedLabel && (\n <label style={{ display: 'block', marginBottom: 4 }}>{resolvedLabel}</label>\n )}\n <Textarea\n value={inputValue as string}\n placeholder={placeholder as string}\n disabled={resolvedDisabled as boolean}\n onChange={handleChange}\n autosize={{ minRows: 3, maxRows: 10 }}\n />\n </div>\n );\n }\n\n // shortText, number, obscured 使用 Input\n const inputType = usageHint === 'obscured' ? 'password' : usageHint === 'number' ? 'number' : 'text';\n\n return (\n <Input\n className={className}\n style={style}\n value={inputValue as string}\n placeholder={placeholder as string}\n disabled={resolvedDisabled as boolean}\n label={resolvedLabel}\n type={inputType}\n onChange={handleChange}\n />\n );\n};\n\nA2UITextField.displayName = 'A2UITextField';\n\nexport default A2UITextField;\n"],"names":["A2UITextField","id","_ref","label","text","_ref$usageHint","usageHint","validationRegexp","placeholder","disabled","className","style","resolvedLabel","useDataBinding","_useTwoWayBinding","useTwoWayBinding","_useTwoWayBinding2","_slicedToArray","inputValue","setInputValue","resolvedDisabled","handleChange","useCallback","val","regex","RegExp","test","React","createElement","display","marginBottom","Textarea","value","onChange","autosize","minRows","maxRows","inputType","Input","type","displayName"],"mappings":";;;;;;;;;;;;;;;;;;IAeaA,gBAA8C,SAA9CA,oBAUP;AAAA,EAAA,IATJC,EAAA,GA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
|
3
|
+
*/
|
|
4
|
+
export { A2UIText, type A2UITextProps } from './A2UIText';
|
|
5
|
+
export { A2UIImage, type A2UIImageProps } from './A2UIImage';
|
|
6
|
+
export { A2UIIcon, type A2UIIconProps } from './A2UIIcon';
|
|
7
|
+
export { A2UIButton, type A2UIButtonProps } from './A2UIButton';
|
|
8
|
+
export { A2UIInput, type A2UIInputProps } from './A2UIInput';
|
|
9
|
+
export { A2UITextField, type A2UITextFieldProps } from './A2UITextField';
|
|
10
|
+
export { A2UICheckBox, type A2UICheckBoxProps } from './A2UICheckBox';
|
|
11
|
+
export { A2UIChoicePicker, type A2UIChoicePickerProps } from './A2UIChoicePicker';
|
|
12
|
+
export { A2UISlider, type A2UISliderProps } from './A2UISlider';
|
|
13
|
+
export { A2UIRadioGroup, type A2UIRadioGroupProps } from './A2UIRadioGroup';
|
|
14
|
+
export { A2UICheckboxGroup, type A2UICheckboxGroupProps } from './A2UICheckboxGroup';
|
|
15
|
+
export { A2UIDivider, type A2UIDividerProps } from './A2UIDivider';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tdesign v1.0.2-alpha.14
|
|
3
|
+
* (c) 2026 tdesign
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { A2UIText } from './A2UIText.js';
|
|
8
|
+
export { A2UIImage } from './A2UIImage.js';
|
|
9
|
+
export { A2UIIcon } from './A2UIIcon.js';
|
|
10
|
+
export { A2UIButton } from './A2UIButton.js';
|
|
11
|
+
export { A2UIInput } from './A2UIInput.js';
|
|
12
|
+
export { A2UITextField } from './A2UITextField.js';
|
|
13
|
+
export { A2UICheckBox } from './A2UICheckBox.js';
|
|
14
|
+
export { A2UIChoicePicker } from './A2UIChoicePicker.js';
|
|
15
|
+
export { A2UISlider } from './A2UISlider.js';
|
|
16
|
+
export { A2UIRadioGroup } from './A2UIRadioGroup.js';
|
|
17
|
+
export { A2UICheckboxGroup } from './A2UICheckboxGroup.js';
|
|
18
|
+
export { A2UIDivider } from './A2UIDivider.js';
|
|
19
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
20
|
+
import 'react';
|
|
21
|
+
import 'classnames';
|
|
22
|
+
import '../../../hooks/a2ui/useDataBinding.js';
|
|
23
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
24
|
+
import '../../../hooks/a2ui/A2UIContext.js';
|
|
25
|
+
import '../../../core/a2ui/utils/index.js';
|
|
26
|
+
import '../../../core/a2ui/utils/binding.js';
|
|
27
|
+
import '@babel/runtime/helpers/typeof';
|
|
28
|
+
import '../../../core/a2ui/utils/validation.js';
|
|
29
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
30
|
+
import 'tdesign-react';
|
|
31
|
+
import '../../../hooks/a2ui/useA2UIAction.js';
|
|
32
|
+
import '../A2UIComponentRenderer.js';
|
|
33
|
+
import '../A2UIErrorBoundary.js';
|
|
34
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
35
|
+
import '@babel/runtime/helpers/createClass';
|
|
36
|
+
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
37
|
+
import '@babel/runtime/helpers/getPrototypeOf';
|
|
38
|
+
import '@babel/runtime/helpers/inherits';
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2UI 默认组件注册表
|
|
3
|
+
* 将 A2UI 组件类型映射到 TDesign 实现
|
|
4
|
+
*/
|
|
5
|
+
import type { ComponentRegistry } from '../../hooks/a2ui/A2UIContext';
|
|
6
|
+
/**
|
|
7
|
+
* 默认组件注册表
|
|
8
|
+
*
|
|
9
|
+
* 组件类型名称遵循 A2UI v0.9 协议规范
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultComponentRegistry: ComponentRegistry;
|
|
12
|
+
/**
|
|
13
|
+
* 创建自定义组件注册表
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const customRegistry = createComponentRegistry({
|
|
18
|
+
* ...defaultComponentRegistry,
|
|
19
|
+
* Button: MyCustomButton, // 覆盖默认 Button
|
|
20
|
+
* CustomWidget: MyWidget, // 添加自定义组件
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function createComponentRegistry(components: ComponentRegistry): ComponentRegistry;
|
|
25
|
+
/**
|
|
26
|
+
* 扩展默认注册表
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const registry = extendComponentRegistry({
|
|
31
|
+
* CustomWidget: MyWidget,
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function extendComponentRegistry(extensions: Partial<ComponentRegistry>): ComponentRegistry;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tdesign v1.0.2-alpha.14
|
|
3
|
+
* (c) 2026 tdesign
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
8
|
+
import { A2UIText } from './primitives/A2UIText.js';
|
|
9
|
+
import { A2UIImage } from './primitives/A2UIImage.js';
|
|
10
|
+
import { A2UIIcon } from './primitives/A2UIIcon.js';
|
|
11
|
+
import { A2UIButton } from './primitives/A2UIButton.js';
|
|
12
|
+
import { A2UIInput } from './primitives/A2UIInput.js';
|
|
13
|
+
import { A2UITextField } from './primitives/A2UITextField.js';
|
|
14
|
+
import { A2UICheckBox } from './primitives/A2UICheckBox.js';
|
|
15
|
+
import { A2UIChoicePicker } from './primitives/A2UIChoicePicker.js';
|
|
16
|
+
import { A2UISlider } from './primitives/A2UISlider.js';
|
|
17
|
+
import { A2UIRadioGroup } from './primitives/A2UIRadioGroup.js';
|
|
18
|
+
import { A2UICheckboxGroup } from './primitives/A2UICheckboxGroup.js';
|
|
19
|
+
import { A2UIDivider } from './primitives/A2UIDivider.js';
|
|
20
|
+
import { A2UICard } from './containers/A2UICard.js';
|
|
21
|
+
import { A2UIRow } from './containers/A2UIRow.js';
|
|
22
|
+
import { A2UIColumn } from './containers/A2UIColumn.js';
|
|
23
|
+
import { A2UIList } from './containers/A2UIList.js';
|
|
24
|
+
import { A2UITabs } from './containers/A2UITabs.js';
|
|
25
|
+
import 'react';
|
|
26
|
+
import 'classnames';
|
|
27
|
+
import '../../hooks/a2ui/useDataBinding.js';
|
|
28
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
29
|
+
import '../../hooks/a2ui/A2UIContext.js';
|
|
30
|
+
import '../../core/a2ui/utils/index.js';
|
|
31
|
+
import '../../core/a2ui/utils/binding.js';
|
|
32
|
+
import '@babel/runtime/helpers/typeof';
|
|
33
|
+
import '../../core/a2ui/utils/validation.js';
|
|
34
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
35
|
+
import 'tdesign-react';
|
|
36
|
+
import '../../hooks/a2ui/useA2UIAction.js';
|
|
37
|
+
import './A2UIComponentRenderer.js';
|
|
38
|
+
import './A2UIErrorBoundary.js';
|
|
39
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
40
|
+
import '@babel/runtime/helpers/createClass';
|
|
41
|
+
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
42
|
+
import '@babel/runtime/helpers/getPrototypeOf';
|
|
43
|
+
import '@babel/runtime/helpers/inherits';
|
|
44
|
+
|
|
45
|
+
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; }
|
|
46
|
+
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; }
|
|
47
|
+
var defaultComponentRegistry = {
|
|
48
|
+
Text: A2UIText,
|
|
49
|
+
Image: A2UIImage,
|
|
50
|
+
Icon: A2UIIcon,
|
|
51
|
+
Button: A2UIButton,
|
|
52
|
+
TextField: A2UITextField,
|
|
53
|
+
CheckBox: A2UICheckBox,
|
|
54
|
+
ChoicePicker: A2UIChoicePicker,
|
|
55
|
+
Slider: A2UISlider,
|
|
56
|
+
Divider: A2UIDivider,
|
|
57
|
+
Card: A2UICard,
|
|
58
|
+
Row: A2UIRow,
|
|
59
|
+
Column: A2UIColumn,
|
|
60
|
+
List: A2UIList,
|
|
61
|
+
Tabs: A2UITabs,
|
|
62
|
+
Input: A2UIInput,
|
|
63
|
+
RadioGroup: A2UIRadioGroup,
|
|
64
|
+
CheckboxGroup: A2UICheckboxGroup
|
|
65
|
+
};
|
|
66
|
+
function createComponentRegistry(components) {
|
|
67
|
+
return _objectSpread({}, components);
|
|
68
|
+
}
|
|
69
|
+
function extendComponentRegistry(extensions) {
|
|
70
|
+
return _objectSpread(_objectSpread({}, defaultComponentRegistry), extensions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { createComponentRegistry, defaultComponentRegistry, extendComponentRegistry };
|
|
74
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../../../../pro-components/chat/chat-engine/components/a2ui/registry.ts"],"sourcesContent":["/**\n * A2UI 默认组件注册表\n * 将 A2UI 组件类型映射到 TDesign 实现\n */\n\nimport type { ComponentRegistry } from '../../hooks/a2ui/A2UIContext';\n\n// Display 组件\nimport { A2UIText } from './primitives/A2UIText';\nimport { A2UIImage } from './primitives/A2UIImage';\nimport { A2UIIcon } from './primitives/A2UIIcon';\n\n// Interactive 组件\nimport { A2UIButton } from './primitives/A2UIButton';\nimport { A2UIInput } from './primitives/A2UIInput';\nimport { A2UITextField } from './primitives/A2UITextField';\nimport { A2UICheckBox } from './primitives/A2UICheckBox';\nimport { A2UIChoicePicker } from './primitives/A2UIChoicePicker';\nimport { A2UISlider } from './primitives/A2UISlider';\nimport { A2UIRadioGroup } from './primitives/A2UIRadioGroup';\nimport { A2UICheckboxGroup } from './primitives/A2UICheckboxGroup';\nimport { A2UIDivider } from './primitives/A2UIDivider';\n\n// 容器组件\nimport { A2UICard } from './containers/A2UICard';\nimport { A2UIRow } from './containers/A2UIRow';\nimport { A2UIColumn } from './containers/A2UIColumn';\nimport { A2UIList } from './containers/A2UIList';\nimport { A2UITabs } from './containers/A2UITabs';\n\n/**\n * 默认组件注册表\n * \n * 组件类型名称遵循 A2UI v0.9 协议规范\n */\nexport const defaultComponentRegistry: ComponentRegistry = {\n // ===== Display 组件 =====\n Text: A2UIText,\n Image: A2UIImage,\n Icon: A2UIIcon,\n\n // ===== Interactive 组件 =====\n Button: A2UIButton,\n TextField: A2UITextField,\n CheckBox: A2UICheckBox,\n ChoicePicker: A2UIChoicePicker,\n Slider: A2UISlider,\n Divider: A2UIDivider,\n\n // ===== Layout 组件 =====\n Card: A2UICard,\n Row: A2UIRow,\n Column: A2UIColumn,\n List: A2UIList,\n Tabs: A2UITabs,\n\n // ===== TDesign 扩展(向后兼容)=====\n Input: A2UIInput,\n RadioGroup: A2UIRadioGroup,\n CheckboxGroup: A2UICheckboxGroup,\n};\n\n/**\n * 创建自定义组件注册表\n * \n * @example\n * ```tsx\n * const customRegistry = createComponentRegistry({\n * ...defaultComponentRegistry,\n * Button: MyCustomButton, // 覆盖默认 Button\n * CustomWidget: MyWidget, // 添加自定义组件\n * });\n * ```\n */\nexport function createComponentRegistry(\n components: ComponentRegistry\n): ComponentRegistry {\n return { ...components };\n}\n\n/**\n * 扩展默认注册表\n * \n * @example\n * ```tsx\n * const registry = extendComponentRegistry({\n * CustomWidget: MyWidget,\n * });\n * ```\n */\nexport function extendComponentRegistry(\n extensions: Partial<ComponentRegistry>\n): ComponentRegistry {\n return {\n ...defaultComponentRegistry,\n ...extensions,\n };\n}\n"],"names":["defaultComponentRegistry","Text","A2UIText","Image","A2UIImage","Icon","A2UIIcon","Button","A2UIButton","TextField","A2UITextField","CheckBox","A2UICheckBox","ChoicePicker","A2UIChoicePicker","Slider","A2UISlider","Divider","A2UIDivider","Card","A2UICard","Row","A2UIRow","Column","A2UIColumn","List","A2UIList","Tabs","A2UITabs","Input","A2UIInput","RadioGroup","A2UIRadioGroup","CheckboxGroup","A2UICheckboxGroup","createComponentRegistry","components","_objectSpread","extendComponentRegistry","extensions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,IAAMA,wBAA8C,GAAA;AAEzDC,EAAAA,IAAM,EAAAC,QAAA;AACNC,EAAAA,KAAO,EAAAC,SAAA;AACPC,EAAAA,IAAM,EAAAC,QAAA;AAGNC,EAAAA,MAAQ,EAAAC,UAAA;AACRC,EAAAA,SAAW,EAAAC,aAAA;AACXC,EAAAA,QAAU,EAAAC,YAAA;AACVC,EAAAA,YAAc,EAAAC,gBAAA;AACdC,EAAAA,MAAQ,EAAAC,UAAA;AACRC,EAAAA,OAAS,EAAAC,WAAA;AAGTC,EAAAA,IAAM,EAAAC,QAAA;AACNC,EAAAA,GAAK,EAAAC,OAAA;AACLC,EAAAA,MAAQ,EAAAC,UAAA;AACRC,EAAAA,IAAM,EAAAC,QAAA;AACNC,EAAAA,IAAM,EAAAC,QAAA;AAGNC,EAAAA,KAAO,EAAAC,SAAA;AACPC,EAAAA,UAAY,EAAAC,cAAA;AACZC,EAAAA,aAAe,EAAAC,iBAAAA;AACjB,EAAA;AAcO,SAASC,wBACdC,UACmB,EAAA;EACZ,OAAAC,aAAA,KAAKD,UAAW,CAAA,CAAA;AACzB,CAAA;AAYO,SAASE,wBACdC,UACmB,EAAA;AACZ,EAAA,OAAAF,aAAA,CAAAA,aAAA,CACFrC,EAAAA,EAAAA,wBAAA,GACAuC,UAAA,CAAA,CAAA;AAEP;;;;"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { ActivityConfig, ActivityRegistry, ActivityComponentProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Activity 注册表管理器
|
|
5
|
-
*
|
|
5
|
+
* 业务方注册具体的 activityType(如 json-render-main-card),精确匹配
|
|
6
6
|
*/
|
|
7
7
|
declare class ActivityRegistryManager {
|
|
8
8
|
private registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/registry.ts"],"sourcesContent":["import React from 'react';\nimport type { ActivityConfig, ActivityRegistry, ActivityComponentProps } from './types';\n\n/**\n * Activity 注册表管理器\n *
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/registry.ts"],"sourcesContent":["import React from 'react';\nimport type { ActivityConfig, ActivityRegistry, ActivityComponentProps } from './types';\n\n/**\n * Activity 注册表管理器\n * 业务方注册具体的 activityType(如 json-render-main-card),精确匹配\n */\nclass ActivityRegistryManager {\n private registry: ActivityRegistry = {};\n\n // 组件渲染函数缓存,避免重复创建 React 组件\n private renderFunctionCache = new Map<\n string,\n React.MemoExoticComponent<React.ComponentType<ActivityComponentProps>>\n >();\n\n /**\n * 注册一个 Activity 配置\n */\n register<TContent = any>(config: ActivityConfig<TContent>): void {\n const existingConfig = this.registry[config.activityType];\n\n // 如果组件发生变化,清除旧的缓存\n if (existingConfig && existingConfig.component !== config.component) {\n this.renderFunctionCache.delete(config.activityType);\n }\n\n this.registry[config.activityType] = config;\n\n // 触发注册事件,支持动态注册\n window.dispatchEvent(\n new CustomEvent('activity-registered', {\n detail: { activityType: config.activityType },\n }),\n );\n }\n\n /**\n * 获取指定类型的 Activity 配置\n */\n get(activityType: string): ActivityConfig | undefined {\n return this.registry[activityType];\n }\n\n /**\n * 获取或创建缓存的组件渲染函数\n */\n getRenderFunction(activityType: string): React.MemoExoticComponent<React.ComponentType<ActivityComponentProps>> | null {\n const config = this.registry[activityType];\n if (!config) return null;\n\n // 检查缓存\n let memoizedComponent = this.renderFunctionCache.get(activityType);\n\n if (!memoizedComponent) {\n // 创建 memo 化的组件\n memoizedComponent = React.memo((props: ActivityComponentProps) => \n React.createElement(config.component, props)\n );\n\n // 缓存组件\n this.renderFunctionCache.set(activityType, memoizedComponent);\n }\n\n return memoizedComponent;\n }\n\n /**\n * 获取所有已注册的 Activity 配置\n */\n getAll(): ActivityRegistry {\n return { ...this.registry };\n }\n\n /**\n * 取消注册指定的 Activity\n */\n unregister(activityType: string): void {\n delete this.registry[activityType];\n this.renderFunctionCache.delete(activityType);\n }\n\n /**\n * 清空所有注册的 Activity\n */\n clear(): void {\n this.registry = {};\n this.renderFunctionCache.clear();\n }\n\n /**\n * 检查指定类型是否已注册\n */\n has(activityType: string): boolean {\n return activityType in this.registry;\n }\n\n /**\n * 获取所有已注册的 Activity 类型\n */\n getRegisteredTypes(): string[] {\n return Object.keys(this.registry);\n }\n}\n\n// 导出单例实例\nexport const activityRegistry = new ActivityRegistryManager();\n"],"names":["ActivityRegistryManager","_classCallCheck","_defineProperty","Map","_createClass","key","value","register","config","existingConfig","registry","activityType","component","renderFunctionCache","window","dispatchEvent","CustomEvent","detail","get","getRenderFunction","memoizedComponent","React","memo","props","createElement","set","getAll","_objectSpread","unregister","clear","has","getRegisteredTypes","Object","keys","activityRegistry"],"mappings":";;;;;;;;;;;;;AAAkB,IAOZA,uBAAwB,gBAAA,YAAA;AAAA,EAAA,SAAAA,uBAAA,GAAA;AAAAC,IAAAA,eAAA,OAAAD,uBAAA,CAAA,CAAA;IAAAE,eAAA,CAAA,IAAA,EAAA,UAAA,EACS,EAA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A,GAAA;AACtB,MAAA,OAAAC,MAAA,CAAOC,IAAK,CAAA,IAAA,CAAKvB,QAAQ,CAAA,CAAA;AAClC,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,EAAA,CAAA;IAIWwB,gBAAA,GAAmB,IAAIlC,uBAAwB;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ActivityData } from '
|
|
2
|
+
import { type ActivityData } from '../../core';
|
|
3
3
|
interface ActivityRendererProps {
|
|
4
4
|
activity: ActivityData;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Activity 渲染器组件
|
|
8
|
-
* 根据 activityType
|
|
8
|
+
* 根据 activityType 精确匹配查找注册的组件进行渲染
|
|
9
9
|
*/
|
|
10
10
|
export declare const ActivityRenderer: React.NamedExoticComponent<ActivityRendererProps>;
|
|
11
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/render.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo, Component, ErrorInfo } from 'react';\nimport type { ActivityComponentProps } from './types';\nimport { activityRegistry } from './registry';\nimport { type ActivityData } from '
|
|
1
|
+
{"version":3,"file":"render.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/render.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo, Component, ErrorInfo } from 'react';\nimport type { ActivityComponentProps } from './types';\nimport { activityRegistry } from './registry';\nimport { type ActivityData } from '../../core';\n\ninterface ActivityRendererProps {\n activity: ActivityData;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\n/**\n * Activity 错误边界组件\n * 捕获子组件渲染错误,防止整个对话列表崩溃\n * TODO: 后续支持配置化的错误 UI\n */\nclass ActivityErrorBoundary extends Component<\n { children: React.ReactNode; activityType: string },\n ErrorBoundaryState\n> {\n constructor(props: { children: React.ReactNode; activityType: string }) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error(`[ActivityRenderer] Error in activity \"${this.props.activityType}\":`, error, errorInfo);\n }\n\n render() {\n if (this.state.hasError) {\n return null;\n }\n\n return this.props.children;\n }\n}\n\n/**\n * 默认的 Activity 渲染器\n * 当没有注册对应类型的组件时使用\n * TODO: 后续支持配置化的默认 UI\n */\nconst DefaultActivityRenderer: React.FC<ActivityRendererProps> = ({ activity }) => {\n // 空白兜底,仅在控制台输出警告\n console.warn(`[ActivityRenderer] Unknown activity type: ${activity.activityType}`, activity.content);\n return null;\n};\n\n/**\n * Activity 渲染器组件\n * 根据 activityType 精确匹配查找注册的组件进行渲染\n */\nexport const ActivityRenderer = React.memo<ActivityRendererProps>(\n ({ activity }) => {\n // 添加注册状态监听\n const [isRegistered, setIsRegistered] = useState(\n () => !!activityRegistry.getRenderFunction(activity.activityType),\n );\n\n // 缓存组件 props\n const componentProps = useMemo<ActivityComponentProps>(\n () => ({\n activityType: activity.activityType,\n content: activity.content,\n messageId: activity.messageId || '',\n }),\n [activity.activityType, activity.content, activity.messageId],\n );\n\n // 监听组件注册事件,支持动态注册\n useEffect(() => {\n if (!isRegistered) {\n const handleRegistered = (event: CustomEvent) => {\n // 精确匹配\n if (event.detail?.activityType === activity.activityType) {\n setIsRegistered(true);\n }\n };\n\n // 添加事件监听\n window.addEventListener('activity-registered', handleRegistered as EventListener);\n\n return () => {\n window.removeEventListener('activity-registered', handleRegistered as EventListener);\n };\n }\n }, [activity.activityType, isRegistered]);\n\n // 使用 registry 的缓存渲染函数\n const MemoizedComponent = useMemo(\n () => activityRegistry.getRenderFunction(activity.activityType),\n [activity.activityType, isRegistered],\n );\n\n // 如果没有注册对应的组件,使用默认渲染器\n if (!MemoizedComponent) {\n return <DefaultActivityRenderer activity={activity} />;\n }\n\n return (\n <ActivityErrorBoundary activityType={activity.activityType}>\n <MemoizedComponent {...componentProps} />\n </ActivityErrorBoundary>\n );\n },\n (prevProps, nextProps) =>\n prevProps.activity.activityType === nextProps.activity.activityType &&\n prevProps.activity.messageId === nextProps.activity.messageId &&\n JSON.stringify(prevProps.activity.content) === JSON.stringify(nextProps.activity.content),\n);\n\nActivityRenderer.displayName = 'ActivityRenderer';"],"names":["ActivityErrorBoundary","props","_this","_classCallCheck","_callSuper","state","hasError","error","_inherits","_Component","_createClass","key","value","componentDidCatch","errorInfo","console","activityType","render","children","getDerivedStateFromError","Component","DefaultActivityRenderer","_ref","activity","warn","concat","content","ActivityRenderer","React","memo","_ref2","_useState","useState","activityRegistry","getRenderFunction","_useState2","_slicedToArray","isRegistered","setIsRegistered","componentProps","useMemo","messageId","useEffect","handleRegistered","event","_event$detail","detail","window","addEventListener","removeEventListener","MemoizedComponent","createElement","_objectSpread","prevProps","nextProps","JSON","stringify","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEiC,IAiB3BA;EAIJ,SAAAA,qBAAAA,CAAYC,KAA4D,EAAA;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAAC,IAAAA,eAAA,OAAAH,qBAAA,CAAA,CAAA;AACtEE,IAAAA,KAAA,GAAAE,UAAA,CAAAJ,IAAAA,EAAAA,qBAAA,GAAMC,KAAK,CAAA,CAAA,CAAA;IACXC,KAAA,CAAKG,KAAQ,GAAA;AAAEC,MAAAA,QAAU,EAAA,KAAA;AAAOC,MAAAA,OAAO,IAAA;KAAK,CAAA;AAAA,IAAA,OAAAL,KAAA,CAAA;AAC9C,GAAA;EAAAM,SAAA,CAAAR,qBAAA,EAAAS,UAAA,CAAA,CAAA;EAAA,OAAAC,YAAA,CAAAV,qBAAA,EAAA,CAAA;IAAAW,GAAA,EAAA,mBAAA;AAAAC,IAAAA,KAAA,EAMA,SAAAC,iBAAAA,CAAkBN,OAAcO,SAA4B,EAAA;AAC1DC,MAAAA,OAAA,CAAQR,uDAA+C,IAAA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A;AAAA,GAAA,EAC9D,CAACO,QAAS,CAAAP,YAAA,EAAcqB,YAAY,CACtC,CAAA,CAAA;EAGA,IAAI,CAACa,iBAAmB,EAAA;AACtB,IAAA,sBAAQtB,KAAA,CAAAuB,aAAA,CAAA9B,uBAAA,EAAA;AAAwBE,MAAAA,QAAA,EAAAA,QAAAA;AAAoB,KAAA,CAAA,CAAA;AACtD,GAAA;AAEA,EAAA,sBACGK,KAAA,CAAAuB,aAAA,CAAAnD,qBAAA,EAAA;IAAsBgB,cAAcO,QAAS,CAAAP,YAAAA;AAAA,GAAA,iBAC3CY,KAAA,CAAAuB,aAAA,CAAAD,iBAAA,EAAAE,aAAA,CAAA,EAAA,EAAsBb,cAAA,CAAgB,CACzC,CAAA,CAAA;AAEJ,CAAA,EACA,UAACc,SAAW,EAAAC,SAAA,EAAA;EAAA,OACVD,SAAU,CAAA9B,QAAA,CAASP,iBAAiBsC,SAAU,CAAA/B,QAAA,CAASP,YACvD,IAAAqC,SAAA,CAAU9B,QAAS,CAAAkB,SAAA,KAAca,UAAU/B,QAAS,CAAAkB,SAAA,IACpDc,IAAK,CAAAC,SAAA,CAAUH,SAAU,CAAA9B,QAAA,CAASG,OAAO,CAAA,KAAM6B,IAAK,CAAAC,SAAA,CAAUF,SAAU,CAAA/B,QAAA,CAASG,OAAO,CAAA,CAAA;AAAA,CAC5F,EAAA;AAEAC,gBAAA,CAAiB8B,WAAc,GAAA,kBAAA;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tdesign v1.0.2-alpha.
|
|
2
|
+
* tdesign v1.0.2-alpha.15
|
|
3
3
|
* (c) 2026 tdesign
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -7,22 +7,70 @@
|
|
|
7
7
|
import './toolcall/index.js';
|
|
8
8
|
import './activity/index.js';
|
|
9
9
|
export { AgentStateProvider } from './provider/agent-state.js';
|
|
10
|
+
export { e as A2UIButton, A as A2UIJsonRenderActivityRenderer, d as A2UITextField, J as JsonRenderActivityRenderer, g as JsonRenderInput, a as a2uiRegistry, j as createA2UIJsonRenderActivityConfig, b as createA2UIRegistry, c as createCustomRegistry, h as createJsonRenderActivityConfig, k as defaultA2UIJsonRenderActivityConfig, i as defaultJsonRenderActivityConfig, t as tdesignRegistry, f as withA2UIBinding, w as withStableProps } from '../../_chunks/dep-f2051ebd.js';
|
|
10
11
|
export { isNonInteractive, isNonInteractiveConfig } from './toolcall/types.js';
|
|
11
12
|
export { agentToolcallRegistry } from './toolcall/registry.js';
|
|
12
13
|
export { ToolCallRenderer, withAgentStateToolcall, withAgentStateToolcall1 } from './toolcall/render.js';
|
|
13
14
|
export { activityRegistry } from './activity/registry.js';
|
|
14
15
|
export { ActivityRenderer } from './activity/render.js';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export { JsonRenderEngine, createJsonRenderEngine } from './json-render/engine.js';
|
|
17
|
+
export { PERFORMANCE_THRESHOLDS, PerformanceMonitor, checkPerformance, globalPerformanceMonitor } from './json-render/performance.js';
|
|
18
|
+
export { createCustomCatalog, tdesignActionList, tdesignCatalog, tdesignComponentList } from './json-render/catalog.js';
|
|
19
|
+
export { JsonRenderButton } from './json-render/catalog/button.js';
|
|
20
|
+
export { JsonRenderCard } from './json-render/catalog/card.js';
|
|
21
|
+
export { JsonRenderCol, JsonRenderDivider, JsonRenderRow, JsonRenderSpace } from './json-render/catalog/layout.js';
|
|
22
|
+
export { SurfaceStateManager, surfaceStateManager } from './json-render/SurfaceStateManager.js';
|
|
23
|
+
export { DataProvider, useData, useDataBinding, useDataValue } from './json-render/contexts/data.js';
|
|
24
|
+
export { VisibilityProvider, useIsVisible, useVisibility } from './json-render/contexts/visibility.js';
|
|
25
|
+
export { ActionProvider, ConfirmDialog, useAction, useActions } from './json-render/contexts/actions.js';
|
|
26
|
+
export { ValidationProvider, useFieldValidation, useValidation } from './json-render/contexts/validation.js';
|
|
27
|
+
export { JSONUIProvider, Renderer, createRendererFromCatalog } from './json-render/renderer.js';
|
|
28
|
+
export { default as A2UIAdapter, applyA2UIDataUpdate, applyA2UIUpdates, convertA2UIMessagesToJsonRender } from './json-render/adapters/a2ui-to-jsonrender.js';
|
|
29
|
+
import './activity/types.js';
|
|
18
30
|
import 'react';
|
|
19
|
-
import '
|
|
31
|
+
import '../hooks/useAgentState.js';
|
|
32
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
20
33
|
import '@babel/runtime/helpers/slicedToArray';
|
|
34
|
+
import '../core/index.js';
|
|
35
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
36
|
+
import '@babel/runtime/helpers/asyncToGenerator';
|
|
37
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
38
|
+
import '@babel/runtime/helpers/createClass';
|
|
39
|
+
import '@babel/runtime/regenerator';
|
|
40
|
+
import '../core/adapters/agui/index.js';
|
|
41
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
42
|
+
import '../core/adapters/agui/event-mapper.js';
|
|
43
|
+
import '../core/adapters/agui/events.js';
|
|
44
|
+
import 'zod';
|
|
45
|
+
import '../core/adapters/agui/types.js';
|
|
21
46
|
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
22
47
|
import '@babel/runtime/helpers/getPrototypeOf';
|
|
23
48
|
import '@babel/runtime/helpers/inherits';
|
|
24
|
-
import '@babel/runtime/
|
|
25
|
-
import '../
|
|
26
|
-
import '
|
|
27
|
-
import '
|
|
49
|
+
import '@babel/runtime/helpers/wrapNativeSuper';
|
|
50
|
+
import '../core/adapters/agui/state-manager.js';
|
|
51
|
+
import '@babel/runtime/helpers/typeof';
|
|
52
|
+
import '../core/utils/index.js';
|
|
53
|
+
import '../core/adapters/agui/activity-manager.js';
|
|
54
|
+
import '../core/adapters/agui/utils.js';
|
|
55
|
+
import '../core/event-bus/index.js';
|
|
56
|
+
import '../core/event-bus/ChatEventBus.js';
|
|
57
|
+
import '../core/event-bus/types.js';
|
|
58
|
+
import '../core/store/message.js';
|
|
59
|
+
import '@babel/runtime/helpers/get';
|
|
60
|
+
import '../core/store/reactiveState.js';
|
|
61
|
+
import '../core/processor/index.js';
|
|
62
|
+
import '../core/server/index.js';
|
|
63
|
+
import '../core/server/llm-service.js';
|
|
64
|
+
import '../core/utils/logger.js';
|
|
65
|
+
import '../core/server/batch-client.js';
|
|
66
|
+
import '../core/utils/eventEmitter.js';
|
|
67
|
+
import '../core/server/errors.js';
|
|
68
|
+
import '../core/server/sse-client.js';
|
|
69
|
+
import '../core/server/connection-manager.js';
|
|
70
|
+
import '../core/server/sse-parser.js';
|
|
71
|
+
import '../core/server/types.js';
|
|
72
|
+
import './json-render/adapters/index.js';
|
|
73
|
+
import 'tdesign-react';
|
|
74
|
+
import '@json-render/core';
|
|
75
|
+
import './json-render/catalog/text.js';
|
|
28
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2UI v0.9 + json-render Activity 渲染器
|
|
3
|
+
* 将 A2UI v0.9 协议转换为 json-render Schema 进行渲染
|
|
4
|
+
*
|
|
5
|
+
* 工作流程:
|
|
6
|
+
* 1. 接收 ACTIVITY_SNAPSHOT/DELTA 中的 A2UI content
|
|
7
|
+
* 2. 区分消息类型:UI型 vs 纯数据型
|
|
8
|
+
* 3. UI型:转换为 Schema 并注册到 SurfaceStateManager,渲染 UI
|
|
9
|
+
* 4. 纯数据型:通过 SurfaceStateManager 更新数据,触发订阅者重渲染,本组件不渲染
|
|
10
|
+
*
|
|
11
|
+
* 消息分类:
|
|
12
|
+
* - UI型消息:包含 createSurface / updateComponents / deleteSurface → 需要渲染/更新 UI
|
|
13
|
+
* - 纯数据型消息:仅包含 updateDataModel → 只更新状态,不渲染新 UI
|
|
14
|
+
*/
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import type { ComponentRegistry } from './renderer';
|
|
17
|
+
import type { JsonRenderActivityProps } from './types';
|
|
18
|
+
import type { A2UIMessage } from './adapters';
|
|
19
|
+
export interface A2UIJsonRenderActivityRendererProps extends Omit<JsonRenderActivityProps, 'content'> {
|
|
20
|
+
/** A2UI content(包含 messages 数组) */
|
|
21
|
+
content: {
|
|
22
|
+
messages?: A2UIMessage[];
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
/** 组件注册表(必须) */
|
|
26
|
+
registry: ComponentRegistry;
|
|
27
|
+
/** Action 处理器(可选) */
|
|
28
|
+
actionHandlers?: Record<string, (params: Record<string, unknown>) => void | Promise<void>>;
|
|
29
|
+
/** 显示调试信息 */
|
|
30
|
+
debug?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A2UI v0.9 + json-render Activity 渲染器组件
|
|
34
|
+
*/
|
|
35
|
+
export declare const A2UIJsonRenderActivityRenderer: React.FC<A2UIJsonRenderActivityRendererProps>;
|
|
36
|
+
export default A2UIJsonRenderActivityRenderer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tdesign v1.0.2-alpha.15
|
|
3
|
+
* (c) 2026 tdesign
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
8
|
+
import 'react';
|
|
9
|
+
export { A as A2UIJsonRenderActivityRenderer, A as default } from '../../../_chunks/dep-f2051ebd.js';
|
|
10
|
+
import './adapters/index.js';
|
|
11
|
+
import './SurfaceStateManager.js';
|
|
12
|
+
import './adapters/a2ui-to-jsonrender.js';
|
|
13
|
+
import '@babel/runtime/helpers/typeof';
|
|
14
|
+
import './engine.js';
|
|
15
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
16
|
+
import '@babel/runtime/helpers/createClass';
|
|
17
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
18
|
+
import './performance.js';
|
|
19
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
20
|
+
import './catalog/button.js';
|
|
21
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
22
|
+
import 'tdesign-react';
|
|
23
|
+
import '@json-render/core';
|
|
24
|
+
import './contexts/data.js';
|
|
25
|
+
import './catalog/card.js';
|
|
26
|
+
import './catalog/text.js';
|
|
27
|
+
import './catalog/layout.js';
|
|
28
|
+
import './catalog.js';
|
|
29
|
+
import 'zod';
|
|
30
|
+
import './contexts/visibility.js';
|
|
31
|
+
import './contexts/actions.js';
|
|
32
|
+
import '@babel/runtime/helpers/asyncToGenerator';
|
|
33
|
+
import '@babel/runtime/regenerator';
|
|
34
|
+
import './contexts/validation.js';
|
|
35
|
+
import './renderer.js';
|
|
36
|
+
//# sourceMappingURL=A2UIJsonRenderActivityRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2UIJsonRenderActivityRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* json-render Activity 渲染器
|
|
3
|
+
* 基于 TDesign ChatEngine 的 Activity 机制集成 json-render
|
|
4
|
+
*
|
|
5
|
+
* 核心特性:
|
|
6
|
+
* 1. 支持 ACTIVITY_SNAPSHOT 全量渲染
|
|
7
|
+
* 2. 支持 ACTIVITY_DELTA 增量更新(Delta Merge 由数据层完成,此处接收完整 Schema)
|
|
8
|
+
* 3. 使用 React.memo + react-fast-compare 优化渲染性能
|
|
9
|
+
* 4. 与现有 A2UI 渲染器并行工作
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import type { ComponentRegistry } from './renderer';
|
|
14
|
+
import type { JsonRenderActivityProps } from './types';
|
|
15
|
+
export interface JsonRenderActivityRendererProps extends JsonRenderActivityProps {
|
|
16
|
+
/** 组件注册表(必须) */
|
|
17
|
+
registry: ComponentRegistry;
|
|
18
|
+
/**
|
|
19
|
+
* Action 处理器映射表
|
|
20
|
+
*
|
|
21
|
+
* 示例:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const actionHandlers = {
|
|
24
|
+
* submit: async (params) => { ... },
|
|
25
|
+
* reset: async (params) => { ... },
|
|
26
|
+
* cancel: async (params) => { ... },
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
actionHandlers?: Record<string, (params: Record<string, unknown>) => void | Promise<void>>;
|
|
31
|
+
/** 显示调试信息 */
|
|
32
|
+
debug?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 使用 React.memo 包装,配合 react-fast-compare 进行高效的深比较
|
|
36
|
+
*
|
|
37
|
+
* 对比策略:
|
|
38
|
+
* 1. registry 引用比较(通常是稳定的)
|
|
39
|
+
* 2. actionHandlers 引用比较(建议使用 useMemo 稳定化)
|
|
40
|
+
* 3. content 使用 react-fast-compare 深比较(比 JSON.stringify 快 3-5 倍)
|
|
41
|
+
*/
|
|
42
|
+
export declare const JsonRenderActivityRenderer: React.NamedExoticComponent<JsonRenderActivityRendererProps>;
|
|
43
|
+
/**
|
|
44
|
+
* 默认导出
|
|
45
|
+
*/
|
|
46
|
+
export default JsonRenderActivityRenderer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tdesign v1.0.2-alpha.15
|
|
3
|
+
* (c) 2026 tdesign
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import 'react';
|
|
8
|
+
export { J as JsonRenderActivityRenderer, J as default } from '../../../_chunks/dep-f2051ebd.js';
|
|
9
|
+
import './contexts/data.js';
|
|
10
|
+
import './contexts/visibility.js';
|
|
11
|
+
import './contexts/actions.js';
|
|
12
|
+
import './renderer.js';
|
|
13
|
+
import '@babel/runtime/helpers/typeof';
|
|
14
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
15
|
+
import './adapters/index.js';
|
|
16
|
+
import './adapters/a2ui-to-jsonrender.js';
|
|
17
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
18
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
19
|
+
import './SurfaceStateManager.js';
|
|
20
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
21
|
+
import '@babel/runtime/helpers/createClass';
|
|
22
|
+
import './engine.js';
|
|
23
|
+
import './performance.js';
|
|
24
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
25
|
+
import './catalog/button.js';
|
|
26
|
+
import 'tdesign-react';
|
|
27
|
+
import '@json-render/core';
|
|
28
|
+
import './catalog/card.js';
|
|
29
|
+
import './catalog/text.js';
|
|
30
|
+
import './catalog/layout.js';
|
|
31
|
+
import './catalog.js';
|
|
32
|
+
import 'zod';
|
|
33
|
+
import './contexts/validation.js';
|
|
34
|
+
import '@babel/runtime/helpers/asyncToGenerator';
|
|
35
|
+
import '@babel/runtime/regenerator';
|
|
36
|
+
//# sourceMappingURL=JsonRenderActivityRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonRenderActivityRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|