edytor 2.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/README.md +19 -4
  2. package/dist/block/block.svelte.js +2 -4
  3. package/dist/clipboard/htmlFlow.d.ts +20 -7
  4. package/dist/clipboard/htmlFlow.js +23 -15
  5. package/dist/clipboard/serializeClipboardFragment.d.ts +37 -4
  6. package/dist/clipboard/serializeClipboardFragment.js +6 -4
  7. package/dist/clipboard/textBlocks.d.ts +8 -0
  8. package/dist/clipboard/textBlocks.js +6 -2
  9. package/dist/cloudflare/DocumentRoom.d.ts +13 -9
  10. package/dist/cloudflare/DocumentRoom.js +10 -6
  11. package/dist/cloudflare/room/admission.js +3 -3
  12. package/dist/cloudflare/room/context.d.ts +28 -27
  13. package/dist/cloudflare/room/context.js +2 -2
  14. package/dist/cloudflare/room/purge.d.ts +6 -3
  15. package/dist/cloudflare/room/purge.js +44 -19
  16. package/dist/cloudflare/room/updates.d.ts +3 -4
  17. package/dist/cloudflare/room/updates.js +6 -8
  18. package/dist/cloudflare/routeDocumentSocket.d.ts +17 -0
  19. package/dist/cloudflare/routeDocumentSocket.js +53 -0
  20. package/dist/collaboration/comments/client.d.ts +1 -1
  21. package/dist/collaboration/comments/client.js +1 -1
  22. package/dist/collaboration/remoteSelection.js +3 -3
  23. package/dist/components/Edytor.svelte +2 -10
  24. package/dist/components/Edytor.svelte.d.ts +1 -3
  25. package/dist/crdt/admission.d.ts +5 -10
  26. package/dist/crdt/admission.js +5 -11
  27. package/dist/crdt/attribution/attribution.d.ts +31 -12
  28. package/dist/crdt/attribution/attribution.js +56 -18
  29. package/dist/crdt/attribution/block.d.ts +3 -3
  30. package/dist/crdt/attribution/block.js +7 -8
  31. package/dist/crdt/attribution/index.d.ts +1 -1
  32. package/dist/crdt/attribution/index.js +1 -1
  33. package/dist/crdt/data.d.ts +62 -31
  34. package/dist/crdt/data.js +211 -103
  35. package/dist/crdt/doc/delete.d.ts +1 -1
  36. package/dist/crdt/doc/delete.js +13 -30
  37. package/dist/crdt/doc/funnel.d.ts +7 -6
  38. package/dist/crdt/doc/funnel.js +39 -33
  39. package/dist/crdt/doc/gate.d.ts +3 -20
  40. package/dist/crdt/doc/gate.js +2 -41
  41. package/dist/crdt/doc/history.d.ts +25 -9
  42. package/dist/crdt/doc/history.js +152 -42
  43. package/dist/crdt/doc/layout.js +11 -22
  44. package/dist/crdt/doc/meta.js +12 -17
  45. package/dist/crdt/doc/moves.d.ts +1 -1
  46. package/dist/crdt/doc/moves.js +52 -32
  47. package/dist/crdt/doc/reads.js +2 -2
  48. package/dist/crdt/doc/seed.js +2 -2
  49. package/dist/crdt/doc/split-merge.js +12 -15
  50. package/dist/crdt/doc/steps.d.ts +25 -13
  51. package/dist/crdt/doc/steps.js +52 -122
  52. package/dist/crdt/doc/types.d.ts +21 -9
  53. package/dist/crdt/document.d.ts +21 -19
  54. package/dist/crdt/document.js +26 -23
  55. package/dist/crdt/edytor-doc.d.ts +66 -68
  56. package/dist/crdt/edytor-doc.js +21 -20
  57. package/dist/crdt/engine-api.d.ts +33 -1
  58. package/dist/crdt/engine.d.ts +0 -1
  59. package/dist/crdt/engine.js +1 -4
  60. package/dist/crdt/flow.d.ts +1 -1
  61. package/dist/crdt/flow.js +25 -27
  62. package/dist/crdt/index.d.ts +29 -28
  63. package/dist/crdt/index.js +3 -3
  64. package/dist/crdt/placement/display.d.ts +5 -30
  65. package/dist/crdt/placement/display.js +39 -144
  66. package/dist/crdt/placement/keys.d.ts +58 -0
  67. package/dist/crdt/placement/keys.js +90 -0
  68. package/dist/crdt/placement/model.d.ts +119 -118
  69. package/dist/crdt/placement/model.js +242 -142
  70. package/dist/crdt/placement/resolve.d.ts +123 -35
  71. package/dist/crdt/placement/resolve.js +187 -153
  72. package/dist/crdt/placement/slots.d.ts +134 -0
  73. package/dist/crdt/placement/slots.js +152 -0
  74. package/dist/crdt/protocol.d.ts +2 -2
  75. package/dist/crdt/protocol.js +2 -2
  76. package/dist/crdt/providers/index.d.ts +1 -1
  77. package/dist/crdt/providers/room.d.ts +26 -11
  78. package/dist/crdt/providers/room.js +77 -27
  79. package/dist/crdt/providers/websocket.d.ts +1 -1
  80. package/dist/crdt/providers/websocket.js +33 -32
  81. package/dist/crdt/purge.d.ts +17 -8
  82. package/dist/crdt/purge.js +236 -126
  83. package/dist/crdt/restore.d.ts +2 -2
  84. package/dist/crdt/restore.js +18 -34
  85. package/dist/crdt/schema.d.ts +22 -21
  86. package/dist/crdt/schema.js +29 -23
  87. package/dist/crdt/semantics.js +3 -1
  88. package/dist/crdt/storage.d.ts +1 -1
  89. package/dist/crdt/storage.js +1 -1
  90. package/dist/crdt/structs.d.ts +15 -15
  91. package/dist/crdt/structs.js +8 -22
  92. package/dist/crdt/text/index/cache.js +4 -0
  93. package/dist/crdt/text/index/claims.js +12 -0
  94. package/dist/crdt/text/index/fold.d.ts +2 -3
  95. package/dist/crdt/text/index/fold.js +194 -44
  96. package/dist/crdt/text/index/layout.js +5 -8
  97. package/dist/crdt/text/index/placement.d.ts +26 -18
  98. package/dist/crdt/text/index/placement.js +404 -138
  99. package/dist/crdt/text/index/records.d.ts +3 -3
  100. package/dist/crdt/text/index/records.js +24 -31
  101. package/dist/crdt/text/index/shared.d.ts +11 -3
  102. package/dist/crdt/text/index/shared.js +12 -3
  103. package/dist/crdt/text/index/state.d.ts +21 -17
  104. package/dist/crdt/text/index/state.js +15 -17
  105. package/dist/crdt/text/index/streams.d.ts +10 -5
  106. package/dist/crdt/text/index/streams.js +78 -27
  107. package/dist/crdt/text/items.d.ts +10 -3
  108. package/dist/crdt/text/items.js +7 -0
  109. package/dist/crdt/text/model.d.ts +77 -62
  110. package/dist/crdt/text/model.js +84 -169
  111. package/dist/crdt/text/ranges.d.ts +1 -1
  112. package/dist/crdt/text/ranges.js +3 -3
  113. package/dist/crdt/text/rows.d.ts +13 -7
  114. package/dist/crdt/text/rows.js +24 -7
  115. package/dist/crdt/text/runs.d.ts +17 -12
  116. package/dist/crdt/text/runs.js +24 -7
  117. package/dist/crdt/text/streams.d.ts +26 -13
  118. package/dist/crdt/text/streams.js +41 -14
  119. package/dist/crdt/vendor/yjs/UPSTREAM.md +568 -21
  120. package/dist/crdt/vendor/yjs/dts/global.d.ts +2 -0
  121. package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
  122. package/dist/crdt/vendor/yjs/dts/structs/AbstractStruct.d.ts +7 -0
  123. package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +194 -10
  124. package/dist/crdt/vendor/yjs/dts/utils/Doc.d.ts +6 -3
  125. package/dist/crdt/vendor/yjs/dts/utils/StructStore.d.ts +5 -18
  126. package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +15 -1
  127. package/dist/crdt/vendor/yjs/dts/utils/UpdateDecoder.d.ts +14 -6
  128. package/dist/crdt/vendor/yjs/dts/utils/UpdateEncoder.d.ts +33 -6
  129. package/dist/crdt/vendor/yjs/dts/utils/ids.d.ts +1 -65
  130. package/dist/crdt/vendor/yjs/dts/utils/marks.d.ts +6 -1
  131. package/dist/crdt/vendor/yjs/dts/ynode.d.ts +43 -7
  132. package/dist/crdt/vendor/yjs/global.d.ts +2 -0
  133. package/dist/crdt/vendor/yjs/src/index.js +1 -1
  134. package/dist/crdt/vendor/yjs/src/structs/AbstractStruct.js +10 -0
  135. package/dist/crdt/vendor/yjs/src/structs/Item.js +610 -51
  136. package/dist/crdt/vendor/yjs/src/utils/BlockSet.js +18 -9
  137. package/dist/crdt/vendor/yjs/src/utils/Doc.js +5 -3
  138. package/dist/crdt/vendor/yjs/src/utils/StructStore.js +5 -0
  139. package/dist/crdt/vendor/yjs/src/utils/Transaction.js +36 -13
  140. package/dist/crdt/vendor/yjs/src/utils/UpdateDecoder.js +88 -18
  141. package/dist/crdt/vendor/yjs/src/utils/UpdateEncoder.js +119 -32
  142. package/dist/crdt/vendor/yjs/src/utils/encoding.js +13 -1
  143. package/dist/crdt/vendor/yjs/src/utils/ids.js +7 -7
  144. package/dist/crdt/vendor/yjs/src/utils/marks.js +193 -8
  145. package/dist/crdt/vendor/yjs/src/utils/redo.js +1 -1
  146. package/dist/crdt/vendor/yjs/src/utils/transaction-helpers.js +1 -1
  147. package/dist/crdt/vendor/yjs/src/utils/updates.js +3 -3
  148. package/dist/crdt/vendor/yjs/src/ynode.js +177 -12
  149. package/dist/dnd/autoScroll.d.ts +15 -7
  150. package/dist/dnd/autoScroll.js +10 -15
  151. package/dist/dnd/dropIndicator.js +2 -5
  152. package/dist/dnd/external.d.ts +6 -0
  153. package/dist/dnd/external.js +17 -0
  154. package/dist/dnd/geometry.d.ts +2 -0
  155. package/dist/dnd/geometry.js +3 -4
  156. package/dist/dnd/placement.d.ts +1 -1
  157. package/dist/dnd/pragmatic.d.ts +3 -1
  158. package/dist/dnd/pragmatic.js +12 -2
  159. package/dist/dnd/vendor/pragmatic/UPSTREAM.md +51 -18
  160. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.d.ts +4 -0
  161. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.js +6 -0
  162. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.d.ts +0 -2
  163. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.js +4 -22
  164. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter-types.d.ts +26 -0
  165. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.d.ts +30 -0
  166. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.js +203 -0
  167. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-items.js +13 -0
  168. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-types.js +9 -0
  169. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/is-an-available-type.js +19 -0
  170. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.d.ts +4 -0
  171. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.js +6 -0
  172. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js +4 -16
  173. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/internal-types.d.ts +1 -8
  174. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-drop-target.js +5 -6
  175. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-monitor.js +2 -3
  176. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +1 -1
  177. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.js +6 -24
  178. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.d.ts +2 -0
  179. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.js +5 -0
  180. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.d.ts +3 -0
  181. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.js +12 -0
  182. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/native-types.d.ts +12 -0
  183. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window-in-safari.js +10 -0
  184. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window.js +55 -0
  185. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.d.ts +4 -0
  186. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.js +8 -0
  187. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/internal-types.d.ts +0 -4
  188. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/get-scroll-by.js +16 -72
  189. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/try-scroll.js +1 -9
  190. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/configuration.js +4 -29
  191. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-scroll-change.js +2 -3
  192. package/dist/edytor.svelte.d.ts +2 -5
  193. package/dist/edytor.svelte.js +21 -32
  194. package/dist/events/beforeInputCommands.js +2 -2
  195. package/dist/events/onBeforeInput.js +1 -1
  196. package/dist/events/onDrop.d.ts +0 -6
  197. package/dist/events/onDrop.js +10 -23
  198. package/dist/events/onInput.d.ts +0 -12
  199. package/dist/events/onInput.js +1 -67
  200. package/dist/events/onPageHide.d.ts +3 -0
  201. package/dist/events/onPageHide.js +16 -0
  202. package/dist/export/forms.d.ts +627 -0
  203. package/dist/export/forms.js +749 -0
  204. package/dist/export/index.d.ts +170 -0
  205. package/dist/export/index.js +161 -0
  206. package/dist/export/markdown.d.ts +41 -0
  207. package/dist/export/markdown.js +585 -0
  208. package/dist/export/markdownWriter.d.ts +9 -0
  209. package/dist/export/markdownWriter.js +133 -0
  210. package/dist/export/mdx.d.ts +15 -0
  211. package/dist/export/mdx.js +33 -0
  212. package/dist/index.d.ts +3 -3
  213. package/dist/index.js +1 -1
  214. package/dist/kinds.js +1 -1
  215. package/dist/plugins/anchored.svelte.d.ts +21 -25
  216. package/dist/plugins/anchored.svelte.js +23 -39
  217. package/dist/plugins/blockHandles/BlockHandleController.svelte.js +24 -32
  218. package/dist/plugins/blockHandles/dragPreview.d.ts +26 -7
  219. package/dist/plugins/blockHandles/dragPreview.js +33 -0
  220. package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +5 -0
  221. package/dist/plugins/blockMenu/BlockMenuController.svelte.js +7 -2
  222. package/dist/plugins/blockMenu/blockMenuPlugin.js +5 -50
  223. package/dist/plugins/chrome.d.ts +27 -5
  224. package/dist/plugins/chrome.js +24 -9
  225. package/dist/plugins/code/CodePlugin.svelte +12 -9
  226. package/dist/plugins/code/header.svelte.js +7 -11
  227. package/dist/plugins/code/languageMenu.svelte.d.ts +5 -2
  228. package/dist/plugins/code/languageMenu.svelte.js +13 -20
  229. package/dist/plugins/columns/ColumnsPlugin.svelte +7 -20
  230. package/dist/plugins/columns/resize.svelte.d.ts +2 -3
  231. package/dist/plugins/columns/resize.svelte.js +2 -5
  232. package/dist/plugins/comments/CommentsController.svelte.d.ts +6 -0
  233. package/dist/plugins/comments/CommentsController.svelte.js +20 -0
  234. package/dist/plugins/equation/EquationPlugin.svelte +12 -22
  235. package/dist/plugins/equation/equation.svelte.d.ts +7 -15
  236. package/dist/plugins/equation/equation.svelte.js +13 -50
  237. package/dist/plugins/equation/tex.d.ts +17 -0
  238. package/dist/plugins/equation/tex.js +42 -0
  239. package/dist/plugins/fileDrop.d.ts +38 -23
  240. package/dist/plugins/fileDrop.js +82 -76
  241. package/dist/plugins/find/FindController.svelte.d.ts +5 -0
  242. package/dist/plugins/find/FindController.svelte.js +14 -14
  243. package/dist/plugins/find/findPlugin.js +1 -15
  244. package/dist/plugins/image/ImageChrome.svelte +8 -2
  245. package/dist/plugins/image/ImagePlugin.svelte +15 -52
  246. package/dist/plugins/image/controls.svelte.js +16 -2
  247. package/dist/plugins/image/toolbar.svelte.d.ts +5 -4
  248. package/dist/plugins/image/toolbar.svelte.js +21 -31
  249. package/dist/plugins/index.d.ts +1 -1
  250. package/dist/plugins/list.svelte.d.ts +9 -0
  251. package/dist/plugins/list.svelte.js +18 -0
  252. package/dist/plugins/marquee/marqueePlugin.js +0 -4
  253. package/dist/plugins/media/AudioPlugin.svelte +1 -1
  254. package/dist/plugins/media/BookmarkPlugin.svelte +6 -97
  255. package/dist/plugins/media/EmbedPlugin.svelte +5 -90
  256. package/dist/plugins/media/EmptySlot.svelte +36 -20
  257. package/dist/plugins/media/EmptySlot.svelte.d.ts +6 -15
  258. package/dist/plugins/media/FilePlugin.svelte +1 -19
  259. package/dist/plugins/media/MediaEmpty.svelte +2 -55
  260. package/dist/plugins/media/MediaEmpty.svelte.d.ts +18 -14
  261. package/dist/plugins/media/SourceBlock.svelte +142 -52
  262. package/dist/plugins/media/SourceBlock.svelte.d.ts +10 -4
  263. package/dist/plugins/media/VideoPlugin.svelte +1 -1
  264. package/dist/plugins/media/empty.svelte.js +2 -7
  265. package/dist/plugins/media/media.d.ts +2 -63
  266. package/dist/plugins/media/media.js +1 -194
  267. package/dist/plugins/media/sources.d.ts +60 -0
  268. package/dist/plugins/media/sources.js +165 -0
  269. package/dist/plugins/media/urlPaste.svelte.d.ts +2 -1
  270. package/dist/plugins/media/urlPaste.svelte.js +12 -21
  271. package/dist/plugins/mention/MentionPlugin.svelte +8 -35
  272. package/dist/plugins/page/PagePlugin.svelte +2 -9
  273. package/dist/plugins/page/page.js +1 -1
  274. package/dist/plugins/pageLink/PageLinkPlugin.svelte +6 -13
  275. package/dist/plugins/richtext/RichTextPlugin.svelte +85 -197
  276. package/dist/plugins/richtext/body.js +1 -1
  277. package/dist/plugins/richtext/calloutIcons.svelte.d.ts +2 -2
  278. package/dist/plugins/richtext/calloutIcons.svelte.js +5 -7
  279. package/dist/plugins/richtext/richTextOperations.d.ts +1 -19
  280. package/dist/plugins/richtext/richTextOperations.js +3 -49
  281. package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +2 -0
  282. package/dist/plugins/slashMenu/SlashMenuController.svelte.js +7 -0
  283. package/dist/plugins/slashMenu/slashMenuPlugin.js +5 -14
  284. package/dist/plugins/table/TableChrome.svelte +2 -3
  285. package/dist/plugins/table/TablePlugin.svelte +20 -54
  286. package/dist/plugins/table/chrome.svelte.d.ts +5 -2
  287. package/dist/plugins/table/chrome.svelte.js +30 -54
  288. package/dist/plugins/table/table.js +3 -3
  289. package/dist/plugins/toc/TocPlugin.svelte +2 -4
  290. package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +7 -0
  291. package/dist/plugins/toolbar/ToolbarController.svelte.js +20 -13
  292. package/dist/plugins/toolbar/toolbarPlugin.js +19 -53
  293. package/dist/plugins/triggers/TriggerController.svelte.d.ts +7 -2
  294. package/dist/plugins/triggers/TriggerController.svelte.js +11 -4
  295. package/dist/plugins/triggers/place.js +1 -2
  296. package/dist/plugins/triggers/triggers.d.ts +6 -1
  297. package/dist/plugins/triggers/triggers.js +12 -13
  298. package/dist/plugins/uploads.svelte.d.ts +5 -2
  299. package/dist/plugins/uploads.svelte.js +25 -15
  300. package/dist/plugins.d.ts +26 -0
  301. package/dist/plugins.js +0 -24
  302. package/dist/selection/replaceSelection.js +2 -2
  303. package/dist/selection/selection.svelte.d.ts +4 -10
  304. package/dist/selection/selection.svelte.js +7 -11
  305. package/dist/session/bindings.js +1 -1
  306. package/dist/session/commands.d.ts +7 -11
  307. package/dist/session/commands.js +13 -19
  308. package/dist/session/inputRules.js +1 -1
  309. package/dist/session/navigation.js +1 -1
  310. package/dist/session/suggestions.svelte.d.ts +0 -11
  311. package/dist/session/suggestions.svelte.js +15 -3
  312. package/dist/session/uploads.d.ts +8 -8
  313. package/dist/surface/lines.js +1 -3
  314. package/dist/surface/observer.svelte.d.ts +17 -1
  315. package/dist/surface/observer.svelte.js +74 -19
  316. package/dist/surface/overlay.d.ts +0 -14
  317. package/dist/surface/overlay.js +0 -25
  318. package/dist/surface/projector.svelte.d.ts +15 -3
  319. package/dist/surface/projector.svelte.js +60 -9
  320. package/dist/text/text.svelte.js +3 -13
  321. package/dist/utils/sanitize.d.ts +38 -0
  322. package/dist/utils/sanitize.js +82 -0
  323. package/dist/utils.d.ts +2 -0
  324. package/dist/utils.js +5 -0
  325. package/package.json +19 -2
  326. package/dist/crdt/placement/rank.d.ts +0 -87
  327. package/dist/crdt/placement/rank.js +0 -332
  328. package/dist/crdt/placement/source.d.ts +0 -43
  329. package/dist/crdt/placement/source.js +0 -66
  330. package/dist/crdt/text/delete-index.d.ts +0 -129
  331. package/dist/crdt/text/delete-index.js +0 -365
  332. package/dist/crdt/text/deletes.d.ts +0 -76
  333. package/dist/crdt/text/deletes.js +0 -362
  334. package/dist/crdt/text/index/anchored.d.ts +0 -17
  335. package/dist/crdt/text/index/anchored.js +0 -197
  336. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/max-z-index.js +0 -3
  337. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/supports-popover.js +0 -16
  338. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-axis-allowed.js +0 -3
  339. package/dist/plugins/code/LanguageMenu.svelte +0 -25
  340. package/dist/plugins/code/LanguageMenu.svelte.d.ts +0 -9
  341. package/dist/plugins/equation/EquationEditor.svelte +0 -27
  342. package/dist/plugins/equation/EquationEditor.svelte.d.ts +0 -9
  343. package/dist/plugins/image/ImageToolbarHost.svelte +0 -37
  344. package/dist/plugins/image/ImageToolbarHost.svelte.d.ts +0 -9
  345. package/dist/plugins/richtext/CalloutIconPicker.svelte +0 -26
  346. package/dist/plugins/richtext/CalloutIconPicker.svelte.d.ts +0 -9
