edytor 4.0.0 → 6.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 (193) 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 +10 -3
  6. package/dist/cloudflare/index.d.ts +1 -1
  7. package/dist/cloudflare/room/access.d.ts +8 -3
  8. package/dist/cloudflare/room/access.js +44 -20
  9. package/dist/cloudflare/room/admission.js +28 -5
  10. package/dist/cloudflare/room/comments.js +28 -1
  11. package/dist/cloudflare/room/context.d.ts +106 -109
  12. package/dist/cloudflare/room/context.js +10 -3
  13. package/dist/cloudflare/room/forged.d.ts +14 -0
  14. package/dist/cloudflare/room/forged.js +30 -2
  15. package/dist/cloudflare/room/frames.d.ts +4 -0
  16. package/dist/cloudflare/room/frames.js +5 -1
  17. package/dist/cloudflare/room/purge.js +2 -1
  18. package/dist/cloudflare/room/replicas.d.ts +4 -2
  19. package/dist/cloudflare/room/replicas.js +8 -3
  20. package/dist/cloudflare/room/suggest.d.ts +7 -0
  21. package/dist/cloudflare/room/suggest.js +143 -0
  22. package/dist/cloudflare/routeDocumentSocket.d.ts +10 -1
  23. package/dist/cloudflare/routeDocumentSocket.js +5 -3
  24. package/dist/components/Content.svelte +9 -1
  25. package/dist/crdt/anchors.js +3 -2
  26. package/dist/crdt/attribution/attribution.d.ts +3 -0
  27. package/dist/crdt/attribution/attribution.js +3 -3
  28. package/dist/crdt/doc/funnel.d.ts +1 -1
  29. package/dist/crdt/doc/funnel.js +5 -2
  30. package/dist/crdt/doc/gate.d.ts +1 -1
  31. package/dist/crdt/doc/history.d.ts +6 -0
  32. package/dist/crdt/doc/history.js +79 -59
  33. package/dist/crdt/doc/ops.d.ts +81 -0
  34. package/dist/crdt/doc/ops.js +1898 -0
  35. package/dist/crdt/doc/reads.d.ts +2 -2
  36. package/dist/crdt/doc/reads.js +18 -28
  37. package/dist/crdt/doc/suggest.d.ts +167 -0
  38. package/dist/crdt/doc/suggest.js +579 -0
  39. package/dist/crdt/document.d.ts +10 -1
  40. package/dist/crdt/document.js +19 -11
  41. package/dist/crdt/edytor-doc.d.ts +294 -272
  42. package/dist/crdt/edytor-doc.js +123 -108
  43. package/dist/crdt/engine-api.d.ts +8 -2
  44. package/dist/crdt/engine.d.ts +2 -1
  45. package/dist/crdt/engine.js +3 -1
  46. package/dist/crdt/flow.d.ts +5 -47
  47. package/dist/crdt/flow.js +3 -269
  48. package/dist/crdt/index.d.ts +102 -108
  49. package/dist/crdt/index.js +3 -0
  50. package/dist/crdt/operations.d.ts +13 -4
  51. package/dist/crdt/parts.d.ts +43 -0
  52. package/dist/crdt/parts.js +44 -0
  53. package/dist/crdt/placement/display.d.ts +1 -1
  54. package/dist/crdt/placement/display.js +3 -3
  55. package/dist/crdt/placement/keys.d.ts +5 -0
  56. package/dist/crdt/placement/keys.js +5 -0
  57. package/dist/crdt/placement/resolve.d.ts +1 -1
  58. package/dist/crdt/placement/resolve.js +2 -1
  59. package/dist/crdt/protocol.d.ts +1 -1
  60. package/dist/crdt/protocol.js +1 -1
  61. package/dist/crdt/protocols/auth.d.ts +11 -1
  62. package/dist/crdt/protocols/auth.js +17 -1
  63. package/dist/crdt/protocols/awareness.js +46 -81
  64. package/dist/crdt/protocols/comments.d.ts +16 -1
  65. package/dist/crdt/protocols/comments.js +9 -1
  66. package/dist/crdt/providers/index.d.ts +12 -22
  67. package/dist/crdt/providers/index.js +3 -1
  68. package/dist/crdt/providers/indexeddb.d.ts +6 -10
  69. package/dist/crdt/providers/indexeddb.js +10 -16
  70. package/dist/crdt/providers/room.d.ts +11 -0
  71. package/dist/crdt/providers/room.js +26 -12
  72. package/dist/crdt/providers/websocket.d.ts +8 -12
  73. package/dist/crdt/providers/websocket.js +17 -19
  74. package/dist/crdt/purge.d.ts +7 -1
  75. package/dist/crdt/purge.js +32 -2
  76. package/dist/crdt/rangeDelete.d.ts +2 -47
  77. package/dist/crdt/rangeDelete.js +1 -169
  78. package/dist/crdt/restore.d.ts +2 -1
  79. package/dist/crdt/restore.js +9 -0
  80. package/dist/crdt/schema.d.ts +9 -1
  81. package/dist/crdt/schema.js +13 -3
  82. package/dist/crdt/structs.d.ts +2 -0
  83. package/dist/crdt/structs.js +2 -0
  84. package/dist/crdt/text/index/build.d.ts +125 -0
  85. package/dist/crdt/text/index/build.js +2895 -0
  86. package/dist/crdt/text/index/shared.d.ts +2 -6
  87. package/dist/crdt/text/index/shared.js +19 -19
  88. package/dist/crdt/text/model.d.ts +10 -0
  89. package/dist/crdt/text/model.js +10 -4
  90. package/dist/crdt/text/runs.d.ts +43 -42
  91. package/dist/crdt/text/runs.js +2 -165
  92. package/dist/crdt/vendor/yjs/UPSTREAM.md +83 -0
  93. package/dist/crdt/vendor/yjs/dts/index.d.ts +1 -1
  94. package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +6 -3
  95. package/dist/crdt/vendor/yjs/dts/ynode.d.ts +13 -2
  96. package/dist/crdt/vendor/yjs/src/index.js +1 -1
  97. package/dist/crdt/vendor/yjs/src/structs/Item.js +44 -5
  98. package/dist/crdt/vendor/yjs/src/ynode.js +29 -7
  99. package/dist/edytor.svelte.d.ts +1 -1
  100. package/dist/edytor.svelte.js +100 -75
  101. package/dist/events/beforeInputCommands.d.ts +2 -2
  102. package/dist/events/domTextOffset.d.ts +2 -0
  103. package/dist/events/domTextOffset.js +8 -0
  104. package/dist/events/nativeInteractiveControl.d.ts +11 -1
  105. package/dist/events/nativeInteractiveControl.js +41 -1
  106. package/dist/events/onBeforeInput.js +3 -3
  107. package/dist/events/onFocus.js +9 -11
  108. package/dist/export/forms.d.ts +75 -75
  109. package/dist/index.d.ts +4 -2
  110. package/dist/index.js +1 -1
  111. package/dist/labels.d.ts +8 -0
  112. package/dist/labels.js +6 -1
  113. package/dist/plugins/comments/CommentsController.svelte.d.ts +5 -1
  114. package/dist/plugins/comments/CommentsController.svelte.js +14 -4
  115. package/dist/plugins/find/search.js +2 -2
  116. package/dist/plugins/index.d.ts +1 -0
  117. package/dist/plugins/index.js +1 -0
  118. package/dist/plugins/richtext/RichTextPlugin.svelte +63 -61
  119. package/dist/plugins/richtext/richTextOperations.js +26 -32
  120. package/dist/plugins/suggestions/SuggestionBars.svelte +40 -23
  121. package/dist/plugins/suggestions/SuggestionBars.svelte.d.ts +3 -1
  122. package/dist/plugins/suggestions/SuggestionRuns.svelte +77 -0
  123. package/dist/plugins/suggestions/SuggestionRuns.svelte.d.ts +9 -0
  124. package/dist/plugins/suggestions/shared.svelte.d.ts +58 -0
  125. package/dist/plugins/suggestions/shared.svelte.js +421 -0
  126. package/dist/plugins/suggestions/suggestionsPlugin.d.ts +15 -4
  127. package/dist/selection/domSelection.d.ts +2 -0
  128. package/dist/selection/domSelection.js +6 -2
  129. package/dist/selection/pointer.svelte.js +75 -48
  130. package/dist/selection/replaceSelection.js +2 -6
  131. package/dist/selection/selection.svelte.d.ts +3 -3
  132. package/dist/selection/selection.svelte.js +39 -32
  133. package/dist/selection/selection.utils.d.ts +14 -0
  134. package/dist/selection/selection.utils.js +33 -11
  135. package/dist/session/commands.js +21 -11
  136. package/dist/session/composition.svelte.d.ts +5 -3
  137. package/dist/session/composition.svelte.js +21 -17
  138. package/dist/session/handles.d.ts +4 -17
  139. package/dist/session/handles.js +14 -44
  140. package/dist/session/navigation.js +6 -9
  141. package/dist/session/selection.d.ts +11 -5
  142. package/dist/session/selection.js +14 -48
  143. package/dist/session/suggestions.svelte.d.ts +38 -9
  144. package/dist/session/suggestions.svelte.js +37 -18
  145. package/dist/session/virtual.d.ts +1 -1
  146. package/dist/surface/attributes.d.ts +5 -0
  147. package/dist/surface/attributes.js +2 -2
  148. package/dist/surface/cells.d.ts +2 -26
  149. package/dist/surface/cells.js +2 -33
  150. package/dist/surface/observer.svelte.d.ts +6 -1
  151. package/dist/surface/observer.svelte.js +143 -111
  152. package/dist/surface/pin.svelte.d.ts +9 -9
  153. package/dist/surface/pin.svelte.js +15 -22
  154. package/dist/surface/projector.svelte.js +10 -16
  155. package/dist/text/text.svelte.js +14 -19
  156. package/dist/themes/notion.css +29 -0
  157. package/dist/utils.d.ts +5 -0
  158. package/dist/utils.js +7 -0
  159. package/package.json +3 -1
  160. package/dist/crdt/doc/capability.d.ts +0 -56
  161. package/dist/crdt/doc/capability.js +0 -211
  162. package/dist/crdt/doc/content.d.ts +0 -16
  163. package/dist/crdt/doc/content.js +0 -77
  164. package/dist/crdt/doc/delete.d.ts +0 -15
  165. package/dist/crdt/doc/delete.js +0 -84
  166. package/dist/crdt/doc/layout.d.ts +0 -9
  167. package/dist/crdt/doc/layout.js +0 -178
  168. package/dist/crdt/doc/meta.d.ts +0 -19
  169. package/dist/crdt/doc/meta.js +0 -199
  170. package/dist/crdt/doc/moves.d.ts +0 -21
  171. package/dist/crdt/doc/moves.js +0 -274
  172. package/dist/crdt/doc/split-merge.d.ts +0 -10
  173. package/dist/crdt/doc/split-merge.js +0 -179
  174. package/dist/crdt/doc/steps.d.ts +0 -65
  175. package/dist/crdt/doc/steps.js +0 -311
  176. package/dist/crdt/text/index/cache.d.ts +0 -16
  177. package/dist/crdt/text/index/cache.js +0 -175
  178. package/dist/crdt/text/index/claims.d.ts +0 -18
  179. package/dist/crdt/text/index/claims.js +0 -225
  180. package/dist/crdt/text/index/fold.d.ts +0 -21
  181. package/dist/crdt/text/index/fold.js +0 -656
  182. package/dist/crdt/text/index/layout.d.ts +0 -24
  183. package/dist/crdt/text/index/layout.js +0 -271
  184. package/dist/crdt/text/index/placement.d.ts +0 -47
  185. package/dist/crdt/text/index/placement.js +0 -741
  186. package/dist/crdt/text/index/records.d.ts +0 -13
  187. package/dist/crdt/text/index/records.js +0 -139
  188. package/dist/crdt/text/index/report.d.ts +0 -18
  189. package/dist/crdt/text/index/report.js +0 -337
  190. package/dist/crdt/text/index/state.d.ts +0 -197
  191. package/dist/crdt/text/index/state.js +0 -116
  192. package/dist/crdt/text/index/streams.d.ts +0 -25
  193. package/dist/crdt/text/index/streams.js +0 -248
