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
@@ -28,7 +28,7 @@ export declare const crdt: {
28
28
  Awareness: typeof import("../../index.js").Awareness;
29
29
  doc: {
30
30
  SCHEMA: {
31
- readonly version: 6;
31
+ readonly version: 11;
32
32
  readonly name: "edytor-doc";
33
33
  readonly roots: {
34
34
  readonly registry: "blocks";
@@ -39,7 +39,7 @@ export declare const crdt: {
39
39
  readonly schema: "schema";
40
40
  };
41
41
  };
42
- SCHEMA_VERSION: 6;
42
+ SCHEMA_VERSION: 11;
43
43
  SCHEMA_NAME: "edytor-doc";
44
44
  META_KEY: "meta";
45
45
  init: (doc: E.EngineDoc, opts?: {
@@ -55,77 +55,66 @@ export declare const crdt: {
55
55
  assertSchema: (doc: E.EngineDoc, docName?: string) => void;
56
56
  SchemaMismatchError: typeof E.SchemaMismatchError;
57
57
  create: (doc: E.EngineDoc, config?: import("../../crdt/edytor-doc.js").EdytorDocConfig) => {
58
- prepare: {
59
- insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../index.js").FlowView) => import("../../index.js").Prepared;
60
- deleteRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
61
- replaceRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
62
- insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[]) => import("../../index.js").Prepared;
63
- moveBlocks: (ids: readonly import("../../index.js").BlockId[], dest: import("../../index.js").Destination) => import("../../index.js").Prepared;
64
- nestBlock: (id: import("../../index.js").BlockId, parent: import("../../index.js").BlockId) => import("../../index.js").Prepared;
65
- unNestBlock: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
66
- unNestBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
67
- liftOut: (id: import("../../index.js").BlockId, kind: string, { keep, after }?: {
68
- keep?: boolean;
69
- after?: readonly import("../../index.js").BlockSpec[];
70
- }) => import("../../index.js").Prepared;
71
- placeBeside: (ids: readonly import("../../index.js").BlockId[], target: import("../../index.js").BlockId, side: "left" | "right", kind?: string) => import("../../index.js").Prepared;
72
- wrapInLayout: (ids: readonly import("../../index.js").BlockId[], kind?: string, columns?: number) => import("../../index.js").Prepared;
73
- splitBlock: (id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail?: import("../../index.js").SplitTail) => import("../../index.js").Prepared;
74
- mergeBlocks: (fromId: import("../../index.js").BlockId, intoId: import("../../index.js").BlockId) => import("../../index.js").Prepared;
75
- mergeBackward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
76
- mergeForward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
77
- deleteBlock: (id: import("../../index.js").BlockId, opts?: {
78
- keepChildren?: boolean;
79
- }) => import("../../index.js").Prepared;
80
- setBlock: (id: import("../../index.js").BlockId, value: {
81
- type?: string;
82
- data?: Record<string, unknown>;
83
- content?: (import("../../index.js").ContentItem | import("../../index.js").JSONText | import("../../index.js").JSONInlineBlock)[];
84
- children?: (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[];
85
- }) => import("../../index.js").Prepared;
86
- setBlockType: (id: import("../../index.js").BlockId, type: string) => import("../../index.js").Prepared;
87
- patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").Prepared;
88
- duplicateBlock: (id: import("../../index.js").BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => import("../../index.js").Prepared;
89
- insertText: (id: import("../../index.js").BlockId, offset: number, text: string, marks?: Record<string, unknown>) => import("../../index.js").Prepared;
90
- deleteText: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
91
- formatRange: (id: import("../../index.js").BlockId, offset: number, length: number, marks: Record<string, unknown>) => import("../../index.js").Prepared;
92
- clearMarks: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
93
- insertInline: (id: import("../../index.js").BlockId, offset: number, atom: import("../../crdt/doc/content.js").NewInline) => import("../../index.js").Prepared;
94
- removeInline: (id: import("../../index.js").BlockId, inlineId: string) => import("../../index.js").Prepared;
95
- deleteBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
96
- };
97
- apply: (p: import("../../index.js").Prepared) => import("../../index.js").OpResult;
98
- compose: (...parts: import("../../index.js").Prepared[]) => import("../../index.js").Prepared;
99
- transact: <R>(fn: () => R, origin?: unknown) => R;
58
+ init: (opts?: Parameters<(doc: E.EngineDoc, opts?: {
59
+ content?: import("../../index.js").BlockSpec[];
60
+ defaultType?: string;
61
+ }) => void>[1]) => void;
62
+ seed: (value: import("../../index.js").JSONBlock[], data?: import("../../crdt/doc/types.js").JsonObj) => void;
63
+ isInitialized: () => boolean;
64
+ schemaVersion: () => number | undefined;
65
+ checkSchema: () => E.SchemaProblem | null;
66
+ assertSchema: () => void;
67
+ dispose: () => void;
68
+ createUndoManager: (options?: import("../../crdt/doc/history.js").HistoryOptions) => import("../../crdt/doc/history.js").UndoManager;
69
+ part: import("../../crdt/doc/suggest.js").SuggestContext;
70
+ childSlots: (parent: import("../../index.js").BlockId | null) => import("../../crdt/placement/model.js").ChildSlot[];
71
+ slotOf: (id: string) => {
72
+ parent: import("../../index.js").BlockId | null;
73
+ rank: string;
74
+ } | null;
75
+ crdtId: (id: string) => string | null;
76
+ resolveBlock: (id: string) => E.EngineNode | null;
77
+ followUndo: (anchor: import("../../index.js").DocAnchor) => import("../../index.js").DocAnchor;
78
+ rolesChanged: (place?: boolean) => void;
79
+ defaultChild: (id: string | null) => string;
80
+ contentJSON: (id: string) => ({
81
+ text: string;
82
+ marks?: Record<string, unknown>;
83
+ } | {
84
+ id?: string;
85
+ type: string;
86
+ data?: unknown;
87
+ })[];
100
88
  model: {
101
89
  REGISTRY_KEY: string;
102
90
  registryOf: (doc: E.EngineDoc) => E.EngineNode;
103
91
  blockNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
104
92
  liveNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
105
93
  isLive: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => boolean;
106
- candidatesOf: (node: E.EngineNode) => import("../../crdt/placement/model.js").PlacementCand[];
107
94
  view: (doc: E.EngineDoc) => import("../../crdt/placement/model.js").ModelView;
108
- resolvePlacements: (blocks: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").BlockRec>, ownerOf?: (b: import("../../index.js").BlockId) => import("../../crdt/text/model.js").Owner) => Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>;
109
95
  childrenIndex: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/placement/model.js").DisplayOwnership) => Map<import("../../index.js").BlockId | null, import("../../crdt/placement/model.js").ChildSlot[]>;
110
96
  positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
111
97
  buildInline: (atom: import("../../index.js").InlineSpec) => E.EngineNode;
112
98
  isSelfOrDescendant: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/text/model.js").Ownership, id: import("../../index.js").BlockId, maybeAncestor: import("../../index.js").BlockId) => boolean;
113
- ranksAt: (siblings: readonly {
114
- rank: string;
115
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
116
- writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../index.js").BlockId | null, r: string) => void;
99
+ placeBlocks: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, parent: import("../../index.js").BlockId | null, left: import("../../index.js").BlockId | null, right: import("../../index.js").BlockId | null, slots: readonly import("../../crdt/placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("../../crdt/placement/slots.js").Unit | null) => void;
100
+ moveBlocksTo: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, ids: readonly import("../../index.js").BlockId[], parent: import("../../index.js").BlockId | null, index: number, side?: number, part?: number, at?: import("../../index.js").BlockId | null) => void;
101
+ insertSpecsAt: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, parent: import("../../index.js").BlockId | null, index: number, specs: readonly import("../../index.js").BlockSpec[], split?: import("../../crdt/placement/slots.js").Unit | null) => void;
117
102
  withdrawOnUndo: (doc: E.EngineDoc) => (item: E.EngineItemRef, stackItem: {
118
103
  inserts: {
119
104
  has(client: number, clock: number): boolean;
120
105
  };
121
106
  }) => boolean;
122
- materializeSpec: (doc: E.EngineDoc, sp: import("../../index.js").BlockSpec, parent: import("../../index.js").BlockId | null, rank: string) => void;
123
107
  collides: (doc: E.EngineDoc, specs: readonly import("../../index.js").BlockSpec[]) => boolean;
124
- writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, place: import("../../crdt/placement/model.js").PlacementValue) => void;
108
+ writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, parent: import("../../index.js").BlockId | null, index: number) => import("../../crdt/placement/slots.js").Unit;
125
109
  ownText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => {
126
110
  from: unknown;
127
111
  to: number;
128
112
  };
113
+ recordsOf: (doc: E.EngineDoc, node: E.EngineNode, v?: import("../../crdt/placement/model.js").ModelView) => {
114
+ item: import("../../crdt/placement/slots.js").SeqItem;
115
+ stamp: import("../../crdt/placement/slots.js").Stamp;
116
+ wins: boolean;
117
+ }[];
129
118
  insertBlocks: (doc: E.EngineDoc, dest: import("../../index.js").Destination, specs: import("../../index.js").BlockSpec[]) => boolean;
130
119
  insertBlock: (doc: E.EngineDoc, dest: import("../../index.js").Destination, spec: import("../../index.js").BlockSpec) => boolean;
131
120
  restoreBlocks: (doc: E.EngineDoc, specs: import("../../index.js").BlockSpec[]) => void;
@@ -157,72 +146,102 @@ export declare const crdt: {
157
146
  at: number;
158
147
  node: E.EngineNode;
159
148
  } | null;
160
- splitAt: (blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: import("../../crdt/text/model.js").Ownership, b: import("../../crdt/text/model.js").BlockId, offset: number, newId: import("../../crdt/text/model.js").BlockId, n: number) => import("../../crdt/text/model.js").MergeClaim[];
161
- claimInto: (blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: Pick<import("../../crdt/text/model.js").Ownership, "streamOf">, from: import("../../crdt/text/model.js").BlockId, into: import("../../crdt/text/model.js").BlockId) => void;
149
+ splitAt: (doc: E.EngineDoc, blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: import("../../crdt/text/model.js").Ownership, b: import("../../crdt/text/model.js").BlockId, offset: number, newId: import("../../crdt/text/model.js").BlockId, n: number) => void;
150
+ claimInto: (own: Pick<import("../../crdt/text/model.js").Ownership, "streamOf">, from: import("../../crdt/text/model.js").BlockId, into: import("../../crdt/text/model.js").BlockId) => void;
162
151
  ownText: (doc: E.EngineDoc, rec: import("../../crdt/text/model.js").TextBlockRec) => {
163
152
  from: unknown;
164
153
  to: number;
165
154
  };
166
155
  };
167
156
  runsView: import("../../crdt/text/runs.js").RunView;
157
+ api: object;
158
+ } & {
159
+ prepare: {
160
+ insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../index.js").FlowView) => import("../../index.js").Prepared;
161
+ deleteRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
162
+ replaceRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView) => import("../../index.js").Prepared;
163
+ nestBlock: (id: import("../../index.js").BlockId, parent: import("../../index.js").BlockId) => import("../../index.js").Prepared;
164
+ deleteBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
165
+ insertText: (id: import("../../index.js").BlockId, offset: number, text: string, marks?: Record<string, unknown>) => import("../../index.js").Prepared;
166
+ deleteText: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
167
+ formatRange: (id: import("../../index.js").BlockId, offset: number, length: number, marks: Record<string, unknown>) => import("../../index.js").Prepared;
168
+ clearMarks: (id: import("../../index.js").BlockId, offset: number, length: number) => import("../../index.js").Prepared;
169
+ insertInline: (id: import("../../index.js").BlockId, offset: number, atom: import("../../crdt/doc/content.js").NewInline) => import("../../index.js").Prepared;
170
+ removeInline: (id: import("../../index.js").BlockId, inlineId: string) => import("../../index.js").Prepared;
171
+ setBlockType: (id: import("../../index.js").BlockId, type: string) => import("../../index.js").Prepared;
172
+ patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").Prepared;
173
+ setBlock: (id: import("../../index.js").BlockId, value: {
174
+ type?: string;
175
+ data?: Record<string, unknown>;
176
+ content?: (import("../../index.js").ContentItem | import("../../index.js").JSONText | import("../../index.js").JSONInlineBlock)[];
177
+ children?: (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[];
178
+ }) => import("../../index.js").Prepared;
179
+ deleteBlock: (id: import("../../index.js").BlockId, opts?: {
180
+ keepChildren?: boolean;
181
+ }) => import("../../index.js").Prepared;
182
+ splitBlock: (id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail?: import("../../index.js").SplitTail) => import("../../index.js").Prepared;
183
+ mergeBlocks: (fromId: import("../../index.js").BlockId, intoId: import("../../index.js").BlockId) => import("../../index.js").Prepared;
184
+ mergeBackward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
185
+ mergeForward: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
186
+ placeBeside: (ids: readonly import("../../index.js").BlockId[], target: import("../../index.js").BlockId, side: "left" | "right", kind?: string) => import("../../index.js").Prepared;
187
+ wrapInLayout: (ids: readonly import("../../index.js").BlockId[], kind?: string, columns?: number) => import("../../index.js").Prepared;
188
+ insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[]) => import("../../index.js").Prepared;
189
+ moveBlocks: (ids: readonly import("../../index.js").BlockId[], dest: import("../../index.js").Destination) => import("../../index.js").Prepared;
190
+ unNestBlocks: (ids: readonly import("../../index.js").BlockId[]) => import("../../index.js").Prepared;
191
+ unNestBlock: (id: import("../../index.js").BlockId) => import("../../index.js").Prepared;
192
+ liftOut: (id: import("../../index.js").BlockId, kind: string, { keep, after }?: {
193
+ keep?: boolean;
194
+ after?: readonly import("../../index.js").BlockSpec[];
195
+ }) => import("../../index.js").Prepared;
196
+ duplicateBlock: (id: import("../../index.js").BlockId, freshId?: (oldId: string, kind: "block" | "inline") => string) => import("../../index.js").Prepared;
197
+ };
198
+ apply: (p: import("../../index.js").Prepared, quiet?: boolean) => import("../../index.js").OpResult;
199
+ compose: (...parts: import("../../index.js").Prepared[]) => import("../../index.js").Prepared;
200
+ transact: <R>(fn: () => R, origin?: unknown) => R;
168
201
  version: number;
169
202
  insertFlow: (target: import("../../index.js").FlowTarget, flow: import("../../index.js").Flow, view?: import("../../index.js").FlowView | undefined) => import("../../index.js").OpResult;
170
203
  deleteRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView | undefined) => import("../../index.js").OpResult;
171
204
  replaceRange: (from: import("../../index.js").DocPosition, to: import("../../index.js").DocPosition, view?: import("../../index.js").RangeView | undefined) => import("../../index.js").OpResult;
172
- insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[]) => import("../../index.js").OpResult;
173
- moveBlocks: (ids: readonly string[], dest: import("../../index.js").Destination) => import("../../index.js").OpResult;
174
205
  nestBlock: (id: string, parent: string) => import("../../index.js").OpResult;
175
- unNestBlock: (id: string) => import("../../index.js").OpResult;
176
- unNestBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
177
- liftOut: (id: string, kind: string, args_2?: {
178
- keep?: boolean;
179
- after?: readonly import("../../index.js").BlockSpec[];
180
- } | undefined) => import("../../index.js").OpResult;
181
- placeBeside: (ids: readonly string[], target: string, side: "right" | "left", kind?: string | undefined) => import("../../index.js").OpResult;
182
- wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => import("../../index.js").OpResult;
183
- splitBlock: (id: string, offset: number, newId: string, tail?: import("../../index.js").SplitTail | undefined) => import("../../index.js").OpResult;
184
- mergeBlocks: (fromId: string, intoId: string) => import("../../index.js").OpResult;
185
- mergeBackward: (id: string) => import("../../index.js").OpResult;
186
- mergeForward: (id: string) => import("../../index.js").OpResult;
187
- deleteBlock: (id: string, opts?: {
188
- keepChildren?: boolean;
189
- } | undefined) => import("../../index.js").OpResult;
206
+ deleteBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
207
+ insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => import("../../index.js").OpResult;
208
+ deleteText: (id: string, offset: number, length: number) => import("../../index.js").OpResult;
209
+ formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => import("../../index.js").OpResult;
210
+ clearMarks: (id: string, offset: number, length: number) => import("../../index.js").OpResult;
211
+ insertInline: (id: string, offset: number, atom: import("../../crdt/doc/content.js").NewInline) => import("../../index.js").OpResult;
212
+ removeInline: (id: string, inlineId: string) => import("../../index.js").OpResult;
213
+ setBlockType: (id: string, type: string) => import("../../index.js").OpResult;
214
+ patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").OpResult;
190
215
  setBlock: (id: string, value: {
191
216
  type?: string;
192
217
  data?: Record<string, unknown>;
193
218
  content?: (import("../../index.js").ContentItem | import("../../index.js").JSONText | import("../../index.js").JSONInlineBlock)[];
194
219
  children?: (import("../../index.js").BlockSpec | import("../../index.js").JSONBlock)[];
195
220
  }) => import("../../index.js").OpResult;
196
- setBlockType: (id: string, type: string) => import("../../index.js").OpResult;
197
- patchData: (target: import("../../index.js").DataTarget, patches: readonly import("../../index.js").DataPatch[]) => import("../../index.js").OpResult;
221
+ deleteBlock: (id: string, opts?: {
222
+ keepChildren?: boolean;
223
+ } | undefined) => import("../../index.js").OpResult;
224
+ splitBlock: (id: string, offset: number, newId: string, tail?: import("../../index.js").SplitTail | undefined) => import("../../index.js").OpResult;
225
+ mergeBlocks: (fromId: string, intoId: string) => import("../../index.js").OpResult;
226
+ mergeBackward: (id: string) => import("../../index.js").OpResult;
227
+ mergeForward: (id: string) => import("../../index.js").OpResult;
228
+ placeBeside: (ids: readonly string[], target: string, side: "left" | "right", kind?: string | undefined) => import("../../index.js").OpResult;
229
+ wrapInLayout: (ids: readonly string[], kind?: string | undefined, columns?: number | undefined) => import("../../index.js").OpResult;
230
+ insertBlocks: (dest: import("../../index.js").Destination, specs: readonly (import("../../index.js").JSONBlock | import("../../index.js").BlockSpec)[]) => import("../../index.js").OpResult;
231
+ moveBlocks: (ids: readonly string[], dest: import("../../index.js").Destination) => import("../../index.js").OpResult;
232
+ unNestBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
233
+ unNestBlock: (id: string) => import("../../index.js").OpResult;
234
+ liftOut: (id: string, kind: string, args_2?: {
235
+ keep?: boolean;
236
+ after?: readonly import("../../index.js").BlockSpec[];
237
+ } | undefined) => import("../../index.js").OpResult;
198
238
  duplicateBlock: (id: string, freshId?: ((oldId: string, kind: "block" | "inline") => string) | undefined) => import("../../index.js").OpResult;
199
- insertText: (id: string, offset: number, text: string, marks?: Record<string, unknown> | undefined) => import("../../index.js").OpResult;
200
- deleteText: (id: string, offset: number, length: number) => import("../../index.js").OpResult;
201
- formatRange: (id: string, offset: number, length: number, marks: Record<string, unknown>) => import("../../index.js").OpResult;
202
- clearMarks: (id: string, offset: number, length: number) => import("../../index.js").OpResult;
203
- insertInline: (id: string, offset: number, atom: import("../../crdt/doc/content.js").NewInline) => import("../../index.js").OpResult;
204
- removeInline: (id: string, inlineId: string) => import("../../index.js").OpResult;
205
- deleteBlocks: (ids: readonly string[]) => import("../../index.js").OpResult;
206
- init: (opts?: Parameters<(doc: E.EngineDoc, opts?: {
207
- content?: import("../../index.js").BlockSpec[];
208
- defaultType?: string;
209
- }) => void>[1]) => void;
210
- seed: (value: import("../../index.js").JSONBlock[], data?: import("../../crdt/doc/types.js").JsonObj) => void;
211
- isInitialized: () => boolean;
212
- schemaVersion: () => number | undefined;
213
- checkSchema: () => E.SchemaProblem | null;
214
- assertSchema: () => void;
215
- dispose: () => void;
216
- createUndoManager: (options?: import("../../crdt/doc/history.js").HistoryOptions) => import("../../crdt/doc/history.js").UndoManager;
217
239
  project: () => import("../../index.js").ProjectedDoc;
218
- toJSON: () => JSONDoc;
240
+ toJSON: (options?: {
241
+ suggestions?: boolean;
242
+ } | undefined) => JSONDoc;
219
243
  blockJSON: (id: string) => import("../../index.js").JSONBlock;
220
244
  childrenIds: (id: string | null) => string[];
221
- childSlots: (parent: import("../../index.js").BlockId | null) => import("../../crdt/placement/model.js").ChildSlot[];
222
- slotOf: (id: string) => {
223
- parent: import("../../index.js").BlockId | null;
224
- rank: string;
225
- } | null;
226
245
  positionOf: (id: string) => import("../../index.js").Destination | null;
227
246
  pathOf: (id: string) => number[] | null;
228
247
  parentOf: (id: string) => string | null;
@@ -240,8 +259,6 @@ export declare const crdt: {
240
259
  ids: (path: readonly string[]) => string[];
241
260
  } | null;
242
261
  blockAttribution: (id: string) => import("../../index.js").BlockAttribution | undefined;
243
- crdtId: (id: string) => string | null;
244
- resolveBlock: (id: string) => E.EngineNode | null;
245
262
  displayLength: (id: string) => number;
246
263
  contentItems: (id: string) => import("../../index.js").ContentItem[];
247
264
  hasBlock: (id: string) => boolean;
@@ -255,8 +272,6 @@ export declare const crdt: {
255
272
  blockId: import("../../index.js").BlockId;
256
273
  offset: number;
257
274
  } | null;
258
- followUndo: (anchor: import("../../index.js").DocAnchor) => import("../../index.js").DocAnchor;
259
- rolesChanged: () => void;
260
275
  isVoid: (id: string) => boolean;
261
276
  isIsland: (id: string) => boolean;
262
277
  isLines: (id: string) => boolean;
@@ -288,24 +303,14 @@ export declare const crdt: {
288
303
  parent: string | null;
289
304
  levels: string[];
290
305
  };
291
- defaultChild: (id: string | null) => string;
292
306
  runs: (id: string) => readonly import("../../index.js").ContentRun[];
293
- contentJSON: (id: string) => ({
294
- text: string;
295
- marks?: Record<string, unknown>;
296
- } | {
297
- id?: string;
298
- type: string;
299
- data?: unknown;
300
- })[];
301
307
  onChange: (cb: (change: import("../../index.js").DocChange) => void) => (() => void);
302
308
  };
303
309
  newDoc: (opts?: ConstructorParameters<E.EngineApi["Doc"]>[0]) => YDoc;
304
- keepCopies: (doc: E.EngineDoc) => void;
305
- purge: (doc: E.EngineDoc, facade: {
310
+ purge: (doc: E.EngineDoc, facade: Partial<import("../../crdt/doc/suggest.js").SuggestFacade> & {
306
311
  model: import("../../crdt/placement/model.js").PlacementModel;
307
312
  text: import("../../crdt/text/model.js").TextEngine;
308
- }, horizon: import("../../crdt/purge.js").Horizon) => import("../index.js").PurgeReport;
313
+ }, horizon: import("../../crdt/purge.js").Horizon | null) => import("../index.js").PurgeReport;
309
314
  horizonOf: (doc: E.EngineDoc) => import("../../crdt/purge.js").Horizon | null;
310
315
  restoreTo: <Plan>(doc: E.EngineDoc, facade: import("../../crdt/restore.js").RestoreFacade<Plan>, json: JSONDoc) => import("../../crdt/restore.js").RestoreReport;
311
316
  model: {
@@ -314,29 +319,30 @@ export declare const crdt: {
314
319
  blockNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
315
320
  liveNodeOf: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => E.EngineNode | null;
316
321
  isLive: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => boolean;
317
- candidatesOf: (node: E.EngineNode) => import("../../crdt/placement/model.js").PlacementCand[];
318
322
  view: (doc: E.EngineDoc) => import("../../crdt/placement/model.js").ModelView;
319
- resolvePlacements: (blocks: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").BlockRec>, ownerOf?: (b: import("../../index.js").BlockId) => import("../../crdt/text/model.js").Owner) => Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>;
320
323
  childrenIndex: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/placement/model.js").DisplayOwnership) => Map<import("../../index.js").BlockId | null, import("../../crdt/placement/model.js").ChildSlot[]>;
321
324
  positionInView: (v: import("../../crdt/placement/model.js").ModelView, id: import("../../index.js").BlockId) => import("../../index.js").Destination | null;
322
325
  buildInline: (atom: import("../../index.js").InlineSpec) => E.EngineNode;
323
326
  isSelfOrDescendant: (placements: Map<import("../../index.js").BlockId, import("../../crdt/placement/model.js").ResolvedPlacement>, own: import("../../crdt/text/model.js").Ownership, id: import("../../index.js").BlockId, maybeAncestor: import("../../index.js").BlockId) => boolean;
324
- ranksAt: (siblings: readonly {
325
- rank: string;
326
- }[], index: number, count: number, clientId: number, rand?: () => number, run?: boolean) => string[];
327
- writePlacement: (doc: E.EngineDoc, node: E.EngineNode, p: import("../../index.js").BlockId | null, r: string) => void;
327
+ placeBlocks: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, parent: import("../../index.js").BlockId | null, left: import("../../index.js").BlockId | null, right: import("../../index.js").BlockId | null, slots: readonly import("../../crdt/placement/slots.js").BlockSlot[] | null, moved?: readonly number[] | null, side?: number, part?: number, at?: import("../../crdt/placement/slots.js").Unit | null) => void;
328
+ moveBlocksTo: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, ids: readonly import("../../index.js").BlockId[], parent: import("../../index.js").BlockId | null, index: number, side?: number, part?: number, at?: import("../../index.js").BlockId | null) => void;
329
+ insertSpecsAt: (doc: E.EngineDoc, v: import("../../crdt/placement/model.js").ModelView, parent: import("../../index.js").BlockId | null, index: number, specs: readonly import("../../index.js").BlockSpec[], split?: import("../../crdt/placement/slots.js").Unit | null) => void;
328
330
  withdrawOnUndo: (doc: E.EngineDoc) => (item: E.EngineItemRef, stackItem: {
329
331
  inserts: {
330
332
  has(client: number, clock: number): boolean;
331
333
  };
332
334
  }) => boolean;
333
- materializeSpec: (doc: E.EngineDoc, sp: import("../../index.js").BlockSpec, parent: import("../../index.js").BlockId | null, rank: string) => void;
334
335
  collides: (doc: E.EngineDoc, specs: readonly import("../../index.js").BlockSpec[]) => boolean;
335
- writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, place: import("../../crdt/placement/model.js").PlacementValue) => void;
336
+ writeSplit: (doc: E.EngineDoc, id: import("../../index.js").BlockId, offset: number, newId: import("../../index.js").BlockId, tail: import("../../index.js").SplitTail, parent: import("../../index.js").BlockId | null, index: number) => import("../../crdt/placement/slots.js").Unit;
336
337
  ownText: (doc: E.EngineDoc, id: import("../../index.js").BlockId) => {
337
338
  from: unknown;
338
339
  to: number;
339
340
  };
341
+ recordsOf: (doc: E.EngineDoc, node: E.EngineNode, v?: import("../../crdt/placement/model.js").ModelView) => {
342
+ item: import("../../crdt/placement/slots.js").SeqItem;
343
+ stamp: import("../../crdt/placement/slots.js").Stamp;
344
+ wins: boolean;
345
+ }[];
340
346
  insertBlocks: (doc: E.EngineDoc, dest: import("../../index.js").Destination, specs: import("../../index.js").BlockSpec[]) => boolean;
341
347
  insertBlock: (doc: E.EngineDoc, dest: import("../../index.js").Destination, spec: import("../../index.js").BlockSpec) => boolean;
342
348
  restoreBlocks: (doc: E.EngineDoc, specs: import("../../index.js").BlockSpec[]) => void;
@@ -368,8 +374,8 @@ export declare const crdt: {
368
374
  at: number;
369
375
  node: E.EngineNode;
370
376
  } | null;
371
- splitAt: (blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: import("../../crdt/text/model.js").Ownership, b: import("../../crdt/text/model.js").BlockId, offset: number, newId: import("../../crdt/text/model.js").BlockId, n: number) => import("../../crdt/text/model.js").MergeClaim[];
372
- claimInto: (blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: Pick<import("../../crdt/text/model.js").Ownership, "streamOf">, from: import("../../crdt/text/model.js").BlockId, into: import("../../crdt/text/model.js").BlockId) => void;
377
+ splitAt: (doc: E.EngineDoc, blocks: ReadonlyMap<import("../../crdt/text/model.js").BlockId, import("../../crdt/text/model.js").TextBlockRec>, own: import("../../crdt/text/model.js").Ownership, b: import("../../crdt/text/model.js").BlockId, offset: number, newId: import("../../crdt/text/model.js").BlockId, n: number) => void;
378
+ claimInto: (own: Pick<import("../../crdt/text/model.js").Ownership, "streamOf">, from: import("../../crdt/text/model.js").BlockId, into: import("../../crdt/text/model.js").BlockId) => void;
373
379
  ownText: (doc: E.EngineDoc, rec: import("../../crdt/text/model.js").TextBlockRec) => {
374
380
  from: unknown;
375
381
  to: number;
@@ -529,11 +535,11 @@ export declare const crdt: {
529
535
  destroy(): void;
530
536
  disconnect(): void;
531
537
  connect(): void;
532
- emit<N extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: N, args: Parameters<E.WebsocketProviderEvents[N]>): void;
538
+ emit<N extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "access" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: N, args: Parameters<E.WebsocketProviderEvents[N]>): void;
533
539
  _observers: Map<string, Set<any>>;
534
- on<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): E.WebsocketProviderEvents[NAME];
535
- once<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): void;
536
- off<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): void;
540
+ on<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "access" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): E.WebsocketProviderEvents[NAME];
541
+ once<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "access" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): void;
542
+ off<NAME extends "refused" | "status" | "failed" | "schema-mismatch" | "message-error" | "protocol-mismatch" | "synced" | "access" | "connection-close" | "connection-error" | "saved" | "permission-denied" | "expired" | "unreachable">(name: NAME, f: E.WebsocketProviderEvents[NAME]): void;
537
543
  };
