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
@@ -6,15 +6,16 @@
6
6
  import { readData } from '../../data.js';
7
7
  import { Y } from '../../engine.js';
8
8
  import { LIVE_WRITERS, baseIdOf, incarnationId } from '../../incarnations.js';
9
- import { candidatesOf } from '../../placement/model.js';
10
- import { CONTENT, NONCE, hasDeleteMark, isNodeLike } from '../../schema.js';
11
- import { changedUnder, engineOps, itemOf, queuedTransactions, sequenceLength, walkIdSet } from '../../structs.js';
12
- import { DEAD, isBoundary } from '../model.js';
9
+ import { ownerOfNode, slotOwner } from '../../placement/resolve.js';
10
+ import { isBlockSlot, isDataSlot, isRecord, unitOf } from '../../placement/slots.js';
11
+ import { CONTENT, CONTENT_NODE, NONCE, hasDeleteMark, isNodeLike } from '../../schema.js';
12
+ import { changedUnder, clientsOf, engineOps, itemOf, queuedTransactions, sequenceLength, structAt, walkIdSet } from '../../structs.js';
13
+ import { DEAD, isRowMark } from '../model.js';
13
14
  import { gapOfItem, headOf, rowLength, segmentOfGap, shiftGap } from '../rows.js';
14
- import { CONTENT_ATTR, EMPTY_RUNS, ENTRY_FACET, facetOf, checksOf, indexChecks, sameShape, typeAttr } from './shared.js';
15
+ import { CONTENT_ATTR, DATA_SEQ_FACET, EMPTY_RUNS, ENTRY_FACET, SEQ_FACET, facetOf, checksOf, indexChecks, sameShape, typeAttr } from './shared.js';
15
16
  /** The fold of one doc's index, over every part it folds into. */
