@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,124 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.markdown-cursor-blur {
|
|
4
|
+
width: 3em;
|
|
5
|
+
position: absolute;
|
|
6
|
+
margin-left: -3em;
|
|
7
|
+
backdrop-filter: blur(1.5px);
|
|
8
|
+
|
|
9
|
+
&::after {
|
|
10
|
+
content: '_';
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
.markdown-cursor-dot {
|
|
17
|
+
position: absolute;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding-left: 2px;
|
|
21
|
+
gap: 4px;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
&-dot1 {
|
|
25
|
+
width: 5px;
|
|
26
|
+
height: 5px;
|
|
27
|
+
border-radius: 999px;
|
|
28
|
+
background-color: e('var(--@{ant-prefix}-color-text)');
|
|
29
|
+
animation: markdown-cursor-dot1 2s infinite ease;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
&-dot2 {
|
|
34
|
+
width: 4px;
|
|
35
|
+
height: 4px;
|
|
36
|
+
border-radius: 999px;
|
|
37
|
+
opacity: 0.5;
|
|
38
|
+
background-color: e('var(--@{ant-prefix}-color-text)');
|
|
39
|
+
animation: markdown-cursor-dot2 2s infinite ease;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
.markdown-cursor-underline {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
padding: 0 2px;
|
|
48
|
+
animation: markdown-cursor-underline .8s infinite;
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
content: '_';
|
|
52
|
+
color: e('var(--@{ant-prefix}-color-primary)'),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@keyframes markdown-cursor-underline {
|
|
58
|
+
0% {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
100% {
|
|
63
|
+
opacity: 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@keyframes markdown-cursor-dot1 {
|
|
71
|
+
0% {
|
|
72
|
+
transform: translateX(0px)scale(1);
|
|
73
|
+
z-index: 1;
|
|
74
|
+
opacity: 1;
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
40% {
|
|
79
|
+
transform: translateX(8.5px)scale(0.8);
|
|
80
|
+
z-index: 3;
|
|
81
|
+
opacity: 0.5;
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
50% {
|
|
86
|
+
transform: translateX(8.5px) scale(0.8);
|
|
87
|
+
z-index: 1;
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
90% {
|
|
92
|
+
transform: translateX(0px) scale(1);
|
|
93
|
+
z-index: 1;
|
|
94
|
+
opacity: 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes markdown-cursor-dot2 {
|
|
99
|
+
0% {
|
|
100
|
+
transform: translateX(0px)scale(1);
|
|
101
|
+
z-index: 1;
|
|
102
|
+
opacity: 0.5;
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
40% {
|
|
107
|
+
transform: translateX(-8.5px)scale(1.25);
|
|
108
|
+
z-index: 3;
|
|
109
|
+
opacity: 1;
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
50% {
|
|
114
|
+
transform: translateX(-8.5px) scale(1.25);
|
|
115
|
+
z-index: 1;
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
90% {
|
|
120
|
+
transform: translateX(0px) scale(1);
|
|
121
|
+
z-index: 1;
|
|
122
|
+
opacity: 0.5;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useAppendCursor(ref: any, cursor: any, content: any): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLayoutEffect, useMemo } from 'react';
|
|
3
|
+
import { useProviderContext } from "../..";
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import Underline from "../cursor/Underline";
|
|
6
|
+
import Dot from "../cursor/Dot";
|
|
7
|
+
import { createRoot } from 'react-dom/client';
|
|
8
|
+
function findDeepNode(childNodes) {
|
|
9
|
+
var _childNodes, _lastNode$childNodes;
|
|
10
|
+
var lastNode = childNodes === null || childNodes === void 0 ? void 0 : childNodes[childNodes.length - (
|
|
11
|
+
// 末尾最后的一个空text节点不当做节点
|
|
12
|
+
((_childNodes = childNodes[childNodes.length - 1]) === null || _childNodes === void 0 ? void 0 : _childNodes.nodeValue) === '\n' ? 2 : 1)];
|
|
13
|
+
if (lastNode !== null && lastNode !== void 0 && (_lastNode$childNodes = lastNode.childNodes) !== null && _lastNode$childNodes !== void 0 && _lastNode$childNodes.length) return findDeepNode(lastNode.childNodes);
|
|
14
|
+
return lastNode;
|
|
15
|
+
}
|
|
16
|
+
export function useAppendCursor(ref, cursor, content) {
|
|
17
|
+
var _useProviderContext = useProviderContext(),
|
|
18
|
+
getPrefixCls = _useProviderContext.getPrefixCls;
|
|
19
|
+
var Cursor = useMemo(function () {
|
|
20
|
+
return {
|
|
21
|
+
'underline': Underline,
|
|
22
|
+
'dot': Dot
|
|
23
|
+
}[cursor] || Dot;
|
|
24
|
+
}, [cursor]);
|
|
25
|
+
var loadingClassName = getPrefixCls('typography-cursor');
|
|
26
|
+
useLayoutEffect(function () {
|
|
27
|
+
try {
|
|
28
|
+
var _ref$current, _loading$parentElemen;
|
|
29
|
+
var deepNode = findDeepNode((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.childNodes);
|
|
30
|
+
var loading = ref.current.querySelector(".".concat(loadingClassName));
|
|
31
|
+
loading && ((_loading$parentElemen = loading.parentElement) === null || _loading$parentElemen === void 0 ? void 0 : _loading$parentElemen.removeChild(loading));
|
|
32
|
+
if (cursor && deepNode) {
|
|
33
|
+
var span = document.createElement('span');
|
|
34
|
+
span.className = classNames(loadingClassName);
|
|
35
|
+
span.innerHTML = '';
|
|
36
|
+
if (deepNode.nodeType === 3) {
|
|
37
|
+
var _deepNode$parentNode;
|
|
38
|
+
(_deepNode$parentNode = deepNode.parentNode) === null || _deepNode$parentNode === void 0 || _deepNode$parentNode.appendChild(span);
|
|
39
|
+
} else {
|
|
40
|
+
deepNode.appendChild(span);
|
|
41
|
+
}
|
|
42
|
+
var container = createRoot(span);
|
|
43
|
+
container.render( /*#__PURE__*/React.createElement(Cursor, null));
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('markdown cursor error', error);
|
|
47
|
+
}
|
|
48
|
+
}, [content, cursor]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { BubbleContext } from "../../bubble/Bubble";
|
|
8
|
+
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
function isString(str) {
|
|
11
|
+
return typeof str === 'string';
|
|
12
|
+
}
|
|
13
|
+
var noop = function noop() {};
|
|
14
|
+
/**
|
|
15
|
+
* Return typed content and typing status when typing is enabled.
|
|
16
|
+
* Or return content directly.
|
|
17
|
+
*/
|
|
18
|
+
var useTypedEffect = function useTypedEffect(content, typingEnabled) {
|
|
19
|
+
var _React$useContext = React.useContext(BubbleContext),
|
|
20
|
+
_React$useContext$onU = _React$useContext.onUpdate,
|
|
21
|
+
onUpdate = _React$useContext$onU === void 0 ? noop : _React$useContext$onU;
|
|
22
|
+
var prevContentRef = React.useRef('');
|
|
23
|
+
var _React$useState = React.useState(1),
|
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25
|
+
typingIndex = _React$useState2[0],
|
|
26
|
+
setTypingIndex = _React$useState2[1];
|
|
27
|
+
var mergedTypingEnabled = typingEnabled && isString(content);
|
|
28
|
+
|
|
29
|
+
// Reset typing index when content changed
|
|
30
|
+
useLayoutEffect(function () {
|
|
31
|
+
if (!mergedTypingEnabled && isString(content)) {
|
|
32
|
+
setTypingIndex(content.length);
|
|
33
|
+
} else if (isString(content) && isString(prevContentRef.current) && content.indexOf(prevContentRef.current) !== 0) {
|
|
34
|
+
setTypingIndex(1);
|
|
35
|
+
}
|
|
36
|
+
prevContentRef.current = content;
|
|
37
|
+
}, [content]);
|
|
38
|
+
|
|
39
|
+
// Start typing
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
if (mergedTypingEnabled && typingIndex < content.length) {
|
|
42
|
+
var id = setTimeout(function () {
|
|
43
|
+
setTypingIndex(function (prev) {
|
|
44
|
+
return prev + 1;
|
|
45
|
+
});
|
|
46
|
+
onUpdate();
|
|
47
|
+
});
|
|
48
|
+
return function () {
|
|
49
|
+
clearTimeout(id);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, [typingIndex, typingEnabled, content]);
|
|
53
|
+
var mergedTypingContent = mergedTypingEnabled ? content.slice(0, typingIndex) : content;
|
|
54
|
+
return [mergedTypingContent, mergedTypingEnabled && typingIndex < content.length];
|
|
55
|
+
};
|
|
56
|
+
export default useTypedEffect;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { MarkdownProps as InnerMarkdownProps } from './type';
|
|
4
|
+
import type { Components } from 'react-markdown/lib';
|
|
5
|
+
export interface MarkdownProps {
|
|
6
|
+
content?: string;
|
|
7
|
+
cursor?: boolean | 'blur' | 'dot' | 'underline';
|
|
8
|
+
baseFontSize?: number;
|
|
9
|
+
citations?: InnerMarkdownProps['citations'];
|
|
10
|
+
citationsMap?: InnerMarkdownProps['citationsMap'];
|
|
11
|
+
components?: Components & Record<string, FC>;
|
|
12
|
+
allowHtml?: boolean;
|
|
13
|
+
typing?: boolean;
|
|
14
|
+
raw?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function (props: MarkdownProps): React.JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import Markdown from "./Markdown";
|
|
3
|
+
import { ConfigProvider, Typography } from 'antd';
|
|
4
|
+
import "./index.less";
|
|
5
|
+
import { useGlobalContext, useProviderContext } from "./..";
|
|
6
|
+
import { useAppendCursor } from "./hooks/index";
|
|
7
|
+
import useTypedEffect from "./hooks/useTypedEffect";
|
|
8
|
+
export default function (props) {
|
|
9
|
+
var _useGlobalContext = useGlobalContext(),
|
|
10
|
+
markdown = _useGlobalContext.markdown;
|
|
11
|
+
var _props$content = props.content,
|
|
12
|
+
content = _props$content === void 0 ? '' : _props$content,
|
|
13
|
+
_props$raw = props.raw,
|
|
14
|
+
raw = _props$raw === void 0 ? false : _props$raw;
|
|
15
|
+
var baseFontSize = props.baseFontSize || (markdown === null || markdown === void 0 ? void 0 : markdown.baseFontSize) || 14;
|
|
16
|
+
var ref = useRef();
|
|
17
|
+
var _useProviderContext = useProviderContext(),
|
|
18
|
+
getPrefixCls = _useProviderContext.getPrefixCls;
|
|
19
|
+
var prefixCls = getPrefixCls('markdown');
|
|
20
|
+
var typedContent = useTypedEffect(content, props.cursor && props.typing);
|
|
21
|
+
useAppendCursor(ref, props.cursor, typedContent[0]);
|
|
22
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
23
|
+
theme: {
|
|
24
|
+
token: {
|
|
25
|
+
fontSize: baseFontSize
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: prefixCls,
|
|
30
|
+
ref: ref
|
|
31
|
+
}, raw ? typedContent[0] : /*#__PURE__*/React.createElement(Markdown, {
|
|
32
|
+
citations: props.citations,
|
|
33
|
+
citationsMap: props.citationsMap,
|
|
34
|
+
allowHtml: props.allowHtml,
|
|
35
|
+
components: props.components
|
|
36
|
+
}, typedContent[0]))));
|
|
37
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
@import '../index.less';
|
|
2
|
+
|
|
3
|
+
.@{ant-prefix}-typography {
|
|
4
|
+
line-height: 1.7;
|
|
5
|
+
color: inherit;
|
|
6
|
+
|
|
7
|
+
.katex-display {
|
|
8
|
+
font-size: 1.3em;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.katex-html {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.katex-error {
|
|
16
|
+
color: inherit !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cm-gutter-lint {
|
|
20
|
+
width: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.cm-line {
|
|
24
|
+
background-color: transparent !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.cm-activeLineGutter {
|
|
28
|
+
background-color: transparent !important;
|
|
29
|
+
color: inherit !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ͼ1.cm-focused {
|
|
33
|
+
outline: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
mstyle[mathcolor="#cc0000"] {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ol li {
|
|
41
|
+
margin-inline: 40px 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-cursor {}
|
|
45
|
+
|
|
46
|
+
figure {
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
figure img {
|
|
51
|
+
display: block;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
code .@{ant-prefix}-typography-cursor,
|
|
56
|
+
pre .@{ant-prefix}-typography-cursor,
|
|
57
|
+
table .@{ant-prefix}-typography-cursor {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes typography-cursor {
|
|
62
|
+
0% {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
100% {
|
|
67
|
+
opacity: 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
code {
|
|
72
|
+
font-size: 0.8571428571428571em;
|
|
73
|
+
border: 0 !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pre code {
|
|
77
|
+
font-size: 0.8571428571428571em;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
h1,
|
|
81
|
+
h2,
|
|
82
|
+
h3,
|
|
83
|
+
h4,
|
|
84
|
+
h5,
|
|
85
|
+
h6 {
|
|
86
|
+
margin-top: 0.5714285714285714em !important;
|
|
87
|
+
margin-bottom: 0.5714285714285714em !important;
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
line-height: 1.7777;
|
|
90
|
+
color: inherit !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
p {
|
|
94
|
+
margin-top: 0.5714285714285714em !important;
|
|
95
|
+
margin-bottom: 0.5714285714285714em !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
h1 {
|
|
99
|
+
font-size: 1.2857142857142858em;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
h2 {
|
|
103
|
+
font-size: 1.1428571428571428em;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
h3 {
|
|
107
|
+
font-size: 1em;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
h4 {
|
|
111
|
+
font-size: 1em;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
h5 {
|
|
115
|
+
font-size: 1em;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
h6 {
|
|
119
|
+
font-size: 1em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
hr {
|
|
123
|
+
border-color: e('var(--@{ant-prefix}-color-border-secondary)');
|
|
124
|
+
border-style: solid;
|
|
125
|
+
border-width: 1px 0 0 0;
|
|
126
|
+
margin: 1em 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
table {
|
|
130
|
+
border-collapse: collapse;
|
|
131
|
+
display: block;
|
|
132
|
+
width: max-content;
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
overflow: auto;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
table th {
|
|
138
|
+
background: e('var(--@{ant-prefix}-color-fill-quaternary)');
|
|
139
|
+
text-align: left;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
table td,
|
|
143
|
+
table th {
|
|
144
|
+
padding: 0.75em 1.5em;
|
|
145
|
+
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
146
|
+
white-space: pre;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.@{ant-prefix}-markdown-video {
|
|
151
|
+
position: relative;
|
|
152
|
+
width: 30%;
|
|
153
|
+
padding-top: 18%;
|
|
154
|
+
border-radius: 8px;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
background-color: #000;
|
|
157
|
+
|
|
158
|
+
&-play {
|
|
159
|
+
position: absolute;
|
|
160
|
+
top: 50%;
|
|
161
|
+
left: 50%;
|
|
162
|
+
transform: translate(-50%, -50%);
|
|
163
|
+
z-index: 1;
|
|
164
|
+
color: #ccc;
|
|
165
|
+
font-size: 30px;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.@{ant-prefix}-markdown-image {
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
border-radius: 8px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.@{ant-prefix}-typography *:last-child {
|
|
176
|
+
margin-bottom: 0 !important;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.@{ant-prefix}-typography *:first-child {
|
|
180
|
+
margin-top: 0 !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[data-prefers-color='dark'] .@{ant-prefix}-typography {
|
|
184
|
+
#setText pre {
|
|
185
|
+
code {
|
|
186
|
+
filter: invert(1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@keyframes fade-in {
|
|
192
|
+
0% {
|
|
193
|
+
opacity: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
100% {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
.animate-fade-in {
|
|
203
|
+
animation: fade-in 1s;
|
|
204
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { SKIP, visit } from 'unist-util-visit';
|
|
14
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
15
|
+
export var remarkCustomFootnotes = function remarkCustomFootnotes() {
|
|
16
|
+
return function (tree, file) {
|
|
17
|
+
var footnoteLinks = new Map();
|
|
18
|
+
visit(tree, 'footnoteDefinition', function (node) {
|
|
19
|
+
var linkData = null;
|
|
20
|
+
|
|
21
|
+
// 查找第一个link类型的子节点
|
|
22
|
+
visit(node, 'link', function (linkNode) {
|
|
23
|
+
if (linkData) return SKIP; // 只取第一个链接
|
|
24
|
+
|
|
25
|
+
// 提取链接文本
|
|
26
|
+
var textNode = linkNode.children.find(function (n) {
|
|
27
|
+
return n.type === 'text';
|
|
28
|
+
});
|
|
29
|
+
linkData = {
|
|
30
|
+
alt: (textNode === null || textNode === void 0 ? void 0 : textNode.value) || '',
|
|
31
|
+
title: (textNode === null || textNode === void 0 ? void 0 : textNode.value) || '',
|
|
32
|
+
url: linkNode.url // 或者根据需求处理
|
|
33
|
+
};
|
|
34
|
+
return SKIP; // 找到后停止遍历
|
|
35
|
+
});
|
|
36
|
+
if (linkData) {
|
|
37
|
+
footnoteLinks.set(node.identifier, linkData);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// 将数据存入文件上下文
|
|
42
|
+
file.data.footnoteLinks = Object.fromEntries(footnoteLinks);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
47
|
+
export var rehypeFootnoteLinks = function rehypeFootnoteLinks() {
|
|
48
|
+
return function (tree, file) {
|
|
49
|
+
var linksData = file.data.footnoteLinks || {};
|
|
50
|
+
visit(tree, 'element', function (node) {
|
|
51
|
+
var _node$properties$clas;
|
|
52
|
+
if (node.tagName === 'section' && (_node$properties$clas = node.properties.className) !== null && _node$properties$clas !== void 0 && _node$properties$clas.includes('footnotes')) {
|
|
53
|
+
// 转换数据格式为数组(按identifier排序)
|
|
54
|
+
var sortedLinks = Object.entries(linksData).sort(function (_ref, _ref2) {
|
|
55
|
+
var _ref3 = _slicedToArray(_ref, 1),
|
|
56
|
+
a = _ref3[0];
|
|
57
|
+
var _ref4 = _slicedToArray(_ref2, 1),
|
|
58
|
+
b = _ref4[0];
|
|
59
|
+
return a.localeCompare(b);
|
|
60
|
+
}).map(function (_ref5) {
|
|
61
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
62
|
+
id = _ref6[0],
|
|
63
|
+
data = _ref6[1];
|
|
64
|
+
return _objectSpread({
|
|
65
|
+
id: id
|
|
66
|
+
}, data);
|
|
67
|
+
});
|
|
68
|
+
// 注入数据属性
|
|
69
|
+
node.properties['data-footnote-links'] = JSON.stringify(sortedLinks);
|
|
70
|
+
}
|
|
71
|
+
if (node.tagName === 'sup') {
|
|
72
|
+
var link = node.children.find(function (n) {
|
|
73
|
+
return n.tagName === 'a';
|
|
74
|
+
});
|
|
75
|
+
if (link) {
|
|
76
|
+
var _link$properties;
|
|
77
|
+
// a node example
|
|
78
|
+
// {
|
|
79
|
+
// "href": "#user-content-fn-3",
|
|
80
|
+
// "id": "user-content-fnref-3-2",
|
|
81
|
+
// "dataFootnoteRef": true,
|
|
82
|
+
// }
|
|
83
|
+
var linkRefIndex = (_link$properties = link.properties) === null || _link$properties === void 0 || (_link$properties = _link$properties.id) === null || _link$properties === void 0 ? void 0 : _link$properties.replace(/^user-content-fnref-/, '')[0];
|
|
84
|
+
if (linkRefIndex !== undefined) link.properties['data-link'] = JSON.stringify(linksData[linkRefIndex]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const rehypeKatexDir: () => (tree: any) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { visit } from 'unist-util-visit';
|
|
2
|
+
|
|
3
|
+
// katex-directive
|
|
4
|
+
// 给 class="katex" 的节点加上 dir="ltr" 属性
|
|
5
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
6
|
+
export var rehypeKatexDir = function rehypeKatexDir() {
|
|
7
|
+
return function (tree) {
|
|
8
|
+
visit(tree, 'element', function (node) {
|
|
9
|
+
var _node$properties;
|
|
10
|
+
if ((_node$properties = node.properties) !== null && _node$properties !== void 0 && (_node$properties = _node$properties.className) !== null && _node$properties !== void 0 && _node$properties.includes('katex')) {
|
|
11
|
+
node.properties.dir = 'ltr';
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { visit } from 'unist-util-visit';
|
|
5
|
+
export function rehypeFadeIn() {
|
|
6
|
+
return function (tree) {
|
|
7
|
+
visit(tree, 'element', function (node) {
|
|
8
|
+
if (['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'strong'].includes(node.tagName) && node.children) {
|
|
9
|
+
var newChildren = [];
|
|
10
|
+
node.children.forEach(function (child) {
|
|
11
|
+
if (child.type === 'text') {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
var segmenter = new Intl.Segmenter('zh', {
|
|
14
|
+
granularity: 'word'
|
|
15
|
+
});
|
|
16
|
+
var segments = segmenter.segment(child.value);
|
|
17
|
+
var words = Array.from(segments)
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
.map(function (segment) {
|
|
20
|
+
return segment.segment;
|
|
21
|
+
}).filter(Boolean);
|
|
22
|
+
words.forEach(function (word) {
|
|
23
|
+
newChildren.push({
|
|
24
|
+
type: 'element',
|
|
25
|
+
tagName: 'span',
|
|
26
|
+
properties: {
|
|
27
|
+
className: 'animate-fade-in'
|
|
28
|
+
},
|
|
29
|
+
children: [{
|
|
30
|
+
type: 'text',
|
|
31
|
+
value: word
|
|
32
|
+
}]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
newChildren.push(child);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
node.children = newChildren;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|