538
544
  };
539
545
  watchComments: (server: string | null, roomName: string, listener: (message: E.CommentMessage) => void) => (() => void);
@@ -691,9 +697,10 @@ export declare class RoomContext {
691
697
  emptied: number;
692
698
  marks: number;
693
699
  records: number;
694
- candidates: number;
695
700
  claims: number;
696
701
  merged: number;
702
+ released: number;
703
+ suggestions: number;
697
704
  };
698
705
  since: number;
699
706
  };
@@ -725,7 +732,10 @@ export declare class RoomContext {
725
732
  get lookups(): ReturnType<typeof lookups>;
726
733
  /** The digest of the room's block roles a client's advertised one is compared with. */
727
734
  get digest(): Record<string, string>;
728
- /** A facade over `doc` obeying the room's block roles (`semantics`). */
735
+ /**
736
+ * A facade over `doc` obeying the room's block roles (`semantics`), its
737
+ * shared suggestions built: its `toJSON()` leaves the pending ones out.
738
+ */
729
739
  facadeOf(doc: YDoc): EdytorDoc;
730
740
  /**
731
741
  * The facade over the live document. Read while the room is idle, it
@@ -11,6 +11,7 @@ import { Y } from '../../crdt/engine.js';
11
11
  import * as E from '../../crdt/protocol.js';
12
12
  import { CLOSE } from '../../crdt/providers/room.js';
13
13
  import { asEngineDoc } from '../../crdt/structs.js';
14
+ import { suggestionsOf } from '../../crdt/doc/suggest.js';
14
15
  import { defaultSemantics, facadeConfigOf, semanticsDigest } from '../../crdt/semantics.js';
15
16
  import { MAX_REFUSALS, ROOM_ORIGIN, SOCKET_TAG, noTimers } from './shared.js';
16
17
  /** The engine API the room is built on (the Worker-safe CRDT entry). */
@@ -51,9 +52,10 @@ const counters = () => ({
51
52
  emptied: 0,
52
53
  marks: 0,
53
54
  records: 0,
54
- candidates: 0,
55
55
  claims: 0,
56
- merged: 0
56
+ merged: 0,
57
+ released: 0,
58
+ suggestions: 0
57
59
  },
58
60
  since: Date.now()
59
61
  });
