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
@@ -8,7 +8,7 @@ import { sanitizeSpec } from '../../utils/json.js';
8
8
  import { ref } from './plan.js';
9
9
  /** The layout ops of one facade, prepared. */
10
10
  export const layoutOps = (c) => {
11
- const { roles, view, blockTypeOf, childrenIds, positionOf, ancestorsOf, isIsland, isLines, insideIsland, isLayout, isLayoutItem, holdsLayout, insideItem, live, canPlace, isContainer, fits, fitsIn, REFUSED, plan, ranksFor, moveTo, landing, emptied } = c;
11
+ const { roles, view, blockTypeOf, childrenIds, positionOf, ancestorsOf, isIsland, isLines, insideIsland, isLayout, isLayoutItem, holdsLayout, insideItem, live, canPlace, isContainer, fits, fitsIn, REFUSED, plan, moveTo, landing, emptied } = c;
12
12
  /** The layout kind a new layout takes: `kind` when it is one, else the only one the roles declare. */
13
13
  const layoutKind = (kind) => {
14
14
  if (kind !== undefined)
@@ -62,8 +62,8 @@ export const layoutOps = (c) => {
62
62
  * an item, a layout or a block holding one, a block that does not
63
63
  * fit an item, a block or a layout inside an island, and, wrapping,
64
64
  * when there is no layout kind. The sources are cleaned in the same
65
- * plan (`emptying`, `dissolving`); plain ranks (a move). `ids`: the
66
- * moved blocks.
65
+ * plan (`emptying`, `dissolving`); a plain move. `ids`: the moved
66
+ * blocks.
67
67
  */
68
68
  const placeBeside = (ids, target, side, kind) => {
69
69
  const moved = ids.map(ref);
@@ -98,25 +98,20 @@ export const layoutOps = (c) => {
98
98
  if (layout !== null && (isIsland(layout) || insideIsland(layout, v)))
99
99
  return REFUSED;
100
100
  const fresh = spec(item);
101
- const into = (parent) => moveTo(moved, parent, 0, ranksFor(parent, 0, moved.length));
101
+ const into = (parent) => moveTo(moved, parent, 0);
102
102
  let writes;
103
103
  let kept;
104
104
  if (layout !== null) {
105
- const ranks = ranksFor(layout, index, 1);
106
- writes = [
107
- { op: 'insertBlocks', parent: layout, index, specs: [fresh], ranks },
108
- ...into(fresh.id)
109
- ];
105
+ writes = [{ op: 'insertBlocks', parent: layout, index, specs: [fresh] }, ...into(fresh.id)];
110
106
  kept = new Set([fresh.id, ...landing(layout)]);
111
107
  }
112
108
  else {
113
109
  const pos = positionOf(at);
114
110
  const host = spec(item);
115
111
  const wrapper = { ...spec(wrap), children: right ? [host, fresh] : [fresh, host] };
116
- const ranks = ranksFor(pos.parent, pos.index, 1);
117
112
  writes = [
118
- { op: 'insertBlocks', parent: pos.parent, index: pos.index, specs: [wrapper], ranks },
119
- ...moveTo([at], host.id, 0, ranksFor(host.id, 0, 1)),
113
+ { op: 'insertBlocks', parent: pos.parent, index: pos.index, specs: [wrapper] },
114
+ ...moveTo([at], host.id, 0),
120
115
  ...into(fresh.id)
121
116
  ];
122
117
  kept = new Set([wrapper.id, host.id, fresh.id, ...landing(pos.parent)]);
@@ -134,8 +129,8 @@ export const layoutOps = (c) => {
134
129
  * fewer items than blocks, blocks of different parents, an item, a
135
130
  * layout or a block holding one, where the layout does not fit
136
131
  * (`fits`: in a list, a code block) or lands inside an item or an
137
- * island, and for a block that does not fit an item. Plain ranks (a
138
- * move). `ids`: the new layout.
132
+ * island, and for a block that does not fit an item. A plain move.
133
+ * `ids`: the new layout.
139
134
  */
140
135
  const wrapInLayout = (ids, kind, columns = ids.length) => {
141
136
  const blocks = ids.map(ref);
@@ -165,14 +160,8 @@ export const layoutOps = (c) => {
165
160
  const wrapper = { ...spec(wrap), children: items };
166
161
  const at = positionOf(ordered[0]).index;
167
162
  const writes = [
168
- {
169
- op: 'insertBlocks',
170
- parent,
171
- index: at,
172
- specs: [wrapper],
173
- ranks: ranksFor(parent, at, 1)
174
- },
175
- ...ordered.flatMap((id, i) => moveTo([id], items[i].id, 0, ranksFor(items[i].id, 0, 1)))
163
+ { op: 'insertBlocks', parent, index: at, specs: [wrapper] },
164
+ ...ordered.flatMap((id, i) => moveTo([id], items[i].id, 0))
176
165
  ];
177
166
  const kept = new Set([
178
167
  wrapper.id,
@@ -7,11 +7,11 @@ import { randOf } from '../rand.js';
7
7
  import { TYPE } from '../schema.js';
8
8
  import { asBlockSpec, asContentItem, sanitizeSpec, sanitizeWireJson } from '../../utils/json.js';
9
9
  import { patchWrites, leafKey, isObject } from '../data.js';
10
- import { collides, promotedRank, ranksAt } from '../placement/model.js';
10
+ import { collides } from '../placement/model.js';
11
11
  import { ref, refused, sanitizeItem } from './plan.js';
12
12
  /** The meta ops of one facade, prepared. */
13
13
  export const metaOps = (c) => {
14
- const { doc, roles, roleOf, dataNode, view, blockTypeOf, blockDataOf, childrenIds, positionOf, is, isVoid, displayLength, live, contentTarget, REFUSED, plan, moveTo, attr, leavingIsland, settle, remove, atomOf, writeContent } = c;
14
+ const { doc, roles, roleOf, dataNode, view, blockTypeOf, blockDataOf, childrenIds, positionOf, is, isVoid, displayLength, live, contentTarget, REFUSED, plan, attr, leavingIsland, settle, remove, atomOf, writeContent } = c;
15
15
  /**
16
16
  * The data step of `patches` (sanitized) on a block, one of its atoms or
17
17
  * the document (`crdt/data.ts`): none when it changes nothing, `null`
@@ -23,12 +23,12 @@ export const metaOps = (c) => {
23
23
  // A block kind's atomic paths are written as one leaf each (`data.atomic`).
24
24
  const type = inlineId === undefined && id !== undefined ? blockTypeOf(id) : undefined;
25
25
  const atomic = (type === undefined ? undefined : roleOf(type)?.atomic) ?? [];
26
- const leaves = node
26
+ const writes = node
27
27
  ? patchWrites(node, patches, doc.clientID, randOf(doc), atomic.map((p) => leafKey(typeof p === 'string' ? [p] : p)))
28
28
  : [];
29
- if (leaves === null)
29
+ if (writes === null)
30
30
  return null; // a patch fits no value there
31
- if (leaves.length === 0)
31
+ if (writes.length === 0)
32
32
  return [];
33
33
  const offset = inlineId === undefined ? undefined : atomOf(id, inlineId)?.at;
34
34
  return [
@@ -37,7 +37,7 @@ export const metaOps = (c) => {
37
37
  ...(id !== undefined && { id }),
38
38
  ...(inlineId !== undefined && { inlineId, offset }),
39
39
  ops: patches,
40
- leaves
40
+ writes
41
41
  }
42
42
  ];
43
43
  };
@@ -65,10 +65,8 @@ export const metaOps = (c) => {
65
65
  /**
66
66
  * The target role decides: nothing renders a void's children,
67
67
  * so a block retyped to a void kind hands them to the slot right after
68
- * it, as the kind they show there (`settledKind`). Each moves to the
69
- * rank the read-time
70
- * shedding gives it (`promotedRank`), so a child a peer adds
71
- * meanwhile keeps its place in the void's order among them. An island
68
+ * it, as the kind they show there (`settledKind`), in their order (where
69
+ * the read-time shedding shows a child a peer adds meanwhile). An island
72
70
  * declared `lines` retyped to an ordinary kind keeps its lines, each
73
71
  * retyped to the new kind's default child (the document's where that
74
72
  * renders no content): no line kind outside its island. Any other
@@ -95,12 +93,11 @@ export const metaOps = (c) => {
95
93
  }
96
94
  if (!roles.childless(type) || moved.length === 0 || pos === null)
97
95
  return steps;
98
- const slotRank = kids.get(pos.parent)[pos.index].rank;
99
- const ids = moved.map((k) => k.id);
96
+ // The children keep their home slots: the read shows them in the void's
97
+ // slot (`conc.void-children`), settled for its parent.
100
98
  return [
101
99
  ...steps,
102
- ...moveTo(ids, pos.parent, pos.index + 1, moved.map((k) => promotedRank(slotRank, k.rank))),
103
- ...settle(id, ids, pos.parent)
100
+ ...settle(id, moved.map((k) => k.id), pos.parent)
104
101
  ];
105
102
  };
106
103
  /** Set the block type (attr write — the block keeps its identity; see `retypeSteps`). */
@@ -187,10 +184,8 @@ export const metaOps = (c) => {
187
184
  if (children !== undefined) {
188
185
  for (const kid of childrenIds(id))
189
186
  writes.push(remove(kid));
190
- // Every current child is deleted, so the new ones rank from an empty list.
191
- const ranks = ranksAt([], 0, children.length, doc.clientID, randOf(doc));
192
187
  if (children.length > 0)
193
- writes.push({ op: 'insertBlocks', parent: id, index: 0, specs: children, ranks });
188
+ writes.push({ op: 'insertBlocks', parent: id, index: 0, specs: children });
194
189
  }
195
190
  return plan([id], writes);
196
191
  };
@@ -1,7 +1,7 @@
1
1
  import { type JSONBlock } from '../../utils/json.js';
2
2
  import { type BlockId, type BlockSpec, type Destination } from '../placement/model.js';
3
3
  import type { Prepared } from './types.js';
4
- import type { OpsContext } from './steps.js';
4
+ import { type OpsContext } from './steps.js';
5
5
  /** The moves ops of one facade, prepared. */
6
6
  export declare const moveOps: (c: OpsContext) => {
7
7
  insertBlocks: (dest: Destination, specs: readonly (BlockSpec | JSONBlock)[]) => Prepared;
@@ -7,9 +7,10 @@ import { id as newId } from '../../utils.js';
7
7
  import { asBlockSpec, sanitizeSpec } from '../../utils/json.js';
8
8
  import { collides } from '../placement/model.js';
9
9
  import { ref } from './plan.js';
10
+ import { PART } from './steps.js';
10
11
  /** The moves ops of one facade, prepared. */
11
12
  export const moveOps = (c) => {
12
- const { doc, blockTypeOf, blockDataOf, childrenIds, positionOf, isVoid, isIsland, isLine, contentItems, live, canPlace, isContainer, fits, kindToCopy, REFUSED, HEAD, KEPT, WITH, SELF, AFTER, plan, ranksFor, moveTo, move, exitRanks, leaving, settledKind, settle, landing, emptying, emptied } = c;
13
+ const { doc, blockTypeOf, blockDataOf, childrenIds, positionOf, isVoid, isIsland, isLine, contentItems, live, canPlace, isContainer, fits, kindToCopy, REFUSED, plan, moveTo, move, leaving, settledKind, settle, landing, emptying, emptied } = c;
13
14
  /**
14
15
  * Insert blocks (specs may carry children/content/data; the batch is
15
16
  * all-or-nothing). A spec is a `BlockSpec` or the `JSONBlock` that
@@ -29,8 +30,7 @@ export const moveOps = (c) => {
29
30
  return plan([], []);
30
31
  if ((parent !== null && !live(parent)) || collides(doc, clean))
31
32
  return REFUSED;
32
- const ranks = ranksFor(parent, dest.index, clean.length, [], true);
33
- return plan(clean.map((s) => s.id), [{ op: 'insertBlocks', parent, index: dest.index, specs: clean, ranks }]);
33
+ return plan(clean.map((s) => s.id), [{ op: 'insertBlocks', parent, index: dest.index, specs: clean }]);
34
34
  };
35
35
  /**
36
36
  * Grouped move — one step, per-member conflict resolution; refused
@@ -80,8 +80,7 @@ export const moveOps = (c) => {
80
80
  const retype = settle(from, moved, ppos.parent);
81
81
  if (isContainer(from))
82
82
  return splitOut(moved, [from], [], false, retype);
83
- const out = leaving(from, true, moved);
84
- const writes = [...moveTo(moved, ppos.parent, ppos.index + 1, out), ...retype];
83
+ const writes = [...moveTo(moved, ppos.parent, ppos.index + 1, leaving(true)), ...retype];
85
84
  const adopts = after.length > 0 &&
86
85
  !isVoid(last) &&
87
86
  !isIsland(last) &&
@@ -123,13 +122,11 @@ export const moveOps = (c) => {
123
122
  const splitOut = (ids, levels, specs, keep, retype = []) => {
124
123
  const moved = keep ? [] : [...ids];
125
124
  const placed = [...moved, ...specs.map((s) => s.id)];
126
- const insert = (at, index, s, ranks) => s.length ? [{ op: 'insertBlocks', parent: at, index, specs: s, ranks }] : [];
125
+ const insert = (at, index, s) => s.length ? [{ op: 'insertBlocks', parent: at, index, specs: s }] : [];
127
126
  const last = ids.at(-1);
128
127
  const { parent, index } = positionOf(levels.at(-1) ?? last);
129
- if (levels.length === 0) {
130
- const ranks = ranksFor(parent, index + 1, specs.length, [], true);
131
- return plan(placed, [...insert(parent, index + 1, specs, ranks), ...retype]);
132
- }
128
+ if (levels.length === 0)
129
+ return plan(placed, [...insert(parent, index + 1, specs), ...retype]);
133
130
  // Bottom up: what stays before the split at each level (the level
134
131
  // itself, or a new head holding it), and whether anything follows it.
135
132
  const heads = [];
@@ -141,10 +138,8 @@ export const moveOps = (c) => {
141
138
  for (const level of levels) {
142
139
  const kids = childrenIds(level);
143
140
  const at = kids.indexOf(child);
144
- const lead = [
145
- ...kids.slice(0, keep && child === last ? at + 1 : at).filter((k) => !moved.includes(k)),
146
- ...(before && !before.head ? [before.id] : [])
147
- ];
141
+ const stays = (keep && child === last) || (before !== null && !before.head);
142
+ const lead = kids.slice(0, at + (stays ? 1 : 0)).filter((k) => !moved.includes(k));
148
143
  if (!follows && at + 1 < kids.length)
149
144
  [follows, next] = [true, kids[at + 1]];
150
145
  if ((lead.length > 0 || before?.head) && follows) {
@@ -160,27 +155,52 @@ export const moveOps = (c) => {
160
155
  before = lead.length > 0 ? { id: level } : null;
161
156
  child = level;
162
157
  }
163
- // Ranked by where each comes from in the outermost level: the
164
- // head right before the first block (with `keep`, right before it
165
- // leaves), the blocks, then `specs` after the last — with `keep`,
166
- // right before the block after it, so a peer's head that takes the
167
- // block they follow sorts before them.
158
+ // Written in one gap, each right after the block before it, as an
159
+ // after-record out of the level's slot or a before-record into the gap
160
+ // before it (`leaving`): the engine's sort decides their order against
161
+ // a peer's records there (fork patch YP22, `sourceOrder`: the block a
162
+ // record stands at, then its part), so a peer's heads, pieces, lifts
163
+ // and new blocks in the same gap keep the serial order whatever the
164
+ // client ids (`del.merge.container`). The head stands at the first block
165
+ // (with `keep`, at it: `with`), the blocks at themselves, the new
166
+ // blocks after the last (`after`) — or, kept before the block that
167
+ // follows, at that block (`kept`). The records are written last first,
168
+ // so each stands before the one written before it, in the order the
169
+ // sort gives them; the head and the new blocks are created in the
170
+ // innermost level right after the block they stand at (their home,
171
+ // hidden while their records show them) and moved out by them.
168
172
  const outside = before !== null && !before.head;
169
- let gap = index + (outside ? 1 : 0);
170
- const ranks = exitRanks(levels.at(-1), outside, [
171
- ...(before?.head ? [{ at: ids[0], part: [keep ? WITH : HEAD] }] : []),
172
- ...moved.map((id) => ({ at: id, part: [SELF] })),
173
- ...specs.map((_, i) => keep && !outside ? { at: next, part: [KEPT, i] } : { at: last, part: [AFTER, i] })
174
- ]);
175
- const writes = before?.head
176
- ? insert(parent, gap++, [before.head], ranks.splice(0, 1))
177
- : [];
173
+ const side = leaving(outside);
174
+ const gap = index + (outside ? 1 : 0);
175
+ const at = moved[0] ?? last;
176
+ const kids0 = childrenIds(levels[0]);
177
+ const home = kids0.indexOf(last) + 1;
178
+ const specIds = specs.map((sp) => sp.id);
179
+ const [stands, part] = keep && !outside ? [next, PART.kept] : [last, PART.after];
180
+ // One record per run of adjacent blocks, each standing at its first: a
181
+ // block a peer's move takes out of a run leaves the others at their own place.
182
+ const runs = [];
183
+ for (const id of moved) {
184
+ const run = runs.at(-1);
185
+ if (run !== undefined && kids0.indexOf(run.at(-1)) + 1 === kids0.indexOf(id))
186
+ run.push(id);
187
+ else
188
+ runs.push([id]);
189
+ }
190
+ const writes = [
191
+ ...insert(levels[0], home, specs),
192
+ ...(before?.head ? insert(levels[0], home, [before.head]) : []),
193
+ ...moveTo(specIds, parent, gap, side, stands, part),
194
+ ...runs.reverse().flatMap((run) => moveTo(run, parent, gap, side, run[0], PART.self)),
195
+ ...(before?.head
196
+ ? moveTo([before.head.id], parent, gap, side, at, keep ? PART.with : PART.head)
197
+ : [])
198
+ ];
178
199
  for (const { spec, kids, inner } of heads.reverse()) {
179
- const inside = ranksFor(spec.id, 0, kids.length + (inner ? 1 : 0));
180
- writes.push(...moveTo(kids, spec.id, 0, inside.slice(0, kids.length)), ...(inner ? insert(spec.id, kids.length, [inner], inside.slice(-1)) : []));
200
+ writes.push(...moveTo(kids, spec.id, 0), ...(inner ? insert(spec.id, kids.length, [inner]) : []));
181
201
  }
182
- const mine = ranks.splice(0, moved.length);
183
- writes.push(...moveTo(moved, parent, gap, mine), ...insert(parent, gap + moved.length, specs, ranks), ...retype);
202
+ writes.push(...retype);
203
+ void next;
184
204
  return plan(placed, emptying(levels[0], moved, writes, landing(parent)));
185
205
  };
186
206
  /**
@@ -301,8 +301,8 @@ export const docReads = (c) => {
301
301
  const hasBlock = (id) => blockNodeOf(doc, id) !== null;
302
302
  /** The one liveness answer (`isLive`): `id` renders in `project()`. O(depth). */
303
303
  const live = (id) => isLive(doc, id);
304
- /** A live block that can hold content: it has a claims list (a streamless block gets its own text on first write). */
305
- const contentTarget = (id) => live(id) && view().blocks.get(id)?.claimsNode !== undefined;
304
+ /** A live block that can hold content (a streamless block gets its own text on first write). */
305
+ const contentTarget = (id) => live(id) && view().blocks.has(id);
306
306
  return {
307
307
  dataNode,
308
308
  blockJSON,
@@ -3,7 +3,7 @@ import { hash32, setDocRand } from '../rand.js';
3
3
  import { keepingReplaced } from '../incarnations.js';
4
4
  import { asEngineDoc, asYDoc } from '../structs.js';
5
5
  import { DOC_DATA_ROOT, SCHEMA } from '../schema.js';
6
- import { dataLeaves, isObject, writeLeaves } from '../data.js';
6
+ import { dataWrites, isObject, writeData } from '../data.js';
7
7
  import { jsonBlockToSpec, sanitizeSpec, sanitizeWireJson, sanitizeWireString } from '../../utils/json.js';
8
8
  import { isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION } from './gate.js';
9
9
  /** Origin of the seed update's apply — non-local, like any integrated update. */
@@ -100,7 +100,7 @@ export const bindSeed = (Y, BA) => {
100
100
  };
101
101
  scratch.transact(() => {
102
102
  specs.forEach(records);
103
- writeLeaves(scratch.get(DOC_DATA_ROOT), dataLeaves(own));
103
+ writeData(scratch.get(DOC_DATA_ROOT), dataWrites(own));
104
104
  });
105
105
  return Y.encodeStateAsUpdate(raw);
106
106
  };
@@ -11,7 +11,7 @@ import { blockNodeOf, isSelfOrDescendant } from '../placement/model.js';
11
11
  import { ref } from './plan.js';
12
12
  /** The split-merge ops of one facade, prepared. */
13
13
  export const splitMergeOps = (c) => {
14
- const { doc, view, childrenIds, positionOf, isVoid, isCellKind, blockTypeOf, insideIsland, isLayoutItem, next, previous, displayLength, contentTarget, isContainer, fits, canMerge, rendersContent, kindToCopy, REFUSED, plan, ranksFor, moveTo, move, pieceRanks, leaving, settledKind, settle, landing, emptying, emptied, merge, clamp } = c;
14
+ const { doc, view, childrenIds, positionOf, isVoid, isCellKind, blockTypeOf, insideIsland, isLayoutItem, next, previous, displayLength, contentTarget, isContainer, fits, canMerge, rendersContent, kindToCopy, REFUSED, plan, moveTo, move, leaving, settledKind, settle, landing, emptying, emptied, merge, clamp } = c;
15
15
  /**
16
16
  * Split `id` at content `offset` into a new sibling `newId` (one boundary
17
17
  * item and the claims that follow it, no text copied; children follow).
@@ -26,7 +26,7 @@ export const splitMergeOps = (c) => {
26
26
  const born = ref(newId);
27
27
  const pos = positionOf(id);
28
28
  const rec = view().blocks.get(id);
29
- if (pos === null || isVoid(id) || !rendersContent(id) || !rec?.claimsNode)
29
+ if (pos === null || isVoid(id) || !rendersContent(id) || rec === undefined)
30
30
  return REFUSED;
31
31
  // A table's cell holds its lines as line breaks: it never splits (`table.split`).
32
32
  if (isCellKind(blockTypeOf(id)))
@@ -39,7 +39,6 @@ export const splitMergeOps = (c) => {
39
39
  const t = tail
40
40
  ? { type, data: tail.data && sanitizeWireJson(tail.data) }
41
41
  : { type, data: readData(rec.node) };
42
- const [rank] = pieceRanks(id, at, 1);
43
42
  const length = displayLength(id) - at;
44
43
  const split = {
45
44
  op: 'splitBlock',
@@ -49,7 +48,7 @@ export const splitMergeOps = (c) => {
49
48
  newId: born,
50
49
  tail: t,
51
50
  parent: pos.parent,
52
- rank: rank
51
+ index: pos.index + 1
53
52
  };
54
53
  return plan([born], [split, ...move(childrenIds(id), born, 0)]);
55
54
  };
@@ -58,11 +57,11 @@ export const splitMergeOps = (c) => {
58
57
  * children ADOPTED as `into`'s last children — an island's take
59
58
  * `into`'s default child, like a baseline merge's — and `from` is
60
59
  * hidden via the claim (undo restores it). The children stay under
61
- * `from`, ranked after `into`'s children, and display under `into`
62
- * through the claim: a concurrent delete of `into` voids the
63
- * claim and `from` comes back with its children, never below them.
64
- * Role rules are `canMerge`'s; a merge that would close a display
65
- * cycle is refused. `ids`: `into`.
60
+ * `from` and display under `into` through the claim, after `into`'s
61
+ * own children (the display's claim order): a concurrent delete of
62
+ * `into` voids the claim and `from` comes back with its children,
63
+ * never below them. Role rules are `canMerge`'s; a merge that would
64
+ * close a display cycle is refused. `ids`: `into`.
66
65
  */
67
66
  const mergeBlocks = (fromId, intoId) => {
68
67
  const from = ref(fromId);
@@ -74,9 +73,8 @@ export const splitMergeOps = (c) => {
74
73
  return REFUSED;
75
74
  const kids = childrenIds(from);
76
75
  const retype = settle(from, kids, into);
77
- const adopt = moveTo(kids, from, kids.length, ranksFor(into, Infinity, kids.length, kids));
78
76
  // A list its only item leaves goes, as with every sibling op.
79
- return plan([into], emptied([from], [merge(from, into), ...adopt, ...retype], landing(into)));
77
+ return plan([into], emptied([from], [merge(from, into), ...retype], landing(into)));
80
78
  };
81
79
  /**
82
80
  * Baseline-shaped merge (both `mergeBackward` and `mergeForward`):
@@ -84,7 +82,7 @@ export const splitMergeOps = (c) => {
84
82
  * NOT adopted into `into` — and take the kind they show there
85
83
  * (`settledKind`: an island's children its parent's default child, a
86
84
  * paragraph in a list its item); then `from`'s content claims
87
- * into `into`. Ranked after `from`, not at it: a concurrent delete of
85
+ * into `into`. Placed after `from`, not at it: a concurrent delete of
88
86
  * `into` revives `from` above its former children.
89
87
  */
90
88
  const mergeUnnesting = (from, into) => {
@@ -93,8 +91,7 @@ export const splitMergeOps = (c) => {
93
91
  return REFUSED;
94
92
  const kids = childrenIds(from);
95
93
  const retype = settle(from, kids, pos.parent);
96
- const out = leaving(from, true, kids);
97
- return plan([into], [...moveTo(kids, pos.parent, pos.index + 1, out), ...retype, merge(from, into)]);
94
+ return plan([into], [...moveTo(kids, pos.parent, pos.index + 1, leaving(true)), ...retype, merge(from, into)]);
98
95
  };
99
96
  /** Remove `container`, left empty, for the key at `id` (refused if it holds text). */
100
97
  const gone = (id, container) => {
@@ -143,7 +140,7 @@ export const splitMergeOps = (c) => {
143
140
  if (!fits(slot.parent, settledKind(prev, id, slot.parent)))
144
141
  return REFUSED;
145
142
  const lift = [
146
- ...moveTo([id], slot.parent, slot.index, leaving(prev, false, [id])),
143
+ ...moveTo([id], slot.parent, slot.index, leaving(false)),
147
144
  ...settle(prev, [id], slot.parent)
148
145
  ];
149
146
  return plan([id], emptying(prev, [id], lift, landing(slot.parent)));
@@ -1,28 +1,40 @@
1
+ /**
2
+ * The step writers every prepared op composes: the plan itself, moves (a
3
+ * move's place and side), type steps and the kind a block shows where it
4
+ * lands (`settle`), the containers and layouts a write leaves empty
5
+ * (`emptying`, `dissolving`), delete and merge steps, and display spans of a
6
+ * block's content.
7
+ */
1
8
  import { TYPE } from '../schema.js';
2
9
  import { type BlockId, type ContentItem } from '../placement/model.js';
3
10
  import type { Plan, PlanStep } from './types.js';
4
11
  import type { DocBase, DocReads } from './reads.js';
5
12
  import type { DocCapability } from './capability.js';
6
13
  /** What the step writers read: the reads and the structural capability. */
14
+ /**
15
+ * A record's order among the records standing at one block, for the
16
+ * engine's sort of two records at one origin (fork patch YP22): what a split
17
+ * of a list around a block writes there — a new head list holding the items
18
+ * before it (`head`), new blocks placed after the items before it, which
19
+ * stay (`kept`), a head holding those items and the block (`with`), the
20
+ * block itself leaving (`self`), new blocks after it (`after`) — in the
21
+ * order every serial run of the gestures gives (`del.merge.container`).
22
+ */
23
+ export declare const PART: {
24
+ readonly head: 0;
25
+ readonly kept: 1;
26
+ readonly with: 2;
27
+ readonly self: 3;
28
+ readonly after: 4;
29
+ };
7
30
  export type StepsContext = DocBase & DocReads & DocCapability;
8
31
  /** The step writers of one facade. */
9
32
  export declare const planSteps: (c: StepsContext) => {
10
33
  REFUSED: import("./types.js").OpResult;
11
- HEAD: number;
12
- KEPT: number;
13
- WITH: number;
14
- SELF: number;
15
- AFTER: number;
16
34
  plan: (ids: readonly BlockId[], writes: PlanStep[]) => Plan;
17
- ranksFor: (parent: BlockId | null, index: number, count: number, exclude?: readonly BlockId[], run?: boolean) => string[];
18
- moveTo: (ids: BlockId[], parent: BlockId | null, index: number, ranks: string[]) => PlanStep[];
35
+ moveTo: (ids: BlockId[], parent: BlockId | null, index: number, side?: 0 | 1, at?: BlockId, part?: number) => PlanStep[];
19
36
  move: (ids: BlockId[], parent: BlockId | null, index: number) => PlanStep[];
20
- exitRanks: (outer: BlockId, after: boolean, parts: readonly {
21
- at: BlockId;
22
- part: readonly number[];
23
- }[]) => string[];
24
- pieceRanks: (id: BlockId, at: number, count: number) => string[];
25
- leaving: (outer: BlockId, after: boolean, ids: readonly BlockId[]) => string[];
37
+ leaving: (after: boolean) => 0 | 1;
26
38
  attr: (id: BlockId, key: typeof TYPE, value: string) => PlanStep[];
27
39
  leavingIsland: (island: BlockId, kind: string | undefined, to: string) => string | undefined;
28
40
  settledKind: (from: BlockId | null, kid: BlockId, parent: BlockId | null) => string | undefined;