@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.
Files changed (476) hide show
  1. package/README.md +88 -0
  2. package/dist/_util/hooks/use-proxy-imperative-handle.d.ts +4 -0
  3. package/dist/_util/hooks/use-proxy-imperative-handle.js +18 -0
  4. package/dist/_util/type.d.ts +1 -0
  5. package/dist/_util/type.js +1 -0
  6. package/dist/_util/warning.d.ts +30 -0
  7. package/dist/_util/warning.js +63 -0
  8. package/dist/accordion/Accordion.d.ts +22 -0
  9. package/dist/accordion/Accordion.js +93 -0
  10. package/dist/accordion/BodyContent.d.ts +8 -0
  11. package/dist/accordion/BodyContent.js +18 -0
  12. package/dist/accordion/DeepThink.d.ts +7 -0
  13. package/dist/accordion/DeepThink.js +35 -0
  14. package/dist/accordion/index.d.ts +2 -0
  15. package/dist/accordion/index.js +1 -0
  16. package/dist/accordion/index.less +170 -0
  17. package/dist/attachments/DropArea.d.ts +8 -0
  18. package/dist/attachments/DropArea.js +87 -0
  19. package/dist/attachments/FileList/AudioIcon.d.ts +2 -0
  20. package/dist/attachments/FileList/AudioIcon.js +19 -0
  21. package/dist/attachments/FileList/FileListCard.d.ts +12 -0
  22. package/dist/attachments/FileList/FileListCard.js +229 -0
  23. package/dist/attachments/FileList/Progress.d.ts +6 -0
  24. package/dist/attachments/FileList/Progress.js +21 -0
  25. package/dist/attachments/FileList/VideoIcon.d.ts +2 -0
  26. package/dist/attachments/FileList/VideoIcon.js +19 -0
  27. package/dist/attachments/FileList/index.d.ts +16 -0
  28. package/dist/attachments/FileList/index.js +132 -0
  29. package/dist/attachments/PlaceholderUploader.d.ts +17 -0
  30. package/dist/attachments/PlaceholderUploader.js +79 -0
  31. package/dist/attachments/SilentUploader.d.ts +9 -0
  32. package/dist/attachments/SilentUploader.js +23 -0
  33. package/dist/attachments/context.d.ts +5 -0
  34. package/dist/attachments/context.js +2 -0
  35. package/dist/attachments/index.d.ts +33 -0
  36. package/dist/attachments/index.js +166 -0
  37. package/dist/attachments/style/fileCard.d.ts +4 -0
  38. package/dist/attachments/style/fileCard.js +124 -0
  39. package/dist/attachments/style/index.d.ts +10 -0
  40. package/dist/attachments/style/index.js +211 -0
  41. package/dist/attachments/util.d.ts +2 -0
  42. package/dist/attachments/util.js +53 -0
  43. package/dist/bubble/Avatar.d.ts +10 -0
  44. package/dist/bubble/Avatar.js +22 -0
  45. package/dist/bubble/Bubble.d.ts +11 -0
  46. package/dist/bubble/Bubble.js +102 -0
  47. package/dist/bubble/BubbleList.d.ts +15 -0
  48. package/dist/bubble/BubbleList.js +44 -0
  49. package/dist/bubble/Cards.d.ts +21 -0
  50. package/dist/bubble/Cards.js +47 -0
  51. package/dist/bubble/ScrollToBottom.d.ts +7 -0
  52. package/dist/bubble/ScrollToBottom.js +45 -0
  53. package/dist/bubble/Spin.d.ts +2 -0
  54. package/dist/bubble/Spin.js +18 -0
  55. package/dist/bubble/hooks/useDisplayData.d.ts +0 -0
  56. package/dist/bubble/hooks/useDisplayData.js +0 -0
  57. package/dist/bubble/hooks/useListData.d.ts +0 -0
  58. package/dist/bubble/hooks/useListData.js +0 -0
  59. package/dist/bubble/index.d.ts +8 -0
  60. package/dist/bubble/index.js +4 -0
  61. package/dist/bubble/interface.d.ts +26 -0
  62. package/dist/bubble/interface.js +1 -0
  63. package/dist/bubble/loading.d.ts +6 -0
  64. package/dist/bubble/loading.js +17 -0
  65. package/dist/bubble/style/avatar.less +40 -0
  66. package/dist/bubble/style/content.d.ts +4 -0
  67. package/dist/bubble/style/content.js +43 -0
  68. package/dist/bubble/style/index.d.ts +9 -0
  69. package/dist/bubble/style/index.js +53 -0
  70. package/dist/bubble/style/list.less +15 -0
  71. package/dist/bubble/style/scrollToBottom.less +174 -0
  72. package/dist/chat-anywhere/Chat/Ref.d.ts +3 -0
  73. package/dist/chat-anywhere/Chat/Ref.js +19 -0
  74. package/dist/chat-anywhere/Chat/index.d.ts +4 -0
  75. package/dist/chat-anywhere/Chat/index.js +65 -0
  76. package/dist/chat-anywhere/Chat/index.less +54 -0
  77. package/dist/chat-anywhere/Header/index.d.ts +3 -0
  78. package/dist/chat-anywhere/Header/index.js +32 -0
  79. package/dist/chat-anywhere/Header/index.less +24 -0
  80. package/dist/chat-anywhere/Input/index.d.ts +3 -0
  81. package/dist/chat-anywhere/Input/index.js +170 -0
  82. package/dist/chat-anywhere/Input/index.less +12 -0
  83. package/dist/chat-anywhere/Layout/index.d.ts +10 -0
  84. package/dist/chat-anywhere/Layout/index.js +73 -0
  85. package/dist/chat-anywhere/Layout/index.less +61 -0
  86. package/dist/chat-anywhere/SessionList/index.d.ts +5 -0
  87. package/dist/chat-anywhere/SessionList/index.js +115 -0
  88. package/dist/chat-anywhere/SessionList/index.less +52 -0
  89. package/dist/chat-anywhere/hooks/ChatAnywhereProvider.d.ts +43 -0
  90. package/dist/chat-anywhere/hooks/ChatAnywhereProvider.js +90 -0
  91. package/dist/chat-anywhere/hooks/types.d.ts +57 -0
  92. package/dist/chat-anywhere/hooks/types.js +1 -0
  93. package/dist/chat-anywhere/hooks/useInput.d.ts +7 -0
  94. package/dist/chat-anywhere/hooks/useInput.js +21 -0
  95. package/dist/chat-anywhere/hooks/useMessages.d.ts +11 -0
  96. package/dist/chat-anywhere/hooks/useMessages.js +56 -0
  97. package/dist/chat-anywhere/hooks/useSessionList.d.ts +24 -0
  98. package/dist/chat-anywhere/hooks/useSessionList.js +120 -0
  99. package/dist/chat-anywhere/index.d.ts +9 -0
  100. package/dist/chat-anywhere/index.js +58 -0
  101. package/dist/conversations/GroupTitle.d.ts +10 -0
  102. package/dist/conversations/GroupTitle.js +15 -0
  103. package/dist/conversations/Item.d.ts +14 -0
  104. package/dist/conversations/Item.js +96 -0
  105. package/dist/conversations/hooks/useGroupable.d.ts +9 -0
  106. package/dist/conversations/hooks/useGroupable.js +72 -0
  107. package/dist/conversations/index.d.ts +62 -0
  108. package/dist/conversations/index.js +124 -0
  109. package/dist/conversations/interface.d.ts +60 -0
  110. package/dist/conversations/interface.js +1 -0
  111. package/dist/conversations/style/index.d.ts +9 -0
  112. package/dist/conversations/style/index.js +80 -0
  113. package/dist/default-cards/Count/index.d.ts +3 -0
  114. package/dist/default-cards/Count/index.js +16 -0
  115. package/dist/default-cards/Count/index.less +19 -0
  116. package/dist/default-cards/DeepThink/index.d.ts +11 -0
  117. package/dist/default-cards/DeepThink/index.js +11 -0
  118. package/dist/default-cards/DeepThink/index.less +0 -0
  119. package/dist/default-cards/Files/index.d.ts +2 -0
  120. package/dist/default-cards/Files/index.js +18 -0
  121. package/dist/default-cards/Footer/index.d.ts +19 -0
  122. package/dist/default-cards/Footer/index.js +50 -0
  123. package/dist/default-cards/Footer/index.less +41 -0
  124. package/dist/default-cards/Images/index.d.ts +3 -0
  125. package/dist/default-cards/Images/index.js +33 -0
  126. package/dist/default-cards/Images/index.less +17 -0
  127. package/dist/default-cards/Interrupted/index.d.ts +11 -0
  128. package/dist/default-cards/Interrupted/index.js +40 -0
  129. package/dist/default-cards/Interrupted/index.less +57 -0
  130. package/dist/default-cards/Text/index.d.ts +2 -0
  131. package/dist/default-cards/Text/index.js +12 -0
  132. package/dist/default-cards/index.d.ts +6 -0
  133. package/dist/default-cards/index.js +6 -0
  134. package/dist/disclaimer/index.d.ts +11 -0
  135. package/dist/disclaimer/index.js +26 -0
  136. package/dist/docs/1896.async.js +457 -0
  137. package/dist/docs/2710.async.js +62 -0
  138. package/dist/docs/2863.async.js +400 -0
  139. package/dist/docs/3057.async.js +46 -0
  140. package/dist/docs/3364.async.js +25 -0
  141. package/dist/docs/404.html +15 -0
  142. package/dist/docs/4820.async.js +1381 -0
  143. package/dist/docs/5623.async.js +60 -0
  144. package/dist/docs/5757.async.js +1 -0
  145. package/dist/docs/5804.async.js +271 -0
  146. package/dist/docs/6198.async.js +18 -0
  147. package/dist/docs/6671.async.js +137 -0
  148. package/dist/docs/7195.async.js +1 -0
  149. package/dist/docs/7485.async.js +29 -0
  150. package/dist/docs/7931.async.js +19 -0
  151. package/dist/docs/7997.async.js +5 -0
  152. package/dist/docs/8156.async.js +110 -0
  153. package/dist/docs/8368.async.js +2 -0
  154. package/dist/docs/8480.async.js +1449 -0
  155. package/dist/docs/8618.async.js +246 -0
  156. package/dist/docs/9016.async.js +32 -0
  157. package/dist/docs/9016.chunk.css +1 -0
  158. package/dist/docs/9335.async.js +11 -0
  159. package/dist/docs/accordion__demos.async.js +9 -0
  160. package/dist/docs/attachments__demos.async.js +1 -0
  161. package/dist/docs/bubble__demos.async.js +50 -0
  162. package/dist/docs/components/accordion/index.html +15 -0
  163. package/dist/docs/components/accordion-cn/index.html +15 -0
  164. package/dist/docs/components/attachments/index.html +15 -0
  165. package/dist/docs/components/attachments-cn/index.html +15 -0
  166. package/dist/docs/components/bubble/index.html +15 -0
  167. package/dist/docs/components/bubble-cn/index.html +15 -0
  168. package/dist/docs/components/bubble-list/index.html +15 -0
  169. package/dist/docs/components/bubble-list-cn/index.html +15 -0
  170. package/dist/docs/components/conversations/index.html +15 -0
  171. package/dist/docs/components/conversations-cn/index.html +15 -0
  172. package/dist/docs/components/disclaimer/index.html +15 -0
  173. package/dist/docs/components/disclaimer-cn/index.html +15 -0
  174. package/dist/docs/components/footer/index.html +15 -0
  175. package/dist/docs/components/footer-cn/index.html +15 -0
  176. package/dist/docs/components/markdown/index.html +15 -0
  177. package/dist/docs/components/markdown-cn/index.html +15 -0
  178. package/dist/docs/components/sender/index.html +15 -0
  179. package/dist/docs/components/sender-cn/index.html +15 -0
  180. package/dist/docs/components/status/index.html +15 -0
  181. package/dist/docs/components/status-cn/index.html +15 -0
  182. package/dist/docs/components/welcome/index.html +15 -0
  183. package/dist/docs/components/welcome-cn/index.html +15 -0
  184. package/dist/docs/components__accordion__index.en-US.md.async.js +6 -0
  185. package/dist/docs/components__accordion__index.en-US.md.chunk.css +1 -0
  186. package/dist/docs/components__accordion__index.zh-CN.md.async.js +6 -0
  187. package/dist/docs/components__accordion__index.zh-CN.md.chunk.css +1 -0
  188. package/dist/docs/components__attachments__index.en-US.md.async.js +1 -0
  189. package/dist/docs/components__attachments__index.en-US.md.chunk.css +1 -0
  190. package/dist/docs/components__attachments__index.zh-CN.md.async.js +1 -0
  191. package/dist/docs/components__attachments__index.zh-CN.md.chunk.css +1 -0
  192. package/dist/docs/components__bubble-list__index.en-US.md.async.js +2 -0
  193. package/dist/docs/components__bubble-list__index.en-US.md.chunk.css +1 -0
  194. package/dist/docs/components__bubble-list__index.zh-CN.md.async.js +2 -0
  195. package/dist/docs/components__bubble-list__index.zh-CN.md.chunk.css +1 -0
  196. package/dist/docs/components__bubble__index.en-US.md.async.js +1 -0
  197. package/dist/docs/components__bubble__index.en-US.md.chunk.css +1 -0
  198. package/dist/docs/components__bubble__index.zh-CN.md.async.js +1 -0
  199. package/dist/docs/components__bubble__index.zh-CN.md.chunk.css +1 -0
  200. package/dist/docs/components__conversations__index.en-US.md.async.js +2 -0
  201. package/dist/docs/components__conversations__index.en-US.md.chunk.css +1 -0
  202. package/dist/docs/components__conversations__index.zh-CN.md.async.js +1 -0
  203. package/dist/docs/components__conversations__index.zh-CN.md.chunk.css +1 -0
  204. package/dist/docs/components__disclaimer__index.en-US.md.async.js +1 -0
  205. package/dist/docs/components__disclaimer__index.en-US.md.chunk.css +1 -0
  206. package/dist/docs/components__disclaimer__index.zh-CN.md.async.js +1 -0
  207. package/dist/docs/components__disclaimer__index.zh-CN.md.chunk.css +1 -0
  208. package/dist/docs/components__footer__index.en-US.md.async.js +1 -0
  209. package/dist/docs/components__footer__index.en-US.md.chunk.css +1 -0
  210. package/dist/docs/components__footer__index.zh-CN.md.async.js +2 -0
  211. package/dist/docs/components__footer__index.zh-CN.md.chunk.css +1 -0
  212. package/dist/docs/components__markdown__index.en-US.md.async.js +1 -0
  213. package/dist/docs/components__markdown__index.en-US.md.chunk.css +1 -0
  214. package/dist/docs/components__markdown__index.zh-CN.md.async.js +1 -0
  215. package/dist/docs/components__markdown__index.zh-CN.md.chunk.css +1 -0
  216. package/dist/docs/components__sender__index.en-US.md.async.js +1 -0
  217. package/dist/docs/components__sender__index.en-US.md.chunk.css +1 -0
  218. package/dist/docs/components__sender__index.zh-CN.md.async.js +1 -0
  219. package/dist/docs/components__sender__index.zh-CN.md.chunk.css +1 -0
  220. package/dist/docs/components__status__index.en-US.md.async.js +1 -0
  221. package/dist/docs/components__status__index.en-US.md.chunk.css +1 -0
  222. package/dist/docs/components__status__index.zh-CN.md.async.js +2 -0
  223. package/dist/docs/components__status__index.zh-CN.md.chunk.css +1 -0
  224. package/dist/docs/components__welcome__index.en-US.md.async.js +2 -0
  225. package/dist/docs/components__welcome__index.en-US.md.chunk.css +1 -0
  226. package/dist/docs/components__welcome__index.zh-CN.md.async.js +2 -0
  227. package/dist/docs/components__welcome__index.zh-CN.md.chunk.css +1 -0
  228. package/dist/docs/conversations__demos.async.js +1 -0
  229. package/dist/docs/demos.async.js +47 -0
  230. package/dist/docs/demos.chunk.css +1 -0
  231. package/dist/docs/disclaimer__demos.async.js +1 -0
  232. package/dist/docs/docs/development/ag-ui/index.html +15 -0
  233. package/dist/docs/docs/development/ag-ui-cn/index.html +15 -0
  234. package/dist/docs/docs/development/backend/index.html +15 -0
  235. package/dist/docs/docs/development/backend-cn/index.html +15 -0
  236. package/dist/docs/docs/development/cards/index.html +15 -0
  237. package/dist/docs/docs/development/cards-cn/index.html +15 -0
  238. package/dist/docs/docs/development/chatanywhere/index.html +15 -0
  239. package/dist/docs/docs/development/chatanywhere-api/index.html +15 -0
  240. package/dist/docs/docs/development/chatanywhere-api-cn/index.html +15 -0
  241. package/dist/docs/docs/development/chatanywhere-cn/index.html +15 -0
  242. package/dist/docs/docs/development/custom/index.html +15 -0
  243. package/dist/docs/docs/development/custom-cn/index.html +15 -0
  244. package/dist/docs/docs/development/overview/index.html +15 -0
  245. package/dist/docs/docs/development/overview-cn/index.html +15 -0
  246. package/dist/docs/docs/development/qwen/index.html +15 -0
  247. package/dist/docs/docs/development/qwen-cn/index.html +15 -0
  248. package/dist/docs/docs/templates/copilot/index.html +15 -0
  249. package/dist/docs/docs/templates/copilot-cn/index.html +15 -0
  250. package/dist/docs/docs/templates/native/index.html +15 -0
  251. package/dist/docs/docs/templates/native-cn/index.html +15 -0
  252. package/dist/docs/docs/templates/voice/index.html +15 -0
  253. package/dist/docs/docs/templates/voice-cn/index.html +15 -0
  254. package/dist/docs/docs__development__ag-ui.en-US.md.async.js +210 -0
  255. package/dist/docs/docs__development__ag-ui.en-US.md.chunk.css +1 -0
  256. package/dist/docs/docs__development__ag-ui.zh-CN.md.async.js +210 -0
  257. package/dist/docs/docs__development__ag-ui.zh-CN.md.chunk.css +1 -0
  258. package/dist/docs/docs__development__backend.en-US.md.async.js +12 -0
  259. package/dist/docs/docs__development__backend.en-US.md.chunk.css +1 -0
  260. package/dist/docs/docs__development__backend.zh-CN.md.async.js +12 -0
  261. package/dist/docs/docs__development__backend.zh-CN.md.chunk.css +1 -0
  262. package/dist/docs/docs__development__cards.en-US.md.async.js +27 -0
  263. package/dist/docs/docs__development__cards.en-US.md.chunk.css +1 -0
  264. package/dist/docs/docs__development__cards.zh-CN.md.async.js +27 -0
  265. package/dist/docs/docs__development__cards.zh-CN.md.chunk.css +1 -0
  266. package/dist/docs/docs__development__chatanywhere-api.en-US.md.async.js +69 -0
  267. package/dist/docs/docs__development__chatanywhere-api.en-US.md.chunk.css +1 -0
  268. package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.async.js +69 -0
  269. package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.chunk.css +1 -0
  270. package/dist/docs/docs__development__chatanywhere.en-US.md.async.js +77 -0
  271. package/dist/docs/docs__development__chatanywhere.en-US.md.chunk.css +1 -0
  272. package/dist/docs/docs__development__chatanywhere.zh-CN.md.async.js +77 -0
  273. package/dist/docs/docs__development__chatanywhere.zh-CN.md.chunk.css +1 -0
  274. package/dist/docs/docs__development__custom.en-US.md.async.js +22 -0
  275. package/dist/docs/docs__development__custom.en-US.md.chunk.css +1 -0
  276. package/dist/docs/docs__development__custom.zh-CN.md.async.js +22 -0
  277. package/dist/docs/docs__development__custom.zh-CN.md.chunk.css +1 -0
  278. package/dist/docs/docs__development__overview.en-US.md.async.js +21 -0
  279. package/dist/docs/docs__development__overview.en-US.md.chunk.css +1 -0
  280. package/dist/docs/docs__development__overview.zh-CN.md.async.js +21 -0
  281. package/dist/docs/docs__development__overview.zh-CN.md.chunk.css +1 -0
  282. package/dist/docs/docs__development__qwen.en-US.md.async.js +25 -0
  283. package/dist/docs/docs__development__qwen.en-US.md.chunk.css +1 -0
  284. package/dist/docs/docs__development__qwen.zh-CN.md.async.js +25 -0
  285. package/dist/docs/docs__development__qwen.zh-CN.md.chunk.css +1 -0
  286. package/dist/docs/docs__templates__copilot.en-US.md.async.js +1 -0
  287. package/dist/docs/docs__templates__copilot.en-US.md.chunk.css +1 -0
  288. package/dist/docs/docs__templates__copilot.zh-CN.md.async.js +1 -0
  289. package/dist/docs/docs__templates__copilot.zh-CN.md.chunk.css +1 -0
  290. package/dist/docs/docs__templates__native.en-US.md.async.js +1 -0
  291. package/dist/docs/docs__templates__native.en-US.md.chunk.css +1 -0
  292. package/dist/docs/docs__templates__native.zh-CN.md.async.js +1 -0
  293. package/dist/docs/docs__templates__native.zh-CN.md.chunk.css +1 -0
  294. package/dist/docs/docs__templates__voice.en-US.md.async.js +20 -0
  295. package/dist/docs/docs__templates__voice.en-US.md.chunk.css +1 -0
  296. package/dist/docs/docs__templates__voice.zh-CN.md.async.js +1 -0
  297. package/dist/docs/docs__templates__voice.zh-CN.md.chunk.css +1 -0
  298. package/dist/docs/dumi__pages__index__index.en-US.async.js +1 -0
  299. package/dist/docs/dumi__pages__index__index.en-US.chunk.css +1 -0
  300. package/dist/docs/dumi__pages__index__index.zh-CN.async.js +1 -0
  301. package/dist/docs/dumi__pages__index__index.zh-CN.chunk.css +1 -0
  302. package/dist/docs/dumi__theme__layouts__DocLayout__index.async.js +1 -0
  303. package/dist/docs/dumi__theme__layouts__DocLayout__index.chunk.css +1 -0
  304. package/dist/docs/dumi__theme__layouts__GlobalLayout__index.async.js +18 -0
  305. package/dist/docs/dumi__theme__layouts__GlobalLayout__index.chunk.css +1 -0
  306. package/dist/docs/dumi__tmp-production__dumi__theme__ContextWrapper.async.js +1 -0
  307. package/dist/docs/index/index.html +15 -0
  308. package/dist/docs/index-cn/index.html +15 -0
  309. package/dist/docs/markdown__demos.async.js +164 -0
  310. package/dist/docs/meta__components__en-US.async.js +9 -0
  311. package/dist/docs/meta__components__zh-CN.async.js +10 -0
  312. package/dist/docs/meta__docs__en-US.async.js +475 -0
  313. package/dist/docs/meta__docs__en-US.chunk.css +1 -0
  314. package/dist/docs/meta__docs__zh-CN.async.js +456 -0
  315. package/dist/docs/meta__docs__zh-CN.chunk.css +1 -0
  316. package/dist/docs/nm__dumi__dist__client__pages__404.async.js +1 -0
  317. package/dist/docs/nm__dumi__dist__client__pages__Demo__index.async.js +1 -0
  318. package/dist/docs/nm__dumi__dist__client__pages__Demo__index.chunk.css +1 -0
  319. package/dist/docs/preload_helper.js +1 -0
  320. package/dist/docs/sender__demos.async.js +1 -0
  321. package/dist/docs/umi.css +1 -0
  322. package/dist/docs/umi.js +107 -0
  323. package/dist/docs/welcome__demos.async.js +1 -0
  324. package/dist/docs/~demos/:id/index.html +15 -0
  325. package/dist/docs/~demos/accordion-demo-inline/index.html +15 -0
  326. package/dist/docs/~demos/accordion-demo-mutisteps/index.html +15 -0
  327. package/dist/docs/~demos/accordion-demo-thinking/index.html +15 -0
  328. package/dist/docs/~demos/attachments-demo-files/index.html +15 -0
  329. package/dist/docs/~demos/bubble-demo-basic/index.html +15 -0
  330. package/dist/docs/~demos/bubble-demo-havestopped/index.html +15 -0
  331. package/dist/docs/~demos/bubble-demo-userwithfile/index.html +15 -0
  332. package/dist/docs/~demos/bubble-demo-userwithimage/index.html +15 -0
  333. package/dist/docs/~demos/bubble-demo-userwithnormal/index.html +15 -0
  334. package/dist/docs/~demos/bubble-demo-withavatar/index.html +15 -0
  335. package/dist/docs/~demos/bubble-demo-withcode/index.html +15 -0
  336. package/dist/docs/~demos/bubble-demo-witherror/index.html +15 -0
  337. package/dist/docs/~demos/bubble-demo-witherrordetail/index.html +15 -0
  338. package/dist/docs/~demos/bubble-demo-withimage/index.html +15 -0
  339. package/dist/docs/~demos/bubble-demo-withusage/index.html +15 -0
  340. package/dist/docs/~demos/bubble-demo-withwaitingmessage/index.html +15 -0
  341. package/dist/docs/~demos/components-bubble-list-demo-basic/index.html +15 -0
  342. package/dist/docs/~demos/components-footer-demo-basic/index.html +15 -0
  343. package/dist/docs/~demos/components-footer-demo-withusage/index.html +15 -0
  344. package/dist/docs/~demos/components-status-demo-basic/index.html +15 -0
  345. package/dist/docs/~demos/conversations-demo-basic/index.html +15 -0
  346. package/dist/docs/~demos/disclaimer-demo-demo/index.html +15 -0
  347. package/dist/docs/~demos/disclaimer-demo-withlink/index.html +15 -0
  348. package/dist/docs/~demos/docs-development-ag-ui-demo-with-copilotkit/index.html +15 -0
  349. package/dist/docs/~demos/docs-development-cards-demo-file/index.html +15 -0
  350. package/dist/docs/~demos/docs-development-cards-demo-footer/index.html +15 -0
  351. package/dist/docs/~demos/docs-development-cards-demo-image/index.html +15 -0
  352. package/dist/docs/~demos/docs-development-cards-demo-text/index.html +15 -0
  353. package/dist/docs/~demos/docs-development-custom-demo-custom/index.html +15 -0
  354. package/dist/docs/~demos/docs-templates-copilot-demo-copilot/index.html +15 -0
  355. package/dist/docs/~demos/docs-templates-native-demo-basic/index.html +15 -0
  356. package/dist/docs/~demos/docs-templates-voice-demo-demo/index.html +15 -0
  357. package/dist/docs/~demos/markdown-demo-citations/index.html +15 -0
  358. package/dist/docs/~demos/markdown-demo-cursor/index.html +15 -0
  359. package/dist/docs/~demos/markdown-demo-mathjax/index.html +15 -0
  360. package/dist/docs/~demos/markdown-demo-md/index.html +15 -0
  361. package/dist/docs/~demos/sender-demo-basic/index.html +15 -0
  362. package/dist/docs/~demos/sender-demo-disabled/index.html +15 -0
  363. package/dist/docs/~demos/sender-demo-loading/index.html +15 -0
  364. package/dist/docs/~demos/sender-demo-moreprefixaction/index.html +15 -0
  365. package/dist/docs/~demos/sender-demo-withfile/index.html +15 -0
  366. package/dist/docs/~demos/welcome-demo-demo0/index.html +15 -0
  367. package/dist/docs/~demos/welcome-demo-demo1/index.html +15 -0
  368. package/dist/docs/~demos/welcome-demo-demo2/index.html +15 -0
  369. package/dist/index.d.ts +26 -0
  370. package/dist/index.js +20 -0
  371. package/dist/index.less +1 -0
  372. package/dist/markdown/Citation.d.ts +16 -0
  373. package/dist/markdown/Citation.js +55 -0
  374. package/dist/markdown/CodeBlock.d.ts +6 -0
  375. package/dist/markdown/CodeBlock.js +88 -0
  376. package/dist/markdown/ImageOrVideo.d.ts +2 -0
  377. package/dist/markdown/ImageOrVideo.js +81 -0
  378. package/dist/markdown/Link.d.ts +3 -0
  379. package/dist/markdown/Link.js +28 -0
  380. package/dist/markdown/Markdown.d.ts +4 -0
  381. package/dist/markdown/Markdown.js +121 -0
  382. package/dist/markdown/cursor/Blur.d.ts +3 -0
  383. package/dist/markdown/cursor/Blur.js +7 -0
  384. package/dist/markdown/cursor/Dot.d.ts +3 -0
  385. package/dist/markdown/cursor/Dot.js +16 -0
  386. package/dist/markdown/cursor/Underline.d.ts +3 -0
  387. package/dist/markdown/cursor/Underline.js +7 -0
  388. package/dist/markdown/cursor/index.less +124 -0
  389. package/dist/markdown/hooks/index.d.ts +1 -0
  390. package/dist/markdown/hooks/index.js +49 -0
  391. package/dist/markdown/hooks/useTypedEffect.d.ts +6 -0
  392. package/dist/markdown/hooks/useTypedEffect.js +56 -0
  393. package/dist/markdown/index.d.ts +16 -0
  394. package/dist/markdown/index.js +37 -0
  395. package/dist/markdown/index.less +204 -0
  396. package/dist/markdown/plugins/footnote.d.ts +2 -0
  397. package/dist/markdown/plugins/footnote.js +89 -0
  398. package/dist/markdown/plugins/katexDir.d.ts +1 -0
  399. package/dist/markdown/plugins/katexDir.js +15 -0
  400. package/dist/markdown/rehype/fadeIn.d.ts +2 -0
  401. package/dist/markdown/rehype/fadeIn.js +43 -0
  402. package/dist/markdown/type.d.ts +46 -0
  403. package/dist/markdown/type.js +1 -0
  404. package/dist/markdown/utils.d.ts +22 -0
  405. package/dist/markdown/utils.js +125 -0
  406. package/dist/provider/CustomCardsProvider.d.ts +15 -0
  407. package/dist/provider/CustomCardsProvider.js +18 -0
  408. package/dist/provider/GlobalProvider.d.ts +5 -0
  409. package/dist/provider/GlobalProvider.js +11 -0
  410. package/dist/provider/index.d.ts +8 -0
  411. package/dist/provider/index.js +20 -0
  412. package/dist/provider/types.d.ts +8 -0
  413. package/dist/provider/types.js +1 -0
  414. package/dist/sender/SenderHeader.d.ts +19 -0
  415. package/dist/sender/SenderHeader.js +79 -0
  416. package/dist/sender/StopLoading.d.ts +5 -0
  417. package/dist/sender/StopLoading.js +20 -0
  418. package/dist/sender/components/ActionButton.d.ts +22 -0
  419. package/dist/sender/components/ActionButton.js +39 -0
  420. package/dist/sender/components/ClearButton.d.ts +4 -0
  421. package/dist/sender/components/ClearButton.js +13 -0
  422. package/dist/sender/components/LoadingButton.d.ts +4 -0
  423. package/dist/sender/components/LoadingButton.js +22 -0
  424. package/dist/sender/components/SendButton.d.ts +4 -0
  425. package/dist/sender/components/SendButton.js +14 -0
  426. package/dist/sender/components/SpeechButton/RecordingIcon.d.ts +5 -0
  427. package/dist/sender/components/SpeechButton/RecordingIcon.js +49 -0
  428. package/dist/sender/components/SpeechButton/index.d.ts +4 -0
  429. package/dist/sender/components/SpeechButton/index.js +30 -0
  430. package/dist/sender/index.d.ts +61 -0
  431. package/dist/sender/index.js +307 -0
  432. package/dist/sender/style/header.d.ts +4 -0
  433. package/dist/sender/style/header.js +46 -0
  434. package/dist/sender/style/index.d.ts +10 -0
  435. package/dist/sender/style/index.js +123 -0
  436. package/dist/sender/useSpeech.d.ts +6 -0
  437. package/dist/sender/useSpeech.js +114 -0
  438. package/dist/stream/index.d.ts +34 -0
  439. package/dist/stream/index.en-US.md.bk +50 -0
  440. package/dist/stream/index.js +197 -0
  441. package/dist/stream/index.zh-CN.md.bk +51 -0
  442. package/dist/theme/components.d.ts +10 -0
  443. package/dist/theme/components.js +1 -0
  444. package/dist/theme/cssinjs-utils.d.ts +14 -0
  445. package/dist/theme/cssinjs-utils.js +1 -0
  446. package/dist/theme/genStyleUtils.d.ts +28 -0
  447. package/dist/theme/genStyleUtils.js +49 -0
  448. package/dist/theme/useToken.d.ts +18 -0
  449. package/dist/theme/useToken.js +110 -0
  450. package/dist/version/index.d.ts +2 -0
  451. package/dist/version/index.js +2 -0
  452. package/dist/voice-chat/Recorder/index.d.ts +26 -0
  453. package/dist/voice-chat/Recorder/index.js +168 -0
  454. package/dist/voice-chat/VoiceChatProvider/context.d.ts +22 -0
  455. package/dist/voice-chat/VoiceChatProvider/context.js +3 -0
  456. package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.d.ts +1 -0
  457. package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.js +5 -0
  458. package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.d.ts +8 -0
  459. package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.js +31 -0
  460. package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.d.ts +5 -0
  461. package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.js +48 -0
  462. package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.d.ts +4 -0
  463. package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.js +10 -0
  464. package/dist/voice-chat/VoiceChatProvider/index.d.ts +9 -0
  465. package/dist/voice-chat/VoiceChatProvider/index.js +55 -0
  466. package/dist/voice-chat/VoiceChatService/index.d.ts +34 -0
  467. package/dist/voice-chat/VoiceChatService/index.js +209 -0
  468. package/dist/voice-chat/index.d.ts +2 -0
  469. package/dist/voice-chat/index.js +2 -0
  470. package/dist/voice-chat/types/index.d.ts +12 -0
  471. package/dist/voice-chat/types/index.js +4 -0
  472. package/dist/welcome/icon.d.ts +2 -0
  473. package/dist/welcome/icon.js +38 -0
  474. package/dist/welcome/index.d.ts +9 -0
  475. package/dist/welcome/index.js +57 -0
  476. package/package.json +117 -0