@@ -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';
@@ -49,24 +50,71 @@ type Layers = {
49
50
  */
50
51
  export declare const adoptRules: <D extends object>(doc: D) => D;
51
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
+ } & {
52
100
  /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
53
101
  prepare: {
54
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
55
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
56
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
57
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
58
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
59
102
  /**
60
103
  * Move `id` to the last position under `parent` — under a container
61
104
  * it is no item of, under its last item (`nestParent`: Tab after a list).
62
105
  */
63
106
  nestBlock: (id: BlockId, parent: BlockId) => Prepared;
64
- unNestBlock: (id: BlockId) => Prepared;
107
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
108
+ deleteBlocks: (ids: readonly BlockId[]) => Prepared;
109
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
110
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
65
111
  unNestBlocks: (ids: readonly BlockId[]) => Prepared;
112
+ unNestBlock: (id: BlockId) => Prepared;
66
113
  liftOut: (id: BlockId, kind: string, { keep, after }?: {
67
114
  keep?: boolean;
68
115
  after?: readonly import("./index.js").BlockSpec[];
69
116
  }) => Prepared;
117
+ duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
70
118
  placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
71
119
  wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
72
120
  splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
@@ -76,44 +124,40 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
76
124
  deleteBlock: (id: BlockId, opts?: {
77
125
  keepChildren?: boolean;
78
126
  }) => Prepared;
127
+ setBlockType: (id: BlockId, type: string) => Prepared;
128
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
79
129
  setBlock: (id: BlockId, value: {
80
130
  type?: string;
81
131
  data?: Record<string, unknown>;
82
132
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
83
133
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
84
134
  }) => Prepared;
85
- setBlockType: (id: BlockId, type: string) => Prepared;
86
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
87
- duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
88
135
  insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
89
136
  deleteText: (id: BlockId, offset: number, length: number) => Prepared;
90
137
  formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
91
138
  clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
92
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
139
+ insertInline: (id: BlockId, offset: number, atom: import("./doc/ops.js").NewInline) => Prepared;
93
140
  removeInline: (id: BlockId, inlineId: string) => Prepared;
94
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
95
- deleteBlocks: (ids: readonly BlockId[]) => 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;
96
144
  };
97
145
  /** Write a prepared plan exactly (refusals pass through). */
98
- apply: (p: Prepared) => OpResult;
146
+ apply: (p: Prepared, quiet?: boolean) => OpResult;
99
147
  compose: (...parts: Prepared[]) => Prepared;
100
148
  transact: <R>(fn: () => R, origin?: unknown) => R;
101
- model: L["model"];
102
- text: L["text"];
103
- runsView: RunView;
104
149
  version: number;
105
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
106
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
107
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
108
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
109
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
110
150
  nestBlock: (id: string, parent: string) => OpResult;
111
- unNestBlock: (id: string) => OpResult;
151
+ deleteBlocks: (ids: readonly string[]) => OpResult;
152
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
153
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
112
154
  unNestBlocks: (ids: readonly string[]) => OpResult;
155
+ unNestBlock: (id: string) => OpResult;
113
156
  liftOut: (id: string, kind: string, args_2?: {
114
157
  keep?: boolean;
115
158
  after?: readonly import("./index.js").BlockSpec[];
116
159
  } | undefined) => OpResult;
160
+ duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
117
161
  placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
118
162
  wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
119
163
  splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
@@ -123,51 +167,29 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
123
167
  deleteBlock: (id: string, opts?: {
124
168
  keepChildren?: boolean;
125
169
  } | undefined) => OpResult;
170
+ setBlockType: (id: string, type: string) => OpResult;
171
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
126
172
  setBlock: (id: string, value: {
127
173
  type?: string;
128
174
  data?: Record<string, unknown>;
129
175
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
130
176
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
131
177
  }) => OpResult;
132
- setBlockType: (id: string, type: string) => OpResult;
133
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
134
- duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
135
178
  insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
136
179
  deleteText: (id: string, offset: number, length: number) => OpResult;
137
180
  formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
138
181
  clearMarks: (id: string, offset: number, length: number) => OpResult;
139
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
182
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
140
183
  removeInline: (id: string, inlineId: string) => OpResult;
141
- deleteBlocks: (ids: readonly string[]) => OpResult;
142
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
143
- content?: import("./index.js").BlockSpec[];
144
- defaultType?: string;
145
- }) => void>[1]) => void;
146
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
147
- seed: (value: JSONBlock[], data?: JsonObj) => void;
148
- isInitialized: () => boolean;
149
- /** Replicated `meta.v` schema version (the module-level read, bound). */
150
- schemaVersion: () => number | undefined;
151
- /**
152
- * The schema gate for this doc — throws {@link SchemaMismatchError}
153
- * on unversioned-content or unsupported-version state. Consumers
154
- * (`Edytor.sync()`, packed consumers) call it before trusting
155
- * a synced doc.
156
- */
157
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
158
- assertSchema: () => void;
159
- dispose: () => void;
160
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
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;
161
187
  project: () => import("./index.js").ProjectedDoc;
