foldkit-richtext 0.5.2 → 0.6.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 (100) hide show
  1. package/dist/clipboard.d.ts +224 -0
  2. package/dist/clipboard.d.ts.map +1 -0
  3. package/dist/clipboard.js +208 -0
  4. package/dist/clipboard.js.map +1 -0
  5. package/dist/code.d.ts +27 -0
  6. package/dist/code.d.ts.map +1 -0
  7. package/dist/code.js +45 -0
  8. package/dist/code.js.map +1 -0
  9. package/dist/command.d.ts +300 -0
  10. package/dist/command.d.ts.map +1 -0
  11. package/dist/command.js +1438 -0
  12. package/dist/command.js.map +1 -0
  13. package/dist/decoration.d.ts +44 -0
  14. package/dist/decoration.d.ts.map +1 -0
  15. package/dist/decoration.js +96 -0
  16. package/dist/decoration.js.map +1 -0
  17. package/dist/document.d.ts +1045 -0
  18. package/dist/document.d.ts.map +1 -0
  19. package/dist/document.js +544 -0
  20. package/dist/document.js.map +1 -0
  21. package/dist/footnote.d.ts +35 -0
  22. package/dist/footnote.d.ts.map +1 -0
  23. package/dist/footnote.js +100 -0
  24. package/dist/footnote.js.map +1 -0
  25. package/dist/history.d.ts +470 -0
  26. package/dist/history.d.ts.map +1 -0
  27. package/dist/history.js +81 -0
  28. package/dist/history.js.map +1 -0
  29. package/dist/html.d.ts +27 -0
  30. package/dist/html.d.ts.map +1 -0
  31. package/dist/html.js +99 -0
  32. package/dist/html.js.map +1 -0
  33. package/dist/indent.d.ts +16 -0
  34. package/dist/indent.d.ts.map +1 -0
  35. package/dist/indent.js +101 -0
  36. package/dist/indent.js.map +1 -0
  37. package/dist/index.d.ts +24 -0
  38. package/dist/index.js +24 -0
  39. package/dist/input.d.ts +54 -0
  40. package/dist/input.d.ts.map +1 -0
  41. package/dist/input.js +37 -0
  42. package/dist/input.js.map +1 -0
  43. package/dist/kit.d.ts +179 -0
  44. package/dist/kit.d.ts.map +1 -0
  45. package/dist/kit.js +202 -0
  46. package/dist/kit.js.map +1 -0
  47. package/dist/marks.d.ts +79 -0
  48. package/dist/marks.d.ts.map +1 -0
  49. package/dist/marks.js +127 -0
  50. package/dist/marks.js.map +1 -0
  51. package/dist/media.d.ts +30 -0
  52. package/dist/media.d.ts.map +1 -0
  53. package/dist/media.js +148 -0
  54. package/dist/media.js.map +1 -0
  55. package/dist/migration.d.ts +55 -0
  56. package/dist/migration.d.ts.map +1 -0
  57. package/dist/migration.js +124 -0
  58. package/dist/migration.js.map +1 -0
  59. package/dist/outline.d.ts +15 -0
  60. package/dist/outline.d.ts.map +1 -0
  61. package/dist/outline.js +39 -0
  62. package/dist/outline.js.map +1 -0
  63. package/dist/rendering.d.ts +96 -0
  64. package/dist/rendering.d.ts.map +1 -0
  65. package/dist/rendering.js +106 -0
  66. package/dist/rendering.js.map +1 -0
  67. package/dist/replicated.d.ts +340 -0
  68. package/dist/replicated.d.ts.map +1 -0
  69. package/dist/replicated.js +1727 -0
  70. package/dist/replicated.js.map +1 -0
  71. package/dist/search.d.ts +28 -0
  72. package/dist/search.d.ts.map +1 -0
  73. package/dist/search.js +61 -0
  74. package/dist/search.js.map +1 -0
  75. package/dist/standard.d.ts +61 -0
  76. package/dist/standard.d.ts.map +1 -0
  77. package/dist/standard.js +231 -0
  78. package/dist/standard.js.map +1 -0
  79. package/dist/table.d.ts +38 -0
  80. package/dist/table.d.ts.map +1 -0
  81. package/dist/table.js +160 -0
  82. package/dist/table.js.map +1 -0
  83. package/dist/transaction.d.ts +712 -0
  84. package/dist/transaction.d.ts.map +1 -0
  85. package/dist/transaction.js +993 -0
  86. package/dist/transaction.js.map +1 -0
  87. package/dist/transform.d.ts +48 -0
  88. package/dist/transform.d.ts.map +1 -0
  89. package/dist/transform.js +94 -0
  90. package/dist/transform.js.map +1 -0
  91. package/dist/url.d.ts +16 -0
  92. package/dist/url.d.ts.map +1 -0
  93. package/dist/url.js +32 -0
  94. package/dist/url.js.map +1 -0
  95. package/package.json +6 -6
  96. package/dist/index.d.mts +0 -3787
  97. package/dist/index.d.mts.map +0 -1
  98. package/dist/index.mjs +0 -6688
  99. package/dist/index.mjs.map +0 -1
  100. package/dist/rolldown-runtime-D8jQpDG7.mjs +0 -12
