@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,129 @@
1
+ 'use client';
2
+
3
+ import {
4
+ Bold,
5
+ Code2,
6
+ Italic,
7
+ type LucideProps,
8
+ Strikethrough,
9
+ Underline
10
+ } from 'lucide-react';
11
+ import { KEYS } from 'platejs';
12
+ import {
13
+ useEditorMounted,
14
+ useEditorReadOnly,
15
+ useEditorRef,
16
+ useSelectionAcrossBlocks
17
+ } from 'platejs/react';
18
+
19
+ import { AIToolbarButton } from './ai-toolbar-button';
20
+ import { CommentToolbarButton } from './comment-toolbar-button';
21
+ import { InlineEquationToolbarButton } from './equation-toolbar-button';
22
+ import { FontColorToolbarButton } from './font-color-toolbar-button';
23
+ import { LinkToolbarButton } from './link-toolbar-button';
24
+ import { MarkToolbarButton } from './mark-toolbar-button';
25
+ import { MoreToolbarButton } from './more-toolbar-button';
26
+ import { SuggestionToolbarButton } from './suggestion-toolbar-button';
27
+ import { ToolbarGroup } from './toolbar';
28
+ import { TurnIntoToolbarButton } from './turn-into-toolbar-button';
29
+
30
+ export function FloatingToolbarButtons() {
31
+ const editor = useEditorRef();
32
+ const readOnly = useEditorReadOnly();
33
+ const isMounted = useEditorMounted();
34
+ const isSelectionAcrossBlocks = useSelectionAcrossBlocks();
35
+
36
+ if (!isMounted) return null;
37
+
38
+ return (
39
+ <div
40
+ className="flex"
41
+ style={{
42
+ transform: 'translateX(calc(-1px))',
43
+ whiteSpace: 'nowrap'
44
+ }}>
45
+ {!readOnly && (
46
+ <>
47
+ <ToolbarGroup>
48
+ <AIToolbarButton
49
+ className="gap-1.5"
50
+ tooltip="Edit, generate, and more (⌘+J)">
51
+ <AIIcon className="!size-3" />
52
+ <div className="hidden bg-[linear-gradient(120deg,#6EB6F2_10%,#a855f7,#ea580c,#eab308)] bg-clip-text text-transparent sm:inline">
53
+ Ask AI
54
+ </div>
55
+ </AIToolbarButton>
56
+ </ToolbarGroup>
57
+
58
+ <ToolbarGroup>
59
+ {editor.plugins[KEYS.comment] && <CommentToolbarButton />}
60
+ <SuggestionToolbarButton />
61
+ </ToolbarGroup>
62
+ <ToolbarGroup>
63
+ <TurnIntoToolbarButton />
64
+
65
+ <MarkToolbarButton
66
+ nodeType={KEYS.bold}
67
+ tooltip="Bold (⌘+B)">
68
+ <Bold />
69
+ </MarkToolbarButton>
70
+
71
+ <MarkToolbarButton
72
+ nodeType={KEYS.italic}
73
+ tooltip="Italic (⌘+I)">
74
+ <Italic />
75
+ </MarkToolbarButton>
76
+
77
+ <MarkToolbarButton
78
+ nodeType={KEYS.underline}
79
+ tooltip="Underline (⌘+U)">
80
+ <Underline />
81
+ </MarkToolbarButton>
82
+
83
+ <MarkToolbarButton
84
+ nodeType={KEYS.strikethrough}
85
+ tooltip="Strikethrough (⌘+⇧+X)">
86
+ <Strikethrough />
87
+ </MarkToolbarButton>
88
+
89
+ <MarkToolbarButton
90
+ nodeType={KEYS.code}
91
+ tooltip="Code (⌘+E)">
92
+ <Code2 />
93
+ </MarkToolbarButton>
94
+
95
+ <InlineEquationToolbarButton />
96
+
97
+ <LinkToolbarButton />
98
+
99
+ <FontColorToolbarButton />
100
+ </ToolbarGroup>
101
+ <ToolbarGroup>
102
+ {!isSelectionAcrossBlocks && <MoreToolbarButton />}
103
+ </ToolbarGroup>
104
+ </>
105
+ )}
106
+ </div>
107
+ );
108
+ }
109
+
110
+ function AIIcon(props: LucideProps) {
111
+ return (
112
+ <svg
113
+ fill="url(#myGradient)"
114
+ viewBox="0 0 512 512"
115
+ xmlns="http://www.w3.org/2000/svg"
116
+ {...props}>
117
+ <defs>
118
+ <linearGradient id="myGradient" x1="0%" x2="100%" y1="0%" y2="100%">
119
+ <stop offset="0%" stopColor="#6EB6F2" />
120
+ <stop offset="15%" stopColor="#6EB6F2" />
121
+ <stop offset="40%" stopColor="#c084fc" />
122
+ <stop offset="60%" stopColor="#f87171" />
123
+ <stop offset="100%" stopColor="#fcd34d" />
124
+ </linearGradient>
125
+ </defs>
126
+ <path d="M161.15 362.26a40.902 40.902 0 0 0 23.78 7.52v-.11a40.989 40.989 0 0 0 37.75-24.8l17.43-53.02a81.642 81.642 0 0 1 51.68-51.53l50.57-16.44a41.051 41.051 0 0 0 20.11-15.31 40.964 40.964 0 0 0 7.32-24.19 41.077 41.077 0 0 0-8.23-23.89 41.051 41.051 0 0 0-20.68-14.54l-49.92-16.21a81.854 81.854 0 0 1-51.82-51.85L222.7 27.33A41.11 41.11 0 0 0 183.63.01c-8.54.07-16.86 2.8-23.78 7.81A41.152 41.152 0 0 0 145 27.97l-16.58 50.97c-4 11.73-10.61 22.39-19.33 31.19s-19.33 15.5-31.01 19.61l-50.54 16.24a41.131 41.131 0 0 0-15.89 10.14 41.059 41.059 0 0 0-9.69 16.17 41.144 41.144 0 0 0-1.44 18.8c.98 6.29 3.42 12.27 7.11 17.46a41.312 41.312 0 0 0 20.39 15.19l49.89 16.18a82.099 82.099 0 0 1 32.11 19.91c2.42 2.4 4.68 4.96 6.77 7.65a81.567 81.567 0 0 1 12.94 24.38l16.44 50.49a40.815 40.815 0 0 0 14.98 19.91zm218.06 143.57c-5.42-3.86-9.5-9.32-11.66-15.61l-9.33-28.64a37.283 37.283 0 0 0-8.9-14.48c-4.05-4.06-9-7.12-14.45-8.93l-28.19-9.19a32.655 32.655 0 0 1-16.24-12.06 32.062 32.062 0 0 1-5.97-18.74c.01-6.76 2.13-13.35 6.06-18.86 3.91-5.53 9.46-9.68 15.87-11.86l28.61-9.27a37.013 37.013 0 0 0 14.08-9.01c3.95-4.04 6.91-8.93 8.67-14.29l9.22-28.22a32.442 32.442 0 0 1 11.72-15.87 32.476 32.476 0 0 1 18.74-6.17c6.74-.07 13.33 1.96 18.86 5.81 5.53 3.84 9.74 9.31 12.03 15.64l9.36 28.84a36.832 36.832 0 0 0 8.94 14.34c4.05 4.03 8.97 7.06 14.39 8.87l28.22 9.19a32.44 32.44 0 0 1 16.29 11.52 32.465 32.465 0 0 1 6.47 18.87 32.458 32.458 0 0 1-21.65 31.19l-28.84 9.36a37.384 37.384 0 0 0-14.36 8.93c-4.05 4.06-7.1 9.01-8.9 14.45l-9.16 28.13A32.492 32.492 0 0 1 417 505.98a32.005 32.005 0 0 1-18.74 6.03 32.508 32.508 0 0 1-19.05-6.18z" />
127
+ </svg>
128
+ );
129
+ }
@@ -0,0 +1,99 @@
1
+ 'use client';
2
+
3
+ import { type ComponentProps } from 'react';
4
+
5
+ import * as React from 'react';
6
+
7
+ import { AIChatPlugin } from '@platejs/ai/react';
8
+ import {
9
+ type FloatingToolbarState,
10
+ flip,
11
+ offset,
12
+ shift,
13
+ useFloatingToolbar,
14
+ useFloatingToolbarState
15
+ } from '@platejs/floating';
16
+ import { BlockSelectionPlugin } from '@platejs/selection/react';
17
+ import {
18
+ useComposedRef,
19
+ useEditorRef,
20
+ useEventEditorValue,
21
+ usePluginOption
22
+ } from 'platejs/react';
23
+
24
+ import { cn } from '@docyrus/ui-pro-shared/lib/utils';
25
+
26
+ import { Toolbar } from './toolbar';
27
+
28
+ import { linkPlugin } from '../editor/plugins/link-kit';
29
+
30
+ export function FloatingToolbar({
31
+ children,
32
+ ref: refProp,
33
+ state,
34
+ ...props
35
+ }: ComponentProps<typeof Toolbar> & {
36
+ state?: FloatingToolbarState;
37
+ }) {
38
+ const editor = useEditorRef();
39
+ const focusedEditorId = useEventEditorValue('focus');
40
+ const isFloatingLinkOpen = !!usePluginOption(linkPlugin, 'mode');
41
+ const aiOpen = usePluginOption(AIChatPlugin, 'open');
42
+ const isSelectingSomeBlocks = usePluginOption(
43
+ BlockSelectionPlugin,
44
+ 'isSelectingSome'
45
+ );
46
+
47
+ const floatingToolbarState = useFloatingToolbarState({
48
+ editorId: editor.id,
49
+ focusedEditorId,
50
+ hideToolbar: aiOpen || isFloatingLinkOpen || isSelectingSomeBlocks,
51
+ ...state,
52
+ floatingOptions: {
53
+ middleware: [
54
+ offset({
55
+ crossAxis: -24,
56
+ mainAxis: 12
57
+ }),
58
+ shift({ padding: 50 }),
59
+ flip({
60
+ fallbackPlacements: [
61
+ 'top-start',
62
+ 'top-end',
63
+ 'bottom-start',
64
+ 'bottom-end'
65
+ ],
66
+ padding: 12
67
+ })
68
+ ],
69
+ placement: 'top-start',
70
+ ...state?.floatingOptions
71
+ }
72
+ });
73
+
74
+ const {
75
+ clickOutsideRef,
76
+ hidden,
77
+ props: rootProps,
78
+ ref: floatingRef
79
+ } = useFloatingToolbar(floatingToolbarState);
80
+
81
+ const ref = useComposedRef<HTMLDivElement>(refProp, floatingRef);
82
+
83
+ if (hidden) return null;
84
+
85
+ return (
86
+ <div ref={clickOutsideRef}>
87
+ <Toolbar
88
+ className={cn(
89
+ 'absolute z-50 animate-zoom whitespace-nowrap rounded-lg bg-popover p-1 opacity-100 shadow-toolbar print:hidden',
90
+ 'scrollbar-hide max-w-[80vw] overflow-x-auto'
91
+ )}
92
+ ref={ref}
93
+ {...rootProps}
94
+ {...props}>
95
+ {children}
96
+ </Toolbar>
97
+ </div>
98
+ );
99
+ }
@@ -0,0 +1,211 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+
5
+ import { useCallback, useState, type ComponentProps } from 'react';
6
+
7
+ import { KEYS } from 'platejs';
8
+ import { useEditorRef, useSelectionFragmentProp } from 'platejs/react';
9
+
10
+ import {
11
+ DropdownMenu,
12
+ DropdownMenuContent,
13
+ DropdownMenuGroup,
14
+ DropdownMenuLabel,
15
+ DropdownMenuPortal,
16
+ DropdownMenuRadioGroup,
17
+ DropdownMenuRadioItem,
18
+ DropdownMenuTrigger
19
+ } from './dropdown-menu';
20
+ import { ToolbarButton } from './toolbar';
21
+
22
+ export function FontColorToolbarButton(
23
+ props: ComponentProps<typeof DropdownMenu>
24
+ ) {
25
+ const editor = useEditorRef();
26
+
27
+ const color = useSelectionFragmentProp({
28
+ key: KEYS.color,
29
+ defaultValue: 'inherit',
30
+ mode: 'text'
31
+ });
32
+ const background = useSelectionFragmentProp({
33
+ key: KEYS.backgroundColor,
34
+ defaultValue: 'transparent',
35
+ mode: 'text'
36
+ });
37
+
38
+ const [lastUsed, setLastUsed] = useState<Record<
39
+ 'key' | 'label' | 'value',
40
+ string
41
+ > | null>(null);
42
+
43
+ const onColorChange = useCallback((color: string) => {
44
+ editor.tf.addMarks({ [KEYS.color]: color });
45
+ editor.tf.focus();
46
+
47
+ const { label } = textColorItems.find(item => item.value === color)!;
48
+
49
+ localStorage.setItem(
50
+ 'lastUsed',
51
+ JSON.stringify({ key: KEYS.color, label, value: color })
52
+ );
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
54
+ }, []);
55
+
56
+ const onBackgroundChange = useCallback((background: string) => {
57
+ editor.tf.addMarks({ [KEYS.backgroundColor]: background });
58
+ editor.tf.focus();
59
+
60
+ const { label } = backgroundColorItems.find(
61
+ item => item.value === background
62
+ )!;
63
+
64
+ localStorage.setItem(
65
+ 'lastUsed',
66
+ JSON.stringify({
67
+ key: KEYS.backgroundColor,
68
+ label,
69
+ value: background
70
+ })
71
+ );
72
+ // eslint-disable-next-line react-hooks/exhaustive-deps
73
+ }, []);
74
+
75
+ const onOpenChange = useCallback((open: boolean) => {
76
+ if (!open) return;
77
+
78
+ const local = localStorage.getItem('lastUsed');
79
+
80
+ if (local) {
81
+ return setLastUsed(JSON.parse(local));
82
+ }
83
+
84
+ setLastUsed(null);
85
+ }, []);
86
+
87
+ const onLastUsed = useCallback(() => {
88
+ if (!lastUsed) return;
89
+ if (lastUsed.key === KEYS.color) {
90
+ onColorChange(lastUsed.value);
91
+ } else {
92
+ onBackgroundChange(lastUsed.value);
93
+ }
94
+ // eslint-disable-next-line react-hooks/exhaustive-deps
95
+ }, [lastUsed]);
96
+
97
+ return (
98
+ <DropdownMenu modal={false} {...props} onOpenChange={onOpenChange}>
99
+ <DropdownMenuTrigger asChild>
100
+ <ToolbarButton isDropdown pressed={false} tooltip="Color">
101
+ <div
102
+ className="size-4 rounded-full"
103
+ style={{
104
+ background:
105
+ background === 'transparent' && color === 'inherit' ? 'linear-gradient(120deg, #6EB6F2 20%, #a855f7, #ea580c, #eab308 80%)' : color === 'inherit' ? background : color
106
+ }} />
107
+ </ToolbarButton>
108
+ </DropdownMenuTrigger>
109
+
110
+ <DropdownMenuPortal>
111
+ <DropdownMenuContent
112
+ align="start"
113
+ className="ignore-click-outside/toolbar h-96 overflow-y-auto"
114
+ data-plate-prevent-overlay>
115
+ {/* TODO:shortcut */}
116
+ {lastUsed && (
117
+ <DropdownMenuGroup>
118
+ <DropdownMenuLabel>Last used</DropdownMenuLabel>
119
+ <DropdownMenuRadioGroup className="flex flex-col gap-0.5">
120
+ <DropdownMenuRadioItem
121
+ className="min-w-[200px] gap-1.5"
122
+ onClick={onLastUsed}
123
+ value={lastUsed.value}>
124
+ <ColorIcon
125
+ group={lastUsed.key === KEYS.backgroundColor ? 'background' : 'color'}
126
+ value={lastUsed.value} />
127
+ {lastUsed.label}
128
+ </DropdownMenuRadioItem>
129
+ </DropdownMenuRadioGroup>
130
+ </DropdownMenuGroup>
131
+ )}
132
+
133
+ <DropdownMenuGroup>
134
+ <DropdownMenuLabel>Text color</DropdownMenuLabel>
135
+ <DropdownMenuRadioGroup
136
+ className="flex flex-col"
137
+ onValueChange={onColorChange}
138
+ value={color}>
139
+ {textColorItems.map(({ label, value: itemValue }) => (
140
+ <DropdownMenuRadioItem
141
+ className="min-w-[200px] gap-1.5"
142
+ key={itemValue}
143
+ value={itemValue}>
144
+ <ColorIcon group="color" value={itemValue} />
145
+ {label}
146
+ </DropdownMenuRadioItem>
147
+ ))}
148
+ </DropdownMenuRadioGroup>
149
+ </DropdownMenuGroup>
150
+
151
+ <DropdownMenuGroup>
152
+ <DropdownMenuLabel>Background color</DropdownMenuLabel>
153
+ <DropdownMenuRadioGroup
154
+ className="flex flex-col gap-0.5"
155
+ onValueChange={onBackgroundChange}
156
+ value={background}>
157
+ {backgroundColorItems.map(({ label, value: itemValue }) => (
158
+ <DropdownMenuRadioItem
159
+ className="min-w-[200px] gap-1.5"
160
+ key={itemValue}
161
+ value={itemValue}>
162
+ <ColorIcon group="background" value={itemValue} />
163
+ {label}
164
+ </DropdownMenuRadioItem>
165
+ ))}
166
+ </DropdownMenuRadioGroup>
167
+ </DropdownMenuGroup>
168
+ </DropdownMenuContent>
169
+ </DropdownMenuPortal>
170
+ </DropdownMenu>
171
+ );
172
+ }
173
+
174
+ export function ColorIcon({ group, value }: { group: string; value: string }) {
175
+ return (
176
+ <div
177
+ className="flex size-5 items-center justify-center rounded-sm border text-sm"
178
+ style={{
179
+ background: group === 'background' ? value : undefined,
180
+ color: group === 'color' ? value : undefined
181
+ }}>
182
+ A
183
+ </div>
184
+ );
185
+ }
186
+
187
+ export const textColorItems: { label: string; value: string }[] = [
188
+ { label: 'Default', value: 'inherit' },
189
+ { label: 'Gray', value: 'rgb(123, 122, 116)' },
190
+ { label: 'Brown', value: 'rgb(162, 110, 83)' },
191
+ { label: 'Orange', value: 'rgb(215, 110, 30)' },
192
+ { label: 'Yellow', value: 'rgb(205, 147, 47)' },
193
+ { label: 'Green', value: 'rgb(39, 124, 112)' },
194
+ { label: 'Blue', value: 'rgb(59, 109, 178)' },
195
+ { label: 'Purple', value: 'rgb(122, 68, 178)' },
196
+ { label: 'Pink', value: 'rgb(168, 62, 111)' },
197
+ { label: 'Red', value: 'rgb(190, 55, 55)' }
198
+ ];
199
+
200
+ export const backgroundColorItems: { label: string; value: string }[] = [
201
+ { label: 'Default background', value: 'transparent' },
202
+ { label: 'Gray background', value: 'rgb(241, 241, 239)' },
203
+ { label: 'Brown background', value: 'rgb(235, 229, 220)' },
204
+ { label: 'Orange background', value: 'rgb(254, 235, 200)' },
205
+ { label: 'Yellow background', value: 'rgb(254, 249, 195)' },
206
+ { label: 'Green background', value: 'rgb(204, 251, 241)' },
207
+ { label: 'Blue background', value: 'rgb(219, 234, 254)' },
208
+ { label: 'Purple background', value: 'rgb(243, 232, 255)' },
209
+ { label: 'Pink background', value: 'rgb(252, 231, 243)' },
210
+ { label: 'Red background', value: 'rgb(254, 226, 226)' }
211
+ ];
@@ -0,0 +1,154 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+
5
+ import * as React from 'react';
6
+
7
+ import { type TElement, KEYS } from 'platejs';
8
+
9
+ import { toUnitLess } from '@platejs/basic-styles';
10
+ import { FontSizePlugin } from '@platejs/basic-styles/react';
11
+ import { Minus, Plus } from 'lucide-react';
12
+ import { useEditorPlugin, useEditorSelector } from 'platejs/react';
13
+
14
+ import { cn } from '@docyrus/ui-pro-shared/lib/utils';
15
+
16
+ import {
17
+ Popover,
18
+ PopoverContent,
19
+ PopoverTrigger
20
+ } from './popover';
21
+
22
+ import { ToolbarButton } from './toolbar';
23
+
24
+ const DEFAULT_FONT_SIZE = '16';
25
+
26
+ const FONT_SIZE_MAP = {
27
+ h1: '36',
28
+ h2: '24',
29
+ h3: '20'
30
+ } as const;
31
+
32
+ const FONT_SIZES = [
33
+ '8',
34
+ '9',
35
+ '10',
36
+ '12',
37
+ '14',
38
+ '16',
39
+ '18',
40
+ '24',
41
+ '30',
42
+ '36',
43
+ '48',
44
+ '60',
45
+ '72',
46
+ '96'
47
+ ] as const;
48
+
49
+ export function FontSizeToolbarButton() {
50
+ const [inputValue, setInputValue] = useState(DEFAULT_FONT_SIZE);
51
+ const [isFocused, setIsFocused] = useState(false);
52
+ const { editor, tf } = useEditorPlugin(FontSizePlugin);
53
+
54
+ const cursorFontSize = useEditorSelector((editor) => {
55
+ if (!editor?.api) return DEFAULT_FONT_SIZE;
56
+
57
+ const fontSize = editor.api.marks()?.[KEYS.fontSize];
58
+
59
+ if (fontSize) {
60
+ return toUnitLess(fontSize as string);
61
+ }
62
+
63
+ const [block] = editor.api.block<TElement>() || [];
64
+
65
+ if (!block?.type) return DEFAULT_FONT_SIZE;
66
+
67
+ return block.type in FONT_SIZE_MAP ? FONT_SIZE_MAP[block.type as keyof typeof FONT_SIZE_MAP] : DEFAULT_FONT_SIZE;
68
+ }, []);
69
+
70
+ const handleInputChange = () => {
71
+ const newSize = toUnitLess(inputValue);
72
+
73
+ if (
74
+ Number.parseInt(newSize, 10) < 1
75
+ || Number.parseInt(newSize, 10) > 100
76
+ ) {
77
+ editor.tf.focus();
78
+
79
+ return;
80
+ }
81
+ if (newSize !== toUnitLess(cursorFontSize)) {
82
+ tf.fontSize.addMark(`${newSize}px`);
83
+ }
84
+
85
+ editor.tf.focus();
86
+ };
87
+
88
+ const handleFontSizeChange = (delta: number) => {
89
+ const newSize = Number(displayValue) + delta;
90
+
91
+ tf.fontSize.addMark(`${newSize}px`);
92
+ editor.tf.focus();
93
+ };
94
+
95
+ const displayValue = isFocused ? inputValue : cursorFontSize;
96
+
97
+ return (
98
+ <div className="flex h-7 items-center gap-1 rounded-md bg-muted/60 p-0">
99
+ <ToolbarButton onClick={() => handleFontSizeChange(-1)}>
100
+ <Minus />
101
+ </ToolbarButton>
102
+
103
+ <Popover open={isFocused} modal={false}>
104
+ <PopoverTrigger asChild>
105
+ <input
106
+ className={cn(
107
+ 'h-full w-10 shrink-0 bg-transparent px-1 text-center text-sm hover:bg-muted'
108
+ )}
109
+ value={displayValue}
110
+ onBlur={() => {
111
+ setIsFocused(false);
112
+ handleInputChange();
113
+ }}
114
+ onChange={e => setInputValue(e.target.value)}
115
+ onFocus={() => {
116
+ setIsFocused(true);
117
+ setInputValue(toUnitLess(cursorFontSize));
118
+ }}
119
+ onKeyDown={(e) => {
120
+ if (e.key === 'Enter') {
121
+ e.preventDefault();
122
+ handleInputChange();
123
+ }
124
+ }}
125
+ data-plate-focus="true"
126
+ type="text" />
127
+ </PopoverTrigger>
128
+ <PopoverContent
129
+ className="w-10 px-px py-1"
130
+ onOpenAutoFocus={e => e.preventDefault()}>
131
+ {FONT_SIZES.map(size => (
132
+ <button
133
+ key={size}
134
+ className={cn(
135
+ 'flex h-8 w-full items-center justify-center text-sm hover:bg-accent data-[highlighted=true]:bg-accent'
136
+ )}
137
+ onClick={() => {
138
+ tf.fontSize.addMark(`${size}px`);
139
+ setIsFocused(false);
140
+ }}
141
+ data-highlighted={size === displayValue}
142
+ type="button">
143
+ {size}
144
+ </button>
145
+ ))}
146
+ </PopoverContent>
147
+ </Popover>
148
+
149
+ <ToolbarButton onClick={() => handleFontSizeChange(1)}>
150
+ <Plus />
151
+ </ToolbarButton>
152
+ </div>
153
+ );
154
+ }
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+
3
+ import { CopilotPlugin } from '@platejs/ai/react';
4
+ import {
5
+ type PlateLeafProps,
6
+ PlateLeaf,
7
+ usePluginOption
8
+ } from 'platejs/react';
9
+
10
+ export function GhostText(props: PlateLeafProps) {
11
+ const suggestionText = usePluginOption(CopilotPlugin, 'suggestionText');
12
+
13
+ if (!suggestionText) return <>{props.children}</>;
14
+
15
+ return (
16
+ <PlateLeaf
17
+ {...props}
18
+ className="text-muted-foreground/70" />
19
+ );
20
+ }
@@ -0,0 +1,52 @@
1
+
2
+ import { cva } from 'class-variance-authority';
3
+ import { PathApi } from 'platejs';
4
+ import { SlateElement, type SlateElementProps } from 'platejs/static';
5
+
6
+ const headingVariants = cva(
7
+ 'relative mb-1 px-0.5 py-[3px] font-semibold leading-[1.3]!',
8
+ {
9
+ variants: {
10
+ isFirstBlock: {
11
+ false: '',
12
+ true: 'mt-0!'
13
+ },
14
+ variant: {
15
+ h1: 'mt-8 text-[1.875em]',
16
+ h2: 'mt-[1.4em] text-[1.5em]',
17
+ h3: 'mt-[1em] text-[1.25em]'
18
+ }
19
+ }
20
+ }
21
+ );
22
+
23
+ export function HeadingElementStatic({
24
+ children,
25
+ variant = 'h1',
26
+ ...props
27
+ }: SlateElementProps & {
28
+ variant?: 'h1' | 'h2' | 'h3';
29
+ }) {
30
+ const isFirstBlock = PathApi.equals(props.api.findPath(props.element)!, [0]);
31
+
32
+ return (
33
+ <SlateElement
34
+ as={variant}
35
+ className={headingVariants({ isFirstBlock, variant })}
36
+ {...props}>
37
+ {children}
38
+ </SlateElement>
39
+ );
40
+ }
41
+
42
+ export function H1ElementStatic(props: SlateElementProps) {
43
+ return <HeadingElementStatic variant="h1" {...props} />;
44
+ }
45
+
46
+ export function H2ElementStatic(props: SlateElementProps) {
47
+ return <HeadingElementStatic variant="h2" {...props} />;
48
+ }
49
+
50
+ export function H3ElementStatic(props: SlateElementProps) {
51
+ return <HeadingElementStatic variant="h3" {...props} />;
52
+ }