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
@@ -6,6 +6,7 @@ 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
8
  import { assertSchema, checkSchema, isInitialized, META_KEY, registryEmpty, SCHEMA_NAME, SCHEMA_VERSION, SchemaMismatchError, schemaVersion } from './doc/gate.js';
9
+ import type { SuggestContext } from './doc/suggest.js';
9
10
  import type { EngineNode } from './engine-api.js';
10
11
  import type { ContentItem, InlineSpec, ModelView, SplitTail } from './placement/model.js';
11
12
  import type { Anchor } from './text/model.js';
@@ -38,126 +39,157 @@ type Layers = {
38
39
  * The per-doc facade factory over the engine `Y` (the editor's documents
39
40
  * use it directly; {@link bindDocModel} is the public binding around it).
40
41
  */
42
+ /**
43
+ * Give `doc` edytor's rule — a registry value a concurrent creation replaced
44
+ * keeps its subtree (fork patch YP14, `keepingReplaced`) — or refuse it
45
+ * loudly when it has integrated updates without it: the engine decides what
46
+ * a replaced value keeps when it integrates, so a document that took updates
47
+ * under the engine's default could lose a subtree its peers keep, forever.
48
+ * Create it with `createDoc()` (or `createDocument`/`loadDocument`), never
49
+ * `new Y.Doc()`.
50
+ */
51
+ export declare const adoptRules: <D extends object>(doc: D) => D;
41
52
  export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (doc: EngineDoc, config?: EdytorDocConfig) => {
53
+ init: (opts?: Parameters<(doc: EngineDoc, opts?: {
54
+ content?: import("./index.js").BlockSpec[];
55
+ defaultType?: string;
56
+ }) => void>[1]) => void;
57
+ /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
58
+ seed: (value: JSONBlock[], data?: JsonObj) => void;
59
+ isInitialized: () => boolean;
60
+ /** Replicated `meta.v` schema version (the module-level read, bound). */
61
+ schemaVersion: () => number | undefined;
62
+ /**
63
+ * The schema gate for this doc — throws {@link SchemaMismatchError}
64
+ * on unversioned-content or unsupported-version state. Consumers
65
+ * (`Edytor.sync()`, packed consumers) call it before trusting
66
+ * a synced doc.
67
+ */
68
+ checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
69
+ assertSchema: () => void;
70
+ dispose: () => void;
71
+ createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
72
+ /** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
73
+ part: SuggestContext;
74
+ /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
75
+ childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
76
+ slotOf: (id: string) => {
77
+ parent: BlockId | null;
78
+ rank: string;
79
+ } | null;
80
+ crdtId: (id: string) => string | null;
81
+ resolveBlock: (id: string) => EngineNode | null;
82
+ followUndo: (anchor: DocAnchor) => DocAnchor;
83
+ /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
84
+ rolesChanged: (place?: boolean) => void;
85
+ defaultChild: (id: string | null) => string;
86
+ contentJSON: (id: string) => ({
87
+ text: string;
88
+ marks?: Record<string, unknown>;
89
+ } | {
90
+ id?: string;
91
+ type: string;
92
+ data?: unknown;
93
+ })[];
94
+ model: L["model"];
95
+ text: L["text"];
96
+ runsView: RunView;
97
+ /** The public members' names (`EdytorDocument` forwards them). */
98
+ api: object;
99
+ } & {
42
100
  /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
43
101
  prepare: {
44
102
  insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
45
103
  deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
46
104
  replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
47
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
48
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
49
105
  /**
50
106
  * Move `id` to the last position under `parent` — under a container
51
107
  * it is no item of, under its last item (`nestParent`: Tab after a list).
52
108
  */
53
109
  nestBlock: (id: BlockId, parent: BlockId) => Prepared;
54
- unNestBlock: (id: BlockId) => Prepared;
55
- unNestBlocks: (ids: readonly BlockId[]) => Prepared;
56
- liftOut: (id: BlockId, kind: string, { keep, after }?: {
57
- keep?: boolean;
58
- after?: readonly import("./index.js").BlockSpec[];
59
- }) => Prepared;
60
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
61
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
62
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
63
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
64
- mergeBackward: (id: BlockId) => Prepared;
65
- mergeForward: (id: BlockId) => Prepared;
66
- deleteBlock: (id: BlockId, opts?: {
67
- keepChildren?: boolean;
68
- }) => Prepared;
110
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
111
+ 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;
69
120
  setBlock: (id: BlockId, value: {
70
121
  type?: string;
71
122
  data?: Record<string, unknown>;
72
123
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
73
124
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
74
125
  }) => Prepared;
75
- setBlockType: (id: BlockId, type: string) => Prepared;
76
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => 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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
136
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
137
+ unNestBlocks: (ids: readonly BlockId[]) => Prepared;
138
+ unNestBlock: (id: BlockId) => Prepared;
139
+ liftOut: (id: BlockId, kind: string, { keep, after }?: {
140
+ keep?: boolean;
141
+ after?: readonly import("./index.js").BlockSpec[];
142
+ }) => Prepared;
77
143
  duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
78
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
79
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
80
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
81
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
82
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
83
- removeInline: (id: BlockId, inlineId: string) => Prepared;
84
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
85
- deleteBlocks: (ids: readonly BlockId[]) => Prepared;
86
144
  };
87
145
  /** Write a prepared plan exactly (refusals pass through). */
88
- apply: (p: Prepared) => OpResult;
146
+ apply: (p: Prepared, quiet?: boolean) => OpResult;
89
147
  compose: (...parts: Prepared[]) => Prepared;
90
148
  transact: <R>(fn: () => R, origin?: unknown) => R;
91
- model: L["model"];
92
- text: L["text"];
93
- runsView: RunView;
94
149
  version: number;
95
150
  insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
96
151
  deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
97
152
  replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
98
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
99
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
100
153
  nestBlock: (id: string, parent: string) => OpResult;
101
- unNestBlock: (id: string) => OpResult;
102
- unNestBlocks: (ids: readonly string[]) => OpResult;
103
- liftOut: (id: string, kind: string, args_2?: {
104
- keep?: boolean;
105
- after?: readonly import("./index.js").BlockSpec[];
106
- } | undefined) => OpResult;
107
- placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => OpResult;
108
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
109
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
110
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
111
- mergeBackward: (id: string) => OpResult;
112
- mergeForward: (id: string) => OpResult;
113
- deleteBlock: (id: string, opts?: {
114
- keepChildren?: boolean;
115
- } | undefined) => OpResult;
154
+ 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;
116
163
  setBlock: (id: string, value: {
117
164
  type?: string;
118
165
  data?: Record<string, unknown>;
119
166
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
120
167
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
121
168
  }) => OpResult;
122
- setBlockType: (id: string, type: string) => OpResult;
123
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => 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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
179
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
180
+ unNestBlocks: (ids: readonly string[]) => OpResult;
181
+ unNestBlock: (id: string) => OpResult;
182
+ liftOut: (id: string, kind: string, args_2?: {
183
+ keep?: boolean;
184
+ after?: readonly import("./index.js").BlockSpec[];
185
+ } | undefined) => OpResult;
124
186
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
125
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
126
- deleteText: (id: string, offset: number, length: number) => OpResult;
127
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
128
- clearMarks: (id: string, offset: number, length: number) => OpResult;
129
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
130
- removeInline: (id: string, inlineId: string) => OpResult;
131
- deleteBlocks: (ids: readonly string[]) => OpResult;
132
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
133
- content?: import("./index.js").BlockSpec[];
134
- defaultType?: string;
135
- }) => void>[1]) => void;
136
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
137
- seed: (value: JSONBlock[], data?: JsonObj) => void;
138
- isInitialized: () => boolean;
139
- /** Replicated `meta.v` schema version (the module-level read, bound). */
140
- schemaVersion: () => number | undefined;
141
- /**
142
- * The schema gate for this doc — throws {@link SchemaMismatchError}
143
- * on unversioned-content or unsupported-version state. Consumers
144
- * (`Edytor.sync()`, packed consumers) call it before trusting
145
- * a synced doc.
146
- */
147
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
148
- assertSchema: () => void;
149
- dispose: () => void;
150
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
151
187
  project: () => import("./index.js").ProjectedDoc;
