edytor 1.0.0 → 3.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 (287) hide show
  1. package/README.md +26 -69
  2. package/dist/block/block.svelte.d.ts +6 -4
  3. package/dist/block/block.svelte.js +12 -8
  4. package/dist/block/inlineBlock.svelte.d.ts +6 -2
  5. package/dist/block/inlineBlock.svelte.js +7 -2
  6. package/dist/clipboard/htmlFlow.d.ts +20 -7
  7. package/dist/clipboard/htmlFlow.js +23 -15
  8. package/dist/clipboard/serializeClipboardFragment.d.ts +37 -4
  9. package/dist/clipboard/serializeClipboardFragment.js +6 -4
  10. package/dist/clipboard/textBlocks.d.ts +8 -0
  11. package/dist/clipboard/textBlocks.js +6 -2
  12. package/dist/cloudflare/room/admission.js +3 -3
  13. package/dist/cloudflare/room/context.d.ts +7 -1
  14. package/dist/cloudflare/routeDocumentSocket.d.ts +17 -0
  15. package/dist/cloudflare/routeDocumentSocket.js +53 -0
  16. package/dist/collaboration/awarenessSelection.d.ts +22 -1
  17. package/dist/collaboration/awarenessSelection.js +42 -0
  18. package/dist/collaboration/comments/client.d.ts +1 -1
  19. package/dist/collaboration/comments/client.js +1 -1
  20. package/dist/collaboration/remoteSelection.js +3 -3
  21. package/dist/components/Block.svelte +3 -1
  22. package/dist/components/Edytor.svelte +38 -20
  23. package/dist/components/Edytor.svelte.d.ts +9 -4
  24. package/dist/components/InlineBlock.svelte +1 -1
  25. package/dist/crdt/admission.d.ts +5 -10
  26. package/dist/crdt/admission.js +5 -11
  27. package/dist/crdt/data.d.ts +10 -0
  28. package/dist/crdt/data.js +20 -2
  29. package/dist/crdt/doc/funnel.d.ts +7 -6
  30. package/dist/crdt/doc/funnel.js +10 -9
  31. package/dist/crdt/doc/gate.d.ts +0 -17
  32. package/dist/crdt/doc/gate.js +2 -41
  33. package/dist/crdt/doc/history.js +2 -2
  34. package/dist/crdt/doc/reads.d.ts +7 -0
  35. package/dist/crdt/doc/reads.js +11 -1
  36. package/dist/crdt/document.d.ts +13 -14
  37. package/dist/crdt/document.js +17 -19
  38. package/dist/crdt/edytor-doc.d.ts +22 -4
  39. package/dist/crdt/edytor-doc.js +5 -8
  40. package/dist/crdt/index.d.ts +9 -3
  41. package/dist/crdt/index.js +2 -2
  42. package/dist/crdt/operations.d.ts +1 -1
  43. package/dist/crdt/operations.js +1 -0
  44. package/dist/crdt/props.d.ts +32 -0
  45. package/dist/crdt/props.js +172 -0
  46. package/dist/crdt/protocol.d.ts +2 -2
  47. package/dist/crdt/protocol.js +2 -2
  48. package/dist/crdt/providers/index.d.ts +1 -1
  49. package/dist/crdt/providers/room.d.ts +10 -9
  50. package/dist/crdt/providers/room.js +13 -10
  51. package/dist/crdt/providers/websocket.d.ts +1 -1
  52. package/dist/crdt/providers/websocket.js +28 -29
  53. package/dist/crdt/semantics.js +3 -1
  54. package/dist/dnd/autoScroll.d.ts +15 -7
  55. package/dist/dnd/autoScroll.js +10 -15
  56. package/dist/{plugins/blockHandles → dnd}/dropIndicator.d.ts +2 -2
  57. package/dist/{plugins/blockHandles → dnd}/dropIndicator.js +2 -5
  58. package/dist/dnd/external.d.ts +6 -0
  59. package/dist/dnd/external.js +17 -0
  60. package/dist/{plugins/blockHandles → dnd}/geometry.d.ts +4 -2
  61. package/dist/{plugins/blockHandles → dnd}/geometry.js +3 -4
  62. package/dist/dnd/placement.d.ts +200 -0
  63. package/dist/dnd/placement.js +426 -0
  64. package/dist/dnd/pragmatic.d.ts +3 -1
  65. package/dist/dnd/pragmatic.js +12 -2
  66. package/dist/dnd/vendor/pragmatic/UPSTREAM.md +51 -18
  67. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.d.ts +4 -0
  68. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.js +6 -0
  69. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.d.ts +0 -2
  70. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.js +4 -22
  71. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter-types.d.ts +26 -0
  72. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.d.ts +30 -0
  73. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.js +203 -0
  74. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-items.js +13 -0
  75. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-types.js +9 -0
  76. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/is-an-available-type.js +19 -0
  77. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.d.ts +4 -0
  78. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.js +6 -0
  79. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js +4 -16
  80. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/internal-types.d.ts +1 -8
  81. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-drop-target.js +5 -6
  82. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-monitor.js +2 -3
  83. 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
  84. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.js +6 -24
  85. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.d.ts +2 -0
  86. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.js +5 -0
  87. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.d.ts +3 -0
  88. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.js +12 -0
  89. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/native-types.d.ts +12 -0
  90. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window-in-safari.js +10 -0
  91. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window.js +55 -0
  92. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.d.ts +4 -0
  93. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.js +8 -0
  94. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/internal-types.d.ts +0 -4
  95. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/get-scroll-by.js +16 -72
  96. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/try-scroll.js +1 -9
  97. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/configuration.js +4 -29
  98. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-scroll-change.js +2 -3
  99. package/dist/edytor.svelte.d.ts +19 -9
  100. package/dist/edytor.svelte.js +28 -33
  101. package/dist/events/beforeInputCommands.d.ts +2 -2
  102. package/dist/events/beforeInputCommands.js +8 -4
  103. package/dist/events/onBeforeInput.js +1 -1
  104. package/dist/events/onDrop.js +25 -10
  105. package/dist/events/onInput.d.ts +0 -12
  106. package/dist/events/onInput.js +1 -67
  107. package/dist/events/onPaste.d.ts +2 -1
  108. package/dist/events/onPaste.js +8 -3
  109. package/dist/export/forms.d.ts +627 -0
  110. package/dist/export/forms.js +749 -0
  111. package/dist/export/index.d.ts +170 -0
  112. package/dist/export/index.js +161 -0
  113. package/dist/export/markdown.d.ts +41 -0
  114. package/dist/export/markdown.js +585 -0
  115. package/dist/export/markdownWriter.d.ts +9 -0
  116. package/dist/export/markdownWriter.js +133 -0
  117. package/dist/export/mdx.d.ts +15 -0
  118. package/dist/export/mdx.js +33 -0
  119. package/dist/index.d.ts +4 -4
  120. package/dist/index.js +2 -2
  121. package/dist/kinds.js +1 -1
  122. package/dist/labels.d.ts +2 -0
  123. package/dist/labels.js +2 -1
  124. package/dist/plugins/anchored.svelte.d.ts +21 -25
  125. package/dist/plugins/anchored.svelte.js +23 -39
  126. package/dist/plugins/arrowMove/arrowMove.d.ts +1 -1
  127. package/dist/plugins/arrowMove/arrowMove.js +1 -1
  128. package/dist/plugins/blockHandles/BlockHandleController.svelte.d.ts +2 -122
  129. package/dist/plugins/blockHandles/BlockHandleController.svelte.js +48 -414
  130. package/dist/plugins/blockHandles/BlockHandles.svelte +14 -32
  131. package/dist/plugins/blockHandles/blockHandlesPlugin.js +2 -1
  132. package/dist/plugins/blockHandles/dragPreview.d.ts +26 -7
  133. package/dist/plugins/blockHandles/dragPreview.js +33 -0
  134. package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +5 -0
  135. package/dist/plugins/blockMenu/BlockMenuController.svelte.js +7 -2
  136. package/dist/plugins/blockMenu/blockMenuPlugin.js +5 -50
  137. package/dist/plugins/chrome.d.ts +27 -5
  138. package/dist/plugins/chrome.js +24 -9
  139. package/dist/plugins/code/CodeHeader.svelte +5 -3
  140. package/dist/plugins/code/CodePlugin.svelte +15 -12
  141. package/dist/plugins/code/header.svelte.js +7 -11
  142. package/dist/plugins/code/languageMenu.svelte.d.ts +5 -2
  143. package/dist/plugins/code/languageMenu.svelte.js +13 -20
  144. package/dist/plugins/code/languages.d.ts +0 -3
  145. package/dist/plugins/code/languages.js +0 -2
  146. package/dist/plugins/columns/ColumnResize.svelte +3 -2
  147. package/dist/plugins/columns/ColumnsPlugin.svelte +8 -21
  148. package/dist/plugins/columns/gaps.d.ts +7 -5
  149. package/dist/plugins/columns/gaps.js +11 -6
  150. package/dist/plugins/columns/resize.svelte.d.ts +5 -6
  151. package/dist/plugins/columns/resize.svelte.js +12 -14
  152. package/dist/plugins/comments/CommentsController.svelte.d.ts +6 -0
  153. package/dist/plugins/comments/CommentsController.svelte.js +20 -0
  154. package/dist/plugins/equation/EquationPlugin.svelte +13 -30
  155. package/dist/plugins/equation/EquationPlugin.svelte.d.ts +1 -0
  156. package/dist/plugins/equation/equation.css +7 -0
  157. package/dist/plugins/equation/equation.svelte.d.ts +7 -15
  158. package/dist/plugins/equation/equation.svelte.js +13 -50
  159. package/dist/plugins/equation/tex.d.ts +17 -0
  160. package/dist/plugins/equation/tex.js +42 -0
  161. package/dist/plugins/fileDrop.d.ts +43 -0
  162. package/dist/plugins/fileDrop.js +122 -0
  163. package/dist/plugins/find/FindController.svelte.d.ts +5 -0
  164. package/dist/plugins/find/FindController.svelte.js +14 -14
  165. package/dist/plugins/find/findPlugin.js +1 -15
  166. package/dist/plugins/image/ImageChrome.svelte +8 -2
  167. package/dist/plugins/image/ImagePlugin.svelte +56 -84
  168. package/dist/plugins/image/ImagePlugin.svelte.d.ts +13 -1
  169. package/dist/plugins/image/controls.svelte.js +16 -2
  170. package/dist/plugins/image/image.css +17 -0
  171. package/dist/plugins/image/toolbar.svelte.d.ts +5 -4
  172. package/dist/plugins/image/toolbar.svelte.js +21 -31
  173. package/dist/plugins/index.d.ts +4 -5
  174. package/dist/plugins/index.js +0 -1
  175. package/dist/plugins/list.svelte.d.ts +9 -0
  176. package/dist/plugins/list.svelte.js +18 -0
  177. package/dist/plugins/markdownShortcuts.js +5 -5
  178. package/dist/plugins/marquee/marqueePlugin.js +0 -4
  179. package/dist/plugins/media/AudioPlugin.svelte +13 -1
  180. package/dist/plugins/media/AudioPlugin.svelte.d.ts +11 -1
  181. package/dist/plugins/media/BookmarkPlugin.svelte +6 -97
  182. package/dist/plugins/media/EmbedPlugin.svelte +5 -90
  183. package/dist/plugins/media/EmptySlot.svelte +36 -20
  184. package/dist/plugins/media/EmptySlot.svelte.d.ts +6 -15
  185. package/dist/plugins/media/FilePlugin.svelte +12 -20
  186. package/dist/plugins/media/FilePlugin.svelte.d.ts +9 -0
  187. package/dist/plugins/media/MediaEmpty.svelte +2 -55
  188. package/dist/plugins/media/MediaEmpty.svelte.d.ts +18 -14
  189. package/dist/plugins/media/SourceBlock.svelte +178 -52
  190. package/dist/plugins/media/SourceBlock.svelte.d.ts +13 -6
  191. package/dist/plugins/media/UploadPreview.svelte +32 -0
  192. package/dist/plugins/media/UploadPreview.svelte.d.ts +11 -0
  193. package/dist/plugins/media/VideoPlugin.svelte +13 -1
  194. package/dist/plugins/media/VideoPlugin.svelte.d.ts +11 -1
  195. package/dist/plugins/media/empty.svelte.d.ts +13 -4
  196. package/dist/plugins/media/empty.svelte.js +32 -26
  197. package/dist/plugins/media/media.d.ts +9 -63
  198. package/dist/plugins/media/media.js +1 -194
  199. package/dist/plugins/media/sources.d.ts +60 -0
  200. package/dist/plugins/media/sources.js +165 -0
  201. package/dist/plugins/media/upload.css +23 -0
  202. package/dist/plugins/media/urlPaste.svelte.d.ts +2 -1
  203. package/dist/plugins/media/urlPaste.svelte.js +12 -21
  204. package/dist/plugins/mention/MentionPlugin.svelte +50 -38
  205. package/dist/plugins/mention/MentionPlugin.svelte.d.ts +11 -2
  206. package/dist/plugins/mention/mention.css +6 -0
  207. package/dist/plugins/page/PagePlugin.svelte +2 -9
  208. package/dist/plugins/page/page.js +1 -1
  209. package/dist/plugins/pageLink/PageLinkPlugin.svelte +126 -28
  210. package/dist/plugins/pageLink/PageLinkPlugin.svelte.d.ts +13 -1
  211. package/dist/plugins/pageLink/pageLink.css +6 -0
  212. package/dist/plugins/richtext/RichTextPlugin.svelte +99 -204
  213. package/dist/plugins/richtext/RichTextPlugin.svelte.d.ts +1 -0
  214. package/dist/plugins/richtext/body.js +1 -1
  215. package/dist/plugins/richtext/calloutIcons.svelte.d.ts +2 -2
  216. package/dist/plugins/richtext/calloutIcons.svelte.js +5 -7
  217. package/dist/plugins/richtext/richTextOperations.d.ts +1 -19
  218. package/dist/plugins/richtext/richTextOperations.js +3 -49
  219. package/dist/plugins/richtext/richtext.css +6 -0
  220. package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +2 -0
  221. package/dist/plugins/slashMenu/SlashMenuController.svelte.js +7 -0
  222. package/dist/plugins/slashMenu/slashMenuPlugin.js +5 -14
  223. package/dist/plugins/table/TableChrome.svelte +2 -3
  224. package/dist/plugins/table/TablePlugin.svelte +20 -54
  225. package/dist/plugins/table/chrome.svelte.d.ts +5 -2
  226. package/dist/plugins/table/chrome.svelte.js +33 -56
  227. package/dist/plugins/table/table.js +3 -3
  228. package/dist/plugins/toc/TocPlugin.svelte +2 -4
  229. package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +7 -0
  230. package/dist/plugins/toolbar/ToolbarController.svelte.js +20 -13
  231. package/dist/plugins/toolbar/toolbarPlugin.js +19 -53
  232. package/dist/plugins/triggers/TriggerController.svelte.d.ts +7 -2
  233. package/dist/plugins/triggers/TriggerController.svelte.js +11 -4
  234. package/dist/plugins/triggers/place.js +1 -2
  235. package/dist/plugins/triggers/triggers.d.ts +6 -1
  236. package/dist/plugins/triggers/triggers.js +12 -13
  237. package/dist/plugins/uploads.svelte.d.ts +48 -32
  238. package/dist/plugins/uploads.svelte.js +119 -43
  239. package/dist/plugins.d.ts +66 -14
  240. package/dist/plugins.js +0 -24
  241. package/dist/selection/replaceSelection.js +2 -2
  242. package/dist/selection/selection.svelte.d.ts +4 -10
  243. package/dist/selection/selection.svelte.js +7 -11
  244. package/dist/session/attempt.d.ts +16 -6
  245. package/dist/session/attempt.js +1 -0
  246. package/dist/session/bindings.js +35 -32
  247. package/dist/session/commands.d.ts +7 -11
  248. package/dist/session/commands.js +15 -19
  249. package/dist/session/history.js +1 -0
  250. package/dist/session/inputRules.d.ts +6 -3
  251. package/dist/session/inputRules.js +10 -6
  252. package/dist/session/moves.d.ts +33 -0
  253. package/dist/session/moves.js +71 -1
  254. package/dist/session/navigation.d.ts +7 -0
  255. package/dist/session/navigation.js +20 -11
  256. package/dist/session/props.d.ts +28 -0
  257. package/dist/session/props.js +65 -0
  258. package/dist/session/suggestions.svelte.d.ts +0 -11
  259. package/dist/session/suggestions.svelte.js +15 -3
  260. package/dist/session/uploads.d.ts +29 -0
  261. package/dist/session/uploads.js +10 -0
  262. package/dist/surface/lines.js +1 -3
  263. package/dist/surface/observer.svelte.d.ts +17 -1
  264. package/dist/surface/observer.svelte.js +72 -17
  265. package/dist/surface/overlay.d.ts +0 -14
  266. package/dist/surface/overlay.js +0 -25
  267. package/dist/surface/projector.svelte.js +1 -1
  268. package/dist/text/text.svelte.js +3 -13
  269. package/dist/themes/notion.css +9 -0
  270. package/dist/utils/sanitize.d.ts +38 -0
  271. package/dist/utils/sanitize.js +82 -0
  272. package/dist/utils.d.ts +2 -0
  273. package/dist/utils.js +5 -0
  274. package/package.json +18 -1
  275. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/max-z-index.js +0 -3
  276. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/supports-popover.js +0 -16
  277. package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-axis-allowed.js +0 -3
  278. package/dist/plugins/code/LanguageMenu.svelte +0 -25
  279. package/dist/plugins/code/LanguageMenu.svelte.d.ts +0 -9
  280. package/dist/plugins/equation/EquationEditor.svelte +0 -27
  281. package/dist/plugins/equation/EquationEditor.svelte.d.ts +0 -9
  282. package/dist/plugins/image/ImageToolbarHost.svelte +0 -37
  283. package/dist/plugins/image/ImageToolbarHost.svelte.d.ts +0 -9
  284. package/dist/plugins/richtext/CalloutIconPicker.svelte +0 -26
  285. package/dist/plugins/richtext/CalloutIconPicker.svelte.d.ts +0 -9
  286. /package/dist/{plugins/columns → dnd}/stacking.d.ts +0 -0
  287. /package/dist/{plugins/columns → dnd}/stacking.js +0 -0
