@thomasfosterau/effect-richtext 0.0.0-stage → 0.1.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 (176) hide show
  1. package/LICENSE +48 -0
  2. package/README.md +118 -2
  3. package/dist/_virtual/_rolldown/runtime.js +12 -0
  4. package/dist/commands/commands.d.ts +323 -0
  5. package/dist/commands/commands.js +722 -0
  6. package/dist/commands/internal.js +43 -0
  7. package/dist/commands/keymaps.d.ts +46 -0
  8. package/dist/commands/keymaps.js +64 -0
  9. package/dist/commands.d.ts +3 -0
  10. package/dist/commands.js +3 -0
  11. package/dist/compat/commands.d.ts +250 -0
  12. package/dist/compat/commands.js +275 -0
  13. package/dist/compat/internal/core.d.ts +20 -0
  14. package/dist/compat/internal/core.js +148 -0
  15. package/dist/compat/internal/props.js +82 -0
  16. package/dist/compat/keymap.d.ts +21 -0
  17. package/dist/compat/keymap.js +38 -0
  18. package/dist/compat/model.d.ts +893 -0
  19. package/dist/compat/model.js +1212 -0
  20. package/dist/compat/orderedmap.d.ts +74 -0
  21. package/dist/compat/orderedmap.js +124 -0
  22. package/dist/compat/schema-basic.d.ts +38 -0
  23. package/dist/compat/schema-basic.js +238 -0
  24. package/dist/compat/schema-list.d.ts +81 -0
  25. package/dist/compat/schema-list.js +156 -0
  26. package/dist/compat/state.d.ts +415 -0
  27. package/dist/compat/state.js +689 -0
  28. package/dist/compat/test-builder.d.ts +98 -0
  29. package/dist/compat/test-builder.js +197 -0
  30. package/dist/compat/transform.d.ts +458 -0
  31. package/dist/compat/transform.js +803 -0
  32. package/dist/compat/view.d.ts +411 -0
  33. package/dist/compat/view.js +409 -0
  34. package/dist/dropcursor.d.ts +46 -0
  35. package/dist/dropcursor.js +176 -0
  36. package/dist/extensions/defaults.d.ts +716 -0
  37. package/dist/extensions/defaults.js +209 -0
  38. package/dist/extensions/editor.d.ts +246 -0
  39. package/dist/extensions/editor.js +271 -0
  40. package/dist/extensions/extension.d.ts +375 -0
  41. package/dist/extensions/extension.js +233 -0
  42. package/dist/extensions.d.ts +4 -0
  43. package/dist/extensions.js +4 -0
  44. package/dist/gapcursor.d.ts +66 -0
  45. package/dist/gapcursor.js +273 -0
  46. package/dist/history.d.ts +178 -0
  47. package/dist/history.js +412 -0
  48. package/dist/html.d.ts +158 -0
  49. package/dist/html.js +164 -0
  50. package/dist/inputrules.d.ts +271 -0
  51. package/dist/inputrules.js +321 -0
  52. package/dist/internal/attempt.js +15 -0
  53. package/dist/internal/json.js +29 -0
  54. package/dist/keymap/keymap.d.ts +130 -0
  55. package/dist/keymap/keymap.js +159 -0
  56. package/dist/keymap.d.ts +2 -0
  57. package/dist/keymap.js +1 -0
  58. package/dist/markdown/errors.d.ts +23 -0
  59. package/dist/markdown/errors.js +26 -0
  60. package/dist/markdown/from_markdown.d.ts +185 -0
  61. package/dist/markdown/from_markdown.js +266 -0
  62. package/dist/markdown/schema.d.ts +522 -0
  63. package/dist/markdown/schema.js +292 -0
  64. package/dist/markdown/to_markdown.d.ts +251 -0
  65. package/dist/markdown/to_markdown.js +413 -0
  66. package/dist/markdown.d.ts +5 -0
  67. package/dist/markdown.js +5 -0
  68. package/dist/model/attrsCodec.js +48 -0
  69. package/dist/model/comparedeep.js +17 -0
  70. package/dist/model/content.d.ts +232 -0
  71. package/dist/model/content.js +630 -0
  72. package/dist/model/diff.js +66 -0
  73. package/dist/model/dom.d.ts +3 -0
  74. package/dist/model/errors.d.ts +90 -0
  75. package/dist/model/errors.js +76 -0
  76. package/dist/model/fragment.d.ts +131 -0
  77. package/dist/model/fragment.js +262 -0
  78. package/dist/model/from_dom.d.ts +299 -0
  79. package/dist/model/from_dom.js +618 -0
  80. package/dist/model/json.d.ts +37 -0
  81. package/dist/model/json.js +126 -0
  82. package/dist/model/mark.d.ts +73 -0
  83. package/dist/model/mark.js +121 -0
  84. package/dist/model/node.d.ts +267 -0
  85. package/dist/model/node.js +434 -0
  86. package/dist/model/replace.d.ts +78 -0
  87. package/dist/model/replace.js +207 -0
  88. package/dist/model/resolvedpos.d.ts +196 -0
  89. package/dist/model/resolvedpos.js +305 -0
  90. package/dist/model/schema.d.ts +740 -0
  91. package/dist/model/schema.js +451 -0
  92. package/dist/model/to_dom.d.ts +169 -0
  93. package/dist/model/to_dom.js +238 -0
  94. package/dist/model.d.ts +12 -0
  95. package/dist/model.js +12 -0
  96. package/dist/placeholder.d.ts +53 -0
  97. package/dist/placeholder.js +79 -0
  98. package/dist/reactive/observer.d.ts +54 -0
  99. package/dist/reactive/observer.js +61 -0
  100. package/dist/reactive/selectors.d.ts +22 -0
  101. package/dist/reactive/selectors.js +61 -0
  102. package/dist/reactive/stateref.d.ts +72 -0
  103. package/dist/reactive/stateref.js +71 -0
  104. package/dist/reactive/streams.d.ts +83 -0
  105. package/dist/reactive/streams.js +85 -0
  106. package/dist/reactive.d.ts +16 -0
  107. package/dist/reactive.js +26 -0
  108. package/dist/schema-basic.d.ts +448 -0
  109. package/dist/schema-basic.js +269 -0
  110. package/dist/schema-list/commands.d.ts +66 -0
  111. package/dist/schema-list/commands.js +203 -0
  112. package/dist/schema-list.d.ts +92 -0
  113. package/dist/schema-list.js +100 -0
  114. package/dist/state/errors.d.ts +39 -0
  115. package/dist/state/errors.js +32 -0
  116. package/dist/state/plugin.d.ts +232 -0
  117. package/dist/state/plugin.js +82 -0
  118. package/dist/state/selection.d.ts +297 -0
  119. package/dist/state/selection.js +486 -0
  120. package/dist/state/state.d.ts +212 -0
  121. package/dist/state/state.js +489 -0
  122. package/dist/state/transaction.d.ts +145 -0
  123. package/dist/state/transaction.js +195 -0
  124. package/dist/state.d.ts +6 -0
  125. package/dist/state.js +6 -0
  126. package/dist/test-builder.d.ts +3582 -0
  127. package/dist/test-builder.js +239 -0
  128. package/dist/transform/attr_step.d.ts +60 -0
  129. package/dist/transform/attr_step.js +105 -0
  130. package/dist/transform/errors.d.ts +50 -0
  131. package/dist/transform/errors.js +35 -0
  132. package/dist/transform/map.d.ts +182 -0
  133. package/dist/transform/map.js +280 -0
  134. package/dist/transform/mark.js +98 -0
  135. package/dist/transform/mark_set_step.js +69 -0
  136. package/dist/transform/mark_step.d.ts +113 -0
  137. package/dist/transform/mark_step.js +225 -0
  138. package/dist/transform/replace.d.ts +18 -0
  139. package/dist/transform/replace.js +381 -0
  140. package/dist/transform/replace_step.d.ts +109 -0
  141. package/dist/transform/replace_step.js +175 -0
  142. package/dist/transform/step.d.ts +157 -0
  143. package/dist/transform/step.js +168 -0
  144. package/dist/transform/structure.d.ts +89 -0
  145. package/dist/transform/structure.js +350 -0
  146. package/dist/transform/transform.d.ts +248 -0
  147. package/dist/transform/transform.js +373 -0
  148. package/dist/transform.d.ts +10 -0
  149. package/dist/transform.js +10 -0
  150. package/dist/view/browser.js +39 -0
  151. package/dist/view/capturekeys.js +282 -0
  152. package/dist/view/clipboard.d.ts +8 -0
  153. package/dist/view/clipboard.js +245 -0
  154. package/dist/view/decoration.d.ts +339 -0
  155. package/dist/view/decoration.js +566 -0
  156. package/dist/view/dom.d.ts +18 -0
  157. package/dist/view/dom.js +140 -0
  158. package/dist/view/domchange.js +295 -0
  159. package/dist/view/domcoords.d.ts +22 -0
  160. package/dist/view/domcoords.js +448 -0
  161. package/dist/view/domobserver.d.ts +47 -0
  162. package/dist/view/domobserver.js +328 -0
  163. package/dist/view/errors.d.ts +18 -0
  164. package/dist/view/errors.js +21 -0
  165. package/dist/view/input.d.ts +58 -0
  166. package/dist/view/input.js +704 -0
  167. package/dist/view/selection.js +198 -0
  168. package/dist/view/view.d.ts +699 -0
  169. package/dist/view/view.js +623 -0
  170. package/dist/view/viewdesc.d.ts +236 -0
  171. package/dist/view/viewdesc.js +1205 -0
  172. package/dist/view-css.d.ts +43 -0
  173. package/dist/view-css.js +124 -0
  174. package/dist/view.d.ts +6 -0
  175. package/dist/view.js +4 -0
  176. package/package.json +206 -3
