@ecsplico/editor 2.1.1 → 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 (701) hide show
  1. package/CHANGELOG.md +74 -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/code/CodeSurface.vue.d.ts +3 -3
  41. package/dist/config/index.d.ts +105 -0
  42. package/dist/config/index.js +95 -0
  43. package/dist/config/index.js.map +1 -0
  44. package/dist/core/abilities.js +1 -0
  45. package/dist/core/abilities.js.map +1 -1
  46. package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
  47. package/dist/core/api-routes.js.map +1 -0
  48. package/dist/core/backend-capability.d.ts +7 -0
  49. package/dist/core/backend-capability.js +17 -0
  50. package/dist/core/backend-capability.js.map +1 -0
  51. package/dist/core/backend-types.d.ts +245 -0
  52. package/dist/core/backend-types.js +17 -0
  53. package/dist/core/backend-types.js.map +1 -0
  54. package/dist/core/backend.d.ts +108 -0
  55. package/dist/core/backend.js +14 -0
  56. package/dist/core/backend.js.map +1 -0
  57. package/dist/core/block-convert.d.ts +7 -5
  58. package/dist/core/block-convert.js +28 -5
  59. package/dist/core/block-convert.js.map +1 -1
  60. package/dist/core/command-types.d.ts +89 -0
  61. package/dist/core/commands.d.ts +40 -0
  62. package/dist/core/commands.js +151 -0
  63. package/dist/core/commands.js.map +1 -0
  64. package/dist/core/context.d.ts +17 -20
  65. package/dist/core/context.js +24 -21
  66. package/dist/core/context.js.map +1 -1
  67. package/dist/core/core-feature.d.ts +22 -7
  68. package/dist/core/core-feature.js +51 -18
  69. package/dist/core/core-feature.js.map +1 -1
  70. package/dist/core/define-editor.d.ts +4 -3
  71. package/dist/core/define-editor.js +14 -7
  72. package/dist/core/define-editor.js.map +1 -1
  73. package/dist/core/document-markdown.js +12 -3
  74. package/dist/core/document-markdown.js.map +1 -1
  75. package/dist/core/editor-ui.d.ts +8 -1
  76. package/dist/core/editor-ui.js +9 -8
  77. package/dist/core/editor-ui.js.map +1 -1
  78. package/dist/core/extension-points.d.ts +3 -15
  79. package/dist/core/feature-context.d.ts +8 -7
  80. package/dist/core/feature-context.js +12 -11
  81. package/dist/core/feature-context.js.map +1 -1
  82. package/dist/core/feature.d.ts +35 -19
  83. package/dist/core/feature.js.map +1 -1
  84. package/dist/core/fences.d.ts +2 -1
  85. package/dist/core/fences.js +3 -2
  86. package/dist/core/fences.js.map +1 -1
  87. package/dist/core/fetch-error.d.ts +1 -1
  88. package/dist/core/fetch-error.js +3 -1
  89. package/dist/core/fetch-error.js.map +1 -1
  90. package/dist/core/hash.d.ts +5 -0
  91. package/dist/core/hash.js +11 -0
  92. package/dist/core/hash.js.map +1 -0
  93. package/dist/core/http-backend.d.ts +11 -0
  94. package/dist/core/http-backend.js +195 -0
  95. package/dist/core/http-backend.js.map +1 -0
  96. package/dist/core/index.d.ts +14 -9
  97. package/dist/core/index.js +12 -9
  98. package/dist/core/palette.d.ts +48 -0
  99. package/dist/core/palette.js +95 -0
  100. package/dist/core/palette.js.map +1 -0
  101. package/dist/core/schema/abilities.d.ts +2 -1
  102. package/dist/core/schema/abilities.js +5 -1
  103. package/dist/core/schema/abilities.js.map +1 -1
  104. package/dist/core/schema/index.d.ts +11 -5
  105. package/dist/core/schema/index.js +13 -8
  106. package/dist/core/schema/index.js.map +1 -1
  107. package/dist/core/schema/mark-flags.d.ts +8 -1
  108. package/dist/core/schema/of-features.d.ts +13 -0
  109. package/dist/core/schema/of-features.js +14 -0
  110. package/dist/core/schema/of-features.js.map +1 -0
  111. package/dist/core/slash.d.ts +8 -6
  112. package/dist/core/slash.js +24 -16
  113. package/dist/core/slash.js.map +1 -1
  114. package/dist/core/surface-session.js +13 -5
  115. package/dist/core/surface-session.js.map +1 -1
  116. package/dist/core/toolbar-items.d.ts +10 -4
  117. package/dist/core/toolbar-items.js +269 -195
  118. package/dist/core/toolbar-items.js.map +1 -1
  119. package/dist/core/util.js +11 -0
  120. package/dist/core/util.js.map +1 -0
  121. package/dist/document/DocumentSurface.d.ts +1 -1
  122. package/dist/document/DocumentSurface.vue.d.ts +3 -3
  123. package/dist/features/ai/agent-op-review.d.ts +1 -1
  124. package/dist/features/ai/agent-op-review.js +1 -1
  125. package/dist/features/ai/agent-ops.js +1 -1
  126. package/dist/features/ai/ai-apply.d.ts +2 -2
  127. package/dist/features/ai/ai-apply.js +1 -1
  128. package/dist/features/ai/ai-review.js +1 -1
  129. package/dist/features/ai/ai-sse.d.ts +6 -6
  130. package/dist/features/ai/ai-sse.js +20 -63
  131. package/dist/features/ai/ai-sse.js.map +1 -1
  132. package/dist/features/ai/assistant.d.ts +8 -7
  133. package/dist/features/ai/assistant.js +3 -3
  134. package/dist/features/ai/assistant.js.map +1 -1
  135. package/dist/features/ai/block-actions.d.ts +3 -2
  136. package/dist/features/ai/block-actions.js +3 -2
  137. package/dist/features/ai/block-actions.js.map +1 -1
  138. package/dist/features/ai/components/AiSelectionMenu.js +1 -1
  139. package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
  140. package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
  141. package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
  142. package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
  143. package/dist/features/ai/document-chat-model.d.ts +8 -7
  144. package/dist/features/ai/document-chat-model.js +5 -5
  145. package/dist/features/ai/document-chat-model.js.map +1 -1
  146. package/dist/features/ai/document-chat.js +1 -1
  147. package/dist/features/ai/feature.js +27 -14
  148. package/dist/features/ai/feature.js.map +1 -1
  149. package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
  150. package/dist/features/ai/ghost-autocomplete.js +6 -9
  151. package/dist/features/ai/ghost-autocomplete.js.map +1 -1
  152. package/dist/features/ai/index.d.ts +4 -3
  153. package/dist/features/ai/index.js +10 -10
  154. package/dist/features/ai/model-profiles.d.ts +5 -4
  155. package/dist/features/ai/model-profiles.js +2 -2
  156. package/dist/features/ai/model-profiles.js.map +1 -1
  157. package/dist/features/ai/protocol/block-lines.js +1 -1
  158. package/dist/features/ai/protocol/block-lines.js.map +1 -1
  159. package/dist/features/ai/protocol/chat.js +4 -1
  160. package/dist/features/ai/protocol/chat.js.map +1 -1
  161. package/dist/features/ai/protocol/index.d.ts +3 -2
  162. package/dist/features/ai/protocol/models.d.ts +2 -16
  163. package/dist/features/ai/protocol/models.js.map +1 -1
  164. package/dist/features/ai/rate-limit.d.ts +1 -1
  165. package/dist/features/ai/rate-limit.js +3 -1
  166. package/dist/features/ai/rate-limit.js.map +1 -1
  167. package/dist/features/ai/react/AiSelectionMenu.js +2 -2
  168. package/dist/features/ai/react/AiSidebar.js +4 -4
  169. package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
  170. package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
  171. package/dist/features/ai/react/DocumentChatOps.js +1 -1
  172. package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
  173. package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
  174. package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
  175. package/dist/features/ai/react/use-ai-assistant.js +3 -3
  176. package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
  177. package/dist/features/ai/react/use-document-chat.js +2 -2
  178. package/dist/features/ai/react/use-document-chat.js.map +1 -1
  179. package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
  180. package/dist/features/ai/selection-flow.d.ts +1 -1
  181. package/dist/features/ai/selection-flow.js +1 -1
  182. package/dist/features/ai/sidebar-flow.d.ts +1 -1
  183. package/dist/features/ai/sidebar-flow.js +1 -1
  184. package/dist/features/ai/use-ai-assistant.d.ts +1 -1
  185. package/dist/features/ai/use-ai-assistant.js +3 -3
  186. package/dist/features/ai/use-ai-assistant.js.map +1 -1
  187. package/dist/features/ai/use-document-chat.js +2 -2
  188. package/dist/features/ai/use-document-chat.js.map +1 -1
  189. package/dist/features/ai/use-model-profiles.d.ts +2 -1
  190. package/dist/features/authors/attribution.d.ts +1 -1
  191. package/dist/features/authors/feature.js +12 -11
  192. package/dist/features/authors/feature.js.map +1 -1
  193. package/dist/features/block-ui/block-actions.d.ts +22 -1
  194. package/dist/features/block-ui/block-actions.js +26 -2
  195. package/dist/features/block-ui/block-actions.js.map +1 -1
  196. package/dist/features/block-ui/components/BlockActionsOverlay.js +33 -4
  197. package/dist/features/block-ui/components/BlockActionsOverlay.js.map +1 -1
  198. package/dist/features/block-ui/components/BlockActionsOverlay.vue.d.ts +4 -0
  199. package/dist/features/block-ui/components/BlockUi.js +1 -1
  200. package/dist/features/block-ui/feature.js +1 -0
  201. package/dist/features/block-ui/feature.js.map +1 -1
  202. package/dist/features/block-ui/index.d.ts +2 -2
  203. package/dist/features/block-ui/index.js +2 -2
  204. package/dist/features/block-ui/react/BlockActionsOverlay.d.ts +4 -0
  205. package/dist/features/block-ui/react/BlockActionsOverlay.js +38 -12
  206. package/dist/features/block-ui/react/BlockActionsOverlay.js.map +1 -1
  207. package/dist/features/block-ui/react/BlockUi.js +1 -1
  208. package/dist/features/collab/anchor-resolver.js +1 -1
  209. package/dist/features/collab/feature.js +2 -0
  210. package/dist/features/collab/feature.js.map +1 -1
  211. package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
  212. package/dist/features/comments/feature.js +12 -11
  213. package/dist/features/comments/feature.js.map +1 -1
  214. package/dist/features/comments/index.d.ts +3 -2
  215. package/dist/features/comments/index.js +1 -1
  216. package/dist/features/comments/margin-layout.d.ts +3 -2
  217. package/dist/features/comments/model.d.ts +3 -67
  218. package/dist/features/comments/model.js +2 -2
  219. package/dist/features/comments/model.js.map +1 -1
  220. package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
  221. package/dist/features/comments/react/use-comments.d.ts +2 -1
  222. package/dist/features/comments/react.d.ts +1 -1
  223. package/dist/features/comments/schema.d.ts +2 -52
  224. package/dist/features/comments/schema.js.map +1 -1
  225. package/dist/features/comments/snapshot-equality.js.map +1 -1
  226. package/dist/features/comments/use-comments.d.ts +3 -2
  227. package/dist/features/comments/vue.d.ts +1 -1
  228. package/dist/features/composites/accepted-children.d.ts +1 -0
  229. package/dist/features/composites/accepted-children.js +16 -1
  230. package/dist/features/composites/accepted-children.js.map +1 -1
  231. package/dist/features/composites/ai-brief.js +31 -0
  232. package/dist/features/composites/ai-brief.js.map +1 -1
  233. package/dist/features/composites/bibliography-command.d.ts +11 -0
  234. package/dist/features/composites/bibliography-form.js +90 -0
  235. package/dist/features/composites/bibliography-form.js.map +1 -0
  236. package/dist/features/composites/bibliography.d.ts +33 -0
  237. package/dist/features/composites/bibliography.js +120 -0
  238. package/dist/features/composites/bibliography.js.map +1 -0
  239. package/dist/features/composites/components/BibliographyEditor.js +261 -0
  240. package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
  241. package/dist/features/composites/components/CompositeChrome.js +75 -26
  242. package/dist/features/composites/components/CompositeChrome.js.map +1 -1
  243. package/dist/features/composites/components/CompositeDetails.js +46 -11
  244. package/dist/features/composites/components/CompositeDetails.js.map +1 -1
  245. package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
  246. package/dist/features/composites/components/CompositeFieldEditor.js +37 -4
  247. package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
  248. package/dist/features/composites/components/CompositeInspector.js +17 -5
  249. package/dist/features/composites/components/CompositeInspector.js.map +1 -1
  250. package/dist/features/composites/components/CompositeTable.js +13 -4
  251. package/dist/features/composites/components/CompositeTable.js.map +1 -1
  252. package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
  253. package/dist/features/composites/components/CompositeView.js +11 -1
  254. package/dist/features/composites/components/CompositeView.js.map +1 -1
  255. package/dist/features/composites/components/DerivationBadge.js +103 -0
  256. package/dist/features/composites/components/DerivationBadge.js.map +1 -0
  257. package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
  258. package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
  259. package/dist/features/composites/components/ReferenceView.js +122 -0
  260. package/dist/features/composites/components/ReferenceView.js.map +1 -0
  261. package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
  262. package/dist/features/composites/components/SettingsEditingTab.js +1 -1
  263. package/dist/features/composites/convert.js +2 -2
  264. package/dist/features/composites/convert.js.map +1 -1
  265. package/dist/features/composites/derivation.d.ts +61 -0
  266. package/dist/features/composites/derivation.js +98 -0
  267. package/dist/features/composites/derivation.js.map +1 -0
  268. package/dist/features/composites/derived-chrome.js +69 -0
  269. package/dist/features/composites/derived-chrome.js.map +1 -0
  270. package/dist/features/composites/feature.js +159 -109
  271. package/dist/features/composites/feature.js.map +1 -1
  272. package/dist/features/composites/fences.d.ts +4 -3
  273. package/dist/features/composites/fences.js +51 -7
  274. package/dist/features/composites/fences.js.map +1 -1
  275. package/dist/features/composites/index.d.ts +12 -3
  276. package/dist/features/composites/index.js +15 -6
  277. package/dist/features/composites/inspector-model.d.ts +4 -1
  278. package/dist/features/composites/inspector-model.js +8 -4
  279. package/dist/features/composites/inspector-model.js.map +1 -1
  280. package/dist/features/composites/kinds.d.ts +8 -1
  281. package/dist/features/composites/kinds.js +145 -6
  282. package/dist/features/composites/kinds.js.map +1 -1
  283. package/dist/features/composites/legacy.d.ts +4 -1
  284. package/dist/features/composites/legacy.js +56 -1
  285. package/dist/features/composites/legacy.js.map +1 -1
  286. package/dist/features/composites/meta-display.js +40 -1
  287. package/dist/features/composites/meta-display.js.map +1 -1
  288. package/dist/features/composites/meta-keys.d.ts +7 -0
  289. package/dist/features/composites/meta-keys.js +21 -0
  290. package/dist/features/composites/meta-keys.js.map +1 -0
  291. package/dist/features/composites/node-views.d.ts +6 -3
  292. package/dist/features/composites/node-views.js +7 -3
  293. package/dist/features/composites/node-views.js.map +1 -1
  294. package/dist/features/composites/nodes.d.ts +6 -1
  295. package/dist/features/composites/nodes.js +33 -7
  296. package/dist/features/composites/nodes.js.map +1 -1
  297. package/dist/features/composites/react/BibliographyEditor.js +229 -0
  298. package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
  299. package/dist/features/composites/react/CompositeChrome.js +65 -17
  300. package/dist/features/composites/react/CompositeChrome.js.map +1 -1
  301. package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
  302. package/dist/features/composites/react/CompositeDetails.js +45 -6
  303. package/dist/features/composites/react/CompositeDetails.js.map +1 -1
  304. package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
  305. package/dist/features/composites/react/CompositeFieldEditor.js +24 -1
  306. package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
  307. package/dist/features/composites/react/CompositeInspector.js +11 -5
  308. package/dist/features/composites/react/CompositeInspector.js.map +1 -1
  309. package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
  310. package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
  311. package/dist/features/composites/react/CompositeTable.js +16 -2
  312. package/dist/features/composites/react/CompositeTable.js.map +1 -1
  313. package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
  314. package/dist/features/composites/react/CompositeView.js +6 -1
  315. package/dist/features/composites/react/CompositeView.js.map +1 -1
  316. package/dist/features/composites/react/DerivationBadge.js +116 -0
  317. package/dist/features/composites/react/DerivationBadge.js.map +1 -0
  318. package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
  319. package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
  320. package/dist/features/composites/react/ReferenceView.d.ts +11 -0
  321. package/dist/features/composites/react/ReferenceView.js +115 -0
  322. package/dist/features/composites/react/ReferenceView.js.map +1 -0
  323. package/dist/features/composites/react/SettingsEditingTab.js +2 -2
  324. package/dist/features/composites/react.d.ts +2 -1
  325. package/dist/features/composites/react.js +7 -3
  326. package/dist/features/composites/react.js.map +1 -1
  327. package/dist/features/composites/reference-ai.js +16 -0
  328. package/dist/features/composites/reference-ai.js.map +1 -0
  329. package/dist/features/composites/reference-label.d.ts +19 -0
  330. package/dist/features/composites/reference-label.js +58 -0
  331. package/dist/features/composites/reference-label.js.map +1 -0
  332. package/dist/features/composites/reference-suggestion.d.ts +10 -0
  333. package/dist/features/composites/reference-suggestion.js +41 -0
  334. package/dist/features/composites/reference-suggestion.js.map +1 -0
  335. package/dist/features/composites/reference-text.d.ts +18 -0
  336. package/dist/features/composites/reference-text.js +89 -0
  337. package/dist/features/composites/reference-text.js.map +1 -0
  338. package/dist/features/composites/reference.d.ts +44 -0
  339. package/dist/features/composites/reference.js +148 -0
  340. package/dist/features/composites/reference.js.map +1 -0
  341. package/dist/features/composites/reveal-source.d.ts +32 -0
  342. package/dist/features/composites/reveal-source.js +89 -0
  343. package/dist/features/composites/reveal-source.js.map +1 -0
  344. package/dist/features/composites/rows.d.ts +21 -2
  345. package/dist/features/composites/rows.js +63 -9
  346. package/dist/features/composites/rows.js.map +1 -1
  347. package/dist/features/composites/schema.d.ts +9 -3
  348. package/dist/features/composites/schema.js +11 -4
  349. package/dist/features/composites/schema.js.map +1 -1
  350. package/dist/features/composites/table-model.js +12 -21
  351. package/dist/features/composites/table-model.js.map +1 -1
  352. package/dist/features/composites/vue.d.ts +3 -2
  353. package/dist/features/composites/vue.js +8 -4
  354. package/dist/features/composites/vue.js.map +1 -1
  355. package/dist/features/media/assets.d.ts +2 -0
  356. package/dist/features/media/assets.js +3 -2
  357. package/dist/features/media/assets.js.map +1 -1
  358. package/dist/features/media/components/FileView.js +13 -4
  359. package/dist/features/media/components/FileView.js.map +1 -1
  360. package/dist/features/media/feature.d.ts +3 -3
  361. package/dist/features/media/feature.js +21 -28
  362. package/dist/features/media/feature.js.map +1 -1
  363. package/dist/features/media/file-import.js +2 -2
  364. package/dist/features/media/file-import.js.map +1 -1
  365. package/dist/features/media/index.d.ts +2 -2
  366. package/dist/features/media/index.js +2 -2
  367. package/dist/features/media/react/FileView.js +19 -2
  368. package/dist/features/media/react/FileView.js.map +1 -1
  369. package/dist/features/media/schema.d.ts +8 -0
  370. package/dist/features/media/schema.js +126 -11
  371. package/dist/features/media/schema.js.map +1 -1
  372. package/dist/features/media/upload.d.ts +16 -14
  373. package/dist/features/media/upload.js +13 -19
  374. package/dist/features/media/upload.js.map +1 -1
  375. package/dist/features/mentions/index.d.ts +4 -3
  376. package/dist/features/mentions/index.js +4 -1
  377. package/dist/features/mentions/index.js.map +1 -1
  378. package/dist/features/mentions/mention-text.d.ts +1 -1
  379. package/dist/features/mentions/mention-text.js.map +1 -1
  380. package/dist/features/mentions/mention.d.ts +0 -6
  381. package/dist/features/mentions/mention.js.map +1 -1
  382. package/dist/features/mentions/metadata-defaults.d.ts +2 -2
  383. package/dist/features/mentions/metadata-defaults.js +3 -9
  384. package/dist/features/mentions/metadata-defaults.js.map +1 -1
  385. package/dist/features/mentions/schema.d.ts +2 -1
  386. package/dist/features/mentions/schema.js.map +1 -1
  387. package/dist/features/tables/feature.d.ts +2 -1
  388. package/dist/features/tables/feature.js +90 -70
  389. package/dist/features/tables/feature.js.map +1 -1
  390. package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
  391. package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
  392. package/dist/features/themes/feature.js +2 -0
  393. package/dist/features/themes/feature.js.map +1 -1
  394. package/dist/features/themes/index.d.ts +2 -1
  395. package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
  396. package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
  397. package/dist/features/themes/schema.d.ts +2 -6
  398. package/dist/features/themes/schema.js.map +1 -1
  399. package/dist/features/themes/theme-runtime.d.ts +1 -1
  400. package/dist/features/themes/theme-runtime.js +4 -2
  401. package/dist/features/themes/theme-runtime.js.map +1 -1
  402. package/dist/features/transcript/TranscriptSegmentView.js +48 -28
  403. package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
  404. package/dist/features/transcript/feature.js +21 -19
  405. package/dist/features/transcript/feature.js.map +1 -1
  406. package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
  407. package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
  408. package/dist/features/transcript/segment-node.d.ts +2 -0
  409. package/dist/features/transcript/segment-node.js +35 -7
  410. package/dist/features/transcript/segment-node.js.map +1 -1
  411. package/dist/i18n/de/composites.js +91 -1
  412. package/dist/i18n/de/composites.js.map +1 -1
  413. package/dist/i18n/de/integrations.js +49 -8
  414. package/dist/i18n/de/integrations.js.map +1 -1
  415. package/dist/i18n/de/media.js +0 -1
  416. package/dist/i18n/de/media.js.map +1 -1
  417. package/dist/i18n/de/palette.js +22 -0
  418. package/dist/i18n/de/palette.js.map +1 -0
  419. package/dist/i18n/de/tables.js +0 -1
  420. package/dist/i18n/de/tables.js.map +1 -1
  421. package/dist/i18n/de/transcript.js +2 -1
  422. package/dist/i18n/de/transcript.js.map +1 -1
  423. package/dist/i18n/de/tree.js +3 -0
  424. package/dist/i18n/de/tree.js.map +1 -1
  425. package/dist/i18n/de.d.ts +157 -11
  426. package/dist/i18n/de.js +3 -1
  427. package/dist/i18n/de.js.map +1 -1
  428. package/dist/i18n/en/composites.js +89 -1
  429. package/dist/i18n/en/composites.js.map +1 -1
  430. package/dist/i18n/en/integrations.js +49 -8
  431. package/dist/i18n/en/integrations.js.map +1 -1
  432. package/dist/i18n/en/media.js +0 -1
  433. package/dist/i18n/en/media.js.map +1 -1
  434. package/dist/i18n/en/palette.js +22 -0
  435. package/dist/i18n/en/palette.js.map +1 -0
  436. package/dist/i18n/en/tables.js +0 -1
  437. package/dist/i18n/en/tables.js.map +1 -1
  438. package/dist/i18n/en/transcript.js +2 -1
  439. package/dist/i18n/en/transcript.js.map +1 -1
  440. package/dist/i18n/en/tree.js +3 -0
  441. package/dist/i18n/en/tree.js.map +1 -1
  442. package/dist/i18n/en.js +3 -1
  443. package/dist/i18n/en.js.map +1 -1
  444. package/dist/index.d.ts +4 -3
  445. package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
  446. package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
  447. package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
  448. package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
  449. package/dist/integrations/composite-ai/composite-fill.js +97 -56
  450. package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
  451. package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
  452. package/dist/integrations/composite-ai/composite-summary.js +7 -26
  453. package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
  454. package/dist/integrations/composite-ai/derive.d.ts +29 -0
  455. package/dist/integrations/composite-ai/derive.js +173 -0
  456. package/dist/integrations/composite-ai/derive.js.map +1 -0
  457. package/dist/integrations/composite-ai/index.d.ts +11 -7
  458. package/dist/integrations/composite-ai/index.js +72 -14
  459. package/dist/integrations/composite-ai/index.js.map +1 -1
  460. package/dist/integrations/composite-ai/rendition.d.ts +45 -0
  461. package/dist/integrations/composite-ai/rendition.js +314 -0
  462. package/dist/integrations/composite-ai/rendition.js.map +1 -0
  463. package/dist/integrations/composite-media/index.d.ts +7 -5
  464. package/dist/integrations/composite-media/index.js +86 -13
  465. package/dist/integrations/composite-media/index.js.map +1 -1
  466. package/dist/integrations/transcript-ai/index.d.ts +1 -1
  467. package/dist/integrations/transcript-ai/index.js +5 -2
  468. package/dist/integrations/transcript-ai/index.js.map +1 -1
  469. package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
  470. package/dist/integrations/transcript-ai/protocol.js +0 -2
  471. package/dist/integrations/transcript-ai/protocol.js.map +1 -1
  472. package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
  473. package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
  474. package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
  475. package/dist/markdown/MarkdownSurface.vue.d.ts +10 -9
  476. package/dist/markdown/MarkdownSurface2.js +3 -6
  477. package/dist/markdown/MarkdownSurface2.js.map +1 -1
  478. package/dist/markdown/document.js +1 -1
  479. package/dist/markdown/source-mode.d.ts +1 -1
  480. package/dist/nuxt/module.d.ts +1402 -54
  481. package/dist/nuxt/module.js +6 -49
  482. package/dist/nuxt/module.js.map +1 -1
  483. package/dist/nuxt/runtime/install-context.d.ts +7 -3
  484. package/dist/nuxt/runtime/install-context.js +14 -8
  485. package/dist/nuxt/runtime/install-context.js.map +1 -1
  486. package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
  487. package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
  488. package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
  489. package/dist/presets/compose.d.ts +94 -0
  490. package/dist/presets/compose.js +164 -0
  491. package/dist/presets/compose.js.map +1 -0
  492. package/dist/react/AdvancedEditor.d.ts +15 -15
  493. package/dist/react/AdvancedEditor.js +15 -13
  494. package/dist/react/AdvancedEditor.js.map +1 -1
  495. package/dist/react/EditorCommandPalette.d.ts +13 -0
  496. package/dist/react/EditorCommandPalette.js +118 -0
  497. package/dist/react/EditorCommandPalette.js.map +1 -0
  498. package/dist/react/EditorSettingsModal.d.ts +5 -5
  499. package/dist/react/EditorSettingsModal.js +7 -4
  500. package/dist/react/EditorSettingsModal.js.map +1 -1
  501. package/dist/react/EditorSettingsPanel.d.ts +7 -7
  502. package/dist/react/EditorSettingsPanel.js +8 -5
  503. package/dist/react/EditorSettingsPanel.js.map +1 -1
  504. package/dist/react/EditorSurface.d.ts +7 -7
  505. package/dist/react/EditorSurface.js +10 -6
  506. package/dist/react/EditorSurface.js.map +1 -1
  507. package/dist/react/EditorToolbar.d.ts +4 -6
  508. package/dist/react/EditorToolbar.js +29 -37
  509. package/dist/react/EditorToolbar.js.map +1 -1
  510. package/dist/react/SimpleEditor.d.ts +22 -23
  511. package/dist/react/SimpleEditor.js +21 -7
  512. package/dist/react/SimpleEditor.js.map +1 -1
  513. package/dist/react/advanced.d.ts +4 -3
  514. package/dist/react/advanced.js +2 -2
  515. package/dist/react/compose.d.ts +20 -0
  516. package/dist/react/compose.js +49 -0
  517. package/dist/react/compose.js.map +1 -0
  518. package/dist/react/composed-surface.d.ts +39 -0
  519. package/dist/react/composed-surface.js +71 -0
  520. package/dist/react/composed-surface.js.map +1 -0
  521. package/dist/react/context.js +6 -2
  522. package/dist/react/context.js.map +1 -1
  523. package/dist/react/index.d.ts +2 -1
  524. package/dist/react/index.js +2 -1
  525. package/dist/react/key-labels.js +15 -0
  526. package/dist/react/key-labels.js.map +1 -0
  527. package/dist/react/settings.d.ts +1 -1
  528. package/dist/react/simple.d.ts +2 -2
  529. package/dist/react/ui/command.js +36 -1
  530. package/dist/react/ui/command.js.map +1 -1
  531. package/dist/schema/advanced.d.ts +6 -6
  532. package/dist/schema/advanced.js +26 -29
  533. package/dist/schema/advanced.js.map +1 -1
  534. package/dist/server/ai.d.ts +5 -16
  535. package/dist/server/ai.js.map +1 -1
  536. package/dist/server/auth.d.ts +9 -0
  537. package/dist/server/collab-state.d.ts +1 -1
  538. package/dist/server/collab-state.js.map +1 -1
  539. package/dist/server/collab.d.ts +13 -13
  540. package/dist/server/collab.js +34 -18
  541. package/dist/server/collab.js.map +1 -1
  542. package/dist/server/crossref.js +78 -0
  543. package/dist/server/crossref.js.map +1 -0
  544. package/dist/server/errors.d.ts +1 -1
  545. package/dist/server/errors.js +1 -1
  546. package/dist/server/errors.js.map +1 -1
  547. package/dist/server/extract.js +308 -0
  548. package/dist/server/extract.js.map +1 -0
  549. package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
  550. package/dist/server/h3.js.map +1 -0
  551. package/dist/server/handlers/ai.d.ts +30 -9
  552. package/dist/server/handlers/ai.js +170 -36
  553. package/dist/server/handlers/ai.js.map +1 -1
  554. package/dist/server/handlers/context.d.ts +12 -5
  555. package/dist/server/handlers/context.js +10 -4
  556. package/dist/server/handlers/context.js.map +1 -1
  557. package/dist/server/handlers/editor.d.ts +19 -13
  558. package/dist/server/handlers/editor.js +49 -38
  559. package/dist/server/handlers/editor.js.map +1 -1
  560. package/dist/server/handlers/index.d.ts +4 -4
  561. package/dist/server/handlers/index.js +4 -4
  562. package/dist/server/host.d.ts +16 -25
  563. package/dist/server/host.js +58 -41
  564. package/dist/server/host.js.map +1 -1
  565. package/dist/server/index.d.ts +6 -4
  566. package/dist/server/index.js +3 -2
  567. package/dist/server/pdf.js +97 -0
  568. package/dist/server/pdf.js.map +1 -0
  569. package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
  570. package/dist/server/ports.js +29 -0
  571. package/dist/server/ports.js.map +1 -0
  572. package/dist/server/routes.js +144 -0
  573. package/dist/server/routes.js.map +1 -0
  574. package/dist/settings/index.d.ts +1 -1
  575. package/dist/settings/index.js.map +1 -1
  576. package/dist/styles/composites.css +25 -0
  577. package/dist/tree/DocumentTree.js +56 -29
  578. package/dist/tree/DocumentTree.js.map +1 -1
  579. package/dist/tree/react/DocumentTree.js +23 -0
  580. package/dist/tree/react/DocumentTree.js.map +1 -1
  581. package/dist/tree/tree-host.js +1 -1
  582. package/dist/vue/AdvancedEditor.js +30 -9
  583. package/dist/vue/AdvancedEditor.js.map +1 -1
  584. package/dist/vue/AdvancedEditor.vue.d.ts +32 -12
  585. package/dist/vue/SimpleEditor.js +62 -16
  586. package/dist/vue/SimpleEditor.js.map +1 -1
  587. package/dist/vue/SimpleEditor.vue.d.ts +37 -7
  588. package/dist/vue/advanced.d.ts +3 -2
  589. package/dist/vue/advanced.js +2 -2
  590. package/dist/vue/components/EditorCommandPalette.js +91 -0
  591. package/dist/vue/components/EditorCommandPalette.js.map +1 -0
  592. package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
  593. package/dist/vue/components/EditorSettingsModal.js +10 -6
  594. package/dist/vue/components/EditorSettingsModal.js.map +1 -1
  595. package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
  596. package/dist/vue/components/EditorSettingsPanel.js +10 -6
  597. package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
  598. package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
  599. package/dist/vue/components/EditorSurface.js +11 -6
  600. package/dist/vue/components/EditorSurface.js.map +1 -1
  601. package/dist/vue/components/EditorSurface.vue.d.ts +11 -11
  602. package/dist/vue/components/EditorToolbar.js +41 -49
  603. package/dist/vue/components/EditorToolbar.js.map +1 -1
  604. package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
  605. package/dist/vue/compose.d.ts +17 -0
  606. package/dist/vue/compose.js +51 -0
  607. package/dist/vue/compose.js.map +1 -0
  608. package/dist/vue/context-key.d.ts +6 -0
  609. package/dist/vue/context-key.js +6 -0
  610. package/dist/vue/context-key.js.map +1 -0
  611. package/dist/vue/context.d.ts +8 -6
  612. package/dist/vue/context.js +6 -5
  613. package/dist/vue/context.js.map +1 -1
  614. package/dist/vue/index.d.ts +10 -8
  615. package/dist/vue/index.js +10 -8
  616. package/dist/vue/kit/index.d.ts +2 -2
  617. package/dist/vue/kit/nuxt-ui.js +23 -0
  618. package/dist/vue/kit/nuxt-ui.js.map +1 -1
  619. package/dist/vue/kit/types.d.ts +40 -1
  620. package/package.json +30 -16
  621. package/dist/adapters/comments/client.d.ts +0 -64
  622. package/dist/adapters/comments/client.js.map +0 -1
  623. package/dist/adapters/routes.js.map +0 -1
  624. package/dist/core/toolbar.d.ts +0 -74
  625. package/dist/core/toolbar.js +0 -45
  626. package/dist/core/toolbar.js.map +0 -1
  627. package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
  628. package/dist/integrations/composite-ai/document-transcribe.js +0 -89
  629. package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
  630. package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
  631. package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
  632. package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
  633. package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
  634. package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
  635. package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
  636. package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
  637. package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
  638. package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
  639. package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
  640. package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
  641. package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
  642. package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
  643. package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
  644. package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
  645. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
  646. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
  647. package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
  648. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
  649. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
  650. package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
  651. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
  652. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
  653. package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
  654. package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
  655. package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
  656. package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
  657. package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
  658. package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
  659. package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
  660. package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
  661. package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
  662. package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
  663. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
  664. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
  665. package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
  666. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
  667. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
  668. package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
  669. package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
  670. package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
  671. package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
  672. package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
  673. package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
  674. package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
  675. package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
  676. package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
  677. package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
  678. package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
  679. package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
  680. package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
  681. package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
  682. package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
  683. package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
  684. package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
  685. package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
  686. package/dist/presets/advanced.d.ts +0 -33
  687. package/dist/presets/advanced.js +0 -50
  688. package/dist/presets/advanced.js.map +0 -1
  689. package/dist/presets/simple.d.ts +0 -9
  690. package/dist/presets/simple.js +0 -12
  691. package/dist/presets/simple.js.map +0 -1
  692. package/dist/react/advanced-preset.d.ts +0 -11
  693. package/dist/react/advanced-preset.js +0 -31
  694. package/dist/react/advanced-preset.js.map +0 -1
  695. package/dist/vue/advanced-preset.d.ts +0 -13
  696. package/dist/vue/advanced-preset.js +0 -33
  697. package/dist/vue/advanced-preset.js.map +0 -1
  698. package/docs/extending.md +0 -538
  699. package/docs/integration.md +0 -630
  700. package/docs/llms.md +0 -383
  701. package/docs/usage.md +0 -1076
