@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 +0,0 @@
1
- {"version":3,"file":"DragHandle.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/DragHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,GAEd,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,wBAAwB,CAAC;AAgD7E,MAAM,aAAa,GAAG,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,iFAAiF;AACjF,iFAAiF;AACjF,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,mFAAmF;AACnF,kFAAkF;AAClF,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,iFAAiF;AACjF,iFAAiF;AACjF,iFAAiF;AACjF,MAAM,iCAAiC,GAAG,IAAI,CAAC;AAC/C,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAChE,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC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CAAC;4BAC7B,uBAAuB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;4BAC7C,IAAI,sBAAsB,KAAK,YAAY,EAAE,CAAC;gCAC5C,sBAAsB,GAAG,IAAI,CAAC;4BAChC,CAAC;4BACD,IAAI,uBAAuB,KAAK,YAAY,EAAE,CAAC;gCAC7C,uBAAuB,GAAG,IAAI,CAAC;4BACjC,CAAC;4BACD,MAAM,EAAE,MAAM,EAAE,CAAC;4BACjB,MAAM,GAAG,IAAI,CAAC;4BACd,mBAAmB,GAAG,IAAI,CAAC;wBAC7B,CAAC;qBACF,CAAC;gBACJ,CAAC;gBACD,KAAK,EAAE;oBACL,eAAe,EAAE;wBACf,SAAS,CAAC,KAAK,EAAE,KAAK;4BACpB,qBAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;4BACpD,OAAO,KAAK,CAAC;wBACf,CAAC;wBACD,IAAI;4BACF,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;4BAC9B,iBAAiB,CAAC,KAAK,CAAC,CAAC;4BACzB,UAAU,EAAE,CAAC;4BACb,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF;iBACF;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { Extension } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\nimport {\n Plugin,\n PluginKey,\n NodeSelection,\n TextSelection,\n type Transaction,\n} from \"@tiptap/pm/state\";\nimport { type EditorView } from \"@tiptap/pm/view\";\n\n/**\n * Default editor-wrapper CSS selector the drag handle scopes itself to.\n *\n * The handle, the drop indicator, and the `position: relative` anchor are all\n * appended to / measured against the closest ancestor matching this selector.\n * Content's editor wraps its ProseMirror DOM in a `.visual-editor-wrapper`\n * element, so that is the historical default. Other apps (e.g. the plan editor)\n * pass their own wrapper selector via {@link DragHandleOptions.wrapperSelector}.\n */\nexport const DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR = \".visual-editor-wrapper\";\n\nexport interface DragHandleOptions {\n /**\n * CSS selector for the editor wrapper element the handle is anchored to.\n *\n * Must match an ancestor of the ProseMirror editor DOM. The wrapper gets\n * `position: relative` so the absolutely-positioned grip and drop indicator\n * can be placed relative to it. Defaults to\n * {@link DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR} so Content keeps working\n * unchanged.\n */\n wrapperSelector: string;\n /**\n * Optional source-side payload for a cross-editor block move. The editor doc\n * carries ProseMirror node content, but app-owned side-map data (for example a\n * plan `diagram` block's HTML/CSS) can live outside the doc; this lets the\n * host carry that data to the receiving editor before the node is inserted.\n */\n getDragTransferData?: (context: {\n view: EditorView;\n node: ProseMirrorNode;\n pos: number;\n }) => unknown;\n /**\n * Optional target-side receiver for cross-editor transfer data. Called before\n * the node is inserted into the target editor so the target's serializer can\n * resolve app-owned data during the synchronous ProseMirror update.\n */\n receiveDragTransferData?: (\n data: unknown,\n context: {\n view: EditorView;\n node: ProseMirrorNode;\n pos: number;\n sourceView: EditorView;\n },\n ) => void;\n /**\n * Optional host-level drop handler for document-specific structure changes.\n * Returning true tells the shared drag handle that the host fully handled the\n * move and no ProseMirror insert/delete should run. This is used for\n * Notion-style side drops where dropping a block to the left/right creates or\n * inserts into a column layout rather than inserting into the target editor.\n */\n handleDrop?: (data: unknown, context: DragHandleDropContext) => boolean;\n}\n\nconst dragHandleKey = new PluginKey(\"dragHandle\");\nconst HOVER_SIDE_OUTSET_REM = 8;\n// Notion-style side drop: drag a block to a neighbour's LEFT/RIGHT region and it\n// builds (or joins) a column layout instead of reordering. The activation region\n// has to be GENEROUS or the gesture is dead for a real human — a natural drag\n// releases somewhere over the block's body, nowhere near a thin edge sliver. The\n// old values (28% of width, capped at 140px, AND only the vertical middle 60%)\n// left a wide ~820px plan block with two ~17%-of-width edge slivers in a 35px-tall\n// band as the ONLY column targets — ~66% of the block (the whole centre) plus the\n// top/bottom only ever reordered, so \"drag side by side\" essentially never made\n// columns. Now each side claims ~a third of the width across the FULL block\n// height, with a middle band always preserved for before/after reorder.\nconst SIDE_DROP_ZONE_RATIO = 0.33;\nconst SIDE_DROP_ZONE_MIN_PX = 56;\nconst SIDE_DROP_ZONE_MAX_PX = 320;\n// Never let the two side zones swallow the whole block: keep at least the middle\n// ~10% of the width as the before/after reorder band so dropping over the centre\n// still moves the block above/below the target (Notion keeps reorder reachable).\nconst SIDE_DROP_ZONE_MAX_WIDTH_FRACTION = 0.45;\nconst DRAG_HANDLE_MENU_STYLE_ID = \"an-rich-md-drag-menu-styles\";\nconst DRAG_HANDLE_MENU_WIDTH = 220;\nconst DRAG_HANDLE_MENU_GAP = 6;\nconst DRAG_HANDLE_MENU_VIEWPORT_PADDING = 8;\n\n/**\n * Wraps Tabler outline icon path data in the standard 24×24 stroke SVG so the\n * DOM-based block menu renders the same icons the React UI uses (Tabler is the\n * framework-wide icon set). The editor is plain DOM, not React, so we inline the\n * markup instead of importing `@tabler/icons-react` components.\n */\nconst tablerIconSvg = (paths: string): string =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${paths}</svg>`;\n\n// Tabler `copy`, `trash`, and `plus` (outline). Path data copied verbatim from\n// @tabler/icons so the glyphs stay pixel-identical to the React icon set.\nconst DRAG_HANDLE_MENU_ICON_DUPLICATE = tablerIconSvg(\n '<path d=\"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\" /><path d=\"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1\" />',\n);\nconst DRAG_HANDLE_MENU_ICON_DELETE = tablerIconSvg(\n '<path d=\"M4 7l16 0\" /><path d=\"M10 11l0 6\" /><path d=\"M14 11l0 6\" /><path d=\"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12\" /><path d=\"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3\" />',\n);\nconst DRAG_HANDLE_MENU_ICON_INSERT = tablerIconSvg(\n '<path d=\"M12 5l0 14\" /><path d=\"M5 12l14 0\" />',\n);\n// Tabler `grip-vertical` (outline) for the left-margin drag grip.\nconst DRAG_HANDLE_GRIP_ICON = tablerIconSvg(\n '<path d=\"M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" /><path d=\"M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" /><path d=\"M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" /><path d=\"M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" /><path d=\"M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" /><path d=\"M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" />',\n);\n\ntype DropTarget = {\n registration: DragHandleRegistration;\n view: EditorView;\n block: HTMLElement;\n placement: DragHandleDropPlacement;\n pos: number;\n targetPos: number;\n targetNodeSize: number;\n rect: DOMRect;\n};\n\nexport type DragHandleDropPlacement = \"before\" | \"after\" | \"left\" | \"right\";\n\nexport type DragHandleDropContext = {\n view: EditorView;\n sourceView: EditorView;\n sourceNode: ProseMirrorNode;\n sourcePos: number;\n sourceNodeSize: number;\n targetNode: ProseMirrorNode;\n targetPos: number;\n targetNodeSize: number;\n insertPos: number;\n placement: DragHandleDropPlacement;\n};\n\ntype DragSession = {\n view: EditorView;\n sourceBlock: HTMLElement;\n sourcePos: number;\n sourceNodeSize: number;\n startX: number;\n startY: number;\n dragging: boolean;\n preview: HTMLElement | null;\n dropLine: HTMLElement | null;\n dropTarget: DropTarget | null;\n};\n\ntype HoverBlock = {\n node: HTMLElement;\n pmPos: number;\n rect: DOMRect;\n};\n\ntype DragHandleMenuContext = {\n view: EditorView;\n sourceBlock: HTMLElement;\n sourcePos: number;\n sourceNodeSize: number;\n};\n\ntype DragHandleRegistration = {\n view: EditorView;\n wrapperSelector: string;\n getDragTransferData?: DragHandleOptions[\"getDragTransferData\"];\n receiveDragTransferData?: DragHandleOptions[\"receiveDragTransferData\"];\n handleDrop?: DragHandleOptions[\"handleDrop\"];\n canHover?: () => boolean;\n findHoverBlock?: (clientX: number, clientY: number) => HoverBlock | null;\n showHoverBlock?: (block: HoverBlock) => void;\n hideHover?: () => void;\n /** The currently displayed grip's bounding rect, or null when hidden. */\n gripRect?: () => DOMRect | null;\n};\n\nconst dragHandleRegistrations = new Set<DragHandleRegistration>();\nlet dragHandleGlobalHoverListeners = 0;\nlet activeDragRegistration: DragHandleRegistration | null = null;\n// The registration whose grip is currently shown. Used to keep that grip alive\n// while the cursor travels from a block's body to its grip, even when the grip\n// sits in a contested gap (an inter-column gap or a tab body's left offset)\n// where another editor's wide forgiving zone would otherwise re-win the hover\n// and hide the grip out from under the approaching cursor.\nlet activeHoverRegistration: DragHandleRegistration | null = null;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(Math.max(value, min), max);\n\nconst editorArea = (registration: DragHandleRegistration) => {\n const rect = registration.view.dom.getBoundingClientRect();\n return rect.width * rect.height;\n};\n\nconst updateRegisteredHover = (clientX: number, clientY: number) => {\n if (activeDragRegistration) {\n for (const registration of dragHandleRegistrations) {\n registration.hideHover?.();\n }\n activeHoverRegistration = null;\n return;\n }\n\n const candidates: Array<{\n registration: DragHandleRegistration;\n block: HoverBlock;\n }> = [];\n\n for (const registration of dragHandleRegistrations) {\n if (!registration.view.dom.isConnected || !registration.canHover?.()) {\n registration.hideHover?.();\n continue;\n }\n const block = registration.findHoverBlock?.(clientX, clientY);\n if (block) {\n candidates.push({ registration, block });\n } else {\n registration.hideHover?.();\n }\n }\n\n // Grip keepalive. Once a block's grip is showing, hold it while the cursor\n // travels LEFT of that block's content toward its grip glyph — within the\n // block's own vertical row and no further left than the glyph itself. This is\n // what makes grips grabbable for blocks that are NOT flush with the page's\n // left gutter (a right column, a tab body): their grip sits in a gap that the\n // neighbour's wide forgiving zone also claims, so the normal picker would flip\n // hover to the neighbour mid-approach and the grip would vanish before the\n // cursor reaches it. The keepalive only bridges the body→grip gap — it does\n // NOT fire while the cursor is over content (so the innermost/nested picking\n // and gutter-grab rules below still decide there) and the row guard stops it\n // from sticking the grip across vertical moves to another block's row.\n if (activeHoverRegistration) {\n const held = candidates.find(\n (candidate) => candidate.registration === activeHoverRegistration,\n );\n const grip = activeHoverRegistration.gripRect?.();\n if (\n held &&\n grip &&\n clientY >= held.block.rect.top &&\n clientY < held.block.rect.bottom &&\n clientX >= grip.left - 4 &&\n clientX < held.block.rect.left\n ) {\n for (const registration of dragHandleRegistrations) {\n if (registration !== held.registration) registration.hideHover?.();\n }\n held.registration.showHoverBlock?.(held.block);\n return;\n }\n }\n\n // Pick which editor owns the grip when several register a hover block at this\n // point. Nested region editors (e.g. each column inside a `columns` block) tile\n // their container's whole footprint AND extend a wide forgiving zone\n // (HOVER_SIDE_OUTSET_REM) into its left-margin gutter, so a pure\n // \"smallest editor wins\" rule lets an inner block beat the container everywhere\n // and leaves the container itself impossible to grab. Split candidates by where\n // the cursor sits relative to each block:\n // - Over a block's body (clientX at/after its left edge) the innermost\n // (smallest) editor wins, so nested blocks stay grabbable from their content.\n // - In the shared left-margin gutter (clientX left of every candidate's\n // content, where the grip lives) the outermost (largest) editor wins, so the\n // container block can be picked up and reordered.\n // Prefer the candidate whose block actually sits UNDER the cursor\n // horizontally. Without this, a left column's forgiving side zone reaches\n // across the inter-column gap, ties the right column's editor on area, and\n // wins — so hovering a right-column block shows the grip for the LEFT block\n // (and right-column blocks appear to have no grip at all). `overContent`\n // restricts to blocks the cursor is genuinely within; `rightOfLeftEdge` keeps\n // the gutter-grab behaviour; fully left of every block → the container wins.\n const overContent = candidates.filter(\n (candidate) =>\n clientX >= candidate.block.rect.left &&\n clientX <= candidate.block.rect.right,\n );\n // The grip renders in a narrow band just LEFT of each block (≈24px). A block\n // must OWN that band so moving the cursor onto its grip keeps showing (and\n // lets you press) that block's grip — otherwise, for a column block whose grip\n // sits in the gutter/inter-column gap, the \"gutter → largest editor\" rule\n // below would flip the hover to the columns container and the grip would\n // vanish out from under the cursor, making inner column blocks impossible to\n // drag. The band is narrow, so it does not collide with the neighbouring\n // column's content (the right column's grip lives in the inter-column gap,\n // left of its own content but right of the left column's content).\n const GRIP_HOVER_ZONE_PX = 28;\n const overGrip = candidates.filter(\n (candidate) =>\n clientX >= candidate.block.rect.left - GRIP_HOVER_ZONE_PX &&\n clientX < candidate.block.rect.left,\n );\n const rightOfLeftEdge = candidates.filter(\n (candidate) => clientX >= candidate.block.rect.left,\n );\n let active: {\n registration: DragHandleRegistration;\n block: HoverBlock;\n } | null;\n const innerPool =\n overContent.length > 0\n ? overContent\n : overGrip.length > 0\n ? overGrip\n : rightOfLeftEdge;\n if (innerPool.length > 0) {\n innerPool.sort(\n (a, b) => editorArea(a.registration) - editorArea(b.registration),\n );\n active = innerPool[0];\n } else {\n candidates.sort(\n (a, b) => editorArea(b.registration) - editorArea(a.registration),\n );\n active = candidates[0] ?? null;\n }\n\n for (const registration of dragHandleRegistrations) {\n if (registration !== active?.registration) registration.hideHover?.();\n }\n active?.registration.showHoverBlock?.(active.block);\n activeHoverRegistration = active?.registration ?? null;\n};\n\nconst handleGlobalHoverMove = (event: MouseEvent) => {\n updateRegisteredHover(event.clientX, event.clientY);\n};\n\nconst retainGlobalHoverListener = () => {\n dragHandleGlobalHoverListeners += 1;\n if (dragHandleGlobalHoverListeners === 1) {\n document.addEventListener(\"mousemove\", handleGlobalHoverMove);\n }\n};\n\nconst releaseGlobalHoverListener = () => {\n dragHandleGlobalHoverListeners = Math.max(\n 0,\n dragHandleGlobalHoverListeners - 1,\n );\n if (dragHandleGlobalHoverListeners === 0) {\n document.removeEventListener(\"mousemove\", handleGlobalHoverMove);\n }\n};\n\nconst ensureDragHandleMenuStyles = () => {\n if (document.getElementById(DRAG_HANDLE_MENU_STYLE_ID)) return;\n\n const style = document.createElement(\"style\");\n style.id = DRAG_HANDLE_MENU_STYLE_ID;\n style.textContent = `\n.an-rich-md-drag-menu {\n position: fixed;\n z-index: 9999;\n width: ${DRAG_HANDLE_MENU_WIDTH}px;\n padding: 4px;\n border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));\n border-radius: 7px;\n background: hsl(var(--popover, 0 0% 100%));\n color: hsl(var(--popover-foreground, var(--foreground, 222.2 84% 4.9%)));\n box-shadow:\n 0 12px 32px rgb(15 23 42 / 0.16),\n 0 2px 8px rgb(15 23 42 / 0.08);\n font-family: inherit;\n font-size: 13px;\n line-height: 1.35;\n}\n\n.an-rich-md-drag-menu__item {\n display: flex;\n width: 100%;\n align-items: center;\n gap: 9px;\n border: 0;\n border-radius: 5px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n letter-spacing: 0;\n padding: 7px 8px;\n text-align: left;\n}\n\n.an-rich-md-drag-menu__item:hover,\n.an-rich-md-drag-menu__item:focus-visible {\n background: hsl(var(--accent, 210 40% 96.1%));\n color: hsl(var(--accent-foreground, var(--foreground, 222.2 84% 4.9%)));\n outline: none;\n}\n\n.an-rich-md-drag-menu__item[data-danger=\"true\"] {\n color: hsl(var(--destructive, 0 84.2% 60.2%));\n}\n\n.an-rich-md-drag-menu__item[data-danger=\"true\"]:hover,\n.an-rich-md-drag-menu__item[data-danger=\"true\"]:focus-visible {\n background: hsl(var(--destructive, 0 84.2% 60.2%) / 0.1);\n}\n\n.an-rich-md-drag-menu__icon {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n color: hsl(var(--muted-foreground, 215.4 16.3% 46.9%));\n}\n\n.an-rich-md-drag-menu__item[data-danger=\"true\"] .an-rich-md-drag-menu__icon {\n color: currentColor;\n}\n\n.an-rich-md-drag-menu__icon svg {\n width: 17px;\n height: 17px;\n}\n\n.an-rich-md-drag-menu__label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n`;\n document.head.appendChild(style);\n};\n\n/**\n * App-agnostic Tiptap extension providing a Notion-style left-margin drag grip\n * (the `::` handle), block selection, and drag-to-reorder over top-level block\n * nodes.\n *\n * Behavior:\n * - On hover over any top-level block, a `.drag-handle` grip appears in the left\n * margin (forgiving hit zone extends {@link HOVER_SIDE_OUTSET_REM}rem to the\n * sides and into the gap above/between blocks).\n * - Single-clicking the grip selects the block and opens a block action menu.\n * Dragging past a small threshold starts a reorder, showing a floating clone\n * preview (`.notion-drag-preview`) and a `.notion-drop-indicator` line.\n * `Escape` cancels.\n * - While dragging, the source block carries `.notion-block--dragging` and the\n * document element carries `.notion-editor-is-dragging` so apps can style the\n * in-flight state. Apps own all of these CSS class names.\n * - Works for ANY top-level node ProseMirror renders as a direct child of the\n * editor — including `group: \"block\"`, `draggable: true` atoms such as the\n * plan editor's `planBlock`.\n *\n * The only app-specific coupling — the editor wrapper element the handle and\n * drop indicator are anchored to — is configurable via\n * {@link DragHandleOptions.wrapperSelector}, defaulting to\n * {@link DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR} (`.visual-editor-wrapper`) so the\n * Content editor keeps working byte-identically. The plan editor passes its own\n * wrapper selector via `DragHandle.configure({ wrapperSelector })`.\n */\nexport const DragHandle = Extension.create<DragHandleOptions>({\n name: \"dragHandle\",\n\n addOptions() {\n return {\n wrapperSelector: DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR,\n getDragTransferData: undefined,\n receiveDragTransferData: undefined,\n };\n },\n\n addProseMirrorPlugins() {\n const editor = this.editor;\n const wrapperSelector = this.options.wrapperSelector;\n const getDragTransferData = this.options.getDragTransferData;\n const receiveDragTransferData = this.options.receiveDragTransferData;\n const handleDrop = this.options.handleDrop;\n let handle: HTMLElement | null = null;\n let menu: HTMLElement | null = null;\n let menuContext: DragHandleMenuContext | null = null;\n let currentBlock: HTMLElement | null = null;\n let dragStartPos: number | null = null;\n let dragSession: DragSession | null = null;\n let currentRegistration: DragHandleRegistration | null = null;\n\n const getHoverSideOutset = () => {\n const rootFontSize = Number.parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n );\n return (\n (Number.isFinite(rootFontSize) ? rootFontSize : 16) *\n HOVER_SIDE_OUTSET_REM\n );\n };\n\n const getTopLevelBlocks = (editorView: EditorView): HoverBlock[] => {\n const blocks: HoverBlock[] = [];\n\n editorView.state.doc.forEach((_node, offset) => {\n const dom = editorView.nodeDOM(offset);\n if (!(dom instanceof HTMLElement)) return;\n\n blocks.push({\n node: dom,\n pmPos: offset,\n rect: dom.getBoundingClientRect(),\n });\n });\n\n return blocks;\n };\n\n const registrationForView = (\n editorView: EditorView,\n ): DragHandleRegistration | null => {\n for (const registration of dragHandleRegistrations) {\n if (registration.view === editorView) return registration;\n }\n return null;\n };\n\n const findForgivingBlock = (\n editorView: EditorView,\n clientX: number,\n clientY: number,\n ): HoverBlock | null => {\n const blocks = getTopLevelBlocks(editorView);\n if (blocks.length === 0) return null;\n\n const sideOutset = getHoverSideOutset();\n const pageLeft = 0;\n const pageRight = window.visualViewport?.width ?? window.innerWidth;\n\n for (let index = 0; index < blocks.length; index++) {\n const block = blocks[index];\n const nextBlock = blocks[index + 1];\n const blockBottomGap = nextBlock\n ? Math.max(0, nextBlock.rect.top - block.rect.bottom)\n : 0;\n const zoneLeft = Math.max(pageLeft, block.rect.left - sideOutset);\n const zoneRight = Math.min(pageRight, block.rect.right + sideOutset);\n const zoneTop =\n index === 0\n ? Math.max(0, block.rect.top - blockBottomGap)\n : block.rect.top;\n const zoneBottom = nextBlock ? nextBlock.rect.top : block.rect.bottom;\n\n if (\n clientX >= zoneLeft &&\n clientX <= zoneRight &&\n clientY >= zoneTop &&\n clientY < zoneBottom\n ) {\n return block;\n }\n }\n\n return null;\n };\n\n const showHandleForBlock = (editorView: EditorView, block: HoverBlock) => {\n if (!handle) return;\n currentBlock = block.node;\n dragStartPos = block.pmPos;\n\n const wrapper = editorView.dom.closest(wrapperSelector);\n if (!wrapper) return;\n\n // Lazily (re)attach the grip the first time a wrapper is actually\n // available. At plugin `view()` init the editor DOM may not yet be mounted\n // inside the wrapper (React mounts `EditorContent` after the EditorView is\n // constructed), so the init-time append can silently no-op and leave the\n // grip orphaned. Re-home it here once the wrapper exists.\n if (handle.parentElement !== wrapper) {\n (wrapper as HTMLElement).style.position = \"relative\";\n wrapper.appendChild(handle);\n }\n\n const wrapperRect = wrapper.getBoundingClientRect();\n const handleLeft = block.rect.left - wrapperRect.left - 24;\n\n handle.style.display = \"flex\";\n handle.style.top = `${block.rect.top - wrapperRect.top + 2}px`;\n handle.style.left = `${handleLeft}px`;\n };\n\n const selectBlockAt = (editorView: EditorView, pos: number) => {\n try {\n const sel = NodeSelection.create(editorView.state.doc, pos);\n editorView.dispatch(editorView.state.tr.setSelection(sel));\n editorView.focus();\n return sel;\n } catch {\n return null;\n }\n };\n\n const cleanupDragVisuals = () => {\n dragSession?.preview?.remove();\n dragSession?.dropLine?.remove();\n dragSession?.sourceBlock.classList.remove(\"notion-block--dragging\");\n document.documentElement.classList.remove(\"notion-editor-is-dragging\");\n };\n\n const createDragPreview = (block: HTMLElement): HTMLElement => {\n const blockRect = block.getBoundingClientRect();\n const preview = document.createElement(\"div\");\n const clone = block.cloneNode(true) as HTMLElement;\n\n clone.classList.remove(\n \"ProseMirror-selectednode\",\n \"notion-block--dragging\",\n );\n clone.removeAttribute(\"contenteditable\");\n clone.style.background = \"transparent\";\n clone.style.backgroundColor = \"transparent\";\n clone.querySelectorAll(\"[contenteditable]\").forEach((node) => {\n node.removeAttribute(\"contenteditable\");\n });\n clone.querySelectorAll<HTMLElement>(\"*\").forEach((node) => {\n node.style.background = \"transparent\";\n node.style.backgroundColor = \"transparent\";\n });\n\n preview.className = \"notion-drag-preview\";\n preview.style.width = `${blockRect.width}px`;\n preview.appendChild(clone);\n document.body.appendChild(preview);\n\n return preview;\n };\n\n const createDropLine = (\n registration: DragHandleRegistration,\n ): HTMLElement | null => {\n const wrapper = registration.view.dom.closest(\n registration.wrapperSelector,\n );\n if (!wrapper) return null;\n\n const line = document.createElement(\"div\");\n line.className = \"notion-drop-indicator\";\n wrapper.appendChild(line);\n return line;\n };\n\n const forceHideHandle = () => {\n if (handle) {\n handle.style.display = \"none\";\n handle.setAttribute(\"aria-expanded\", \"false\");\n }\n currentBlock = null;\n dragStartPos = null;\n };\n\n const closeMenu = ({ hideGrip = false }: { hideGrip?: boolean } = {}) => {\n menu?.remove();\n menu = null;\n menuContext = null;\n handle?.setAttribute(\"aria-expanded\", \"false\");\n document.removeEventListener(\"mousedown\", handleMenuDocumentMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"keydown\", handleMenuKeyDown, {\n capture: true,\n });\n window.removeEventListener(\"resize\", handleMenuViewportChange);\n window.removeEventListener(\"scroll\", handleMenuViewportChange, {\n capture: true,\n });\n if (hideGrip) forceHideHandle();\n };\n\n const resolveMenuContext = (context: DragHandleMenuContext) => {\n const latestBlock = getTopLevelBlocks(context.view).find(\n (block) => block.node === context.sourceBlock,\n );\n const sourcePos = latestBlock?.pmPos ?? context.sourcePos;\n const sourceNode = context.view.state.doc.nodeAt(sourcePos);\n if (!sourceNode) return null;\n\n return {\n ...context,\n sourcePos,\n sourceNode,\n sourceNodeSize: sourceNode.nodeSize,\n };\n };\n\n const focusSelectionNear = (\n view: EditorView,\n tr: Transaction,\n pos: number,\n bias: -1 | 1,\n ) => {\n tr.setSelection(\n TextSelection.near(\n tr.doc.resolve(clamp(pos, 0, tr.doc.content.size)),\n bias,\n ),\n );\n view.dispatch(tr.scrollIntoView());\n view.focus();\n };\n\n const duplicateBlock = (context: DragHandleMenuContext) => {\n const resolved = resolveMenuContext(context);\n if (!resolved) return;\n\n const insertPos = resolved.sourcePos + resolved.sourceNodeSize;\n const tr = resolved.view.state.tr.insert(insertPos, resolved.sourceNode);\n\n try {\n tr.setSelection(NodeSelection.create(tr.doc, insertPos));\n resolved.view.dispatch(tr.scrollIntoView());\n resolved.view.focus();\n } catch {\n focusSelectionNear(resolved.view, tr, insertPos, 1);\n }\n };\n\n const deleteBlock = (context: DragHandleMenuContext) => {\n const resolved = resolveMenuContext(context);\n if (!resolved) return;\n\n const { view, sourcePos, sourceNodeSize } = resolved;\n const paragraph = view.state.schema.nodes.paragraph;\n const sourceEnd = sourcePos + sourceNodeSize;\n\n if (view.state.doc.childCount <= 1 && paragraph) {\n const replacement = paragraph.createAndFill() ?? paragraph.create();\n const tr = view.state.tr.replaceWith(sourcePos, sourceEnd, replacement);\n focusSelectionNear(view, tr, sourcePos + 1, 1);\n return;\n }\n\n const tr = view.state.tr.delete(sourcePos, sourceEnd);\n const selectionBias = sourcePos >= tr.doc.content.size ? -1 : 1;\n focusSelectionNear(view, tr, sourcePos, selectionBias);\n };\n\n const insertParagraphBelow = (context: DragHandleMenuContext) => {\n const resolved = resolveMenuContext(context);\n const paragraph = resolved?.view.state.schema.nodes.paragraph;\n if (!resolved || !paragraph) return;\n\n const insertPos = resolved.sourcePos + resolved.sourceNodeSize;\n const paragraphNode = paragraph.createAndFill() ?? paragraph.create();\n const tr = resolved.view.state.tr.insert(insertPos, paragraphNode);\n tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));\n resolved.view.dispatch(tr.scrollIntoView());\n resolved.view.focus();\n };\n\n const positionMenu = (anchorRect: DOMRect) => {\n if (!menu) return;\n\n const viewportWidth = window.visualViewport?.width ?? window.innerWidth;\n const viewportHeight =\n window.visualViewport?.height ?? window.innerHeight;\n const menuHeight = menu.offsetHeight || 118;\n const preferredLeft = anchorRect.right + DRAG_HANDLE_MENU_GAP;\n const alternateLeft =\n anchorRect.left - DRAG_HANDLE_MENU_WIDTH - DRAG_HANDLE_MENU_GAP;\n const left =\n preferredLeft +\n DRAG_HANDLE_MENU_WIDTH +\n DRAG_HANDLE_MENU_VIEWPORT_PADDING <=\n viewportWidth\n ? preferredLeft\n : alternateLeft;\n\n menu.style.left = `${clamp(\n left,\n DRAG_HANDLE_MENU_VIEWPORT_PADDING,\n viewportWidth -\n DRAG_HANDLE_MENU_WIDTH -\n DRAG_HANDLE_MENU_VIEWPORT_PADDING,\n )}px`;\n menu.style.top = `${clamp(\n anchorRect.top - 4,\n DRAG_HANDLE_MENU_VIEWPORT_PADDING,\n viewportHeight - menuHeight - DRAG_HANDLE_MENU_VIEWPORT_PADDING,\n )}px`;\n };\n\n const createMenuItem = (\n label: string,\n iconSvg: string,\n action: (context: DragHandleMenuContext) => void,\n options: { danger?: boolean } = {},\n ) => {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = \"an-rich-md-drag-menu__item\";\n button.setAttribute(\"role\", \"menuitem\");\n button.setAttribute(\"data-plan-interactive\", \"true\");\n if (options.danger) button.setAttribute(\"data-danger\", \"true\");\n\n const icon = document.createElement(\"span\");\n icon.className = \"an-rich-md-drag-menu__icon\";\n icon.setAttribute(\"aria-hidden\", \"true\");\n icon.innerHTML = iconSvg;\n\n const labelElement = document.createElement(\"span\");\n labelElement.className = \"an-rich-md-drag-menu__label\";\n labelElement.textContent = label;\n\n button.append(icon, labelElement);\n button.addEventListener(\"mousedown\", (event) => {\n event.preventDefault();\n });\n button.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n const context = menuContext;\n if (!context) return;\n closeMenu({ hideGrip: true });\n action(context);\n });\n\n return button;\n };\n\n const openMenu = (context: DragHandleMenuContext, anchorRect: DOMRect) => {\n const resolved = resolveMenuContext(context);\n if (!resolved) return;\n\n closeMenu();\n selectBlockAt(resolved.view, resolved.sourcePos);\n ensureDragHandleMenuStyles();\n\n const el = document.createElement(\"div\");\n el.className = \"an-rich-md-drag-menu\";\n el.setAttribute(\"role\", \"menu\");\n el.setAttribute(\"aria-label\", \"Block actions\");\n el.setAttribute(\"data-plan-interactive\", \"true\");\n\n el.append(\n createMenuItem(\n \"Duplicate\",\n DRAG_HANDLE_MENU_ICON_DUPLICATE,\n duplicateBlock,\n ),\n createMenuItem(\"Delete\", DRAG_HANDLE_MENU_ICON_DELETE, deleteBlock, {\n danger: true,\n }),\n createMenuItem(\n \"Insert block below\",\n DRAG_HANDLE_MENU_ICON_INSERT,\n insertParagraphBelow,\n ),\n );\n\n menu = el;\n menuContext = {\n view: resolved.view,\n sourceBlock: resolved.sourceBlock,\n sourcePos: resolved.sourcePos,\n sourceNodeSize: resolved.sourceNodeSize,\n };\n document.body.appendChild(el);\n positionMenu(anchorRect);\n handle?.setAttribute(\"aria-expanded\", \"true\");\n document.addEventListener(\"mousedown\", handleMenuDocumentMouseDown, {\n capture: true,\n });\n document.addEventListener(\"keydown\", handleMenuKeyDown, {\n capture: true,\n });\n window.addEventListener(\"resize\", handleMenuViewportChange);\n window.addEventListener(\"scroll\", handleMenuViewportChange, {\n capture: true,\n });\n\n el.querySelector<HTMLButtonElement>(\"button\")?.focus({\n preventScroll: true,\n });\n };\n\n const findDropTarget = (\n registration: DragHandleRegistration,\n clientX: number,\n clientY: number,\n ): DropTarget | null => {\n const view = registration.view;\n const block = findForgivingBlock(view, clientX, clientY);\n if (!block) return null;\n\n const node = view.state.doc.nodeAt(block.pmPos);\n if (!node) return null;\n\n let placement: DragHandleDropPlacement;\n const withinBlockY =\n clientY >= block.rect.top && clientY <= block.rect.bottom;\n // Side (column) zones span the FULL block height — only the horizontal\n // position decides column-vs-reorder. Restricting to the vertical middle\n // (the old 0.2 band) made the already-tiny edge slivers nearly unhittable.\n const sideZoneWidth = Math.min(\n clamp(\n block.rect.width * SIDE_DROP_ZONE_RATIO,\n SIDE_DROP_ZONE_MIN_PX,\n SIDE_DROP_ZONE_MAX_PX,\n ),\n block.rect.width * SIDE_DROP_ZONE_MAX_WIDTH_FRACTION,\n );\n\n if (\n registration.handleDrop &&\n withinBlockY &&\n clientX <= block.rect.left + sideZoneWidth\n ) {\n placement = \"left\";\n } else if (\n registration.handleDrop &&\n withinBlockY &&\n clientX >= block.rect.right - sideZoneWidth\n ) {\n placement = \"right\";\n } else {\n placement =\n clientY < block.rect.top ||\n (clientY <= block.rect.bottom &&\n clientY < block.rect.top + block.rect.height / 2)\n ? \"before\"\n : \"after\";\n }\n const before = placement === \"before\" || placement === \"left\";\n\n return {\n registration,\n view,\n block: block.node,\n placement,\n pos: before ? block.pmPos : block.pmPos + node.nodeSize,\n targetPos: block.pmPos,\n targetNodeSize: node.nodeSize,\n rect: block.rect,\n };\n };\n\n const findAnyDropTarget = (\n session: DragSession,\n clientX: number,\n clientY: number,\n ): DropTarget | null => {\n const candidates: DropTarget[] = [];\n\n for (const registration of dragHandleRegistrations) {\n if (!registration.view.dom.isConnected) continue;\n if (\n registration.view !== session.view &&\n session.sourceBlock.contains(registration.view.dom)\n ) {\n continue;\n }\n const target = findDropTarget(registration, clientX, clientY);\n if (target) candidates.push(target);\n }\n\n candidates.sort((a, b) => {\n const aRect = a.view.dom.getBoundingClientRect();\n const bRect = b.view.dom.getBoundingClientRect();\n return aRect.width * aRect.height - bRect.width * bRect.height;\n });\n\n return candidates[0] ?? null;\n };\n\n const positionDragPreview = (\n session: DragSession,\n clientX: number,\n clientY: number,\n ) => {\n if (!session.preview) return;\n\n session.preview.style.transform = `translate3d(${clientX + 12}px, ${clientY + 10}px, 0)`;\n };\n\n const updateDropLine = (\n session: DragSession,\n target: DropTarget | null,\n ) => {\n const sourceEnd = session.sourcePos + session.sourceNodeSize;\n const isSideDrop =\n target?.placement === \"left\" || target?.placement === \"right\";\n if (\n !target ||\n (target.view === session.view &&\n (isSideDrop\n ? // A side drop only ever builds columns; the ProseMirror seam\n // position is irrelevant. The only no-op is dropping a block on\n // ITS OWN side — adjacent *different* blocks must still form\n // columns (otherwise dropping onto an immediate neighbour's\n // facing edge silently does nothing, which reads as \"side drop\n // works sometimes\").\n target.targetPos === session.sourcePos\n : target.pos === session.sourcePos ||\n target.pos === sourceEnd ||\n (target.pos > session.sourcePos && target.pos < sourceEnd)))\n ) {\n session.dropTarget = null;\n session.dropLine?.remove();\n session.dropLine = null;\n return;\n }\n\n const wrapper = target.view.dom.closest(\n target.registration.wrapperSelector,\n );\n if (!wrapper) return;\n\n if (!session.dropLine || session.dropLine.parentElement !== wrapper) {\n session.dropLine?.remove();\n session.dropLine = createDropLine(target.registration);\n }\n if (!session.dropLine) return;\n\n const wrapperRect = wrapper.getBoundingClientRect();\n const editorRect = target.view.dom.getBoundingClientRect();\n\n session.dropTarget = target;\n // A column (side) drop and a reorder (before/after) drop both draw the\n // `.notion-drop-indicator`, but they mean very different things, so the\n // column case carries a modifier class apps style distinctly (a bolder,\n // glowing vertical bar) — without a clear cue a human can't tell they've\n // entered column-build mode before releasing.\n const isColumnDrop =\n target.placement === \"left\" || target.placement === \"right\";\n session.dropLine.classList.toggle(\n \"notion-drop-indicator--column\",\n isColumnDrop,\n );\n if (isColumnDrop) {\n // A vertical bar centred on the seam at the target's left/right edge,\n // spanning the block's full height.\n const SIDE_BAR_WIDTH = 4;\n const seam =\n target.placement === \"left\" ? target.rect.left : target.rect.right;\n session.dropLine.style.left = `${seam - wrapperRect.left - SIDE_BAR_WIDTH / 2}px`;\n session.dropLine.style.top = `${target.rect.top - wrapperRect.top}px`;\n session.dropLine.style.width = `${SIDE_BAR_WIDTH}px`;\n session.dropLine.style.height = `${target.rect.height}px`;\n return;\n }\n\n const top =\n target.placement === \"before\" ? target.rect.top : target.rect.bottom;\n session.dropLine.style.left = `${editorRect.left - wrapperRect.left}px`;\n session.dropLine.style.top = `${top - wrapperRect.top}px`;\n session.dropLine.style.width = `${editorRect.width}px`;\n session.dropLine.style.height = \"3px\";\n };\n\n const createHandle = () => {\n const el = document.createElement(\"div\");\n el.className = \"drag-handle\";\n el.contentEditable = \"false\";\n el.draggable = false;\n el.tabIndex = 0;\n el.setAttribute(\"role\", \"button\");\n el.setAttribute(\"aria-label\", \"Open block menu or drag to reorder\");\n el.setAttribute(\"aria-haspopup\", \"menu\");\n el.setAttribute(\"aria-expanded\", \"false\");\n el.title = \"Open block menu or drag to reorder\";\n // The icon must not be its own hit target: a real mouse-down inside a\n // nested editor (a column) lands on the SVG, and a container block's\n // capture-phase block-select handler (RegistryBlockNode) only spares the\n // grip DIV — so a press on the icon gets swallowed and the block can't be\n // dragged out of / between columns. `pointer-events:none` makes every\n // press in the grip area resolve to the DIV instead.\n // Tabler `grip-vertical` (the framework-wide icon set). `pointer-events:none`\n // keeps every press in the grip area resolving to the DIV, not the SVG.\n el.innerHTML = DRAG_HANDLE_GRIP_ICON;\n const gripSvg = el.querySelector(\"svg\");\n if (gripSvg) {\n gripSvg.setAttribute(\"width\", \"16\");\n gripSvg.setAttribute(\"height\", \"16\");\n gripSvg.style.pointerEvents = \"none\";\n }\n return el;\n };\n\n const hideHandle = () => {\n if (menu) return;\n forceHideHandle();\n };\n\n const removeDragListeners = () => {\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"keydown\", handleDocumentKeyDown);\n };\n\n function handleMenuDocumentMouseDown(event: MouseEvent) {\n const target = event.target;\n if (!(target instanceof Node)) return;\n if (menu?.contains(target) || handle?.contains(target)) return;\n closeMenu({ hideGrip: true });\n }\n\n function handleMenuKeyDown(event: KeyboardEvent) {\n if (!menu) return;\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeMenu({ hideGrip: true });\n return;\n }\n\n if (\n event.key !== \"ArrowDown\" &&\n event.key !== \"ArrowUp\" &&\n event.key !== \"Home\" &&\n event.key !== \"End\"\n ) {\n return;\n }\n\n const buttons = Array.from(\n menu.querySelectorAll<HTMLButtonElement>(\"button\"),\n );\n if (buttons.length === 0) return;\n\n event.preventDefault();\n const activeIndex = buttons.indexOf(\n document.activeElement as HTMLButtonElement,\n );\n let nextIndex = activeIndex < 0 ? 0 : activeIndex;\n\n if (event.key === \"ArrowDown\") {\n nextIndex = (nextIndex + 1) % buttons.length;\n } else if (event.key === \"ArrowUp\") {\n nextIndex = (nextIndex - 1 + buttons.length) % buttons.length;\n } else if (event.key === \"Home\") {\n nextIndex = 0;\n } else if (event.key === \"End\") {\n nextIndex = buttons.length - 1;\n }\n\n buttons[nextIndex]?.focus({ preventScroll: true });\n }\n\n function handleMenuViewportChange() {\n closeMenu({ hideGrip: true });\n }\n\n const finishDragSession = (commit: boolean, event?: MouseEvent) => {\n const session = dragSession;\n if (!session) return;\n\n removeDragListeners();\n\n if (commit && session.dragging && session.dropTarget) {\n const sourceStart = session.sourcePos;\n const sourceEnd = session.sourcePos + session.sourceNodeSize;\n const target = session.dropTarget;\n const dropPos = target.pos;\n const isSideDrop =\n target.placement === \"left\" || target.placement === \"right\";\n\n if (\n target.view !== session.view ||\n (isSideDrop\n ? // Side drop (column build): proceed for any block that isn't the\n // source itself, including the source's immediate neighbour.\n target.targetPos !== sourceStart\n : dropPos !== sourceStart &&\n dropPos !== sourceEnd &&\n !(dropPos > sourceStart && dropPos < sourceEnd))\n ) {\n const sourceNode = session.view.state.doc.nodeAt(sourceStart);\n if (sourceNode) {\n const sourceRegistration = registrationForView(session.view);\n const transferData = sourceRegistration?.getDragTransferData?.({\n view: session.view,\n node: sourceNode,\n pos: sourceStart,\n });\n const targetNode = target.view.state.doc.nodeAt(target.targetPos);\n const handled =\n !!targetNode &&\n (target.registration.handleDrop?.(transferData, {\n view: target.view,\n sourceView: session.view,\n sourceNode,\n sourcePos: sourceStart,\n sourceNodeSize: sourceNode.nodeSize,\n targetNode,\n targetPos: target.targetPos,\n targetNodeSize: target.targetNodeSize,\n insertPos: dropPos,\n placement: target.placement,\n }) ??\n false);\n\n if (handled) {\n target.view.focus();\n } else if (target.view === session.view) {\n const insertPos =\n dropPos > sourceStart ? dropPos - sourceNode.nodeSize : dropPos;\n const tr = session.view.state.tr\n .delete(sourceStart, sourceEnd)\n .insert(insertPos, sourceNode);\n\n tr.setSelection(NodeSelection.create(tr.doc, insertPos));\n\n session.view.dispatch(tr.scrollIntoView());\n session.view.focus();\n } else {\n try {\n const targetNode = target.view.state.schema.nodeFromJSON(\n sourceNode.toJSON(),\n );\n target.registration.receiveDragTransferData?.(transferData, {\n view: target.view,\n node: targetNode,\n pos: dropPos,\n sourceView: session.view,\n });\n const insertTr = target.view.state.tr.insert(\n dropPos,\n targetNode,\n );\n insertTr.setSelection(\n NodeSelection.create(insertTr.doc, dropPos),\n );\n target.view.dispatch(insertTr.scrollIntoView());\n\n const deleteTr = session.view.state.tr.delete(\n sourceStart,\n sourceEnd,\n );\n session.view.dispatch(deleteTr);\n target.view.focus();\n } catch {\n // If the target schema cannot accept this node, leave the\n // source document untouched.\n }\n }\n }\n }\n } else if (commit && !session.dragging && event) {\n openMenu(\n {\n view: session.view,\n sourceBlock: session.sourceBlock,\n sourcePos: session.sourcePos,\n sourceNodeSize: session.sourceNodeSize,\n },\n handle?.getBoundingClientRect() ??\n session.sourceBlock.getBoundingClientRect(),\n );\n }\n\n cleanupDragVisuals();\n dragSession = null;\n if (activeDragRegistration === currentRegistration) {\n activeDragRegistration = null;\n }\n if (session.dragging || !commit) hideHandle();\n };\n\n const beginDragSession = (session: DragSession, event: MouseEvent) => {\n session.dragging = true;\n session.preview = createDragPreview(session.sourceBlock);\n session.sourceBlock.classList.add(\"notion-block--dragging\");\n document.documentElement.classList.add(\"notion-editor-is-dragging\");\n positionDragPreview(session, event.clientX, event.clientY);\n updateDropLine(\n session,\n findAnyDropTarget(session, event.clientX, event.clientY),\n );\n };\n\n function handleDocumentMouseMove(event: MouseEvent) {\n if (!dragSession) return;\n event.preventDefault();\n\n const movedEnough =\n Math.hypot(\n event.clientX - dragSession.startX,\n event.clientY - dragSession.startY,\n ) > 4;\n\n if (!dragSession.dragging && movedEnough) {\n beginDragSession(dragSession, event);\n }\n\n if (!dragSession.dragging) return;\n\n positionDragPreview(dragSession, event.clientX, event.clientY);\n updateDropLine(\n dragSession,\n findAnyDropTarget(dragSession, event.clientX, event.clientY),\n );\n }\n\n function handleDocumentMouseUp(event: MouseEvent) {\n event.preventDefault();\n finishDragSession(true, event);\n }\n\n function handleDocumentKeyDown(event: KeyboardEvent) {\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n finishDragSession(false);\n }\n\n return [\n new Plugin({\n key: dragHandleKey,\n view(editorView) {\n const registration: DragHandleRegistration = {\n view: editorView,\n wrapperSelector,\n getDragTransferData,\n receiveDragTransferData,\n handleDrop,\n canHover: () =>\n !!handle && !menu && !dragSession && editor.isEditable,\n findHoverBlock: (clientX, clientY) =>\n findForgivingBlock(editorView, clientX, clientY),\n showHoverBlock: (block) => showHandleForBlock(editorView, block),\n hideHover: () => hideHandle(),\n gripRect: () =>\n handle && handle.style.display !== \"none\"\n ? handle.getBoundingClientRect()\n : null,\n };\n currentRegistration = registration;\n dragHandleRegistrations.add(registration);\n retainGlobalHoverListener();\n handle = createHandle();\n const wrapper = editorView.dom.closest(wrapperSelector);\n if (wrapper) {\n (wrapper as HTMLElement).style.position = \"relative\";\n wrapper.appendChild(handle);\n }\n\n handle.addEventListener(\"mousedown\", (e) => {\n e.stopPropagation();\n if (e.button !== 0) return;\n closeMenu();\n if (!editor.isEditable) {\n e.preventDefault();\n return;\n }\n\n if (!currentBlock || dragStartPos === null) return;\n\n const sourceNode = editorView.state.doc.nodeAt(dragStartPos);\n if (!sourceNode) return;\n\n e.preventDefault();\n dragSession = {\n view: editorView,\n sourceBlock: currentBlock,\n sourcePos: dragStartPos,\n sourceNodeSize: sourceNode.nodeSize,\n startX: e.clientX,\n startY: e.clientY,\n dragging: false,\n preview: null,\n dropLine: null,\n dropTarget: null,\n };\n activeDragRegistration = registration;\n\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"keydown\", handleDocumentKeyDown);\n });\n\n handle.addEventListener(\"keydown\", (e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n e.stopPropagation();\n closeMenu();\n if (!editor.isEditable || !currentBlock || dragStartPos === null) {\n return;\n }\n\n const sourceNode = editorView.state.doc.nodeAt(dragStartPos);\n if (!sourceNode) return;\n\n openMenu(\n {\n view: editorView,\n sourceBlock: currentBlock,\n sourcePos: dragStartPos,\n sourceNodeSize: sourceNode.nodeSize,\n },\n handle?.getBoundingClientRect() ??\n currentBlock.getBoundingClientRect(),\n );\n });\n\n return {\n destroy() {\n closeMenu({ hideGrip: true });\n finishDragSession(false);\n releaseGlobalHoverListener();\n dragHandleRegistrations.delete(registration);\n if (activeDragRegistration === registration) {\n activeDragRegistration = null;\n }\n if (activeHoverRegistration === registration) {\n activeHoverRegistration = null;\n }\n handle?.remove();\n handle = null;\n currentRegistration = null;\n },\n };\n },\n props: {\n handleDOMEvents: {\n mousemove(_view, event) {\n updateRegisteredHover(event.clientX, event.clientY);\n return false;\n },\n drop() {\n closeMenu({ hideGrip: true });\n finishDragSession(false);\n hideHandle();\n return false;\n },\n },\n },\n }),\n ];\n },\n});\n"]}
@@ -1,63 +0,0 @@
1
- import { type ImageOptions } from "@tiptap/extension-image";
2
- import type { EditorView } from "@tiptap/pm/view";
3
- /**
4
- * The injectable async upload contract for the shared image block.
5
- *
6
- * An app provides this to turn a picked / pasted / dropped {@link File} into a
7
- * hosted image. It returns the final `src` (a hosted URL) plus an optional
8
- * `alt`. Plans wire it to the framework `upload-image` action; Content keeps its
9
- * own richer image block and does not use this contract.
10
- *
11
- * When NO upload function is supplied, the shared block still renders images and
12
- * round-trips `![alt](src)` markdown — it just cannot ingest local files (paste
13
- * of an image URL / markdown still works via the base node's input rules).
14
- */
15
- export type ImageUploadFn = (file: File) => Promise<{
16
- src: string;
17
- alt?: string;
18
- }>;
19
- export interface SharedImageOptions extends ImageOptions {
20
- /**
21
- * App-injected uploader. When present, the shared block accepts pasted /
22
- * dropped image files and the `/image` slash command, uploading each file
23
- * through this function and patching the node's `src` on resolve.
24
- */
25
- onImageUpload?: ImageUploadFn | null;
26
- }
27
- /**
28
- * The SHARED block-level image node. Built on `@tiptap/extension-image` (a
29
- * node named `image`), so:
30
- *
31
- * - **GFM serialization** emits pure `![alt](src)` markdown via a block-aware
32
- * `addStorage().markdown.serialize` (it calls `closeBlock` so a block image
33
- * keeps its blank-line separator, byte-stable). It emits NO `<img width>`
34
- * HTML, so plans stay source-syncable under the GFM `html:false` contract.
35
- * - **Paste / drop** of local image files is handled by a self-contained
36
- * ProseMirror plugin that calls the injected {@link ImageUploadFn}. Pasting
37
- * an image URL or `![](url)` markdown works through the base node's input
38
- * rules even when no uploader is supplied.
39
- *
40
- * The node adds one transient `uploadId` attribute (never parsed/rendered to
41
- * HTML, never serialized to markdown) used to track an in-flight upload.
42
- *
43
- * Content keeps its own richer `ImageNode` (Assets picker, AI alt-text, resize,
44
- * NFM `{color}` serialization) and does NOT use this shared node — both nodes
45
- * are named `image` but never coexist in the same editor because Content leaves
46
- * `features.image` off and injects its own via `extraExtensions`.
47
- */
48
- export declare const SharedImage: import("@tiptap/core").Node<SharedImageOptions, any>;
49
- /**
50
- * Build the shared image extension, optionally wired with an app uploader.
51
- *
52
- * @example
53
- * createImageExtension({ onImageUpload: uploadEditorImage })
54
- */
55
- export declare function createImageExtension(options?: {
56
- onImageUpload?: ImageUploadFn | null;
57
- }): import("@tiptap/core").Node<SharedImageOptions, any>;
58
- /**
59
- * Open a native file picker, then upload + insert the chosen image(s) through
60
- * the same flow as paste/drop. Used by the `/image` slash command.
61
- */
62
- export declare function pickAndInsertImage(view: EditorView, upload: ImageUploadFn): void;
63
- //# sourceMappingURL=ImageExtension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImageExtension.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/ImageExtension.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,IAAI,EAAE,IAAI,KACP,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5C,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC;AAoHD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,sDAqGtB,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE;IAAE,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;CAAO,wDAMvD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,GACpB,IAAI,CAgBN"}
@@ -1,243 +0,0 @@
1
- import Image from "@tiptap/extension-image";
2
- import { Plugin, PluginKey } from "@tiptap/pm/state";
3
- const sharedImageUploadPluginKey = new PluginKey("an-shared-image-upload");
4
- /** A monotonically increasing id so concurrent uploads patch the right node. */
5
- let uploadCounter = 0;
6
- function nextUploadId() {
7
- uploadCounter += 1;
8
- return `an-img-${Date.now()}-${uploadCounter}`;
9
- }
10
- /** Image files only — never ingest non-image clipboard/drop payloads. */
11
- function imageFilesFrom(data) {
12
- if (!data)
13
- return [];
14
- return Array.from(data.files ?? []).filter((file) => file.type.startsWith("image/"));
15
- }
16
- /**
17
- * Insert a placeholder `image` node (empty `src`, transient `uploadId`) at
18
- * `pos` for every file, then resolve each upload and patch the matching node's
19
- * `src`. Mirrors Content's optimistic upload flow but is self-contained in the
20
- * shared extension so it works for ANY editor wrapper (the plan's
21
- * `SharedRichEditor` and Content's hand-rolled `useEditor` alike) without a new
22
- * `editorProps` seam.
23
- */
24
- function uploadAndInsertImages(view, files, pos, upload) {
25
- if (files.length === 0)
26
- return;
27
- const pending = [];
28
- // Insert all placeholders first, top-down from `pos`, so multi-file
29
- // paste/drop keeps source order.
30
- let insertAt = pos;
31
- for (const file of files) {
32
- const uploadId = nextUploadId();
33
- const node = view.state.schema.nodes.image?.create({
34
- src: "",
35
- alt: "",
36
- uploadId,
37
- });
38
- if (!node)
39
- continue;
40
- const tr = view.state.tr.insert(insertAt, node);
41
- view.dispatch(tr);
42
- pending.push({ uploadId, file });
43
- // Advance past the inserted atom for the next placeholder.
44
- insertAt += node.nodeSize;
45
- }
46
- for (const item of pending) {
47
- void (async () => {
48
- try {
49
- const { src, alt } = await upload(item.file);
50
- if (!view.dom.isConnected || view.isDestroyed)
51
- return;
52
- patchUploadNode(view, item.uploadId, { src, alt: alt ?? "" });
53
- }
54
- catch (error) {
55
- console.error("Image upload failed:", error);
56
- // Drop the placeholder so a failed upload does not leave an empty box.
57
- if (view.dom.isConnected && !view.isDestroyed) {
58
- removeUploadNode(view, item.uploadId);
59
- }
60
- }
61
- })();
62
- }
63
- }
64
- /** Find a placeholder node by its transient `uploadId` and return its position. */
65
- function findUploadNode(view, uploadId) {
66
- let found = null;
67
- view.state.doc.descendants((node, pos) => {
68
- if (found)
69
- return false;
70
- if (node.type.name === "image" && node.attrs.uploadId === uploadId) {
71
- found = { pos, nodeSize: node.nodeSize };
72
- return false;
73
- }
74
- return true;
75
- });
76
- return found;
77
- }
78
- /** Patch the resolved `src`/`alt` onto the placeholder and clear `uploadId`. */
79
- function patchUploadNode(view, uploadId, attrs) {
80
- const target = findUploadNode(view, uploadId);
81
- if (!target)
82
- return;
83
- const node = view.state.doc.nodeAt(target.pos);
84
- if (!node)
85
- return;
86
- const tr = view.state.tr.setNodeMarkup(target.pos, undefined, {
87
- ...node.attrs,
88
- src: attrs.src,
89
- alt: attrs.alt,
90
- uploadId: null,
91
- });
92
- view.dispatch(tr);
93
- }
94
- /** Remove a placeholder whose upload failed. */
95
- function removeUploadNode(view, uploadId) {
96
- const target = findUploadNode(view, uploadId);
97
- if (!target)
98
- return;
99
- const tr = view.state.tr.delete(target.pos, target.pos + target.nodeSize);
100
- view.dispatch(tr);
101
- }
102
- /**
103
- * The SHARED block-level image node. Built on `@tiptap/extension-image` (a
104
- * node named `image`), so:
105
- *
106
- * - **GFM serialization** emits pure `![alt](src)` markdown via a block-aware
107
- * `addStorage().markdown.serialize` (it calls `closeBlock` so a block image
108
- * keeps its blank-line separator, byte-stable). It emits NO `<img width>`
109
- * HTML, so plans stay source-syncable under the GFM `html:false` contract.
110
- * - **Paste / drop** of local image files is handled by a self-contained
111
- * ProseMirror plugin that calls the injected {@link ImageUploadFn}. Pasting
112
- * an image URL or `![](url)` markdown works through the base node's input
113
- * rules even when no uploader is supplied.
114
- *
115
- * The node adds one transient `uploadId` attribute (never parsed/rendered to
116
- * HTML, never serialized to markdown) used to track an in-flight upload.
117
- *
118
- * Content keeps its own richer `ImageNode` (Assets picker, AI alt-text, resize,
119
- * NFM `{color}` serialization) and does NOT use this shared node — both nodes
120
- * are named `image` but never coexist in the same editor because Content leaves
121
- * `features.image` off and injects its own via `extraExtensions`.
122
- */
123
- export const SharedImage = Image.extend({
124
- // Block-level atom (Content's image is also a block atom). The base extension
125
- // is block when `inline:false`.
126
- inline: false,
127
- group: "block",
128
- addOptions() {
129
- return {
130
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
131
- ...this.parent(),
132
- onImageUpload: null,
133
- };
134
- },
135
- addAttributes() {
136
- return {
137
- ...this.parent?.(),
138
- // Transient: marks an in-flight upload so the plugin can patch `src` on
139
- // resolve. Never written to HTML or markdown.
140
- uploadId: {
141
- default: null,
142
- parseHTML: () => null,
143
- renderHTML: () => ({}),
144
- },
145
- };
146
- },
147
- addStorage() {
148
- return {
149
- ...this.parent?.(),
150
- // A BLOCK-aware markdown serializer. tiptap-markdown's built-in fallback
151
- // for the `image` node is prosemirror-markdown's INLINE image serializer,
152
- // which omits the trailing block separator — so an image immediately
153
- // followed by a paragraph loses its blank line on round-trip. This
154
- // node-level spec (merged OVER the fallback by tiptap-markdown's
155
- // `getMarkdownSpec`) emits the same pure `![alt](src)` markdown but calls
156
- // `closeBlock`, so a block image stays byte-stable and source-syncable.
157
- // No `<img width>` / HTML is emitted, so the GFM `html:false` contract and
158
- // the plan round-trip corpus are preserved.
159
- markdown: {
160
- serialize(state, node) {
161
- const src = node.attrs.src ?? "";
162
- const alt = node.attrs.alt ?? "";
163
- const title = node.attrs.title ?? "";
164
- const titleSuffix = title ? ` "${title.replace(/"/g, '\\"')}"` : "";
165
- state.write(`![${state.esc(alt)}](${state.esc(src)}${titleSuffix})`);
166
- state.closeBlock(node);
167
- },
168
- parse: {
169
- // Parsing `![alt](src)` is handled by markdown-it + the base node's
170
- // markdown input rule.
171
- },
172
- },
173
- };
174
- },
175
- addProseMirrorPlugins() {
176
- const upload = this.options.onImageUpload;
177
- const parentPlugins = this.parent?.() ?? [];
178
- if (!upload)
179
- return parentPlugins;
180
- return [
181
- ...parentPlugins,
182
- new Plugin({
183
- key: sharedImageUploadPluginKey,
184
- props: {
185
- handlePaste(view, event) {
186
- const files = imageFilesFrom(event.clipboardData);
187
- if (files.length === 0)
188
- return false;
189
- event.preventDefault();
190
- uploadAndInsertImages(view, files, view.state.selection.from, upload);
191
- return true;
192
- },
193
- handleDrop(view, event) {
194
- const files = imageFilesFrom(event.dataTransfer);
195
- if (files.length === 0)
196
- return false;
197
- event.preventDefault();
198
- const coords = view.posAtCoords({
199
- left: event.clientX,
200
- top: event.clientY,
201
- });
202
- const pos = coords?.pos ?? view.state.selection.from;
203
- uploadAndInsertImages(view, files, pos, upload);
204
- return true;
205
- },
206
- },
207
- }),
208
- ];
209
- },
210
- });
211
- /**
212
- * Build the shared image extension, optionally wired with an app uploader.
213
- *
214
- * @example
215
- * createImageExtension({ onImageUpload: uploadEditorImage })
216
- */
217
- export function createImageExtension(options = {}) {
218
- return SharedImage.configure({
219
- onImageUpload: options.onImageUpload ?? null,
220
- HTMLAttributes: { class: "an-rich-md-image" },
221
- });
222
- }
223
- /**
224
- * Open a native file picker, then upload + insert the chosen image(s) through
225
- * the same flow as paste/drop. Used by the `/image` slash command.
226
- */
227
- export function pickAndInsertImage(view, upload) {
228
- const input = document.createElement("input");
229
- input.type = "file";
230
- input.accept = "image/*";
231
- input.multiple = true;
232
- input.style.display = "none";
233
- input.addEventListener("change", () => {
234
- const files = Array.from(input.files ?? []).filter((file) => file.type.startsWith("image/"));
235
- input.remove();
236
- if (files.length === 0)
237
- return;
238
- uploadAndInsertImages(view, files, view.state.selection.from, upload);
239
- });
240
- document.body.appendChild(input);
241
- input.click();
242
- }
243
- //# sourceMappingURL=ImageExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImageExtension.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/ImageExtension.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA4BrD,MAAM,0BAA0B,GAAG,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAE3E,gFAAgF;AAChF,IAAI,aAAa,GAAG,CAAC,CAAC;AACtB,SAAS,YAAY;IACnB,aAAa,IAAI,CAAC,CAAC;IACnB,OAAO,UAAU,IAAI,CAAC,GAAG,EAAE,IAAI,aAAa,EAAE,CAAC;AACjD,CAAC;AAED,yEAAyE;AACzE,SAAS,cAAc,CAAC,IAAqC;IAC3D,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAClD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAC5B,IAAgB,EAChB,KAAa,EACb,GAAW,EACX,MAAqB;IAErB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAE/B,MAAM,OAAO,GAA4C,EAAE,CAAC;IAE5D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AAC,QAAQ,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC/B,CAAC;QACF,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC/B,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC","sourcesContent":["import Image, { type ImageOptions } from \"@tiptap/extension-image\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport type { EditorView } from \"@tiptap/pm/view\";\n\n/**\n * The injectable async upload contract for the shared image block.\n *\n * An app provides this to turn a picked / pasted / dropped {@link File} into a\n * hosted image. It returns the final `src` (a hosted URL) plus an optional\n * `alt`. Plans wire it to the framework `upload-image` action; Content keeps its\n * own richer image block and does not use this contract.\n *\n * When NO upload function is supplied, the shared block still renders images and\n * round-trips `![alt](src)` markdown — it just cannot ingest local files (paste\n * of an image URL / markdown still works via the base node's input rules).\n */\nexport type ImageUploadFn = (\n file: File,\n) => Promise<{ src: string; alt?: string }>;\n\nexport interface SharedImageOptions extends ImageOptions {\n /**\n * App-injected uploader. When present, the shared block accepts pasted /\n * dropped image files and the `/image` slash command, uploading each file\n * through this function and patching the node's `src` on resolve.\n */\n onImageUpload?: ImageUploadFn | null;\n}\n\nconst sharedImageUploadPluginKey = new PluginKey(\"an-shared-image-upload\");\n\n/** A monotonically increasing id so concurrent uploads patch the right node. */\nlet uploadCounter = 0;\nfunction nextUploadId(): string {\n uploadCounter += 1;\n return `an-img-${Date.now()}-${uploadCounter}`;\n}\n\n/** Image files only — never ingest non-image clipboard/drop payloads. */\nfunction imageFilesFrom(data: DataTransfer | null | undefined): File[] {\n if (!data) return [];\n return Array.from(data.files ?? []).filter((file) =>\n file.type.startsWith(\"image/\"),\n );\n}\n\n/**\n * Insert a placeholder `image` node (empty `src`, transient `uploadId`) at\n * `pos` for every file, then resolve each upload and patch the matching node's\n * `src`. Mirrors Content's optimistic upload flow but is self-contained in the\n * shared extension so it works for ANY editor wrapper (the plan's\n * `SharedRichEditor` and Content's hand-rolled `useEditor` alike) without a new\n * `editorProps` seam.\n */\nfunction uploadAndInsertImages(\n view: EditorView,\n files: File[],\n pos: number,\n upload: ImageUploadFn,\n): void {\n if (files.length === 0) return;\n\n const pending: Array<{ uploadId: string; file: File }> = [];\n\n // Insert all placeholders first, top-down from `pos`, so multi-file\n // paste/drop keeps source order.\n let insertAt = pos;\n for (const file of files) {\n const uploadId = nextUploadId();\n const node = view.state.schema.nodes.image?.create({\n src: \"\",\n alt: \"\",\n uploadId,\n });\n if (!node) continue;\n const tr = view.state.tr.insert(insertAt, node);\n view.dispatch(tr);\n pending.push({ uploadId, file });\n // Advance past the inserted atom for the next placeholder.\n insertAt += node.nodeSize;\n }\n\n for (const item of pending) {\n void (async () => {\n try {\n const { src, alt } = await upload(item.file);\n if (!view.dom.isConnected || view.isDestroyed) return;\n patchUploadNode(view, item.uploadId, { src, alt: alt ?? \"\" });\n } catch (error) {\n console.error(\"Image upload failed:\", error);\n // Drop the placeholder so a failed upload does not leave an empty box.\n if (view.dom.isConnected && !view.isDestroyed) {\n removeUploadNode(view, item.uploadId);\n }\n }\n })();\n }\n}\n\n/** Find a placeholder node by its transient `uploadId` and return its position. */\nfunction findUploadNode(\n view: EditorView,\n uploadId: string,\n): { pos: number; nodeSize: number } | null {\n let found: { pos: number; nodeSize: number } | null = null;\n view.state.doc.descendants((node, pos) => {\n if (found) return false;\n if (node.type.name === \"image\" && node.attrs.uploadId === uploadId) {\n found = { pos, nodeSize: node.nodeSize };\n return false;\n }\n return true;\n });\n return found;\n}\n\n/** Patch the resolved `src`/`alt` onto the placeholder and clear `uploadId`. */\nfunction patchUploadNode(\n view: EditorView,\n uploadId: string,\n attrs: { src: string; alt: string },\n): void {\n const target = findUploadNode(view, uploadId);\n if (!target) return;\n const node = view.state.doc.nodeAt(target.pos);\n if (!node) return;\n const tr = view.state.tr.setNodeMarkup(target.pos, undefined, {\n ...node.attrs,\n src: attrs.src,\n alt: attrs.alt,\n uploadId: null,\n });\n view.dispatch(tr);\n}\n\n/** Remove a placeholder whose upload failed. */\nfunction removeUploadNode(view: EditorView, uploadId: string): void {\n const target = findUploadNode(view, uploadId);\n if (!target) return;\n const tr = view.state.tr.delete(target.pos, target.pos + target.nodeSize);\n view.dispatch(tr);\n}\n\n/**\n * The SHARED block-level image node. Built on `@tiptap/extension-image` (a\n * node named `image`), so:\n *\n * - **GFM serialization** emits pure `![alt](src)` markdown via a block-aware\n * `addStorage().markdown.serialize` (it calls `closeBlock` so a block image\n * keeps its blank-line separator, byte-stable). It emits NO `<img width>`\n * HTML, so plans stay source-syncable under the GFM `html:false` contract.\n * - **Paste / drop** of local image files is handled by a self-contained\n * ProseMirror plugin that calls the injected {@link ImageUploadFn}. Pasting\n * an image URL or `![](url)` markdown works through the base node's input\n * rules even when no uploader is supplied.\n *\n * The node adds one transient `uploadId` attribute (never parsed/rendered to\n * HTML, never serialized to markdown) used to track an in-flight upload.\n *\n * Content keeps its own richer `ImageNode` (Assets picker, AI alt-text, resize,\n * NFM `{color}` serialization) and does NOT use this shared node — both nodes\n * are named `image` but never coexist in the same editor because Content leaves\n * `features.image` off and injects its own via `extraExtensions`.\n */\nexport const SharedImage = Image.extend<SharedImageOptions>({\n // Block-level atom (Content's image is also a block atom). The base extension\n // is block when `inline:false`.\n inline: false,\n group: \"block\",\n\n addOptions() {\n return {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n ...this.parent!(),\n onImageUpload: null,\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n // Transient: marks an in-flight upload so the plugin can patch `src` on\n // resolve. Never written to HTML or markdown.\n uploadId: {\n default: null,\n parseHTML: () => null,\n renderHTML: () => ({}),\n },\n };\n },\n\n addStorage() {\n return {\n ...this.parent?.(),\n // A BLOCK-aware markdown serializer. tiptap-markdown's built-in fallback\n // for the `image` node is prosemirror-markdown's INLINE image serializer,\n // which omits the trailing block separator — so an image immediately\n // followed by a paragraph loses its blank line on round-trip. This\n // node-level spec (merged OVER the fallback by tiptap-markdown's\n // `getMarkdownSpec`) emits the same pure `![alt](src)` markdown but calls\n // `closeBlock`, so a block image stays byte-stable and source-syncable.\n // No `<img width>` / HTML is emitted, so the GFM `html:false` contract and\n // the plan round-trip corpus are preserved.\n markdown: {\n serialize(\n state: {\n esc: (s: string) => string;\n write: (s: string) => void;\n closeBlock: (n: unknown) => void;\n },\n node: { attrs: { src?: string; alt?: string; title?: string } },\n ) {\n const src = node.attrs.src ?? \"\";\n const alt = node.attrs.alt ?? \"\";\n const title = node.attrs.title ?? \"\";\n const titleSuffix = title ? ` \"${title.replace(/\"/g, '\\\\\"')}\"` : \"\";\n state.write(`![${state.esc(alt)}](${state.esc(src)}${titleSuffix})`);\n state.closeBlock(node);\n },\n parse: {\n // Parsing `![alt](src)` is handled by markdown-it + the base node's\n // markdown input rule.\n },\n },\n };\n },\n\n addProseMirrorPlugins() {\n const upload = this.options.onImageUpload;\n const parentPlugins = this.parent?.() ?? [];\n if (!upload) return parentPlugins;\n\n return [\n ...parentPlugins,\n new Plugin({\n key: sharedImageUploadPluginKey,\n props: {\n handlePaste(view, event) {\n const files = imageFilesFrom(event.clipboardData);\n if (files.length === 0) return false;\n event.preventDefault();\n uploadAndInsertImages(\n view,\n files,\n view.state.selection.from,\n upload,\n );\n return true;\n },\n handleDrop(view, event) {\n const files = imageFilesFrom(event.dataTransfer);\n if (files.length === 0) return false;\n event.preventDefault();\n const coords = view.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n const pos = coords?.pos ?? view.state.selection.from;\n uploadAndInsertImages(view, files, pos, upload);\n return true;\n },\n },\n }),\n ];\n },\n});\n\n/**\n * Build the shared image extension, optionally wired with an app uploader.\n *\n * @example\n * createImageExtension({ onImageUpload: uploadEditorImage })\n */\nexport function createImageExtension(\n options: { onImageUpload?: ImageUploadFn | null } = {},\n) {\n return SharedImage.configure({\n onImageUpload: options.onImageUpload ?? null,\n HTMLAttributes: { class: \"an-rich-md-image\" },\n });\n}\n\n/**\n * Open a native file picker, then upload + insert the chosen image(s) through\n * the same flow as paste/drop. Used by the `/image` slash command.\n */\nexport function pickAndInsertImage(\n view: EditorView,\n upload: ImageUploadFn,\n): void {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n input.accept = \"image/*\";\n input.multiple = true;\n input.style.display = \"none\";\n input.addEventListener(\"change\", () => {\n const files = Array.from(input.files ?? []).filter((file) =>\n file.type.startsWith(\"image/\"),\n );\n input.remove();\n if (files.length === 0) return;\n uploadAndInsertImages(view, files, view.state.selection.from, upload);\n });\n document.body.appendChild(input);\n input.click();\n}\n"]}
@@ -1,51 +0,0 @@
1
- import type { Awareness } from "y-protocols/awareness";
2
- import type { Doc as YDoc } from "yjs";
3
- /**
4
- * Back-compat surface for the shared rich markdown editor.
5
- *
6
- * The editor core now lives in dedicated modules:
7
- * - {@link createSharedEditorExtensions} — the ONE extension factory.
8
- * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
9
- * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
10
- * - {@link SharedRichEditor} — the editor component.
11
- *
12
- * This file keeps the historical `RichMarkdownEditor` component name (aliased to
13
- * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
14
- * existing embedders and the round-trip / collab specs keep working unchanged.
15
- */
16
- import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser } from "./extensions.js";
17
- import { SharedRichEditor, type SharedRichEditorProps } from "./SharedRichEditor.js";
18
- export type { RichMarkdownDialect, RichMarkdownEditorPreset, RichMarkdownCollabUser, };
19
- /** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */
20
- export interface CreateRichMarkdownExtensionsOptions {
21
- dialect?: RichMarkdownDialect;
22
- placeholder?: string;
23
- /**
24
- * Yjs document for collaborative editing. When present, the editor binds the
25
- * shared Collaboration + CollaborationCaret extensions and StarterKit's
26
- * built-in undo/redo is disabled (Yjs owns history).
27
- */
28
- ydoc?: YDoc | null;
29
- /** Shared awareness instance for live multi-user cursors. */
30
- awareness?: Awareness | null;
31
- /** Current user info for the collaborative cursor label. */
32
- user?: RichMarkdownCollabUser | null;
33
- }
34
- /**
35
- * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
36
- * in terms of {@link createSharedEditorExtensions}: it maps the flat
37
- * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
38
- * shared factory expects. The round-trip and collab specs build their `Editor`
39
- * from this, so its output must stay byte-stable.
40
- */
41
- export declare function createRichMarkdownExtensions({ dialect, placeholder, ydoc, awareness, user, }?: CreateRichMarkdownExtensionsOptions): (import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Node<any, any>)[];
42
- /** @deprecated Prefer {@link SharedRichEditorProps}. */
43
- export type RichMarkdownEditorProps = SharedRichEditorProps;
44
- /**
45
- * Historical name for {@link SharedRichEditor}. Kept so existing imports
46
- * (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
47
- * plan editor tests (which assert the source mentions `RichMarkdownEditor`)
48
- * keep working. New code should import `SharedRichEditor`.
49
- */
50
- export declare const RichMarkdownEditor: typeof SharedRichEditor;
51
- //# sourceMappingURL=RichMarkdownEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichMarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RichMarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,CAAC;AAEF,sEAAsE;AACtE,MAAM,WAAW,mCAAmC;IAClD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,OAAe,EACf,WAAwC,EACxC,IAAW,EACX,SAAgB,EAChB,IAAW,GACZ,GAAE,mCAAwC,kIAM1C;AAED,wDAAwD;AACxD,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}