152
- toJSON: () => JSONDoc;
188
+ toJSON: (options?: {
189
+ suggestions?: boolean;
190
+ }) => JSONDoc;
153
191
  blockJSON: (id: string) => JSONBlock;
154
192
  childrenIds: (id: string | null) => string[];
155
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
156
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
157
- slotOf: (id: string) => {
158
- parent: BlockId | null;
159
- rank: string;
160
- } | null;
161
193
  positionOf: (id: string) => import("./index.js").Destination | null;
162
194
  pathOf: (id: string) => number[] | null;
163
195
  parentOf: (id: string) => string | null;
@@ -180,8 +212,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
180
212
  * O(1) per call; live-replicated (remote values read the same).
181
213
  */
182
214
  blockAttribution: (id: string) => BlockAttribution | undefined;
183
- crdtId: (id: string) => string | null;
184
- resolveBlock: (id: string) => EngineNode | null;
185
215
  displayLength: (id: string) => number;
186
216
  contentItems: (id: string) => ContentItem[];
187
217
  hasBlock: (id: string) => boolean;
@@ -195,9 +225,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
195
225
  blockId: BlockId;
196
226
  offset: number;
197
227
  } | null;
198
- followUndo: (anchor: DocAnchor) => DocAnchor;
199
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
200
- rolesChanged: () => void;
201
228
  isVoid: (id: string) => boolean;
202
229
  isIsland: (id: string) => boolean;
203
230
  isLines: (id: string) => boolean;
@@ -244,16 +271,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
244
271
  parent: string | null;
245
272
  levels: string[];
246
273
  };
247
- defaultChild: (id: string | null) => string;
248
274
  runs: (id: string) => readonly ContentRun[];
249
- contentJSON: (id: string) => ({
250
- text: string;
251
- marks?: Record<string, unknown>;
252
- } | {
253
- id?: string;
254
- type: string;
255
- data?: unknown;
256
- })[];
257
275
  onChange: (cb: (change: DocChange) => void) => (() => void);
258
276
  };
259
277
  /**
@@ -265,7 +283,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
265
283
  export declare const bindDocModel: (Y: EngineApi) => {
266
284
  /** The schema manifest constants table. */
267
285
  SCHEMA: {
268
- readonly version: 6;
286
+ readonly version: 11;
269
287
  readonly name: "edytor-doc";
270
288
  readonly roots: {
271
289
  readonly registry: "blocks";
@@ -276,7 +294,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
276
294
  readonly schema: "schema";
277
295
  };
278
296
  };
