@agent-native/core 0.110.2 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +17 -0
  3. package/corpus/core/docs/content/components.mdx +7 -0
  4. package/corpus/core/docs/content/locales/ar-SA/components.mdx +4 -2
  5. package/corpus/core/docs/content/locales/de-DE/components.mdx +4 -2
  6. package/corpus/core/docs/content/locales/es-ES/components.mdx +4 -2
  7. package/corpus/core/docs/content/locales/fr-FR/components.mdx +4 -2
  8. package/corpus/core/docs/content/locales/hi-IN/components.mdx +3 -2
  9. package/corpus/core/docs/content/locales/ja-JP/components.mdx +3 -2
  10. package/corpus/core/docs/content/locales/ko-KR/components.mdx +3 -2
  11. package/corpus/core/docs/content/locales/pt-BR/components.mdx +4 -2
  12. package/corpus/core/docs/content/locales/zh-CN/components.mdx +3 -2
  13. package/corpus/core/docs/content/locales/zh-TW/components.mdx +3 -2
  14. package/corpus/core/docs/content/toolkit-agent-ux.mdx +8 -3
  15. package/corpus/core/migration-manifest.json +133 -269
  16. package/corpus/core/package.json +32 -33
  17. package/corpus/core/scripts/check-dist-imports.mjs +25 -1
  18. package/corpus/core/scripts/finalize-build.mjs +59 -2
  19. package/corpus/core/src/client/AgentAskPopover.tsx +1 -1
  20. package/corpus/core/src/client/AgentPanel.tsx +1 -1
  21. package/corpus/core/src/client/AssistantChat.tsx +12 -14
  22. package/corpus/core/src/client/NewWorkspaceAppFlow.tsx +1 -1
  23. package/corpus/core/src/client/agent-chat-adapter.ts +1 -1
  24. package/corpus/core/src/client/blocks/RegistryBlockDataProvider.tsx +121 -0
  25. package/corpus/core/src/client/blocks/index.ts +6 -0
  26. package/corpus/core/src/client/chat/attachment-adapters.ts +4 -5
  27. package/corpus/core/src/client/chat/index.ts +0 -1
  28. package/corpus/core/src/client/chat/message-components.tsx +2 -2
  29. package/corpus/core/src/client/code-agent-chat-adapter.ts +2 -2
  30. package/corpus/core/src/client/collab/index.ts +0 -22
  31. package/corpus/core/src/client/composer/index.ts +5 -66
  32. package/corpus/core/src/client/composer/runtime-adapters.tsx +123 -0
  33. package/corpus/core/src/client/composer/use-mention-search.ts +2 -79
  34. package/corpus/core/src/client/composer/wired-components.tsx +53 -0
  35. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +1 -1
  36. package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +1 -1
  37. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +1 -1
  38. package/corpus/core/src/client/index.ts +0 -156
  39. package/corpus/core/src/client/resources/ResourceEditor.tsx +29 -681
  40. package/corpus/core/src/client/resources/ResourcesPanel.tsx +1 -1
  41. package/corpus/core/src/client/settings/AutomationsSection.tsx +1 -1
  42. package/corpus/core/src/client/sharing/index.ts +0 -4
  43. package/corpus/core/src/client/tombstone/agent-presence-chip.ts +17 -0
  44. package/corpus/core/src/client/tombstone/editor.ts +265 -0
  45. package/corpus/core/src/client/tombstone/live-cursor-overlay.ts +21 -0
  46. package/corpus/core/src/client/tombstone/presence-bar.ts +17 -0
  47. package/corpus/core/src/client/tombstone/recent-edit-highlights.ts +17 -0
  48. package/corpus/core/src/client/tombstone/remote-selection-rings.ts +21 -0
  49. package/corpus/core/src/client/tombstone/rich-markdown-editor.ts +265 -0
  50. package/corpus/core/src/client/tombstone/ui-dialog.ts +49 -0
  51. package/corpus/core/src/client/tombstone/ui-dropdown-menu.ts +69 -0
  52. package/corpus/core/src/client/tombstone/ui-hover-card.ts +21 -0
  53. package/corpus/core/src/client/tombstone/ui-popover.ts +25 -0
  54. package/corpus/core/src/client/tombstone/ui-sheet.ts +49 -0
  55. package/corpus/core/src/client/tombstone/ui-tooltip.ts +29 -0
  56. package/corpus/core/src/client/tombstone/visual-style-controls.ts +61 -0
  57. package/corpus/core/src/client/uploads/index.ts +5 -0
  58. package/corpus/core/src/client/{rich-markdown-editor/uploadEditorImage.ts → uploads/upload-editor-image.ts} +11 -4
  59. package/corpus/core/src/package-lifecycle/tombstone.ts +16 -2
  60. package/corpus/core/src/package-lifecycle/upgrade-error.ts +23 -5
  61. package/corpus/core/src/testing.ts +1 -4
  62. package/corpus/core/src/vite/client.ts +62 -22
  63. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +2 -4
  64. package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +1 -1
  65. package/corpus/templates/content/app/components/editor/registrySlashItems.ts +53 -52
  66. package/corpus/templates/plan/app/components/editor/PlanBlockNode.tsx +2 -2
  67. package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +1 -1
  68. package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +1 -1
  69. package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +1 -1
  70. package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +1 -1
  71. package/dist/catalog.json +1 -0
  72. package/dist/client/AgentAskPopover.js +1 -1
  73. package/dist/client/AgentAskPopover.js.map +1 -1
  74. package/dist/client/AgentPanel.js +1 -1
  75. package/dist/client/AgentPanel.js.map +1 -1
  76. package/dist/client/AssistantChat.d.ts +2 -2
  77. package/dist/client/AssistantChat.d.ts.map +1 -1
  78. package/dist/client/AssistantChat.js +5 -6
  79. package/dist/client/AssistantChat.js.map +1 -1
  80. package/dist/client/NewWorkspaceAppFlow.js +1 -1
  81. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  82. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  83. package/dist/client/agent-chat-adapter.js +1 -1
  84. package/dist/client/agent-chat-adapter.js.map +1 -1
  85. package/dist/client/blocks/RegistryBlockDataProvider.d.ts +7 -0
  86. package/dist/client/blocks/RegistryBlockDataProvider.d.ts.map +1 -0
  87. package/dist/client/blocks/RegistryBlockDataProvider.js +54 -0
  88. package/dist/client/blocks/RegistryBlockDataProvider.js.map +1 -0
  89. package/dist/client/blocks/index.d.ts +2 -0
  90. package/dist/client/blocks/index.d.ts.map +1 -1
  91. package/dist/client/blocks/index.js +1 -0
  92. package/dist/client/blocks/index.js.map +1 -1
  93. package/dist/client/chat/attachment-adapters.d.ts.map +1 -1
  94. package/dist/client/chat/attachment-adapters.js +1 -1
  95. package/dist/client/chat/attachment-adapters.js.map +1 -1
  96. package/dist/client/chat/index.d.ts +0 -1
  97. package/dist/client/chat/index.d.ts.map +1 -1
  98. package/dist/client/chat/index.js +0 -1
  99. package/dist/client/chat/index.js.map +1 -1
  100. package/dist/client/chat/message-components.d.ts.map +1 -1
  101. package/dist/client/chat/message-components.js +2 -2
  102. package/dist/client/chat/message-components.js.map +1 -1
  103. package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
  104. package/dist/client/code-agent-chat-adapter.js +1 -1
  105. package/dist/client/code-agent-chat-adapter.js.map +1 -1
  106. package/dist/client/collab/index.d.ts +0 -5
  107. package/dist/client/collab/index.d.ts.map +1 -1
  108. package/dist/client/collab/index.js +0 -5
  109. package/dist/client/collab/index.js.map +1 -1
  110. package/dist/client/composer/index.d.ts +3 -11
  111. package/dist/client/composer/index.d.ts.map +1 -1
  112. package/dist/client/composer/index.js +3 -10
  113. package/dist/client/composer/index.js.map +1 -1
  114. package/dist/client/composer/runtime-adapters.d.ts +5 -0
  115. package/dist/client/composer/runtime-adapters.d.ts.map +1 -0
  116. package/dist/client/composer/runtime-adapters.js +85 -0
  117. package/dist/client/composer/runtime-adapters.js.map +1 -0
  118. package/dist/client/composer/use-mention-search.d.ts +1 -2
  119. package/dist/client/composer/use-mention-search.d.ts.map +1 -1
  120. package/dist/client/composer/use-mention-search.js +2 -69
  121. package/dist/client/composer/use-mention-search.js.map +1 -1
  122. package/dist/client/composer/wired-components.d.ts +10 -0
  123. package/dist/client/composer/wired-components.d.ts.map +1 -0
  124. package/dist/client/composer/wired-components.js +20 -0
  125. package/dist/client/composer/wired-components.js.map +1 -0
  126. package/dist/client/extensions/ExtensionViewer.js +1 -1
  127. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  128. package/dist/client/extensions/ExtensionsListPage.js +1 -1
  129. package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
  130. package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
  131. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  132. package/dist/client/index.d.ts +0 -10
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +0 -26
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
  137. package/dist/client/resources/ResourceEditor.js +14 -532
  138. package/dist/client/resources/ResourceEditor.js.map +1 -1
  139. package/dist/client/resources/ResourcesPanel.js +1 -1
  140. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  141. package/dist/client/settings/AutomationsSection.js +1 -1
  142. package/dist/client/settings/AutomationsSection.js.map +1 -1
  143. package/dist/client/sharing/index.d.ts +0 -1
  144. package/dist/client/sharing/index.d.ts.map +1 -1
  145. package/dist/client/sharing/index.js +0 -1
  146. package/dist/client/sharing/index.js.map +1 -1
  147. package/dist/client/tombstone/agent-presence-chip.d.ts +6 -0
  148. package/dist/client/tombstone/agent-presence-chip.d.ts.map +1 -0
  149. package/dist/client/tombstone/agent-presence-chip.js +5 -0
  150. package/dist/client/tombstone/agent-presence-chip.js.map +1 -0
  151. package/dist/client/tombstone/editor.d.ts +128 -0
  152. package/dist/client/tombstone/editor.d.ts.map +1 -0
  153. package/dist/client/tombstone/editor.js +76 -0
  154. package/dist/client/tombstone/editor.js.map +1 -0
  155. package/dist/client/tombstone/live-cursor-overlay.d.ts +8 -0
  156. package/dist/client/tombstone/live-cursor-overlay.d.ts.map +1 -0
  157. package/dist/client/tombstone/live-cursor-overlay.js +5 -0
  158. package/dist/client/tombstone/live-cursor-overlay.js.map +1 -0
  159. package/dist/client/tombstone/presence-bar.d.ts +6 -0
  160. package/dist/client/tombstone/presence-bar.d.ts.map +1 -0
  161. package/dist/client/tombstone/presence-bar.js +5 -0
  162. package/dist/client/tombstone/presence-bar.js.map +1 -0
  163. package/dist/client/tombstone/recent-edit-highlights.d.ts +6 -0
  164. package/dist/client/tombstone/recent-edit-highlights.d.ts.map +1 -0
  165. package/dist/client/tombstone/recent-edit-highlights.js +5 -0
  166. package/dist/client/tombstone/recent-edit-highlights.js.map +1 -0
  167. package/dist/client/tombstone/remote-selection-rings.d.ts +8 -0
  168. package/dist/client/tombstone/remote-selection-rings.d.ts.map +1 -0
  169. package/dist/client/tombstone/remote-selection-rings.js +5 -0
  170. package/dist/client/tombstone/remote-selection-rings.js.map +1 -0
  171. package/dist/client/tombstone/rich-markdown-editor.d.ts +128 -0
  172. package/dist/client/tombstone/rich-markdown-editor.d.ts.map +1 -0
  173. package/dist/client/tombstone/rich-markdown-editor.js +76 -0
  174. package/dist/client/tombstone/rich-markdown-editor.js.map +1 -0
  175. package/dist/client/tombstone/ui-dialog.d.ts +22 -0
  176. package/dist/client/tombstone/ui-dialog.d.ts.map +1 -0
  177. package/dist/client/tombstone/ui-dialog.js +23 -0
  178. package/dist/client/tombstone/ui-dialog.js.map +1 -0
  179. package/dist/client/tombstone/ui-dropdown-menu.d.ts +32 -0
  180. package/dist/client/tombstone/ui-dropdown-menu.d.ts.map +1 -0
  181. package/dist/client/tombstone/ui-dropdown-menu.js +33 -0
  182. package/dist/client/tombstone/ui-dropdown-menu.js.map +1 -0
  183. package/dist/client/tombstone/ui-hover-card.d.ts +8 -0
  184. package/dist/client/tombstone/ui-hover-card.d.ts.map +1 -0
  185. package/dist/client/tombstone/ui-hover-card.js +9 -0
  186. package/dist/client/tombstone/ui-hover-card.js.map +1 -0
  187. package/dist/client/tombstone/ui-popover.d.ts +10 -0
  188. package/dist/client/tombstone/ui-popover.d.ts.map +1 -0
  189. package/dist/client/tombstone/ui-popover.js +11 -0
  190. package/dist/client/tombstone/ui-popover.js.map +1 -0
  191. package/dist/client/tombstone/ui-sheet.d.ts +22 -0
  192. package/dist/client/tombstone/ui-sheet.d.ts.map +1 -0
  193. package/dist/client/tombstone/ui-sheet.js +23 -0
  194. package/dist/client/tombstone/ui-sheet.js.map +1 -0
  195. package/dist/client/tombstone/ui-tooltip.d.ts +12 -0
  196. package/dist/client/tombstone/ui-tooltip.d.ts.map +1 -0
  197. package/dist/client/tombstone/ui-tooltip.js +13 -0
  198. package/dist/client/tombstone/ui-tooltip.js.map +1 -0
  199. package/dist/client/tombstone/visual-style-controls.d.ts +28 -0
  200. package/dist/client/tombstone/visual-style-controls.d.ts.map +1 -0
  201. package/dist/client/tombstone/visual-style-controls.js +23 -0
  202. package/dist/client/tombstone/visual-style-controls.js.map +1 -0
  203. package/dist/client/uploads/index.d.ts +1 -0
  204. package/dist/client/uploads/index.d.ts.map +1 -1
  205. package/dist/client/uploads/index.js +1 -0
  206. package/dist/client/uploads/index.js.map +1 -1
  207. package/dist/client/{rich-markdown-editor/uploadEditorImage.d.ts → uploads/upload-editor-image.d.ts} +8 -4
  208. package/dist/client/uploads/upload-editor-image.d.ts.map +1 -0
  209. package/dist/client/{rich-markdown-editor/uploadEditorImage.js → uploads/upload-editor-image.js} +2 -2
  210. package/dist/client/uploads/upload-editor-image.js.map +1 -0
  211. package/dist/collab/struct-routes.d.ts +1 -1
  212. package/dist/notifications/routes.d.ts +3 -3
  213. package/dist/package-lifecycle/tombstone.d.ts.map +1 -1
  214. package/dist/package-lifecycle/tombstone.js +13 -3
  215. package/dist/package-lifecycle/tombstone.js.map +1 -1
  216. package/dist/package-lifecycle/upgrade-error.d.ts +2 -2
  217. package/dist/package-lifecycle/upgrade-error.d.ts.map +1 -1
  218. package/dist/package-lifecycle/upgrade-error.js +8 -5
  219. package/dist/package-lifecycle/upgrade-error.js.map +1 -1
  220. package/dist/secrets/routes.d.ts +9 -9
  221. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  222. package/dist/server/transcribe-voice.d.ts +1 -1
  223. package/dist/testing.d.ts +1 -3
  224. package/dist/testing.d.ts.map +1 -1
  225. package/dist/testing.js +1 -3
  226. package/dist/testing.js.map +1 -1
  227. package/dist/vite/client.d.ts.map +1 -1
  228. package/dist/vite/client.js +26 -22
  229. package/dist/vite/client.js.map +1 -1
  230. package/docs/content/components.mdx +7 -0
  231. package/docs/content/locales/ar-SA/components.mdx +4 -2
  232. package/docs/content/locales/de-DE/components.mdx +4 -2
  233. package/docs/content/locales/es-ES/components.mdx +4 -2
  234. package/docs/content/locales/fr-FR/components.mdx +4 -2
  235. package/docs/content/locales/hi-IN/components.mdx +3 -2
  236. package/docs/content/locales/ja-JP/components.mdx +3 -2
  237. package/docs/content/locales/ko-KR/components.mdx +3 -2
  238. package/docs/content/locales/pt-BR/components.mdx +4 -2
  239. package/docs/content/locales/zh-CN/components.mdx +3 -2
  240. package/docs/content/locales/zh-TW/components.mdx +3 -2
  241. package/docs/content/toolkit-agent-ux.mdx +8 -3
  242. package/migration-manifest.json +133 -269
  243. package/package.json +31 -32
  244. package/corpus/core/src/client/composer/AgentComposerFrame.tsx +0 -59
  245. package/corpus/core/src/client/composer/ComposerPlusMenu.tsx +0 -988
  246. package/corpus/core/src/client/composer/MentionPopover.tsx +0 -412
  247. package/corpus/core/src/client/composer/PastedTextChip.tsx +0 -150
  248. package/corpus/core/src/client/composer/PromptComposer.tsx +0 -714
  249. package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +0 -860
  250. package/corpus/core/src/client/composer/TiptapComposer.tsx +0 -2928
  251. package/corpus/core/src/client/composer/VoiceButton.tsx +0 -262
  252. package/corpus/core/src/client/composer/asset-picker-url.ts +0 -80
  253. package/corpus/core/src/client/composer/attachment-accept.ts +0 -71
  254. package/corpus/core/src/client/composer/draft-key.ts +0 -7
  255. package/corpus/core/src/client/composer/extensions/FileReference.tsx +0 -55
  256. package/corpus/core/src/client/composer/extensions/MentionReference.tsx +0 -93
  257. package/corpus/core/src/client/composer/extensions/SkillReference.tsx +0 -56
  258. package/corpus/core/src/client/composer/pasted-text.ts +0 -160
  259. package/corpus/core/src/client/composer/prompt-attachments.ts +0 -70
  260. package/corpus/core/src/client/composer/realtime-voice-audio-level.ts +0 -64
  261. package/corpus/core/src/client/composer/realtime-voice-transcript.ts +0 -134
  262. package/corpus/core/src/client/composer/types.ts +0 -66
  263. package/corpus/core/src/client/composer/use-file-search.ts +0 -63
  264. package/corpus/core/src/client/composer/use-skills.ts +0 -44
  265. package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +0 -2095
  266. package/corpus/core/src/client/composer/useVoiceDictation.ts +0 -1155
  267. package/corpus/core/src/client/editor/index.ts +0 -1
  268. package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +0 -799
  269. package/corpus/core/src/client/rich-markdown-editor/index.ts +0 -70
  270. package/corpus/core/src/client/rich-markdown-editor/registrySlashCommands.ts +0 -112
  271. package/dist/client/composer/AgentComposerFrame.d.ts +0 -19
  272. package/dist/client/composer/AgentComposerFrame.d.ts.map +0 -1
  273. package/dist/client/composer/AgentComposerFrame.js +0 -14
  274. package/dist/client/composer/AgentComposerFrame.js.map +0 -1
  275. package/dist/client/composer/ComposerPlusMenu.d.ts +0 -17
  276. package/dist/client/composer/ComposerPlusMenu.d.ts.map +0 -1
  277. package/dist/client/composer/ComposerPlusMenu.js +0 -501
  278. package/dist/client/composer/ComposerPlusMenu.js.map +0 -1
  279. package/dist/client/composer/MentionPopover.d.ts +0 -29
  280. package/dist/client/composer/MentionPopover.d.ts.map +0 -1
  281. package/dist/client/composer/MentionPopover.js +0 -180
  282. package/dist/client/composer/MentionPopover.js.map +0 -1
  283. package/dist/client/composer/PastedTextChip.d.ts +0 -9
  284. package/dist/client/composer/PastedTextChip.d.ts.map +0 -1
  285. package/dist/client/composer/PastedTextChip.js +0 -47
  286. package/dist/client/composer/PastedTextChip.js.map +0 -1
  287. package/dist/client/composer/PromptComposer.d.ts +0 -115
  288. package/dist/client/composer/PromptComposer.d.ts.map +0 -1
  289. package/dist/client/composer/PromptComposer.js +0 -299
  290. package/dist/client/composer/PromptComposer.js.map +0 -1
  291. package/dist/client/composer/RealtimeVoiceMode.d.ts +0 -104
  292. package/dist/client/composer/RealtimeVoiceMode.d.ts.map +0 -1
  293. package/dist/client/composer/RealtimeVoiceMode.js +0 -245
  294. package/dist/client/composer/RealtimeVoiceMode.js.map +0 -1
  295. package/dist/client/composer/TiptapComposer.d.ts +0 -222
  296. package/dist/client/composer/TiptapComposer.d.ts.map +0 -1
  297. package/dist/client/composer/TiptapComposer.js +0 -1834
  298. package/dist/client/composer/TiptapComposer.js.map +0 -1
  299. package/dist/client/composer/VoiceButton.d.ts +0 -23
  300. package/dist/client/composer/VoiceButton.d.ts.map +0 -1
  301. package/dist/client/composer/VoiceButton.js +0 -100
  302. package/dist/client/composer/VoiceButton.js.map +0 -1
  303. package/dist/client/composer/asset-picker-url.d.ts +0 -16
  304. package/dist/client/composer/asset-picker-url.d.ts.map +0 -1
  305. package/dist/client/composer/asset-picker-url.js +0 -64
  306. package/dist/client/composer/asset-picker-url.js.map +0 -1
  307. package/dist/client/composer/attachment-accept.d.ts +0 -9
  308. package/dist/client/composer/attachment-accept.d.ts.map +0 -1
  309. package/dist/client/composer/attachment-accept.js +0 -65
  310. package/dist/client/composer/attachment-accept.js.map +0 -1
  311. package/dist/client/composer/draft-key.d.ts +0 -2
  312. package/dist/client/composer/draft-key.d.ts.map +0 -1
  313. package/dist/client/composer/draft-key.js +0 -8
  314. package/dist/client/composer/draft-key.js.map +0 -1
  315. package/dist/client/composer/extensions/FileReference.d.ts +0 -3
  316. package/dist/client/composer/extensions/FileReference.d.ts.map +0 -1
  317. package/dist/client/composer/extensions/FileReference.js +0 -36
  318. package/dist/client/composer/extensions/FileReference.js.map +0 -1
  319. package/dist/client/composer/extensions/MentionReference.d.ts +0 -3
  320. package/dist/client/composer/extensions/MentionReference.d.ts.map +0 -1
  321. package/dist/client/composer/extensions/MentionReference.js +0 -66
  322. package/dist/client/composer/extensions/MentionReference.js.map +0 -1
  323. package/dist/client/composer/extensions/SkillReference.d.ts +0 -3
  324. package/dist/client/composer/extensions/SkillReference.d.ts.map +0 -1
  325. package/dist/client/composer/extensions/SkillReference.js +0 -40
  326. package/dist/client/composer/extensions/SkillReference.js.map +0 -1
  327. package/dist/client/composer/pasted-text.d.ts +0 -31
  328. package/dist/client/composer/pasted-text.d.ts.map +0 -1
  329. package/dist/client/composer/pasted-text.js +0 -130
  330. package/dist/client/composer/pasted-text.js.map +0 -1
  331. package/dist/client/composer/prompt-attachments.d.ts +0 -11
  332. package/dist/client/composer/prompt-attachments.d.ts.map +0 -1
  333. package/dist/client/composer/prompt-attachments.js +0 -45
  334. package/dist/client/composer/prompt-attachments.js.map +0 -1
  335. package/dist/client/composer/realtime-voice-audio-level.d.ts +0 -14
  336. package/dist/client/composer/realtime-voice-audio-level.d.ts.map +0 -1
  337. package/dist/client/composer/realtime-voice-audio-level.js +0 -47
  338. package/dist/client/composer/realtime-voice-audio-level.js.map +0 -1
  339. package/dist/client/composer/realtime-voice-transcript.d.ts +0 -26
  340. package/dist/client/composer/realtime-voice-transcript.d.ts.map +0 -1
  341. package/dist/client/composer/realtime-voice-transcript.js +0 -103
  342. package/dist/client/composer/realtime-voice-transcript.js.map +0 -1
  343. package/dist/client/composer/types.d.ts +0 -60
  344. package/dist/client/composer/types.d.ts.map +0 -1
  345. package/dist/client/composer/types.js +0 -2
  346. package/dist/client/composer/types.js.map +0 -1
  347. package/dist/client/composer/use-file-search.d.ts +0 -6
  348. package/dist/client/composer/use-file-search.d.ts.map +0 -1
  349. package/dist/client/composer/use-file-search.js +0 -52
  350. package/dist/client/composer/use-file-search.js.map +0 -1
  351. package/dist/client/composer/use-skills.d.ts +0 -7
  352. package/dist/client/composer/use-skills.d.ts.map +0 -1
  353. package/dist/client/composer/use-skills.js +0 -39
  354. package/dist/client/composer/use-skills.js.map +0 -1
  355. package/dist/client/composer/useRealtimeVoiceMode.d.ts +0 -172
  356. package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +0 -1
  357. package/dist/client/composer/useRealtimeVoiceMode.js +0 -1648
  358. package/dist/client/composer/useRealtimeVoiceMode.js.map +0 -1
  359. package/dist/client/composer/useVoiceDictation.d.ts +0 -57
  360. package/dist/client/composer/useVoiceDictation.d.ts.map +0 -1
  361. package/dist/client/composer/useVoiceDictation.js +0 -975
  362. package/dist/client/composer/useVoiceDictation.js.map +0 -1
  363. package/dist/client/editor/index.d.ts +0 -2
  364. package/dist/client/editor/index.d.ts.map +0 -1
  365. package/dist/client/editor/index.js +0 -2
  366. package/dist/client/editor/index.js.map +0 -1
  367. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +0 -130
  368. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +0 -1
  369. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +0 -426
  370. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +0 -1
  371. package/dist/client/rich-markdown-editor/index.d.ts +0 -5
  372. package/dist/client/rich-markdown-editor/index.d.ts.map +0 -1
  373. package/dist/client/rich-markdown-editor/index.js +0 -5
  374. package/dist/client/rich-markdown-editor/index.js.map +0 -1
  375. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +0 -60
  376. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +0 -1
  377. package/dist/client/rich-markdown-editor/registrySlashCommands.js +0 -51
  378. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +0 -1
  379. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +0 -1
  380. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +0 -1
