cd-aichat 1.0.0

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 (356) hide show
  1. package/README.md +188 -0
  2. package/dist/ailogo.png +0 -0
  3. package/dist/cd-aichat.css +1 -0
  4. package/dist/cd-aichat.es.js +32223 -0
  5. package/dist/cd-aichat.umd.js +279 -0
  6. package/dist/index.css +1 -0
  7. package/package.json +61 -0
  8. package/src/ailogo.png +0 -0
  9. package/src/components/AiChat.test.js +538 -0
  10. package/src/components/AiChat.vue +2206 -0
  11. package/src/components/AiChatWidget.test.js +312 -0
  12. package/src/components/AiChatWidget.vue +963 -0
  13. package/src/components/BurnAfterReadDialog.test.js +121 -0
  14. package/src/components/BurnAfterReadDialog.vue +511 -0
  15. package/src/components/BurnAfterReadMessage.test.js +188 -0
  16. package/src/components/BurnAfterReadMessage.vue +193 -0
  17. package/src/components/BurnIndicator.test.js +101 -0
  18. package/src/components/BurnIndicator.vue +164 -0
  19. package/src/components/ChatWindow.vue +0 -0
  20. package/src/components/MentionList.vue +163 -0
  21. package/src/components/ResourceList.vue +194 -0
  22. package/src/components/RichTextEditor.vue +437 -0
  23. package/src/components/ScheduledSendDialog.vue +476 -0
  24. package/src/components/ScreenshotOverlay.vue +78 -0
  25. package/src/components/SendButtonGroup.test.js +174 -0
  26. package/src/components/SendButtonGroup.vue +166 -0
  27. package/src/components/UserDrawer.vue +0 -0
  28. package/src/components/screenshot/ScreenshotsBackground/getBoundsByPoints.ts +41 -0
  29. package/src/components/screenshot/ScreenshotsBackground/index.scss +27 -0
  30. package/src/components/screenshot/ScreenshotsBackground/index.tsx +145 -0
  31. package/src/components/screenshot/ScreenshotsButton/index.scss +29 -0
  32. package/src/components/screenshot/ScreenshotsButton/index.tsx +58 -0
  33. package/src/components/screenshot/ScreenshotsCanvas/getBoundsByPoints.ts +55 -0
  34. package/src/components/screenshot/ScreenshotsCanvas/getPoints.ts +60 -0
  35. package/src/components/screenshot/ScreenshotsCanvas/index.scss +84 -0
  36. package/src/components/screenshot/ScreenshotsCanvas/index.tsx +277 -0
  37. package/src/components/screenshot/ScreenshotsCanvas/isPointInDraw.ts +35 -0
  38. package/src/components/screenshot/ScreenshotsColor/index.scss +45 -0
  39. package/src/components/screenshot/ScreenshotsColor/index.tsx +39 -0
  40. package/src/components/screenshot/ScreenshotsContext.ts +56 -0
  41. package/src/components/screenshot/ScreenshotsMagnifier/index.scss +61 -0
  42. package/src/components/screenshot/ScreenshotsMagnifier/index.tsx +126 -0
  43. package/src/components/screenshot/ScreenshotsOperations/index.scss +25 -0
  44. package/src/components/screenshot/ScreenshotsOperations/index.tsx +118 -0
  45. package/src/components/screenshot/ScreenshotsOption/index.scss +50 -0
  46. package/src/components/screenshot/ScreenshotsOption/index.tsx +150 -0
  47. package/src/components/screenshot/ScreenshotsSize/index.scss +28 -0
  48. package/src/components/screenshot/ScreenshotsSize/index.tsx +41 -0
  49. package/src/components/screenshot/ScreenshotsSizeColor/index.scss +8 -0
  50. package/src/components/screenshot/ScreenshotsSizeColor/index.tsx +25 -0
  51. package/src/components/screenshot/ScreenshotsTextarea/calculateNodeSize.ts +117 -0
  52. package/src/components/screenshot/ScreenshotsTextarea/index.scss +19 -0
  53. package/src/components/screenshot/ScreenshotsTextarea/index.tsx +96 -0
  54. package/src/components/screenshot/composeImage.ts +57 -0
  55. package/src/components/screenshot/exports.ts +4 -0
  56. package/src/components/screenshot/hooks/useBounds.ts +35 -0
  57. package/src/components/screenshot/hooks/useCall.ts +17 -0
  58. package/src/components/screenshot/hooks/useCanvasContextRef.ts +8 -0
  59. package/src/components/screenshot/hooks/useCanvasMousedown.ts +13 -0
  60. package/src/components/screenshot/hooks/useCanvasMousemove.ts +13 -0
  61. package/src/components/screenshot/hooks/useCanvasMouseup.ts +13 -0
  62. package/src/components/screenshot/hooks/useCursor.ts +34 -0
  63. package/src/components/screenshot/hooks/useDispatcher.ts +8 -0
  64. package/src/components/screenshot/hooks/useDrawSelect.ts +16 -0
  65. package/src/components/screenshot/hooks/useEmiter.ts +61 -0
  66. package/src/components/screenshot/hooks/useHistory.ts +160 -0
  67. package/src/components/screenshot/hooks/useLang.ts +8 -0
  68. package/src/components/screenshot/hooks/useOperation.ts +37 -0
  69. package/src/components/screenshot/hooks/useReset.ts +26 -0
  70. package/src/components/screenshot/hooks/useStore.ts +8 -0
  71. package/src/components/screenshot/icons/iconfont.scss +88 -0
  72. package/src/components/screenshot/icons/iconfont.ttf +0 -0
  73. package/src/components/screenshot/icons/iconfont.woff +0 -0
  74. package/src/components/screenshot/icons/iconfont.woff2 +0 -0
  75. package/src/components/screenshot/index.tsx +169 -0
  76. package/src/components/screenshot/operations/Arrow/draw.ts +56 -0
  77. package/src/components/screenshot/operations/Arrow/index.tsx +193 -0
  78. package/src/components/screenshot/operations/Brush/draw.ts +45 -0
  79. package/src/components/screenshot/operations/Brush/index.tsx +169 -0
  80. package/src/components/screenshot/operations/Cancel/index.tsx +18 -0
  81. package/src/components/screenshot/operations/Ellipse/draw.ts +96 -0
  82. package/src/components/screenshot/operations/Ellipse/index.tsx +245 -0
  83. package/src/components/screenshot/operations/Mosaic/index.tsx +223 -0
  84. package/src/components/screenshot/operations/Ok/index.tsx +37 -0
  85. package/src/components/screenshot/operations/Pin/index.tsx +37 -0
  86. package/src/components/screenshot/operations/Rectangle/draw.ts +80 -0
  87. package/src/components/screenshot/operations/Rectangle/index.tsx +245 -0
  88. package/src/components/screenshot/operations/Redo/index.tsx +22 -0
  89. package/src/components/screenshot/operations/Save/index.tsx +37 -0
  90. package/src/components/screenshot/operations/Scan/index.tsx +46 -0
  91. package/src/components/screenshot/operations/Search/index.tsx +39 -0
  92. package/src/components/screenshot/operations/Text/index.tsx +307 -0
  93. package/src/components/screenshot/operations/Undo/index.tsx +22 -0
  94. package/src/components/screenshot/operations/index.ts +34 -0
  95. package/src/components/screenshot/operations/utils.ts +34 -0
  96. package/src/components/screenshot/screenshots.scss +13 -0
  97. package/src/components/screenshot/types.ts +53 -0
  98. package/src/components/screenshot/useGetLoadedImage.ts +29 -0
  99. package/src/components/screenshot/var.scss +107 -0
  100. package/src/components/screenshot/zh_CN.ts +37 -0
  101. package/src/emoji/100.gif +0 -0
  102. package/src/emoji/101.gif +0 -0
  103. package/src/emoji/102.gif +0 -0
  104. package/src/emoji/103.gif +0 -0
  105. package/src/emoji/104.gif +0 -0
  106. package/src/emoji/105.gif +0 -0
  107. package/src/emoji/106.gif +0 -0
  108. package/src/emoji/107.gif +0 -0
  109. package/src/emoji/108.gif +0 -0
  110. package/src/emoji/109.gif +0 -0
  111. package/src/emoji/110.gif +0 -0
  112. package/src/emoji/111.gif +0 -0
  113. package/src/emoji/112.gif +0 -0
  114. package/src/emoji/113.gif +0 -0
  115. package/src/emoji/114.gif +0 -0
  116. package/src/emoji/115.gif +0 -0
  117. package/src/emoji/116.gif +0 -0
  118. package/src/emoji/117.gif +0 -0
  119. package/src/emoji/118.gif +0 -0
  120. package/src/emoji/119.gif +0 -0
  121. package/src/emoji/120.gif +0 -0
  122. package/src/emoji/121.gif +0 -0
  123. package/src/emoji/122.gif +0 -0
  124. package/src/emoji/123.gif +0 -0
  125. package/src/emoji/124.gif +0 -0
  126. package/src/emoji/125.gif +0 -0
  127. package/src/emoji/126.gif +0 -0
  128. package/src/emoji/127.gif +0 -0
  129. package/src/emoji/128.gif +0 -0
  130. package/src/emoji/129.gif +0 -0
  131. package/src/emoji/130.gif +0 -0
  132. package/src/emoji/131.gif +0 -0
  133. package/src/emoji/132.gif +0 -0
  134. package/src/emoji/133.gif +0 -0
  135. package/src/emoji/134.gif +0 -0
  136. package/src/emoji/135.gif +0 -0
  137. package/src/emoji/136.gif +0 -0
  138. package/src/emoji/137.gif +0 -0
  139. package/src/emoji/138.gif +0 -0
  140. package/src/emoji/139.gif +0 -0
  141. package/src/emoji/140.gif +0 -0
  142. package/src/emoji/141.gif +0 -0
  143. package/src/emoji/142.gif +0 -0
  144. package/src/emoji/143.gif +0 -0
  145. package/src/emoji/144.gif +0 -0
  146. package/src/emoji/145.gif +0 -0
  147. package/src/emoji/146.gif +0 -0
  148. package/src/emoji/147.gif +0 -0
  149. package/src/emoji/148.gif +0 -0
  150. package/src/emoji/149.gif +0 -0
  151. package/src/emoji/150.gif +0 -0
  152. package/src/emoji/151.gif +0 -0
  153. package/src/emoji/152.gif +0 -0
  154. package/src/emoji/153.gif +0 -0
  155. package/src/emoji/154.gif +0 -0
  156. package/src/emoji/155.gif +0 -0
  157. package/src/emoji/156.gif +0 -0
  158. package/src/emoji/157.gif +0 -0
  159. package/src/emoji/158.gif +0 -0
  160. package/src/emoji/159.gif +0 -0
  161. package/src/emoji/160.gif +0 -0
  162. package/src/emoji/161.gif +0 -0
  163. package/src/emoji/162.gif +0 -0
  164. package/src/emoji/163.gif +0 -0
  165. package/src/emoji/164.gif +0 -0
  166. package/src/emoji/165.gif +0 -0
  167. package/src/emoji/166.gif +0 -0
  168. package/src/emoji/167.gif +0 -0
  169. package/src/emoji/168.gif +0 -0
  170. package/src/emoji/169.gif +0 -0
  171. package/src/emoji/170.gif +0 -0
  172. package/src/emoji/171.gif +0 -0
  173. package/src/emoji/172.gif +0 -0
  174. package/src/emoji/173.gif +0 -0
  175. package/src/emoji/174.gif +0 -0
  176. package/src/emoji/175.gif +0 -0
  177. package/src/emoji/176.gif +0 -0
  178. package/src/emoji/177.gif +0 -0
  179. package/src/emoji/178.gif +0 -0
  180. package/src/emoji/179.gif +0 -0
  181. package/src/emoji/180.gif +0 -0
  182. package/src/emoji/181.gif +0 -0
  183. package/src/emoji/182.gif +0 -0
  184. package/src/emoji/183.gif +0 -0
  185. package/src/emoji/184.gif +0 -0
  186. package/src/emoji/185.gif +0 -0
  187. package/src/emoji/186.gif +0 -0
  188. package/src/emoji/187.gif +0 -0
  189. package/src/emoji/188.gif +0 -0
  190. package/src/emoji/189.gif +0 -0
  191. package/src/emoji/190.gif +0 -0
  192. package/src/emoji/191.gif +0 -0
  193. package/src/emoji/192.gif +0 -0
  194. package/src/emoji/193.gif +0 -0
  195. package/src/emoji/194.gif +0 -0
  196. package/src/emoji/195.gif +0 -0
  197. package/src/emoji/196.gif +0 -0
  198. package/src/emoji/197.gif +0 -0
  199. package/src/emoji/198.gif +0 -0
  200. package/src/emoji/199.gif +0 -0
  201. package/src/emoji/200.png +0 -0
  202. package/src/emoji/201.png +0 -0
  203. package/src/emoji/202.png +0 -0
  204. package/src/emoji/203.png +0 -0
  205. package/src/emoji/204.png +0 -0
  206. package/src/emoji/205.png +0 -0
  207. package/src/emoji/206.png +0 -0
  208. package/src/emoji/207.png +0 -0
  209. package/src/emoji/208.png +0 -0
  210. package/src/emoji/209.png +0 -0
  211. package/src/emoji/210.png +0 -0
  212. package/src/emoji/211.png +0 -0
  213. package/src/emoji/212.png +0 -0
  214. package/src/emoji/213.png +0 -0
  215. package/src/emoji/214.png +0 -0
  216. package/src/emoji/215.png +0 -0
  217. package/src/emoji/216.png +0 -0
  218. package/src/emoji/217.png +0 -0
  219. package/src/emoji/218.png +0 -0
  220. package/src/emoji/219.png +0 -0
  221. package/src/emoji2/101--Streamline-The-Team.png +0 -0
  222. package/src/emoji2/128--Streamline-The-Team.png +0 -0
  223. package/src/emoji2/134--Streamline-The-Team.png +0 -0
  224. package/src/emoji2/173--Streamline-The-Team.png +0 -0
  225. package/src/emoji2/Airplane--Streamline-Emoji.svg +24 -0
  226. package/src/emoji2/Alien--Streamline-Emoji.svg +21 -0
  227. package/src/emoji2/Amazed-Face--Streamline-Emoji.svg +16 -0
  228. package/src/emoji2/Amusing-Face--Streamline-Emoji.svg +20 -0
  229. package/src/emoji2/Anguished-Face--Streamline-Emoji.svg +19 -0
  230. package/src/emoji2/Anxious-Face--Streamline-Emoji.svg +17 -0
  231. package/src/emoji2/Astonished-Face--Streamline-Emoji.svg +20 -0
  232. package/src/emoji2/Backhand-Index-Pointing-Down-1--Streamline-Emoji.svg +12 -0
  233. package/src/emoji2/Backhand-Index-Pointing-Left-1--Streamline-Emoji.svg +13 -0
  234. package/src/emoji2/Backhand-Index-Pointing-Right-1--Streamline-Emoji.svg +13 -0
  235. package/src/emoji2/Backhand-Index-Pointing-Up-1--Streamline-Emoji.svg +14 -0
  236. package/src/emoji2/Bar-Chart--Streamline-Emoji.svg +22 -0
  237. package/src/emoji2/Beaming-Face-With-Smiling-Eyes--Streamline-Emoji.svg +20 -0
  238. package/src/emoji2/Boy-1--Streamline-Emoji.svg +17 -0
  239. package/src/emoji2/Boy-2--Streamline-Emoji.svg +17 -0
  240. package/src/emoji2/Boy-3--Streamline-Emoji.svg +17 -0
  241. package/src/emoji2/Broken-Heart--Streamline-Emoji.svg +12 -0
  242. package/src/emoji2/Clapping-Hands-1--Streamline-Emoji.svg +23 -0
  243. package/src/emoji2/Clinking-Glasses-2--Streamline-Emoji.svg +43 -0
  244. package/src/emoji2/Confounded-Face--Streamline-Emoji.svg +17 -0
  245. package/src/emoji2/Confused-Face--Streamline-Emoji.svg +15 -0
  246. package/src/emoji2/Construction-Worker--Streamline-Emoji.svg +21 -0
  247. package/src/emoji2/Couple-With-Heart-Woman-Man-1--Streamline-Emoji.svg +40 -0
  248. package/src/emoji2/Couple-With-Heart-Woman-Man-2--Streamline-Emoji.svg +40 -0
  249. package/src/emoji2/Cowboy-Hat-Face--Streamline-Emoji.svg +22 -0
  250. package/src/emoji2/Crazy-Face--Streamline-Emoji.svg +25 -0
  251. package/src/emoji2/Crossed-Fingers-1--Streamline-Emoji.svg +25 -0
  252. package/src/emoji2/Crown--Streamline-Emoji.svg +35 -0
  253. package/src/emoji2/Crying-Face--Streamline-Emoji.svg +26 -0
  254. package/src/emoji2/Delivery-Truck--Streamline-Emoji.svg +31 -0
  255. package/src/emoji2/Determined-Face--Streamline-Emoji.svg +25 -0
  256. package/src/emoji2/Disappointed-Face--Streamline-Emoji.svg +15 -0
  257. package/src/emoji2/Dizzy-Face--Streamline-Emoji.svg +20 -0
  258. package/src/emoji2/Downcast-Face-With-Sweat--Streamline-Emoji.svg +18 -0
  259. package/src/emoji2/Drooling-Face-1--Streamline-Emoji.svg +19 -0
  260. package/src/emoji2/Drooling-Face-2--Streamline-Emoji.svg +18 -0
  261. package/src/emoji2/Ear--Streamline-Emoji.svg +14 -0
  262. package/src/emoji2/Exclamation-Mark--Streamline-Emoji.svg +12 -0
  263. package/src/emoji2/Exploding-Head--Streamline-Emoji.svg +24 -0
  264. package/src/emoji2/Expressionless-Face--Streamline-Emoji.svg +15 -0
  265. package/src/emoji2/Face-Blowing-A-Kiss--Streamline-Emoji.svg +18 -0
  266. package/src/emoji2/Face-Savoring-Food--Streamline-Emoji.svg +18 -0
  267. package/src/emoji2/Face-Screaming-In-Fear--Streamline-Emoji.svg +18 -0
  268. package/src/emoji2/Face-Vomiting--Streamline-Emoji.svg +28 -0
  269. package/src/emoji2/Face-With-Head-Bandage--Streamline-Emoji.svg +25 -0
  270. package/src/emoji2/Face-With-Medical-Mask--Streamline-Emoji.svg +23 -0
  271. package/src/emoji2/Face-With-Monocle--Streamline-Emoji.svg +26 -0
  272. package/src/emoji2/Face-With-Raised-Eyebrow--Streamline-Emoji.svg +17 -0
  273. package/src/emoji2/Face-With-Rolling-Eyes--Streamline-Emoji.svg +17 -0
  274. package/src/emoji2/Face-With-Steam-From-Nose--Streamline-Emoji.svg +19 -0
  275. package/src/emoji2/Face-With-Symbols-On-Mouth--Streamline-Emoji.svg +22 -0
  276. package/src/emoji2/Face-With-Tears-Of-Joy--Streamline-Emoji.svg +34 -0
  277. package/src/emoji2/Face-With-Thermometer--Streamline-Emoji.svg +31 -0
  278. package/src/emoji2/Face-With-Tongue--Streamline-Emoji.svg +18 -0
  279. package/src/emoji2/Face-Without-Mouth--Streamline-Emoji.svg +14 -0
  280. package/src/emoji2/Fearful-Face--Streamline-Emoji.svg +18 -0
  281. package/src/emoji2/Flexed-Biceps-1--Streamline-Emoji.svg +13 -0
  282. package/src/emoji2/Flushed-Face--Streamline-Emoji.svg +19 -0
  283. package/src/emoji2/Folded-Hands-1--Streamline-Emoji.svg +29 -0
  284. package/src/emoji2/Frowning-Face--Streamline-Emoji.svg +15 -0
  285. package/src/emoji2/Fuel-Pump--Streamline-Emoji.svg +30 -0
  286. package/src/emoji2/Girl-1--Streamline-Emoji.svg +23 -0
  287. package/src/emoji2/Glasses-1--Streamline-Emoji.svg +27 -0
  288. package/src/emoji2/Grimacing-Face--Streamline-Emoji.svg +19 -0
  289. package/src/emoji2/Grinning-Cat-Face--Streamline-Emoji.svg +32 -0
  290. package/src/emoji2/Grinning-Face--Streamline-Emoji.svg +16 -0
  291. package/src/emoji2/Grinning-Face-With-Sweat--Streamline-Emoji.svg +19 -0
  292. package/src/emoji2/Grinning-Squinting-Face--Streamline-Emoji.svg +16 -0
  293. package/src/emoji2/Hand-With-Fingers-Splayed-1--Streamline-Emoji.svg +14 -0
  294. package/src/emoji2/Heart-Suit--Streamline-Emoji.svg +9 -0
  295. package/src/emoji2/Hushed-Face-1--Streamline-Emoji.svg +17 -0
  296. package/src/emoji2/Hushed-Face-2--Streamline-Emoji.svg +15 -0
  297. package/src/emoji2/Index-Pointing-Up-1--Streamline-Emoji.svg +17 -0
  298. package/src/emoji2/Kissing-Face-With-Closed-Eyes--Streamline-Emoji.svg +18 -0
  299. package/src/emoji2/Loudly-Crying-Face--Streamline-Emoji.svg +16 -0
  300. package/src/emoji2/Lying-Face--Streamline-Emoji.svg +15 -0
  301. package/src/emoji2/Man-1--Streamline-Emoji.svg +17 -0
  302. package/src/emoji2/Man-Facepalming-1--Streamline-Emoji.svg +21 -0
  303. package/src/emoji2/Man-Gesturing-No-1--Streamline-Emoji.svg +34 -0
  304. package/src/emoji2/Man-Gesturing-Ok-1--Streamline-Emoji.svg +25 -0
  305. package/src/emoji2/Man-Health-Worker-1--Streamline-Emoji.svg +41 -0
  306. package/src/emoji2/Man-Raising-Hand-1--Streamline-Emoji.svg +26 -0
  307. package/src/emoji2/Man-Shrugging-1--Streamline-Emoji.svg +31 -0
  308. package/src/emoji2/Money-Mouth-Face-2--Streamline-Emoji.svg +30 -0
  309. package/src/emoji2/Mouth--Streamline-Emoji.svg +12 -0
  310. package/src/emoji2/Nauseated-Face-2--Streamline-Emoji.svg +19 -0
  311. package/src/emoji2/Neutral-Face--Streamline-Emoji.svg +15 -0
  312. package/src/emoji2/Ok-Hand-1--Streamline-Emoji.svg +14 -0
  313. package/src/emoji2/Old-Man-1--Streamline-Emoji.svg +27 -0
  314. package/src/emoji2/Old-Woman-1--Streamline-Emoji.svg +23 -0
  315. package/src/emoji2/Oncoming-Fist-1--Streamline-Emoji.svg +15 -0
  316. package/src/emoji2/Person-Wearing-Turban-2--Streamline-Emoji.svg +20 -0
  317. package/src/emoji2/Pile-Of-Poo--Streamline-Emoji.svg +15 -0
  318. package/src/emoji2/Police-Car-Light--Streamline-Emoji.svg +26 -0
  319. package/src/emoji2/Rocket--Streamline-Emoji.svg +32 -0
  320. package/src/emoji2/Sailboat--Streamline-Emoji.svg +18 -0
  321. package/src/emoji2/Shaved-Ice--Streamline-Emoji.svg +21 -0
  322. package/src/emoji2/Shortcake-2--Streamline-Emoji.svg +18 -0
  323. package/src/emoji2/Shushing-Face--Streamline-Emoji.svg +21 -0
  324. package/src/emoji2/Sign-Of-The-Horns-1--Streamline-Emoji.svg +19 -0
  325. package/src/emoji2/Sleeping-Face--Streamline-Emoji.svg +21 -0
  326. package/src/emoji2/Slightly-Smiling-Face--Streamline-Emoji.svg +15 -0
  327. package/src/emoji2/Smiling-Face-With-Halo--Streamline-Emoji.svg +20 -0
  328. package/src/emoji2/Smiling-Face-With-Heart-Eyes--Streamline-Emoji.svg +21 -0
  329. package/src/emoji2/Smirking-Face--Streamline-Emoji.svg +17 -0
  330. package/src/emoji2/Sun-With-Face--Streamline-Emoji.svg +24 -0
  331. package/src/emoji2/Thumbs-Down-1--Streamline-Emoji.svg +20 -0
  332. package/src/emoji2/Thumbs-Up-1--Streamline-Emoji.svg +19 -0
  333. package/src/emoji2/Winking-Face--Streamline-Emoji.svg +18 -0
  334. package/src/emoji2/Woman-Gesturing-No-1--Streamline-Emoji.svg +34 -0
  335. package/src/emoji2/Woman-Gesturing-Ok-2--Streamline-Emoji.svg +25 -0
  336. package/src/emoji2/Woman-Raising-Hand-1--Streamline-Emoji.svg +26 -0
  337. package/src/emoji2/Womans-Sandal--Streamline-Emoji.svg +13 -0
  338. package/src/emoji2/Worried-Face--Streamline-Emoji.svg +17 -0
  339. package/src/emoji2/Writing-Hand-1--Streamline-Emoji.svg +17 -0
  340. package/src/emoji2/Zipper-Mouth-Face--Streamline-Emoji.svg +21 -0
  341. package/src/index.js +19 -0
  342. package/src/services/burn-after-read-service.js +313 -0
  343. package/src/services/burn-after-read-service.test.js +325 -0
  344. package/src/services/dify-api.js +338 -0
  345. package/src/services/dify-api.test.js +376 -0
  346. package/src/services/scheduled-send-service.js +311 -0
  347. package/src/services/scheduled-send-service.test.js +317 -0
  348. package/src/styles/index.css +2368 -0
  349. package/src/utils/emoji.js +125 -0
  350. package/src/utils/emojiData.js +267 -0
  351. package/src/utils/eventEmitter.js +114 -0
  352. package/src/utils/state.js +224 -0
  353. package/src/utils/state.test.js +198 -0
  354. package/src/utils/storage.js +122 -0
  355. package/src/utils/storage.test.js +162 -0
  356. package/src/utils/validation.js +249 -0