279
- SCHEMA_VERSION: 6;
297
+ SCHEMA_VERSION: 11;
280
298
  SCHEMA_NAME: "edytor-doc";
281
299
  META_KEY: "meta";
282
300
  /** Doc-level API (no facade needed). */
@@ -294,84 +312,77 @@ export declare const bindDocModel: (Y: EngineApi) => {
294
312
  SchemaMismatchError: typeof SchemaMismatchError;
295
313
  /** Attach the per-doc facade. */
296
314
  create: (doc: EngineDoc, config?: EdytorDocConfig) => {
297
- /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
298
- prepare: {
299
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
300
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
301
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
302
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
303
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
304
- /**
305
- * Move `id` to the last position under `parent` — under a container
306
- * it is no item of, under its last item (`nestParent`: Tab after a list).
307
- */
308
- nestBlock: (id: BlockId, parent: BlockId) => Prepared;
309
- unNestBlock: (id: BlockId) => Prepared;
310
- unNestBlocks: (ids: readonly BlockId[]) => Prepared;
311
- liftOut: (id: BlockId, kind: string, { keep, after }?: {
312
- keep?: boolean;
313
- after?: readonly import("./index.js").BlockSpec[];
314
- }) => Prepared;
315
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
316
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
317
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
318
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
319
- mergeBackward: (id: BlockId) => Prepared;
320
- mergeForward: (id: BlockId) => Prepared;
321
- deleteBlock: (id: BlockId, opts?: {
322
- keepChildren?: boolean;
323
- }) => Prepared;
324
- setBlock: (id: BlockId, value: {
325
- type?: string;
326
- data?: Record<string, unknown>;
327
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
328
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
329
- }) => Prepared;
330
- setBlockType: (id: BlockId, type: string) => Prepared;
331
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
332
- duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
333
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
334
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
335
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
336
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
337
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
338
- removeInline: (id: BlockId, inlineId: string) => Prepared;
339
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
340
- deleteBlocks: (ids: readonly BlockId[]) => Prepared;
341
- };
342
- /** Write a prepared plan exactly (refusals pass through). */
343
- apply: (p: Prepared) => OpResult;
344
- compose: (...parts: Prepared[]) => Prepared;
345
- transact: <R>(fn: () => R, origin?: unknown) => R;
315
+ init: (opts?: Parameters<(doc: EngineDoc, opts?: {
316
+ content?: import("./index.js").BlockSpec[];
317
+ defaultType?: string;
318
+ }) => void>[1]) => void;
319
+ /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
320
+ seed: (value: JSONBlock[], data?: JsonObj) => void;
321
+ isInitialized: () => boolean;
322
+ /** Replicated `meta.v` schema version (the module-level read, bound). */
323
+ schemaVersion: () => number | undefined;
324
+ /**
325
+ * The schema gate for this doc — throws {@link SchemaMismatchError}
326
+ * on unversioned-content or unsupported-version state. Consumers
327
+ * (`Edytor.sync()`, packed consumers) call it before trusting
328
+ * a synced doc.
329
+ */
330
+ checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
331
+ assertSchema: () => void;
332
+ dispose: () => void;
333
+ createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
334
+ /** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
335
+ part: SuggestContext;
336
+ /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
337
+ childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
338
+ slotOf: (id: string) => {
339
+ parent: BlockId | null;
340
+ rank: string;
341
+ } | null;
342
+ crdtId: (id: string) => string | null;
343
+ resolveBlock: (id: string) => EngineNode | null;
344
+ followUndo: (anchor: DocAnchor) => DocAnchor;
345
+ /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
346
+ rolesChanged: (place?: boolean) => void;
347
+ defaultChild: (id: string | null) => string;
348
+ contentJSON: (id: string) => ({
349
+ text: string;
350
+ marks?: Record<string, unknown>;
351
+ } | {
352
+ id?: string;
353
+ type: string;
354
+ data?: unknown;
355
+ })[];
346
356
  model: {
347
357
  REGISTRY_KEY: string;
348
358
  registryOf: (doc: EngineDoc) => EngineNode;
349
359
  blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
350
360
  liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
351
361
  isLive: (doc: EngineDoc, id: BlockId) => boolean;
352
- candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
353
362
  view: (doc: EngineDoc) => ModelView;
354
- resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
355
363
  childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
356
364
  positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
357
365
  buildInline: (atom: InlineSpec) => EngineNode;
358
366
  isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
359
- ranksAt: (siblings: readonly {
360
- rank: string;
361
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
362
- writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
367
+ placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
368
+ moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
369
+ insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
363
370
  withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
364
371
  inserts: {
365
372
  has(client: number, clock: number): boolean;
366
373
  };
367
374
  }) => boolean;
368
- materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
369
375
  collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
370
- writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, place: import("./placement/model.js").PlacementValue) => void;
376
+ writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
371
377
  ownText: (doc: EngineDoc, id: BlockId) => {
372
378
  from: unknown;
373
379
  to: number;
374
380
  };
381
+ recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
382
+ item: import("./placement/slots.js").SeqItem;
383
+ stamp: import("./placement/slots.js").Stamp;
384
+ wins: boolean;
385
+ }[];
375
386
  insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
376
387
  insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
377
388
  restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -403,81 +414,110 @@ export declare const bindDocModel: (Y: EngineApi) => {
403
414
  at: number;
404
415
  node: EngineNode;
405
416
  } | null;
406
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
407
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
417
+ splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
418
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
408
419
  ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
409
420
  from: unknown;
410
421
  to: number;
411
422
  };
412
423
  };
413
424
  runsView: RunView;
425
+ /** The public members' names (`EdytorDocument` forwards them). */
426
+ api: object;
427
+ } & {
428
+ /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
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
+ /**
434
+ * Move `id` to the last position under `parent` — under a container
435
+ * it is no item of, under its last item (`nestParent`: Tab after a list).
436
+ */
437
+ nestBlock: (id: BlockId, parent: BlockId) => Prepared;
438
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
439
+ 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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
464
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
465
+ unNestBlocks: (ids: readonly BlockId[]) => Prepared;
466
+ unNestBlock: (id: BlockId) => Prepared;
467
+ liftOut: (id: BlockId, kind: string, { keep, after }?: {
468
+ keep?: boolean;
469
+ after?: readonly import("./index.js").BlockSpec[];
470
+ }) => Prepared;
471
+ duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
472
+ };
473
+ /** Write a prepared plan exactly (refusals pass through). */
474
+ apply: (p: Prepared, quiet?: boolean) => OpResult;
475
+ compose: (...parts: Prepared[]) => Prepared;
476
+ transact: <R>(fn: () => R, origin?: unknown) => R;
414
477
  version: number;
415
478
  insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
416
479
  deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
417
480
  replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
418
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
419
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
420
481
  nestBlock: (id: string, parent: string) => OpResult;
421
- unNestBlock: (id: string) => OpResult;
422
- unNestBlocks: (ids: readonly string[]) => OpResult;
423
- liftOut: (id: string, kind: string, args_2?: {
424
- keep?: boolean;
425
- after?: readonly import("./index.js").BlockSpec[];
426
- } | undefined) => OpResult;
427
- placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => OpResult;
428
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
429
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
430
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
431
- mergeBackward: (id: string) => OpResult;
432
- mergeForward: (id: string) => OpResult;
433
- deleteBlock: (id: string, opts?: {
434
- keepChildren?: boolean;
435
- } | undefined) => OpResult;
436
- setBlock: (id: string, value: {
437
- type?: string;
438
- data?: Record<string, unknown>;
439
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
440
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
441
- }) => OpResult;
442
- setBlockType: (id: string, type: string) => OpResult;
443
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
444
- duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
482
+ deleteBlocks: (ids: readonly string[]) => OpResult;
445
483
  insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
446
484
  deleteText: (id: string, offset: number, length: number) => OpResult;
447
485
  formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
448
486
  clearMarks: (id: string, offset: number, length: number) => OpResult;
449
487
  insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
450
488
  removeInline: (id: string, inlineId: string) => OpResult;
451
- deleteBlocks: (ids: readonly string[]) => OpResult;
452
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
453
- content?: import("./index.js").BlockSpec[];
454
- defaultType?: string;
455
- }) => void>[1]) => void;
456
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
457
- seed: (value: JSONBlock[], data?: JsonObj) => void;
458
- isInitialized: () => boolean;
459
- /** Replicated `meta.v` schema version (the module-level read, bound). */
460
- schemaVersion: () => number | undefined;
461
- /**
462
- * The schema gate for this doc — throws {@link SchemaMismatchError}
463
- * on unversioned-content or unsupported-version state. Consumers
464
- * (`Edytor.sync()`, packed consumers) call it before trusting
465
- * a synced doc.
466
- */
467
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
468
- assertSchema: () => void;
469
- dispose: () => void;
470
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
507
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
508
+ unNestBlocks: (ids: readonly string[]) => OpResult;
509
+ unNestBlock: (id: string) => OpResult;
510
+ liftOut: (id: string, kind: string, args_2?: {
511
+ keep?: boolean;
512
+ after?: readonly import("./index.js").BlockSpec[];
513
+ } | undefined) => OpResult;
514
+ duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
471
515
  project: () => import("./index.js").ProjectedDoc;
