@copilotkit/vue 1.57.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/AGENTS.md +50 -0
- package/CHANGELOG.md +13 -0
- package/PARITY.md +434 -0
- package/README.md +396 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +20 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -0
- package/dist/components/copilot-provider/index.d.ts +3 -0
- package/dist/components/copilot-provider/index.d.ts.map +1 -0
- package/dist/components/copilot-provider/types.d.ts +22 -0
- package/dist/components/copilot-provider/types.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-copilot-action.d.ts +27 -0
- package/dist/hooks/use-copilot-action.d.ts.map +1 -0
- package/dist/hooks/use-copilot-readable.d.ts +20 -0
- package/dist/hooks/use-copilot-readable.d.ts.map +1 -0
- package/dist/hooks/use-frontend-tool.d.ts +21 -0
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +252 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs +85 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs.map +1 -0
- package/dist/use-render-activity-message-CqtxiFSs.js +8927 -0
- package/dist/use-render-activity-message-CqtxiFSs.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +9 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +16 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +7 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts +6 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +18 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts +88 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +154 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +19 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +16 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts +62 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts.map +1 -0
- package/dist/v2/components/a2ui/adapter.d.ts +38 -0
- package/dist/v2/components/a2ui/adapter.d.ts.map +1 -0
- package/dist/v2/components/a2ui/catalog.d.ts +29 -0
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -0
- package/dist/v2/components/a2ui/index.d.ts +5 -0
- package/dist/v2/components/a2ui/index.d.ts.map +1 -0
- package/dist/v2/components/a2ui/utils.d.ts +18 -0
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +12 -0
- package/dist/v2/components/a2ui.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +164 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts +7 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +290 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +72 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts +65 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts +27 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts +26 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts +17 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +21 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts +34 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +106 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts +15 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +48 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +62 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +53 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/audioRecorder.d.ts +11 -0
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +682 -0
- package/dist/v2/components/chat/index.d.ts.map +1 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts +29 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts.map +1 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +3 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +380 -0
- package/dist/v2/components/chat/types.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +2 -0
- package/dist/v2/components/icons/index.d.ts.map +1 -0
- package/dist/v2/components/index.d.ts +8 -0
- package/dist/v2/components/index.d.ts.map +1 -0
- package/dist/v2/hooks/index.d.ts +24 -0
- package/dist/v2/hooks/index.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent-context.d.ts +24 -0
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent.d.ts +53 -0
- package/dist/v2/hooks/use-agent.d.ts.map +1 -0
- package/dist/v2/hooks/use-attachments.d.ts +21 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/use-capabilities.d.ts +16 -0
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -0
- package/dist/v2/hooks/use-component.d.ts +13 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts +24 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +14 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts +19 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +19 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/hooks/use-interrupt.d.ts +36 -0
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -0
- package/dist/v2/hooks/use-katex-styles.d.ts +22 -0
- package/dist/v2/hooks/use-katex-styles.d.ts.map +1 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts +33 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts +28 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts +21 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts +27 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-tool.d.ts +36 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-suggestions.d.ts +26 -0
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-threads.d.ts +42 -0
- package/dist/v2/hooks/use-threads.d.ts.map +1 -0
- package/dist/v2/index.cjs +2 -0
- package/dist/v2/index.cjs.map +1 -0
- package/dist/v2/index.d.cts +9 -0
- package/dist/v2/index.d.mts +9 -0
- package/dist/v2/index.d.ts +9 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.mjs +75 -0
- package/dist/v2/index.mjs.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +3 -0
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -0
- package/dist/v2/lib/shallow-stable.d.ts +7 -0
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -0
- package/dist/v2/lib/transcription-client.d.ts +19 -0
- package/dist/v2/lib/transcription-client.d.ts.map +1 -0
- package/dist/v2/lib/vue-core.d.ts +47 -0
- package/dist/v2/lib/vue-core.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts +15 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts +17 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +61 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +37 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts +4 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts.map +1 -0
- package/dist/v2/providers/index.d.ts +13 -0
- package/dist/v2/providers/index.d.ts.map +1 -0
- package/dist/v2/providers/keys.d.ts +17 -0
- package/dist/v2/providers/keys.d.ts.map +1 -0
- package/dist/v2/providers/license-context.d.ts +7 -0
- package/dist/v2/providers/license-context.d.ts.map +1 -0
- package/dist/v2/providers/types.d.ts +38 -0
- package/dist/v2/providers/types.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts +4 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotKit.d.ts +2 -0
- package/dist/v2/providers/useCopilotKit.d.ts.map +1 -0
- package/dist/v2/providers/useLicenseContext.d.ts +14 -0
- package/dist/v2/providers/useLicenseContext.d.ts.map +1 -0
- package/dist/v2/types/a2ui.d.ts +5 -0
- package/dist/v2/types/a2ui.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +15 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/types/frontend-tool.d.ts +6 -0
- package/dist/v2/types/frontend-tool.d.ts.map +1 -0
- package/dist/v2/types/human-in-the-loop.d.ts +29 -0
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/types/index.d.ts +10 -0
- package/dist/v2/types/index.d.ts.map +1 -0
- package/dist/v2/types/interrupt.d.ts +14 -0
- package/dist/v2/types/interrupt.d.ts.map +1 -0
- package/dist/v2/types/sandbox-function.d.ts +8 -0
- package/dist/v2/types/sandbox-function.d.ts.map +1 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts +18 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts +19 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts +37 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -0
- package/env.d.ts +7 -0
- package/eslint.config.mjs +42 -0
- package/package.json +130 -0
- package/scripts/scope-preflight.mjs +100 -0
- package/src/components/copilot-provider/CopilotKit.vue +18 -0
- package/src/components/copilot-provider/index.ts +2 -0
- package/src/components/copilot-provider/types.ts +24 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-copilot-action.ts +168 -0
- package/src/hooks/use-copilot-readable.ts +75 -0
- package/src/hooks/use-frontend-tool.ts +76 -0
- package/src/index.ts +12 -0
- package/src/styles/globals.css +314 -0
- package/src/v2/__tests__/exports.test.ts +35 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +5 -0
- package/src/v2/__tests__/setup.ts +141 -0
- package/src/v2/__tests__/utils/agents.ts +391 -0
- package/src/v2/__tests__/utils/mount.ts +83 -0
- package/src/v2/__tests__/utils/test-helpers.ts +712 -0
- package/src/v2/components/A2UIMessageRenderer.ts +125 -0
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +186 -0
- package/src/v2/components/CopilotKitInspector.vue +42 -0
- package/src/v2/components/InlineFeatureWarning.vue +35 -0
- package/src/v2/components/LicenseWarningBanner.vue +196 -0
- package/src/v2/components/MCPAppsActivityRenderer.ts +778 -0
- package/src/v2/components/OpenGenerativeUIRenderer.ts +550 -0
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +271 -0
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +57 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.e2e.test.ts +851 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.test.ts +237 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +516 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +295 -0
- package/src/v2/components/a2ui/A2UICatalogContext.ts +190 -0
- package/src/v2/components/a2ui/VueSurface.ts +144 -0
- package/src/v2/components/a2ui/adapter.ts +156 -0
- package/src/v2/components/a2ui/catalog.ts +858 -0
- package/src/v2/components/a2ui/index.ts +7 -0
- package/src/v2/components/a2ui/utils.ts +67 -0
- package/src/v2/components/a2ui.ts +30 -0
- package/src/v2/components/chat/CopilotChat.vue +777 -0
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +891 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +411 -0
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +87 -0
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +269 -0
- package/src/v2/components/chat/CopilotChatInput.vue +1271 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +476 -0
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +247 -0
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +56 -0
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +93 -0
- package/src/v2/components/chat/CopilotChatToggleButton.vue +145 -0
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +17 -0
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +18 -0
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +161 -0
- package/src/v2/components/chat/CopilotChatUserMessage.vue +322 -0
- package/src/v2/components/chat/CopilotChatView.vue +740 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +73 -0
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +38 -0
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +22 -0
- package/src/v2/components/chat/CopilotPopup.vue +182 -0
- package/src/v2/components/chat/CopilotPopupView.vue +168 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +453 -0
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +140 -0
- package/src/v2/components/chat/CopilotSidebar.vue +178 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +172 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +366 -0
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +142 -0
- package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.ts +237 -0
- package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.ts +1240 -0
- package/src/v2/components/chat/__tests__/CopilotChat.licenseWarning.test.ts +138 -0
- package/src/v2/components/chat/__tests__/CopilotChat.onError.test.ts +85 -0
- package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +652 -0
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +683 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +768 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +1108 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.ts +87 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +277 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentRenderer.test.ts +124 -0
- package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.ts +230 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.bottomAnchored.test.ts +83 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +1139 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +1051 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +494 -0
- package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.ts +181 -0
- package/src/v2/components/chat/__tests__/CopilotChatReasoningMessage.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +674 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.test.ts +91 -0
- package/src/v2/components/chat/__tests__/CopilotChatToggleButton.test.ts +93 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.test.ts +382 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.ts +1019 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.ts +516 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.ts +701 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.test.ts +337 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.ts +135 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +278 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.ts +1082 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +166 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.ts +1145 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.test.ts +374 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +636 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +725 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.ts +603 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +214 -0
- package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.ts +394 -0
- package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.ts +82 -0
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +39 -0
- package/src/v2/components/chat/audioRecorder.ts +15 -0
- package/src/v2/components/chat/index.ts +52 -0
- package/src/v2/components/chat/last-user-message-context.ts +39 -0
- package/src/v2/components/chat/normalize-auto-scroll.ts +17 -0
- package/src/v2/components/chat/types.ts +481 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +86 -0
- package/src/v2/components/icons/index.ts +22 -0
- package/src/v2/components/index.ts +7 -0
- package/src/v2/hooks/__tests__/standard-schema-types.test.ts +149 -0
- package/src/v2/hooks/__tests__/standard-schema.test.ts +315 -0
- package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.ts +144 -0
- package/src/v2/hooks/__tests__/use-agent-context.test.ts +271 -0
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +64 -0
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +268 -0
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.ts +433 -0
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +747 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.ts +187 -0
- package/src/v2/hooks/__tests__/use-agent.test.ts +126 -0
- package/src/v2/hooks/__tests__/use-attachments.test.ts +181 -0
- package/src/v2/hooks/__tests__/use-component.test.ts +145 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.ts +527 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +399 -0
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +214 -0
- package/src/v2/hooks/__tests__/use-frontend-tool-available.test.ts +220 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +2320 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.test.ts +648 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +1379 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +282 -0
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +345 -0
- package/src/v2/hooks/__tests__/use-katex-styles.test.ts +69 -0
- package/src/v2/hooks/__tests__/use-keyboard-height.test.ts +199 -0
- package/src/v2/hooks/__tests__/use-pin-to-send.test.ts +363 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +329 -0
- package/src/v2/hooks/__tests__/use-suggestions.e2e.test.ts +397 -0
- package/src/v2/hooks/__tests__/use-suggestions.test.ts +198 -0
- package/src/v2/hooks/__tests__/use-threads.test.ts +1041 -0
- package/src/v2/hooks/__tests__/zod-regression.test.ts +339 -0
- package/src/v2/hooks/index.ts +29 -0
- package/src/v2/hooks/use-agent-context.ts +55 -0
- package/src/v2/hooks/use-agent.ts +345 -0
- package/src/v2/hooks/use-attachments.ts +261 -0
- package/src/v2/hooks/use-capabilities.ts +30 -0
- package/src/v2/hooks/use-component.ts +46 -0
- package/src/v2/hooks/use-configure-suggestions.ts +252 -0
- package/src/v2/hooks/use-default-render-tool.ts +130 -0
- package/src/v2/hooks/use-frontend-tool.ts +68 -0
- package/src/v2/hooks/use-human-in-the-loop.ts +90 -0
- package/src/v2/hooks/use-interrupt.ts +257 -0
- package/src/v2/hooks/use-katex-styles.ts +44 -0
- package/src/v2/hooks/use-keyboard-height.ts +87 -0
- package/src/v2/hooks/use-pin-to-send.ts +160 -0
- package/src/v2/hooks/use-render-activity-message.ts +92 -0
- package/src/v2/hooks/use-render-custom-messages.ts +129 -0
- package/src/v2/hooks/use-render-tool.ts +128 -0
- package/src/v2/hooks/use-suggestions.ts +98 -0
- package/src/v2/hooks/use-threads.ts +208 -0
- package/src/v2/index.ts +11 -0
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +84 -0
- package/src/v2/lib/__tests__/transcription-client.test.ts +65 -0
- package/src/v2/lib/processPartialHtml.ts +21 -0
- package/src/v2/lib/shallow-stable.ts +54 -0
- package/src/v2/lib/transcription-client.ts +151 -0
- package/src/v2/lib/vue-core.ts +161 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.types.ts +15 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +95 -0
- package/src/v2/providers/CopilotKitProvider.types.ts +66 -0
- package/src/v2/providers/CopilotKitProvider.vue +653 -0
- package/src/v2/providers/SandboxFunctionsContext.ts +11 -0
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +309 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.debug.test.ts +295 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.license.test.ts +110 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.ts +67 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.ts +901 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +141 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.ts +871 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +603 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.ts +104 -0
- package/src/v2/providers/index.ts +21 -0
- package/src/v2/providers/keys.ts +25 -0
- package/src/v2/providers/license-context.ts +16 -0
- package/src/v2/providers/types.ts +40 -0
- package/src/v2/providers/useCopilotChatConfiguration.ts +11 -0
- package/src/v2/providers/useCopilotKit.ts +11 -0
- package/src/v2/providers/useLicenseContext.ts +21 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +157 -0
- package/src/v2/types/a2ui.ts +5 -0
- package/src/v2/types/defineToolCallRenderer.ts +32 -0
- package/src/v2/types/frontend-tool.ts +8 -0
- package/src/v2/types/human-in-the-loop.ts +38 -0
- package/src/v2/types/index.ts +9 -0
- package/src/v2/types/interrupt.ts +15 -0
- package/src/v2/types/sandbox-function.ts +8 -0
- package/src/v2/types/vue-activity-message-renderer.ts +22 -0
- package/src/v2/types/vue-custom-message-renderer.ts +24 -0
- package/src/v2/types/vue-tool-call-renderer.ts +44 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +49 -0
- package/vitest.config.ts +23 -0
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue basic catalog for A2UI v0.9.
|
|
3
|
+
*
|
|
4
|
+
* Provides Vue component implementations for all 18 basic catalog components,
|
|
5
|
+
* mirroring the React renderer's catalog/basic/.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { h, ref, type CSSProperties, type VNode } from "vue";
|
|
9
|
+
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
10
|
+
import {
|
|
11
|
+
TextApi,
|
|
12
|
+
ImageApi,
|
|
13
|
+
IconApi,
|
|
14
|
+
VideoApi,
|
|
15
|
+
AudioPlayerApi,
|
|
16
|
+
RowApi,
|
|
17
|
+
ColumnApi,
|
|
18
|
+
ListApi,
|
|
19
|
+
CardApi,
|
|
20
|
+
TabsApi,
|
|
21
|
+
DividerApi,
|
|
22
|
+
ModalApi,
|
|
23
|
+
ButtonApi,
|
|
24
|
+
TextFieldApi,
|
|
25
|
+
CheckBoxApi,
|
|
26
|
+
ChoicePickerApi,
|
|
27
|
+
SliderApi,
|
|
28
|
+
DateTimeInputApi,
|
|
29
|
+
BASIC_FUNCTIONS,
|
|
30
|
+
} from "@a2ui/web_core/v0_9/basic_catalog";
|
|
31
|
+
|
|
32
|
+
import { createVueComponent, type VueComponentImplementation } from "./adapter";
|
|
33
|
+
import {
|
|
34
|
+
LEAF_MARGIN,
|
|
35
|
+
STANDARD_BORDER,
|
|
36
|
+
STANDARD_RADIUS,
|
|
37
|
+
getBaseLeafStyle,
|
|
38
|
+
getBaseContainerStyle,
|
|
39
|
+
mapJustify,
|
|
40
|
+
mapAlign,
|
|
41
|
+
} from "./utils";
|
|
42
|
+
|
|
43
|
+
// -- Helper: render a child list (arrays of { id, basePath } or string IDs) --
|
|
44
|
+
function renderChildList(
|
|
45
|
+
childList: unknown,
|
|
46
|
+
buildChild: (id: string, basePath?: string) => VNode,
|
|
47
|
+
): VNode[] {
|
|
48
|
+
if (!Array.isArray(childList)) return [];
|
|
49
|
+
return childList
|
|
50
|
+
.map((item: unknown) => {
|
|
51
|
+
if (item && typeof item === "object" && "id" in item) {
|
|
52
|
+
const node = item as { id: string; basePath?: string };
|
|
53
|
+
return buildChild(node.id, node.basePath);
|
|
54
|
+
}
|
|
55
|
+
if (typeof item === "string") {
|
|
56
|
+
return buildChild(item);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
})
|
|
60
|
+
.filter((v): v is VNode => v !== null);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// -- Unique ID counter for form elements --
|
|
64
|
+
let a2uiIdCounter = 0;
|
|
65
|
+
function useA2UIUniqueId(): string {
|
|
66
|
+
return `a2ui-vue-${++a2uiIdCounter}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ============================================================
|
|
70
|
+
// Component Implementations
|
|
71
|
+
// ============================================================
|
|
72
|
+
|
|
73
|
+
const Text = createVueComponent(TextApi, ({ props }) => {
|
|
74
|
+
const text = props.text ?? "";
|
|
75
|
+
const style = { ...getBaseLeafStyle(), display: "inline-block" };
|
|
76
|
+
|
|
77
|
+
switch (props.variant) {
|
|
78
|
+
case "h1":
|
|
79
|
+
return h("h1", { style }, text);
|
|
80
|
+
case "h2":
|
|
81
|
+
return h("h2", { style }, text);
|
|
82
|
+
case "h3":
|
|
83
|
+
return h("h3", { style }, text);
|
|
84
|
+
case "h4":
|
|
85
|
+
return h("h4", { style }, text);
|
|
86
|
+
case "h5":
|
|
87
|
+
return h("h5", { style }, text);
|
|
88
|
+
case "caption":
|
|
89
|
+
return h(
|
|
90
|
+
"small",
|
|
91
|
+
{ style: { ...style, color: "#666", textAlign: "left" } },
|
|
92
|
+
text,
|
|
93
|
+
);
|
|
94
|
+
case "body":
|
|
95
|
+
default:
|
|
96
|
+
return h("span", { style }, text);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const Image = createVueComponent(ImageApi, ({ props }) => {
|
|
101
|
+
const mapFit = (fit?: string): string => {
|
|
102
|
+
if (fit === "scaleDown") return "scale-down";
|
|
103
|
+
return fit || "fill";
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const style: CSSProperties = {
|
|
107
|
+
...getBaseLeafStyle(),
|
|
108
|
+
objectFit: mapFit(props.fit) as CSSProperties["objectFit"],
|
|
109
|
+
width: "100%",
|
|
110
|
+
height: "auto",
|
|
111
|
+
display: "block",
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
if (props.variant === "icon") {
|
|
115
|
+
style.width = "24px";
|
|
116
|
+
style.height = "24px";
|
|
117
|
+
} else if (props.variant === "avatar") {
|
|
118
|
+
style.width = "40px";
|
|
119
|
+
style.height = "40px";
|
|
120
|
+
style.borderRadius = "50%";
|
|
121
|
+
} else if (props.variant === "smallFeature") {
|
|
122
|
+
style.maxWidth = "100px";
|
|
123
|
+
} else if (props.variant === "largeFeature") {
|
|
124
|
+
style.maxHeight = "400px";
|
|
125
|
+
} else if (props.variant === "header") {
|
|
126
|
+
style.height = "200px";
|
|
127
|
+
style.objectFit = "cover";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return h("img", { src: props.url, alt: props.description || "", style });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const Icon = createVueComponent(IconApi, ({ props }) => {
|
|
134
|
+
const iconName =
|
|
135
|
+
typeof props.name === "string"
|
|
136
|
+
? props.name
|
|
137
|
+
: (props.name as { path?: string })?.path;
|
|
138
|
+
const style = {
|
|
139
|
+
...getBaseLeafStyle(),
|
|
140
|
+
fontSize: "24px",
|
|
141
|
+
width: "24px",
|
|
142
|
+
height: "24px",
|
|
143
|
+
display: "inline-flex",
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return h("span", { class: "material-symbols-outlined", style }, iconName);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const Video = createVueComponent(VideoApi, ({ props }) => {
|
|
152
|
+
const style = {
|
|
153
|
+
...getBaseLeafStyle(),
|
|
154
|
+
width: "100%",
|
|
155
|
+
aspectRatio: "16/9",
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return h("video", { src: props.url, controls: true, style });
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const AudioPlayer = createVueComponent(AudioPlayerApi, ({ props }) => {
|
|
162
|
+
const style = { ...getBaseLeafStyle(), width: "100%" };
|
|
163
|
+
|
|
164
|
+
return h(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
style: {
|
|
168
|
+
display: "flex",
|
|
169
|
+
flexDirection: "column",
|
|
170
|
+
gap: "4px",
|
|
171
|
+
width: "100%",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
[
|
|
175
|
+
props.description
|
|
176
|
+
? h(
|
|
177
|
+
"span",
|
|
178
|
+
{ style: { fontSize: "12px", color: "#666" } },
|
|
179
|
+
props.description,
|
|
180
|
+
)
|
|
181
|
+
: null,
|
|
182
|
+
h("audio", { src: props.url, controls: true, style }),
|
|
183
|
+
],
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const Row = createVueComponent(RowApi, ({ props, buildChild }) => {
|
|
188
|
+
return h(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
style: {
|
|
192
|
+
display: "flex",
|
|
193
|
+
flexDirection: "row",
|
|
194
|
+
justifyContent: mapJustify(props.justify),
|
|
195
|
+
alignItems: mapAlign(props.align),
|
|
196
|
+
width: "100%",
|
|
197
|
+
margin: "0",
|
|
198
|
+
padding: "0",
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
renderChildList(props.children, buildChild),
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const Column = createVueComponent(ColumnApi, ({ props, buildChild }) => {
|
|
206
|
+
return h(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
style: {
|
|
210
|
+
display: "flex",
|
|
211
|
+
flexDirection: "column",
|
|
212
|
+
justifyContent: mapJustify(props.justify),
|
|
213
|
+
alignItems: mapAlign(props.align),
|
|
214
|
+
width: "100%",
|
|
215
|
+
margin: "0",
|
|
216
|
+
padding: "0",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
renderChildList(props.children, buildChild),
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const List = createVueComponent(ListApi, ({ props, buildChild }) => {
|
|
224
|
+
const isHorizontal = props.direction === "horizontal";
|
|
225
|
+
const style = {
|
|
226
|
+
display: "flex",
|
|
227
|
+
flexDirection: isHorizontal ? ("row" as const) : ("column" as const),
|
|
228
|
+
alignItems: mapAlign(props.align),
|
|
229
|
+
overflowX: isHorizontal ? ("auto" as const) : ("hidden" as const),
|
|
230
|
+
overflowY: isHorizontal ? ("hidden" as const) : ("auto" as const),
|
|
231
|
+
width: "100%",
|
|
232
|
+
margin: "0",
|
|
233
|
+
padding: "0",
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return h("div", { style }, renderChildList(props.children, buildChild));
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const Card = createVueComponent(CardApi, ({ props, buildChild }) => {
|
|
240
|
+
const style = {
|
|
241
|
+
...getBaseContainerStyle(),
|
|
242
|
+
backgroundColor: "#fff",
|
|
243
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
244
|
+
width: "100%",
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
return h("div", { style }, [props.child ? buildChild(props.child) : null]);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const Tabs = createVueComponent(
|
|
251
|
+
TabsApi,
|
|
252
|
+
({ props, buildChild, state }) => {
|
|
253
|
+
const tabs = props.tabs || [];
|
|
254
|
+
|
|
255
|
+
return h(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
style: {
|
|
259
|
+
display: "flex",
|
|
260
|
+
flexDirection: "column",
|
|
261
|
+
width: "100%",
|
|
262
|
+
margin: LEAF_MARGIN,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
[
|
|
266
|
+
h(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
style: {
|
|
270
|
+
display: "flex",
|
|
271
|
+
borderBottom: "1px solid #ccc",
|
|
272
|
+
marginBottom: "8px",
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
tabs.map((tab, i: number) => {
|
|
276
|
+
const title =
|
|
277
|
+
typeof tab.title === "string"
|
|
278
|
+
? tab.title
|
|
279
|
+
: String(tab.title ?? "");
|
|
280
|
+
return h(
|
|
281
|
+
"button",
|
|
282
|
+
{
|
|
283
|
+
key: i,
|
|
284
|
+
onClick: () => {
|
|
285
|
+
state.selectedIndex.value = i;
|
|
286
|
+
},
|
|
287
|
+
style: {
|
|
288
|
+
padding: "8px 16px",
|
|
289
|
+
border: "none",
|
|
290
|
+
background: "none",
|
|
291
|
+
borderBottom:
|
|
292
|
+
state.selectedIndex.value === i
|
|
293
|
+
? "2px solid var(--a2ui-primary-color, #007bff)"
|
|
294
|
+
: "none",
|
|
295
|
+
fontWeight:
|
|
296
|
+
state.selectedIndex.value === i ? "bold" : "normal",
|
|
297
|
+
cursor: "pointer",
|
|
298
|
+
color:
|
|
299
|
+
state.selectedIndex.value === i
|
|
300
|
+
? "var(--a2ui-primary-color, #007bff)"
|
|
301
|
+
: "inherit",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
title,
|
|
305
|
+
);
|
|
306
|
+
}),
|
|
307
|
+
),
|
|
308
|
+
h("div", { style: { flex: "1" } }, [
|
|
309
|
+
tabs[state.selectedIndex.value]?.child
|
|
310
|
+
? buildChild(tabs[state.selectedIndex.value]!.child)
|
|
311
|
+
: null,
|
|
312
|
+
]),
|
|
313
|
+
],
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
() => ({ selectedIndex: ref(0) }),
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
const Divider = createVueComponent(DividerApi, ({ props }) => {
|
|
320
|
+
const isVertical = props.axis === "vertical";
|
|
321
|
+
const style: Record<string, string> = {
|
|
322
|
+
margin: LEAF_MARGIN,
|
|
323
|
+
border: "none",
|
|
324
|
+
backgroundColor: "#ccc",
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
if (isVertical) {
|
|
328
|
+
style.width = "1px";
|
|
329
|
+
style.height = "100%";
|
|
330
|
+
} else {
|
|
331
|
+
style.width = "100%";
|
|
332
|
+
style.height = "1px";
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return h("div", { style });
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const Modal = createVueComponent(
|
|
339
|
+
ModalApi,
|
|
340
|
+
({ props, buildChild, state }) => {
|
|
341
|
+
return h("div", {}, [
|
|
342
|
+
h(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
onClick: () => {
|
|
346
|
+
state.isOpen.value = true;
|
|
347
|
+
},
|
|
348
|
+
style: { display: "inline-block" },
|
|
349
|
+
},
|
|
350
|
+
[props.trigger ? buildChild(props.trigger) : null],
|
|
351
|
+
),
|
|
352
|
+
state.isOpen.value
|
|
353
|
+
? h(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
style: {
|
|
357
|
+
position: "fixed",
|
|
358
|
+
top: "0",
|
|
359
|
+
left: "0",
|
|
360
|
+
right: "0",
|
|
361
|
+
bottom: "0",
|
|
362
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
363
|
+
display: "flex",
|
|
364
|
+
alignItems: "center",
|
|
365
|
+
justifyContent: "center",
|
|
366
|
+
zIndex: "1000",
|
|
367
|
+
},
|
|
368
|
+
onClick: () => {
|
|
369
|
+
state.isOpen.value = false;
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
[
|
|
373
|
+
h(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
style: {
|
|
377
|
+
backgroundColor: "#fff",
|
|
378
|
+
padding: "24px",
|
|
379
|
+
borderRadius: "8px",
|
|
380
|
+
maxWidth: "90%",
|
|
381
|
+
maxHeight: "90%",
|
|
382
|
+
overflow: "auto",
|
|
383
|
+
display: "flex",
|
|
384
|
+
flexDirection: "column",
|
|
385
|
+
},
|
|
386
|
+
onClick: (e: Event) => e.stopPropagation(),
|
|
387
|
+
},
|
|
388
|
+
[
|
|
389
|
+
h(
|
|
390
|
+
"div",
|
|
391
|
+
{ style: { display: "flex", justifyContent: "flex-end" } },
|
|
392
|
+
[
|
|
393
|
+
h(
|
|
394
|
+
"button",
|
|
395
|
+
{
|
|
396
|
+
onClick: () => {
|
|
397
|
+
state.isOpen.value = false;
|
|
398
|
+
},
|
|
399
|
+
style: {
|
|
400
|
+
border: "none",
|
|
401
|
+
background: "none",
|
|
402
|
+
fontSize: "20px",
|
|
403
|
+
cursor: "pointer",
|
|
404
|
+
padding: "4px",
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
"\u00D7",
|
|
408
|
+
),
|
|
409
|
+
],
|
|
410
|
+
),
|
|
411
|
+
h("div", { style: { flex: "1" } }, [
|
|
412
|
+
props.content ? buildChild(props.content) : null,
|
|
413
|
+
]),
|
|
414
|
+
],
|
|
415
|
+
),
|
|
416
|
+
],
|
|
417
|
+
)
|
|
418
|
+
: null,
|
|
419
|
+
]);
|
|
420
|
+
},
|
|
421
|
+
() => ({ isOpen: ref(false) }),
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
const Button = createVueComponent(ButtonApi, ({ props, buildChild }) => {
|
|
425
|
+
const style = {
|
|
426
|
+
margin: LEAF_MARGIN,
|
|
427
|
+
padding: "8px 16px",
|
|
428
|
+
cursor: "pointer",
|
|
429
|
+
border: props.variant === "borderless" ? "none" : "1px solid #ccc",
|
|
430
|
+
backgroundColor:
|
|
431
|
+
props.variant === "primary"
|
|
432
|
+
? "var(--a2ui-primary-color, #007bff)"
|
|
433
|
+
: props.variant === "borderless"
|
|
434
|
+
? "transparent"
|
|
435
|
+
: "#fff",
|
|
436
|
+
color: props.variant === "primary" ? "#fff" : "inherit",
|
|
437
|
+
borderRadius: "4px",
|
|
438
|
+
display: "inline-flex",
|
|
439
|
+
alignItems: "center",
|
|
440
|
+
justifyContent: "center",
|
|
441
|
+
boxSizing: "border-box",
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
return h(
|
|
445
|
+
"button",
|
|
446
|
+
{
|
|
447
|
+
style,
|
|
448
|
+
onClick: props.action,
|
|
449
|
+
disabled: props.isValid === false,
|
|
450
|
+
},
|
|
451
|
+
[props.child ? buildChild(props.child) : null],
|
|
452
|
+
);
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
const TextField = createVueComponent(TextFieldApi, ({ props, state }) => {
|
|
456
|
+
const uniqueId = state.id;
|
|
457
|
+
const isLong = props.variant === "longText";
|
|
458
|
+
const type =
|
|
459
|
+
props.variant === "number"
|
|
460
|
+
? "number"
|
|
461
|
+
: props.variant === "obscured"
|
|
462
|
+
? "password"
|
|
463
|
+
: "text";
|
|
464
|
+
|
|
465
|
+
const inputStyle = {
|
|
466
|
+
padding: "8px",
|
|
467
|
+
width: "100%",
|
|
468
|
+
border:
|
|
469
|
+
props.validationErrors && props.validationErrors.length > 0
|
|
470
|
+
? "1px solid red"
|
|
471
|
+
: STANDARD_BORDER,
|
|
472
|
+
borderRadius: STANDARD_RADIUS,
|
|
473
|
+
boxSizing: "border-box",
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
const hasError = props.validationErrors && props.validationErrors.length > 0;
|
|
477
|
+
|
|
478
|
+
return h(
|
|
479
|
+
"div",
|
|
480
|
+
{
|
|
481
|
+
style: {
|
|
482
|
+
display: "flex",
|
|
483
|
+
flexDirection: "column",
|
|
484
|
+
gap: "4px",
|
|
485
|
+
width: "100%",
|
|
486
|
+
margin: LEAF_MARGIN,
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
[
|
|
490
|
+
props.label
|
|
491
|
+
? h(
|
|
492
|
+
"label",
|
|
493
|
+
{ for: uniqueId, style: { fontSize: "14px", fontWeight: "bold" } },
|
|
494
|
+
props.label,
|
|
495
|
+
)
|
|
496
|
+
: null,
|
|
497
|
+
isLong
|
|
498
|
+
? h("textarea", {
|
|
499
|
+
id: uniqueId,
|
|
500
|
+
style: inputStyle,
|
|
501
|
+
value: props.value || "",
|
|
502
|
+
onInput: (e: Event) =>
|
|
503
|
+
props.setValue((e.target as HTMLTextAreaElement).value),
|
|
504
|
+
})
|
|
505
|
+
: h("input", {
|
|
506
|
+
id: uniqueId,
|
|
507
|
+
type,
|
|
508
|
+
style: inputStyle,
|
|
509
|
+
value: props.value || "",
|
|
510
|
+
onInput: (e: Event) =>
|
|
511
|
+
props.setValue((e.target as HTMLInputElement).value),
|
|
512
|
+
}),
|
|
513
|
+
hasError
|
|
514
|
+
? h(
|
|
515
|
+
"span",
|
|
516
|
+
{ style: { fontSize: "12px", color: "red" } },
|
|
517
|
+
props.validationErrors![0],
|
|
518
|
+
)
|
|
519
|
+
: null,
|
|
520
|
+
],
|
|
521
|
+
);
|
|
522
|
+
}, () => ({ id: useA2UIUniqueId() }));
|
|
523
|
+
|
|
524
|
+
const CheckBox = createVueComponent(CheckBoxApi, ({ props, state }) => {
|
|
525
|
+
const uniqueId = state.id;
|
|
526
|
+
const hasError = props.validationErrors && props.validationErrors.length > 0;
|
|
527
|
+
|
|
528
|
+
return h(
|
|
529
|
+
"div",
|
|
530
|
+
{
|
|
531
|
+
style: { display: "flex", flexDirection: "column", margin: LEAF_MARGIN },
|
|
532
|
+
},
|
|
533
|
+
[
|
|
534
|
+
h(
|
|
535
|
+
"div",
|
|
536
|
+
{ style: { display: "flex", alignItems: "center", gap: "8px" } },
|
|
537
|
+
[
|
|
538
|
+
h("input", {
|
|
539
|
+
id: uniqueId,
|
|
540
|
+
type: "checkbox",
|
|
541
|
+
checked: !!props.value,
|
|
542
|
+
onChange: (e: Event) =>
|
|
543
|
+
props.setValue((e.target as HTMLInputElement).checked),
|
|
544
|
+
style: {
|
|
545
|
+
cursor: "pointer",
|
|
546
|
+
outline: hasError ? "1px solid red" : "none",
|
|
547
|
+
},
|
|
548
|
+
}),
|
|
549
|
+
props.label
|
|
550
|
+
? h(
|
|
551
|
+
"label",
|
|
552
|
+
{
|
|
553
|
+
for: uniqueId,
|
|
554
|
+
style: {
|
|
555
|
+
cursor: "pointer",
|
|
556
|
+
color: hasError ? "red" : "inherit",
|
|
557
|
+
},
|
|
558
|
+
},
|
|
559
|
+
props.label,
|
|
560
|
+
)
|
|
561
|
+
: null,
|
|
562
|
+
],
|
|
563
|
+
),
|
|
564
|
+
hasError
|
|
565
|
+
? h(
|
|
566
|
+
"span",
|
|
567
|
+
{
|
|
568
|
+
style: { fontSize: "12px", color: "red", marginTop: "4px" },
|
|
569
|
+
},
|
|
570
|
+
props.validationErrors?.[0],
|
|
571
|
+
)
|
|
572
|
+
: null,
|
|
573
|
+
],
|
|
574
|
+
);
|
|
575
|
+
}, () => ({ id: useA2UIUniqueId() }));
|
|
576
|
+
|
|
577
|
+
const ChoicePicker = createVueComponent(
|
|
578
|
+
ChoicePickerApi,
|
|
579
|
+
({ props, context, state }) => {
|
|
580
|
+
const values = Array.isArray(props.value) ? props.value : [];
|
|
581
|
+
const isMutuallyExclusive = props.variant === "mutuallyExclusive";
|
|
582
|
+
|
|
583
|
+
const onToggle = (val: string) => {
|
|
584
|
+
if (isMutuallyExclusive) {
|
|
585
|
+
props.setValue([val]);
|
|
586
|
+
} else {
|
|
587
|
+
const newValues = values.includes(val)
|
|
588
|
+
? values.filter((v: string) => v !== val)
|
|
589
|
+
: [...values, val];
|
|
590
|
+
props.setValue(newValues);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
type ChoiceOption = {
|
|
595
|
+
label?: string | Record<string, unknown>;
|
|
596
|
+
value: string;
|
|
597
|
+
};
|
|
598
|
+
const options = (props.options || []).filter(
|
|
599
|
+
(opt: ChoiceOption) =>
|
|
600
|
+
!props.filterable ||
|
|
601
|
+
state.filter.value === "" ||
|
|
602
|
+
String(typeof opt.label === "string" ? opt.label : "")
|
|
603
|
+
.toLowerCase()
|
|
604
|
+
.includes(state.filter.value.toLowerCase()),
|
|
605
|
+
);
|
|
606
|
+
|
|
607
|
+
return h(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
style: {
|
|
611
|
+
display: "flex",
|
|
612
|
+
flexDirection: "column",
|
|
613
|
+
gap: "8px",
|
|
614
|
+
margin: LEAF_MARGIN,
|
|
615
|
+
width: "100%",
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
[
|
|
619
|
+
props.label
|
|
620
|
+
? h("strong", { style: { fontSize: "14px" } }, props.label)
|
|
621
|
+
: null,
|
|
622
|
+
props.filterable
|
|
623
|
+
? h("input", {
|
|
624
|
+
type: "text",
|
|
625
|
+
placeholder: "Filter options...",
|
|
626
|
+
value: state.filter.value,
|
|
627
|
+
onInput: (e: Event) => {
|
|
628
|
+
state.filter.value = (e.target as HTMLInputElement).value;
|
|
629
|
+
},
|
|
630
|
+
style: {
|
|
631
|
+
padding: "4px 8px",
|
|
632
|
+
border: STANDARD_BORDER,
|
|
633
|
+
borderRadius: STANDARD_RADIUS,
|
|
634
|
+
},
|
|
635
|
+
})
|
|
636
|
+
: null,
|
|
637
|
+
h(
|
|
638
|
+
"div",
|
|
639
|
+
{
|
|
640
|
+
style: {
|
|
641
|
+
display: "flex",
|
|
642
|
+
flexDirection: props.displayStyle === "chips" ? "row" : "column",
|
|
643
|
+
flexWrap: props.displayStyle === "chips" ? "wrap" : "nowrap",
|
|
644
|
+
gap: "8px",
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
options.map((opt: ChoiceOption, i: number) => {
|
|
648
|
+
const isSelected = values.includes(opt.value);
|
|
649
|
+
const label =
|
|
650
|
+
typeof opt.label === "string"
|
|
651
|
+
? opt.label
|
|
652
|
+
: String(opt.label ?? opt.value);
|
|
653
|
+
if (props.displayStyle === "chips") {
|
|
654
|
+
return h(
|
|
655
|
+
"button",
|
|
656
|
+
{
|
|
657
|
+
key: i,
|
|
658
|
+
onClick: () => onToggle(opt.value),
|
|
659
|
+
style: {
|
|
660
|
+
padding: "4px 12px",
|
|
661
|
+
borderRadius: "16px",
|
|
662
|
+
border: isSelected
|
|
663
|
+
? "1px solid var(--a2ui-primary-color, #007bff)"
|
|
664
|
+
: STANDARD_BORDER,
|
|
665
|
+
backgroundColor: isSelected
|
|
666
|
+
? "var(--a2ui-primary-color, #007bff)"
|
|
667
|
+
: "#fff",
|
|
668
|
+
color: isSelected ? "#fff" : "inherit",
|
|
669
|
+
cursor: "pointer",
|
|
670
|
+
fontSize: "12px",
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
label,
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
return h(
|
|
677
|
+
"label",
|
|
678
|
+
{
|
|
679
|
+
key: i,
|
|
680
|
+
style: {
|
|
681
|
+
display: "flex",
|
|
682
|
+
alignItems: "center",
|
|
683
|
+
gap: "8px",
|
|
684
|
+
cursor: "pointer",
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
[
|
|
688
|
+
h("input", {
|
|
689
|
+
type: isMutuallyExclusive ? "radio" : "checkbox",
|
|
690
|
+
checked: isSelected,
|
|
691
|
+
onChange: () => onToggle(opt.value),
|
|
692
|
+
name: isMutuallyExclusive
|
|
693
|
+
? `choice-${context.componentModel.id}`
|
|
694
|
+
: undefined,
|
|
695
|
+
}),
|
|
696
|
+
h("span", { style: { fontSize: "14px" } }, label),
|
|
697
|
+
],
|
|
698
|
+
);
|
|
699
|
+
}),
|
|
700
|
+
),
|
|
701
|
+
],
|
|
702
|
+
);
|
|
703
|
+
},
|
|
704
|
+
() => ({ filter: ref("") }),
|
|
705
|
+
);
|
|
706
|
+
|
|
707
|
+
const Slider = createVueComponent(SliderApi, ({ props, state }) => {
|
|
708
|
+
const uniqueId = state.id;
|
|
709
|
+
|
|
710
|
+
return h(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
style: {
|
|
714
|
+
display: "flex",
|
|
715
|
+
flexDirection: "column",
|
|
716
|
+
gap: "4px",
|
|
717
|
+
margin: LEAF_MARGIN,
|
|
718
|
+
width: "100%",
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
[
|
|
722
|
+
h(
|
|
723
|
+
"div",
|
|
724
|
+
{ style: { display: "flex", justifyContent: "space-between" } },
|
|
725
|
+
[
|
|
726
|
+
props.label
|
|
727
|
+
? h(
|
|
728
|
+
"label",
|
|
729
|
+
{
|
|
730
|
+
for: uniqueId,
|
|
731
|
+
style: { fontSize: "14px", fontWeight: "bold" },
|
|
732
|
+
},
|
|
733
|
+
props.label,
|
|
734
|
+
)
|
|
735
|
+
: null,
|
|
736
|
+
h(
|
|
737
|
+
"span",
|
|
738
|
+
{ style: { fontSize: "12px", color: "#666" } },
|
|
739
|
+
String(props.value),
|
|
740
|
+
),
|
|
741
|
+
],
|
|
742
|
+
),
|
|
743
|
+
h("input", {
|
|
744
|
+
id: uniqueId,
|
|
745
|
+
type: "range",
|
|
746
|
+
min: props.min ?? 0,
|
|
747
|
+
max: props.max,
|
|
748
|
+
value: props.value ?? 0,
|
|
749
|
+
onInput: (e: Event) =>
|
|
750
|
+
props.setValue(Number((e.target as HTMLInputElement).value)),
|
|
751
|
+
style: { width: "100%", cursor: "pointer" },
|
|
752
|
+
}),
|
|
753
|
+
],
|
|
754
|
+
);
|
|
755
|
+
}, () => ({ id: useA2UIUniqueId() }));
|
|
756
|
+
|
|
757
|
+
const DateTimeInput = createVueComponent(DateTimeInputApi, ({ props, state }) => {
|
|
758
|
+
const uniqueId = state.id;
|
|
759
|
+
|
|
760
|
+
let type = "datetime-local";
|
|
761
|
+
if (props.enableDate && !props.enableTime) type = "date";
|
|
762
|
+
if (!props.enableDate && props.enableTime) type = "time";
|
|
763
|
+
|
|
764
|
+
const style = {
|
|
765
|
+
padding: "8px",
|
|
766
|
+
width: "100%",
|
|
767
|
+
border: STANDARD_BORDER,
|
|
768
|
+
borderRadius: STANDARD_RADIUS,
|
|
769
|
+
boxSizing: "border-box",
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
return h(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
style: {
|
|
776
|
+
display: "flex",
|
|
777
|
+
flexDirection: "column",
|
|
778
|
+
gap: "4px",
|
|
779
|
+
width: "100%",
|
|
780
|
+
margin: LEAF_MARGIN,
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
[
|
|
784
|
+
props.label
|
|
785
|
+
? h(
|
|
786
|
+
"label",
|
|
787
|
+
{
|
|
788
|
+
for: uniqueId,
|
|
789
|
+
style: { fontSize: "14px", fontWeight: "bold" },
|
|
790
|
+
},
|
|
791
|
+
props.label,
|
|
792
|
+
)
|
|
793
|
+
: null,
|
|
794
|
+
h("input", {
|
|
795
|
+
id: uniqueId,
|
|
796
|
+
type,
|
|
797
|
+
style,
|
|
798
|
+
value: props.value || "",
|
|
799
|
+
onInput: (e: Event) =>
|
|
800
|
+
props.setValue((e.target as HTMLInputElement).value),
|
|
801
|
+
min: typeof props.min === "string" ? props.min : undefined,
|
|
802
|
+
max: typeof props.max === "string" ? props.max : undefined,
|
|
803
|
+
}),
|
|
804
|
+
],
|
|
805
|
+
);
|
|
806
|
+
}, () => ({ id: useA2UIUniqueId() }));
|
|
807
|
+
|
|
808
|
+
// ============================================================
|
|
809
|
+
// Catalog Assembly
|
|
810
|
+
// ============================================================
|
|
811
|
+
|
|
812
|
+
const vueBasicComponents: VueComponentImplementation[] = [
|
|
813
|
+
Text,
|
|
814
|
+
Image,
|
|
815
|
+
Icon,
|
|
816
|
+
Video,
|
|
817
|
+
AudioPlayer,
|
|
818
|
+
Row,
|
|
819
|
+
Column,
|
|
820
|
+
List,
|
|
821
|
+
Card,
|
|
822
|
+
Tabs,
|
|
823
|
+
Divider,
|
|
824
|
+
Modal,
|
|
825
|
+
Button,
|
|
826
|
+
TextField,
|
|
827
|
+
CheckBox,
|
|
828
|
+
ChoicePicker,
|
|
829
|
+
Slider,
|
|
830
|
+
DateTimeInput,
|
|
831
|
+
];
|
|
832
|
+
|
|
833
|
+
export const vueBasicCatalog = new Catalog<VueComponentImplementation>(
|
|
834
|
+
"https://a2ui.org/specification/v0_9/basic_catalog.json",
|
|
835
|
+
vueBasicComponents,
|
|
836
|
+
BASIC_FUNCTIONS,
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
export {
|
|
840
|
+
Text,
|
|
841
|
+
Image,
|
|
842
|
+
Icon,
|
|
843
|
+
Video,
|
|
844
|
+
AudioPlayer,
|
|
845
|
+
Row,
|
|
846
|
+
Column,
|
|
847
|
+
List,
|
|
848
|
+
Card,
|
|
849
|
+
Tabs,
|
|
850
|
+
Divider,
|
|
851
|
+
Modal,
|
|
852
|
+
Button,
|
|
853
|
+
TextField,
|
|
854
|
+
CheckBox,
|
|
855
|
+
ChoicePicker,
|
|
856
|
+
Slider,
|
|
857
|
+
DateTimeInput,
|
|
858
|
+
};
|