@ecsplico/editor 2.1.2 → 3.0.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 (692) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +39 -156
  3. package/dist/adapters/comments/drizzle.d.ts +1 -1
  4. package/dist/adapters/comments/{client.js → rest-model.js} +3 -3
  5. package/dist/adapters/comments/rest-model.js.map +1 -0
  6. package/dist/adapters/comments/types.d.ts +2 -2
  7. package/dist/adapters/document-state.d.ts +23 -0
  8. package/dist/adapters/document-state.js +66 -0
  9. package/dist/adapters/document-state.js.map +1 -0
  10. package/dist/adapters/documents.js +14 -11
  11. package/dist/adapters/documents.js.map +1 -1
  12. package/dist/adapters/drizzle.d.ts +2 -2
  13. package/dist/adapters/drizzle.js +97 -88
  14. package/dist/adapters/drizzle.js.map +1 -1
  15. package/dist/adapters/forge.d.ts +12 -7
  16. package/dist/adapters/forge.js +38 -45
  17. package/dist/adapters/forge.js.map +1 -1
  18. package/dist/adapters/http.d.ts +20 -0
  19. package/dist/adapters/http.js +68 -0
  20. package/dist/adapters/http.js.map +1 -0
  21. package/dist/adapters/index.d.ts +5 -5
  22. package/dist/adapters/json.d.ts +3 -3
  23. package/dist/adapters/json.js +58 -49
  24. package/dist/adapters/json.js.map +1 -1
  25. package/dist/adapters/memory.d.ts +21 -0
  26. package/dist/adapters/memory.js +53 -0
  27. package/dist/adapters/memory.js.map +1 -0
  28. package/dist/adapters/nitro.d.ts +23 -20
  29. package/dist/adapters/nitro.js +58 -163
  30. package/dist/adapters/nitro.js.map +1 -1
  31. package/dist/adapters/react.d.ts +55 -0
  32. package/dist/adapters/react.js +209 -0
  33. package/dist/adapters/react.js.map +1 -0
  34. package/dist/adapters/shared.d.ts +15 -21
  35. package/dist/adapters/shared.js +10 -8
  36. package/dist/adapters/shared.js.map +1 -1
  37. package/dist/adapters/vue.d.ts +15 -30
  38. package/dist/adapters/vue.js +36 -87
  39. package/dist/adapters/vue.js.map +1 -1
  40. package/dist/config/index.d.ts +105 -0
  41. package/dist/config/index.js +95 -0
  42. package/dist/config/index.js.map +1 -0
  43. package/dist/core/abilities.js +1 -0
  44. package/dist/core/abilities.js.map +1 -1
  45. package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
  46. package/dist/core/api-routes.js.map +1 -0
  47. package/dist/core/backend-capability.d.ts +7 -0
  48. package/dist/core/backend-capability.js +17 -0
  49. package/dist/core/backend-capability.js.map +1 -0
  50. package/dist/core/backend-types.d.ts +245 -0
  51. package/dist/core/backend-types.js +17 -0
  52. package/dist/core/backend-types.js.map +1 -0
  53. package/dist/core/backend.d.ts +108 -0
  54. package/dist/core/backend.js +14 -0
  55. package/dist/core/backend.js.map +1 -0
  56. package/dist/core/block-convert.d.ts +7 -5
  57. package/dist/core/block-convert.js +28 -5
  58. package/dist/core/block-convert.js.map +1 -1
  59. package/dist/core/command-types.d.ts +89 -0
  60. package/dist/core/commands.d.ts +40 -0
  61. package/dist/core/commands.js +151 -0
  62. package/dist/core/commands.js.map +1 -0
  63. package/dist/core/context.d.ts +17 -20
  64. package/dist/core/context.js +24 -21
  65. package/dist/core/context.js.map +1 -1
  66. package/dist/core/core-feature.d.ts +22 -7
  67. package/dist/core/core-feature.js +51 -18
  68. package/dist/core/core-feature.js.map +1 -1
  69. package/dist/core/define-editor.d.ts +4 -3
  70. package/dist/core/define-editor.js +14 -7
  71. package/dist/core/define-editor.js.map +1 -1
  72. package/dist/core/document-markdown.js +12 -3
  73. package/dist/core/document-markdown.js.map +1 -1
  74. package/dist/core/editor-ui.d.ts +8 -1
  75. package/dist/core/editor-ui.js +9 -8
  76. package/dist/core/editor-ui.js.map +1 -1
  77. package/dist/core/extension-points.d.ts +3 -15
  78. package/dist/core/feature-context.d.ts +8 -7
  79. package/dist/core/feature-context.js +12 -11
  80. package/dist/core/feature-context.js.map +1 -1
  81. package/dist/core/feature.d.ts +35 -19
  82. package/dist/core/feature.js.map +1 -1
  83. package/dist/core/fences.d.ts +2 -1
  84. package/dist/core/fences.js +3 -2
  85. package/dist/core/fences.js.map +1 -1
  86. package/dist/core/fetch-error.d.ts +1 -1
  87. package/dist/core/fetch-error.js +3 -1
  88. package/dist/core/fetch-error.js.map +1 -1
  89. package/dist/core/hash.d.ts +5 -0
  90. package/dist/core/hash.js +11 -0
  91. package/dist/core/hash.js.map +1 -0
  92. package/dist/core/http-backend.d.ts +11 -0
  93. package/dist/core/http-backend.js +195 -0
  94. package/dist/core/http-backend.js.map +1 -0
  95. package/dist/core/index.d.ts +14 -9
  96. package/dist/core/index.js +12 -9
  97. package/dist/core/palette.d.ts +48 -0
  98. package/dist/core/palette.js +95 -0
  99. package/dist/core/palette.js.map +1 -0
  100. package/dist/core/schema/abilities.d.ts +2 -1
  101. package/dist/core/schema/abilities.js +5 -1
  102. package/dist/core/schema/abilities.js.map +1 -1
  103. package/dist/core/schema/index.d.ts +11 -5
  104. package/dist/core/schema/index.js +13 -8
  105. package/dist/core/schema/index.js.map +1 -1
  106. package/dist/core/schema/mark-flags.d.ts +8 -1
  107. package/dist/core/schema/of-features.d.ts +13 -0
  108. package/dist/core/schema/of-features.js +14 -0
  109. package/dist/core/schema/of-features.js.map +1 -0
  110. package/dist/core/slash.d.ts +8 -6
  111. package/dist/core/slash.js +24 -16
  112. package/dist/core/slash.js.map +1 -1
  113. package/dist/core/surface-session.js +13 -5
  114. package/dist/core/surface-session.js.map +1 -1
  115. package/dist/core/toolbar-items.d.ts +10 -4
  116. package/dist/core/toolbar-items.js +269 -195
  117. package/dist/core/toolbar-items.js.map +1 -1
  118. package/dist/core/util.js +11 -0
  119. package/dist/core/util.js.map +1 -0
  120. package/dist/document/DocumentSurface.d.ts +1 -1
  121. package/dist/features/ai/agent-op-review.d.ts +1 -1
  122. package/dist/features/ai/agent-op-review.js +1 -1
  123. package/dist/features/ai/agent-ops.js +1 -1
  124. package/dist/features/ai/ai-apply.d.ts +2 -2
  125. package/dist/features/ai/ai-apply.js +1 -1
  126. package/dist/features/ai/ai-review.js +1 -1
  127. package/dist/features/ai/ai-sse.d.ts +6 -6
  128. package/dist/features/ai/ai-sse.js +20 -63
  129. package/dist/features/ai/ai-sse.js.map +1 -1
  130. package/dist/features/ai/assistant.d.ts +8 -7
  131. package/dist/features/ai/assistant.js +3 -3
  132. package/dist/features/ai/assistant.js.map +1 -1
  133. package/dist/features/ai/block-actions.d.ts +3 -2
  134. package/dist/features/ai/block-actions.js +3 -2
  135. package/dist/features/ai/block-actions.js.map +1 -1
  136. package/dist/features/ai/components/AiSelectionMenu.js +1 -1
  137. package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
  138. package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
  139. package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
  140. package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
  141. package/dist/features/ai/document-chat-model.d.ts +8 -7
  142. package/dist/features/ai/document-chat-model.js +5 -5
  143. package/dist/features/ai/document-chat-model.js.map +1 -1
  144. package/dist/features/ai/document-chat.js +1 -1
  145. package/dist/features/ai/feature.js +27 -14
  146. package/dist/features/ai/feature.js.map +1 -1
  147. package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
  148. package/dist/features/ai/ghost-autocomplete.js +6 -9
  149. package/dist/features/ai/ghost-autocomplete.js.map +1 -1
  150. package/dist/features/ai/index.d.ts +4 -3
  151. package/dist/features/ai/index.js +10 -10
  152. package/dist/features/ai/model-profiles.d.ts +5 -4
  153. package/dist/features/ai/model-profiles.js +2 -2
  154. package/dist/features/ai/model-profiles.js.map +1 -1
  155. package/dist/features/ai/protocol/block-lines.js +1 -1
  156. package/dist/features/ai/protocol/block-lines.js.map +1 -1
  157. package/dist/features/ai/protocol/chat.js +4 -1
  158. package/dist/features/ai/protocol/chat.js.map +1 -1
  159. package/dist/features/ai/protocol/index.d.ts +3 -2
  160. package/dist/features/ai/protocol/models.d.ts +2 -16
  161. package/dist/features/ai/protocol/models.js.map +1 -1
  162. package/dist/features/ai/rate-limit.d.ts +1 -1
  163. package/dist/features/ai/rate-limit.js +3 -1
  164. package/dist/features/ai/rate-limit.js.map +1 -1
  165. package/dist/features/ai/react/AiSelectionMenu.js +2 -2
  166. package/dist/features/ai/react/AiSidebar.js +4 -4
  167. package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
  168. package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
  169. package/dist/features/ai/react/DocumentChatOps.js +1 -1
  170. package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
  171. package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
  172. package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
  173. package/dist/features/ai/react/use-ai-assistant.js +3 -3
  174. package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
  175. package/dist/features/ai/react/use-document-chat.js +2 -2
  176. package/dist/features/ai/react/use-document-chat.js.map +1 -1
  177. package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
  178. package/dist/features/ai/selection-flow.d.ts +1 -1
  179. package/dist/features/ai/selection-flow.js +1 -1
  180. package/dist/features/ai/sidebar-flow.d.ts +1 -1
  181. package/dist/features/ai/sidebar-flow.js +1 -1
  182. package/dist/features/ai/use-ai-assistant.d.ts +1 -1
  183. package/dist/features/ai/use-ai-assistant.js +3 -3
  184. package/dist/features/ai/use-ai-assistant.js.map +1 -1
  185. package/dist/features/ai/use-document-chat.js +2 -2
  186. package/dist/features/ai/use-document-chat.js.map +1 -1
  187. package/dist/features/ai/use-model-profiles.d.ts +2 -1
  188. package/dist/features/authors/attribution.d.ts +1 -1
  189. package/dist/features/authors/feature.js +12 -11
  190. package/dist/features/authors/feature.js.map +1 -1
  191. package/dist/features/block-ui/block-actions.d.ts +1 -1
  192. package/dist/features/block-ui/block-actions.js +1 -1
  193. package/dist/features/block-ui/block-actions.js.map +1 -1
  194. package/dist/features/block-ui/components/BlockUi.js +1 -1
  195. package/dist/features/block-ui/feature.js +1 -0
  196. package/dist/features/block-ui/feature.js.map +1 -1
  197. package/dist/features/block-ui/react/BlockUi.js +1 -1
  198. package/dist/features/collab/anchor-resolver.js +1 -1
  199. package/dist/features/collab/feature.js +2 -0
  200. package/dist/features/collab/feature.js.map +1 -1
  201. package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
  202. package/dist/features/comments/feature.js +12 -11
  203. package/dist/features/comments/feature.js.map +1 -1
  204. package/dist/features/comments/index.d.ts +3 -2
  205. package/dist/features/comments/index.js +1 -1
  206. package/dist/features/comments/margin-layout.d.ts +3 -2
  207. package/dist/features/comments/model.d.ts +3 -67
  208. package/dist/features/comments/model.js +2 -2
  209. package/dist/features/comments/model.js.map +1 -1
  210. package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
  211. package/dist/features/comments/react/use-comments.d.ts +2 -1
  212. package/dist/features/comments/react.d.ts +1 -1
  213. package/dist/features/comments/schema.d.ts +2 -52
  214. package/dist/features/comments/schema.js.map +1 -1
  215. package/dist/features/comments/snapshot-equality.js.map +1 -1
  216. package/dist/features/comments/use-comments.d.ts +3 -2
  217. package/dist/features/comments/vue.d.ts +1 -1
  218. package/dist/features/composites/accepted-children.d.ts +1 -0
  219. package/dist/features/composites/accepted-children.js +16 -1
  220. package/dist/features/composites/accepted-children.js.map +1 -1
  221. package/dist/features/composites/ai-brief.js +31 -0
  222. package/dist/features/composites/ai-brief.js.map +1 -1
  223. package/dist/features/composites/bibliography-command.d.ts +11 -0
  224. package/dist/features/composites/bibliography-form.js +90 -0
  225. package/dist/features/composites/bibliography-form.js.map +1 -0
  226. package/dist/features/composites/bibliography.d.ts +33 -0
  227. package/dist/features/composites/bibliography.js +120 -0
  228. package/dist/features/composites/bibliography.js.map +1 -0
  229. package/dist/features/composites/components/BibliographyEditor.js +261 -0
  230. package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
  231. package/dist/features/composites/components/CompositeChrome.js +75 -26
  232. package/dist/features/composites/components/CompositeChrome.js.map +1 -1
  233. package/dist/features/composites/components/CompositeDetails.js +46 -11
  234. package/dist/features/composites/components/CompositeDetails.js.map +1 -1
  235. package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
  236. package/dist/features/composites/components/CompositeFieldEditor.js +37 -4
  237. package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
  238. package/dist/features/composites/components/CompositeInspector.js +17 -5
  239. package/dist/features/composites/components/CompositeInspector.js.map +1 -1
  240. package/dist/features/composites/components/CompositeTable.js +13 -4
  241. package/dist/features/composites/components/CompositeTable.js.map +1 -1
  242. package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
  243. package/dist/features/composites/components/CompositeView.js +11 -1
  244. package/dist/features/composites/components/CompositeView.js.map +1 -1
  245. package/dist/features/composites/components/DerivationBadge.js +103 -0
  246. package/dist/features/composites/components/DerivationBadge.js.map +1 -0
  247. package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
  248. package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
  249. package/dist/features/composites/components/ReferenceView.js +122 -0
  250. package/dist/features/composites/components/ReferenceView.js.map +1 -0
  251. package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
  252. package/dist/features/composites/components/SettingsEditingTab.js +1 -1
  253. package/dist/features/composites/convert.js +2 -2
  254. package/dist/features/composites/convert.js.map +1 -1
  255. package/dist/features/composites/derivation.d.ts +61 -0
  256. package/dist/features/composites/derivation.js +98 -0
  257. package/dist/features/composites/derivation.js.map +1 -0
  258. package/dist/features/composites/derived-chrome.js +69 -0
  259. package/dist/features/composites/derived-chrome.js.map +1 -0
  260. package/dist/features/composites/feature.js +159 -109
  261. package/dist/features/composites/feature.js.map +1 -1
  262. package/dist/features/composites/fences.d.ts +4 -3
  263. package/dist/features/composites/fences.js +51 -7
  264. package/dist/features/composites/fences.js.map +1 -1
  265. package/dist/features/composites/index.d.ts +12 -3
  266. package/dist/features/composites/index.js +15 -6
  267. package/dist/features/composites/inspector-model.d.ts +4 -1
  268. package/dist/features/composites/inspector-model.js +8 -4
  269. package/dist/features/composites/inspector-model.js.map +1 -1
  270. package/dist/features/composites/kinds.d.ts +8 -1
  271. package/dist/features/composites/kinds.js +145 -6
  272. package/dist/features/composites/kinds.js.map +1 -1
  273. package/dist/features/composites/legacy.d.ts +4 -1
  274. package/dist/features/composites/legacy.js +56 -1
  275. package/dist/features/composites/legacy.js.map +1 -1
  276. package/dist/features/composites/meta-display.js +40 -1
  277. package/dist/features/composites/meta-display.js.map +1 -1
  278. package/dist/features/composites/meta-keys.d.ts +7 -0
  279. package/dist/features/composites/meta-keys.js +21 -0
  280. package/dist/features/composites/meta-keys.js.map +1 -0
  281. package/dist/features/composites/node-views.d.ts +6 -3
  282. package/dist/features/composites/node-views.js +7 -3
  283. package/dist/features/composites/node-views.js.map +1 -1
  284. package/dist/features/composites/nodes.d.ts +6 -1
  285. package/dist/features/composites/nodes.js +33 -7
  286. package/dist/features/composites/nodes.js.map +1 -1
  287. package/dist/features/composites/react/BibliographyEditor.js +229 -0
  288. package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
  289. package/dist/features/composites/react/CompositeChrome.js +65 -17
  290. package/dist/features/composites/react/CompositeChrome.js.map +1 -1
  291. package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
  292. package/dist/features/composites/react/CompositeDetails.js +45 -6
  293. package/dist/features/composites/react/CompositeDetails.js.map +1 -1
  294. package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
  295. package/dist/features/composites/react/CompositeFieldEditor.js +24 -1
  296. package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
  297. package/dist/features/composites/react/CompositeInspector.js +11 -5
  298. package/dist/features/composites/react/CompositeInspector.js.map +1 -1
  299. package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
  300. package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
  301. package/dist/features/composites/react/CompositeTable.js +16 -2
  302. package/dist/features/composites/react/CompositeTable.js.map +1 -1
  303. package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
  304. package/dist/features/composites/react/CompositeView.js +6 -1
  305. package/dist/features/composites/react/CompositeView.js.map +1 -1
  306. package/dist/features/composites/react/DerivationBadge.js +116 -0
  307. package/dist/features/composites/react/DerivationBadge.js.map +1 -0
  308. package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
  309. package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
  310. package/dist/features/composites/react/ReferenceView.d.ts +11 -0
  311. package/dist/features/composites/react/ReferenceView.js +115 -0
  312. package/dist/features/composites/react/ReferenceView.js.map +1 -0
  313. package/dist/features/composites/react/SettingsEditingTab.js +2 -2
  314. package/dist/features/composites/react.d.ts +2 -1
  315. package/dist/features/composites/react.js +7 -3
  316. package/dist/features/composites/react.js.map +1 -1
  317. package/dist/features/composites/reference-ai.js +16 -0
  318. package/dist/features/composites/reference-ai.js.map +1 -0
  319. package/dist/features/composites/reference-label.d.ts +19 -0
  320. package/dist/features/composites/reference-label.js +58 -0
  321. package/dist/features/composites/reference-label.js.map +1 -0
  322. package/dist/features/composites/reference-suggestion.d.ts +10 -0
  323. package/dist/features/composites/reference-suggestion.js +41 -0
  324. package/dist/features/composites/reference-suggestion.js.map +1 -0
  325. package/dist/features/composites/reference-text.d.ts +18 -0
  326. package/dist/features/composites/reference-text.js +89 -0
  327. package/dist/features/composites/reference-text.js.map +1 -0
  328. package/dist/features/composites/reference.d.ts +44 -0
  329. package/dist/features/composites/reference.js +148 -0
  330. package/dist/features/composites/reference.js.map +1 -0
  331. package/dist/features/composites/reveal-source.d.ts +32 -0
  332. package/dist/features/composites/reveal-source.js +89 -0
  333. package/dist/features/composites/reveal-source.js.map +1 -0
  334. package/dist/features/composites/rows.d.ts +21 -2
  335. package/dist/features/composites/rows.js +63 -9
  336. package/dist/features/composites/rows.js.map +1 -1
  337. package/dist/features/composites/schema.d.ts +9 -3
  338. package/dist/features/composites/schema.js +11 -4
  339. package/dist/features/composites/schema.js.map +1 -1
  340. package/dist/features/composites/table-model.js +12 -21
  341. package/dist/features/composites/table-model.js.map +1 -1
  342. package/dist/features/composites/vue.d.ts +3 -2
  343. package/dist/features/composites/vue.js +8 -4
  344. package/dist/features/composites/vue.js.map +1 -1
  345. package/dist/features/media/assets.d.ts +2 -0
  346. package/dist/features/media/assets.js +3 -2
  347. package/dist/features/media/assets.js.map +1 -1
  348. package/dist/features/media/components/FileView.js +13 -4
  349. package/dist/features/media/components/FileView.js.map +1 -1
  350. package/dist/features/media/feature.d.ts +3 -3
  351. package/dist/features/media/feature.js +21 -28
  352. package/dist/features/media/feature.js.map +1 -1
  353. package/dist/features/media/file-import.js +2 -2
  354. package/dist/features/media/file-import.js.map +1 -1
  355. package/dist/features/media/index.d.ts +2 -2
  356. package/dist/features/media/index.js +2 -2
  357. package/dist/features/media/react/FileView.js +19 -2
  358. package/dist/features/media/react/FileView.js.map +1 -1
  359. package/dist/features/media/schema.d.ts +8 -0
  360. package/dist/features/media/schema.js +126 -11
  361. package/dist/features/media/schema.js.map +1 -1
  362. package/dist/features/media/upload.d.ts +16 -14
  363. package/dist/features/media/upload.js +13 -19
  364. package/dist/features/media/upload.js.map +1 -1
  365. package/dist/features/mentions/index.d.ts +4 -3
  366. package/dist/features/mentions/index.js +4 -1
  367. package/dist/features/mentions/index.js.map +1 -1
  368. package/dist/features/mentions/mention-text.d.ts +1 -1
  369. package/dist/features/mentions/mention-text.js.map +1 -1
  370. package/dist/features/mentions/mention.d.ts +0 -6
  371. package/dist/features/mentions/mention.js.map +1 -1
  372. package/dist/features/mentions/metadata-defaults.d.ts +2 -2
  373. package/dist/features/mentions/metadata-defaults.js +3 -9
  374. package/dist/features/mentions/metadata-defaults.js.map +1 -1
  375. package/dist/features/mentions/schema.d.ts +2 -1
  376. package/dist/features/mentions/schema.js.map +1 -1
  377. package/dist/features/tables/feature.d.ts +2 -1
  378. package/dist/features/tables/feature.js +90 -70
  379. package/dist/features/tables/feature.js.map +1 -1
  380. package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
  381. package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
  382. package/dist/features/themes/feature.js +2 -0
  383. package/dist/features/themes/feature.js.map +1 -1
  384. package/dist/features/themes/index.d.ts +2 -1
  385. package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
  386. package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
  387. package/dist/features/themes/schema.d.ts +2 -6
  388. package/dist/features/themes/schema.js.map +1 -1
  389. package/dist/features/themes/theme-runtime.d.ts +1 -1
  390. package/dist/features/themes/theme-runtime.js +4 -2
  391. package/dist/features/themes/theme-runtime.js.map +1 -1
  392. package/dist/features/transcript/TranscriptSegmentView.js +48 -28
  393. package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
  394. package/dist/features/transcript/feature.js +21 -19
  395. package/dist/features/transcript/feature.js.map +1 -1
  396. package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
  397. package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
  398. package/dist/features/transcript/segment-node.d.ts +2 -0
  399. package/dist/features/transcript/segment-node.js +35 -7
  400. package/dist/features/transcript/segment-node.js.map +1 -1
  401. package/dist/i18n/de/composites.js +91 -1
  402. package/dist/i18n/de/composites.js.map +1 -1
  403. package/dist/i18n/de/integrations.js +49 -8
  404. package/dist/i18n/de/integrations.js.map +1 -1
  405. package/dist/i18n/de/media.js +0 -1
  406. package/dist/i18n/de/media.js.map +1 -1
  407. package/dist/i18n/de/palette.js +22 -0
  408. package/dist/i18n/de/palette.js.map +1 -0
  409. package/dist/i18n/de/tables.js +0 -1
  410. package/dist/i18n/de/tables.js.map +1 -1
  411. package/dist/i18n/de/transcript.js +2 -1
  412. package/dist/i18n/de/transcript.js.map +1 -1
  413. package/dist/i18n/de/tree.js +3 -0
  414. package/dist/i18n/de/tree.js.map +1 -1
  415. package/dist/i18n/de.d.ts +157 -11
  416. package/dist/i18n/de.js +3 -1
  417. package/dist/i18n/de.js.map +1 -1
  418. package/dist/i18n/en/composites.js +89 -1
  419. package/dist/i18n/en/composites.js.map +1 -1
  420. package/dist/i18n/en/integrations.js +49 -8
  421. package/dist/i18n/en/integrations.js.map +1 -1
  422. package/dist/i18n/en/media.js +0 -1
  423. package/dist/i18n/en/media.js.map +1 -1
  424. package/dist/i18n/en/palette.js +22 -0
  425. package/dist/i18n/en/palette.js.map +1 -0
  426. package/dist/i18n/en/tables.js +0 -1
  427. package/dist/i18n/en/tables.js.map +1 -1
  428. package/dist/i18n/en/transcript.js +2 -1
  429. package/dist/i18n/en/transcript.js.map +1 -1
  430. package/dist/i18n/en/tree.js +3 -0
  431. package/dist/i18n/en/tree.js.map +1 -1
  432. package/dist/i18n/en.js +3 -1
  433. package/dist/i18n/en.js.map +1 -1
  434. package/dist/index.d.ts +4 -3
  435. package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
  436. package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
  437. package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
  438. package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
  439. package/dist/integrations/composite-ai/composite-fill.js +97 -56
  440. package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
  441. package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
  442. package/dist/integrations/composite-ai/composite-summary.js +7 -26
  443. package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
  444. package/dist/integrations/composite-ai/derive.d.ts +29 -0
  445. package/dist/integrations/composite-ai/derive.js +173 -0
  446. package/dist/integrations/composite-ai/derive.js.map +1 -0
  447. package/dist/integrations/composite-ai/index.d.ts +11 -7
  448. package/dist/integrations/composite-ai/index.js +72 -14
  449. package/dist/integrations/composite-ai/index.js.map +1 -1
  450. package/dist/integrations/composite-ai/rendition.d.ts +45 -0
  451. package/dist/integrations/composite-ai/rendition.js +314 -0
  452. package/dist/integrations/composite-ai/rendition.js.map +1 -0
  453. package/dist/integrations/composite-media/index.d.ts +7 -5
  454. package/dist/integrations/composite-media/index.js +86 -13
  455. package/dist/integrations/composite-media/index.js.map +1 -1
  456. package/dist/integrations/transcript-ai/index.d.ts +1 -1
  457. package/dist/integrations/transcript-ai/index.js +5 -2
  458. package/dist/integrations/transcript-ai/index.js.map +1 -1
  459. package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
  460. package/dist/integrations/transcript-ai/protocol.js +0 -2
  461. package/dist/integrations/transcript-ai/protocol.js.map +1 -1
  462. package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
  463. package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
  464. package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
  465. package/dist/markdown/MarkdownSurface.vue.d.ts +6 -5
  466. package/dist/markdown/MarkdownSurface2.js +3 -6
  467. package/dist/markdown/MarkdownSurface2.js.map +1 -1
  468. package/dist/markdown/document.js +1 -1
  469. package/dist/markdown/source-mode.d.ts +1 -1
  470. package/dist/nuxt/module.d.ts +1402 -54
  471. package/dist/nuxt/module.js +6 -49
  472. package/dist/nuxt/module.js.map +1 -1
  473. package/dist/nuxt/runtime/install-context.d.ts +7 -3
  474. package/dist/nuxt/runtime/install-context.js +14 -8
  475. package/dist/nuxt/runtime/install-context.js.map +1 -1
  476. package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
  477. package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
  478. package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
  479. package/dist/presets/compose.d.ts +94 -0
  480. package/dist/presets/compose.js +164 -0
  481. package/dist/presets/compose.js.map +1 -0
  482. package/dist/react/AdvancedEditor.d.ts +15 -15
  483. package/dist/react/AdvancedEditor.js +15 -13
  484. package/dist/react/AdvancedEditor.js.map +1 -1
  485. package/dist/react/EditorCommandPalette.d.ts +13 -0
  486. package/dist/react/EditorCommandPalette.js +118 -0
  487. package/dist/react/EditorCommandPalette.js.map +1 -0
  488. package/dist/react/EditorSettingsModal.d.ts +5 -5
  489. package/dist/react/EditorSettingsModal.js +7 -4
  490. package/dist/react/EditorSettingsModal.js.map +1 -1
  491. package/dist/react/EditorSettingsPanel.d.ts +7 -7
  492. package/dist/react/EditorSettingsPanel.js +8 -5
  493. package/dist/react/EditorSettingsPanel.js.map +1 -1
  494. package/dist/react/EditorSurface.d.ts +7 -7
  495. package/dist/react/EditorSurface.js +10 -6
  496. package/dist/react/EditorSurface.js.map +1 -1
  497. package/dist/react/EditorToolbar.d.ts +4 -6
  498. package/dist/react/EditorToolbar.js +29 -37
  499. package/dist/react/EditorToolbar.js.map +1 -1
  500. package/dist/react/SimpleEditor.d.ts +22 -23
  501. package/dist/react/SimpleEditor.js +21 -7
  502. package/dist/react/SimpleEditor.js.map +1 -1
  503. package/dist/react/advanced.d.ts +4 -3
  504. package/dist/react/advanced.js +2 -2
  505. package/dist/react/compose.d.ts +20 -0
  506. package/dist/react/compose.js +49 -0
  507. package/dist/react/compose.js.map +1 -0
  508. package/dist/react/composed-surface.d.ts +39 -0
  509. package/dist/react/composed-surface.js +71 -0
  510. package/dist/react/composed-surface.js.map +1 -0
  511. package/dist/react/context.js +6 -2
  512. package/dist/react/context.js.map +1 -1
  513. package/dist/react/index.d.ts +2 -1
  514. package/dist/react/index.js +2 -1
  515. package/dist/react/key-labels.js +15 -0
  516. package/dist/react/key-labels.js.map +1 -0
  517. package/dist/react/settings.d.ts +1 -1
  518. package/dist/react/simple.d.ts +2 -2
  519. package/dist/react/ui/command.js +36 -1
  520. package/dist/react/ui/command.js.map +1 -1
  521. package/dist/schema/advanced.d.ts +6 -6
  522. package/dist/schema/advanced.js +26 -29
  523. package/dist/schema/advanced.js.map +1 -1
  524. package/dist/server/ai.d.ts +5 -16
  525. package/dist/server/ai.js.map +1 -1
  526. package/dist/server/auth.d.ts +9 -0
  527. package/dist/server/collab-state.d.ts +1 -1
  528. package/dist/server/collab-state.js.map +1 -1
  529. package/dist/server/collab.d.ts +13 -13
  530. package/dist/server/collab.js +34 -18
  531. package/dist/server/collab.js.map +1 -1
  532. package/dist/server/crossref.js +78 -0
  533. package/dist/server/crossref.js.map +1 -0
  534. package/dist/server/errors.d.ts +1 -1
  535. package/dist/server/errors.js +1 -1
  536. package/dist/server/errors.js.map +1 -1
  537. package/dist/server/extract.js +308 -0
  538. package/dist/server/extract.js.map +1 -0
  539. package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
  540. package/dist/server/h3.js.map +1 -0
  541. package/dist/server/handlers/ai.d.ts +30 -9
  542. package/dist/server/handlers/ai.js +170 -36
  543. package/dist/server/handlers/ai.js.map +1 -1
  544. package/dist/server/handlers/context.d.ts +12 -5
  545. package/dist/server/handlers/context.js +10 -4
  546. package/dist/server/handlers/context.js.map +1 -1
  547. package/dist/server/handlers/editor.d.ts +19 -13
  548. package/dist/server/handlers/editor.js +49 -38
  549. package/dist/server/handlers/editor.js.map +1 -1
  550. package/dist/server/handlers/index.d.ts +4 -4
  551. package/dist/server/handlers/index.js +4 -4
  552. package/dist/server/host.d.ts +16 -25
  553. package/dist/server/host.js +58 -41
  554. package/dist/server/host.js.map +1 -1
  555. package/dist/server/index.d.ts +6 -4
  556. package/dist/server/index.js +3 -2
  557. package/dist/server/pdf.js +97 -0
  558. package/dist/server/pdf.js.map +1 -0
  559. package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
  560. package/dist/server/ports.js +29 -0
  561. package/dist/server/ports.js.map +1 -0
  562. package/dist/server/routes.js +144 -0
  563. package/dist/server/routes.js.map +1 -0
  564. package/dist/settings/index.d.ts +1 -1
  565. package/dist/settings/index.js.map +1 -1
  566. package/dist/styles/composites.css +25 -0
  567. package/dist/tree/DocumentTree.js +56 -29
  568. package/dist/tree/DocumentTree.js.map +1 -1
  569. package/dist/tree/react/DocumentTree.js +23 -0
  570. package/dist/tree/react/DocumentTree.js.map +1 -1
  571. package/dist/tree/tree-host.js +2 -2
  572. package/dist/tree/tree-items.js +1 -1
  573. package/dist/vue/AdvancedEditor.js +30 -9
  574. package/dist/vue/AdvancedEditor.js.map +1 -1
  575. package/dist/vue/AdvancedEditor.vue.d.ts +28 -8
  576. package/dist/vue/SimpleEditor.js +62 -16
  577. package/dist/vue/SimpleEditor.js.map +1 -1
  578. package/dist/vue/SimpleEditor.vue.d.ts +37 -7
  579. package/dist/vue/advanced.d.ts +3 -2
  580. package/dist/vue/advanced.js +2 -2
  581. package/dist/vue/components/EditorCommandPalette.js +91 -0
  582. package/dist/vue/components/EditorCommandPalette.js.map +1 -0
  583. package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
  584. package/dist/vue/components/EditorSettingsModal.js +10 -6
  585. package/dist/vue/components/EditorSettingsModal.js.map +1 -1
  586. package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
  587. package/dist/vue/components/EditorSettingsPanel.js +10 -6
  588. package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
  589. package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
  590. package/dist/vue/components/EditorSurface.js +11 -6
  591. package/dist/vue/components/EditorSurface.js.map +1 -1
  592. package/dist/vue/components/EditorSurface.vue.d.ts +7 -7
  593. package/dist/vue/components/EditorToolbar.js +41 -49
  594. package/dist/vue/components/EditorToolbar.js.map +1 -1
  595. package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
  596. package/dist/vue/compose.d.ts +17 -0
  597. package/dist/vue/compose.js +51 -0
  598. package/dist/vue/compose.js.map +1 -0
  599. package/dist/vue/context-key.d.ts +6 -0
  600. package/dist/vue/context-key.js +6 -0
  601. package/dist/vue/context-key.js.map +1 -0
  602. package/dist/vue/context.d.ts +8 -6
  603. package/dist/vue/context.js +6 -5
  604. package/dist/vue/context.js.map +1 -1
  605. package/dist/vue/index.d.ts +10 -8
  606. package/dist/vue/index.js +10 -8
  607. package/dist/vue/kit/index.d.ts +2 -2
  608. package/dist/vue/kit/nuxt-ui.js +23 -0
  609. package/dist/vue/kit/nuxt-ui.js.map +1 -1
  610. package/dist/vue/kit/types.d.ts +40 -1
  611. package/package.json +30 -16
  612. package/dist/adapters/comments/client.d.ts +0 -64
  613. package/dist/adapters/comments/client.js.map +0 -1
  614. package/dist/adapters/routes.js.map +0 -1
  615. package/dist/core/toolbar.d.ts +0 -74
  616. package/dist/core/toolbar.js +0 -45
  617. package/dist/core/toolbar.js.map +0 -1
  618. package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
  619. package/dist/integrations/composite-ai/document-transcribe.js +0 -89
  620. package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
  621. package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
  622. package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
  623. package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
  624. package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
  625. package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
  626. package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
  627. package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
  628. package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
  629. package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
  630. package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
  631. package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
  632. package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
  633. package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
  634. package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
  635. package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
  636. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
  637. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
  638. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
  639. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
  640. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
  641. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
  642. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
  643. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
  644. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
  645. package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
  646. package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
  647. package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
  648. package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
  649. package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
  650. package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
  651. package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
  652. package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
  653. package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
  654. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
  655. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
  656. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
  657. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
  658. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
  659. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
  660. package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
  661. package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
  662. package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
  663. package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
  664. package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
  665. package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
  666. package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
  667. package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
  668. package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
  669. package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
  670. package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
  671. package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
  672. package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
  673. package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
  674. package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
  675. package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
  676. package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
  677. package/dist/presets/advanced.d.ts +0 -33
  678. package/dist/presets/advanced.js +0 -50
  679. package/dist/presets/advanced.js.map +0 -1
  680. package/dist/presets/simple.d.ts +0 -9
  681. package/dist/presets/simple.js +0 -12
  682. package/dist/presets/simple.js.map +0 -1
  683. package/dist/react/advanced-preset.d.ts +0 -11
  684. package/dist/react/advanced-preset.js +0 -31
  685. package/dist/react/advanced-preset.js.map +0 -1
  686. package/dist/vue/advanced-preset.d.ts +0 -13
  687. package/dist/vue/advanced-preset.js +0 -33
  688. package/dist/vue/advanced-preset.js.map +0 -1
  689. package/docs/extending.md +0 -538
  690. package/docs/integration.md +0 -632
  691. package/docs/llms.md +0 -383
  692. package/docs/usage.md +0 -1076