@@ -0,0 +1,87 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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); }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import classnames from 'classnames';
12
+ import React from 'react';
13
+ import { createPortal } from 'react-dom';
14
+ import { AttachmentContext } from "./context";
15
+ export default function DropArea(props) {
16
+ var getDropContainer = props.getDropContainer,
17
+ className = props.className,
18
+ prefixCls = props.prefixCls,
19
+ children = props.children;
20
+ var _React$useContext = React.useContext(AttachmentContext),
21
+ disabled = _React$useContext.disabled;
22
+ var _React$useState = React.useState(),
23
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24
+ container = _React$useState2[0],
25
+ setContainer = _React$useState2[1];
26
+ var _React$useState3 = React.useState(null),
27
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
28
+ showArea = _React$useState4[0],
29
+ setShowArea = _React$useState4[1];
30
+
31
+ // ========================== Container ===========================
32
+ React.useEffect(function () {
33
+ var nextContainer = getDropContainer === null || getDropContainer === void 0 ? void 0 : getDropContainer();
34
+ if (container !== nextContainer) {
35
+ setContainer(nextContainer);
36
+ }
37
+ }, [getDropContainer]);
38
+
39
+ // ============================= Drop =============================
40
+ React.useEffect(function () {
41
+ // Add global drop event
42
+ if (container) {
43
+ var onDragEnter = function onDragEnter() {
44
+ setShowArea(true);
45
+ };
46
+
47
+ // Should prevent default to make drop event work
48
+ var onDragOver = function onDragOver(e) {
49
+ e.preventDefault();
50
+ };
51
+ var onDragLeave = function onDragLeave(e) {
52
+ if (!e.relatedTarget) {
53
+ setShowArea(false);
54
+ }
55
+ };
56
+ var onDrop = function onDrop(e) {
57
+ setShowArea(false);
58
+ e.preventDefault();
59
+ };
60
+ document.addEventListener('dragenter', onDragEnter);
61
+ document.addEventListener('dragover', onDragOver);
62
+ document.addEventListener('dragleave', onDragLeave);
63
+ document.addEventListener('drop', onDrop);
64
+ return function () {
65
+ document.removeEventListener('dragenter', onDragEnter);
66
+ document.removeEventListener('dragover', onDragOver);
67
+ document.removeEventListener('dragleave', onDragLeave);
68
+ document.removeEventListener('drop', onDrop);
69
+ };
70
+ }
71
+ }, [!!container]);
72
+
73
+ // =========================== Visible ============================
74
+ var showDropdown = getDropContainer && container && !disabled;
75
+
76
+ // ============================ Render ============================
77
+ if (!showDropdown) {
78
+ return null;
79
+ }
80
+ var areaCls = "".concat(prefixCls, "-drop-area");
81
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
82
+ className: classnames(areaCls, className, _defineProperty({}, "".concat(areaCls, "-on-body"), container.tagName === 'BODY')),
83
+ style: {
84
+ display: showArea ? 'block' : 'none'
85
+ }
86
+ }, children), container);
87
+ }
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function AudioIcon(): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export default function AudioIcon() {
3
+ return /*#__PURE__*/React.createElement("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ viewBox: "0 0 16 16",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ xmlnsXlink: "http://www.w3.org/1999/xlink"
10
+ }, /*#__PURE__*/React.createElement("title", null, "audio"), /*#__PURE__*/React.createElement("g", {
11
+ stroke: "none",
12
+ "stroke-width": "1",
13
+ fill: "none",
14
+ "fill-rule": "evenodd"
15
+ }, /*#__PURE__*/React.createElement("path", {
16
+ d: "M14.1178571,4.0125 C14.225,4.11964286 14.2857143,4.26428571 14.2857143,4.41607143 L14.2857143,15.4285714 C14.2857143,15.7446429 14.0303571,16 13.7142857,16 L2.28571429,16 C1.96964286,16 1.71428571,15.7446429 1.71428571,15.4285714 L1.71428571,0.571428571 C1.71428571,0.255357143 1.96964286,0 2.28571429,0 L9.86964286,0 C10.0214286,0 10.1678571,0.0607142857 10.275,0.167857143 L14.1178571,4.0125 Z M10.7315824,7.11216117 C10.7428131,7.15148751 10.7485063,7.19218979 10.7485063,7.23309113 L10.7485063,8.07742614 C10.7484199,8.27364959 10.6183424,8.44607275 10.4296853,8.50003683 L8.32984514,9.09986306 L8.32984514,11.7071803 C8.32986605,12.5367078 7.67249692,13.217028 6.84345686,13.2454634 L6.79068592,13.2463395 C6.12766108,13.2463395 5.53916361,12.8217001 5.33010655,12.1924966 C5.1210495,11.563293 5.33842118,10.8709227 5.86959669,10.4741173 C6.40077221,10.0773119 7.12636292,10.0652587 7.67042486,10.4442027 L7.67020842,7.74937024 L7.68449368,7.74937024 C7.72405122,7.59919041 7.83988806,7.48101083 7.98924584,7.4384546 L10.1880418,6.81004755 C10.42156,6.74340323 10.6648954,6.87865515 10.7315824,7.11216117 Z M9.60714286,1.31785714 L12.9678571,4.67857143 L9.60714286,4.67857143 L9.60714286,1.31785714 Z",
17
+ fill: "currentColor"
18
+ })));
19
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { Attachment } from '..';
3
+ export interface FileListCardProps {
4
+ prefixCls?: string;
5
+ item: Attachment;
6
+ onRemove?: (item: Attachment) => void;
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ renderType?: 'default';
10
+ }
11
+ declare const _default: React.ForwardRefExoticComponent<FileListCardProps & React.RefAttributes<HTMLDivElement>>;
12
+ export default _default;
@@ -0,0 +1,229 @@
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
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
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 { CloseOutlined, FileExcelFilled, FileImageFilled, FileMarkdownFilled, FilePdfFilled, FilePptFilled, FileTextFilled, FileWordFilled, FileZipFilled } from '@ant-design/icons';
13
+ import classnames from 'classnames';
14
+ import React from 'react';
15
+ import { useProviderContext } from "../..";
16
+ import { AttachmentContext } from "../context";
17
+ import useStyle from "../style";
18
+ import { previewImage } from "../util";
19
+ import AudioIcon from "./AudioIcon";
20
+ import Progress from "./Progress";
21
+ import VideoIcon from "./VideoIcon";
22
+ var EMPTY = "\xA0";
23
+ var DEFAULT_ICON_COLOR = '#8c8c8c';
24
+ var IMG_EXTS = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp', 'svg'];
25
+ var PRESET_FILE_ICONS = [{
26
+ icon: /*#__PURE__*/React.createElement(FileExcelFilled, null),
27
+ color: '#22b35e',
28
+ ext: ['xlsx', 'xls']
29
+ }, {
30
+ icon: /*#__PURE__*/React.createElement(FileImageFilled, null),
31
+ color: DEFAULT_ICON_COLOR,
32
+ ext: IMG_EXTS
33
+ }, {
34
+ icon: /*#__PURE__*/React.createElement(FileMarkdownFilled, null),
35
+ color: DEFAULT_ICON_COLOR,
36
+ ext: ['md', 'mdx']
37
+ }, {
38
+ icon: /*#__PURE__*/React.createElement(FilePdfFilled, null),
39
+ color: '#ff4d4f',
40
+ ext: ['pdf']
41
+ }, {
42
+ icon: /*#__PURE__*/React.createElement(FilePptFilled, null),
43
+ color: '#ff6e31',
44
+ ext: ['ppt', 'pptx']
45
+ }, {
46
+ icon: /*#__PURE__*/React.createElement(FileWordFilled, null),
47
+ color: '#1677ff',
48
+ ext: ['doc', 'docx']
49
+ }, {
50
+ icon: /*#__PURE__*/React.createElement(FileZipFilled, null),
51
+ color: '#fab714',
52
+ ext: ['zip', 'rar', '7z', 'tar', 'gz']
53
+ }, {
54
+ icon: /*#__PURE__*/React.createElement(VideoIcon, null),
55
+ color: '#ff4d4f',
56
+ ext: ['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv']
57
+ }, {
58
+ icon: /*#__PURE__*/React.createElement(AudioIcon, null),
59
+ color: '#8c8c8c',
60
+ ext: ['mp3', 'wav', 'flac', 'ape', 'aac', 'ogg']
61
+ }];
62
+ function matchExt(suffix, ext) {
63
+ return ext.some(function (e) {
64
+ return suffix.toLowerCase() === ".".concat(e);
65
+ });
66
+ }
67
+ function getSize(size) {
68
+ var retSize = size;
69
+ var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
70
+ var unitIndex = 0;
71
+ while (retSize >= 1024 && unitIndex < units.length - 1) {
72
+ retSize /= 1024;
73
+ unitIndex++;
74
+ }
75
+ return "".concat(retSize.toFixed(0), " ").concat(units[unitIndex]);
76
+ }
77
+ function FileListCard(props, ref) {
78
+ var customizePrefixCls = props.prefixCls,
79
+ item = props.item,
80
+ onRemove = props.onRemove,
81
+ className = props.className,
82
+ style = props.style;
83
+ var context = React.useContext(AttachmentContext);
84
+ var _ref = context || {},
85
+ disabled = _ref.disabled;
86
+ var name = item.name,
87
+ size = item.size,
88
+ percent = item.percent,
89
+ _item$status = item.status,
90
+ status = _item$status === void 0 ? 'done' : _item$status,
91
+ description = item.description;
92
+
93
+ // ============================= Prefix =============================
94
+ var _useProviderContext = useProviderContext(),
95
+ getPrefixCls = _useProviderContext.getPrefixCls;
96
+ var prefixCls = getPrefixCls('attachment', customizePrefixCls);
97
+ var cardCls = "".concat(prefixCls, "-list-card");
98
+
99
+ // ============================= Style ==============================
100
+ var _useStyle = useStyle(prefixCls),
101
+ _useStyle2 = _slicedToArray(_useStyle, 3),
102
+ wrapCSSVar = _useStyle2[0],
103
+ hashId = _useStyle2[1],
104
+ cssVarCls = _useStyle2[2];
105
+
106
+ // ============================== Name ==============================
107
+ var _React$useMemo = React.useMemo(function () {
108
+ var nameStr = name || '';
109
+ var match = nameStr.match(/^(.*)\.[^.]+$/);
110
+ return match ? [match[1], nameStr.slice(match[1].length)] : [nameStr, ''];
111
+ }, [name]),
112
+ _React$useMemo2 = _slicedToArray(_React$useMemo, 2),
113
+ namePrefix = _React$useMemo2[0],
114
+ nameSuffix = _React$useMemo2[1];
115
+ var isImg = React.useMemo(function () {
116
+ return matchExt(nameSuffix, IMG_EXTS);
117
+ }, [nameSuffix]);
118
+
119
+ // ============================== Desc ==============================
120
+ var desc = React.useMemo(function () {
121
+ if (description) {
122
+ return description;
123
+ }
124
+ if (status === 'uploading') {
125
+ return "".concat(percent || 0, "%");
126
+ }
127
+ if (status === 'error') {
128
+ return item.response || EMPTY;
129
+ }
130
+ return size ? getSize(size) : EMPTY;
131
+ }, [status, percent]);
132
+
133
+ // ============================== Icon ==============================
134
+ var _React$useMemo3 = React.useMemo(function () {
135
+ var _iterator = _createForOfIteratorHelper(PRESET_FILE_ICONS),
136
+ _step;
137
+ try {
138
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
139
+ var _step$value = _step.value,
140
+ ext = _step$value.ext,
141
+ _icon = _step$value.icon,
142
+ color = _step$value.color;
143
+ if (matchExt(nameSuffix, ext)) {
144
+ return [_icon, color];
145
+ }
146
+ }
147
+ } catch (err) {
148
+ _iterator.e(err);
149
+ } finally {
150
+ _iterator.f();
151
+ }
152
+ return [/*#__PURE__*/React.createElement(FileTextFilled, {
153
+ key: "defaultIcon"
154
+ }), DEFAULT_ICON_COLOR];
155
+ }, [nameSuffix]),
156
+ _React$useMemo4 = _slicedToArray(_React$useMemo3, 2),
157
+ icon = _React$useMemo4[0],
158
+ iconColor = _React$useMemo4[1];
159
+
160
+ // ========================== ImagePreview ==========================
161
+ var _React$useState = React.useState(),
162
+ _React$useState2 = _slicedToArray(_React$useState, 2),
163
+ previewImg = _React$useState2[0],
164
+ setPreviewImg = _React$useState2[1];
165
+ React.useEffect(function () {
166
+ if (item.originFileObj) {
167
+ var synced = true;
168
+ previewImage(item.originFileObj).then(function (url) {
169
+ if (synced) {
170
+ setPreviewImg(url);
171
+ }
172
+ });
173
+ return function () {
174
+ synced = false;
175
+ };
176
+ }
177
+ setPreviewImg(undefined);
178
+ }, [item.originFileObj]);
179
+
180
+ // ============================= Render =============================
181
+ var content = null;
182
+ var previewUrl = item.thumbUrl || item.url || previewImg;
183
+ var renderType = props.renderType || 'default';
184
+ var isImgPreview = isImg && (item.originFileObj || previewUrl) && renderType === 'default';
185
+ if (isImgPreview) {
186
+ // Preview Image style
187
+ content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("img", {
188
+ alt: "preview",
189
+ src: previewUrl
190
+ }), status !== 'done' && /*#__PURE__*/React.createElement("div", {
191
+ className: "".concat(cardCls, "-img-mask")
192
+ }, status === 'uploading' && percent !== undefined && /*#__PURE__*/React.createElement(Progress, {
193
+ percent: percent,
194
+ prefixCls: cardCls
195
+ }), status === 'error' && /*#__PURE__*/React.createElement("div", {
196
+ className: "".concat(cardCls, "-desc")
197
+ }, /*#__PURE__*/React.createElement("div", {
198
+ className: "".concat(cardCls, "-ellipsis-prefix")
199
+ }, desc))));
200
+ } else {
201
+ // Preview Card style
202
+ content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
203
+ className: "".concat(cardCls, "-icon"),
204
+ style: {
205
+ color: iconColor
206
+ }
207
+ }, icon), /*#__PURE__*/React.createElement("div", {
208
+ className: "".concat(cardCls, "-content")
209
+ }, /*#__PURE__*/React.createElement("div", {
210
+ className: "".concat(cardCls, "-name")
211
+ }, namePrefix !== null && namePrefix !== void 0 ? namePrefix : EMPTY, nameSuffix), /*#__PURE__*/React.createElement("div", {
212
+ className: "".concat(cardCls, "-desc")
213
+ }, /*#__PURE__*/React.createElement("div", {
214
+ className: "".concat(cardCls, "-ellipsis-prefix")
215
+ }, desc))));
216
+ }
217
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
218
+ className: classnames(cardCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(cardCls, "-status-").concat(status), status), "".concat(cardCls, "-type-preview"), isImgPreview), "".concat(cardCls, "-type-overview"), !isImgPreview), "".concat(cardCls, "-type-").concat(renderType), true), "".concat(cardCls, "-hoverable"), !disabled && onRemove), className, hashId, cssVarCls),
219
+ style: style,
220
+ ref: ref
221
+ }, content, !disabled && onRemove && /*#__PURE__*/React.createElement("button", {
222
+ type: "button",
223
+ className: "".concat(cardCls, "-remove"),
224
+ onClick: function onClick() {
225
+ onRemove(item);
226
+ }
227
+ }, /*#__PURE__*/React.createElement(CloseOutlined, null))));
228
+ }
229
+ export default /*#__PURE__*/React.forwardRef(FileListCard);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface ProgressProps {
3
+ prefixCls: string;
4
+ percent: number;
5
+ }
6
+ export default function Progress(props: ProgressProps): React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { Progress as AntdProgress, theme } from 'antd';
2
+ import React from 'react';
3
+ export default function Progress(props) {
4
+ var percent = props.percent;
5
+ var _theme$useToken = theme.useToken(),
6
+ token = _theme$useToken.token;
7
+ return /*#__PURE__*/React.createElement(AntdProgress, {
8
+ type: "circle",
9
+ percent: percent,
10
+ size: token.fontSizeHeading2 * 2,
11
+ strokeColor: "#FFF",
12
+ trailColor: "rgba(255, 255, 255, 0.3)",
13
+ format: function format(ptg) {
14
+ return /*#__PURE__*/React.createElement("span", {
15
+ style: {
16
+ color: '#FFF'
17
+ }
18
+ }, (ptg || 0).toFixed(0), "%");
19
+ }
20
+ });
21
+ }
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function VideoIcon(): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export default function VideoIcon() {
3
+ return /*#__PURE__*/React.createElement("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ viewBox: "0 0 16 16",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ xmlnsXlink: "http://www.w3.org/1999/xlink"
10
+ }, /*#__PURE__*/React.createElement("title", null, "video"), /*#__PURE__*/React.createElement("g", {
11
+ stroke: "none",
12
+ "stroke-width": "1",
13
+ fill: "none",
14
+ "fill-rule": "evenodd"
15
+ }, /*#__PURE__*/React.createElement("path", {
16
+ d: "M14.1178571,4.0125 C14.225,4.11964286 14.2857143,4.26428571 14.2857143,4.41607143 L14.2857143,15.4285714 C14.2857143,15.7446429 14.0303571,16 13.7142857,16 L2.28571429,16 C1.96964286,16 1.71428571,15.7446429 1.71428571,15.4285714 L1.71428571,0.571428571 C1.71428571,0.255357143 1.96964286,0 2.28571429,0 L9.86964286,0 C10.0214286,0 10.1678571,0.0607142857 10.275,0.167857143 L14.1178571,4.0125 Z M12.9678571,4.67857143 L9.60714286,1.31785714 L9.60714286,4.67857143 L12.9678571,4.67857143 Z M10.5379461,10.3101106 L6.68957555,13.0059749 C6.59910784,13.0693494 6.47439406,13.0473861 6.41101953,12.9569184 C6.3874624,12.9232903 6.37482581,12.8832269 6.37482581,12.8421686 L6.37482581,7.45043999 C6.37482581,7.33998304 6.46436886,7.25043999 6.57482581,7.25043999 C6.61588409,7.25043999 6.65594753,7.26307658 6.68957555,7.28663371 L10.5379461,9.98249803 C10.6284138,10.0458726 10.6503772,10.1705863 10.5870027,10.2610541 C10.5736331,10.2801392 10.5570312,10.2967411 10.5379461,10.3101106 Z",
17
+ fill: "currentColor"
18
+ })));
19
+ }
@@ -0,0 +1,16 @@
1
+ import { type UploadProps } from 'antd';
2
+ import React from 'react';
3
+ import type { Attachment } from '..';
4
+ export interface FileListProps {
5
+ prefixCls: string;
6
+ items: Attachment[];
7
+ onRemove: (item: Attachment) => void;
8
+ overflow?: 'scrollX' | 'scrollY' | 'wrap';
9
+ upload: UploadProps;
10
+ listClassName?: string;
11
+ listStyle?: React.CSSProperties;
12
+ itemClassName?: string;
13
+ itemStyle?: React.CSSProperties;
14
+ renderType?: 'default';
15
+ }
16
+ export default function FileList(props: FileListProps): React.JSX.Element;
@@ -0,0 +1,132 @@
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 { LeftOutlined, RightOutlined } from '@ant-design/icons';
14
+ import { Button } from 'antd';
15
+ import classnames from 'classnames';
16
+ import { CSSMotionList } from 'rc-motion';
17
+ import React from 'react';
18
+ import { AttachmentContext } from "../context";
19
+ import FileListCard from "./FileListCard";
20
+ var TOLERANCE = 1;
21
+ export default function FileList(props) {
22
+ var prefixCls = props.prefixCls,
23
+ items = props.items,
24
+ onRemove = props.onRemove,
25
+ overflow = props.overflow,
26
+ upload = props.upload,
27
+ listClassName = props.listClassName,
28
+ listStyle = props.listStyle,
29
+ itemClassName = props.itemClassName,
30
+ itemStyle = props.itemStyle;
31
+ var listCls = "".concat(prefixCls, "-list");
32
+ var containerRef = React.useRef(null);
33
+ var _React$useState = React.useState(false),
34
+ _React$useState2 = _slicedToArray(_React$useState, 2),
35
+ firstMount = _React$useState2[0],
36
+ setFirstMount = _React$useState2[1];
37
+ var _React$useContext = React.useContext(AttachmentContext),
38
+ disabled = _React$useContext.disabled;
39
+ React.useEffect(function () {
40
+ setFirstMount(true);
41
+ return function () {
42
+ setFirstMount(false);
43
+ };
44
+ }, []);
45
+
46
+ // ================================= Scroll =================================
47
+ var _React$useState3 = React.useState(false),
48
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
49
+ pingStart = _React$useState4[0],
50
+ setPingStart = _React$useState4[1];
51
+ var _React$useState5 = React.useState(false),
52
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
53
+ pingEnd = _React$useState6[0],
54
+ setPingEnd = _React$useState6[1];
55
+ var checkPing = function checkPing() {
56
+ var containerEle = containerRef.current;
57
+ if (!containerEle) {
58
+ return;
59
+ }
60
+ if (overflow === 'scrollX') {
61
+ setPingStart(Math.abs(containerEle.scrollLeft) >= TOLERANCE);
62
+ setPingEnd(containerEle.scrollWidth - containerEle.clientWidth - Math.abs(containerEle.scrollLeft) >= TOLERANCE);
63
+ } else if (overflow === 'scrollY') {
64
+ setPingStart(containerEle.scrollTop !== 0);
65
+ setPingEnd(containerEle.scrollHeight - containerEle.clientHeight !== containerEle.scrollTop);
66
+ }
67
+ };
68
+ React.useEffect(function () {
69
+ checkPing();
70
+ }, [overflow]);
71
+ var onScrollOffset = function onScrollOffset(offset) {
72
+ var containerEle = containerRef.current;
73
+ if (containerEle) {
74
+ containerEle.scrollTo({
75
+ left: containerEle.scrollLeft + offset * containerEle.clientWidth,
76
+ behavior: 'smooth'
77
+ });
78
+ }
79
+ };
80
+ var onScrollLeft = function onScrollLeft() {
81
+ onScrollOffset(-1);
82
+ };
83
+ var onScrollRight = function onScrollRight() {
84
+ onScrollOffset(1);
85
+ };
86
+
87
+ // ================================= Render =================================
88
+ return /*#__PURE__*/React.createElement("div", {
89
+ className: classnames(listCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(listCls, "-overflow-").concat(props.overflow), overflow), "".concat(listCls, "-overflow-ping-start"), pingStart), "".concat(listCls, "-overflow-ping-end"), pingEnd), listClassName),
90
+ ref: containerRef,
91
+ onScroll: checkPing,
92
+ style: listStyle
93
+ }, /*#__PURE__*/React.createElement(CSSMotionList, {
94
+ keys: items.map(function (item) {
95
+ return {
96
+ key: item.uid,
97
+ item: item
98
+ };
99
+ }),
100
+ motionName: "".concat(listCls, "-card-motion"),
101
+ component: false,
102
+ motionAppear: firstMount,
103
+ motionLeave: true,
104
+ motionEnter: true
105
+ }, function (_ref) {
106
+ var key = _ref.key,
107
+ item = _ref.item,
108
+ motionCls = _ref.className,
109
+ motionStyle = _ref.style;
110
+ return /*#__PURE__*/React.createElement(FileListCard, {
111
+ key: key,
112
+ prefixCls: prefixCls,
113
+ item: item,
114
+ onRemove: onRemove,
115
+ className: classnames(motionCls, itemClassName),
116
+ style: _objectSpread(_objectSpread({}, motionStyle), itemStyle),
117
+ renderType: props.renderType
118
+ });
119
+ }), overflow === 'scrollX' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
120
+ size: "small",
121
+ shape: "circle",
122
+ className: "".concat(listCls, "-prev-btn"),
123
+ icon: /*#__PURE__*/React.createElement(LeftOutlined, null),
124
+ onClick: onScrollLeft
125
+ }), /*#__PURE__*/React.createElement(Button, {
126
+ size: "small",
127
+ shape: "circle",
128
+ className: "".concat(listCls, "-next-btn"),
129
+ icon: /*#__PURE__*/React.createElement(RightOutlined, null),
130
+ onClick: onScrollRight
131
+ })));
132
+ }
@@ -0,0 +1,17 @@
1
+ import { type UploadProps } from 'antd';
2
+ import React from 'react';
3
+ export interface PlaceholderConfig {
4
+ icon?: React.ReactNode;
5
+ title?: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ }
8
+ export type PlaceholderType = PlaceholderConfig | React.ReactElement;
9
+ export interface PlaceholderProps {
10
+ prefixCls: string;
11
+ placeholder?: PlaceholderType;
12
+ upload?: UploadProps;
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ }
16
+ declare const _default: React.ForwardRefExoticComponent<PlaceholderProps & React.RefAttributes<import("antd/es/upload/Upload").UploadRef<any>>>;
17
+ export default _default;