@@ -1 +1 @@
1
- {"version":3,"file":"accepted-children.js","names":[],"sources":["../../../src/features/composites/accepted-children.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey, type Transaction } from '@tiptap/pm/state'\nimport { AddMarkStep, AttrStep, RemoveMarkStep, ReplaceStep, type Step } from '@tiptap/pm/transform'\nimport type { Notifier } from '../../core/notify'\nimport { createTranslator, type Translate } from '../../i18n'\nimport { type CompositeKind, compositeKind, kindAccepts } from './kinds'\nimport { compositeKindsOf } from './nodes'\n\n/** One Baustein nested in a Baustein that does not accept its kind (both kind ids). */\nexport interface NestingViolation {\n parent: string\n child: string\n}\n\n/** The short sentence for a refused nesting, naming both kinds by label (German: „Notiz nimmt keine Aufgabe auf.“). */\nexport function nestingReason(kinds: readonly CompositeKind[], parent: string, child: string, t: Translate): string {\n return t('composites.nesting.refused', { parent: compositeKind(kinds, parent).label, child: compositeKind(kinds, child).label })\n}\n\n/**\n * The Bausteine of `node`'s subtree, outermost first: `node` itself when it is a Baustein, otherwise the Bausteine\n * directly inside it (not those nested in another Baustein).\n */\nexport function outermostComposites(node: PMNode): PMNode[] {\n if (node.type.name === 'composite') return [node]\n const found: PMNode[] = []\n node.descendants((child) => {\n if (child.type.name === 'composite') {\n found.push(child)\n return false\n }\n return !child.isTextblock\n })\n return found\n}\n\n/**\n * Every Baustein in `doc` whose nearest Baustein ancestor (quotes and lists in between do not count) does not accept\n * its kind, in document order. Top-level Bausteine have no parent and never violate.\n */\nexport function nestingViolations(doc: PMNode, kinds: readonly CompositeKind[]): NestingViolation[] {\n const found: NestingViolation[] = []\n function walk(node: PMNode, parentKind: string | null) {\n node.forEach((child) => {\n if (child.isTextblock || child.isLeaf) return\n if (child.type.name === 'composite') {\n const kind = String(child.attrs.kind)\n if (parentKind !== null && !kindAccepts(kinds, parentKind, kind)) found.push({ parent: parentKind, child: kind })\n walk(child, kind)\n }\n else walk(child, parentKind)\n })\n }\n walk(doc, null)\n return found\n}\n\n/** A step that cannot change which Baustein sits in which: marks, text typed or deleted inside one textblock, attributes other than `kind`. */\nfunction keepsNesting(step: Step, before: PMNode): boolean {\n if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) return true\n if (step instanceof AttrStep) return step.attr !== 'kind'\n if (step instanceof ReplaceStep) {\n const { slice } = step\n if (slice.openStart !== 0 || slice.openEnd !== 0 || !slice.content.content.every(child => child.isInline)) return false\n const $from = before.resolve(step.from)\n return $from.parent.isTextblock && $from.sameParent(before.resolve(step.to))\n }\n return false\n}\n\n/**\n * Transactions that were not made by this user's edit: collaboration (y-sync marks remote changes and Yjs undo/redo\n * with `isChangeOrigin`) and prosemirror-history's undo/redo. They replay what was allowed, or what others wrote.\n */\nfunction isReplay(tr: Transaction): boolean {\n const sync = tr.getMeta('y-sync$') as { isChangeOrigin?: boolean } | undefined\n return sync?.isChangeOrigin === true || tr.getMeta('history$') !== undefined\n}\n\n/** The pair of kinds that occurs more often in `after` than in `before`, if any. */\nfunction addedViolation(before: readonly NestingViolation[], after: readonly NestingViolation[]): NestingViolation | undefined {\n const counts = new Map<string, number>()\n const key = (v: NestingViolation) => JSON.stringify([v.parent, v.child])\n for (const v of before) counts.set(key(v), (counts.get(key(v)) ?? 0) + 1)\n for (const v of after) {\n const left = counts.get(key(v)) ?? 0\n if (left === 0) return v\n counts.set(key(v), left - 1)\n }\n return after[0]\n}\n\nexport interface AcceptedChildrenOptions {\n /** Shows the notice of a refused edit (default: dropped). The composites feature passes the surface's `ctx.notify`. */\n notify: Notifier\n /** The translator of the notice. The composites feature passes the surface's `ctx.t`. */\n t: Translate\n}\n\n/**\n * Enforces the kinds' accepted children (`CompositeKind.accepts`) for every local edit at one place: a transaction that\n * leaves the document with more Bausteine nested in a Baustein that does not accept them than before is refused — block\n * drag, „In Baustein umwandeln“, paste, AI inserts and review acceptance, `moveBlockInto` — and the user is told why.\n * Existing violations stay: transactions that add none (typing, undoing) pass, and so do collaboration replays, undo/redo\n * and loading a whole document. Client-only, no schema: kinds are read from the editor (`compositeKindsOf`).\n */\nexport const AcceptedChildren = Extension.create<AcceptedChildrenOptions>({\n name: 'acceptedChildren',\n addOptions: () => ({ notify: () => {}, t: createTranslator() }),\n addProseMirrorPlugins() {\n const { editor } = this\n const { notify, t } = this.options\n return [new Plugin({\n key: new PluginKey('acceptedChildren'),\n filterTransaction(tr, state) {\n if (!tr.docChanged || isReplay(tr)) return true\n // `setContent` loads a whole new document; that is not an edit of the existing one.\n if (tr.steps.some((step, index) => step instanceof ReplaceStep && step.from === 0 && step.to === tr.docs[index]!.content.size)) return true\n if (tr.steps.every((step, index) => keepsNesting(step, tr.docs[index]!))) return true\n const kinds = compositeKindsOf(editor)\n const before = nestingViolations(state.doc, kinds)\n const after = nestingViolations(tr.doc, kinds)\n if (after.length <= before.length) return true\n const added = addedViolation(before, after)\n notify({\n id: 'composites-accepted-children',\n title: t('composites.nesting.title'),\n ...(added && { description: nestingReason(kinds, added.parent, added.child, t) }),\n kind: 'warning',\n icon: 'i-lucide-ban',\n })\n return false\n },\n })]\n },\n})\n"],"mappings":";;;;;;;;AAgBA,SAAgB,cAAc,OAAiC,QAAgB,OAAe,GAAsB;CAClH,OAAO,EAAE,8BAA8B;EAAE,QAAQ,cAAc,OAAO,MAAM,CAAC,CAAC;EAAO,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC;CAAM,CAAC;AACjI;;;;;AAMA,SAAgB,oBAAoB,MAAwB;CAC1D,IAAI,KAAK,KAAK,SAAS,aAAa,OAAO,CAAC,IAAI;CAChD,MAAM,QAAkB,CAAC;CACzB,KAAK,aAAa,UAAU;EAC1B,IAAI,MAAM,KAAK,SAAS,aAAa;GACnC,MAAM,KAAK,KAAK;GAChB,OAAO;EACT;EACA,OAAO,CAAC,MAAM;CAChB,CAAC;CACD,OAAO;AACT;;;;;AAMA,SAAgB,kBAAkB,KAAa,OAAqD;CAClG,MAAM,QAA4B,CAAC;CACnC,SAAS,KAAK,M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O,IAAI,IAAI,CAAC,CAAC,KAAK;EACnC,IAAI,SAAS,GAAG,OAAO;EACvB,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC;CAC7B;CACA,OAAO,MAAM;AACf;;;;;;;;AAgBA,MAAa,mBAAmB,UAAU,OAAgC;CACxE,MAAM;CACN,mBAAmB;EAAE,cAAc,CAAC;EAAG,GAAG,iBAAiB;CAAE;CAC7D,wBAAwB;EACtB,MAAM,EAAE,WAAW;EACnB,MAAM,EAAE,QAAQ,MAAM,KAAK;EAC3B,OAAO,CAAC,IAAI,OAAO;GACjB,KAAK,IAAI,UAAU,kBAAkB;GACrC,kBAAkB,IAAI,OAAO;IAC3B,IAAI,CAAC,GAAG,cAAc,SAAS,EAAE,GAAG,OAAO;IAE3C,IAAI,GAAG,MAAM,MAAM,MAAM,UAAU,gBAAgB,eAAe,KAAK,SAAS,KAAK,KAAK,OAAO,GAAG,KAAK,MAAM,CAAE,QAAQ,IAAI,GAAG,OAAO;IACvI,IAAI,GAAG,MAAM,OAAO,MAAM,UAAU,aAAa,MAAM,GAAG,KAAK,MAAO,CAAC,GAAG,OAAO;IACjF,MAAM,QAAQ,iBAAiB,MAAM;IACrC,MAAM,SAAS,kBAAkB,MAAM,KAAK,KAAK;IACjD,MAAM,QAAQ,kBAAkB,GAAG,KAAK,KAAK;IAC7C,IAAI,MAAM,UAAU,OAAO,QAAQ,OAAO;IAC1C,MAAM,QAAQ,eAAe,QAAQ,KAAK;IAC1C,OAAO;KACL,IAAI;KACJ,OAAO,EAAE,0BAA0B;KACnC,GAAI,SAAS,EAAE,aAAa,cAAc,OAAO,MAAM,QAAQ,MAAM,OAAO,CAAC,EAAE;KAC/E,MAAM;KACN,MAAM;IACR,CAAC;IACD,OAAO;GACT;EACF,CAAC,CAAC;CACJ;AACF,CAAC"}
1
+ {"version":3,"file":"accepted-children.js","names":[],"sources":["../../../src/features/composites/accepted-children.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey, type Transaction } from '@tiptap/pm/state'\nimport { AddMarkStep, AttrStep, RemoveMarkStep, ReplaceStep, type Step } from '@tiptap/pm/transform'\nimport type { InsertGuard } from '../../core/command-types'\nimport type { Notifier } from '../../core/notify'\nimport { createTranslator, type Translate } from '../../i18n'\nimport { type CompositeKind, compositeKind, kindAccepts } from './kinds'\nimport { compositeKindsOf } from './nodes'\n\n/** One Baustein nested in a Baustein that does not accept its kind (both kind ids). */\nexport interface NestingViolation {\n parent: string\n child: string\n}\n\n/** The short sentence for a refused nesting, naming both kinds by label (German: „Notiz nimmt keine Aufgabe auf.“). */\nexport function nestingReason(kinds: readonly CompositeKind[], parent: string, child: string, t: Translate): string {\n return t('composites.nesting.refused', { parent: compositeKind(kinds, parent).label, child: compositeKind(kinds, child).label })\n}\n\n/**\n * The Bausteine of `node`'s subtree, outermost first: `node` itself when it is a Baustein, otherwise the Bausteine\n * directly inside it (not those nested in another Baustein).\n */\nexport function outermostComposites(node: PMNode): PMNode[] {\n if (node.type.name === 'composite') return [node]\n const found: PMNode[] = []\n node.descendants((child) => {\n if (child.type.name === 'composite') {\n found.push(child)\n return false\n }\n return !child.isTextblock\n })\n return found\n}\n\n/**\n * Every Baustein in `doc` whose nearest Baustein ancestor (quotes and lists in between do not count) does not accept\n * its kind, in document order. Top-level Bausteine have no parent and never violate.\n */\nexport function nestingViolations(doc: PMNode, kinds: readonly CompositeKind[]): NestingViolation[] {\n const found: NestingViolation[] = []\n function walk(node: PMNode, parentKind: string | null) {\n node.forEach((child) => {\n if (child.isTextblock || child.isLeaf) return\n if (child.type.name === 'composite') {\n const kind = String(child.attrs.kind)\n if (parentKind !== null && !kindAccepts(kinds, parentKind, kind)) found.push({ parent: parentKind, child: kind })\n walk(child, kind)\n }\n else walk(child, parentKind)\n })\n }\n walk(doc, null)\n return found\n}\n\n/**\n * The insert guard of the composites feature: a Baustein of kind `creates.attrs.kind` may be created only where the\n * nearest Baustein around the insertion point (`$parent` and outward; quotes and lists in between do not count)\n * accepts that kind, or where there is none. Uses `kindAccepts`, the rule `AcceptedChildren` enforces on transactions\n * through `nestingViolations`, so the `/` menu and toolbar offer exactly what an edit would not be refused for.\n */\nexport const compositeInsertGuard: InsertGuard = (editor, $parent, creates) => {\n const child = creates.attrs?.kind\n if (creates.type !== 'composite' || typeof child !== 'string') return true\n for (let depth = $parent.depth; depth >= 0; depth--) {\n const node = $parent.node(depth)\n if (node.type.name === 'composite') return kindAccepts(compositeKindsOf(editor), String(node.attrs.kind), child)\n }\n return true\n}\n\n/** A step that cannot change which Baustein sits in which: marks, text typed or deleted inside one textblock, attributes other than `kind`. */\nfunction keepsNesting(step: Step, before: PMNode): boolean {\n if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) return true\n if (step instanceof AttrStep) return step.attr !== 'kind'\n if (step instanceof ReplaceStep) {\n const { slice } = step\n if (slice.openStart !== 0 || slice.openEnd !== 0 || !slice.content.content.every(child => child.isInline)) return false\n const $from = before.resolve(step.from)\n return $from.parent.isTextblock && $from.sameParent(before.resolve(step.to))\n }\n return false\n}\n\n/**\n * Transactions that were not made by this user's edit: collaboration (y-sync marks remote changes and Yjs undo/redo\n * with `isChangeOrigin`) and prosemirror-history's undo/redo. They replay what was allowed, or what others wrote.\n */\nfunction isReplay(tr: Transaction): boolean {\n const sync = tr.getMeta('y-sync$') as { isChangeOrigin?: boolean } | undefined\n return sync?.isChangeOrigin === true || tr.getMeta('history$') !== undefined\n}\n\n/** The pair of kinds that occurs more often in `after` than in `before`, if any. */\nfunction addedViolation(before: readonly NestingViolation[], after: readonly NestingViolation[]): NestingViolation | undefined {\n const counts = new Map<string, number>()\n const key = (v: NestingViolation) => JSON.stringify([v.parent, v.child])\n for (const v of before) counts.set(key(v), (counts.get(key(v)) ?? 0) + 1)\n for (const v of after) {\n const left = counts.get(key(v)) ?? 0\n if (left === 0) return v\n counts.set(key(v), left - 1)\n }\n return after[0]\n}\n\nexport interface AcceptedChildrenOptions {\n /** Shows the notice of a refused edit (default: dropped). The composites feature passes the surface's `ctx.notify`. */\n notify: Notifier\n /** The translator of the notice. The composites feature passes the surface's `ctx.t`. */\n t: Translate\n}\n\n/**\n * Enforces the kinds' accepted children (`CompositeKind.accepts`) for every local edit at one place: a transaction that\n * leaves the document with more Bausteine nested in a Baustein that does not accept them than before is refused — block\n * drag, „In Baustein umwandeln“, paste, AI inserts and review acceptance, `moveBlockInto` — and the user is told why.\n * Existing violations stay: transactions that add none (typing, undoing) pass, and so do collaboration replays, undo/redo\n * and loading a whole document. Client-only, no schema: kinds are read from the editor (`compositeKindsOf`).\n */\nexport const AcceptedChildren = Extension.create<AcceptedChildrenOptions>({\n name: 'acceptedChildren',\n addOptions: () => ({ notify: () => {}, t: createTranslator() }),\n addProseMirrorPlugins() {\n const { editor } = this\n const { notify, t } = this.options\n return [new Plugin({\n key: new PluginKey('acceptedChildren'),\n filterTransaction(tr, state) {\n if (!tr.docChanged || isReplay(tr)) return true\n // `setContent` loads a whole new document; that is not an edit of the existing one.\n if (tr.steps.some((step, index) => step instanceof ReplaceStep && step.from === 0 && step.to === tr.docs[index]!.content.size)) return true\n if (tr.steps.every((step, index) => keepsNesting(step, tr.docs[index]!))) return true\n const kinds = compositeKindsOf(editor)\n const before = nestingViolations(state.doc, kinds)\n const after = nestingViolations(tr.doc, kinds)\n if (after.length <= before.length) return true\n const added = addedViolation(before, after)\n notify({\n id: 'composites-accepted-children',\n title: t('composites.nesting.title'),\n ...(added && { description: nestingReason(kinds, added.parent, added.child, t) }),\n kind: 'warning',\n icon: 'i-lucide-ban',\n })\n return false\n },\n })]\n },\n})\n"],"mappings":";;;;;;;;AAiBA,SAAgB,cAAc,OAAiC,QAAgB,OAAe,GAAsB;CAClH,OAAO,EAAE,8BAA8B;EAAE,QAAQ,cAAc,OAAO,MAAM,CAAC,CAAC;EAAO,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC;CAAM,CAAC;AACjI;;;;;AAMA,SAAgB,oBAA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KAAK,KAAK,OAAO,GAAG,KAAK,MAAM,CAAE,QAAQ,IAAI,GAAG,OAAO;IACvI,IAAI,GAAG,MAAM,OAAO,MAAM,UAAU,aAAa,MAAM,GAAG,KAAK,MAAO,CAAC,GAAG,OAAO;IACjF,MAAM,QAAQ,iBAAiB,MAAM;IACrC,MAAM,SAAS,kBAAkB,MAAM,KAAK,KAAK;IACjD,MAAM,QAAQ,kBAAkB,GAAG,KAAK,KAAK;IAC7C,IAAI,MAAM,UAAU,OAAO,QAAQ,OAAO;IAC1C,MAAM,QAAQ,eAAe,QAAQ,KAAK;IAC1C,OAAO;KACL,IAAI;KACJ,OAAO,EAAE,0BAA0B;KACnC,GAAI,SAAS,EAAE,aAAa,cAAc,OAAO,MAAM,QAAQ,MAAM,OAAO,CAAC,EAAE;KAC/E,MAAM;KACN,MAAM;IACR,CAAC;IACD,OAAO;GACT;EACF,CAAC,CAAC;CACJ;AACF,CAAC"}
@@ -1,5 +1,8 @@
1
+ import { findBlockById } from "../../core/schema/block-ids.js";
1
2
  import { compositeKind } from "./kinds.js";