@@ -0,0 +1,121 @@
1
+ import { describe, it, expect, beforeEach } from 'vitest';
2
+ import { mount } from '@vue/test-utils';
3
+ import BurnAfterReadDialog from './BurnAfterReadDialog.vue';
4
+
5
+ describe('BurnAfterReadDialog.vue', () => {
6
+ let wrapper;
7
+
8
+ beforeEach(() => {
9
+ wrapper = mount(BurnAfterReadDialog, {
10
+ props: {
11
+ messageContent: 'This is a test message'
12
+ }
13
+ });
14
+ });
15
+
16
+ it('应该渲染对话框', () => {
17
+ expect(wrapper.find('.burn-after-read-dialog').exists()).toBe(true);
18
+ });
19
+
20
+ it('应该显示消息预览', () => {
21
+ expect(wrapper.text()).toContain('This is a test message');
22
+ });
23
+
24
+ it('应该显示预设销毁时间按钮', () => {
25
+ const presetButtons = wrapper.findAll('.preset-btn');
26
+ expect(presetButtons.length).toBeGreaterThan(0);
27
+ });
28
+
29
+ it('应该默认选择10秒', () => {
30
+ const activeButton = wrapper.find('.preset-btn.active');
31
+ expect(activeButton.text()).toContain('10秒');
32
+ });
33
+
34
+ it('应该允许选择不同的销毁时间', async () => {
35
+ const buttons = wrapper.findAll('.preset-btn');
36
+ await buttons[0].trigger('click');
37
+ expect(wrapper.vm.selectedBurnTime).toBe(5);
38
+ });
39
+
40
+ it('应该支持自定义销毁时间', async () => {
41
+ const input = wrapper.find('#custom-burn-time');
42
+ await input.setValue(30);
43
+ const applyBtn = wrapper.find('.apply-custom-btn');
44
+ await applyBtn.trigger('click');
45
+ expect(wrapper.vm.selectedBurnTime).toBe(30);
46
+ });
47
+
48
+ it('应该验证自定义时间范围', async () => {
49
+ const input = wrapper.find('#custom-burn-time');
50
+ await input.setValue(0);
51
+ expect(wrapper.vm.isCustomTimeValid).toBe(false);
52
+
53
+ await input.setValue(3601);
54
+ expect(wrapper.vm.isCustomTimeValid).toBe(false);
55
+
56
+ await input.setValue(100);
57
+ expect(wrapper.vm.isCustomTimeValid).toBe(true);
58
+ });
59
+
60
+ it('应该格式化销毁时间显示', () => {
61
+ expect(wrapper.vm.formatBurnTime).toContain('10秒');
62
+ });
63
+
64
+ it('应该在确认时发出事件', async () => {
65
+ const confirmBtn = wrapper.find('.btn-primary');
66
+ await confirmBtn.trigger('click');
67
+ expect(wrapper.emitted('confirm')).toBeTruthy();
68
+ const emittedData = wrapper.emitted('confirm')[0][0];
69
+ expect(emittedData.burnAfterRead).toBe(true);
70
+ expect(emittedData.burnAfterReadDelay).toBe(10);
71
+ });
72
+
73
+ it('应该在取消时发出事件', async () => {
74
+ const cancelBtn = wrapper.find('.btn-cancel');
75
+ await cancelBtn.trigger('click');
76
+ expect(wrapper.emitted('cancel')).toBeTruthy();
77
+ });
78
+
79
+ it('应该在点击背景时关闭', async () => {
80
+ const overlay = wrapper.find('.burn-after-read-dialog-overlay');
81
+ await overlay.trigger('click');
82
+ expect(wrapper.emitted('cancel')).toBeTruthy();
83
+ });
84
+
85
+ it('应该在点击关闭按钮时关闭', async () => {
86
+ const closeBtn = wrapper.find('.close-btn');
87
+ await closeBtn.trigger('click');
88
+ expect(wrapper.emitted('cancel')).toBeTruthy();
89
+ });
90
+
91
+ it('应该截断长消息预览', async () => {
92
+ const longMessage = 'a'.repeat(200);
93
+ const longWrapper = mount(BurnAfterReadDialog, {
94
+ props: {
95
+ messageContent: longMessage
96
+ }
97
+ });
98
+ expect(longWrapper.vm.messagePreview).toContain('...');
99
+ });
100
+
101
+ it('应该禁用确认按钮当未选择销毁时间', async () => {
102
+ wrapper.vm.selectedBurnTime = 0;
103
+ await wrapper.vm.$nextTick();
104
+ const confirmBtn = wrapper.find('.btn-primary');
105
+ expect(confirmBtn.attributes('disabled')).toBeDefined();
106
+ });
107
+
108
+ it('应该格式化分钟时间', async () => {
109
+ const buttons = wrapper.findAll('.preset-btn');
110
+ await buttons[3].trigger('click'); // 1分钟
111
+ expect(wrapper.vm.formatBurnTime).toContain('分钟');
112
+ });
113
+
114
+ it('应该格式化小时时间', async () => {
115
+ const input = wrapper.find('#custom-burn-time');
116
+ await input.setValue(3600);
117
+ const applyBtn = wrapper.find('.apply-custom-btn');
118
+ await applyBtn.trigger('click');
119
+ expect(wrapper.vm.formatBurnTime).toContain('小时');
120
+ });
121
+ });
@@ -0,0 +1,511 @@
1
+ <template>
2
+ <div class="burn-after-read-dialog-overlay" @click="handleCancel">
3
+ <div class="burn-after-read-dialog" @click.stop>
4
+ <div class="dialog-header">
5
+ <h3>阅后即焚</h3>
6
+ <button
7
+ class="close-btn"
8
+ @click="handleCancel"
9
+ aria-label="关闭对话框"
10
+ >
11
+ <i class="ri-close-line"></i>
12
+ </button>
13
+ </div>
14
+ <div class="dialog-body">
15
+ <!-- 销毁时间选择 -->
16
+ <div class="burn-time-section">
17
+ <label>销毁时间</label>
18
+ <div class="burn-time-presets">
19
+ <button
20
+ v-for="preset in burnTimePresets"
21
+ :key="preset.id"
22
+ class="preset-btn"
23
+ :class="{ active: selectedBurnTime === preset.seconds }"
24
+ @click="selectBurnTime(preset)"
25
+ >
26
+ <i :class="preset.icon"></i>
27
+ <span>{{ preset.label }}</span>
28
+ </button>
29
+ </div>
30
+ <!-- 自定义时间 -->
31
+ <div class="custom-time-section">
32
+ <label for="custom-burn-time">自定义时间(秒)</label>
33
+ <div class="custom-time-input">
34
+ <input
35
+ id="custom-burn-time"
36
+ v-model.number="customBurnTime"
37
+ type="number"
38
+ min="1"
39
+ max="3600"
40
+ placeholder="输入秒数"
41
+ @input="handleCustomTimeInput"
42
+ />
43
+ <button
44
+ class="apply-custom-btn"
45
+ :disabled="!isCustomTimeValid"
46
+ @click="applyCustomTime"
47
+ >
48
+ 应用
49
+ </button>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <!-- 消息预览 -->
54
+ <div class="message-preview-section">
55
+ <label>消息预览</label>
56
+ <div class="message-preview">
57
+ <div class="burn-indicator">
58
+ <i class="ri-fire-line burn-icon"></i>
59
+ <span class="burn-text">阅后即焚</span>
60
+ </div>
61
+ <div class="message-content">
62
+ {{ messagePreview }}
63
+ </div>
64
+ </div>
65
+ </div>
66
+ <!-- 销毁时间显示 -->
67
+ <div class="burn-info">
68
+ <div class="burn-time-display">
69
+ <span class="label">销毁时间:</span>
70
+ <span class="time-value">{{ formatBurnTime }}</span>
71
+ </div>
72
+ <div class="burn-warning">
73
+ <i class="ri-alarm-warning-line"></i>
74
+ <span>消息发送后,接收方阅读完毕将在指定时间后自动销毁</span>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <div class="dialog-footer">
79
+ <button
80
+ class="btn btn-cancel"
81
+ @click="handleCancel"
82
+ >
83
+ 取消
84
+ </button>
85
+ <button
86
+ class="btn btn-primary"
87
+ :disabled="!selectedBurnTime"
88
+ @click="handleConfirm"
89
+ >
90
+ <i class="ri-fire-line"></i>
91
+ 确认发送
92
+ </button>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </template>
97
+ <script>
98
+ import { ref, computed } from 'vue';
99
+ export default {
100
+ name: 'BurnAfterReadDialog',
101
+ props: {
102
+ messageContent: {
103
+ type: String,
104
+ required: true
105
+ }
106
+ },
107
+ emits: ['confirm', 'cancel'],
108
+ setup(props, { emit }) {
109
+ const selectedBurnTime = ref(0);
110
+ const customBurnTime = ref('');
111
+ const burnTimePresets = [
112
+ {
113
+ id: '5s',
114
+ label: '5秒',
115
+ seconds: 5,
116
+ icon: 'ri-time-line'
117
+ },
118
+ {
119
+ id: '10s',
120
+ label: '10秒',
121
+ seconds: 10,
122
+ icon: 'ri-time-line'
123
+ },
124
+ {
125
+ id: '30s',
126
+ label: '30秒',
127
+ seconds: 30,
128
+ icon: 'ri-time-line'
129
+ },
130
+ {
131
+ id: '1min',
132
+ label: '1分钟',
133
+ seconds: 60,
134
+ icon: 'ri-timer-line'
135
+ },
136
+ {
137
+ id: '5min',
138
+ label: '5分钟',
139
+ seconds: 300,
140
+ icon: 'ri-timer-line'
141
+ },
142
+ {
143
+ id: '10min',
144
+ label: '10分钟',
145
+ seconds: 600,
146
+ icon: 'ri-timer-line'
147
+ }
148
+ ];
149
+ const messagePreview = computed(() => {
150
+ const preview = props.messageContent.substring(0, 100);
151
+ return preview.length < props.messageContent.length
152
+ ? preview + '...'
153
+ : preview;
154
+ });
155
+ const formatBurnTime = computed(() => {
156
+ if (!selectedBurnTime.value) return '未选择';
157
+ const seconds = selectedBurnTime.value;
158
+ if (seconds < 60) {
159
+ return `${seconds}秒`;
160
+ } else if (seconds < 3600) {
161
+ const minutes = Math.floor(seconds / 60);
162
+ const remainingSeconds = seconds % 60;
163
+ return remainingSeconds > 0
164
+ ? `${minutes}分${remainingSeconds}秒`
165
+ : `${minutes}分钟`;
166
+ } else {
167
+ const hours = Math.floor(seconds / 3600);
168
+ const remainingMinutes = Math.floor((seconds % 3600) / 60);
169
+ return remainingMinutes > 0
170
+ ? `${hours}小时${remainingMinutes}分钟`
171
+ : `${hours}小时`;
172
+ }
173
+ });
174
+ const isCustomTimeValid = computed(() => {
175
+ const time = Number(customBurnTime.value);
176
+ return time >= 1 && time <= 3600 && Number.isInteger(time);
177
+ });
178
+ const selectBurnTime = (preset) => {
179
+ selectedBurnTime.value = preset.seconds;
180
+ customBurnTime.value = '';
181
+ };
182
+ const handleCustomTimeInput = () => {
183
+ if (isCustomTimeValid.value) {
184
+ selectedBurnTime.value = 0; // 清除预设选择
185
+ }
186
+ };
187
+ const applyCustomTime = () => {
188
+ if (isCustomTimeValid.value) {
189
+ selectedBurnTime.value = Number(customBurnTime.value);
190
+ }
191
+ };
192
+ const handleConfirm = () => {
193
+ if (!selectedBurnTime.value) return;
194
+ emit('confirm', {
195
+ message: props.messageContent,
196
+ burnAfterReadDelay: selectedBurnTime.value,
197
+ burnAfterRead: true
198
+ });
199
+ };
200
+ const handleCancel = () => {
201
+ emit('cancel');
202
+ };
203
+ // 默认选择10秒
204
+ selectBurnTime(burnTimePresets[1]);
205
+ return {
206
+ selectedBurnTime,
207
+ customBurnTime,
208
+ burnTimePresets,
209
+ messagePreview,
210
+ formatBurnTime,
211
+ isCustomTimeValid,
212
+ selectBurnTime,
213
+ handleCustomTimeInput,
214
+ applyCustomTime,
215
+ handleConfirm,
216
+ handleCancel
217
+ };
218
+ }
219
+ };
220
+ </script>
221
+ <style scoped>
222
+ .burn-after-read-dialog-overlay {
223
+ position: fixed;
224
+ top: 0;
225
+ left: 0;
226
+ right: 0;
227
+ bottom: 0;
228
+ background-color: rgba(0, 0, 0, 0.5);
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: center;
232
+ z-index: 1000;
233
+ }
234
+ .burn-after-read-dialog {
235
+ background-color: white;
236
+ border-radius: 8px;
237
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
238
+ width: 90%;
239
+ max-width: 500px;
240
+ max-height: 90vh;
241
+ overflow-y: auto;
242
+ display: flex;
243
+ flex-direction: column;
244
+ }
245
+ .dialog-header {
246
+ display: flex;
247
+ justify-content: space-between;
248
+ align-items: center;
249
+ padding: 16px;
250
+ border-bottom: 1px solid #e0e0e0;
251
+ background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
252
+ color: white;
253
+ }
254
+ .dialog-header h3 {
255
+ margin: 0;
256
+ font-size: 18px;
257
+ font-weight: 600;
258
+ display: flex;
259
+ align-items: center;
260
+ gap: 8px;
261
+ }
262
+ .dialog-header h3::before {
263
+ content: '🔥';
264
+ font-size: 20px;
265
+ }
266
+ .close-btn {
267
+ background: none;
268
+ border: none;
269
+ font-size: 20px;
270
+ color: white;
271
+ cursor: pointer;
272
+ padding: 4px;
273
+ display: flex;
274
+ align-items: center;
275
+ justify-content: center;
276
+ transition: opacity 0.2s;
277
+ }
278
+ .close-btn:hover {
279
+ opacity: 0.8;
280
+ }
281
+ .dialog-body {
282
+ padding: 20px;
283
+ flex: 1;
284
+ overflow-y: auto;
285
+ }
286
+ .burn-time-section {
287
+ margin-bottom: 24px;
288
+ }
289
+ .burn-time-section > label {
290
+ display: block;
291
+ margin-bottom: 12px;
292
+ font-weight: 600;
293
+ color: #333;
294
+ font-size: 14px;
295
+ }
296
+ .burn-time-presets {
297
+ display: grid;
298
+ grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
299
+ gap: 8px;
300
+ margin-bottom: 16px;
301
+ }
302
+ .preset-btn {
303
+ display: flex;
304
+ flex-direction: column;
305
+ align-items: center;
306
+ gap: 4px;
307
+ padding: 12px 8px;
308
+ border: 2px solid #e0e0e0;
309
+ border-radius: 6px;
310
+ background-color: white;
311
+ color: #333;
312
+ cursor: pointer;
313
+ font-size: 12px;
314
+ transition: all 0.2s;
315
+ }
316
+ .preset-btn:hover {
317
+ border-color: #ff6b6b;
318
+ background-color: #fff5f5;
319
+ }
320
+ .preset-btn.active {
321
+ border-color: #ff6b6b;
322
+ background-color: #ff6b6b;
323
+ color: white;
324
+ }
325
+ .preset-btn i {
326
+ font-size: 18px;
327
+ }
328
+ .custom-time-section {
329
+ border-top: 1px solid #e0e0e0;
330
+ padding-top: 16px;
331
+ }
332
+ .custom-time-section label {
333
+ display: block;
334
+ margin-bottom: 8px;
335
+ font-weight: 500;
336
+ color: #333;
337
+ font-size: 13px;
338
+ }
339
+ .custom-time-input {
340
+ display: flex;
341
+ gap: 8px;
342
+ }
343
+ .custom-time-input input {
344
+ flex: 1;
345
+ padding: 8px 12px;
346
+ border: 1px solid #e0e0e0;
347
+ border-radius: 4px;
348
+ font-size: 14px;
349
+ font-family: inherit;
350
+ }
351
+ .custom-time-input input:focus {
352
+ outline: none;
353
+ border-color: #ff6b6b;
354
+ box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
355
+ }
356
+ .apply-custom-btn {
357
+ padding: 8px 16px;
358
+ border: none;
359
+ border-radius: 4px;
360
+ background-color: #ff6b6b;
361
+ color: white;
362
+ cursor: pointer;
363
+ font-size: 13px;
364
+ transition: background-color 0.2s;
365
+ }
366
+ .apply-custom-btn:hover:not(:disabled) {
367
+ background-color: #ff5252;
368
+ }
369
+ .apply-custom-btn:disabled {
370
+ background-color: #ccc;
371
+ cursor: not-allowed;
372
+ }
373
+ .message-preview-section {
374
+ margin-bottom: 24px;
375
+ }
376
+ .message-preview-section label {
377
+ display: block;
378
+ margin-bottom: 8px;
379
+ font-weight: 500;
380
+ color: #333;
381
+ font-size: 14px;
382
+ }
383
+ .message-preview {
384
+ border: 1px solid #e0e0e0;
385
+ border-radius: 6px;
386
+ overflow: hidden;
387
+ }
388
+ .burn-indicator {
389
+ display: flex;
390
+ align-items: center;
391
+ gap: 6px;
392
+ padding: 8px 12px;
393
+ background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
394
+ color: white;
395
+ font-size: 12px;
396
+ font-weight: 500;
397
+ }
398
+ .burn-icon {
399
+ font-size: 14px;
400
+ animation: flame 1.5s ease-in-out infinite alternate;
401
+ }
402
+ @keyframes flame {
403
+ 0% { transform: scale(1) rotate(-2deg); }
404
+ 100% { transform: scale(1.1) rotate(2deg); }
405
+ }
406
+ .message-content {
407
+ padding: 12px;
408
+ background-color: #f9f9f9;
409
+ color: #666;
410
+ font-size: 13px;
411
+ line-height: 1.5;
412
+ word-break: break-word;
413
+ max-height: 100px;
414
+ overflow-y: auto;
415
+ }
416
+ .burn-info {
417
+ padding: 12px;
418
+ background-color: #fff5f5;
419
+ border: 1px solid #ffebee;
420
+ border-radius: 6px;
421
+ border-left: 4px solid #ff6b6b;
422
+ }
423
+ .burn-time-display {
424
+ display: flex;
425
+ justify-content: space-between;
426
+ margin-bottom: 8px;
427
+ font-size: 14px;
428
+ }
429
+ .burn-time-display .label {
430
+ color: #666;
431
+ font-weight: 500;
432
+ }
433
+ .burn-time-display .time-value {
434
+ color: #ff6b6b;
435
+ font-weight: 600;
436
+ }
437
+ .burn-warning {
438
+ display: flex;
439
+ align-items: flex-start;
440
+ gap: 6px;
441
+ font-size: 12px;
442
+ color: #ff6b6b;
443
+ line-height: 1.4;
444
+ }
445
+ .burn-warning i {
446
+ font-size: 14px;
447
+ margin-top: 1px;
448
+ flex-shrink: 0;
449
+ }
450
+ .dialog-footer {
451
+ display: flex;
452
+ gap: 12px;
453
+ padding: 16px;
454
+ border-top: 1px solid #e0e0e0;
455
+ background-color: #fafafa;
456
+ }
457
+ .btn {
458
+ flex: 1;
459
+ padding: 10px 16px;
460
+ border: none;
461
+ border-radius: 4px;
462
+ font-size: 14px;
463
+ font-weight: 500;
464
+ cursor: pointer;
465
+ transition: all 0.2s;
466
+ display: flex;
467
+ align-items: center;
468
+ justify-content: center;
469
+ gap: 6px;
470
+ }
471
+ .btn-cancel {
472
+ background-color: white;
473
+ color: #333;
474
+ border: 1px solid #e0e0e0;
475
+ }
476
+ .btn-cancel:hover {
477
+ background-color: #f5f5f5;
478
+ border-color: #d0d0d0;
479
+ }
480
+ .btn-primary {
481
+ background-color: #ff6b6b;
482
+ color: white;
483
+ }
484
+ .btn-primary:hover:not(:disabled) {
485
+ background-color: #ff5252;
486
+ }
487
+ .btn-primary:disabled {
488
+ background-color: #ccc;
489
+ cursor: not-allowed;
490
+ opacity: 0.6;
491
+ }
492
+ /* 响应式设计 */
493
+ @media (max-width: 600px) {
494
+ .burn-after-read-dialog {
495
+ width: 95%;
496
+ max-height: 95vh;
497
+ }
498
+ .burn-time-presets {
499
+ grid-template-columns: repeat(2, 1fr);
500
+ }
501
+ .dialog-body {
502
+ padding: 16px;
503
+ }
504
+ .dialog-header {
505
+ padding: 12px;
506
+ }
507
+ .dialog-footer {
508
+ padding: 12px;
509
+ }
510
+ }
511
+ </style>