472
- toJSON: () => JSONDoc;
516
+ toJSON: (options?: {
517
+ suggestions?: boolean;
518
+ } | undefined) => JSONDoc;
473
519
  blockJSON: (id: string) => JSONBlock;
474
520
  childrenIds: (id: string | null) => string[];
475
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
476
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
477
- slotOf: (id: string) => {
478
- parent: BlockId | null;
479
- rank: string;
480
- } | null;
481
521
  positionOf: (id: string) => import("./index.js").Destination | null;
482
522
  pathOf: (id: string) => number[] | null;
483
523
  parentOf: (id: string) => string | null;
@@ -500,8 +540,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
500
540
  * O(1) per call; live-replicated (remote values read the same).
501
541
  */
502
542
  blockAttribution: (id: string) => BlockAttribution | undefined;
503
- crdtId: (id: string) => string | null;
504
- resolveBlock: (id: string) => EngineNode | null;
505
543
  displayLength: (id: string) => number;
506
544
  contentItems: (id: string) => ContentItem[];
507
545
  hasBlock: (id: string) => boolean;
@@ -515,9 +553,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
515
553
  blockId: BlockId;
516
554
  offset: number;
517
555
  } | null;
518
- followUndo: (anchor: DocAnchor) => DocAnchor;
519
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
520
- rolesChanged: () => void;
521
556
  isVoid: (id: string) => boolean;
