@ecsplico/editor 3.6.0 → 4.1.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 (593) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/adapters/direct-ai.d.ts +4 -4
  3. package/dist/adapters/direct-ai.js +2 -2
  4. package/dist/adapters/direct-ai.js.map +1 -1
  5. package/dist/adapters/document-state.d.ts +1 -1
  6. package/dist/adapters/document-state.js.map +1 -1
  7. package/dist/adapters/forge.d.ts +2 -2
  8. package/dist/adapters/forge.js.map +1 -1
  9. package/dist/adapters/nitro.d.ts +11 -3
  10. package/dist/adapters/nitro.js +3 -1
  11. package/dist/adapters/nitro.js.map +1 -1
  12. package/dist/adapters/shared.d.ts +6 -6
  13. package/dist/adapters/shared.js.map +1 -1
  14. package/dist/code/CodeSurface.vue.d.ts +3 -3
  15. package/dist/config/index.d.ts +14 -14
  16. package/dist/config/index.js +8 -8
  17. package/dist/config/index.js.map +1 -1
  18. package/dist/core/backend-types.d.ts +3 -3
  19. package/dist/core/backend-types.js.map +1 -1
  20. package/dist/core/backend.d.ts +4 -4
  21. package/dist/core/backend.js.map +1 -1
  22. package/dist/core/block-convert.d.ts +1 -1
  23. package/dist/core/block-convert.js +5 -5
  24. package/dist/core/block-convert.js.map +1 -1
  25. package/dist/core/block-transfer.d.ts +8 -4
  26. package/dist/core/block-transfer.js +23 -14
  27. package/dist/core/block-transfer.js.map +1 -1
  28. package/dist/core/capabilities.d.ts +113 -0
  29. package/dist/core/capabilities.js +155 -0
  30. package/dist/core/capabilities.js.map +1 -0
  31. package/dist/core/command-types.d.ts +1 -1
  32. package/dist/core/context.js.map +1 -1
  33. package/dist/core/convert.d.ts +5 -5
  34. package/dist/core/convert.js +5 -5
  35. package/dist/core/convert.js.map +1 -1
  36. package/dist/core/core-feature.js +1 -1
  37. package/dist/core/define-editor.d.ts +2 -2
  38. package/dist/core/define-editor.js +34 -6
  39. package/dist/core/define-editor.js.map +1 -1
  40. package/dist/core/derivation.d.ts +119 -0
  41. package/dist/core/derivation.js +187 -0
  42. package/dist/core/derivation.js.map +1 -0
  43. package/dist/core/derive.d.ts +61 -0
  44. package/dist/core/derive.js +69 -0
  45. package/dist/core/derive.js.map +1 -0
  46. package/dist/core/extension-points.d.ts +16 -0
  47. package/dist/core/feature-context.d.ts +5 -1
  48. package/dist/core/feature-context.js +10 -3
  49. package/dist/core/feature-context.js.map +1 -1
  50. package/dist/core/feature.d.ts +41 -19
  51. package/dist/core/feature.js.map +1 -1
  52. package/dist/core/fences.js +1 -1
  53. package/dist/core/fences.js.map +1 -1
  54. package/dist/core/index.d.ts +6 -2
  55. package/dist/core/index.js +5 -1
  56. package/dist/core/pipeline.d.ts +14 -5
  57. package/dist/core/pipeline.js +19 -7
  58. package/dist/core/pipeline.js.map +1 -1
  59. package/dist/core/properties.d.ts +22 -0
  60. package/dist/core/properties.js +17 -0
  61. package/dist/core/properties.js.map +1 -0
  62. package/dist/core/schema/block-ids.js +5 -5
  63. package/dist/core/schema/block-ids.js.map +1 -1
  64. package/dist/core/schema/index.d.ts +2 -1
  65. package/dist/core/schema/index.js +2 -1
  66. package/dist/core/schema/index.js.map +1 -1
  67. package/dist/core/schema/opaque-fence.d.ts +4 -4
  68. package/dist/core/schema/opaque-fence.js +7 -7
  69. package/dist/core/schema/opaque-fence.js.map +1 -1
  70. package/dist/core/schema/persisted-names.d.ts +58 -0
  71. package/dist/core/schema/persisted-names.js +96 -0
  72. package/dist/core/schema/persisted-names.js.map +1 -0
  73. package/dist/core/toolbar-items.js +1 -1
  74. package/dist/core/toolbar-items.js.map +1 -1
  75. package/dist/core/util.js +5 -1
  76. package/dist/core/util.js.map +1 -1
  77. package/dist/document/DocumentSurface.vue.d.ts +3 -3
  78. package/dist/features/ai/agent-ops.js +1 -1
  79. package/dist/features/ai/ai-review.js +1 -1
  80. package/dist/features/ai/assistant.d.ts +4 -4
  81. package/dist/features/ai/assistant.js +1 -1
  82. package/dist/features/ai/assistant.js.map +1 -1
  83. package/dist/features/ai/components/AiSelectionMenu.js +1 -1
  84. package/dist/features/ai/components/AiSelectionMenu.js.map +1 -1
  85. package/dist/features/ai/components/ModelQuickSwitch.js +7 -7
  86. package/dist/features/ai/components/ModelQuickSwitch.js.map +1 -1
  87. package/dist/features/ai/components/ModelQuickSwitch.vue.d.ts +4 -4
  88. package/dist/features/ai/components/SettingsAiTab.js +8 -8
  89. package/dist/features/ai/components/SettingsAiTab.js.map +1 -1
  90. package/dist/features/ai/components/SettingsModelProfiles.js +1 -1
  91. package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
  92. package/dist/features/ai/document-chat-model.d.ts +2 -2
  93. package/dist/features/ai/document-chat-model.js +5 -5
  94. package/dist/features/ai/document-chat-model.js.map +1 -1
  95. package/dist/features/ai/document-chat.js +2 -2
  96. package/dist/features/ai/document-chat.js.map +1 -1
  97. package/dist/features/ai/feature.d.ts +2 -2
  98. package/dist/features/ai/feature.js +2 -2
  99. package/dist/features/ai/feature.js.map +1 -1
  100. package/dist/features/ai/ghost-autocomplete.d.ts +4 -4
  101. package/dist/features/ai/ghost-autocomplete.js +1 -1
  102. package/dist/features/ai/ghost-autocomplete.js.map +1 -1
  103. package/dist/features/ai/index.d.ts +3 -3
  104. package/dist/features/ai/index.js +2 -2
  105. package/dist/features/ai/model-profiles.d.ts +9 -9
  106. package/dist/features/ai/model-profiles.js +13 -13
  107. package/dist/features/ai/model-profiles.js.map +1 -1
  108. package/dist/features/ai/protocol/agent-ops.d.ts +2 -2
  109. package/dist/features/ai/protocol/agent-ops.js +1 -1
  110. package/dist/features/ai/protocol/agent-ops.js.map +1 -1
  111. package/dist/features/ai/protocol/block-lines.d.ts +7 -7
  112. package/dist/features/ai/protocol/block-lines.js +10 -10
  113. package/dist/features/ai/protocol/block-lines.js.map +1 -1
  114. package/dist/features/ai/protocol/chat.d.ts +5 -5
  115. package/dist/features/ai/protocol/chat.js +12 -12
  116. package/dist/features/ai/protocol/chat.js.map +1 -1
  117. package/dist/features/ai/protocol/generate.d.ts +1 -1
  118. package/dist/features/ai/protocol/generate.js +1 -1
  119. package/dist/features/ai/protocol/generate.js.map +1 -1
  120. package/dist/features/ai/protocol/index.d.ts +3 -3
  121. package/dist/features/ai/protocol/index.js +2 -2
  122. package/dist/features/ai/protocol/models.d.ts +3 -3
  123. package/dist/features/ai/protocol/models.js +3 -3
  124. package/dist/features/ai/protocol/models.js.map +1 -1
  125. package/dist/features/ai/protocol/schemas.d.ts +1 -1
  126. package/dist/features/ai/protocol/schemas.js +1 -1
  127. package/dist/features/ai/protocol/schemas.js.map +1 -1
  128. package/dist/features/ai/protocol/tasks.d.ts +5 -5
  129. package/dist/features/ai/protocol/tasks.js +12 -12
  130. package/dist/features/ai/protocol/tasks.js.map +1 -1
  131. package/dist/features/ai/react/AiSelectionMenu.js.map +1 -1
  132. package/dist/features/ai/react/ModelQuickSwitch.d.ts +4 -4
  133. package/dist/features/ai/react/ModelQuickSwitch.js +6 -6
  134. package/dist/features/ai/react/ModelQuickSwitch.js.map +1 -1
  135. package/dist/features/ai/react/SettingsAiTab.d.ts +1 -1
  136. package/dist/features/ai/react/SettingsAiTab.js +8 -8
  137. package/dist/features/ai/react/SettingsAiTab.js.map +1 -1
  138. package/dist/features/ai/react/SettingsModelProfiles.d.ts +1 -1
  139. package/dist/features/ai/react/SettingsModelProfiles.js +1 -1
  140. package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
  141. package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
  142. package/dist/features/ai/react/use-ai-assistant.js +1 -1
  143. package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
  144. package/dist/features/ai/react/use-model-profiles.d.ts +5 -5
  145. package/dist/features/ai/react/use-model-profiles.js +2 -2
  146. package/dist/features/ai/react/use-model-profiles.js.map +1 -1
  147. package/dist/features/ai/use-ai-assistant.d.ts +1 -1
  148. package/dist/features/ai/use-ai-assistant.js +1 -1
  149. package/dist/features/ai/use-ai-assistant.js.map +1 -1
  150. package/dist/features/ai/use-model-profiles.d.ts +4 -4
  151. package/dist/features/ai/use-model-profiles.js +2 -2
  152. package/dist/features/ai/use-model-profiles.js.map +1 -1
  153. package/dist/features/block-ui/block-actions.d.ts +8 -4
  154. package/dist/features/block-ui/block-actions.js +38 -22
  155. package/dist/features/block-ui/block-actions.js.map +1 -1
  156. package/dist/features/block-ui/block-target.d.ts +29 -0
  157. package/dist/features/block-ui/block-target.js +63 -0
  158. package/dist/features/block-ui/block-target.js.map +1 -0
  159. package/dist/features/block-ui/components/BlockHandles.js +3 -3
  160. package/dist/features/block-ui/components/BlockHandles.js.map +1 -1
  161. package/dist/features/block-ui/components/BlockUi.js +11 -23
  162. package/dist/features/block-ui/components/BlockUi.js.map +1 -1
  163. package/dist/features/block-ui/feature.d.ts +3 -2
  164. package/dist/features/block-ui/feature.js +3 -2
  165. package/dist/features/block-ui/feature.js.map +1 -1
  166. package/dist/features/block-ui/handle-geometry.js +12 -23
  167. package/dist/features/block-ui/handle-geometry.js.map +1 -1
  168. package/dist/features/block-ui/index.d.ts +2 -1
  169. package/dist/features/block-ui/index.js +2 -1
  170. package/dist/features/block-ui/react/BlockHandles.d.ts +1 -1
  171. package/dist/features/block-ui/react/BlockHandles.js +4 -4
  172. package/dist/features/block-ui/react/BlockHandles.js.map +1 -1
  173. package/dist/features/block-ui/react/BlockUi.js +13 -25
  174. package/dist/features/block-ui/react/BlockUi.js.map +1 -1
  175. package/dist/features/comments/model.js +1 -1
  176. package/dist/features/composites/accepted-children.d.ts +5 -4
  177. package/dist/features/composites/accepted-children.js +26 -26
  178. package/dist/features/composites/accepted-children.js.map +1 -1
  179. package/dist/features/composites/ai-brief.d.ts +4 -4
  180. package/dist/features/composites/ai-brief.js +14 -12
  181. package/dist/features/composites/ai-brief.js.map +1 -1
  182. package/dist/features/composites/anchors.d.ts +1 -1
  183. package/dist/features/composites/anchors.js.map +1 -1
  184. package/dist/features/composites/baskets.d.ts +1 -1
  185. package/dist/features/composites/baskets.js.map +1 -1
  186. package/dist/features/composites/bibliography-command.d.ts +1 -1
  187. package/dist/features/composites/bibliography-form.js +1 -1
  188. package/dist/features/composites/bibliography-form.js.map +1 -1
  189. package/dist/features/composites/bibliography.js.map +1 -1
  190. package/dist/features/composites/block-types-json.d.ts +38 -0
  191. package/dist/features/composites/block-types-json.js +122 -0
  192. package/dist/features/composites/block-types-json.js.map +1 -0
  193. package/dist/features/composites/block-types.d.ts +119 -0
  194. package/dist/features/composites/block-types.js +343 -0
  195. package/dist/features/composites/block-types.js.map +1 -0
  196. package/dist/features/composites/capabilities.js +109 -0
  197. package/dist/features/composites/capabilities.js.map +1 -0
  198. package/dist/features/composites/components/BibliographyEditor.js +5 -5
  199. package/dist/features/composites/components/BibliographyEditor.js.map +1 -1
  200. package/dist/features/composites/components/CompositeBasketMenu.js +2 -2
  201. package/dist/features/composites/components/CompositeBasketMenu.js.map +1 -1
  202. package/dist/features/composites/components/CompositeChrome.js +18 -8
  203. package/dist/features/composites/components/CompositeChrome.js.map +1 -1
  204. package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
  205. package/dist/features/composites/components/CompositeDetails.js +11 -10
  206. package/dist/features/composites/components/CompositeDetails.js.map +1 -1
  207. package/dist/features/composites/components/CompositeDetails.vue.d.ts +1 -1
  208. package/dist/features/composites/components/CompositeFieldEditor.js +7 -7
  209. package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
  210. package/dist/features/composites/components/CompositeFieldEditor.vue.d.ts +5 -5
  211. package/dist/features/composites/components/CompositeInspector.js +136 -113
  212. package/dist/features/composites/components/CompositeInspector.js.map +1 -1
  213. package/dist/features/composites/components/CompositeInspector.vue.d.ts +3 -3
  214. package/dist/features/composites/components/CompositeStatusMenu.js +2 -2
  215. package/dist/features/composites/components/CompositeStatusMenu.js.map +1 -1
  216. package/dist/features/composites/components/CompositeSummaryEditor.js +1 -1
  217. package/dist/features/composites/components/CompositeSummaryEditor.js.map +1 -1
  218. package/dist/features/composites/components/CompositeSummaryEditor.vue.d.ts +1 -1
  219. package/dist/features/composites/components/CompositeTable.js +2 -2
  220. package/dist/features/composites/components/CompositeTable.js.map +1 -1
  221. package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
  222. package/dist/features/composites/components/CompositeTagsEditor.js.map +1 -1
  223. package/dist/features/composites/components/CompositeTagsEditor.vue.d.ts +1 -1
  224. package/dist/features/composites/components/CompositeView.js +19 -17
  225. package/dist/features/composites/components/CompositeView.js.map +1 -1
  226. package/dist/features/composites/components/DerivationBadge.js +15 -6
  227. package/dist/features/composites/components/DerivationBadge.js.map +1 -1
  228. package/dist/features/composites/components/FocusChip.js +1 -1
  229. package/dist/features/composites/components/FocusChip.js.map +1 -1
  230. package/dist/features/composites/components/FocusChip.vue.d.ts +1 -1
  231. package/dist/features/composites/components/ReferenceFieldSelect.js +3 -3
  232. package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -1
  233. package/dist/features/composites/components/ReferenceView.js +1 -1
  234. package/dist/features/composites/components/ReferenceView.js.map +1 -1
  235. package/dist/features/composites/components/SettingsEditingTab.js +18 -18
  236. package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
  237. package/dist/features/composites/components/SettingsEditingTab.vue.d.ts +3 -3
  238. package/dist/features/composites/convert.d.ts +4 -4
  239. package/dist/features/composites/convert.js +27 -28
  240. package/dist/features/composites/convert.js.map +1 -1
  241. package/dist/features/composites/derived-chrome.js +34 -28
  242. package/dist/features/composites/derived-chrome.js.map +1 -1
  243. package/dist/features/composites/editing-settings-keys.js +6 -6
  244. package/dist/features/composites/editing-settings-keys.js.map +1 -1
  245. package/dist/features/composites/feature.d.ts +10 -10
  246. package/dist/features/composites/feature.js +58 -46
  247. package/dist/features/composites/feature.js.map +1 -1
  248. package/dist/features/composites/fences.d.ts +3 -3
  249. package/dist/features/composites/fences.js +18 -13
  250. package/dist/features/composites/fences.js.map +1 -1
  251. package/dist/features/composites/focus.d.ts +10 -10
  252. package/dist/features/composites/focus.js +11 -11
  253. package/dist/features/composites/focus.js.map +1 -1
  254. package/dist/features/composites/heading-composites.d.ts +5 -5
  255. package/dist/features/composites/heading-composites.js +13 -16
  256. package/dist/features/composites/heading-composites.js.map +1 -1
  257. package/dist/features/composites/index.d.ts +20 -18
  258. package/dist/features/composites/index.js +9 -7
  259. package/dist/features/composites/inspector-model.d.ts +45 -22
  260. package/dist/features/composites/inspector-model.js +53 -14
  261. package/dist/features/composites/inspector-model.js.map +1 -1
  262. package/dist/features/composites/legacy.d.ts +5 -4
  263. package/dist/features/composites/legacy.js +16 -23
  264. package/dist/features/composites/legacy.js.map +1 -1
  265. package/dist/features/composites/markdown-export.js +3 -3
  266. package/dist/features/composites/markdown-export.js.map +1 -1
  267. package/dist/features/composites/merge.d.ts +8 -8
  268. package/dist/features/composites/merge.js +23 -22
  269. package/dist/features/composites/merge.js.map +1 -1
  270. package/dist/features/composites/meta-display.js +5 -5
  271. package/dist/features/composites/meta-display.js.map +1 -1
  272. package/dist/features/composites/meta-keys.d.ts +5 -5
  273. package/dist/features/composites/meta-keys.js +8 -8
  274. package/dist/features/composites/meta-keys.js.map +1 -1
  275. package/dist/features/composites/node-views.d.ts +3 -3
  276. package/dist/features/composites/node-views.js +2 -2
  277. package/dist/features/composites/node-views.js.map +1 -1
  278. package/dist/features/composites/nodes.d.ts +13 -13
  279. package/dist/features/composites/nodes.js +100 -77
  280. package/dist/features/composites/nodes.js.map +1 -1
  281. package/dist/features/composites/outline.d.ts +15 -12
  282. package/dist/features/composites/outline.js +24 -21
  283. package/dist/features/composites/outline.js.map +1 -1
  284. package/dist/features/composites/properties.d.ts +51 -0
  285. package/dist/features/composites/properties.js +89 -0
  286. package/dist/features/composites/properties.js.map +1 -0
  287. package/dist/features/composites/react/BibliographyEditor.js +5 -5
  288. package/dist/features/composites/react/BibliographyEditor.js.map +1 -1
  289. package/dist/features/composites/react/CompositeBasketMenu.js +2 -2
  290. package/dist/features/composites/react/CompositeBasketMenu.js.map +1 -1
  291. package/dist/features/composites/react/CompositeChrome.d.ts +1 -1
  292. package/dist/features/composites/react/CompositeChrome.js +15 -6
  293. package/dist/features/composites/react/CompositeChrome.js.map +1 -1
  294. package/dist/features/composites/react/CompositeDetails.d.ts +1 -1
  295. package/dist/features/composites/react/CompositeDetails.js +11 -10
  296. package/dist/features/composites/react/CompositeDetails.js.map +1 -1
  297. package/dist/features/composites/react/CompositeFieldEditor.d.ts +5 -5
  298. package/dist/features/composites/react/CompositeFieldEditor.js +6 -6
  299. package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
  300. package/dist/features/composites/react/CompositeInspector.d.ts +3 -3
  301. package/dist/features/composites/react/CompositeInspector.js +142 -128
  302. package/dist/features/composites/react/CompositeInspector.js.map +1 -1
  303. package/dist/features/composites/react/CompositeStatusMenu.js +2 -2
  304. package/dist/features/composites/react/CompositeStatusMenu.js.map +1 -1
  305. package/dist/features/composites/react/CompositeSummaryEditor.d.ts +1 -1
  306. package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
  307. package/dist/features/composites/react/CompositeSummaryEditor.js.map +1 -1
  308. package/dist/features/composites/react/CompositeTable.d.ts +1 -1
  309. package/dist/features/composites/react/CompositeTable.js +3 -3
  310. package/dist/features/composites/react/CompositeTable.js.map +1 -1
  311. package/dist/features/composites/react/CompositeTagsEditor.d.ts +1 -1
  312. package/dist/features/composites/react/CompositeTagsEditor.js +1 -1
  313. package/dist/features/composites/react/CompositeTagsEditor.js.map +1 -1
  314. package/dist/features/composites/react/CompositeView.js +17 -15
  315. package/dist/features/composites/react/CompositeView.js.map +1 -1
  316. package/dist/features/composites/react/DerivationBadge.js +13 -4
  317. package/dist/features/composites/react/DerivationBadge.js.map +1 -1
  318. package/dist/features/composites/react/FocusChip.d.ts +1 -1
  319. package/dist/features/composites/react/FocusChip.js +1 -1
  320. package/dist/features/composites/react/FocusChip.js.map +1 -1
  321. package/dist/features/composites/react/ReferenceFieldSelect.js +3 -3
  322. package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -1
  323. package/dist/features/composites/react/ReferenceView.d.ts +1 -1
  324. package/dist/features/composites/react/ReferenceView.js +1 -1
  325. package/dist/features/composites/react/ReferenceView.js.map +1 -1
  326. package/dist/features/composites/react/SettingsEditingTab.d.ts +4 -4
  327. package/dist/features/composites/react/SettingsEditingTab.js +20 -20
  328. package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
  329. package/dist/features/composites/react.js +1 -1
  330. package/dist/features/composites/react.js.map +1 -1
  331. package/dist/features/composites/reference-ai.js +1 -1
  332. package/dist/features/composites/reference-ai.js.map +1 -1
  333. package/dist/features/composites/reference-label.d.ts +3 -3
  334. package/dist/features/composites/reference-label.js +6 -6
  335. package/dist/features/composites/reference-label.js.map +1 -1
  336. package/dist/features/composites/reference-suggestion.d.ts +1 -1
  337. package/dist/features/composites/reference-suggestion.js +3 -3
  338. package/dist/features/composites/reference-suggestion.js.map +1 -1
  339. package/dist/features/composites/reference-text.d.ts +2 -2
  340. package/dist/features/composites/reference-text.js +4 -4
  341. package/dist/features/composites/reference-text.js.map +1 -1
  342. package/dist/features/composites/reference.d.ts +3 -3
  343. package/dist/features/composites/reference.js +1 -1
  344. package/dist/features/composites/reference.js.map +1 -1
  345. package/dist/features/composites/reveal-source.d.ts +3 -3
  346. package/dist/features/composites/reveal-source.js +6 -6
  347. package/dist/features/composites/reveal-source.js.map +1 -1
  348. package/dist/features/composites/rows-model.d.ts +2 -2
  349. package/dist/features/composites/rows-model.js +4 -3
  350. package/dist/features/composites/rows-model.js.map +1 -1
  351. package/dist/features/composites/rows.d.ts +16 -28
  352. package/dist/features/composites/rows.js +20 -54
  353. package/dist/features/composites/rows.js.map +1 -1
  354. package/dist/features/composites/schema.d.ts +12 -11
  355. package/dist/features/composites/schema.js +10 -9
  356. package/dist/features/composites/schema.js.map +1 -1
  357. package/dist/features/composites/source.d.ts +20 -0
  358. package/dist/features/composites/source.js +40 -0
  359. package/dist/features/composites/source.js.map +1 -0
  360. package/dist/features/composites/split.d.ts +11 -11
  361. package/dist/features/composites/split.js +20 -20
  362. package/dist/features/composites/split.js.map +1 -1
  363. package/dist/features/composites/structure-mode.js +3 -3
  364. package/dist/features/composites/structure-mode.js.map +1 -1
  365. package/dist/features/composites/table-model.js +2 -2
  366. package/dist/features/composites/table-model.js.map +1 -1
  367. package/dist/features/composites/use-composite-inspector.js +3 -1
  368. package/dist/features/composites/use-composite-inspector.js.map +1 -1
  369. package/dist/features/composites/use-composite-rows.d.ts +2 -2
  370. package/dist/features/composites/use-composite-rows.js.map +1 -1
  371. package/dist/features/composites/vue.js +1 -1
  372. package/dist/features/composites/vue.js.map +1 -1
  373. package/dist/features/image-studio/components/ImageStudioDialog.js +150 -87
  374. package/dist/features/image-studio/components/ImageStudioDialog.js.map +1 -1
  375. package/dist/features/image-studio/components/ImageStudioDialog.vue.d.ts +5 -1
  376. package/dist/features/image-studio/components/ImageStudioLibraryPanel.js +186 -0
  377. package/dist/features/image-studio/components/ImageStudioLibraryPanel.js.map +1 -0
  378. package/dist/features/image-studio/components/ImageStudioLibraryTile.js +134 -0
  379. package/dist/features/image-studio/components/ImageStudioLibraryTile.js.map +1 -0
  380. package/dist/features/image-studio/components/ImageStudioView.js.map +1 -1
  381. package/dist/features/image-studio/feature.d.ts +1 -1
  382. package/dist/features/image-studio/feature.js +1 -1
  383. package/dist/features/image-studio/feature.js.map +1 -1
  384. package/dist/features/image-studio/index.d.ts +3 -2
  385. package/dist/features/image-studio/index.js +2 -2
  386. package/dist/features/image-studio/library.d.ts +35 -0
  387. package/dist/features/image-studio/node-core.d.ts +3 -3
  388. package/dist/features/image-studio/node-core.js +1 -1
  389. package/dist/features/image-studio/node-core.js.map +1 -1
  390. package/dist/features/image-studio/node-store.d.ts +1 -1
  391. package/dist/features/image-studio/node-store.js +1 -1
  392. package/dist/features/image-studio/node-store.js.map +1 -1
  393. package/dist/features/image-studio/react/ImageStudioDialog.d.ts +1 -1
  394. package/dist/features/image-studio/react/ImageStudioDialog.js +46 -5
  395. package/dist/features/image-studio/react/ImageStudioDialog.js.map +1 -1
  396. package/dist/features/image-studio/react/ImageStudioLibraryPanel.js +141 -0
  397. package/dist/features/image-studio/react/ImageStudioLibraryPanel.js.map +1 -0
  398. package/dist/features/image-studio/react/ImageStudioLibraryTile.js +105 -0
  399. package/dist/features/image-studio/react/ImageStudioLibraryTile.js.map +1 -0
  400. package/dist/features/image-studio/react/ImageStudioView.js +1 -1
  401. package/dist/features/image-studio/react/ImageStudioView.js.map +1 -1
  402. package/dist/features/image-studio/react/store.d.ts +8 -3
  403. package/dist/features/image-studio/react/store.js.map +1 -1
  404. package/dist/features/image-studio/react.d.ts +4 -3
  405. package/dist/features/image-studio/react.js +3 -3
  406. package/dist/features/image-studio/react.js.map +1 -1
  407. package/dist/features/image-studio/schema.d.ts +1 -1
  408. package/dist/features/image-studio/schema.js +1 -1
  409. package/dist/features/image-studio/schema.js.map +1 -1
  410. package/dist/features/image-studio/state.d.ts +8 -3
  411. package/dist/features/image-studio/state.js +11 -3
  412. package/dist/features/image-studio/state.js.map +1 -1
  413. package/dist/features/image-studio/store.d.ts +8 -3
  414. package/dist/features/image-studio/vue.d.ts +4 -3
  415. package/dist/features/image-studio/vue.js +3 -3
  416. package/dist/features/image-studio/vue.js.map +1 -1
  417. package/dist/features/mentions/tag.js +2 -1
  418. package/dist/features/mentions/tag.js.map +1 -1
  419. package/dist/features/themes/components/SettingsAppearanceTab.js +1 -1
  420. package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
  421. package/dist/features/themes/feature.d.ts +1 -1
  422. package/dist/features/themes/feature.js.map +1 -1
  423. package/dist/features/themes/react/SettingsAppearanceTab.d.ts +1 -1
  424. package/dist/features/themes/react/SettingsAppearanceTab.js +1 -1
  425. package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
  426. package/dist/features/themes/theme-runtime.js +1 -1
  427. package/dist/features/themes/theme-runtime.js.map +1 -1
  428. package/dist/features/transcript/TranscriptSegmentView.js +1 -1
  429. package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
  430. package/dist/features/transcript/react/TranscriptSegmentView.js +1 -1
  431. package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
  432. package/dist/features/transcript/segment-node.js.map +1 -1
  433. package/dist/features/transfer/feature.js +1 -1
  434. package/dist/features/transfer/feature.js.map +1 -1
  435. package/dist/features/transfer/transforms.d.ts +4 -4
  436. package/dist/features/transfer/transforms.js +12 -12
  437. package/dist/features/transfer/transforms.js.map +1 -1
  438. package/dist/i18n/de/ai.js +4 -4
  439. package/dist/i18n/de/ai.js.map +1 -1
  440. package/dist/i18n/de/authors.js +1 -1
  441. package/dist/i18n/de/authors.js.map +1 -1
  442. package/dist/i18n/de/comments.js +1 -1
  443. package/dist/i18n/de/comments.js.map +1 -1
  444. package/dist/i18n/de/composites.js +62 -59
  445. package/dist/i18n/de/composites.js.map +1 -1
  446. package/dist/i18n/de/image-studio.js +11 -2
  447. package/dist/i18n/de/image-studio.js.map +1 -1
  448. package/dist/i18n/de/integrations.js +20 -20
  449. package/dist/i18n/de/integrations.js.map +1 -1
  450. package/dist/i18n/de/markdown.js +1 -1
  451. package/dist/i18n/de/markdown.js.map +1 -1
  452. package/dist/i18n/de/palette.js +1 -1
  453. package/dist/i18n/de/palette.js.map +1 -1
  454. package/dist/i18n/de/themes.js +3 -3
  455. package/dist/i18n/de/themes.js.map +1 -1
  456. package/dist/i18n/de/transfer.js +2 -2
  457. package/dist/i18n/de/transfer.js.map +1 -1
  458. package/dist/i18n/de/tree.js +6 -6
  459. package/dist/i18n/de/tree.js.map +1 -1
  460. package/dist/i18n/de.d.ts +110 -98
  461. package/dist/i18n/en/ai.js +2 -2
  462. package/dist/i18n/en/ai.js.map +1 -1
  463. package/dist/i18n/en/composites.js +64 -61
  464. package/dist/i18n/en/composites.js.map +1 -1
  465. package/dist/i18n/en/image-studio.js +9 -0
  466. package/dist/i18n/en/image-studio.js.map +1 -1
  467. package/dist/i18n/en/integrations.js +9 -9
  468. package/dist/i18n/en/integrations.js.map +1 -1
  469. package/dist/i18n/en/markdown.js +1 -1
  470. package/dist/i18n/en/markdown.js.map +1 -1
  471. package/dist/i18n/en/palette.js +1 -1
  472. package/dist/i18n/en/palette.js.map +1 -1
  473. package/dist/i18n/en/themes.js +4 -4
  474. package/dist/i18n/en/themes.js.map +1 -1
  475. package/dist/i18n/en/tree.js +5 -5
  476. package/dist/i18n/en/tree.js.map +1 -1
  477. package/dist/index.d.ts +4 -1
  478. package/dist/integrations/composite-ai/bibliography-fetch.d.ts +6 -6
  479. package/dist/integrations/composite-ai/bibliography-fetch.js +19 -19
  480. package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -1
  481. package/dist/integrations/composite-ai/composite-fill.d.ts +4 -4
  482. package/dist/integrations/composite-ai/composite-fill.js +5 -5
  483. package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
  484. package/dist/integrations/composite-ai/composite-summary.d.ts +2 -2
  485. package/dist/integrations/composite-ai/composite-summary.js +5 -5
  486. package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
  487. package/dist/integrations/composite-ai/derive.d.ts +17 -17
  488. package/dist/integrations/composite-ai/derive.js +27 -26
  489. package/dist/integrations/composite-ai/derive.js.map +1 -1
  490. package/dist/integrations/composite-ai/index.d.ts +14 -15
  491. package/dist/integrations/composite-ai/index.js +98 -77
  492. package/dist/integrations/composite-ai/index.js.map +1 -1
  493. package/dist/integrations/composite-ai/outline-sanitize.d.ts +1 -1
  494. package/dist/integrations/composite-ai/outline-sanitize.js +1 -1
  495. package/dist/integrations/composite-ai/outline-sanitize.js.map +1 -1
  496. package/dist/integrations/composite-ai/rendition.d.ts +9 -9
  497. package/dist/integrations/composite-ai/rendition.js +27 -27
  498. package/dist/integrations/composite-ai/rendition.js.map +1 -1
  499. package/dist/integrations/composite-ai/split.d.ts +8 -8
  500. package/dist/integrations/composite-ai/split.js +12 -12
  501. package/dist/integrations/composite-ai/split.js.map +1 -1
  502. package/dist/integrations/composite-ai/transfer-transforms.d.ts +2 -2
  503. package/dist/integrations/composite-ai/transfer-transforms.js +11 -11
  504. package/dist/integrations/composite-ai/transfer-transforms.js.map +1 -1
  505. package/dist/integrations/composite-media/index.d.ts +4 -3
  506. package/dist/integrations/composite-media/index.js +20 -14
  507. package/dist/integrations/composite-media/index.js.map +1 -1
  508. package/dist/markdown/MarkdownSurface.vue.d.ts +7 -7
  509. package/dist/markdown/document.js +1 -1
  510. package/dist/markdown/document.js.map +1 -1
  511. package/dist/nuxt/module.d.ts +48 -24
  512. package/dist/nuxt/module.js.map +1 -1
  513. package/dist/nuxt/runtime/server/plugins/editor-server.js +3 -2
  514. package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
  515. package/dist/presets/compose.d.ts +6 -6
  516. package/dist/presets/compose.js +7 -4
  517. package/dist/presets/compose.js.map +1 -1
  518. package/dist/react/AdvancedEditor.d.ts +2 -2
  519. package/dist/react/AdvancedEditor.js +1 -1
  520. package/dist/react/AdvancedEditor.js.map +1 -1
  521. package/dist/react/compose.d.ts +1 -1
  522. package/dist/react/compose.js +1 -1
  523. package/dist/react/compose.js.map +1 -1
  524. package/dist/react/composed-surface.d.ts +5 -5
  525. package/dist/react/composed-surface.js +2 -2
  526. package/dist/react/composed-surface.js.map +1 -1
  527. package/dist/server/ai.d.ts +7 -7
  528. package/dist/server/ai.js +1 -1
  529. package/dist/server/ai.js.map +1 -1
  530. package/dist/server/auth.d.ts +1 -1
  531. package/dist/server/collab-state.d.ts +1 -1
  532. package/dist/server/collab-state.js.map +1 -1
  533. package/dist/server/collab.d.ts +4 -4
  534. package/dist/server/collab.js +22 -17
  535. package/dist/server/collab.js.map +1 -1
  536. package/dist/server/handlers/ai.d.ts +9 -6
  537. package/dist/server/handlers/ai.js +13 -17
  538. package/dist/server/handlers/ai.js.map +1 -1
  539. package/dist/server/handlers/context.d.ts +4 -0
  540. package/dist/server/handlers/context.js.map +1 -1
  541. package/dist/server/handlers/editor.d.ts +33 -32
  542. package/dist/server/handlers/editor.js +13 -8
  543. package/dist/server/handlers/editor.js.map +1 -1
  544. package/dist/server/handlers/images.d.ts +1 -1
  545. package/dist/server/handlers/images.js +1 -1
  546. package/dist/server/handlers/images.js.map +1 -1
  547. package/dist/server/host.d.ts +4 -0
  548. package/dist/server/host.js +10 -2
  549. package/dist/server/host.js.map +1 -1
  550. package/dist/server/index.d.ts +3 -3
  551. package/dist/server/ports.d.ts +8 -8
  552. package/dist/server/ports.js.map +1 -1
  553. package/dist/settings/index.d.ts +20 -19
  554. package/dist/settings/index.js +25 -24
  555. package/dist/settings/index.js.map +1 -1
  556. package/dist/settings/migrate.d.ts +18 -0
  557. package/dist/settings/migrate.js +46 -0
  558. package/dist/settings/migrate.js.map +1 -0
  559. package/dist/settings/values.d.ts +12 -12
  560. package/dist/settings/values.js +11 -11
  561. package/dist/settings/values.js.map +1 -1
  562. package/dist/styles/composites.css +10 -10
  563. package/dist/tree/DocumentTree.js +12 -5
  564. package/dist/tree/DocumentTree.js.map +1 -1
  565. package/dist/tree/drop-rules.js +5 -5
  566. package/dist/tree/drop-rules.js.map +1 -1
  567. package/dist/tree/react/DocumentTree.js +14 -5
  568. package/dist/tree/react/DocumentTree.js.map +1 -1
  569. package/dist/tree/tree-host.js +5 -5
  570. package/dist/tree/tree-host.js.map +1 -1
  571. package/dist/tree/tree-items.js +34 -28
  572. package/dist/tree/tree-items.js.map +1 -1
  573. package/dist/tree/tree-model.js +16 -16
  574. package/dist/tree/tree-model.js.map +1 -1
  575. package/dist/tree/tree-rows.js +2 -2
  576. package/dist/tree/tree-rows.js.map +1 -1
  577. package/dist/tree/tree-view-model.d.ts +2 -2
  578. package/dist/tree/tree-view-model.js.map +1 -1
  579. package/dist/vue/AdvancedEditor.js +2 -2
  580. package/dist/vue/AdvancedEditor.js.map +1 -1
  581. package/dist/vue/AdvancedEditor.vue.d.ts +10 -10
  582. package/dist/vue/SimpleEditor.vue.d.ts +4 -4
  583. package/dist/vue/components/EditorSurface.vue.d.ts +4 -4
  584. package/dist/vue/compose.d.ts +1 -1
  585. package/dist/vue/compose.js +1 -1
  586. package/dist/vue/compose.js.map +1 -1
  587. package/package.json +1 -1
  588. package/dist/features/composites/derivation.d.ts +0 -62
  589. package/dist/features/composites/derivation.js +0 -102
  590. package/dist/features/composites/derivation.js.map +0 -1
  591. package/dist/features/composites/kinds.d.ts +0 -89
  592. package/dist/features/composites/kinds.js +0 -285
  593. package/dist/features/composites/kinds.js.map +0 -1
