@agent-native/core 0.109.2 → 0.109.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +16 -0
  3. package/corpus/core/docs/content/agent-native-toolkit.mdx +46 -13
  4. package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +79 -55
  5. package/corpus/core/docs/content/locales/ar-SA/toolkit-capability-packages.mdx +21 -0
  6. package/corpus/core/docs/content/locales/ar-SA/toolkit-context-knowledge.mdx +12 -0
  7. package/corpus/core/docs/content/locales/ar-SA/toolkit-editors-canvases.mdx +17 -0
  8. package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +82 -54
  9. package/corpus/core/docs/content/locales/de-DE/toolkit-capability-packages.mdx +21 -0
  10. package/corpus/core/docs/content/locales/de-DE/toolkit-context-knowledge.mdx +12 -0
  11. package/corpus/core/docs/content/locales/de-DE/toolkit-editors-canvases.mdx +17 -0
  12. package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +81 -52
  13. package/corpus/core/docs/content/locales/es-ES/toolkit-capability-packages.mdx +21 -0
  14. package/corpus/core/docs/content/locales/es-ES/toolkit-context-knowledge.mdx +12 -0
  15. package/corpus/core/docs/content/locales/es-ES/toolkit-editors-canvases.mdx +21 -0
  16. package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +84 -54
  17. package/corpus/core/docs/content/locales/fr-FR/toolkit-capability-packages.mdx +21 -0
  18. package/corpus/core/docs/content/locales/fr-FR/toolkit-context-knowledge.mdx +12 -0
  19. package/corpus/core/docs/content/locales/fr-FR/toolkit-editors-canvases.mdx +21 -0
  20. package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +69 -62
  21. package/corpus/core/docs/content/locales/hi-IN/toolkit-capability-packages.mdx +21 -0
  22. package/corpus/core/docs/content/locales/hi-IN/toolkit-context-knowledge.mdx +12 -0
  23. package/corpus/core/docs/content/locales/hi-IN/toolkit-editors-canvases.mdx +17 -0
  24. package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +69 -62
  25. package/corpus/core/docs/content/locales/ja-JP/toolkit-capability-packages.mdx +21 -0
  26. package/corpus/core/docs/content/locales/ja-JP/toolkit-context-knowledge.mdx +12 -0
  27. package/corpus/core/docs/content/locales/ja-JP/toolkit-editors-canvases.mdx +17 -0
  28. package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +69 -62
  29. package/corpus/core/docs/content/locales/ko-KR/toolkit-capability-packages.mdx +21 -0
  30. package/corpus/core/docs/content/locales/ko-KR/toolkit-context-knowledge.mdx +12 -0
  31. package/corpus/core/docs/content/locales/ko-KR/toolkit-editors-canvases.mdx +17 -0
  32. package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +82 -54
  33. package/corpus/core/docs/content/locales/pt-BR/toolkit-capability-packages.mdx +21 -0
  34. package/corpus/core/docs/content/locales/pt-BR/toolkit-context-knowledge.mdx +12 -0
  35. package/corpus/core/docs/content/locales/pt-BR/toolkit-editors-canvases.mdx +17 -0
  36. package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +69 -62
  37. package/corpus/core/docs/content/locales/zh-CN/toolkit-capability-packages.mdx +21 -0
  38. package/corpus/core/docs/content/locales/zh-CN/toolkit-context-knowledge.mdx +12 -0
  39. package/corpus/core/docs/content/locales/zh-CN/toolkit-editors-canvases.mdx +17 -0
  40. package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +69 -62
  41. package/corpus/core/docs/content/locales/zh-TW/toolkit-capability-packages.mdx +21 -0
  42. package/corpus/core/docs/content/locales/zh-TW/toolkit-context-knowledge.mdx +12 -0
  43. package/corpus/core/docs/content/locales/zh-TW/toolkit-editors-canvases.mdx +17 -0
  44. package/corpus/core/docs/content/toolkit-capability-packages.mdx +52 -0
  45. package/corpus/core/docs/content/toolkit-context-knowledge.mdx +46 -0
  46. package/corpus/core/docs/content/toolkit-editors-canvases.mdx +55 -0
  47. package/corpus/core/package.json +35 -34
  48. package/corpus/core/src/cli/create.ts +57 -15
  49. package/corpus/core/src/cli/package-lifecycle.ts +2 -0
  50. package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +2 -0
  51. package/corpus/core/src/client/context-xray/ContextMeter.tsx +31 -111
  52. package/corpus/core/src/client/context-xray/ContextSegmentRow.tsx +8 -111
  53. package/corpus/core/src/client/context-xray/ContextTreemap.tsx +6 -111
  54. package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +31 -391
  55. package/corpus/core/src/client/context-xray/SegmentProvenancePopover.tsx +4 -52
  56. package/corpus/core/src/client/context-xray/format.ts +0 -33
  57. package/corpus/core/src/client/require-session.tsx +19 -3
  58. package/corpus/core/src/client/rich-markdown-editor/index.ts +42 -57
  59. package/corpus/core/src/client/rich-markdown-editor/uploadEditorImage.ts +2 -1
  60. package/corpus/core/src/client/use-action.ts +145 -2
  61. package/corpus/core/src/client/use-session.ts +79 -48
  62. package/corpus/core/src/client/visual-style-controls.tsx +1 -1088
  63. package/corpus/core/src/collab/agent-identity.ts +5 -22
  64. package/corpus/core/src/collab/client.ts +1 -53
  65. package/corpus/core/src/db/client.ts +13 -7
  66. package/corpus/core/src/db/create-get-db.ts +20 -13
  67. package/corpus/core/src/db/request-telemetry.ts +154 -0
  68. package/corpus/core/src/integrations/index.ts +1 -0
  69. package/corpus/core/src/integrations/plugin.ts +9 -3
  70. package/corpus/core/src/integrations/remote-push-delivery-job.ts +48 -0
  71. package/corpus/core/src/integrations/remote-push-delivery.ts +370 -0
  72. package/corpus/core/src/integrations/remote-push-store.ts +275 -26
  73. package/corpus/core/src/server/better-auth-instance.ts +11 -3
  74. package/corpus/core/src/server/core-routes-plugin.ts +36 -14
  75. package/corpus/core/src/server/framework-request-handler.ts +11 -1
  76. package/corpus/core/src/server/http-response-telemetry.ts +233 -31
  77. package/corpus/core/src/styles/rich-markdown-editor.css +1 -510
  78. package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
  79. package/corpus/core/src/testing.ts +1 -1
  80. package/corpus/core/src/vite/client.ts +3 -0
  81. package/corpus/templates/clips/actions/finalize-recording.ts +3 -1
  82. package/corpus/templates/clips/actions/set-mobile-capture-state.ts +4 -1
  83. package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -6
  84. package/corpus/templates/clips/changelog/2026-07-18-new-recording-is-now-emphasized-as-the-primary-action-in-the.md +6 -0
  85. package/corpus/templates/clips/changelog/2026-07-18-recordings-now-remain-safely-recoverable-until-the-stored-me.md +6 -0
  86. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +5 -3
  87. package/corpus/templates/content/app/components/editor/extensions/DragHandle.tsx +4 -4
  88. package/corpus/templates/content/package.json +25 -25
  89. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
  90. package/corpus/templates/design/package.json +1 -1
  91. package/corpus/templates/mail/package.json +9 -9
  92. package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +2 -0
  93. package/corpus/templates/plan/app/components/editor/PlanDocumentEditor.tsx +8 -8
  94. package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +6 -6
  95. package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +4 -7
  96. package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +6 -4
  97. package/corpus/templates/plan/app/components/plan/PlanVisualSurface.tsx +1 -1
  98. package/corpus/templates/plan/changelog/2026-07-18-visual-plans-now-open-on-wireframes-by-default-when-a-protot.md +6 -0
  99. package/corpus/templates/plan/package.json +3 -3
  100. package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +2 -2
  101. package/corpus/templates/slides/app/components/editor/TweaksPanel.tsx +2 -2
  102. package/corpus/templates/slides/package.json +13 -13
  103. package/corpus/templates/tasks/AGENTS.md +3 -0
  104. package/corpus/templates/tasks/actions/render-task-list-inline.ts +202 -0
  105. package/corpus/templates/tasks/changelog/2026-07-18-task-lists-can-now-appear-as-interactive-widgets-inline-in-c.md +6 -0
  106. package/corpus/templates/tasks/docs/features/f8-chat.mdx +2 -0
  107. package/corpus/templates/tasks/server/plugins/agent-chat.ts +2 -0
  108. package/dist/catalog.json +39 -1
  109. package/dist/cli/create.d.ts +10 -1
  110. package/dist/cli/create.d.ts.map +1 -1
  111. package/dist/cli/create.js +49 -16
  112. package/dist/cli/create.js.map +1 -1
  113. package/dist/cli/package-lifecycle.d.ts.map +1 -1
  114. package/dist/cli/package-lifecycle.js +2 -0
  115. package/dist/cli/package-lifecycle.js.map +1 -1
  116. package/dist/cli/skills-content/visual-plan-skill.d.ts +1 -1
  117. package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -1
  118. package/dist/cli/skills-content/visual-plan-skill.js +2 -0
  119. package/dist/cli/skills-content/visual-plan-skill.js.map +1 -1
  120. package/dist/client/context-xray/ContextMeter.d.ts.map +1 -1
  121. package/dist/client/context-xray/ContextMeter.js +8 -23
  122. package/dist/client/context-xray/ContextMeter.js.map +1 -1
  123. package/dist/client/context-xray/ContextSegmentRow.d.ts.map +1 -1
  124. package/dist/client/context-xray/ContextSegmentRow.js +3 -19
  125. package/dist/client/context-xray/ContextSegmentRow.js.map +1 -1
  126. package/dist/client/context-xray/ContextTreemap.d.ts.map +1 -1
  127. package/dist/client/context-xray/ContextTreemap.js +3 -54
  128. package/dist/client/context-xray/ContextTreemap.js.map +1 -1
  129. package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
  130. package/dist/client/context-xray/ContextXRayPanel.js +21 -163
  131. package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
  132. package/dist/client/context-xray/SegmentProvenancePopover.d.ts.map +1 -1
  133. package/dist/client/context-xray/SegmentProvenancePopover.js +3 -4
  134. package/dist/client/context-xray/SegmentProvenancePopover.js.map +1 -1
  135. package/dist/client/context-xray/format.d.ts +0 -4
  136. package/dist/client/context-xray/format.d.ts.map +1 -1
  137. package/dist/client/context-xray/format.js +0 -49
  138. package/dist/client/context-xray/format.js.map +1 -1
  139. package/dist/client/require-session.d.ts.map +1 -1
  140. package/dist/client/require-session.js +6 -3
  141. package/dist/client/require-session.js.map +1 -1
  142. package/dist/client/rich-markdown-editor/index.d.ts +1 -12
  143. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
  144. package/dist/client/rich-markdown-editor/index.js +1 -12
  145. package/dist/client/rich-markdown-editor/index.js.map +1 -1
  146. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +1 -1
  147. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -1
  148. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -1
  149. package/dist/client/use-action.d.ts.map +1 -1
  150. package/dist/client/use-action.js +117 -1
  151. package/dist/client/use-action.js.map +1 -1
  152. package/dist/client/use-session.d.ts.map +1 -1
  153. package/dist/client/use-session.js +72 -50
  154. package/dist/client/use-session.js.map +1 -1
  155. package/dist/client/visual-style-controls.d.ts +1 -89
  156. package/dist/client/visual-style-controls.d.ts.map +1 -1
  157. package/dist/client/visual-style-controls.js +1 -498
  158. package/dist/client/visual-style-controls.js.map +1 -1
  159. package/dist/collab/agent-identity.d.ts +1 -14
  160. package/dist/collab/agent-identity.d.ts.map +1 -1
  161. package/dist/collab/agent-identity.js +1 -13
  162. package/dist/collab/agent-identity.js.map +1 -1
  163. package/dist/collab/awareness.d.ts +2 -2
  164. package/dist/collab/awareness.d.ts.map +1 -1
  165. package/dist/collab/client.d.ts +1 -19
  166. package/dist/collab/client.d.ts.map +1 -1
  167. package/dist/collab/client.js +1 -53
  168. package/dist/collab/client.js.map +1 -1
  169. package/dist/collab/struct-routes.d.ts +1 -1
  170. package/dist/db/client.d.ts.map +1 -1
  171. package/dist/db/client.js +7 -1
  172. package/dist/db/client.js.map +1 -1
  173. package/dist/db/create-get-db.d.ts +3 -6
  174. package/dist/db/create-get-db.d.ts.map +1 -1
  175. package/dist/db/create-get-db.js +9 -2
  176. package/dist/db/create-get-db.js.map +1 -1
  177. package/dist/db/request-telemetry.d.ts +23 -0
  178. package/dist/db/request-telemetry.d.ts.map +1 -0
  179. package/dist/db/request-telemetry.js +95 -0
  180. package/dist/db/request-telemetry.js.map +1 -0
  181. package/dist/integrations/index.d.ts +1 -0
  182. package/dist/integrations/index.d.ts.map +1 -1
  183. package/dist/integrations/index.js +1 -0
  184. package/dist/integrations/index.js.map +1 -1
  185. package/dist/integrations/plugin.d.ts.map +1 -1
  186. package/dist/integrations/plugin.js +8 -3
  187. package/dist/integrations/plugin.js.map +1 -1
  188. package/dist/integrations/remote-push-delivery-job.d.ts +4 -0
  189. package/dist/integrations/remote-push-delivery-job.d.ts.map +1 -0
  190. package/dist/integrations/remote-push-delivery-job.js +44 -0
  191. package/dist/integrations/remote-push-delivery-job.js.map +1 -0
  192. package/dist/integrations/remote-push-delivery.d.ts +11 -0
  193. package/dist/integrations/remote-push-delivery.d.ts.map +1 -0
  194. package/dist/integrations/remote-push-delivery.js +265 -0
  195. package/dist/integrations/remote-push-delivery.js.map +1 -0
  196. package/dist/integrations/remote-push-store.d.ts +33 -0
  197. package/dist/integrations/remote-push-store.d.ts.map +1 -1
  198. package/dist/integrations/remote-push-store.js +195 -26
  199. package/dist/integrations/remote-push-store.js.map +1 -1
  200. package/dist/notifications/routes.d.ts +3 -3
  201. package/dist/progress/routes.d.ts +1 -1
  202. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  203. package/dist/resources/handlers.d.ts +3 -3
  204. package/dist/secrets/routes.d.ts +9 -9
  205. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  206. package/dist/server/better-auth-instance.js +7 -3
  207. package/dist/server/better-auth-instance.js.map +1 -1
  208. package/dist/server/core-routes-plugin.d.ts +8 -0
  209. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  210. package/dist/server/core-routes-plugin.js +23 -8
  211. package/dist/server/core-routes-plugin.js.map +1 -1
  212. package/dist/server/framework-request-handler.d.ts.map +1 -1
  213. package/dist/server/framework-request-handler.js +9 -1
  214. package/dist/server/framework-request-handler.js.map +1 -1
  215. package/dist/server/http-response-telemetry.d.ts +3 -2
  216. package/dist/server/http-response-telemetry.d.ts.map +1 -1
  217. package/dist/server/http-response-telemetry.js +160 -27
  218. package/dist/server/http-response-telemetry.js.map +1 -1
  219. package/dist/server/transcribe-voice.d.ts +1 -1
  220. package/dist/styles/rich-markdown-editor.css +1 -510
  221. package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
  222. package/dist/testing.d.ts +1 -1
  223. package/dist/testing.d.ts.map +1 -1
  224. package/dist/testing.js +1 -1
  225. package/dist/testing.js.map +1 -1
  226. package/dist/vite/client.d.ts.map +1 -1
  227. package/dist/vite/client.js +3 -0
  228. package/dist/vite/client.js.map +1 -1
  229. package/docs/content/agent-native-toolkit.mdx +46 -13
  230. package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +79 -55
  231. package/docs/content/locales/ar-SA/toolkit-capability-packages.mdx +21 -0
  232. package/docs/content/locales/ar-SA/toolkit-context-knowledge.mdx +12 -0
  233. package/docs/content/locales/ar-SA/toolkit-editors-canvases.mdx +17 -0
  234. package/docs/content/locales/de-DE/agent-native-toolkit.mdx +82 -54
  235. package/docs/content/locales/de-DE/toolkit-capability-packages.mdx +21 -0
  236. package/docs/content/locales/de-DE/toolkit-context-knowledge.mdx +12 -0
  237. package/docs/content/locales/de-DE/toolkit-editors-canvases.mdx +17 -0
  238. package/docs/content/locales/es-ES/agent-native-toolkit.mdx +81 -52
  239. package/docs/content/locales/es-ES/toolkit-capability-packages.mdx +21 -0
  240. package/docs/content/locales/es-ES/toolkit-context-knowledge.mdx +12 -0
  241. package/docs/content/locales/es-ES/toolkit-editors-canvases.mdx +21 -0
  242. package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +84 -54
  243. package/docs/content/locales/fr-FR/toolkit-capability-packages.mdx +21 -0
  244. package/docs/content/locales/fr-FR/toolkit-context-knowledge.mdx +12 -0
  245. package/docs/content/locales/fr-FR/toolkit-editors-canvases.mdx +21 -0
  246. package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +69 -62
  247. package/docs/content/locales/hi-IN/toolkit-capability-packages.mdx +21 -0
  248. package/docs/content/locales/hi-IN/toolkit-context-knowledge.mdx +12 -0
  249. package/docs/content/locales/hi-IN/toolkit-editors-canvases.mdx +17 -0
  250. package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +69 -62
  251. package/docs/content/locales/ja-JP/toolkit-capability-packages.mdx +21 -0
  252. package/docs/content/locales/ja-JP/toolkit-context-knowledge.mdx +12 -0
  253. package/docs/content/locales/ja-JP/toolkit-editors-canvases.mdx +17 -0
  254. package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +69 -62
  255. package/docs/content/locales/ko-KR/toolkit-capability-packages.mdx +21 -0
  256. package/docs/content/locales/ko-KR/toolkit-context-knowledge.mdx +12 -0
  257. package/docs/content/locales/ko-KR/toolkit-editors-canvases.mdx +17 -0
  258. package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +82 -54
  259. package/docs/content/locales/pt-BR/toolkit-capability-packages.mdx +21 -0
  260. package/docs/content/locales/pt-BR/toolkit-context-knowledge.mdx +12 -0
  261. package/docs/content/locales/pt-BR/toolkit-editors-canvases.mdx +17 -0
  262. package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +69 -62
  263. package/docs/content/locales/zh-CN/toolkit-capability-packages.mdx +21 -0
  264. package/docs/content/locales/zh-CN/toolkit-context-knowledge.mdx +12 -0
  265. package/docs/content/locales/zh-CN/toolkit-editors-canvases.mdx +17 -0
  266. package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +69 -62
  267. package/docs/content/locales/zh-TW/toolkit-capability-packages.mdx +21 -0
  268. package/docs/content/locales/zh-TW/toolkit-context-knowledge.mdx +12 -0
  269. package/docs/content/locales/zh-TW/toolkit-editors-canvases.mdx +17 -0
  270. package/docs/content/toolkit-capability-packages.mdx +52 -0
  271. package/docs/content/toolkit-context-knowledge.mdx +46 -0
  272. package/docs/content/toolkit-editors-canvases.mdx +55 -0
  273. package/package.json +27 -26
  274. package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
  275. package/corpus/core/src/client/rich-markdown-editor/BubbleToolbar.tsx +0 -253
  276. package/corpus/core/src/client/rich-markdown-editor/CodeBlockNode.tsx +0 -258
  277. package/corpus/core/src/client/rich-markdown-editor/DragHandle.ts +0 -1437
  278. package/corpus/core/src/client/rich-markdown-editor/ImageExtension.ts +0 -306
  279. package/corpus/core/src/client/rich-markdown-editor/RichMarkdownEditor.tsx +0 -80
  280. package/corpus/core/src/client/rich-markdown-editor/RunId.ts +0 -61
  281. package/corpus/core/src/client/rich-markdown-editor/SharedRichEditor.tsx +0 -321
  282. package/corpus/core/src/client/rich-markdown-editor/SlashCommandMenu.tsx +0 -310
  283. package/corpus/core/src/client/rich-markdown-editor/extensions.ts +0 -402
  284. package/corpus/core/src/client/rich-markdown-editor/gfmDoc.ts +0 -92
  285. package/corpus/core/src/client/rich-markdown-editor/surgical-apply.ts +0 -192
  286. package/corpus/core/src/client/rich-markdown-editor/useCollabReconcile.ts +0 -590
  287. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +0 -37
  288. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +0 -1
  289. package/dist/client/rich-markdown-editor/BubbleToolbar.js +0 -171
  290. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +0 -1
  291. package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts +0 -49
  292. package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts.map +0 -1
  293. package/dist/client/rich-markdown-editor/CodeBlockNode.js +0 -127
  294. package/dist/client/rich-markdown-editor/CodeBlockNode.js.map +0 -1
  295. package/dist/client/rich-markdown-editor/DragHandle.d.ts +0 -97
  296. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +0 -1
  297. package/dist/client/rich-markdown-editor/DragHandle.js +0 -1066
  298. package/dist/client/rich-markdown-editor/DragHandle.js.map +0 -1
  299. package/dist/client/rich-markdown-editor/ImageExtension.d.ts +0 -63
  300. package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +0 -1
  301. package/dist/client/rich-markdown-editor/ImageExtension.js +0 -243
  302. package/dist/client/rich-markdown-editor/ImageExtension.js.map +0 -1
  303. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +0 -51
  304. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +0 -1
  305. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +0 -37
  306. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +0 -1
  307. package/dist/client/rich-markdown-editor/RunId.d.ts +0 -28
  308. package/dist/client/rich-markdown-editor/RunId.d.ts.map +0 -1
  309. package/dist/client/rich-markdown-editor/RunId.js +0 -60
  310. package/dist/client/rich-markdown-editor/RunId.js.map +0 -1
  311. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +0 -110
  312. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +0 -1
  313. package/dist/client/rich-markdown-editor/SharedRichEditor.js +0 -144
  314. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +0 -1
  315. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +0 -41
  316. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +0 -1
  317. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +0 -221
  318. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +0 -1
  319. package/dist/client/rich-markdown-editor/extensions.d.ts +0 -178
  320. package/dist/client/rich-markdown-editor/extensions.d.ts.map +0 -1
  321. package/dist/client/rich-markdown-editor/extensions.js +0 -224
  322. package/dist/client/rich-markdown-editor/extensions.js.map +0 -1
  323. package/dist/client/rich-markdown-editor/gfmDoc.d.ts +0 -24
  324. package/dist/client/rich-markdown-editor/gfmDoc.d.ts.map +0 -1
  325. package/dist/client/rich-markdown-editor/gfmDoc.js +0 -83
  326. package/dist/client/rich-markdown-editor/gfmDoc.js.map +0 -1
  327. package/dist/client/rich-markdown-editor/surgical-apply.d.ts +0 -66
  328. package/dist/client/rich-markdown-editor/surgical-apply.d.ts.map +0 -1
  329. package/dist/client/rich-markdown-editor/surgical-apply.js +0 -147
  330. package/dist/client/rich-markdown-editor/surgical-apply.js.map +0 -1
  331. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +0 -110
  332. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +0 -1
  333. package/dist/client/rich-markdown-editor/useCollabReconcile.js +0 -441
  334. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +0 -1