522
557
  isIsland: (id: string) => boolean;
523
558
  isLines: (id: string) => boolean;
@@ -564,16 +599,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
564
599
  parent: string | null;
565
600
  levels: string[];
566
601
  };
567
- defaultChild: (id: string | null) => string;
568
602
  runs: (id: string) => readonly ContentRun[];
569
- contentJSON: (id: string) => ({
570
- text: string;
571
- marks?: Record<string, unknown>;
572
- } | {
573
- id?: string;
574
- type: string;
575
- data?: unknown;
576
- })[];
577
603
  onChange: (cb: (change: DocChange) => void) => (() => void);
578
604
  };
579
605
  /**
@@ -584,14 +610,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
584
610
  * not have integrated anything yet.
585
611
  */
586
612
  newDoc: (opts?: ConstructorParameters<EngineApi["Doc"]>[0]) => YDoc;
587
- /**
588
- * Keep, on `doc`, the text a replica may have to copy again: its
589
- * `gcFilter` then spares a deleted copy's content, as every facade's
590
- * history does. A doc that only relays updates (the room) calls it
591
- * before applying anything, so what it collects and encodes matches
592
- * what an editing replica keeps.
593
- */
594
- keepCopies: (doc: EngineDoc) => void;
595
613
  /** The bound engine layers (same instances the facades use). */
596
614
  model: {
597
615
  REGISTRY_KEY: string;
@@ -599,29 +617,30 @@ export declare const bindDocModel: (Y: EngineApi) => {
599
617
  blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
600
618
  liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
601
619
  isLive: (doc: EngineDoc, id: BlockId) => boolean;
602
- candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
603
620
  view: (doc: EngineDoc) => ModelView;
604
- resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
605
621
  childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
606
622
  positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
607
623
  buildInline: (atom: InlineSpec) => EngineNode;
608
624
  isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
609
- ranksAt: (siblings: readonly {
610
- rank: string;
611
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
612
- writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
625
+ placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
626
+ moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
627
+ insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
613
628
  withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
614
629
  inserts: {
615
630
  has(client: number, clock: number): boolean;
616
631
  };
617
632
  }) => boolean;
618
- materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
619
633
  collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
620
- writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, place: import("./placement/model.js").PlacementValue) => void;
634
+ writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
621
635
  ownText: (doc: EngineDoc, id: BlockId) => {
622
636
  from: unknown;
623
637
  to: number;
624
638
  };
639
+ recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
640
+ item: import("./placement/slots.js").SeqItem;
641
+ stamp: import("./placement/slots.js").Stamp;
642
+ wins: boolean;
643
+ }[];
625
644
  insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
626
645
  insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
627
646
  restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -653,8 +672,8 @@ export declare const bindDocModel: (Y: EngineApi) => {
653
672
  at: number;
654
673
  node: EngineNode;
655
674
  } | null;
656
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
657
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
675
+ splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
676
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
658
677
  ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
659
678
  from: unknown;
660
679
  to: number;