3
+ import { derivationOf } from "./derivation.js";
2
4
  import { compositeKindsOf } from "./nodes.js";
5
+ import { citeFull } from "./bibliography.js";
3
6
  //#region src/features/composites/ai-brief.ts
4
7
  const PLACEHOLDER = /\{([\p{L}\p{N}_-]+)\}/gu;
5
8
  const isFilled = (value) => typeof value === "string" && value !== "" || typeof value === "number";
@@ -21,6 +24,34 @@ function compositeAiBrief(editor, pos) {
21
24
  const meta = node.attrs.meta ?? {};
22
25
  const fields = kind.fields.flatMap((field) => {
23
26
  const raw = meta[field.key];
27
+ if (field.type === "bibliography") {
28
+ const bib = raw;
29
+ return bib && typeof bib === "object" && typeof bib.type === "string" ? [{
30
+ key: field.key,
31
+ label: field.label,
32
+ value: citeFull({
33
+ ...bib,
34
+ title: node.child(0).textContent
35
+ })
36
+ }] : [];
37
+ }
38
+ if (field.type === "reference") {
39
+ const target = typeof raw === "string" && raw ? findBlockById(editor.state.doc, raw)?.node : void 0;
40
+ const title = target?.type.name === "composite" ? target.child(0).textContent.trim() : "";
41
+ return title ? [{
42
+ key: field.key,
43
+ label: field.label,
44
+ value: title
45
+ }] : [];
46
+ }
47
+ if (field.type === "derivation") {
48
+ const derivation = derivationOf(node);
49
+ return derivation ? [{
50
+ key: field.key,
51
+ label: field.label,
52
+ value: `${derivation.method} from ${"asset" in derivation.from ? derivation.from.asset : derivation.from.block}`
53
+ }] : [];
54
+ }
24
55
  if (!isFilled(raw)) return [];
25
56
  const value = String(raw);
26
57
  return [{
@@ -1 +1 @@
1
- {"version":3,"file":"ai-brief.js","names":[],"sources":["../../../src/features/composites/ai-brief.ts"],"sourcesContent":["// Vue-free: what one Baustein tells the model (read by „Baustein füllen (KI)“, see `integrations/composite-ai`).\nimport type { Editor, JSONContent } from '@tiptap/core'\n// Types only: brings in the `editor.markdown` augmentation of `@tiptap/markdown` for contexts that do not otherwise load it.\nimport type {} from '@tiptap/markdown'\nimport { compositeKind } from './kinds'\nimport { COMPOSITE_CHROME_COUNT, compositeKindsOf } from './nodes'\n\n/** What one Baustein tells the model: kind brief, place in the hierarchy, chrome, field values, resolved instruction and skeleton, body. */\nexport interface CompositeAiBrief {\n kind: { id: string, label: string, purpose?: string }\n /** Titles of the enclosing composites, outermost first (empty at document level). */\n path: string[]\n title: string\n description: string\n tags: string[]\n /** Declared fields with a non-empty value, `select` values as their option label. */\n fields: { key: string, label: string, value: string }[]\n /** `meta[ai.instructionsField]` when non-empty, else `ai.instructions`, else ''. */\n instructions: string\n /** `ai.skeleton` with `{key}` replaced by the string value of `meta[key]` (declared fields only); '' without a skeleton. */\n skeleton: string\n /** Body blocks as Markdown ('' for a body without text). */\n body: string\n}\n\nconst PLACEHOLDER = /\\{([\\p{L}\\p{N}_-]+)\\}/gu\n\nconst isFilled = (value: unknown): value is string | number => (typeof value === 'string' && value !== '') || typeof value === 'number'\n\n/** The brief of the composite at `pos`; null unless the node there is a composite whose kind has `ai`. */\nexport function compositeAiBrief(editor: Editor, pos: number): CompositeAiBrief | null {\n const node = editor.state.doc.nodeAt(pos)\n if (node?.type.name !== 'composite' || node.childCount < COMPOSITE_CHROME_COUNT) return null\n const kind = compositeKind(compositeKindsOf(editor), String(node.attrs.kind))\n const ai = kind.ai\n if (!ai) return null\n\n const $pos = editor.state.doc.resolve(pos)\n const path: string[] = []\n for (let depth = 1; depth <= $pos.depth; depth++) {\n const ancestor = $pos.node(depth)\n if (ancestor.type.name === 'composite') path.push(ancestor.child(0).textContent.trim())\n }\n\n const tags: unknown = node.child(2).attrs.tags\n const body = Array.from({ length: node.childCount - COMPOSITE_CHROME_COUNT }, (_, i) => node.child(COMPOSITE_CHROME_COUNT + i))\n const meta: Record<string, unknown> = node.attrs.meta ?? {}\n\n const fields = kind.fields.flatMap((field) => {\n const raw = meta[field.key]\n if (!isFilled(raw)) return []\n const value = String(raw)\n return [{ key: field.key, label: field.label, value: field.type === 'select' ? (field.options?.find(option => option.value === value)?.label ?? value) : value }]\n })\n const keys = new Set(kind.fields.map(field => field.key))\n const own = ai.instructionsField ? String(meta[ai.instructionsField] ?? '').trim() : ''\n\n return {\n kind: { id: kind.id, label: kind.label, ...(ai.purpose && { purpose: ai.purpose }) },\n path,\n title: node.child(0).textContent,\n description: node.child(1).textContent,\n tags: Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string') : [],\n fields,\n instructions: own || ai.instructions?.trim() || '',\n skeleton: ai.skeleton?.replace(PLACEHOLDER, (match, key: string) => keys.has(key) && isFilled(meta[key]) ? String(meta[key]) : match) ?? '',\n body: body.some(child => child.textContent.trim())\n ? editor.markdown!.serialize({ type: 'doc', content: body.map(child => child.toJSON() as JSONContent) }).trim()\n : '',\n }\n}\n"],"mappings":";;;AAyBA,MAAM,cAAc;AAEpB,MAAM,YAAY,UAA8C,OAAO,UAAU,YAAY,UAAU,MAAO,OAAO,UAAU;;AAG/H,SAAgB,iBAAiB,QAAgB,KAAsC;CACrF,MAAM,OAAO,OAAO,MAAM,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AO,KAAK;GAAO,GAAI,GAAG,WAAW,EAAE,SAAS,GAAG,QAAQ;EAAG;EACnF;EACA,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC;EACrB,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC;EAC3B,MAAM,MAAM,QAAQ,IAAI,IAAI,KAAK,QAAQ,QAAuB,OAAO,QAAQ,QAAQ,IAAI,CAAC;EAC5F;EACA,cAAc,OAAO,GAAG,cAAc,KAAK,KAAK;EAChD,UAAU,GAAG,UAAU,QAAQ,cAAc,OAAO,QAAgB,KAAK,IAAI,GAAG,KAAK,SAAS,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,KAAK;EACzI,MAAM,KAAK,MAAK,UAAS,MAAM,YAAY,KAAK,CAAC,IAC7C,OAAO,SAAU,UAAU;GAAE,MAAM;GAAO,SAAS,KAAK,KAAI,UAAS,MAAM,OAAO,CAAgB;EAAE,CAAC,CAAC,CAAC,KAAK,IAC5G;CACN;AACF"}
1
+ {"version":3,"file":"ai-brief.js","names":[],"sources":["../../../src/features/composites/ai-brief.ts"],"sourcesContent":["// Vue-free: what one Baustein tells the model (read by „Baustein füllen (KI)“, see `integrations/composite-ai`).\nimport type { Editor, JSONContent } from '@tiptap/core'\n// Types only: brings in the `editor.markdown` augmentation of `@tiptap/markdown` for contexts that do not otherwise load it.\nimport type {} from '@tiptap/markdown'\nimport { findBlockById } from '../../core/schema/block-ids'\nimport { type CslItem, citeFull } from './bibliography'\nimport { derivationOf } from './derivation'\nimport { compositeKind } from './kinds'\nimport { COMPOSITE_CHROME_COUNT, compositeKindsOf } from './nodes'\n\n/** What one Baustein tells the model: kind brief, place in the hierarchy, chrome, field values, resolved instruction and skeleton, body. */\nexport interface CompositeAiBrief {\n kind: { id: string, label: string, purpose?: string }\n /** Titles of the enclosing composites, outermost first (empty at document level). */\n path: string[]\n title: string\n description: string\n tags: string[]\n /** Declared fields with a non-empty value, `select` values as their option label. */\n fields: { key: string, label: string, value: string }[]\n /** `meta[ai.instructionsField]` when non-empty, else `ai.instructions`, else ''. */\n instructions: string\n /** `ai.skeleton` with `{key}` replaced by the string value of `meta[key]` (declared fields only); '' without a skeleton. */\n skeleton: string\n /** Body blocks as Markdown ('' for a body without text). */\n body: string\n}\n\nconst PLACEHOLDER = /\\{([\\p{L}\\p{N}_-]+)\\}/gu\n\nconst isFilled = (value: unknown): value is string | number => (typeof value === 'string' && value !== '') || typeof value === 'number'\n\n/** The brief of the composite at `pos`; null unless the node there is a composite whose kind has `ai`. */\nexport function compositeAiBrief(editor: Editor, pos: number): CompositeAiBrief | null {\n const node = editor.state.doc.nodeAt(pos)\n if (node?.type.name !== 'composite' || node.childCount < COMPOSITE_CHROME_COUNT) return null\n const kind = compositeKind(compositeKindsOf(editor), String(node.attrs.kind))\n const ai = kind.ai\n if (!ai) return null\n\n const $pos = editor.state.doc.resolve(pos)\n const path: string[] = []\n for (let depth = 1; depth <= $pos.depth; depth++) {\n const ancestor = $pos.node(depth)\n if (ancestor.type.name === 'composite') path.push(ancestor.child(0).textContent.trim())\n }\n\n const tags: unknown = node.child(2).attrs.tags\n const body = Array.from({ length: node.childCount - COMPOSITE_CHROME_COUNT }, (_, i) => node.child(COMPOSITE_CHROME_COUNT + i))\n const meta: Record<string, unknown> = node.attrs.meta ?? {}\n\n const fields = kind.fields.flatMap((field) => {\n const raw = meta[field.key]\n if (field.type === 'bibliography') {\n const bib = raw as Partial<CslItem> | null | undefined\n return bib && typeof bib === 'object' && typeof bib.type === 'string' ? [{ key: field.key, label: field.label, value: citeFull({ ...(bib as CslItem), title: node.child(0).textContent }) }] : []\n }\n if (field.type === 'reference') {\n const target = typeof raw === 'string' && raw ? findBlockById(editor.state.doc, raw)?.node : undefined\n const title = target?.type.name === 'composite' ? target.child(0).textContent.trim() : ''\n return title ? [{ key: field.key, label: field.label, value: title }] : []\n }\n if (field.type === 'derivation') {\n const derivation = derivationOf(node)\n return derivation ? [{ key: field.key, label: field.label, value: `${derivation.method} from ${'asset' in derivation.from ? derivation.from.asset : derivation.from.block}` }] : []\n }\n if (!isFilled(raw)) return []\n const value = String(raw)\n return [{ key: field.key, label: field.label, value: field.type === 'select' ? (field.options?.find(option => option.value === value)?.label ?? value) : value }]\n })\n const keys = new Set(kind.fields.map(field => field.key))\n const own = ai.instructionsField ? String(meta[ai.instructionsField] ?? '').trim() : ''\n\n return {\n kind: { id: kind.id, label: kind.label, ...(ai.purpose && { purpose: ai.purpose }) },\n path,\n title: node.child(0).textContent,\n description: node.child(1).textContent,\n tags: Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string') : [],\n fields,\n instructions: own || ai.instructions?.trim() || '',\n skeleton: ai.skeleton?.replace(PLACEHOLDER, (match, key: string) => keys.has(key) && isFilled(meta[key]) ? String(meta[key]) : match) ?? '',\n body: body.some(child => child.textContent.trim())\n ? editor.markdown!.serialize({ type: 'doc', content: body.map(child => child.toJSON() as JSONContent) }).trim()\n : '',\n }\n}\n"],"mappings":";;;;;;AA4BA,MAAM,cAAc;AAEpB,MAAM,YAAY,UAA8C,OAAO,UAAU,YAAY,UAAU,MAAO,OAAO,UAAU;;AAG/H,SAAgB,iBAAiB,QAAgB,KAAsC;CACrF,MAAM,OAAO,OAAO,MAAM,IAAI,OAAO,GAAG;CACxC,IAAI,MAAM,KAAK,SAAS,eAAe,KAAK,aAAA,GAAqC,OAAO;CACxF,MAAM,OAAO,cAAc,iBAAiB,MAAM,GAAG,OAAO,KAAK,MAAM,IAAI,CAAC;CAC5E,MAAM,KAAK,KAAK;CAChB,IAAI,CAAC,IAAI,OAAO;CAEhB,MAAM,OAAO,OAAO,MAAM,IAAI,QAAQ,GAAG;CACzC,MAAM,OAAiB,CAAC;CACxB,KAAK,IAAI,QAAQ,GAAG,SAAS,KAAK,OAAO,SAAS;EAChD,MAAM,WAAW,KAAK,KAAK,KAAK;EAChC,IAAI,SAAS,KAAK,SAAS,aAAa,KAAK,KAAK,SAAS,MAAM,CAAC,CAAC,CAAC,YAAY,K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AAC;GAAE,KAAK,MAAM;GAAK,OAAO,MAAM;GAAO,OAAO,MAAM,SAAS,WAAY,MAAM,SAAS,MAAK,WAAU,OAAO,UAAU,KAAK,CAAC,EAAE,SAAS,QAAS;EAAM,CAAC;CAClK,CAAC;CACD,MAAM,OAAO,IAAI,IAAI,KAAK,OAAO,KAAI,UAAS,MAAM,GAAG,CAAC;CACxD,MAAM,MAAM,GAAG,oBAAoB,OAAO,KAAK,GAAG,sBAAsB,EAAE,CAAC,CAAC,KAAK,IAAI;CAErF,OAAO;EACL,MAAM;GAAE,IAAI,KAAK;GAAI,OAAO,KAAK;GAAO,GAAI,GAAG,WAAW,EAAE,SAAS,GAAG,QAAQ;EAAG;EACnF;EACA,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC;EACrB,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC;EAC3B,MAAM,MAAM,QAAQ,IAAI,IAAI,KAAK,QAAQ,QAAuB,OAAO,QAAQ,QAAQ,IAAI,CAAC;EAC5F;EACA,cAAc,OAAO,GAAG,cAAc,KAAK,KAAK;EAChD,UAAU,GAAG,UAAU,QAAQ,cAAc,OAAO,QAAgB,KAAK,IAAI,GAAG,KAAK,SAAS,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,KAAK;EACzI,MAAM,KAAK,MAAK,UAAS,MAAM,YAAY,KAAK,CAAC,IAC7C,OAAO,SAAU,UAAU;GAAE,MAAM;GAAO,SAAS,KAAK,KAAI,UAAS,MAAM,OAAO,CAAgB;EAAE,CAAC,CAAC,CAAC,KAAK,IAC5G;CACN;AACF"}
@@ -0,0 +1,11 @@
1
+ import "@tiptap/core";
2
+ //#region src/features/composites/bibliography-command.d.ts
3
+ declare module '@tiptap/core' {
4
+ interface Commands<ReturnType> {
5
+ compositeBibliographyFetch: {
6
+ /** Fetches the bibliographic data of the Baustein at `pos` into its `meta.bib` (`ai.extract`, method `bibliography`). Registered by `composite-ai`. */
7
+ fetchCompositeBibliography: (pos: number) => ReturnType;
8
+ };
9
+ }
10
+ }
11
+ //# sourceMappingURL=bibliography-command.d.ts.map
@@ -0,0 +1,90 @@
1
+ import { yearOf } from "./bibliography.js";
2
+ //#region src/features/composites/bibliography-form.ts
3
+ /** Keys of the CSL item the form edits; every other stored key is kept as it is. */
4
+ const MANAGED_KEYS = {
5
+ "type": true,
6
+ "author": true,
7
+ "issued": true,
8
+ "container-title": true,
9
+ "volume": true,
10
+ "issue": true,
11
+ "page": true,
12
+ "publisher": true,
13
+ "DOI": true,
14
+ "ISBN": true,
15
+ "URL": true,
16
+ "abstract": true
17
+ };
18
+ /** Never stored in `meta.bib`: the block id and the title belong to the Baustein. */
19
+ const FOREIGN_KEYS = {
20
+ id: true,
21
+ title: true
22
+ };
23
+ /** The names of `authors`, one per non-empty line. */
24
+ function parseAuthors(text) {
25
+ return text.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => {
26
+ const comma = line.indexOf(",");
27
+ if (comma < 0) return { literal: line };
28
+ const family = line.slice(0, comma).trim();
29
+ const given = line.slice(comma + 1).trim();
30
+ return family ? {
31
+ family,
32
+ ...given && { given }
33
+ } : { literal: line };
34
+ });
35
+ }
36
+ /** `names` as the text `parseAuthors` reads back: `Family, Given` per line. */
37
+ function authorsText(names) {
38
+ return (names ?? []).map((name) => name.family ? name.given ? `${name.family}, ${name.given}` : `${name.family},` : name.literal ?? "").filter(Boolean).join("\n");
39
+ }
40
+ /** The form values of `item`; without an item the defaults of an empty form. */
41
+ function bibFormOf(item) {
42
+ const year = item ? yearOf(item) : null;
43
+ return {
44
+ type: item?.type ?? "article-journal",
45
+ authors: authorsText(item?.author),
46
+ year: year === null ? "" : String(year),
47
+ containerTitle: item?.["container-title"] ?? "",
48
+ volume: item?.volume ?? "",
49
+ issue: item?.issue ?? "",
50
+ page: item?.page ?? "",
51
+ publisher: item?.publisher ?? "",
52
+ doi: item?.DOI ?? "",
53
+ isbn: item?.ISBN ?? "",
54
+ url: item?.URL ?? "",
55
+ abstract: item?.abstract ?? ""
56
+ };
57
+ }
58
+ /**
59
+ * The complete CSL item for `form`: no `title` and no empty strings. Keys the form does not edit (`editor`,
60
+ * `publisher-place`, `language`, …) are taken over from `base`; an unchanged year keeps the stored date parts (month, day).
61
+ */
62
+ function bibItemOf(form, base) {
63
+ const text = (value) => value.trim() || void 0;
64
+ const author = parseAuthors(form.authors);
65
+ const year = Number.parseInt(form.year, 10);
66
+ const keptDate = base?.issued && yearOf(base) === year ? base.issued : void 0;
67
+ const fields = {
68
+ author: author.length ? author : void 0,
69
+ issued: Number.isFinite(year) ? keptDate ?? { "date-parts": [[year]] } : void 0,
70
+ "container-title": text(form.containerTitle),
71
+ volume: text(form.volume),
72
+ issue: text(form.issue),
73
+ page: text(form.page),
74
+ publisher: text(form.publisher),
75
+ DOI: text(form.doi),
76
+ ISBN: text(form.isbn),
77
+ URL: text(form.url),
78
+ abstract: text(form.abstract)
79
+ };
80
+ const kept = Object.entries(base ?? {}).filter(([key, value]) => !MANAGED_KEYS[key] && !FOREIGN_KEYS[key] && value !== "" && value !== void 0 && value !== null);
81
+ const entries = [...Object.entries(fields).filter(([, value]) => value !== void 0), ...kept];
82
+ return {
83
+ type: form.type,
84
+ ...Object.fromEntries(entries)
85
+ };
86
+ }
87
+ //#endregion
88
+ export { authorsText, bibFormOf, bibItemOf, parseAuthors };
89
+
90
+ //# sourceMappingURL=bibliography-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bibliography-form.js","names":[],"sources":["../../../src/features/composites/bibliography-form.ts"],"sourcesContent":["// Vue-free: the form model of the bibliography editor (`BibliographyEditor` on Vue and React) — a CSL item as flat strings and back.\nimport { type CslItem, type CslName, type CslType, yearOf } from './bibliography'\n\n/** The CSL item as the editor's inputs hold it: one string per input. */\nexport interface BibForm {\n type: CslType\n /** One person per line: `Family, Given`; a line without a comma is an institution or an unparsed name. */\n authors: string\n year: string\n containerTitle: string\n volume: string\n issue: string\n page: string\n publisher: string\n doi: string\n isbn: string\n url: string\n abstract: string\n}\n\n/** Keys of the CSL item the form edits; every other stored key is kept as it is. */\nconst MANAGED_KEYS: Record<string, true> = { 'type': true, 'author': true, 'issued': true, 'container-title': true, 'volume': true, 'issue': true, 'page': true, 'publisher': true, 'DOI': true, 'ISBN': true, 'URL': true, 'abstract': true }\n/** Never stored in `meta.bib`: the block id and the title belong to the Baustein. */\nconst FOREIGN_KEYS: Record<string, true> = { id: true, title: true }\n\n/** The names of `authors`, one per non-empty line. */\nexport function parseAuthors(text: string): CslName[] {\n return text.split('\\n').map(line => line.trim()).filter(Boolean).map((line) => {\n const comma = line.indexOf(',')\n if (comma < 0) return { literal: line }\n const family = line.slice(0, comma).trim()\n const given = line.slice(comma + 1).trim()\n return family ? { family, ...(given && { given }) } : { literal: line }\n })\n}\n\n/** `names` as the text `parseAuthors` reads back: `Family, Given` per line. */\nexport function authorsText(names: readonly CslName[] | undefined): string {\n return (names ?? []).map(name => name.family ? (name.given ? `${name.family}, ${name.given}` : `${name.family},`) : (name.literal ?? '')).filter(Boolean).join('\\n')\n}\n\n/** The form values of `item`; without an item the defaults of an empty form. */\nexport function bibFormOf(item: CslItem | null | undefined): BibForm {\n const year = item ? yearOf(item) : null\n return {\n type: item?.type ?? 'article-journal',\n authors: authorsText(item?.author),\n year: year === null ? '' : String(year),\n containerTitle: item?.['container-title'] ?? '',\n volume: item?.volume ?? '',\n issue: item?.issue ?? '',\n page: item?.page ?? '',\n publisher: item?.publisher ?? '',\n doi: item?.DOI ?? '',\n isbn: item?.ISBN ?? '',\n url: item?.URL ?? '',\n abstract: item?.abstract ?? '',\n }\n}\n\n/**\n * The complete CSL item for `form`: no `title` and no empty strings. Keys the form does not edit (`editor`,\n * `publisher-place`, `language`, …) are taken over from `base`; an unchanged year keeps the stored date parts (month, day).\n */\nexport function bibItemOf(form: BibForm, base?: CslItem | null): CslItem {\n const text = (value: string) => value.trim() || undefined\n const author = parseAuthors(form.authors)\n const year = Number.parseInt(form.year, 10)\n const keptDate = base?.issued && yearOf(base) === year ? base.issued : undefined\n const fields: Record<string, unknown> = {\n author: author.length ? author : undefined,\n issued: Number.isFinite(year) ? (keptDate ?? { 'date-parts': [[year]] }) : undefined,\n 'container-title': text(form.containerTitle),\n volume: text(form.volume),\n issue: text(form.issue),\n page: text(form.page),\n publisher: text(form.publisher),\n DOI: text(form.doi),\n ISBN: text(form.isbn),\n URL: text(form.url),\n abstract: text(form.abstract),\n }\n const kept = Object.entries(base ?? {}).filter(([key, value]) => !MANAGED_KEYS[key] && !FOREIGN_KEYS[key] && value !== '' && value !== undefined && value !== null)\n const entries = [...Object.entries(fields).filter(([, value]) => value !== undefined), ...kept]\n return { type: form.type, ...Object.fromEntries(entries) }\n}\n"],"mappings":";;;AAqBA,MAAM,eAAqC;CAAE,QAAQ;CAAM,UAAU;CAAM,UAAU;CAAM,mBAAmB;CAAM,UAAU;CAAM,SAAS;CAAM,QAAQ;CAAM,aAAa;CAAM,OAAO;CAAM,QAAQ;CAAM,OAAO;CAAM,YAAY;AAAK;;AAE7O,MAAM,eAAqC;CAAE,IAAI;CAAM,OAAO;AAAK;;AAGnE,SAAgB,aAAa,MAAyB;CACpD,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,SAAS;EAC7E,MAAM,QAAQ,KAAK,QAAQ,GAAG;EAC9B,IAAI,QAAQ,GAAG,OAAO,EAAE,SAAS,KAAK;EACtC,MAAM,SAAS,KAAK,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK;EACzC,MAAM,QAAQ,KAAK,MAAM,QAAQ,CAAC,CAAC,CAAC,KAAK;EACzC,OAAO,SAAS;GAAE;GAAQ,GAAI,SAAS,EAAE,MAAM;EAAG,IAAI,EAAE,SAAS,KAAK;CACxE,CAAC;AACH;;AAGA,SAAgB,YAAY,OAA+C;CACzE,QAAQ,SAAS,CAAC,EAAA,CAAG,KAAI,SAAQ,KAAK,SAAU,KAAK,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Q;CAC9B;CACA,MAAM,OAAO,OAAO,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC,aAAa,QAAQ,CAAC,aAAa,QAAQ,UAAU,MAAM,UAAU,KAAA,KAAa,UAAU,IAAI;CAClK,MAAM,UAAU,CAAC,GAAG,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,GAAG,GAAG,IAAI;CAC9F,OAAO;EAAE,MAAM,KAAK;EAAM,GAAG,OAAO,YAAY,OAAO;CAAE;AAC3D"}
@@ -0,0 +1,33 @@
1
+ import { Translate } from "../../i18n/index.js";
2
+ import { CSL_TYPES, CslDate, CslItem, CslName, CslType } from "../../core/backend-types.js";
3
+ import { BIB_KEY } from "./meta-keys.js";
4
+ import { Node } from "@tiptap/pm/model";
5
+ //#region src/features/composites/bibliography.d.ts
6
+ /** The select options of the CSL types, labelled through `t`. */
7
+ export declare function cslTypeOptions(t: Translate): {
8
+ value: CslType;
9
+ label: string;
10
+ }[];
11
+ /** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */
12
+ export declare function bibOf(node: Node): CslItem | null;
13
+ /** The full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */
14
+ export declare function cslOf(node: Node): (CslItem & {
15
+ id: string;
16
+ title: string;
17
+ }) | null;
18
+ /** The year of the first date part of `issued`, or `null`. */
19
+ export declare function yearOf(csl: Pick<CslItem, 'issued'>): number | null;
20
+ /** "Doe 2024", "Doe & Roe 2024", "Doe et al. 2024"; without authors the first 40 characters of `title`; without a year no year. */
21
+ export declare function citeShort(csl: Pick<CslItem, 'author' | 'issued'>, title: string): string;
22
+ /** An APA-like reference: "Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…"; empty parts are left out. */
23
+ export declare function citeFull(csl: CslItem & {
24
+ title: string;
25
+ }): string;
26
+ /** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */
27
+ export declare function bibtexOf(csl: CslItem & {
28
+ id: string;
29
+ title: string;
30
+ }): string;
31
+ //#endregion
32
+ export { BIB_KEY, CSL_TYPES, type CslDate, type CslItem, type CslName, type CslType };
33
+ //# sourceMappingURL=bibliography.d.ts.map
@@ -0,0 +1,120 @@
1
+ import { blockIdOf } from "../../core/schema/block-ids.js";
2
+ import { BIB_KEY } from "./meta-keys.js";
3
+ import { CSL_TYPES } from "../../core/backend-types.js";
4
+ //#region src/features/composites/bibliography.ts
5
+ /** The select options of the CSL types, labelled through `t`. */
6
+ function cslTypeOptions(t) {
7
+ return CSL_TYPES.map((value) => ({
8
+ value,
9
+ label: t(`composites.bib.type.${value}`)
10
+ }));
11
+ }
12
+ /** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */
13
+ function bibOf(node) {
14
+ const bib = node.attrs.meta?.["bib"];
15
+ if (!bib || typeof bib !== "object" || Array.isArray(bib)) return null;
16
+ return "type" in bib && typeof bib.type === "string" ? bib : null;
17
+ }
18
+ /** The full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */
19
+ function cslOf(node) {
20
+ const bib = bibOf(node);
21
+ if (!bib) return null;
22
+ return {
23
+ ...bib,
24
+ id: blockIdOf(node) ?? "",
25
+ title: node.childCount > 0 ? node.child(0).textContent : ""
26
+ };
27
+ }
28
+ /** The year of the first date part of `issued`, or `null`. */
29
+ function yearOf(csl) {
30
+ const year = csl.issued?.["date-parts"]?.[0]?.[0];
31
+ return typeof year === "number" && Number.isFinite(year) ? year : null;
32
+ }
33
+ const familyOf = (name) => (name.family ?? name.literal ?? "").trim();
34
+ const SHORT_TITLE_LENGTH = 40;
35
+ /** "Doe 2024", "Doe & Roe 2024", "Doe et al. 2024"; without authors the first 40 characters of `title`; without a year no year. */
36
+ function citeShort(csl, title) {
37
+ const families = (csl.author ?? []).map(familyOf).filter(Boolean);
38
+ const who = families.length === 0 ? title.trim().slice(0, SHORT_TITLE_LENGTH) : families.length === 1 ? families[0] : families.length === 2 ? `${families[0]} & ${families[1]}` : `${families[0]} et al.`;
39
+ const year = yearOf(csl);
40
+ return year === null ? who : `${who} ${year}`.trim();
41
+ }
42
+ const initialsOf = (given) => given.split(/[\s-]+/).filter(Boolean).map((word) => `${[...word][0].toUpperCase()}.`).join(" ");
43
+ function apaName(name) {
44
+ const family = (name.family ?? "").trim();
45
+ if (!family) return (name.literal ?? "").trim();
46
+ const initials = initialsOf((name.given ?? "").trim());
47
+ return initials ? `${family}, ${initials}` : family;
48
+ }
49
+ const withStop = (text) => /[.!?]$/.test(text) ? text : `${text}.`;
50
+ /** An APA-like reference: "Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…"; empty parts are left out. */
51
+ function citeFull(csl) {
52
+ const authors = (csl.author ?? []).map(apaName).filter(Boolean).join(", ");
53
+ const year = yearOf(csl);
54
+ const head = [authors, year === null ? "" : `(${year})`].filter(Boolean).join(" ");
55
+ const volume = [csl.volume, csl.issue ? `(${csl.issue})` : ""].filter(Boolean).join("");
56
+ const container = [
57
+ csl["container-title"],
58
+ volume,
59
+ csl.page
60
+ ].map((part) => part?.trim()).filter(Boolean).join(", ");
61
+ const doi = csl.DOI?.trim();
62
+ const link = doi ? /^https?:\/\//i.test(doi) ? doi : `https://doi.org/${doi}` : csl.URL?.trim();
63
+ const publisher = [csl["publisher-place"], csl.publisher].map((part) => part?.trim()).filter(Boolean).join(": ");
64
+ return [
65
+ head && withStop(head),
66
+ csl.title.trim() && withStop(csl.title.trim()),
67
+ container && withStop(container),
68
+ !container && publisher && withStop(publisher),
69
+ link
70
+ ].filter(Boolean).join(" ");
71
+ }
72
+ const BIBTEX_ENTRY = {
73
+ "article-journal": "article",
74
+ book: "book",
75
+ chapter: "incollection",
76
+ "paper-conference": "inproceedings",
77
+ thesis: "phdthesis",
78
+ report: "techreport"
79
+ };
80
+ /** Lowercase ASCII letters and digits of `text`: diacritics folded, everything else dropped. */
81
+ const asciiKey = (text) => text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9]/g, "");
82
+ const bibtexName = (name) => {
83
+ const family = (name.family ?? "").trim();
84
+ if (!family) return (name.literal ?? "").trim();
85
+ const given = (name.given ?? "").trim();
86
+ return given ? `${family}, ${given}` : family;
87
+ };
88
+ /** The citation key: first author's family name + year + first title word (all lowercase ASCII). */
89
+ function bibtexKey(csl) {
90
+ const first = csl.author?.[0];
91
+ const family = first ? asciiKey(familyOf(first)) : "";
92
+ const year = yearOf(csl);
93
+ const word = asciiKey(csl.title.trim().split(/\s+/)[0] ?? "");
94
+ return `${family}${year ?? ""}${word}` || asciiKey(csl.id) || "ref";
95
+ }
96
+ /** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */
97
+ function bibtexOf(csl) {
98
+ const entry = BIBTEX_ENTRY[csl.type] ?? "misc";
99
+ const container = csl["container-title"]?.trim();
100
+ const lines = [
101
+ ["title", csl.title.trim()],
102
+ ["author", (csl.author ?? []).map(bibtexName).filter(Boolean).join(" and ")],
103
+ ["year", yearOf(csl)?.toString()],
104
+ ["journal", entry === "article" ? container : void 0],
105
+ ["booktitle", entry === "incollection" || entry === "inproceedings" ? container : void 0],
106
+ ["volume", csl.volume?.trim()],
107
+ ["number", csl.issue?.trim()],
108
+ ["pages", csl.page?.trim().replace(/\s*[-–—]+\s*/g, "--")],
109
+ [entry === "phdthesis" ? "school" : entry === "techreport" ? "institution" : "publisher", csl.publisher?.trim()],
110
+ ["address", csl["publisher-place"]?.trim()],
111
+ ["doi", csl.DOI?.trim()],
112
+ ["isbn", csl.ISBN?.trim()],
113
+ ["url", csl.URL?.trim()]
114
+ ].filter(([, value]) => value).map(([name, value]) => ` ${name} = {${value}},`);
115
+ return `@${entry}{${bibtexKey(csl)},\n${lines.join("\n")}\n}\n`;
116
+ }
117
+ //#endregion
118
+ export { BIB_KEY, CSL_TYPES, bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf };
119
+
120
+ //# sourceMappingURL=bibliography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bibliography.js","names":[],"sources":["../../../src/features/composites/bibliography.ts"],"sourcesContent":["// Vue-free and server-importable: bibliographic data of a composite („Baustein“) as CSL-JSON in `meta.bib`, and its citation and BibTeX renderings.\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { blockIdOf } from '../../core/schema/block-ids'\nimport type { MessageKey, Translate } from '../../i18n'\nimport { CSL_TYPES, type CslItem, type CslName, type CslType } from '../../core/backend-types'\nimport { BIB_KEY } from './meta-keys'\n\n// The CSL types live in `core/backend-types.ts` (the `ai.extract` wire type names them); this module is their feature-side entry.\nexport { CSL_TYPES, type CslDate, type CslItem, type CslName, type CslType } from '../../core/backend-types'\n\nexport { BIB_KEY }\n\n/** The select options of the CSL types, labelled through `t`. */\nexport function cslTypeOptions(t: Translate): { value: CslType, label: string }[] {\n return CSL_TYPES.map(value => ({ value, label: t(`composites.bib.type.${value}` as MessageKey) }))\n}\n\n/** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */\nexport function bibOf(node: PMNode): CslItem | null {\n const bib: unknown = node.attrs.meta?.[BIB_KEY]\n if (!bib || typeof bib !== 'object' || Array.isArray(bib)) return null\n return 'type' in bib && typeof bib.type === 'string' ? bib as CslItem : null\n}\n\n/** The full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */\nexport function cslOf(node: PMNode): (CslItem & { id: string, title: string }) | null {\n const bib = bibOf(node)\n if (!bib) return null\n return { ...bib, id: blockIdOf(node) ?? '', title: node.childCount > 0 ? node.child(0).textContent : '' }\n}\n\n/** The year of the first date part of `issued`, or `null`. */\nexport function yearOf(csl: Pick<CslItem, 'issued'>): number | null {\n const year = csl.issued?.['date-parts']?.[0]?.[0]\n return typeof year === 'number' && Number.isFinite(year) ? year : null\n}\n\nconst familyOf = (name: CslName): string => (name.family ?? name.literal ?? '').trim()\n\nconst SHORT_TITLE_LENGTH = 40\n\n/** \"Doe 2024\", \"Doe & Roe 2024\", \"Doe et al. 2024\"; without authors the first 40 characters of `title`; without a year no year. */\nexport function citeShort(csl: Pick<CslItem, 'author' | 'issued'>, title: string): string {\n const families = (csl.author ?? []).map(familyOf).filter(Boolean)\n const who = families.length === 0\n ? title.trim().slice(0, SHORT_TITLE_LENGTH)\n : families.length === 1\n ? families[0]!\n : families.length === 2 ? `${families[0]} & ${families[1]}` : `${families[0]} et al.`\n const year = yearOf(csl)\n return year === null ? who : `${who} ${year}`.trim()\n}\n\nconst initialsOf = (given: string): string => given.split(/[\\s-]+/).filter(Boolean).map(word => `${[...word][0]!.toUpperCase()}.`).join(' ')\n\nfunction apaName(name: CslName): string {\n const family = (name.family ?? '').trim()\n if (!family) return (name.literal ?? '').trim()\n const initials = initialsOf((name.given ?? '').trim())\n return initials ? `${family}, ${initials}` : family\n}\n\nconst withStop = (text: string): string => /[.!?]$/.test(text) ? text : `${text}.`\n\n/** An APA-like reference: \"Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…\"; empty parts are left out. */\nexport function citeFull(csl: CslItem & { title: string }): string {\n const authors = (csl.author ?? []).map(apaName).filter(Boolean).join(', ')\n const year = yearOf(csl)\n const head = [authors, year === null ? '' : `(${year})`].filter(Boolean).join(' ')\n const volume = [csl.volume, csl.issue ? `(${csl.issue})` : ''].filter(Boolean).join('')\n const container = [csl['container-title'], volume, csl.page].map(part => part?.trim()).filter(Boolean).join(', ')\n const doi = csl.DOI?.trim()\n const link = doi ? (/^https?:\\/\\//i.test(doi) ? doi : `https://doi.org/${doi}`) : csl.URL?.trim()\n const publisher = [csl['publisher-place'], csl.publisher].map(part => part?.trim()).filter(Boolean).join(': ')\n return [\n head && withStop(head),\n csl.title.trim() && withStop(csl.title.trim()),\n container && withStop(container),\n // A book or report is located by its publisher; a journal article by its container.\n !container && publisher && withStop(publisher),\n link,\n ].filter(Boolean).join(' ')\n}\n\nconst BIBTEX_ENTRY: Partial<Record<CslType, string>> = {\n 'article-journal': 'article',\n book: 'book',\n chapter: 'incollection',\n 'paper-conference': 'inproceedings',\n thesis: 'phdthesis',\n report: 'techreport',\n}\n\n/** Lowercase ASCII letters and digits of `text`: diacritics folded, everything else dropped. */\nconst asciiKey = (text: string): string => text.normalize('NFD').replace(/\\p{M}/gu, '').toLowerCase().replace(/[^a-z0-9]/g, '')\n\nconst bibtexName = (name: CslName): string => {\n const family = (name.family ?? '').trim()\n if (!family) return (name.literal ?? '').trim()\n const given = (name.given ?? '').trim()\n return given ? `${family}, ${given}` : family\n}\n\n/** The citation key: first author's family name + year + first title word (all lowercase ASCII). */\nfunction bibtexKey(csl: CslItem & { id: string, title: string }): string {\n const first = csl.author?.[0]\n const family = first ? asciiKey(familyOf(first)) : ''\n const year = yearOf(csl)\n const word = asciiKey(csl.title.trim().split(/\\s+/)[0] ?? '')\n return `${family}${year ?? ''}${word}` || asciiKey(csl.id) || 'ref'\n}\n\n/** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */\nexport function bibtexOf(csl: CslItem & { id: string, title: string }): string {\n const entry = BIBTEX_ENTRY[csl.type] ?? 'misc'\n const container = csl['container-title']?.trim()\n const fields: [string, string | undefined][] = [\n ['title', csl.title.trim()],\n ['author', (csl.author ?? []).map(bibtexName).filter(Boolean).join(' and ')],\n ['year', yearOf(csl)?.toString()],\n ['journal', entry === 'article' ? container : undefined],\n ['booktitle', entry === 'incollection' || entry === 'inproceedings' ? container : undefined],\n ['volume', csl.volume?.trim()],\n ['number', csl.issue?.trim()],\n ['pages', csl.page?.trim().replace(/\\s*[-–—]+\\s*/g, '--')],\n [entry === 'phdthesis' ? 'school' : entry === 'techreport' ? 'institution' : 'publisher', csl.publisher?.trim()],\n ['address', csl['publisher-place']?.trim()],\n ['doi', csl.DOI?.trim()],\n ['isbn', csl.ISBN?.trim()],\n ['url', csl.URL?.trim()],\n ]\n const lines = fields.filter(([, value]) => value).map(([name, value]) => ` ${name} = {${value}},`)\n return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