edytor 3.0.0 → 5.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 (231) hide show
  1. package/README.md +2 -2
  2. package/dist/block/block.svelte.js +6 -21
  3. package/dist/block/inlineBlock.svelte.js +4 -6
  4. package/dist/clipboard/moveText.js +6 -8
  5. package/dist/cloudflare/DocumentRoom.d.ts +23 -12
  6. package/dist/cloudflare/DocumentRoom.js +10 -6
  7. package/dist/cloudflare/index.d.ts +1 -1
  8. package/dist/cloudflare/room/access.d.ts +8 -3
  9. package/dist/cloudflare/room/access.js +44 -20
  10. package/dist/cloudflare/room/admission.js +28 -5
  11. package/dist/cloudflare/room/comments.js +28 -1
  12. package/dist/cloudflare/room/context.d.ts +139 -129
  13. package/dist/cloudflare/room/context.js +11 -4
  14. package/dist/cloudflare/room/forged.d.ts +14 -0
  15. package/dist/cloudflare/room/forged.js +30 -2
  16. package/dist/cloudflare/room/frames.d.ts +4 -0
  17. package/dist/cloudflare/room/frames.js +5 -1
  18. package/dist/cloudflare/room/purge.d.ts +6 -3
  19. package/dist/cloudflare/room/purge.js +45 -19
  20. package/dist/cloudflare/room/replicas.d.ts +4 -2
  21. package/dist/cloudflare/room/replicas.js +8 -3
  22. package/dist/cloudflare/room/suggest.d.ts +7 -0
  23. package/dist/cloudflare/room/suggest.js +143 -0
  24. package/dist/cloudflare/room/updates.d.ts +3 -4
  25. package/dist/cloudflare/room/updates.js +6 -8
  26. package/dist/cloudflare/routeDocumentSocket.d.ts +10 -1
  27. package/dist/cloudflare/routeDocumentSocket.js +5 -3
  28. package/dist/components/Content.svelte +9 -1
  29. package/dist/crdt/anchors.js +3 -2
  30. package/dist/crdt/attribution/attribution.d.ts +34 -12
  31. package/dist/crdt/attribution/attribution.js +59 -21
  32. package/dist/crdt/attribution/block.d.ts +3 -3
  33. package/dist/crdt/attribution/block.js +7 -8
  34. package/dist/crdt/attribution/index.d.ts +1 -1
  35. package/dist/crdt/attribution/index.js +1 -1
  36. package/dist/crdt/data.d.ts +62 -31
  37. package/dist/crdt/data.js +211 -103
  38. package/dist/crdt/doc/capability.js +9 -13
  39. package/dist/crdt/doc/delete.d.ts +1 -1
  40. package/dist/crdt/doc/delete.js +13 -30
  41. package/dist/crdt/doc/funnel.d.ts +1 -1
  42. package/dist/crdt/doc/funnel.js +34 -26
  43. package/dist/crdt/doc/gate.d.ts +3 -3
  44. package/dist/crdt/doc/history.d.ts +31 -9
  45. package/dist/crdt/doc/history.js +204 -73
  46. package/dist/crdt/doc/layout.js +16 -27
  47. package/dist/crdt/doc/meta.js +17 -23
  48. package/dist/crdt/doc/moves.d.ts +1 -1
  49. package/dist/crdt/doc/moves.js +52 -32
  50. package/dist/crdt/doc/reads.d.ts +2 -2
  51. package/dist/crdt/doc/reads.js +20 -30
  52. package/dist/crdt/doc/seed.js +2 -2
  53. package/dist/crdt/doc/split-merge.js +12 -15
  54. package/dist/crdt/doc/steps.d.ts +25 -13
  55. package/dist/crdt/doc/steps.js +55 -125
  56. package/dist/crdt/doc/suggest.d.ts +167 -0
  57. package/dist/crdt/doc/suggest.js +579 -0
  58. package/dist/crdt/doc/types.d.ts +21 -9
  59. package/dist/crdt/document.d.ts +26 -6
  60. package/dist/crdt/document.js +40 -15
  61. package/dist/crdt/edytor-doc.d.ts +410 -390
  62. package/dist/crdt/edytor-doc.js +143 -95
  63. package/dist/crdt/engine-api.d.ts +39 -1
  64. package/dist/crdt/engine.d.ts +2 -2
  65. package/dist/crdt/engine.js +4 -5
  66. package/dist/crdt/flow.d.ts +2 -2
  67. package/dist/crdt/flow.js +29 -37
  68. package/dist/crdt/index.d.ts +134 -127
  69. package/dist/crdt/index.js +4 -1
  70. package/dist/crdt/operations.d.ts +12 -3
  71. package/dist/crdt/parts.d.ts +43 -0
  72. package/dist/crdt/parts.js +44 -0
  73. package/dist/crdt/placement/display.d.ts +6 -31
  74. package/dist/crdt/placement/display.js +41 -146
  75. package/dist/crdt/placement/keys.d.ts +63 -0
  76. package/dist/crdt/placement/keys.js +95 -0
  77. package/dist/crdt/placement/model.d.ts +119 -118
  78. package/dist/crdt/placement/model.js +242 -142
  79. package/dist/crdt/placement/resolve.d.ts +123 -35
  80. package/dist/crdt/placement/resolve.js +188 -153
  81. package/dist/crdt/placement/slots.d.ts +134 -0
  82. package/dist/crdt/placement/slots.js +152 -0
  83. package/dist/crdt/protocol.d.ts +1 -1
  84. package/dist/crdt/protocol.js +1 -1
  85. package/dist/crdt/protocols/auth.d.ts +11 -1
  86. package/dist/crdt/protocols/auth.js +17 -1
  87. package/dist/crdt/protocols/comments.d.ts +16 -1
  88. package/dist/crdt/protocols/comments.js +9 -1
  89. package/dist/crdt/providers/index.d.ts +6 -4
  90. package/dist/crdt/providers/index.js +3 -1
  91. package/dist/crdt/providers/room.d.ts +16 -2
  92. package/dist/crdt/providers/room.js +64 -17
  93. package/dist/crdt/providers/websocket.d.ts +6 -4
  94. package/dist/crdt/providers/websocket.js +14 -7
  95. package/dist/crdt/purge.d.ts +24 -9
  96. package/dist/crdt/purge.js +266 -126
  97. package/dist/crdt/restore.d.ts +4 -3
  98. package/dist/crdt/restore.js +27 -34
  99. package/dist/crdt/schema.d.ts +30 -21
  100. package/dist/crdt/schema.js +39 -23
  101. package/dist/crdt/storage.d.ts +1 -1
  102. package/dist/crdt/storage.js +1 -1
  103. package/dist/crdt/structs.d.ts +17 -15
  104. package/dist/crdt/structs.js +10 -22
  105. package/dist/crdt/text/index/cache.js +4 -0
  106. package/dist/crdt/text/index/claims.js +13 -23
  107. package/dist/crdt/text/index/fold.d.ts +2 -3
  108. package/dist/crdt/text/index/fold.js +194 -44
  109. package/dist/crdt/text/index/layout.d.ts +2 -4
  110. package/dist/crdt/text/index/layout.js +14 -30
  111. package/dist/crdt/text/index/placement.d.ts +26 -18
  112. package/dist/crdt/text/index/placement.js +420 -157
  113. package/dist/crdt/text/index/records.d.ts +3 -3
  114. package/dist/crdt/text/index/records.js +24 -31
  115. package/dist/crdt/text/index/shared.d.ts +11 -3
  116. package/dist/crdt/text/index/shared.js +29 -17
  117. package/dist/crdt/text/index/state.d.ts +21 -17
  118. package/dist/crdt/text/index/state.js +15 -17
  119. package/dist/crdt/text/index/streams.d.ts +10 -5
  120. package/dist/crdt/text/index/streams.js +78 -27
  121. package/dist/crdt/text/items.d.ts +10 -3
  122. package/dist/crdt/text/items.js +7 -0
  123. package/dist/crdt/text/model.d.ts +87 -62
  124. package/dist/crdt/text/model.js +91 -169
  125. package/dist/crdt/text/ranges.d.ts +1 -1
  126. package/dist/crdt/text/ranges.js +3 -3
  127. package/dist/crdt/text/rows.d.ts +13 -7
  128. package/dist/crdt/text/rows.js +24 -7
  129. package/dist/crdt/text/runs.d.ts +51 -42
  130. package/dist/crdt/text/runs.js +24 -7
  131. package/dist/crdt/text/streams.d.ts +26 -13
  132. package/dist/crdt/text/streams.js +41 -14
  133. package/dist/crdt/vendor/yjs/UPSTREAM.md +651 -21
  134. package/dist/crdt/vendor/yjs/dts/global.d.ts +2 -0
  135. package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
  136. package/dist/crdt/vendor/yjs/dts/structs/AbstractStruct.d.ts +7 -0
  137. package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +197 -10
  138. package/dist/crdt/vendor/yjs/dts/utils/Doc.d.ts +6 -3
  139. package/dist/crdt/vendor/yjs/dts/utils/StructStore.d.ts +5 -18
  140. package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +15 -1
  141. package/dist/crdt/vendor/yjs/dts/utils/UpdateDecoder.d.ts +14 -6
  142. package/dist/crdt/vendor/yjs/dts/utils/UpdateEncoder.d.ts +33 -6
  143. package/dist/crdt/vendor/yjs/dts/utils/ids.d.ts +1 -65
  144. package/dist/crdt/vendor/yjs/dts/utils/marks.d.ts +6 -1
  145. package/dist/crdt/vendor/yjs/dts/ynode.d.ts +54 -7
  146. package/dist/crdt/vendor/yjs/global.d.ts +2 -0
  147. package/dist/crdt/vendor/yjs/src/index.js +1 -1
  148. package/dist/crdt/vendor/yjs/src/structs/AbstractStruct.js +10 -0
  149. package/dist/crdt/vendor/yjs/src/structs/Item.js +649 -51
  150. package/dist/crdt/vendor/yjs/src/utils/BlockSet.js +18 -9
  151. package/dist/crdt/vendor/yjs/src/utils/Doc.js +5 -3
  152. package/dist/crdt/vendor/yjs/src/utils/StructStore.js +5 -0
  153. package/dist/crdt/vendor/yjs/src/utils/Transaction.js +36 -13
  154. package/dist/crdt/vendor/yjs/src/utils/UpdateDecoder.js +88 -18
  155. package/dist/crdt/vendor/yjs/src/utils/UpdateEncoder.js +119 -32
  156. package/dist/crdt/vendor/yjs/src/utils/encoding.js +13 -1
  157. package/dist/crdt/vendor/yjs/src/utils/ids.js +7 -7
  158. package/dist/crdt/vendor/yjs/src/utils/marks.js +193 -8
  159. package/dist/crdt/vendor/yjs/src/utils/redo.js +1 -1
  160. package/dist/crdt/vendor/yjs/src/utils/transaction-helpers.js +1 -1
  161. package/dist/crdt/vendor/yjs/src/utils/updates.js +3 -3
  162. package/dist/crdt/vendor/yjs/src/ynode.js +199 -12
  163. package/dist/edytor.svelte.d.ts +1 -1
  164. package/dist/edytor.svelte.js +103 -75
  165. package/dist/events/beforeInputCommands.d.ts +2 -2
  166. package/dist/events/beforeInputCommands.js +2 -2
  167. package/dist/events/nativeInteractiveControl.d.ts +11 -1
  168. package/dist/events/nativeInteractiveControl.js +41 -1
  169. package/dist/events/onBeforeInput.js +3 -3
  170. package/dist/events/onFocus.js +9 -11
  171. package/dist/events/onPageHide.d.ts +3 -0
  172. package/dist/events/onPageHide.js +16 -0
  173. package/dist/export/forms.d.ts +50 -50
  174. package/dist/index.d.ts +4 -2
  175. package/dist/index.js +1 -1
  176. package/dist/labels.d.ts +8 -0
  177. package/dist/labels.js +6 -1
  178. package/dist/plugins/comments/CommentsController.svelte.d.ts +5 -1
  179. package/dist/plugins/comments/CommentsController.svelte.js +14 -4
  180. package/dist/plugins/find/search.js +2 -2
  181. package/dist/plugins/index.d.ts +1 -0
  182. package/dist/plugins/index.js +1 -0
  183. package/dist/plugins/suggestions/SuggestionBars.svelte +40 -23
  184. package/dist/plugins/suggestions/SuggestionBars.svelte.d.ts +3 -1
  185. package/dist/plugins/suggestions/SuggestionRuns.svelte +77 -0
  186. package/dist/plugins/suggestions/SuggestionRuns.svelte.d.ts +9 -0
  187. package/dist/plugins/suggestions/shared.svelte.d.ts +58 -0
  188. package/dist/plugins/suggestions/shared.svelte.js +421 -0
  189. package/dist/plugins/suggestions/suggestionsPlugin.d.ts +15 -4
  190. package/dist/selection/domSelection.d.ts +2 -0
  191. package/dist/selection/domSelection.js +6 -2
  192. package/dist/selection/pointer.svelte.js +75 -48
  193. package/dist/selection/replaceSelection.js +2 -6
  194. package/dist/selection/selection.svelte.d.ts +3 -3
  195. package/dist/selection/selection.svelte.js +39 -32
  196. package/dist/selection/selection.utils.d.ts +14 -0
  197. package/dist/selection/selection.utils.js +28 -3
  198. package/dist/session/commands.js +21 -11
  199. package/dist/session/composition.svelte.d.ts +5 -3
  200. package/dist/session/composition.svelte.js +21 -17
  201. package/dist/session/handles.d.ts +4 -17
  202. package/dist/session/handles.js +11 -37
  203. package/dist/session/navigation.js +6 -9
  204. package/dist/session/selection.d.ts +11 -5
  205. package/dist/session/selection.js +14 -48
  206. package/dist/session/suggestions.svelte.d.ts +38 -9
  207. package/dist/session/suggestions.svelte.js +37 -18
  208. package/dist/session/virtual.d.ts +1 -1
  209. package/dist/surface/attributes.d.ts +5 -0
  210. package/dist/surface/attributes.js +2 -2
  211. package/dist/surface/cells.d.ts +2 -26
  212. package/dist/surface/cells.js +2 -33
  213. package/dist/surface/observer.svelte.d.ts +6 -1
  214. package/dist/surface/observer.svelte.js +130 -83
  215. package/dist/surface/pin.svelte.d.ts +9 -9
  216. package/dist/surface/pin.svelte.js +15 -22
  217. package/dist/surface/projector.svelte.d.ts +15 -3
  218. package/dist/surface/projector.svelte.js +67 -22
  219. package/dist/text/text.svelte.js +14 -19
  220. package/dist/themes/notion.css +29 -0
  221. package/package.json +4 -2
  222. package/dist/crdt/placement/rank.d.ts +0 -87
  223. package/dist/crdt/placement/rank.js +0 -332
  224. package/dist/crdt/placement/source.d.ts +0 -43
  225. package/dist/crdt/placement/source.js +0 -66
  226. package/dist/crdt/text/delete-index.d.ts +0 -129
  227. package/dist/crdt/text/delete-index.js +0 -365
  228. package/dist/crdt/text/deletes.d.ts +0 -76
  229. package/dist/crdt/text/deletes.js +0 -362
  230. package/dist/crdt/text/index/anchored.d.ts +0 -17
  231. package/dist/crdt/text/index/anchored.js +0 -197
