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
@@ -1,365 +0,0 @@
1
- /**
2
- * The index of text delete marks and restoration records (`text/deletes.ts`):
3
- * which root characters each live mark holds, every copy of a character and
4
- * what it copied, and the reads over them (members, leaves, holders, the
5
- * parts of one status), kept in each document's `State`.
6
- */
7
- import * as decoding from 'lib0-v14/decoding';
8
- import * as encoding from 'lib0-v14/encoding';
9
- import { asYDoc, clientsOf, collectable, collectNow, collects, engineOps, structAt, walkIdSet } from '../structs.js';
10
- export const overlaps = (a, b) => a.k < b.k + b.n && b.k < a.k + a.n;
11
- export const push = (map, key, v) => {
12
- const list = map.get(key);
13
- if (list === undefined)
14
- map.set(key, [v]);
15
- else
16
- list.push(v);
17
- };
18
- export const keyOf = (r) => `${r.client}:${r.clock}`;
19
- /** The most spans a folded delete record holds (a backspace run merges into one). */
20
- export const FOLD_SPANS = 8;
21
- /** `spans` sorted, with touching and overlapping spans of one client merged. */
22
- export const mergeSpans = (spans) => {
23
- const out = [];
24
- for (const sp of [...spans].sort((a, b) => a.c - b.c || a.k - b.k)) {
25
- const last = out[out.length - 1];
26
- if (last !== undefined && last.c === sp.c && sp.k <= last.k + last.n)
27
- last.n = Math.max(last.n, sp.k + sp.n - last.k);
28
- else
29
- out.push({ ...sp });
30
- }
31
- return out;
32
- };
33
- /** `m` narrowed to root characters `[lo, hi)`. */
34
- export const clip = (m, lo, hi) => ({
35
- c: m.c,
36
- k: m.k + lo - m.rk,
37
- n: hi - lo,
38
- rk: lo
39
- });
40
- export const encode = (rows) => {
41
- const e = encoding.createEncoder();
42
- encoding.writeVarUint(e, rows.length);
43
- for (const row of rows)
44
- for (const v of row)
45
- encoding.writeVarUint(e, v);
46
- return encoding.toUint8Array(e);
47
- };
48
- export const decode = (bytes, width) => {
49
- const d = decoding.createDecoder(bytes);
50
- const rows = [];
51
- for (let i = decoding.readVarUint(d); i > 0; i--) {
52
- const row = [];
53
- for (let j = 0; j < width; j++)
54
- row.push(decoding.readVarUint(d));
55
- rows.push(row);
56
- }
57
- return rows;
58
- };
59
- /** The index's reads and writes over a document's `State`. */
60
- export const deleteIndex = (Y) => {
61
- const ops = engineOps(Y);
62
- const idSet = (spans) => {
63
- const set = ops.idSet();
64
- for (const sp of spans)
65
- set.add(sp.c, sp.k, sp.n);
66
- return set;
67
- };
68
- /** Each item of `spans`, split at their edges. */
69
- const each = (tr, spans, fn) => ops.iterate(tr, idSet(spans), fn);
70
- // ── the index ──────────────────────────────────────────────────────
71
- /** `sp` as the root spans of its characters, in order (its own ids where it is no copy). */
72
- const rootSpans = (s, sp) => {
73
- const out = [];
74
- let k = sp.k;
75
- const end = sp.k + sp.n;
76
- const copies = (s.copies.get(sp.c) ?? []).filter((e) => overlaps(e, sp));
77
- for (const e of copies.sort((a, b) => a.k - b.k)) {
78
- const lo = Math.max(k, e.k);
79
- const hi = Math.min(end, e.k + e.n);
80
- if (lo > k)
81
- out.push({ c: sp.c, k, n: lo - k });
82
- out.push({ c: e.rc, k: e.rk + lo - e.k, n: hi - lo });
83
- k = hi;
84
- }
85
- if (end > k)
86
- out.push({ c: sp.c, k, n: end - k });
87
- return out;
88
- };
89
- /** Every member of root span `r`'s characters: the root itself and each copy. */
90
- const members = (s, r) => [
91
- { ...r, rk: r.k },
92
- ...(s.byRoot.get(r.c) ?? [])
93
- .filter((e) => overlaps({ k: e.rk, n: e.n }, r))
94
- .map((e) => clip({ c: e.c, k: e.k, n: e.n, rk: e.rk }, Math.max(r.k, e.rk), Math.min(r.k + r.n, e.rk + e.n)))
95
- ];
96
- /** The live parts of member `m`, in root coordinates. */
97
- const liveRoots = (s, m) => {
98
- const out = [];
99
- walkIdSet(Y, s.doc, idSet([m]), (st, lo, hi) => {
100
- if (!st.deleted && hi > lo)
101
- out.push({ c: m.c, k: m.rk + lo - m.k, n: hi - lo });
102
- });
103
- return out;
104
- };
105
- /** The live ids showing root spans `roots`. */
106
- const shown = (s, roots) => roots.flatMap((r) => members(s, r).flatMap((m) => liveRoots(s, m).map((p) => clip(m, p.k, p.k + p.n))));
107
- /** The live index of id `c:k` in its text (YATA order: the same on every replica). */
108
- const indexOf = (s, c, k) => Y.indexOfId(asYDoc(s.doc), Y.createID(c, k))?.index ?? Infinity;
109
- /**
110
- * List order of ids `a` and `b` of one text (negative: `a` first): their
111
- * live indices, and where no live unit separates them, the walk from one
112
- * to the other through the dead run between them.
113
- */
114
- const order = (s, a, b) => {
115
- const d = indexOf(s, a.c, a.k) - indexOf(s, b.c, b.k);
116
- if (d !== 0 || (a.c === b.c && a.k === b.k))
117
- return d;
118
- const find = (x) => structAt(Y, clientsOf(s.doc).get(x.c) ?? [], x.k);
119
- const [sa, sb] = [find(a), find(b)];
120
- if (sa === sb)
121
- return a.k - b.k;
122
- for (let it = sa?.right ?? null; it !== null; it = it.right) {
123
- if (it === sb)
124
- return -1;
125
- if (!it.deleted && it.countable !== false)
126
- break;
127
- }
128
- return 1;
129
- };
130
- /**
131
- * What restores root span `r`: per character, the leftmost leaf of its
132
- * lineage (a member no copy was made of). A copy sits right before what it
133
- * copied, so leaves are the newest incarnations, and the leftmost one is
134
- * where the leftmost-wins deduplication keeps its neighbours.
135
- */
136
- const leaves = (s, r) => {
137
- const ms = members(s, r);
138
- if (ms.length === 1)
139
- return ms;
140
- const copied = (m, rk) => {
141
- const id = m.k + rk - m.rk;
142
- return (s.byOrigin.get(m.c) ?? []).some((e) => e.ok <= id && id < e.ok + e.n);
143
- };
144
- // A leaf beside a shown neighbour of the same copy puts the character back
145
- // among the neighbours it was restored with.
146
- const beside = (m, rk) => {
147
- const id = m.k + rk - m.rk;
148
- const e = (s.copies.get(m.c) ?? []).find((x) => x.k <= id && id < x.k + x.n);
149
- const lo = e?.k ?? -Infinity;
150
- const hi = e === undefined ? Infinity : e.k + e.n;
151
- return [id - 1, id + 1].some((k) => k >= lo && k < hi && structAt(Y, clientsOf(s.doc).get(m.c) ?? [], k)?.deleted === false);
152
- };
153
- const out = [];
154
- for (let rk = r.k; rk < r.k + r.n; rk++) {
155
- let best = null;
156
- let near = false;
157
- for (const m of ms) {
158
- if (rk < m.rk || rk >= m.rk + m.n || copied(m, rk))
159
- continue;
160
- const id = { c: m.c, k: m.k + rk - m.rk };
161
- const b = beside(m, rk);
162
- if (best === null ||
163
- (b && !near) ||
164
- (b === near && order(s, id, { c: best.c, k: best.k + rk - best.rk }) < 0))
165
- [best, near] = [m, b];
166
- }
167
- if (best === null)
168
- continue;
169
- const last = out[out.length - 1];
170
- if (last !== undefined &&
171
- last.c === best.c &&
172
- last.rk + last.n === rk &&
173
- last.k + last.n === best.k + rk - best.rk)
174
- last.n++;
175
- else
176
- out.push(clip(best, rk, rk + 1));
177
- }
178
- return out;
179
- };
180
- /** Whether the record `r` is live (the struct holding it is not deleted). */
181
- const alive = (s, r) => structAt(Y, clientsOf(s.doc).get(r.client) ?? [], r.clock)?.deleted === false;
182
- /** Every hold on root characters of client `c`. */
183
- const heldOf = (s, c) => [...(s.held.get(c)?.values() ?? [])].flat();
184
- /** Live marks holding any character of `r`, except those `skip` names. */
185
- const holders = (s, r, skip) => heldOf(s, r.c)
186
- .filter((h) => overlaps(h, r) && !skip?.(h.mark) && alive(s, h.mark))
187
- .map((h) => h.mark);
188
- /** `r` without the spans `done`. */
189
- const minus = (r, done) => {
190
- let out = [r];
191
- for (const d of done)
192
- if (d.c === r.c)
193
- out = out.flatMap((x) => {
194
- if (!overlaps(x, d))
195
- return [x];
196
- const keep = [];
197
- if (d.k > x.k)
198
- keep.push({ c: x.c, k: x.k, n: d.k - x.k });
199
- if (d.k + d.n < x.k + x.n)
200
- keep.push({ c: x.c, k: d.k + d.n, n: x.k + x.n - d.k - d.n });
201
- return keep;
202
- });
203
- return out;
204
- };
205
- /** `r` cut where a live hold or a shown copy starts or ends: parts of one status each. */
206
- const parts = (s, r) => {
207
- const cuts = new Set([r.k, r.k + r.n]);
208
- const edge = (k) => k > r.k && k < r.k + r.n && cuts.add(k);
209
- for (const h of heldOf(s, r.c))
210
- if (overlaps(h, r) && alive(s, h.mark))
211
- [h.k, h.k + h.n].forEach(edge);
212
- for (const m of members(s, r))
213
- for (const p of liveRoots(s, m))
214
- [p.k, p.k + p.n].forEach(edge);
215
- const at = [...cuts].sort((a, b) => a - b);
216
- return at.slice(1).map((hi, i) => ({ c: r.c, k: at[i], n: hi - at[i] }));
217
- };
218
- /** Index `copies`; the ones that were new. */
219
- const addCopies = (s, copies) => copies.filter((e) => {
220
- const key = `${e.c}:${e.k}`;
221
- if (s.copyKeys.has(key))
222
- return false;
223
- s.copyKeys.add(key);
224
- push(s.copies, e.c, e);
225
- push(s.byRoot, e.rc, e);
226
- push(s.byOrigin, e.oc, e);
227
- return true;
228
- });
229
- const indexRecord = (s, rec, bytes) => addCopies(s, decode(bytes, 6).map(([k, n, rc, rk, oc, ok]) => ({ c: rec.client, k, n, rc, rk, oc, ok })));
230
- const indexMark = (s, mark, bytes) => {
231
- const key = keyOf(mark);
232
- if (s.holds.has(key))
233
- return false;
234
- const roots = decode(bytes, 3).flatMap(([c, k, n]) => rootSpans(s, { c, k, n }));
235
- s.holds.set(key, roots);
236
- for (const r of roots) {
237
- let byMark = s.held.get(r.c);
238
- if (byMark === undefined)
239
- s.held.set(r.c, (byMark = new Map()));
240
- const list = byMark.get(key);
241
- if (list === undefined)
242
- byMark.set(key, [{ k: r.k, n: r.n, mark }]);
243
- else
244
- list.push({ k: r.k, n: r.n, mark });
245
- }
246
- return true;
247
- };
248
- /** Drop the marks `marks` from the index (by mark: folded delete records drop one per delete); whether any was indexed. */
249
- const dropMarks = (s, marks) => {
250
- let any = false;
251
- for (const key of marks.map(keyOf)) {
252
- const roots = s.holds.get(key);
253
- if (roots === undefined)
254
- continue;
255
- any = true;
256
- s.holds.delete(key);
257
- for (const r of roots) {
258
- const byMark = s.held.get(r.c);
259
- byMark?.delete(key);
260
- if (byMark?.size === 0)
261
- s.held.delete(r.c);
262
- }
263
- }
264
- return any;
265
- };
266
- /** The records `st` (a struct of a records list) holds that `ids` names, with their bytes. */
267
- const recordsIn = (st, ids) => {
268
- const content = st.content?.getContent?.() ?? [];
269
- const out = [];
270
- for (let j = 0; j < st.length; j++) {
271
- const r = { client: st.id.client, clock: st.id.clock + j };
272
- // A collected record (its content gone) names nothing.
273
- if (!(content[j] instanceof Uint8Array))
274
- continue;
275
- if (ids === null || ids.has(r.client, r.clock))
276
- out.push([r, content[j]]);
277
- }
278
- return out;
279
- };
280
- /** Index the records `tr` wrote (restorations first: a mark's roots may need them). */
281
- const sync = (s, tr) => {
282
- const fresh = { copies: [], marks: [], released: false };
283
- if (!tr.changed.has(s.marks) && !tr.changed.has(s.restored))
284
- return fresh;
285
- const inserted = [];
286
- walkIdSet(Y, s.doc, tr.insertSet, (st) => {
287
- if (st.parent === s.restored || st.parent === s.marks)
288
- inserted.push(st);
289
- });
290
- for (const st of inserted)
291
- if (st.parent === s.restored && !st.deleted)
292
- for (const [r, bytes] of recordsIn(st, tr.insertSet))
293
- fresh.copies.push(...indexRecord(s, r, bytes));
294
- for (const st of inserted)
295
- if (st.parent === s.marks && !st.deleted)
296
- for (const [r, bytes] of recordsIn(st, tr.insertSet))
297
- if (indexMark(s, r, bytes))
298
- fresh.marks.push(r);
299
- const dropped = [];
300
- walkIdSet(Y, s.doc, tr.deleteSet, (st) => {
301
- if (st.parent === s.marks)
302
- for (const [r] of recordsIn(st, tr.deleteSet))
303
- dropped.push(r);
304
- // A restoration record only the purge deletes: its copies are
305
- // forgotten and collected on every replica, as on the room.
306
- if (st.parent === s.restored && !tr.insertSet.has(st.id.client, st.id.clock))
307
- for (const [r, bytes] of recordsIn(st, null)) {
308
- const copies = copiesOf(r, bytes);
309
- forget(s, copies);
310
- collect(s, tr, copies);
311
- }
312
- });
313
- fresh.released = dropMarks(s, dropped);
314
- return fresh;
315
- };
316
- /** The copies record `r` names. */
317
- const copiesOf = (r, bytes) => decode(bytes, 6).map(([k, n, rc, rk, oc, ok]) => ({ c: r.client, k, n, rc, rk, oc, ok }));
318
- /** Drop `copies` from the index: the `gcFilter` no longer keeps them. */
319
- const forget = (s, copies) => {
320
- const gone = new Set(copies.map((e) => `${e.c}:${e.k}`));
321
- const keep = (e) => !gone.has(`${e.c}:${e.k}`);
322
- for (const map of [s.copies, s.byRoot, s.byOrigin])
323
- for (const [c, list] of map)
324
- map.set(c, list.filter(keep));
325
- for (const key of gone)
326
- s.copyKeys.delete(key);
327
- };
328
- /** Collect the deleted items wholly inside `copies` (none a history keeps). */
329
- const collect = (s, tr, copies) => {
330
- if (!collects(s.doc) || copies.length === 0)
331
- return;
332
- walkIdSet(Y, s.doc, idSet(copies), (st) => {
333
- const it = st;
334
- const inside = copies.some((e) => e.c === it.id.client && e.k <= it.id.clock && it.id.clock + it.length <= e.k + e.n);
335
- if (inside &&
336
- it.deleted &&
337
- it.keep !== true &&
338
- it.parent !== undefined &&
339
- collectable(s.doc, it))
340
- collectNow(it, tr);
341
- });
342
- };
343
- return {
344
- idSet,
345
- each,
346
- rootSpans,
347
- members,
348
- liveRoots,
349
- shown,
350
- indexOf,
351
- leaves,
352
- holders,
353
- minus,
354
- parts,
355
- addCopies,
356
- indexRecord,
357
- indexMark,
358
- dropMarks,
359
- recordsIn,
360
- sync,
361
- copiesOf,
362
- forget,
363
- collect
364
- };
365
- };
@@ -1,76 +0,0 @@
1
- /**
2
- * Per-writer text delete marks — the block delete marks' rule applied to text.
3
- *
4
- * Deleting text tombstones its engine items, and an undo brings
5
- * text back as COPIES (new items). The engine records no writer for a
6
- * delete, so two writers who deleted the same character concurrently could
7
- * not tell each other's delete from their own: one undo brought it back
8
- * although the other writer's delete still held it, and the second undo
9
- * brought a second copy. A mark names the writer: every text delete writes
10
- * one record (its engine client is the writer) listing the characters it
11
- * deleted. Records sit in the history's scope — an undo deletes the undoer's
12
- * own record and a redo writes a copy of it — so a live record is exactly
13
- * "this writer's delete is in effect".
14
- *
15
- * The rule: a character is visible iff no writer's delete of it is in
16
- * effect, and at most one copy of it is visible. A character keeps one
17
- * identity across copies, its ROOT (the original item): every restoration
18
- * writes a record naming, for each copy, the member it copied and the root
19
- * (never removed). A character is restored by copying its newest member —
20
- * the leaf of that lineage, where its neighbours' copies are — so restored
21
- * text keeps its order whoever restores it. Every decision is made by the
22
- * replica whose fact it is, never on another replica's stale state:
23
- *
24
- * - restoring (the undoing history): the history hands every text unit of a
25
- * replayed step to `restoreFilter`, which withholds it, and `onApply`
26
- * restores each character of the step no other live mark holds and no
27
- * copy shows, once. A character another mark holds stays PENDING on that
28
- * history, which restores it once no mark holds it and no copy shows (two
29
- * writers undid a double delete concurrently, each withheld by the other);
30
- * - holding (the mark's writer): a copy that appears while the writer's
31
- * mark holds its character — a peer undid without having seen the delete
32
- * — is deleted by that writer, as part of the marked step (so its undo
33
- * brings the character back). A delete, and a redo that writes its mark
34
- * again, hide the character's other visible copies in the same step;
35
- * - deduplicating (the copy's writer): a replica deletes its own copy when a
36
- * copy with a smaller id shows the same character (concurrent
37
- * restorations; the smaller one wins).
38
- *
39
- * Writes a local step needs join it (`onApply`, the facade's delete), so an
40
- * undo stays one update. Writes a REMOTE change calls for run in one
41
- * follow-up transaction under an origin no history tracks, like the
42
- * engine's formatting cleanup (fork patch YP10). Pending characters, holding and
43
- * deduplication are session facts: a writer whose history ended no longer
44
- * hides a concurrent restoration, though its live mark still withholds every
45
- * later undo.
46
- *
47
- * The index of marks and copies is `text/delete-index.ts`; this module
48
- * writes the marks, restores, holds and deduplicates.
49
- */
50
- import type { EngineApi, EngineDoc, EngineNode, YUndoManager } from '../engine-api.js';
51
- import { type State, type Step, type Tr } from './delete-index.js';
52
- /** Engine ids `c:k … c:k+n-1`. */
53
- export type Span = {
54
- c: number;
55
- k: number;
56
- n: number;
57
- };
58
- export declare const bindDeletes: (Y: EngineApi) => {
59
- /** The history's extra scope: the marks (an undo removes its own). */
60
- scope: (doc: EngineDoc) => EngineNode;
61
- /**
62
- * Mark `spans` (the characters a text delete just deleted, inside its
63
- * transaction) as this writer's, and hide their other visible copies.
64
- */
65
- markDeleted: (doc: EngineDoc, deleted: readonly Span[]) => void;
66
- /** A doc's index of marks and copies, and the delete the purge writes (`purge.ts`). */
67
- state: (doc: EngineDoc) => State;
68
- remove: (tr: Tr, live: readonly Span[], into?: Step, keep?: boolean) => void;
69
- /** The restore and apply rules of a history on `doc` (`doc/history.ts`). */
70
- history: (doc: EngineDoc, um: () => YUndoManager) => {
71
- /** Text units are restored by `onApply`, character by character. */
72
- restoreFilter: (item: unknown) => boolean;
73
- onApply: (transaction: unknown, stackItem: unknown) => void;
74
- };
75
- };
76
- export type TextDeletes = ReturnType<typeof bindDeletes>;