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,8 +6,9 @@ import { onCut } from './events/onCut.js';
6
6
  import { isControlEvent, isKindControl } from './events/nativeInteractiveControl.js';
7
7
  import { onInput } from './events/onInput.js';
8
8
  import { onPaste } from './events/onPaste.js';
9
- import { onDragLeave, onTextDragEnd, onTextDragStart, preventUnsupportedDrop } from './events/onDrop.js';
9
+ import { onTextDragEnd, onTextDragStart, preventUnsupportedDrop } from './events/onDrop.js';
10
10
  import { attachFocus, selectionIsInside, takeKeys } from './events/onFocus.js';
11
+ import { attachPageHide } from './events/onPageHide.js';
11
12
  import { insertLineBreak, runIntent } from './events/beforeInputCommands.js';
12
13
  import { textPointAt } from './selection/selection.utils.js';
13
14
  import { Attempts } from './session/attempt.js';
@@ -29,7 +30,7 @@ import Announcer from './components/Announcer.svelte';
29
30
  import RemoteSelections from './collaboration/RemoteSelections.svelte';
30
31
  import Ranges from './components/Ranges.svelte';
31
32
  import { Handles } from './session/handles.js';
32
- import { id } from './utils.js';
33
+ import { cleanups, id } from './utils.js';
33
34
  import { Y } from './crdt/engine.js';
34
35
  import { markName } from './crdt/text/marks.js';
35
36
  import { callEach } from './crdt/protocols/observable.js';