@@ -86,20 +86,3 @@ export declare class SchemaMismatchError extends Error {
86
86
  * mutating a synced document.
87
87
  */
88
88
  export declare const assertSchema: (doc: EngineDoc, docName?: string) => void;
89
- /**
90
- * Error raised by {@link assertUsableDoc} — the doc cannot host a v14 facade:
91
- * a foreign engine object (a v13 `yjs` Doc — a different CRDT implementation
92
- * entirely).
93
- */
94
- export declare class UnsupportedDocError extends Error {
95
- readonly kind: 'foreign';
96
- constructor(kind: 'foreign');
97
- }
98
- /**
99
- * Document-boundary guard run by {@link EdytorDocBinding.create} before the
100
- * runs view attaches. The facade only speaks the v14 unified-node surface —
101
- * without this gate a foreign doc dies obscurely inside `buildView`
102
- * (`registry.forEachAttr is not a function`); it fails fast with an
103
- * actionable error instead.
104
- */
105
- export declare const assertUsableDoc: (doc: EngineDoc) => void;
@@ -1,4 +1,4 @@
1
- import { isNodeLike, SCHEMA } from '../schema.js';
1
+ import { SCHEMA } from '../schema.js';
2
2
  export const SCHEMA_VERSION = SCHEMA.version;
3
3
  export const SCHEMA_NAME = SCHEMA.name;
4
4
  export const META_KEY = SCHEMA.roots.meta;
@@ -51,13 +51,7 @@ export class SchemaMismatchError extends Error {
51
51
  docName;
52
52
  problem;
53
53
  constructor(docName, problem) {
54
- super(problem.kind === 'unversioned'
55
- ? `Document "${docName}" carries replicated registry state but no meta.v schema version — refusing to treat it as initialized.`
56
- : problem.kind === 'unsupported'
57
- ? `Document "${docName}" claims unsupported schema version ${problem.version} (this build speaks ${SCHEMA_VERSION}).`
58
- : problem.schema === undefined
59
- ? `Document "${docName}" carries meta.v=${problem.version} but no meta.schema manifest name — refusing it as an "${SCHEMA_NAME}" document.`
60
- : `Document "${docName}" claims foreign schema "${String(problem.schema)}" (this build speaks "${SCHEMA_NAME}").`);
54
+ super(`${docName}: ${problem.kind} schema version ${problem.version} "${String(problem.schema)}" (this build speaks ${SCHEMA_VERSION} "${SCHEMA_NAME}")`);
61
55
  this.docName = docName;
62
56
  this.problem = problem;
63
57
  this.name = 'SchemaMismatchError';
@@ -73,36 +67,3 @@ export const assertSchema = (doc, docName = 'doc') => {
73
67
  if (problem !== null)
74
68
  throw new SchemaMismatchError(docName, problem);
75
69
  };
76
- /**
77
- * Error raised by {@link assertUsableDoc} — the doc cannot host a v14 facade:
78
- * a foreign engine object (a v13 `yjs` Doc — a different CRDT implementation
79
- * entirely).
80
- */
81
- export class UnsupportedDocError extends Error {
82
- kind;
83
- constructor(kind) {
84
- super('Document is not a v14 engine doc — the `blocks` registry is not a ' +
85
- 'unified Y.Node. Use `crdt.createDoc()` (or `new Y.Doc()` from `edytor/crdt`).');
86
- this.kind = kind;
87
- this.name = 'UnsupportedDocError';
88
- }
89
- }
90
- /**
91
- * Document-boundary guard run by {@link EdytorDocBinding.create} before the
92
- * runs view attaches. The facade only speaks the v14 unified-node surface —
93
- * without this gate a foreign doc dies obscurely inside `buildView`
94
- * (`registry.forEachAttr is not a function`); it fails fast with an
95
- * actionable error instead.
96
- */
97
- export const assertUsableDoc = (doc) => {
98
- let registry;
99
- try {
100
- registry = typeof doc?.get === 'function' ? doc.get(SCHEMA.roots.registry) : undefined;
101
- }
102
- catch {
103
- registry = undefined;
104
- }
105
- if (!isNodeLike(registry) || typeof registry.forEachAttr !== 'function') {
106
- throw new UnsupportedDocError('foreign');
107
- }
108
- };
@@ -15,7 +15,7 @@ import { readHorizon } from '../purge.js';
15
15
  import { BLOCK_NODE, DATA_LEAF_PREFIX, DOC_DATA_ROOT, HORIZON_ROOT, INLINE_NODE, LAST_CHANGED_ATTR, TYPE } from '../schema.js';
16
16
  import { changedUnder, collectable, collectNow, collects, dropSearchMarkers, engineOps, walkIdSet } from '../structs.js';
17
17
  import { isInitialized } from './gate.js';
18
- import { EdytorDocDisposedError } from './funnel.js';
18
+ import { DocumentDestroyedError } from './funnel.js';
19
19
  import { registryOf, withdrawOnUndo } from '../placement/model.js';
20
20
  /** The undo steps a document's history keeps by default: older ones are released. */
21
21
  export const DEFAULT_HISTORY_LIMIT = 200;
@@ -367,7 +367,7 @@ export const docHistory = (c) => {
367
367
  */
368
368
  const createUndoManager = (options = {}) => {
369
369
  if (disposed()) {
370
- throw new EdytorDocDisposedError('createUndoManager');
370
+ throw new DocumentDestroyedError('createUndoManager');
371
371
  }
372
372
  write(() => {
373
373
  if (!isInitialized(doc))
@@ -1,6 +1,7 @@
1
1
  import type { EngineApi, EngineDoc, EngineNode } from '../engine-api.js';
2
2
  import { type BlockId, type ContentItem, type Destination, type ModelView } from '../placement/model.js';
3
3
  import type { DisplayRoles, RunView } from '../text/runs.js';
4
+ import { type DataPatch } from '../data.js';
4
5
  import { type JSONBlock } from '../../utils/json.js';
5
6
  import type { BlockRole, DataTarget, JsonObj, OrderPolicy } from './types.js';
6
7
  /** What every part of a document facade is built over: one doc, its engine layers, its index and its roles. */
@@ -25,6 +26,12 @@ export declare const docReads: (c: DocBase) => {
25
26
  blockDataOf: (id: BlockId) => Record<string, unknown> | undefined;
26
27
  docData: () => JsonObj;
27
28
  dataItemIds: (target: DataTarget, path: readonly string[]) => string[];
29
+ dataPreview: (target: DataTarget, pending: readonly DataPatch[]) => {
30
+ data: {
31
+ [x: string]: unknown;
32
+ };
33
+ ids: (path: readonly string[]) => string[];
34
+ } | null;
28
35
  childrenIds: (parent: BlockId | null) => BlockId[];
29
36
  positionOf: (id: BlockId) => Destination | null;
30
37
  pathOf: (id: BlockId) => number[] | null;
@@ -9,7 +9,7 @@ import { DOC_DATA_ROOT, TYPE } from '../schema.js';
9
9
  import { blockNodeOf, displayParentOf, displaySlotOf, isLive, isLiveIn, positionInView, positionOf as modelPositionOf } from '../placement/model.js';
10
10
  import { DEAD, findAtom, ownedLength } from '../text/model.js';
11
11
  import { holdsPending } from '../structs.js';
12
- import { itemIds, readData } from '../data.js';
12
+ import { itemIds, previewData, readData } from '../data.js';
13
13
  import { columnIds, listedColumns, unlistedOrder } from '../tables.js';
14
14
  import { cloneJsonSafe } from '../../utils/json.js';
15
15
  import { ref } from './plan.js';
@@ -69,6 +69,15 @@ export const docReads = (c) => {
69
69
  const node = dataNode(id && ref(id), atom && ref(atom));
70
70
  return node && Array.isArray(path) ? itemIds(node, path) : [];
71
71
  };
72
+ /**
73
+ * A block's, an atom's or the document's data once `pending` patches are
74
+ * applied, without writing them, and its array items' ids (`previewData`):
75
+ * what a view reads of its data writes not yet dispatched.
76
+ */
77
+ const dataPreview = (target, pending) => {
78
+ const [id, atom] = typeof target === 'object' && target ? [target.block, target.atom] : [target ?? undefined];
79
+ return previewData(dataNode(id && ref(id), atom && ref(atom)), pending);
80
+ };
72
81
  /** Ordered visible children of `parent` (`null` = root) — canonical read. */
73
82
  const childrenIds = (parent) => (view().kids.get(parent) ?? []).map((k) => k.id);
74
83
  const positionOf = (id) => modelPositionOf(doc, id);
@@ -302,6 +311,7 @@ export const docReads = (c) => {
302
311
  blockDataOf,
303
312
  docData,
304
313
  dataItemIds,
314
+ dataPreview,
305
315
  childrenIds,
306
316
  positionOf,
307
317
  pathOf,
@@ -64,7 +64,7 @@
64
64
  * - `createDocument` — the fresh doc is trivially admitted;
65
65
  * - `loadDocument` — the payload is decoded+integrated onto a SCRATCH
66
66
  * doc first (`admitUpdate`) and the gate runs on the merged result; a
67
- * refusal ({@link UndecodableUpdateError}, {@link UnsupportedDocError},
67
+ * refusal ({@link UndecodableUpdateError},
68
68
  * {@link SchemaMismatchError}) leaves nothing composed and never
69
69
  * touches the caller's bytes;
70
70
  * - `attachDocument` — the borrowed doc is gated BEFORE any composition
@@ -144,7 +144,7 @@ import type { MarkEdge } from './text/marks.js';
144
144
  import type { EngineApi, EngineDoc, YDoc, YUndoManager } from './engine-api.js';
145
145
  import { type DocumentOperations } from './operations.js';
146
146
  import { type AttributionBinding, type DocumentAttribution } from './attribution/index.js';
147
- import { type BlockRole, type DocFacade, type EdytorDocConfig } from './edytor-doc.js';
147
+ import { DocumentDestroyedError, type BlockRole, type DocFacade, type EdytorDocConfig } from './edytor-doc.js';
148
148
  import { Awareness } from './protocols/awareness.js';
149
149
  import type { EdytorSync, EdytorSyncCleanup } from './providers/index.js';
150
150
  import { SyncRefusedError } from './providers/room.js';
@@ -243,19 +243,11 @@ export type CreateDocumentOptions = DocumentOptions & {
243
243
  value?: JSONDoc;
244
244
  };
245
245
  export type LoadDocumentOptions = DocumentOptions;
246
+ export { DocumentDestroyedError };
246
247
  /** Raised when a readiness-gated service is used on a pending document. */
247
248
  export declare class DocumentNotReadyError extends Error {
248
249
  constructor(service: string);
249
250
  }
250
- /**
251
- * Raised when an operation runs against a torn-down document — every
252
- * attach reference has been released and the facade/history/awareness
253
- * teardown already ran. Distinct from {@link DocumentNotReadyError}:
254
- * destroyed is terminal, pending may still resolve.
255
- */
256
- export declare class DocumentDestroyedError extends Error {
257
- constructor(service?: string);
258
- }
259
251
  /**
260
252
  * How the document's content state was decided — the distinction the
261
253
  * readiness contract requires:
@@ -353,6 +345,14 @@ export declare class EdytorDocument {
353
345
  private _destroyed;
354
346
  /** {@link DocumentOptions.requireHydration}: an empty document waits for a provider's `synced`. */
355
347
  readonly requireHydration: boolean;
348
+ /**
349
+ * The document's properties as a live object (`crdt/props`): a read
350
+ * follows the document, and a write at any depth (`document.data.title
351
+ * = 'Notes'`, `document.data.tags.push('x')`, `delete …`) is the raw
352
+ * `patchData` operation at once, as `document.patchData(null, …)`. Not
353
+ * reactive by itself: a view's `edytor.data` is, and dispatches.
354
+ */
355
+ get data(): Record<string, any>;
356
356
  /** The replica id (`doc.clientID`) — identifies the replica, not the actor. */
357
357
  get clientID(): number;
358
358
  /**
@@ -633,9 +633,8 @@ export declare const bindDocument: (Y: EngineApi) => {
633
633
  * borrowed doc. Content state stays `pending` — the caller (view or
634
634
  * provider path) drives `sync()`.
635
635
  *
636
- * Admission runs BEFORE any composition touches the doc: a
637
- * foreign engine object refuses with {@link UnsupportedDocError}, an
638
- * unversioned/unsupported/foreign schema claim with
636
+ * Admission runs BEFORE any composition touches the doc: an
637
+ * unversioned/unsupported/foreign schema claim refuses with
639
638
  * {@link SchemaMismatchError} — the borrowed doc is left
640
639
  * byte-identical (the gate reads are write-free) and can be
641
640
  * attached once its state heals (e.g. a remote update supplies the
@@ -2,9 +2,10 @@ import { DEV } from 'esm-env';
2
2
  import { Y } from './engine.js';
3
3
  import { asEngineDoc } from './structs.js';
4
4
  import { DOCUMENT_OPERATIONS } from './operations.js';
5
+ import { propsProxy } from './props.js';
5
6
  import { bindAttribution } from './attribution/index.js';
6
7
  import { profileOf } from './attribution/attribution.js';
7
- import { docFacade, DEFAULT_HISTORY_LIMIT, isInitialized } from './edytor-doc.js';
8
+ import { docFacade, DocumentDestroyedError, DEFAULT_HISTORY_LIMIT, isInitialized } from './edytor-doc.js';
8
9
  import { assertAdmission, assertSchema, bindAdmission, checkSchema } from './admission.js';
9
10
  import { Awareness } from './protocols/awareness.js';
10
11
  import { callEach } from './protocols/observable.js';
@@ -17,27 +18,14 @@ const alive = (document, op) => {
17
18
  if (document.destroyed)
18
19
  throw new DocumentDestroyedError(op);
19
20
  };
21
+ export { DocumentDestroyedError };
20
22
  /** Raised when a readiness-gated service is used on a pending document. */
21
23
  export class DocumentNotReadyError extends Error {
22
24
  constructor(service) {
23
- super(`EdytorDocument.${service}: document is not ready — it is still pending ` +
24
- `(created without a value, provider hydration may be in flight). ` +
25
- `Wait for the sync callback / call document.sync() first.`);
25
+ super(`${service}: the document is not ready (call document.sync() first)`);
26
26
  this.name = 'DocumentNotReadyError';
27
27
  }
28
28
  }
29
- /**
30
- * Raised when an operation runs against a torn-down document — every
31
- * attach reference has been released and the facade/history/awareness
32
- * teardown already ran. Distinct from {@link DocumentNotReadyError}:
33
- * destroyed is terminal, pending may still resolve.
34
- */
35
- export class DocumentDestroyedError extends Error {
36
- constructor(service) {
37
- super(`EdytorDocument${service ? `.${service}` : ''}: document is destroyed.`);
38
- this.name = 'DocumentDestroyedError';
39
- }
40
- }
41
29
  /**
42
30
  * How long (ms) an empty document waits for a provider that has not
43
31
  * settled before it decides without it (settle-or-bound) — the bound a
@@ -237,6 +225,17 @@ export class EdytorDocument {
237
225
  else if (DEV)
238
226
  advertise(this.awareness, this.#capability.config, this.#defaultType);
239
227
  }
228
+ #data;
229
+ /**
230
+ * The document's properties as a live object (`crdt/props`): a read
231
+ * follows the document, and a write at any depth (`document.data.title
232
+ * = 'Notes'`, `document.data.tags.push('x')`, `delete …`) is the raw
233
+ * `patchData` operation at once, as `document.patchData(null, …)`. Not
234
+ * reactive by itself: a view's `edytor.data` is, and dispatches.
235
+ */
236
+ get data() {
237
+ return (this.#data ??= propsProxy(() => this.facade.docData(), (patches) => void this.facade.apply(this.facade.prepare.patchData(null, patches)), (path) => this.facade.dataItemIds(null, path)));
238
+ }
240
239
  /** The replica id (`doc.clientID`) — identifies the replica, not the actor. */
241
240
  get clientID() {
242
241
  return this.doc.clientID;
@@ -914,9 +913,8 @@ export const bindDocument = (Y) => {
914
913
  * borrowed doc. Content state stays `pending` — the caller (view or
915
914
  * provider path) drives `sync()`.
916
915
  *
917
- * Admission runs BEFORE any composition touches the doc: a
918
- * foreign engine object refuses with {@link UnsupportedDocError}, an
919
- * unversioned/unsupported/foreign schema claim with
916
+ * Admission runs BEFORE any composition touches the doc: an
917
+ * unversioned/unsupported/foreign schema claim refuses with
920
918
  * {@link SchemaMismatchError} — the borrowed doc is left
921
919
  * byte-identical (the gate reads are write-free) and can be
922
920
  * attached once its state heals (e.g. a remote update supplies the
@@ -5,7 +5,7 @@ import { bindText } from './text/model.js';
5
5
  import { type RunView } from './text/runs.js';
6
6
  import { type BlockAttribution } from './attribution/block.js';
7
7
  import type { JSONBlock, JSONDoc } from '../utils/json.js';
8
- import { assertSchema, assertUsableDoc, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
8
+ import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
9
9
  import type { EngineNode } from './engine-api.js';
10
10
  import type { ContentItem, InlineSpec, ModelView, SplitTail } from './placement/model.js';
11
11
  import type { Anchor } from './text/model.js';
@@ -14,10 +14,10 @@ import type { DocPosition } from './rangeDelete.js';
14
14
  import type { DataPatch } from './data.js';
15
15
  import type { AnchorAffinity, BlockRole, DataTarget, DocAnchor, DocChange, EdytorDocConfig, JsonObj, OpResult, OrderPolicy, Plan, PlanEffect, PlanStep, Prepared, TextRange } from './doc/types.js';
16
16
  export { SCHEMA };
17
- export { assertSchema, assertUsableDoc, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
18
- export { UnsupportedDocError, type SchemaProblem } from './doc/gate.js';
17
+ export { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
18
+ export type { SchemaProblem } from './doc/gate.js';
19
19
  export { SEED_ORIGIN } from './doc/seed.js';
20
- export { EdytorDocDisposedError } from './doc/funnel.js';
20
+ export { DocumentDestroyedError } from './doc/funnel.js';
21
21
  export { DEFAULT_HISTORY_LIMIT } from './doc/history.js';
22
22
  export type { AnchorAffinity, BlockRole, DataTarget, DocAnchor, DocChange, EdytorDocConfig, OpResult, OrderPolicy, Plan, PlanEffect, PlanStep, Prepared, TextRange };
23
23
  export type EdytorDoc = ReturnType<EdytorDocBinding['create']>;
@@ -168,6 +168,12 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
168
168
  blockDataOf: (id: string) => Record<string, unknown> | undefined;
169
169
  docData: () => JsonObj;
170
170
  dataItemIds: (target: DataTarget, path: readonly string[]) => string[];
171
+ dataPreview: (target: DataTarget, pending: readonly DataPatch[]) => {
172
+ data: {
173
+ [x: string]: unknown;
174
+ };
175
+ ids: (path: readonly string[]) => string[];
176
+ } | null;
171
177
  /**
172
178
  * Compact per-block attribution (`{createdBy, contributors,
173
179
  * lastChangedBy}`), or `undefined` for unauthored/system blocks.
@@ -482,6 +488,12 @@ export declare const bindDocModel: (Y: EngineApi) => {
482
488
  blockDataOf: (id: string) => Record<string, unknown> | undefined;
483
489
  docData: () => JsonObj;
484
490
  dataItemIds: (target: DataTarget, path: readonly string[]) => string[];
491
+ dataPreview: (target: DataTarget, pending: readonly DataPatch[]) => {
492
+ data: {
493
+ [x: string]: unknown;
494
+ };
495
+ ids: (path: readonly string[]) => string[];
496
+ } | null;
485
497
  /**
486
498
  * Compact per-block attribution (`{createdBy, contributors,
487
499
  * lastChangedBy}`), or `undefined` for unauthored/system blocks.
@@ -882,6 +894,12 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
882
894
  blockDataOf: (id: string) => Record<string, unknown> | undefined;
883
895
  docData: () => JsonObj;
884
896
  dataItemIds: (target: DataTarget, path: readonly string[]) => string[];
897
+ dataPreview: (target: DataTarget, pending: readonly DataPatch[]) => {
898
+ data: {
899
+ [x: string]: unknown;
900
+ };
901
+ ids: (path: readonly string[]) => string[];
902
+ } | null;
885
903
  /**
886
904
  * Compact per-block attribution (`{createdBy, contributors,
887
905
  * lastChangedBy}`), or `undefined` for unauthored/system blocks.
@@ -58,7 +58,7 @@ import { bindRuns, indexOf } from './text/runs.js';
58
58
  import { bindBlockAttribution, blockAttributionOf } from './attribution/block.js';
59
59
  import { rangeDeleteOps } from './rangeDelete.js';
60
60
  import { flowOps } from './flow.js';
61
- import { assertSchema, assertUsableDoc, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
61
+ import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
62
62
  import { bindSeed, restore } from './doc/seed.js';
63
63
  import { applied, ref } from './doc/plan.js';
64
64
  import { docReads } from './doc/reads.js';
@@ -76,10 +76,9 @@ import { metaOps } from './doc/meta.js';
76
76
  import { contentOps } from './doc/content.js';
77
77
  // ── schema manifest and gate (`doc/gate.ts`) ────────────────────────────
78
78
  export { SCHEMA };
79
- export { assertSchema, assertUsableDoc, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
80
- export { UnsupportedDocError } from './doc/gate.js';
79
+ export { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
81
80
  export { SEED_ORIGIN } from './doc/seed.js';
82
- export { EdytorDocDisposedError } from './doc/funnel.js';
81
+ export { DocumentDestroyedError } from './doc/funnel.js';
83
82
  export { DEFAULT_HISTORY_LIMIT } from './doc/history.js';
84
83
  /**
85
84
  * The per-doc facade factory over the engine `Y` (the editor's documents
@@ -94,9 +93,6 @@ export const docFacade = (Y, layers) => {
94
93
  const { init, seed } = bindSeed(Y, BA);
95
94
  return (doc, config = {}) => {
96
95
  keepingReplaced(doc);
97
- // Document-boundary check — foreign (v13-engine) and legacy-schema docs
98
- // fail fast here rather than inside the runs view (see assertUsableDoc).
99
- assertUsableDoc(doc);
100
96
  setMarkEdges(doc, config.markEdge ?? (() => undefined));
101
97
  const roleOf = config.roleOf ?? (() => undefined);
102
98
  const defaultType = config.defaultType ?? 'paragraph';
@@ -135,7 +131,7 @@ export const docFacade = (Y, layers) => {
135
131
  const base = { Y, doc, runsView, roles, roleOf, rendersContentOf };
136
132
  const reads = { ...base, ...docReads(base) };
137
133
  const shape = { ...reads, ...docCapability(reads) };
138
- const { blockJSON, view, blockTypeOf, blockDataOf, docData, dataItemIds, childrenIds, positionOf, pathOf, ancestorsOf, slotOf, isVoid, isIsland, isLines, islandOf, insideIsland, isLayout, isLayoutItem, order, compare, next, previous, displayLength, contentItems, hasBlock, live } = reads;
134
+ const { blockJSON, view, blockTypeOf, blockDataOf, docData, dataItemIds, dataPreview, childrenIds, positionOf, pathOf, ancestorsOf, slotOf, isVoid, isIsland, isLines, islandOf, insideIsland, isLayout, isLayoutItem, order, compare, next, previous, displayLength, contentItems, hasBlock, live } = reads;
139
135
  const { canPlace, fits, nestParent, canMerge, defaultChild } = shape;
140
136
  const funnel = writeFunnel({ ...reads, BA, config });
141
137
  const { write, apply } = funnel;
@@ -262,6 +258,7 @@ export const docFacade = (Y, layers) => {
262
258
  blockDataOf: byRef(blockDataOf),
263
259
  docData,
264
260
  dataItemIds,
261
+ dataPreview,
265
262
  /**
266
263
  * Compact per-block attribution (`{createdBy, contributors,
267
264
  * lastChangedBy}`), or `undefined` for unauthored/system blocks.
@@ -62,7 +62,7 @@ export type { YDoc, YUndoManager, YTransaction } from './engine-api.js';
62
62
  export { type EdytorSync, type EdytorSyncPayload, type EdytorSyncCleanup, type IndexeddbSyncOptions, type WebsocketSync, type WebsocketSyncOptions, type ProviderStack, type PrefetchOptions, type PrefetchResult, type LastUpdatedOptions } from './providers/index.js';
63
63
  export { SyncRefusedError } from './providers/room.js';
64
64
  export { Awareness, type AwarenessDoc, type AwarenessStates, type AwarenessUpdate, type MetaClientState } from './protocols/awareness.js';
65
- export { SchemaMismatchError, UndecodableUpdateError, UnsupportedDocError } from './admission.js';
65
+ export { SchemaMismatchError, UndecodableUpdateError } from './admission.js';
66
66
  export { type DocumentAttribution, type AttributionActor, type ActorProfile, type AttributionController } from './attribution/index.js';
67
67
  export { type ActorId, type BlockAttribution } from './attribution/index.js';
68
68
  import type { EngineApi, YDoc } from './engine-api.js';
@@ -280,6 +280,12 @@ export declare const bindCrdt: (Y: EngineApi) => {
280
280
  blockDataOf: (id: string) => Record<string, unknown> | undefined;
281
281
  docData: () => import("./doc/types.js").JsonObj;
282
282
  dataItemIds: (target: import("./edytor-doc.js").DataTarget, path: readonly string[]) => string[];
283
+ dataPreview: (target: import("./edytor-doc.js").DataTarget, pending: readonly import("./data.js").DataPatch[]) => {
284
+ data: {
285
+ [x: string]: unknown;
286
+ };
287
+ ids: (path: readonly string[]) => string[];
288
+ } | null;
283
289
  blockAttribution: (id: string) => import("./index.js").BlockAttribution | undefined;
284
290
  crdtId: (id: string) => string | null;
285
291
  resolveBlock: (id: string) => import("./engine-api.js").EngineNode | null;
@@ -577,7 +583,7 @@ export declare const bindCrdt: (Y: EngineApi) => {
577
583
  off<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: import("./protocol.js").WebsocketProviderEvents[NAME]): void;
578
584
  };
579
585
  };
580
- watchComments: (server: string, roomName: string, listener: (message: import("./protocol.js").CommentMessage) => void) => (() => void);
586
+ watchComments: (server: string | null, roomName: string, listener: (message: import("./protocol.js").CommentMessage) => void) => (() => void);
581
587
  storeState: (idbPersistence: {
582
588
  db: IDBDatabase | null;
583
589
  name: string;
@@ -626,4 +632,4 @@ export declare const bindCrdt: (Y: EngineApi) => {
626
632
  };
627
633
  export type Crdt = ReturnType<typeof bindCrdt>;
628
634
  export type { EngineApi, EngineDoc, EngineNode, EngineTransaction, EngineItemRef, YNode, YItem } from './engine-api.js';
629
- export { EdytorDocDisposedError, DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
635
+ export { DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
@@ -101,7 +101,7 @@ export { Awareness } from './protocols/awareness.js';
101
101
  // every content-entry path crosses). The gates themselves
102
102
  // (`assertAdmission`, `inspectAdmission`, …) are diagnostics vocabulary:
103
103
  // `edytor/protocol`.
104
- export { SchemaMismatchError, UndecodableUpdateError, UnsupportedDocError } from './admission.js';
104
+ export { SchemaMismatchError, UndecodableUpdateError } from './admission.js';
105
105
  // ── 5 · Attribution (read surface) ─────────────────────────────────────
106
106
  //
107
107
  // `document.attribution` hands back a `DocumentAttribution` — compact
@@ -145,4 +145,4 @@ export const bindCrdt = (Y) => {
145
145
  // The facade's disposal error and the history's default depth belong
146
146
  // to the document; the frame contract, message types and codecs are
147
147
  // `edytor/protocol`.
148
- export { EdytorDocDisposedError, DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
148
+ export { DEFAULT_HISTORY_LIMIT } from './edytor-doc.js';
@@ -149,4 +149,4 @@ export interface DocumentOperations extends DocumentWrites, DocumentReads {
149
149
  /** Every write of `DocumentWrites`: what a view dispatches under the same names (`edytor.insertBlocks(…)`). */
150
150
  export declare const DOCUMENT_WRITES: readonly ["insertBlocks", "moveBlocks", "nestBlock", "unNestBlock", "unNestBlocks", "liftOut", "wrapInLayout", "placeBeside", "splitBlock", "mergeBlocks", "mergeBackward", "mergeForward", "deleteBlock", "deleteBlocks", "setBlock", "setBlockType", "patchData", "duplicateBlock", "insertText", "deleteText", "formatRange", "clearMarks", "insertInline", "removeInline", "deleteRange", "replaceRange", "insertFlow"];
151
151
  /** Every name of `DocumentOperations`, for the document's own members (`EdytorDocument`). */
152
- export declare const DOCUMENT_OPERATIONS: readonly ["insertBlocks", "moveBlocks", "nestBlock", "unNestBlock", "unNestBlocks", "liftOut", "wrapInLayout", "placeBeside", "splitBlock", "mergeBlocks", "mergeBackward", "mergeForward", "deleteBlock", "deleteBlocks", "setBlock", "setBlockType", "patchData", "duplicateBlock", "insertText", "deleteText", "formatRange", "clearMarks", "insertInline", "removeInline", "deleteRange", "replaceRange", "insertFlow", "toJSON", "docData", "dataItemIds", "project", "blockJSON", "childrenIds", "parentOf", "ancestorsOf", "positionOf", "pathOf", "blockTypeOf", "blockDataOf", "blockText", "contentItems", "displayLength", "runs", "hasBlock", "isVisibleBlock", "listBlockIds", "blockAttribution", "isVoid", "isIsland", "isLines", "islandOf", "insideIsland", "isLayout", "isLayoutItem", "besideAt", "isTable", "isTableRow", "isTableCell", "tableOf", "tableColumns", "tableGrid", "order", "compare", "next", "previous", "canPlace", "canMerge", "fits", "nestParent", "landingOf", "anchorAt", "resolveAnchor", "prepare", "apply", "compose", "transact", "onChange", "version"];
152
+ export declare const DOCUMENT_OPERATIONS: readonly ["insertBlocks", "moveBlocks", "nestBlock", "unNestBlock", "unNestBlocks", "liftOut", "wrapInLayout", "placeBeside", "splitBlock", "mergeBlocks", "mergeBackward", "mergeForward", "deleteBlock", "deleteBlocks", "setBlock", "setBlockType", "patchData", "duplicateBlock", "insertText", "deleteText", "formatRange", "clearMarks", "insertInline", "removeInline", "deleteRange", "replaceRange", "insertFlow", "toJSON", "docData", "dataItemIds", "dataPreview", "project", "blockJSON", "childrenIds", "parentOf", "ancestorsOf", "positionOf", "pathOf", "blockTypeOf", "blockDataOf", "blockText", "contentItems", "displayLength", "runs", "hasBlock", "isVisibleBlock", "listBlockIds", "blockAttribution", "isVoid", "isIsland", "isLines", "islandOf", "insideIsland", "isLayout", "isLayoutItem", "besideAt", "isTable", "isTableRow", "isTableCell", "tableOf", "tableColumns", "tableGrid", "order", "compare", "next", "previous", "canPlace", "canMerge", "fits", "nestParent", "landingOf", "anchorAt", "resolveAnchor", "prepare", "apply", "compose", "transact", "onChange", "version"];
@@ -34,6 +34,7 @@ export const DOCUMENT_OPERATIONS = [
34
34
  'toJSON',
35
35
  'docData',
36
36
  'dataItemIds',
37
+ 'dataPreview',
37
38
  'project',
38
39
  'blockJSON',
39
40
  'childrenIds',
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Properties: the deep proxy behind `block.data`, `atom.data`,
3
+ * `edytor.data` and `document.data` (SyncedStore's feel, one small module).
4
+ * It is sugar over the one write path: every mutation is a data patch
5
+ * handed to `write`, which is the `patchData` operation (dispatched on a
6
+ * view, raw on a bare document).
7
+ *
8
+ * A read goes to `read()` every time (the live source), so a reactive
9
+ * reader of `block.data.title` re-runs when anyone changes it, and a key a
10
+ * peer deletes is gone. Plain objects read as nested proxies, arrays as
11
+ * array proxies, everything else as the raw value; a proxy is cached per
12
+ * path, so its identity is stable. An object or array held in an array
13
+ * item is that item's (its path names the item by id, from `ids`): it
14
+ * stays on its item wherever peers move it, so `{#each list as item (item)}`
15
+ * keeps a row on its item; once the item is removed, its writes are
16
+ * refused. A key is a path segment as `keySegment` writes it.
17
+ *
18
+ * Writes, each the patch of only what it changes (per-leaf storage, so
19
+ * concurrent edits of other keys and items merge): `obj.key = v`,
20
+ * `arr[i] = v` and `delete obj.key` patch that path; `push`, `pop`,
21
+ * `shift`, `unshift`, `splice` and `length` are one `splice` (the items
22
+ * kept keep their ids), `sort` and `reverse` one `order` (the items move),
23
+ * `fill` and `copyWithin` writes of the items they change. Assigning a
24
+ * value equal to the one there writes nothing. `JSON.stringify` and
25
+ * `$state.snapshot` read plain JSON through it.
26
+ */
27
+ import { type DataPatch } from './data.js';
28
+ type Json = Record<string, unknown>;
29
+ export declare const propsProxy: <T extends object = Json>(read: () => Json, write: (ops: DataPatch[]) => void,
30
+ /** The ids of the items of the array at a path (`facade.dataItemIds`). */
31
+ ids?: (path: readonly string[]) => string[]) => T;
32
+ export {};