16
17
  export const indexFold = (ix) => {
17
- const { doc, registry, dataRoot, blocks, shells, textConsumers, ownerSeeds, rows, retargets, unresolved, reclaim, placementSeeds, stateSeeds, incarnations, cache, dirty, foldStats, frames, candidates, ownerOf, invalidateBlock, streamOf, streamsIn, setRow, scanRow, refreshDelims, placeHome, applyRetargets, noteKind, argParent, noteCands, kept, updateBlockRec, ensureRec, syncIncarnations, computeRuns, tableFacts } = ix;
18
+ const { doc, registry, dataRoot, blocks, shells, textConsumers, ownerSeeds, rows, reclaim, placementSeeds, stateSeeds, incarnations, cache, dirty, foldStats, frames, candidates, ownerOf, invalidateBlock, streamOf, streamsIn, setRow, scanRow, refreshDelims, placeHome, applyReclaims, noteKind, homeFor, putSlot, edgeParent, kept, updateBlockRec, ensureRec, syncIncarnations, computeRuns, tableFacts } = ix;
18
19
  const ops = engineOps(Y);
19
20
  const NO_EDITS = Object.freeze({
20
21
  edits: [],
@@ -26,12 +27,86 @@ export const indexFold = (ix) => {
26
27
  if (arr === undefined)
27
28
  return false;
28
29
  for (let k = from - s.id.clock; k < to - s.id.clock; k++)
29
- if (isBoundary(arr[k]))
30
+ if (isRowMark(arr[k]))
30
31
  return true;
31
32
  return false;
32
33
  };
33
- /** The edits the id sets `ins`/`del` (what the fold has not folded yet) hold, per text. */
34
- const makeEditIndex = (ins, del) => {
34
+ /** The struct holding id `client:clock` (unsplit), `null` when the store holds none. */
35
+ const structOf = (client, clock) => structAt(Y, clientsOf(doc).get(client) ?? [], clock);
36
+ /**
37
+ * The edits the id sets `ins`/`del`, the hold log `log` and the move log
38
+ * `moves` (what the fold has not folded yet) hold: per text, its edits
39
+ * (a log entry is a unit a hold record hid or showed, fork patch YP20:
40
+ * `client, clock, ±len`, in order); per sequence, what changed in it
41
+ * (`seq`): the slots written and removed, the records written and
42
+ * removed and the units whose mover changed name the blocks to re-place.
43
+ * Reading the sequences writes the slot map (the slots written and
44
+ * removed, `putSlot`) and lists the ids whose home to read again
45
+ * (`rehome`).
46
+ */
47
+ const makeEditIndex = (ins, del, log = [], moves = []) => {
48
+ let seqs;
49
+ const rehome = new Set();
50
+ const seqOf = (node) => {
51
+ let e = seqs.get(node);
52
+ if (e === undefined)
53
+ seqs.set(node, (e = { blocks: new Set(), data: false }));
54
+ return e;
55
+ };
56
+ /** Note unit `c:k` (`value`) of the sequence of `node`: a block slot names its block, a data slot its data. */
57
+ const noteUnit = (e, owner, value, c, k, inserted) => {
58
+ if (isBlockSlot(value)) {
59
+ e.blocks.add(slotOwner(registry, kept, value.b, c));
60
+ if (inserted === null || (inserted && owner === undefined))
61
+ return;
62
+ putSlot(value.b, { c, k }, inserted ? { parent: owner, c, k } : null);
63
+ rehome.add(value.b);
64
+ }
65
+ else if (isDataSlot(value))
66
+ e.data = true;
67
+ };
68
+ const visitSeq = (s, from, to, inserted) => {
69
+ const parent = s.parent;
70
+ if (s.parentSub !== null || !isNodeLike(parent) || parent.name === CONTENT_NODE)
71
+ return;
72
+ const e = seqOf(parent);
73
+ const owner = ownerOfNode(registry, kept, parent);
74
+ const it = s;
75
+ if (it.content === undefined)
76
+ return;
77
+ if (isRecord(it)) {
78
+ const ids = it.content.ids;
79
+ for (let i = 0; i < ids.length; i += 3)
80
+ for (let j = 0; j < ids[i + 2]; j++) {
81
+ const u = unitOf(doc, { c: ids[i], k: ids[i + 1] + j });
82
+ if (u !== null)
83
+ noteUnit(e, owner, u.value, ids[i], ids[i + 1] + j, null);
84
+ }
85
+ }
86
+ else if (it.content.arr !== undefined)
87
+ for (let k = from; k < to; k++)
88
+ noteUnit(e, owner, it.content.arr[k - s.id.clock], s.id.client, k, inserted);
89
+ };
90
+ const buildSeqs = () => {
91
+ if (seqs !== undefined)
92
+ return seqs;
93
+ seqs = new Map();
94
+ if (ins === undefined || del === undefined)
95
+ return seqs;
96
+ walkIdSet(Y, doc, ins, (s, from, to) => visitSeq(s, from, to, true));
97
+ walkIdSet(Y, doc, del, (s, from, to) => visitSeq(s, from, to, false));
98
+ for (let i = 0; i < moves.length; i += 3) {
99
+ const s = structOf(moves[i], moves[i + 1]);
100
+ if (s === null)
101
+ continue;
102
+ visitSeq(s, moves[i + 1], moves[i + 1] + moves[i + 2], null);
103
+ // Where the unit shows now: that sequence changed too.
104
+ const mover = s.mover;
105
+ if (mover)
106
+ seqOf(mover.parent);
107
+ }
108
+ return seqs;
109
+ };
35
110
  let built;
36
111
  const build = () => {
37
112
  if (built !== undefined)
@@ -39,7 +114,7 @@ export const indexFold = (ix) => {
39
114
  if (ins === undefined || del === undefined)
40
115
  return (built = null);
41
116
  const out = new Map();
42
- const visit = (idSet, deleted) => walkIdSet(Y, doc, idSet, (s, from, to) => {
117
+ const edit = (s, from, to, deleted) => {
43
118
  const parent = s.parent;
44
119
  if (s.parentSub !== null || !isNodeLike(parent))
45
120
  return;
@@ -49,20 +124,44 @@ export const indexFold = (ix) => {
49
124
  // A format marker moves no unit; its effect reaches past the edit.
50
125
  if (s.countable !== true)
51
126
  return void (e.opaque = true);
52
- // Written and removed within the fold: nothing moved.
53
- if (deleted ? ins.has(s.id.client, from) : s.deleted)
54
- return;
55
127
  if (holdsBoundary(s, from, to))
56
128
  return void (e.scan = true);
57
129
  e.edits.push({ item: s, len: to - from, del: deleted });
130
+ };
131
+ const visit = (idSet, deleted) => walkIdSet(Y, doc, idSet, (s, from, to) => {
132
+ // Written and removed (or held) within the fold: nothing moved.
133
+ if (!(deleted ? ins.has(s.id.client, from) : s.deleted))
134
+ edit(s, from, to, deleted);
58
135
  });
59
- built = visit(ins, false) && visit(del, true) ? out : null;
136
+ // In order, after the inserts and before the deletes (each gap then
137
+ // holds what an edit takes); a unit written within the fold shows or
138
+ // not as its insert says.
139
+ const held = () => {
140
+ for (let i = 0; i < log.length; i += 3) {
141
+ const s = structOf(log[i], log[i + 1]);
142
+ if (s === null)
143
+ return false;
144
+ const n = log[i + 2];
145
+ if (!ins.has(log[i], log[i + 1]))
146
+ edit(s, log[i + 1], log[i + 1] + Math.abs(n), n < 0);
147
+ }
148
+ return true;
149
+ };
150
+ built = visit(ins, false) && held() && visit(del, true) ? out : null;
60
151
  return built;
61
152
  };
62
- /** `node`'s edits (`null`: unknown — rescan, every consumer recomputes). */
63
- return (node) => {
64
- const map = build();
65
- return map === null ? null : (map.get(node) ?? NO_EDITS);
153
+ return {
154
+ /** `node`'s edits (`null`: unknown — rescan, every consumer recomputes). */
155
+ text: (node) => {
156
+ const map = build();
157
+ return map === null ? null : (map.get(node) ?? NO_EDITS);
158
+ },
159
+ /** What changed in `node`'s sequence (`undefined`: nothing). */
160
+ seq: (node) => buildSeqs().get(node),
161
+ /** The sequences the fold changed. */
162
+ seqNodes: () => buildSeqs().keys(),
163
+ /** The ids whose home to read again (their slots changed). */
164
+ rehome
66
165
  };
67
166
  };
68
167
  const runs = (b) => {
@@ -73,7 +172,8 @@ export const indexFold = (ix) => {
73
172
  return cache.get(b)?.runs ?? EMPTY_RUNS;
74
173
  };
75
174
  // ── the fold ─────────────────────────────────────────────────────
76
- const parentOf = (id) => blocks.get(id)?.cands[0]?.p;
175
+ /** The owner of the sequence `id`'s slot shows in (its display edge's parent), as the engine stands. */
176
+ const parentOf = (id) => edgeParent(id);
77
177
  /** Note edits of `id`'s own text (`null`: unknown — rescan, every reader re-reads). */
78
178
  const noteText = (ctx, id, e) => {
79
179
  let t = ctx.texts.get(id);
@@ -92,11 +192,12 @@ export const indexFold = (ix) => {
92
192
  t.edits.push(x);
93
193
  };
94
194
  /** Fold one block's changed facets (`edits`: its own text's, one per changed content node). */
95
- const foldBlock = (id, facets, edits, ctx) => {
195
+ const foldBlock = (id, facets, edits, ctx, editsOf) => {
96
196
  const kinds = new Set();
97
197
  for (const f of facets)
98
198
  kinds.add(f === ENTRY_FACET ? 'entry' : facetOf(f));
99
- const parentBefore = parentOf(id);
199
+ // The display parents a shell may flip by (`settle`): read while there are shells.
200
+ const parentBefore = shells.size > 0 ? parentOf(id) : undefined;
100
201
  if (typeof parentBefore === 'string')
101
202
  ctx.parents.add(parentBefore);
102
203
  if (kinds.has('entry') || kinds.has('structure')) {
@@ -123,12 +224,9 @@ export const indexFold = (ix) => {
123
224
  else {
124
225
  ensureRec(id);
125
226
  const rec = blocks.get(id);
126
- if (kinds.has('at') && rec) {
127
- const before = argParent(rec);
128
- rec.cands = candidatesOf(rec.node);
129
- noteCands(id, before);
130
- placementSeeds.add(id);
131
- }
227
+ // A data slot in the block's sequence: its arrays' items changed (the seq pass seeded the blocks).
228
+ if (kinds.has('seq') && rec && editsOf.seq(rec.node)?.data)
229
+ kinds.add('meta');
132
230
  if (kinds.has('meta') && rec) {
133
231
  const was = rec.type;
134
232
  const facts = tableFacts(id, rec.data);
@@ -147,7 +245,7 @@ export const indexFold = (ix) => {
147
245
  stateSeeds.add(id);
148
246
  }
149
247
  }
150
- const parentAfter = parentOf(id);
248
+ const parentAfter = shells.size > 0 ? parentOf(id) : undefined;
151
249
  if (typeof parentAfter === 'string')
152
250
  ctx.parents.add(parentAfter);
153
251
  if (kinds.has('content'))
@@ -195,7 +293,7 @@ export const indexFold = (ix) => {
195
293
  const next = scanRow(home);
196
294
  const same = next !== undefined && row !== undefined && next.key === row.key;
197
295
  if (same)
198
- [next.cuts, next.head] = [row.cuts, row.head];
296
+ [next.cuts, next.heads, next.head] = [row.cuts, row.heads, row.head];
199
297
  setRow(home, next, ctx.named);
200
298
  if (!same)
201
299
  homes.add(home);
@@ -269,8 +367,10 @@ export const indexFold = (ix) => {
269
367
  if (holdsUnit(id))
270
368
  hold(id);
271
369
  for (const [id, rec] of blocks) {
272
- const p = rec.cands[0]?.p;
273
- if (!shells.has(id) && !rec.deleted && typeof p === 'string' && shells.has(p))
370
+ if (shells.has(id) || rec.deleted)
371
+ continue;
372
+ const p = parentOf(id);
373
+ if (typeof p === 'string' && shells.has(p))
274
374
  hold(p);
275
375
  }
276
376
  for (let id = up.pop(); id !== undefined; id = up.pop()) {
@@ -327,8 +427,9 @@ export const indexFold = (ix) => {
327
427
  return null;
328
428
  id = incarnationId(id, item);
329
429
  }
430
+ // The block's own sequence (its slots and records: `SEQ_FACET`), or one of its attrs.
330
431
  if (below === null)
331
- return [id, sub === CONTENT ? CONTENT_ATTR : (sub ?? '?'), false];
432
+ return [id, sub === CONTENT ? CONTENT_ATTR : sub === null ? SEQ_FACET : sub, false];
332
433
  const facet = below._item?.parentSub ?? CONTENT;
333
434
  return [id, facet, sub === null && below === type && facet === CONTENT];
334
435
  }
@@ -361,7 +462,7 @@ export const indexFold = (ix) => {
361
462
  let list = edits.get(id);
362
463
  if (list === undefined)
363
464
  edits.set(id, (list = []));
364
- list.push(seq ? editsOf(type) : null);
465
+ list.push(seq ? editsOf.text(type) : null);
365
466
  }
366
467
  }
367
468
  const ctx = {
@@ -371,15 +472,42 @@ export const indexFold = (ix) => {
371
472
  table: false,
372
473
  parents: new Set()
373
474
  };
475
+ // The sequences (the root's, the blocks'): their slots index the blocks' homes, their changes seed the placements.
476
+ for (const node of editsOf.seqNodes()) {
477
+ const ch = editsOf.seq(node);
478
+ ix.seqEpoch++;
479
+ for (const b of ch.blocks)
480
+ placementSeeds.add(b);
481
+ if (ch.blocks.size > 0 || ch.data)
482
+ derived = true;
483
+ const owner = ownerOfNode(registry, kept, node);
484
+ if (typeof owner === 'string') {
485
+ let facets = touched.get(owner);
486
+ if (facets === undefined)
487
+ touched.set(owner, (facets = new Set()));
488
+ facets.add(SEQ_FACET);
489
+ if (ch.data)
490
+ facets.add(DATA_SEQ_FACET);
491
+ }
492
+ }
493
+ // A slot's block, and its losing incarnations, re-read their home (which slot is whose).
494
+ for (const b of editsOf.rehome)
495
+ for (const id of [b, ...(incarnations.get(b) ?? [])]) {
496
+ const rec = blocks.get(id);
497
+ if (rec === undefined)
498
+ continue;
499
+ const home = homeFor(id);
500
+ if (home?.c !== rec.home?.c || home?.k !== rec.home?.k)
501
+ placementSeeds.add(id);
502
+ rec.home = home;
503
+ }
374
504
  for (const [id, facets] of touched) {
375
- foldBlock(id, facets, edits.get(id) ?? [], ctx);
505
+ foldBlock(id, facets, edits.get(id) ?? [], ctx, editsOf);
376
506
  derived ||= [...facets].some((f) => f === ENTRY_FACET || facetOf(f) !== 'ignore');
377
507
  }
378
508
  foldTexts(ctx);
379
- for (const h of unresolved)
380
- retargets.add(h);
381
- if (retargets.size > 0 || reclaim.size > 0)
382
- applyRetargets(ctx);
509
+ if (reclaim.size > 0)
510
+ applyReclaims(ctx);
383
511
  if (shells.size > 0)
384
512
  settle(ctx.table ? shells : [...touched.keys(), ...ctx.parents, ...editedStreams(ctx)], ctx);
385
513
  for (const b of ctx.invalidated)
@@ -406,7 +534,7 @@ export const indexFold = (ix) => {
406
534
  }
407
535
  return touched;
408
536
  };
409
- /** Each transaction's folded part: copies of its id sets, and their lengths (the watermark). */
537
+ /** Each transaction's folded part: copies of its id sets, the hold and move logs' folded lengths, and the watermark. */
410
538
  const cursors = new WeakMap();
411
539
  /** The transactions whose commit fold ran. */
412
540
  const committed = new WeakSet();
@@ -418,6 +546,11 @@ export const indexFold = (ix) => {
418
546
  });
419
547
  return n;
420
548
  };
549
+ /** How much a transaction wrote so far: its id sets' lengths and its hold and move logs'. */
550
+ const watermark = (tr) => lengthOf(tr.insertSet) +
551
+ lengthOf(tr.deleteSet) +
552
+ (tr.holds?.length ?? 0) +
553
+ (tr.moves?.length ?? 0);
421
554
  /**
422
555
  * Fold the pending part of `tr` — the structs its insert/delete sets
423
556
  * gained since the last fold — before a read inside it (read-your-
@@ -429,14 +562,18 @@ export const indexFold = (ix) => {
429
562
  return false;
430
563
  let cursor = cursors.get(tr);
431
564
  if (cursor === undefined)
432
- cursors.set(tr, (cursor = { ins: ops.idSet(), del: ops.idSet(), mark: 0 }));
433
- const mark = lengthOf(tr.insertSet) + lengthOf(tr.deleteSet);
565
+ cursors.set(tr, (cursor = { ins: ops.idSet(), del: ops.idSet(), holds: 0, moves: 0, mark: 0 }));
566
+ const mark = watermark(tr);
434
567
  if (mark === cursor.mark)
435
568
  return false;
436
569
  const ins = ops.diff(tr.insertSet, cursor.ins);
437
570
  const del = ops.diff(tr.deleteSet, cursor.del);
571
+ const log = (tr.holds ?? []).slice(cursor.holds);
572
+ const moves = (tr.moves ?? []).slice(cursor.moves);
438
573
  ops.insertInto(cursor.ins, ins);
439
574
  ops.insertInto(cursor.del, del);
575
+ cursor.holds += log.length;
576
+ cursor.moves += moves.length;
440
577
  cursor.mark = mark;
441
578
  for (const f of frames)
442
579
  f.wrote = true;
@@ -452,7 +589,18 @@ export const indexFold = (ix) => {
452
589
  };
453
590
  walkIdSet(Y, doc, ins, note);
454
591
  walkIdSet(Y, doc, del, note);
455
- fold(changed, makeEditIndex(ins, del));
592
+ for (const l of [log, moves])
593
+ for (let i = 0; i < l.length; i += 3) {
594
+ const s = structOf(l[i], l[i + 1]);
595
+ if (s === null)
596
+ continue;
597
+ note(s);
598
+ // A unit a record moved: where it shows now changed too (a held unit has no mover).
599
+ const mover = s.mover;
600
+ if (mover)
601
+ note(mover);
602
+ }
603
+ fold(changed, makeEditIndex(ins, del, log, moves));
456
604
  return true;
457
605
  };
458
606
  const openTx = () => doc._transaction;
@@ -473,7 +621,7 @@ export const indexFold = (ix) => {
473
621
  const unfolded = () => queuedTransactions(doc).some((tr) => !committed.has(tr) &&
474
622
  tr.insertSet !== undefined &&
475
623
  tr.deleteSet !== undefined &&
476
- lengthOf(tr.insertSet) + lengthOf(tr.deleteSet) !== (cursors.get(tr)?.mark ?? 0));
624
+ watermark(tr) !== (cursors.get(tr)?.mark ?? 0));
477
625
  /**
478
626
  * The commit of a transaction that changed the registry or a node under
479
627
  * it: fold `transaction.changed` once (the report publishes from `update`).
@@ -489,9 +637,11 @@ export const indexFold = (ix) => {
489
637
  ins = ops.diff(ins, cursor.ins);
490
638
  del = ops.diff(del, cursor.del);
491
639
  }
640
+ const log = (tr.holds ?? []).slice(cursor?.holds ?? 0);
641
+ const moves = (tr.moves ?? []).slice(cursor?.moves ?? 0);
492
642
  cursors.delete(tr);
493
643
  committed.add(tr);
494
- fold(tr.changed ?? new Map(), makeEditIndex(ins, del));
644
+ fold(tr.changed ?? new Map(), makeEditIndex(ins, del, log, moves));
495
645
  };
496
646
  return {
497
647
  runs,
@@ -1,4 +1,4 @@
1
- import { encodeRank, RANK_VMAX } from '../../placement/rank.js';
1
+ import { cellKey, LAST_CELL, unlistedCellKey } from '../../placement/keys.js';
2
2
  import { listedColumns, unlistedRank } from '../../tables.js';
3
3
  /** The layout rules of one doc's index, over its state. */
4
4
  export const indexLayout = (ix) => {
@@ -77,8 +77,8 @@ export const indexLayout = (ix) => {
77
77
  /**
78
78
  * The rank cell `id` displays at in row `row` (`table.columns`): its
79
79
  * column's position in the table holding the row, so every row shows its
80
- * cells in the table's column order whatever their placements (a rank
81
- * of one segment, the position, ties by block id); a withdrawn cell of a
80
+ * cells in the table's column order whatever their placements (a key of
81
+ * the position, ties by block id); a withdrawn cell of a
82
82
  * column the table no longer lists after them, its column's place among
83
83
  * those fixed by its id (`unlistedRank`); any other cell of no listed
84
84
  * column last (it does not display, `table.cell`).
@@ -95,11 +95,8 @@ export const indexLayout = (ix) => {
95
95
  const column = columnOf(id);
96
96
  const at = column === undefined ? undefined : index.get(column);
97
97
  if (at === undefined && column !== undefined && ix.shells.has(id))
98
- return encodeRank([
99
- { v: RANK_VMAX - 1, t: 0 },
100
- { v: unlistedRank(column), t: 0 }
101
- ]);
102
- return encodeRank([{ v: at ?? RANK_VMAX, t: 0 }]);
98
+ return unlistedCellKey(unlistedRank(column));
99
+ return at === undefined ? LAST_CELL : cellKey(at);
103
100
  };
104
101
  /**
105
102
  * The table rules (`table.*`), in the same pass: a cell displays only in
@@ -3,36 +3,44 @@
3
3
  * ownership the display reads (`ownShim`), and THE shown-kind rule
4
4
  * (`typeOf`).
5
5
  *
6
- * A structural change re-decides only what it can change: the winning
7
- * placement of the blocks whose candidates (or whose parent's
8
- * registry entry) changed, and the display slot of every block whose
9
- * slot walk (`displaySlotOf`) reads one that changed — its stored
10
- * subtree, through the blocks it displays — patched into the parents'
11
- * child lists. While every block shows its winning candidate (no
12
- * cycle rejected, none rehomed), a block's placement is its argmax
13
- * (`resolvePlacements` accepts it), so only a cycle through a changed
14
- * display edge needs the global resolution, which then runs whole.
15
- * The layout rules re-run only on the layouts a change reaches.
6
+ * A structural change re-decides only what it can change: the display
7
+ * edge of the blocks whose slot, record or mover changed (fork patch
8
+ * YP22), and the display slot of every block whose slot walk
9
+ * (`displaySlotOf`) reads one that changed — its stored subtree, through
10
+ * the blocks it displays — patched into the parents' child lists. A
11
+ * block's candidate edges are its live move records, strongest first, then
12
+ * its home slot; it shows at the first that closes no cycle through the
13
+ * accepted edges (`settle`): the later move wins, and the block whose edge
14
+ * is the oldest of a cycle falls back to its next candidate, back where it
15
+ * stood (its previous record, else home; the root's tail only when every
16
+ * candidate closes a cycle), so a cycle resolves locally: no global pass.
17
+ * The first build places every block the same way (their unique acyclic
18
+ * acceptance, whatever the order; the tests' greedy rebuild,
19
+ * `src/tests/oracles/placements.ts`, is what the self-checks compare). A
20
+ * placed block's order key is found from its sequence neighbours
21
+ * (`placement/keys.ts`), never by walking the parent's sequence; a rebuild
22
+ * keys every list once, in its sequence's order. The layout rules re-run
23
+ * only on the layouts a change reaches.
16
24
  */
17
- import { type BlockId, type BlockRec, type DisplayOwnership, type DocOrder } from '../../placement/model.js';
25
+ import { type BlockId, type DisplayOwnership, type DocOrder } from '../../placement/model.js';
26
+ import { homeOf, type SlotRef } from '../../placement/resolve.js';
27
+ import { type Unit } from '../../placement/slots.js';
28
+ import type { EngineNode } from '../../engine-api.js';
18
29
  import type { IndexClaims } from './claims.js';
19
30
  import type { IndexLayout } from './layout.js';
20
31
  import type { IndexState } from './state.js';
21
32
  import type { IndexStreams } from './streams.js';
22
33
  /** Placement maintenance of one doc's index, over its state, claims, streams and layout rules. */
23
34
  export declare const indexPlacement: (ix: IndexState & IndexClaims & IndexStreams & IndexLayout) => {
24
- ranker: {
25
- rank: (id: BlockId, parent: BlockId | null, rank: string) => string;
26
- regroup: (home: BlockId) => Set<BlockId>;
27
- forget: (home?: BlockId) => void;
28
- };
29
35
  ownShim: DisplayOwnership;
30
36
  own0: DisplayOwnership;
31
37
  noteKind: (id: BlockId) => void;
32
- argParent: (rec: BlockRec | undefined) => BlockId | null | undefined;
33
- noteCands: (id: BlockId, before: BlockId | null | undefined) => void;
38
+ homeFor: (id: BlockId) => ReturnType<typeof homeOf>;
39
+ putSlot: (b: BlockId, u: Unit, ref: SlotRef | null) => void;
40
+ edgeParent: (id: BlockId) => BlockId | null | undefined;
34
41
  noteFollowing: (id: BlockId) => void;
35
42
  ensurePlacements: () => void;
43
+ reslot: (node: EngineNode) => void;
36
44
  typeOf: (id: BlockId) => string;
37
45
  order: () => DocOrder;
38
46
  };