@@ -50,10 +50,9 @@
50
50
  * bootstrap-shaped is written or broadcast, so writes made raw against a
51
51
  * pending doc produce unversioned state that `sync()` then refuses (see
52
52
  * below). `local`/`hydrated` — the full surface is legal; the only
53
- * difference is WHO decided the content. (One exception to "nothing
54
- * broadcast": the actor dictionary attach publishes this replica's
55
- * `c/<clientID>`/`u/<actorId>` records on ANY constructed document —
56
- * identity metadata, not content, and outside every admission gate.)
53
+ * difference is WHO decided the content. (The actor dictionary's
54
+ * `c/<clientID>`/`u/<actorId>` records go with the replica's first write,
55
+ * whatever it is: a document that is only read publishes nothing.)
57
56
  *
58
57
  * ── Admission boundary ────────────────────────────────────────────
59
58
  *
@@ -142,7 +141,7 @@
142
141
  */
143
142
  import type { MarkEdge } from './text/marks.js';
144
143
  import type { EngineApi, EngineDoc, YDoc, YUndoManager } from './engine-api.js';
145
- import { type DocumentOperations } from './operations.js';
144
+ import type { DocumentOperations } from './operations.js';
146
145
  import { type AttributionBinding, type DocumentAttribution } from './attribution/index.js';