@@ -671,7 +690,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
671
690
  export declare const bindEdytorDoc: (Y: EngineApi) => {
672
691
  /** The schema manifest constants table. */
673
692
  SCHEMA: {
674
- readonly version: 6;
693
+ readonly version: 11;
675
694
  readonly name: "edytor-doc";
676
695
  readonly roots: {
677
696
  readonly registry: "blocks";
@@ -682,7 +701,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
682
701
  readonly schema: "schema";
683
702
  };
684
703
  };
685
- SCHEMA_VERSION: 6;
704
+ SCHEMA_VERSION: 11;
686
705
  SCHEMA_NAME: "edytor-doc";
687
706
  META_KEY: "meta";
688
707
  /** Doc-level API (no facade needed). */
@@ -700,84 +719,77 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
700
719
  SchemaMismatchError: typeof SchemaMismatchError;
701
720
  /** Attach the per-doc facade. */
702
721
  create: (doc: EngineDoc, config?: EdytorDocConfig) => {
703
- /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
704
- prepare: {
705
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
706
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
707
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
708
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
709
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
710
- /**
711
- * Move `id` to the last position under `parent` — under a container
712
- * it is no item of, under its last item (`nestParent`: Tab after a list).
713
- */
714
- nestBlock: (id: BlockId, parent: BlockId) => Prepared;
715
- unNestBlock: (id: BlockId) => Prepared;
716
- unNestBlocks: (ids: readonly BlockId[]) => Prepared;
717
- liftOut: (id: BlockId, kind: string, { keep, after }?: {
718
- keep?: boolean;
719
- after?: readonly import("./index.js").BlockSpec[];
720
- }) => Prepared;
721
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
722
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
723
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
724
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
725
- mergeBackward: (id: BlockId) => Prepared;
726
- mergeForward: (id: BlockId) => Prepared;
727
- deleteBlock: (id: BlockId, opts?: {
728
- keepChildren?: boolean;
729
- }) => Prepared;
730
- setBlock: (id: BlockId, value: {
731
- type?: string;
732
- data?: Record<string, unknown>;
733
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
734
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
735
- }) => Prepared;
736
- setBlockType: (id: BlockId, type: string) => Prepared;
737
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
738
- duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
739
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
740
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
741
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
742
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
743
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
744
- removeInline: (id: BlockId, inlineId: string) => Prepared;
745
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
746
- deleteBlocks: (ids: readonly BlockId[]) => Prepared;
747
- };
748
- /** Write a prepared plan exactly (refusals pass through). */
749
- apply: (p: Prepared) => OpResult;
750
- compose: (...parts: Prepared[]) => Prepared;
751
- transact: <R>(fn: () => R, origin?: unknown) => R;
722
+ init: (opts?: Parameters<(doc: EngineDoc, opts?: {
723
+ content?: import("./index.js").BlockSpec[];
724
+ defaultType?: string;
725
+ }) => void>[1]) => void;
726
+ /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
727
+ seed: (value: JSONBlock[], data?: JsonObj) => void;
728
+ isInitialized: () => boolean;
729
+ /** Replicated `meta.v` schema version (the module-level read, bound). */
730
+ schemaVersion: () => number | undefined;
731
+ /**
732
+ * The schema gate for this doc — throws {@link SchemaMismatchError}
733
+ * on unversioned-content or unsupported-version state. Consumers
734
+ * (`Edytor.sync()`, packed consumers) call it before trusting
735
+ * a synced doc.
736
+ */
737
+ checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
738
+ assertSchema: () => void;
739
+ dispose: () => void;
740
+ createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
741
+ /** @internal What a part built over the document reads and writes (`doc/suggest.ts`). */
742
+ part: SuggestContext;
743
+ /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
744
+ childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
745
+ slotOf: (id: string) => {
746
+ parent: BlockId | null;
747
+ rank: string;
748
+ } | null;
749
+ crdtId: (id: string) => string | null;
750
+ resolveBlock: (id: string) => EngineNode | null;
751
+ followUndo: (anchor: DocAnchor) => DocAnchor;
752
+ /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
753
+ rolesChanged: (place?: boolean) => void;
754
+ defaultChild: (id: string | null) => string;
755
+ contentJSON: (id: string) => ({
756
+ text: string;
757
+ marks?: Record<string, unknown>;
758
+ } | {
759
+ id?: string;
760
+ type: string;
761
+ data?: unknown;
762
+ })[];
752
763
  model: {
753
764
  REGISTRY_KEY: string;
754
765
  registryOf: (doc: EngineDoc) => EngineNode;
755
766
  blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
756
767
  liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
757
768
  isLive: (doc: EngineDoc, id: BlockId) => boolean;
758
- candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
759
769
  view: (doc: EngineDoc) => ModelView;
760
- resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
761
770
  childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
762
771
  positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
763
772
  buildInline: (atom: InlineSpec) => EngineNode;
764
773
  isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
765
- ranksAt: (siblings: readonly {
766
- rank: string;
767
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
768
- writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
774
+ placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
775
+ moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
776
+ insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
769
777
  withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
770
778
  inserts: {
771
779
  has(client: number, clock: number): boolean;
772
780
  };
773
781
  }) => boolean;
774
- materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
775
782
  collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
776
- writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, place: import("./placement/model.js").PlacementValue) => void;
783
+ writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
777
784
  ownText: (doc: EngineDoc, id: BlockId) => {
778
785
  from: unknown;
779
786
  to: number;
780
787
  };
788
+ recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
789
+ item: import("./placement/slots.js").SeqItem;
790
+ stamp: import("./placement/slots.js").Stamp;
791
+ wins: boolean;
792
+ }[];
781
793
  insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
782
794
  insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
783
795
  restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -809,81 +821,110 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
809
821
  at: number;
810
822
  node: EngineNode;
811
823
  } | null;
812
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
813
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
824
+ splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
825
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
814
826
  ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
815
827
  from: unknown;
816
828
  to: number;
817
829
  };
818
830
  };
819
831
  runsView: RunView;
832
+ /** The public members' names (`EdytorDocument` forwards them). */
833
+ api: object;
834
+ } & {
835
+ /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
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
+ /**
841
+ * Move `id` to the last position under `parent` — under a container
842
+ * it is no item of, under its last item (`nestParent`: Tab after a list).
843
+ */
844
+ nestBlock: (id: BlockId, parent: BlockId) => Prepared;
845
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
846
+ 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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
871
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
872
+ unNestBlocks: (ids: readonly BlockId[]) => Prepared;
873
+ unNestBlock: (id: BlockId) => Prepared;
874
+ liftOut: (id: BlockId, kind: string, { keep, after }?: {
875
+ keep?: boolean;
876
+ after?: readonly import("./index.js").BlockSpec[];
877
+ }) => Prepared;
878
+ duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
879
+ };
880
+ /** Write a prepared plan exactly (refusals pass through). */
881
+ apply: (p: Prepared, quiet?: boolean) => OpResult;
882
+ compose: (...parts: Prepared[]) => Prepared;
883
+ transact: <R>(fn: () => R, origin?: unknown) => R;
820
884
  version: number;
821
885
  insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
822
886
  deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
823
887
  replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
824
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
825
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
826
888
  nestBlock: (id: string, parent: string) => OpResult;