@@ -193,11 +194,10 @@ export class Edytor {
193
194
  // CRDT (v14) — the document is the composition owner: it holds the ONE
194
195
  // engine doc, the shared facade (only structural read/write surface),
195
196
  // the default local history and the shared awareness. Injected
196
- // documents are borrowed; a view with no `document` option internally
197
- // owns one (built around `doc`/`awareness` when those are injected).
197
+ // documents are borrowed; a view with no `document` option owns a fresh one.
198
198
  document;
199
- /** @internal `true` when this view created its document — `destroy()` then releases it. */
200
- ownsDocument = false;
199
+ /** `true` when this view created its document — `destroy()` then releases it. */
200
+ #owned = false;
201
201
  get doc() {
202
202
  return this.document.doc;
203
203
  }
@@ -297,7 +297,7 @@ export class Edytor {
297
297
  this.dispatcher.record({ operation: command, status: this.history.replay(command) });
298
298
  };
299
299
  constructor(options) {
300
- const { readonly, hotkeys, plugins, document, doc, awareness, actor, requireHydration, presence, sync, value, onSelectionChange, labels, onChange, onDocChange, allowNesting } = options;
300
+ const { readonly, hotkeys, plugins, document, actor, requireHydration, presence, sync, value, onSelectionChange, labels, onChange, onDocChange, allowNesting } = options;
301
301
  for (const name of DOCUMENT_WRITES)
302
302
  Object.defineProperty(this, name, {
303
303
  value: (...args) => this.dispatcher.operate(name, args)
@@ -306,21 +306,14 @@ export class Edytor {
306
306
  this.labels = labels;
307
307
  this.allowNesting = allowNesting === true;
308
308
  if (document !== undefined) {
309
- if (DEV &&
310
- (doc !== undefined ||
311
- awareness !== undefined ||
312
- actor !== undefined ||
313
- requireHydration !== undefined)) {
314
- throw new Error('EdytorOptions: `document` cannot be combined with `doc`/`awareness`/`actor`/`requireHydration` — ' +
315
- 'the document owns them (compose them via attachDocument first).');
309
+ if (DEV && (actor !== undefined || requireHydration !== undefined)) {
310
+ throw new Error('EdytorOptions: `document` cannot be combined with `actor`/`requireHydration`: set them on the document.');
316
311
  }
317
312
  this.document = document;
318
313
  }
319
314
  else {
320
- // Legacy path — the view internally owns a document composed
321
- // around the injected (or a fresh) doc/awareness.
322
- this.document = attachDocument(doc ?? new Y.Doc(), { awareness, actor, requireHydration });
323
- this.ownsDocument = true;
315
+ this.document = attachDocument(new Y.Doc(), { actor, requireHydration });
316
+ this.#owned = true;
324
317
  }
325
318
  this.readonly = readonly || false;
326
319
  this.onChange = onChange;
@@ -388,7 +381,7 @@ export class Edytor {
388
381
  // decision; every other view binds on the one readiness event
389
382
  // (`<Edytor>` decides an injected document at mount, once the
390
383
  // providers of its sibling views attached).
391
- if (this.ownsDocument && !sync) {
384
+ if (this.#owned && !sync) {
392
385
  this.sync(value || { children: [] });
393
386
  }
394
387
  else {
@@ -409,7 +402,7 @@ export class Edytor {
409
402
  // document-lifetime additive declarations, and an injected
410
403
  // document's are left for the views that legitimately share it.
411
404
  this.document.untrackOrigin(this.transaction);
412
- if (this.ownsDocument) {
405
+ if (this.#owned) {
413
406
  this.document.destroy();
414
407
  }
415
408
  throw error;
@@ -611,9 +604,7 @@ export class Edytor {
611
604
  // A failed async handler (a command's hook or write) surfaces
612
605
  // through the platform's error reporting; the DOM ignores
613
606
  // the listener's promise.
614
- void Promise.resolve(result)
615
- .finally(clear)
616
- .catch((error) => typeof reportError === 'function' ? reportError(error) : console.error(error));
607
+ void Promise.resolve(result).finally(clear).catch(reportError);
617
608
  }
618
609
  else {
619
610
  clear();
@@ -804,7 +795,9 @@ export class Edytor {
804
795
  keydown(event);
805
796
  }),
806
797
  // Pointer and focus ownership, and the focus-time caret restore.
807
- ...attachFocus(this, node), on(node, 'mousedown', this.selection.pointer.preventTripleClick), on(node, 'click', this.selection.pointer.tripleClick),
798
+ ...attachFocus(this, node),
799
+ // The page leaving for good ends the session's history.
800
+ attachPageHide(this), on(node, 'mousedown', this.selection.pointer.preventTripleClick), on(node, 'click', this.selection.pointer.tripleClick),
808
801
  // Settle queued mutation repairs before the native menu opens —
809
802
  // spellcheck suggestions are computed against the DOM at this
810
803
  // moment (PM flushes its DOM observer on contextmenu for the
@@ -812,7 +805,7 @@ export class Edytor {
812
805
  on(node, 'contextmenu', () => void this.surface.flush()), on(node, 'beforeinput', this.#withUserInput(this.onBeforeInput)),
813
806
  // An `input` records what the browser did; it says nothing new about
814
807
  // where the user wants the selection (a display still to land wins).
815
- on(node, 'input', this.#withUserInput(this.onInput, { bumpSerial: false })), on(node, 'copy', this.onCopy), on(node, 'cut', this.#withUserInput(this.onCut)), on(node, 'paste', this.#withUserInput(this.onPaste)), on(node, 'dragstart', (event) => onTextDragStart(this, event)), on(node, 'dragend', () => onTextDragEnd(this)), on(node, 'dragover', (event) => preventUnsupportedDrop(event, this)), on(node, 'dragleave', (event) => onDragLeave(this, event)), on(node, 'drop', this.#withUserInput((event) => preventUnsupportedDrop(event, this))), on(node, 'compositionstart', this.onCompositionStart), on(node, 'compositionend', this.onCompositionEnd), detachSurface);
808
+ on(node, 'input', this.#withUserInput(this.onInput, { bumpSerial: false })), on(node, 'copy', this.onCopy), on(node, 'cut', this.#withUserInput(this.onCut)), on(node, 'paste', this.#withUserInput(this.onPaste)), on(node, 'dragstart', (event) => onTextDragStart(this, event)), on(node, 'dragend', () => onTextDragEnd(this)), on(node, 'dragover', (event) => preventUnsupportedDrop(event, this)), on(node, 'drop', this.#withUserInput((event) => preventUnsupportedDrop(event, this))), on(node, 'compositionstart', this.onCompositionStart), on(node, 'compositionend', this.onCompositionEnd), detachSurface);
816
809
  // Chrome lives in the overlay, outside the host: remote carets, then the plugins'.
817
810
  const detachOverlay = this.overlay.attach(node);
818
811
  const presence = mount(RemoteSelections, {
@@ -830,11 +823,7 @@ export class Edytor {
830
823
  props: { announcer: this.announcer }
831
824
  });
832
825
  this.off.push(() => unmount(presence), () => unmount(ranges), () => unmount(live), detachOverlay);
833
- this.plugins.forEach((plugin) => {
834
- const action = plugin.onEdytorAttached?.({ node });
835
- if (typeof action === 'function')
836
- this.off.push(action);
837
- });
826
+ this.off.push(...cleanups(this.plugins, (plugin) => plugin.onEdytorAttached?.({ node })));
838
827
  return {
839
828
  destroy: () => {
840
829
  if (selectionIsInside(node))
@@ -864,7 +853,7 @@ export class Edytor {
864
853
  * discarded.
865
854
  *
866
855
  * Releases every listener the editor holds on potentially-SHARED objects
867
- * — an injected doc/awareness outlives a single editor, so an
856
+ * — an injected document outlives a single editor, so an
868
857
  * undestroyed mount leaks a facade `update` listener and the undo
869
858
  * manager's doc observers forever.
870
859
  *
@@ -908,7 +897,7 @@ export class Edytor {
908
897
  // awareness, doc) belong to the document — released exactly once,
909
898
  // and only when THIS view created it. A borrowed document keeps
910
899
  // serving its sibling views and headless consumers.
911
- if (this.ownsDocument) {
900
+ if (this.#owned) {
912
901
  this.document.destroy();
913
902
  }
914
903
  };
@@ -209,14 +209,14 @@ const splitKeepingChildren = (edytor, [id, offset, born, tail], child) => {
209
209
  return REFUSED;
210
210
  if (!child)
211
211
  return facade.compose({ ...split, writes: [step] });
212
- // The rank of a first child, and the document's answer on placing the kind there.
212
+ // The document's answer on placing the kind as a first child.
213
213
  const slot = facade.prepare.insertBlocks({ parent: id, index: 0 }, [
214
214
  { id: born, type: tail?.type ?? facade.defaultChild(id) }
215
215
  ]);
216
216
  const first = 'writes' in slot ? slot.writes[0] : undefined;
217
217
  if (first?.op !== 'insertBlocks')
218
218
  return REFUSED;
219
- const placed = { ...step, parent: id, rank: first.ranks[0] };
219
+ const placed = { ...step, parent: id, index: 0 };
220
220
  return facade.compose({ ...split, writes: [placed] });
221
221
  };
222
222
  /**
@@ -7,7 +7,7 @@ import { isAndroidChromeBrowser } from './events.utils.js';
7
7
  import { isNativeInteractiveControl, isNativeInteractiveEvent, ownsEvent } from './nativeInteractiveControl.js';
8
8
  import { runBeforeInputCommand } from './beforeInputCommands.js';
9
9
  import { deleteInText } from './beforeInputDeleteCommands.js';
10
- import { readDomText } from './onInput.js';
10
+ import { readDomText } from '../surface/observer.svelte.js';
11
11
  /** The Android no-op-Backspace and model-owned drift deadlines (named, counted browser rules). */
12
12
  const NATIVE_INPUT_REPAIR_WINDOW_MS = 150;
13
13
  const dirOf = (inputType) => INTENTS[inputType]?.dir;
@@ -31,9 +31,3 @@ export declare const onTextDragEnd: (edytor: Edytor) => undefined;
31
31
  * which is the control's (`isControlDrop`).
32
32
  */
33
33
  export declare const preventUnsupportedDrop: (event: DragEvent, edytor: Edytor) => void | Promise<void>;
34
- /**
35
- * A drag leaving the host (to the page around it, or out of the window):
36
- * a file drag's indicator goes. Moving between the host's own elements is
37
- * no leave.
38
- */
39
- export declare const onDragLeave: (edytor: Edytor, event: DragEvent) => void;
@@ -13,8 +13,9 @@ import { viewUploads } from '../session/uploads.js';
13
13
  * `Files` is intentionally accepted (so the browser never opens a dropped
14
14
  * file in place of the page): with the view's uploads (a media plugin given
15
15
  * an `upload`), file drops route through the plugin `onPaste` hook with the
16
- * drop indicator's placement (`ViewUploads.drop`: a block per file the kinds
17
- * take there; unclaimed files insert nothing); without them a drop carrying
16
+ * placement the uploads' drop target resolved (`ViewUploads.drop`, Pragmatic's
17
+ * external adapter: a block per file the kinds take there; unclaimed files
18
+ * insert nothing); without them a drop carrying
18
19
  * files is ignored, its effect `none`.
19
20
  */
20
21
  const ACCEPTED_FOREIGN_DROP_TYPES = ['Files', 'text/html', 'text/plain', 'text/uri-list'];
@@ -188,21 +189,19 @@ export const preventUnsupportedDrop = (event, edytor) => {
188
189
  if (isAcceptedForeignDrop(root, event.dataTransfer)) {
189
190
  event.preventDefault();
190
191
  event.stopPropagation();
191
- // Files show where they land (the block drag's indicator); none in a
192
- // read-only view or one without uploads, which takes no file drop (the
193
- // browser must not open the file).
194
- const shown = drop && !ownsEvent(root, event) && drop.over(event);
192
+ // Where files land shows from the uploads' drop target (Pragmatic's
193
+ // external adapter); a read-only view or one without uploads takes no
194
+ // file drop, and the browser must not open the file.
195
195
  if (event.dataTransfer)
196
196
  event.dataTransfer.dropEffect = files && (edytor.readonly || !drop) ? 'none' : 'copy';
197
- if (drop && !shown)
198
- drop.end();
199
197
  }
200
198
  return;
201
199
  }
202
200
  const accepted = isAcceptedForeignDrop(root, event.dataTransfer);
203
- // Where the files land: the indicator's placement, re-resolved at the drop point.
204
- const at = drop && accepted && !ownsEvent(root, event) ? drop.at(event) : null;
205
- drop?.end();
201
+ // Where the files land: the placement the uploads' drop target resolved at
202
+ // the drop point (its window listener captures, so it ran first).
203
+ const placed = drop?.take() ?? null;
204
+ const at = accepted && !ownsEvent(root, event) ? placed : null;
206
205
  if (accepted && isControlDrop(root, event))
207
206
  return;
208
207
  event.preventDefault();
@@ -219,15 +218,3 @@ export const preventUnsupportedDrop = (event, edytor) => {
219
218
  if (!edytor.isComposing)
220
219
  return insertFromDrop(edytor, root, event, at);
221
220
  };
222
- /**
223
- * A drag leaving the host (to the page around it, or out of the window):
224
- * a file drag's indicator goes. Moving between the host's own elements is
225
- * no leave.
226
- */
227
- export const onDragLeave = (edytor, event) => {
228
- const root = event.currentTarget;
229
- const to = event.relatedTarget;
230
- if (to instanceof Node && root.contains(to))
231
- return;
232
- viewUploads(edytor)?.drop.end();
233
- };
@@ -1,16 +1,4 @@
1
1
  import type { Edytor } from '../edytor.svelte.js';
2
- import type { Text } from '../text/text.svelte.js';
3
- /**
4
- * What the browser shows for `text`: its element's text nodes in order (WebKit's
5
- * converted-space wrappers read as plain spaces), the empty filler and the
6
- * trailing-newline marker stripped.
7
- */
8
- export declare const readDomText: (text: Text) => string;
9
- export declare const getCollapsedDomTextSelection: (edytor: Edytor) => {
10
- text: Text;
11
- offset: number;
12
- } | null;
13
- export declare const handleNativeLineBreakTextValue: (edytor: Edytor, text: Text, value: string) => Promise<boolean>;
14
2
  /**
15
3
  * An `input` event. Browser-made text is never adopted here: the mutation
16
4
  * queue is the only adopter (a native line break there runs as its
@@ -1,76 +1,10 @@
1
- import { diffText } from '../utils/diffText.js';
2
- import { getDomSelectionSnapshot } from '../selection/domSelection.js';
3
- import { domOffsetIn } from '../selection/selection.utils.js';
4
1
  import { isControlEvent } from './nativeInteractiveControl.js';
5
- import { runOccurrence } from './onBeforeInput.js';
6
2
  import { attemptOf, kindOf } from '../session/attempt.js';
7
- const ZERO_WIDTH_SPACE = '\u200B';
8
- /**
9
- * What the browser shows for `text`: its element's text nodes in order (WebKit's
10
- * converted-space wrappers read as plain spaces), the empty filler and the
11
- * trailing-newline marker stripped.
12
- */
13
- export const readDomText = (text) => {
14
- let value = '';
15
- const node = text.node;
16
- if (node) {
17
- const walker = (node.ownerDocument ?? document).createTreeWalker(node, NodeFilter.SHOW_TEXT);
18
- while (walker.nextNode()) {
19
- const leaf = walker.currentNode;
20
- value += leaf.parentElement?.closest('span.Apple-converted-space')
21
- ? leaf.data.replaceAll('\u00A0', ' ')
22
- : leaf.data;
23
- }
24
- }
25
- // An empty text's filler shares its node with what the browser typed, on either side.
26
- if (text.isEmpty)
27
- return value.replaceAll(ZERO_WIDTH_SPACE, '');
28
- if (text.endsWithNewline && value.endsWith(ZERO_WIDTH_SPACE)) {
29
- value = value.slice(0, -ZERO_WIDTH_SPACE.length);
30
- }
31
- return value;
32
- };
33
- export const getCollapsedDomTextSelection = (edytor) => {
34
- const selection = getDomSelectionSnapshot(edytor.node);
35
- if (!selection?.anchorNode || !selection.isCollapsed) {
36
- return null;
37
- }
38
- if (!edytor.node?.contains(selection.anchorNode)) {
39
- return null;
40
- }
41
- const text = edytor.selection.getTextOfNode(selection.anchorNode);
42
- if (!text?.node) {
43
- return null;
44
- }
45
- // No model rule here: the DOM caret is read BEFORE the reconcile writes
46
- // the model, so a native insertion legitimately sits past `text.length`
47
- // (`selectText` clamps the final write).
48
- return { text, offset: domOffsetIn(text, selection.anchorNode, selection.anchorOffset) };
49
- };
3
+ import { getCollapsedDomTextSelection } from '../surface/observer.svelte.js';
50
4
  const getInputType = (event) => {
51
5
  const inputType = event.inputType;
52
6
  return typeof inputType === 'string' ? inputType : '';
53
7
  };
54
- const getNativeLineBreakInsertionIndexFromValue = (text, value) => {
55
- const change = diffText(text.stringContent, value);
56
- return change && !change.remove && /^[\r\n]+$/.test(change.insert) ? change.at : null;
57
- };
58
- export const handleNativeLineBreakTextValue = async (edytor, text, value) => {
59
- if (!text.isInDocument)
60
- return false;
61
- const insertionIndex = getNativeLineBreakInsertionIndexFromValue(text, value);
62
- if (insertionIndex === null) {
63
- return false;
64
- }
65
- // The native line break is the key's occurrence: its intent, run by the model.
66
- const inputType = edytor.attempts.confirm()?.inputType === 'insertLineBreak' || value.includes('\n')
67
- ? 'insertLineBreak'
68
- : 'insertParagraph';
69
- text.refreshFromModel();
70
- edytor.selection.selectText(text, insertionIndex);
71
- await runOccurrence(edytor, { inputType, cancelable: false });
72
- return true;
73
- };
74
8
  /**
75
9
  * An `input` no attempt expected (its engine sent no `beforeinput`): the
76
10
  * browser changed the text under its caret — a browser-owned attempt of its own.
@@ -0,0 +1,3 @@
1
+ import type { Edytor } from '../edytor.svelte.js';
2
+ /** End the view's session when its page leaves for good; answers the teardown. */
3
+ export declare const attachPageHide: (edytor: Edytor) => (() => void);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The page leaves for good (installed by `Edytor.attach`): a `pagehide` the
3
+ * back/forward cache keeps nothing of. The view tells its document the
4
+ * session's history ended (`document.endHistory()`, `hist.release.end`): the
5
+ * history's rule releases what the session deleted. A page the cache keeps
6
+ * may come back with its history, and a lost connection fires nothing here:
7
+ * both keep it.
8
+ *
9
+ * The page's lifecycle is the sync layer's (`onPageLeave`, which the
10
+ * providers leave by too): the view subscribes to its `write` phase, run
11
+ * before the providers' teardown whatever order they subscribed in, so the
12
+ * release goes out on a socket or store that is still open.
13
+ */
14
+ import { onPageLeave } from '../crdt/providers/room.js';
15
+ /** End the view's session when its page leaves for good; answers the teardown. */
16
+ export const attachPageHide = (edytor) => onPageLeave(() => edytor.document.endHistory(), 'write');