@baishuyun/chat-sdk 0.0.1-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/.storybook/main.ts +21 -0
- package/.storybook/preview-head.html +1 -0
- package/.storybook/preview.ts +16 -0
- package/.turbo/turbo-build.log +82 -0
- package/components.json +22 -0
- package/dist/chat-sdk.js +55613 -0
- package/dist/chat-sdk.js.map +1 -0
- package/dist/chat-sdk.umd.cjs +661 -0
- package/dist/chat-sdk.umd.cjs.map +1 -0
- package/dist/chat.d.ts +5 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/components/biz-comp/FakeBotMsg.d.ts +7 -0
- package/dist/components/biz-comp/FakeBotMsg.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldChecker.d.ts +16 -0
- package/dist/components/biz-comp/FieldChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldCheckerListMsg.d.ts +12 -0
- package/dist/components/biz-comp/FieldCheckerListMsg.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldValueChecker.d.ts +14 -0
- package/dist/components/biz-comp/FieldValueChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/SubformFieldsValueChecker.d.ts +20 -0
- package/dist/components/biz-comp/SubformFieldsValueChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/chat-client.d.ts +13 -0
- package/dist/components/biz-comp/chat-client.d.ts.map +1 -0
- package/dist/components/biz-comp/chat-frame.d.ts +6 -0
- package/dist/components/biz-comp/chat-frame.d.ts.map +1 -0
- package/dist/components/biz-comp/conversation.d.ts +10 -0
- package/dist/components/biz-comp/conversation.d.ts.map +1 -0
- package/dist/components/biz-comp/dock-btn.d.ts +2 -0
- package/dist/components/biz-comp/dock-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/field-icon.d.ts +5 -0
- package/dist/components/biz-comp/field-icon.d.ts.map +1 -0
- package/dist/components/biz-comp/markdown-part.d.ts +5 -0
- package/dist/components/biz-comp/markdown-part.d.ts.map +1 -0
- package/dist/components/biz-comp/markdown.d.ts +5 -0
- package/dist/components/biz-comp/markdown.d.ts.map +1 -0
- package/dist/components/biz-comp/message-content.d.ts +6 -0
- package/dist/components/biz-comp/message-content.d.ts.map +1 -0
- package/dist/components/biz-comp/messages.d.ts +3 -0
- package/dist/components/biz-comp/messages.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/attachment-btn.d.ts +9 -0
- package/dist/components/biz-comp/multi-modal-input/attachment-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/clear-btn.d.ts +7 -0
- package/dist/components/biz-comp/multi-modal-input/clear-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/index.d.ts +21 -0
- package/dist/components/biz-comp/multi-modal-input/index.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/preview-attachment.d.ts +12 -0
- package/dist/components/biz-comp/multi-modal-input/preview-attachment.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/prompt-input.d.ts +35 -0
- package/dist/components/biz-comp/multi-modal-input/prompt-input.d.ts.map +1 -0
- package/dist/components/biz-comp/opening-lines.d.ts +3 -0
- package/dist/components/biz-comp/opening-lines.d.ts.map +1 -0
- package/dist/components/biz-comp/preview-message-wrapper.d.ts +9 -0
- package/dist/components/biz-comp/preview-message-wrapper.d.ts.map +1 -0
- package/dist/components/biz-comp/preview-message.d.ts +11 -0
- package/dist/components/biz-comp/preview-message.d.ts.map +1 -0
- package/dist/components/biz-comp/response.d.ts +6 -0
- package/dist/components/biz-comp/response.d.ts.map +1 -0
- package/dist/components/biz-comp/suggestions.d.ts +7 -0
- package/dist/components/biz-comp/suggestions.d.ts.map +1 -0
- package/dist/components/bs-ui/abs-fullscreen-gradient-bg.d.ts +9 -0
- package/dist/components/bs-ui/abs-fullscreen-gradient-bg.d.ts.map +1 -0
- package/dist/components/bs-ui/attachments-previewer.d.ts +15 -0
- package/dist/components/bs-ui/attachments-previewer.d.ts.map +1 -0
- package/dist/components/bs-ui/border-color-animation.d.ts +9 -0
- package/dist/components/bs-ui/border-color-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/bot-avatar-name.d.ts +6 -0
- package/dist/components/bs-ui/bot-avatar-name.d.ts.map +1 -0
- package/dist/components/bs-ui/bot-icon.d.ts +5 -0
- package/dist/components/bs-ui/bot-icon.d.ts.map +1 -0
- package/dist/components/bs-ui/bs-icons.d.ts +39 -0
- package/dist/components/bs-ui/bs-icons.d.ts.map +1 -0
- package/dist/components/bs-ui/card.d.ts +10 -0
- package/dist/components/bs-ui/card.d.ts.map +1 -0
- package/dist/components/bs-ui/chat-area-header.d.ts +9 -0
- package/dist/components/bs-ui/chat-area-header.d.ts.map +1 -0
- package/dist/components/bs-ui/collapsible-txt-msg.d.ts +10 -0
- package/dist/components/bs-ui/collapsible-txt-msg.d.ts.map +1 -0
- package/dist/components/bs-ui/confirm-dialog.d.ts +26 -0
- package/dist/components/bs-ui/confirm-dialog.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-generating-indicator.d.ts +2 -0
- package/dist/components/bs-ui/fields-generating-indicator.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-portal.d.ts +8 -0
- package/dist/components/bs-ui/fields-portal.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-previewer.d.ts +12 -0
- package/dist/components/bs-ui/fields-previewer.d.ts.map +1 -0
- package/dist/components/bs-ui/font-icon.d.ts +6 -0
- package/dist/components/bs-ui/font-icon.d.ts.map +1 -0
- package/dist/components/bs-ui/form-info-editor.d.ts +37 -0
- package/dist/components/bs-ui/form-info-editor.d.ts.map +1 -0
- package/dist/components/bs-ui/generate-animation.d.ts +4 -0
- package/dist/components/bs-ui/generate-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/icon-btn.d.ts +7 -0
- package/dist/components/bs-ui/icon-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/line-checker.d.ts +15 -0
- package/dist/components/bs-ui/line-checker.d.ts.map +1 -0
- package/dist/components/bs-ui/linear-gradient-border-btn.d.ts +10 -0
- package/dist/components/bs-ui/linear-gradient-border-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/linear-gradient-color-bg-animation.d.ts +8 -0
- package/dist/components/bs-ui/linear-gradient-color-bg-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/option-item.d.ts +9 -0
- package/dist/components/bs-ui/option-item.d.ts.map +1 -0
- package/dist/components/bs-ui/previewer-header.d.ts +13 -0
- package/dist/components/bs-ui/previewer-header.d.ts.map +1 -0
- package/dist/components/bs-ui/primary-confirm-btn.d.ts +7 -0
- package/dist/components/bs-ui/primary-confirm-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/primary-entry-btn.d.ts +9 -0
- package/dist/components/bs-ui/primary-entry-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/tab-radio-group.d.ts +16 -0
- package/dist/components/bs-ui/tab-radio-group.d.ts.map +1 -0
- package/dist/components/bs-ui/tooltip.d.ts +5 -0
- package/dist/components/bs-ui/tooltip.d.ts.map +1 -0
- package/dist/components/bs-ui/user-txt-msg-bubble.d.ts +6 -0
- package/dist/components/bs-ui/user-txt-msg-bubble.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +24 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/icons.d.ts +176 -0
- package/dist/components/ui/icons.d.ts.map +1 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/one-time-click-btn.d.ts +4 -0
- package/dist/components/ui/one-time-click-btn.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/web-comp/fields-previewer-web-component.d.ts +61 -0
- package/dist/components/web-comp/fields-previewer-web-component.d.ts.map +1 -0
- package/dist/const/index.d.ts +4 -0
- package/dist/const/index.d.ts.map +1 -0
- package/dist/const/ui.d.ts +4 -0
- package/dist/const/ui.d.ts.map +1 -0
- package/dist/hooks/use-evt-bus.d.ts +2 -0
- package/dist/hooks/use-evt-bus.d.ts.map +1 -0
- package/dist/hooks/use-evt.d.ts +3 -0
- package/dist/hooks/use-evt.d.ts.map +1 -0
- package/dist/hooks/use-frame-mode.d.ts +5 -0
- package/dist/hooks/use-frame-mode.d.ts.map +1 -0
- package/dist/hooks/use-plugin-component.d.ts +5 -0
- package/dist/hooks/use-plugin-component.d.ts.map +1 -0
- package/dist/hooks/use-plugin-ctx.d.ts +3 -0
- package/dist/hooks/use-plugin-ctx.d.ts.map +1 -0
- package/dist/hooks/use-plugin-custom-components.d.ts +4 -0
- package/dist/hooks/use-plugin-custom-components.d.ts.map +1 -0
- package/dist/hooks/use-plugin-life-cycle-chain-runner.d.ts +5 -0
- package/dist/hooks/use-plugin-life-cycle-chain-runner.d.ts.map +1 -0
- package/dist/hooks/use-plugin-list.d.ts +2 -0
- package/dist/hooks/use-plugin-list.d.ts.map +1 -0
- package/dist/hooks/use-plugin.d.ts +2 -0
- package/dist/hooks/use-plugin.d.ts.map +1 -0
- package/dist/hooks/use-shadow.d.ts +25 -0
- package/dist/hooks/use-shadow.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/event-emitter.d.ts +39 -0
- package/dist/lib/event-emitter.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +30 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/const.d.ts +3 -0
- package/dist/plugins/form-builder-base-plugin/const.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/index.d.ts +7 -0
- package/dist/plugins/form-builder-base-plugin/index.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/types.d.ts +12 -0
- package/dist/plugins/form-builder-base-plugin/types.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts +2 -0
- package/dist/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/avatar.d.ts +5 -0
- package/dist/plugins/form-filling-plugin/components/avatar.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/entry-btn.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/msg-part.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/const.d.ts +612 -0
- package/dist/plugins/form-filling-plugin/const.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/index.d.ts +13 -0
- package/dist/plugins/form-filling-plugin/index.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/types.d.ts +8 -0
- package/dist/plugins/form-filling-plugin/types.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/utils.d.ts +4 -0
- package/dist/plugins/form-filling-plugin/utils.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/components/confirmer.d.ts +9 -0
- package/dist/plugins/general-model-form-builder-plugin/components/confirmer.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/components/ghost-evt-dispatcher.d.ts +10 -0
- package/dist/plugins/general-model-form-builder-plugin/components/ghost-evt-dispatcher.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/components/msg-part.d.ts +3 -0
- package/dist/plugins/general-model-form-builder-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/components/new-confirmer.d.ts +10 -0
- package/dist/plugins/general-model-form-builder-plugin/components/new-confirmer.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/const.d.ts +3 -0
- package/dist/plugins/general-model-form-builder-plugin/const.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/index.d.ts +9 -0
- package/dist/plugins/general-model-form-builder-plugin/index.d.ts.map +1 -0
- package/dist/plugins/general-model-form-builder-plugin/types.d.ts +3 -0
- package/dist/plugins/general-model-form-builder-plugin/types.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/components/create-form-confirm.d.ts +7 -0
- package/dist/plugins/mcp-form-builder-plugin/components/create-form-confirm.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/components/entry-btn.d.ts +3 -0
- package/dist/plugins/mcp-form-builder-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/components/follow-up.d.ts +3 -0
- package/dist/plugins/mcp-form-builder-plugin/components/follow-up.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/components/msg-part.d.ts +3 -0
- package/dist/plugins/mcp-form-builder-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/const/index.d.ts +12 -0
- package/dist/plugins/mcp-form-builder-plugin/const/index.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/hooks/index.d.ts +1 -0
- package/dist/plugins/mcp-form-builder-plugin/hooks/index.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/hooks/use-fields-confirmed.d.ts +2 -0
- package/dist/plugins/mcp-form-builder-plugin/hooks/use-fields-confirmed.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/index.d.ts +23 -0
- package/dist/plugins/mcp-form-builder-plugin/index.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/types.d.ts +17 -0
- package/dist/plugins/mcp-form-builder-plugin/types.d.ts.map +1 -0
- package/dist/plugins/mcp-form-builder-plugin/utils/index.d.ts +51 -0
- package/dist/plugins/mcp-form-builder-plugin/utils/index.d.ts.map +1 -0
- package/dist/sdk.impl.d.ts +21 -0
- package/dist/sdk.impl.d.ts.map +1 -0
- package/dist/store/context.d.ts +12 -0
- package/dist/store/context.d.ts.map +1 -0
- package/dist/store/index.d.ts +13 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/stories/AbsFullscreenGradientBg.stories.d.ts +17 -0
- package/dist/stories/AbsFullscreenGradientBg.stories.d.ts.map +1 -0
- package/dist/stories/AttachmentsPreviewer.stories.d.ts +16 -0
- package/dist/stories/AttachmentsPreviewer.stories.d.ts.map +1 -0
- package/dist/stories/BorderColorAnimation.stories.d.ts +24 -0
- package/dist/stories/BorderColorAnimation.stories.d.ts.map +1 -0
- package/dist/stories/BotAvatarAndName.stories.d.ts +18 -0
- package/dist/stories/BotAvatarAndName.stories.d.ts.map +1 -0
- package/dist/stories/BotIcon.stories.d.ts +17 -0
- package/dist/stories/BotIcon.stories.d.ts.map +1 -0
- package/dist/stories/BsTooltip.stories.d.ts +7 -0
- package/dist/stories/BsTooltip.stories.d.ts.map +1 -0
- package/dist/stories/Card.stories.d.ts +14 -0
- package/dist/stories/Card.stories.d.ts.map +1 -0
- package/dist/stories/ChatAreaHeader.stories.d.ts +14 -0
- package/dist/stories/ChatAreaHeader.stories.d.ts.map +1 -0
- package/dist/stories/CollapsibleTextMsg.stories.d.ts +16 -0
- package/dist/stories/CollapsibleTextMsg.stories.d.ts.map +1 -0
- package/dist/stories/ConfirmDialog.stories.d.ts +61 -0
- package/dist/stories/ConfirmDialog.stories.d.ts.map +1 -0
- package/dist/stories/FormInfoEditor.stories.d.ts +15 -0
- package/dist/stories/FormInfoEditor.stories.d.ts.map +1 -0
- package/dist/stories/GenerateAnimation.stories.d.ts +16 -0
- package/dist/stories/GenerateAnimation.stories.d.ts.map +1 -0
- package/dist/stories/IconBtn.stories.d.ts +14 -0
- package/dist/stories/IconBtn.stories.d.ts.map +1 -0
- package/dist/stories/IconLib.d.ts +12 -0
- package/dist/stories/IconLib.d.ts.map +1 -0
- package/dist/stories/Icons.stories.d.ts +24 -0
- package/dist/stories/Icons.stories.d.ts.map +1 -0
- package/dist/stories/LineChecker.stories.d.ts +23 -0
- package/dist/stories/LineChecker.stories.d.ts.map +1 -0
- package/dist/stories/LinearGradientBorderBtn.stories.d.ts +22 -0
- package/dist/stories/LinearGradientBorderBtn.stories.d.ts.map +1 -0
- package/dist/stories/LinearGradientColorBgAnimation.stories.d.ts +23 -0
- package/dist/stories/LinearGradientColorBgAnimation.stories.d.ts.map +1 -0
- package/dist/stories/OptionItem.stories.d.ts +20 -0
- package/dist/stories/OptionItem.stories.d.ts.map +1 -0
- package/dist/stories/PreviewerHeader.stories.d.ts +9 -0
- package/dist/stories/PreviewerHeader.stories.d.ts.map +1 -0
- package/dist/stories/PrimaryConfirmBtn.stories.d.ts +16 -0
- package/dist/stories/PrimaryConfirmBtn.stories.d.ts.map +1 -0
- package/dist/stories/PrimaryEntryBtn.stories.d.ts +26 -0
- package/dist/stories/PrimaryEntryBtn.stories.d.ts.map +1 -0
- package/dist/stories/TabRadioGroup.stories.d.ts +18 -0
- package/dist/stories/TabRadioGroup.stories.d.ts.map +1 -0
- package/dist/stories/UserTextMsgBubble.stories.d.ts +14 -0
- package/dist/stories/UserTextMsgBubble.stories.d.ts.map +1 -0
- package/dist/stories/fields-generating.stories.d.ts +14 -0
- package/dist/stories/fields-generating.stories.d.ts.map +1 -0
- package/dist/stories/fields-previewer.stories.d.ts +18 -0
- package/dist/stories/fields-previewer.stories.d.ts.map +1 -0
- package/package.json +76 -0
- package/scripts/inline-style-inject.ts +36 -0
- package/src/chat.tsx +56 -0
- package/src/components/biz-comp/FakeBotMsg.tsx +52 -0
- package/src/components/biz-comp/FieldChecker.tsx +114 -0
- package/src/components/biz-comp/FieldCheckerListMsg.tsx +34 -0
- package/src/components/biz-comp/FieldValueChecker.tsx +98 -0
- package/src/components/biz-comp/SubformFieldsValueChecker.tsx +166 -0
- package/src/components/biz-comp/chat-client.tsx +206 -0
- package/src/components/biz-comp/chat-frame.tsx +25 -0
- package/src/components/biz-comp/conversation.tsx +70 -0
- package/src/components/biz-comp/dock-btn.tsx +52 -0
- package/src/components/biz-comp/field-icon.tsx +8 -0
- package/src/components/biz-comp/markdown-part.tsx +48 -0
- package/src/components/biz-comp/markdown.tsx +36 -0
- package/src/components/biz-comp/message-content.tsx +21 -0
- package/src/components/biz-comp/messages.tsx +42 -0
- package/src/components/biz-comp/multi-modal-input/attachment-btn.tsx +30 -0
- package/src/components/biz-comp/multi-modal-input/clear-btn.tsx +42 -0
- package/src/components/biz-comp/multi-modal-input/index.tsx +422 -0
- package/src/components/biz-comp/multi-modal-input/preview-attachment.tsx +72 -0
- package/src/components/biz-comp/multi-modal-input/prompt-input.tsx +260 -0
- package/src/components/biz-comp/opening-lines.tsx +34 -0
- package/src/components/biz-comp/preview-message-wrapper.tsx +55 -0
- package/src/components/biz-comp/preview-message.tsx +91 -0
- package/src/components/biz-comp/response.tsx +23 -0
- package/src/components/biz-comp/suggestions.tsx +78 -0
- package/src/components/bs-ui/abs-fullscreen-gradient-bg.tsx +34 -0
- package/src/components/bs-ui/attachments-previewer.tsx +229 -0
- package/src/components/bs-ui/border-color-animation.tsx +58 -0
- package/src/components/bs-ui/bot-avatar-name.tsx +25 -0
- package/src/components/bs-ui/bot-icon.tsx +23 -0
- package/src/components/bs-ui/bs-icons.tsx +801 -0
- package/src/components/bs-ui/card.tsx +37 -0
- package/src/components/bs-ui/chat-area-header.tsx +41 -0
- package/src/components/bs-ui/collapsible-txt-msg.tsx +50 -0
- package/src/components/bs-ui/confirm-dialog.tsx +128 -0
- package/src/components/bs-ui/fields-generating-indicator.tsx +50 -0
- package/src/components/bs-ui/fields-portal.tsx +18 -0
- package/src/components/bs-ui/fields-previewer.tsx +109 -0
- package/src/components/bs-ui/font-icon.tsx +17 -0
- package/src/components/bs-ui/form-info-editor.tsx +286 -0
- package/src/components/bs-ui/generate-animation.tsx +54 -0
- package/src/components/bs-ui/icon-btn.tsx +31 -0
- package/src/components/bs-ui/line-checker.tsx +129 -0
- package/src/components/bs-ui/linear-gradient-border-btn.tsx +48 -0
- package/src/components/bs-ui/linear-gradient-color-bg-animation.tsx +103 -0
- package/src/components/bs-ui/option-item.tsx +28 -0
- package/src/components/bs-ui/previewer-header.tsx +134 -0
- package/src/components/bs-ui/primary-confirm-btn.tsx +46 -0
- package/src/components/bs-ui/primary-entry-btn.tsx +37 -0
- package/src/components/bs-ui/tab-radio-group.tsx +73 -0
- package/src/components/bs-ui/tooltip.tsx +18 -0
- package/src/components/bs-ui/user-txt-msg-bubble.tsx +19 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/button.tsx +51 -0
- package/src/components/ui/card.tsx +76 -0
- package/src/components/ui/checkbox.tsx +29 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/dialog.tsx +104 -0
- package/src/components/ui/dropdown-menu.tsx +199 -0
- package/src/components/ui/icons.tsx +1288 -0
- package/src/components/ui/input-group.tsx +172 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/one-time-click-btn.tsx +32 -0
- package/src/components/ui/select.tsx +157 -0
- package/src/components/ui/spinner.tsx +17 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +22 -0
- package/src/components/ui/tooltip.tsx +34 -0
- package/src/components/web-comp/fields-previewer-web-component.ts +259 -0
- package/src/const/index.ts +61 -0
- package/src/const/ui.ts +7 -0
- package/src/global.d.ts +1 -0
- package/src/hooks/use-evt-bus.ts +11 -0
- package/src/hooks/use-evt.ts +17 -0
- package/src/hooks/use-frame-mode.ts +13 -0
- package/src/hooks/use-plugin-component.ts +12 -0
- package/src/hooks/use-plugin-ctx.ts +12 -0
- package/src/hooks/use-plugin-custom-components.ts +31 -0
- package/src/hooks/use-plugin-life-cycle-chain-runner.ts +26 -0
- package/src/hooks/use-plugin-list.ts +11 -0
- package/src/hooks/use-plugin.ts +11 -0
- package/src/hooks/use-shadow.ts +128 -0
- package/src/index.tsx +10 -0
- package/src/lib/event-emitter.ts +93 -0
- package/src/lib/utils.ts +222 -0
- package/src/plugins/form-builder-base-plugin/const.ts +27 -0
- package/src/plugins/form-builder-base-plugin/index.ts +45 -0
- package/src/plugins/form-builder-base-plugin/types.ts +13 -0
- package/src/plugins/form-filling-plugin/components/FormFillingOpeningLines.tsx +3 -0
- package/src/plugins/form-filling-plugin/components/avatar.tsx +14 -0
- package/src/plugins/form-filling-plugin/components/entry-btn.tsx +15 -0
- package/src/plugins/form-filling-plugin/components/msg-part.tsx +90 -0
- package/src/plugins/form-filling-plugin/const.ts +595 -0
- package/src/plugins/form-filling-plugin/index.ts +135 -0
- package/src/plugins/form-filling-plugin/types.ts +11 -0
- package/src/plugins/form-filling-plugin/utils.ts +63 -0
- package/src/plugins/general-model-form-builder-plugin/components/confirmer.tsx +90 -0
- package/src/plugins/general-model-form-builder-plugin/components/ghost-evt-dispatcher.tsx +69 -0
- package/src/plugins/general-model-form-builder-plugin/components/msg-part.tsx +147 -0
- package/src/plugins/general-model-form-builder-plugin/components/new-confirmer.tsx +191 -0
- package/src/plugins/general-model-form-builder-plugin/const.ts +3 -0
- package/src/plugins/general-model-form-builder-plugin/index.ts +20 -0
- package/src/plugins/general-model-form-builder-plugin/types.ts +1 -0
- package/src/plugins/mcp-form-builder-plugin/components/create-form-confirm.tsx +126 -0
- package/src/plugins/mcp-form-builder-plugin/components/entry-btn.tsx +9 -0
- package/src/plugins/mcp-form-builder-plugin/components/follow-up.tsx +15 -0
- package/src/plugins/mcp-form-builder-plugin/components/msg-part.tsx +135 -0
- package/src/plugins/mcp-form-builder-plugin/const/index.ts +13 -0
- package/src/plugins/mcp-form-builder-plugin/hooks/index.ts +0 -0
- package/src/plugins/mcp-form-builder-plugin/hooks/use-fields-confirmed.ts +12 -0
- package/src/plugins/mcp-form-builder-plugin/index.ts +225 -0
- package/src/plugins/mcp-form-builder-plugin/types.ts +21 -0
- package/src/plugins/mcp-form-builder-plugin/utils/index.ts +450 -0
- package/src/sdk.impl.tsx +108 -0
- package/src/store/context.tsx +22 -0
- package/src/store/index.ts +53 -0
- package/src/stories/AbsFullscreenGradientBg.stories.tsx +36 -0
- package/src/stories/AttachmentsPreviewer.stories.tsx +188 -0
- package/src/stories/BorderColorAnimation.stories.tsx +60 -0
- package/src/stories/BotAvatarAndName.stories.ts +24 -0
- package/src/stories/BotIcon.stories.ts +22 -0
- package/src/stories/BsTooltip.stories.tsx +32 -0
- package/src/stories/Card.stories.tsx +28 -0
- package/src/stories/ChatAreaHeader.stories.ts +26 -0
- package/src/stories/CollapsibleTextMsg.stories.ts +44 -0
- package/src/stories/ConfirmDialog.stories.tsx +123 -0
- package/src/stories/FormInfoEditor.stories.tsx +183 -0
- package/src/stories/GenerateAnimation.stories.ts +20 -0
- package/src/stories/IconBtn.stories.tsx +26 -0
- package/src/stories/IconLib.tsx +47 -0
- package/src/stories/Icons.stories.ts +22 -0
- package/src/stories/LineChecker.stories.tsx +134 -0
- package/src/stories/LinearGradientBorderBtn.stories.tsx +86 -0
- package/src/stories/LinearGradientColorBgAnimation.stories.tsx +60 -0
- package/src/stories/OptionItem.stories.tsx +77 -0
- package/src/stories/PreviewerHeader.stories.tsx +45 -0
- package/src/stories/PrimaryConfirmBtn.stories.ts +37 -0
- package/src/stories/PrimaryEntryBtn.stories.tsx +74 -0
- package/src/stories/TabRadioGroup.stories.tsx +84 -0
- package/src/stories/UserTextMsgBubble.stories.ts +24 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/demo.css +539 -0
- package/src/stories/assets/demo_index.html +7988 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/iconfont.css +1377 -0
- package/src/stories/assets/iconfont.eot +0 -0
- package/src/stories/assets/iconfont.json +2382 -0
- package/src/stories/assets/iconfont.svg +697 -0
- package/src/stories/assets/iconfont.ttf +0 -0
- package/src/stories/assets/iconfont.woff +0 -0
- package/src/stories/assets/iconfont.woff2 +0 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/fields-generating.stories.tsx +22 -0
- package/src/stories/fields-previewer.stories.tsx +67 -0
- package/src/style.css +172 -0
- package/stats.html +4949 -0
- package/tailwind.config.js +49 -0
- package/tsconfig.json +13 -0
- package/vite.config.ts +38 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { createRoot, Root } from 'react-dom/client';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { FieldsPreviewer, FieldsPreviewerProps } from '../bs-ui/fields-previewer';
|
|
4
|
+
|
|
5
|
+
// Declare the global SDK styles injected by vite
|
|
6
|
+
declare const __SDK_STYLES__: string;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A wrapper component that renders a slot element for light DOM children
|
|
10
|
+
*/
|
|
11
|
+
const SlotContainer = () => {
|
|
12
|
+
return createElement('slot');
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Web Component wrapper for FieldsPreviewer
|
|
17
|
+
* This allows using the FieldsPreviewer component in React 17 or non-React applications
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* ```html
|
|
21
|
+
* <fields-previewer
|
|
22
|
+
* title="Form Preview"
|
|
23
|
+
* tips="Preview your form here"
|
|
24
|
+
* z-index="1"
|
|
25
|
+
* >
|
|
26
|
+
* <div>Your content here</div>
|
|
27
|
+
* </fields-previewer>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Or via JavaScript:
|
|
31
|
+
* ```js
|
|
32
|
+
* const previewer = document.createElement('fields-previewer');
|
|
33
|
+
* previewer.setProps({
|
|
34
|
+
* title: 'Form Preview',
|
|
35
|
+
* onSave: () => console.log('save'),
|
|
36
|
+
* });
|
|
37
|
+
* previewer.innerHTML = '<div>Your content</div>';
|
|
38
|
+
* document.body.appendChild(previewer);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export class FieldsPreviewerWebComponent extends HTMLElement {
|
|
42
|
+
private root: Root | null = null;
|
|
43
|
+
private shadowContainer: HTMLDivElement | null = null;
|
|
44
|
+
private shadowWrapper: HTMLDivElement | null = null;
|
|
45
|
+
private _props: Partial<FieldsPreviewerProps> = {};
|
|
46
|
+
private _childrenOverride: React.ReactNode | null = null;
|
|
47
|
+
private _externalRootEl: HTMLElement | null = null;
|
|
48
|
+
|
|
49
|
+
// Observed attributes for reactive updates
|
|
50
|
+
static get observedAttributes() {
|
|
51
|
+
return [
|
|
52
|
+
'title',
|
|
53
|
+
'tips',
|
|
54
|
+
'fullscreen',
|
|
55
|
+
'streaming',
|
|
56
|
+
'empty',
|
|
57
|
+
'z-index',
|
|
58
|
+
'padding',
|
|
59
|
+
'right-space-width',
|
|
60
|
+
'active',
|
|
61
|
+
|
|
62
|
+
// fields counter
|
|
63
|
+
'fields-count',
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
constructor() {
|
|
68
|
+
super();
|
|
69
|
+
// Don't attach shadow here - we'll do it in connectedCallback based on rootEl
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
if (this._externalRootEl) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.setupShadowDOM();
|
|
78
|
+
this.render();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
disconnectedCallback() {
|
|
82
|
+
if (this.root) {
|
|
83
|
+
this.root.unmount();
|
|
84
|
+
this.root = null;
|
|
85
|
+
}
|
|
86
|
+
// Clean up external shadow wrapper if exists
|
|
87
|
+
if (this.shadowWrapper && this.shadowWrapper.parentNode) {
|
|
88
|
+
this.shadowWrapper.parentNode.removeChild(this.shadowWrapper);
|
|
89
|
+
this.shadowWrapper = null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Set the external root element where shadow DOM will be rendered
|
|
95
|
+
* Must be called before the element is connected to the DOM, or call refresh() after
|
|
96
|
+
*/
|
|
97
|
+
public setRootEl(el: HTMLElement) {
|
|
98
|
+
if (this._externalRootEl === el && !el) return;
|
|
99
|
+
|
|
100
|
+
this._externalRootEl = el;
|
|
101
|
+
// If already connected, re-setup
|
|
102
|
+
if (this.isConnected) {
|
|
103
|
+
this.cleanup();
|
|
104
|
+
this.setupShadowDOM();
|
|
105
|
+
this.render();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private cleanup() {
|
|
110
|
+
if (this.root) {
|
|
111
|
+
this.root.unmount();
|
|
112
|
+
this.root = null;
|
|
113
|
+
}
|
|
114
|
+
if (this.shadowWrapper && this.shadowWrapper.parentNode) {
|
|
115
|
+
this.shadowWrapper.parentNode.removeChild(this.shadowWrapper);
|
|
116
|
+
this.shadowWrapper = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null) {
|
|
121
|
+
if (oldValue !== newValue) {
|
|
122
|
+
this.updatePropsFromAttributes();
|
|
123
|
+
this.render();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public injectStyles(styles: string) {
|
|
128
|
+
const shadowRoot = this._externalRootEl ? this.shadowWrapper?.shadowRoot : this.shadowRoot;
|
|
129
|
+
|
|
130
|
+
if (!shadowRoot) return;
|
|
131
|
+
|
|
132
|
+
const styleSheet = new CSSStyleSheet();
|
|
133
|
+
styleSheet.replaceSync(styles);
|
|
134
|
+
|
|
135
|
+
// Apply the stylesheet to the shadow root
|
|
136
|
+
(shadowRoot as any).adoptedStyleSheets = [
|
|
137
|
+
...(shadowRoot as any).adoptedStyleSheets,
|
|
138
|
+
styleSheet,
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
console.log('injected styles into shadow root');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private setupShadowDOM() {
|
|
145
|
+
// const targetEl = this._externalRootEl || this;
|
|
146
|
+
|
|
147
|
+
// If using external root, create a wrapper div to attach shadow
|
|
148
|
+
if (this._externalRootEl) {
|
|
149
|
+
this.shadowWrapper = document.createElement('div');
|
|
150
|
+
this.shadowWrapper.style.width = '100%';
|
|
151
|
+
this.shadowWrapper.style.height = '100%';
|
|
152
|
+
this._externalRootEl.appendChild(this.shadowWrapper);
|
|
153
|
+
this.shadowWrapper.attachShadow({ mode: 'open' });
|
|
154
|
+
} else {
|
|
155
|
+
// Attach shadow to self
|
|
156
|
+
if (!this.shadowRoot) {
|
|
157
|
+
this.attachShadow({ mode: 'open' });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const shadowRoot = this._externalRootEl ? this.shadowWrapper!.shadowRoot : this.shadowRoot;
|
|
162
|
+
|
|
163
|
+
if (!shadowRoot) return;
|
|
164
|
+
|
|
165
|
+
console.log('found new shadow root:', this._externalRootEl);
|
|
166
|
+
|
|
167
|
+
// Inject styles
|
|
168
|
+
const styleEl = document.createElement('style');
|
|
169
|
+
styleEl.textContent = typeof __SDK_STYLES__ !== 'undefined' ? __SDK_STYLES__ : '';
|
|
170
|
+
shadowRoot.appendChild(styleEl);
|
|
171
|
+
|
|
172
|
+
// Create container for React
|
|
173
|
+
this.shadowContainer = document.createElement('div');
|
|
174
|
+
this.shadowContainer.style.width = '100%';
|
|
175
|
+
this.shadowContainer.style.height = '100%';
|
|
176
|
+
shadowRoot.appendChild(this.shadowContainer);
|
|
177
|
+
|
|
178
|
+
// Create React root
|
|
179
|
+
this.root = createRoot(this.shadowContainer);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private updatePropsFromAttributes() {
|
|
183
|
+
const booleanAttr = (name: string): boolean | undefined => {
|
|
184
|
+
const value = this.getAttribute(name);
|
|
185
|
+
if (value === null) return undefined;
|
|
186
|
+
return value === 'true' || value === '';
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const numberAttr = (name: string): number | undefined => {
|
|
190
|
+
const value = this.getAttribute(name);
|
|
191
|
+
if (value === null) return undefined;
|
|
192
|
+
const num = parseFloat(value);
|
|
193
|
+
return isNaN(num) ? undefined : num;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
this._props = {
|
|
197
|
+
...this._props,
|
|
198
|
+
title: this.getAttribute('title') ?? this._props.title,
|
|
199
|
+
tips: this.getAttribute('tips') ?? this._props.tips,
|
|
200
|
+
fullscreen: booleanAttr('fullscreen') ?? this._props.fullscreen,
|
|
201
|
+
streaming: booleanAttr('streaming') ?? this._props.streaming,
|
|
202
|
+
empty: booleanAttr('empty') ?? this._props.empty,
|
|
203
|
+
active: booleanAttr('active') ?? this._props.active,
|
|
204
|
+
zIndex: numberAttr('z-index') ?? this._props.zIndex,
|
|
205
|
+
padding: numberAttr('padding') ?? this._props.padding,
|
|
206
|
+
rightSpaceWidth: numberAttr('right-space-width') ?? this._props.rightSpaceWidth,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Set props programmatically (useful for passing callbacks and React children)
|
|
212
|
+
* If you pass `children` here, it will override the slot-based children
|
|
213
|
+
*/
|
|
214
|
+
public setProps(props: Partial<FieldsPreviewerProps>) {
|
|
215
|
+
// Extract children override if provided
|
|
216
|
+
if ('children' in props) {
|
|
217
|
+
this._childrenOverride = props.children;
|
|
218
|
+
const { children: _, ...restProps } = props;
|
|
219
|
+
this._props = { ...this._props, ...restProps };
|
|
220
|
+
} else {
|
|
221
|
+
this._props = { ...this._props, ...props };
|
|
222
|
+
}
|
|
223
|
+
this.render();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Get current props
|
|
228
|
+
*/
|
|
229
|
+
public getProps(): Partial<FieldsPreviewerProps> {
|
|
230
|
+
return { ...this._props };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private render() {
|
|
234
|
+
if (!this.root) return;
|
|
235
|
+
|
|
236
|
+
this.updatePropsFromAttributes();
|
|
237
|
+
|
|
238
|
+
// Use children override if set via setProps, otherwise use slot for light DOM children
|
|
239
|
+
const children = this._childrenOverride ?? createElement(SlotContainer);
|
|
240
|
+
|
|
241
|
+
const element = createElement(FieldsPreviewer, {
|
|
242
|
+
...this._props,
|
|
243
|
+
children,
|
|
244
|
+
} as FieldsPreviewerProps);
|
|
245
|
+
this.root.render(element);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Register the web component
|
|
250
|
+
export function registerFieldsPreviewerWebComponent(tagName = 'fields-previewer-container') {
|
|
251
|
+
if (!customElements.get(tagName)) {
|
|
252
|
+
customElements.define(tagName, FieldsPreviewerWebComponent);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Auto-register with default tag name
|
|
257
|
+
if (typeof window !== 'undefined') {
|
|
258
|
+
registerFieldsPreviewerWebComponent();
|
|
259
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { FieldType } from '@baishuyun/types';
|
|
2
|
+
|
|
3
|
+
export const FieldTypeNameMap: Record<FieldType, string> = {
|
|
4
|
+
text: '输入框',
|
|
5
|
+
password: '密码输入框',
|
|
6
|
+
location: '定位',
|
|
7
|
+
datetime: '日期时间选择器',
|
|
8
|
+
radiogroup: '单选框',
|
|
9
|
+
radio: '单选框',
|
|
10
|
+
combo: '下拉框',
|
|
11
|
+
address: '地址',
|
|
12
|
+
button: '按钮',
|
|
13
|
+
textarea: '多行输入框',
|
|
14
|
+
combocheck: '多选下拉框',
|
|
15
|
+
checkboxgroup: '多选框组',
|
|
16
|
+
separator: '分割线',
|
|
17
|
+
upload: '附件上传',
|
|
18
|
+
number: '数字输入框',
|
|
19
|
+
dataload: '数据加载',
|
|
20
|
+
image: '图片上传',
|
|
21
|
+
signature: '签名',
|
|
22
|
+
dept: '部门选择',
|
|
23
|
+
user: '成员选择',
|
|
24
|
+
usergroup: '成员多选',
|
|
25
|
+
deptgroup: '部门多选',
|
|
26
|
+
unknown: '未知类型',
|
|
27
|
+
sn: '流水号',
|
|
28
|
+
linkdata: '关联数据',
|
|
29
|
+
linkquery: '关联查询',
|
|
30
|
+
subform: '子表单',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const FIELD_ICON_CODE_MAP: Record<FieldType, string> = {
|
|
34
|
+
address: '',
|
|
35
|
+
subform: '',
|
|
36
|
+
password: '', // text
|
|
37
|
+
button: '',
|
|
38
|
+
textarea: '',
|
|
39
|
+
datetime: '',
|
|
40
|
+
text: '',
|
|
41
|
+
location: '',
|
|
42
|
+
radiogroup: '',
|
|
43
|
+
radio: '',
|
|
44
|
+
combo: '',
|
|
45
|
+
combocheck: '',
|
|
46
|
+
separator: '',
|
|
47
|
+
checkboxgroup: '',
|
|
48
|
+
upload: '',
|
|
49
|
+
number: '',
|
|
50
|
+
image: '',
|
|
51
|
+
signature: '',
|
|
52
|
+
user: '',
|
|
53
|
+
dataload: '', // field
|
|
54
|
+
linkdata: '',
|
|
55
|
+
linkquery: '',
|
|
56
|
+
usergroup: '',
|
|
57
|
+
dept: '',
|
|
58
|
+
sn: '',
|
|
59
|
+
deptgroup: '',
|
|
60
|
+
unknown: '',
|
|
61
|
+
};
|
package/src/const/ui.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const BotImgUrl = `
|
|
2
|
+
url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABMdSURBVHgB7VoJlF1Vld33vffnX79+TalKqpKQEQQiGhIUJYDKqIZBxVYQW9FWWQuWK7at3SBL2rZdirYRAV3gkrZbXS3EAUEMtEoEHJgbYiDzWEmlUuOv+vN/793b+9z3E7FAkkjbq9tVN3n577//hrvvOWfvc84LMD2mx/SYHtNjekyP6XFkQ3Fzzj///MQVV1wxq3kshr/gob770NNXjWpj+qvabJ5oDDePu/hLHOdceOHs0BizuWTCX48as2EsCB7oL/zyaO7h4P/RWPraMxfcuqWOsQYc7Wgg6Thtyj/+aO6h8OcZcl8jO5dccomb5PD9WOurXnVix0S5lHW0VhJ5TuiEqdZ8cf0TTxe2locLT95zT2XKPXDwPgfHt31TfmZXkFzW5ah4SmPR4NBnlszt/cep5/05hyUSOzNj1Gc+8/kl996/7tPb+wcfm2gEE2UerHOrcpsIo09fNsahH2rj+6EJxU85eEhPFP3hnbv3/2bNmvs//dFPfOrYKc+JXf31x97X8pXAfKzujz21ZdM/NX/7X/HUQ0C/9rXbzti3f+SRSmD0+qGieXS4ZD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AOJPqkdGOHcpIn6zQEtoy+dCTSBaM+i3/JkzIVriUbdcB6Ea9ZR/2p2BPrScaBZzz1Uyzr0PtztlT2W6LPdjqeQMENai+M4V2qsD3OAlq/IVMecAC3JTpAOJPqsdqB2WERLcex84d1AOgVolA0xDsui4RyedOQkepcwZ8M6N2mqUhzxF6HZQDoDaCoMnDGMWYkG1OZyJZ9ov0jPTVpb/7hJzW4+0vxvhZYJ2WpFt0/mFt5e8RN9vtvh/D+/uiOKrnQ60qD4ADTyLN3xGdCN6PrwiU5J9IjNN+nHjGii/tEFawbSKUCzzBQ20bAOY7mSS7S/Ntzw/LSFNBbgoIrR7UhmGhQfKrS4TzMOq3WHEp0gHUj0+SIttj/1DhDNyDSI7kgnMS0ky5sSDcWc1Q5F5RFYF4YSHWzgYaBTosf5IEKNTkVaLzCAFtcw0vwYkSMd338AsPwZPYZjSIIAAAAASUVORK5CYII=)`;
|
|
6
|
+
|
|
7
|
+
export const transCls = "transition-all duration-200 ease-out";
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const __SDK_STYLES__: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useEvtBus } from './use-evt-bus';
|
|
3
|
+
import { EventKey, FormBuilderEventMap } from '@baishuyun/types';
|
|
4
|
+
|
|
5
|
+
export const useEvt = (evtName: EventKey<FormBuilderEventMap>, handler: (data: any) => void) => {
|
|
6
|
+
const evtBus = useEvtBus();
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const handlerWrapper = (data: any) => handler(data);
|
|
10
|
+
|
|
11
|
+
evtBus.on(evtName, handlerWrapper);
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
evtBus.off(evtName, handlerWrapper);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomComponentType } from '@baishuyun/types';
|
|
2
|
+
import { usePluginCustomComponents } from './use-plugin-custom-components';
|
|
3
|
+
|
|
4
|
+
export const usePluginComponent = (compType: CustomComponentType) => {
|
|
5
|
+
const comInfos = usePluginCustomComponents<CustomComponentType>(compType);
|
|
6
|
+
if (!comInfos || !comInfos.length) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const targetComConfig = comInfos[0];
|
|
11
|
+
return targetComConfig.Component ?? null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChatAreaPlugin } from '@baishuyun/types';
|
|
2
|
+
import { usePlugin } from './use-plugin';
|
|
3
|
+
|
|
4
|
+
export const usePluginCtx = <T, P extends ChatAreaPlugin>(name: string) => {
|
|
5
|
+
const plugin = usePlugin<P>(name);
|
|
6
|
+
|
|
7
|
+
if (!plugin) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return plugin.Context as T;
|
|
12
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentConfig, PluginCustomComponent } from '@baishuyun/types';
|
|
2
|
+
import { usePluginList } from './use-plugin-list';
|
|
3
|
+
|
|
4
|
+
export const usePluginCustomComponents = <K extends keyof PluginCustomComponent>(
|
|
5
|
+
componentKey: K
|
|
6
|
+
): ComponentConfig<K>[] => {
|
|
7
|
+
const pluginList = usePluginList();
|
|
8
|
+
|
|
9
|
+
const pluginComponentsList = pluginList
|
|
10
|
+
.map((_plugin) => ({
|
|
11
|
+
pluginName: _plugin.pluginName,
|
|
12
|
+
Component: _plugin.customComponents?.[componentKey],
|
|
13
|
+
}))
|
|
14
|
+
.filter((componentConfig): componentConfig is ComponentConfig<K> =>
|
|
15
|
+
Boolean(componentConfig.Component)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return pluginComponentsList;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useDefaultPluginCustomComponent = <K extends keyof PluginCustomComponent>(
|
|
22
|
+
componentKey: K
|
|
23
|
+
): ComponentConfig<K> | null => {
|
|
24
|
+
const pluginComponents = usePluginCustomComponents(componentKey);
|
|
25
|
+
|
|
26
|
+
if (pluginComponents.length > 0) {
|
|
27
|
+
return pluginComponents[0] as ComponentConfig<K>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PluginLifecycleHooksType } from '@baishuyun/types';
|
|
2
|
+
import { usePluginList } from './use-plugin-list';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
export const usePluginLifeCycleChainRunner = (cycleType: PluginLifecycleHooksType) => {
|
|
6
|
+
const pluginList = usePluginList();
|
|
7
|
+
|
|
8
|
+
const chainExec = useCallback((ctx: any) => {
|
|
9
|
+
let resultCtx = ctx;
|
|
10
|
+
|
|
11
|
+
for (const plugin of pluginList) {
|
|
12
|
+
const hook = plugin.lifecycleHooks?.[cycleType];
|
|
13
|
+
if (!hook) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
resultCtx = hook(resultCtx);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return resultCtx;
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
exec: chainExec,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useChatStore } from "@/store/context";
|
|
2
|
+
|
|
3
|
+
export const usePlugin = <T>(pluginName: string) => {
|
|
4
|
+
const { pluginMap } = useChatStore((store) => {
|
|
5
|
+
return {
|
|
6
|
+
pluginMap: store.chatAreaPluginMap,
|
|
7
|
+
};
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
return pluginMap.get(pluginName) as T;
|
|
11
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseShadowOptions {
|
|
4
|
+
/** Shadow DOM挂载的根元素(默认挂到body) */
|
|
5
|
+
rootEl?: HTMLElement;
|
|
6
|
+
/** 要注入到Shadow DOM中的样式文本 */
|
|
7
|
+
style?: string;
|
|
8
|
+
/** Shadow内部容器的类名 */
|
|
9
|
+
containerClasses?: string[];
|
|
10
|
+
/** 包裹Shadow的外层元素类名 */
|
|
11
|
+
wrapperClasses?: string[];
|
|
12
|
+
/** 包裹元素的内联样式 */
|
|
13
|
+
wrapperStyle?: React.CSSProperties;
|
|
14
|
+
|
|
15
|
+
extraHtml?: string;
|
|
16
|
+
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 通用的创建Shadow DOM的Hook
|
|
22
|
+
* @param options 配置项:样式、根元素、类名等
|
|
23
|
+
* @returns Shadow DOM内部的容器元素(用于React Portal挂载)
|
|
24
|
+
*/
|
|
25
|
+
export const useShadow = ({
|
|
26
|
+
id,
|
|
27
|
+
style = '',
|
|
28
|
+
rootEl,
|
|
29
|
+
containerClasses = [],
|
|
30
|
+
wrapperClasses = [],
|
|
31
|
+
wrapperStyle = {},
|
|
32
|
+
extraHtml = '',
|
|
33
|
+
}: UseShadowOptions): { shadowContainer: HTMLElement | null; destroy: () => void } => {
|
|
34
|
+
const [shadowContainer, setShadowContainer] = useState<HTMLElement | null>(null);
|
|
35
|
+
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
wrapperRef.current?.classList.add(...wrapperClasses);
|
|
39
|
+
shadowContainer?.classList.add(...containerClasses);
|
|
40
|
+
}, [wrapperClasses, containerClasses]);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (wrapperRef.current) {
|
|
44
|
+
Object.entries(wrapperStyle).forEach(([key, value]) => {
|
|
45
|
+
if (value !== undefined) {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
wrapperRef.current!.style[key as any] = value;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, [wrapperStyle]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
// Cleanup previous shadow container if it exists
|
|
55
|
+
if (wrapperRef.current && wrapperRef.current.parentNode) {
|
|
56
|
+
wrapperRef.current.parentNode.removeChild(wrapperRef.current);
|
|
57
|
+
wrapperRef.current = null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
// 1. 创建外层包裹元素(挂载Shadow Root的载体)
|
|
62
|
+
const wrapperEl = document.createElement('div');
|
|
63
|
+
wrapperEl.classList.add(...wrapperClasses, 'wrapper');
|
|
64
|
+
// wrapperEl.style.height = '100%';
|
|
65
|
+
wrapperRef.current = wrapperEl;
|
|
66
|
+
|
|
67
|
+
// apply wrapper styles
|
|
68
|
+
Object.entries(wrapperStyle).forEach(([key, value]) => {
|
|
69
|
+
if (value !== undefined) {
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
wrapperEl.style[key as any] = value;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// 2. 创建并挂载Shadow Root
|
|
76
|
+
const shadowRoot = wrapperEl.attachShadow({ mode: 'open' });
|
|
77
|
+
|
|
78
|
+
// 注入额外的HTML内容
|
|
79
|
+
if (extraHtml) {
|
|
80
|
+
shadowRoot.innerHTML = extraHtml;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 3. 注入样式到Shadow DOM
|
|
84
|
+
if (style) {
|
|
85
|
+
const styleEl = document.createElement('style');
|
|
86
|
+
styleEl.textContent = style;
|
|
87
|
+
shadowRoot.appendChild(styleEl);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 4. 创建Shadow内部的容器(最终挂载React Portal的元素)
|
|
91
|
+
const containerEl = document.createElement('div');
|
|
92
|
+
containerEl.classList.add(...containerClasses, 'shadow-container');
|
|
93
|
+
shadowRoot.appendChild(containerEl);
|
|
94
|
+
|
|
95
|
+
// 5. 将外层元素挂载到指定根节点
|
|
96
|
+
const mountRoot = rootEl || document.body;
|
|
97
|
+
mountRoot.appendChild(wrapperEl);
|
|
98
|
+
console.log('shadow mounted to', mountRoot);
|
|
99
|
+
|
|
100
|
+
setShadowContainer(containerEl);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('创建Shadow DOM失败:', error);
|
|
103
|
+
setShadowContainer(null);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Cleanup on unmount or when rootEl changes
|
|
107
|
+
return () => {
|
|
108
|
+
if (wrapperRef.current && wrapperRef.current.parentNode) {
|
|
109
|
+
wrapperRef.current.parentNode.removeChild(wrapperRef.current);
|
|
110
|
+
wrapperRef.current = null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}, [rootEl]); // Recreate when rootEl changes
|
|
114
|
+
|
|
115
|
+
if (shadowContainer) {
|
|
116
|
+
shadowContainer.id = id;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
shadowContainer,
|
|
121
|
+
destroy: () => {
|
|
122
|
+
if (wrapperRef.current && wrapperRef.current.parentNode) {
|
|
123
|
+
wrapperRef.current.parentNode.removeChild(wrapperRef.current);
|
|
124
|
+
wrapperRef.current = null;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
};
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ChatSDK } from './sdk.impl';
|
|
2
|
+
|
|
3
|
+
export * from './plugins/mcp-form-builder-plugin';
|
|
4
|
+
export * from './plugins/general-model-form-builder-plugin';
|
|
5
|
+
export * from './plugins/form-filling-plugin';
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
FieldsPreviewerWebComponent,
|
|
9
|
+
registerFieldsPreviewerWebComponent,
|
|
10
|
+
} from './components/web-comp/fields-previewer-web-component';
|