827
- unNestBlock: (id: string) => OpResult;
828
- unNestBlocks: (ids: readonly string[]) => OpResult;
829
- liftOut: (id: string, kind: string, args_2?: {
830
- keep?: boolean;
831
- after?: readonly import("./index.js").BlockSpec[];
832
- } | undefined) => OpResult;
833
- placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => OpResult;
834
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
835
- splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
836
- mergeBlocks: (fromId: string, intoId: string) => OpResult;
837
- mergeBackward: (id: string) => OpResult;
838
- mergeForward: (id: string) => OpResult;
839
- deleteBlock: (id: string, opts?: {
840
- keepChildren?: boolean;
841
- } | undefined) => OpResult;
889
+ 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;
842
898
  setBlock: (id: string, value: {
843
899
  type?: string;
844
900
  data?: Record<string, unknown>;
845
901
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
846
902
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
847
903
  }) => OpResult;
848
- setBlockType: (id: string, type: string) => OpResult;
849
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => 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
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
914
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
915
+ unNestBlocks: (ids: readonly string[]) => OpResult;
916
+ unNestBlock: (id: string) => OpResult;
917
+ liftOut: (id: string, kind: string, args_2?: {
918
+ keep?: boolean;
919
+ after?: readonly import("./index.js").BlockSpec[];
920
+ } | undefined) => OpResult;
850
921
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
851
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
852
- deleteText: (id: string, offset: number, length: number) => OpResult;
853
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
854
- clearMarks: (id: string, offset: number, length: number) => OpResult;
855
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
856
- removeInline: (id: string, inlineId: string) => OpResult;
857
- deleteBlocks: (ids: readonly string[]) => OpResult;
858
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
859
- content?: import("./index.js").BlockSpec[];
860
- defaultType?: string;
861
- }) => void>[1]) => void;
862
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
863
- seed: (value: JSONBlock[], data?: JsonObj) => void;
864
- isInitialized: () => boolean;
865
- /** Replicated `meta.v` schema version (the module-level read, bound). */
866
- schemaVersion: () => number | undefined;
867
- /**
868
- * The schema gate for this doc — throws {@link SchemaMismatchError}
869
- * on unversioned-content or unsupported-version state. Consumers
870
- * (`Edytor.sync()`, packed consumers) call it before trusting
871
- * a synced doc.
872
- */
873
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
874
- assertSchema: () => void;
875
- dispose: () => void;
876
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
877
922
  project: () => import("./index.js").ProjectedDoc;
878
- toJSON: () => JSONDoc;
923
+ toJSON: (options?: {
924
+ suggestions?: boolean;
925
+ } | undefined) => JSONDoc;
879
926
  blockJSON: (id: string) => JSONBlock;
880
927
  childrenIds: (id: string | null) => string[];
881
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
882
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
883
- slotOf: (id: string) => {
884
- parent: BlockId | null;
885
- rank: string;
886
- } | null;
887
928
  positionOf: (id: string) => import("./index.js").Destination | null;
888
929
  pathOf: (id: string) => number[] | null;
889
930
  parentOf: (id: string) => string | null;
@@ -906,8 +947,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
906
947
  * O(1) per call; live-replicated (remote values read the same).
907
948
  */
908
949
  blockAttribution: (id: string) => BlockAttribution | undefined;
909
- crdtId: (id: string) => string | null;
910
- resolveBlock: (id: string) => EngineNode | null;
911
950
  displayLength: (id: string) => number;
912
951
  contentItems: (id: string) => ContentItem[];
913
952
  hasBlock: (id: string) => boolean;
@@ -921,9 +960,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
921
960
  blockId: BlockId;
922
961
  offset: number;
923
962
  } | null;
924
- followUndo: (anchor: DocAnchor) => DocAnchor;
925
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
926
- rolesChanged: () => void;
927
963
  isVoid: (id: string) => boolean;
928
964
  isIsland: (id: string) => boolean;
929
965
  isLines: (id: string) => boolean;
@@ -970,16 +1006,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
970
1006
  parent: string | null;
971
1007
  levels: string[];
972
1008
  };
973
- defaultChild: (id: string | null) => string;
974
1009
  runs: (id: string) => readonly ContentRun[];
975
- contentJSON: (id: string) => ({
976
- text: string;
977
- marks?: Record<string, unknown>;
978
- } | {
979
- id?: string;
980
- type: string;
981
- data?: unknown;
982
- })[];
983
1010
  onChange: (cb: (change: DocChange) => void) => (() => void);
984
1011
  };
985
1012
  /**
@@ -990,23 +1017,15 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
990
1017
  * not have integrated anything yet.
991
1018
  */
992
1019
  newDoc: (opts?: ConstructorParameters<EngineApi["Doc"]>[0]) => YDoc;
993
- /**
994
- * Keep, on `doc`, the text a replica may have to copy again: its
995
- * `gcFilter` then spares a deleted copy's content, as every facade's
996
- * history does. A doc that only relays updates (the room) calls it
997
- * before applying anything, so what it collects and encodes matches
998
- * what an editing replica keeps.
999
- */
1000
- keepCopies: (doc: EngineDoc) => void;
1001
1020
  /**
1002
1021
  * Purge from `doc` what was deleted before `horizon` (`room.purge.what`): real deletes, inside the caller's transaction,
1003
1022
  * and the horizon record every history reads (`hist.purge.horizon`).
1004
1023
  * The room's purge task runs it; `facade` is a facade over `doc`.
1005
1024
  */