@@ -1,426 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { IconPencil } from "@tabler/icons-react";
3
- import { NodeSelection, Plugin, PluginKey, } from "@tiptap/pm/state";
4
- import { Node, NodeViewWrapper, ReactNodeViewRenderer, mergeAttributes, } from "@tiptap/react";
5
- import { createContext, useEffect, useContext, useMemo, useState, } from "react";
6
- import { blockEditSurface, useOptionalBlockRegistry, } from "../blocks/index.js";
7
- import { SchemaBlockEditor } from "../blocks/SchemaBlockEditor.js";
8
- const RegistryBlockDataContext = createContext(null);
9
- export function RegistryBlockDataProvider({ value, children, }) {
10
- return (_jsx(RegistryBlockDataContext.Provider, { value: value, children: children }));
11
- }
12
- /** Read the registry block side-map. Returns `null` outside a provider. */
13
- export function useRegistryBlockData() {
14
- return useContext(RegistryBlockDataContext);
15
- }
16
- function clickedInteractiveChild(target) {
17
- if (target.closest("button,input,textarea,select,a,[role='textbox']")) {
18
- return true;
19
- }
20
- // The block drag-handle grip is a `role="button"` div that lives in the editor
21
- // wrapper, and nested container blocks (columns/tabs) render their own inner
22
- // editors — each its own grip. A container block's `onMouseDownCapture`
23
- // selection handler runs in a SEPARATE React root (Tiptap mounts every node
24
- // view as its own root), so its `stopPropagation()` halts the NATIVE mousedown
25
- // right there, before it can reach an inner grip or inner editor. Treat the
26
- // grip and anything inside a nested editor region as interactive so the outer
27
- // container never hijacks a mousedown meant for inner machinery — this is what
28
- // makes dragging a block OUT of / BETWEEN columns (a nested grip) work at all.
29
- if (target.closest(".drag-handle") ||
30
- target.closest(".plan-nested-document-editor-region")) {
31
- return true;
32
- }
33
- const blockNode = target.closest(".plan-block-node");
34
- const editable = target.closest("[contenteditable='true']");
35
- return !!blockNode && !!editable && blockNode.contains(editable);
36
- }
37
- /* -------------------------------------------------------------------------- */
38
- /* B. RegistryBlockNodeView (React) */
39
- /* -------------------------------------------------------------------------- */
40
- /**
41
- * Renders one registry-block atom. The block is non-editable as far as
42
- * ProseMirror is concerned (`contentEditable={false}`); all interaction happens
43
- * inside the registry-driven `<BlockView>`. Read vs edit is toggled by
44
- * `props.selected` (the node is "selected" in the editor) AND the document being
45
- * editable. `data-plan-interactive` keeps existing host click-guards from
46
- * treating clicks inside the block as document clicks.
47
- */
48
- export function RegistryBlockNodeView(props) {
49
- const blockType = String(props.node.attrs.blockType ?? "");
50
- const blockId = String(props.node.attrs.blockId ?? "");
51
- const [panelOpen, setPanelOpen] = useState(false);
52
- const [shellHovered, setShellHovered] = useState(false);
53
- const registryValue = useOptionalBlockRegistry();
54
- const sideMap = useRegistryBlockData();
55
- // Optimistic edit override. `onBlockDataChange` commits into the host's own
56
- // store (a ref the side-map context can't observe), so an edit does NOT
57
- // re-render this node — the new data only reaches the view on the next full
58
- // document reconcile, which lands after the autosave round-trip (seconds
59
- // later) and is skipped entirely when the host treats the save as its own
60
- // echo. That left quick toggles like the callout tone buttons visually frozen
61
- // until reload. Holding the just-edited data locally re-renders this one node
62
- // immediately, then releases once the authoritative block catches up to (or
63
- // moves past) the value the edit was based on.
64
- const [pendingEdit, setPendingEdit] = useState(null);
65
- const liveBlock = sideMap?.getBlock(blockId);
66
- const liveData = liveBlock?.data;
67
- useEffect(() => {
68
- if (pendingEdit && !Object.is(liveData, pendingEdit.base)) {
69
- setPendingEdit(null);
70
- }
71
- }, [liveData, pendingEdit]);
72
- const block = liveBlock && pendingEdit && Object.is(liveData, pendingEdit.base)
73
- ? { ...liveBlock, data: pendingEdit.data }
74
- : liveBlock;
75
- const commitBlockData = (nextData, meta) => {
76
- setPendingEdit({ data: nextData, base: liveData });
77
- sideMap?.onBlockDataChange(blockId, nextData, meta);
78
- };
79
- const editable = sideMap?.editable ?? false;
80
- // In Notion-sync mode, flag blocks that have no Notion (NFM) analog so the
81
- // author sees what won't push. Prose blocks aren't registry-block nodes, so
82
- // this only ever covers structured blocks.
83
- const incompatibleWithNotion = (sideMap?.notionSync ?? false) &&
84
- (sideMap?.isNotionIncompatibleType?.(blockType) ?? false);
85
- // The block data isn't in the side-map yet (e.g. a freshly inserted node whose
86
- // store entry hasn't been seeded). Render a graceful placeholder.
87
- if (!block) {
88
- return (_jsx(NodeViewWrapper, { className: "plan-block-node", "data-block-id": blockId, children: _jsx("div", { contentEditable: false, "data-plan-interactive": true, className: "plan-block-node__placeholder rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground", children: blockType ? `Loading ${blockType} block…` : "Loading block…" }) }));
89
- }
90
- const spec = registryValue?.registry.get(blockType);
91
- const selectNode = (event) => {
92
- if (!editable)
93
- return;
94
- const target = event.target;
95
- if (target instanceof HTMLElement && clickedInteractiveChild(target))
96
- return;
97
- const pos = typeof props.getPos === "function" ? props.getPos() : null;
98
- if (typeof pos !== "number")
99
- return;
100
- try {
101
- event.preventDefault();
102
- event.stopPropagation();
103
- const { view } = props.editor;
104
- view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)));
105
- view.focus();
106
- }
107
- catch {
108
- // Ignore stale positions during React/ProseMirror reconciliation.
109
- }
110
- };
111
- const updateShellHover = (event) => {
112
- const target = event.target;
113
- setShellHovered(target instanceof HTMLElement &&
114
- target.closest(".plan-block-node__shell") === event.currentTarget);
115
- };
116
- // Choose how to render the block body:
117
- // 1. Registered spec → read view by default; direct-manipulation specs
118
- // (`editSurface: "inline" | "container"`) render their editor in place,
119
- // read-only-in-edit-mode specs (`"none"`) keep their read view, while
120
- // artifact/config specs (`"panel"`) keep the read view plus a corner edit
121
- // button.
122
- // 2. No spec, but the side-map provides `renderLegacyBlock` → delegate to the
123
- // host's dispatcher (decision, legacy visual-questions, image, and any
124
- // other type rendered by a bespoke component rather than the registry), so
125
- // EVERY block type renders in the document exactly as it does in the
126
- // per-block reader — never a bare title fallback.
127
- // 3. Neither → a small non-crashing fallback.
128
- let body;
129
- let editSurface = null;
130
- if (registryValue && spec) {
131
- const blockData = block.data;
132
- const Read = spec.Read;
133
- const readNode = (_jsx(Read, { data: blockData, blockId: block.id, title: block.title, summary: block.summary, ctx: registryValue.ctx }));
134
- body = readNode;
135
- const canEditBlock = editable &&
136
- spec.placement.includes("block") &&
137
- !!sideMap?.onBlockDataChange;
138
- if (canEditBlock) {
139
- const Edit = spec.Edit;
140
- const editorNode = Edit ? (_jsx(Edit, { data: blockData, onChange: commitBlockData, editable: true, blockId: block.id, title: block.title, summary: block.summary, ctx: registryValue.ctx })) : (_jsx(SchemaBlockEditor, { data: blockData, onChange: (nextData) => commitBlockData(nextData), schema: spec.schema, editable: true, blockId: block.id, ctx: registryValue.ctx }));
141
- const surface = blockEditSurface(spec);
142
- if (surface === "panel" && registryValue.ctx.renderEditSurface) {
143
- editSurface = registryValue.ctx.renderEditSurface({
144
- title: spec.label,
145
- open: panelOpen,
146
- onOpenChange: setPanelOpen,
147
- blockId: block.id,
148
- blockType,
149
- blockTitle: block.title,
150
- blockSummary: block.summary,
151
- blockData,
152
- trigger: (_jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": `Edit ${spec.label}`, onClick: () => setPanelOpen(true), className: "an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 data-[visible=true]:opacity-100", "data-visible": panelOpen || shellHovered, children: _jsx(IconPencil, { className: "size-4" }) })),
153
- children: editorNode,
154
- });
155
- }
156
- else if (surface === "panel") {
157
- editSurface = props.selected ? (_jsx("div", { className: "mt-3", children: editorNode })) : null;
158
- }
159
- else if (surface !== "none") {
160
- body = editorNode;
161
- }
162
- }
163
- }
164
- else if (sideMap?.renderLegacyBlock) {
165
- // Self-editing legacy blocks (e.g. image) render their own edit affordance
166
- // inside their overlay, so render them in edit mode and add NO separate
167
- // corner edit surface — the block owns a single, self-contained overlay.
168
- const selfEdits = editable && Boolean(sideMap.legacyBlockSelfEdits?.(blockType));
169
- body = sideMap.renderLegacyBlock(block, { editing: selfEdits });
170
- if (editable && !selfEdits) {
171
- // Prefer a host-provided schema/custom editor (a real form) over the raw
172
- // JSON fallback when the host knows how to edit this legacy block type.
173
- const customEditor = sideMap.renderLegacyBlockEditor?.(block, {
174
- onChange: (nextData) => commitBlockData(nextData),
175
- });
176
- editSurface = (_jsx(LegacyJsonEditSurface, { block: block, open: panelOpen, onOpenChange: setPanelOpen, renderEditSurface: registryValue?.ctx.renderEditSurface, onChange: (nextBlock) => commitBlockData(nextBlock), selected: shellHovered, customEditor: customEditor }));
177
- }
178
- }
179
- else {
180
- body = (_jsx("div", { className: "plan-block-node__fallback rounded-md border border-border px-3 py-2 text-sm text-muted-foreground", children: block.title || blockType || "Unsupported block" }));
181
- }
182
- return (_jsx(NodeViewWrapper, { className: "plan-block-node", "data-block-id": blockId, "data-block-type": blockType || undefined, "data-plan-block-selected": props.selected ? "" : undefined, "data-notion-incompatible": incompatibleWithNotion ? "" : undefined, onMouseDownCapture: selectNode, children: _jsxs("div", { contentEditable: false, "data-plan-interactive": true, className: "plan-block-node__shell relative", onMouseEnter: updateShellHover, onMouseMove: updateShellHover, onMouseLeave: () => setShellHovered(false), children: [incompatibleWithNotion && (_jsx("span", { className: "plan-block-notion-badge", title: "This block type has no Notion equivalent and won't sync to Notion.", children: "Won't sync to Notion" })), body, editSurface && (_jsx("div", { className: "plan-block-node__edit absolute right-2 top-2 z-20", children: editSurface }))] }) }));
183
- }
184
- export function LegacyJsonEditSurface({ block, open, onOpenChange, renderEditSurface, onChange, selected, customEditor, }) {
185
- const serializedBlockData = useMemo(() => JSON.stringify(block.data, null, 2), [block.data]);
186
- const [draft, setDraft] = useState(serializedBlockData);
187
- const [parseError, setParseError] = useState(null);
188
- useEffect(() => {
189
- setDraft(serializedBlockData);
190
- setParseError(null);
191
- }, [block.id, serializedBlockData]);
192
- const saveDraft = () => {
193
- try {
194
- const nextData = JSON.parse(draft);
195
- setParseError(null);
196
- onChange(nextData);
197
- onOpenChange(false);
198
- }
199
- catch (error) {
200
- setParseError(error instanceof Error ? error.message : "Invalid JSON data.");
201
- }
202
- };
203
- const trigger = (_jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": `Edit ${block.title ?? "block"}`, onClick: () => onOpenChange(true), className: "an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 data-[visible=true]:opacity-100", "data-visible": selected || open, children: _jsx(IconPencil, { className: "size-4" }) }));
204
- const jsonEditor = (_jsxs("div", { className: "grid gap-3", children: [_jsx("textarea", { "data-plan-interactive": true, className: "min-h-64 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs leading-5 text-foreground shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", value: draft, "aria-invalid": parseError ? true : undefined, onChange: (event) => {
205
- setDraft(event.target.value);
206
- if (parseError)
207
- setParseError(null);
208
- } }), parseError ? (_jsxs("p", { className: "text-xs text-destructive", role: "alert", children: ["Invalid JSON: ", parseError] })) : null, _jsx("div", { className: "flex justify-end", children: _jsx("button", { type: "button", "data-plan-interactive": true, className: "inline-flex h-8 items-center justify-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground", onClick: saveDraft, children: "Save" }) })] }));
209
- const editor = customEditor ?? jsonEditor;
210
- if (!renderEditSurface)
211
- return open ? editor : trigger;
212
- return renderEditSurface({
213
- title: block.title ?? "Block",
214
- open,
215
- onOpenChange,
216
- blockId: block.id,
217
- blockType: typeof block.type === "string"
218
- ? (block.type ?? "")
219
- : "legacy",
220
- blockTitle: block.title,
221
- blockSummary: block.summary,
222
- blockData: block.data,
223
- trigger,
224
- children: editor,
225
- });
226
- }
227
- /**
228
- * Build the generic registry-block Tiptap atom node. Returns a Tiptap `Node`
229
- * that:
230
- * - carries identity attrs `blockType` / `blockId` / `title` / `summary`, a
231
- * `sourceBlockId` (set when a duplicate is re-minted, so the host can copy the
232
- * original block's data), and an optional `__raw` verbatim-MDX attr for
233
- * byte-stable source round-trips;
234
- * - is an atom + isolating + draggable block that renders through
235
- * {@link RegistryBlockNodeView} (via `ReactNodeViewRenderer`);
236
- * - installs a dedupe `appendTransaction` plugin that re-mints any duplicate or
237
- * empty `blockId` (the classic paste/duplicate case), preserving the original
238
- * block's id + side-map data and tagging its own transaction so it never
239
- * loops.
240
- */
241
- export function createRegistryBlockNode(options) {
242
- const { nodeName, dataTag, mintId, group = "block" } = options;
243
- const dedupeKey = new PluginKey(`${nodeName}DedupeIds`);
244
- const keyboardGuardKey = new PluginKey(`${nodeName}KeyboardGuard`);
245
- /**
246
- * Collect every `blockId` currently present on this node type in a doc, with
247
- * the position of each node, so duplicate ids (from paste/duplicate) can be
248
- * detected and re-minted.
249
- */
250
- function collectEntries(state) {
251
- const found = [];
252
- state.doc.descendants((node, pos) => {
253
- if (node.type.name === nodeName) {
254
- found.push({
255
- pos,
256
- blockType: String(node.attrs.blockType ?? ""),
257
- blockId: String(node.attrs.blockId ?? ""),
258
- sourceBlockId: typeof node.attrs.sourceBlockId === "string"
259
- ? node.attrs.sourceBlockId
260
- : undefined,
261
- });
262
- }
263
- return true;
264
- });
265
- return found;
266
- }
267
- /**
268
- * Build a transaction that re-mints any duplicate / missing ids in `state`, or
269
- * `null` when nothing needs changing. Only the *later* duplicate (and any node
270
- * with an empty id) is re-minted, so the original keeps its id and side-map
271
- * data.
272
- */
273
- function buildDedupeTransaction(state) {
274
- const entries = collectEntries(state);
275
- if (entries.length === 0)
276
- return null;
277
- const seen = new Set();
278
- let tr = state.tr;
279
- let changed = false;
280
- for (const entry of entries) {
281
- const needsNewId = !entry.blockId || seen.has(entry.blockId);
282
- if (needsNewId) {
283
- const freshId = mintId(entry.blockType || "block");
284
- const node = state.doc.nodeAt(entry.pos);
285
- if (node) {
286
- tr = tr.setNodeMarkup(entry.pos, undefined, {
287
- ...node.attrs,
288
- blockId: freshId,
289
- sourceBlockId: entry.sourceBlockId || entry.blockId || null,
290
- });
291
- changed = true;
292
- }
293
- seen.add(freshId);
294
- }
295
- else {
296
- seen.add(entry.blockId);
297
- }
298
- }
299
- return changed ? tr.setMeta(dedupeKey, true) : null;
300
- }
301
- const selectedRegistryBlock = (state) => state.selection instanceof NodeSelection &&
302
- state.selection.node.type.name === nodeName;
303
- const isMutatingKey = (event) => {
304
- if (event.altKey || event.ctrlKey || event.metaKey)
305
- return false;
306
- if (event.key === "Enter")
307
- return true;
308
- return event.key.length === 1;
309
- };
310
- return Node.create({
311
- name: nodeName,
312
- group,
313
- atom: true,
314
- draggable: true,
315
- selectable: true,
316
- isolating: true,
317
- addAttributes() {
318
- return {
319
- blockType: { default: "" },
320
- blockId: { default: "" },
321
- title: { default: null },
322
- summary: { default: null },
323
- sourceBlockId: { default: null },
324
- // Optional verbatim source for hosts that need byte-identical
325
- // source-format round-trips without React (server pull, hashing). Plan
326
- // never sets this.
327
- __raw: { default: null, rendered: false },
328
- };
329
- },
330
- parseHTML() {
331
- return [
332
- {
333
- tag: `div[${dataTag}]`,
334
- getAttrs: (element) => {
335
- const node = element;
336
- return {
337
- blockType: node.getAttribute("data-block-type") || "",
338
- blockId: node.getAttribute("data-block-id") || "",
339
- title: node.getAttribute("data-title") || null,
340
- summary: node.getAttribute("data-summary") || null,
341
- sourceBlockId: node.getAttribute("data-source-block-id") || null,
342
- };
343
- },
344
- },
345
- ];
346
- },
347
- renderHTML({ HTMLAttributes }) {
348
- return [
349
- "div",
350
- mergeAttributes(HTMLAttributes, {
351
- [dataTag]: "",
352
- "data-block-type": HTMLAttributes.blockType ?? "",
353
- "data-block-id": HTMLAttributes.blockId ?? "",
354
- "data-title": HTMLAttributes.title ?? undefined,
355
- "data-summary": HTMLAttributes.summary ?? undefined,
356
- "data-source-block-id": HTMLAttributes.sourceBlockId ?? undefined,
357
- }),
358
- ];
359
- },
360
- addNodeView() {
361
- return ReactNodeViewRenderer(RegistryBlockNodeView);
362
- },
363
- addProseMirrorPlugins() {
364
- return [
365
- new Plugin({
366
- key: dedupeKey,
367
- appendTransaction(transactions, _oldState, newState) {
368
- // Ignore our own re-mint, and skip when nothing changed the doc.
369
- if (transactions.some((transaction) => transaction.getMeta(dedupeKey)) ||
370
- !transactions.some((transaction) => transaction.docChanged)) {
371
- return null;
372
- }
373
- return buildDedupeTransaction(newState);
374
- },
375
- }),
376
- new Plugin({
377
- key: keyboardGuardKey,
378
- props: {
379
- handleClickOn(view, _pos, node, nodePos, event, direct) {
380
- if (node.type.name !== nodeName || !direct)
381
- return false;
382
- if (event.target instanceof HTMLElement &&
383
- clickedInteractiveChild(event.target)) {
384
- return false;
385
- }
386
- event.preventDefault();
387
- view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos)));
388
- view.focus();
389
- return true;
390
- },
391
- handleKeyDown(view, event) {
392
- if (!selectedRegistryBlock(view.state) || !isMutatingKey(event))
393
- return false;
394
- event.preventDefault();
395
- return true;
396
- },
397
- handleTextInput(view) {
398
- return selectedRegistryBlock(view.state);
399
- },
400
- handlePaste(view, event) {
401
- if (!selectedRegistryBlock(view.state))
402
- return false;
403
- event.preventDefault();
404
- return true;
405
- },
406
- handleDOMEvents: {
407
- beforeinput(view, event) {
408
- if (!selectedRegistryBlock(view.state))
409
- return false;
410
- const inputEvent = event;
411
- if (!inputEvent.inputType ||
412
- (!inputEvent.inputType.startsWith("insert") &&
413
- inputEvent.inputType !== "formatSetBlockTextDirection")) {
414
- return false;
415
- }
416
- event.preventDefault();
417
- return true;
418
- },
419
- },
420
- },
421
- }),
422
- ];
423
- },
424
- });
425
- }
426
- //# sourceMappingURL=RegistryBlockNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RegistryBlockNode.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RegistryBlockNode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,aAAa,EACb,MAAM,EACN,SAAS,GAEV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,IAAI,EACJ,eAAe,EACf,qBAAqB,EACrB,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,GAGT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GAGzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AA2FnE,MAAM,wBAAwB,GAC5B,aAAa,CAAqC,IAAI,CAAC,CAAC;AAE1D,MAAM,UAAU,yBAAyB,CAEvC,EACA,KAAK,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ACvB,OAAO,IAAI,CAAC;4BACd,CAAC;yBACF;qBACF;iBACF,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { IconPencil } from \"@tabler/icons-react\";\nimport {\n NodeSelection,\n Plugin,\n PluginKey,\n type EditorState,\n} from \"@tiptap/pm/state\";\nimport {\n Node,\n NodeViewWrapper,\n ReactNodeViewRenderer,\n mergeAttributes,\n type NodeViewProps,\n} from \"@tiptap/react\";\nimport {\n createContext,\n useEffect,\n useContext,\n useMemo,\n useState,\n type ReactNode,\n type MouseEvent as ReactMouseEvent,\n} from \"react\";\n\nimport {\n blockEditSurface,\n useOptionalBlockRegistry,\n type BlockDataChangeMeta,\n type BlockRenderContext,\n} from \"../blocks/index.js\";\nimport { SchemaBlockEditor } from \"../blocks/SchemaBlockEditor.js\";\n\n/* -------------------------------------------------------------------------- */\n/* The generic registry-block side-map + Tiptap NodeView, lifted into core. */\n/* */\n/* This is the app-agnostic NodeView that renders registered block specs */\n/* inside a `SharedRichEditor` document. Hosts mount the node produced by */\n/* {@link createRegistryBlockNode} as an extra extension and wrap the editor */\n/* in a {@link RegistryBlockDataProvider}, sourcing the typed block `data` */\n/* from their own authoritative store (for example, PlanContent.blocks). The */\n/* node itself carries only lightweight identity attrs (type/id/title/summary) */\n/* plus an optional `__raw` verbatim-MDX attr for byte-stable source */\n/* round-trips; the heavy typed `data` is threaded through the side-map */\n/* context, keeping the doc small and the block data the single source of */\n/* truth. */\n/* -------------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------------- */\n/* C. Block-data side-map context */\n/* -------------------------------------------------------------------------- */\n\n/** The minimal block shape the NodeView renders through `<BlockView>`. */\nexport interface RegistryBlockSideMapBlock {\n id: string;\n title?: string;\n summary?: string;\n data: unknown;\n}\n\n/**\n * The side-map an editor host supplies so the registry NodeView can resolve a\n * block's full typed `data` (and commit edits) by its stable id, without ever\n * storing that data in the ProseMirror doc.\n */\nexport interface RegistryBlockDataValue<\n TBlock extends RegistryBlockSideMapBlock = RegistryBlockSideMapBlock,\n> {\n /** Resolve a block's full record (incl. `data`) by its stable id. */\n getBlock: (blockId: string) => TBlock | undefined;\n /** Commit a new `data` value for a block (edit-mode only). */\n onBlockDataChange: (\n blockId: string,\n nextData: unknown,\n meta?: BlockDataChangeMeta,\n ) => void;\n /** Whether the document (and thus its blocks) is editable. */\n editable: boolean;\n /**\n * When true, blocks whose type has no Notion (NFM) analog are badged so the\n * author knows they won't sync. The host decides which types are incompatible\n * via {@link isNotionIncompatibleType}; this flag just toggles the badge on.\n */\n notionSync?: boolean;\n /**\n * Decide whether a block type is Notion-incompatible (no NFM analog). Only\n * consulted when {@link notionSync} is true. Injected by the host so the\n * single registry-level allowlist (plan's `isNotionCompatibleBlockType`, or\n * content's registry-derived gate) drives the badge — core stays policy-free.\n */\n isNotionIncompatibleType?: (blockType: string) => boolean;\n /**\n * Render a block whose type is NOT in the registry through the host's own\n * dispatcher (plan: `PlanBlockView` for decision / legacy visual-questions /\n * image; omitted in hosts with no legacy types), so every block type renders\n * in the document instead of a bare fallback.\n */\n renderLegacyBlock?: (\n block: TBlock,\n options: { editing: boolean },\n ) => ReactNode;\n /**\n * Optional: render a schema-driven (or otherwise custom) editor for a legacy\n * block in place of the raw-JSON fallback. Receives an `onChange` that commits\n * the block's new `data`. Return `null`/`undefined` to keep the JSON editor for\n * that block type. The returned editor is expected to autosave through\n * `onChange` (no Save button is shown), matching registered panel blocks.\n */\n renderLegacyBlockEditor?: (\n block: TBlock,\n args: { onChange: (nextData: unknown) => void },\n ) => ReactNode;\n /**\n * Return `true` for legacy block types that render their OWN edit affordance\n * inside `renderLegacyBlock` (e.g. an image block with its own hover toolbar).\n * For those types the node view renders the legacy block in edit mode and adds\n * NO separate corner edit surface (no pencil / JSON / form popover), so the\n * block owns a single, self-contained control overlay.\n */\n legacyBlockSelfEdits?: (blockType: string) => boolean;\n}\n\nconst RegistryBlockDataContext =\n createContext<RegistryBlockDataValue<any> | null>(null);\n\nexport function RegistryBlockDataProvider<\n TBlock extends RegistryBlockSideMapBlock = RegistryBlockSideMapBlock,\n>({\n value,\n children,\n}: {\n value: RegistryBlockDataValue<TBlock>;\n children: ReactNode;\n}) {\n return (\n <RegistryBlockDataContext.Provider value={value}>\n {children}\n </RegistryBlockDataContext.Provider>\n );\n}\n\n/** Read the registry block side-map. Returns `null` outside a provider. */\nexport function useRegistryBlockData<\n TBlock extends RegistryBlockSideMapBlock = RegistryBlockSideMapBlock,\n>(): RegistryBlockDataValue<TBlock> | null {\n return useContext(\n RegistryBlockDataContext,\n ) as RegistryBlockDataValue<TBlock> | null;\n}\n\nfunction clickedInteractiveChild(target: HTMLElement) {\n if (target.closest(\"button,input,textarea,select,a,[role='textbox']\")) {\n return true;\n }\n\n // The block drag-handle grip is a `role=\"button\"` div that lives in the editor\n // wrapper, and nested container blocks (columns/tabs) render their own inner\n // editors — each its own grip. A container block's `onMouseDownCapture`\n // selection handler runs in a SEPARATE React root (Tiptap mounts every node\n // view as its own root), so its `stopPropagation()` halts the NATIVE mousedown\n // right there, before it can reach an inner grip or inner editor. Treat the\n // grip and anything inside a nested editor region as interactive so the outer\n // container never hijacks a mousedown meant for inner machinery — this is what\n // makes dragging a block OUT of / BETWEEN columns (a nested grip) work at all.\n if (\n target.closest(\".drag-handle\") ||\n target.closest(\".plan-nested-document-editor-region\")\n ) {\n return true;\n }\n\n const blockNode = target.closest(\".plan-block-node\");\n const editable = target.closest(\"[contenteditable='true']\");\n return !!blockNode && !!editable && blockNode.contains(editable);\n}\n\n/* -------------------------------------------------------------------------- */\n/* B. RegistryBlockNodeView (React) */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Renders one registry-block atom. The block is non-editable as far as\n * ProseMirror is concerned (`contentEditable={false}`); all interaction happens\n * inside the registry-driven `<BlockView>`. Read vs edit is toggled by\n * `props.selected` (the node is \"selected\" in the editor) AND the document being\n * editable. `data-plan-interactive` keeps existing host click-guards from\n * treating clicks inside the block as document clicks.\n */\nexport function RegistryBlockNodeView(props: NodeViewProps) {\n const blockType = String(props.node.attrs.blockType ?? \"\");\n const blockId = String(props.node.attrs.blockId ?? \"\");\n const [panelOpen, setPanelOpen] = useState(false);\n const [shellHovered, setShellHovered] = useState(false);\n\n const registryValue = useOptionalBlockRegistry();\n const sideMap = useRegistryBlockData();\n\n // Optimistic edit override. `onBlockDataChange` commits into the host's own\n // store (a ref the side-map context can't observe), so an edit does NOT\n // re-render this node — the new data only reaches the view on the next full\n // document reconcile, which lands after the autosave round-trip (seconds\n // later) and is skipped entirely when the host treats the save as its own\n // echo. That left quick toggles like the callout tone buttons visually frozen\n // until reload. Holding the just-edited data locally re-renders this one node\n // immediately, then releases once the authoritative block catches up to (or\n // moves past) the value the edit was based on.\n const [pendingEdit, setPendingEdit] = useState<{\n data: unknown;\n base: unknown;\n } | null>(null);\n const liveBlock = sideMap?.getBlock(blockId);\n const liveData = liveBlock?.data;\n useEffect(() => {\n if (pendingEdit && !Object.is(liveData, pendingEdit.base)) {\n setPendingEdit(null);\n }\n }, [liveData, pendingEdit]);\n const block =\n liveBlock && pendingEdit && Object.is(liveData, pendingEdit.base)\n ? { ...liveBlock, data: pendingEdit.data }\n : liveBlock;\n const commitBlockData = (nextData: unknown, meta?: BlockDataChangeMeta) => {\n setPendingEdit({ data: nextData, base: liveData });\n sideMap?.onBlockDataChange(blockId, nextData, meta);\n };\n const editable = sideMap?.editable ?? false;\n // In Notion-sync mode, flag blocks that have no Notion (NFM) analog so the\n // author sees what won't push. Prose blocks aren't registry-block nodes, so\n // this only ever covers structured blocks.\n const incompatibleWithNotion =\n (sideMap?.notionSync ?? false) &&\n (sideMap?.isNotionIncompatibleType?.(blockType) ?? false);\n\n // The block data isn't in the side-map yet (e.g. a freshly inserted node whose\n // store entry hasn't been seeded). Render a graceful placeholder.\n if (!block) {\n return (\n <NodeViewWrapper className=\"plan-block-node\" data-block-id={blockId}>\n <div\n contentEditable={false}\n data-plan-interactive\n className=\"plan-block-node__placeholder rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground\"\n >\n {blockType ? `Loading ${blockType} block…` : \"Loading block…\"}\n </div>\n </NodeViewWrapper>\n );\n }\n\n const spec = registryValue?.registry.get(blockType);\n const selectNode = (event: ReactMouseEvent<HTMLElement>) => {\n if (!editable) return;\n const target = event.target;\n if (target instanceof HTMLElement && clickedInteractiveChild(target))\n return;\n const pos = typeof props.getPos === \"function\" ? props.getPos() : null;\n if (typeof pos !== \"number\") return;\n try {\n event.preventDefault();\n event.stopPropagation();\n const { view } = props.editor;\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)),\n );\n view.focus();\n } catch {\n // Ignore stale positions during React/ProseMirror reconciliation.\n }\n };\n const updateShellHover = (event: ReactMouseEvent<HTMLElement>) => {\n const target = event.target;\n setShellHovered(\n target instanceof HTMLElement &&\n target.closest(\".plan-block-node__shell\") === event.currentTarget,\n );\n };\n\n // Choose how to render the block body:\n // 1. Registered spec → read view by default; direct-manipulation specs\n // (`editSurface: \"inline\" | \"container\"`) render their editor in place,\n // read-only-in-edit-mode specs (`\"none\"`) keep their read view, while\n // artifact/config specs (`\"panel\"`) keep the read view plus a corner edit\n // button.\n // 2. No spec, but the side-map provides `renderLegacyBlock` → delegate to the\n // host's dispatcher (decision, legacy visual-questions, image, and any\n // other type rendered by a bespoke component rather than the registry), so\n // EVERY block type renders in the document exactly as it does in the\n // per-block reader — never a bare title fallback.\n // 3. Neither → a small non-crashing fallback.\n let body: ReactNode;\n let editSurface: ReactNode = null;\n if (registryValue && spec) {\n const blockData = (block as { data: unknown }).data;\n const Read = spec.Read;\n const readNode = (\n <Read\n data={blockData}\n blockId={block.id}\n title={block.title}\n summary={block.summary}\n ctx={registryValue.ctx}\n />\n );\n body = readNode;\n const canEditBlock =\n editable &&\n spec.placement.includes(\"block\") &&\n !!sideMap?.onBlockDataChange;\n if (canEditBlock) {\n const Edit = spec.Edit;\n const editorNode = Edit ? (\n <Edit\n data={blockData}\n onChange={commitBlockData}\n editable\n blockId={block.id}\n title={block.title}\n summary={block.summary}\n ctx={registryValue.ctx}\n />\n ) : (\n <SchemaBlockEditor\n data={blockData}\n onChange={(nextData) => commitBlockData(nextData)}\n schema={spec.schema}\n editable\n blockId={block.id}\n ctx={registryValue.ctx}\n />\n );\n const surface = blockEditSurface(spec);\n if (surface === \"panel\" && registryValue.ctx.renderEditSurface) {\n editSurface = registryValue.ctx.renderEditSurface({\n title: spec.label,\n open: panelOpen,\n onOpenChange: setPanelOpen,\n blockId: block.id,\n blockType,\n blockTitle: block.title,\n blockSummary: block.summary,\n blockData,\n trigger: (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Edit ${spec.label}`}\n onClick={() => setPanelOpen(true)}\n className=\"an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 data-[visible=true]:opacity-100\"\n data-visible={panelOpen || shellHovered}\n >\n <IconPencil className=\"size-4\" />\n </button>\n ),\n children: editorNode,\n });\n } else if (surface === \"panel\") {\n editSurface = props.selected ? (\n <div className=\"mt-3\">{editorNode}</div>\n ) : null;\n } else if (surface !== \"none\") {\n body = editorNode;\n }\n }\n } else if (sideMap?.renderLegacyBlock) {\n // Self-editing legacy blocks (e.g. image) render their own edit affordance\n // inside their overlay, so render them in edit mode and add NO separate\n // corner edit surface — the block owns a single, self-contained overlay.\n const selfEdits =\n editable && Boolean(sideMap.legacyBlockSelfEdits?.(blockType));\n body = sideMap.renderLegacyBlock(block, { editing: selfEdits });\n if (editable && !selfEdits) {\n // Prefer a host-provided schema/custom editor (a real form) over the raw\n // JSON fallback when the host knows how to edit this legacy block type.\n const customEditor = sideMap.renderLegacyBlockEditor?.(block, {\n onChange: (nextData) => commitBlockData(nextData),\n });\n editSurface = (\n <LegacyJsonEditSurface\n block={block}\n open={panelOpen}\n onOpenChange={setPanelOpen}\n renderEditSurface={registryValue?.ctx.renderEditSurface}\n onChange={(nextBlock) => commitBlockData(nextBlock)}\n selected={shellHovered}\n customEditor={customEditor}\n />\n );\n }\n } else {\n body = (\n <div className=\"plan-block-node__fallback rounded-md border border-border px-3 py-2 text-sm text-muted-foreground\">\n {block.title || blockType || \"Unsupported block\"}\n </div>\n );\n }\n\n return (\n <NodeViewWrapper\n className=\"plan-block-node\"\n data-block-id={blockId}\n // Mirror the block type onto the wrapper so the document flow can detect a\n // RUN of consecutive blocks of the same type (e.g. api-endpoint) and\n // collapse the divider + gap between them, matching the read-only path.\n data-block-type={blockType || undefined}\n data-plan-block-selected={props.selected ? \"\" : undefined}\n data-notion-incompatible={incompatibleWithNotion ? \"\" : undefined}\n onMouseDownCapture={selectNode}\n >\n <div\n contentEditable={false}\n data-plan-interactive\n className=\"plan-block-node__shell relative\"\n onMouseEnter={updateShellHover}\n onMouseMove={updateShellHover}\n onMouseLeave={() => setShellHovered(false)}\n >\n {incompatibleWithNotion && (\n <span\n className=\"plan-block-notion-badge\"\n title=\"This block type has no Notion equivalent and won't sync to Notion.\"\n >\n Won't sync to Notion\n </span>\n )}\n {body}\n {editSurface && (\n <div className=\"plan-block-node__edit absolute right-2 top-2 z-20\">\n {editSurface}\n </div>\n )}\n </div>\n </NodeViewWrapper>\n );\n}\n\nexport function LegacyJsonEditSurface({\n block,\n open,\n onOpenChange,\n renderEditSurface,\n onChange,\n selected,\n customEditor,\n}: {\n block: RegistryBlockSideMapBlock;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n renderEditSurface?: BlockRenderContext[\"renderEditSurface\"];\n onChange: (nextData: unknown) => void;\n selected: boolean;\n /**\n * A host-provided form editor (e.g. {@link SchemaBlockEditor}). When present it\n * replaces the raw-JSON textarea + Save button; the form autosaves through its\n * own `onChange`.\n */\n customEditor?: ReactNode;\n}) {\n const serializedBlockData = useMemo(\n () => JSON.stringify(block.data, null, 2),\n [block.data],\n );\n const [draft, setDraft] = useState(serializedBlockData);\n const [parseError, setParseError] = useState<string | null>(null);\n\n useEffect(() => {\n setDraft(serializedBlockData);\n setParseError(null);\n }, [block.id, serializedBlockData]);\n\n const saveDraft = () => {\n try {\n const nextData = JSON.parse(draft) as unknown;\n setParseError(null);\n onChange(nextData);\n onOpenChange(false);\n } catch (error) {\n setParseError(\n error instanceof Error ? error.message : \"Invalid JSON data.\",\n );\n }\n };\n\n const trigger = (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Edit ${block.title ?? \"block\"}`}\n onClick={() => onOpenChange(true)}\n className=\"an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 data-[visible=true]:opacity-100\"\n data-visible={selected || open}\n >\n <IconPencil className=\"size-4\" />\n </button>\n );\n const jsonEditor = (\n <div className=\"grid gap-3\">\n <textarea\n data-plan-interactive\n className=\"min-h-64 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs leading-5 text-foreground shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n value={draft}\n aria-invalid={parseError ? true : undefined}\n onChange={(event) => {\n setDraft(event.target.value);\n if (parseError) setParseError(null);\n }}\n />\n {parseError ? (\n <p className=\"text-xs text-destructive\" role=\"alert\">\n Invalid JSON: {parseError}\n </p>\n ) : null}\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n data-plan-interactive\n className=\"inline-flex h-8 items-center justify-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground\"\n onClick={saveDraft}\n >\n Save\n </button>\n </div>\n </div>\n );\n const editor = customEditor ?? jsonEditor;\n if (!renderEditSurface) return open ? editor : trigger;\n return renderEditSurface({\n title: block.title ?? \"Block\",\n open,\n onOpenChange,\n blockId: block.id,\n blockType:\n typeof (block as { type?: unknown }).type === \"string\"\n ? ((block as unknown as { type: string }).type ?? \"\")\n : \"legacy\",\n blockTitle: block.title,\n blockSummary: block.summary,\n blockData: block.data,\n trigger,\n children: editor,\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* A. registry-block Tiptap node factory */\n/* -------------------------------------------------------------------------- */\n\n/** Options for {@link createRegistryBlockNode}. */\nexport interface CreateRegistryBlockNodeOptions {\n /**\n * The Tiptap node name (e.g. `\"planBlock\"`). Hosts that serialize the doc by\n * node name (plan's `plan-doc.ts` keys off `\"planBlock\"`) must pass the exact\n * name their serializer expects.\n */\n nodeName: string;\n /**\n * The HTML data-attribute that marks a serialized registry block on copy/paste\n * round-trip (e.g. `\"data-plan-block\"`).\n */\n dataTag: string;\n /**\n * Mint a fresh, unique block id for a given block type. Used by the dedupe\n * plugin to re-mint duplicate / missing ids (paste/duplicate). Plan passes\n * `createPlanBlockId`.\n */\n mintId: (blockType: string) => string;\n /** Node group (default `\"block\"`). */\n group?: string;\n}\n\n/**\n * Build the generic registry-block Tiptap atom node. Returns a Tiptap `Node`\n * that:\n * - carries identity attrs `blockType` / `blockId` / `title` / `summary`, a\n * `sourceBlockId` (set when a duplicate is re-minted, so the host can copy the\n * original block's data), and an optional `__raw` verbatim-MDX attr for\n * byte-stable source round-trips;\n * - is an atom + isolating + draggable block that renders through\n * {@link RegistryBlockNodeView} (via `ReactNodeViewRenderer`);\n * - installs a dedupe `appendTransaction` plugin that re-mints any duplicate or\n * empty `blockId` (the classic paste/duplicate case), preserving the original\n * block's id + side-map data and tagging its own transaction so it never\n * loops.\n */\nexport function createRegistryBlockNode(\n options: CreateRegistryBlockNodeOptions,\n) {\n const { nodeName, dataTag, mintId, group = \"block\" } = options;\n const dedupeKey = new PluginKey(`${nodeName}DedupeIds`);\n const keyboardGuardKey = new PluginKey(`${nodeName}KeyboardGuard`);\n\n /**\n * Collect every `blockId` currently present on this node type in a doc, with\n * the position of each node, so duplicate ids (from paste/duplicate) can be\n * detected and re-minted.\n */\n function collectEntries(state: EditorState): Array<{\n pos: number;\n blockType: string;\n blockId: string;\n sourceBlockId?: string;\n }> {\n const found: Array<{\n pos: number;\n blockType: string;\n blockId: string;\n sourceBlockId?: string;\n }> = [];\n state.doc.descendants((node, pos) => {\n if (node.type.name === nodeName) {\n found.push({\n pos,\n blockType: String(node.attrs.blockType ?? \"\"),\n blockId: String(node.attrs.blockId ?? \"\"),\n sourceBlockId:\n typeof node.attrs.sourceBlockId === \"string\"\n ? node.attrs.sourceBlockId\n : undefined,\n });\n }\n return true;\n });\n return found;\n }\n\n /**\n * Build a transaction that re-mints any duplicate / missing ids in `state`, or\n * `null` when nothing needs changing. Only the *later* duplicate (and any node\n * with an empty id) is re-minted, so the original keeps its id and side-map\n * data.\n */\n function buildDedupeTransaction(state: EditorState) {\n const entries = collectEntries(state);\n if (entries.length === 0) return null;\n\n const seen = new Set<string>();\n let tr = state.tr;\n let changed = false;\n\n for (const entry of entries) {\n const needsNewId = !entry.blockId || seen.has(entry.blockId);\n if (needsNewId) {\n const freshId = mintId(entry.blockType || \"block\");\n const node = state.doc.nodeAt(entry.pos);\n if (node) {\n tr = tr.setNodeMarkup(entry.pos, undefined, {\n ...node.attrs,\n blockId: freshId,\n sourceBlockId: entry.sourceBlockId || entry.blockId || null,\n });\n changed = true;\n }\n seen.add(freshId);\n } else {\n seen.add(entry.blockId);\n }\n }\n\n return changed ? tr.setMeta(dedupeKey, true) : null;\n }\n\n const selectedRegistryBlock = (state: EditorState) =>\n state.selection instanceof NodeSelection &&\n state.selection.node.type.name === nodeName;\n\n const isMutatingKey = (event: KeyboardEvent) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return false;\n if (event.key === \"Enter\") return true;\n return event.key.length === 1;\n };\n\n return Node.create({\n name: nodeName,\n group,\n atom: true,\n draggable: true,\n selectable: true,\n isolating: true,\n\n addAttributes() {\n return {\n blockType: { default: \"\" },\n blockId: { default: \"\" },\n title: { default: null },\n summary: { default: null },\n sourceBlockId: { default: null },\n // Optional verbatim source for hosts that need byte-identical\n // source-format round-trips without React (server pull, hashing). Plan\n // never sets this.\n __raw: { default: null, rendered: false },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: `div[${dataTag}]`,\n getAttrs: (element) => {\n const node = element as HTMLElement;\n return {\n blockType: node.getAttribute(\"data-block-type\") || \"\",\n blockId: node.getAttribute(\"data-block-id\") || \"\",\n title: node.getAttribute(\"data-title\") || null,\n summary: node.getAttribute(\"data-summary\") || null,\n sourceBlockId: node.getAttribute(\"data-source-block-id\") || null,\n };\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n [dataTag]: \"\",\n \"data-block-type\": HTMLAttributes.blockType ?? \"\",\n \"data-block-id\": HTMLAttributes.blockId ?? \"\",\n \"data-title\": HTMLAttributes.title ?? undefined,\n \"data-summary\": HTMLAttributes.summary ?? undefined,\n \"data-source-block-id\": HTMLAttributes.sourceBlockId ?? undefined,\n }),\n ];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(RegistryBlockNodeView);\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: dedupeKey,\n appendTransaction(transactions, _oldState, newState) {\n // Ignore our own re-mint, and skip when nothing changed the doc.\n if (\n transactions.some((transaction) =>\n transaction.getMeta(dedupeKey),\n ) ||\n !transactions.some((transaction) => transaction.docChanged)\n ) {\n return null;\n }\n return buildDedupeTransaction(newState);\n },\n }),\n new Plugin({\n key: keyboardGuardKey,\n props: {\n handleClickOn(view, _pos, node, nodePos, event, direct) {\n if (node.type.name !== nodeName || !direct) return false;\n if (\n event.target instanceof HTMLElement &&\n clickedInteractiveChild(event.target)\n ) {\n return false;\n }\n event.preventDefault();\n view.dispatch(\n view.state.tr.setSelection(\n NodeSelection.create(view.state.doc, nodePos),\n ),\n );\n view.focus();\n return true;\n },\n handleKeyDown(view, event) {\n if (!selectedRegistryBlock(view.state) || !isMutatingKey(event))\n return false;\n event.preventDefault();\n return true;\n },\n handleTextInput(view) {\n return selectedRegistryBlock(view.state);\n },\n handlePaste(view, event) {\n if (!selectedRegistryBlock(view.state)) return false;\n event.preventDefault();\n return true;\n },\n handleDOMEvents: {\n beforeinput(view, event) {\n if (!selectedRegistryBlock(view.state)) return false;\n const inputEvent = event as InputEvent;\n if (\n !inputEvent.inputType ||\n (!inputEvent.inputType.startsWith(\"insert\") &&\n inputEvent.inputType !== \"formatSetBlockTextDirection\")\n ) {\n return false;\n }\n event.preventDefault();\n return true;\n },\n },\n },\n }),\n ];\n },\n });\n}\n"]}
@@ -1,5 +0,0 @@
1
- export { applyDocSurgically, BubbleToolbar, buildDefaultBubbleItems, createCodeBlockNode, createImageExtension, createImageSlashCommand, createRichMarkdownExtensions, createSharedEditorExtensions, DEFAULT_CODE_LANGUAGES, DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR, DEFAULT_SLASH_COMMANDS, defaultParseValue, diffTopLevel, DragHandle, getEditorMarkdown, gfmToProseJSON, MARKDOWN_DIALECT_CONFIG, pickAndInsertImage, proseJSONToGfm, RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION, RichMarkdownEditor, RunId, RUN_ID_NODE_TYPES, SharedImage, SharedRichEditor, SlashCommandMenu, useCollabReconcile, type BubbleToolbarItem, type BubbleToolbarProps, type CodeBlockClassNames, type CodeLanguageOption, type CreateCodeBlockNodeOptions, type CreateRichMarkdownExtensionsOptions, type CreateSharedEditorExtensionsOptions, type DragHandleDropContext, type DragHandleDropPlacement, type DragHandleOptions, type ImageUploadFn, type RichMarkdownCollabUser, type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownEditorProps, type SharedEditorCollab, type SharedEditorFeatures, type SharedImageOptions, type SharedRichEditorProps, type SlashCommandItem, type SlashCommandMenuProps, type TopLevelDiff, type UseCollabReconcileOptions, type UseCollabReconcileResult, } from "@agent-native/toolkit/editor";
2
- export { uploadEditorImage } from "./uploadEditorImage.js";
3
- export { createRegistryBlockNode, RegistryBlockNodeView, RegistryBlockDataProvider, useRegistryBlockData, type CreateRegistryBlockNodeOptions, type RegistryBlockDataValue, type RegistryBlockSideMapBlock, } from "./RegistryBlockNode.js";
4
- export { buildRegistryBlockSlashItems, getRegistryBlockSlashDescription, getRegistryBlockSlashSearchText, type BuildRegistryBlockSlashItemsOptions, } from "./registrySlashCommands.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,EACtB,oCAAoC,EACpC,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sCAAsC,EACtC,kBAAkB,EAClB,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mCAAmC,GACzC,MAAM,4BAA4B,CAAC"}
@@ -1,5 +0,0 @@
1
- export { applyDocSurgically, BubbleToolbar, buildDefaultBubbleItems, createCodeBlockNode, createImageExtension, createImageSlashCommand, createRichMarkdownExtensions, createSharedEditorExtensions, DEFAULT_CODE_LANGUAGES, DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR, DEFAULT_SLASH_COMMANDS, defaultParseValue, diffTopLevel, DragHandle, getEditorMarkdown, gfmToProseJSON, MARKDOWN_DIALECT_CONFIG, pickAndInsertImage, proseJSONToGfm, RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION, RichMarkdownEditor, RunId, RUN_ID_NODE_TYPES, SharedImage, SharedRichEditor, SlashCommandMenu, useCollabReconcile, } from "@agent-native/toolkit/editor";
2
- export { uploadEditorImage } from "./uploadEditorImage.js";
3
- export { createRegistryBlockNode, RegistryBlockNodeView, RegistryBlockDataProvider, useRegistryBlockData, } from "./RegistryBlockNode.js";
4
- export { buildRegistryBlockSlashItems, getRegistryBlockSlashDescription, getRegistryBlockSlashSearchText, } from "./registrySlashCommands.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,EACtB,oCAAoC,EACpC,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sCAAsC,EACtC,kBAAkB,EAClB,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GAyBnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,GAEhC,MAAM,4BAA4B,CAAC","sourcesContent":["export {\n applyDocSurgically,\n BubbleToolbar,\n buildDefaultBubbleItems,\n createCodeBlockNode,\n createImageExtension,\n createImageSlashCommand,\n createRichMarkdownExtensions,\n createSharedEditorExtensions,\n DEFAULT_CODE_LANGUAGES,\n DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR,\n DEFAULT_SLASH_COMMANDS,\n defaultParseValue,\n diffTopLevel,\n DragHandle,\n getEditorMarkdown,\n gfmToProseJSON,\n MARKDOWN_DIALECT_CONFIG,\n pickAndInsertImage,\n proseJSONToGfm,\n RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION,\n RichMarkdownEditor,\n RunId,\n RUN_ID_NODE_TYPES,\n SharedImage,\n SharedRichEditor,\n SlashCommandMenu,\n useCollabReconcile,\n type BubbleToolbarItem,\n type BubbleToolbarProps,\n type CodeBlockClassNames,\n type CodeLanguageOption,\n type CreateCodeBlockNodeOptions,\n type CreateRichMarkdownExtensionsOptions,\n type CreateSharedEditorExtensionsOptions,\n type DragHandleDropContext,\n type DragHandleDropPlacement,\n type DragHandleOptions,\n type ImageUploadFn,\n type RichMarkdownCollabUser,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownEditorProps,\n type SharedEditorCollab,\n type SharedEditorFeatures,\n type SharedImageOptions,\n type SharedRichEditorProps,\n type SlashCommandItem,\n type SlashCommandMenuProps,\n type TopLevelDiff,\n type UseCollabReconcileOptions,\n type UseCollabReconcileResult,\n} from \"@agent-native/toolkit/editor\";\n\nexport { uploadEditorImage } from \"./uploadEditorImage.js\";\nexport {\n createRegistryBlockNode,\n RegistryBlockNodeView,\n RegistryBlockDataProvider,\n useRegistryBlockData,\n type CreateRegistryBlockNodeOptions,\n type RegistryBlockDataValue,\n type RegistryBlockSideMapBlock,\n} from \"./RegistryBlockNode.js\";\nexport {\n buildRegistryBlockSlashItems,\n getRegistryBlockSlashDescription,\n getRegistryBlockSlashSearchText,\n type BuildRegistryBlockSlashItemsOptions,\n} from \"./registrySlashCommands.js\";\n"]}
@@ -1,60 +0,0 @@
1
- import type { BlockRegistry, BlockSpec } from "../blocks/index.js";
2
- /**
3
- * Compact, user-facing slash-menu copy for structured registry blocks. The full
4
- * registry description remains available through search text, but the visible
5
- * row should scan like a command palette, not a block reference page.
6
- */
7
- export declare function getRegistryBlockSlashDescription(spec: Pick<BlockSpec, "type" | "description">): string;
8
- /** Searchable text for registry block slash items, including raw type keywords. */
9
- export declare function getRegistryBlockSlashSearchText(spec: Pick<BlockSpec, "type" | "label" | "description">): string;
10
- /**
11
- * Shared builder for the registry-derived block slash commands both the plan and
12
- * content editors offer. Both apps take every `BlockSpec` whose `placement`
13
- * includes `"block"`, gate it by Notion-compatibility when the open document is
14
- * linked to a Notion page, and emit one slash item per surviving spec that
15
- * inserts that block's atom node. The only legitimate per-app differences are:
16
- *
17
- * - the ITEM SHAPE (plan uses a text-glyph `icon`, content a React component),
18
- * - the Notion-compat PREDICATE (plan unions in prose-only NFM analogs, content
19
- * reads the registry `notionCompatible` flag directly), and
20
- * - the INSERT behavior (plan inserts a `planBlock` node, content a
21
- * `registryBlock` node seeded with inline `__raw`).
22
- *
23
- * Those three are injected; everything else (the `list("block")` source, the
24
- * Notion filter wiring, the one-item-per-spec mapping) lives here so adding a
25
- * new library block only touches the registry, never the slash builders.
26
- */
27
- export interface BuildRegistryBlockSlashItemsOptions<TItem, TEditor> {
28
- /**
29
- * When `true`, only specs the predicate accepts are offered (the open document
30
- * is linked to a Notion page, so blocks that can't round-trip to NFM are
31
- * hidden). When unset/false, every block-placed spec is offered.
32
- */
33
- notionCompatibleOnly?: boolean;
34
- /**
35
- * Decide whether a spec round-trips to Notion. Defaults to the spec's own
36
- * `notionCompatible` flag (content's rule). Plan passes a predicate that unions
37
- * in prose-only NFM analogs not carried as registry flags.
38
- */
39
- isNotionCompatible?: (spec: BlockSpec) => boolean;
40
- /** Build one app-shaped slash item from a surviving block spec. */
41
- toItem: (spec: BlockSpec, insert: (editor: TEditor) => void) => TItem;
42
- /**
43
- * Optional app-level capability gate. Use this for blocks whose schema is
44
- * registered for parse/render compatibility but whose authoring experience is
45
- * not available in this editor yet.
46
- */
47
- includeSpec?: (spec: BlockSpec) => boolean;
48
- /**
49
- * Insert this spec's block atom into the editor. Plan inserts a `planBlock`
50
- * node; content inserts a `registryBlock` node seeded with inline `__raw`.
51
- */
52
- insertBlock: (editor: TEditor, spec: BlockSpec) => void;
53
- }
54
- /**
55
- * Build the registry-derived block slash items, shared by plan and content. Each
56
- * app prepends its own prose/base commands and wraps the result in its own item
57
- * type via {@link BuildRegistryBlockSlashItemsOptions.toItem}.
58
- */
59
- export declare function buildRegistryBlockSlashItems<TItem, TEditor>(registry: BlockRegistry, options: BuildRegistryBlockSlashItemsOptions<TItem, TEditor>): TItem[];
60
- //# sourceMappingURL=registrySlashCommands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registrySlashCommands.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/registrySlashCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAwBnE;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,GAC5C,MAAM,CAKR;AAED,mFAAmF;AACnF,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC,GACtD,MAAM,CAKR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mCAAmC,CAAC,KAAK,EAAE,OAAO;IACjE;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAClD,mEAAmE;IACnE,MAAM,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,KAAK,KAAK,CAAC;IACtE;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC3C;;;OAGG;IACH,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,EACzD,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,mCAAmC,CAAC,KAAK,EAAE,OAAO,CAAC,GAC3D,KAAK,EAAE,CAUT"}