@@ -1,37 +0,0 @@
1
- /**
2
- * Back-compat surface for the shared rich markdown editor.
3
- *
4
- * The editor core now lives in dedicated modules:
5
- * - {@link createSharedEditorExtensions} — the ONE extension factory.
6
- * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
7
- * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
8
- * - {@link SharedRichEditor} — the editor component.
9
- *
10
- * This file keeps the historical `RichMarkdownEditor` component name (aliased to
11
- * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
12
- * existing embedders and the round-trip / collab specs keep working unchanged.
13
- */
14
- import { createSharedEditorExtensions, } from "./extensions.js";
15
- import { SharedRichEditor, } from "./SharedRichEditor.js";
16
- /**
17
- * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
18
- * in terms of {@link createSharedEditorExtensions}: it maps the flat
19
- * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
20
- * shared factory expects. The round-trip and collab specs build their `Editor`
21
- * from this, so its output must stay byte-stable.
22
- */
23
- export function createRichMarkdownExtensions({ dialect = "gfm", placeholder = "Type '/' for commands...", ydoc = null, awareness = null, user = null, } = {}) {
24
- return createSharedEditorExtensions({
25
- dialect,
26
- placeholder,
27
- collab: ydoc ? { ydoc, awareness, user } : null,
28
- });
29
- }
30
- /**
31
- * Historical name for {@link SharedRichEditor}. Kept so existing imports
32
- * (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
33
- * plan editor tests (which assert the source mentions `RichMarkdownEditor`)
34
- * keep working. New code should import `SharedRichEditor`.
35
- */
36
- export const RichMarkdownEditor = SharedRichEditor;
37
- //# sourceMappingURL=RichMarkdownEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichMarkdownEditor.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RichMarkdownEditor.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,4BAA4B,GAI7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAwB/B;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,0BAA0B,EACxC,IAAI,GAAG,IAAI,EACX,SAAS,GAAG,IAAI,EAChB,IAAI,GAAG,IAAI,GACZ,GAAwC,EAAE;IACzC,OAAO,4BAA4B,CAAC;QAClC,OAAO;QACP,WAAW;QACX,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;KAChD,CAAC,CAAC;AACL,CAAC;AAKD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import type { Awareness } from \"y-protocols/awareness\";\nimport type { Doc as YDoc } from \"yjs\";\n\n/**\n * Back-compat surface for the shared rich markdown editor.\n *\n * The editor core now lives in dedicated modules:\n * - {@link createSharedEditorExtensions} — the ONE extension factory.\n * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.\n * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.\n * - {@link SharedRichEditor} — the editor component.\n *\n * This file keeps the historical `RichMarkdownEditor` component name (aliased to\n * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so\n * existing embedders and the round-trip / collab specs keep working unchanged.\n */\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n} from \"./extensions.js\";\nimport {\n SharedRichEditor,\n type SharedRichEditorProps,\n} from \"./SharedRichEditor.js\";\n\nexport type {\n RichMarkdownDialect,\n RichMarkdownEditorPreset,\n RichMarkdownCollabUser,\n};\n\n/** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */\nexport interface CreateRichMarkdownExtensionsOptions {\n dialect?: RichMarkdownDialect;\n placeholder?: string;\n /**\n * Yjs document for collaborative editing. When present, the editor binds the\n * shared Collaboration + CollaborationCaret extensions and StarterKit's\n * built-in undo/redo is disabled (Yjs owns history).\n */\n ydoc?: YDoc | null;\n /** Shared awareness instance for live multi-user cursors. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n}\n\n/**\n * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented\n * in terms of {@link createSharedEditorExtensions}: it maps the flat\n * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the\n * shared factory expects. The round-trip and collab specs build their `Editor`\n * from this, so its output must stay byte-stable.\n */\nexport function createRichMarkdownExtensions({\n dialect = \"gfm\",\n placeholder = \"Type '/' for commands...\",\n ydoc = null,\n awareness = null,\n user = null,\n}: CreateRichMarkdownExtensionsOptions = {}) {\n return createSharedEditorExtensions({\n dialect,\n placeholder,\n collab: ydoc ? { ydoc, awareness, user } : null,\n });\n}\n\n/** @deprecated Prefer {@link SharedRichEditorProps}. */\nexport type RichMarkdownEditorProps = SharedRichEditorProps;\n\n/**\n * Historical name for {@link SharedRichEditor}. Kept so existing imports\n * (`import { RichMarkdownEditor } from \"@agent-native/core/client\"`) and the\n * plan editor tests (which assert the source mentions `RichMarkdownEditor`)\n * keep working. New code should import `SharedRichEditor`.\n */\nexport const RichMarkdownEditor = SharedRichEditor;\n"]}
@@ -1,28 +0,0 @@
1
- import { Extension } from "@tiptap/core";
2
- /**
3
- * Node types that carry the optional `runId` attribute.
4
- *
5
- * These are exactly the top-level block nodes a plan's `rich-text` block can
6
- * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
7
- * FIRST node of each rich-text run so a re-parse can map the run back to its
8
- * originating block id (stable ids across edits). Atom/structured blocks live
9
- * in their own `planBlock` node and do not need this attribute.
10
- */
11
- export declare const RUN_ID_NODE_TYPES: readonly ["paragraph", "heading", "bulletList", "orderedList", "taskList", "blockquote", "codeBlock"];
12
- /**
13
- * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
14
- * block node types in {@link RUN_ID_NODE_TYPES}.
15
- *
16
- * - `renderHTML` emits `data-run-id` only when the attribute is set, so the
17
- * live editor's DOM carries the id for the doc↔blocks bridge.
18
- * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
19
- * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
20
- * `tiptap-markdown` drops attributes it has no serializer for, so we simply
21
- * don't register a markdown serializer here — the attribute is invisible to
22
- * the GFM round-trip and only lives in the ProseMirror JSON / DOM.
23
- *
24
- * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
25
- * schema is identical on both sides of the bridge.
26
- */
27
- export declare const RunId: Extension<any, any>;
28
- //# sourceMappingURL=RunId.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RunId.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RunId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,YAC5B,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,CACH,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK,qBAwBhB,CAAC"}
@@ -1,60 +0,0 @@
1
- import { Extension } from "@tiptap/core";
2
- /**
3
- * Node types that carry the optional `runId` attribute.
4
- *
5
- * These are exactly the top-level block nodes a plan's `rich-text` block can
6
- * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
7
- * FIRST node of each rich-text run so a re-parse can map the run back to its
8
- * originating block id (stable ids across edits). Atom/structured blocks live
9
- * in their own `planBlock` node and do not need this attribute.
10
- */
11
- export const RUN_ID_NODE_TYPES = [
12
- "paragraph",
13
- "heading",
14
- "bulletList",
15
- "orderedList",
16
- "taskList",
17
- "blockquote",
18
- "codeBlock",
19
- ];
20
- /**
21
- * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
22
- * block node types in {@link RUN_ID_NODE_TYPES}.
23
- *
24
- * - `renderHTML` emits `data-run-id` only when the attribute is set, so the
25
- * live editor's DOM carries the id for the doc↔blocks bridge.
26
- * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
27
- * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
28
- * `tiptap-markdown` drops attributes it has no serializer for, so we simply
29
- * don't register a markdown serializer here — the attribute is invisible to
30
- * the GFM round-trip and only lives in the ProseMirror JSON / DOM.
31
- *
32
- * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
33
- * schema is identical on both sides of the bridge.
34
- */
35
- export const RunId = Extension.create({
36
- name: "runId",
37
- addGlobalAttributes() {
38
- return [
39
- {
40
- types: [...RUN_ID_NODE_TYPES],
41
- attributes: {
42
- runId: {
43
- default: null,
44
- // Read the id off the rendered DOM so paste / re-parse round-trips.
45
- parseHTML: (element) => element.getAttribute("data-run-id"),
46
- // Only emit the attribute when set; an unset (null) runId adds
47
- // nothing to the DOM so untouched nodes stay clean.
48
- renderHTML: (attributes) => {
49
- const runId = attributes.runId;
50
- if (!runId)
51
- return {};
52
- return { "data-run-id": runId };
53
- },
54
- },
55
- },
56
- },
57
- ];
58
- },
59
- });
60
- //# sourceMappingURL=RunId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RunId.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RunId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,SAAS;IACT,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,WAAW;CACH,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,OAAO;IAEb,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC;gBAC7B,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,oEAAoE;wBACpE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;wBAC3D,+DAA+D;wBAC/D,oDAAoD;wBACpD,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;4BACzB,MAAM,KAAK,GAAI,UAAwC,CAAC,KAAK,CAAC;4BAC9D,IAAI,CAAC,KAAK;gCAAE,OAAO,EAAE,CAAC;4BACtB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;wBAClC,CAAC;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { Extension } from \"@tiptap/core\";\n\n/**\n * Node types that carry the optional `runId` attribute.\n *\n * These are exactly the top-level block nodes a plan's `rich-text` block can\n * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the\n * FIRST node of each rich-text run so a re-parse can map the run back to its\n * originating block id (stable ids across edits). Atom/structured blocks live\n * in their own `planBlock` node and do not need this attribute.\n */\nexport const RUN_ID_NODE_TYPES = [\n \"paragraph\",\n \"heading\",\n \"bulletList\",\n \"orderedList\",\n \"taskList\",\n \"blockquote\",\n \"codeBlock\",\n] as const;\n\n/**\n * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the\n * block node types in {@link RUN_ID_NODE_TYPES}.\n *\n * - `renderHTML` emits `data-run-id` only when the attribute is set, so the\n * live editor's DOM carries the id for the doc↔blocks bridge.\n * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.\n * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.\n * `tiptap-markdown` drops attributes it has no serializer for, so we simply\n * don't register a markdown serializer here — the attribute is invisible to\n * the GFM round-trip and only lives in the ProseMirror JSON / DOM.\n *\n * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the\n * schema is identical on both sides of the bridge.\n */\nexport const RunId = Extension.create({\n name: \"runId\",\n\n addGlobalAttributes() {\n return [\n {\n types: [...RUN_ID_NODE_TYPES],\n attributes: {\n runId: {\n default: null,\n // Read the id off the rendered DOM so paste / re-parse round-trips.\n parseHTML: (element) => element.getAttribute(\"data-run-id\"),\n // Only emit the attribute when set; an unset (null) runId adds\n // nothing to the DOM so untouched nodes stay clean.\n renderHTML: (attributes) => {\n const runId = (attributes as { runId?: string | null }).runId;\n if (!runId) return {};\n return { \"data-run-id\": runId };\n },\n },\n },\n },\n ];\n },\n});\n"]}
@@ -1,110 +0,0 @@
1
- import type { Extension, Node, Mark } from "@tiptap/core";
2
- import type { Awareness } from "y-protocols/awareness";
3
- import type { Doc as YDoc } from "yjs";
4
- import { type BubbleToolbarItem } from "./BubbleToolbar.js";
5
- import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser, type SharedEditorFeatures } from "./extensions.js";
6
- import type { ImageUploadFn } from "./ImageExtension.js";
7
- import { type SlashCommandItem } from "./SlashCommandMenu.js";
8
- import { type UseCollabReconcileOptions } from "./useCollabReconcile.js";
9
- export interface SharedRichEditorProps {
10
- value: string;
11
- onChange: (markdown: string) => void;
12
- onBlur?: () => void;
13
- contentUpdatedAt?: string | null;
14
- editable?: boolean;
15
- dialect?: RichMarkdownDialect;
16
- preset?: RichMarkdownEditorPreset;
17
- /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */
18
- features?: SharedEditorFeatures;
19
- /**
20
- * Injectable image uploader for the shared image block. Used only when
21
- * `features.image` is on. Pass `uploadEditorImage` (the framework
22
- * `upload-image` action) for a real uploading image block.
23
- */
24
- onImageUpload?: ImageUploadFn | null;
25
- /**
26
- * App-specific extensions (Notion nodes, media, drag handles, comment
27
- * anchors, …) appended after the shared base schema.
28
- */
29
- extraExtensions?: Array<Extension | Node | Mark>;
30
- placeholder?: string;
31
- className?: string;
32
- editorClassName?: string;
33
- ariaLabel?: string;
34
- interactive?: boolean;
35
- /**
36
- * Yjs document for real-time multi-user editing. When provided, prose is
37
- * authored against the shared Y.Doc and mirrored back to `value` as markdown
38
- * (still the source of truth). When omitted, the editor is a plain controlled
39
- * `value`/`onChange` editor — the existing, non-collaborative behavior.
40
- */
41
- ydoc?: YDoc | null;
42
- /** True after the collab provider has loaded persisted Y.Doc state. */
43
- collabSynced?: boolean;
44
- /** Shared awareness instance for live cursors/presence. */
45
- awareness?: Awareness | null;
46
- /** Current user info for the collaborative cursor label. */
47
- user?: RichMarkdownCollabUser | null;
48
- /**
49
- * Disable StarterKit's built-in undo/redo for a controlled (non-collab)
50
- * editor whose host owns its own undo authority (see
51
- * {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a
52
- * `ydoc` is present (Yjs always owns history then). Default `false`, so every
53
- * existing embedder is unchanged.
54
- */
55
- disableHistory?: boolean;
56
- /** Override the slash-menu block command list. */
57
- slashItems?: SlashCommandItem[];
58
- /** Override the bubble-toolbar item builder. */
59
- buildBubbleItems?: (editor: import("@tiptap/react").Editor, toggleLink: () => void) => BubbleToolbarItem[];
60
- /**
61
- * Override how the editor's content is read into the canonical `value`.
62
- * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk
63
- * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so
64
- * seed/reconcile/onChange all speak the same value space.
65
- */
66
- getMarkdown?: (editor: import("@tiptap/react").Editor) => string;
67
- /** Override how the canonical `value` is applied into the editor (seed + reconcile). */
68
- setContent?: (editor: import("@tiptap/react").Editor, value: string, options: {
69
- emitUpdate?: boolean;
70
- addToHistory?: boolean;
71
- }) => void;
72
- /**
73
- * Optional parser for surgical reconcile. Custom value formats that already
74
- * handle surgical writes inside `setContent` can pass `false` so the default
75
- * markdown parser never treats their source bytes as literal markdown.
76
- */
77
- parseValue?: UseCollabReconcileOptions["parseValue"];
78
- /** Canonicalize `value` for the echo / already-in-sync equality checks. */
79
- normalizeValue?: (value: string) => string;
80
- /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */
81
- shouldSeed?: (info: {
82
- value: string;
83
- currentMarkdown: string;
84
- fragmentLength: number;
85
- }) => boolean;
86
- /** Initial "applied" watermark (see {@link useCollabReconcile}). */
87
- initialAppliedUpdatedAt?: string | null;
88
- /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */
89
- wrapperClassName?: string;
90
- /**
91
- * Fires once the editor instance exists. Lets a host capture the root
92
- * `editor.view` — e.g. to repaint the WHOLE document after a structural block
93
- * move (a column emptied and its container dissolved) that a surgical
94
- * per-region patch can't express, since the change is in the root doc itself.
95
- */
96
- onEditorReady?: (editor: import("@tiptap/react").Editor) => void;
97
- }
98
- /**
99
- * The single shared rich markdown editor surface. Combines
100
- * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +
101
- * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /
102
- * lead-client logic), and the shared {@link SlashCommandMenu} +
103
- * {@link BubbleToolbar}.
104
- *
105
- * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.
106
- * With a `ydoc` it binds the framework collaboration stack; markdown stays the
107
- * canonical saved representation while the Y.Doc is transient live state.
108
- */
109
- export declare function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable, dialect, preset, features, onImageUpload, extraExtensions, placeholder, className, editorClassName, ariaLabel, interactive, ydoc, collabSynced, awareness, user, disableHistory, slashItems, buildBubbleItems, getMarkdown, setContent, parseValue, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }: SharedRichEditorProps): import("react").JSX.Element;
110
- //# sourceMappingURL=SharedRichEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedRichEditor.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,E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AAC;IACrD,2EAA2E;IAC3E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;KACxB,KAAK,OAAO,CAAC;IACd,oEAAoE;IACpE,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,QAAe,EACf,OAAe,EACf,MAAe,EACf,QAAQ,EACR,aAAoB,EACpB,eAAe,EACf,WAAwC,EACxC,SAAS,EACT,eAAe,EACf,SAAS,EACT,WAAsB,EACtB,IAAW,EACX,YAAmB,EACnB,SAAgB,EAChB,IAAW,EACX,cAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACd,EAAE,qBAAqB,+BAgKvB"}
@@ -1,144 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { EditorContent, useEditor } from "@tiptap/react";
3
- import { useEffect, useMemo, useRef } from "react";
4
- import { cn } from "../utils.js";
5
- import { BubbleToolbar } from "./BubbleToolbar.js";
6
- import { createSharedEditorExtensions, } from "./extensions.js";
7
- import { SlashCommandMenu } from "./SlashCommandMenu.js";
8
- import { useCollabReconcile, getEditorMarkdown, } from "./useCollabReconcile.js";
9
- /**
10
- * The single shared rich markdown editor surface. Combines
11
- * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +
12
- * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /
13
- * lead-client logic), and the shared {@link SlashCommandMenu} +
14
- * {@link BubbleToolbar}.
15
- *
16
- * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.
17
- * With a `ydoc` it binds the framework collaboration stack; markdown stays the
18
- * canonical saved representation while the Y.Doc is transient live state.
19
- */
20
- export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable = true, dialect = "gfm", preset = "plan", features, onImageUpload = null, extraExtensions, placeholder = "Type '/' for commands...", className, editorClassName, ariaLabel, interactive = editable, ydoc = null, collabSynced = true, awareness = null, user = null, disableHistory = false, slashItems, buildBubbleItems, getMarkdown, setContent, parseValue, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }) {
21
- const readMarkdown = getMarkdown ?? getEditorMarkdown;
22
- const onChangeRef = useRef(onChange);
23
- const onBlurRef = useRef(onBlur);
24
- onChangeRef.current = onChange;
25
- onBlurRef.current = onBlur;
26
- const extensions = useMemo(() => createSharedEditorExtensions({
27
- dialect,
28
- preset,
29
- placeholder,
30
- features,
31
- extraExtensions,
32
- onImageUpload,
33
- collab: ydoc ? { ydoc, awareness, user } : null,
34
- disableHistory,
35
- }),
36
- // `preset` is retained in the dependency list so future preset-specific
37
- // schema branches re-create the editor; it is currently schema-neutral. The
38
- // collab inputs are identity-stable per block (one Y.Doc per docId), so they
39
- // only change on a genuine doc switch — exactly when the editor must
40
- // re-create to rebind Collaboration.
41
- [
42
- dialect,
43
- placeholder,
44
- preset,
45
- features,
46
- extraExtensions,
47
- onImageUpload,
48
- ydoc,
49
- awareness,
50
- user?.name,
51
- user?.email,
52
- user?.color,
53
- disableHistory,
54
- ]);
55
- const collab = !!ydoc;
56
- // The collab hook needs the editor, but useEditor's `onUpdate` needs the
57
- // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards
58
- // through `guardsRef`, which is populated right after the hook runs below.
59
- // `onUpdate` only ever fires after the editor exists, by which point the ref
60
- // holds the real guards.
61
- const guardsRef = useRef(null);
62
- const editor = useEditor({
63
- extensions,
64
- // With Collaboration active the prose is owned by the shared Y.XmlFragment.
65
- // Seeding `content` here too would make the editor initialize from BOTH the
66
- // prop and the Y.Doc, firing a spurious initial update that could autosave a
67
- // stale value over newer SQL. The lead-client seed effect populates an empty
68
- // doc instead. Non-collab editors keep initializing from `value`.
69
- // With Collaboration the Y.Doc owns the prose (seeded by the lead client).
70
- // With a custom `setContent` the reconcile seeds the editor too (the raw
71
- // `value` is not directly settable content — e.g. the plan's blocks JSON),
72
- // so only the plain markdown path seeds from `value` here.
73
- content: collab || setContent ? null : value,
74
- editable,
75
- editorProps: {
76
- attributes: {
77
- class: cn("an-rich-md-prose", editorClassName),
78
- ...(ariaLabel ? { role: "textbox", "aria-label": ariaLabel } : {}),
79
- },
80
- },
81
- onUpdate: ({ editor, transaction }) => {
82
- const guards = guardsRef.current;
83
- if (!guards || guards.shouldIgnoreUpdate(transaction))
84
- return;
85
- try {
86
- const markdown = readMarkdown(editor);
87
- if (!guards.registerEmitted(markdown))
88
- return;
89
- queueMicrotask(() => onChangeRef.current(markdown));
90
- }
91
- catch (error) {
92
- console.error("Markdown serialization error:", error);
93
- }
94
- },
95
- onBlur: () => {
96
- onBlurRef.current?.();
97
- },
98
- // Recreate the editor when the shared Y.Doc identity changes — including
99
- // null → doc. Extensions are baked in at creation, so a ydoc that arrives
100
- // AFTER the first mount (fresh page load: the session/user resolves after
101
- // the editor mounts) would otherwise never bind Collaboration: the editor
102
- // looks fine but produces no Yjs updates and never receives peers' edits.
103
- }, [ydoc]);
104
- const collabState = useCollabReconcile({
105
- editor,
106
- ydoc,
107
- collabSynced,
108
- awareness,
109
- value,
110
- contentUpdatedAt,
111
- editable,
112
- getMarkdown: readMarkdown,
113
- setContent,
114
- parseValue,
115
- normalizeValue,
116
- shouldSeed,
117
- initialAppliedUpdatedAt,
118
- });
119
- guardsRef.current = collabState;
120
- useEffect(() => {
121
- if (!editor || editor.isDestroyed)
122
- return;
123
- editor.setEditable(editable);
124
- }, [editable, editor]);
125
- useEffect(() => {
126
- if (editor)
127
- onEditorReady?.(editor);
128
- }, [editor, onEditorReady]);
129
- useEffect(() => () => editor?.destroy(), [editor]);
130
- const handleWrapperClick = (event) => {
131
- if (!editable || !editor || editor.isDestroyed)
132
- return;
133
- const target = event.target;
134
- if (target.classList.contains("an-rich-md-wrapper") ||
135
- target.classList.contains("an-rich-md-clickable")) {
136
- editor.chain().focus("end").run();
137
- }
138
- };
139
- if (!editor) {
140
- return (_jsx("div", { className: cn("an-rich-md-wrapper an-rich-md-loading", className), "data-plan-interactive": interactive ? true : undefined }));
141
- }
142
- return (_jsxs("div", { className: cn("an-rich-md-wrapper an-rich-md-clickable", !editable && "an-rich-md-wrapper--readonly", wrapperClassName, className), onClick: handleWrapperClick, "data-plan-interactive": interactive ? true : undefined, children: [editable ? (_jsx(BubbleToolbar, { editor: editor, buildItems: buildBubbleItems })) : null, editable ? (_jsx(SlashCommandMenu, { editor: editor, items: slashItems })) : null, _jsx(EditorContent, { editor: editor })] }));
143
- }
144
- //# sourceMappingURL=SharedRichEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedRichEditor.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAA0B,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,4BAA4B,GAK7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAyB,MAAM,uBAAuB,CAAC;AAChF,O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AO;QACvD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;QAC3C,IACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC/C,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EACjD,CAAC;YACD,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CAAC,uCAAuC,EAAE,SAAS,CAAC,2BAC1C,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,GACrD,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,yCAAyC,EACzC,CAAC,QAAQ,IAAI,8BAA8B,EAC3C,gBAAgB,EAChB,SAAS,CACV,EACD,OAAO,EAAE,kBAAkB,2BACJ,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,aAEpD,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAI,CAChE,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAI,CACxD,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,GAAI,IAC7B,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { Extension, Node, Mark } from \"@tiptap/core\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport type { Awareness } from \"y-protocols/awareness\";\nimport type { Doc as YDoc } from \"yjs\";\n\nimport { cn } from \"../utils.js\";\nimport { BubbleToolbar, type BubbleToolbarItem } from \"./BubbleToolbar.js\";\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorFeatures,\n} from \"./extensions.js\";\nimport type { ImageUploadFn } from \"./ImageExtension.js\";\nimport { SlashCommandMenu, type SlashCommandItem } from \"./SlashCommandMenu.js\";\nimport {\n useCollabReconcile,\n getEditorMarkdown,\n type UseCollabReconcileResult,\n type UseCollabReconcileOptions,\n} from \"./useCollabReconcile.js\";\n\nexport interface SharedRichEditorProps {\n value: string;\n onChange: (markdown: string) => void;\n onBlur?: () => void;\n contentUpdatedAt?: string | null;\n editable?: boolean;\n dialect?: RichMarkdownDialect;\n preset?: RichMarkdownEditorPreset;\n /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */\n features?: SharedEditorFeatures;\n /**\n * Injectable image uploader for the shared image block. Used only when\n * `features.image` is on. Pass `uploadEditorImage` (the framework\n * `upload-image` action) for a real uploading image block.\n */\n onImageUpload?: ImageUploadFn | null;\n /**\n * App-specific extensions (Notion nodes, media, drag handles, comment\n * anchors, …) appended after the shared base schema.\n */\n extraExtensions?: Array<Extension | Node | Mark>;\n placeholder?: string;\n className?: string;\n editorClassName?: string;\n ariaLabel?: string;\n interactive?: boolean;\n /**\n * Yjs document for real-time multi-user editing. When provided, prose is\n * authored against the shared Y.Doc and mirrored back to `value` as markdown\n * (still the source of truth). When omitted, the editor is a plain controlled\n * `value`/`onChange` editor — the existing, non-collaborative behavior.\n */\n ydoc?: YDoc | null;\n /** True after the collab provider has loaded persisted Y.Doc state. */\n collabSynced?: boolean;\n /** Shared awareness instance for live cursors/presence. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n /**\n * Disable StarterKit's built-in undo/redo for a controlled (non-collab)\n * editor whose host owns its own undo authority (see\n * {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a\n * `ydoc` is present (Yjs always owns history then). Default `false`, so every\n * existing embedder is unchanged.\n */\n disableHistory?: boolean;\n /** Override the slash-menu block command list. */\n slashItems?: SlashCommandItem[];\n /** Override the bubble-toolbar item builder. */\n buildBubbleItems?: (\n editor: import(\"@tiptap/react\").Editor,\n toggleLink: () => void,\n ) => BubbleToolbarItem[];\n /**\n * Override how the editor's content is read into the canonical `value`.\n * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk\n * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so\n * seed/reconcile/onChange all speak the same value space.\n */\n getMarkdown?: (editor: import(\"@tiptap/react\").Editor) => string;\n /** Override how the canonical `value` is applied into the editor (seed + reconcile). */\n setContent?: (\n editor: import(\"@tiptap/react\").Editor,\n value: string,\n options: { emitUpdate?: boolean; addToHistory?: boolean },\n ) => void;\n /**\n * Optional parser for surgical reconcile. Custom value formats that already\n * handle surgical writes inside `setContent` can pass `false` so the default\n * markdown parser never treats their source bytes as literal markdown.\n */\n parseValue?: UseCollabReconcileOptions[\"parseValue\"];\n /** Canonicalize `value` for the echo / already-in-sync equality checks. */\n normalizeValue?: (value: string) => string;\n /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */\n shouldSeed?: (info: {\n value: string;\n currentMarkdown: string;\n fragmentLength: number;\n }) => boolean;\n /** Initial \"applied\" watermark (see {@link useCollabReconcile}). */\n initialAppliedUpdatedAt?: string | null;\n /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */\n wrapperClassName?: string;\n /**\n * Fires once the editor instance exists. Lets a host capture the root\n * `editor.view` — e.g. to repaint the WHOLE document after a structural block\n * move (a column emptied and its container dissolved) that a surgical\n * per-region patch can't express, since the change is in the root doc itself.\n */\n onEditorReady?: (editor: import(\"@tiptap/react\").Editor) => void;\n}\n\n/**\n * The single shared rich markdown editor surface. Combines\n * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +\n * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /\n * lead-client logic), and the shared {@link SlashCommandMenu} +\n * {@link BubbleToolbar}.\n *\n * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.\n * With a `ydoc` it binds the framework collaboration stack; markdown stays the\n * canonical saved representation while the Y.Doc is transient live state.\n */\nexport function SharedRichEditor({\n value,\n onChange,\n onBlur,\n contentUpdatedAt,\n editable = true,\n dialect = \"gfm\",\n preset = \"plan\",\n features,\n onImageUpload = null,\n extraExtensions,\n placeholder = \"Type '/' for commands...\",\n className,\n editorClassName,\n ariaLabel,\n interactive = editable,\n ydoc = null,\n collabSynced = true,\n awareness = null,\n user = null,\n disableHistory = false,\n slashItems,\n buildBubbleItems,\n getMarkdown,\n setContent,\n parseValue,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n wrapperClassName,\n onEditorReady,\n}: SharedRichEditorProps) {\n const readMarkdown = getMarkdown ?? getEditorMarkdown;\n const onChangeRef = useRef(onChange);\n const onBlurRef = useRef(onBlur);\n onChangeRef.current = onChange;\n onBlurRef.current = onBlur;\n\n const extensions = useMemo(\n () =>\n createSharedEditorExtensions({\n dialect,\n preset,\n placeholder,\n features,\n extraExtensions,\n onImageUpload,\n collab: ydoc ? { ydoc, awareness, user } : null,\n disableHistory,\n }),\n // `preset` is retained in the dependency list so future preset-specific\n // schema branches re-create the editor; it is currently schema-neutral. The\n // collab inputs are identity-stable per block (one Y.Doc per docId), so they\n // only change on a genuine doc switch — exactly when the editor must\n // re-create to rebind Collaboration.\n [\n dialect,\n placeholder,\n preset,\n features,\n extraExtensions,\n onImageUpload,\n ydoc,\n awareness,\n user?.name,\n user?.email,\n user?.color,\n disableHistory,\n ],\n );\n\n const collab = !!ydoc;\n\n // The collab hook needs the editor, but useEditor's `onUpdate` needs the\n // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards\n // through `guardsRef`, which is populated right after the hook runs below.\n // `onUpdate` only ever fires after the editor exists, by which point the ref\n // holds the real guards.\n const guardsRef = useRef<UseCollabReconcileResult | null>(null);\n\n const editor = useEditor(\n {\n extensions,\n // With Collaboration active the prose is owned by the shared Y.XmlFragment.\n // Seeding `content` here too would make the editor initialize from BOTH the\n // prop and the Y.Doc, firing a spurious initial update that could autosave a\n // stale value over newer SQL. The lead-client seed effect populates an empty\n // doc instead. Non-collab editors keep initializing from `value`.\n // With Collaboration the Y.Doc owns the prose (seeded by the lead client).\n // With a custom `setContent` the reconcile seeds the editor too (the raw\n // `value` is not directly settable content — e.g. the plan's blocks JSON),\n // so only the plain markdown path seeds from `value` here.\n content: collab || setContent ? null : value,\n editable,\n editorProps: {\n attributes: {\n class: cn(\"an-rich-md-prose\", editorClassName),\n ...(ariaLabel ? { role: \"textbox\", \"aria-label\": ariaLabel } : {}),\n },\n },\n onUpdate: ({ editor, transaction }) => {\n const guards = guardsRef.current;\n if (!guards || guards.shouldIgnoreUpdate(transaction)) return;\n try {\n const markdown = readMarkdown(editor);\n if (!guards.registerEmitted(markdown)) return;\n queueMicrotask(() => onChangeRef.current(markdown));\n } catch (error) {\n console.error(\"Markdown serialization error:\", error);\n }\n },\n onBlur: () => {\n onBlurRef.current?.();\n },\n // Recreate the editor when the shared Y.Doc identity changes — including\n // null → doc. Extensions are baked in at creation, so a ydoc that arrives\n // AFTER the first mount (fresh page load: the session/user resolves after\n // the editor mounts) would otherwise never bind Collaboration: the editor\n // looks fine but produces no Yjs updates and never receives peers' edits.\n },\n [ydoc],\n );\n\n const collabState = useCollabReconcile({\n editor,\n ydoc,\n collabSynced,\n awareness,\n value,\n contentUpdatedAt,\n editable,\n getMarkdown: readMarkdown,\n setContent,\n parseValue,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n });\n guardsRef.current = collabState;\n\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n editor.setEditable(editable);\n }, [editable, editor]);\n\n useEffect(() => {\n if (editor) onEditorReady?.(editor);\n }, [editor, onEditorReady]);\n\n useEffect(() => () => editor?.destroy(), [editor]);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!editable || !editor || editor.isDestroyed) return;\n const target = event.target as HTMLElement;\n if (\n target.classList.contains(\"an-rich-md-wrapper\") ||\n target.classList.contains(\"an-rich-md-clickable\")\n ) {\n editor.chain().focus(\"end\").run();\n }\n };\n\n if (!editor) {\n return (\n <div\n className={cn(\"an-rich-md-wrapper an-rich-md-loading\", className)}\n data-plan-interactive={interactive ? true : undefined}\n />\n );\n }\n\n return (\n <div\n className={cn(\n \"an-rich-md-wrapper an-rich-md-clickable\",\n !editable && \"an-rich-md-wrapper--readonly\",\n wrapperClassName,\n className,\n )}\n onClick={handleWrapperClick}\n data-plan-interactive={interactive ? true : undefined}\n >\n {editable ? (\n <BubbleToolbar editor={editor} buildItems={buildBubbleItems} />\n ) : null}\n {editable ? (\n <SlashCommandMenu editor={editor} items={slashItems} />\n ) : null}\n <EditorContent editor={editor} />\n </div>\n );\n}\n"]}
@@ -1,41 +0,0 @@
1
- import type { Editor } from "@tiptap/react";
2
- import { type ImageUploadFn } from "./ImageExtension.js";
3
- /** A single slash-menu block command. Apps can extend the default list. */
4
- export interface SlashCommandItem {
5
- title: string;
6
- description: string;
7
- /**
8
- * Optional hidden search text. Use this for raw block types and aliases that
9
- * should match slash queries without making the visible description verbose.
10
- */
11
- searchText?: string;
12
- /** Short text glyph shown in the menu (T, H1, tbl, …). */
13
- icon: string;
14
- action: (editor: Editor) => void;
15
- }
16
- /**
17
- * The default block commands — Plan's current set. Apps pass their own `items`
18
- * (typically `[...DEFAULT_SLASH_COMMANDS, ...extra]`) to extend it.
19
- */
20
- export declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
21
- /**
22
- * Build the `/image` slash command for the shared image block. Requires the
23
- * editor to mount the shared image extension (`features.image`) and an
24
- * {@link ImageUploadFn}; the command opens a native file picker and uploads +
25
- * inserts the chosen image(s). Add it to the list an app passes to
26
- * {@link SlashCommandMenu} (e.g. `[...DEFAULT_SLASH_COMMANDS, createImageSlashCommand(upload)]`).
27
- */
28
- export declare function createImageSlashCommand(upload: ImageUploadFn): SlashCommandItem;
29
- export interface SlashCommandMenuProps {
30
- editor: Editor;
31
- /** Block command list. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
32
- items?: SlashCommandItem[];
33
- }
34
- /**
35
- * The shared "/" block-insert menu. Detects a `/query` at the caret, filters the
36
- * provided command list, and renders a fixed-position picker with keyboard
37
- * navigation. Extracted from the inline plan menu so apps share one
38
- * implementation and only swap the command list.
39
- */
40
- export declare function SlashCommandMenu({ editor, items, }: SlashCommandMenuProps): import("react").JSX.Element | null;
41
- //# sourceMappingURL=SlashCommandMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SlashCommandMenu.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SlashCommandMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAW5C,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7E,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,EA2EpD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,GACpB,gBAAgB,CAOlB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAA8B,GAC/B,EAAE,qBAAqB,sCAwKvB"}