@docyrus/ui-pro-ai-assistant 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/dist/index.js +26161 -0
  2. package/dist/index.js.map +1 -0
  3. package/package.json +155 -0
  4. package/src/components/assistant-animations.tsx +29 -0
  5. package/src/components/assistant-dialogs.tsx +235 -0
  6. package/src/components/code-view.tsx +278 -0
  7. package/src/components/create-agent-task.tsx +104 -0
  8. package/src/components/create-new-work-version.tsx +30 -0
  9. package/src/components/extract-web.tsx +160 -0
  10. package/src/components/forward-to-agent.tsx +90 -0
  11. package/src/components/generate-chart.tsx +101 -0
  12. package/src/components/generative-action-button.tsx +122 -0
  13. package/src/components/generative-tool.tsx +685 -0
  14. package/src/components/generative-ui-object.tsx +210 -0
  15. package/src/components/input-area.tsx +1209 -0
  16. package/src/components/json-schema-layout.tsx +326 -0
  17. package/src/components/list-item-card.tsx +92 -0
  18. package/src/components/mermaid-diagram.tsx +192 -0
  19. package/src/components/preview-image.tsx +47 -0
  20. package/src/components/request-approval.tsx +48 -0
  21. package/src/components/request-user-input.tsx +270 -0
  22. package/src/components/search-web.tsx +319 -0
  23. package/src/components/sheet-command.tsx +88 -0
  24. package/src/components/shell-canvas.tsx +122 -0
  25. package/src/components/show-advanced-data-table.tsx +352 -0
  26. package/src/components/show-generated-content-options.tsx +93 -0
  27. package/src/components/show-people-cards.tsx +180 -0
  28. package/src/components/subagent-tool.tsx +180 -0
  29. package/src/components/text-editor-tool.tsx +328 -0
  30. package/src/components/work-canvas.tsx +88 -0
  31. package/src/components/work-card.tsx +42 -0
  32. package/src/declarations.d.ts +1 -0
  33. package/src/docy-assistant.tsx +1962 -0
  34. package/src/hooks/index.ts +7 -0
  35. package/src/hooks/use-assistant-api.ts +507 -0
  36. package/src/hooks/use-deployment-data.ts +162 -0
  37. package/src/hooks/use-project-state.ts +347 -0
  38. package/src/hooks/use-session-state.ts +207 -0
  39. package/src/hooks/use-speech-recognition.ts +137 -0
  40. package/src/hooks/use-ui-state.ts +185 -0
  41. package/src/hooks/use-works-state.ts +146 -0
  42. package/src/i18n/context.tsx +253 -0
  43. package/src/i18n/index.ts +19 -0
  44. package/src/i18n/locales/de.json +198 -0
  45. package/src/i18n/locales/el.json +198 -0
  46. package/src/i18n/locales/en.json +226 -0
  47. package/src/i18n/locales/es.json +198 -0
  48. package/src/i18n/locales/fr.json +198 -0
  49. package/src/i18n/locales/it.json +198 -0
  50. package/src/i18n/locales/pt.json +198 -0
  51. package/src/i18n/locales/sl.json +198 -0
  52. package/src/i18n/locales/tr.json +211 -0
  53. package/src/i18n/types.ts +23 -0
  54. package/src/i18n/use-translation.ts +17 -0
  55. package/src/index.ts +18 -0
  56. package/src/internal/plate-editor/editor/auth-context.ts +11 -0
  57. package/src/internal/plate-editor/editor/editor-base-kit.tsx +39 -0
  58. package/src/internal/plate-editor/editor/editor-kit.tsx +89 -0
  59. package/src/internal/plate-editor/editor/plate-editor.tsx +75 -0
  60. package/src/internal/plate-editor/editor/plate-types.ts +126 -0
  61. package/src/internal/plate-editor/editor/plugins/ai-kit.tsx +172 -0
  62. package/src/internal/plate-editor/editor/plugins/autoformat-kit.tsx +211 -0
  63. package/src/internal/plate-editor/editor/plugins/basic-blocks-base-kit.tsx +26 -0
  64. package/src/internal/plate-editor/editor/plugins/basic-blocks-kit.tsx +51 -0
  65. package/src/internal/plate-editor/editor/plugins/basic-marks-base-kit.tsx +24 -0
  66. package/src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx +38 -0
  67. package/src/internal/plate-editor/editor/plugins/basic-nodes-kit.tsx +6 -0
  68. package/src/internal/plate-editor/editor/plugins/block-menu-kit.tsx +14 -0
  69. package/src/internal/plate-editor/editor/plugins/block-placeholder-kit.tsx +17 -0
  70. package/src/internal/plate-editor/editor/plugins/block-selection-kit.tsx +31 -0
  71. package/src/internal/plate-editor/editor/plugins/callout-base-kit.tsx +5 -0
  72. package/src/internal/plate-editor/editor/plugins/callout-kit.tsx +7 -0
  73. package/src/internal/plate-editor/editor/plugins/code-block-base-kit.tsx +23 -0
  74. package/src/internal/plate-editor/editor/plugins/code-block-kit.tsx +26 -0
  75. package/src/internal/plate-editor/editor/plugins/column-base-kit.tsx +8 -0
  76. package/src/internal/plate-editor/editor/plugins/column-kit.tsx +7 -0
  77. package/src/internal/plate-editor/editor/plugins/comment-base-kit.tsx +5 -0
  78. package/src/internal/plate-editor/editor/plugins/comment-kit.tsx +174 -0
  79. package/src/internal/plate-editor/editor/plugins/copilot-kit.tsx +68 -0
  80. package/src/internal/plate-editor/editor/plugins/cursor-overlay-kit.tsx +13 -0
  81. package/src/internal/plate-editor/editor/plugins/date-base-kit.tsx +5 -0
  82. package/src/internal/plate-editor/editor/plugins/date-kit.tsx +7 -0
  83. package/src/internal/plate-editor/editor/plugins/discussion-kit.tsx +36 -0
  84. package/src/internal/plate-editor/editor/plugins/dnd-kit.tsx +27 -0
  85. package/src/internal/plate-editor/editor/plugins/docx-export-kit.tsx +43 -0
  86. package/src/internal/plate-editor/editor/plugins/docx-kit.tsx +6 -0
  87. package/src/internal/plate-editor/editor/plugins/emoji-kit.tsx +15 -0
  88. package/src/internal/plate-editor/editor/plugins/exit-break-kit.tsx +12 -0
  89. package/src/internal/plate-editor/editor/plugins/floating-toolbar-kit.tsx +19 -0
  90. package/src/internal/plate-editor/editor/plugins/font-base-kit.tsx +36 -0
  91. package/src/internal/plate-editor/editor/plugins/font-kit.tsx +47 -0
  92. package/src/internal/plate-editor/editor/plugins/indent-base-kit.tsx +19 -0
  93. package/src/internal/plate-editor/editor/plugins/indent-kit.tsx +22 -0
  94. package/src/internal/plate-editor/editor/plugins/link-base-kit.tsx +5 -0
  95. package/src/internal/plate-editor/editor/plugins/link-kit.tsx +35 -0
  96. package/src/internal/plate-editor/editor/plugins/list-base-kit.tsx +24 -0
  97. package/src/internal/plate-editor/editor/plugins/list-kit.tsx +27 -0
  98. package/src/internal/plate-editor/editor/plugins/markdown-kit.tsx +18 -0
  99. package/src/internal/plate-editor/editor/plugins/math-base-kit.tsx +8 -0
  100. package/src/internal/plate-editor/editor/plugins/math-kit.tsx +10 -0
  101. package/src/internal/plate-editor/editor/plugins/media-base-kit.tsx +37 -0
  102. package/src/internal/plate-editor/editor/plugins/media-kit.tsx +53 -0
  103. package/src/internal/plate-editor/editor/plugins/mention-base-kit.tsx +5 -0
  104. package/src/internal/plate-editor/editor/plugins/mention-kit.tsx +36 -0
  105. package/src/internal/plate-editor/editor/plugins/slash-kit.tsx +17 -0
  106. package/src/internal/plate-editor/editor/plugins/suggestion-base-kit.tsx +5 -0
  107. package/src/internal/plate-editor/editor/plugins/suggestion-kit.tsx +95 -0
  108. package/src/internal/plate-editor/editor/plugins/table-base-kit.tsx +20 -0
  109. package/src/internal/plate-editor/editor/plugins/table-kit.tsx +22 -0
  110. package/src/internal/plate-editor/editor/plugins/toc-base-kit.tsx +5 -0
  111. package/src/internal/plate-editor/editor/plugins/toc-kit.tsx +14 -0
  112. package/src/internal/plate-editor/editor/plugins/toggle-base-kit.tsx +5 -0
  113. package/src/internal/plate-editor/editor/plugins/toggle-kit.tsx +9 -0
  114. package/src/internal/plate-editor/editor/transforms.ts +165 -0
  115. package/src/internal/plate-editor/editor/use-chat.ts +152 -0
  116. package/src/internal/plate-editor/hooks/index.ts +3 -0
  117. package/src/internal/plate-editor/hooks/use-copy-to-clipboard.ts +31 -0
  118. package/src/internal/plate-editor/hooks/use-is-touch-device.ts +26 -0
  119. package/src/internal/plate-editor/hooks/use-lock-scroll.ts +21 -0
  120. package/src/internal/plate-editor/hooks/use-media-query.ts +44 -0
  121. package/src/internal/plate-editor/hooks/use-mounted.ts +18 -0
  122. package/src/internal/plate-editor/hooks/use-on-click-outside.ts +114 -0
  123. package/src/internal/plate-editor/hooks/use-upload-file.ts +81 -0
  124. package/src/internal/plate-editor/i18n/context.tsx +58 -0
  125. package/src/internal/plate-editor/i18n/index.ts +3 -0
  126. package/src/internal/plate-editor/i18n/locales/de.json +57 -0
  127. package/src/internal/plate-editor/i18n/locales/el.json +57 -0
  128. package/src/internal/plate-editor/i18n/locales/en.json +57 -0
  129. package/src/internal/plate-editor/i18n/locales/es.json +57 -0
  130. package/src/internal/plate-editor/i18n/locales/fr.json +57 -0
  131. package/src/internal/plate-editor/i18n/locales/it.json +57 -0
  132. package/src/internal/plate-editor/i18n/locales/pt.json +57 -0
  133. package/src/internal/plate-editor/i18n/locales/sl.json +57 -0
  134. package/src/internal/plate-editor/i18n/locales/tr.json +57 -0
  135. package/src/internal/plate-editor/i18n/types.ts +59 -0
  136. package/src/internal/plate-editor/i18n/use-translation.ts +22 -0
  137. package/src/internal/plate-editor/index.ts +39 -0
  138. package/src/internal/plate-editor/lib/ai-output-converter.ts +153 -0
  139. package/src/internal/plate-editor/lib/download-file.ts +17 -0
  140. package/src/internal/plate-editor/plate-ui/ai-chat-editor.tsx +26 -0
  141. package/src/internal/plate-editor/plate-ui/ai-menu.tsx +828 -0
  142. package/src/internal/plate-editor/plate-ui/ai-node.tsx +41 -0
  143. package/src/internal/plate-editor/plate-ui/ai-toolbar-button.tsx +27 -0
  144. package/src/internal/plate-editor/plate-ui/alert-dialog.tsx +147 -0
  145. package/src/internal/plate-editor/plate-ui/align-toolbar-button.tsx +90 -0
  146. package/src/internal/plate-editor/plate-ui/avatar.tsx +3 -0
  147. package/src/internal/plate-editor/plate-ui/block-context-menu.tsx +106 -0
  148. package/src/internal/plate-editor/plate-ui/block-discussion.tsx +364 -0
  149. package/src/internal/plate-editor/plate-ui/block-draggable.tsx +556 -0
  150. package/src/internal/plate-editor/plate-ui/block-list-static.tsx +78 -0
  151. package/src/internal/plate-editor/plate-ui/block-list.tsx +85 -0
  152. package/src/internal/plate-editor/plate-ui/block-menu.tsx +557 -0
  153. package/src/internal/plate-editor/plate-ui/block-selection.tsx +47 -0
  154. package/src/internal/plate-editor/plate-ui/block-suggestion.tsx +469 -0
  155. package/src/internal/plate-editor/plate-ui/blockquote-node-static.tsx +10 -0
  156. package/src/internal/plate-editor/plate-ui/blockquote-node.tsx +11 -0
  157. package/src/internal/plate-editor/plate-ui/button.tsx +190 -0
  158. package/src/internal/plate-editor/plate-ui/calendar.tsx +3 -0
  159. package/src/internal/plate-editor/plate-ui/callout-node-static.tsx +76 -0
  160. package/src/internal/plate-editor/plate-ui/callout-node.tsx +54 -0
  161. package/src/internal/plate-editor/plate-ui/caption.tsx +48 -0
  162. package/src/internal/plate-editor/plate-ui/checkbox.tsx +3 -0
  163. package/src/internal/plate-editor/plate-ui/code-block-node-static.tsx +172 -0
  164. package/src/internal/plate-editor/plate-ui/code-block-node.tsx +228 -0
  165. package/src/internal/plate-editor/plate-ui/code-node-static.tsx +11 -0
  166. package/src/internal/plate-editor/plate-ui/code-node.tsx +12 -0
  167. package/src/internal/plate-editor/plate-ui/column-node-static.tsx +65 -0
  168. package/src/internal/plate-editor/plate-ui/column-node.tsx +24 -0
  169. package/src/internal/plate-editor/plate-ui/command.tsx +204 -0
  170. package/src/internal/plate-editor/plate-ui/comment-node-static.tsx +12 -0
  171. package/src/internal/plate-editor/plate-ui/comment-node.tsx +45 -0
  172. package/src/internal/plate-editor/plate-ui/comment-toolbar-button.tsx +24 -0
  173. package/src/internal/plate-editor/plate-ui/comment.tsx +619 -0
  174. package/src/internal/plate-editor/plate-ui/cursor-overlay.tsx +85 -0
  175. package/src/internal/plate-editor/plate-ui/date-node-static.tsx +43 -0
  176. package/src/internal/plate-editor/plate-ui/date-node.tsx +56 -0
  177. package/src/internal/plate-editor/plate-ui/dialog.tsx +426 -0
  178. package/src/internal/plate-editor/plate-ui/dropdown-menu.tsx +266 -0
  179. package/src/internal/plate-editor/plate-ui/editor-static.tsx +40 -0
  180. package/src/internal/plate-editor/plate-ui/editor.tsx +148 -0
  181. package/src/internal/plate-editor/plate-ui/emoji-node.tsx +48 -0
  182. package/src/internal/plate-editor/plate-ui/emoji-toolbar-button.tsx +626 -0
  183. package/src/internal/plate-editor/plate-ui/equation-node-static.tsx +155 -0
  184. package/src/internal/plate-editor/plate-ui/equation-node.tsx +226 -0
  185. package/src/internal/plate-editor/plate-ui/equation-toolbar-button.tsx +26 -0
  186. package/src/internal/plate-editor/plate-ui/export-toolbar-button.tsx +208 -0
  187. package/src/internal/plate-editor/plate-ui/fixed-toolbar-buttons.tsx +157 -0
  188. package/src/internal/plate-editor/plate-ui/fixed-toolbar.tsx +27 -0
  189. package/src/internal/plate-editor/plate-ui/floating-discussion.tsx +1129 -0
  190. package/src/internal/plate-editor/plate-ui/floating-toolbar-buttons.tsx +129 -0
  191. package/src/internal/plate-editor/plate-ui/floating-toolbar.tsx +99 -0
  192. package/src/internal/plate-editor/plate-ui/font-color-toolbar-button.tsx +211 -0
  193. package/src/internal/plate-editor/plate-ui/font-size-toolbar-button.tsx +154 -0
  194. package/src/internal/plate-editor/plate-ui/ghost-text.tsx +20 -0
  195. package/src/internal/plate-editor/plate-ui/heading-node-static.tsx +52 -0
  196. package/src/internal/plate-editor/plate-ui/heading-node.tsx +56 -0
  197. package/src/internal/plate-editor/plate-ui/highlight-node-static.tsx +9 -0
  198. package/src/internal/plate-editor/plate-ui/highlight-node.tsx +11 -0
  199. package/src/internal/plate-editor/plate-ui/history-toolbar-button.tsx +52 -0
  200. package/src/internal/plate-editor/plate-ui/hover-card.tsx +7 -0
  201. package/src/internal/plate-editor/plate-ui/hr-node-static.tsx +18 -0
  202. package/src/internal/plate-editor/plate-ui/hr-node.tsx +28 -0
  203. package/src/internal/plate-editor/plate-ui/import-toolbar-button.tsx +124 -0
  204. package/src/internal/plate-editor/plate-ui/indent-toolbar-button.tsx +34 -0
  205. package/src/internal/plate-editor/plate-ui/inline-combobox.tsx +409 -0
  206. package/src/internal/plate-editor/plate-ui/input.tsx +39 -0
  207. package/src/internal/plate-editor/plate-ui/insert-toolbar-button.tsx +260 -0
  208. package/src/internal/plate-editor/plate-ui/label.tsx +1 -0
  209. package/src/internal/plate-editor/plate-ui/line-height-toolbar-button.tsx +71 -0
  210. package/src/internal/plate-editor/plate-ui/link-node-static.tsx +15 -0
  211. package/src/internal/plate-editor/plate-ui/link-node.tsx +33 -0
  212. package/src/internal/plate-editor/plate-ui/link-toolbar-button.tsx +30 -0
  213. package/src/internal/plate-editor/plate-ui/link-toolbar.tsx +149 -0
  214. package/src/internal/plate-editor/plate-ui/list-toolbar-button.tsx +179 -0
  215. package/src/internal/plate-editor/plate-ui/mark-toolbar-button.tsx +36 -0
  216. package/src/internal/plate-editor/plate-ui/media-audio-node-static.tsx +21 -0
  217. package/src/internal/plate-editor/plate-ui/media-audio-node.tsx +32 -0
  218. package/src/internal/plate-editor/plate-ui/media-embed-node.tsx +103 -0
  219. package/src/internal/plate-editor/plate-ui/media-file-node-static.tsx +30 -0
  220. package/src/internal/plate-editor/plate-ui/media-file-node.tsx +52 -0
  221. package/src/internal/plate-editor/plate-ui/media-image-node-static.tsx +37 -0
  222. package/src/internal/plate-editor/plate-ui/media-image-node.tsx +183 -0
  223. package/src/internal/plate-editor/plate-ui/media-placeholder-node.tsx +441 -0
  224. package/src/internal/plate-editor/plate-ui/media-preview-dialog.tsx +127 -0
  225. package/src/internal/plate-editor/plate-ui/media-toolbar-button.tsx +229 -0
  226. package/src/internal/plate-editor/plate-ui/media-toolbar.tsx +216 -0
  227. package/src/internal/plate-editor/plate-ui/media-upload-toast.tsx +73 -0
  228. package/src/internal/plate-editor/plate-ui/media-video-node-static.tsx +35 -0
  229. package/src/internal/plate-editor/plate-ui/media-video-node.tsx +119 -0
  230. package/src/internal/plate-editor/plate-ui/mention-node-static.tsx +46 -0
  231. package/src/internal/plate-editor/plate-ui/mention-node.tsx +79 -0
  232. package/src/internal/plate-editor/plate-ui/menu.tsx +532 -0
  233. package/src/internal/plate-editor/plate-ui/mode-toolbar-button.tsx +126 -0
  234. package/src/internal/plate-editor/plate-ui/more-toolbar-button.tsx +34 -0
  235. package/src/internal/plate-editor/plate-ui/paragraph-node-static.tsx +15 -0
  236. package/src/internal/plate-editor/plate-ui/paragraph-node.tsx +16 -0
  237. package/src/internal/plate-editor/plate-ui/popover.tsx +77 -0
  238. package/src/internal/plate-editor/plate-ui/progress.tsx +1 -0
  239. package/src/internal/plate-editor/plate-ui/remote-cursor-overlay.tsx +81 -0
  240. package/src/internal/plate-editor/plate-ui/resize-handle.tsx +88 -0
  241. package/src/internal/plate-editor/plate-ui/separator.tsx +43 -0
  242. package/src/internal/plate-editor/plate-ui/slash-node.tsx +435 -0
  243. package/src/internal/plate-editor/plate-ui/spinner.tsx +1 -0
  244. package/src/internal/plate-editor/plate-ui/suggestion-node-static.tsx +35 -0
  245. package/src/internal/plate-editor/plate-ui/suggestion-node.tsx +168 -0
  246. package/src/internal/plate-editor/plate-ui/suggestion-toolbar-button.tsx +24 -0
  247. package/src/internal/plate-editor/plate-ui/table-node-static.tsx +85 -0
  248. package/src/internal/plate-editor/plate-ui/table-node.tsx +285 -0
  249. package/src/internal/plate-editor/plate-ui/table-toolbar-button.tsx +254 -0
  250. package/src/internal/plate-editor/plate-ui/tabs.tsx +3 -0
  251. package/src/internal/plate-editor/plate-ui/textarea.tsx +58 -0
  252. package/src/internal/plate-editor/plate-ui/toc-node-static.tsx +142 -0
  253. package/src/internal/plate-editor/plate-ui/toc-node.tsx +57 -0
  254. package/src/internal/plate-editor/plate-ui/toc-sidebar.tsx +50 -0
  255. package/src/internal/plate-editor/plate-ui/toggle-node-static.tsx +18 -0
  256. package/src/internal/plate-editor/plate-ui/toggle-node.tsx +33 -0
  257. package/src/internal/plate-editor/plate-ui/toggle-toolbar-button.tsx +26 -0
  258. package/src/internal/plate-editor/plate-ui/toggle.tsx +3 -0
  259. package/src/internal/plate-editor/plate-ui/toolbar.tsx +380 -0
  260. package/src/internal/plate-editor/plate-ui/tooltip.tsx +149 -0
  261. package/src/internal/plate-editor/plate-ui/turn-into-toolbar-button.tsx +177 -0
  262. package/src/internal/plate-editor/types/index.ts +22 -0
  263. package/src/internal/plate-editor/vite.ts +284 -0
  264. package/src/internal/sheets/components/univer-sheets.tsx +1104 -0
  265. package/src/internal/sheets/i18n/context.tsx +183 -0
  266. package/src/internal/sheets/i18n/index.ts +19 -0
  267. package/src/internal/sheets/i18n/locales/de.json +21 -0
  268. package/src/internal/sheets/i18n/locales/el.json +21 -0
  269. package/src/internal/sheets/i18n/locales/en.json +21 -0
  270. package/src/internal/sheets/i18n/locales/es.json +21 -0
  271. package/src/internal/sheets/i18n/locales/fr.json +21 -0
  272. package/src/internal/sheets/i18n/locales/it.json +21 -0
  273. package/src/internal/sheets/i18n/locales/pt.json +21 -0
  274. package/src/internal/sheets/i18n/locales/sl.json +21 -0
  275. package/src/internal/sheets/i18n/locales/tr.json +21 -0
  276. package/src/internal/sheets/i18n/types.ts +23 -0
  277. package/src/internal/sheets/i18n/use-translation.ts +17 -0
  278. package/src/internal/sheets/index.ts +14 -0
  279. package/src/internal/sheets/types/css.d.ts +11 -0
  280. package/src/internal/sheets/types/index.ts +260 -0
  281. package/src/internal/sheets/xlsx.ts +1169 -0
  282. package/src/lib/api-client.ts +77 -0
  283. package/src/lib/assistant-api-actions.ts +549 -0
  284. package/src/lib/assistant-config.tsx +71 -0
  285. package/src/lib/class-utils.ts +40 -0
  286. package/src/lib/index.ts +7 -0
  287. package/src/lib/message-utils.ts +131 -0
  288. package/src/tools/tools-schema.json +512 -0
  289. package/src/types/index.ts +235 -0
  290. package/src/views/assistant-view.tsx +1137 -0
  291. package/src/views/canvas-app.tsx +839 -0
  292. package/src/views/canvas-code.tsx +93 -0
  293. package/src/views/canvas-deep-research.tsx +44 -0
  294. package/src/views/canvas-image.tsx +25 -0
  295. package/src/views/canvas-record-view.tsx +285 -0
  296. package/src/views/canvas-spreadsheet.tsx +125 -0
  297. package/src/views/canvas-text.tsx +52 -0
  298. package/src/views/canvas.tsx +274 -0
  299. package/src/views/chat-panel.tsx +149 -0
  300. package/src/views/index.ts +20 -0
  301. package/src/views/memories-panel.tsx +365 -0
  302. package/src/views/message-list.tsx +370 -0
  303. package/src/views/project-detail.tsx +257 -0
  304. package/src/views/projects-panel.tsx +131 -0
  305. package/src/views/sessions-list.tsx +98 -0
  306. package/src/views/sidebar-content.tsx +256 -0
  307. package/src/views/work-detail.tsx +98 -0
  308. package/src/vite.ts +284 -0
