edytor 0.0.11 → 0.1.0-next.16

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 (371) hide show
  1. package/README.md +77 -197
  2. package/dist/block/block.svelte.d.ts +156 -69
  3. package/dist/block/block.svelte.js +324 -355
  4. package/dist/block/block.utils.d.ts +191 -24
  5. package/dist/block/block.utils.js +327 -460
  6. package/dist/block/contentRange.d.ts +4 -0
  7. package/dist/block/contentRange.js +20 -0
  8. package/dist/block/inlineBlock.svelte.d.ts +26 -19
  9. package/dist/block/inlineBlock.svelte.js +91 -39
  10. package/dist/clipboard/clipboard.d.ts +4 -0
  11. package/dist/clipboard/clipboard.js +4 -0
  12. package/dist/clipboard/createClipboardFragment.d.ts +3 -0
  13. package/dist/clipboard/createClipboardFragment.js +103 -0
  14. package/dist/clipboard/fragmentData.d.ts +6 -0
  15. package/dist/clipboard/fragmentData.js +74 -0
  16. package/dist/clipboard/htmlFlow.d.ts +22 -0
  17. package/dist/clipboard/htmlFlow.js +167 -0
  18. package/dist/clipboard/insertClipboardFragment.d.ts +18 -0
  19. package/dist/clipboard/insertClipboardFragment.js +48 -0
  20. package/dist/clipboard/serializeClipboardFragment.d.ts +7 -0
  21. package/dist/clipboard/serializeClipboardFragment.js +53 -0
  22. package/dist/clipboard/textBlocks.d.ts +23 -0
  23. package/dist/clipboard/textBlocks.js +103 -0
  24. package/dist/clipboard/types.d.ts +20 -0
  25. package/dist/clipboard/types.js +2 -0
  26. package/dist/cloudflare/DocumentRoom.d.ts +586 -0
  27. package/dist/cloudflare/DocumentRoom.js +1706 -0
  28. package/dist/cloudflare/index.d.ts +8 -0
  29. package/dist/cloudflare/index.js +8 -0
  30. package/dist/cloudflare/routeDocumentSocket.d.ts +33 -0
  31. package/dist/cloudflare/routeDocumentSocket.js +51 -0
  32. package/dist/collaboration/RemoteSelections.svelte +94 -0
  33. package/dist/collaboration/RemoteSelections.svelte.d.ts +7 -0
  34. package/dist/collaboration/awarenessSelection.d.ts +127 -0
  35. package/dist/collaboration/awarenessSelection.js +199 -0
  36. package/dist/collaboration/documentSync.d.ts +20 -0
  37. package/dist/collaboration/documentSync.js +13 -0
  38. package/dist/collaboration/index.d.ts +3 -0
  39. package/dist/collaboration/index.js +3 -0
  40. package/dist/collaboration/providers.d.ts +13 -0
  41. package/dist/collaboration/providers.js +21 -0
  42. package/dist/collaboration/remoteSelection.d.ts +21 -0
  43. package/dist/collaboration/remoteSelection.js +159 -0
  44. package/dist/components/Block.svelte +223 -15
  45. package/dist/components/Block.svelte.d.ts +4 -2
  46. package/dist/components/Content.svelte +128 -32
  47. package/dist/components/Content.svelte.d.ts +6 -2
  48. package/dist/components/Edytor.svelte +308 -110
  49. package/dist/components/Edytor.svelte.d.ts +64 -20
  50. package/dist/components/InlineBlock.svelte +38 -7
  51. package/dist/components/InlineBlock.svelte.d.ts +5 -2
  52. package/dist/components/Mark.svelte +29 -13
  53. package/dist/components/Mark.svelte.d.ts +4 -4
  54. package/dist/components/Suggestion.svelte +48 -0
  55. package/dist/components/Suggestion.svelte.d.ts +7 -0
  56. package/dist/components/SuggestionRanges.svelte +58 -0
  57. package/dist/components/SuggestionRanges.svelte.d.ts +7 -0
  58. package/dist/components/Text.svelte +107 -14
  59. package/dist/components/Text.svelte.d.ts +8 -1
  60. package/dist/constants.d.ts +0 -2
  61. package/dist/constants.js +0 -2
  62. package/dist/crdt/admission.d.ts +141 -0
  63. package/dist/crdt/admission.js +147 -0
  64. package/dist/crdt/anchors.d.ts +47 -0
  65. package/dist/crdt/anchors.js +42 -0
  66. package/dist/crdt/attribution/attribution.d.ts +169 -0
  67. package/dist/crdt/attribution/attribution.js +136 -0
  68. package/dist/crdt/attribution/block.d.ts +200 -0
  69. package/dist/crdt/attribution/block.js +327 -0
  70. package/dist/crdt/attribution/index.d.ts +9 -0
  71. package/dist/crdt/attribution/index.js +9 -0
  72. package/dist/crdt/data.d.ts +81 -0
  73. package/dist/crdt/data.js +383 -0
  74. package/dist/crdt/document.d.ts +590 -0
  75. package/dist/crdt/document.js +1160 -0
  76. package/dist/crdt/edytor-doc.d.ts +752 -0
  77. package/dist/crdt/edytor-doc.js +2382 -0
  78. package/dist/crdt/engine-api.d.ts +153 -0
  79. package/dist/crdt/engine.d.ts +37 -0
  80. package/dist/crdt/engine.js +50 -0
  81. package/dist/crdt/flow.d.ts +104 -0
  82. package/dist/crdt/flow.js +229 -0
  83. package/dist/crdt/index.d.ts +630 -0
  84. package/dist/crdt/index.js +168 -0
  85. package/dist/crdt/migration/legacy-schema.d.ts +61 -0
  86. package/dist/crdt/migration/legacy-schema.js +149 -0
  87. package/dist/crdt/migration/migrate.d.ts +67 -0
  88. package/dist/crdt/migration/migrate.js +219 -0
  89. package/dist/crdt/nodes.d.ts +120 -0
  90. package/dist/crdt/nodes.js +56 -0
  91. package/dist/crdt/placement/model.d.ts +383 -0
  92. package/dist/crdt/placement/model.js +811 -0
  93. package/dist/crdt/placement/rank.d.ts +57 -0
  94. package/dist/crdt/placement/rank.js +209 -0
  95. package/dist/crdt/protocols/auth.d.ts +28 -0
  96. package/dist/crdt/protocols/auth.js +43 -0
  97. package/dist/crdt/protocols/awareness.d.ts +87 -0
  98. package/dist/crdt/protocols/awareness.js +271 -0
  99. package/dist/crdt/protocols/envelope.d.ts +75 -0
  100. package/dist/crdt/protocols/envelope.js +89 -0
  101. package/dist/crdt/protocols/observable.d.ts +19 -0
  102. package/dist/crdt/protocols/observable.js +26 -0
  103. package/dist/crdt/protocols/sync.d.ts +82 -0
  104. package/dist/crdt/protocols/sync.js +288 -0
  105. package/dist/crdt/providers/container.d.ts +23 -0
  106. package/dist/crdt/providers/container.js +64 -0
  107. package/dist/crdt/providers/index.d.ts +282 -0
  108. package/dist/crdt/providers/index.js +118 -0
  109. package/dist/crdt/providers/indexeddb.d.ts +196 -0
  110. package/dist/crdt/providers/indexeddb.js +332 -0
  111. package/dist/crdt/providers/room.d.ts +193 -0
  112. package/dist/crdt/providers/room.js +444 -0
  113. package/dist/crdt/providers/websocket.d.ts +223 -0
  114. package/dist/crdt/providers/websocket.js +601 -0
  115. package/dist/crdt/rand.d.ts +22 -0
  116. package/dist/crdt/rand.js +22 -0
  117. package/dist/crdt/rangeDelete.d.ts +85 -0
  118. package/dist/crdt/rangeDelete.js +126 -0
  119. package/dist/crdt/schema.d.ts +96 -0
  120. package/dist/crdt/schema.js +79 -0
  121. package/dist/crdt/semantics.d.ts +81 -0
  122. package/dist/crdt/semantics.js +57 -0
  123. package/dist/crdt/structs.d.ts +106 -0
  124. package/dist/crdt/structs.js +119 -0
  125. package/dist/crdt/text/deletes.d.ts +23 -0
  126. package/dist/crdt/text/deletes.js +608 -0
  127. package/dist/crdt/text/model.d.ts +280 -0
  128. package/dist/crdt/text/model.js +554 -0
  129. package/dist/crdt/text/runs.d.ts +212 -0
  130. package/dist/crdt/text/runs.js +1142 -0
  131. package/dist/crdt/vendor/yjs/API-NOTES.md +59 -0
  132. package/dist/crdt/vendor/yjs/LICENSE +23 -0
  133. package/dist/crdt/vendor/yjs/UPSTREAM.md +653 -0
  134. package/dist/crdt/vendor/yjs/dts/global.d.ts +52 -0
  135. package/dist/crdt/vendor/yjs/dts/index.d.ts +25 -0
  136. package/dist/crdt/vendor/yjs/dts/structs/AbstractStruct.d.ts +38 -0
  137. package/dist/crdt/vendor/yjs/dts/structs/GC.d.ts +25 -0
  138. package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +748 -0
  139. package/dist/crdt/vendor/yjs/dts/structs/Skip.d.ts +30 -0
  140. package/dist/crdt/vendor/yjs/dts/utils/BlockSet.d.ts +34 -0
  141. package/dist/crdt/vendor/yjs/dts/utils/Doc.d.ts +198 -0
  142. package/dist/crdt/vendor/yjs/dts/utils/EventHandler.d.ts +17 -0
  143. package/dist/crdt/vendor/yjs/dts/utils/ID.d.ts +20 -0
  144. package/dist/crdt/vendor/yjs/dts/utils/RangeCursor.d.ts +198 -0
  145. package/dist/crdt/vendor/yjs/dts/utils/RelativePosition.d.ts +80 -0
  146. package/dist/crdt/vendor/yjs/dts/utils/StructStore.d.ts +61 -0
  147. package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +129 -0
  148. package/dist/crdt/vendor/yjs/dts/utils/UndoManager.d.ts +205 -0
  149. package/dist/crdt/vendor/yjs/dts/utils/UpdateDecoder.d.ts +170 -0
  150. package/dist/crdt/vendor/yjs/dts/utils/UpdateEncoder.d.ts +164 -0
  151. package/dist/crdt/vendor/yjs/dts/utils/YEvent.d.ts +93 -0
  152. package/dist/crdt/vendor/yjs/dts/utils/content-helper.d.ts +1 -0
  153. package/dist/crdt/vendor/yjs/dts/utils/encoding-helpers.d.ts +5 -0
  154. package/dist/crdt/vendor/yjs/dts/utils/encoding.d.ts +26 -0
  155. package/dist/crdt/vendor/yjs/dts/utils/ids.d.ts +407 -0
  156. package/dist/crdt/vendor/yjs/dts/utils/isParentOf.d.ts +1 -0
  157. package/dist/crdt/vendor/yjs/dts/utils/meta.d.ts +25 -0
  158. package/dist/crdt/vendor/yjs/dts/utils/renderer-helpers.d.ts +98 -0
  159. package/dist/crdt/vendor/yjs/dts/utils/schemas.d.ts +2 -0
  160. package/dist/crdt/vendor/yjs/dts/utils/transaction-helpers.d.ts +15 -0
  161. package/dist/crdt/vendor/yjs/dts/utils/updates.d.ts +70 -0
  162. package/dist/crdt/vendor/yjs/dts/ynode.d.ts +655 -0
  163. package/dist/crdt/vendor/yjs/global.d.ts +52 -0
  164. package/dist/crdt/vendor/yjs/src/index.js +64 -0
  165. package/dist/crdt/vendor/yjs/src/structs/AbstractStruct.js +64 -0
  166. package/dist/crdt/vendor/yjs/src/structs/GC.js +75 -0
  167. package/dist/crdt/vendor/yjs/src/structs/Item.js +1538 -0
  168. package/dist/crdt/vendor/yjs/src/structs/Skip.js +72 -0
  169. package/dist/crdt/vendor/yjs/src/utils/BlockSet.js +291 -0
  170. package/dist/crdt/vendor/yjs/src/utils/Doc.js +255 -0
  171. package/dist/crdt/vendor/yjs/src/utils/EventHandler.js +75 -0
  172. package/dist/crdt/vendor/yjs/src/utils/ID.js +59 -0
  173. package/dist/crdt/vendor/yjs/src/utils/RangeCursor.js +407 -0
  174. package/dist/crdt/vendor/yjs/src/utils/RelativePosition.js +301 -0
  175. package/dist/crdt/vendor/yjs/src/utils/StructStore.js +134 -0
  176. package/dist/crdt/vendor/yjs/src/utils/Transaction.js +458 -0
  177. package/dist/crdt/vendor/yjs/src/utils/UndoManager.js +554 -0
  178. package/dist/crdt/vendor/yjs/src/utils/UpdateDecoder.js +284 -0
  179. package/dist/crdt/vendor/yjs/src/utils/UpdateEncoder.js +323 -0
  180. package/dist/crdt/vendor/yjs/src/utils/YEvent.js +158 -0
  181. package/dist/crdt/vendor/yjs/src/utils/content-helper.js +0 -0
  182. package/dist/crdt/vendor/yjs/src/utils/encoding-helpers.js +110 -0
  183. package/dist/crdt/vendor/yjs/src/utils/encoding.js +662 -0
  184. package/dist/crdt/vendor/yjs/src/utils/ids.js +1504 -0
  185. package/dist/crdt/vendor/yjs/src/utils/isParentOf.js +19 -0
  186. package/dist/crdt/vendor/yjs/src/utils/meta.js +74 -0
  187. package/dist/crdt/vendor/yjs/src/utils/renderer-helpers.js +186 -0
  188. package/dist/crdt/vendor/yjs/src/utils/schemas.js +3 -0
  189. package/dist/crdt/vendor/yjs/src/utils/transaction-helpers.js +391 -0
  190. package/dist/crdt/vendor/yjs/src/utils/updates.js +264 -0
  191. package/dist/crdt/vendor/yjs/src/ynode.js +2897 -0
  192. package/dist/dnd/pragmatic.d.ts +22 -0
  193. package/dist/dnd/pragmatic.js +26 -0
  194. package/dist/edytor.svelte.d.ts +323 -54
  195. package/dist/edytor.svelte.js +771 -197
  196. package/dist/edytor.utils.d.ts +49 -2
  197. package/dist/edytor.utils.js +65 -76
  198. package/dist/events/beforeInputCommands.d.ts +21 -0
  199. package/dist/events/beforeInputCommands.js +328 -0
  200. package/dist/events/beforeInputDeleteCommands.d.ts +3 -0
  201. package/dist/events/beforeInputDeleteCommands.js +245 -0
  202. package/dist/events/dataTransferPayload.d.ts +6 -0
  203. package/dist/events/dataTransferPayload.js +9 -0
  204. package/dist/events/domTextOffset.d.ts +12 -0
  205. package/dist/events/domTextOffset.js +52 -0
  206. package/dist/events/events.utils.d.ts +3 -0
  207. package/dist/events/events.utils.js +13 -0
  208. package/dist/events/nativeInteractiveControl.d.ts +31 -0
  209. package/dist/events/nativeInteractiveControl.js +98 -0
  210. package/dist/events/onBeforeInput.d.ts +10 -1
  211. package/dist/events/onBeforeInput.js +449 -330
  212. package/dist/events/onCopy.d.ts +7 -0
  213. package/dist/events/onCopy.js +30 -0
  214. package/dist/events/onCut.d.ts +8 -0
  215. package/dist/events/onCut.js +13 -0
  216. package/dist/events/onDrop.d.ts +16 -0
  217. package/dist/events/onDrop.js +158 -0
  218. package/dist/events/onFocus.d.ts +4 -0
  219. package/dist/events/onFocus.js +166 -0
  220. package/dist/events/onInput.d.ts +20 -0
  221. package/dist/events/onInput.js +249 -0
  222. package/dist/events/onKeyDown.js +191 -11
  223. package/dist/events/onPaste.d.ts +3 -0
  224. package/dist/events/onPaste.js +108 -0
  225. package/dist/events/wordBoundary.d.ts +2 -0
  226. package/dist/events/wordBoundary.js +58 -0
  227. package/dist/index.d.ts +38 -1
  228. package/dist/index.js +36 -1
  229. package/dist/kinds.d.ts +100 -0
  230. package/dist/kinds.js +198 -0
  231. package/dist/plugins/arrowMove/arrowMove.d.ts +1 -1
  232. package/dist/plugins/arrowMove/arrowMove.js +30 -65
  233. package/dist/plugins/blockHandles/BlockHandle.svelte +152 -0
  234. package/dist/plugins/blockHandles/BlockHandle.svelte.d.ts +12 -0
  235. package/dist/plugins/blockHandles/BlockHandleController.svelte.d.ts +208 -0
  236. package/dist/plugins/blockHandles/BlockHandleController.svelte.js +823 -0
  237. package/dist/plugins/blockHandles/BlockHandles.svelte +151 -0
  238. package/dist/plugins/blockHandles/BlockHandles.svelte.d.ts +20 -0
  239. package/dist/plugins/blockHandles/autoScroll.d.ts +8 -0
  240. package/dist/plugins/blockHandles/autoScroll.js +25 -0
  241. package/dist/plugins/blockHandles/blockHandlesPlugin.d.ts +37 -0
  242. package/dist/plugins/blockHandles/blockHandlesPlugin.js +100 -0
  243. package/dist/plugins/blockHandles/dragPreview.d.ts +33 -0
  244. package/dist/plugins/blockHandles/dragPreview.js +228 -0
  245. package/dist/plugins/blockMenu/BlockMenu.svelte +301 -0
  246. package/dist/plugins/blockMenu/BlockMenu.svelte.d.ts +9 -0
  247. package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +102 -0
  248. package/dist/plugins/blockMenu/BlockMenuController.svelte.js +245 -0
  249. package/dist/plugins/blockMenu/blockMenuPlugin.d.ts +11 -0
  250. package/dist/plugins/blockMenu/blockMenuPlugin.js +89 -0
  251. package/dist/plugins/code/CodePlugin.svelte +210 -163
  252. package/dist/plugins/code/CodePlugin.svelte.d.ts +1 -3
  253. package/dist/plugins/code/code.css +92 -0
  254. package/dist/plugins/icons.d.ts +2 -0
  255. package/dist/plugins/icons.js +31 -0
  256. package/dist/plugins/image/ImageEmpty.svelte +69 -0
  257. package/dist/plugins/image/ImageEmpty.svelte.d.ts +8 -0
  258. package/dist/plugins/image/ImagePlugin.svelte +74 -12
  259. package/dist/plugins/image/ImagePlugin.svelte.d.ts +15 -0
  260. package/dist/plugins/image/image.d.ts +2 -0
  261. package/dist/plugins/image/image.js +7 -0
  262. package/dist/plugins/index.d.ts +14 -1
  263. package/dist/plugins/index.js +10 -1
  264. package/dist/plugins/keepInView.d.ts +4 -0
  265. package/dist/plugins/keepInView.js +6 -0
  266. package/dist/plugins/markdownShortcuts.d.ts +3 -0
  267. package/dist/plugins/markdownShortcuts.js +104 -0
  268. package/dist/plugins/mention/MentionPlugin.svelte +28 -31
  269. package/dist/plugins/richtext/RichTextPlugin.svelte +411 -200
  270. package/dist/plugins/richtext/RichTextPlugin.svelte.d.ts +8 -7
  271. package/dist/plugins/richtext/richTextOperations.d.ts +53 -0
  272. package/dist/plugins/richtext/richTextOperations.js +200 -0
  273. package/dist/plugins/slashMenu/SlashMenu.svelte +297 -0
  274. package/dist/plugins/slashMenu/SlashMenu.svelte.d.ts +11 -0
  275. package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +56 -0
  276. package/dist/plugins/slashMenu/SlashMenuController.svelte.js +275 -0
  277. package/dist/plugins/slashMenu/slashMenuPlugin.d.ts +25 -0
  278. package/dist/plugins/slashMenu/slashMenuPlugin.js +105 -0
  279. package/dist/plugins/suggestions/SuggestionBars.svelte +142 -0
  280. package/dist/plugins/suggestions/SuggestionBars.svelte.d.ts +10 -0
  281. package/dist/plugins/suggestions/suggestionsPlugin.d.ts +28 -0
  282. package/dist/plugins/suggestions/suggestionsPlugin.js +53 -0
  283. package/dist/plugins/toolbar/Toolbar.svelte +341 -0
  284. package/dist/plugins/toolbar/Toolbar.svelte.d.ts +9 -0
  285. package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +85 -0
  286. package/dist/plugins/toolbar/ToolbarController.svelte.js +150 -0
  287. package/dist/plugins/toolbar/toolbarPlugin.d.ts +16 -0
  288. package/dist/plugins/toolbar/toolbarPlugin.js +40 -0
  289. package/dist/plugins.d.ts +249 -40
  290. package/dist/plugins.js +11 -5
  291. package/dist/selection/domSelection.d.ts +29 -0
  292. package/dist/selection/domSelection.js +230 -0
  293. package/dist/selection/replaceSelection.d.ts +143 -0
  294. package/dist/selection/replaceSelection.js +316 -0
  295. package/dist/selection/selection.svelte.d.ts +275 -37
  296. package/dist/selection/selection.svelte.js +1162 -331
  297. package/dist/selection/selection.utils.d.ts +35 -4
  298. package/dist/selection/selection.utils.js +309 -100
  299. package/dist/selection/visibility.d.ts +88 -0
  300. package/dist/selection/visibility.js +140 -0
  301. package/dist/session/attempt.d.ts +190 -0
  302. package/dist/session/attempt.js +188 -0
  303. package/dist/session/bindings.d.ts +16 -0
  304. package/dist/session/bindings.js +262 -0
  305. package/dist/session/commands.d.ts +158 -0
  306. package/dist/session/commands.js +601 -0
  307. package/dist/session/composition.svelte.d.ts +114 -0
  308. package/dist/session/composition.svelte.js +489 -0
  309. package/dist/session/editing/text.d.ts +33 -0
  310. package/dist/session/editing/text.js +36 -0
  311. package/dist/session/handles.d.ts +63 -0
  312. package/dist/session/handles.js +123 -0
  313. package/dist/session/history.d.ts +49 -0
  314. package/dist/session/history.js +131 -0
  315. package/dist/session/keymap.d.ts +42 -0
  316. package/dist/session/keymap.js +144 -0
  317. package/dist/session/moves.d.ts +32 -0
  318. package/dist/session/moves.js +116 -0
  319. package/dist/session/navigation.d.ts +51 -0
  320. package/dist/session/navigation.js +312 -0
  321. package/dist/session/props.d.ts +28 -0
  322. package/dist/session/props.js +162 -0
  323. package/dist/session/selection.d.ts +126 -0
  324. package/dist/session/selection.js +227 -0
  325. package/dist/session/suggestions.svelte.d.ts +125 -0
  326. package/dist/session/suggestions.svelte.js +329 -0
  327. package/dist/session/virtual.d.ts +33 -0
  328. package/dist/session/virtual.js +182 -0
  329. package/dist/surface/attributes.d.ts +36 -0
  330. package/dist/surface/attributes.js +143 -0
  331. package/dist/surface/cells.d.ts +103 -0
  332. package/dist/surface/cells.js +215 -0
  333. package/dist/surface/observer.svelte.d.ts +70 -0
  334. package/dist/surface/observer.svelte.js +969 -0
  335. package/dist/surface/overlay.d.ts +33 -0
  336. package/dist/surface/overlay.js +91 -0
  337. package/dist/surface/pin.svelte.d.ts +56 -0
  338. package/dist/surface/pin.svelte.js +108 -0
  339. package/dist/surface/projector.svelte.d.ts +69 -0
  340. package/dist/surface/projector.svelte.js +486 -0
  341. package/dist/text/deltas.d.ts +14 -3
  342. package/dist/text/deltas.js +27 -90
  343. package/dist/text/text.svelte.d.ts +43 -31
  344. package/dist/text/text.svelte.js +88 -69
  345. package/dist/text/text.utils.d.ts +7 -2
  346. package/dist/text/text.utils.js +121 -97
  347. package/dist/themes/notion.css +473 -0
  348. package/dist/utils/diffText.d.ts +15 -0
  349. package/dist/utils/diffText.js +26 -0
  350. package/dist/utils/json.d.ts +90 -3
  351. package/dist/utils/json.js +369 -2
  352. package/dist/utils.d.ts +3 -1
  353. package/dist/utils.js +2 -0
  354. package/package.json +112 -50
  355. package/dist/block/content.svelte.d.ts +0 -14
  356. package/dist/block/content.svelte.js +0 -40
  357. package/dist/components/ReadonlyEditor.svelte +0 -46
  358. package/dist/components/ReadonlyEditor.svelte.d.ts +0 -4
  359. package/dist/components/readonlyElements.svelte.d.ts +0 -82
  360. package/dist/components/readonlyElements.svelte.js +0 -144
  361. package/dist/dnd.svelte.d.ts +0 -17
  362. package/dist/dnd.svelte.js +0 -125
  363. package/dist/hotkeys.d.ts +0 -27
  364. package/dist/hotkeys.js +0 -282
  365. package/dist/localProvider.d.ts +0 -82
  366. package/dist/localProvider.js +0 -267
  367. package/dist/plugins/code/prism.css +0 -141
  368. package/dist/utils/jsx.d.ts +0 -25
  369. package/dist/utils/jsx.js +0 -66
  370. package/dist/utils/serialize.js +0 -1
  371. /package/dist/{utils/serialize.d.ts → crdt/engine-api.js} +0 -0