162
- toJSON: () => JSONDoc;
188
+ toJSON: (options?: {
189
+ suggestions?: boolean;
190
+ }) => JSONDoc;
163
191
  blockJSON: (id: string) => JSONBlock;
164
192
  childrenIds: (id: string | null) => string[];
165
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
166
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
167
- slotOf: (id: string) => {
168
- parent: BlockId | null;
169
- rank: string;
170
- } | null;
171
193
  positionOf: (id: string) => import("./index.js").Destination | null;
172
194
  pathOf: (id: string) => number[] | null;
173
195
  parentOf: (id: string) => string | null;
@@ -190,8 +212,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
190
212
  * O(1) per call; live-replicated (remote values read the same).
191
213
  */
192
214
  blockAttribution: (id: string) => BlockAttribution | undefined;
193
- crdtId: (id: string) => string | null;
194
- resolveBlock: (id: string) => EngineNode | null;
195
215
  displayLength: (id: string) => number;
196
216
  contentItems: (id: string) => ContentItem[];
197
217
  hasBlock: (id: string) => boolean;
@@ -205,9 +225,6 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
205
225
  blockId: BlockId;
206
226
  offset: number;
207
227
  } | null;
208
- followUndo: (anchor: DocAnchor) => DocAnchor;
209
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
210
- rolesChanged: () => void;
211
228
  isVoid: (id: string) => boolean;