@@ -0,0 +1,626 @@
1
+ 'use client';
2
+
3
+ import {
4
+ memo, useCallback, type ComponentPropsWithoutRef, type ReactElement, type ReactNode
5
+ } from 'react';
6
+
7
+ import {
8
+ type IEmojiFloatingLibrary,
9
+ type UseEmojiPickerType, useEmojiDropdownMenuState
10
+ } from '@platejs/emoji/react';
11
+
12
+ import {
13
+ type Emoji,
14
+ type EmojiCategoryList,
15
+ type EmojiIconList,
16
+ EmojiSettings,
17
+ type GridRow
18
+ } from '@platejs/emoji';
19
+
20
+ import {
21
+ AppleIcon,
22
+ ClockIcon,
23
+ CompassIcon,
24
+ DeleteIcon,
25
+ FlagIcon,
26
+ LeafIcon,
27
+ LightbulbIcon,
28
+ MusicIcon,
29
+ SearchIcon,
30
+ SmileIcon,
31
+ StarIcon,
32
+ XIcon
33
+ } from 'lucide-react';
34
+ import { Popover } from 'radix-ui';
35
+
36
+ import { cn } from '@docyrus/ui-pro-shared/lib/utils';
37
+
38
+ import { Button } from './button';
39
+ import { ToolbarButton } from './toolbar';
40
+
41
+ export function EmojiPopover({
42
+ children,
43
+ control,
44
+ isOpen,
45
+ setIsOpen
46
+ }: {
47
+ children: ReactNode;
48
+ control: ReactNode;
49
+ isOpen: boolean;
50
+ setIsOpen: (open: boolean) => void;
51
+ }) {
52
+ return (
53
+ <Popover.Root onOpenChange={setIsOpen} open={isOpen}>
54
+ <Popover.Trigger asChild>{control}</Popover.Trigger>
55
+
56
+ <Popover.Portal>
57
+ <Popover.Content className="z-100">{children}</Popover.Content>
58
+ </Popover.Portal>
59
+ </Popover.Root>
60
+ );
61
+ }
62
+
63
+ export function EmojiPicker({
64
+ clearSearch,
65
+ emoji,
66
+ emojiLibrary,
67
+ focusedCategory,
68
+ hasFound,
69
+ i18n,
70
+ icons = {
71
+ categories: emojiCategoryIcons,
72
+ search: emojiSearchIcons
73
+ },
74
+ isSearching,
75
+ refs,
76
+ searchResult,
77
+ searchValue,
78
+ setSearch,
79
+ settings = EmojiSettings,
80
+ visibleCategories,
81
+ handleCategoryClick,
82
+ onMouseOver,
83
+ onSelectEmoji
84
+ }: Omit<UseEmojiPickerType, 'icons'> & {
85
+ icons?: EmojiIconList<ReactElement>;
86
+ }) {
87
+ return (
88
+ <div
89
+ className={cn(
90
+ 'flex flex-col rounded-xl bg-popover text-popover-foreground',
91
+ 'h-[23rem] w-80 border shadow-md'
92
+ )}>
93
+ <EmojiPickerNavigation
94
+ emojiLibrary={emojiLibrary}
95
+ focusedCategory={focusedCategory}
96
+ i18n={i18n}
97
+ icons={icons}
98
+ onClick={handleCategoryClick} />
99
+ <EmojiPickerSearchBar
100
+ i18n={i18n}
101
+ searchValue={searchValue}
102
+ setSearch={setSearch}>
103
+ <EmojiPickerSearchAndClear
104
+ clearSearch={clearSearch}
105
+ i18n={i18n}
106
+ searchValue={searchValue} />
107
+ </EmojiPickerSearchBar>
108
+ <EmojiPickerContent
109
+ emojiLibrary={emojiLibrary}
110
+ i18n={i18n}
111
+ isSearching={isSearching}
112
+ onMouseOver={onMouseOver}
113
+ onSelectEmoji={onSelectEmoji}
114
+ refs={refs}
115
+ searchResult={searchResult}
116
+ settings={settings}
117
+ visibleCategories={visibleCategories} />
118
+ <EmojiPickerPreview
119
+ emoji={emoji}
120
+ hasFound={hasFound}
121
+ i18n={i18n}
122
+ isSearching={isSearching} />
123
+ </div>
124
+ );
125
+ }
126
+
127
+ const EmojiButton = memo(
128
+ ({
129
+ emoji,
130
+ index,
131
+ onMouseOver,
132
+ onSelect
133
+ }: {
134
+ emoji: Emoji;
135
+ index: number;
136
+ onMouseOver: (emoji?: Emoji) => void;
137
+ onSelect: (emoji: Emoji) => void;
138
+ }) => (
139
+ <button
140
+ aria-label={emoji.skins[0].native}
141
+ className="group relative flex size-9 cursor-pointer items-center justify-center border-none bg-transparent text-2xl leading-none"
142
+ data-index={index}
143
+ onClick={() => onSelect(emoji)}
144
+ onMouseEnter={() => onMouseOver(emoji)}
145
+ onMouseLeave={() => onMouseOver()}
146
+ tabIndex={-1}
147
+ type="button">
148
+ <div
149
+ aria-hidden="true"
150
+ className="absolute inset-0 rounded-full opacity-0 group-hover:opacity-100" />
151
+ <span
152
+ className="relative"
153
+ data-emoji-set="native"
154
+ style={{
155
+ fontFamily:
156
+ '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
157
+ }}>
158
+ {emoji.skins[0].native}
159
+ </span>
160
+ </button>
161
+ )
162
+ );
163
+
164
+ const RowOfButtons = memo(
165
+ ({
166
+ emojiLibrary,
167
+ row,
168
+ onMouseOver,
169
+ onSelectEmoji
170
+ }: {
171
+ row: GridRow;
172
+ } & Pick<
173
+ UseEmojiPickerType,
174
+ 'emojiLibrary' | 'onMouseOver' | 'onSelectEmoji'
175
+ >) => (
176
+ <div className="flex" data-index={row.id} key={row.id}>
177
+ {row.elements.map((emojiId, index) => (
178
+ <EmojiButton
179
+ emoji={emojiLibrary.getEmoji(emojiId)}
180
+ index={index}
181
+ key={emojiId}
182
+ onMouseOver={onMouseOver}
183
+ onSelect={onSelectEmoji} />
184
+ ))}
185
+ </div>
186
+ )
187
+ );
188
+
189
+ function EmojiSearchList({
190
+ emojiLibrary,
191
+ getRowWidth,
192
+ i18nSearchResult,
193
+ searchResult,
194
+ onSelectEmoji,
195
+ onMouseOver
196
+ }: {
197
+ emojiLibrary: UseEmojiPickerType['emojiLibrary'];
198
+ getRowWidth: number;
199
+ i18nSearchResult: string;
200
+ searchResult: UseEmojiPickerType['searchResult'];
201
+ onSelectEmoji: UseEmojiPickerType['onSelectEmoji'];
202
+ onMouseOver: UseEmojiPickerType['onMouseOver'];
203
+ }) {
204
+ return (
205
+ <div data-id="search" style={{ width: getRowWidth }}>
206
+ <div className="-top-px sticky z-1 bg-popover/90 p-1 py-2 font-semibold text-card-foreground text-sm backdrop-blur-xs">
207
+ {i18nSearchResult}
208
+ </div>
209
+ <div className="relative flex flex-wrap">
210
+ {searchResult.map((emoji: Emoji, index: number) => (
211
+ <EmojiButton
212
+ emoji={emojiLibrary.getEmoji(emoji.id)}
213
+ index={index}
214
+ key={emoji.id}
215
+ onMouseOver={onMouseOver}
216
+ onSelect={onSelectEmoji} />
217
+ ))}
218
+ </div>
219
+ </div>
220
+ );
221
+ }
222
+
223
+ function EmojiPickerContent({
224
+ emojiLibrary,
225
+ i18n,
226
+ isSearching = false,
227
+ refs,
228
+ searchResult,
229
+ settings = EmojiSettings,
230
+ visibleCategories,
231
+ onMouseOver,
232
+ onSelectEmoji
233
+ }: Pick<
234
+ UseEmojiPickerType,
235
+ | 'emojiLibrary'
236
+ | 'i18n'
237
+ | 'isSearching'
238
+ | 'onMouseOver'
239
+ | 'onSelectEmoji'
240
+ | 'refs'
241
+ | 'searchResult'
242
+ | 'settings'
243
+ | 'visibleCategories'
244
+ >) {
245
+ const getRowWidth = settings.perLine.value * settings.buttonSize.value;
246
+
247
+ const isCategoryVisible = useCallback(
248
+ (categoryId: any) => visibleCategories.has(categoryId) ? visibleCategories.get(categoryId) : false,
249
+ [visibleCategories]
250
+ );
251
+
252
+ const EmojiList = useCallback(
253
+ () => emojiLibrary
254
+ .getGrid()
255
+ .sections()
256
+ .map(({ id: categoryId }) => {
257
+ const section = emojiLibrary.getGrid().section(categoryId);
258
+ const { buttonSize } = settings;
259
+
260
+ return (
261
+ <div
262
+ data-id={categoryId}
263
+ key={categoryId}
264
+ ref={section.root}
265
+ style={{ width: getRowWidth }}>
266
+ <div className="-top-px sticky z-1 bg-popover/90 p-1 py-2 font-semibold text-sm backdrop-blur-xs">
267
+ {i18n.categories[categoryId]}
268
+ </div>
269
+ <div
270
+ className="relative flex flex-wrap"
271
+ style={{ height: section.getRows().length * buttonSize.value }}>
272
+ {isCategoryVisible(categoryId)
273
+ && section
274
+ .getRows()
275
+ .map((row: GridRow) => (
276
+ <RowOfButtons
277
+ emojiLibrary={emojiLibrary}
278
+ key={row.id}
279
+ onMouseOver={onMouseOver}
280
+ onSelectEmoji={onSelectEmoji}
281
+ row={row} />
282
+ ))}
283
+ </div>
284
+ </div>
285
+ );
286
+ }),
287
+ [
288
+ emojiLibrary,
289
+ getRowWidth,
290
+ i18n.categories,
291
+ isCategoryVisible,
292
+ onSelectEmoji,
293
+ onMouseOver,
294
+ settings
295
+ ]
296
+ );
297
+
298
+ return (
299
+ <div
300
+ className={cn(
301
+ 'h-full min-h-[50%] overflow-y-auto overflow-x-hidden px-2',
302
+ '[&::-webkit-scrollbar]:w-4',
303
+ '[&::-webkit-scrollbar-button]:hidden [&::-webkit-scrollbar-button]:size-0',
304
+ ':hover:[&::-webkit-scrollbar-thumb]:bg-[#f3f4f6]',
305
+ '[&::-webkit-scrollbar-thumb]:min-h-[65px] [&::-webkit-scrollbar-thumb]:rounded-2xl [&::-webkit-scrollbar-thumb]:border-4 [&::-webkit-scrollbar-thumb]:border-white',
306
+ '[&::-webkit-scrollbar-track]:border-0'
307
+ )}
308
+ data-id="scroll"
309
+ ref={refs.current.contentRoot}>
310
+ <div className="h-full" ref={refs.current.content}>
311
+ {isSearching ? (
312
+ <EmojiSearchList
313
+ emojiLibrary={emojiLibrary}
314
+ getRowWidth={getRowWidth}
315
+ i18nSearchResult={i18n.searchResult}
316
+ onMouseOver={onMouseOver}
317
+ onSelectEmoji={onSelectEmoji}
318
+ searchResult={searchResult} />
319
+ ) : EmojiList()}
320
+ </div>
321
+ </div>
322
+ );
323
+ }
324
+
325
+ function EmojiPickerSearchBar({
326
+ children,
327
+ i18n,
328
+ searchValue,
329
+ setSearch
330
+ }: {
331
+ children: ReactNode;
332
+ } & Pick<UseEmojiPickerType, 'i18n' | 'searchValue' | 'setSearch'>) {
333
+ return (
334
+ <div className="flex items-center px-2">
335
+ <div className="relative flex grow items-center">
336
+ <input
337
+ aria-label="Search"
338
+ autoComplete="off"
339
+ className="block w-full appearance-none rounded-full border-0 bg-muted px-10 py-2 text-sm outline-hidden placeholder:text-muted-foreground focus-visible:outline-hidden"
340
+ onChange={event => setSearch(event.target.value)}
341
+ placeholder={i18n.search}
342
+ type="text"
343
+ value={searchValue} />
344
+ {children}
345
+ </div>
346
+ </div>
347
+ );
348
+ }
349
+
350
+ function EmojiPickerSearchAndClear({
351
+ clearSearch,
352
+ i18n,
353
+ searchValue
354
+ }: Pick<UseEmojiPickerType, 'clearSearch' | 'i18n' | 'searchValue'>) {
355
+ return (
356
+ <div className="flex items-center">
357
+ <div
358
+ className={cn(
359
+ '-translate-y-1/2 absolute top-1/2 left-3 z-10 flex size-5 items-center justify-center'
360
+ )}>
361
+ <SearchIcon className="size-4" />
362
+ </div>
363
+ {searchValue && (
364
+ <Button
365
+ aria-label="Clear"
366
+ className={cn(
367
+ '-translate-y-1/2 absolute top-1/2 right-1 flex size-8 cursor-pointer items-center justify-center border-none bg-transparent'
368
+ )}
369
+ onClick={clearSearch}
370
+ size="icon"
371
+ title={i18n.clear}
372
+ type="button"
373
+ variant="ghost">
374
+ <DeleteIcon className="size-4" />
375
+ </Button>
376
+ )}
377
+ </div>
378
+ );
379
+ }
380
+
381
+ function EmojiPreview({ emoji }: Pick<UseEmojiPickerType, 'emoji'>) {
382
+ return (
383
+ <div className="flex h-20 items-center border-muted border-t p-2">
384
+ <div
385
+ className="flex items-center justify-center text-2xl"
386
+ style={{
387
+ fontFamily:
388
+ '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
389
+ }}>
390
+ {emoji?.skins[0].native}
391
+ </div>
392
+ <div className="overflow-hidden pl-2">
393
+ <div className="truncate text-sm">{emoji?.name}</div>
394
+ <div className="truncate text-xs">{`:${emoji?.id}:`}</div>
395
+ </div>
396
+ </div>
397
+ );
398
+ }
399
+
400
+ function NoEmoji({ i18n }: Pick<UseEmojiPickerType, 'i18n'>) {
401
+ return (
402
+ <div className="flex h-20 items-center border-muted border-t p-2">
403
+ <div className="flex items-center justify-center text-2xl">&#x1F622;</div>
404
+ <div className="overflow-hidden pl-2">
405
+ <div className="truncate font-semibold text-primary text-sm">
406
+ {i18n.searchNoResultsTitle}
407
+ </div>
408
+ <div className="truncate text-xs">{i18n.searchNoResultsSubtitle}</div>
409
+ </div>
410
+ </div>
411
+ );
412
+ }
413
+
414
+ function PickAnEmoji({ i18n }: Pick<UseEmojiPickerType, 'i18n'>) {
415
+ return (
416
+ <div className="flex h-20 items-center border-muted border-t p-2">
417
+ <div className="flex items-center justify-center text-2xl">&#x261D;&#xFE0F;</div>
418
+ <div className="overflow-hidden pl-2">
419
+ <div className="truncate font-semibold text-sm">{i18n.pick}</div>
420
+ </div>
421
+ </div>
422
+ );
423
+ }
424
+
425
+ function EmojiPickerPreview({
426
+ emoji,
427
+ hasFound = true,
428
+ i18n,
429
+ isSearching = false,
430
+ ...props
431
+ }: Pick<UseEmojiPickerType, 'emoji' | 'hasFound' | 'i18n' | 'isSearching'>) {
432
+ const showPickEmoji = !emoji && !(isSearching && !hasFound);
433
+ const showNoEmoji = isSearching && !hasFound;
434
+ const showPreview = emoji;
435
+
436
+ return (
437
+ <>
438
+ {showPreview && <EmojiPreview emoji={emoji} {...props} />}
439
+ {showPickEmoji && <PickAnEmoji i18n={i18n} {...props} />}
440
+ {showNoEmoji && <NoEmoji i18n={i18n} {...props} />}
441
+ </>
442
+ );
443
+ }
444
+
445
+ const getBarProperty = (
446
+ emojiLibrary: IEmojiFloatingLibrary,
447
+ focusedCategory?: EmojiCategoryList
448
+ ) => {
449
+ let width = 0;
450
+ let position = 0;
451
+
452
+ if (focusedCategory) {
453
+ width = 100 / emojiLibrary.getGrid().size;
454
+ position = focusedCategory ? emojiLibrary.indexOf(focusedCategory) * 100 : 0;
455
+ }
456
+
457
+ return { position, width };
458
+ };
459
+
460
+ function EmojiPickerNavigation({
461
+ emojiLibrary,
462
+ focusedCategory,
463
+ i18n,
464
+ icons,
465
+ onClick
466
+ }: {
467
+ onClick: (id: EmojiCategoryList) => void;
468
+ } & Pick<
469
+ UseEmojiPickerType,
470
+ 'emojiLibrary' | 'focusedCategory' | 'i18n' | 'icons'
471
+ >) {
472
+ const { position, width } = getBarProperty(emojiLibrary, focusedCategory);
473
+
474
+ return (
475
+ <nav
476
+ className="mb-2.5 border-0 border-b border-b-border border-solid p-3"
477
+ id="emoji-nav">
478
+ <div className="relative flex items-center">
479
+ {emojiLibrary
480
+ .getGrid()
481
+ .sections()
482
+ .map(({ id }) => (
483
+ <Button
484
+ aria-label={i18n.categories[id]}
485
+ className={cn(
486
+ 'size-6 grow fill-current text-muted-foreground hover:bg-transparent hover:text-foreground',
487
+ id === focusedCategory
488
+ && 'pointer-events-none fill-current text-primary'
489
+ )}
490
+ key={id}
491
+ onClick={() => onClick(id)}
492
+ size="icon"
493
+ title={i18n.categories[id]}
494
+ type="button"
495
+ variant="ghost">
496
+ <span className="size-5">{icons.categories[id].outline}</span>
497
+ </Button>
498
+ ))}
499
+ <div
500
+ className="-bottom-3 absolute left-0 h-0.5 w-full rounded-t-lg bg-primary opacity-100 transition-transform duration-200"
501
+ style={{
502
+ transform: `translateX(${position}%)`,
503
+ visibility: `${focusedCategory ? 'visible' : 'hidden'}`,
504
+ width: `${width}%`
505
+ }} />
506
+ </div>
507
+ </nav>
508
+ );
509
+ }
510
+
511
+ export const emojiCategoryIcons: Record<
512
+ EmojiCategoryList,
513
+ { outline: ReactElement; solid: ReactElement }
514
+ > = {
515
+ activity: {
516
+ outline: (
517
+ <svg
518
+ className="size-full"
519
+ fill="none"
520
+ stroke="currentColor"
521
+ strokeLinecap="round"
522
+ strokeLinejoin="round"
523
+ strokeWidth="2"
524
+ viewBox="0 0 24 24"
525
+ xmlns="http://www.w3.org/2000/svg">
526
+ <circle cx="12" cy="12" r="10" />
527
+ <path d="M2.1 13.4A10.1 10.1 0 0 0 13.4 2.1" />
528
+ <path d="m5 4.9 14 14.2" />
529
+ <path d="M21.9 10.6a10.1 10.1 0 0 0-11.3 11.3" />
530
+ </svg>
531
+ ),
532
+ solid: (
533
+ <svg
534
+ className="size-full"
535
+ fill="none"
536
+ stroke="currentColor"
537
+ strokeLinecap="round"
538
+ strokeLinejoin="round"
539
+ strokeWidth="2"
540
+ viewBox="0 0 24 24"
541
+ xmlns="http://www.w3.org/2000/svg">
542
+ <circle cx="12" cy="12" r="10" />
543
+ <path d="M2.1 13.4A10.1 10.1 0 0 0 13.4 2.1" />
544
+ <path d="m5 4.9 14 14.2" />
545
+ <path d="M21.9 10.6a10.1 10.1 0 0 0-11.3 11.3" />
546
+ </svg>
547
+ )
548
+ },
549
+
550
+ custom: {
551
+ outline: <StarIcon className="size-full" />,
552
+ solid: <StarIcon className="size-full" />
553
+ },
554
+
555
+ flags: {
556
+ outline: <FlagIcon className="size-full" />,
557
+ solid: <FlagIcon className="size-full" />
558
+ },
559
+
560
+ foods: {
561
+ outline: <AppleIcon className="size-full" />,
562
+ solid: <AppleIcon className="size-full" />
563
+ },
564
+
565
+ frequent: {
566
+ outline: <ClockIcon className="size-full" />,
567
+ solid: <ClockIcon className="size-full" />
568
+ },
569
+
570
+ nature: {
571
+ outline: <LeafIcon className="size-full" />,
572
+ solid: <LeafIcon className="size-full" />
573
+ },
574
+
575
+ objects: {
576
+ outline: <LightbulbIcon className="size-full" />,
577
+ solid: <LightbulbIcon className="size-full" />
578
+ },
579
+
580
+ people: {
581
+ outline: <SmileIcon className="size-full" />,
582
+ solid: <SmileIcon className="size-full" />
583
+ },
584
+
585
+ places: {
586
+ outline: <CompassIcon className="size-full" />,
587
+ solid: <CompassIcon className="size-full" />
588
+ },
589
+
590
+ symbols: {
591
+ outline: <MusicIcon className="size-full" />,
592
+ solid: <MusicIcon className="size-full" />
593
+ }
594
+ };
595
+
596
+ const emojiSearchIcons = {
597
+ delete: <XIcon className="size-4 text-current" />,
598
+ loupe: <SearchIcon className="size-4 text-current" />
599
+ };
600
+
601
+ export function EmojiToolbarButton({
602
+ options,
603
+ ...props
604
+ }: {
605
+ options?: any;
606
+ } & ComponentPropsWithoutRef<typeof ToolbarButton>) {
607
+ const { emojiPickerState, isOpen, setIsOpen }
608
+ = useEmojiDropdownMenuState(options);
609
+
610
+ return (
611
+ <EmojiPopover
612
+ control={
613
+ <ToolbarButton pressed={isOpen} tooltip="Emoji" isDropdown {...props}>
614
+ <SmileIcon />
615
+ </ToolbarButton>
616
+ }
617
+ isOpen={isOpen}
618
+ setIsOpen={setIsOpen}>
619
+ <EmojiPicker
620
+ {...emojiPickerState}
621
+ isOpen={isOpen}
622
+ setIsOpen={setIsOpen}
623
+ settings={options?.settings} />
624
+ </EmojiPopover>
625
+ );
626
+ }