edytor 5.0.0 → 7.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 (137) hide show
  1. package/README.md +3 -3
  2. package/dist/cloudflare/DocumentRoom.d.ts +77 -2
  3. package/dist/cloudflare/DocumentRoom.js +37 -1
  4. package/dist/cloudflare/index.d.ts +1 -1
  5. package/dist/cloudflare/index.js +1 -1
  6. package/dist/cloudflare/room/access.d.ts +6 -1
  7. package/dist/cloudflare/room/access.js +30 -4
  8. package/dist/cloudflare/room/admission.d.ts +11 -0
  9. package/dist/cloudflare/room/admission.js +43 -10
  10. package/dist/cloudflare/room/context.d.ts +73 -76
  11. package/dist/cloudflare/room/context.js +17 -6
  12. package/dist/cloudflare/room/forged.d.ts +1 -1
  13. package/dist/cloudflare/room/forged.js +11 -9
  14. package/dist/cloudflare/room/frames.d.ts +2 -0
  15. package/dist/cloudflare/room/frames.js +2 -0
  16. package/dist/cloudflare/room/presence.js +1 -4
  17. package/dist/cloudflare/room/reseed.d.ts +93 -0
  18. package/dist/cloudflare/room/reseed.js +500 -0
  19. package/dist/cloudflare/room/scheduler.d.ts +1 -1
  20. package/dist/cloudflare/room/scheduler.js +9 -1
  21. package/dist/cloudflare/room/shared.d.ts +10 -0
  22. package/dist/cloudflare/room/shared.js +10 -0
  23. package/dist/cloudflare/room/storage.d.ts +7 -0
  24. package/dist/cloudflare/room/storage.js +33 -1
  25. package/dist/components/Edytor.svelte +18 -3
  26. package/dist/components/Edytor.svelte.d.ts +10 -1
  27. package/dist/components/EdytorRoot.svelte +17 -0
  28. package/dist/components/EdytorRoot.svelte.d.ts +4 -0
  29. package/dist/components/Suggestion.svelte +1 -1
  30. package/dist/crdt/attribution/block.d.ts +3 -0
  31. package/dist/crdt/attribution/block.js +3 -2
  32. package/dist/crdt/doc/history.js +2 -3
  33. package/dist/crdt/doc/ops.d.ts +81 -0
  34. package/dist/crdt/doc/ops.js +1898 -0
  35. package/dist/crdt/doc/suggest.d.ts +6 -2
  36. package/dist/crdt/doc/suggest.js +6 -5
  37. package/dist/crdt/edytor-doc.d.ts +157 -157
  38. package/dist/crdt/edytor-doc.js +15 -43
  39. package/dist/crdt/engine-room.d.ts +4 -0
  40. package/dist/crdt/engine-room.js +6 -0
  41. package/dist/crdt/flow.d.ts +4 -46
  42. package/dist/crdt/flow.js +2 -262
  43. package/dist/crdt/index.d.ts +64 -75
  44. package/dist/crdt/operations.d.ts +1 -1
  45. package/dist/crdt/placement/resolve.d.ts +1 -1
  46. package/dist/crdt/protocol.d.ts +2 -2
  47. package/dist/crdt/protocol.js +2 -2
  48. package/dist/crdt/protocols/auth.d.ts +8 -1
  49. package/dist/crdt/protocols/auth.js +14 -1
  50. package/dist/crdt/protocols/awareness.js +46 -81
  51. package/dist/crdt/providers/index.d.ts +11 -22
  52. package/dist/crdt/providers/index.js +22 -3
  53. package/dist/crdt/providers/indexeddb.d.ts +6 -10
  54. package/dist/crdt/providers/indexeddb.js +10 -16
  55. package/dist/crdt/providers/room.d.ts +26 -0
  56. package/dist/crdt/providers/room.js +41 -12
  57. package/dist/crdt/providers/websocket.d.ts +10 -14
  58. package/dist/crdt/providers/websocket.js +43 -23
  59. package/dist/crdt/rangeDelete.d.ts +2 -47
  60. package/dist/crdt/rangeDelete.js +1 -169
  61. package/dist/crdt/reseed.d.ts +127 -0
  62. package/dist/crdt/reseed.js +533 -0
  63. package/dist/crdt/restore.d.ts +13 -1
  64. package/dist/crdt/restore.js +8 -3
  65. package/dist/crdt/schema.d.ts +6 -0
  66. package/dist/crdt/schema.js +6 -0
  67. package/dist/crdt/structs.d.ts +8 -11
  68. package/dist/crdt/structs.js +25 -44
  69. package/dist/crdt/text/index/build.d.ts +119 -0
  70. package/dist/crdt/text/index/build.js +2801 -0
  71. package/dist/crdt/text/index/shared.d.ts +2 -6
  72. package/dist/crdt/text/index/shared.js +2 -5
  73. package/dist/crdt/text/model.js +2 -3
  74. package/dist/crdt/text/runs.d.ts +9 -12
  75. package/dist/crdt/text/runs.js +2 -165
  76. package/dist/crdt/vendor/yjs/UPSTREAM.md +101 -5
  77. package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
  78. package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +10 -10
  79. package/dist/crdt/vendor/yjs/dts/utils/encoding.d.ts +1 -0
  80. package/dist/crdt/vendor/yjs/src/index.js +1 -1
  81. package/dist/crdt/vendor/yjs/src/structs/Item.js +24 -13
  82. package/dist/crdt/vendor/yjs/src/utils/Transaction.js +12 -10
  83. package/dist/crdt/vendor/yjs/src/utils/encoding.js +42 -1
  84. package/dist/events/domTextOffset.d.ts +2 -0
  85. package/dist/events/domTextOffset.js +8 -0
  86. package/dist/export/forms.d.ts +50 -50
  87. package/dist/index.d.ts +1 -1
  88. package/dist/index.js +1 -1
  89. package/dist/plugins/richtext/RichTextPlugin.svelte +63 -61
  90. package/dist/plugins/richtext/richTextOperations.js +26 -32
  91. package/dist/selection/selection.svelte.d.ts +1 -1
  92. package/dist/selection/selection.svelte.js +87 -106
  93. package/dist/selection/selection.utils.js +5 -8
  94. package/dist/session/commands.js +49 -51
  95. package/dist/session/handles.js +3 -7
  96. package/dist/surface/attributes.d.ts +3 -3
  97. package/dist/surface/attributes.js +2 -2
  98. package/dist/surface/observer.svelte.d.ts +7 -7
  99. package/dist/surface/observer.svelte.js +225 -336
  100. package/dist/surface/projector.svelte.js +2 -2
  101. package/dist/utils.d.ts +5 -0
  102. package/dist/utils.js +7 -0
  103. package/package.json +1 -1
  104. package/dist/crdt/doc/capability.d.ts +0 -56
  105. package/dist/crdt/doc/capability.js +0 -207
  106. package/dist/crdt/doc/content.d.ts +0 -16
  107. package/dist/crdt/doc/content.js +0 -77
  108. package/dist/crdt/doc/delete.d.ts +0 -15
  109. package/dist/crdt/doc/delete.js +0 -84
  110. package/dist/crdt/doc/layout.d.ts +0 -9
  111. package/dist/crdt/doc/layout.js +0 -178
  112. package/dist/crdt/doc/meta.d.ts +0 -19
  113. package/dist/crdt/doc/meta.js +0 -198
  114. package/dist/crdt/doc/moves.d.ts +0 -21
  115. package/dist/crdt/doc/moves.js +0 -274
  116. package/dist/crdt/doc/split-merge.d.ts +0 -10
  117. package/dist/crdt/doc/split-merge.js +0 -179
  118. package/dist/crdt/doc/steps.d.ts +0 -65
  119. package/dist/crdt/doc/steps.js +0 -311
  120. package/dist/crdt/text/index/cache.d.ts +0 -16
  121. package/dist/crdt/text/index/cache.js +0 -175
  122. package/dist/crdt/text/index/claims.d.ts +0 -18
  123. package/dist/crdt/text/index/claims.js +0 -203
  124. package/dist/crdt/text/index/fold.d.ts +0 -21
  125. package/dist/crdt/text/index/fold.js +0 -656
  126. package/dist/crdt/text/index/layout.d.ts +0 -22
  127. package/dist/crdt/text/index/layout.js +0 -258
  128. package/dist/crdt/text/index/placement.d.ts +0 -47
  129. package/dist/crdt/text/index/placement.js +0 -738
  130. package/dist/crdt/text/index/records.d.ts +0 -13
  131. package/dist/crdt/text/index/records.js +0 -139
  132. package/dist/crdt/text/index/report.d.ts +0 -18
  133. package/dist/crdt/text/index/report.js +0 -337
  134. package/dist/crdt/text/index/state.d.ts +0 -197
  135. package/dist/crdt/text/index/state.js +0 -116
  136. package/dist/crdt/text/index/streams.d.ts +0 -25
  137. package/dist/crdt/text/index/streams.js +0 -248