212
229
  isIsland: (id: string) => boolean;
213
230
  isLines: (id: string) => boolean;
@@ -254,16 +271,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
254
271
  parent: string | null;
255
272
  levels: string[];
256
273
  };
257
- defaultChild: (id: string | null) => string;
258
274
  runs: (id: string) => readonly ContentRun[];
259
- contentJSON: (id: string) => ({
260
- text: string;
261
- marks?: Record<string, unknown>;
262
- } | {
263
- id?: string;
264
- type: string;
265
- data?: unknown;
266
- })[];
267
275
  onChange: (cb: (change: DocChange) => void) => (() => void);
268
276
  };
269
277
  /**
@@ -275,7 +283,7 @@ export declare const docFacade: <L extends Layers>(Y: EngineApi, layers: L) => (
275
283
  export declare const bindDocModel: (Y: EngineApi) => {
276
284
  /** The schema manifest constants table. */
277
285
  SCHEMA: {
278
- readonly version: 10;
286
+ readonly version: 11;
279
287
  readonly name: "edytor-doc";
280
288
  readonly roots: {
281
289
  readonly registry: "blocks";
@@ -286,7 +294,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
286
294
  readonly schema: "schema";
287
295
  };
288
296
  };
289
- SCHEMA_VERSION: 10;
297
+ SCHEMA_VERSION: 11;
290
298
  SCHEMA_NAME: "edytor-doc";