package/dist/crdt/flow.js CHANGED
@@ -94,7 +94,9 @@ export const flowOps = (c) => {
94
94
  const placed = specs(dest.parent);
95
95
  const p = c.insertBlocks(dest, placed);
96
96
  const at = endOf(placed.at(-1)) ?? { block: last().id, offset: lengthOf(last()) };
97
- return 'writes' in p ? { ...c.plan(p.ids, [...pre, ...p.writes]), at } : p;
97
+ // The lines are placed while the replaced blocks still show (each step reads the
98
+ // display as it stands), then those go.
99
+ return 'writes' in p ? { ...c.plan(p.ids, [...p.writes, ...pre]), at } : p;
98
100
  };
99
101
  if ('replace' in target || 'slot' in target) {
100
102
  let slot;
@@ -188,55 +190,53 @@ export const flowOps = (c) => {
188
190
  return c.REFUSED;
189
191
  const writes = [];
190
192
  /** A joined line's children lead the block it joins; `moved` follow them. */
191
- const kids = (to, l, moved = [], ranks = c.ranksFor(to, 0, (l?.children?.length ?? 0) + moved.length)) => {
193
+ const kids = (to, l, moved = []) => {
192
194
  const k = l?.children?.length ?? 0;
193
195
  if (k)
194
- writes.push({ op: 'insertBlocks', parent: to, index: 0, specs: l.children, ranks });
196
+ writes.push({ op: 'insertBlocks', parent: to, index: 0, specs: l.children });
195
197
  if (moved.length)
196
- writes.push({
197
- op: 'moveBlocks',
198
- ids: moved,
199
- parent: to,
200
- index: k,
201
- ranks: ranks.slice(k)
202
- });
198
+ writes.push({ op: 'moveBlocks', ids: moved, parent: to, index: k });
203
199
  };
204
200
  /**
205
201
  * `l` joins `B` at `at`: its content, its kind when `B` shows no text (a header
206
202
  * keeps its own, as Enter does), its children first.
207
203
  */
208
- const join = (l, at, ranks) => {
204
+ const join = (l, at) => {
209
205
  const end = c.writeContent(writes, B, at, l.content);
210
206
  const kind = l.type && fit(parent, l.type);
211
207
  if (len === 0 && !header && kind && kind === l.type)
212
208
  writes.push(...c.attr(B, TYPE, kind), ...(c.dataSteps(B, c.replaceData(l.data ?? {})) ?? []));
213
209
  if (!shut)
214
- kids(B, l, [], ranks);
210
+ kids(B, l);
215
211
  return end;
216
212
  };
217
- /** The placed lines at `at` under `home`, `ranks` theirs. */
218
- const place = (at, ranks) => {
213
+ /** The placed lines at `at` under `home` (`split`: the tail of the split they come with). */
214
+ const place = (at, split) => {
219
215
  if (placed.length)
220
- writes.push({ op: 'insertBlocks', parent: home, index: at, specs: placed, ranks });
216
+ writes.push({
217
+ op: 'insertBlocks',
218
+ parent: home,
219
+ index: at,
220
+ specs: placed,
221
+ ...(split !== undefined && { split })
222
+ });
221
223
  };
222
224
  // Under a header, the first line's children, the placed lines and the rest, in order.
223
225
  const k = joinsHead ? (first.children?.length ?? 0) : 0;
224
- const lead = inside ? c.ranksFor(B, 0, k + placed.length + 1) : [];
225
- const slot = inside ? 0 : index + 1;
226
+ const slot = inside ? k : index + 1;
226
227
  // Where the placed lines end the caret: after their last shown line (`flow.apart`).
227
228
  const end = placed.length ? endOf(placed.at(-1)) : undefined;
228
229
  // Nothing before the position and the first line stands apart: the lines go before `B`,
229
230
  // which keeps its text and takes a joining last line, or goes when empty and not needed.
230
231
  if (!joinsHead && o === 0 && !inside) {
231
- place(index, c.ranksFor(parent, index, placed.length, [], true));
232
+ place(index);
232
233
  if (joinsTail) {
233
234
  const at = join(last(), 0);
234
235
  // A closed header's taken line's nested lines follow it, the caret ending them.
235
236
  const after = shut ? specs(parent, last().children ?? []) : [];
236
237
  if (after.length) {
237
- const ranks = c.ranksFor(parent, index + 1, after.length, [], true);
238
238
  const slot = index + placed.length + 1;
239
- writes.push({ op: 'insertBlocks', parent, index: slot, specs: after, ranks });
239
+ writes.push({ op: 'insertBlocks', parent, index: slot, specs: after });
240
240
  }
241
241
  const caret = after.length ? endOf(after.at(-1)) : undefined;
242
242
  const touched = [...ids, B, ...after.map((s) => s.id)];
@@ -246,13 +246,13 @@ export const flowOps = (c) => {
246
246
  return { ...c.plan(ids, [...writes, c.remove(B, [])]), at: end };
247
247
  return { ...c.plan([...ids, B], writes), at: end ?? { block: B, offset: 0 } };
248
248
  }
249
- const head = joinsHead ? join(first, o, inside ? lead.slice(0, k) : undefined) : o;
249
+ const head = joinsHead ? join(first, o) : o;
250
250
  if (lines.length === 1 && joinsHead)
251
251
  return { ...c.plan([B], writes), at: { block: B, offset: head } };
252
252
  const moved = inside ? [] : c.childrenIds(B).filter((id) => !view.hidden?.(id));
253
253
  // Nothing after the position to keep, and the caret has a line: no split.
254
254
  if (!joinsTail && o === len && moved.length === 0 && end) {
255
- place(slot, inside ? lead.slice(k, -1) : c.pieceRanks(B, o, placed.length));
255
+ place(slot);
256
256
  return { ...c.plan([B, ...ids], writes), at: end };
257
257
  }
258
258
  // The rest of `B` stays in a shown line: the last line's block when it joins, else
@@ -266,9 +266,7 @@ export const flowOps = (c) => {
266
266
  : bare || inside
267
267
  ? { type: c.defaultChild(home), data: {} }
268
268
  : { type: c.kindToCopy(B), data: c.blockDataOf(B) };
269
- // By the offset the paste splits `B` at (SW12-crdt-4), as Enter's split.
270
- const ranks = inside ? lead.slice(k) : c.pieceRanks(B, o, placed.length + 1);
271
- const rank = ranks.pop();
269
+ // After `B` (under a header: after the first line's children); the placed lines go before it.
272
270
  const length = len - o;
273
271
  writes.push({
274
272
  op: 'splitBlock',
@@ -278,10 +276,10 @@ export const flowOps = (c) => {
278
276
  newId: T,
279
277
  tail,
280
278
  parent: home,
281
- rank
279
+ index: slot
282
280
  });
283
281
  kids(T, joinsTail ? last() : undefined, moved);
284
- place(slot, ranks);
282
+ place(slot, T);
285
283
  const at = joinsTail
286
284
  ? { block: T, offset: c.writeContent(writes, T, 0, last().content) }
287
285
  : (end ?? { block: T, offset: 0 });
@@ -62,7 +62,7 @@ export type { YDoc, YUndoManager, YTransaction } from './engine-api.js';
62
62
  export { type EdytorSync, type EdytorSyncPayload, type EdytorSyncCleanup, type IndexeddbSyncOptions, type WebsocketSync, type WebsocketSyncOptions, type ProviderStack, type PrefetchOptions, type PrefetchResult, type LastUpdatedOptions } from './providers/index.js';
63
63
  export { SyncRefusedError } from './providers/room.js';
64
64
  export { Awareness, type AwarenessDoc, type AwarenessStates, type AwarenessUpdate, type MetaClientState } from './protocols/awareness.js';
65
- export { SchemaMismatchError, UndecodableUpdateError, UnsupportedDocError } from './admission.js';
65
+ export { SchemaMismatchError, UndecodableUpdateError } from './admission.js';
66
66
  export { type DocumentAttribution, type AttributionActor, type ActorProfile, type AttributionController } from './attribution/index.js';
67
67
  export { type ActorId, type BlockAttribution } from './attribution/index.js';
68
68
  import type { EngineApi, YDoc } from './engine-api.js';
@@ -75,7 +75,7 @@ export declare const bindCrdt: (Y: EngineApi) => {
75
75
  Awareness: typeof _Awareness;
76
76
  doc: {
77
77
  SCHEMA: {
78
- readonly version: 6;
78
+ readonly version: 10;
79
79
  readonly name: "edytor-doc";
80
80
  readonly roots: {
81
81
  readonly registry: "blocks";
@@ -86,7 +86,7 @@ export declare const bindCrdt: (Y: EngineApi) => {
86
86
  readonly schema: "schema";
87
87
  };
88
88
  };
89
- SCHEMA_VERSION: 6;
89
+ SCHEMA_VERSION: 10;
90
90
  SCHEMA_NAME: "edytor-doc";
91
91
  META_KEY: "meta";
92
92
  init: (doc: import("./engine-api.js").EngineDoc, opts?: {
@@ -150,29 +150,30 @@ export declare const bindCrdt: (Y: EngineApi) => {
150
150
  blockNodeOf: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => import("./engine-api.js").EngineNode | null;
151
151
  liveNodeOf: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => import("./engine-api.js").EngineNode | null;
152
152
  isLive: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => boolean;
153
- candidatesOf: (node: import("./engine-api.js").EngineNode) => import("./placement/model.js").PlacementCand[];
154
153
  view: (doc: import("./engine-api.js").EngineDoc) => import("./placement/model.js").ModelView;
155
- resolvePlacements: (blocks: Map<import("./index.js").BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: import("./index.js").BlockId) => import("./text/model.js").Owner) => Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>;
156
154
  childrenIndex: (placements: Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<import("./index.js").BlockId | null, import("./placement/model.js").ChildSlot[]>;
157
155
  positionInView: (v: import("./placement/model.js").ModelView, id: import("./index.js").BlockId) => import("./index.js").Destination | null;
158
156
  buildInline: (atom: import("./index.js").InlineSpec) => import("./engine-api.js").EngineNode;
159
157
  isSelfOrDescendant: (placements: Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: import("./index.js").BlockId, maybeAncestor: import("./index.js").BlockId) => boolean;
160
- ranksAt: (siblings: readonly {
161
- rank: string;
162
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
163
- writePlacement: (doc: import("./engine-api.js").EngineDoc, node: import("./engine-api.js").EngineNode, p: import("./index.js").BlockId | null, r: string) => void;
158
+ placeBlocks: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, parent: import("./index.js").BlockId | null, left: import("./index.js").BlockId | null, right: import("./index.js").BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
159
+ moveBlocksTo: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, ids: readonly import("./index.js").BlockId[], parent: import("./index.js").BlockId | null, index: number, side?: number, part?: number, at?: import("./index.js").BlockId | null) => void;
160
+ insertSpecsAt: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, parent: import("./index.js").BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
164
161
  withdrawOnUndo: (doc: import("./engine-api.js").EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
165
162
  inserts: {
166
163
  has(client: number, clock: number): boolean;
167
164
  };
168
165
  }) => boolean;
169
- materializeSpec: (doc: import("./engine-api.js").EngineDoc, sp: import("./index.js").BlockSpec, parent: import("./index.js").BlockId | null, rank: string) => void;
170
166
  collides: (doc: import("./engine-api.js").EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
171
- writeSplit: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId, offset: number, newId: import("./index.js").BlockId, tail: import("./placement/model.js").SplitTail, place: import("./placement/model.js").PlacementValue) => void;
167
+ writeSplit: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId, offset: number, newId: import("./index.js").BlockId, tail: import("./placement/model.js").SplitTail, parent: import("./index.js").BlockId | null, index: number) => import("./placement/slots.js").Unit;
172
168
  ownText: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => {
173
169
  from: unknown;
174
170
  to: number;
175
171
  };
172
+ recordsOf: (doc: import("./engine-api.js").EngineDoc, node: import("./engine-api.js").EngineNode, v?: import("./placement/model.js").ModelView) => {
173
+ item: import("./placement/slots.js").SeqItem;
174
+ stamp: import("./placement/slots.js").Stamp;
175
+ wins: boolean;
176
+ }[];
176
177
  insertBlocks: (doc: import("./engine-api.js").EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
177
178
  insertBlock: (doc: import("./engine-api.js").EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
178
179
  restoreBlocks: (doc: import("./engine-api.js").EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -204,8 +205,8 @@ export declare const bindCrdt: (Y: EngineApi) => {
204
205
  at: number;
205
206
  node: import("./engine-api.js").EngineNode;
206
207
  } | null;
207
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
208
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
208
+ splitAt: (doc: import("./engine-api.js").EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
209
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
209
210
  ownText: (doc: import("./engine-api.js").EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
210
211
  from: unknown;
211
212
  to: number;
@@ -225,7 +226,7 @@ export declare const bindCrdt: (Y: EngineApi) => {
225
226
  keep?: boolean;
226
227
  after?: readonly import("./index.js").BlockSpec[];
227
228
  } | undefined) => import("./edytor-doc.js").OpResult;
228
- placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => import("./edytor-doc.js").OpResult;
229
+ placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => import("./edytor-doc.js").OpResult;
229
230
  wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => import("./edytor-doc.js").OpResult;
230
231
  splitBlock: (id: string, offset: number, newId: string, tail?: import("./placement/model.js").SplitTail | undefined) => import("./edytor-doc.js").OpResult;
231
232
  mergeBlocks: (fromId: string, intoId: string) => import("./edytor-doc.js").OpResult;
@@ -348,11 +349,10 @@ export declare const bindCrdt: (Y: EngineApi) => {
348
349
  onChange: (cb: (change: import("./edytor-doc.js").DocChange) => void) => (() => void);
349
350
  };
350
351
  newDoc: (opts?: ConstructorParameters<EngineApi["Doc"]>[0]) => YDoc;
351
- keepCopies: (doc: import("./engine-api.js").EngineDoc) => void;
352
352
  purge: (doc: import("./engine-api.js").EngineDoc, facade: {
353
353
  model: import("./placement/model.js").PlacementModel;
354
354
  text: import("./text/model.js").TextEngine;
355
- }, horizon: import("./purge.js").Horizon) => import("./purge.js").PurgeReport;
355
+ }, horizon: import("./purge.js").Horizon | null) => import("./purge.js").PurgeReport;
356
356
  horizonOf: (doc: import("./engine-api.js").EngineDoc) => import("./purge.js").Horizon | null;
357
357
  restoreTo: <Plan>(doc: import("./engine-api.js").EngineDoc, facade: import("./restore.js").RestoreFacade<Plan>, json: import("./index.js").JSONDoc) => import("./restore.js").RestoreReport;
358
358
  model: {
@@ -361,29 +361,30 @@ export declare const bindCrdt: (Y: EngineApi) => {
361
361
  blockNodeOf: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => import("./engine-api.js").EngineNode | null;
362
362
  liveNodeOf: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => import("./engine-api.js").EngineNode | null;
363
363
  isLive: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => boolean;
364
- candidatesOf: (node: import("./engine-api.js").EngineNode) => import("./placement/model.js").PlacementCand[];
365
364
  view: (doc: import("./engine-api.js").EngineDoc) => import("./placement/model.js").ModelView;
366
- resolvePlacements: (blocks: Map<import("./index.js").BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: import("./index.js").BlockId) => import("./text/model.js").Owner) => Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>;
367
365
  childrenIndex: (placements: Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<import("./index.js").BlockId | null, import("./placement/model.js").ChildSlot[]>;
368
366
  positionInView: (v: import("./placement/model.js").ModelView, id: import("./index.js").BlockId) => import("./index.js").Destination | null;
369
367
  buildInline: (atom: import("./index.js").InlineSpec) => import("./engine-api.js").EngineNode;
370
368
  isSelfOrDescendant: (placements: Map<import("./index.js").BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: import("./index.js").BlockId, maybeAncestor: import("./index.js").BlockId) => boolean;
371
- ranksAt: (siblings: readonly {
372
- rank: string;
373
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
374
- writePlacement: (doc: import("./engine-api.js").EngineDoc, node: import("./engine-api.js").EngineNode, p: import("./index.js").BlockId | null, r: string) => void;
369
+ placeBlocks: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, parent: import("./index.js").BlockId | null, left: import("./index.js").BlockId | null, right: import("./index.js").BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
370
+ moveBlocksTo: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, ids: readonly import("./index.js").BlockId[], parent: import("./index.js").BlockId | null, index: number, side?: number, part?: number, at?: import("./index.js").BlockId | null) => void;
371
+ insertSpecsAt: (doc: import("./engine-api.js").EngineDoc, v: import("./placement/model.js").ModelView, parent: import("./index.js").BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
375
372
  withdrawOnUndo: (doc: import("./engine-api.js").EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
376
373
  inserts: {
377
374
  has(client: number, clock: number): boolean;
378
375
  };
379
376
  }) => boolean;
380
- materializeSpec: (doc: import("./engine-api.js").EngineDoc, sp: import("./index.js").BlockSpec, parent: import("./index.js").BlockId | null, rank: string) => void;
381
377
  collides: (doc: import("./engine-api.js").EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
382
- writeSplit: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId, offset: number, newId: import("./index.js").BlockId, tail: import("./placement/model.js").SplitTail, place: import("./placement/model.js").PlacementValue) => void;
378
+ writeSplit: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId, offset: number, newId: import("./index.js").BlockId, tail: import("./placement/model.js").SplitTail, parent: import("./index.js").BlockId | null, index: number) => import("./placement/slots.js").Unit;
383
379
  ownText: (doc: import("./engine-api.js").EngineDoc, id: import("./index.js").BlockId) => {
384
380
  from: unknown;
385
381
  to: number;
386
382
  };
383
+ recordsOf: (doc: import("./engine-api.js").EngineDoc, node: import("./engine-api.js").EngineNode, v?: import("./placement/model.js").ModelView) => {
384
+ item: import("./placement/slots.js").SeqItem;
385
+ stamp: import("./placement/slots.js").Stamp;
386
+ wins: boolean;
387
+ }[];
387
388
  insertBlocks: (doc: import("./engine-api.js").EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
388
389
  insertBlock: (doc: import("./engine-api.js").EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
389
390
  restoreBlocks: (doc: import("./engine-api.js").EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -415,8 +416,8 @@ export declare const bindCrdt: (Y: EngineApi) => {
415
416
  at: number;
416
417
  node: import("./engine-api.js").EngineNode;
417
418
  } | null;
418
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
419
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
419
+ splitAt: (doc: import("./engine-api.js").EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
420
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
420
421
  ownText: (doc: import("./engine-api.js").EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
421
422
  from: unknown;
422
423
  to: number;
@@ -583,7 +584,7 @@ export declare const bindCrdt: (Y: EngineApi) => {
583
584
  off<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: import("./protocol.js").WebsocketProviderEvents[NAME]): void;
584
585
  };
585
586
  };
586
- watchComments: (server: string, roomName: string, listener: (message: import("./protocol.js").CommentMessage) => void) => (() => void);
587
+ watchComments: (server: string | null, roomName: string, listener: (message: import("./protocol.js").CommentMessage) => void) => (() => void);
587
588
  storeState: (idbPersistence: {
588
589
  db: IDBDatabase | null;
589
590
  name: string;
@@ -632,4 +633,4 @@ export declare const bindCrdt: (Y: EngineApi) => {
632
633
  };
633
634
  export type Crdt = ReturnType<typeof bindCrdt>;
634
635
  export type { EngineApi, EngineDoc, EngineNode, EngineTransaction, EngineItemRef, YNode, YItem } from './engine-api.js';
635
- export { EdytorDocDisposedError, DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
636
+ export { DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
@@ -101,7 +101,7 @@ export { Awareness } from './protocols/awareness.js';
101
101
  // every content-entry path crosses). The gates themselves
102
102
  // (`assertAdmission`, `inspectAdmission`, …) are diagnostics vocabulary:
103
103
  // `edytor/protocol`.
104
- export { SchemaMismatchError, UndecodableUpdateError, UnsupportedDocError } from './admission.js';
104
+ export { SchemaMismatchError, UndecodableUpdateError } from './admission.js';
105
105
  // ── 5 · Attribution (read surface) ─────────────────────────────────────
106
106
  //
107
107
  // `document.attribution` hands back a `DocumentAttribution` — compact
@@ -109,7 +109,7 @@ export { SchemaMismatchError, UndecodableUpdateError, UnsupportedDocError } from
109
109
  // the public read vocabulary; ordinary editing writes no per-edit
110
110
  // attribution.
111
111
  export {} from './attribution/index.js';
112
- // Compact per-BLOCK attribution read vocabulary (`b/<blockId>`
112
+ // Compact per-BLOCK attribution read vocabulary (`blockattr` `<blockId>`
113
113
  // records + the block-node `l` attr — see `attribution/block.ts`).
114
114
  // `document.attribution.block(id)` / `document.blockAttribution(id)`
115
115
  // are the read entry points.
@@ -145,4 +145,4 @@ export const bindCrdt = (Y) => {
145
145
  // The facade's disposal error and the history's default depth belong
146
146
  // to the document; the frame contract, message types and codecs are
147
147
  // `edytor/protocol`.
148
- export { EdytorDocDisposedError, DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
148
+ export { DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
@@ -1,38 +1,13 @@
1
1
  /**
2
2
  * Where a block displays: its display slot (read-time promotion out of a
3
3
  * deleted, childless or passing parent, the line and layout rules), the
4
- * children index and document order built from it, the text order of a
5
- * text's pieces (`textRanker`), liveness, and the inverse of the claim
6
- * owners. Pure over replicated state and the ownership the caller passes.
4
+ * children index and document order built from it, liveness, and the
5
+ * inverse of the claim owners. Pure over replicated state and the
6
+ * ownership the caller passes. The order of a text's pieces is the slots'
7
+ * (`order.split.text`: a split-born slot's key, fork patch YP22).
7
8
  */
8
9
  import { type Owner } from '../text/model.js';
9
- import type { BlockId, BlockRec, ChildSlot, DisplayOwnership, DocOrder, ModelView, ResolvedPlacement } from './model.js';
10
- /**
11
- * Split pieces in text order (`order.split.text`): the blocks whose streams lie in one
12
- * backing text and that still stand where they were made (their winning
13
- * placement is their first candidate, `1.<client>`: no move, outdent or
14
- * lift since) under one parent show in their streams' order in that text —
15
- * the order of the boundaries that delimit them, the same on every
16
- * replica — at the ranks they hold between them: the i-th of them in the
17
- * text takes the i-th smallest of their ranks. Ranks written at a split
18
- * (`sourceRank`) are a guess made on one replica's text; the boundaries are
19
- * the replicated fact, so two peers splitting one block at once keep the
20
- * text's order whatever each saw (an unseen edit after one's own split
21
- * point included). A block moved since stands where it was moved.
22
- *
23
- * `inText(home)`: the blocks of `home`'s text, in text order (segment 0's
24
- * first). Memoized per (text, parent) until `forget(home)`.
25
- */
26
- export declare const textRanker: (blocks: ReadonlyMap<BlockId, BlockRec>, placements: ReadonlyMap<BlockId, ResolvedPlacement>, homeOf: (b: BlockId) => BlockId | undefined, inText: (home: BlockId) => readonly BlockId[]) => {
27
- rank: (id: BlockId, parent: BlockId | null, rank: string) => string;
28
- /**
29
- * Decide `home`'s text again (its segments or a member's placement
30
- * changed); the blocks whose text-order rank changed.
31
- */
32
- regroup: (home: BlockId) => Set<BlockId>;
33
- /** Drop what was decided for `home`'s text (every one, without it). */
34
- forget: (home?: BlockId) => void;
35
- };
10
+ import type { BlockId, ChildSlot, DisplayOwnership, DocOrder, ModelView, ResolvedPlacement } from './model.js';
36
11
  /**
37
12
  * THE liveness answer: `id` carries no live delete mark, owns
38
13
  * itself (`own.hidden` covers both: a delete-marked or unknown block owns
@@ -1,144 +1,13 @@
1
1
  /**
2
2
  * Where a block displays: its display slot (read-time promotion out of a
3
3
  * deleted, childless or passing parent, the line and layout rules), the
4
- * children index and document order built from it, the text order of a
5
- * text's pieces (`textRanker`), liveness, and the inverse of the claim
6
- * owners. Pure over replicated state and the ownership the caller passes.
4
+ * children index and document order built from it, liveness, and the
5
+ * inverse of the claim owners. Pure over replicated state and the
6
+ * ownership the caller passes. The order of a text's pieces is the slots'
7
+ * (`order.split.text`: a split-born slot's key, fork patch YP22).
7
8
  */
8
9
  import { DEAD } from '../text/model.js';
9
- import { promotedRank } from './source.js';
10
- /**
11
- * Split pieces in text order (`order.split.text`): the blocks whose streams lie in one
12
- * backing text and that still stand where they were made (their winning
13
- * placement is their first candidate, `1.<client>`: no move, outdent or
14
- * lift since) under one parent show in their streams' order in that text —
15
- * the order of the boundaries that delimit them, the same on every
16
- * replica — at the ranks they hold between them: the i-th of them in the
17
- * text takes the i-th smallest of their ranks. Ranks written at a split
18
- * (`sourceRank`) are a guess made on one replica's text; the boundaries are
19
- * the replicated fact, so two peers splitting one block at once keep the
20
- * text's order whatever each saw (an unseen edit after one's own split
21
- * point included). A block moved since stands where it was moved.
22
- *
23
- * `inText(home)`: the blocks of `home`'s text, in text order (segment 0's
24
- * first). Memoized per (text, parent) until `forget(home)`.
25
- */
26
- export const textRanker = (blocks, placements, homeOf, inText) => {
27
- const memo = new Map();
28
- const keysOf = new Map();
29
- /** `b` stands where it was made: its placement is its first candidate's. */
30
- const unmoved = (b) => {
31
- const c = blocks.get(b)?.cands[0];
32
- const pl = placements.get(b);
33
- if (c === undefined || pl === undefined || c.seq !== 1 || c.r !== pl.rank)
34
- return false;
35
- return pl.parent === (c.p !== null && !blocks.has(c.p) ? null : c.p);
36
- };
37
- const group = (home, parent) => {
38
- const members = [];
39
- for (const b of inText(home))
40
- if (placements.get(b)?.parent === parent && unmoved(b))
41
- members.push(b);
42
- const out = new Map();
43
- if (members.length < 2)
44
- return out;
45
- const rankOf = (b) => placements.get(b).rank;
46
- // One client's blocks keep its own order (it ranked them knowing each
47
- // other); the text decides between different clients' (concurrent
48
- // splits). Each client's members, sorted by rank, fill that client's
49
- // places in the text order.
50
- const byClient = new Map();
51
- for (const b of members) {
52
- const c = blocks.get(b).cands[0].client;
53
- const list = byClient.get(c);
54
- if (list === undefined)
55
- byClient.set(c, [b]);
56
- else
57
- list.push(b);
58
- }
59
- if (byClient.size < 2)
60
- return out;
61
- for (const list of byClient.values())
62
- list.sort((x, y) => bySlot({ id: x, rank: rankOf(x) }, { id: y, rank: rankOf(y) }));
63
- const next = new Map();
64
- const order = members.map((b) => {
65
- const c = blocks.get(b).cands[0].client;
66
- const i = next.get(c) ?? 0;
67
- next.set(c, i + 1);
68
- return byClient.get(c)[i];
69
- });
70
- const ranks = members.map(rankOf).sort();
71
- order.forEach((b, i) => out.set(b, ranks[i]));
72
- return out;
73
- };
74
- return {
75
- rank: (id, parent, rank) => {
76
- const home = homeOf(id);
77
- // A text no other block shares (most blocks' own): nothing to order.
78
- if (home === undefined || inText(home).length < 2)
79
- return rank;
80
- const key = `${home}\u0000${parent}`;
81
- let ranks = memo.get(key);
82
- if (ranks === undefined) {
83
- memo.set(key, (ranks = group(home, parent)));
84
- let keys = keysOf.get(home);
85
- if (keys === undefined)
86
- keysOf.set(home, (keys = new Set()));
87
- keys.add(key);
88
- }
89
- return ranks.get(id) ?? rank;
90
- },
91
- /**
92
- * Decide `home`'s text again (its segments or a member's placement
93
- * changed); the blocks whose text-order rank changed.
94
- */
95
- regroup: (home) => {
96
- const before = new Map();
97
- for (const key of keysOf.get(home) ?? [])
98
- for (const [b, r] of memo.get(key) ?? [])
99
- before.set(b, r);
100
- for (const key of keysOf.get(home) ?? [])
101
- memo.delete(key);
102
- const keys = new Set();
103
- keysOf.set(home, keys);
104
- const changed = new Set();
105
- const parents = new Set();
106
- const row = inText(home);
107
- if (row.length >= 2)
108
- for (const b of row) {
109
- const pl = placements.get(b);
110
- if (pl !== undefined)
111
- parents.add(pl.parent);
112
- }
113
- for (const parent of parents) {
114
- const key = `${home}\u0000${parent}`;
115
- const ranks = group(home, parent);
116
- memo.set(key, ranks);
117
- keys.add(key);
118
- for (const [b, r] of ranks)
119
- if (before.get(b) !== r)
120
- changed.add(b);
121
- }
122
- for (const [b, r] of before) {
123
- const now = memo.get(`${home}\u0000${placements.get(b)?.parent}`)?.get(b);
124
- if (now !== r)
125
- changed.add(b);
126
- }
127
- return changed;
128
- },
129
- /** Drop what was decided for `home`'s text (every one, without it). */
130
- forget: (home) => {
131
- if (home === undefined) {
132
- memo.clear();
133
- keysOf.clear();
134
- return;
135
- }
136
- for (const key of keysOf.get(home) ?? [])
137
- memo.delete(key);
138
- keysOf.delete(home);
139
- }
140
- };
141
- };
10
+ import { claimedRank, promotedRank } from './keys.js';
142
11
  /**
143
12
  * THE liveness answer: `id` carries no live delete mark, owns
144
13
  * itself (`own.hidden` covers both: a delete-marked or unknown block owns
@@ -201,15 +70,13 @@ export const isLiveIn = (v, id) => {
201
70
  */
202
71
  export const displaySlotOf = (own, placements, pl, id) => {
203
72
  let { parent, rank } = pl;
204
- // A piece of a text shown under its own placement's parent takes its text-order rank;
205
- // a table's cell its column's (`table.columns`).
73
+ // A table's cell shown under its own placement's parent takes its column's rank
74
+ // (`table.columns`). Shown under its parent's claim owner (the parent merged away),
75
+ // it follows the owner's own children, by the claims down to its parent (`claimedRank`).
206
76
  const direct = (owner) => {
207
77
  if (owner !== pl.parent)
208
- return rank;
209
- const ruled = owner === null ? undefined : own.slotRank?.(owner, id, rank);
210
- if (ruled !== undefined)
211
- return ruled;
212
- return own.textRank === undefined ? rank : own.textRank(id, owner, rank);
78
+ return claimedRank(claimPath(own, owner, pl.parent), rank);
79
+ return (owner === null ? undefined : own.slotRank?.(owner, id, rank)) ?? rank;
213
80
  };
214
81
  let reset = null;
215
82
  /** The first parent it is promoted out of (a deleted or childless one). */
@@ -240,8 +107,20 @@ export const displaySlotOf = (own, placements, pl, id) => {
240
107
  // Promoted into a container: it shows as one of its items.
241
108
  if (shows && reset === null && promoted !== null && own.container?.(owner) === true)
242
109
  reset = promoted;
110
+ // Under its parent's claim owner — promoted there or not — it is keyed in the
111
+ // owner's claimed space: the keys are local to one index, so a key of
112
+ // `parent`'s sequence compares with the owner's own children's on no replica
113
+ // but this one.
243
114
  if (shows)
244
- return { parent: owner, rank: hops === 0 ? direct(owner) : rank, reset };
115
+ return {
116
+ parent: owner,
117
+ rank: owner !== parent
118
+ ? claimedRank(claimPath(own, owner, parent), rank)
119
+ : hops === 0
120
+ ? direct(owner)
121
+ : rank,
122
+ reset
123
+ };
245
124
  promoted ??= out;
246
125
  const up = placements.get(out);
247
126
  if (up === undefined || hops > placements.size)
@@ -253,6 +132,22 @@ export const displaySlotOf = (own, placements, pl, id) => {
253
132
  }
254
133
  return { parent: null, rank: pl.parent === null ? direct(null) : rank, reset };
255
134
  };
135
+ /**
136
+ * The claims from `owner` down to `parent` (a block it displays through
137
+ * merge claims), as each holder's claim index: the order the merged blocks'
138
+ * children take after the owner's own children.
139
+ */
140
+ const claimPath = (own, owner, parent) => {
141
+ const path = [];
142
+ for (let cur = parent, hops = 0; cur !== null && cur !== owner && hops < 256; hops++) {
143
+ const holder = own.top(cur);
144
+ if (holder === undefined)
145
+ break;
146
+ path.unshift(Math.max(0, own.claimIndex(holder, cur)));
147
+ cur = holder;
148
+ }
149
+ return path;
150
+ };
256
151
  /**
257
152
  * The slot of `b` when it is a line — it displays (or, deleted, would
258
153
  * display) directly under a `lines` island ({@link DisplayOwnership.lined}) — else