@@ -0,0 +1,712 @@
1
+ import { Schema } from "effect";
2
+ import { Block, EditorState, NodeId, NodeReference, Position, RunMark, Selection } from "./document.js";
3
+ import { Transform } from "./transform.js";
4
+ /** How many normalization passes a transaction may spend before it gives up. */
5
+ export declare const MAX_NORMALIZATION_PASSES = 10;
6
+ /**
7
+ * What a text block retypes to: a paragraph, or a heading at a level. Its runs are
8
+ * its own and survive the change; only the block's type does not.
9
+ */
10
+ export declare const TextBlock: Schema.Union<readonly [Schema.Struct<{
11
+ readonly type: Schema.Literal<"Paragraph">;
12
+ }>, Schema.Struct<{
13
+ readonly type: Schema.Literal<"Heading">;
14
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
15
+ }>]>;
16
+ export type TextBlock = typeof TextBlock.Type;
17
+ /**
18
+ * What a block becomes, under its own identity and with its own content: a block that holds
19
+ * text becomes a paragraph, a heading, or an application node kind that holds text, such as a
20
+ * code block, keeping its runs; a node that holds blocks becomes another node kind, keeping
21
+ * its nested blocks, as a list item becomes a task.
22
+ */
23
+ export declare const RetypeTarget: Schema.Union<readonly [Schema.Struct<{
24
+ readonly type: Schema.Literal<"Paragraph">;
25
+ }>, Schema.Struct<{
26
+ readonly type: Schema.Literal<"Heading">;
27
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
28
+ }>, Schema.Struct<{
29
+ readonly type: Schema.Literal<"Node">;
30
+ readonly kind: Schema.NonEmptyString;
31
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
32
+ }>]>;
33
+ export type RetypeTarget = typeof RetypeTarget.Type;
34
+ export declare const Operation: Schema.Union<readonly [Schema.Struct<{
35
+ readonly type: Schema.Literal<"InsertText">;
36
+ readonly at: Schema.Struct<{
37
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
38
+ readonly offset: Schema.Number;
39
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
40
+ }>;
41
+ readonly text: Schema.String;
42
+ }>, Schema.Struct<{
43
+ readonly type: Schema.Literal<"DeleteText">;
44
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
45
+ readonly from: Schema.Number;
46
+ readonly to: Schema.Number;
47
+ }>, Schema.Struct<{
48
+ readonly type: Schema.Literal<"AddMark">;
49
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
50
+ readonly mark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
51
+ readonly name: Schema.NonEmptyString;
52
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
53
+ }>]>;
54
+ }>, Schema.Struct<{
55
+ readonly type: Schema.Literal<"RemoveMark">;
56
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
57
+ readonly mark: Schema.String;
58
+ }>, Schema.Struct<{
59
+ readonly type: Schema.Literal<"SetSelection">;
60
+ readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
61
+ readonly type: Schema.Literal<"Range">;
62
+ readonly anchor: Schema.Struct<{
63
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
64
+ readonly offset: Schema.Number;
65
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
66
+ }>;
67
+ readonly focus: Schema.Struct<{
68
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
69
+ readonly offset: Schema.Number;
70
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
71
+ }>;
72
+ }>, Schema.Struct<{
73
+ readonly type: Schema.Literal<"Node">;
74
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
75
+ }>]>>;
76
+ }>, Schema.Struct<{
77
+ readonly type: Schema.Literal<"SplitNode">;
78
+ readonly block: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
79
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
80
+ readonly offset: Schema.Number;
81
+ readonly blockId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
82
+ readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
83
+ }>, Schema.Struct<{
84
+ readonly type: Schema.Literal<"JoinNode">;
85
+ readonly into: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
86
+ readonly removed: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
87
+ }>, Schema.Struct<{
88
+ readonly type: Schema.Literal<"MoveNode">;
89
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
90
+ readonly to: Schema.Number;
91
+ /** The block list to move into: a node block's, or the document's when absent. */
92
+ readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
93
+ }>, Schema.Struct<{
94
+ readonly type: Schema.Literal<"RetypeBlock">;
95
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
96
+ readonly to: Schema.Union<readonly [Schema.Struct<{
97
+ readonly type: Schema.Literal<"Paragraph">;
98
+ }>, Schema.Struct<{
99
+ readonly type: Schema.Literal<"Heading">;
100
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
101
+ }>, Schema.Struct<{
102
+ readonly type: Schema.Literal<"Node">;
103
+ readonly kind: Schema.NonEmptyString;
104
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
105
+ }>]>;
106
+ }>, Schema.Struct<{
107
+ readonly type: Schema.Literal<"SetProps">;
108
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
109
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
110
+ }>, Schema.Struct<{
111
+ readonly type: Schema.Literal<"InsertNode">;
112
+ readonly block: Schema.Union<readonly [Schema.Struct<{
113
+ readonly type: Schema.Literal<"Paragraph">;
114
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
115
+ readonly children: Schema.$Array<Schema.Struct<{
116
+ readonly type: Schema.Literal<"Text">;
117
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
118
+ readonly text: Schema.String;
119
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
120
+ readonly name: Schema.NonEmptyString;
121
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
122
+ }>]>>;
123
+ }>>;
124
+ }>, Schema.Struct<{
125
+ readonly type: Schema.Literal<"Heading">;
126
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
127
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
128
+ readonly children: Schema.$Array<Schema.Struct<{
129
+ readonly type: Schema.Literal<"Text">;
130
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
131
+ readonly text: Schema.String;
132
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
133
+ readonly name: Schema.NonEmptyString;
134
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
135
+ }>]>>;
136
+ }>>;
137
+ }>, Schema.Struct<{
138
+ readonly type: Schema.Literal<"Node">;
139
+ readonly kind: Schema.NonEmptyString;
140
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
141
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
142
+ readonly children: Schema.$Array<Schema.Struct<{
143
+ readonly type: Schema.Literal<"Text">;
144
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
145
+ readonly text: Schema.String;
146
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
147
+ readonly name: Schema.NonEmptyString;
148
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
149
+ }>]>>;
150
+ }>>;
151
+ readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
152
+ readonly type: 'Node';
153
+ readonly kind: string;
154
+ readonly id: string;
155
+ readonly props: {
156
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
157
+ };
158
+ readonly children: readonly {
159
+ readonly type: "Text";
160
+ readonly id: string;
161
+ readonly text: string;
162
+ readonly marks: readonly (string | {
163
+ readonly name: string;
164
+ readonly props?: {
165
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
166
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
167
+ } | null;
168
+ };
169
+ })[];
170
+ }[];
171
+ readonly blocks?: readonly ( /*elided*/ any | {
172
+ readonly type: "Paragraph";
173
+ readonly id: string;
174
+ readonly children: readonly {
175
+ readonly type: "Text";
176
+ readonly id: string;
177
+ readonly text: string;
178
+ readonly marks: readonly (string | {
179
+ readonly name: string;
180
+ readonly props?: {
181
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
182
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
183
+ } | null;
184
+ };
185
+ })[];
186
+ }[];
187
+ } | {
188
+ readonly type: "Heading";
189
+ readonly id: string;
190
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
191
+ readonly children: readonly {
192
+ readonly type: "Text";
193
+ readonly id: string;
194
+ readonly text: string;
195
+ readonly marks: readonly (string | {
196
+ readonly name: string;
197
+ readonly props?: {
198
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
199
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
200
+ } | null;
201
+ };
202
+ })[];
203
+ }[];
204
+ } | {
205
+ readonly type: "Unknown";
206
+ readonly id: string;
207
+ readonly originalType: string;
208
+ readonly props: {
209
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
210
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
211
+ } | null;
212
+ };
213
+ readonly children: readonly {
214
+ readonly type: "Text";
215
+ readonly id: string;
216
+ readonly text: string;
217
+ readonly marks: readonly (string | {
218
+ readonly name: string;
219
+ readonly props?: {
220
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
221
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
222
+ } | null;
223
+ };
224
+ })[];
225
+ }[];
226
+ })[];
227
+ } | {
228
+ readonly type: "Paragraph";
229
+ readonly id: string;
230
+ readonly children: readonly {
231
+ readonly type: "Text";
232
+ readonly id: string;
233
+ readonly text: string;
234
+ readonly marks: readonly (string | {
235
+ readonly name: string;
236
+ readonly props?: {
237
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
238
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
239
+ } | null;
240
+ };
241
+ })[];
242
+ }[];
243
+ } | {
244
+ readonly type: "Heading";
245
+ readonly id: string;
246
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
247
+ readonly children: readonly {
248
+ readonly type: "Text";
249
+ readonly id: string;
250
+ readonly text: string;
251
+ readonly marks: readonly (string | {
252
+ readonly name: string;
253
+ readonly props?: {
254
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
255
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
256
+ } | null;
257
+ };
258
+ })[];
259
+ }[];
260
+ } | {
261
+ readonly type: "Unknown";
262
+ readonly id: string;
263
+ readonly originalType: string;
264
+ readonly props: {
265
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
266
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
267
+ } | null;
268
+ };
269
+ readonly children: readonly {
270
+ readonly type: "Text";
271
+ readonly id: string;
272
+ readonly text: string;
273
+ readonly marks: readonly (string | {
274
+ readonly name: string;
275
+ readonly props?: {
276
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
277
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
278
+ } | null;
279
+ };
280
+ })[];
281
+ }[];
282
+ })[], never, never>>>;
283
+ }>, Schema.Struct<{
284
+ readonly type: Schema.Literal<"Unknown">;
285
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
286
+ readonly originalType: Schema.NonEmptyString;
287
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
288
+ readonly children: Schema.$Array<Schema.Struct<{
289
+ readonly type: Schema.Literal<"Text">;
290
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
291
+ readonly text: Schema.String;
292
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
293
+ readonly name: Schema.NonEmptyString;
294
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
295
+ }>]>>;
296
+ }>>;
297
+ }>]>;
298
+ readonly at: Schema.Number;
299
+ /** The block list to insert into: a node block's, or the document's when absent. */
300
+ readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
301
+ }>, Schema.Struct<{
302
+ readonly type: Schema.Literal<"DeleteNode">;
303
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
304
+ }>, Schema.Struct<{
305
+ readonly type: Schema.Literal<"SplitRun">;
306
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
307
+ readonly offset: Schema.Number;
308
+ readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
309
+ }>]>;
310
+ export type Operation = typeof Operation.Type;
311
+ export declare const Transaction: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
312
+ readonly type: Schema.Literal<"InsertText">;
313
+ readonly at: Schema.Struct<{
314
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
315
+ readonly offset: Schema.Number;
316
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
317
+ }>;
318
+ readonly text: Schema.String;
319
+ }>, Schema.Struct<{
320
+ readonly type: Schema.Literal<"DeleteText">;
321
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
322
+ readonly from: Schema.Number;
323
+ readonly to: Schema.Number;
324
+ }>, Schema.Struct<{
325
+ readonly type: Schema.Literal<"AddMark">;
326
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
327
+ readonly mark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
328
+ readonly name: Schema.NonEmptyString;
329
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
330
+ }>]>;
331
+ }>, Schema.Struct<{
332
+ readonly type: Schema.Literal<"RemoveMark">;
333
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
334
+ readonly mark: Schema.String;
335
+ }>, Schema.Struct<{
336
+ readonly type: Schema.Literal<"SetSelection">;
337
+ readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
338
+ readonly type: Schema.Literal<"Range">;
339
+ readonly anchor: Schema.Struct<{
340
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
341
+ readonly offset: Schema.Number;
342
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
343
+ }>;
344
+ readonly focus: Schema.Struct<{
345
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
346
+ readonly offset: Schema.Number;
347
+ readonly affinity: Schema.Literals<readonly ["before", "after"]>;
348
+ }>;
349
+ }>, Schema.Struct<{
350
+ readonly type: Schema.Literal<"Node">;
351
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
352
+ }>]>>;
353
+ }>, Schema.Struct<{
354
+ readonly type: Schema.Literal<"SplitNode">;
355
+ readonly block: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
356
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
357
+ readonly offset: Schema.Number;
358
+ readonly blockId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
359
+ readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
360
+ }>, Schema.Struct<{
361
+ readonly type: Schema.Literal<"JoinNode">;
362
+ readonly into: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
363
+ readonly removed: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
364
+ }>, Schema.Struct<{
365
+ readonly type: Schema.Literal<"MoveNode">;
366
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
367
+ readonly to: Schema.Number;
368
+ /** The block list to move into: a node block's, or the document's when absent. */
369
+ readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
370
+ }>, Schema.Struct<{
371
+ readonly type: Schema.Literal<"RetypeBlock">;
372
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
373
+ readonly to: Schema.Union<readonly [Schema.Struct<{
374
+ readonly type: Schema.Literal<"Paragraph">;
375
+ }>, Schema.Struct<{
376
+ readonly type: Schema.Literal<"Heading">;
377
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
378
+ }>, Schema.Struct<{
379
+ readonly type: Schema.Literal<"Node">;
380
+ readonly kind: Schema.NonEmptyString;
381
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
382
+ }>]>;
383
+ }>, Schema.Struct<{
384
+ readonly type: Schema.Literal<"SetProps">;
385
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
386
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
387
+ }>, Schema.Struct<{
388
+ readonly type: Schema.Literal<"InsertNode">;
389
+ readonly block: Schema.Union<readonly [Schema.Struct<{
390
+ readonly type: Schema.Literal<"Paragraph">;
391
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
392
+ readonly children: Schema.$Array<Schema.Struct<{
393
+ readonly type: Schema.Literal<"Text">;
394
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
395
+ readonly text: Schema.String;
396
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
397
+ readonly name: Schema.NonEmptyString;
398
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
399
+ }>]>>;
400
+ }>>;
401
+ }>, Schema.Struct<{
402
+ readonly type: Schema.Literal<"Heading">;
403
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
404
+ readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
405
+ readonly children: Schema.$Array<Schema.Struct<{
406
+ readonly type: Schema.Literal<"Text">;
407
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
408
+ readonly text: Schema.String;
409
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
410
+ readonly name: Schema.NonEmptyString;
411
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
412
+ }>]>>;
413
+ }>>;
414
+ }>, Schema.Struct<{
415
+ readonly type: Schema.Literal<"Node">;
416
+ readonly kind: Schema.NonEmptyString;
417
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
418
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
419
+ readonly children: Schema.$Array<Schema.Struct<{
420
+ readonly type: Schema.Literal<"Text">;
421
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
422
+ readonly text: Schema.String;
423
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
424
+ readonly name: Schema.NonEmptyString;
425
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
426
+ }>]>>;
427
+ }>>;
428
+ readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
429
+ readonly type: 'Node';
430
+ readonly kind: string;
431
+ readonly id: string;
432
+ readonly props: {
433
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
434
+ };
435
+ readonly children: readonly {
436
+ readonly type: "Text";
437
+ readonly id: string;
438
+ readonly text: string;
439
+ readonly marks: readonly (string | {
440
+ readonly name: string;
441
+ readonly props?: {
442
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
443
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
444
+ } | null;
445
+ };
446
+ })[];
447
+ }[];
448
+ readonly blocks?: readonly ( /*elided*/ any | {
449
+ readonly type: "Paragraph";
450
+ readonly id: string;
451
+ readonly children: readonly {
452
+ readonly type: "Text";
453
+ readonly id: string;
454
+ readonly text: string;
455
+ readonly marks: readonly (string | {
456
+ readonly name: string;
457
+ readonly props?: {
458
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
459
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
460
+ } | null;
461
+ };
462
+ })[];
463
+ }[];
464
+ } | {
465
+ readonly type: "Heading";
466
+ readonly id: string;
467
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
468
+ readonly children: readonly {
469
+ readonly type: "Text";
470
+ readonly id: string;
471
+ readonly text: string;
472
+ readonly marks: readonly (string | {
473
+ readonly name: string;
474
+ readonly props?: {
475
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
476
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
477
+ } | null;
478
+ };
479
+ })[];
480
+ }[];
481
+ } | {
482
+ readonly type: "Unknown";
483
+ readonly id: string;
484
+ readonly originalType: string;
485
+ readonly props: {
486
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
487
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
488
+ } | null;
489
+ };
490
+ readonly children: readonly {
491
+ readonly type: "Text";
492
+ readonly id: string;
493
+ readonly text: string;
494
+ readonly marks: readonly (string | {
495
+ readonly name: string;
496
+ readonly props?: {
497
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
498
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
499
+ } | null;
500
+ };
501
+ })[];
502
+ }[];
503
+ })[];
504
+ } | {
505
+ readonly type: "Paragraph";
506
+ readonly id: string;
507
+ readonly children: readonly {
508
+ readonly type: "Text";
509
+ readonly id: string;
510
+ readonly text: string;
511
+ readonly marks: readonly (string | {
512
+ readonly name: string;
513
+ readonly props?: {
514
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
515
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
516
+ } | null;
517
+ };
518
+ })[];
519
+ }[];
520
+ } | {
521
+ readonly type: "Heading";
522
+ readonly id: string;
523
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
524
+ readonly children: readonly {
525
+ readonly type: "Text";
526
+ readonly id: string;
527
+ readonly text: string;
528
+ readonly marks: readonly (string | {
529
+ readonly name: string;
530
+ readonly props?: {
531
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
532
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
533
+ } | null;
534
+ };
535
+ })[];
536
+ }[];
537
+ } | {
538
+ readonly type: "Unknown";
539
+ readonly id: string;
540
+ readonly originalType: string;
541
+ readonly props: {
542
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
543
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
544
+ } | null;
545
+ };
546
+ readonly children: readonly {
547
+ readonly type: "Text";
548
+ readonly id: string;
549
+ readonly text: string;
550
+ readonly marks: readonly (string | {
551
+ readonly name: string;
552
+ readonly props?: {
553
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | {
554
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null)[] | any | null;
555
+ } | null;
556
+ };
557
+ })[];
558
+ }[];
559
+ })[], never, never>>>;
560
+ }>, Schema.Struct<{
561
+ readonly type: Schema.Literal<"Unknown">;
562
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
563
+ readonly originalType: Schema.NonEmptyString;
564
+ readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
565
+ readonly children: Schema.$Array<Schema.Struct<{
566
+ readonly type: Schema.Literal<"Text">;
567
+ readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
568
+ readonly text: Schema.String;
569
+ readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
570
+ readonly name: Schema.NonEmptyString;
571
+ readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
572
+ }>]>>;
573
+ }>>;
574
+ }>]>;
575
+ readonly at: Schema.Number;
576
+ /** The block list to insert into: a node block's, or the document's when absent. */
577
+ readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
578
+ }>, Schema.Struct<{
579
+ readonly type: Schema.Literal<"DeleteNode">;
580
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
581
+ }>, Schema.Struct<{
582
+ readonly type: Schema.Literal<"SplitRun">;
583
+ readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
584
+ readonly offset: Schema.Number;
585
+ readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
586
+ }>]>>;
587
+ export type Transaction = typeof Transaction.Type;
588
+ /** A text-run target: a validated id or a reusable node reference. */
589
+ export type TextTarget = NodeId | NodeReference;
590
+ /**
591
+ * Typesafe constructors for transaction operations. Each builder accepts a
592
+ * `NodeId` or a `Node.make` reference and validates shape immediately
593
+ * (misuse throws), while document-dependent checks — node kind, existence,
594
+ * bounds, selection resolution — remain `apply` diagnostics. Compose with
595
+ * `Node.at` for positions: `Edit.insertText(Text.at(5, 'after'), '!')`.
596
+ */
597
+ export declare const Edit: {
598
+ insertText: (at: Position, text: string) => Extract<Operation, {
599
+ readonly type: 'InsertText';
600
+ }>;
601
+ deleteText: (node: TextTarget, from: number, to: number) => Extract<Operation, {
602
+ readonly type: 'DeleteText';
603
+ }>;
604
+ addMark: (node: TextTarget, mark: RunMark) => Extract<Operation, {
605
+ readonly type: 'AddMark';
606
+ }>;
607
+ removeMark: (node: TextTarget, mark: string) => Extract<Operation, {
608
+ readonly type: 'RemoveMark';
609
+ }>;
610
+ setSelection: (selection: Selection | null) => Extract<Operation, {
611
+ readonly type: 'SetSelection';
612
+ }>;
613
+ splitBlock: (block: TextTarget, node: TextTarget, offset: number, newBlock: string | NodeId, newRun: string | NodeId) => Extract<Operation, {
614
+ readonly type: 'SplitNode';
615
+ }>;
616
+ joinBlocks: (survivor: TextTarget, removed: TextTarget) => Extract<Operation, {
617
+ readonly type: 'JoinNode';
618
+ }>;
619
+ moveBlock: (node: TextTarget, to: number, parent?: TextTarget) => Extract<Operation, {
620
+ readonly type: 'MoveNode';
621
+ }>;
622
+ retypeBlock: (node: TextTarget, to: RetypeTarget) => Extract<Operation, {
623
+ readonly type: 'RetypeBlock';
624
+ }>;
625
+ /** Sets the named props of a node block; props it does not name keep their values. */
626
+ setProps: (node: TextTarget, props: Schema.JsonObject) => Extract<Operation, {
627
+ readonly type: 'SetProps';
628
+ }>;
629
+ insertBlock: (block: Block, at: number, parent?: TextTarget) => Extract<Operation, {
630
+ readonly type: 'InsertNode';
631
+ }>;
632
+ deleteBlock: (node: TextTarget) => Extract<Operation, {
633
+ readonly type: 'DeleteNode';
634
+ }>;
635
+ splitRun: (node: TextTarget, offset: number, newRun: string | NodeId) => Extract<Operation, {
636
+ readonly type: 'SplitRun';
637
+ }>;
638
+ };
639
+ export interface ChangeSet {
640
+ readonly dirtyNodes: ReadonlySet<NodeId>;
641
+ readonly insertedNodes: ReadonlySet<NodeId>;
642
+ readonly removedNodes: ReadonlySet<NodeId>;
643
+ readonly textChanged: ReadonlySet<NodeId>;
644
+ readonly structureChanged: boolean;
645
+ readonly selectionChanged: boolean;
646
+ }
647
+ /** One replacement of [from, to) with inserted UTF-16 units, in sequential coordinates. */
648
+ export interface PositionStep {
649
+ readonly node: NodeId;
650
+ readonly from: number;
651
+ readonly to: number;
652
+ readonly inserted: number;
653
+ }
654
+ /**
655
+ * Split relocation: offsets > at move to into with offset - at; offset == at
656
+ * follows affinity (before stays, after moves to 0); lower offsets stay.
657
+ */
658
+ export interface SplitStep {
659
+ readonly node: NodeId;
660
+ readonly into: NodeId;
661
+ readonly at: number;
662
+ }
663
+ /**
664
+ * Merge relocation: offsets >= at move to into with base + offset - at;
665
+ * lower offsets stay. Affinity is preserved, not consulted: the source
666
+ * location ceases to exist, so every endpoint must move.
667
+ */
668
+ export interface RelocateStep {
669
+ readonly node: NodeId;
670
+ readonly into: NodeId;
671
+ readonly at: number;
672
+ readonly base: number;
673
+ }
674
+ /**
675
+ * Deletion collapse: every offset in node moves to offset 0 of into;
676
+ * affinity is preserved. Emitted per removed run when a surviving run exists;
677
+ * with no text left, positions cannot map and selection clears instead.
678
+ */
679
+ export interface CollapseStep {
680
+ readonly node: NodeId;
681
+ readonly into: NodeId;
682
+ }
683
+ /** Maps a position through each edit, preserving insertion affinity. */
684
+ export declare const mapPosition: (position: Position, steps: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>) => Position;
685
+ /**
686
+ * Maps a whole selection through steps: both range endpoints, or a node target
687
+ * whose identity a step relocated. Steps that only replace text have no `into`,
688
+ * so a node selection is unaffected by them.
689
+ */
690
+ export declare const mapThrough: (selection: Selection | null, steps: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>) => Selection | null;
691
+ export type TransactionResult = {
692
+ readonly ok: true;
693
+ readonly state: EditorState;
694
+ readonly changeSet: ChangeSet;
695
+ readonly positionMap: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>;
696
+ /**
697
+ * The transactions that produced `state`, in order, each normalized before the next:
698
+ * folding `apply` over them from the input state yields `state` again. A command can
699
+ * need more than one, and an action has at least one per command.
700
+ */
701
+ readonly transactions: ReadonlyArray<Transaction>;
702
+ } | {
703
+ readonly ok: false;
704
+ readonly error: 'InvalidInput' | 'MissingText' | 'MissingNode' | 'InvalidRange' | 'InvalidSelection' | 'InvalidParent' | 'ForbiddenMark' | 'UnexpectedChild' | 'UnstableNormalization';
705
+ };
706
+ /**
707
+ * Pure, atomic text transaction. Rejection returns no partially edited state.
708
+ * `transforms` defaults to the registry's shipped rules; a Kit's transforms
709
+ * arrive here when Kit support lands.
710
+ */
711
+ export declare const apply: (state: EditorState, transaction: Transaction, transforms?: ReadonlyArray<Transform>) => TransactionResult;
712
+ //# sourceMappingURL=transaction.d.ts.map