291
299
  META_KEY: "meta";
292
300
  /** Doc-level API (no facade needed). */
@@ -304,55 +312,47 @@ export declare const bindDocModel: (Y: EngineApi) => {
304
312
  SchemaMismatchError: typeof SchemaMismatchError;
305
313
  /** Attach the per-doc facade. */
306
314
  create: (doc: EngineDoc, config?: EdytorDocConfig) => {
307
- /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
308
- prepare: {
309
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
310
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
311
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
312
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
313
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
314
- /**
315
- * Move `id` to the last position under `parent` — under a container
316
- * it is no item of, under its last item (`nestParent`: Tab after a list).
317
- */
318
- nestBlock: (id: BlockId, parent: BlockId) => Prepared;
319
- unNestBlock: (id: BlockId) => Prepared;
320
- unNestBlocks: (ids: readonly BlockId[]) => Prepared;
321
- liftOut: (id: BlockId, kind: string, { keep, after }?: {
322
- keep?: boolean;
323
- after?: readonly import("./index.js").BlockSpec[];
324
- }) => Prepared;
325
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
326
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
327
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
328
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
329
- mergeBackward: (id: BlockId) => Prepared;
330
- mergeForward: (id: BlockId) => Prepared;
331
- deleteBlock: (id: BlockId, opts?: {
332
- keepChildren?: boolean;
333
- }) => Prepared;
334
- setBlock: (id: BlockId, value: {
335
- type?: string;
336
- data?: Record<string, unknown>;
337
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
338
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
339
- }) => Prepared;
340
- setBlockType: (id: BlockId, type: string) => Prepared;
341
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
342
- duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
343
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
344
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
345
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
346
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
347
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
348
- removeInline: (id: BlockId, inlineId: string) => Prepared;
349
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
350
- deleteBlocks: (ids: readonly BlockId[]) => Prepared;
351
- };
352
- /** Write a prepared plan exactly (refusals pass through). */
353
- apply: (p: Prepared) => OpResult;
354
- compose: (...parts: Prepared[]) => Prepared;
355
- 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
+ })[];
356
356
  model: {
357
357
  REGISTRY_KEY: string;
358
358
  registryOf: (doc: EngineDoc) => EngineNode;
@@ -422,19 +422,70 @@ export declare const bindDocModel: (Y: EngineApi) => {
422
422
  };
423
423
  };
424
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
+ /**
431
+ * Move `id` to the last position under `parent` — under a container
432
+ * it is no item of, under its last item (`nestParent`: Tab after a list).
433
+ */
434
+ nestBlock: (id: BlockId, parent: BlockId) => Prepared;
435
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
436
+ deleteBlocks: (ids: readonly BlockId[]) => Prepared;
437
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
438
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
439
+ unNestBlocks: (ids: readonly BlockId[]) => Prepared;
440
+ unNestBlock: (id: BlockId) => Prepared;
441
+ liftOut: (id: BlockId, kind: string, { keep, after }?: {
442
+ keep?: boolean;
443
+ after?: readonly import("./index.js").BlockSpec[];
444
+ }) => Prepared;
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
+ };
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;
425
477
  version: number;
426
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
427
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
428
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
429
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
430
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
431
478
  nestBlock: (id: string, parent: string) => OpResult;
432
- unNestBlock: (id: string) => OpResult;
479
+ deleteBlocks: (ids: readonly string[]) => OpResult;
480
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
481
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
433
482
  unNestBlocks: (ids: readonly string[]) => OpResult;
483
+ unNestBlock: (id: string) => OpResult;
434
484
  liftOut: (id: string, kind: string, args_2?: {
435
485
  keep?: boolean;
436
486
  after?: readonly import("./index.js").BlockSpec[];
437
487
  } | undefined) => OpResult;
488
+ duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
438
489
  placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
439
490
  wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
440
491
  splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
@@ -444,51 +495,29 @@ export declare const bindDocModel: (Y: EngineApi) => {
444
495
  deleteBlock: (id: string, opts?: {
445
496
  keepChildren?: boolean;
446
497
  } | undefined) => OpResult;
498
+ setBlockType: (id: string, type: string) => OpResult;
499
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
447
500
  setBlock: (id: string, value: {
448
501
  type?: string;
449
502
  data?: Record<string, unknown>;
450
503
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
451
504
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
452
505
  }) => OpResult;
453
- setBlockType: (id: string, type: string) => OpResult;
454
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
455
- duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
456
506
  insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
457
507
  deleteText: (id: string, offset: number, length: number) => OpResult;
458
508
  formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
459
509
  clearMarks: (id: string, offset: number, length: number) => OpResult;
460
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
510
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
461
511
  removeInline: (id: string, inlineId: string) => OpResult;
462
- deleteBlocks: (ids: readonly string[]) => OpResult;
463
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
464
- content?: import("./index.js").BlockSpec[];
465
- defaultType?: string;
466
- }) => void>[1]) => void;
467
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
468
- seed: (value: JSONBlock[], data?: JsonObj) => void;
469
- isInitialized: () => boolean;
470
- /** Replicated `meta.v` schema version (the module-level read, bound). */
471
- schemaVersion: () => number | undefined;
472
- /**
473
- * The schema gate for this doc — throws {@link SchemaMismatchError}
474
- * on unversioned-content or unsupported-version state. Consumers
475
- * (`Edytor.sync()`, packed consumers) call it before trusting
476
- * a synced doc.
477
- */
478
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
479
- assertSchema: () => void;
480
- dispose: () => void;
481
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
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;
482
515
  project: () => import("./index.js").ProjectedDoc;