1006
- purge: (doc: EngineDoc, facade: {
1025
+ purge: (doc: EngineDoc, facade: Partial<import("./doc/suggest.js").SuggestFacade> & {
1007
1026
  model: import("./placement/model.js").PlacementModel;
1008
1027
  text: import("./text/model.js").TextEngine;
1009
- }, horizon: import("./purge.js").Horizon) => import("./purge.js").PurgeReport;
1028
+ }, horizon: import("./purge.js").Horizon | null) => import("./purge.js").PurgeReport;
1010
1029
  /** The purge horizon `doc` holds, or `null`. */
1011
1030
  horizonOf: (doc: EngineDoc) => import("./purge.js").Horizon | null;
1012
1031
  /**
@@ -1020,29 +1039,30 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
1020
1039
  blockNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
1021
1040
  liveNodeOf: (doc: EngineDoc, id: BlockId) => EngineNode | null;
1022
1041
  isLive: (doc: EngineDoc, id: BlockId) => boolean;
1023
- candidatesOf: (node: EngineNode) => import("./placement/model.js").PlacementCand[];
1024
1042
  view: (doc: EngineDoc) => ModelView;
1025
- resolvePlacements: (blocks: Map<BlockId, import("./placement/model.js").BlockRec>, ownerOf?: (b: BlockId) => import("./text/model.js").Owner) => Map<BlockId, import("./placement/model.js").ResolvedPlacement>;
1026
1043
  childrenIndex: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./placement/model.js").DisplayOwnership) => Map<BlockId | null, import("./placement/model.js").ChildSlot[]>;
1027
1044
  positionInView: (v: ModelView, id: BlockId) => import("./index.js").Destination | null;
1028
1045
  buildInline: (atom: InlineSpec) => EngineNode;
1029
1046
  isSelfOrDescendant: (placements: Map<BlockId, import("./placement/model.js").ResolvedPlacement>, own: import("./text/model.js").Ownership, id: BlockId, maybeAncestor: BlockId) => boolean;
1030
- ranksAt: (siblings: readonly {
1031
- rank: string;
1032
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
1033
- writePlacement: (doc: EngineDoc, node: EngineNode, p: BlockId | null, r: string) => void;
1047
+ placeBlocks: (doc: EngineDoc, v: ModelView, parent: BlockId | null, left: BlockId | null, right: BlockId | null, slots: readonly import("./placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("./placement/slots.js").Unit | null) => void;
1048
+ moveBlocksTo: (doc: EngineDoc, v: ModelView, ids: readonly BlockId[], parent: BlockId | null, index: number, side?: number, part?: number, at?: BlockId | null) => void;
1049
+ insertSpecsAt: (doc: EngineDoc, v: ModelView, parent: BlockId | null, index: number, specs: readonly import("./index.js").BlockSpec[], split?: import("./placement/slots.js").Unit | null) => void;
1034
1050
  withdrawOnUndo: (doc: EngineDoc) => (item: import("./engine-api.js").EngineItemRef, stackItem: {
1035
1051
  inserts: {
1036
1052
  has(client: number, clock: number): boolean;
1037
1053
  };
1038
1054
  }) => boolean;
1039
- materializeSpec: (doc: EngineDoc, sp: import("./index.js").BlockSpec, parent: BlockId | null, rank: string) => void;
1040
1055
  collides: (doc: EngineDoc, specs: readonly import("./index.js").BlockSpec[]) => boolean;
1041
- writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, place: import("./placement/model.js").PlacementValue) => void;
1056
+ writeSplit: (doc: EngineDoc, id: BlockId, offset: number, newId: BlockId, tail: SplitTail, parent: BlockId | null, index: number) => import("./placement/slots.js").Unit;
1042
1057
  ownText: (doc: EngineDoc, id: BlockId) => {
1043
1058
  from: unknown;
1044
1059
  to: number;
1045
1060
  };
1061
+ recordsOf: (doc: EngineDoc, node: EngineNode, v?: ModelView) => {
1062
+ item: import("./placement/slots.js").SeqItem;
1063
+ stamp: import("./placement/slots.js").Stamp;
1064
+ wins: boolean;
1065
+ }[];
1046
1066
  insertBlocks: (doc: EngineDoc, dest: import("./index.js").Destination, specs: import("./index.js").BlockSpec[]) => boolean;
1047
1067
  insertBlock: (doc: EngineDoc, dest: import("./index.js").Destination, spec: import("./index.js").BlockSpec) => boolean;
1048
1068
  restoreBlocks: (doc: EngineDoc, specs: import("./index.js").BlockSpec[]) => void;
@@ -1074,8 +1094,8 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
1074
1094
  at: number;
1075
1095
  node: EngineNode;
1076
1096
  } | null;
1077
- splitAt: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => import("./text/model.js").MergeClaim[];
1078
- claimInto: (blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
1097
+ splitAt: (doc: EngineDoc, blocks: ReadonlyMap<import("./text/model.js").BlockId, import("./text/model.js").TextBlockRec>, own: import("./text/model.js").Ownership, b: import("./text/model.js").BlockId, offset: number, newId: import("./text/model.js").BlockId, n: number) => void;
1098
+ claimInto: (own: Pick<import("./text/model.js").Ownership, "streamOf">, from: import("./text/model.js").BlockId, into: import("./text/model.js").BlockId) => void;
1079
1099
  ownText: (doc: EngineDoc, rec: import("./text/model.js").TextBlockRec) => {
1080
1100
  from: unknown;
1081
1101
  to: number;