package/README.md CHANGED
@@ -1,231 +1,111 @@
1
1
  <div align="center">
2
2
  <img src="cover.jpg" alt="Edytor Logo" width="60%"/>
3
3
 
4
- <p>A powerful, extensible rich text editor built with Svelte and Y.js</p>
4
+ <p>A collaborative block editor for Svelte 5, on a Yjs v14 engine</p>
5
5
 
6
- [![npm version](https://badge.fury.io/js/edytor.svg)](https://badge.fury.io/js/edytor)
7
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
9
7
  [![Svelte v5](https://img.shields.io/badge/Svelte-v5-FF3E00.svg)](https://svelte.dev)
10
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
11
8
 
12
- <p>
13
- <a href="#features">Features</a> •
14
- <a href="#quick-start">Quick Start</a> •
9
+ <p>
10
+ <a href="https://edytor-docs.beynar.workers.dev/docs">Documentation</a> •
11
+ <a href="#quick-start">Quick start</a> •
12
+ <a href="https://edytor-docs.beynar.workers.dev/docs/reference/migration">Migrating from 0.0.11</a>
15
13
  </p>
16
14
  </div>
17
15
 
18
- Edytor aims to be the premier rich text editor for Svelte, providing the same level of power, flexibility and extensibility that Slate.js offers for React. Like Slate.js, Edytor strives to be heavily customizable and provide a powerful API to build any kind of collaborative rich text editor.
19
-
20
- ## ⚠️ Work in progress
21
-
22
- Edytor is currently in the early stages of development. It is not yet ready for production use.
23
- I welcome early contributors to help us build a better editor for Svelte.
24
- Just run it, see what you can do with it, and open issues or PRs.
25
-
26
- If you want to submit an issue please share the json value of the document. It will help understand and fix the issue.
27
-
28
- ## ✨ Features
29
-
30
- - 📑 **Customizable with snippets**: Use snippets to render your own blocks and marks
31
- - 🎨 **Rich Text Formatting**: Full support for marks, blocks and inline blocks.
32
- - 🤝 **Real-time Collaboration**: Uses Y.js as data store, collaborative editing is built-in
33
- - 🔌 **Plugin System**: Extensible architecture for custom features. I try to make every action performed by the editor hackable and preventable to let you build your own features.
34
- - ⚡ **High Performance**: Optimized for large documents, fine grained update at the leaf level thanks to Y.js and Svelte's reactivity
35
- - 🔄 **Undo/Redo**: Built-in history management
36
- - 📦 **Lightweight**: Relatively small bundle size compared to other rich text editors
37
- - 📦 **AI copilot ready**: Support inline text suggestions for ai completions.
38
-
39
- ## ✨ Things that are ready
40
-
41
- - [x] YJS backed editing
42
- - [x] Basic block operations and text operations.
43
- - [x] Stable data structure
44
- - [x] Undo/Redo
45
- - [x] Rich text formatting
46
- - [x] Customizable with snippets
47
- - [x] Plugin system
48
- - [x] Text suggestions
49
- - [x] Inline blocks
50
- - [x] Nesting
51
- - [x] Selection + movable blocks
52
- - [x] Content transformation
53
- - [x] Content normalization
54
- - [x] Island blocks
55
- - [x] Customizable hotkeys
56
- - [x] Void elements and editable void elements
57
- - [x] Text spanning deletion
58
- - [x] Block spanning deletion.
59
- - [x] Readable JSON data structure
60
- - [x] Readonly edytor to lightweightly render static content without the Y.js extra works.
61
-
62
- ## ✨ Things that are not ready
63
-
64
- - [ ] DND
65
- - [ ] Battle tested collaborative editing + awareness + providers
66
- - [ ] Children normalization
67
- - [ ] Children transformation
68
- - [ ] Block suggestions
69
- - [ ] Reactive data (inline)block properties with syncrostate.
70
-
71
- ## 🧠 Concepts
72
-
73
- Edytor structure is built around this key concepts:
74
-
75
- - **Blocks**: Container elements like paragraphs, headings, and lists
76
- - **Content**: The content of a block is an array of inlines blocks or text and marks.
77
- - **Children**: Children are the blocks that are directly inside a block. They allow an infinite nesting.
78
- - **Marks**: Texts are simply text with marks that define the formatting.
79
- - **Inline blocks**: Inline blocks are inline elements that are no editable and render custom components like footnotes, equations, etc.
80
-
81
- Schematic example of a document:
82
- (content and children are not dom element, i put them here to help you understand the structure)
83
-
84
- ```html
85
- <root>
86
- <block>
87
- <content>
88
- <text mark="bold">Hello</text>
89
- <text>World</text>
90
- <inline-block type="footnote">
91
- <!-- Inline block are rendered by the user code -->
92
- </inline-block>
93
- </content>
94
- <children>
95
- <nested-block>
96
- <content>
97
- <text>World</text>
98
- </content>
99
- </nested-block>
100
- <nested-block>
101
- <content>
102
- <text>World</text>
103
- </content>
104
- <children>
105
- <nested-block>
106
- <content>
107
- <text>World</text>
108
- </content>
109
- </nested-block>
110
- </children>
111
- </nested-block>
112
- </children>
113
- </block>
114
- </root>
115
- ```
116
-
117
- ### Blocks
118
-
119
- Blocks are the container elements like paragraphs, headings, and lists.
120
- They have a content that is an array of inlines blocks or text.
121
- They may have children that is an array of nested-blocks.
122
- Blocks can be nested unless they are void or inside an island
123
-
124
- An island is a block that is editable but is structuraly stable and isolated from the rest of the document.
125
- It is impossible to merge an island with another block. It is also impossible to move another block inside an island.
126
- You may think of an island as a block that is editable but is not completely part of the document structure and isolated from the rest of the document.
16
+ Edytor aims to be for Svelte what Slate.js is for React: a heavily customizable editor with an API to build any kind of collaborative rich text editor.
127
17
 
128
- A void block is a block which does not have children or whose children are not editable and rendered outside of the edytor core logic.
129
- Void blocks can render and edit their content anyway. That is usefull to render caption.
130
- You may think of a void block as a block that is completely independent from the rest of the document.
131
- Void blocks acts also like an island but are even less editables.
18
+ > **Work in progress.** Edytor is a pre-release (`0.1.0-next.16`, `edytor@next` on npm) and not ready for production; the API changes between releases without a compatibility layer. The untagged `edytor@0.0.11` on npm predates the current API. Issues and PRs are welcome: when you report a bug, include the document's JSON value.
132
19
 
133
- ### Text
20
+ ## Features
134
21
 
135
- Text is the basic text element that is rendered by the editor. At is core it is a Y.js text with any formatting attributes you want.
22
+ - **Notion-style editing out of the box.** `<Edytor />` alone is a rich text editor with images: headings, lists, to-dos, toggles, callouts, quotes, dividers, ten marks, Notion's markdown shortcuts and hotkeys. Add the Notion theme, block handles with a block menu (drag one block, or every block the selection covers), a slash menu, a selection toolbar and code blocks.
23
+ - **Your markup.** Blocks, marks and inline atoms render through your Svelte snippets; the slash menu, toolbar, block menu and handles take a snippet and keep their behavior.
24
+ - **Synced properties.** `block.data`, `atom.data` and `edytor.data` read and write like plain objects (`bind:value={block.data.title}`); each property and each array item syncs on its own, so concurrent edits of different properties, or of different items of one array, merge.
25
+ - **AI suggestions.** `edytor.suggestions.add(position, content)` proposes text, paragraphs, lists, to-dos or images after, before or inside a block, at the end of its text, or in place of the selection; it streams in, shows only on your screen, and becomes one undo step when accepted ([Suggestions](https://edytor-docs.beynar.workers.dev/docs/editor/suggestions)).
26
+ - **Plugins that can veto anything.** Every command is prepared before it writes; plugins see the command and each planned step and can refuse or replace it.
27
+ - **Real-time collaboration.** One `EdytorDocument` shared by any number of views, or none (headless). Presence cursors, identity-preserving moves, splits and merges, and undo that only takes back your own edits.
28
+ - **Offline first.** A local IndexedDB copy and cross-tab sync; offline edits survive reloads and reach the server on reconnect.
29
+ - **A Cloudflare Durable Object room.** `edytor/cloudflare` stores in SQLite, acknowledges after the write, binds identity to the socket and hibernates.
30
+ - **Headless and Worker-safe.** `edytor/crdt/edytor` runs in Node and Workers without Svelte.
136
31
 
137
- ### Inlines Block
32
+ ## Install
138
33
 
139
- Inlines are inline blocks, useful to render custom components like footnotes, equations, etc.
140
- They are rendered by the user code and are not editable nor focusable.
141
- They have a data property
142
-
143
- ## 🚀 Quick Start
144
-
145
- ### Installation (not published yet)
34
+ The pre-release is on npm under the `next` tag. Name the tag: a bare `edytor` is the old, incompatible `0.0.11`.
146
35
 
147
36
  ```bash
148
- npm install edytor
149
- # or
150
- yarn add edytor
151
- # or
152
- pnpm add edytor
37
+ pnpm add edytor@next
153
38
  ```
154
39
 
155
- ### Basic Usage
40
+ `svelte@^5` is a peer dependency. Do not install `yjs`: the v14 engine is vendored (`edytor/crdt`). See [installation](https://edytor-docs.beynar.workers.dev/docs/getting-started).
41
+
42
+ ## Quick start
156
43
 
157
44
  ```svelte
158
- <script>
159
- import { Edytor } from 'edytor';
160
-
161
- let value = {
162
- children: [
163
- {
164
- type: 'paragraph',
165
- content: [{ text: 'Hello, World!' }]
166
- }
167
- ]
45
+ <script lang="ts">
46
+ import {
47
+ Edytor,
48
+ codePlugin,
49
+ markdownShortcutsPlugin,
50
+ slashMenuPlugin,
51
+ toolbarPlugin,
52
+ blockMenuPlugin,
53
+ richTextPlaceholder,
54
+ type JSONDoc
55
+ } from 'edytor';
56
+ import 'edytor/themes/notion.css';
57
+
58
+ const value: JSONDoc = {
59
+ children: [{ type: 'paragraph', content: [{ text: 'Hello, World!' }] }]
168
60
  };
169
-
170
- function onChange(newValue) {
171
- console.log('Document changed:', newValue);
172
- }
61
+ const plugins = [
62
+ codePlugin,
63
+ markdownShortcutsPlugin,
64
+ slashMenuPlugin,
65
+ toolbarPlugin,
66
+ blockMenuPlugin
67
+ ];
173
68
  </script>
174
69
 
175
- <Edytor {value} {onChange} />
70
+ <div class="edytor-notion">
71
+ <Edytor
72
+ {value}
73
+ {plugins}
74
+ placeholder={richTextPlaceholder}
75
+ onChange={(root) => console.log(root)}
76
+ />
77
+ </div>
176
78
  ```
177
79
 
178
- ## Testing
179
-
180
- I'm welcome to any contribution to improve the testing.
181
- In the end, every block operation should be tested.
182
- I've implemented a custom jsx parser to simplify testing the editor.
80
+ `<Edytor>` adds the rich text, image, arrow-move and suggestions plugins after yours, and block handles. To collaborate, name a room and a server running the [`edytor/cloudflare` room](https://edytor-docs.beynar.workers.dev/docs/server/quick-start):
183
81
 
184
- So instead of defining the value as a json object, you can define the value as a jsx element.
185
-
186
- ```html
187
- <root>
188
- <paragraph>Hello, World!</paragraph>
189
- </root>
82
+ ```svelte
83
+ <Edytor
84
+ server="wss://example.com/rooms"
85
+ room={documentId}
86
+ params={{ token }}
87
+ actor={{ id: userId }}
88
+ />
190
89
  ```
191
90
 
192
- is the same as
91
+ ## Documentation
193
92
 
194
- ```json
195
- {
196
- "type": "root",
197
- "children": [{ "type": "paragraph", "content": [{ "text": "Hello, World!" }] }]
198
- }
199
- ```
93
+ The [documentation site](https://edytor-docs.beynar.workers.dev/docs) is the single source for the API and behavior; this README only introduces the package.
200
94
 
201
- You can also add one or two cursors with the `|` character into the jsx in order to simulate the cursor position
95
+ - [Getting started](https://edytor-docs.beynar.workers.dev/docs/getting-started): installation, quick start, SvelteKit, entry points and bundle size
96
+ - [Concepts](https://edytor-docs.beynar.workers.dev/docs/concepts/document-model): the document model, blocks, void and island roles
97
+ - [Editor](https://edytor-docs.beynar.workers.dev/docs/editor/edytor-component): the component, commands, selection, history, clipboard, readonly
98
+ - [Plugins](https://edytor-docs.beynar.workers.dev/docs/plugins) and [customization](https://edytor-docs.beynar.workers.dev/docs/customization/blocks): bundled plugins, custom blocks and marks, [hotkeys and editing behavior](https://edytor-docs.beynar.workers.dev/docs/customization/hotkeys)
99
+ - [Collaboration](https://edytor-docs.beynar.workers.dev/docs/collaboration) and [server](https://edytor-docs.beynar.workers.dev/docs/server/quick-start): documents, providers, presence, the Durable Object room and its protocol
100
+ - [Reference](https://edytor-docs.beynar.workers.dev/docs/reference/document-api): the document API, [troubleshooting](https://edytor-docs.beynar.workers.dev/docs/reference/troubleshooting), [migration from 0.0.11](https://edytor-docs.beynar.workers.dev/docs/reference/migration), limitations
202
101
 
203
- ```jsx
204
- <root>
205
- <paragraph>Hello, |World!|</paragraph>
206
- </root>
207
- ```
102
+ ## Contributing
208
103
 
209
- I've also implemented the `createTestEdytor` that help with creating an edytor instance from a jsx element in order to test various operations on a virtual edytor and test the expected output.
210
-
211
- ```jsx
212
- test('split text', () => {
213
- const { edytor, expect } = createTestEdytor(
214
- <root>
215
- <paragraph>Hello, |World!</paragraph>
216
- </root>
217
- );
218
-
219
- edytor.selection.state.startBlock?.splitBlock({
220
- index: edytor.selection.state.yStart,
221
- text: edytor.selection.state.startText
222
- });
223
-
224
- expect(
225
- <root>
226
- <paragraph>Hello, </paragraph>
227
- <paragraph>World!</paragraph>
228
- </root>
229
- );
230
- });
104
+ `AGENTS.md` describes the architecture (one owner per fact), where to fix what, and the test lanes. The docs live in `site/content/docs`; a change to public behavior updates them in the same commit.
105
+
106
+ ```bash
107
+ pnpm install
108
+ pnpm check && pnpm lint
109
+ pnpm exec vitest --run # unit and model fixtures (JSX fixture DSL in src/tests/jsx)
110
+ pnpm test:dom # editors mounted in jsdom
231
111
  ```
@@ -1,53 +1,119 @@
1
1
  import { Text } from '../text/text.svelte.js';
2
2
  import { Edytor } from '../edytor.svelte.js';
3
- import { type YBlock, type JSONBlock, type JSONText, type JSONInlineBlock } from '../utils/json.js';
4
- import * as Y from 'yjs';
3
+ import type { JSONBlock, JSONText, JSONInlineBlock } from '../utils/json.js';
4
+ import { type BlockOperations } from './block.utils.js';
5
5
  import type { BlockDefinition } from '../plugins.js';
6
6
  import { InlineBlock } from './inlineBlock.svelte.js';
7
- export declare const getSetArray: <T = YBlock>(yBlock: YBlock, key?: "children" | "content") => Y.Array<T>;
8
- export declare const getSetText: (yBlock: YBlock) => Y.Text;
7
+ import type { DocBlock } from '../crdt/index.js';
8
+ /**
9
+ * An id-only block handle (§2.4 "Handles", R4): every getter reads the
10
+ * document index (transaction-aware), every mutator issues a command. The
11
+ * view keeps one per id (`edytor.idToBlock`); `node` is the element the core
12
+ * renders for it (O45).
13
+ */
14
+ /** Mark an element inside a block's markup as non-editable chrome (`block.void`, a preview's too). */
15
+ export declare const voidChrome: (node: HTMLElement) => void;
9
16
  export declare class Block {
10
17
  #private;
11
18
  readonly: boolean;
12
- edytor: Edytor;
13
- yBlock: YBlock;
14
- parent?: Block;
15
- yChildren: Y.Array<YBlock>;
16
- yContent: Y.Array<YBlock | Y.Text>;
17
- children: Block[];
18
- content: (Text | InlineBlock)[];
19
- id: string;
20
- data: Record<string, any>;
19
+ readonly edytor: Edytor;
20
+ readonly id: string;
21
21
  node?: HTMLElement;
22
- definition: BlockDefinition;
22
+ constructor(edytor: Edytor, id: string);
23
+ get isRoot(): boolean;
24
+ /** The typed document node — `null` for the root. */
25
+ get model(): DocBlock | null;
26
+ /** The display parent (the root for a top-level block); none for the root or a dead block. */
27
+ get parent(): Block | undefined;
28
+ get children(): Block[];
29
+ /** Text segments and inline atoms, alternating, starting and ending with a text. */
30
+ get content(): (Text | InlineBlock)[];
31
+ get type(): string;
32
+ /** Retype the block — the `setBlock` command (readonly, hooks, `dispatcher.last`). */
33
+ set type(value: string);
34
+ /**
35
+ * The block's `data` as a live proxy (`session/props.ts`): reads follow the
36
+ * document (reactive through the block's cell), writes are `patchData`
37
+ * commands. The root's is the document's data (`edytor.data`).
38
+ */
39
+ get data(): Record<string, any>;
40
+ get definition(): BlockDefinition;
41
+ /**
42
+ * Replace the block's `data` — a `patchData` command of its root (readonly,
43
+ * hooks, `dispatcher.last`); `block.model.setData` is the raw document write.
44
+ */
45
+ setData: (data: Record<string, unknown>) => void;
23
46
  get selected(): boolean;
24
47
  get focused(): boolean;
25
- get insideIsland(): boolean;
48
+ /** May this block move at all — R5 `canPlace` without a destination (drag handles). */
49
+ get movable(): boolean;
50
+ /**
51
+ * May text-level structural commands (convert, markdown shortcut, slash
52
+ * menu) apply: the block is movable — or the virtual paragraph of an
53
+ * emptied document, which a conversion creates with its kind
54
+ * (SW10-lists-3) — has no role of its own and renders its own content —
55
+ * a container (a list) is never converted, its items are (ZW-02).
56
+ */
57
+ get convertible(): boolean;
26
58
  get firstEditableText(): Text | undefined;
27
59
  get lastEditableText(): Text | undefined;
28
60
  get index(): number;
29
- set index(value: number);
30
- get type(): string;
31
- set type(value: string);
32
61
  get depth(): number;
33
62
  get path(): number[];
34
- get isRoot(): boolean;
35
- get suggestions(): (Text | InlineBlock)[] | null;
63
+ /** The block is visible in the document (a dead handle answers false). */
64
+ get isInTree(): boolean;
65
+ /**
66
+ * @deprecated `edytor.suggestions` with `{ end: block.id }`. The content of
67
+ * this block's latest `end` suggestion, as parts (a text's runs, or an
68
+ * atom); setting it replaces this block's `end` suggestions, `null` drops them.
69
+ */
70
+ get suggestions(): (JSONText[] | JSONInlineBlock)[] | null;
36
71
  set suggestions(value: (JSONText[] | JSONInlineBlock)[] | null);
37
72
  get nextBlock(): Block | null;
38
73
  get previousBlock(): Block | null;
39
74
  get closestPreviousBlock(): Block | null;
40
75
  get closestNextBlock(): Block | null;
41
- get deepestChild(): Block;
42
76
  get hasChildren(): boolean;
77
+ /** It shows content: text or an inline atom (a block holding only a mention is not empty). */
43
78
  get hasContent(): boolean;
79
+ /** It holds nothing: no content and no children (the emptiness Turn into reads, `holdsNothing`). */
44
80
  get isEmpty(): boolean;
81
+ get isNested(): boolean;
82
+ /** This block's JSON — the document's one serializer (`facade.blockJSON`, L14). */
45
83
  get value(): JSONBlock;
46
- get firstText(): Text;
47
- get lastText(): Text;
48
- private observeContent;
49
- private observeChildren;
50
- private batch;
84
+ isChildOf(block: Block): boolean;
85
+ /** Whether this kind renders its own content slot — the adopted capability (R5, O22). */
86
+ get rendersContent(): boolean;
87
+ /**
88
+ * A container: it shows only its children (a list), neither void nor an
89
+ * island — the document's container rule (YW-02). Its items hold what it
90
+ * shows; it is never converted (`convertible`).
91
+ */
92
+ get isContainer(): boolean;
93
+ /**
94
+ * An item of a list: its parent is a container whose items are a kind of
95
+ * their own (a `list-item` in an `unordered-list`), not the document's
96
+ * default — a column of paragraphs is no list. Turned into another kind,
97
+ * an item leaves its list; <kbd>Enter</kbd> in an empty one ends it.
98
+ */
99
+ get isListItem(): boolean;
100
+ /**
101
+ * The list this block shows in: its container when it is an item
102
+ * (`isListItem`), or — an item outdented out of a nested list into the
103
+ * item holding it (SW8-roles-4) — the list of the items of its kind it
104
+ * sits under. <kbd>Enter</kbd> in an empty one outdents it; the menus
105
+ * name it by the list's `itemKind`.
106
+ */
107
+ get list(): Block | undefined;
108
+ /**
109
+ * The first text of this block's own content — none for a kind that
110
+ * does not render its content (a list container, a divider): its slot
111
+ * is never displayed, so no caret or endpoint may land there. A block
112
+ * without a content slot (the root) answers with its first child's.
113
+ */
114
+ get firstText(): Text | undefined;
115
+ /** The last text of this block's own content (see {@link firstText}). */
116
+ get lastText(): Text | undefined;
51
117
  addChildBlock: (args_0: {
52
118
  block: JSONBlock;
53
119
  index: number;
@@ -56,68 +122,89 @@ export declare class Block {
56
122
  blocks: JSONBlock[];
57
123
  index: number;
58
124
  }) => Block[];
59
- insertBlockAfter: (args_0: {
125
+ insertBlockAfter: (payload: {
60
126
  block: JSONBlock;
61
- }) => Block | null;
62
- insertBlockBefore: (args_0: {
127
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
128
+ insertBlockBefore: (payload: {
63
129
  block: JSONBlock;
64
- }) => Block | null;
65
- splitBlock: (args_0: {
130
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
131
+ splitBlock: (payload: {
66
132
  index: number;
67
133
  text: Text;
68
- }) => Block | null;
69
- removeBlock: (args_0?: {
70
- keepChildren: boolean;
71
- } | undefined) => void;
72
- unNestBlock: () => Block | null;
73
- mergeBlockBackward: () => Block | null;
74
- mergeBlockForward: () => Block | null;
75
- nestBlock: () => Block | null;
76
- setBlock: (args_0: {
77
- value: JSONBlock;
78
- }) => void;
79
- moveBlock: (args_0: {
134
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
135
+ duplicateBlock: (_?: {} | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
136
+ removeBlock: (payload?: {
137
+ keepChildren?: boolean;
138
+ } | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => void;
139
+ unNestBlock: (this: Block, _?: {} | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null;
140
+ mergeBlockBackward: (_?: {} | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
141
+ mergeBlockForward: (_?: {} | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null | undefined;
142
+ nestBlock: (this: Block, _?: {} | undefined, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null;
143
+ setBlock: (payload: {
144
+ value: Partial<JSONBlock>;
145
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => void;
146
+ moveBlock: (this: Block, payload: {
80
147
  path: number[];
81
- }) => Block | null;
148
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => Block | null;
149
+ moveBlocks: (this: Block, payload: {
150
+ blocks: Block[];
151
+ path: number[];
152
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => Block[];
82
153
  pushContentIntoBlock: (args_0: {
83
154
  value: (Text | InlineBlock)[];
84
155
  }) => void;
85
- removeInlineBlock: (args_0: {
156
+ removeInlineBlock: (payload: {
86
157
  index: number;
87
- }) => void;
158
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => void;
159
+ patchData: (payload: {
160
+ ops: import("../crdt/index.js").DataPatch[];
161
+ atom?: string;
162
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => void;
88
163
  addInlineBlock: (args_0: {
89
164
  index: number;
90
165
  block: JSONInlineBlock;
91
166
  text: Text;
92
- }) => Text;
167
+ }) => Text | null | undefined;
93
168
  normalizeContent: () => void;
94
- suggestText: (args_0: {
95
- value: (JSONText | JSONInlineBlock)[] | string | null;
96
- }) => void;
169
+ normalizeChildren: () => void;
170
+ /** @deprecated `edytor.suggestions.add({ end: block.id }, …)`. */
171
+ suggestText: (payload: BlockOperations["suggestText"]) => void;
172
+ /** @deprecated `suggestion.accept()`. */
97
173
  acceptSuggestedText: () => void;
98
- deleteContentAtRange: (args_0: {
174
+ deleteContentAtRange: (payload: {
99
175
  start: [number, number];
100
176
  end: [number, number];
101
- }) => void;
177
+ }, plan?: import("../crdt/index.js").Prepared | undefined) => void;
178
+ /** Mark an element inside the block's markup as non-editable chrome (a header, a caption bar). */
102
179
  void: (node: HTMLElement) => void;
103
- constructor({ parent, block, yBlock, edytor }: {
104
- parent?: Block;
105
- edytor: Edytor;
106
- } & ({
107
- yBlock?: undefined;
108
- block: JSONBlock;
109
- } | {
110
- yBlock: YBlock;
111
- block?: undefined;
112
- } | {
113
- yBlock: YBlock;
114
- block: JSONBlock & {
115
- type: 'root';
116
- };
117
- }));
180
+ /**
181
+ * The text segment that displays block offset `offset`, and the offset in
182
+ * it — the one offset → segment mapper over the committed parts (a
183
+ * boundary before an atom reads the text before it; past the end, the
184
+ * last text's end).
185
+ */
186
+ textAtOffset: (offset: number) => {
187
+ text: Text;
188
+ offset: number;
189
+ } | null;
190
+ /**
191
+ * Insert children at `index`: a JSON spec is created (its id kept, minted
192
+ * when missing); a block handle moves there with its identity.
193
+ */
194
+ insertChildren: (index: number, blocks: (JSONBlock | Block)[]) => void;
195
+ /** Delete `length` visible children from `index`, each with its subtree (a document delete). */
196
+ deleteChildren: (index: number, length?: number) => void;
197
+ /**
198
+ * Insert content before part `index` (a text segment or an inline atom):
199
+ * each entry is a text's runs or an atom, as JSON.
200
+ */
201
+ insertParts: (index: number, parts: (JSONText[] | JSONInlineBlock)[]) => void;
202
+ /**
203
+ * Register the element the core rendered for this block (O45) and run the
204
+ * attach hooks. A re-rendered block (moved, re-parented) keeps its declared
205
+ * view state (R11): an open toggle stays open.
206
+ */
118
207
  attach: (node: HTMLElement) => {
119
208
  destroy: () => void;
120
209
  };
121
210
  }
122
- export declare function observeChildren(this: Block, event: Y.YArrayEvent<YBlock>): void;
123
- export declare function observeContent(this: Block, event: Y.YArrayEvent<YBlock | Y.Text>): void;