483
- toJSON: () => JSONDoc;
516
+ toJSON: (options?: {
517
+ suggestions?: boolean;
518
+ } | undefined) => JSONDoc;
484
519
  blockJSON: (id: string) => JSONBlock;
485
520
  childrenIds: (id: string | null) => string[];
486
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
487
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
488
- slotOf: (id: string) => {
489
- parent: BlockId | null;
490
- rank: string;
491
- } | null;
492
521
  positionOf: (id: string) => import("./index.js").Destination | null;
493
522
  pathOf: (id: string) => number[] | null;
494
523
  parentOf: (id: string) => string | null;
@@ -511,8 +540,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
511
540
  * O(1) per call; live-replicated (remote values read the same).
512
541
  */
513
542
  blockAttribution: (id: string) => BlockAttribution | undefined;
514
- crdtId: (id: string) => string | null;
515
- resolveBlock: (id: string) => EngineNode | null;
516
543
  displayLength: (id: string) => number;
517
544
  contentItems: (id: string) => ContentItem[];
518
545
  hasBlock: (id: string) => boolean;
@@ -526,9 +553,6 @@ export declare const bindDocModel: (Y: EngineApi) => {
526
553
  blockId: BlockId;
527
554
  offset: number;
528
555
  } | null;
529
- followUndo: (anchor: DocAnchor) => DocAnchor;
530
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
531
- rolesChanged: () => void;
532
556
  isVoid: (id: string) => boolean;
533
557
  isIsland: (id: string) => boolean;
534
558
  isLines: (id: string) => boolean;
@@ -575,16 +599,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
575
599
  parent: string | null;
576
600
  levels: string[];
577
601
  };
578
- defaultChild: (id: string | null) => string;
579
602
  runs: (id: string) => readonly ContentRun[];
580
- contentJSON: (id: string) => ({
581
- text: string;
582
- marks?: Record<string, unknown>;
583
- } | {
584
- id?: string;
585
- type: string;
586
- data?: unknown;
587
- })[];
588
603
  onChange: (cb: (change: DocChange) => void) => (() => void);
589
604
  };
590
605
  /**
@@ -675,7 +690,7 @@ export declare const bindDocModel: (Y: EngineApi) => {
675
690
  export declare const bindEdytorDoc: (Y: EngineApi) => {
676
691
  /** The schema manifest constants table. */
677
692
  SCHEMA: {
678
- readonly version: 10;
693
+ readonly version: 11;
679
694
  readonly name: "edytor-doc";
680
695
  readonly roots: {
681
696
  readonly registry: "blocks";
@@ -686,7 +701,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
686
701
  readonly schema: "schema";
687
702
  };
688
703
  };
689
- SCHEMA_VERSION: 10;
704
+ SCHEMA_VERSION: 11;
690
705
  SCHEMA_NAME: "edytor-doc";
691
706
  META_KEY: "meta";
692
707
  /** Doc-level API (no facade needed). */
@@ -704,55 +719,47 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
704
719
  SchemaMismatchError: typeof SchemaMismatchError;
705
720
  /** Attach the per-doc facade. */