@@ -3,7 +3,6 @@ const en = {
3
3
  "media.picker.image": "Image",
4
4
  "media.picker.audio": "Audio file",
5
5
  "media.picker.video": "Video",
6
- "media.toolbar.record": "Recording",
7
6
  "media.slash.record": "Record audio",
8
7
  "media.import.tooLarge.title": "File too large",
9
8
  "media.import.tooLarge.description": "{name}: Text files may be at most 2 MB.",
@@ -1 +1 @@
1
- {"version":3,"file":"media.js","names":[],"sources":["../../../src/i18n/en/media.ts"],"sourcesContent":["import type { de } from '../de/media'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'media.picker.image': 'Image',\n 'media.picker.audio': 'Audio file',\n 'media.picker.video': 'Video',\n 'media.toolbar.record': 'Recording',\n 'media.slash.record': 'Record audio',\n 'media.import.tooLarge.title': 'File too large',\n 'media.import.tooLarge.description': '{name}: Text files may be at most 2 MB.',\n 'media.import.failed': 'Import failed',\n 'media.view.title': 'Title',\n 'media.view.fileName': 'File name',\n 'media.view.open': 'Open',\n 'media.recorder.title': 'Record audio',\n 'media.recorder.failed': 'Recording failed',\n 'media.recorder.denied': 'Microphone access denied',\n 'media.recorder.unsupported': 'This browser does not support recording',\n 'media.recorder.duration': 'Recording duration',\n 'media.recorder.cancel': 'Cancel',\n 'media.recorder.stopInsert': 'Stop & insert',\n 'media.recorder.retry': 'Upload again',\n 'media.recorder.start': 'Start recording',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,sBAAsB;CACtB,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACxB,sBAAsB;CACtB,+BAA+B;CAC/B,qCAAqC;CACrC,uBAAuB;CACvB,oBAAoB;CACpB,uBAAuB;CACvB,mBAAmB;CACnB,wBAAwB;CACxB,yBAAyB;CACzB,yBAAyB;CACzB,8BAA8B;CAC9B,2BAA2B;CAC3B,yBAAyB;CACzB,6BAA6B;CAC7B,wBAAwB;CACxB,wBAAwB;AAC1B"}
1
+ {"version":3,"file":"media.js","names":[],"sources":["../../../src/i18n/en/media.ts"],"sourcesContent":["import type { de } from '../de/media'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'media.picker.image': 'Image',\n 'media.picker.audio': 'Audio file',\n 'media.picker.video': 'Video',\n 'media.slash.record': 'Record audio',\n 'media.import.tooLarge.title': 'File too large',\n 'media.import.tooLarge.description': '{name}: Text files may be at most 2 MB.',\n 'media.import.failed': 'Import failed',\n 'media.view.title': 'Title',\n 'media.view.fileName': 'File name',\n 'media.view.open': 'Open',\n 'media.recorder.title': 'Record audio',\n 'media.recorder.failed': 'Recording failed',\n 'media.recorder.denied': 'Microphone access denied',\n 'media.recorder.unsupported': 'This browser does not support recording',\n 'media.recorder.duration': 'Recording duration',\n 'media.recorder.cancel': 'Cancel',\n 'media.recorder.stopInsert': 'Stop & insert',\n 'media.recorder.retry': 'Upload again',\n 'media.recorder.start': 'Start recording',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,sBAAsB;CACtB,sBAAsB;CACtB,sBAAsB;CACtB,sBAAsB;CACtB,+BAA+B;CAC/B,qCAAqC;CACrC,uBAAuB;CACvB,oBAAoB;CACpB,uBAAuB;CACvB,mBAAmB;CACnB,wBAAwB;CACxB,yBAAyB;CACzB,yBAAyB;CACzB,8BAA8B;CAC9B,2BAA2B;CAC3B,yBAAyB;CACzB,6BAA6B;CAC7B,wBAAwB;CACxB,wBAAwB;AAC1B"}
@@ -0,0 +1,22 @@
1
+ //#region src/i18n/en/palette.ts
2
+ const en = {
3
+ "palette.title": "Commands",
4
+ "palette.description": "Search and run editor commands",
5
+ "palette.placeholder": "Search commands …",
6
+ "palette.empty": "No command found",
7
+ "palette.back": "Back",
8
+ "palette.group.history": "History",
9
+ "palette.group.blockType": "Text style",
10
+ "palette.group.marks": "Formatting",
11
+ "palette.group.blocks": "Blocks",
12
+ "palette.group.inserts": "Insert",
13
+ "palette.group.collaboration": "Collaboration",
14
+ "palette.group.composites": "Building blocks",
15
+ "palette.group.table": "Table",
16
+ "palette.group.ai": "AI",
17
+ "palette.group.other": "More commands"
18
+ };
19
+ //#endregion
20
+ export { en };
21
+
22
+ //# sourceMappingURL=palette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"palette.js","names":[],"sources":["../../../src/i18n/en/palette.ts"],"sourcesContent":["import type { de } from '../de/palette'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'palette.title': 'Commands',\n 'palette.description': 'Search and run editor commands',\n 'palette.placeholder': 'Search commands …',\n 'palette.empty': 'No command found',\n 'palette.back': 'Back',\n 'palette.group.history': 'History',\n 'palette.group.blockType': 'Text style',\n 'palette.group.marks': 'Formatting',\n 'palette.group.blocks': 'Blocks',\n 'palette.group.inserts': 'Insert',\n 'palette.group.collaboration': 'Collaboration',\n 'palette.group.composites': 'Building blocks',\n 'palette.group.table': 'Table',\n 'palette.group.ai': 'AI',\n 'palette.group.other': 'More commands',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,iBAAiB;CACjB,uBAAuB;CACvB,uBAAuB;CACvB,iBAAiB;CACjB,gBAAgB;CAChB,yBAAyB;CACzB,2BAA2B;CAC3B,uBAAuB;CACvB,wBAAwB;CACxB,yBAAyB;CACzB,+BAA+B;CAC/B,4BAA4B;CAC5B,uBAAuB;CACvB,oBAAoB;CACpB,uBAAuB;AACzB"}
@@ -6,7 +6,6 @@ const en = {
6
6
  "tables.toolbar.deleteRow": "Delete row",
7
7
  "tables.toolbar.deleteColumn": "Delete column",
8
8
  "tables.toolbar.deleteTable": "Delete table",
9
- "tables.slash.table": "Table",
10
9
  "tables.slash.tasks": "Task list"
11
10
  };
12
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"tables.js","names":[],"sources":["../../../src/i18n/en/tables.ts"],"sourcesContent":["import type { de } from '../de/tables'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'tables.toolbar.insert': 'Insert table (3×3)',\n 'tables.toolbar.addRow': 'Add row',\n 'tables.toolbar.addColumn': 'Add column',\n 'tables.toolbar.deleteRow': 'Delete row',\n 'tables.toolbar.deleteColumn': 'Delete column',\n 'tables.toolbar.deleteTable': 'Delete table',\n 'tables.slash.table': 'Table',\n 'tables.slash.tasks': 'Task list',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,yBAAyB;CACzB,yBAAyB;CACzB,4BAA4B;CAC5B,4BAA4B;CAC5B,+BAA+B;CAC/B,8BAA8B;CAC9B,sBAAsB;CACtB,sBAAsB;AACxB"}
1
+ {"version":3,"file":"tables.js","names":[],"sources":["../../../src/i18n/en/tables.ts"],"sourcesContent":["import type { de } from '../de/tables'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'tables.toolbar.insert': 'Insert table (3×3)',\n 'tables.toolbar.addRow': 'Add row',\n 'tables.toolbar.addColumn': 'Add column',\n 'tables.toolbar.deleteRow': 'Delete row',\n 'tables.toolbar.deleteColumn': 'Delete column',\n 'tables.toolbar.deleteTable': 'Delete table',\n 'tables.slash.tasks': 'Task list',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,yBAAyB;CACzB,yBAAyB;CACzB,4BAA4B;CAC5B,4BAA4B;CAC5B,+BAA+B;CAC/B,8BAA8B;CAC9B,sBAAsB;AACxB"}
@@ -2,7 +2,8 @@
2
2
  const en = {
3
3
  "transcript.toolbar.speaker": "Speaker block",
4
4
  "transcript.convert.speakerLine": "Speaker line",
5
- "transcript.speaker": "Speaker"
5
+ "transcript.speaker": "Speaker",
6
+ "transcript.seek": "Jump to {time} in the recording"
6
7
  };
7
8
  //#endregion
8
9
  export { en };
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.js","names":[],"sources":["../../../src/i18n/en/transcript.ts"],"sourcesContent":["import type { de } from '../de/transcript'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'transcript.toolbar.speaker': 'Speaker block',\n 'transcript.convert.speakerLine': 'Speaker line',\n 'transcript.speaker': 'Speaker',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,8BAA8B;CAC9B,kCAAkC;CAClC,sBAAsB;AACxB"}
1
+ {"version":3,"file":"transcript.js","names":[],"sources":["../../../src/i18n/en/transcript.ts"],"sourcesContent":["import type { de } from '../de/transcript'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'transcript.toolbar.speaker': 'Speaker block',\n 'transcript.convert.speakerLine': 'Speaker line',\n 'transcript.speaker': 'Speaker',\n 'transcript.seek': 'Jump to {time} in the recording',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,8BAA8B;CAC9B,kCAAkC;CAClC,sBAAsB;CACtB,mBAAmB;AACrB"}
@@ -27,6 +27,9 @@ const en = {
27
27
  "tree.filterText.placeholder": "Filter by title",
28
28
  "tree.filterText.clear": "Clear title filter",
29
29
  "tree.noMatches": "No matches",
30
+ "tree.root.folders": "Folders",
31
+ "tree.root.file": "File as root",
32
+ "tree.root.unavailable": "Only with an open building-block file (setting “Structure: building blocks”).",
30
33
  "tree.drop.nothing": "Nothing is being dragged.",
31
34
  "tree.drop.noDocumentMove": "Documents and folders cannot be moved inside the open document.",
32
35
  "tree.drop.foldersOnly": "Only folders accept entries.",
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","names":[],"sources":["../../../src/i18n/en/tree.ts"],"sourcesContent":["import type { de } from '../de/tree'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'tree.aria': 'Documents',\n 'tree.loading': 'Loading…',\n 'tree.loadFailed': 'Documents could not be loaded',\n 'tree.empty': 'No documents yet',\n 'tree.rootFallback': 'Document',\n 'tree.untitled': '(untitled)',\n 'tree.summary': 'Has a summary',\n 'tree.filter.show': 'Show',\n 'tree.filter.title': 'Filter view',\n 'tree.filter.reset': 'Reset filter',\n 'tree.add': 'Add',\n 'tree.delete': 'Delete',\n 'tree.menu.newDocument': 'New document',\n 'tree.menu.newFolder': 'New folder',\n 'tree.menu.newSubfolder': 'New subfolder',\n 'tree.menu.newCompositeFolder': 'New folder block',\n 'tree.menu.importFile': 'Import file…',\n 'tree.menu.rename': 'Rename',\n 'tree.folder.name': 'Folder name',\n 'tree.folder.placeholder': 'New folder',\n 'tree.folder.placeholderIn': 'New folder in {parent}',\n 'tree.folder.renameFailed': 'Folder not renamed',\n 'tree.removed': 'Document deleted',\n 'tree.undo': 'Undo',\n 'tree.filterText.placeholder': 'Filter by title',\n 'tree.filterText.clear': 'Clear title filter',\n 'tree.noMatches': 'No matches',\n\n 'tree.drop.nothing': 'Nothing is being dragged.',\n 'tree.drop.noDocumentMove': 'Documents and folders cannot be moved inside the open document.',\n 'tree.drop.foldersOnly': 'Only folders accept entries.',\n 'tree.drop.documentInFolder': 'The document is already in this folder.',\n 'tree.drop.folderIntoSelf': 'A folder cannot be moved into itself or one of its subfolders.',\n 'tree.drop.folderInFolder': 'The folder is already in this folder.',\n 'tree.drop.blocksOnlyInDocument': 'Building blocks can only be moved within the open document.',\n 'tree.drop.noBlocksHere': 'Building blocks cannot be dropped here.',\n 'tree.drop.blockWithoutId': 'This building block has no ID yet and cannot be addressed as a target.',\n 'tree.drop.editorClosed': 'The editor is no longer open.',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,aAAa;CACb,gBAAgB;CAChB,mBAAmB;CACnB,cAAc;CACd,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;CAChB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,YAAY;CACZ,eAAe;CACf,yBAAyB;CACzB,uBAAuB;CACvB,0BAA0B;CAC1B,gCAAgC;CAChC,wBAAwB;CACxB,oBAAoB;CACpB,oBAAoB;CACpB,2BAA2B;CAC3B,6BAA6B;CAC7B,4BAA4B;CAC5B,gBAAgB;CAChB,aAAa;CACb,+BAA+B;CAC/B,yBAAyB;CACzB,kBAAkB;CAElB,qBAAqB;CACrB,4BAA4B;CAC5B,yBAAyB;CACzB,8BAA8B;CAC9B,4BAA4B;CAC5B,4BAA4B;CAC5B,kCAAkC;CAClC,0BAA0B;CAC1B,4BAA4B;CAC5B,0BAA0B;AAC5B"}
1
+ {"version":3,"file":"tree.js","names":[],"sources":["../../../src/i18n/en/tree.ts"],"sourcesContent":["import type { de } from '../de/tree'\n\nexport const en: { [K in keyof typeof de]: string } = {\n 'tree.aria': 'Documents',\n 'tree.loading': 'Loading…',\n 'tree.loadFailed': 'Documents could not be loaded',\n 'tree.empty': 'No documents yet',\n 'tree.rootFallback': 'Document',\n 'tree.untitled': '(untitled)',\n 'tree.summary': 'Has a summary',\n 'tree.filter.show': 'Show',\n 'tree.filter.title': 'Filter view',\n 'tree.filter.reset': 'Reset filter',\n 'tree.add': 'Add',\n 'tree.delete': 'Delete',\n 'tree.menu.newDocument': 'New document',\n 'tree.menu.newFolder': 'New folder',\n 'tree.menu.newSubfolder': 'New subfolder',\n 'tree.menu.newCompositeFolder': 'New folder block',\n 'tree.menu.importFile': 'Import file…',\n 'tree.menu.rename': 'Rename',\n 'tree.folder.name': 'Folder name',\n 'tree.folder.placeholder': 'New folder',\n 'tree.folder.placeholderIn': 'New folder in {parent}',\n 'tree.folder.renameFailed': 'Folder not renamed',\n 'tree.removed': 'Document deleted',\n 'tree.undo': 'Undo',\n 'tree.filterText.placeholder': 'Filter by title',\n 'tree.filterText.clear': 'Clear title filter',\n 'tree.noMatches': 'No matches',\n 'tree.root.folders': 'Folders',\n 'tree.root.file': 'File as root',\n 'tree.root.unavailable': 'Only with an open building-block file (setting “Structure: building blocks”).',\n\n 'tree.drop.nothing': 'Nothing is being dragged.',\n 'tree.drop.noDocumentMove': 'Documents and folders cannot be moved inside the open document.',\n 'tree.drop.foldersOnly': 'Only folders accept entries.',\n 'tree.drop.documentInFolder': 'The document is already in this folder.',\n 'tree.drop.folderIntoSelf': 'A folder cannot be moved into itself or one of its subfolders.',\n 'tree.drop.folderInFolder': 'The folder is already in this folder.',\n 'tree.drop.blocksOnlyInDocument': 'Building blocks can only be moved within the open document.',\n 'tree.drop.noBlocksHere': 'Building blocks cannot be dropped here.',\n 'tree.drop.blockWithoutId': 'This building block has no ID yet and cannot be addressed as a target.',\n 'tree.drop.editorClosed': 'The editor is no longer open.',\n}\n"],"mappings":";AAEA,MAAa,KAAyC;CACpD,aAAa;CACb,gBAAgB;CAChB,mBAAmB;CACnB,cAAc;CACd,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;CAChB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,YAAY;CACZ,eAAe;CACf,yBAAyB;CACzB,uBAAuB;CACvB,0BAA0B;CAC1B,gCAAgC;CAChC,wBAAwB;CACxB,oBAAoB;CACpB,oBAAoB;CACpB,2BAA2B;CAC3B,6BAA6B;CAC7B,4BAA4B;CAC5B,gBAAgB;CAChB,aAAa;CACb,+BAA+B;CAC/B,yBAAyB;CACzB,kBAAkB;CAClB,qBAAqB;CACrB,kBAAkB;CAClB,yBAAyB;CAEzB,qBAAqB;CACrB,4BAA4B;CAC5B,yBAAyB;CACzB,8BAA8B;CAC9B,4BAA4B;CAC5B,4BAA4B;CAC5B,kCAAkC;CAClC,0BAA0B;CAC1B,4BAA4B;CAC5B,0BAA0B;AAC5B"}
package/dist/i18n/en.js CHANGED
@@ -15,6 +15,7 @@ import { en as en$14 } from "./en/outline.js";
15
15
  import { en as en$15 } from "./en/mentions.js";
16
16
  import { en as en$16 } from "./en/integrations.js";
17
17
  import { en as en$17 } from "./en/markdown.js";
18
+ import { en as en$18 } from "./en/palette.js";
18
19
  //#region src/i18n/en.ts
19
20
  /** The English catalog: the same keys as `de`, checked per area file. */
20
21
  const en = {
@@ -34,7 +35,8 @@ const en = {
34
35
  ...en$14,
35
36
  ...en$15,
36
37
  ...en$16,
37
- ...en$17
38
+ ...en$17,
39
+ ...en$18
38
40
  };
39
41
  //#endregion
40
42
  export { en };
@@ -1 +1 @@
1
- {"version":3,"file":"en.js","names":["common","toolbar","block","settings","ai","comments","authors","composites","media","themes","tree","transcript","tables","outline","mentions","integrations","markdown"],"sources":["../../src/i18n/en.ts"],"sourcesContent":["import { en as common } from './en/common'\nimport { en as toolbar } from './en/toolbar'\nimport { en as block } from './en/block'\nimport { en as settings } from './en/settings'\nimport { en as ai } from './en/ai'\nimport { en as comments } from './en/comments'\nimport { en as authors } from './en/authors'\nimport { en as composites } from './en/composites'\nimport { en as media } from './en/media'\nimport { en as themes } from './en/themes'\nimport { en as tree } from './en/tree'\nimport { en as transcript } from './en/transcript'\nimport { en as tables } from './en/tables'\nimport { en as outline } from './en/outline'\nimport { en as mentions } from './en/mentions'\nimport { en as integrations } from './en/integrations'\nimport { en as markdown } from './en/markdown'\nimport type { de } from './de'\n\n/** The English catalog: the same keys as `de`, checked per area file. */\nexport const en: { [K in keyof typeof de]: string } = {\n ...common,\n ...toolbar,\n ...block,\n ...settings,\n ...ai,\n ...comments,\n ...authors,\n ...composites,\n ...media,\n ...themes,\n ...tree,\n ...transcript,\n ...tables,\n ...outline,\n ...mentions,\n ...integrations,\n ...markdown,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAa,KAAyC;CACpD,GAAGA;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;AACL"}
1
+ {"version":3,"file":"en.js","names":["common","toolbar","block","settings","ai","comments","authors","composites","media","themes","tree","transcript","tables","outline","mentions","integrations","markdown","palette"],"sources":["../../src/i18n/en.ts"],"sourcesContent":["import { en as common } from './en/common'\nimport { en as toolbar } from './en/toolbar'\nimport { en as block } from './en/block'\nimport { en as settings } from './en/settings'\nimport { en as ai } from './en/ai'\nimport { en as comments } from './en/comments'\nimport { en as authors } from './en/authors'\nimport { en as composites } from './en/composites'\nimport { en as media } from './en/media'\nimport { en as themes } from './en/themes'\nimport { en as tree } from './en/tree'\nimport { en as transcript } from './en/transcript'\nimport { en as tables } from './en/tables'\nimport { en as outline } from './en/outline'\nimport { en as mentions } from './en/mentions'\nimport { en as integrations } from './en/integrations'\nimport { en as markdown } from './en/markdown'\nimport { en as palette } from './en/palette'\nimport type { de } from './de'\n\n/** The English catalog: the same keys as `de`, checked per area file. */\nexport const en: { [K in keyof typeof de]: string } = {\n ...common,\n ...toolbar,\n ...block,\n ...settings,\n ...ai,\n ...comments,\n ...authors,\n ...composites,\n ...media,\n ...themes,\n ...tree,\n ...transcript,\n ...tables,\n ...outline,\n ...mentions,\n ...integrations,\n ...markdown,\n ...palette,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,KAAyC;CACpD,GAAGA;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;AACL"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { ToolbarGroup, ToolbarItem } from "./core/toolbar.js";
2
- import { AbilitiesOptions, BlockAction, BlockActionContext, BlockTarget, SlashCommandItem } from "./core/extension-points.js";
3
1
  import { EditorSettings } from "./settings/index.js";
2
+ import { CommandDef, ToolbarGroupDef } from "./core/command-types.js";
3
+ import { AbilitiesOptions, BlockAction, BlockActionContext, BlockTarget } from "./core/extension-points.js";
4
4
  import { EditorMetadata, MetadataItem, MetadataQuery, MetadataSource } from "./core/metadata-types.js";
5
5
  import { AnchorResolver, EditorFeature, EditorPreset, FeatureContext } from "./core/feature.js";
6
- export type { AbilitiesOptions, AnchorResolver, BlockAction, BlockActionContext, BlockTarget, EditorFeature, EditorMetadata, EditorPreset, EditorSettings, FeatureContext, MetadataItem, MetadataQuery, MetadataSource, SlashCommandItem, ToolbarGroup, ToolbarItem };
6
+ import "./core/commands.js";
7
+ export type { AbilitiesOptions, AnchorResolver, BlockAction, BlockActionContext, BlockTarget, CommandDef, EditorFeature, EditorMetadata, EditorPreset, EditorSettings, FeatureContext, MetadataItem, MetadataQuery, MetadataSource, ToolbarGroupDef };
@@ -0,0 +1,31 @@
1
+ import { Translate } from "../../i18n/index.js";
2
+ import { EditorBackend } from "../../core/backend.js";
3
+ import { Notifier } from "../../core/notify.js";
4
+ import { ModelRef } from "../../core/backend-types.js";
5
+ import "../../features/ai/index.js";
6
+ import { Editor } from "@tiptap/core";
7
+ import { Node as Node$1 } from "@tiptap/pm/model";
8
+ //#region src/integrations/composite-ai/bibliography-fetch.d.ts
9
+ /**
10
+ * The DOI of the Baustein: `meta.doi`, else the DOI of `meta.bib`, with a `https://doi.org/` or `doi:` prefix removed;
11
+ * '' when there is none, `null` when the stored text is no DOI.
12
+ */
13
+ export declare function doiOf(composite: Node$1): string | null;
14
+ /**
15
+ * Whether „Literaturangaben abrufen“ applies to the Baustein: its kind has a `bibliography` field and bibliographic
16
+ * data can be looked up — it has a DOI (`meta.doi`, `meta.bib.DOI`) or a PDF source stored as an asset to read it from.
17
+ */
18
+ export declare function canFetchBibliography(editor: Editor, node: Node$1): boolean;
19
+ /**
20
+ * „Literaturangaben abrufen“ / „DOI abrufen“: fetches the bibliographic data of the Baustein at `pos` (`ai.extract`,
21
+ * method `bibliography`: Crossref by the DOI — `meta.doi`, else `meta.bib.DOI` — and, without one, from the PDF source's
22
+ * first pages by the model) and stores it as `meta.bib`, replacing the previous data. The title of the result is only
23
+ * applied to an untitled Baustein and never stored in `meta.bib`. Both changes are one transaction (one undo step). The
24
+ * Baustein is found again by its block ID after the request, so edits while it runs do not misplace the result.
25
+ * `documentId` is the document whose assets the request addresses when the Baustein has no stored source (a DOI-only
26
+ * lookup needs no file). Notices go through `notify`, in the language of `t`; the progress notice stays until the
27
+ * request ends.
28
+ */
29
+ export declare function fetchBibliography(editor: Editor, pos: number, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate, documentId?: string): Promise<void>;
30
+ //#endregion
31
+ //# sourceMappingURL=bibliography-fetch.d.ts.map
@@ -0,0 +1,159 @@
1
+ import { blockIdOf } from "../../core/schema/block-ids.js";
2
+ import { fetchErrorMessage } from "../../core/fetch-error.js";
3
+ import { compositeKind } from "../../features/composites/kinds.js";
4
+ import "../../features/composites/meta-keys.js";
5
+ import { sourceOf } from "../../features/composites/derivation.js";
6
+ import { compositeKindsOf } from "../../features/composites/nodes.js";
7
+ import { bibOf } from "../../features/composites/bibliography.js";
8
+ import { isRateLimited, notifyAiRateLimited } from "../../features/ai/rate-limit.js";
9
+ import { compositeMetaWith, compositeOfRow } from "../../features/composites/rows.js";
10
+ //#region src/integrations/composite-ai/bibliography-fetch.ts
11
+ /** A DOI as the extract route accepts it (`DOI_PATTERN` of the server handler). */
12
+ const DOI = /^10\.\d{4,9}\/\S+$/;
13
+ const DOI_PREFIX = /^(?:https?:\/\/(?:dx\.)?doi\.org\/|doi:\s*)/i;
14
+ /** Block IDs with a running request, so a second click does not start another one. */
15
+ const running = /* @__PURE__ */ new Set();
16
+ /**
17
+ * The DOI of the Baustein: `meta.doi`, else the DOI of `meta.bib`, with a `https://doi.org/` or `doi:` prefix removed;
18
+ * '' when there is none, `null` when the stored text is no DOI.
19
+ */
20
+ function doiOf(composite) {
21
+ const raw = [composite.attrs.meta?.doi, bibOf(composite)?.DOI].find((value) => typeof value === "string" && value.trim() !== "");
22
+ if (raw === void 0) return "";
23
+ const doi = raw.trim().replace(DOI_PREFIX, "");
24
+ return DOI.test(doi) ? doi : null;
25
+ }
26
+ /**
27
+ * Whether „Literaturangaben abrufen“ applies to the Baustein: its kind has a `bibliography` field and bibliographic
28
+ * data can be looked up — it has a DOI (`meta.doi`, `meta.bib.DOI`) or a PDF source stored as an asset to read it from.
29
+ */
30
+ function canFetchBibliography(editor, node) {
31
+ if (node.type.name !== "composite") return false;
32
+ const kinds = compositeKindsOf(editor);
33
+ if (!compositeKind(kinds, String(node.attrs.kind)).fields.some((field) => field.type === "bibliography")) return false;
34
+ if (doiOf(node)) return true;
35
+ const source = sourceOf(node, kinds);
36
+ return source?.asset != null && source.node.attrs.mimeType === "application/pdf";
37
+ }
38
+ /**
39
+ * „Literaturangaben abrufen“ / „DOI abrufen“: fetches the bibliographic data of the Baustein at `pos` (`ai.extract`,
40
+ * method `bibliography`: Crossref by the DOI — `meta.doi`, else `meta.bib.DOI` — and, without one, from the PDF source's
41
+ * first pages by the model) and stores it as `meta.bib`, replacing the previous data. The title of the result is only
42
+ * applied to an untitled Baustein and never stored in `meta.bib`. Both changes are one transaction (one undo step). The
43
+ * Baustein is found again by its block ID after the request, so edits while it runs do not misplace the result.
44
+ * `documentId` is the document whose assets the request addresses when the Baustein has no stored source (a DOI-only
45
+ * lookup needs no file). Notices go through `notify`, in the language of `t`; the progress notice stays until the
46
+ * request ends.
47
+ */
48
+ async function fetchBibliography(editor, pos, ai, modelRef, notify, t, documentId) {
49
+ const composite = editor.state.doc.nodeAt(pos);
50
+ const id = composite && blockIdOf(composite);
51
+ if (composite?.type.name !== "composite" || !id) return;
52
+ const kind = compositeKind(compositeKindsOf(editor), String(composite.attrs.kind));
53
+ if (!kind.fields.some((field) => field.type === "bibliography") || running.has(id)) return;
54
+ const doi = doiOf(composite);
55
+ if (doi === null) {
56
+ notify({
57
+ title: t("integrations.bibliographyFetch.invalidDoi"),
58
+ kind: "error"
59
+ });
60
+ return;
61
+ }
62
+ const source = sourceOf(composite, compositeKindsOf(editor));
63
+ const asset = source?.asset != null && source.node.attrs.mimeType === "application/pdf" ? source.asset : null;
64
+ const targetDocument = doi ? documentId ?? asset?.documentId : asset?.documentId;
65
+ if (!targetDocument) {
66
+ notify({
67
+ title: t("integrations.bibliographyFetch.noSource"),
68
+ kind: "error"
69
+ });
70
+ return;
71
+ }
72
+ running.add(id);
73
+ const toastId = `bibliography-fetch-${id}`;
74
+ const controller = new AbortController();
75
+ const abort = () => controller.abort();
76
+ editor.on("destroy", abort);
77
+ notify({
78
+ id: toastId,
79
+ title: t("integrations.bibliographyFetch.running"),
80
+ kind: "info",
81
+ icon: "i-lucide-loader-circle",
82
+ duration: 0
83
+ });
84
+ try {
85
+ const result = await ai.extract({
86
+ documentId: targetDocument,
87
+ ...doi ? { doi } : { name: asset.name },
88
+ method: "bibliography",
89
+ model: modelRef("generate")
90
+ }, controller.signal);
91
+ if (editor.isDestroyed) return;
92
+ if (!result.bib) {
93
+ notify({
94
+ title: t("integrations.bibliographyFetch.empty"),
95
+ kind: "error"
96
+ });
97
+ return;
98
+ }
99
+ const { title, ...item } = result.bib;
100
+ const bib = {
101
+ ...item,
102
+ ...doi && !item.DOI ? { DOI: doi } : {}
103
+ };
104
+ if (!editor.commands.command(({ tr }) => {
105
+ const found = compositeOfRow(tr.doc, {
106
+ id,
107
+ pos
108
+ });
109
+ if (!found) return false;
110
+ const field = kind.fields.find((candidate) => candidate.key === "bib") ?? {
111
+ key: "bib",
112
+ type: "bibliography"
113
+ };
114
+ tr.setNodeMarkup(found.pos, void 0, {
115
+ ...found.node.attrs,
116
+ meta: compositeMetaWith(found.node.attrs.meta ?? {}, field, bib)
117
+ });
118
+ const heading = found.node.child(0);
119
+ if (title?.trim() && !heading.textContent.trim()) {
120
+ const from = found.pos + 2;
121
+ tr.replaceWith(from, from + heading.content.size, editor.schema.text(title.trim()));
122
+ }
123
+ return true;
124
+ })) {
125
+ notify({
126
+ title: t("integrations.bibliographyFetch.gone.title"),
127
+ description: t("integrations.bibliographyFetch.gone.description"),
128
+ kind: "error"
129
+ });
130
+ return;
131
+ }
132
+ notify({
133
+ title: t("integrations.bibliographyFetch.done"),
134
+ kind: "success",
135
+ icon: "i-lucide-book-marked"
136
+ });
137
+ if (result.warnings.includes("crossref-unavailable")) notify({
138
+ title: t("integrations.bibliographyFetch.crossrefUnavailable.title"),
139
+ description: t("integrations.bibliographyFetch.crossrefUnavailable.description"),
140
+ kind: "info"
141
+ });
142
+ } catch (err) {
143
+ if (controller.signal.aborted || editor.isDestroyed) return;
144
+ if (isRateLimited(err)) notifyAiRateLimited(notify, t);
145
+ else notify({
146
+ title: t("integrations.bibliographyFetch.failed"),
147
+ description: fetchErrorMessage(err),
148
+ kind: "error"
149
+ });
150
+ } finally {
151
+ running.delete(id);
152
+ notify.dismiss?.(toastId);
153
+ editor.off("destroy", abort);
154
+ }
155
+ }
156
+ //#endregion
157
+ export { canFetchBibliography, doiOf, fetchBibliography };
158
+
159
+ //# sourceMappingURL=bibliography-fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bibliography-fetch.js","names":[],"sources":["../../../src/integrations/composite-ai/bibliography-fetch.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport type { EditorBackend } from '../../core/backend'\nimport { fetchErrorMessage } from '../../core'\nimport type { Notifier } from '../../core/notify'\nimport { blockIdOf } from '../../core/schema'\nimport type { Translate } from '../../i18n'\nimport { isRateLimited, type ModelRef, notifyAiRateLimited } from '../../features/ai'\nimport { BIB_KEY, bibOf, compositeKind, compositeKindsOf, sourceOf } from '../../features/composites/schema'\nimport { compositeMetaWith, compositeOfRow } from '../../features/composites/rows'\n\n/** A DOI as the extract route accepts it (`DOI_PATTERN` of the server handler). */\nconst DOI = /^10\\.\\d{4,9}\\/\\S+$/\nconst DOI_PREFIX = /^(?:https?:\\/\\/(?:dx\\.)?doi\\.org\\/|doi:\\s*)/i\n\n/** Block IDs with a running request, so a second click does not start another one. */\nconst running = new Set<string>()\n\n/**\n * The DOI of the Baustein: `meta.doi`, else the DOI of `meta.bib`, with a `https://doi.org/` or `doi:` prefix removed;\n * '' when there is none, `null` when the stored text is no DOI.\n */\nexport function doiOf(composite: PMNode): string | null {\n const raw = [(composite.attrs.meta as Record<string, unknown> | null | undefined)?.doi, bibOf(composite)?.DOI]\n .find((value): value is string => typeof value === 'string' && value.trim() !== '')\n if (raw === undefined) return ''\n const doi = raw.trim().replace(DOI_PREFIX, '')\n return DOI.test(doi) ? doi : null\n}\n\n/**\n * Whether „Literaturangaben abrufen“ applies to the Baustein: its kind has a `bibliography` field and bibliographic\n * data can be looked up — it has a DOI (`meta.doi`, `meta.bib.DOI`) or a PDF source stored as an asset to read it from.\n */\nexport function canFetchBibliography(editor: Editor, node: PMNode): boolean {\n if (node.type.name !== 'composite') return false\n const kinds = compositeKindsOf(editor)\n if (!compositeKind(kinds, String(node.attrs.kind)).fields.some(field => field.type === 'bibliography')) return false\n if (doiOf(node)) return true\n const source = sourceOf(node, kinds)\n return source?.asset != null && source.node.attrs.mimeType === 'application/pdf'\n}\n\n/**\n * „Literaturangaben abrufen“ / „DOI abrufen“: fetches the bibliographic data of the Baustein at `pos` (`ai.extract`,\n * method `bibliography`: Crossref by the DOI — `meta.doi`, else `meta.bib.DOI` — and, without one, from the PDF source's\n * first pages by the model) and stores it as `meta.bib`, replacing the previous data. The title of the result is only\n * applied to an untitled Baustein and never stored in `meta.bib`. Both changes are one transaction (one undo step). The\n * Baustein is found again by its block ID after the request, so edits while it runs do not misplace the result.\n * `documentId` is the document whose assets the request addresses when the Baustein has no stored source (a DOI-only\n * lookup needs no file). Notices go through `notify`, in the language of `t`; the progress notice stays until the\n * request ends.\n */\nexport async function fetchBibliography(editor: Editor, pos: number, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate, documentId?: string): Promise<void> {\n const composite = editor.state.doc.nodeAt(pos)\n const id = composite && blockIdOf(composite)\n if (composite?.type.name !== 'composite' || !id) return\n const kind = compositeKind(compositeKindsOf(editor), String(composite.attrs.kind))\n if (!kind.fields.some(field => field.type === 'bibliography') || running.has(id)) return\n\n const doi = doiOf(composite)\n if (doi === null) {\n notify({ title: t('integrations.bibliographyFetch.invalidDoi'), kind: 'error' })\n return\n }\n const source = sourceOf(composite, compositeKindsOf(editor))\n const asset = source?.asset != null && source.node.attrs.mimeType === 'application/pdf' ? source.asset : null\n // A DOI is looked up without any file; without one the PDF source is read.\n const targetDocument = doi ? documentId ?? asset?.documentId : asset?.documentId\n if (!targetDocument) {\n notify({ title: t('integrations.bibliographyFetch.noSource'), kind: 'error' })\n return\n }\n\n running.add(id)\n const toastId = `bibliography-fetch-${id}`\n const controller = new AbortController()\n const abort = () => controller.abort()\n editor.on('destroy', abort)\n notify({ id: toastId, title: t('integrations.bibliographyFetch.running'), kind: 'info', icon: 'i-lucide-loader-circle', duration: 0 })\n try {\n const result = await ai.extract({\n documentId: targetDocument,\n ...(doi ? { doi } : { name: asset!.name }),\n method: 'bibliography',\n model: modelRef('generate'),\n }, controller.signal)\n if (editor.isDestroyed) return\n if (!result.bib) {\n notify({ title: t('integrations.bibliographyFetch.empty'), kind: 'error' })\n return\n }\n const { title, ...item } = result.bib\n\n const bib = { ...item, ...(doi && !item.DOI ? { DOI: doi } : {}) }\n const applied = editor.commands.command(({ tr }) => {\n const found = compositeOfRow(tr.doc, { id, pos })\n if (!found) return false\n const field = kind.fields.find(candidate => candidate.key === BIB_KEY) ?? { key: BIB_KEY, type: 'bibliography' as const }\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: compositeMetaWith(found.node.attrs.meta ?? {}, field, bib) })\n const heading = found.node.child(0)\n if (title?.trim() && !heading.textContent.trim()) {\n const from = found.pos + 2\n tr.replaceWith(from, from + heading.content.size, editor.schema.text(title.trim()))\n }\n return true\n })\n if (!applied) {\n notify({ title: t('integrations.bibliographyFetch.gone.title'), description: t('integrations.bibliographyFetch.gone.description'), kind: 'error' })\n return\n }\n notify({ title: t('integrations.bibliographyFetch.done'), kind: 'success', icon: 'i-lucide-book-marked' })\n // The data is applied either way; this tells where it came from.\n if (result.warnings.includes('crossref-unavailable')) {\n notify({ title: t('integrations.bibliographyFetch.crossrefUnavailable.title'), description: t('integrations.bibliographyFetch.crossrefUnavailable.description'), kind: 'info' })\n }\n }\n catch (err) {\n if (controller.signal.aborted || editor.isDestroyed) return\n if (isRateLimited(err)) notifyAiRateLimited(notify, t)\n else notify({ title: t('integrations.bibliographyFetch.failed'), description: fetchErrorMessage(err), kind: 'error' })\n }\n finally {\n running.delete(id)\n notify.dismiss?.(toastId)\n editor.off('destroy', abort)\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,MAAM;AACZ,MAAM,aAAa;;AAGnB,MAAM,0BAAU,IAAI,IAAY;;;;;AAMhC,SAAgB,MAAM,WAAkC;CACtD,MAAM,MAAM,CAAE,UAAU,MAAM,MAAqD,KAAK,MAAM,SAAS,CAAC,EAAE,GAAG,CAAC,CAC3G,MAAM,UAA2B,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,EAAE;CACpF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,QAAQ,YAAY,EAAE;CAC7C,OAAO,IAAI,KAAK,GAAG,IAAI,MAAM;AAC/B;;;;;AAMA,SAAgB,qBAAqB,QAAgB,MAAuB;CAC1E,IAAI,KAAK,KAAK,SAAS,aAAa,OAAO;CAC3C,MAAM,QAAQ,iBAAiB,MAAM;CACrC,IAAI,CAAC,cAAc,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,MAAK,UAAS,MAAM,SAAS,cAAc,GAAG,OAAO;CAC/G,IAAI,MAAM,IAAI,GAAG,OAAO;CACxB,MAAM,SAAS,SAAS,MAAM,KAAK;CACnC,OAAO,QAAQ,SAAS,QAAQ,OAAO,KAAK,MAAM,aAAa;AACjE;;;;;;;;;;;AAYA,eAAsB,kBAAkB,QAAgB,KAAa,IAAsC,UAA0C,QAAkB,GAAc,YAAoC;CACvN,MAAM,YAAY,OAAO,MAAM,IAAI,OAAO,GAAG;CAC7C,MAAM,KAAK,aAAa,UAAU,SAAS;CAC3C,IAAI,WAAW,KAAK,SAAS,eAAe,CAAC,IAAI;CACjD,MAAM,OAAO,cAAc,iBAAiB,MAAM,GAAG,OAAO,UAAU,MAAM,IAAI,CAAC;CACjF,IAAI,CAAC,KAAK,OAAO,MAAK,UAAS,MAAM,SAAS,cAAc,KAAK,QAAQ,IAAI,EAAE,GAAG;CAElF,MAAM,MAAM,MAAM,SAAS;CAC3B,IAAI,QAAQ,MAAM;EAChB,OAAO;GAAE,OAAO,EAAE,2CAA2C;GAAG,MAAM;EAAQ,CAAC;EAC/E;CACF;CACA,MAAM,SAAS,SAAS,WAAW,iBAAiB,MAAM,CAAC;CAC3D,MAAM,QAAQ,QAAQ,SAAS,QAAQ,OAAO,KAAK,MAAM,aAAa,oBAAoB,OAAO,QAAQ;CAEzG,MAAM,iBAAiB,MAAM,cAAc,OAAO,aAAa,OAAO;CACtE,IAAI,CAAC,gBAAgB;EACnB,OAAO;GAAE,OAAO,EAAE,yCAAyC;GAAG,MAAM;EAAQ,CAAC;EAC7E;CACF;CAEA,QAAQ,IAAI,EAAE;CACd,MAAM,UAAU,sBAAsB;CACtC,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,cAAc,WAAW,MAAM;CACrC,OAAO,GAAG,WAAW,KAAK;CAC1B,OAAO;EAAE,IAAI;EAAS,OAAO,EAAE,wCAAwC;EAAG,MAAM;EAAQ,MAAM;EAA0B,UAAU;CAAE,CAAC;CACrI,IAAI;EACF,MAAM,SAAS,MAAM,GAAG,QAAQ;GAC9B,YAAY;GACZ,GAAI,MAAM,EAAE,IAAI,IAAI,EAAE,MAAM,MAAO,KAAK;GACxC,QAAQ;GACR,OAAO,SAAS,UAAU;EAC5B,GAAG,WAAW,MAAM;EACpB,IAAI,OAAO,aAAa;EACxB,IAAI,CAAC,OAAO,KAAK;GACf,OAAO;IAAE,OAAO,EAAE,sCAAsC;IAAG,MAAM;GAAQ,CAAC;GAC1E;EACF;EACA,MAAM,EAAE,OAAO,GAAG,SAAS,OAAO;EAElC,MAAM,MAAM;GAAE,GAAG;GAAM,GAAI,OAAO,CAAC,KAAK,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;EAAG;EAajE,IAAI,CAZY,OAAO,SAAS,SAAS,EAAE,SAAS;GAClD,MAAM,QAAQ,eAAe,GAAG,KAAK;IAAE;IAAI;GAAI,CAAC;GAChD,IAAI,CAAC,OAAO,OAAO;GACnB,MAAM,QAAQ,KAAK,OAAO,MAAK,cAAa,UAAU,QAAA,KAAe,KAAK;IAAE,KAAA;IAAc,MAAM;GAAwB;GACxH,GAAG,cAAc,MAAM,KAAK,KAAA,GAAW;IAAE,GAAG,MAAM,KAAK;IAAO,MAAM,kBAAkB,MAAM,KAAK,MAAM,QAAQ,CAAC,GAAG,OAAO,GAAG;GAAE,CAAC;GAChI,MAAM,UAAU,MAAM,KAAK,MAAM,CAAC;GAClC,IAAI,OAAO,KAAK,KAAK,CAAC,QAAQ,YAAY,KAAK,GAAG;IAChD,MAAM,OAAO,MAAM,MAAM;IACzB,GAAG,YAAY,MAAM,OAAO,QAAQ,QAAQ,MAAM,OAAO,OAAO,KAAK,MAAM,KAAK,CAAC,CAAC;GACpF;GACA,OAAO;EACT,CACW,GAAG;GACZ,OAAO;IAAE,OAAO,EAAE,2CAA2C;IAAG,aAAa,EAAE,iDAAiD;IAAG,MAAM;GAAQ,CAAC;GAClJ;EACF;EACA,OAAO;GAAE,OAAO,EAAE,qCAAqC;GAAG,MAAM;GAAW,MAAM;EAAuB,CAAC;EAEzG,IAAI,OAAO,SAAS,SAAS,sBAAsB,GACjD,OAAO;GAAE,OAAO,EAAE,0DAA0D;GAAG,aAAa,EAAE,gEAAgE;GAAG,MAAM;EAAO,CAAC;CAEnL,SACO,KAAK;EACV,IAAI,WAAW,OAAO,WAAW,OAAO,aAAa;EACrD,IAAI,cAAc,GAAG,GAAG,oBAAoB,QAAQ,CAAC;OAChD,OAAO;GAAE,OAAO,EAAE,uCAAuC;GAAG,aAAa,kBAAkB,GAAG;GAAG,MAAM;EAAQ,CAAC;CACvH,UACQ;EACN,QAAQ,OAAO,EAAE;EACjB,OAAO,UAAU,OAAO;EACxB,OAAO,IAAI,WAAW,KAAK;CAC7B;AACF"}
@@ -1,17 +1,39 @@
1
1
  import { Translate } from "../../i18n/index.js";
2
+ import { EditorBackend } from "../../core/backend.js";
2
3
  import { Notifier } from "../../core/notify.js";
3
- import { ModelRef } from "../../features/ai/protocol/models.js";
4
+ import { ModelRef } from "../../core/backend-types.js";
4
5
  import "../../features/ai/index.js";
5
6
  import { Editor } from "@tiptap/core";
6
- import { $Fetch } from "ofetch";
7
7
  //#region src/integrations/composite-ai/composite-fill.d.ts
8
8
  /**
9
- * Fills the body of the composite at `pos`: its brief (`compositeAiBrief`) plus the preset's `aiBlockData` → task
10
- * `fill-block` (`generate` slot); the result opens the in-document diff review over the body (`startAiReview`), so
11
- * nothing is written until accepted. The body range is anchored when the run starts, so edits while the data loads or
12
- * the result streams do not misplace it. A contributor that rejects cancels the run before any request is sent. Title,
13
- * fields and the other chrome stay untouched. Notices go through `notify`, in the language of `t`.
9
+ * How `generateCompositeBody` ended. `done` carries the streamed Markdown (possibly empty); `data-error`: a
10
+ * contributor of `aiBlockData` rejected, before any request was sent (`message`); `error`: the request failed
11
+ * (`message`); `aborted` also covers a destroyed editor and a node that is no composite of an `ai` kind.
14
12
  */
15
- export declare function fillComposite(editor: Editor, pos: number, fetch: $Fetch, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate): Promise<void>;
13
+ export type CompositeBodyResult = {
14
+ status: 'done';
15
+ output: string;
16
+ } | {
17
+ status: 'rate-limited' | 'aborted';
18
+ output: string;
19
+ } | {
20
+ status: 'data-error' | 'error';
21
+ output: string;
22
+ message: string;
23
+ };
24
+ /**
25
+ * The request half of „Baustein füllen (KI)“: the brief (`compositeAiBrief`) of the composite at `pos` plus the preset's
26
+ * `aiBlockData` → task `fill-block` (`generate` slot), streamed to completion. Writes nothing; `fillComposite` opens
27
+ * the diff review with the result, `deriveComposite` writes it into a new Baustein. A contributor that rejects cancels
28
+ * the run before any request is sent. Never throws.
29
+ */
30
+ export declare function generateCompositeBody(editor: Editor, pos: number, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, t: Translate, signal: AbortSignal): Promise<CompositeBodyResult>;
31
+ /**
32
+ * Fills the body of the composite at `pos` (`generateCompositeBody`); the result opens the in-document diff review over
33
+ * the body (`startAiReview`), so nothing is written until accepted. The body range is anchored when the run starts, so
34
+ * edits while the data loads or the result streams do not misplace it. Title, fields and the other chrome stay
35
+ * untouched. Notices go through `notify`, in the language of `t`.
36
+ */
37
+ export declare function fillComposite(editor: Editor, pos: number, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate): Promise<void>;
16
38
  //#endregion
17
39
  //# sourceMappingURL=composite-fill.d.ts.map
@@ -11,13 +11,95 @@ import { postAiSse } from "../../features/ai/ai-sse.js";
11
11
  /** Entries of `aiBlockData` that travel with a request (the server accepts at most as many). */
12
12
  const MAX_BLOCK_DATA = 10;
13
13
  /**
14
- * Fills the body of the composite at `pos`: its brief (`compositeAiBrief`) plus the preset's `aiBlockData` → task
15
- * `fill-block` (`generate` slot); the result opens the in-document diff review over the body (`startAiReview`), so
16
- * nothing is written until accepted. The body range is anchored when the run starts, so edits while the data loads or
17
- * the result streams do not misplace it. A contributor that rejects cancels the run before any request is sent. Title,
18
- * fields and the other chrome stay untouched. Notices go through `notify`, in the language of `t`.
14
+ * The request half of „Baustein füllen (KI)“: the brief (`compositeAiBrief`) of the composite at `pos` plus the preset's
15
+ * `aiBlockData` → task `fill-block` (`generate` slot), streamed to completion. Writes nothing; `fillComposite` opens
16
+ * the diff review with the result, `deriveComposite` writes it into a new Baustein. A contributor that rejects cancels
17
+ * the run before any request is sent. Never throws.
19
18
  */
20
- async function fillComposite(editor, pos, fetch, modelRef, notify, t) {
19
+ async function generateCompositeBody(editor, pos, ai, modelRef, t, signal) {
20
+ const brief = compositeAiBrief(editor, pos);
21
+ const node = editor.state.doc.nodeAt(pos);
22
+ if (!brief || !node) return {
23
+ status: "aborted",
24
+ output: ""
25
+ };
26
+ let data;
27
+ try {
28
+ data = (await aiBlockDataOf(editor)({
29
+ editor,
30
+ node,
31
+ pos,
32
+ signal
33
+ })).slice(0, MAX_BLOCK_DATA).map(({ label, text }) => ({
34
+ label,
35
+ text: text.slice(0, AI_LIMITS.block.data)
36
+ }));
37
+ } catch (error) {
38
+ if (signal.aborted || editor.isDestroyed) return {
39
+ status: "aborted",
40
+ output: ""
41
+ };
42
+ return {
43
+ status: "data-error",
44
+ output: "",
45
+ message: error instanceof Error ? error.message : String(error)
46
+ };
47
+ }
48
+ if (signal.aborted || editor.isDestroyed) return {
49
+ status: "aborted",
50
+ output: ""
51
+ };
52
+ const block = {
53
+ kind: brief.kind,
54
+ path: brief.path,
55
+ title: brief.title,
56
+ description: brief.description,
57
+ fields: brief.fields.map(({ label, value }) => ({
58
+ label,
59
+ value
60
+ })),
61
+ instructions: brief.instructions,
62
+ skeleton: brief.skeleton,
63
+ body: brief.body,
64
+ data
65
+ };
66
+ let output = "";
67
+ const outcome = await postAiSse(ai, "generate", {
68
+ task: "fill-block",
69
+ prompt: "",
70
+ selection: "",
71
+ context: documentMarkdown(editor),
72
+ blocks: aiContextOf(editor).blocks,
73
+ block,
74
+ model: modelRef("generate")
75
+ }, {
76
+ signal,
77
+ t,
78
+ onDelta: (text) => {
79
+ output += text;
80
+ }
81
+ });
82
+ if (outcome.status === "aborted" || editor.isDestroyed) return {
83
+ status: "aborted",
84
+ output
85
+ };
86
+ if (outcome.status === "error") return {
87
+ status: "error",
88
+ output,
89
+ message: outcome.message
90
+ };
91
+ return {
92
+ status: outcome.status,
93
+ output
94
+ };
95
+ }
96
+ /**
97
+ * Fills the body of the composite at `pos` (`generateCompositeBody`); the result opens the in-document diff review over
98
+ * the body (`startAiReview`), so nothing is written until accepted. The body range is anchored when the run starts, so
99
+ * edits while the data loads or the result streams do not misplace it. Title, fields and the other chrome stay
100
+ * untouched. Notices go through `notify`, in the language of `t`.
101
+ */
102
+ async function fillComposite(editor, pos, ai, modelRef, notify, t) {
21
103
  const brief = compositeAiBrief(editor, pos);
22
104
  const node = editor.state.doc.nodeAt(pos);
23
105
  if (!brief || !node) return;
@@ -29,71 +111,30 @@ async function fillComposite(editor, pos, fetch, modelRef, notify, t) {
29
111
  const controller = new AbortController();
30
112
  const abort = () => controller.abort();
31
113
  editor.on("destroy", abort);
32
- let output = "";
33
114
  try {
34
- let data;
35
- try {
36
- data = (await aiBlockDataOf(editor)({
37
- editor,
38
- node,
39
- pos,
40
- signal: controller.signal
41
- })).slice(0, MAX_BLOCK_DATA).map(({ label, text }) => ({
42
- label,
43
- text: text.slice(0, AI_LIMITS.block.data)
44
- }));
45
- } catch (error) {
46
- if (controller.signal.aborted || editor.isDestroyed) return;
115
+ const result = await generateCompositeBody(editor, pos, ai, modelRef, t, controller.signal);
116
+ if (result.status === "aborted") return;
117
+ if (result.status === "data-error") {
47
118
  notify({
48
119
  title: t("integrations.compositeFill.dataMissing"),
49
- description: error instanceof Error ? error.message : String(error),
120
+ description: result.message,
50
121
  kind: "error"
51
122
  });
52
123
  return;
53
124
  }
54
- if (controller.signal.aborted || editor.isDestroyed) return;
55
- const block = {
56
- kind: brief.kind,
57
- path: brief.path,
58
- title: brief.title,
59
- description: brief.description,
60
- fields: brief.fields.map(({ label, value }) => ({
61
- label,
62
- value
63
- })),
64
- instructions: brief.instructions,
65
- skeleton: brief.skeleton,
66
- body: brief.body,
67
- data
68
- };
69
- const outcome = await postAiSse(fetch, "/api/ai/generate", {
70
- task: "fill-block",
71
- prompt: "",
72
- selection: "",
73
- context: documentMarkdown(editor),
74
- blocks: aiContextOf(editor).blocks,
75
- block,
76
- model: modelRef("generate")
77
- }, {
78
- signal: controller.signal,
79
- t,
80
- onDelta: (text) => {
81
- output += text;
82
- }
83
- });
84
- if (outcome.status === "aborted" || editor.isDestroyed) return;
85
- if (outcome.status === "rate-limited") {
125
+ if (result.status === "rate-limited") {
86
126
  notifyAiRateLimited(notify, t);
87
127
  return;
88
128
  }
89
- if (outcome.status === "error") {
129
+ if (result.status === "error") {
90
130
  notify({
91
131
  title: t("integrations.compositeFill.failed"),
92
- description: outcome.message,
132
+ description: result.message,
93
133
  kind: "error"
94
134
  });
95
135
  return;
96
136
  }
137
+ const { output } = result;
97
138
  if (!output.trim()) {
98
139
  notify({
99
140
  title: t("integrations.compositeFill.empty.title"),
@@ -124,6 +165,6 @@ async function fillComposite(editor, pos, fetch, modelRef, notify, t) {
124
165
  }
125
166
  }
126
167
  //#endregion
127
- export { fillComposite };
168
+ export { fillComposite, generateCompositeBody };
128
169
 
129
170
  //# sourceMappingURL=composite-fill.js.map