@agentscope-ai/chat 1.1.4
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/README.md +88 -0
- package/dist/_util/hooks/use-proxy-imperative-handle.d.ts +4 -0
- package/dist/_util/hooks/use-proxy-imperative-handle.js +18 -0
- package/dist/_util/type.d.ts +1 -0
- package/dist/_util/type.js +1 -0
- package/dist/_util/warning.d.ts +30 -0
- package/dist/_util/warning.js +63 -0
- package/dist/accordion/Accordion.d.ts +22 -0
- package/dist/accordion/Accordion.js +93 -0
- package/dist/accordion/BodyContent.d.ts +8 -0
- package/dist/accordion/BodyContent.js +18 -0
- package/dist/accordion/DeepThink.d.ts +7 -0
- package/dist/accordion/DeepThink.js +35 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +1 -0
- package/dist/accordion/index.less +170 -0
- package/dist/attachments/DropArea.d.ts +8 -0
- package/dist/attachments/DropArea.js +87 -0
- package/dist/attachments/FileList/AudioIcon.d.ts +2 -0
- package/dist/attachments/FileList/AudioIcon.js +19 -0
- package/dist/attachments/FileList/FileListCard.d.ts +12 -0
- package/dist/attachments/FileList/FileListCard.js +229 -0
- package/dist/attachments/FileList/Progress.d.ts +6 -0
- package/dist/attachments/FileList/Progress.js +21 -0
- package/dist/attachments/FileList/VideoIcon.d.ts +2 -0
- package/dist/attachments/FileList/VideoIcon.js +19 -0
- package/dist/attachments/FileList/index.d.ts +16 -0
- package/dist/attachments/FileList/index.js +132 -0
- package/dist/attachments/PlaceholderUploader.d.ts +17 -0
- package/dist/attachments/PlaceholderUploader.js +79 -0
- package/dist/attachments/SilentUploader.d.ts +9 -0
- package/dist/attachments/SilentUploader.js +23 -0
- package/dist/attachments/context.d.ts +5 -0
- package/dist/attachments/context.js +2 -0
- package/dist/attachments/index.d.ts +33 -0
- package/dist/attachments/index.js +166 -0
- package/dist/attachments/style/fileCard.d.ts +4 -0
- package/dist/attachments/style/fileCard.js +124 -0
- package/dist/attachments/style/index.d.ts +10 -0
- package/dist/attachments/style/index.js +211 -0
- package/dist/attachments/util.d.ts +2 -0
- package/dist/attachments/util.js +53 -0
- package/dist/bubble/Avatar.d.ts +10 -0
- package/dist/bubble/Avatar.js +22 -0
- package/dist/bubble/Bubble.d.ts +11 -0
- package/dist/bubble/Bubble.js +102 -0
- package/dist/bubble/BubbleList.d.ts +15 -0
- package/dist/bubble/BubbleList.js +44 -0
- package/dist/bubble/Cards.d.ts +21 -0
- package/dist/bubble/Cards.js +47 -0
- package/dist/bubble/ScrollToBottom.d.ts +7 -0
- package/dist/bubble/ScrollToBottom.js +45 -0
- package/dist/bubble/Spin.d.ts +2 -0
- package/dist/bubble/Spin.js +18 -0
- package/dist/bubble/hooks/useDisplayData.d.ts +0 -0
- package/dist/bubble/hooks/useDisplayData.js +0 -0
- package/dist/bubble/hooks/useListData.d.ts +0 -0
- package/dist/bubble/hooks/useListData.js +0 -0
- package/dist/bubble/index.d.ts +8 -0
- package/dist/bubble/index.js +4 -0
- package/dist/bubble/interface.d.ts +26 -0
- package/dist/bubble/interface.js +1 -0
- package/dist/bubble/loading.d.ts +6 -0
- package/dist/bubble/loading.js +17 -0
- package/dist/bubble/style/avatar.less +40 -0
- package/dist/bubble/style/content.d.ts +4 -0
- package/dist/bubble/style/content.js +43 -0
- package/dist/bubble/style/index.d.ts +9 -0
- package/dist/bubble/style/index.js +53 -0
- package/dist/bubble/style/list.less +15 -0
- package/dist/bubble/style/scrollToBottom.less +174 -0
- package/dist/chat-anywhere/Chat/Ref.d.ts +3 -0
- package/dist/chat-anywhere/Chat/Ref.js +19 -0
- package/dist/chat-anywhere/Chat/index.d.ts +4 -0
- package/dist/chat-anywhere/Chat/index.js +65 -0
- package/dist/chat-anywhere/Chat/index.less +54 -0
- package/dist/chat-anywhere/Header/index.d.ts +3 -0
- package/dist/chat-anywhere/Header/index.js +32 -0
- package/dist/chat-anywhere/Header/index.less +24 -0
- package/dist/chat-anywhere/Input/index.d.ts +3 -0
- package/dist/chat-anywhere/Input/index.js +170 -0
- package/dist/chat-anywhere/Input/index.less +12 -0
- package/dist/chat-anywhere/Layout/index.d.ts +10 -0
- package/dist/chat-anywhere/Layout/index.js +73 -0
- package/dist/chat-anywhere/Layout/index.less +61 -0
- package/dist/chat-anywhere/SessionList/index.d.ts +5 -0
- package/dist/chat-anywhere/SessionList/index.js +115 -0
- package/dist/chat-anywhere/SessionList/index.less +52 -0
- package/dist/chat-anywhere/hooks/ChatAnywhereProvider.d.ts +43 -0
- package/dist/chat-anywhere/hooks/ChatAnywhereProvider.js +90 -0
- package/dist/chat-anywhere/hooks/types.d.ts +57 -0
- package/dist/chat-anywhere/hooks/types.js +1 -0
- package/dist/chat-anywhere/hooks/useInput.d.ts +7 -0
- package/dist/chat-anywhere/hooks/useInput.js +21 -0
- package/dist/chat-anywhere/hooks/useMessages.d.ts +11 -0
- package/dist/chat-anywhere/hooks/useMessages.js +56 -0
- package/dist/chat-anywhere/hooks/useSessionList.d.ts +24 -0
- package/dist/chat-anywhere/hooks/useSessionList.js +120 -0
- package/dist/chat-anywhere/index.d.ts +9 -0
- package/dist/chat-anywhere/index.js +58 -0
- package/dist/conversations/GroupTitle.d.ts +10 -0
- package/dist/conversations/GroupTitle.js +15 -0
- package/dist/conversations/Item.d.ts +14 -0
- package/dist/conversations/Item.js +96 -0
- package/dist/conversations/hooks/useGroupable.d.ts +9 -0
- package/dist/conversations/hooks/useGroupable.js +72 -0
- package/dist/conversations/index.d.ts +62 -0
- package/dist/conversations/index.js +124 -0
- package/dist/conversations/interface.d.ts +60 -0
- package/dist/conversations/interface.js +1 -0
- package/dist/conversations/style/index.d.ts +9 -0
- package/dist/conversations/style/index.js +80 -0
- package/dist/default-cards/Count/index.d.ts +3 -0
- package/dist/default-cards/Count/index.js +16 -0
- package/dist/default-cards/Count/index.less +19 -0
- package/dist/default-cards/DeepThink/index.d.ts +11 -0
- package/dist/default-cards/DeepThink/index.js +11 -0
- package/dist/default-cards/DeepThink/index.less +0 -0
- package/dist/default-cards/Files/index.d.ts +2 -0
- package/dist/default-cards/Files/index.js +18 -0
- package/dist/default-cards/Footer/index.d.ts +19 -0
- package/dist/default-cards/Footer/index.js +50 -0
- package/dist/default-cards/Footer/index.less +41 -0
- package/dist/default-cards/Images/index.d.ts +3 -0
- package/dist/default-cards/Images/index.js +33 -0
- package/dist/default-cards/Images/index.less +17 -0
- package/dist/default-cards/Interrupted/index.d.ts +11 -0
- package/dist/default-cards/Interrupted/index.js +40 -0
- package/dist/default-cards/Interrupted/index.less +57 -0
- package/dist/default-cards/Text/index.d.ts +2 -0
- package/dist/default-cards/Text/index.js +12 -0
- package/dist/default-cards/index.d.ts +6 -0
- package/dist/default-cards/index.js +6 -0
- package/dist/disclaimer/index.d.ts +11 -0
- package/dist/disclaimer/index.js +26 -0
- package/dist/docs/1896.async.js +457 -0
- package/dist/docs/2710.async.js +62 -0
- package/dist/docs/2863.async.js +400 -0
- package/dist/docs/3057.async.js +46 -0
- package/dist/docs/3364.async.js +25 -0
- package/dist/docs/404.html +15 -0
- package/dist/docs/4820.async.js +1381 -0
- package/dist/docs/5623.async.js +60 -0
- package/dist/docs/5757.async.js +1 -0
- package/dist/docs/5804.async.js +271 -0
- package/dist/docs/6198.async.js +18 -0
- package/dist/docs/6671.async.js +137 -0
- package/dist/docs/7195.async.js +1 -0
- package/dist/docs/7485.async.js +29 -0
- package/dist/docs/7931.async.js +19 -0
- package/dist/docs/7997.async.js +5 -0
- package/dist/docs/8156.async.js +110 -0
- package/dist/docs/8368.async.js +2 -0
- package/dist/docs/8480.async.js +1449 -0
- package/dist/docs/8618.async.js +246 -0
- package/dist/docs/9016.async.js +32 -0
- package/dist/docs/9016.chunk.css +1 -0
- package/dist/docs/9335.async.js +11 -0
- package/dist/docs/accordion__demos.async.js +9 -0
- package/dist/docs/attachments__demos.async.js +1 -0
- package/dist/docs/bubble__demos.async.js +50 -0
- package/dist/docs/components/accordion/index.html +15 -0
- package/dist/docs/components/accordion-cn/index.html +15 -0
- package/dist/docs/components/attachments/index.html +15 -0
- package/dist/docs/components/attachments-cn/index.html +15 -0
- package/dist/docs/components/bubble/index.html +15 -0
- package/dist/docs/components/bubble-cn/index.html +15 -0
- package/dist/docs/components/bubble-list/index.html +15 -0
- package/dist/docs/components/bubble-list-cn/index.html +15 -0
- package/dist/docs/components/conversations/index.html +15 -0
- package/dist/docs/components/conversations-cn/index.html +15 -0
- package/dist/docs/components/disclaimer/index.html +15 -0
- package/dist/docs/components/disclaimer-cn/index.html +15 -0
- package/dist/docs/components/footer/index.html +15 -0
- package/dist/docs/components/footer-cn/index.html +15 -0
- package/dist/docs/components/markdown/index.html +15 -0
- package/dist/docs/components/markdown-cn/index.html +15 -0
- package/dist/docs/components/sender/index.html +15 -0
- package/dist/docs/components/sender-cn/index.html +15 -0
- package/dist/docs/components/status/index.html +15 -0
- package/dist/docs/components/status-cn/index.html +15 -0
- package/dist/docs/components/welcome/index.html +15 -0
- package/dist/docs/components/welcome-cn/index.html +15 -0
- package/dist/docs/components__accordion__index.en-US.md.async.js +6 -0
- package/dist/docs/components__accordion__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__accordion__index.zh-CN.md.async.js +6 -0
- package/dist/docs/components__accordion__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__attachments__index.en-US.md.async.js +1 -0
- package/dist/docs/components__attachments__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__attachments__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__attachments__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__bubble-list__index.en-US.md.async.js +2 -0
- package/dist/docs/components__bubble-list__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__bubble-list__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__bubble-list__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__bubble__index.en-US.md.async.js +1 -0
- package/dist/docs/components__bubble__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__bubble__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__bubble__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__conversations__index.en-US.md.async.js +2 -0
- package/dist/docs/components__conversations__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__conversations__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__conversations__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__disclaimer__index.en-US.md.async.js +1 -0
- package/dist/docs/components__disclaimer__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__disclaimer__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__disclaimer__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__footer__index.en-US.md.async.js +1 -0
- package/dist/docs/components__footer__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__footer__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__footer__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__markdown__index.en-US.md.async.js +1 -0
- package/dist/docs/components__markdown__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__markdown__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__markdown__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__sender__index.en-US.md.async.js +1 -0
- package/dist/docs/components__sender__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__sender__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__sender__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__status__index.en-US.md.async.js +1 -0
- package/dist/docs/components__status__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__status__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__status__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__welcome__index.en-US.md.async.js +2 -0
- package/dist/docs/components__welcome__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__welcome__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__welcome__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/conversations__demos.async.js +1 -0
- package/dist/docs/demos.async.js +47 -0
- package/dist/docs/demos.chunk.css +1 -0
- package/dist/docs/disclaimer__demos.async.js +1 -0
- package/dist/docs/docs/development/ag-ui/index.html +15 -0
- package/dist/docs/docs/development/ag-ui-cn/index.html +15 -0
- package/dist/docs/docs/development/backend/index.html +15 -0
- package/dist/docs/docs/development/backend-cn/index.html +15 -0
- package/dist/docs/docs/development/cards/index.html +15 -0
- package/dist/docs/docs/development/cards-cn/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-api/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-api-cn/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-cn/index.html +15 -0
- package/dist/docs/docs/development/custom/index.html +15 -0
- package/dist/docs/docs/development/custom-cn/index.html +15 -0
- package/dist/docs/docs/development/overview/index.html +15 -0
- package/dist/docs/docs/development/overview-cn/index.html +15 -0
- package/dist/docs/docs/development/qwen/index.html +15 -0
- package/dist/docs/docs/development/qwen-cn/index.html +15 -0
- package/dist/docs/docs/templates/copilot/index.html +15 -0
- package/dist/docs/docs/templates/copilot-cn/index.html +15 -0
- package/dist/docs/docs/templates/native/index.html +15 -0
- package/dist/docs/docs/templates/native-cn/index.html +15 -0
- package/dist/docs/docs/templates/voice/index.html +15 -0
- package/dist/docs/docs/templates/voice-cn/index.html +15 -0
- package/dist/docs/docs__development__ag-ui.en-US.md.async.js +210 -0
- package/dist/docs/docs__development__ag-ui.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__ag-ui.zh-CN.md.async.js +210 -0
- package/dist/docs/docs__development__ag-ui.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__backend.en-US.md.async.js +12 -0
- package/dist/docs/docs__development__backend.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__backend.zh-CN.md.async.js +12 -0
- package/dist/docs/docs__development__backend.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__cards.en-US.md.async.js +27 -0
- package/dist/docs/docs__development__cards.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__cards.zh-CN.md.async.js +27 -0
- package/dist/docs/docs__development__cards.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere-api.en-US.md.async.js +69 -0
- package/dist/docs/docs__development__chatanywhere-api.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.async.js +69 -0
- package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere.en-US.md.async.js +77 -0
- package/dist/docs/docs__development__chatanywhere.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere.zh-CN.md.async.js +77 -0
- package/dist/docs/docs__development__chatanywhere.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__custom.en-US.md.async.js +22 -0
- package/dist/docs/docs__development__custom.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__custom.zh-CN.md.async.js +22 -0
- package/dist/docs/docs__development__custom.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__overview.en-US.md.async.js +21 -0
- package/dist/docs/docs__development__overview.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__overview.zh-CN.md.async.js +21 -0
- package/dist/docs/docs__development__overview.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__qwen.en-US.md.async.js +25 -0
- package/dist/docs/docs__development__qwen.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__qwen.zh-CN.md.async.js +25 -0
- package/dist/docs/docs__development__qwen.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__copilot.en-US.md.async.js +1 -0
- package/dist/docs/docs__templates__copilot.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__copilot.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__copilot.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__native.en-US.md.async.js +1 -0
- package/dist/docs/docs__templates__native.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__native.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__native.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__voice.en-US.md.async.js +20 -0
- package/dist/docs/docs__templates__voice.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__voice.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__voice.zh-CN.md.chunk.css +1 -0
- package/dist/docs/dumi__pages__index__index.en-US.async.js +1 -0
- package/dist/docs/dumi__pages__index__index.en-US.chunk.css +1 -0
- package/dist/docs/dumi__pages__index__index.zh-CN.async.js +1 -0
- package/dist/docs/dumi__pages__index__index.zh-CN.chunk.css +1 -0
- package/dist/docs/dumi__theme__layouts__DocLayout__index.async.js +1 -0
- package/dist/docs/dumi__theme__layouts__DocLayout__index.chunk.css +1 -0
- package/dist/docs/dumi__theme__layouts__GlobalLayout__index.async.js +18 -0
- package/dist/docs/dumi__theme__layouts__GlobalLayout__index.chunk.css +1 -0
- package/dist/docs/dumi__tmp-production__dumi__theme__ContextWrapper.async.js +1 -0
- package/dist/docs/index/index.html +15 -0
- package/dist/docs/index-cn/index.html +15 -0
- package/dist/docs/markdown__demos.async.js +164 -0
- package/dist/docs/meta__components__en-US.async.js +9 -0
- package/dist/docs/meta__components__zh-CN.async.js +10 -0
- package/dist/docs/meta__docs__en-US.async.js +475 -0
- package/dist/docs/meta__docs__en-US.chunk.css +1 -0
- package/dist/docs/meta__docs__zh-CN.async.js +456 -0
- package/dist/docs/meta__docs__zh-CN.chunk.css +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__404.async.js +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__Demo__index.async.js +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__Demo__index.chunk.css +1 -0
- package/dist/docs/preload_helper.js +1 -0
- package/dist/docs/sender__demos.async.js +1 -0
- package/dist/docs/umi.css +1 -0
- package/dist/docs/umi.js +107 -0
- package/dist/docs/welcome__demos.async.js +1 -0
- package/dist/docs/~demos/:id/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-inline/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-mutisteps/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-thinking/index.html +15 -0
- package/dist/docs/~demos/attachments-demo-files/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-basic/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-havestopped/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithfile/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithimage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithnormal/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withavatar/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withcode/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-witherror/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-witherrordetail/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withimage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withusage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withwaitingmessage/index.html +15 -0
- package/dist/docs/~demos/components-bubble-list-demo-basic/index.html +15 -0
- package/dist/docs/~demos/components-footer-demo-basic/index.html +15 -0
- package/dist/docs/~demos/components-footer-demo-withusage/index.html +15 -0
- package/dist/docs/~demos/components-status-demo-basic/index.html +15 -0
- package/dist/docs/~demos/conversations-demo-basic/index.html +15 -0
- package/dist/docs/~demos/disclaimer-demo-demo/index.html +15 -0
- package/dist/docs/~demos/disclaimer-demo-withlink/index.html +15 -0
- package/dist/docs/~demos/docs-development-ag-ui-demo-with-copilotkit/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-file/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-footer/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-image/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-text/index.html +15 -0
- package/dist/docs/~demos/docs-development-custom-demo-custom/index.html +15 -0
- package/dist/docs/~demos/docs-templates-copilot-demo-copilot/index.html +15 -0
- package/dist/docs/~demos/docs-templates-native-demo-basic/index.html +15 -0
- package/dist/docs/~demos/docs-templates-voice-demo-demo/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-citations/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-cursor/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-mathjax/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-md/index.html +15 -0
- package/dist/docs/~demos/sender-demo-basic/index.html +15 -0
- package/dist/docs/~demos/sender-demo-disabled/index.html +15 -0
- package/dist/docs/~demos/sender-demo-loading/index.html +15 -0
- package/dist/docs/~demos/sender-demo-moreprefixaction/index.html +15 -0
- package/dist/docs/~demos/sender-demo-withfile/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo0/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo1/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo2/index.html +15 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +20 -0
- package/dist/index.less +1 -0
- package/dist/markdown/Citation.d.ts +16 -0
- package/dist/markdown/Citation.js +55 -0
- package/dist/markdown/CodeBlock.d.ts +6 -0
- package/dist/markdown/CodeBlock.js +88 -0
- package/dist/markdown/ImageOrVideo.d.ts +2 -0
- package/dist/markdown/ImageOrVideo.js +81 -0
- package/dist/markdown/Link.d.ts +3 -0
- package/dist/markdown/Link.js +28 -0
- package/dist/markdown/Markdown.d.ts +4 -0
- package/dist/markdown/Markdown.js +121 -0
- package/dist/markdown/cursor/Blur.d.ts +3 -0
- package/dist/markdown/cursor/Blur.js +7 -0
- package/dist/markdown/cursor/Dot.d.ts +3 -0
- package/dist/markdown/cursor/Dot.js +16 -0
- package/dist/markdown/cursor/Underline.d.ts +3 -0
- package/dist/markdown/cursor/Underline.js +7 -0
- package/dist/markdown/cursor/index.less +124 -0
- package/dist/markdown/hooks/index.d.ts +1 -0
- package/dist/markdown/hooks/index.js +49 -0
- package/dist/markdown/hooks/useTypedEffect.d.ts +6 -0
- package/dist/markdown/hooks/useTypedEffect.js +56 -0
- package/dist/markdown/index.d.ts +16 -0
- package/dist/markdown/index.js +37 -0
- package/dist/markdown/index.less +204 -0
- package/dist/markdown/plugins/footnote.d.ts +2 -0
- package/dist/markdown/plugins/footnote.js +89 -0
- package/dist/markdown/plugins/katexDir.d.ts +1 -0
- package/dist/markdown/plugins/katexDir.js +15 -0
- package/dist/markdown/rehype/fadeIn.d.ts +2 -0
- package/dist/markdown/rehype/fadeIn.js +43 -0
- package/dist/markdown/type.d.ts +46 -0
- package/dist/markdown/type.js +1 -0
- package/dist/markdown/utils.d.ts +22 -0
- package/dist/markdown/utils.js +125 -0
- package/dist/provider/CustomCardsProvider.d.ts +15 -0
- package/dist/provider/CustomCardsProvider.js +18 -0
- package/dist/provider/GlobalProvider.d.ts +5 -0
- package/dist/provider/GlobalProvider.js +11 -0
- package/dist/provider/index.d.ts +8 -0
- package/dist/provider/index.js +20 -0
- package/dist/provider/types.d.ts +8 -0
- package/dist/provider/types.js +1 -0
- package/dist/sender/SenderHeader.d.ts +19 -0
- package/dist/sender/SenderHeader.js +79 -0
- package/dist/sender/StopLoading.d.ts +5 -0
- package/dist/sender/StopLoading.js +20 -0
- package/dist/sender/components/ActionButton.d.ts +22 -0
- package/dist/sender/components/ActionButton.js +39 -0
- package/dist/sender/components/ClearButton.d.ts +4 -0
- package/dist/sender/components/ClearButton.js +13 -0
- package/dist/sender/components/LoadingButton.d.ts +4 -0
- package/dist/sender/components/LoadingButton.js +22 -0
- package/dist/sender/components/SendButton.d.ts +4 -0
- package/dist/sender/components/SendButton.js +14 -0
- package/dist/sender/components/SpeechButton/RecordingIcon.d.ts +5 -0
- package/dist/sender/components/SpeechButton/RecordingIcon.js +49 -0
- package/dist/sender/components/SpeechButton/index.d.ts +4 -0
- package/dist/sender/components/SpeechButton/index.js +30 -0
- package/dist/sender/index.d.ts +61 -0
- package/dist/sender/index.js +307 -0
- package/dist/sender/style/header.d.ts +4 -0
- package/dist/sender/style/header.js +46 -0
- package/dist/sender/style/index.d.ts +10 -0
- package/dist/sender/style/index.js +123 -0
- package/dist/sender/useSpeech.d.ts +6 -0
- package/dist/sender/useSpeech.js +114 -0
- package/dist/stream/index.d.ts +34 -0
- package/dist/stream/index.en-US.md.bk +50 -0
- package/dist/stream/index.js +197 -0
- package/dist/stream/index.zh-CN.md.bk +51 -0
- package/dist/theme/components.d.ts +10 -0
- package/dist/theme/components.js +1 -0
- package/dist/theme/cssinjs-utils.d.ts +14 -0
- package/dist/theme/cssinjs-utils.js +1 -0
- package/dist/theme/genStyleUtils.d.ts +28 -0
- package/dist/theme/genStyleUtils.js +49 -0
- package/dist/theme/useToken.d.ts +18 -0
- package/dist/theme/useToken.js +110 -0
- package/dist/version/index.d.ts +2 -0
- package/dist/version/index.js +2 -0
- package/dist/voice-chat/Recorder/index.d.ts +26 -0
- package/dist/voice-chat/Recorder/index.js +168 -0
- package/dist/voice-chat/VoiceChatProvider/context.d.ts +22 -0
- package/dist/voice-chat/VoiceChatProvider/context.js +3 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.d.ts +1 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.js +5 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.d.ts +8 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.js +31 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.d.ts +5 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.js +48 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.d.ts +4 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.js +10 -0
- package/dist/voice-chat/VoiceChatProvider/index.d.ts +9 -0
- package/dist/voice-chat/VoiceChatProvider/index.js +55 -0
- package/dist/voice-chat/VoiceChatService/index.d.ts +34 -0
- package/dist/voice-chat/VoiceChatService/index.js +209 -0
- package/dist/voice-chat/index.d.ts +2 -0
- package/dist/voice-chat/index.js +2 -0
- package/dist/voice-chat/types/index.d.ts +12 -0
- package/dist/voice-chat/types/index.js +4 -0
- package/dist/welcome/icon.d.ts +2 -0
- package/dist/welcome/icon.js +38 -0
- package/dist/welcome/index.d.ts +9 -0
- package/dist/welcome/index.js +57 -0
- package/package.json +117 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
import { Flex, Typography, Upload } from 'antd';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { AttachmentContext } from "./context";
|
|
16
|
+
function Placeholder(props, ref) {
|
|
17
|
+
var prefixCls = props.prefixCls,
|
|
18
|
+
_props$placeholder = props.placeholder,
|
|
19
|
+
placeholder = _props$placeholder === void 0 ? {} : _props$placeholder,
|
|
20
|
+
upload = props.upload,
|
|
21
|
+
className = props.className,
|
|
22
|
+
style = props.style;
|
|
23
|
+
var placeholderCls = "".concat(prefixCls, "-placeholder");
|
|
24
|
+
var placeholderConfig = placeholder || {};
|
|
25
|
+
var _React$useContext = React.useContext(AttachmentContext),
|
|
26
|
+
disabled = _React$useContext.disabled;
|
|
27
|
+
|
|
28
|
+
// ============================= Drag =============================
|
|
29
|
+
var _React$useState = React.useState(false),
|
|
30
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
31
|
+
dragIn = _React$useState2[0],
|
|
32
|
+
setDragIn = _React$useState2[1];
|
|
33
|
+
var onDragEnter = function onDragEnter() {
|
|
34
|
+
setDragIn(true);
|
|
35
|
+
};
|
|
36
|
+
var onDragLeave = function onDragLeave(e) {
|
|
37
|
+
// Leave the div should end
|
|
38
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
39
|
+
setDragIn(false);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var onDrop = function onDrop() {
|
|
43
|
+
setDragIn(false);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// ============================ Render ============================
|
|
47
|
+
var node = /*#__PURE__*/React.isValidElement(placeholder) ? placeholder : /*#__PURE__*/React.createElement(Flex, {
|
|
48
|
+
align: "center",
|
|
49
|
+
justify: "center",
|
|
50
|
+
vertical: true,
|
|
51
|
+
className: "".concat(placeholderCls, "-inner")
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
53
|
+
className: "".concat(placeholderCls, "-icon")
|
|
54
|
+
}, placeholderConfig.icon), /*#__PURE__*/React.createElement(Typography.Title, {
|
|
55
|
+
className: "".concat(placeholderCls, "-title"),
|
|
56
|
+
level: 5
|
|
57
|
+
}, placeholderConfig.title), /*#__PURE__*/React.createElement(Typography.Text, {
|
|
58
|
+
className: "".concat(placeholderCls, "-description"),
|
|
59
|
+
type: "secondary"
|
|
60
|
+
}, placeholderConfig.description));
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: classNames(placeholderCls, _defineProperty(_defineProperty({}, "".concat(placeholderCls, "-drag-in"), dragIn), "".concat(placeholderCls, "-disabled"), disabled), className),
|
|
63
|
+
onDragEnter: onDragEnter,
|
|
64
|
+
onDragLeave: onDragLeave,
|
|
65
|
+
onDrop: onDrop,
|
|
66
|
+
"aria-hidden": disabled,
|
|
67
|
+
style: style
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Upload.Dragger, _extends({
|
|
69
|
+
showUploadList: false
|
|
70
|
+
}, upload, {
|
|
71
|
+
ref: ref,
|
|
72
|
+
style: {
|
|
73
|
+
padding: 0,
|
|
74
|
+
border: 0,
|
|
75
|
+
background: 'transparent'
|
|
76
|
+
}
|
|
77
|
+
}), node));
|
|
78
|
+
}
|
|
79
|
+
export default /*#__PURE__*/React.forwardRef(Placeholder);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type UploadProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface SilentUploaderProps {
|
|
4
|
+
children: React.ReactElement;
|
|
5
|
+
upload: UploadProps;
|
|
6
|
+
rootClassName?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<SilentUploaderProps & React.RefAttributes<import("antd/es/upload/Upload").UploadRef<any>>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { Upload } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* SilentUploader is only wrap children with antd Upload component.
|
|
6
|
+
*/
|
|
7
|
+
function SilentUploader(props, ref) {
|
|
8
|
+
var children = props.children,
|
|
9
|
+
upload = props.upload,
|
|
10
|
+
rootClassName = props.rootClassName;
|
|
11
|
+
var uploadRef = React.useRef(null);
|
|
12
|
+
React.useImperativeHandle(ref, function () {
|
|
13
|
+
return uploadRef.current;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// ============================ Render ============================
|
|
17
|
+
return /*#__PURE__*/React.createElement(Upload, _extends({}, upload, {
|
|
18
|
+
showUploadList: false,
|
|
19
|
+
rootClassName: rootClassName,
|
|
20
|
+
ref: uploadRef
|
|
21
|
+
}), children);
|
|
22
|
+
}
|
|
23
|
+
export default /*#__PURE__*/React.forwardRef(SilentUploader);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type GetProp, type UploadProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type FileListProps } from './FileList';
|
|
4
|
+
import FileListCard from './FileList/FileListCard';
|
|
5
|
+
import { type PlaceholderType } from './PlaceholderUploader';
|
|
6
|
+
export type SemanticType = 'list' | 'item' | 'placeholder';
|
|
7
|
+
export type Attachment = GetProp<UploadProps, 'fileList'>[number] & {
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export interface AttachmentsProps extends Omit<UploadProps, 'fileList'> {
|
|
11
|
+
prefixCls?: string;
|
|
12
|
+
rootClassName?: string;
|
|
13
|
+
rootStyle?: React.CSSProperties;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
className?: string;
|
|
16
|
+
classNames?: Partial<Record<SemanticType, string>>;
|
|
17
|
+
styles?: Partial<Record<SemanticType, React.CSSProperties>>;
|
|
18
|
+
children?: React.ReactElement;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
placeholder?: PlaceholderType | ((type: 'inline' | 'drop') => PlaceholderType);
|
|
21
|
+
getDropContainer?: null | (() => HTMLElement | null | undefined);
|
|
22
|
+
items?: Attachment[];
|
|
23
|
+
overflow?: FileListProps['overflow'];
|
|
24
|
+
renderType?: 'default';
|
|
25
|
+
}
|
|
26
|
+
export interface AttachmentsRef {
|
|
27
|
+
nativeElement: HTMLDivElement | null;
|
|
28
|
+
upload: (file: File) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const ForwardAttachments: React.ForwardRefExoticComponent<AttachmentsProps & React.RefAttributes<AttachmentsRef>> & {
|
|
31
|
+
FileCard: typeof FileListCard;
|
|
32
|
+
};
|
|
33
|
+
export default ForwardAttachments;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["prefixCls", "rootClassName", "rootStyle", "className", "style", "items", "children", "getDropContainer", "placeholder", "onChange", "overflow", "disabled", "classNames", "styles"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
import classnames from 'classnames';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { useProviderContext } from "./..";
|
|
19
|
+
import { useEvent, useMergedState } from 'rc-util';
|
|
20
|
+
import DropArea from "./DropArea";
|
|
21
|
+
import FileList from "./FileList";
|
|
22
|
+
import FileListCard from "./FileList/FileListCard";
|
|
23
|
+
import PlaceholderUploader from "./PlaceholderUploader";
|
|
24
|
+
import SilentUploader from "./SilentUploader";
|
|
25
|
+
import { AttachmentContext } from "./context";
|
|
26
|
+
import useStyle from "./style";
|
|
27
|
+
function Attachments(props, ref) {
|
|
28
|
+
var customizePrefixCls = props.prefixCls,
|
|
29
|
+
rootClassName = props.rootClassName,
|
|
30
|
+
rootStyle = props.rootStyle,
|
|
31
|
+
className = props.className,
|
|
32
|
+
style = props.style,
|
|
33
|
+
items = props.items,
|
|
34
|
+
children = props.children,
|
|
35
|
+
getDropContainer = props.getDropContainer,
|
|
36
|
+
placeholder = props.placeholder,
|
|
37
|
+
onChange = props.onChange,
|
|
38
|
+
overflow = props.overflow,
|
|
39
|
+
disabled = props.disabled,
|
|
40
|
+
_props$classNames = props.classNames,
|
|
41
|
+
classNames = _props$classNames === void 0 ? {} : _props$classNames,
|
|
42
|
+
_props$styles = props.styles,
|
|
43
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
44
|
+
uploadProps = _objectWithoutProperties(props, _excluded);
|
|
45
|
+
// ============================ PrefixCls ============================
|
|
46
|
+
var _useProviderContext = useProviderContext(),
|
|
47
|
+
getPrefixCls = _useProviderContext.getPrefixCls,
|
|
48
|
+
direction = _useProviderContext.direction;
|
|
49
|
+
var prefixCls = getPrefixCls('attachment', customizePrefixCls);
|
|
50
|
+
var containerRef = React.useRef(null);
|
|
51
|
+
var uploadRef = React.useRef(null);
|
|
52
|
+
React.useImperativeHandle(ref, function () {
|
|
53
|
+
return {
|
|
54
|
+
nativeElement: containerRef.current,
|
|
55
|
+
upload: function upload(file) {
|
|
56
|
+
var _uploadRef$current;
|
|
57
|
+
var fileInput = (_uploadRef$current = uploadRef.current) === null || _uploadRef$current === void 0 || (_uploadRef$current = _uploadRef$current.nativeElement) === null || _uploadRef$current === void 0 ? void 0 : _uploadRef$current.querySelector('input[type="file"]');
|
|
58
|
+
|
|
59
|
+
// Trigger native change event
|
|
60
|
+
if (fileInput) {
|
|
61
|
+
var dataTransfer = new DataTransfer();
|
|
62
|
+
dataTransfer.items.add(file);
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
fileInput.files = dataTransfer.files;
|
|
65
|
+
fileInput.dispatchEvent(new Event('change', {
|
|
66
|
+
bubbles: true
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// ============================ Style ============================
|
|
74
|
+
var _useStyle = useStyle(prefixCls),
|
|
75
|
+
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
76
|
+
wrapCSSVar = _useStyle2[0],
|
|
77
|
+
hashId = _useStyle2[1],
|
|
78
|
+
cssVarCls = _useStyle2[2];
|
|
79
|
+
var cssinjsCls = classnames(hashId, cssVarCls);
|
|
80
|
+
|
|
81
|
+
// ============================ Upload ============================
|
|
82
|
+
var _useMergedState = useMergedState([], {
|
|
83
|
+
value: items
|
|
84
|
+
}),
|
|
85
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
86
|
+
fileList = _useMergedState2[0],
|
|
87
|
+
setFileList = _useMergedState2[1];
|
|
88
|
+
var triggerChange = useEvent(function (info) {
|
|
89
|
+
setFileList(info.fileList);
|
|
90
|
+
onChange === null || onChange === void 0 || onChange(info);
|
|
91
|
+
});
|
|
92
|
+
var mergedUploadProps = _objectSpread(_objectSpread({}, uploadProps), {}, {
|
|
93
|
+
fileList: fileList,
|
|
94
|
+
onChange: triggerChange
|
|
95
|
+
});
|
|
96
|
+
var onItemRemove = function onItemRemove(item) {
|
|
97
|
+
var newFileList = fileList.filter(function (fileItem) {
|
|
98
|
+
return fileItem.uid !== item.uid;
|
|
99
|
+
});
|
|
100
|
+
triggerChange({
|
|
101
|
+
file: item,
|
|
102
|
+
fileList: newFileList
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// ============================ Render ============================
|
|
107
|
+
var renderChildren;
|
|
108
|
+
var getPlaceholderNode = function getPlaceholderNode(type, props, ref) {
|
|
109
|
+
var placeholderContent = typeof placeholder === 'function' ? placeholder(type) : placeholder;
|
|
110
|
+
return /*#__PURE__*/React.createElement(PlaceholderUploader, {
|
|
111
|
+
placeholder: placeholderContent,
|
|
112
|
+
upload: mergedUploadProps,
|
|
113
|
+
prefixCls: prefixCls,
|
|
114
|
+
className: classnames(classNames.placeholder),
|
|
115
|
+
style: _objectSpread(_objectSpread({}, styles.placeholder), props === null || props === void 0 ? void 0 : props.style),
|
|
116
|
+
ref: ref
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
if (children) {
|
|
120
|
+
renderChildren = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SilentUploader, {
|
|
121
|
+
upload: mergedUploadProps,
|
|
122
|
+
rootClassName: rootClassName,
|
|
123
|
+
ref: uploadRef
|
|
124
|
+
}, children), /*#__PURE__*/React.createElement(DropArea, {
|
|
125
|
+
getDropContainer: getDropContainer,
|
|
126
|
+
prefixCls: prefixCls,
|
|
127
|
+
className: classnames(cssinjsCls, rootClassName)
|
|
128
|
+
}, getPlaceholderNode('drop')));
|
|
129
|
+
} else {
|
|
130
|
+
var hasFileList = fileList.length > 0;
|
|
131
|
+
renderChildren = /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
className: classnames(prefixCls, cssinjsCls, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className, rootClassName),
|
|
133
|
+
style: _objectSpread(_objectSpread({}, rootStyle), style),
|
|
134
|
+
dir: direction || 'ltr',
|
|
135
|
+
ref: containerRef
|
|
136
|
+
}, /*#__PURE__*/React.createElement(FileList, {
|
|
137
|
+
prefixCls: prefixCls,
|
|
138
|
+
items: fileList,
|
|
139
|
+
onRemove: onItemRemove,
|
|
140
|
+
overflow: overflow,
|
|
141
|
+
upload: mergedUploadProps,
|
|
142
|
+
listClassName: classnames(classNames.list),
|
|
143
|
+
listStyle: _objectSpread(_objectSpread({}, styles.list), !hasFileList && {
|
|
144
|
+
display: 'none'
|
|
145
|
+
}),
|
|
146
|
+
itemClassName: classnames(classNames.item),
|
|
147
|
+
itemStyle: _objectSpread({}, styles.item),
|
|
148
|
+
renderType: props.renderType
|
|
149
|
+
}), getPlaceholderNode('inline', hasFileList ? {
|
|
150
|
+
style: {
|
|
151
|
+
display: 'none'
|
|
152
|
+
}
|
|
153
|
+
} : {}, uploadRef));
|
|
154
|
+
}
|
|
155
|
+
return wrapCSSVar( /*#__PURE__*/React.createElement(AttachmentContext.Provider, {
|
|
156
|
+
value: {
|
|
157
|
+
disabled: disabled
|
|
158
|
+
}
|
|
159
|
+
}, renderChildren));
|
|
160
|
+
}
|
|
161
|
+
var ForwardAttachments = /*#__PURE__*/React.forwardRef(Attachments);
|
|
162
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
163
|
+
ForwardAttachments.displayName = 'Attachments';
|
|
164
|
+
}
|
|
165
|
+
ForwardAttachments.FileCard = FileListCard;
|
|
166
|
+
export default ForwardAttachments;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
var genFileCardStyle = function genFileCardStyle(token) {
|
|
6
|
+
var componentCls = token.componentCls,
|
|
7
|
+
calc = token.calc;
|
|
8
|
+
var cardCls = "".concat(componentCls, "-list-card");
|
|
9
|
+
return _defineProperty(_defineProperty({}, cardCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
10
|
+
borderRadius: 8,
|
|
11
|
+
position: 'relative',
|
|
12
|
+
background: token.colorBgContainer,
|
|
13
|
+
borderWidth: token.lineWidth,
|
|
14
|
+
borderStyle: 'solid',
|
|
15
|
+
borderColor: token.colorBorderSecondary,
|
|
16
|
+
flex: 'none'
|
|
17
|
+
}, "".concat(cardCls, "-name,").concat(cardCls, "-desc"), {
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
textOverflow: 'ellipsis',
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
maxWidth: '100%'
|
|
22
|
+
}), "".concat(cardCls, "-ellipsis-prefix"), {
|
|
23
|
+
flex: '0 1 auto',
|
|
24
|
+
minWidth: 0,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
textOverflow: 'ellipsis',
|
|
27
|
+
whiteSpace: 'nowrap'
|
|
28
|
+
}), "".concat(cardCls, "-ellipsis-suffix"), {
|
|
29
|
+
flex: 'none'
|
|
30
|
+
}), '&-type-overview', _defineProperty(_defineProperty(_defineProperty({
|
|
31
|
+
padding: '0 8px',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
height: 56,
|
|
34
|
+
gap: token.paddingXS,
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
width: 140
|
|
37
|
+
}, "".concat(cardCls, "-icon"), {
|
|
38
|
+
fontSize: calc(token.fontSizeLG).mul(2).equal(),
|
|
39
|
+
lineHeight: 1,
|
|
40
|
+
flex: 'none'
|
|
41
|
+
}), "".concat(cardCls, "-content"), {
|
|
42
|
+
flex: 'auto',
|
|
43
|
+
minWidth: 0,
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
alignItems: 'stretch',
|
|
47
|
+
fontSize: token.fontSize,
|
|
48
|
+
color: token.colorText
|
|
49
|
+
}), "".concat(cardCls, "-desc"), {
|
|
50
|
+
marginTop: token.marginXXS,
|
|
51
|
+
color: token.colorTextQuaternary,
|
|
52
|
+
fontSize: token.fontSizeSM
|
|
53
|
+
})), '&-type-preview', _defineProperty(_defineProperty(_defineProperty({
|
|
54
|
+
width: 56,
|
|
55
|
+
height: 56,
|
|
56
|
+
lineHeight: 1,
|
|
57
|
+
// Img
|
|
58
|
+
img: {
|
|
59
|
+
width: '100%',
|
|
60
|
+
height: '100%',
|
|
61
|
+
verticalAlign: 'top',
|
|
62
|
+
objectFit: 'cover',
|
|
63
|
+
borderRadius: 'inherit'
|
|
64
|
+
}
|
|
65
|
+
}, "".concat(cardCls, "-img-mask"), {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
inset: 0,
|
|
68
|
+
display: 'flex',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
background: "rgba(0, 0, 0, ".concat(token.opacityLoading, ")"),
|
|
72
|
+
borderRadius: 'inherit'
|
|
73
|
+
}), "&".concat(cardCls, "-status-error"), _defineProperty(_defineProperty({}, "img, ".concat(cardCls, "-img-mask"), {
|
|
74
|
+
borderRadius: calc(token.borderRadius).sub(token.lineWidth).equal()
|
|
75
|
+
}), "".concat(cardCls, "-desc"), {
|
|
76
|
+
paddingInline: token.paddingXXS
|
|
77
|
+
})), "".concat(cardCls, "-progress"), {})), "".concat(cardCls, "-remove"), {
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
top: 0,
|
|
80
|
+
insetInlineEnd: 0,
|
|
81
|
+
border: 0,
|
|
82
|
+
padding: token.paddingXXS,
|
|
83
|
+
lineHeight: 1,
|
|
84
|
+
transform: 'scale(.75) translate(50%, -50%)',
|
|
85
|
+
fontSize: 12,
|
|
86
|
+
cursor: 'pointer',
|
|
87
|
+
display: 'none',
|
|
88
|
+
color: token.colorText,
|
|
89
|
+
backgroundColor: token.colorBgContainer,
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
borderStyle: 'solid',
|
|
92
|
+
borderColor: token.colorBorder,
|
|
93
|
+
borderRadius: '50%',
|
|
94
|
+
'&:dir(rtl)': {
|
|
95
|
+
transform: 'translate(-50%, -50%)'
|
|
96
|
+
}
|
|
97
|
+
}), "&:hover ".concat(cardCls, "-remove"), {
|
|
98
|
+
display: 'block'
|
|
99
|
+
}), '&-status-error', _defineProperty({
|
|
100
|
+
borderColor: token.colorError
|
|
101
|
+
}, "".concat(cardCls, "-desc"), {
|
|
102
|
+
color: token.colorError
|
|
103
|
+
})), '&-motion', {
|
|
104
|
+
transition: ['opacity', 'width', 'margin', 'padding'].map(function (prop) {
|
|
105
|
+
return "".concat(prop, " ").concat(token.motionDurationSlow);
|
|
106
|
+
}).join(','),
|
|
107
|
+
'&-appear-start': {
|
|
108
|
+
width: 0,
|
|
109
|
+
transition: 'none'
|
|
110
|
+
},
|
|
111
|
+
'&-leave-active': {
|
|
112
|
+
opacity: 0,
|
|
113
|
+
width: 0,
|
|
114
|
+
paddingInline: 0,
|
|
115
|
+
borderInlineWidth: 0,
|
|
116
|
+
marginInlineEnd: calc(token.paddingSM).mul(-1).equal()
|
|
117
|
+
}
|
|
118
|
+
})), "".concat(cardCls, "-hoverable"), {
|
|
119
|
+
'&:hover': {
|
|
120
|
+
borderColor: token.colorPrimary
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export default genFileCardStyle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GetDefaultToken } from '../../theme/cssinjs-utils';
|
|
3
|
+
export interface ComponentToken {
|
|
4
|
+
colorBgPlaceholderHover: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AttachmentsToken extends FullToken<'Attachments'> {
|
|
7
|
+
}
|
|
8
|
+
export declare const prepareComponentToken: GetDefaultToken<'Attachments'>;
|
|
9
|
+
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
10
|
+
export default _default;
|