706
721
  create: (doc: EngineDoc, config?: EdytorDocConfig) => {
707
- /** Every op prepared: pure, a plan of named steps + its effect, or `refused`. */
708
- prepare: {
709
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView) => Prepared;
710
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
711
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView) => Prepared;
712
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
713
- moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
714
- /**
715
- * Move `id` to the last position under `parent` — under a container
716
- * it is no item of, under its last item (`nestParent`: Tab after a list).
717
- */
718
- nestBlock: (id: BlockId, parent: BlockId) => Prepared;
719
- unNestBlock: (id: BlockId) => Prepared;
720
- unNestBlocks: (ids: readonly BlockId[]) => Prepared;
721
- liftOut: (id: BlockId, kind: string, { keep, after }?: {
722
- keep?: boolean;
723
- after?: readonly import("./index.js").BlockSpec[];
724
- }) => Prepared;
725
- placeBeside: (ids: readonly BlockId[], target: BlockId, side: "left" | "right", kind?: string) => Prepared;
726
- wrapInLayout: (ids: readonly BlockId[], kind?: string, columns?: number) => Prepared;
727
- splitBlock: (id: BlockId, offset: number, newId: BlockId, tail?: SplitTail) => Prepared;
728
- mergeBlocks: (fromId: BlockId, intoId: BlockId) => Prepared;
729
- mergeBackward: (id: BlockId) => Prepared;
730
- mergeForward: (id: BlockId) => Prepared;
731
- deleteBlock: (id: BlockId, opts?: {
732
- keepChildren?: boolean;
733
- }) => Prepared;
734
- setBlock: (id: BlockId, value: {
735
- type?: string;
736
- data?: Record<string, unknown>;
737
- content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
738
- children?: (import("./index.js").BlockSpec | JSONBlock)[];
739
- }) => Prepared;
740
- setBlockType: (id: BlockId, type: string) => Prepared;
741
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => Prepared;
742
- duplicateBlock: (id: BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => Prepared;
743
- insertText: (id: BlockId, offset: number, text: string, marks?: Record<string, unknown>) => Prepared;
744
- deleteText: (id: BlockId, offset: number, length: number) => Prepared;
745
- formatRange: (id: BlockId, offset: number, length: number, marks: Record<string, unknown>) => Prepared;
746
- clearMarks: (id: BlockId, offset: number, length: number) => Prepared;
747
- insertInline: (id: BlockId, offset: number, atom: import("./doc/content.js").NewInline) => Prepared;
748
- removeInline: (id: BlockId, inlineId: string) => Prepared;
749
- /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
750
- deleteBlocks: (ids: readonly BlockId[]) => Prepared;
751
- };
752
- /** Write a prepared plan exactly (refusals pass through). */
753
- apply: (p: Prepared) => OpResult;
754
- compose: (...parts: Prepared[]) => Prepared;
755
- 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
+ })[];
756
763
  model: {
757
764
  REGISTRY_KEY: string;
758
765
  registryOf: (doc: EngineDoc) => EngineNode;
@@ -822,19 +829,70 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
822
829
  };
823
830
  };
824
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
+ /**
838
+ * Move `id` to the last position under `parent` — under a container
839
+ * it is no item of, under its last item (`nestParent`: Tab after a list).
840
+ */
841
+ nestBlock: (id: BlockId, parent: BlockId) => Prepared;
842
+ /** Delete a block selection — one plan; only the members leave (`deleteBlocks` above). */
843
+ deleteBlocks: (ids: readonly BlockId[]) => Prepared;
844
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => Prepared;
845
+ moveBlocks: (ids: readonly BlockId[], dest: import("./index.js").Destination) => Prepared;
846
+ unNestBlocks: (ids: readonly BlockId[]) => Prepared;
847
+ unNestBlock: (id: BlockId) => Prepared;
848
+ liftOut: (id: BlockId, kind: string, { keep, after }?: {
849
+ keep?: boolean;
850
+ after?: readonly import("./index.js").BlockSpec[];
851
+ }) => Prepared;
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
+ };
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;
825
884
  version: number;
826
- insertFlow: (target: import("./flow.js").FlowTarget, flow: import("./flow.js").Flow, view?: import("./flow.js").FlowView | undefined) => OpResult;
827
- deleteRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
828
- replaceRange: (from: DocPosition, to: DocPosition, view?: import("./rangeDelete.js").RangeView | undefined) => OpResult;
829
- insertBlocks: (dest: import("./index.js").Destination, specs: readonly (import("./index.js").BlockSpec | JSONBlock)[]) => OpResult;
830
- moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
831
885
  nestBlock: (id: string, parent: string) => OpResult;
832
- unNestBlock: (id: string) => OpResult;
886
+ deleteBlocks: (ids: readonly string[]) => OpResult;
887
+ insertBlocks: (dest: import("./index.js").Destination, specs: readonly (JSONBlock | import("./index.js").BlockSpec)[]) => OpResult;
888
+ moveBlocks: (ids: readonly string[], dest: import("./index.js").Destination) => OpResult;
833
889
  unNestBlocks: (ids: readonly string[]) => OpResult;
890
+ unNestBlock: (id: string) => OpResult;
834
891
  liftOut: (id: string, kind: string, args_2?: {
835
892
  keep?: boolean;
836
893
  after?: readonly import("./index.js").BlockSpec[];
837
894
  } | undefined) => OpResult;
895
+ duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
838
896
  placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => OpResult;
839
897
  wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => OpResult;
840
898
  splitBlock: (id: string, offset: number, newId: string, tail?: SplitTail | undefined) => OpResult;
@@ -844,51 +902,29 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
844
902
  deleteBlock: (id: string, opts?: {
845
903
  keepChildren?: boolean;
846
904
  } | undefined) => OpResult;
905
+ setBlockType: (id: string, type: string) => OpResult;
906
+ patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
847
907
  setBlock: (id: string, value: {
848
908
  type?: string;
849
909
  data?: Record<string, unknown>;
850
910
  content?: (ContentItem | import("./index.js").JSONText | import("./index.js").JSONInlineBlock)[];
851
911
  children?: (import("./index.js").BlockSpec | JSONBlock)[];
852
912
  }) => OpResult;