@@ -4,19 +4,19 @@ import { Extension } from "@tiptap/core";
4
4
  import { Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
5
5
  import { Decoration, DecorationSet } from "@tiptap/pm/view";
6
6
  //#region src/features/composites/focus.ts
7
- /** Class of every node hidden by focus mode (siblings of the focused Baustein and of each ancestor). */
7
+ /** Class of every node hidden by focus mode (siblings of the focused Typed block and of each ancestor). */
8
8
  const FOCUS_HIDDEN_CLASS = "sk-focus-hidden";
9
- /** Class of the focused Baustein. */
9
+ /** Class of the focused Typed block. */
10
10
  const FOCUS_TARGET_CLASS = "sk-focus-target";
11
- /** Class of every ancestor of the focused Baustein. */
11
+ /** Class of every ancestor of the focused Typed block. */
12
12
  const FOCUS_ANCESTOR_CLASS = "sk-focus-ancestor";
13
13
  const compositeFocusKey = new PluginKey("compositeFocus");
14
- /** The block id of the focused Baustein in `state`, `null` without focus (or without the extension). */
14
+ /** The block id of the focused Typed block in `state`, `null` without focus (or without the extension). */
15
15
  const compositeFocusOf = (state) => compositeFocusKey.getState(state)?.id ?? null;
16
16
  /**
17
- * The decorations of focus mode on Baustein `id` in `doc`: every sibling of the Baustein and of each of its ancestors gets
18
- * `sk-focus-hidden` (a Baustein's title, description and tags are not siblings in this sense: they stay, so the ancestors
19
- * keep their titles), the Baustein itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.
17
+ * The decorations of focus mode on Typed block `id` in `doc`: every sibling of the Typed block and of each of its ancestors gets
18
+ * `sk-focus-hidden` (a Typed block's title, description and tags are not siblings in this sense: they stay, so the ancestors
19
+ * keep their titles), the Typed block itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.
20
20
  */
21
21
  function focusDecorations(doc, id) {
22
22
  const found = findBlockById(doc, id);
@@ -27,7 +27,7 @@ function focusDecorations(doc, id) {
27
27
  const parent = $pos.node(depth);
28
28
  const onPath = $pos.index(depth);
29
29
  const start = $pos.start(depth);
30
- const isComposite = parent.type.name === "composite";
30
+ const isComposite = parent.type.name === "typedBlock";
31
31
  parent.forEach((child, offset, index) => {
32
32
  if (index === onPath || isComposite && index < 3) return;
33
33
  const pos = start + offset;
@@ -42,15 +42,15 @@ const unfocused = {
42
42
  decorations: DecorationSet.empty
43
43
  };
44
44
  /**
45
- * Focus mode of Bausteine (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset
46
- * when the focused Baustein disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).
45
+ * Focus mode of Typed blocks (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset
46
+ * when the focused Typed block disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).
47
47
  */
48
48
  const CompositeFocus = Extension.create({
49
49
  name: "compositeFocus",
50
50
  addCommands: () => ({ focusComposite: (id) => ({ state, tr }) => {
51
51
  if (id !== null) {
52
52
  const found = findBlockById(state.doc, id);
53
- if (found?.node.type.name !== "composite") return false;
53
+ if (found?.node.type.name !== "typedBlock") return false;
54
54
  const { from, to } = state.selection;
55
55
  if (from < found.pos || to > found.pos + found.node.nodeSize) tr.setSelection(TextSelection.near(tr.doc.resolve(found.pos + 2)));
56
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"focus.js","names":[],"sources":["../../../src/features/composites/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type EditorState, Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\nimport { findBlockById } from '../../core/schema'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n/** State of `compositeFocusKey`: the focused Baustein's block id (`null` = no focus) and the decorations that hide the rest. */\nexport interface CompositeFocusState {\n id: string | null\n decorations: DecorationSet\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n compositeFocus: {\n /**\n * Focus mode: show only the Baustein with block id `id` and the titles of the Bausteine around it (the siblings of it\n * and of every ancestor are hidden); `null` ends it. False when `id` is not a Baustein of the document. A caret outside\n * the focused Baustein moves into its title, so no edit lands in hidden content. Resets by itself when the Baustein is gone.\n */\n focusComposite: (id: string | null) => ReturnType\n }\n }\n}\n\n/** Class of every node hidden by focus mode (siblings of the focused Baustein and of each ancestor). */\nexport const FOCUS_HIDDEN_CLASS = 'sk-focus-hidden'\n/** Class of the focused Baustein. */\nexport const FOCUS_TARGET_CLASS = 'sk-focus-target'\n/** Class of every ancestor of the focused Baustein. */\nexport const FOCUS_ANCESTOR_CLASS = 'sk-focus-ancestor'\n\nexport const compositeFocusKey = new PluginKey<CompositeFocusState>('compositeFocus')\n\n/** The block id of the focused Baustein in `state`, `null` without focus (or without the extension). */\nexport const compositeFocusOf = (state: EditorState): string | null => compositeFocusKey.getState(state)?.id ?? null\n\n/**\n * The decorations of focus mode on Baustein `id` in `doc`: every sibling of the Baustein and of each of its ancestors gets\n * `sk-focus-hidden` (a Baustein's title, description and tags are not siblings in this sense: they stay, so the ancestors\n * keep their titles), the Baustein itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.\n */\nexport function focusDecorations(doc: PMNode, id: string): DecorationSet {\n const found = findBlockById(doc, id)\n if (!found) return DecorationSet.empty\n const $pos = doc.resolve(found.pos)\n const decorations: Decoration[] = [Decoration.node(found.pos, found.pos + found.node.nodeSize, { class: FOCUS_TARGET_CLASS })]\n for (let depth = $pos.depth; depth >= 0; depth--) {\n const parent = $pos.node(depth)\n const onPath = $pos.index(depth)\n const start = $pos.start(depth)\n const isComposite = parent.type.name === 'composite'\n parent.forEach((child, offset, index) => {\n if (index === onPath || (isComposite && index < COMPOSITE_CHROME_COUNT)) return\n const pos = start + offset\n decorations.push(Decoration.node(pos, pos + child.nodeSize, { class: FOCUS_HIDDEN_CLASS }))\n })\n if (depth > 0) decorations.push(Decoration.node($pos.before(depth), $pos.after(depth), { class: FOCUS_ANCESTOR_CLASS }))\n }\n return DecorationSet.create(doc, decorations)\n}\n\nconst unfocused: CompositeFocusState = { id: null, decorations: DecorationSet.empty }\n\n/**\n * Focus mode of Bausteine (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset\n * when the focused Baustein disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).\n */\nexport const CompositeFocus = Extension.create({\n name: 'compositeFocus',\n addCommands: () => ({\n focusComposite: (id: string | null) => ({ state, tr }) => {\n if (id !== null) {\n const found = findBlockById(state.doc, id)\n if (found?.node.type.name !== 'composite') return false\n const { from, to } = state.selection\n // The caret in hidden content would edit what nobody sees: move it into the focused Baustein's title.\n if (from < found.pos || to > found.pos + found.node.nodeSize) tr.setSelection(TextSelection.near(tr.doc.resolve(found.pos + 2)))\n }\n tr.setMeta(compositeFocusKey, { id })\n return true\n },\n }),\n addProseMirrorPlugins: () => [\n new Plugin<CompositeFocusState>({\n key: compositeFocusKey,\n state: {\n init: () => unfocused,\n apply(tr, value) {\n const meta = tr.getMeta(compositeFocusKey) as { id: string | null } | undefined\n const id = meta ? meta.id : value.id\n if (id === null) return value.id === null ? value : unfocused\n if (!meta && !tr.docChanged) return value\n return { id, decorations: focusDecorations(tr.doc, id) }\n },\n },\n appendTransaction(transactions, _before, after) {\n const id = compositeFocusKey.getState(after)?.id\n if (!id || !transactions.some(tr => tr.docChanged || tr.getMeta(compositeFocusKey))) return null\n return findBlockById(after.doc, id) ? null : after.tr.setMeta(compositeFocusKey, { id: null }).setMeta('addToHistory', false)\n },\n props: {\n decorations: state => compositeFocusKey.getState(state)?.decorations,\n },\n }),\n ],\n})\n"],"mappings":";;;;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M,QAAQ,cAAc,MAAM,KAAK,EAAE;GACzC,IAAI,OAAO,KAAK,KAAK,SAAS,aAAa,OAAO;GAClD,MAAM,EAAE,MAAM,OAAO,MAAM;GAE3B,IAAI,OAAO,MAAM,OAAO,KAAK,MAAM,MAAM,MAAM,KAAK,UAAU,GAAG,aAAa,cAAc,KAAK,GAAG,IAAI,QAAQ,MAAM,MAAM,CAAC,CAAC,CAAC;EACjI;EACA,GAAG,QAAQ,mBAAmB,EAAE,GAAG,CAAC;EACpC,OAAO;CACT,EACF;CACA,6BAA6B,CAC3B,IAAI,OAA4B;EAC9B,KAAK;EACL,OAAO;GACL,YAAY;GACZ,MAAM,IAAI,OAAO;IACf,MAAM,OAAO,GAAG,QAAQ,iBAAiB;IACzC,MAAM,KAAK,OAAO,KAAK,KAAK,MAAM;IAClC,IAAI,OAAO,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ;IACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,YAAY,OAAO;IACpC,OAAO;KAAE;KAAI,aAAa,iBAAiB,GAAG,KAAK,EAAE;IAAE;GACzD;EACF;EACA,kBAAkB,cAAc,SAAS,OAAO;GAC9C,MAAM,KAAK,kBAAkB,SAAS,KAAK,CAAC,EAAE;GAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,MAAK,OAAM,GAAG,cAAc,GAAG,QAAQ,iBAAiB,CAAC,GAAG,OAAO;GAC5F,OAAO,cAAc,MAAM,KAAK,EAAE,IAAI,OAAO,MAAM,GAAG,QAAQ,mBAAmB,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,gBAAgB,KAAK;EAC9H;EACA,OAAO,EACL,cAAa,UAAS,kBAAkB,SAAS,KAAK,CAAC,EAAE,YAC3D;CACF,CAAC,CACH;AACF,CAAC"}
1
+ {"version":3,"file":"focus.js","names":[],"sources":["../../../src/features/composites/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type EditorState, Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\nimport { findBlockById } from '../../core/schema'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n/** State of `compositeFocusKey`: the focused Typed block's block id (`null` = no focus) and the decorations that hide the rest. */\nexport interface CompositeFocusState {\n id: string | null\n decorations: DecorationSet\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n compositeFocus: {\n /**\n * Focus mode: show only the Typed block with block id `id` and the titles of the Typed blocks around it (the siblings of it\n * and of every ancestor are hidden); `null` ends it. False when `id` is not a Typed block of the document. A caret outside\n * the focused Typed block moves into its title, so no edit lands in hidden content. Resets by itself when the Typed block is gone.\n */\n focusComposite: (id: string | null) => ReturnType\n }\n }\n}\n\n/** Class of every node hidden by focus mode (siblings of the focused Typed block and of each ancestor). */\nexport const FOCUS_HIDDEN_CLASS = 'sk-focus-hidden'\n/** Class of the focused Typed block. */\nexport const FOCUS_TARGET_CLASS = 'sk-focus-target'\n/** Class of every ancestor of the focused Typed block. */\nexport const FOCUS_ANCESTOR_CLASS = 'sk-focus-ancestor'\n\nexport const compositeFocusKey = new PluginKey<CompositeFocusState>('compositeFocus')\n\n/** The block id of the focused Typed block in `state`, `null` without focus (or without the extension). */\nexport const compositeFocusOf = (state: EditorState): string | null => compositeFocusKey.getState(state)?.id ?? null\n\n/**\n * The decorations of focus mode on Typed block `id` in `doc`: every sibling of the Typed block and of each of its ancestors gets\n * `sk-focus-hidden` (a Typed block's title, description and tags are not siblings in this sense: they stay, so the ancestors\n * keep their titles), the Typed block itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.\n */\nexport function focusDecorations(doc: PMNode, id: string): DecorationSet {\n const found = findBlockById(doc, id)\n if (!found) return DecorationSet.empty\n const $pos = doc.resolve(found.pos)\n const decorations: Decoration[] = [Decoration.node(found.pos, found.pos + found.node.nodeSize, { class: FOCUS_TARGET_CLASS })]\n for (let depth = $pos.depth; depth >= 0; depth--) {\n const parent = $pos.node(depth)\n const onPath = $pos.index(depth)\n const start = $pos.start(depth)\n const isComposite = parent.type.name === 'typedBlock'\n parent.forEach((child, offset, index) => {\n if (index === onPath || (isComposite && index < COMPOSITE_CHROME_COUNT)) return\n const pos = start + offset\n decorations.push(Decoration.node(pos, pos + child.nodeSize, { class: FOCUS_HIDDEN_CLASS }))\n })\n if (depth > 0) decorations.push(Decoration.node($pos.before(depth), $pos.after(depth), { class: FOCUS_ANCESTOR_CLASS }))\n }\n return DecorationSet.create(doc, decorations)\n}\n\nconst unfocused: CompositeFocusState = { id: null, decorations: DecorationSet.empty }\n\n/**\n * Focus mode of Typed blocks (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset\n * when the focused Typed block disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).\n */\nexport const CompositeFocus = Extension.create({\n name: 'compositeFocus',\n addCommands: () => ({\n focusComposite: (id: string | null) => ({ state, tr }) => {\n if (id !== null) {\n const found = findBlockById(state.doc, id)\n if (found?.node.type.name !== 'typedBlock') return false\n const { from, to } = state.selection\n // The caret in hidden content would edit what nobody sees: move it into the focused Typed block's title.\n if (from < found.pos || to > found.pos + found.node.nodeSize) tr.setSelection(TextSelection.near(tr.doc.resolve(found.pos + 2)))\n }\n tr.setMeta(compositeFocusKey, { id })\n return true\n },\n }),\n addProseMirrorPlugins: () => [\n new Plugin<CompositeFocusState>({\n key: compositeFocusKey,\n state: {\n init: () => unfocused,\n apply(tr, value) {\n const meta = tr.getMeta(compositeFocusKey) as { id: string | null } | undefined\n const id = meta ? meta.id : value.id\n if (id === null) return value.id === null ? value : unfocused\n if (!meta && !tr.docChanged) return value\n return { id, decorations: focusDecorations(tr.doc, id) }\n },\n },\n appendTransaction(transactions, _before, after) {\n const id = compositeFocusKey.getState(after)?.id\n if (!id || !transactions.some(tr => tr.docChanged || tr.getMeta(compositeFocusKey))) return null\n return findBlockById(after.doc, id) ? null : after.tr.setMeta(compositeF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
  import { StructureMode } from "../../settings/values.js";
2
2
  import "../../settings/index.js";
3
- import { CompositeKind } from "./kinds.js";
3
+ import { BlockType } from "./block-types.js";
4
4
  import { Node, Schema } from "@tiptap/pm/model";
5
5
  //#region src/features/composites/heading-composites.d.ts
6
6
  /**
@@ -19,18 +19,18 @@ export declare function headingGroupRange(parent: Node, index: number): {
19
19
  * description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line
20
20
  * (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).
21
21
  */
22
- export declare function compositeChromeBlocks(schema: Schema, composite: Node, kinds: readonly CompositeKind[]): Node[];
22
+ export declare function compositeChromeBlocks(schema: Schema, composite: Node, kinds: readonly BlockType[]): Node[];
23
23
  /**
24
24
  * Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)
25
25
  * with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).
26
26
  * Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when
27
27
  * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.
28
28
  */
29
- export declare function flattenCompositesToHeadings(schema: Schema, blocks: readonly Node[], recursive: boolean, level: number, kinds: readonly CompositeKind[]): Node[] | null;
29
+ export declare function flattenCompositesToHeadings(schema: Schema, blocks: readonly Node[], recursive: boolean, level: number, kinds: readonly BlockType[]): Node[] | null;
30
30
  /**
31
- * `blocks` (siblings) in the preferred `structure`: `'composite'` groups headings into `section` composites at every
31
+ * `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every
32
32
  * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.
33
33
  */
34
- export declare function structureBlocks(schema: Schema, blocks: readonly Node[], structure: StructureMode, level: number, kinds: readonly CompositeKind[]): Node[];
34
+ export declare function structureBlocks(schema: Schema, blocks: readonly Node[], structure: StructureMode, level: number, kinds: readonly BlockType[]): Node[];
35
35
  //#endregion
36
36
  //# sourceMappingURL=heading-composites.d.ts.map
@@ -1,11 +1,8 @@
1
- import { compositeKind } from "./kinds.js";
1
+ import { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from "../../core/schema/persisted-names.js";
2
+ import { blockTypeOf, propertiesOf } from "./block-types.js";
2
3
  import { Fragment } from "@tiptap/pm/model";
3
4
  //#region src/features/composites/heading-composites.ts
4
5
  const HEADING = "heading";
5
- const COMPOSITE = "composite";
6
- const TITLE = "compositeTitle";
7
- const DESCRIPTION = "compositeDescription";
8
- const TAGS = "compositeTags";
9
6
  const PARAGRAPH = "paragraph";
10
7
  /** Title, description and tags: the fixed children in front of a composite's body. */
11
8
  const CHROME_COUNT = 3;
@@ -20,7 +17,7 @@ function groupHeadingsIntoComposites(schema, blocks, recursive, kind) {
20
17
  let changed = false;
21
18
  let input = [...blocks];
22
19
  if (recursive) input = input.map((block) => {
23
- if (block.type.name !== COMPOSITE) return block;
20
+ if (block.type.name !== "typedBlock") return block;
24
21
  const children = [];
25
22
  block.forEach((child) => children.push(child));
26
23
  const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind);
@@ -45,10 +42,10 @@ function groupHeadingsIntoComposites(schema, blocks, recursive, kind) {
45
42
  let content = body;
46
43
  if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content;
47
44
  if (!content.length) content = [nodes[PARAGRAPH].create()];
48
- return nodes[COMPOSITE].create({ kind }, [
49
- nodes[TITLE].create(null, heading.content),
50
- nodes[DESCRIPTION].create(),
51
- nodes[TAGS].create(),
45
+ return nodes[TYPED_BLOCK].create({ blockType: kind }, [
46
+ nodes[TYPED_BLOCK_TITLE].create(null, heading.content),
47
+ nodes[TYPED_BLOCK_DESCRIPTION].create(),
48
+ nodes[TYPED_BLOCK_TAGS].create(),
52
49
  ...content
53
50
  ]);
54
51
  });
@@ -91,8 +88,8 @@ function compositeChromeBlocks(schema, composite, kinds) {
91
88
  const chips = names.flatMap((name, index) => [...index ? [schema.text(" ")] : [], n.tag ? n.tag.create({ name }) : schema.text(`#${name}`)]);
92
89
  blocks.push(paragraph.create(null, chips));
93
90
  }
94
- const kind = composite.attrs.kind;
95
- const fields = kinds.some((known) => known.id === kind) ? compositeKind(kinds, kind).fields : [];
91
+ const kind = composite.attrs.blockType;
92
+ const fields = kinds.some((known) => known.id === kind) ? propertiesOf(blockTypeOf(kinds, kind)) : [];
96
93
  const meta = composite.attrs.meta ?? {};
97
94
  const entries = Object.entries(meta).filter(([, value]) => value !== "" && value !== null && value !== void 0).map(([key, value]) => {
98
95
  const field = fields.find((candidate) => candidate.key === key);
@@ -109,10 +106,10 @@ function compositeChromeBlocks(schema, composite, kinds) {
109
106
  * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.
110
107
  */
111
108
  function flattenCompositesToHeadings(schema, blocks, recursive, level, kinds) {
112
- if (!blocks.some((block) => block.type.name === COMPOSITE)) return null;
109
+ if (!blocks.some((block) => block.type.name === "typedBlock")) return null;
113
110
  const heading = schema.nodes[HEADING];
114
111
  return blocks.flatMap((block) => {
115
- if (block.type.name !== COMPOSITE) return [block];
112
+ if (block.type.name !== "typedBlock") return [block];
116
113
  let body = [];
117
114
  block.forEach((child, _offset, index) => {
118
115
  if (index >= CHROME_COUNT) body.push(child);
@@ -127,11 +124,11 @@ function flattenCompositesToHeadings(schema, blocks, recursive, level, kinds) {
127
124
  });
128
125
  }
129
126
  /**
130
- * `blocks` (siblings) in the preferred `structure`: `'composite'` groups headings into `section` composites at every
127
+ * `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every
131
128
  * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.
132
129
  */
133
130
  function structureBlocks(schema, blocks, structure, level, kinds) {
134
- if (structure === "composite") return groupHeadingsIntoComposites(schema, blocks, true, "section") ?? [...blocks];
131
+ if (structure === "structured") return groupHeadingsIntoComposites(schema, blocks, true, "section") ?? [...blocks];
135
132
  return flattenCompositesToHeadings(schema, blocks, true, level, kinds) ?? [...blocks];
136
133
  }
137
134
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"heading-composites.js","names":[],"sources":["../../../src/features/composites/heading-composites.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport { type CompositeKind, compositeKind } from './kinds'\nimport type { StructureMode } from '../../settings'\n\n// Node names hardcoded (not imported from composite.ts) so composite.ts can import this file without a cycle.\nconst HEADING = 'heading'\nconst COMPOSITE = 'composite'\nconst TITLE = 'compositeTitle'\nconst DESCRIPTION = 'compositeDescription'\nconst TAGS = 'compositeTags'\nconst PARAGRAPH = 'paragraph'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nconst CHROME_COUNT = 3\n\n\nconst isHeading = (node: PMNode) => node.type.name === HEADING\nconst levelOf = (node: PMNode) => node.attrs.level as number\n\n/**\n * `blocks` (siblings) with headings grouped into composites of `kind`. Flat: only headings of the lowest level present\n * become composites; everything before the first such heading is kept. Recursive: bodies, the part before the first\n * heading and the bodies of existing composites are grouped the same way. `null` when nothing changed.\n */\nexport function groupHeadingsIntoComposites(schema: Schema, blocks: readonly PMNode[], recursive: boolean, kind: string): PMNode[] | null {\n let changed = false\n let input: PMNode[] = [...blocks]\n if (recursive) {\n input = input.map((block) => {\n if (block.type.name !== COMPOSITE) return block\n const children: PMNode[] = []\n block.forEach(child => children.push(child))\n const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind)\n if (!body) return block\n changed = true\n return block.copy(Fragment.from([...children.slice(0, CHROME_COUNT), ...body]))\n })\n }\n\n let minLevel = Infinity\n for (const block of input) if (isHeading(block)) minLevel = Math.min(minLevel, levelOf(block))\n if (minLevel === Infinity) return changed ? input : null\n\n const { nodes } = schema\n let preamble: PMNode[] = []\n const groups: { heading: PMNode, body: PMNode[] }[] = []\n for (const block of input) {\n if (isHeading(block) && levelOf(block) <= minLevel) groups.push({ heading: block, body: [] })\n else if (groups.length) groups[groups.length - 1]!.body.push(block)\n else preamble.push(block)\n }\n if (recursive) preamble = groupHeadingsIntoComposites(schema, preamble, true, kind) ?? preamble\n\n const composites = groups.map(({ heading, body }) => {\n let content = body\n if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content\n if (!content.length) content = [nodes[PARAGRAPH]!.create()]\n return nodes[COMPOSITE]!.create({ kind }, [\n nodes[TITLE]!.create(null, heading.content), nodes[DESCRIPTION]!.create(), nodes[TAGS]!.create(), ...content,\n ])\n })\n return [...preamble, ...composites]\n}\n\n/** Index range `[from, to)` of the heading at `index` in `parent` plus its content: up to the next sibling heading of the same or a higher level. */\nexport function headingGroupRange(parent: PMNode, index: number): { from: number, to: number } {\n const level = levelOf(parent.child(index))\n for (let i = index + 1; i < parent.childCount; i++) {\n const child = parent.child(i)\n if (isHeading(child) && levelOf(child) <= level) return { from: index, to: i }\n }\n return { from: index, to: parent.childCount }\n}\n\n/**\n * Description, tags and meta of `composite` as plain paragraphs, in this order, each only when non-empty: the\n * description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line\n * (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).\n */\nexport function compositeChromeBlocks(schema: Schema, composite: PMNode, kinds: readonly CompositeKind[]): PMNode[] {\n const n = schema.nodes\n const paragraph = n[PARAGRAPH]!\n const description = composite.child(1)\n const tags: unknown = composite.child(2).attrs.tags\n const blocks: PMNode[] = []\n if (description.content.size) {\n const italic = schema.marks.italic\n const content: PMNode[] = []\n description.forEach(child => content.push(italic && child.isText ? child.mark(italic.create().addToSet(child.marks)) : child))\n blocks.push(paragraph.create(null, content))\n }\n const names = Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string' && tag !== '') : []\n if (names.length) {\n const chips = names.flatMap((name, index) => [\n ...(index ? [schema.text(' ')] : []),\n n.tag ? n.tag.create({ name }) : schema.text(`#${name}`),\n ])\n blocks.push(paragraph.create(null, chips))\n }\n const kind = composite.attrs.kind as string\n const fields = kinds.some(known => known.id === kind) ? compositeKind(kinds, kind).fields : []\n const meta = (composite.attrs.meta ?? {}) as Record<string, unknown>\n const entries = Object.entries(meta)\n .filter(([, value]) => value !== '' && value !== null && value !== undefined)\n .map(([key, value]) => {\n const field = fields.find(candidate => candidate.key === key)\n const display = field?.options?.find(option => option.value === value)?.label ?? String(value)\n return `${field?.label ?? key}: ${display}`\n })\n if (entries.length) blocks.push(paragraph.create(null, schema.text(entries.join(' · '))))\n return blocks\n}\n\n/**\n * Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)\n * with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).\n * Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when\n * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.\n */\nexport function flattenCompositesToHeadings(schema: Schema, blocks: readonly PMNode[], recursive: boolean, level: number, kinds: readonly CompositeKind[]): PMNode[] | null {\n if (!blocks.some(block => block.type.name === COMPOSITE)) return null\n const heading = schema.nodes[HEADING]!\n return blocks.flatMap((block) => {\n if (block.type.name !== COMPOSITE) return [block]\n let body: PMNode[] = []\n block.forEach((child, _offset, index) => {\n if (index >= CHROME_COUNT) body.push(child)\n })\n if (body.length === 1 && body[0]!.type.name === PARAGRAPH && !body[0]!.content.size) body = []\n if (recursive) body = flattenCompositesToHeadings(schema, body, true, level + 1, kinds) ?? body\n return [heading.create({ level: Math.min(level, 6) }, block.child(0).content), ...compositeChromeBlocks(schema, block, kinds), ...body]\n })\n}\n\n/**\n * `blocks` (siblings) in the preferred `structure`: `'composite'` groups headings into `section` composites at every\n * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.\n */\nexport function structureBlocks(schema: Schema, blocks: readonly PMNode[], structure: StructureMode, level: number, kinds: readonly CompositeKind[]): PMNode[] {\n if (structure === 'composite') return groupHeadingsIntoCom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4B,QAAgB,QAA2B,WAAoB,OAAe,OAAkD;CAC1K,IAAI,CAAC,OAAO,MAAK,UAAS,MAAM,KAAK,SAAS,SAAS,GAAG,OAAO;CACjE,MAAM,UAAU,OAAO,MAAM;CAC7B,OAAO,OAAO,SAAS,UAAU;EAC/B,IAAI,MAAM,KAAK,SAAS,WAAW,OAAO,CAAC,KAAK;EAChD,IAAI,OAAiB,CAAC;EACtB,MAAM,SAAS,OAAO,SAAS,UAAU;GACvC,IAAI,SAAS,cAAc,KAAK,KAAK,KAAK;EAC5C,CAAC;EACD,IAAI,KAAK,WAAW,KAAK,KAAK,EAAE,CAAE,KAAK,SAAS,aAAa,CAAC,KAAK,EAAE,CAAE,QAAQ,MAAM,OAAO,CAAC;EAC7F,IAAI,WAAW,OAAO,4BAA4B,QAAQ,MAAM,MAAM,QAAQ,GAAG,KAAK,KAAK;EAC3F,OAAO;GAAC,QAAQ,OAAO,EAAE,OAAO,KAAK,IAAI,OAAO,CAAC,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,OAAO;GAAG,GAAG,sBAAsB,QAAQ,OAAO,KAAK;GAAG,GAAG;EAAI;CACxI,CAAC;AACH;;;;;AAMA,SAAgB,gBAAgB,QAAgB,QAA2B,WAA0B,OAAe,OAA2C;CAC7J,IAAI,cAAc,aAAa,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,SAAS,KAAK,CAAC,GAAG,MAAM;CAChH,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,OAAO,KAAK,KAAK,CAAC,GAAG,MAAM;AACtF"}
1
+ {"version":3,"file":"heading-composites.js","names":[],"sources":["../../../src/features/composites/heading-composites.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport { type BlockType, blockTypeOf, propertiesOf } from './block-types'\nimport { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from '../../core/schema/persisted-names'\nimport type { StructureMode } from '../../settings'\n\nconst HEADING = 'heading'\nconst PARAGRAPH = 'paragraph'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nconst CHROME_COUNT = 3\n\nconst isHeading = (node: PMNode) => node.type.name === HEADING\nconst levelOf = (node: PMNode) => node.attrs.level as number\n\n/**\n * `blocks` (siblings) with headings grouped into composites of `kind`. Flat: only headings of the lowest level present\n * become composites; everything before the first such heading is kept. Recursive: bodies, the part before the first\n * heading and the bodies of existing composites are grouped the same way. `null` when nothing changed.\n */\nexport function groupHeadingsIntoComposites(schema: Schema, blocks: readonly PMNode[], recursive: boolean, kind: string): PMNode[] | null {\n let changed = false\n let input: PMNode[] = [...blocks]\n if (recursive) {\n input = input.map((block) => {\n if (block.type.name !== TYPED_BLOCK) return block\n const children: PMNode[] = []\n block.forEach(child => children.push(child))\n const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind)\n if (!body) return block\n changed = true\n return block.copy(Fragment.from([...children.slice(0, CHROME_COUNT), ...body]))\n })\n }\n\n let minLevel = Infinity\n for (const block of input) if (isHeading(block)) minLevel = Math.min(minLevel, levelOf(block))\n if (minLevel === Infinity) return changed ? input : null\n\n const { nodes } = schema\n let preamble: PMNode[] = []\n const groups: { heading: PMNode, body: PMNode[] }[] = []\n for (const block of input) {\n if (isHeading(block) && levelOf(block) <= minLevel) groups.push({ heading: block, body: [] })\n else if (groups.length) groups[groups.length - 1]!.body.push(block)\n else preamble.push(block)\n }\n if (recursive) preamble = groupHeadingsIntoComposites(schema, preamble, true, kind) ?? preamble\n\n const composites = groups.map(({ heading, body }) => {\n let content = body\n if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content\n if (!content.length) content = [nodes[PARAGRAPH]!.create()]\n return nodes[TYPED_BLOCK]!.create({ blockType: kind }, [\n nodes[TYPED_BLOCK_TITLE]!.create(null, heading.content), nodes[TYPED_BLOCK_DESCRIPTION]!.create(), nodes[TYPED_BLOCK_TAGS]!.create(), ...content,\n ])\n })\n return [...preamble, ...composites]\n}\n\n/** Index range `[from, to)` of the heading at `index` in `parent` plus its content: up to the next sibling heading of the same or a higher level. */\nexport function headingGroupRange(parent: PMNode, index: number): { from: number, to: number } {\n const level = levelOf(parent.child(index))\n for (let i = index + 1; i < parent.childCount; i++) {\n const child = parent.child(i)\n if (isHeading(child) && levelOf(child) <= level) return { from: index, to: i }\n }\n return { from: index, to: parent.childCount }\n}\n\n/**\n * Description, tags and meta of `composite` as plain paragraphs, in this order, each only when non-empty: the\n * description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line\n * (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).\n */\nexport function compositeChromeBlocks(schema: Schema, composite: PMNode, kinds: readonly BlockType[]): PMNode[] {\n const n = schema.nodes\n const paragraph = n[PARAGRAPH]!\n const description = composite.child(1)\n const tags: unknown = composite.child(2).attrs.tags\n const blocks: PMNode[] = []\n if (description.content.size) {\n const italic = schema.marks.italic\n const content: PMNode[] = []\n description.forEach(child => content.push(italic && child.isText ? child.mark(italic.create().addToSet(child.marks)) : child))\n blocks.push(paragraph.create(null, content))\n }\n const names = Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string' && tag !== '') : []\n if (names.length) {\n const chips = names.flatMap((name, index) => [\n ...(index ? [schema.text(' ')] : []),\n n.tag ? n.tag.create({ name }) : schema.text(`#${name}`),\n ])\n blocks.push(paragraph.create(null, chips))\n }\n const kind = composite.attrs.blockType as string\n const fields = kinds.some(known => known.id === kind) ? propertiesOf(blockTypeOf(kinds, kind)) : []\n const meta = (composite.attrs.meta ?? {}) as Record<string, unknown>\n const entries = Object.entries(meta)\n .filter(([, value]) => value !== '' && value !== null && value !== undefined)\n .map(([key, value]) => {\n const field = fields.find(candidate => candidate.key === key)\n const display = field?.options?.find(option => option.value === value)?.label ?? String(value)\n return `${field?.label ?? key}: ${display}`\n })\n if (entries.length) blocks.push(paragraph.create(null, schema.text(entries.join(' · '))))\n return blocks\n}\n\n/**\n * Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)\n * with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).\n * Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when\n * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.\n */\nexport function flattenCompositesToHeadings(schema: Schema, blocks: readonly PMNode[], recursive: boolean, level: number, kinds: readonly BlockType[]): PMNode[] | null {\n if (!blocks.some(block => block.type.name === TYPED_BLOCK)) return null\n const heading = schema.nodes[HEADING]!\n return blocks.flatMap((block) => {\n if (block.type.name !== TYPED_BLOCK) return [block]\n let body: PMNode[] = []\n block.forEach((child, _offset, index) => {\n if (index >= CHROME_COUNT) body.push(child)\n })\n if (body.length === 1 && body[0]!.type.name === PARAGRAPH && !body[0]!.content.size) body = []\n if (recursive) body = flattenCompositesToHeadings(schema, body, true, level + 1, kinds) ?? body\n return [heading.create({ level: Math.min(level, 6) }, block.child(0).content), ...compositeChromeBlocks(schema, block, kinds), ...body]\n })\n}\n\n/**\n * `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every\n * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.\n */\nexport function structureBlocks(schema: Schema, blocks: readonly PMNode[], structure: StructureMode, level: number, kinds: readonly BlockType[]): PMNode[] {\n if (structure === 'structured') return groupHeadingsIntoComposites(schema, blocks, true, 'section') ?? [...blocks]\n return flattenCompositesToHeadings(schema, blocks, true, level, kinds) ?? [...blocks]\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU;AAChB,MAAM,YAAY;;AAElB,MAAM,eAAe;AAErB,MAAM,aAAa,SAAiB,KAAK,KAAK,SAAS;AACvD,MAAM,WAAW,SAAiB,KAAK,MAAM;;;;;;AAO7C,SAAgB,4BAA4B,QAAgB,QAA2B,WAAoB,MAA+B;CACxI,IAAI,UAAU;CACd,IAAI,QAAkB,CAAC,GAAG,MAA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,SAAS,aAAa,CAAC,KAAK,EAAE,CAAE,QAAQ,MAAM,OAAO,CAAC;EAC7F,IAAI,WAAW,OAAO,4BAA4B,QAAQ,MAAM,MAAM,QAAQ,GAAG,KAAK,KAAK;EAC3F,OAAO;GAAC,QAAQ,OAAO,EAAE,OAAO,KAAK,IAAI,OAAO,CAAC,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,OAAO;GAAG,GAAG,sBAAsB,QAAQ,OAAO,KAAK;GAAG,GAAG;EAAI;CACxI,CAAC;AACH;;;;;AAMA,SAAgB,gBAAgB,QAAgB,QAA2B,WAA0B,OAAe,OAAuC;CACzJ,IAAI,cAAc,cAAc,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,SAAS,KAAK,CAAC,GAAG,MAAM;CACjH,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,OAAO,KAAK,KAAK,CAAC,GAAG,MAAM;AACtF"}
@@ -1,11 +1,23 @@
1
1
  import { CSL_TYPES, CslDate, CslItem, CslName, CslType } from "../../core/backend-types.js";
2
- import { CompositeAiBrief, compositeAiBrief } from "./ai-brief.js";
3
- import { CompositeKind, CompositeKindAi, CompositeMetaField, SOURCE_MEDIA_TYPES, compositeKind, defaultCompositeKinds, kindAccepts } from "./kinds.js";
4
- import { CompositeBacklink, CompositeMention, CompositeReference, CompositeRow, compositeBacklinks, compositeDescriptionText, compositeMetaWith, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeMetaField, setCompositeTags } from "./rows.js";
5
- import { CompositeAnchor, CompositeAnchorsHandle, CompositeFrame, compositeSectionOf, observeCompositeAnchors } from "./anchors.js";
6
2
  import { BASKET_IDS, Basket, basketById, basketOf, defaultBaskets, titleHiddenOf } from "./baskets.js";
7
- import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeOptions, CompositeStorage, CompositeTagsNode, CompositeTitleNode, compositeBasketsOf, compositeJSON, compositeKindsOf } from "./nodes.js";
3
+ import { BlockType, BlockTypeAi, SOURCE_MEDIA_TYPES, acceptsChild, acceptsImport, aiBlockTypesOf, blockTypeOf, defaultBlockTypes, isRootBlockType } from "./block-types.js";
4
+ import { CompositeAiBrief, compositeAiBrief } from "./ai-brief.js";
5
+ import { compositeConversions, convertCompositeBlocks } from "./convert.js";
6
+ import { CompositeFence, FenceSegment, splitCompositeFences } from "../../core/fences.js";
7
+ import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
8
+ import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
9
+ import { BASKET_KEY, BIB_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
10
+ import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
11
+ import { bodyMarkdown, sourceOf } from "./source.js";
12
+ import { BlockTypeJsonError, BlockTypeJsonIssue, mergeBlockTypes, parseBlockTypes } from "./block-types-json.js";
13
+ import { migrateLegacyContent } from "./legacy.js";
8
14
  import { REFERENCE_NODE, ReferenceAttrs, ReferenceNode, ReferenceOptions, ReferenceSuggestionPluginKey, referenceMarkdown } from "./reference.js";
15
+ import { normalizeReferences, referencesFromText } from "./reference-text.js";
16
+ import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeOptions, CompositeStorage, CompositeTagsNode, CompositeTitleNode, blockTypesOf, compositeBasketsOf, compositeJSON } from "./nodes.js";
17
+ import { compositeSchemaExtensions } from "./schema.js";
18
+ import { BlockProperties, blockPropertiesAt, blockPropertiesOf, carriesProperties, metaWithProperty, propertyHostOf, setBlockProperty } from "./properties.js";
19
+ import { CompositeBacklink, CompositeMention, CompositeReference, CompositeRow, compositeBacklinks, compositeDescriptionText, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeTags } from "./rows.js";
20
+ import { CompositeAnchor, CompositeAnchorsHandle, CompositeFrame, compositeSectionOf, observeCompositeAnchors } from "./anchors.js";
9
21
  import { CompositeNodeViews, compositeNodes } from "./node-views.js";
10
22
  import { CompositeFeatureOptions, CompositesUi, compositeFeatureCore } from "./feature.js";
11
23
  import { CompositeFocus, CompositeFocusState, compositeFocusKey, compositeFocusOf, focusDecorations } from "./focus.js";
@@ -13,8 +25,8 @@ import { documentCompositeMarkdown, headingsMarkdown, markdownFileName } from ".
13
25
  import { MoveVerdict, OutlineNode, canMoveBlockInto, compositeOutline, moveBlockInto, moveIntoVerdict } from "./outline.js";
14
26
  import { SourceLocator, SourceReveal, parseLocator, revealSource, seekSource } from "./reveal-source.js";
15
27
  import { AcceptedChildren, AcceptedChildrenOptions } from "./accepted-children.js";
16
- import { CompositeKindCount, CompositeRowsHandle, CompositeRowsState, createCompositeRows } from "./rows-model.js";
17
- import { CompositeInspector, CompositeInspectorSection, CompositeInspectorState, CompositeKindOption, compositeFieldText, createCompositeInspector } from "./inspector-model.js";
28
+ import { BlockTypeCount, CompositeRowsHandle, CompositeRowsState, createCompositeRows } from "./rows-model.js";
29
+ import { BlockTypeOption, CompositeInspector, CompositeInspectorSection, CompositeInspectorState, InspectorDerivation, compositeFieldText, createCompositeInspector } from "./inspector-model.js";
18
30
  import { ReferenceTarget, referenceLabel, referenceTarget, referenceTitle } from "./reference-label.js";
19
31
  import { referenceSuggestion } from "./reference-suggestion.js";
20
32
  import { CompositeMerge, mergeBody } from "./merge.js";
@@ -22,14 +34,4 @@ import { CompositeSplit, CompositeSplitOptions, SplitMode, childKindFor, generat
22
34
  import { Structure, StructureStorage, structureOf } from "./structure.js";
23
35
  import { STRUCTURE_MODE_KEYS } from "./structure-mode.js";
24
36
  import { TREE_ROOT_KEYS } from "./tree-root.js";
25
- import { compositeConversions, convertCompositeBlocks } from "./convert.js";
26
- import { CompositeFence, FenceSegment, splitCompositeFences } from "../../core/fences.js";
27
- import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
28
- import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
29
- import { BASKET_KEY, BIB_KEY, DERIVATION_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
30
- import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
31
- import { Derivation, DerivationMethod, DerivationSource, bodyMarkdown, derivationOf, derivationState, renditionsOf, sourceOf } from "./derivation.js";
32
- import { LEGACY_COMPOSITE_NODE, migrateLegacyContent } from "./legacy.js";
33
- import { normalizeReferences, referencesFromText } from "./reference-text.js";
34
- import { compositeSchemaExtensions } from "./schema.js";
35
- export { AcceptedChildren, type AcceptedChildrenOptions, BASKET_IDS, BASKET_KEY, BIB_KEY, type Basket, COMPOSITE_CHROME_COUNT, CSL_TYPES, type CompositeAiBrief, type CompositeAnchor, type CompositeAnchorsHandle, type CompositeBacklink, CompositeDescriptionNode, type CompositeFeatureOptions, type CompositeFence, CompositeFocus, type CompositeFocusState, type CompositeFrame, type CompositeInspector, type CompositeInspectorSection, type CompositeInspectorState, type CompositeKind, type CompositeKindAi, type CompositeKindCount, type CompositeKindOption, type CompositeMention, CompositeMerge, type CompositeMetaField, CompositeNode, type CompositeNodeViews, type CompositeOptions, type CompositeReference, type CompositeRow, type CompositeRowsHandle, type CompositeRowsState, CompositeSplit, type CompositeSplitOptions, type CompositeStorage, CompositeTagsNode, CompositeTitleNode, type CompositesUi, type CslDate, type CslItem, type CslName, type CslType, DERIVATION_KEY, type Derivation, type DerivationMethod, type DerivationSource, type FenceSegment, LEGACY_COMPOSITE_NODE, type MoveVerdict, type OutlineNode, REFERENCE_NODE, type ReferenceAttrs, ReferenceNode, type ReferenceOptions, ReferenceSuggestionPluginKey, type ReferenceTarget, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, type SourceLocator, SourceReveal, type SplitMode, Structure, type StructureStorage, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, basketById, basketOf, bibOf, bibtexOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeKind, compositeKindsOf, compositeMetaWith, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultCompositeKinds, derivationOf, derivationState, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, kindAccepts, markdownFileName, mergeBody, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseLocator, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, renditionsOf, revealSource, seekSource, setCompositeDescription, setCompositeMetaField, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
37
+ export { AcceptedChildren, type AcceptedChildrenOptions, BASKET_IDS, BASKET_KEY, BIB_KEY, type Basket, type BlockProperties, type BlockType, type BlockTypeAi, type BlockTypeCount, BlockTypeJsonError, type BlockTypeJsonIssue, type BlockTypeOption, COMPOSITE_CHROME_COUNT, CSL_TYPES, type CompositeAiBrief, type CompositeAnchor, type CompositeAnchorsHandle, type CompositeBacklink, CompositeDescriptionNode, type CompositeFeatureOptions, type CompositeFence, CompositeFocus, type CompositeFocusState, type CompositeFrame, type CompositeInspector, type CompositeInspectorSection, type CompositeInspectorState, type CompositeMention, CompositeMerge, CompositeNode, type CompositeNodeViews, type CompositeOptions, type CompositeReference, type CompositeRow, type CompositeRowsHandle, type CompositeRowsState, CompositeSplit, type CompositeSplitOptions, type CompositeStorage, CompositeTagsNode, CompositeTitleNode, type CompositesUi, type CslDate, type CslItem, type CslName, type CslType, type FenceSegment, type InspectorDerivation, type MoveVerdict, type OutlineNode, REFERENCE_NODE, type ReferenceAttrs, ReferenceNode, type ReferenceOptions, ReferenceSuggestionPluginKey, type ReferenceTarget, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, type SourceLocator, SourceReveal, type SplitMode, Structure, type StructureStorage, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, acceptsChild, acceptsImport, aiBlockTypesOf, basketById, basketOf, bibOf, bibtexOf, blockPropertiesAt, blockPropertiesOf, blockTypeOf, blockTypesOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, carriesProperties, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultBlockTypes, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, isRootBlockType, markdownFileName, mergeBlockTypes, mergeBody, metaWithProperty, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseBlockTypes, parseLocator, propertyHostOf, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, revealSource, seekSource, setBlockProperty, setCompositeDescription, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
@@ -1,17 +1,19 @@
1
1
  import { splitCompositeFences } from "../../core/fences.js";
2
- import { SOURCE_MEDIA_TYPES, compositeKind, defaultCompositeKinds, kindAccepts } from "./kinds.js";
3
- import { BASKET_KEY, BIB_KEY, DERIVATION_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
2
+ import { SOURCE_MEDIA_TYPES, acceptsChild, acceptsImport, aiBlockTypesOf, blockTypeOf, defaultBlockTypes, isRootBlockType } from "./block-types.js";
3
+ import { BASKET_KEY, BIB_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
4
4
  import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
5
5
  import { BASKET_IDS, basketById, basketOf, defaultBaskets, titleHiddenOf } from "./baskets.js";
6
- import { bodyMarkdown, derivationOf, derivationState, renditionsOf, sourceOf } from "./derivation.js";
7
6
  import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
8
- import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, compositeBasketsOf, compositeJSON, compositeKindsOf } from "./nodes.js";
7
+ import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, blockTypesOf, compositeBasketsOf, compositeJSON } from "./nodes.js";
9
8
  import { REFERENCE_NODE, ReferenceNode, ReferenceSuggestionPluginKey, referenceMarkdown } from "./reference.js";
10
9
  import { CSL_TYPES } from "../../core/backend-types.js";
11
10
  import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
12
11
  import { compositeAiBrief } from "./ai-brief.js";
13
12
  import { compositeConversions, convertCompositeBlocks } from "./convert.js";
14
- import { LEGACY_COMPOSITE_NODE, migrateLegacyContent } from "./legacy.js";
13
+ import { bodyMarkdown, sourceOf } from "./source.js";
14
+ import { blockPropertiesAt, blockPropertiesOf, carriesProperties, metaWithProperty, propertyHostOf, setBlockProperty } from "./properties.js";
15
+ import { BlockTypeJsonError, mergeBlockTypes, parseBlockTypes } from "./block-types-json.js";
16
+ import { migrateLegacyContent } from "./legacy.js";
15
17
  import { normalizeReferences, referencesFromText } from "./reference-text.js";
16
18
  import { compositeSchemaExtensions } from "./schema.js";
17
19
  import { AcceptedChildren } from "./accepted-children.js";
@@ -20,7 +22,7 @@ import { compositeNodes } from "./node-views.js";
20
22
  import { CompositeFocus, compositeFocusKey, compositeFocusOf, focusDecorations } from "./focus.js";
21
23
  import { CompositeMerge, mergeBody } from "./merge.js";
22
24
  import { referenceLabel, referenceTarget, referenceTitle } from "./reference-label.js";
23
- import { compositeBacklinks, compositeDescriptionText, compositeMetaWith, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeMetaField, setCompositeTags } from "./rows.js";
25
+ import { compositeBacklinks, compositeDescriptionText, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeTags } from "./rows.js";
24
26
  import { referenceSuggestion } from "./reference-suggestion.js";
25
27
  import { SourceReveal, parseLocator, revealSource, seekSource } from "./reveal-source.js";
26
28
  import { CompositeSplit, childKindFor, generatedTitle, splitBodyByLength, splitComposite } from "./split.js";
@@ -32,4 +34,4 @@ import { createCompositeRows } from "./rows-model.js";
32
34
  import { TREE_ROOT_KEYS } from "./tree-root.js";
33
35
  import { compositeFieldText, createCompositeInspector } from "./inspector-model.js";
34
36
  import { canMoveBlockInto, compositeOutline, moveBlockInto, moveIntoVerdict } from "./outline.js";
35
- export { AcceptedChildren, BASKET_IDS, BASKET_KEY, BIB_KEY, COMPOSITE_CHROME_COUNT, CSL_TYPES, CompositeDescriptionNode, CompositeFocus, CompositeMerge, CompositeNode, CompositeSplit, CompositeTagsNode, CompositeTitleNode, DERIVATION_KEY, LEGACY_COMPOSITE_NODE, REFERENCE_NODE, ReferenceNode, ReferenceSuggestionPluginKey, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, SourceReveal, Structure, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, basketById, basketOf, bibOf, bibtexOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeKind, compositeKindsOf, compositeMetaWith, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultCompositeKinds, derivationOf, derivationState, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, kindAccepts, markdownFileName, mergeBody, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseLocator, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, renditionsOf, revealSource, seekSource, setCompositeDescription, setCompositeMetaField, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
37
+ export { AcceptedChildren, BASKET_IDS, BASKET_KEY, BIB_KEY, BlockTypeJsonError, COMPOSITE_CHROME_COUNT, CSL_TYPES, CompositeDescriptionNode, CompositeFocus, CompositeMerge, CompositeNode, CompositeSplit, CompositeTagsNode, CompositeTitleNode, REFERENCE_NODE, ReferenceNode, ReferenceSuggestionPluginKey, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, SourceReveal, Structure, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, acceptsChild, acceptsImport, aiBlockTypesOf, basketById, basketOf, bibOf, bibtexOf, blockPropertiesAt, blockPropertiesOf, blockTypeOf, blockTypesOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, carriesProperties, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultBlockTypes, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, isRootBlockType, markdownFileName, mergeBlockTypes, mergeBody, metaWithProperty, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseBlockTypes, parseLocator, propertyHostOf, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, revealSource, seekSource, setBlockProperty, setCompositeDescription, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
@@ -1,35 +1,58 @@
1
1
  import { ReadonlyStore } from "../../core/store.js";
2
- import { CompositeMetaField } from "./kinds.js";
3
- import { CompositeRow } from "./rows.js";
2
+ import { PropertyDefinition } from "../../core/properties.js";
3
+ import { Derivation } from "../../core/derivation.js";
4
+ import { BlockProperties } from "./properties.js";
4
5
  import { CompositeRowsState } from "./rows-model.js";
5
6
  import { Editor } from "@tiptap/core";
7
+ import { Node as Node$1 } from "@tiptap/pm/model";
6
8
  //#region src/features/composites/inspector-model.d.ts
7
- /** Which section of the inspector shows: the document's facts, or the properties of the Baustein under the caret. */
8
- export type CompositeInspectorSection = 'document' | 'composite';
9
- /** A kind the Baustein can be switched to, as the kind select lists it. */
10
- export interface CompositeKindOption {
9
+ /** Which section of the inspector shows: the document's facts, or the properties of the Typed block under the caret. */
10
+ export type CompositeInspectorSection = 'document' | 'typedBlock';
11
+ /** A Block type the Typed block can be switched to, as the Block type select lists it. */
12
+ export interface BlockTypeOption {
11
13
  value: string;
12
14
  label: string;
13
15
  icon: string;
14
16
  }
17
+ /**
18
+ * The Derivation of the block the Block properties section shows, for a block whose capabilities include `derived`. `node` is
19
+ * that block, for the origin display; `sourceMissing` is the source-missing state of its Derivation (the original was deleted).
20
+ */
21
+ export interface InspectorDerivation {
22
+ node: Node$1;
23
+ derivation: Derivation;
24
+ sourceMissing: boolean;
25
+ }
15
26
  /** Everything the inspector renders (see `createCompositeInspector`): the live rows plus the inspector's own state. */
16
27
  export interface CompositeInspectorState extends CompositeRowsState {
17
- /** `'composite'` only while the caret last was in the editor and a Baustein is focused, else `'document'`. */
28
+ /** `'typedBlock'` only while the caret last was in the editor and a Typed block is focused, else `'document'`. */
18
29
  section: CompositeInspectorSection;
19
30
  /** Whether the editor accepts edits; follows `setEditable` (see `createCompositeInspector`). */
20
31
  editable: boolean;
21
- /** The description text as the user sees it in the focused Baustein's textarea; may be ahead of the document until it is committed. */
32
+ /** The description text as the user sees it in the focused Typed block's textarea; may be ahead of the document until it is committed. */
22
33
  draft: string;
23
34
  /** The text typed into the tag search. */
24
35
  searchTerm: string;
25
36
  /** Tag names the metadata source suggested for the latest search that was not superseded. */
26
37
  tagItems: string[];
27
38
  /** The kinds the editor was configured with, in configured order; empty without an editor. */
28
- kindOptions: CompositeKindOption[];
29
- /** How many Bausteine have a description. */
39
+ kindOptions: BlockTypeOption[];
40
+ /** How many Typed blocks have a description. */
30
41
  summarized: number;
31
- /** The focused Baustein has a description. */
42
+ /** The focused Typed block has a description. */
32
43
  hasSummary: boolean;
44
+ /**
45
+ * The Block properties section: the properties of the innermost block around the caret that carries property values, with the
46
+ * Property definitions its Block type declares through the `properties` capability (`definitions`; empty when it has none). Null
47
+ * outside such a block. The section is shown for any block that has the capability, not for a particular node type.
48
+ */
49
+ properties: BlockProperties | null;
50
+ /**
51
+ * The Derivation of the block in `properties` when it is a Derived block (its capabilities include `derived`), whatever its Block
52
+ * type, with the source-missing state. Null for a block that is not Derived, and for one whose Block type lists a `derivation`
53
+ * Property definition: that definition already shows it among `properties.definitions`, so it never shows twice.
54
+ */
55
+ derivation: InspectorDerivation | null;
33
56
  }
34
57
  /** The inspector model of an editor: observable `state`, the actions of the panel, and `dispose()`. */
35
58
  export interface CompositeInspector {
@@ -39,11 +62,11 @@ export interface CompositeInspector {
39
62
  * the section to `'document'`; the section stays there after the input blurs, until the editor takes the focus.
40
63
  */
41
64
  setDocumentFocused: (focused: boolean) => void;
42
- /** Switches the focused Baustein to `kind`; ignored when it already has it or no Baustein is focused. */
65
+ /** Switches the focused Typed block to `kind`; ignored when it already has it or no Typed block is focused. */
43
66
  setKind: (kind: string) => void;
44
67
  /**
45
68
  * The user typed `text` into the description. The draft is written to the document 600 ms after the last call and
46
- * on `blurDescription`; the Baustein focused at the first call of a pending draft is the one that is written.
69
+ * on `blurDescription`; the Typed block focused at the first call of a pending draft is the one that is written.
47
70
  */
48
71
  inputDescription: (text: string) => void;
49
72
  /**
@@ -52,33 +75,33 @@ export interface CompositeInspector {
52
75
  * started) it shows the peer's text.
53
76
  */
54
77
  blurDescription: () => void;
55
- /** Replaces the tags of the focused Baustein. */
78
+ /** Replaces the tags of the focused Typed block. */
56
79
  setTags: (tags: readonly string[]) => void;
57
- /** Creates the tag `raw` (normalized) on the focused Baustein and registers it with the metadata source; clears the search term. */
80
+ /** Creates the tag `raw` (normalized) on the focused Typed block and registers it with the metadata source; clears the search term. */
58
81
  createTag: (raw: string) => void;
59
82
  /** Sets the tag search term and schedules a search for it. */
60
83
  setSearchTerm: (term: string) => void;
61
84
  /** Schedules a tag search for the current term (the picker opened). */
62
85
  searchTags: () => void;
63
86
  /**
64
- * Writes the text `value` to the meta `field` of the focused Baustein; ignored while the editor is not editable and
87
+ * Writes the text `value` to the property `field` of the block in `state.properties`; ignored while the editor is not editable and
65
88
  * for structured fields (`isStructuredField`), whose values are not text and have their own editors.
66
89
  */
67
- setField: (field: CompositeMetaField, value: unknown) => void;
90
+ setField: (field: PropertyDefinition, value: unknown) => void;
68
91
  /** Commits a pending description draft and detaches from the editor. Idempotent; the model is inert afterwards. */
69
92
  dispose: () => void;
70
93
  }
71
94
  /** The text of `field` in `row`'s meta as an input shows it: strings and numbers, otherwise empty. */
72
- export declare function compositeFieldText(row: Pick<CompositeRow, 'meta'> | null, field: Pick<CompositeMetaField, 'key'>): string;
95
+ export declare function compositeFieldText(row: Pick<BlockProperties, 'meta'> | null, field: Pick<PropertyDefinition, 'key'>): string;
73
96
  /**
74
- * The properties panel of `editor`: which section shows, the focused Baustein's description draft, the tag search
97
+ * The properties panel of `editor`: which section shows, the focused Typed block's description draft, the tag search
75
98
  * and the writes. Owns its own `createCompositeRows(editor)`, so a focus change and the rows it refers to arrive in
76
99
  * one notification and the draft is committed before it is replaced. Create one model per editor (a framework hook
77
100
  * follows an editor that changes); without an editor the state is empty and every action is ignored.
78
101
  *
79
102
  * Section: the caret is either in the host's input (`setDocumentFocused`) or in the editor. Only the editor's `focus`
80
103
  * event moves it to the editor (not `selectionUpdate`: collaboration sync moves the selection while the host's input
81
- * has the focus). A deleted Baustein falls back to the document section.
104
+ * has the focus). A deleted Typed block falls back to the document section.
82
105
  *
83
106
  * `isEditable` is not reactive: `editable` follows it on every editor `transaction`, so whoever calls `setEditable`
84
107
  * must dispatch a transaction afterwards (`EditorSurface` does).
@@ -86,8 +109,8 @@ export declare function compositeFieldText(row: Pick<CompositeRow, 'meta'> | nul
86
109
  * Description: edits go to a local `draft` so the asynchronous re-read of the document never overwrites the text
87
110
  * (and moves the caret) while it is typed. `base` is the document text the draft started from; the write lands only
88
111
  * while the description still holds it, so a peer's change made meanwhile is never replaced. The draft is committed
89
- * 600 ms after typing pauses, on blur, when another Baustein takes the focus (before the draft is replaced), when
90
- * the panel leaves the Baustein section, and on `dispose()`. A commit is skipped when the editor is destroyed or not
112
+ * 600 ms after typing pauses, on blur, when another Typed block takes the focus (before the draft is replaced), when
113
+ * the panel leaves the Typed block section, and on `dispose()`. A commit is skipped when the editor is destroyed or not
91
114
  * editable, and refused when a peer changed the description; the draft then reloads the live text. A draft that is
92
115
  * not dirty follows every change of the focused description.
93
116
  *