@@ -132,9 +134,14 @@ export class RoomContext {
132
134
  get digest() {
133
135
  return (this.#_digest ??= semanticsDigest(this.options.semantics ?? defaultSemantics));
134
136
  }
135
- /** A facade over `doc` obeying the room's block roles (`semantics`). */
137
+ /**
138
+ * A facade over `doc` obeying the room's block roles (`semantics`), its
139
+ * shared suggestions built: its `toJSON()` leaves the pending ones out.
140
+ */
136
141
  facadeOf(doc) {
137
- return crdt.doc.create(asEngineDoc(doc), this.lookups);
142
+ const facade = crdt.doc.create(asEngineDoc(doc), this.lookups);
143
+ suggestionsOf(facade);
144
+ return facade;
138
145
  }
139
146
  /**
140
147
  * The facade over the live document. Read while the room is idle, it
@@ -1,5 +1,10 @@
1
1
  import type { YDoc } from '../../crdt/index.js';
2
2
  import type { Decoded, Struct } from './context.js';
3
+ type Id = {
4
+ client: number;
5
+ clock: number;
6
+ };
7
+ export declare const isId: (value: unknown) => value is Id;
3
8
  /**
4
9
  * The clients of a frame (but `skip`) that write a per-writer block mark
5
10
  * of another writer: a struct whose key is `del.<n>` or `wd.<n>` on a
@@ -39,6 +44,14 @@ export type AttributionWrites = {
39
44
  * it again (`#bindOrphan`).
40
45
  */
41
46
  export declare const attributionWrites: (doc: YDoc, structs: Struct[], skip: Set<number>, user: string, owns: (client: number) => boolean, ownerOf: (client: number) => string | undefined) => AttributionWrites;
47
+ /**
48
+ * The suggestion writers of a frame that bind themselves to `user`: `n`
49
+ * writes a record in the suggestions' root and `c/<n>` naming `user` — a
50
+ * suggestion writer's first frame registers it as the user's
51
+ * (`sugg.writer.binding`). Any other self-bound id stays a replica's,
52
+ * claimed only by its own dial.
53
+ */
54
+ export declare const selfBound: (doc: YDoc, structs: Struct[], user: string) => Set<number>;
42
55
  /**
43
56
  * Of a frame's deletes, those of live attribution entries `user` may not
44
57
  * delete, with their keys: a binding of a replica the user does not own
@@ -48,3 +61,4 @@ export declare const forgedAttributionDeletes: (doc: YDoc, ds: Decoded["ds"], us
48
61
  ids: Decoded["ds"];
49
62
  keys: string[];
50
63
  };
64
+ export {};
@@ -7,7 +7,7 @@
7
7
  * find.
8
8
  */
9
9
  import { Y } from '../../crdt/engine.js';
10
- import { ATTRIBUTION_ROOT, DEL_PREFIX, HORIZON_ROOT, REGISTRY_KEY, WITHDRAW_PREFIX } from '../../crdt/schema.js';
10
+ import { ATTRIBUTION_ROOT, DEL_PREFIX, HORIZON_ROOT, REGISTRY_KEY, SUGGEST_ROOT, WITHDRAW_PREFIX } from '../../crdt/schema.js';
11
11
  import { heldClock, runsOf, storedStruct, structAt } from './updates.js';
12
12
  // ── Per-writer marks ──────────────────────────────────────────
13
13
  /** The writer `n` of a per-writer block mark key (`del.<n>`, `wd.<n>`), or `null`. */
@@ -22,7 +22,7 @@ const markWriter = (key) => {
22
22
  const digits = prefix === null ? '' : key.slice(prefix.length);
23
23
  return /^\d{1,16}$/.test(digits) ? Number(digits) : null;
24
24
  };
25
- const isId = (value) => typeof value === 'object' &&
25
+ export const isId = (value) => typeof value === 'object' &&
26
26
  value !== null &&
27
27
  typeof value.client === 'number' &&
28
28
  typeof value.clock === 'number' &&
@@ -198,6 +198,34 @@ export const attributionWrites = (doc, structs, skip, user, owns, ownerOf) => {
198
198
  }
199
199
  return writes;
200
200
  };
201
+ /**
202
+ * The suggestion writers of a frame that bind themselves to `user`: `n`
203
+ * writes a record in the suggestions' root and `c/<n>` naming `user` — a
204
+ * suggestion writer's first frame registers it as the user's
205
+ * (`sugg.writer.binding`). Any other self-bound id stays a replica's,
206
+ * claimed only by its own dial.
207
+ */
208
+ export const selfBound = (doc, structs, user) => {
209
+ const frame = runsOf(structs);
210
+ const records = new Set();
211
+ const bound = new Set();
212
+ for (const struct of structs) {
213
+ if (!(struct instanceof Y.Item))
214
+ continue;
215
+ const place = placeOf(doc, frame, struct.id);
216
+ if (place?.key == null)
217
+ continue;
218
+ const { parent } = place;
219
+ if (parent === SUGGEST_ROOT || (parent != null && parent === doc.share.get(SUGGEST_ROOT)))
220
+ records.add(struct.id.client);
221
+ if (!isAttribution(doc, parent))
222
+ continue;
223
+ const content = struct.content.getContent();
224
+ if (boundReplica(place.key) === struct.id.client && content[content.length - 1] === user)
225
+ bound.add(struct.id.client);
226
+ }
227
+ return new Set([...bound].filter((client) => records.has(client)));
228
+ };
201
229
  /**
202
230
  * Of a frame's deletes, those of live attribution entries `user` may not
203
231
  * delete, with their keys: a binding of a replica the user does not own
@@ -27,5 +27,9 @@ export declare const updateFrame: (update: Uint8Array) => Uint8Array;
27
27
  export declare const readOnlyFrame: () => Uint8Array;
28
28
  /** The denial of a read-only socket's write: it stays, and still syncs. */
29
29
  export declare const readOnlyDenialFrame: () => Uint8Array;
30
+ /** The denial of what a suggest-only socket may not write (stripped): it stays, and still syncs. */
31
+ export declare const suggestOnlyDenialFrame: () => Uint8Array;
32
+ /** The socket's access, at the join and at a change in place (`write`, `suggest`, `comment`, `read`). */
33
+ export declare const accessFrame: (access: string) => Uint8Array;
30
34
  /** A Step2 of what the room STORED: the engine's pending store (never stored) is left out. */
31
35
  export declare const storedStep2: (doc: YDoc, sv: Uint8Array) => Uint8Array;
@@ -4,7 +4,7 @@
4
4
  * room's.
5
5
  */
6
6
  import * as encoding from 'lib0-v14/encoding';
7
- import { READ_ONLY_DENIAL } from '../../crdt/protocols/auth.js';
7
+ import { READ_ONLY_DENIAL, SUGGEST_ONLY_DENIAL } from '../../crdt/protocols/auth.js';
8
8
  import * as E from '../../crdt/protocol.js';
9
9
  import { sync } from './context.js';
10
10
  import { withoutPending } from './updates.js';
@@ -49,5 +49,9 @@ export const updateFrame = (update) => E.frame(E.messageSync, (e) => sync.writeU
49
49
  export const readOnlyFrame = () => E.frame(E.messageAuth, (e) => E.writeReadOnly(e));
50
50
  /** The denial of a read-only socket's write: it stays, and still syncs. */
51
51
  export const readOnlyDenialFrame = () => E.frame(E.messageAuth, (e) => E.writePermissionDenied(e, READ_ONLY_DENIAL));
52
+ /** The denial of what a suggest-only socket may not write (stripped): it stays, and still syncs. */
53
+ export const suggestOnlyDenialFrame = () => E.frame(E.messageAuth, (e) => E.writePermissionDenied(e, SUGGEST_ONLY_DENIAL));
54
+ /** The socket's access, at the join and at a change in place (`write`, `suggest`, `comment`, `read`). */
55
+ export const accessFrame = (access) => E.frame(E.messageAuth, (e) => E.writeAccess(e, access));
52
56
  /** A Step2 of what the room STORED: the engine's pending store (never stored) is left out. */
53
57
  export const storedStep2 = (doc, sv) => withoutPending(doc, () => E.frame(E.messageSync, (e) => sync.writeSyncStep2(e, doc, sv)));