147
146
  import { DocumentDestroyedError, type BlockRole, type DocFacade, type EdytorDocConfig } from './edytor-doc.js';
148
147
  import { Awareness } from './protocols/awareness.js';
@@ -278,6 +277,8 @@ export type DocumentReadiness = 'pending' | 'local' | 'hydrated';
278
277
  * does: from the socket's open, so a slow dial never counts).
279
278
  */
280
279
  export declare const DEFAULT_READINESS_BOUND = 1000;
280
+ /** What a document's user may do in its room (`EdytorDocument.access`). */
281
+ export type DocumentAccess = 'write' | 'suggest' | 'comment' | 'read';
281
282
  /** Internal constructor bag — use {@link createDocument}/{@link loadDocument}/{@link attachDocument}. */
282
283
  export type EdytorDocumentInit = {
283
284
  doc: YDoc;
@@ -324,7 +325,7 @@ export declare class EdytorDocument {
324
325
  * replicated actor dictionary (`u/` profiles, `c/` replica bindings).
325
326
  * Ordinary edits perform no attribution
326
327
  * writes — authorship lands inside the owning op's transaction as the
327
- * block-level `b/<id>` record/`l` stamp. See
328
+ * block-level record (`blockattr` `<id>`)/`l` stamp. See
328
329
  * `src/lib/crdt/attribution/attribution.ts` for the full contract.
329
330
  * Access after teardown throws {@link DocumentDestroyedError} — same
330
331
  * lifecycle contract as {@link history}.
@@ -369,6 +370,13 @@ export declare class EdytorDocument {
369
370
  */
370
371
  get readiness(): DocumentReadiness;
371
372
  get destroyed(): boolean;
373
+ /**
374
+ * What this document's user may do, as its room said as it joined
375
+ * (`'write'` until a room says otherwise): `'suggest'` writes only
376
+ * suggestions, `'comment'` only comments, `'read'` nothing. The plugins
377
+ * read it (the shared suggestions' suggesting mode, the comments).
378
+ */
379
+ access: DocumentAccess;
372
380
  /**
373
381
  * `false` while the document carries a schema stamp this build cannot
374
382
  * own (a foreign stamp got in despite the transport's inbound refusal):
@@ -488,6 +496,18 @@ export declare class EdytorDocument {
488
496
  * on pending).
489
497
  */
490
498
  clearHistory: () => void;
499
+ /**
500
+ * End this session's history: the page it was edited in left for good.
501
+ * Every step is dropped, and what this replica deleted is released: the
502
+ * text its deletes hid is deleted for good now, and the room's purge
503
+ * removes the blocks it deleted at its next run, without waiting for the
504
+ * purge horizon (one small write, sent if the connection still can). A
505
+ * view calls it at a `pagehide` the back/forward cache keeps nothing of;
506
+ * a page kept there, or one that lost its connection, keeps its history.
507
+ * Undo starts empty afterwards. No-op while history has not attached, and
508
+ * on a destroyed document.
509
+ */
510
+ endHistory: () => void;
491
511
  /**
492
512
  * Local document transaction — headless edits, one undo step per call
493
513
  * (`origin`: another origin, which the document's history tracks only
@@ -1,7 +1,6 @@
1
1
  import { DEV } from 'esm-env';
2
2
  import { Y } from './engine.js';
3
3
  import { asEngineDoc } from './structs.js';
4
- import { DOCUMENT_OPERATIONS } from './operations.js';
5
4
  import { propsProxy } from './props.js';
6
5
  import { bindAttribution } from './attribution/index.js';
7
6
  import { profileOf } from './attribution/attribution.js';
@@ -92,7 +91,7 @@ export class EdytorDocument {
92
91
  * replicated actor dictionary (`u/` profiles, `c/` replica bindings).
93
92
  * Ordinary edits perform no attribution
94
93
  * writes — authorship lands inside the owning op's transaction as the
95
- * block-level `b/<id>` record/`l` stamp. See
94
+ * block-level record (`blockattr` `<id>`)/`l` stamp. See
96
95
  * `src/lib/crdt/attribution/attribution.ts` for the full contract.
97
96
  * Access after teardown throws {@link DocumentDestroyedError} — same
98
97
  * lifecycle contract as {@link history}.
@@ -192,13 +191,15 @@ export class EdytorDocument {
192
191
  // with the `SchemaMismatchError` naming the stamp.
193
192
  assertWritable: () => assertSchema(asEngineDoc(this.doc), 'document')
194
193
  });
195
- // The document's own operations (`DocumentOperations`): the bound
196
- // facade's, read through so each call reaches the live binding.
197
- for (const name of DOCUMENT_OPERATIONS) {
198
- if (name === 'transact')
199
- continue;
200
- Object.defineProperty(this, name, { get: () => this.facade[name], configurable: true });
201
- }
194
+ // The document's own operations (the facade's `api`, which satisfies
195
+ // `DocumentOperations`): the bound facade's, read through so each
196
+ // call reaches the live binding.
197
+ for (const name in this.facade.api)
198
+ if (name !== 'transact')
199
+ Object.defineProperty(this, name, {
200
+ get: () => this.facade[name],
201
+ configurable: true
202
+ });
202
203
  this.awareness = init.awareness ?? new init.awarenessCtor(this.doc);
203
204
  this.#ownsAwareness = init.awareness === undefined;
204
205
  this.#historyOptions = init.history;
@@ -213,9 +214,10 @@ export class EdytorDocument {
213
214
  this.awareness.setLocalStateField('user', user);
214
215
  // Attribution service — attaches after the facade (which gates
215
216
  // foreign docs) and after the actor is fixed. Publishes this
216
- // replica's actor dictionary entries (`c/`+`u/`) once; ordinary
217
- // edits perform no attribution work and per-block records are
218
- // written inside the owning op's transaction by the facade.
217
+ // replica's actor dictionary entries (`c/`+`u/`) inside its first
218
+ // write's transaction; ordinary edits perform no attribution work
219
+ // and per-block records are written inside the owning op's
220
+ // transaction by the facade.
219
221
  this.#attributionCtl = init.attribution.attach(asEngineDoc(this.doc), {
220
222
  actor: this.actor
221
223
  });
@@ -260,6 +262,13 @@ export class EdytorDocument {
260
262
  get destroyed() {
261
263
  return this._destroyed;
262
264
  }
265
+ /**
266
+ * What this document's user may do, as its room said as it joined
267
+ * (`'write'` until a room says otherwise): `'suggest'` writes only
268
+ * suggestions, `'comment'` only comments, `'read'` nothing. The plugins
269
+ * read it (the shared suggestions' suggesting mode, the comments).
270
+ */
271
+ access = 'write';
263
272
  /**
264
273
  * `false` while the document carries a schema stamp this build cannot
265
274
  * own (a foreign stamp got in despite the transport's inbound refusal):
@@ -359,8 +368,7 @@ export class EdytorDocument {
359
368
  // promoted out of a newly island kind displays as a default child; a
360
369
  // newly layout kind displays only its items (`layout.*`), a newly
361
370
  // table kind only its rows (`table.*`).
362
- if (Object.values(config.roles ?? {}).some((role) => role?.void || role?.island || role?.layout || role?.table))
363
- this.facade.rolesChanged();
371
+ this.facade.rolesChanged(Object.values(config.roles ?? {}).some((role) => role?.void || role?.island || role?.layout || role?.table));
364
372
  };
365
373
  /**
366
374
  * The readiness transition — decide the document's content state. This
@@ -501,6 +509,22 @@ export class EdytorDocument {
501
509
  alive(this, 'clearHistory');
502
510
  this.#_history?.clear();
503
511
  };
512
+ /**
513
+ * End this session's history: the page it was edited in left for good.
514
+ * Every step is dropped, and what this replica deleted is released: the
515
+ * text its deletes hid is deleted for good now, and the room's purge
516
+ * removes the blocks it deleted at its next run, without waiting for the
517
+ * purge horizon (one small write, sent if the connection still can). A
518
+ * view calls it at a `pagehide` the back/forward cache keeps nothing of;
519
+ * a page kept there, or one that lost its connection, keeps its history.
520
+ * Undo starts empty afterwards. No-op while history has not attached, and
521
+ * on a destroyed document.
522
+ */
523
+ endHistory = () => {
524
+ if (this._destroyed)
525
+ return;
526
+ this.#_history?.end();
527
+ };
504
528
  /**
505
529
  * Local document transaction — headless edits, one undo step per call
506
530
  * (`origin`: another origin, which the document's history tracks only
@@ -663,7 +687,8 @@ export class EdytorDocument {
663
687
  bound = setTimeout(decide, DEFAULT_READINESS_BOUND);
664
688
  },
665
689
  holdBound: () => clearTimeout(bound),
666
- attach: (companion) => this.attachSync(companion, opts)
690
+ attach: (companion) => this.attachSync(companion, opts),
691
+ access: (access) => void (this.access = access)
667
692
  });
668
693
  }
669
694
  catch (error) {