@@ -0,0 +1,458 @@
1
+ import { MapResult, Mappable, Mapping as Mapping$1, StepMap } from "../transform/map.js";
2
+ import { Step as Step$1, StepResult as StepResult$1 } from "../transform/step.js";
3
+ import { AttrStep as AttrStep$1, DocAttrStep as DocAttrStep$1 } from "../transform/attr_step.js";
4
+ import { AddMarkStep as AddMarkStep$1, AddNodeMarkStep as AddNodeMarkStep$1, RemoveMarkStep as RemoveMarkStep$1, RemoveNodeMarkStep as RemoveNodeMarkStep$1 } from "../transform/mark_step.js";
5
+ import { Transform as Transform$1 } from "../transform/transform.js";
6
+ import { ReplaceAroundStep as ReplaceAroundStep$1, ReplaceStep as ReplaceStep$1 } from "../transform/replace_step.js";
7
+ import "../transform.js";
8
+ import { CORE, TransformError } from "./internal/core.js";
9
+ import { Attrs, ContentMatch, Fragment, Mark, MarkType, Node, NodeRange, NodeType, Schema, Slice } from "./model.js";
10
+ /**
11
+ * A mapping represents a pipeline of zero or more step maps.
12
+ *
13
+ * @since 0.1.0
14
+ * @category models
15
+ */
16
+ export declare class Mapping implements Mappable {
17
+ /** @internal */
18
+ readonly [CORE]: Mapping$1;
19
+ /** Create a new mapping with the given position maps. */
20
+ constructor(maps?: ReadonlyArray<StepMap>, mirror?: Array<number>, from?: number, to?: number);
21
+ /** The step maps in this mapping. */
22
+ get maps(): ReadonlyArray<StepMap>;
23
+ /** @internal */
24
+ get mirror(): Array<number> | undefined;
25
+ set mirror(value: Array<number> | undefined);
26
+ /** The starting position in the `maps` array, used when `map` or `mapResult` is called. */
27
+ get from(): number;
28
+ set from(value: number);
29
+ /** The end position in the `maps` array. */
30
+ get to(): number;
31
+ set to(value: number);
32
+ /** Create a mapping that maps only through a part of this one. */
33
+ slice(from?: number, to?: number): Mapping;
34
+ /** Add a step map to the end of this mapping. */
35
+ appendMap(map: StepMap, mirrors?: number): void;
36
+ /** Add all the step maps in a given mapping to this one (preserving mirroring information). */
37
+ appendMapping(mapping: Mapping): void;
38
+ /** Finds the offset of the step map that mirrors the map at the given offset, in this mapping. */
39
+ getMirror(n: number): number | undefined;
40
+ /** @internal */
41
+ setMirror(n: number, m: number): void;
42
+ /** Append the inverse of the given mapping to this one. */
43
+ appendMappingInverted(mapping: Mapping): void;
44
+ /** Create an inverted version of this mapping. */
45
+ invert(): Mapping;
46
+ /** Map a position through this mapping. */
47
+ map(pos: number, assoc?: number): number;
48
+ /** Map a position through this mapping, returning a mapping result. */
49
+ mapResult(pos: number, assoc?: number): MapResult;
50
+ }
51
+ /**
52
+ * The result of applying a step.
53
+ *
54
+ * @since 0.1.0
55
+ * @category models
56
+ */
57
+ export declare class StepResult {
58
+ /** The transformed document, if successful. */
59
+ readonly doc: Node | null;
60
+ /** The failure message, if unsuccessful. */
61
+ readonly failed: string | null;
62
+ /** @internal */
63
+ constructor(
64
+ /** The transformed document, if successful. */
65
+ doc: Node | null,
66
+ /** The failure message, if unsuccessful. */
67
+ failed: string | null);
68
+ /** Create a successful step result. */
69
+ static ok(doc: Node): StepResult;
70
+ /** Create a failed step result. */
71
+ static fail(message: string): StepResult;
72
+ /** Call `Node.replace` with the given arguments. Create a successful result if it succeeds, and a failed one if it throws a `ReplaceError`. */
73
+ static fromReplace(doc: Node, from: number, to: number, slice: Slice): StepResult;
74
+ }
75
+ /**
76
+ * A step object represents an atomic change. Subclass it to define
77
+ * custom steps: subclasses are adapted into core steps automatically.
78
+ *
79
+ * @since 0.1.0
80
+ * @category models
81
+ */
82
+ export declare abstract class Step {
83
+ /** @internal */
84
+ readonly [CORE]: Step$1;
85
+ constructor();
86
+ /** Applies this step to the given document, returning a result object. */
87
+ abstract apply(doc: Node): StepResult;
88
+ /** Get the step map that represents the changes made by this step. */
89
+ getMap(): StepMap;
90
+ /** Create an inverted version of this step. */
91
+ abstract invert(doc: Node): Step;
92
+ /** Map this step through a mappable thing, returning either a version of that step with its positions adjusted, or `null` if the step was entirely deleted by the mapping. */
93
+ abstract map(mapping: Mappable): Step | null;
94
+ /** Try to merge this step with another one, to be applied directly after it. */
95
+ merge(_other: Step): Step | null;
96
+ /** Create a JSON-serializeable representation of this step. */
97
+ abstract toJSON(): any;
98
+ /** Deserialize a step from its JSON representation. */
99
+ static fromJSON(schema: Schema, json: any): Step;
100
+ /** To be able to serialize steps to JSON, each step needs a string ID to attach to its JSON representation. */
101
+ static jsonID(id: string, stepClass: {
102
+ fromJSON(schema: any, json: any): Step;
103
+ }): any;
104
+ }
105
+ /** Base class of the facades for the core's built-in steps. @internal */
106
+ declare abstract class CoreStep extends Step {
107
+ apply(doc: Node): StepResult;
108
+ getMap(): StepMap;
109
+ invert(doc: Node): Step;
110
+ map(mapping: Mappable): Step | null;
111
+ merge(other: Step): Step | null;
112
+ toJSON(): any;
113
+ }
114
+ /**
115
+ * Replace a part of the document with a slice of new content.
116
+ *
117
+ * @since 0.1.0
118
+ * @category models
119
+ */
120
+ export declare class ReplaceStep extends CoreStep {
121
+ /** @internal */
122
+ readonly [CORE]: ReplaceStep$1;
123
+ /** The given `slice` should fit the 'gap' between `from` and `to`. */
124
+ constructor(from: number, to: number, slice: Slice, structure?: boolean);
125
+ /** The start position of the replaced range. */
126
+ get from(): number;
127
+ /** The end position of the replaced range. */
128
+ get to(): number;
129
+ /** The slice to insert. */
130
+ get slice(): Slice;
131
+ /** @internal */
132
+ get structure(): boolean;
133
+ /** @internal */
134
+ static fromJSON(schema: Schema, json: any): ReplaceStep;
135
+ }
136
+ /**
137
+ * Replace a part of the document with a slice of content, but preserve
138
+ * a range of the replaced content by moving it into the slice.
139
+ *
140
+ * @since 0.1.0
141
+ * @category models
142
+ */
143
+ export declare class ReplaceAroundStep extends CoreStep {
144
+ /** @internal */
145
+ readonly [CORE]: ReplaceAroundStep$1;
146
+ /** Create a replace-around step with the given range and gap. */
147
+ constructor(from: number, to: number, gapFrom: number, gapTo: number, slice: Slice, insert: number, structure?: boolean);
148
+ /** The start position of the replaced range. */
149
+ get from(): number;
150
+ /** The end position of the replaced range. */
151
+ get to(): number;
152
+ /** The start of preserved range. */
153
+ get gapFrom(): number;
154
+ /** The end of preserved range. */
155
+ get gapTo(): number;
156
+ /** The slice to insert. */
157
+ get slice(): Slice;
158
+ /** The position in the slice where the preserved range should be inserted. */
159
+ get insert(): number;
160
+ /** @internal */
161
+ get structure(): boolean;
162
+ /** @internal */
163
+ static fromJSON(schema: Schema, json: any): ReplaceAroundStep;
164
+ }
165
+ /**
166
+ * Add a mark to all inline content between two positions.
167
+ *
168
+ * @since 0.1.0
169
+ * @category models
170
+ */
171
+ export declare class AddMarkStep extends CoreStep {
172
+ /** @internal */
173
+ readonly [CORE]: AddMarkStep$1;
174
+ /** Create a mark step. */
175
+ constructor(from: number, to: number, mark: Mark);
176
+ /** The start of the marked range. */
177
+ get from(): number;
178
+ /** The end of the marked range. */
179
+ get to(): number;
180
+ /** The mark to add. */
181
+ get mark(): Mark;
182
+ /** @internal */
183
+ static fromJSON(schema: Schema, json: any): AddMarkStep;
184
+ }
185
+ /**
186
+ * Remove a mark from all inline content between two positions.
187
+ *
188
+ * @since 0.1.0
189
+ * @category models
190
+ */
191
+ export declare class RemoveMarkStep extends CoreStep {
192
+ /** @internal */
193
+ readonly [CORE]: RemoveMarkStep$1;
194
+ /** Create a mark-removing step. */
195
+ constructor(from: number, to: number, mark: Mark);
196
+ /** The start of the unmarked range. */
197
+ get from(): number;
198
+ /** The end of the unmarked range. */
199
+ get to(): number;
200
+ /** The mark to remove. */
201
+ get mark(): Mark;
202
+ /** @internal */
203
+ static fromJSON(schema: Schema, json: any): RemoveMarkStep;
204
+ }
205
+ /**
206
+ * Add a mark to a specific node.
207
+ *
208
+ * @since 0.1.0
209
+ * @category models
210
+ */
211
+ export declare class AddNodeMarkStep extends CoreStep {
212
+ /** @internal */
213
+ readonly [CORE]: AddNodeMarkStep$1;
214
+ /** Create a node mark step. */
215
+ constructor(pos: number, mark: Mark);
216
+ /** The position of the target node. */
217
+ get pos(): number;
218
+ /** The mark to add. */
219
+ get mark(): Mark;
220
+ /** @internal */
221
+ static fromJSON(schema: Schema, json: any): AddNodeMarkStep;
222
+ }
223
+ /**
224
+ * Remove a mark from a specific node.
225
+ *
226
+ * @since 0.1.0
227
+ * @category models
228
+ */
229
+ export declare class RemoveNodeMarkStep extends CoreStep {
230
+ /** @internal */
231
+ readonly [CORE]: RemoveNodeMarkStep$1;
232
+ /** Create a mark-removing step. */
233
+ constructor(pos: number, mark: Mark);
234
+ /** The position of the target node. */
235
+ get pos(): number;
236
+ /** The mark to remove. */
237
+ get mark(): Mark;
238
+ /** @internal */
239
+ static fromJSON(schema: Schema, json: any): RemoveNodeMarkStep;
240
+ }
241
+ /**
242
+ * Update an attribute in a specific node.
243
+ *
244
+ * @since 0.1.0
245
+ * @category models
246
+ */
247
+ export declare class AttrStep extends CoreStep {
248
+ /** @internal */
249
+ readonly [CORE]: AttrStep$1;
250
+ /** Construct an attribute step. */
251
+ constructor(pos: number, attr: string, value: any);
252
+ /** The position of the target node. */
253
+ get pos(): number;
254
+ /** The attribute to set. */
255
+ get attr(): string;
256
+ /** The attribute's new value. */
257
+ get value(): any;
258
+ /** @internal */
259
+ static fromJSON(schema: Schema, json: any): AttrStep;
260
+ }
261
+ /**
262
+ * Update an attribute in the doc node.
263
+ *
264
+ * @since 0.1.0
265
+ * @category models
266
+ */
267
+ export declare class DocAttrStep extends CoreStep {
268
+ /** @internal */
269
+ readonly [CORE]: DocAttrStep$1;
270
+ /** Construct an attribute step. */
271
+ constructor(attr: string, value: any);
272
+ /** The attribute to set. */
273
+ get attr(): string;
274
+ /** The attribute's new value. */
275
+ get value(): any;
276
+ /** @internal */
277
+ static fromJSON(schema: Schema, json: any): DocAttrStep;
278
+ }
279
+ /**
280
+ * A node type with attributes, as used by `findWrapping` and
281
+ * `Transform.wrap`.
282
+ *
283
+ * @since 0.1.0
284
+ * @category models
285
+ */
286
+ export interface NodeTypeWithAttrs {
287
+ type: NodeType;
288
+ attrs?: Attrs | null;
289
+ }
290
+ /**
291
+ * Try to find a target depth to which the content in the given range
292
+ * can be lifted.
293
+ *
294
+ * @since 0.1.0
295
+ * @category structure
296
+ */
297
+ export declare const liftTarget: (range: NodeRange) => number | null;
298
+ /**
299
+ * Try to find a valid way to wrap the content in the given range in a
300
+ * node of the given type.
301
+ *
302
+ * @since 0.1.0
303
+ * @category structure
304
+ */
305
+ export declare const findWrapping: (range: NodeRange, nodeType: NodeType, attrs?: Attrs | null, innerRange?: NodeRange) => Array<{
306
+ type: NodeType;
307
+ attrs: Attrs | null;
308
+ }> | null;
309
+ /**
310
+ * Check whether splitting at the given position is allowed.
311
+ *
312
+ * @since 0.1.0
313
+ * @category structure
314
+ */
315
+ export declare const canSplit: (doc: Node, pos: number, depth?: number, typesAfter?: ReadonlyArray<NodeTypeWithAttrs | null | undefined>) => boolean;
316
+ /**
317
+ * Test whether the blocks before and after a given position can be
318
+ * joined.
319
+ *
320
+ * @since 0.1.0
321
+ * @category structure
322
+ */
323
+ export declare const canJoin: (doc: Node, pos: number) => boolean;
324
+ /**
325
+ * Find an ancestor of the given position that can be joined to the
326
+ * block before (or after if `dir` is positive).
327
+ *
328
+ * @since 0.1.0
329
+ * @category structure
330
+ */
331
+ export declare const joinPoint: (doc: Node, pos: number, dir?: number) => number | null;
332
+ /**
333
+ * Try to find a point where a node of the given type can be inserted
334
+ * near `pos`, by searching up the node hierarchy when `pos` itself
335
+ * isn't a valid place but is at the start or end of a node.
336
+ *
337
+ * @since 0.1.0
338
+ * @category structure
339
+ */
340
+ export declare const insertPoint: (doc: Node, pos: number, nodeType: NodeType) => number | null;
341
+ /**
342
+ * Finds a position at or around the given position where the given
343
+ * slice can be inserted.
344
+ *
345
+ * @since 0.1.0
346
+ * @category structure
347
+ */
348
+ export declare const dropPoint: (doc: Node, pos: number, slice: Slice) => number | null;
349
+ /**
350
+ * 'Fit' a slice into a given position in the document, producing a
351
+ * step that inserts it. Will return null if there's no meaningful way
352
+ * to insert the slice here, or inserting it would be a no-op.
353
+ *
354
+ * @since 0.1.0
355
+ * @category structure
356
+ */
357
+ export declare const replaceStep: (doc: Node, from: number, to?: number, slice?: Slice) => Step | null;
358
+ /**
359
+ * Abstraction to build up and track an array of steps representing a
360
+ * document transformation.
361
+ *
362
+ * @since 0.1.0
363
+ * @category models
364
+ */
365
+ export declare class Transform {
366
+ /** @internal */
367
+ readonly [CORE]: Transform$1;
368
+ /** Create a transform that starts with the given document. */
369
+ constructor(doc: Node);
370
+ /** The steps in this transform. */
371
+ get steps(): Array<Step>;
372
+ /** The documents before each of the steps. */
373
+ get docs(): Array<Node>;
374
+ /** A mapping with the maps for each of the steps in this transform. */
375
+ get mapping(): Mapping;
376
+ /** The current document (the result of applying the steps in the transform). */
377
+ get doc(): Node;
378
+ /** The starting document. */
379
+ get before(): Node;
380
+ /** Apply a new step in this transform, saving the result. Throws an error when the step fails. */
381
+ step(step: Step): this;
382
+ /** Try to apply a step in this transformation, ignoring it if it fails. Returns the step result. */
383
+ maybeStep(step: Step): StepResult;
384
+ /** True when the document has been changed (when there are any steps). */
385
+ get docChanged(): boolean;
386
+ /** Return a single range, in post-transform document positions, that covers all content changed by this transform. */
387
+ changedRange(): {
388
+ from: number;
389
+ to: number;
390
+ } | null;
391
+ /** @internal */
392
+ addStep(step: Step, doc: Node): void;
393
+ /** Replace the part of the document between `from` and `to` with the given `slice`. */
394
+ replace(from: number, to?: number, slice?: Slice): this;
395
+ /** Replace the given range with the given content, which may be a fragment, node, or array of nodes. */
396
+ replaceWith(from: number, to: number, content: Fragment | Node | ReadonlyArray<Node>): this;
397
+ /** Delete the content between the given positions. */
398
+ delete(from: number, to: number): this;
399
+ /** Insert the given content at the given position. */
400
+ insert(pos: number, content: Fragment | Node | ReadonlyArray<Node>): this;
401
+ /** Replace a range of the document with a given slice, using `from`, `to`, and the slice's `openStart` property as hints, rather than fixed start and end points. */
402
+ replaceRange(from: number, to: number, slice: Slice): this;
403
+ /** Replace the given range with a node, but use `from` and `to` as hints, rather than precise positions. */
404
+ replaceRangeWith(from: number, to: number, node: Node): this;
405
+ /** Delete the given range, expanding it to cover fully covered parent nodes until a valid replace is found. */
406
+ deleteRange(from: number, to: number): this;
407
+ /** Split the content in the given range off from its parent, if there is sibling content before or after it, and move it up the tree to the depth specified by `target`. */
408
+ lift(range: NodeRange, target: number): this;
409
+ /** Join the blocks around the given position. */
410
+ join(pos: number, depth?: number): this;
411
+ /** Wrap the given range in the given set of wrappers. */
412
+ wrap(range: NodeRange, wrappers: ReadonlyArray<NodeTypeWithAttrs>): this;
413
+ /** Set the type of all textblocks (partly) between `from` and `to` to the given node type with the given attributes. */
414
+ setBlockType(from: number, to: number | undefined, type: NodeType, attrs?: Attrs | null | ((oldNode: Node) => Attrs)): this;
415
+ /** Change the type, attributes, and/or marks of the node at `pos`. */
416
+ setNodeMarkup(pos: number, type?: NodeType | null, attrs?: Attrs | null, marks?: ReadonlyArray<Mark>): this;
417
+ /** Set a single attribute on a given node to a new value. */
418
+ setNodeAttribute(pos: number, attr: string, value: any): this;
419
+ /** Set a single attribute on the document to a new value. */
420
+ setDocAttribute(attr: string, value: any): this;
421
+ /** Add a mark to the node at position `pos`. */
422
+ addNodeMark(pos: number, mark: Mark): this;
423
+ /** Remove a mark (or all marks of the given type) from the node at position `pos`. */
424
+ removeNodeMark(pos: number, mark: Mark | MarkType): this;
425
+ /** Split the node at the given position, and optionally, if `depth` is greater than one, any number of nodes above that. */
426
+ split(pos: number, depth?: number, typesAfter?: ReadonlyArray<NodeTypeWithAttrs | null | undefined>): this;
427
+ /** Add the given mark to the inline content between `from` and `to`. */
428
+ addMark(from: number, to: number, mark: Mark): this;
429
+ /** Remove marks from inline nodes between `from` and `to`. */
430
+ removeMark(from: number, to: number, mark?: Mark | MarkType | null): this;
431
+ /** Removes all marks and nodes from the content of the node at `pos` that don't match the given new parent node type. */
432
+ clearIncompatible(pos: number, parentType: NodeType, match?: ContentMatch): this;
433
+ }
434
+ /**
435
+ * Get the core (Effect API) object behind a facade. For a user-defined
436
+ * `Step` subclass, this is a core step that delegates to it.
437
+ *
438
+ * @since 0.1.0
439
+ * @category conversions
440
+ */
441
+ export declare function toCore(step: ReplaceStep): ReplaceStep$1;
442
+ export declare function toCore(step: ReplaceAroundStep): ReplaceAroundStep$1;
443
+ export declare function toCore(step: Step): Step$1;
444
+ export declare function toCore(mapping: Mapping): Mapping$1;
445
+ export declare function toCore(tr: Transform): Transform$1;
446
+ /**
447
+ * Get the facade for a core (Effect API) object.
448
+ *
449
+ * @since 0.1.0
450
+ * @category conversions
451
+ */
452
+ export declare function fromCore(step: ReplaceStep$1<any>): ReplaceStep;
453
+ export declare function fromCore(step: ReplaceAroundStep$1<any>): ReplaceAroundStep;
454
+ export declare function fromCore(step: Step$1<any>): Step;
455
+ export declare function fromCore(mapping: Mapping$1): Mapping;
456
+ export declare function fromCore(result: StepResult$1<any>): StepResult;
457
+ export declare function fromCore(tr: Transform$1<any>): Transform;
458
+ export { MapResult, type Mappable, StepMap, TransformError };