853
- setBlockType: (id: string, type: string) => OpResult;
854
- patchData: (target: DataTarget, patches: readonly DataPatch[]) => OpResult;
855
- duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => OpResult;
856
913
  insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => OpResult;
857
914
  deleteText: (id: string, offset: number, length: number) => OpResult;
858
915
  formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => OpResult;
859
916
  clearMarks: (id: string, offset: number, length: number) => OpResult;
860
- insertInline: (id: string, offset: number, atom: import("./doc/content.js").NewInline) => OpResult;
917
+ insertInline: (id: string, offset: number, atom: import("./doc/ops.js").NewInline) => OpResult;
861
918
  removeInline: (id: string, inlineId: string) => OpResult;
862
- deleteBlocks: (ids: readonly string[]) => OpResult;
863
- init: (opts?: Parameters<(doc: EngineDoc, opts?: {
864
- content?: import("./index.js").BlockSpec[];
865
- defaultType?: string;
866
- }) => void>[1]) => void;
867
- /** Apply the deterministic seed of `value` and the document's `data` — the document's seed decision. */
868
- seed: (value: JSONBlock[], data?: JsonObj) => void;
869
- isInitialized: () => boolean;
870
- /** Replicated `meta.v` schema version (the module-level read, bound). */
871
- schemaVersion: () => number | undefined;
872
- /**
873
- * The schema gate for this doc — throws {@link SchemaMismatchError}
874
- * on unversioned-content or unsupported-version state. Consumers
875
- * (`Edytor.sync()`, packed consumers) call it before trusting
876
- * a synced doc.
877
- */
878
- checkSchema: () => import("./edytor-doc.js").SchemaProblem | null;
879
- assertSchema: () => void;
880
- dispose: () => void;
881
- createUndoManager: (options?: import("./doc/history.js").HistoryOptions) => import("./doc/history.js").UndoManager;
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;
882
922
  project: () => import("./index.js").ProjectedDoc;
883
- toJSON: () => JSONDoc;
923
+ toJSON: (options?: {
924
+ suggestions?: boolean;
925
+ } | undefined) => JSONDoc;
884
926
  blockJSON: (id: string) => JSONBlock;
885
927
  childrenIds: (id: string | null) => string[];
886
- /** Visible children of `parent` with their ranks, in `(rank, id)` order. */
887
- childSlots: (parent: BlockId | null) => import("./placement/model.js").ChildSlot[];
888
- slotOf: (id: string) => {
889
- parent: BlockId | null;
890
- rank: string;
891
- } | null;
892
928
  positionOf: (id: string) => import("./index.js").Destination | null;
893
929
  pathOf: (id: string) => number[] | null;
894
930
  parentOf: (id: string) => string | null;
@@ -911,8 +947,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
911
947
  * O(1) per call; live-replicated (remote values read the same).
912
948
  */
913
949
  blockAttribution: (id: string) => BlockAttribution | undefined;
914
- crdtId: (id: string) => string | null;
915
- resolveBlock: (id: string) => EngineNode | null;
916
950
  displayLength: (id: string) => number;
917
951
  contentItems: (id: string) => ContentItem[];
918
952
  hasBlock: (id: string) => boolean;
@@ -926,9 +960,6 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
926
960
  blockId: BlockId;
927
961
  offset: number;
928
962
  } | null;
929
- followUndo: (anchor: DocAnchor) => DocAnchor;
930
- /** Re-read the roles after `roleOf` answers differently (roles adopted later). */
931
- rolesChanged: () => void;
932
963
  isVoid: (id: string) => boolean;
933
964
  isIsland: (id: string) => boolean;
934
965
  isLines: (id: string) => boolean;
@@ -975,16 +1006,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
975
1006
  parent: string | null;
976
1007
  levels: string[];
977
1008
  };
978
- defaultChild: (id: string | null) => string;
979
1009
  runs: (id: string) => readonly ContentRun[];
980
- contentJSON: (id: string) => ({
981
- text: string;
982
- marks?: Record<string, unknown>;
983
- } | {
984
- id?: string;
985
- type: string;
986
- data?: unknown;
987
- })[];
988
1010
  onChange: (cb: (change: DocChange) => void) => (() => void);
989
1011
  };
990
1012
  /**
@@ -1000,7 +1022,7 @@ export declare const bindEdytorDoc: (Y: EngineApi) => {
1000
1022
  * and the horizon record every history reads (`hist.purge.horizon`).
1001
1023
  * The room's purge task runs it; `facade` is a facade over `doc`.
1002
1024
  */
1003
- purge: (doc: EngineDoc, facade: {
1025
+ purge: (doc: EngineDoc, facade: Partial<import("./doc/suggest.js").SuggestFacade> & {
1004
1026
  model: import("./placement/model.js").PlacementModel;
1005
1027
  text: import("./text/model.js").TextEngine;
1006
1028
  }, horizon: import("./purge.js").Horizon | null) => import("./purge.js").PurgeReport;