@@ -89,8 +89,12 @@ export type SuggestContext = DocBase & DocReads & {
89
89
  create: (doc: EngineDoc, config: EdytorDocConfig) => SuggestFacade;
90
90
  /** Its changes no index fact shows: counted in the facade's `version`. */
91
91
  v: number;
92
- /** The export `toJSON()` gives unless asked for the suggestions. */
93
- base: (() => JSONDoc | undefined) | undefined;
92
+ /**
93
+ * The document without its pending suggestions, read by `read` (the
94
+ * export `toJSON()` gives unless asked for the suggestions);
95
+ * `undefined` while none is pending.
96
+ */
97
+ base: (<T>(read: (other: SuggestFacade) => T) => T | undefined) | undefined;
94
98
  };
95
99
  /** The facade the part is built over: its `part`, and the operations it writes through. */
96
100
  export type SuggestFacade = {
@@ -526,10 +526,11 @@ const docSuggest = (f) => {
526
526
  return [...map.keys()].sort(c.compare).flatMap((b) => map.get(b));
527
527
  };
528
528
  /**
529
- * The document without its pending suggestions (`sugg.json.base`): on a
530
- * copy, every pending one rejected; `undefined` while none is pending.
529
+ * The document without its pending suggestions (`sugg.json.base`), read
530
+ * by `read`: on a copy, every pending one rejected; `undefined` while
531
+ * none is pending.
531
532
  */
532
- const base = () => {
533
+ const base = (read) => {
533
534
  if (root().attrKeys().next().done || !changes().length)
534
535
  return;
535
536
  const { Y } = c;
@@ -538,11 +539,11 @@ const docSuggest = (f) => {
538
539
  const other = c.create(copy, { ...c.config, actor: undefined });
539
540
  const all = suggestionsOf(other);
540
541
  all.run(all.decide(all.changes(), false));
541
- const json = other.toJSON({ suggestions: true });
542
+ const out = read(other);
542
543
  all.dispose();
543
544
  other.dispose();
544
545
  copy.destroy();
545
- return json;
546
+ return out;
546
547
  };
547
548
  c.base = base;
548
549
  return {
@@ -99,9 +99,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
99
99
  } & {
100
100
  /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
101
101
  prepare: {
102
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
103
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
104
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
105
102
  /**
106
103
  * Move `id` to the last position under `parent` — under a container
107
104
  * it is no item of, under its last item (`nestParent`: Tab after a list).
@@ -109,29 +106,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
109
106
  nestBlock: (id: BlockId, parent: BlockId) => Prepared;
110
107
  /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
111
108
  deleteBlocks: (ids: readonly BlockId[]) => Prepared;
112
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
113
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
114
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
115
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
116
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
117
- removeInline: (id: BlockId, inlineId: string) => Prepared;
118
- setBlockType: (id: BlockId, type: string) => Prepared;
119
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
120
- setBlock: (id: BlockId, value: {
121
- type?: string;
122
- data?: Record<string, unknown>;
123
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
124
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
125
- }) => Prepared;
126
- deleteBlock: (id: BlockId, opts?: {
127
- keepChildren?: boolean;
128
- }) => Prepared;
129
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
130
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
131
- mergeBackward: (id: BlockId) => Prepared;
132
- mergeForward: (id: BlockId) => Prepared;
133
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
134
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
135
109
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
136
110
  moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
137
111
  unNestBlocks: (ids: readonly BlockId[]) => Prepared;
@@ -141,40 +115,40 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
141
115
  after?: readonly import("./index.js").BlockSpec[];
142
116
  }) => Prepared;
143
117
  duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
118
+ placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
119
+ wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
120
+ splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
121
+ mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
122
+ mergeBackward: (id: BlockId) => Prepared;
123
+ mergeForward: (id: BlockId) => Prepared;
124
+ deleteBlock: (id: BlockId, opts?: {
125
+ keepChildren?: boolean;
126
+ }) => Prepared;
127
+ setBlockType: (id: BlockId, type: string) => Prepared;
128
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
129
+ setBlock: (id: BlockId, value: {
130
+ type?: string;
131
+ data?: Record<string, unknown>;
132
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
133
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
134
+ }) => Prepared;
135
+ insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
136
+ deleteText: (id: BlockId, offset: number, length: number) => Prepared;
137
+ formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
138
+ clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
139
+ insertInline: (id: BlockId, offset: number, atom: import("./doc/ops.js").NewInline) => Prepared;
140
+ removeInline: (id: BlockId, inlineId: string) => Prepared;
141
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
142
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
143
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
144
144
  };
145
145
  /** Write a prepared plan exactly (refusals pass through). */
146
146
  apply: (p: Prepared, quiet?: boolean) => OpResult;
147
147
  compose: (...parts: Prepared[]) => Prepared;
148
148
  transact: <R>(fn: () => R, origin?: unknown) => R;
149
149
  version: number;
150
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
151
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
152
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
153
150
  nestBlock: (id: string, parent: string) => OpResult;
154
151
  deleteBlocks: (ids: readonly string[]) => OpResult;
155
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
156
- deleteText: (id: string, offset: number, length: number) => OpResult;
157
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
158
- clearMarks: (id: string, offset: number, length: number) => OpResult;
159
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
160
- removeInline: (id: string, inlineId: string) => OpResult;
161
- setBlockType: (id: string, type: string) => OpResult;
162
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
163
- setBlock: (id: string, value: {
164
- type?: string;
165
- data?: Record<string, unknown>;
166
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
167
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
168
- }) => OpResult;
169
- deleteBlock: (id: string, opts?: {
170
- keepChildren?: boolean;
171
- } | undefined) => OpResult;
172
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
173
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
174
- mergeBackward: (id: string) => OpResult;
175
- mergeForward: (id: string) => OpResult;
176
- placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
177
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
178
152
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
179
153
  moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
180
154
  unNestBlocks: (ids: readonly string[]) => OpResult;
@@ -184,6 +158,32 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
184
158
  after?: readonly import("./index.js").BlockSpec[];
185
159
  } | undefined) => OpResult;
186
160
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
161
+ placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
162
+ wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
163
+ splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
164
+ mergeBlocks: (fromId: string, intoId: string) => OpResult;
165
+ mergeBackward: (id: string) => OpResult;
166
+ mergeForward: (id: string) => OpResult;
167
+ deleteBlock: (id: string, opts?: {
168
+ keepChildren?: boolean;
169
+ } | undefined) => OpResult;
170
+ setBlockType: (id: string, type: string) => OpResult;
171
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
172
+ setBlock: (id: string, value: {
173
+ type?: string;
174
+ data?: Record<string, unknown>;
175
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
176
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
177
+ }) => OpResult;
178
+ insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
179
+ deleteText: (id: string, offset: number, length: number) => OpResult;
180
+ formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
181
+ clearMarks: (id: string, offset: number, length: number) => OpResult;
182
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
183
+ removeInline: (id: string, inlineId: string) => OpResult;
184
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
185
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
186
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
187
187
  project: () => import("./index.js").ProjectedDoc;
188
188
  toJSON: (options?: {
189
189
  suggestions?: boolean;
@@ -427,9 +427,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
427
427
  } & {
428
428
  /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
429
429
  prepare: {
430
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
431
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
432
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
433
430
  /**
434
431
  * Move `id` to the last position under `parent` — under a container
435
432
  * it is no item of, under its last item (`nestParent`: Tab after a list).
@@ -437,29 +434,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
437
434
  nestBlock: (id: BlockId, parent: BlockId) => Prepared;
438
435
  /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
439
436
  deleteBlocks: (ids: readonly BlockId[]) => Prepared;
440
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
441
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
442
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
443
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
444
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
445
- removeInline: (id: BlockId, inlineId: string) => Prepared;
446
- setBlockType: (id: BlockId, type: string) => Prepared;
447
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
448
- setBlock: (id: BlockId, value: {
449
- type?: string;
450
- data?: Record<string, unknown>;
451
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
452
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
453
- }) => Prepared;
454
- deleteBlock: (id: BlockId, opts?: {
455
- keepChildren?: boolean;
456
- }) => Prepared;
457
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
458
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
459
- mergeBackward: (id: BlockId) => Prepared;
460
- mergeForward: (id: BlockId) => Prepared;
461
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
462
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
463
437
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
464
438
  moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
465
439
  unNestBlocks: (ids: readonly BlockId[]) => Prepared;
@@ -469,40 +443,40 @@ export declare const bindDocModel: (Y: EngineApi) => {
469
443
  after?: readonly import("./index.js").BlockSpec[];
470
444
  }) => Prepared;
471
445
  duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
446
+ placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
447
+ wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
448
+ splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
449
+ mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
450
+ mergeBackward: (id: BlockId) => Prepared;
451
+ mergeForward: (id: BlockId) => Prepared;
452
+ deleteBlock: (id: BlockId, opts?: {
453
+ keepChildren?: boolean;
454
+ }) => Prepared;
455
+ setBlockType: (id: BlockId, type: string) => Prepared;
456
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
457
+ setBlock: (id: BlockId, value: {
458
+ type?: string;
459
+ data?: Record<string, unknown>;
460
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
461
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
462
+ }) => Prepared;
463
+ insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
464
+ deleteText: (id: BlockId, offset: number, length: number) => Prepared;
465
+ formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
466
+ clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
467
+ insertInline: (id: BlockId, offset: number, atom: import("./doc/ops.js").NewInline) => Prepared;
468
+ removeInline: (id: BlockId, inlineId: string) => Prepared;
469
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
470
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
471
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
472
472
  };
473
473
  /** Write a prepared plan exactly (refusals pass through). */
474
474
  apply: (p: Prepared, quiet?: boolean) => OpResult;
475
475
  compose: (...parts: Prepared[]) => Prepared;
476
476
  transact: <R>(fn: () => R, origin?: unknown) => R;
477
477
  version: number;
478
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
479
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
480
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
481
478
  nestBlock: (id: string, parent: string) => OpResult;
482
479
  deleteBlocks: (ids: readonly string[]) => OpResult;
483
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
484
- deleteText: (id: string, offset: number, length: number) => OpResult;
485
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
486
- clearMarks: (id: string, offset: number, length: number) => OpResult;
487
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
488
- removeInline: (id: string, inlineId: string) => OpResult;
489
- setBlockType: (id: string, type: string) => OpResult;
490
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
491
- setBlock: (id: string, value: {
492
- type?: string;
493
- data?: Record<string, unknown>;
494
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
495
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
496
- }) => OpResult;
497
- deleteBlock: (id: string, opts?: {
498
- keepChildren?: boolean;
499
- } | undefined) => OpResult;
500
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
501
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
502
- mergeBackward: (id: string) => OpResult;
503
- mergeForward: (id: string) => OpResult;
504
- placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
505
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
506
480
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
507
481
  moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
508
482
  unNestBlocks: (ids: readonly string[]) => OpResult;
@@ -512,6 +486,32 @@ export declare const bindDocModel: (Y: EngineApi) => {
512
486
  after?: readonly import("./index.js").BlockSpec[];
513
487
  } | undefined) => OpResult;
514
488
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
489
+ placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
490
+ wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
491
+ splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
492
+ mergeBlocks: (fromId: string, intoId: string) => OpResult;
493
+ mergeBackward: (id: string) => OpResult;
494
+ mergeForward: (id: string) => OpResult;
495
+ deleteBlock: (id: string, opts?: {
496
+ keepChildren?: boolean;
497
+ } | undefined) => OpResult;
498
+ setBlockType: (id: string, type: string) => OpResult;
499
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
500
+ setBlock: (id: string, value: {
501
+ type?: string;
502
+ data?: Record<string, unknown>;
503
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
504
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
505
+ }) => OpResult;
506
+ insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
507
+ deleteText: (id: string, offset: number, length: number) => OpResult;
508
+ formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
509
+ clearMarks: (id: string, offset: number, length: number) => OpResult;
510
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
511
+ removeInline: (id: string, inlineId: string) => OpResult;
512
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
513
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
514
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
515
515
  project: () => import("./index.js").ProjectedDoc;
516
516
  toJSON: (options?: {
517
517
  suggestions?: boolean;
@@ -834,9 +834,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
834
834
  } & {
835
835
  /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
836
836
  prepare: {
837
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
838
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
839
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
840
837
  /**
841
838
  * Move `id` to the last position under `parent` — under a container
842
839
  * it is no item of, under its last item (`nestParent`: Tab after a list).
@@ -844,29 +841,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
844
841
  nestBlock: (id: BlockId, parent: BlockId) => Prepared;
845
842
  /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
846
843
  deleteBlocks: (ids: readonly BlockId[]) => Prepared;
847
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
848
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
849
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
850
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
851
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
852
- removeInline: (id: BlockId, inlineId: string) => Prepared;
853
- setBlockType: (id: BlockId, type: string) => Prepared;
854
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
855
- setBlock: (id: BlockId, value: {
856
- type?: string;
857
- data?: Record<string, unknown>;
858
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
859
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
860
- }) => Prepared;
861
- deleteBlock: (id: BlockId, opts?: {
862
- keepChildren?: boolean;
863
- }) => Prepared;
864
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
865
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
866
- mergeBackward: (id: BlockId) => Prepared;
867
- mergeForward: (id: BlockId) => Prepared;
868
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
869
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
870
844
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
871
845
  moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
872
846
  unNestBlocks: (ids: readonly BlockId[]) => Prepared;
@@ -876,40 +850,40 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
876
850
  after?: readonly import("./index.js").BlockSpec[];
877
851
  }) => Prepared;
878
852
  duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
853
+ placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
854
+ wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
855
+ splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
856
+ mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
857
+ mergeBackward: (id: BlockId) => Prepared;
858
+ mergeForward: (id: BlockId) => Prepared;
859
+ deleteBlock: (id: BlockId, opts?: {
860
+ keepChildren?: boolean;
861
+ }) => Prepared;
862
+ setBlockType: (id: BlockId, type: string) => Prepared;
863
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
864
+ setBlock: (id: BlockId, value: {
865
+ type?: string;
866
+ data?: Record<string, unknown>;
867
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
868
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
869
+ }) => Prepared;
870
+ insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
871
+ deleteText: (id: BlockId, offset: number, length: number) => Prepared;
872
+ formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
873
+ clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
874
+ insertInline: (id: BlockId, offset: number, atom: import("./doc/ops.js").NewInline) => Prepared;
875
+ removeInline: (id: BlockId, inlineId: string) => Prepared;
876
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
877
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
878
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
879
879
  };
880
880
  /** Write a prepared plan exactly (refusals pass through). */
881
881
  apply: (p: Prepared, quiet?: boolean) => OpResult;
882
882
  compose: (...parts: Prepared[]) => Prepared;
883
883
  transact: <R>(fn: () => R, origin?: unknown) => R;
884
884
  version: number;
885
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
886
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
887
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
888
885
  nestBlock: (id: string, parent: string) => OpResult;
889
886
  deleteBlocks: (ids: readonly string[]) => OpResult;
890
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
891
- deleteText: (id: string, offset: number, length: number) => OpResult;
892
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
893
- clearMarks: (id: string, offset: number, length: number) => OpResult;
894
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
895
- removeInline: (id: string, inlineId: string) => OpResult;
896
- setBlockType: (id: string, type: string) => OpResult;
897
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
898
- setBlock: (id: string, value: {
899
- type?: string;
900
- data?: Record<string, unknown>;
901
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
902
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
903
- }) => OpResult;
904
- deleteBlock: (id: string, opts?: {
905
- keepChildren?: boolean;
906
- } | undefined) => OpResult;
907
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
908
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
909
- mergeBackward: (id: string) => OpResult;
910
- mergeForward: (id: string) => OpResult;
911
- placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
912
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
913
887
  insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
914
888
  moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
915
889
  unNestBlocks: (ids: readonly string[]) => OpResult;
@@ -919,6 +893,32 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
919
893
  after?: readonly import("./index.js").BlockSpec[];
920
894
  } | undefined) => OpResult;
921
895
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
896
+ placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
897
+ wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
898
+ splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
899
+ mergeBlocks: (fromId: string, intoId: string) => OpResult;
900
+ mergeBackward: (id: string) => OpResult;
901
+ mergeForward: (id: string) => OpResult;
902
+ deleteBlock: (id: string, opts?: {
903
+ keepChildren?: boolean;
904
+ } | undefined) => OpResult;
905
+ setBlockType: (id: string, type: string) => OpResult;
906
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
907
+ setBlock: (id: string, value: {
908
+ type?: string;
909
+ data?: Record<string, unknown>;
910
+ content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
911
+ children?: (import("./index.js").BlockSpec | JSONBlock)[];
912
+ }) => OpResult;
913
+ insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
914
+ deleteText: (id: string, offset: number, length: number) => OpResult;
915
+ formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
916
+ clearMarks: (id: string, offset: number, length: number) => OpResult;
917
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
918
+ removeInline: (id: string, inlineId: string) => OpResult;
919
+ insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
920
+ deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
921
+ replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
922
922
  project: () => import("./index.js").ProjectedDoc;
923
923
  toJSON: (options?: {
924
924
  suggestions?: boolean;
@@ -1032,7 +1032,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
1032
1032
  * Make the visible document `doc` equal `json`, keeping the ids the
1033
1033
  * registry holds and writing only what differs (`room.history.restore`), inside the caller's transaction.
1034
1034
  */
1035
- restoreTo: <Plan>(doc: EngineDoc, facade: import("./restore.js").RestoreFacade<Plan>, json: JSONDoc) => import("./restore.js").RestoreReport;
1035
+ restoreTo: <Plan>(doc: EngineDoc, facade: import("./restore.js").RestoreFacade<Plan>, json: JSONDoc, { rewrite, suggestions }?: import("./restore.js").RestoreOptions<Plan>) => import("./restore.js").RestoreReport;
1036
1036
  model: {
1037
1037
  REGISTRY_KEY: string;
1038
1038
  registryOf: (doc: EngineDoc) => EngineNode;
@@ -23,18 +23,16 @@
23
23
  * `doc/types.ts` — the public types; `doc/plan.ts` — op results, a plan's
24
24
  * effect, ingress normalization.
25
25
  * - `doc/reads.ts` (`DocBase`: the doc, its engine, its index and
26
- * roles) — the reads, roles and document order; `doc/capability.ts` —
27
- * structural capability (`canPlace`, `fits`, `canMerge`, the island and
28
- * void rules).
26
+ * roles) — the reads, roles and document order.
29
27
  * - `doc/funnel.ts` — the write funnel (`write`, `apply`, attribution);
30
28
  * `doc/events.ts` — `onChange`; `doc/history.ts` —
31
29
  * `createUndoManager`; `doc/anchors.ts` — caret anchors.
32
- * - `doc/steps.ts` — the step writers every op composes (ranks, settle,
33
- * emptying, dissolving); the prepared op families over them
34
- * (`OpsContext`): `doc/moves.ts`, `doc/layout.ts`, `doc/split-merge.ts`,
35
- * `doc/delete.ts`, `doc/meta.ts` (type and data), `doc/content.ts`
36
- * (text, atoms, marks); range deletion and flow placement are
37
- * `rangeDelete.ts` and `flow.ts`.
30
+ * - `doc/ops.ts` — one closure over the reads: the structural capability
31
+ * (`canPlace`, `fits`, `canMerge`, the island and void rules), the step
32
+ * writers every op composes (ranks, settle, emptying, dissolving) and the
33
+ * prepared op families (placement, layout, split and merge, delete, type
34
+ * and data, text, atoms and marks), then range deletion and flow placement
35
+ * over them (their types in `rangeDelete.ts` and `flow.ts`).
38
36
  *
39
37
  * ── Identity discipline ────────────────────────────────────────────────
40
38
  *
@@ -56,24 +54,15 @@ import { bindPurge, readHorizon } from './purge.js';
56
54
  import { restoreDocument } from './restore.js';
57
55
  import { bindRuns, indexOf } from './text/runs.js';
58
56
  import { bindBlockAttribution, blockAttributionOf } from './attribution/block.js';
59
- import { rangeDeleteOps } from './rangeDelete.js';
60
- import { flowOps } from './flow.js';
61
57
  import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
62
58
  import { bindSeed, restore } from './doc/seed.js';
63
59
  import { applied, ref } from './doc/plan.js';
64
60
  import { docReads } from './doc/reads.js';
65
- import { docCapability } from './doc/capability.js';
66
61
  import { writeFunnel } from './doc/funnel.js';
67
62
  import { docEvents } from './doc/events.js';
68
63
  import { docHistory } from './doc/history.js';
69
64
  import { docAnchors } from './doc/anchors.js';
70
- import { planSteps } from './doc/steps.js';
71
- import { moveOps } from './doc/moves.js';
72
- import { layoutOps } from './doc/layout.js';
73
- import { splitMergeOps } from './doc/split-merge.js';
74
- import { deleteOps } from './doc/delete.js';
75
- import { metaOps } from './doc/meta.js';
76
- import { contentOps } from './doc/content.js';
65
+ import { docOps } from './doc/ops.js';
77
66
  // ── schema manifest and gate (`doc/gate.ts`) ────────────────────────────
78
67
  export { SCHEMA };
79
68
  export { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion };
@@ -165,9 +154,10 @@ export const docFacade = (Y, layers) => {
165
154
  // The facade's parts, each over the ones before it (`doc/*`).
166
155
  const base = { Y, doc, runsView, roles, roleOf, rendersContentOf };
167
156
  const reads = { ...base, ...docReads(base) };
168
- const shape = { ...reads, ...docCapability(reads) };
157
+ // The capability, the step writers and the prepared op families (`doc/ops.ts`).
158
+ const ops = { ...reads, ...docOps(reads) };
169
159
  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;
170
- const { canPlace, fits, nestParent, canMerge, defaultChild } = shape;
160
+ const { canPlace, fits, nestParent, canMerge, defaultChild, plan, landingOf, besideAt } = ops;
171
161
  const funnel = writeFunnel({ ...reads, BA, config });
172
162
  const { write, apply } = funnel;
173
163
  const events = docEvents({ runsView });
@@ -178,37 +168,19 @@ export const docFacade = (Y, layers) => {
178
168
  };
179
169
  const { createUndoManager } = docHistory({ ...base, ...funnel, init });
180
170
  const { anchorAt, followUndo, resolveAnchor } = docAnchors(reads);
181
- const steps = { ...shape, ...planSteps(shape) };
182
- const { plan } = steps;
183
- // The prepared op families (`OpsContext`: the reads, capability and step
184
- // writers): every op they answer is a document write, but for the reads
185
- // and step writers taken out here.
186
- const { landingOf, ...moves } = moveOps(steps);
187
- const { besideAt, ...layouts } = layoutOps(steps);
188
- const { dataSteps, replaceData, ...metas } = metaOps(steps);
189
- const deletes = deleteOps(steps);
190
- /** What range deletion and flow placement compose: the step writers and the ops. */
191
- const ops = { ...steps, ...moves, ...deletes, dataSteps, replaceData };
192
171
  /** Every document op, prepared — `apply(prepare.op(…))` is the op. */
193
172
  const prepare = {
194
- ...moves,
195
- ...layouts,
196
- ...splitMergeOps(steps),
197
- ...deletes,
198
- ...metas,
199
- ...contentOps(steps),
173
+ ...ops.prepare,
200
174
  /**
201
175
  * Move `id` to the last position under `parent` — under a container
202
176
  * it is no item of, under its last item (`nestParent`: Tab after a list).
203
177
  */
204
178
  nestBlock: (id, parent) => {
205
179
  const at = nestParent([ref(id)], ref(parent));
206
- return moves.moveBlocks([id], { parent: at, index: childrenIds(at).length });
180
+ return ops.prepare.moveBlocks([id], { parent: at, index: childrenIds(at).length });
207
181
  },
208
182
  /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
209
- deleteBlocks: (ids) => deletes.deleteBlocks(ids),
210
- ...rangeDeleteOps(ops),
211
- ...flowOps(ops)
183
+ deleteBlocks: (ids) => ops.prepare.deleteBlocks(ids)
212
184
  };
213
185
  /**
214
186
  * What a part built over this document reads beyond the facade (the
@@ -248,7 +220,7 @@ export const docFacade = (Y, layers) => {
248
220
  */
249
221
  const toJSON = (options) => {
250
222
  // A part's export first (the shared suggestions': without the pending ones, `sugg.json.base`).
251
- const base = !options?.suggestions && part.base?.();
223
+ const base = !options?.suggestions && part.base?.((other) => other.toJSON({ suggestions: true }));
252
224
  if (base)
253
225
  return base;
254
226
  const data = docData();
@@ -0,0 +1,4 @@
1
+ import type * as V from './vendor/yjs/dts/index.js';
2
+
3
+ export declare const clipUpdate: typeof V.clipUpdate;
4
+ export declare const diffUpdate: typeof V.diffUpdate;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The engine calls only the room makes (a re-seed's cut and rebase,
3
+ * `crdt/reseed.ts`): apart from the engine object (`engine.js`), which every
4
+ * app keeps whole, so an app's bundle holds none of them.
5
+ */
6
+ export { clipUpdate, diffUpdate } from './vendor/yjs/src/index.js';