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
package/dist/index.d.mts DELETED
@@ -1,3787 +0,0 @@
1
- import { Schema } from "effect";
2
- /** Caller-assigned identity, unique across blocks and text runs in a document. */
3
- export declare const NodeId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
4
- export type NodeId = typeof NodeId.Type;
5
- /** The mark names this vocabulary defines; a document may hold others verbatim. */
6
- export declare const Mark: Schema.Literals<readonly ["Bold", "Italic", "Code"]>;
7
- export type Mark = typeof Mark.Type;
8
- /** A schema this version can hand to `decodeUnknownSync` at a Kit boundary. */
9
- type PropsSchema = Schema.Codec<any, any, never>;
10
- /**
11
- * A mark with props: which mark, plus the JSON data it carries. Props are JSON
12
- * here for the same reason a node's are: the document codec cannot know an
13
- * application's schemas, so a Kit validates them at that boundary (§12).
14
- */
15
- export declare const MarkValue: Schema.Struct<{
16
- readonly name: Schema.NonEmptyString;
17
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
18
- }>;
19
- export type MarkValue = typeof MarkValue.Type;
20
- /**
21
- * A mark as a text run stores it: a bare name for a mark with no props, or a
22
- * value when it has them. Loading preserves the form it found, so a names-only
23
- * document round-trips byte-equal, and because a run carries a name at most once
24
- * it never holds both forms of one mark.
25
- */
26
- export declare const RunMark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
27
- readonly name: Schema.NonEmptyString;
28
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
29
- }>]>;
30
- export type RunMark = typeof RunMark.Type;
31
- /** A mark's name: a bare string is a mark with no props, an object carries them. */
32
- export declare const markName: (mark: RunMark) => string;
33
- /**
34
- * The content a block holds: runs, or nested blocks (§13). A document does not
35
- * declare which a block kind accepts — its Kit does — so these are the words a
36
- * declaration and a migration both use.
37
- */
38
- export declare const textContent: 'text';
39
- export declare const blockContent: 'blocks';
40
- type ContentMode = typeof textContent | typeof blockContent;
41
- export declare const Text: Schema.Struct<{
42
- readonly type: Schema.Literal<"Text">;
43
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
44
- readonly text: Schema.String;
45
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
46
- readonly name: Schema.NonEmptyString;
47
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
48
- }>]>>;
49
- }>;
50
- export type Text = typeof Text.Type;
51
- export declare const Paragraph: Schema.Struct<{
52
- readonly type: Schema.Literal<"Paragraph">;
53
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
54
- readonly children: Schema.$Array<Schema.Struct<{
55
- readonly type: Schema.Literal<"Text">;
56
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
57
- readonly text: Schema.String;
58
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
59
- readonly name: Schema.NonEmptyString;
60
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
61
- }>]>>;
62
- }>>;
63
- }>;
64
- export type Paragraph = typeof Paragraph.Type;
65
- export declare const Heading: Schema.Struct<{
66
- readonly type: Schema.Literal<"Heading">;
67
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
68
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
69
- readonly children: Schema.$Array<Schema.Struct<{
70
- readonly type: Schema.Literal<"Text">;
71
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
72
- readonly text: Schema.String;
73
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
74
- readonly name: Schema.NonEmptyString;
75
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
76
- }>]>>;
77
- }>>;
78
- }>;
79
- export type Heading = typeof Heading.Type;
80
- /**
81
- * A block whose `type` this version does not implement, retained verbatim for
82
- * recovery and migration: the original type, its remaining JSON fields, and no
83
- * text runs (its subtree lives in `props`, opaque). Unknown blocks are
84
- * read-only content: address them structurally, never edit their text.
85
- */
86
- export declare const UnknownBlock: Schema.Struct<{
87
- readonly type: Schema.Literal<"Unknown">;
88
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
89
- readonly originalType: Schema.NonEmptyString;
90
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
91
- readonly children: Schema.$Array<Schema.Struct<{
92
- readonly type: Schema.Literal<"Text">;
93
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
94
- readonly text: Schema.String;
95
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
96
- readonly name: Schema.NonEmptyString;
97
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
98
- }>]>>;
99
- }>>;
100
- }>;
101
- export type UnknownBlock = typeof UnknownBlock.Type;
102
- /**
103
- * A block whose kind the application declares: a Callout, an Image, an embed.
104
- * `props` is JSON at the codec level because the document codec cannot know an
105
- * application's schemas; a Kit's node definition validates it at that boundary,
106
- * and runtime declarations stay outside the codec (§12). `children` are text
107
- * runs, so positions, operations, and selection work on it unchanged.
108
- *
109
- * `blocks` holds nested blocks, and its presence is what says the kind accepts
110
- * them (§116): a List holds ListItems, a Quote holds paragraphs. A kind with
111
- * nested blocks has no direct runs, which is why `children` stays `Text[]` on
112
- * every block kind — a container simply leaves it empty, as `UnknownBlock` does.
113
- *
114
- * The shape is written by hand because `Block` and this type are mutually
115
- * recursive, and TypeScript cannot infer through that cycle: the schema's
116
- * nested field names the interface, and the interface names the union.
117
- */
118
- export interface NodeBlock {
119
- readonly type: 'Node';
120
- readonly kind: string;
121
- readonly id: NodeId;
122
- readonly props: Schema.JsonObject;
123
- readonly children: ReadonlyArray<Text>;
124
- readonly blocks?: ReadonlyArray<Block>;
125
- }
126
- export declare const NodeBlock: Schema.Struct<{
127
- readonly type: Schema.Literal<"Node">;
128
- readonly kind: Schema.NonEmptyString;
129
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
130
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
131
- readonly children: Schema.$Array<Schema.Struct<{
132
- readonly type: Schema.Literal<"Text">;
133
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
134
- readonly text: Schema.String;
135
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
136
- readonly name: Schema.NonEmptyString;
137
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
138
- }>]>>;
139
- }>>;
140
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
141
- readonly type: 'Node';
142
- readonly kind: string;
143
- readonly id: string;
144
- readonly props: {
145
- 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;
146
- };
147
- readonly children: readonly {
148
- readonly type: "Text";
149
- readonly id: string;
150
- readonly text: string;
151
- readonly marks: readonly (string | {
152
- readonly name: string;
153
- readonly props?: {
154
- 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)[] | {
155
- 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;
156
- } | null;
157
- };
158
- })[];
159
- }[];
160
- readonly blocks?: readonly ( /*elided*/ any | {
161
- readonly type: "Paragraph";
162
- readonly id: string;
163
- readonly children: readonly {
164
- readonly type: "Text";
165
- readonly id: string;
166
- readonly text: string;
167
- readonly marks: readonly (string | {
168
- readonly name: string;
169
- readonly props?: {
170
- 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)[] | {
171
- 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;
172
- } | null;
173
- };
174
- })[];
175
- }[];
176
- } | {
177
- readonly type: "Heading";
178
- readonly id: string;
179
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
180
- readonly children: readonly {
181
- readonly type: "Text";
182
- readonly id: string;
183
- readonly text: string;
184
- readonly marks: readonly (string | {
185
- readonly name: string;
186
- readonly props?: {
187
- 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)[] | {
188
- 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;
189
- } | null;
190
- };
191
- })[];
192
- }[];
193
- } | {
194
- readonly type: "Unknown";
195
- readonly id: string;
196
- readonly originalType: 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
- readonly children: readonly {
203
- readonly type: "Text";
204
- readonly id: string;
205
- readonly text: string;
206
- readonly marks: readonly (string | {
207
- readonly name: 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
- })[];
214
- }[];
215
- })[];
216
- } | {
217
- readonly type: "Paragraph";
218
- readonly id: string;
219
- readonly children: readonly {
220
- readonly type: "Text";
221
- readonly id: string;
222
- readonly text: string;
223
- readonly marks: readonly (string | {
224
- readonly name: string;
225
- readonly props?: {
226
- 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)[] | {
227
- 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;
228
- } | null;
229
- };
230
- })[];
231
- }[];
232
- } | {
233
- readonly type: "Heading";
234
- readonly id: string;
235
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
236
- readonly children: readonly {
237
- readonly type: "Text";
238
- readonly id: string;
239
- readonly text: string;
240
- readonly marks: readonly (string | {
241
- readonly name: string;
242
- readonly props?: {
243
- 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)[] | {
244
- 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;
245
- } | null;
246
- };
247
- })[];
248
- }[];
249
- } | {
250
- readonly type: "Unknown";
251
- readonly id: string;
252
- readonly originalType: 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
- readonly children: readonly {
259
- readonly type: "Text";
260
- readonly id: string;
261
- readonly text: string;
262
- readonly marks: readonly (string | {
263
- readonly name: 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
- })[];
270
- }[];
271
- })[], never, never>>>;
272
- }>;
273
- export type Block = Paragraph | Heading | NodeBlock | UnknownBlock;
274
- export declare const Block: Schema.Union<readonly [Schema.Struct<{
275
- readonly type: Schema.Literal<"Paragraph">;
276
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
277
- readonly children: Schema.$Array<Schema.Struct<{
278
- readonly type: Schema.Literal<"Text">;
279
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
280
- readonly text: Schema.String;
281
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
282
- readonly name: Schema.NonEmptyString;
283
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
284
- }>]>>;
285
- }>>;
286
- }>, Schema.Struct<{
287
- readonly type: Schema.Literal<"Heading">;
288
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
289
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
290
- readonly children: Schema.$Array<Schema.Struct<{
291
- readonly type: Schema.Literal<"Text">;
292
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
293
- readonly text: Schema.String;
294
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
295
- readonly name: Schema.NonEmptyString;
296
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
297
- }>]>>;
298
- }>>;
299
- }>, Schema.Struct<{
300
- readonly type: Schema.Literal<"Node">;
301
- readonly kind: Schema.NonEmptyString;
302
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
303
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
304
- readonly children: Schema.$Array<Schema.Struct<{
305
- readonly type: Schema.Literal<"Text">;
306
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
307
- readonly text: Schema.String;
308
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
309
- readonly name: Schema.NonEmptyString;
310
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
311
- }>]>>;
312
- }>>;
313
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
314
- readonly type: 'Node';
315
- readonly kind: string;
316
- readonly id: string;
317
- readonly props: {
318
- 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;
319
- };
320
- readonly children: readonly {
321
- readonly type: "Text";
322
- readonly id: string;
323
- readonly text: string;
324
- readonly marks: readonly (string | {
325
- readonly name: string;
326
- readonly props?: {
327
- 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)[] | {
328
- 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;
329
- } | null;
330
- };
331
- })[];
332
- }[];
333
- readonly blocks?: readonly ( /*elided*/ any | {
334
- readonly type: "Paragraph";
335
- readonly id: string;
336
- readonly children: readonly {
337
- readonly type: "Text";
338
- readonly id: string;
339
- readonly text: string;
340
- readonly marks: readonly (string | {
341
- readonly name: string;
342
- readonly props?: {
343
- 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)[] | {
344
- 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;
345
- } | null;
346
- };
347
- })[];
348
- }[];
349
- } | {
350
- readonly type: "Heading";
351
- readonly id: string;
352
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
353
- readonly children: readonly {
354
- readonly type: "Text";
355
- readonly id: string;
356
- readonly text: string;
357
- readonly marks: readonly (string | {
358
- readonly name: string;
359
- readonly props?: {
360
- 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)[] | {
361
- 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;
362
- } | null;
363
- };
364
- })[];
365
- }[];
366
- } | {
367
- readonly type: "Unknown";
368
- readonly id: string;
369
- readonly originalType: string;
370
- readonly props: {
371
- 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)[] | {
372
- 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;
373
- } | null;
374
- };
375
- readonly children: readonly {
376
- readonly type: "Text";
377
- readonly id: string;
378
- readonly text: string;
379
- readonly marks: readonly (string | {
380
- readonly name: string;
381
- readonly props?: {
382
- 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)[] | {
383
- 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;
384
- } | null;
385
- };
386
- })[];
387
- }[];
388
- })[];
389
- } | {
390
- readonly type: "Paragraph";
391
- readonly id: string;
392
- readonly children: readonly {
393
- readonly type: "Text";
394
- readonly id: string;
395
- readonly text: string;
396
- readonly marks: readonly (string | {
397
- readonly name: string;
398
- readonly props?: {
399
- 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)[] | {
400
- 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;
401
- } | null;
402
- };
403
- })[];
404
- }[];
405
- } | {
406
- readonly type: "Heading";
407
- readonly id: string;
408
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
409
- readonly children: readonly {
410
- readonly type: "Text";
411
- readonly id: string;
412
- readonly text: string;
413
- readonly marks: readonly (string | {
414
- readonly name: string;
415
- readonly props?: {
416
- 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)[] | {
417
- 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;
418
- } | null;
419
- };
420
- })[];
421
- }[];
422
- } | {
423
- readonly type: "Unknown";
424
- readonly id: string;
425
- readonly originalType: string;
426
- readonly props: {
427
- 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)[] | {
428
- 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;
429
- } | null;
430
- };
431
- readonly children: readonly {
432
- readonly type: "Text";
433
- readonly id: string;
434
- readonly text: string;
435
- readonly marks: readonly (string | {
436
- readonly name: string;
437
- readonly props?: {
438
- 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)[] | {
439
- 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;
440
- } | null;
441
- };
442
- })[];
443
- }[];
444
- })[], never, never>>>;
445
- }>, Schema.Struct<{
446
- readonly type: Schema.Literal<"Unknown">;
447
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
448
- readonly originalType: Schema.NonEmptyString;
449
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
450
- readonly children: Schema.$Array<Schema.Struct<{
451
- readonly type: Schema.Literal<"Text">;
452
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
453
- readonly text: Schema.String;
454
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
455
- readonly name: Schema.NonEmptyString;
456
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
457
- }>]>>;
458
- }>>;
459
- }>]>;
460
- /** Version 1's initial block vocabulary, with document-wide identity validation. */
461
- export declare const Document: Schema.Struct<{
462
- readonly version: Schema.Literal<1>;
463
- readonly children: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
464
- readonly type: Schema.Literal<"Paragraph">;
465
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
466
- readonly children: Schema.$Array<Schema.Struct<{
467
- readonly type: Schema.Literal<"Text">;
468
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
469
- readonly text: Schema.String;
470
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
471
- readonly name: Schema.NonEmptyString;
472
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
473
- }>]>>;
474
- }>>;
475
- }>, Schema.Struct<{
476
- readonly type: Schema.Literal<"Heading">;
477
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
478
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
479
- readonly children: Schema.$Array<Schema.Struct<{
480
- readonly type: Schema.Literal<"Text">;
481
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
482
- readonly text: Schema.String;
483
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
484
- readonly name: Schema.NonEmptyString;
485
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
486
- }>]>>;
487
- }>>;
488
- }>, Schema.Struct<{
489
- readonly type: Schema.Literal<"Node">;
490
- readonly kind: Schema.NonEmptyString;
491
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
492
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
493
- readonly children: Schema.$Array<Schema.Struct<{
494
- readonly type: Schema.Literal<"Text">;
495
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
496
- readonly text: Schema.String;
497
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
498
- readonly name: Schema.NonEmptyString;
499
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
500
- }>]>>;
501
- }>>;
502
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
503
- readonly type: 'Node';
504
- readonly kind: string;
505
- readonly id: string;
506
- readonly props: {
507
- 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;
508
- };
509
- readonly children: readonly {
510
- readonly type: "Text";
511
- readonly id: string;
512
- readonly text: string;
513
- readonly marks: readonly (string | {
514
- readonly name: string;
515
- readonly props?: {
516
- 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)[] | {
517
- 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;
518
- } | null;
519
- };
520
- })[];
521
- }[];
522
- readonly blocks?: readonly ( /*elided*/ any | {
523
- readonly type: "Paragraph";
524
- readonly id: string;
525
- readonly children: readonly {
526
- readonly type: "Text";
527
- readonly id: string;
528
- readonly text: string;
529
- readonly marks: readonly (string | {
530
- readonly name: string;
531
- readonly props?: {
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)[] | {
533
- 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;
534
- } | null;
535
- };
536
- })[];
537
- }[];
538
- } | {
539
- readonly type: "Heading";
540
- readonly id: string;
541
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
542
- readonly children: readonly {
543
- readonly type: "Text";
544
- readonly id: string;
545
- readonly text: string;
546
- readonly marks: readonly (string | {
547
- readonly name: string;
548
- readonly props?: {
549
- 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)[] | {
550
- 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;
551
- } | null;
552
- };
553
- })[];
554
- }[];
555
- } | {
556
- readonly type: "Unknown";
557
- readonly id: string;
558
- readonly originalType: string;
559
- readonly props: {
560
- 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)[] | {
561
- 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;
562
- } | null;
563
- };
564
- readonly children: readonly {
565
- readonly type: "Text";
566
- readonly id: string;
567
- readonly text: string;
568
- readonly marks: readonly (string | {
569
- readonly name: string;
570
- readonly props?: {
571
- 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)[] | {
572
- 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;
573
- } | null;
574
- };
575
- })[];
576
- }[];
577
- })[];
578
- } | {
579
- readonly type: "Paragraph";
580
- readonly id: string;
581
- readonly children: readonly {
582
- readonly type: "Text";
583
- readonly id: string;
584
- readonly text: string;
585
- readonly marks: readonly (string | {
586
- readonly name: string;
587
- readonly props?: {
588
- 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)[] | {
589
- 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;
590
- } | null;
591
- };
592
- })[];
593
- }[];
594
- } | {
595
- readonly type: "Heading";
596
- readonly id: string;
597
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
598
- readonly children: readonly {
599
- readonly type: "Text";
600
- readonly id: string;
601
- readonly text: string;
602
- readonly marks: readonly (string | {
603
- readonly name: string;
604
- readonly props?: {
605
- 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)[] | {
606
- 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;
607
- } | null;
608
- };
609
- })[];
610
- }[];
611
- } | {
612
- readonly type: "Unknown";
613
- readonly id: string;
614
- readonly originalType: string;
615
- readonly props: {
616
- 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)[] | {
617
- 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;
618
- } | null;
619
- };
620
- readonly children: readonly {
621
- readonly type: "Text";
622
- readonly id: string;
623
- readonly text: string;
624
- readonly marks: readonly (string | {
625
- readonly name: string;
626
- readonly props?: {
627
- 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)[] | {
628
- 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;
629
- } | null;
630
- };
631
- })[];
632
- }[];
633
- })[], never, never>>>;
634
- }>, Schema.Struct<{
635
- readonly type: Schema.Literal<"Unknown">;
636
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
637
- readonly originalType: Schema.NonEmptyString;
638
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
639
- readonly children: Schema.$Array<Schema.Struct<{
640
- readonly type: Schema.Literal<"Text">;
641
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
642
- readonly text: Schema.String;
643
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
644
- readonly name: Schema.NonEmptyString;
645
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
646
- }>]>>;
647
- }>>;
648
- }>]>>;
649
- }>;
650
- export type Document = typeof Document.Type;
651
- /** Bounds for decoded documents: blocks, text runs, and total UTF-16 text units. */
652
- export declare const DocumentLimits: Schema.Struct<{
653
- readonly maxBlocks: Schema.Number;
654
- readonly maxTextRuns: Schema.Number;
655
- readonly maxTextLength: Schema.Number;
656
- }>;
657
- export type DocumentLimits = typeof DocumentLimits.Type;
658
- /** Generous DoS guardrails, not application quotas; tighten per document with a spread. */
659
- export declare const DefaultDocumentLimits: DocumentLimits;
660
- /**
661
- * Strict boundary for persisted content. Decodes structure first, then enforces
662
- * `limits`. Throws a Schema error on invalid input, or an Error naming the
663
- * first exceeded bound.
664
- */
665
- export declare const decodeDocument: (input: unknown, limits?: DocumentLimits) => Document;
666
- /**
667
- * A block's address: root-first container indices. `[2]` is the third top-level
668
- * block, `[2, 0]` is the first block nested inside it (§116). A block's depth is
669
- * its path's length.
670
- */
671
- type BlockPath = ReadonlyArray<number>;
672
- /** Walks every block subtree in document order, visiting each with its path. */
673
- export declare const eachBlock: (blocks: ReadonlyArray<Block>, visit: (block: Block, path: BlockPath) => void, prefix?: BlockPath) => void;
674
- /** A run's place in document order: its block's path, then its index in that block. */
675
- interface RunPlace {
676
- readonly path: BlockPath;
677
- readonly index: number;
678
- }
679
- /** A run with the identity it was found by. */
680
- interface LocatedRun extends RunPlace {
681
- readonly run: Text;
682
- }
683
- /** The block a path addresses, or undefined when the path does not resolve. */
684
- export declare const blockAtPath: (document: Document, path: BlockPath) => Block | undefined;
685
- /** The block with this identity, wherever it sits. */
686
- export declare const locateBlock: (document: Document, node: NodeId) => {
687
- readonly path: BlockPath;
688
- readonly block: Block;
689
- } | undefined;
690
- /**
691
- * The blocks either side of a block in its own container, which a handle's up and down move it
692
- * past; both absent when the document does not hold it.
693
- */
694
- export declare const siblingsOf: (document: Document, node: NodeId) => {
695
- readonly previous?: Block | undefined;
696
- readonly next?: Block | undefined;
697
- };
698
- /** The run with this identity, wherever it sits. */
699
- export declare const locateRun: (document: Document, node: NodeId) => LocatedRun | undefined;
700
- /**
701
- * Whether a reader would see nothing: no blocks, or a lone paragraph or heading whose runs
702
- * hold no text. What an editor shows its placeholder for; a lone empty list or code block is
703
- * content a writer made, so it is not blank.
704
- */
705
- export declare const isBlank: (document: Document) => boolean;
706
- /**
707
- * The text of the block a position addresses, up to that position, in run order.
708
- * A menu reads this: what a query is typed into is the block's text between its
709
- * start and the caret, and a query never spans blocks. Affinity is not consulted — a
710
- * prefix ends between characters whatever side the caret leans to — an offset past a
711
- * run's end clamps to it, a negative one reads as none of it, and a position that
712
- * resolves to nothing gives an empty string.
713
- */
714
- export declare const textBefore: (document: Document, position: Position) => string;
715
- /**
716
- * Whichever end of a range comes first in the document, whatever direction it was made in,
717
- * or `undefined` when either end does not resolve. What replaces a range starts here, so a
718
- * read of the text before an edit reads from this end rather than the anchor.
719
- */
720
- export declare const rangeStart: (document: Document, range: Extract<Selection, {
721
- readonly type: 'Range';
722
- }>) => Position | undefined;
723
- /**
724
- * The position a block's text offset addresses, or `undefined` when it is negative or past
725
- * the end. The inverse of `textBefore` for one block: a rule, a search match, or any producer
726
- * working in a block's own text needs it to say where what it found is.
727
- */
728
- export declare const positionInBlock: (block: Block, offset: number) => Position | undefined;
729
- /**
730
- * The range covering the `length` characters before `position` in its block, or
731
- * `undefined` when the position does not resolve, `length` is not positive, or fewer
732
- * characters precede it. The inverse of `textBefore`: an input rule or a menu deletes
733
- * what it matched with this range, so removing the match and acting on it commit as one
734
- * action (§124 §5). Endpoints land at run boundaries with `after` affinity, which is
735
- * where a caret that typed that character would sit.
736
- */
737
- export declare const textRangeBefore: (document: Document, position: Position, length: number) => Selection | undefined;
738
- /** A mark this vocabulary does not define, kept verbatim on its text run. */
739
- interface UnknownMark {
740
- readonly node: NodeId;
741
- /** The mark's name; its props, if any, stay on the run. */
742
- readonly mark: string;
743
- }
744
- /** Lists unknown marks per text run; empty means the document publishes cleanly. */
745
- export declare const findUnknownMarks: (document: Document) => ReadonlyArray<UnknownMark>;
746
- /** A block this vocabulary does not implement, retained for migration. */
747
- interface UnknownNode {
748
- readonly node: NodeId;
749
- readonly originalType: string;
750
- }
751
- /** Lists preserved unknown blocks; empty means the document publishes cleanly. */
752
- export declare const findUnknownNodes: (document: Document) => ReadonlyArray<UnknownNode>;
753
- /** UTF-16 offset in one text run, with insertion affinity at that offset. */
754
- export declare const Position: Schema.Struct<{
755
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
756
- readonly offset: Schema.Number;
757
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
758
- }>;
759
- export type Position = typeof Position.Type;
760
- /** A reusable identity resolved against an explicit document, without owning its content. */
761
- interface NodeReference {
762
- readonly id: NodeId;
763
- /** Returns the current node, or undefined if this document does not contain it. */
764
- readonly read: (document: Document) => Block | Text | undefined;
765
- /** Describes a text position; application of an edit checks the target and bounds. */
766
- readonly at: (offset: number, affinity: Position['affinity']) => Position;
767
- }
768
- export declare const Node: {
769
- /** Declares an immutable reference. Does not insert a node or reserve its ID. */
770
- make: (id: string) => NodeReference;
771
- };
772
- export declare const Selection: Schema.Union<readonly [Schema.Struct<{
773
- readonly type: Schema.Literal<"Range">;
774
- readonly anchor: Schema.Struct<{
775
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
776
- readonly offset: Schema.Number;
777
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
778
- }>;
779
- readonly focus: Schema.Struct<{
780
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
781
- readonly offset: Schema.Number;
782
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
783
- }>;
784
- }>, Schema.Struct<{
785
- readonly type: Schema.Literal<"Node">;
786
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
787
- }>]>;
788
- export type Selection = typeof Selection.Type;
789
- /** Validates references without sorting range endpoints or changing direction. */
790
- export declare const selectionIsValid: (document: Document, selection: Selection | null) => boolean;
791
- export declare const EditorState: Schema.Struct<{
792
- readonly document: Schema.Struct<{
793
- readonly version: Schema.Literal<1>;
794
- readonly children: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
795
- readonly type: Schema.Literal<"Paragraph">;
796
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
797
- readonly children: Schema.$Array<Schema.Struct<{
798
- readonly type: Schema.Literal<"Text">;
799
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
800
- readonly text: Schema.String;
801
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
802
- readonly name: Schema.NonEmptyString;
803
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
804
- }>]>>;
805
- }>>;
806
- }>, Schema.Struct<{
807
- readonly type: Schema.Literal<"Heading">;
808
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
809
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
810
- readonly children: Schema.$Array<Schema.Struct<{
811
- readonly type: Schema.Literal<"Text">;
812
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
813
- readonly text: Schema.String;
814
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
815
- readonly name: Schema.NonEmptyString;
816
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
817
- }>]>>;
818
- }>>;
819
- }>, Schema.Struct<{
820
- readonly type: Schema.Literal<"Node">;
821
- readonly kind: Schema.NonEmptyString;
822
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
823
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
824
- readonly children: Schema.$Array<Schema.Struct<{
825
- readonly type: Schema.Literal<"Text">;
826
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
827
- readonly text: Schema.String;
828
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
829
- readonly name: Schema.NonEmptyString;
830
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
831
- }>]>>;
832
- }>>;
833
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
834
- readonly type: 'Node';
835
- readonly kind: string;
836
- readonly id: string;
837
- readonly props: {
838
- 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;
839
- };
840
- readonly children: readonly {
841
- readonly type: "Text";
842
- readonly id: string;
843
- readonly text: string;
844
- readonly marks: readonly (string | {
845
- readonly name: string;
846
- readonly props?: {
847
- 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)[] | {
848
- 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;
849
- } | null;
850
- };
851
- })[];
852
- }[];
853
- readonly blocks?: readonly ( /*elided*/ any | {
854
- readonly type: "Paragraph";
855
- readonly id: string;
856
- readonly children: readonly {
857
- readonly type: "Text";
858
- readonly id: string;
859
- readonly text: string;
860
- readonly marks: readonly (string | {
861
- readonly name: string;
862
- readonly props?: {
863
- 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)[] | {
864
- 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;
865
- } | null;
866
- };
867
- })[];
868
- }[];
869
- } | {
870
- readonly type: "Heading";
871
- readonly id: string;
872
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
873
- readonly children: readonly {
874
- readonly type: "Text";
875
- readonly id: string;
876
- readonly text: string;
877
- readonly marks: readonly (string | {
878
- readonly name: string;
879
- readonly props?: {
880
- 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)[] | {
881
- 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;
882
- } | null;
883
- };
884
- })[];
885
- }[];
886
- } | {
887
- readonly type: "Unknown";
888
- readonly id: string;
889
- readonly originalType: string;
890
- readonly props: {
891
- 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)[] | {
892
- 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;
893
- } | null;
894
- };
895
- readonly children: readonly {
896
- readonly type: "Text";
897
- readonly id: string;
898
- readonly text: string;
899
- readonly marks: readonly (string | {
900
- readonly name: string;
901
- readonly props?: {
902
- 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)[] | {
903
- 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;
904
- } | null;
905
- };
906
- })[];
907
- }[];
908
- })[];
909
- } | {
910
- readonly type: "Paragraph";
911
- readonly id: string;
912
- readonly children: readonly {
913
- readonly type: "Text";
914
- readonly id: string;
915
- readonly text: string;
916
- readonly marks: readonly (string | {
917
- readonly name: string;
918
- readonly props?: {
919
- 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)[] | {
920
- 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;
921
- } | null;
922
- };
923
- })[];
924
- }[];
925
- } | {
926
- readonly type: "Heading";
927
- readonly id: string;
928
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
929
- readonly children: readonly {
930
- readonly type: "Text";
931
- readonly id: string;
932
- readonly text: string;
933
- readonly marks: readonly (string | {
934
- readonly name: string;
935
- readonly props?: {
936
- 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)[] | {
937
- 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;
938
- } | null;
939
- };
940
- })[];
941
- }[];
942
- } | {
943
- readonly type: "Unknown";
944
- readonly id: string;
945
- readonly originalType: string;
946
- readonly props: {
947
- 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)[] | {
948
- 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;
949
- } | null;
950
- };
951
- readonly children: readonly {
952
- readonly type: "Text";
953
- readonly id: string;
954
- readonly text: string;
955
- readonly marks: readonly (string | {
956
- readonly name: string;
957
- readonly props?: {
958
- 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)[] | {
959
- 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;
960
- } | null;
961
- };
962
- })[];
963
- }[];
964
- })[], never, never>>>;
965
- }>, Schema.Struct<{
966
- readonly type: Schema.Literal<"Unknown">;
967
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
968
- readonly originalType: Schema.NonEmptyString;
969
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
970
- readonly children: Schema.$Array<Schema.Struct<{
971
- readonly type: Schema.Literal<"Text">;
972
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
973
- readonly text: Schema.String;
974
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
975
- readonly name: Schema.NonEmptyString;
976
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
977
- }>]>>;
978
- }>>;
979
- }>]>>;
980
- }>;
981
- readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
982
- readonly type: Schema.Literal<"Range">;
983
- readonly anchor: Schema.Struct<{
984
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
985
- readonly offset: Schema.Number;
986
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
987
- }>;
988
- readonly focus: Schema.Struct<{
989
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
990
- readonly offset: Schema.Number;
991
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
992
- }>;
993
- }>, Schema.Struct<{
994
- readonly type: Schema.Literal<"Node">;
995
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
996
- }>]>>;
997
- }>;
998
- export type EditorState = typeof EditorState.Type;
999
- /**
1000
- * Counts semantic nodes and UTF-16 text units, and reports nesting depth. Depth
1001
- * counts levels of content: an empty document is 0, blocks are 1, runs inside a
1002
- * block are 2, and a block nested inside a block adds a level (§116).
1003
- */
1004
- export declare const inspect: (document: Document) => {
1005
- nodeCount: number;
1006
- textLength: number;
1007
- depth: number;
1008
- };
1009
- /**
1010
- * What a reader would count: words and user-perceived characters, as `Intl.Segmenter` splits
1011
- * them in the default locale, so a word in a script without spaces still counts. Runs are
1012
- * joined within a block, so a word that changes mark midway is one word, and blocks never
1013
- * join, so the last word of one block and the first of the next are two.
1014
- */
1015
- export declare const count: (document: Document) => {
1016
- words: number;
1017
- characters: number;
1018
- };
1019
- /** Which edges a mark continues across when typing at a run boundary. */
1020
- type MarkExpansion = 'before' | 'after' | 'both' | 'none';
1021
- /**
1022
- * A mark definition: its name, where it continues across a boundary, and the
1023
- * schema its props must satisfy when it has any. A Kit declares the vocabulary
1024
- * an editor accepts, so an application can say that its own mark behaves like a
1025
- * link (nothing expands, an `href` prop) or like bold (it continues).
1026
- */
1027
- interface MarkDef<Props extends PropsSchema | undefined = PropsSchema | undefined> {
1028
- readonly name: string;
1029
- readonly expand: MarkExpansion;
1030
- /** Validates a mark value's props at the Kit boundary, not in the codec. */
1031
- readonly Props: Props;
1032
- /** Encodes decoded props into the JSON value stored on a text run. */
1033
- readonly of: Props extends Schema.Codec<infer A, any, any> ? (props: A) => MarkValue : () => MarkValue;
1034
- }
1035
- /**
1036
- * Declares a mark. Expansion defaults to `both`: the conservative choice for a
1037
- * name no policy knows. A definition with `Props` gets an `of` that builds the
1038
- * value; a definition without props builds a value that carries only its name.
1039
- */
1040
- export declare const mark: <Props extends PropsSchema | undefined = undefined>(name: string, options?: {
1041
- readonly Props?: Props;
1042
- readonly expand?: MarkExpansion;
1043
- }) => MarkDef<Props>;
1044
- export declare const Bold: MarkDef;
1045
- export declare const Italic: MarkDef;
1046
- export declare const Code: MarkDef;
1047
- /** The marks this vocabulary defines, and the policy a document without a Kit gets. */
1048
- export declare const shippedMarks: ReadonlyArray<MarkDef>;
1049
- /**
1050
- * The expansion policy of a set of definitions, and which names it declares. A
1051
- * mark the registry does not declare expands both ways: preservation never
1052
- * retargets it away. Declared names are what an edit may add.
1053
- */
1054
- interface MarkRegistry {
1055
- readonly expansionOf: (name: string) => MarkExpansion;
1056
- readonly declares: (name: string) => boolean;
1057
- /** Whether an edit may add this mark: its name is declared and its props decode. */
1058
- readonly accepts: (mark: RunMark) => boolean;
1059
- }
1060
- export declare const markRegistry: (definitions: ReadonlyArray<MarkDef>) => MarkRegistry;
1061
- /** The policy of the shipped vocabulary. */
1062
- export declare const shippedRegistry: MarkRegistry;
1063
- /** A mark's props, or undefined when it carries none. */
1064
- export declare const markProps: (mark: RunMark) => MarkValue['props'] | undefined;
1065
- /**
1066
- * Whether two marks are the same mark with the same props. This is the
1067
- * equivalence normalization merges on, so props compare structurally and key
1068
- * order does not matter.
1069
- */
1070
- export declare const sameMark: (left: RunMark, right: RunMark) => boolean;
1071
- /** Order-insensitive mark-set equality; a run carries a name at most once. */
1072
- export declare const sameMarkSet: (left: ReadonlyArray<RunMark>, right: ReadonlyArray<RunMark>) => boolean;
1073
- /**
1074
- * Retargets a boundary insertion to the neighboring run when the current run
1075
- * carries marks that forbid the edge and the neighbor carries exactly the
1076
- * marks that remain. Interior positions, missing neighbors, and mismatched
1077
- * neighbors return the input reference unchanged; unknown node ids are left
1078
- * for `apply` to diagnose. Never invents runs: mixed-mark edges stay put.
1079
- */
1080
- export declare const resolveInsertion: (document: Document, position: Position, registry?: MarkRegistry) => Position;
1081
- /**
1082
- * Clipboard content is semantic, not HTML (§69). A slice is a versioned,
1083
- * identity-carrying fragment of a document: it round-trips through an
1084
- * application's own format, and a paste mints fresh identities so nothing
1085
- * collides with the document it lands in. HTML and plain text are interchange
1086
- * fallbacks the adapter adds; they are not the slice.
1087
- */
1088
- export declare const Slice: Schema.Struct<{
1089
- readonly version: Schema.Literal<1>;
1090
- readonly blocks: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
1091
- readonly type: Schema.Literal<"Paragraph">;
1092
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1093
- readonly children: Schema.$Array<Schema.Struct<{
1094
- readonly type: Schema.Literal<"Text">;
1095
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1096
- readonly text: Schema.String;
1097
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1098
- readonly name: Schema.NonEmptyString;
1099
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1100
- }>]>>;
1101
- }>>;
1102
- }>, Schema.Struct<{
1103
- readonly type: Schema.Literal<"Heading">;
1104
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1105
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1106
- readonly children: Schema.$Array<Schema.Struct<{
1107
- readonly type: Schema.Literal<"Text">;
1108
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1109
- readonly text: Schema.String;
1110
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1111
- readonly name: Schema.NonEmptyString;
1112
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1113
- }>]>>;
1114
- }>>;
1115
- }>, Schema.Struct<{
1116
- readonly type: Schema.Literal<"Node">;
1117
- readonly kind: Schema.NonEmptyString;
1118
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1119
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1120
- readonly children: Schema.$Array<Schema.Struct<{
1121
- readonly type: Schema.Literal<"Text">;
1122
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1123
- readonly text: Schema.String;
1124
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1125
- readonly name: Schema.NonEmptyString;
1126
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1127
- }>]>>;
1128
- }>>;
1129
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
1130
- readonly type: 'Node';
1131
- readonly kind: string;
1132
- readonly id: string;
1133
- readonly props: {
1134
- 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;
1135
- };
1136
- readonly children: readonly {
1137
- readonly type: "Text";
1138
- readonly id: string;
1139
- readonly text: string;
1140
- readonly marks: readonly (string | {
1141
- readonly name: string;
1142
- readonly props?: {
1143
- 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)[] | {
1144
- 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;
1145
- } | null;
1146
- };
1147
- })[];
1148
- }[];
1149
- readonly blocks?: readonly ( /*elided*/ any | {
1150
- readonly type: "Paragraph";
1151
- readonly id: string;
1152
- readonly children: readonly {
1153
- readonly type: "Text";
1154
- readonly id: string;
1155
- readonly text: string;
1156
- readonly marks: readonly (string | {
1157
- readonly name: string;
1158
- readonly props?: {
1159
- 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)[] | {
1160
- 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;
1161
- } | null;
1162
- };
1163
- })[];
1164
- }[];
1165
- } | {
1166
- readonly type: "Heading";
1167
- readonly id: string;
1168
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
1169
- readonly children: readonly {
1170
- readonly type: "Text";
1171
- readonly id: string;
1172
- readonly text: string;
1173
- readonly marks: readonly (string | {
1174
- readonly name: string;
1175
- readonly props?: {
1176
- 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)[] | {
1177
- 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;
1178
- } | null;
1179
- };
1180
- })[];
1181
- }[];
1182
- } | {
1183
- readonly type: "Unknown";
1184
- readonly id: string;
1185
- readonly originalType: string;
1186
- readonly props: {
1187
- 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)[] | {
1188
- 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;
1189
- } | null;
1190
- };
1191
- readonly children: readonly {
1192
- readonly type: "Text";
1193
- readonly id: string;
1194
- readonly text: string;
1195
- readonly marks: readonly (string | {
1196
- readonly name: string;
1197
- readonly props?: {
1198
- 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)[] | {
1199
- 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;
1200
- } | null;
1201
- };
1202
- })[];
1203
- }[];
1204
- })[];
1205
- } | {
1206
- readonly type: "Paragraph";
1207
- readonly id: string;
1208
- readonly children: readonly {
1209
- readonly type: "Text";
1210
- readonly id: string;
1211
- readonly text: string;
1212
- readonly marks: readonly (string | {
1213
- readonly name: string;
1214
- readonly props?: {
1215
- 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)[] | {
1216
- 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;
1217
- } | null;
1218
- };
1219
- })[];
1220
- }[];
1221
- } | {
1222
- readonly type: "Heading";
1223
- readonly id: string;
1224
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
1225
- readonly children: readonly {
1226
- readonly type: "Text";
1227
- readonly id: string;
1228
- readonly text: string;
1229
- readonly marks: readonly (string | {
1230
- readonly name: string;
1231
- readonly props?: {
1232
- 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)[] | {
1233
- 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;
1234
- } | null;
1235
- };
1236
- })[];
1237
- }[];
1238
- } | {
1239
- readonly type: "Unknown";
1240
- readonly id: string;
1241
- readonly originalType: string;
1242
- readonly props: {
1243
- 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)[] | {
1244
- 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;
1245
- } | null;
1246
- };
1247
- readonly children: readonly {
1248
- readonly type: "Text";
1249
- readonly id: string;
1250
- readonly text: string;
1251
- readonly marks: readonly (string | {
1252
- readonly name: string;
1253
- readonly props?: {
1254
- 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)[] | {
1255
- 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;
1256
- } | null;
1257
- };
1258
- })[];
1259
- }[];
1260
- })[], never, never>>>;
1261
- }>, Schema.Struct<{
1262
- readonly type: Schema.Literal<"Unknown">;
1263
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1264
- readonly originalType: Schema.NonEmptyString;
1265
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1266
- readonly children: Schema.$Array<Schema.Struct<{
1267
- readonly type: Schema.Literal<"Text">;
1268
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1269
- readonly text: Schema.String;
1270
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1271
- readonly name: Schema.NonEmptyString;
1272
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1273
- }>]>>;
1274
- }>>;
1275
- }>]>>;
1276
- }>;
1277
- export type Slice = typeof Slice.Type;
1278
- export declare const emptySlice: Slice;
1279
- /**
1280
- * The semantic content a copy would take: a whole block for a node selection,
1281
- * and for a range only the covered part of what it reaches, with runs trimmed to
1282
- * the selection. Blocks the range never enters are left out, so a partial copy
1283
- * never drags a paragraph along.
1284
- */
1285
- export declare const sliceOf: (document: Document, selection: Selection | null) => Slice | undefined;
1286
- /**
1287
- * Plain text of a slice, one line per text block. A slice and a block list have
1288
- * the same shape, so the serializer's walk serves both.
1289
- */
1290
- export declare const plainTextOf: (slice: Slice) => string;
1291
- /**
1292
- * A slice from pasted plain text: one paragraph per line. Identities come from
1293
- * the caller, like every other identity a live edit mints.
1294
- */
1295
- export declare const sliceFromText: (text: string, mint: () => string) => Slice;
1296
- /** The same content under fresh identities, so a paste can never collide. */
1297
- export declare const withFreshIds: (slice: Slice, mint: () => string) => Slice;
1298
- /** Encodes a slice for the clipboard. */
1299
- export declare const serializeSlice: (slice: Slice) => string;
1300
- /** Decodes a slice, or undefined when the payload is not one this version wrote. */
1301
- export declare const deserializeSlice: (input: unknown) => Slice | undefined;
1302
- /** Whether a kind's runs may carry formatting marks; `all` unless declared otherwise. */
1303
- type MarksPolicy = 'all' | 'none';
1304
- /**
1305
- * Block content that accepts only the named kinds, so a `List` can declare that its
1306
- * children are `ListItem`s and `validate` can report one that is not (§13, §125).
1307
- */
1308
- interface BlockConstraint {
1309
- readonly mode: typeof blockContent;
1310
- readonly of: ReadonlyArray<string>;
1311
- }
1312
- /** Declares that a node holds nested blocks, only of the named kinds. */
1313
- export declare const blocksOf: (...kinds: ReadonlyArray<string>) => BlockConstraint;
1314
- /** A kind's declared content: a mode, or block content restricted to named kinds. */
1315
- type ChildrenDeclaration = ContentMode | BlockConstraint;
1316
- /**
1317
- * The node shapes this version can declare: a `block` is one of the built-in
1318
- * text blocks, an `atom` is an addressable node holding nothing (with optional
1319
- * props), and an application `node` holds runs or nested blocks plus props its own
1320
- * schema validates (§13).
1321
- */
1322
- type NodeDefinition = {
1323
- readonly name: string;
1324
- readonly kind: 'block';
1325
- readonly children: 'text';
1326
- } | {
1327
- readonly name: string;
1328
- readonly kind: 'atom';
1329
- readonly children: 'none';
1330
- /** An atom's props decode at this boundary too, so an `Image` carries a source. */
1331
- readonly props?: PropsSchema | undefined;
1332
- } | {
1333
- readonly name: string;
1334
- readonly kind: 'node';
1335
- /** `textContent` holds runs; `blockContent` or `blocksOf(…)` holds nested blocks. */
1336
- readonly children: ChildrenDeclaration;
1337
- /** `none` forbids marks on this kind's runs, as a `CodeBlock` needs. */
1338
- readonly marks: MarksPolicy;
1339
- /** Validates a `Node` block's `props` at this boundary, not in the codec. */
1340
- readonly props?: PropsSchema | undefined;
1341
- /**
1342
- * A boundary a lift never crosses: a table cell's content stays in the cell, where a
1343
- * quote's or a list item's would be lifted out.
1344
- */
1345
- readonly isolating?: boolean | undefined;
1346
- /** Props a copy split off this node starts with, over the original's (§135). */
1347
- readonly splitProps?: NodeBlock['props'] | undefined;
1348
- /**
1349
- * The kinds this one may stand in (§149); absent, any that holds it. A kind that names
1350
- * them never stands at the top level, as a `ListItem` stands only in a `List`.
1351
- */
1352
- readonly within?: ReadonlyArray<string> | undefined;
1353
- /** Its text keeps line breaks: Enter inserts one rather than splitting, as in code. */
1354
- readonly lineBreaks?: boolean | undefined;
1355
- /** Tab indents its lines, and a new line starts as indented as the last, as in code. */
1356
- readonly indents?: boolean | undefined;
1357
- };
1358
- /**
1359
- * A declared application node, with the caller's name, prop schema, and content
1360
- * mode kept in the type: the erasure to `any` happens only where heterogeneous
1361
- * definitions are collected, not at the authoring call.
1362
- */
1363
- interface NodeDefinitionOf<Name extends string, Props extends PropsSchema | undefined, Children extends ChildrenDeclaration = typeof textContent> {
1364
- readonly name: Name;
1365
- readonly kind: 'node';
1366
- readonly children: Children;
1367
- readonly marks: MarksPolicy;
1368
- readonly props: Props;
1369
- readonly isolating: boolean;
1370
- readonly splitProps: NodeBlock['props'] | undefined;
1371
- readonly within: ReadonlyArray<string> | undefined;
1372
- readonly lineBreaks: boolean;
1373
- readonly indents: boolean;
1374
- }
1375
- /** Declares a block node kind: a top-level node containing text runs. */
1376
- export declare const block: (name: string) => NodeDefinition;
1377
- /**
1378
- * Declares an atom: an addressable node with no text content. Its optional props
1379
- * decode at the same boundary as a `node`'s, so an `Image` is an atom carrying a
1380
- * source rather than a run holder.
1381
- */
1382
- export declare const atom: (name: string, options?: {
1383
- readonly Props?: PropsSchema | undefined;
1384
- }) => NodeDefinition;
1385
- /**
1386
- * Declares an application node kind: a `Node` block whose props this schema
1387
- * validates and whose content the `children` declaration states — a mode, or block
1388
- * content restricted to the kinds `blocksOf` names. `marks: 'none'` forbids marks on
1389
- * its runs. The document codec keeps those props as JSON; the Kit is where an
1390
- * application's types meet them.
1391
- */
1392
- export declare const node: <const Name extends string, Props extends PropsSchema | undefined = undefined, Children extends ChildrenDeclaration = typeof textContent>(name: Name, options?: {
1393
- readonly Props?: Props;
1394
- readonly children?: Children;
1395
- readonly marks?: MarksPolicy;
1396
- /** A boundary a lift never crosses, as a table cell is. */
1397
- readonly isolating?: boolean;
1398
- /**
1399
- * Props a copy split off this node starts with, laid over the original's: Enter in a
1400
- * checked task item starts an unchecked one.
1401
- */
1402
- readonly splitProps?: Props extends PropsSchema ? Partial<Schema.Schema.Type<Props>> : NodeBlock['props'];
1403
- /** The kinds this one may stand in; it then never stands at the top level (§149). */
1404
- readonly within?: ReadonlyArray<string>;
1405
- /**
1406
- * Its text keeps line breaks, as code does: Enter inserts a newline instead of splitting
1407
- * the block, and Enter on an empty last line leaves it for a paragraph after. A callout's
1408
- * text can keep them too, for a note of several lines.
1409
- */
1410
- readonly lineBreaks?: boolean;
1411
- /**
1412
- * Its lines are indented, as code's are: Tab and Shift+Tab indent and outdent them, and a
1413
- * line broken with Enter starts as indented as the one before.
1414
- */
1415
- readonly indents?: boolean;
1416
- }) => NodeDefinitionOf<Name, Props, Children>;
1417
- /**
1418
- * The vocabulary one editor accepts: which node kinds and marks are available.
1419
- * A Kit is a definition, never document state, and it never holds renderers or
1420
- * executable code. Transforms and metadata arrive later.
1421
- */
1422
- interface Kit {
1423
- readonly nodes: ReadonlyArray<NodeDefinition>;
1424
- /** Mark definitions, not just names: a Kit carries each mark's boundary policy. */
1425
- readonly marks: ReadonlyArray<MarkDef>;
1426
- }
1427
- export declare const kit: (definition: {
1428
- readonly nodes: ReadonlyArray<NodeDefinition>;
1429
- readonly marks: ReadonlyArray<MarkDef>;
1430
- }) => Kit;
1431
- interface Diagnostic {
1432
- readonly code: 'UnknownNode' | 'UnsupportedNode' | 'UnknownMark' | 'InvalidProps' | 'MismatchedDefinition' | 'UnexpectedChild' | 'MisplacedNode' | 'ForbiddenMark';
1433
- readonly message: string;
1434
- readonly node?: NodeId;
1435
- readonly detail?: string;
1436
- }
1437
- /**
1438
- * A block's semantic kind: an application node's declared kind, a preserved node's
1439
- * original type, or a built-in block's own type. This is what a `blocksOf`
1440
- * constraint names, and what a `NodeRegistry` is looked up by.
1441
- */
1442
- export declare const blockKind: (block: Block) => string;
1443
- /** Structural summary of a Kit, for tooling and tests. */
1444
- export declare const inspectKit: (definition: Kit) => {
1445
- blocks: number;
1446
- atoms: number;
1447
- nodes: number;
1448
- marks: number;
1449
- };
1450
- /**
1451
- * The node vocabulary an edit may target, the way `MarkRegistry` is the mark
1452
- * vocabulary a mark edit consults. `run` reads a kind's declaration from it to refuse
1453
- * an edit a constraint forbids (§117, §125); `apply` still takes none, so a durable
1454
- * transaction never depends on a vocabulary that may have moved.
1455
- */
1456
- interface NodeRegistry {
1457
- /** The declaration for a block kind, or undefined when this vocabulary has none. */
1458
- readonly definitionFor: (kind: string) => NodeDefinition | undefined;
1459
- }
1460
- /** Builds the registry an edit consults. A later declaration for a name wins, as a Map does. */
1461
- export declare const nodeRegistry: (definitions: ReadonlyArray<NodeDefinition>) => NodeRegistry;
1462
- /**
1463
- * Checks a document against a Kit's vocabulary without changing it, walking
1464
- * nested blocks so a container's children are checked too. Reports preserved
1465
- * unknown blocks, known blocks the Kit does not declare, declarations that
1466
- * disagree with how the document holds a block, application nodes whose props
1467
- * their schema refuses, and marks outside the Kit or whose props their definition
1468
- * refuses. Content diagnostics never strip or repair the document; callers decide
1469
- * whether to block publishing or surface a placeholder.
1470
- */
1471
- export declare const validate: (document: Document, definition: Kit) => ReadonlyArray<Diagnostic>;
1472
- /**
1473
- * Transforms normalize or derive semantic structure after edits (§23). A
1474
- * transform is a pure function of the document plus what the transaction
1475
- * touched: it returns a whole new document and the position steps and identity
1476
- * bookkeeping that go with it, so `apply` can fold it into the same ChangeSet
1477
- * and position map it was already building.
1478
- *
1479
- * Two rules make a registry safe to run in a loop (§24): a transform must be
1480
- * deterministic, and it must be idempotent on normalized state — so running it
1481
- * again after it has run changes nothing, which is how the loop knows it has
1482
- * settled.
1483
- */
1484
- interface TransformContext {
1485
- /** Blocks the transaction touched, plus whatever earlier transforms touched. */
1486
- readonly dirtyNodes: ReadonlySet<NodeId>;
1487
- /** Runs already spent, so a transform can bail out rather than spin. */
1488
- readonly pass: number;
1489
- }
1490
- interface TransformReport {
1491
- readonly document: Document;
1492
- /** The same step vocabulary a transaction uses, so `apply` can fold either. */
1493
- readonly steps: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>;
1494
- readonly insertedNodes: ReadonlySet<NodeId>;
1495
- readonly removedNodes: ReadonlySet<NodeId>;
1496
- readonly dirtyNodes: ReadonlySet<NodeId>;
1497
- /** Runs whose text a transform rewrote, such as a merge's accumulator. */
1498
- readonly textChanged: ReadonlySet<NodeId>;
1499
- /** Whether the block list changed shape, not just the runs inside a block. */
1500
- readonly structureChanged: boolean;
1501
- }
1502
- interface Transform {
1503
- readonly name: string;
1504
- readonly apply: (document: Document, context: TransformContext) => TransformReport;
1505
- }
1506
- /** A transform that found nothing to do. */
1507
- export declare const unchanged: (document: Document) => TransformReport;
1508
- /**
1509
- * Merges adjacent runs whose mark sets match, within the blocks the transaction
1510
- * touched, at any depth. Merging strictly reduces the run count, so one pass reaches
1511
- * a stable state and a second pass finds nothing: the rule is idempotent, and only
1512
- * equal mark sets merge, so an unknown mark never drops.
1513
- */
1514
- export declare const mergeAdjacentRuns: Transform;
1515
- /** The transforms every transaction runs, in order, unless a caller says otherwise. */
1516
- export declare const defaultTransforms: ReadonlyArray<Transform>;
1517
- /** How many normalization passes a transaction may spend before it gives up. */
1518
- export declare const MAX_NORMALIZATION_PASSES = 10;
1519
- /**
1520
- * What a text block retypes to: a paragraph, or a heading at a level. Its runs are
1521
- * its own and survive the change; only the block's type does not.
1522
- */
1523
- export declare const TextBlock: Schema.Union<readonly [Schema.Struct<{
1524
- readonly type: Schema.Literal<"Paragraph">;
1525
- }>, Schema.Struct<{
1526
- readonly type: Schema.Literal<"Heading">;
1527
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1528
- }>]>;
1529
- export type TextBlock = typeof TextBlock.Type;
1530
- /**
1531
- * What a block becomes, under its own identity and with its own content: a block that holds
1532
- * text becomes a paragraph, a heading, or an application node kind that holds text, such as a
1533
- * code block, keeping its runs; a node that holds blocks becomes another node kind, keeping
1534
- * its nested blocks, as a list item becomes a task.
1535
- */
1536
- export declare const RetypeTarget: Schema.Union<readonly [Schema.Struct<{
1537
- readonly type: Schema.Literal<"Paragraph">;
1538
- }>, Schema.Struct<{
1539
- readonly type: Schema.Literal<"Heading">;
1540
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1541
- }>, Schema.Struct<{
1542
- readonly type: Schema.Literal<"Node">;
1543
- readonly kind: Schema.NonEmptyString;
1544
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1545
- }>]>;
1546
- export type RetypeTarget = typeof RetypeTarget.Type;
1547
- export declare const Operation: Schema.Union<readonly [Schema.Struct<{
1548
- readonly type: Schema.Literal<"InsertText">;
1549
- readonly at: Schema.Struct<{
1550
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1551
- readonly offset: Schema.Number;
1552
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1553
- }>;
1554
- readonly text: Schema.String;
1555
- }>, Schema.Struct<{
1556
- readonly type: Schema.Literal<"DeleteText">;
1557
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1558
- readonly from: Schema.Number;
1559
- readonly to: Schema.Number;
1560
- }>, Schema.Struct<{
1561
- readonly type: Schema.Literal<"AddMark">;
1562
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1563
- readonly mark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1564
- readonly name: Schema.NonEmptyString;
1565
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1566
- }>]>;
1567
- }>, Schema.Struct<{
1568
- readonly type: Schema.Literal<"RemoveMark">;
1569
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1570
- readonly mark: Schema.String;
1571
- }>, Schema.Struct<{
1572
- readonly type: Schema.Literal<"SetSelection">;
1573
- readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
1574
- readonly type: Schema.Literal<"Range">;
1575
- readonly anchor: Schema.Struct<{
1576
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1577
- readonly offset: Schema.Number;
1578
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1579
- }>;
1580
- readonly focus: Schema.Struct<{
1581
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1582
- readonly offset: Schema.Number;
1583
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1584
- }>;
1585
- }>, Schema.Struct<{
1586
- readonly type: Schema.Literal<"Node">;
1587
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1588
- }>]>>;
1589
- }>, Schema.Struct<{
1590
- readonly type: Schema.Literal<"SplitNode">;
1591
- readonly block: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1592
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1593
- readonly offset: Schema.Number;
1594
- readonly blockId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1595
- readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1596
- }>, Schema.Struct<{
1597
- readonly type: Schema.Literal<"JoinNode">;
1598
- readonly into: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1599
- readonly removed: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1600
- }>, Schema.Struct<{
1601
- readonly type: Schema.Literal<"MoveNode">;
1602
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1603
- readonly to: Schema.Number;
1604
- /** The block list to move into: a node block's, or the document's when absent. */
1605
- readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
1606
- }>, Schema.Struct<{
1607
- readonly type: Schema.Literal<"RetypeBlock">;
1608
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1609
- readonly to: Schema.Union<readonly [Schema.Struct<{
1610
- readonly type: Schema.Literal<"Paragraph">;
1611
- }>, Schema.Struct<{
1612
- readonly type: Schema.Literal<"Heading">;
1613
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1614
- }>, Schema.Struct<{
1615
- readonly type: Schema.Literal<"Node">;
1616
- readonly kind: Schema.NonEmptyString;
1617
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1618
- }>]>;
1619
- }>, Schema.Struct<{
1620
- readonly type: Schema.Literal<"SetProps">;
1621
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1622
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1623
- }>, Schema.Struct<{
1624
- readonly type: Schema.Literal<"InsertNode">;
1625
- readonly block: Schema.Union<readonly [Schema.Struct<{
1626
- readonly type: Schema.Literal<"Paragraph">;
1627
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1628
- readonly children: Schema.$Array<Schema.Struct<{
1629
- readonly type: Schema.Literal<"Text">;
1630
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1631
- readonly text: Schema.String;
1632
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1633
- readonly name: Schema.NonEmptyString;
1634
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1635
- }>]>>;
1636
- }>>;
1637
- }>, Schema.Struct<{
1638
- readonly type: Schema.Literal<"Heading">;
1639
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1640
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1641
- readonly children: Schema.$Array<Schema.Struct<{
1642
- readonly type: Schema.Literal<"Text">;
1643
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1644
- readonly text: Schema.String;
1645
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1646
- readonly name: Schema.NonEmptyString;
1647
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1648
- }>]>>;
1649
- }>>;
1650
- }>, Schema.Struct<{
1651
- readonly type: Schema.Literal<"Node">;
1652
- readonly kind: Schema.NonEmptyString;
1653
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1654
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1655
- readonly children: Schema.$Array<Schema.Struct<{
1656
- readonly type: Schema.Literal<"Text">;
1657
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1658
- readonly text: Schema.String;
1659
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1660
- readonly name: Schema.NonEmptyString;
1661
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1662
- }>]>>;
1663
- }>>;
1664
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
1665
- readonly type: 'Node';
1666
- readonly kind: string;
1667
- readonly id: string;
1668
- readonly props: {
1669
- 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;
1670
- };
1671
- readonly children: readonly {
1672
- readonly type: "Text";
1673
- readonly id: string;
1674
- readonly text: string;
1675
- readonly marks: readonly (string | {
1676
- readonly name: string;
1677
- readonly props?: {
1678
- 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)[] | {
1679
- 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;
1680
- } | null;
1681
- };
1682
- })[];
1683
- }[];
1684
- readonly blocks?: readonly ( /*elided*/ any | {
1685
- readonly type: "Paragraph";
1686
- readonly id: string;
1687
- readonly children: readonly {
1688
- readonly type: "Text";
1689
- readonly id: string;
1690
- readonly text: string;
1691
- readonly marks: readonly (string | {
1692
- readonly name: string;
1693
- readonly props?: {
1694
- 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)[] | {
1695
- 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;
1696
- } | null;
1697
- };
1698
- })[];
1699
- }[];
1700
- } | {
1701
- readonly type: "Heading";
1702
- readonly id: string;
1703
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
1704
- readonly children: readonly {
1705
- readonly type: "Text";
1706
- readonly id: string;
1707
- readonly text: string;
1708
- readonly marks: readonly (string | {
1709
- readonly name: string;
1710
- readonly props?: {
1711
- 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)[] | {
1712
- 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;
1713
- } | null;
1714
- };
1715
- })[];
1716
- }[];
1717
- } | {
1718
- readonly type: "Unknown";
1719
- readonly id: string;
1720
- readonly originalType: string;
1721
- readonly props: {
1722
- 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)[] | {
1723
- 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;
1724
- } | null;
1725
- };
1726
- readonly children: readonly {
1727
- readonly type: "Text";
1728
- readonly id: string;
1729
- readonly text: string;
1730
- readonly marks: readonly (string | {
1731
- readonly name: string;
1732
- readonly props?: {
1733
- 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)[] | {
1734
- 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;
1735
- } | null;
1736
- };
1737
- })[];
1738
- }[];
1739
- })[];
1740
- } | {
1741
- readonly type: "Paragraph";
1742
- readonly id: string;
1743
- readonly children: readonly {
1744
- readonly type: "Text";
1745
- readonly id: string;
1746
- readonly text: string;
1747
- readonly marks: readonly (string | {
1748
- readonly name: string;
1749
- readonly props?: {
1750
- 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)[] | {
1751
- 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;
1752
- } | null;
1753
- };
1754
- })[];
1755
- }[];
1756
- } | {
1757
- readonly type: "Heading";
1758
- readonly id: string;
1759
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
1760
- readonly children: readonly {
1761
- readonly type: "Text";
1762
- readonly id: string;
1763
- readonly text: string;
1764
- readonly marks: readonly (string | {
1765
- readonly name: string;
1766
- readonly props?: {
1767
- 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)[] | {
1768
- 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;
1769
- } | null;
1770
- };
1771
- })[];
1772
- }[];
1773
- } | {
1774
- readonly type: "Unknown";
1775
- readonly id: string;
1776
- readonly originalType: string;
1777
- readonly props: {
1778
- 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)[] | {
1779
- 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;
1780
- } | null;
1781
- };
1782
- readonly children: readonly {
1783
- readonly type: "Text";
1784
- readonly id: string;
1785
- readonly text: string;
1786
- readonly marks: readonly (string | {
1787
- readonly name: string;
1788
- readonly props?: {
1789
- 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)[] | {
1790
- 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;
1791
- } | null;
1792
- };
1793
- })[];
1794
- }[];
1795
- })[], never, never>>>;
1796
- }>, Schema.Struct<{
1797
- readonly type: Schema.Literal<"Unknown">;
1798
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1799
- readonly originalType: Schema.NonEmptyString;
1800
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1801
- readonly children: Schema.$Array<Schema.Struct<{
1802
- readonly type: Schema.Literal<"Text">;
1803
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1804
- readonly text: Schema.String;
1805
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1806
- readonly name: Schema.NonEmptyString;
1807
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1808
- }>]>>;
1809
- }>>;
1810
- }>]>;
1811
- readonly at: Schema.Number;
1812
- /** The block list to insert into: a node block's, or the document's when absent. */
1813
- readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
1814
- }>, Schema.Struct<{
1815
- readonly type: Schema.Literal<"DeleteNode">;
1816
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1817
- }>, Schema.Struct<{
1818
- readonly type: Schema.Literal<"SplitRun">;
1819
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1820
- readonly offset: Schema.Number;
1821
- readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1822
- }>]>;
1823
- export type Operation = typeof Operation.Type;
1824
- export declare const Transaction: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
1825
- readonly type: Schema.Literal<"InsertText">;
1826
- readonly at: Schema.Struct<{
1827
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1828
- readonly offset: Schema.Number;
1829
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1830
- }>;
1831
- readonly text: Schema.String;
1832
- }>, Schema.Struct<{
1833
- readonly type: Schema.Literal<"DeleteText">;
1834
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1835
- readonly from: Schema.Number;
1836
- readonly to: Schema.Number;
1837
- }>, Schema.Struct<{
1838
- readonly type: Schema.Literal<"AddMark">;
1839
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1840
- readonly mark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1841
- readonly name: Schema.NonEmptyString;
1842
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1843
- }>]>;
1844
- }>, Schema.Struct<{
1845
- readonly type: Schema.Literal<"RemoveMark">;
1846
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1847
- readonly mark: Schema.String;
1848
- }>, Schema.Struct<{
1849
- readonly type: Schema.Literal<"SetSelection">;
1850
- readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
1851
- readonly type: Schema.Literal<"Range">;
1852
- readonly anchor: Schema.Struct<{
1853
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1854
- readonly offset: Schema.Number;
1855
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1856
- }>;
1857
- readonly focus: Schema.Struct<{
1858
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1859
- readonly offset: Schema.Number;
1860
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
1861
- }>;
1862
- }>, Schema.Struct<{
1863
- readonly type: Schema.Literal<"Node">;
1864
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1865
- }>]>>;
1866
- }>, Schema.Struct<{
1867
- readonly type: Schema.Literal<"SplitNode">;
1868
- readonly block: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1869
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1870
- readonly offset: Schema.Number;
1871
- readonly blockId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1872
- readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1873
- }>, Schema.Struct<{
1874
- readonly type: Schema.Literal<"JoinNode">;
1875
- readonly into: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1876
- readonly removed: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1877
- }>, Schema.Struct<{
1878
- readonly type: Schema.Literal<"MoveNode">;
1879
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1880
- readonly to: Schema.Number;
1881
- /** The block list to move into: a node block's, or the document's when absent. */
1882
- readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
1883
- }>, Schema.Struct<{
1884
- readonly type: Schema.Literal<"RetypeBlock">;
1885
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1886
- readonly to: Schema.Union<readonly [Schema.Struct<{
1887
- readonly type: Schema.Literal<"Paragraph">;
1888
- }>, Schema.Struct<{
1889
- readonly type: Schema.Literal<"Heading">;
1890
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1891
- }>, Schema.Struct<{
1892
- readonly type: Schema.Literal<"Node">;
1893
- readonly kind: Schema.NonEmptyString;
1894
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1895
- }>]>;
1896
- }>, Schema.Struct<{
1897
- readonly type: Schema.Literal<"SetProps">;
1898
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1899
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1900
- }>, Schema.Struct<{
1901
- readonly type: Schema.Literal<"InsertNode">;
1902
- readonly block: Schema.Union<readonly [Schema.Struct<{
1903
- readonly type: Schema.Literal<"Paragraph">;
1904
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1905
- readonly children: Schema.$Array<Schema.Struct<{
1906
- readonly type: Schema.Literal<"Text">;
1907
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1908
- readonly text: Schema.String;
1909
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1910
- readonly name: Schema.NonEmptyString;
1911
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1912
- }>]>>;
1913
- }>>;
1914
- }>, Schema.Struct<{
1915
- readonly type: Schema.Literal<"Heading">;
1916
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1917
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
1918
- readonly children: Schema.$Array<Schema.Struct<{
1919
- readonly type: Schema.Literal<"Text">;
1920
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1921
- readonly text: Schema.String;
1922
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1923
- readonly name: Schema.NonEmptyString;
1924
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1925
- }>]>>;
1926
- }>>;
1927
- }>, Schema.Struct<{
1928
- readonly type: Schema.Literal<"Node">;
1929
- readonly kind: Schema.NonEmptyString;
1930
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1931
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1932
- readonly children: Schema.$Array<Schema.Struct<{
1933
- readonly type: Schema.Literal<"Text">;
1934
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
1935
- readonly text: Schema.String;
1936
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
1937
- readonly name: Schema.NonEmptyString;
1938
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1939
- }>]>>;
1940
- }>>;
1941
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
1942
- readonly type: 'Node';
1943
- readonly kind: string;
1944
- readonly id: string;
1945
- readonly props: {
1946
- 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;
1947
- };
1948
- readonly children: readonly {
1949
- readonly type: "Text";
1950
- readonly id: string;
1951
- readonly text: string;
1952
- readonly marks: readonly (string | {
1953
- readonly name: string;
1954
- readonly props?: {
1955
- 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)[] | {
1956
- 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;
1957
- } | null;
1958
- };
1959
- })[];
1960
- }[];
1961
- readonly blocks?: readonly ( /*elided*/ any | {
1962
- readonly type: "Paragraph";
1963
- readonly id: string;
1964
- readonly children: readonly {
1965
- readonly type: "Text";
1966
- readonly id: string;
1967
- readonly text: string;
1968
- readonly marks: readonly (string | {
1969
- readonly name: string;
1970
- readonly props?: {
1971
- 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)[] | {
1972
- 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;
1973
- } | null;
1974
- };
1975
- })[];
1976
- }[];
1977
- } | {
1978
- readonly type: "Heading";
1979
- readonly id: string;
1980
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
1981
- readonly children: readonly {
1982
- readonly type: "Text";
1983
- readonly id: string;
1984
- readonly text: string;
1985
- readonly marks: readonly (string | {
1986
- readonly name: string;
1987
- readonly props?: {
1988
- 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)[] | {
1989
- 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;
1990
- } | null;
1991
- };
1992
- })[];
1993
- }[];
1994
- } | {
1995
- readonly type: "Unknown";
1996
- readonly id: string;
1997
- readonly originalType: string;
1998
- readonly props: {
1999
- 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)[] | {
2000
- 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;
2001
- } | null;
2002
- };
2003
- readonly children: readonly {
2004
- readonly type: "Text";
2005
- readonly id: string;
2006
- readonly text: string;
2007
- readonly marks: readonly (string | {
2008
- readonly name: string;
2009
- readonly props?: {
2010
- 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)[] | {
2011
- 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;
2012
- } | null;
2013
- };
2014
- })[];
2015
- }[];
2016
- })[];
2017
- } | {
2018
- readonly type: "Paragraph";
2019
- readonly id: string;
2020
- readonly children: readonly {
2021
- readonly type: "Text";
2022
- readonly id: string;
2023
- readonly text: string;
2024
- readonly marks: readonly (string | {
2025
- readonly name: string;
2026
- readonly props?: {
2027
- 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)[] | {
2028
- 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;
2029
- } | null;
2030
- };
2031
- })[];
2032
- }[];
2033
- } | {
2034
- readonly type: "Heading";
2035
- readonly id: string;
2036
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
2037
- readonly children: readonly {
2038
- readonly type: "Text";
2039
- readonly id: string;
2040
- readonly text: string;
2041
- readonly marks: readonly (string | {
2042
- readonly name: string;
2043
- readonly props?: {
2044
- 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)[] | {
2045
- 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;
2046
- } | null;
2047
- };
2048
- })[];
2049
- }[];
2050
- } | {
2051
- readonly type: "Unknown";
2052
- readonly id: string;
2053
- readonly originalType: string;
2054
- readonly props: {
2055
- 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)[] | {
2056
- 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;
2057
- } | null;
2058
- };
2059
- readonly children: readonly {
2060
- readonly type: "Text";
2061
- readonly id: string;
2062
- readonly text: string;
2063
- readonly marks: readonly (string | {
2064
- readonly name: string;
2065
- readonly props?: {
2066
- 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)[] | {
2067
- 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;
2068
- } | null;
2069
- };
2070
- })[];
2071
- }[];
2072
- })[], never, never>>>;
2073
- }>, Schema.Struct<{
2074
- readonly type: Schema.Literal<"Unknown">;
2075
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2076
- readonly originalType: Schema.NonEmptyString;
2077
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2078
- readonly children: Schema.$Array<Schema.Struct<{
2079
- readonly type: Schema.Literal<"Text">;
2080
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2081
- readonly text: Schema.String;
2082
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2083
- readonly name: Schema.NonEmptyString;
2084
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2085
- }>]>>;
2086
- }>>;
2087
- }>]>;
2088
- readonly at: Schema.Number;
2089
- /** The block list to insert into: a node block's, or the document's when absent. */
2090
- readonly parent: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">>;
2091
- }>, Schema.Struct<{
2092
- readonly type: Schema.Literal<"DeleteNode">;
2093
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2094
- }>, Schema.Struct<{
2095
- readonly type: Schema.Literal<"SplitRun">;
2096
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2097
- readonly offset: Schema.Number;
2098
- readonly textId: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2099
- }>]>>;
2100
- export type Transaction = typeof Transaction.Type;
2101
- /** A text-run target: a validated id or a reusable node reference. */
2102
- type TextTarget = NodeId | NodeReference;
2103
- /**
2104
- * Typesafe constructors for transaction operations. Each builder accepts a
2105
- * `NodeId` or a `Node.make` reference and validates shape immediately
2106
- * (misuse throws), while document-dependent checks — node kind, existence,
2107
- * bounds, selection resolution — remain `apply` diagnostics. Compose with
2108
- * `Node.at` for positions: `Edit.insertText(Text.at(5, 'after'), '!')`.
2109
- */
2110
- export declare const Edit: {
2111
- insertText: (at: Position, text: string) => Extract<Operation, {
2112
- readonly type: 'InsertText';
2113
- }>;
2114
- deleteText: (node: TextTarget, from: number, to: number) => Extract<Operation, {
2115
- readonly type: 'DeleteText';
2116
- }>;
2117
- addMark: (node: TextTarget, mark: RunMark) => Extract<Operation, {
2118
- readonly type: 'AddMark';
2119
- }>;
2120
- removeMark: (node: TextTarget, mark: string) => Extract<Operation, {
2121
- readonly type: 'RemoveMark';
2122
- }>;
2123
- setSelection: (selection: Selection | null) => Extract<Operation, {
2124
- readonly type: 'SetSelection';
2125
- }>;
2126
- splitBlock: (block: TextTarget, node: TextTarget, offset: number, newBlock: string | NodeId, newRun: string | NodeId) => Extract<Operation, {
2127
- readonly type: 'SplitNode';
2128
- }>;
2129
- joinBlocks: (survivor: TextTarget, removed: TextTarget) => Extract<Operation, {
2130
- readonly type: 'JoinNode';
2131
- }>;
2132
- moveBlock: (node: TextTarget, to: number, parent?: TextTarget) => Extract<Operation, {
2133
- readonly type: 'MoveNode';
2134
- }>;
2135
- retypeBlock: (node: TextTarget, to: RetypeTarget) => Extract<Operation, {
2136
- readonly type: 'RetypeBlock';
2137
- }>;
2138
- /** Sets the named props of a node block; props it does not name keep their values. */
2139
- setProps: (node: TextTarget, props: Schema.JsonObject) => Extract<Operation, {
2140
- readonly type: 'SetProps';
2141
- }>;
2142
- insertBlock: (block: Block, at: number, parent?: TextTarget) => Extract<Operation, {
2143
- readonly type: 'InsertNode';
2144
- }>;
2145
- deleteBlock: (node: TextTarget) => Extract<Operation, {
2146
- readonly type: 'DeleteNode';
2147
- }>;
2148
- splitRun: (node: TextTarget, offset: number, newRun: string | NodeId) => Extract<Operation, {
2149
- readonly type: 'SplitRun';
2150
- }>;
2151
- };
2152
- interface ChangeSet {
2153
- readonly dirtyNodes: ReadonlySet<NodeId>;
2154
- readonly insertedNodes: ReadonlySet<NodeId>;
2155
- readonly removedNodes: ReadonlySet<NodeId>;
2156
- readonly textChanged: ReadonlySet<NodeId>;
2157
- readonly structureChanged: boolean;
2158
- readonly selectionChanged: boolean;
2159
- }
2160
- /** One replacement of [from, to) with inserted UTF-16 units, in sequential coordinates. */
2161
- interface PositionStep {
2162
- readonly node: NodeId;
2163
- readonly from: number;
2164
- readonly to: number;
2165
- readonly inserted: number;
2166
- }
2167
- /**
2168
- * Split relocation: offsets > at move to into with offset - at; offset == at
2169
- * follows affinity (before stays, after moves to 0); lower offsets stay.
2170
- */
2171
- interface SplitStep {
2172
- readonly node: NodeId;
2173
- readonly into: NodeId;
2174
- readonly at: number;
2175
- }
2176
- /**
2177
- * Merge relocation: offsets >= at move to into with base + offset - at;
2178
- * lower offsets stay. Affinity is preserved, not consulted: the source
2179
- * location ceases to exist, so every endpoint must move.
2180
- */
2181
- interface RelocateStep {
2182
- readonly node: NodeId;
2183
- readonly into: NodeId;
2184
- readonly at: number;
2185
- readonly base: number;
2186
- }
2187
- /**
2188
- * Deletion collapse: every offset in node moves to offset 0 of into;
2189
- * affinity is preserved. Emitted per removed run when a surviving run exists;
2190
- * with no text left, positions cannot map and selection clears instead.
2191
- */
2192
- interface CollapseStep {
2193
- readonly node: NodeId;
2194
- readonly into: NodeId;
2195
- }
2196
- /** Maps a position through each edit, preserving insertion affinity. */
2197
- export declare const mapPosition: (position: Position, steps: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>) => Position;
2198
- type TransactionResult = {
2199
- readonly ok: true;
2200
- readonly state: EditorState;
2201
- readonly changeSet: ChangeSet;
2202
- readonly positionMap: ReadonlyArray<PositionStep | SplitStep | RelocateStep | CollapseStep>;
2203
- /**
2204
- * The transactions that produced `state`, in order, each normalized before the next:
2205
- * folding `apply` over them from the input state yields `state` again. A command can
2206
- * need more than one, and an action has at least one per command.
2207
- */
2208
- readonly transactions: ReadonlyArray<Transaction>;
2209
- } | {
2210
- readonly ok: false;
2211
- readonly error: 'InvalidInput' | 'MissingText' | 'MissingNode' | 'InvalidRange' | 'InvalidSelection' | 'InvalidParent' | 'ForbiddenMark' | 'UnexpectedChild' | 'UnstableNormalization';
2212
- };
2213
- /**
2214
- * Pure, atomic text transaction. Rejection returns no partially edited state.
2215
- * `transforms` defaults to the registry's shipped rules; a Kit's transforms
2216
- * arrive here when Kit support lands.
2217
- */
2218
- export declare const apply: (state: EditorState, transaction: Transaction, transforms?: ReadonlyArray<Transform>) => TransactionResult;
2219
- /**
2220
- * Editor intent: what the user is trying to do. Commands resolve against the
2221
- * current document and selection into a Transaction of low-level operations, so
2222
- * durable history keeps its meaning (§19). Identities a command needs come from
2223
- * the caller's `mint`; nothing here reads a clock or a hidden counter.
2224
- */
2225
- type Command = {
2226
- readonly type: 'InsertText';
2227
- readonly text: string;
2228
- /** Stored marks: a bare name, or a value when the mark carries props. */
2229
- readonly marks?: ReadonlyArray<string | MarkValue>;
2230
- } | {
2231
- readonly type: 'DeleteBackward';
2232
- } | {
2233
- readonly type: 'DeleteForward';
2234
- } | {
2235
- readonly type: 'SplitBlock';
2236
- } | {
2237
- readonly type: 'ToggleMark';
2238
- readonly mark: string | MarkValue;
2239
- } |
2240
- /**
2241
- * Puts exactly this mark on every run the selection covers, replacing a same-named mark
2242
- * whose props differ: how a link gets a new `href`. A caret acts on the extent of the
2243
- * mark around it (`markExtent`), and does nothing outside one.
2244
- */
2245
- {
2246
- readonly type: 'SetMark';
2247
- readonly mark: string | MarkValue;
2248
- } |
2249
- /**
2250
- * Takes the named mark off every run the selection covers; a caret, off its extent. Given a
2251
- * mark value, only off the runs carrying exactly that value: one discussion's highlight,
2252
- * leaving another's inside it.
2253
- */
2254
- {
2255
- readonly type: 'ClearMark';
2256
- readonly mark: string | MarkValue;
2257
- } | {
2258
- readonly type: 'SetSelection';
2259
- readonly selection: Selection | null;
2260
- } | {
2261
- readonly type: 'Paste';
2262
- readonly slice: Slice;
2263
- } |
2264
- /** Retypes the block the selection starts in: a paragraph, or a heading. */
2265
- {
2266
- readonly type: 'RetypeBlock';
2267
- readonly to: TextBlock;
2268
- } |
2269
- /**
2270
- * Wraps the block the selection starts in, in new containers listed outermost first: a
2271
- * `Quote`, or a `List` holding a `ListItem`. The block keeps its identity and its runs,
2272
- * so the caret stays where it was. Given a vocabulary, a list wrap right after a list of the
2273
- * same kind and props adds the block to it as a new item.
2274
- */
2275
- {
2276
- readonly type: 'WrapBlock';
2277
- readonly containers: ReadonlyArray<Container>;
2278
- } |
2279
- /**
2280
- * Retypes the text block the selection starts in to a node kind that holds text, such as a
2281
- * `CodeBlock`. The block and its runs keep their identities, text, and marks.
2282
- */
2283
- {
2284
- readonly type: 'ConvertBlock';
2285
- readonly to: Container;
2286
- } |
2287
- /**
2288
- * Retypes the container the selection starts in (the node block holding its block, such as
2289
- * a list item) to another node kind, where it stands: its identity and every block it holds
2290
- * are kept, so edits made inside it meanwhile survive. Only from the container's first block,
2291
- * which is where a marker for the container is typed. Given a vocabulary, the new kind must
2292
- * hold blocks, hold each block the container holds, and stand where the container does.
2293
- */
2294
- {
2295
- readonly type: 'RetypeContainer';
2296
- readonly to: Container;
2297
- } |
2298
- /**
2299
- * Lifts the block the selection starts in out of its container, the inverse of a wrap:
2300
- * repeated while the new parent's declaration refuses it, so a list item's paragraph leaves
2301
- * both the item and the list. The block keeps its identity, and the caret with it.
2302
- */
2303
- {
2304
- readonly type: 'LiftBlock';
2305
- } |
2306
- /**
2307
- * Moves a block, and everything it holds, before or after another block, in its own container
2308
- * or another one the vocabulary lets it stand in (§149). It addresses blocks rather than the
2309
- * selection, so a handle or a key can move the block it stands for; identities are kept, and
2310
- * the selection with them. A container the move leaves empty is deleted.
2311
- */
2312
- {
2313
- readonly type: 'MoveBlock';
2314
- readonly node: NodeId;
2315
- readonly to: Beside;
2316
- } |
2317
- /**
2318
- * Sets the named props of a node block, such as a task item's `checked`, keeping the rest.
2319
- * It addresses the block by identity, as `MoveBlock` does, so a checkbox sends it for its
2320
- * own item. Given a vocabulary, props that decode as the kind's must still decode after.
2321
- */
2322
- {
2323
- readonly type: 'SetProps';
2324
- readonly node: NodeId;
2325
- readonly props: Schema.JsonObject;
2326
- } |
2327
- /**
2328
- * Inserts a block, and everything it holds, before or after another block, under fresh
2329
- * identities from `mint`: an image chosen from a file, a table from a menu, a copy of a block
2330
- * for its handle's Duplicate. The caret goes to the start of its first text, when it has any.
2331
- * Without `to` it goes beside the caret's block: before it when that block is empty, so a
2332
- * slash command typed on a blank line puts its block there and the line stays to type on,
2333
- * and after it otherwise.
2334
- */
2335
- {
2336
- readonly type: 'InsertBlock';
2337
- readonly block: Block;
2338
- readonly to?: Beside | undefined;
2339
- } |
2340
- /**
2341
- * Deletes a block and everything it holds, with any container that would be left empty by it,
2342
- * as a block handle's Delete does. A caret inside it moves to the nearest text that stays; a
2343
- * document left with no block gets an empty paragraph, so there is somewhere to type.
2344
- */
2345
- {
2346
- readonly type: 'DeleteBlock';
2347
- readonly node: NodeId;
2348
- } |
2349
- /**
2350
- * A row above or below the caret's table cell, as wide as the table's widest row, with the caret
2351
- * moved into it. The table is the standard vocabulary's (`Table`, `TableRow`, `TableCell`).
2352
- */
2353
- {
2354
- readonly type: 'InsertRow';
2355
- readonly where: 'before' | 'after';
2356
- } |
2357
- /** A cell beside the caret's in every row, before or after it: a column. */
2358
- {
2359
- readonly type: 'InsertColumn';
2360
- readonly where: 'before' | 'after';
2361
- } |
2362
- /** The caret's row, deleted; the last one deletes the table. */
2363
- {
2364
- readonly type: 'DeleteRow';
2365
- } |
2366
- /** The caret's column, deleted from every row that has it; the last one deletes the table. */
2367
- {
2368
- readonly type: 'DeleteColumn';
2369
- } |
2370
- /**
2371
- * Tab. In a kind declared `indents` (code), a level of indentation at the caret, or at the
2372
- * start of every line a range covers; in a table cell, the caret to the next cell, adding a row
2373
- * after the last. Refused anywhere else (`InvalidSelection`), so Tab can move focus there.
2374
- */
2375
- {
2376
- readonly type: 'Indent';
2377
- } |
2378
- /** Shift+Tab: a level of indentation off each line in code; the previous cell in a table. */
2379
- {
2380
- readonly type: 'Outdent';
2381
- } |
2382
- /**
2383
- * Find and replace: the match at index `at` of `query` (in document order, as `findMatches`
2384
- * lists them), or every match when `at` is absent, becomes `replacement`, as one transaction.
2385
- * Case does not count unless `caseSensitive`. The caret ends after the earliest replacement.
2386
- */
2387
- {
2388
- readonly type: 'Replace';
2389
- readonly query: string;
2390
- readonly replacement: string;
2391
- readonly caseSensitive?: boolean | undefined;
2392
- readonly at?: number | undefined;
2393
- } |
2394
- /**
2395
- * A footnote at the caret, or at the end of a range: a reference showing the next free label
2396
- * (`nextFootnoteLabel`), and its definition after the last top-level block holding `text`, with
2397
- * the caret at the definition's start, ready to write the note.
2398
- */
2399
- {
2400
- readonly type: 'InsertFootnote';
2401
- readonly text?: string | undefined;
2402
- } |
2403
- /**
2404
- * A footnote's label, `from`, becomes `to`: on its definition, and on every reference, whose
2405
- * text becomes `to` where it showed `from`. Refused (`InvalidInput`) when `to` is blank or
2406
- * another footnote's, or when no footnote is labelled `from`.
2407
- */
2408
- {
2409
- readonly type: 'RenameFootnote';
2410
- readonly from: string;
2411
- readonly to: string;
2412
- };
2413
- /** Where `MoveBlock` puts a block: before or after a sibling, named by identity. */
2414
- export declare const Beside: Schema.Union<readonly [Schema.Struct<{
2415
- readonly before: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2416
- readonly after: Schema.optionalKey<Schema.Never>;
2417
- }>, Schema.Struct<{
2418
- readonly after: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2419
- readonly before: Schema.optionalKey<Schema.Never>;
2420
- }>]>;
2421
- export type Beside = typeof Beside.Type;
2422
- /** A container a block is wrapped in: a node kind, and the props it starts with. */
2423
- export declare const Container: Schema.Struct<{
2424
- readonly kind: Schema.NonEmptyString;
2425
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2426
- }>;
2427
- export type Container = typeof Container.Type;
2428
- /** Caller-owned identity source. Live edits mint; replay applies transactions. */
2429
- interface CommandIds {
2430
- readonly mint: () => string;
2431
- }
2432
- /** What a command needs beyond state and identity, such as a Kit's mark policy. */
2433
- interface RunOptions {
2434
- readonly marks?: MarkRegistry | undefined;
2435
- /** The node vocabulary, so an edit a constraint forbids is refused here (§125). */
2436
- readonly nodes?: NodeRegistry | undefined;
2437
- }
2438
- /**
2439
- * Whether a block is an atom, holding neither text nor blocks, as an image is. Without a
2440
- * vocabulary, a node with nothing in it is one.
2441
- */
2442
- export declare const isAtom: (nodes: NodeRegistry | undefined, block: Block) => boolean;
2443
- /** Whether a selection covers text: a range that is not a caret. What a mark or a link applies to. */
2444
- export declare const coversText: (selection: Selection | null) => boolean;
2445
- /**
2446
- * The marks every run the selection covers carries: the ones a toggle would
2447
- * remove, which is what an "active" toolbar button means. A caret reports its
2448
- * run's marks — an empty run can carry them, which is how a caret holds a format
2449
- * — and a range is not bold when it straddles a bold run and a plain one. A node
2450
- * selection reports what its whole subtree agrees on. A read, not a command:
2451
- * nothing here changes anything.
2452
- */
2453
- export declare const marksInRange: (document: Document, selection: Selection | null) => ReadonlySet<string>;
2454
- /** A mark around a caret, and the range of runs it spans. */
2455
- interface MarkExtent {
2456
- readonly mark: RunMark;
2457
- readonly selection: Extract<Selection, {
2458
- readonly type: 'Range';
2459
- }>;
2460
- }
2461
- /**
2462
- * The named mark on the run a position is in, and the adjacent runs of its block carrying
2463
- * the same mark with the same props: the whole link a caret sits in, which is what a link
2464
- * editor shows and what `SetMark` and `ClearMark` act on at a caret. Undefined when that
2465
- * run does not carry the mark. A read, like `marksInRange`.
2466
- */
2467
- export declare const markExtent: (document: Document, position: Position, name: string) => MarkExtent | undefined;
2468
- /**
2469
- * The text style of the block a selection starts in, in the shape `RetypeBlock` takes, so a
2470
- * style picker compares what it would send with what is there. Undefined for a node
2471
- * selection, one that resolves to nothing, or a block a retype does not reach, such as a code
2472
- * block.
2473
- */
2474
- export declare const textBlockAt: (document: Document, selection: Selection | null) => TextBlock | undefined;
2475
- /**
2476
- * The blocks `node` may move beside, in document order (§149): the blocks of every container it
2477
- * may move into, which is what a drag offers. Empty when the document does not hold it.
2478
- */
2479
- export declare const moveTargets: (document: Document, node: NodeId, nodes?: NodeRegistry) => ReadonlyArray<NodeId>;
2480
- /**
2481
- * The blocks a selection starts in, outermost first: a caret in a list item's paragraph gives
2482
- * the list, the item, and the paragraph. What a block handle picks from, and a breadcrumb draws.
2483
- * Empty when the selection is null or resolves to nothing.
2484
- */
2485
- export declare const blocksAt: (document: Document, selection: Selection | null) => ReadonlyArray<Block>;
2486
- /**
2487
- * Resolves one intent into a transaction and applies it atomically. Commands
2488
- * describe intent; the returned `positionMap` and `ChangeSet` describe the
2489
- * document effect, and rejection returns no partially edited state.
2490
- */
2491
- export declare const run: (state: EditorState, command: Command, ids: CommandIds, options?: RunOptions) => TransactionResult;
2492
- /**
2493
- * Whether Tab means something where the selection is: in code, or in a table cell. An editor
2494
- * takes Tab only there, so anywhere else it still moves focus out of the editor.
2495
- */
2496
- export declare const takesTab: (document: Document, selection: Selection | null, nodes?: NodeRegistry) => boolean;
2497
- /** An ordered list of commands that commit as one action (§124 §5). */
2498
- type Action = ReadonlyArray<Command>;
2499
- /**
2500
- * A composed action's invalidation summary is the union of its commands': an identity
2501
- * one command retired and a later one restored appears in both sets, and a patch reads
2502
- * that as "remove it, then render it", so it never under-invalidates.
2503
- */
2504
- export declare const unionChangeSet: (left: ChangeSet, right: ChangeSet) => ChangeSet;
2505
- /**
2506
- * Resolves commands in order and commits them as one action: one resulting state, one
2507
- * composed ChangeSet, and one identity stream, so a caller can treat "remove the query,
2508
- * then apply the choice" as a single transition. It stops at the first refusal and
2509
- * returns that command's error; state is a value, so nothing partial escapes.
2510
- */
2511
- export declare const runAction: (state: EditorState, commands: Action, ids: CommandIds, options?: RunOptions) => TransactionResult;
2512
- /** What a rule makes of the text before the caret, and what to do about it. */
2513
- interface InputMatch {
2514
- /** How many characters of that text the rule consumed; the caller deletes them. */
2515
- readonly remove: number;
2516
- readonly commands: Action;
2517
- /**
2518
- * The marks the text typed next carries, when the rule decides it: `**bold**` ends its bold, so
2519
- * typing on is plain, though the bold run would otherwise continue. Absent, the editor's own
2520
- * rule applies.
2521
- */
2522
- readonly storedMarks?: ReadonlyArray<string> | undefined;
2523
- }
2524
- /**
2525
- * A rule over the text before the caret. `match` is a pure read: it sees the text and the
2526
- * kinds of the node blocks around the caret's block, innermost first (`['ListItem',
2527
- * 'List']` inside a bulleted item), and nothing else, so a rule cannot depend on a
2528
- * selection, a clock, or the Model.
2529
- */
2530
- interface InputRule {
2531
- readonly name: string;
2532
- readonly match: (textBefore: string, within: ReadonlyArray<string>) => InputMatch | undefined;
2533
- }
2534
- /** One edit to read a rule against, named so two strings cannot be handed over swapped. */
2535
- interface InputContext {
2536
- /** The caret's block text before the caret, before this insertion. */
2537
- readonly textBefore: string;
2538
- /** What was just typed. */
2539
- readonly text: string;
2540
- /** The insertion itself, which a matching rule then acts on. */
2541
- readonly insertion: Command;
2542
- /** The kinds of the node blocks around the caret's block, innermost first. Default none. */
2543
- readonly within?: ReadonlyArray<string>;
2544
- }
2545
- /**
2546
- * The commands that insert the text and then let the first matching rule act on it: the
2547
- * insertion, one backward delete per character the rule consumed, and the rule's commands.
2548
- * Consumption is by deleting backwards rather than by a range, because a range would have
2549
- * to be computed against a state the insertion has not produced yet — the deletes resolve
2550
- * as each one runs. A rule that does not match yields the insertion alone.
2551
- *
2552
- * A rule that claims to consume more than it was shown throws: those deletes would run past
2553
- * the block's start and join it to the one before, which no rule means.
2554
- */
2555
- export declare const applyInputRules: (rules: ReadonlyArray<InputRule>, input: InputContext) => Action;
2556
- /**
2557
- * `applyInputRules`, with the marks the matching rule says the next typed text carries, which an
2558
- * editor keeps as its stored marks.
2559
- */
2560
- export declare const resolveInputRules: (rules: ReadonlyArray<InputRule>, input: InputContext) => {
2561
- readonly action: Action;
2562
- readonly storedMarks?: ReadonlyArray<string> | undefined;
2563
- };
2564
- /**
2565
- * Local undo history over editor snapshots. Snapshots are `EditorState` values
2566
- * (document plus selection), so undo restores what the user saw, including the
2567
- * caret. History is interaction state: it belongs in the application Model
2568
- * beside the selection, never in published content, and collaborative undo is a
2569
- * different operation (§§65–66).
2570
- */
2571
- export declare const History: Schema.Struct<{
2572
- /** States to return to, oldest first. */
2573
- readonly past: Schema.$Array<Schema.Struct<{
2574
- readonly document: Schema.Struct<{
2575
- readonly version: Schema.Literal<1>;
2576
- readonly children: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
2577
- readonly type: Schema.Literal<"Paragraph">;
2578
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2579
- readonly children: Schema.$Array<Schema.Struct<{
2580
- readonly type: Schema.Literal<"Text">;
2581
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2582
- readonly text: Schema.String;
2583
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2584
- readonly name: Schema.NonEmptyString;
2585
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2586
- }>]>>;
2587
- }>>;
2588
- }>, Schema.Struct<{
2589
- readonly type: Schema.Literal<"Heading">;
2590
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2591
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
2592
- readonly children: Schema.$Array<Schema.Struct<{
2593
- readonly type: Schema.Literal<"Text">;
2594
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2595
- readonly text: Schema.String;
2596
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2597
- readonly name: Schema.NonEmptyString;
2598
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2599
- }>]>>;
2600
- }>>;
2601
- }>, Schema.Struct<{
2602
- readonly type: Schema.Literal<"Node">;
2603
- readonly kind: Schema.NonEmptyString;
2604
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2605
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2606
- readonly children: Schema.$Array<Schema.Struct<{
2607
- readonly type: Schema.Literal<"Text">;
2608
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2609
- readonly text: Schema.String;
2610
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2611
- readonly name: Schema.NonEmptyString;
2612
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2613
- }>]>>;
2614
- }>>;
2615
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
2616
- readonly type: 'Node';
2617
- readonly kind: string;
2618
- readonly id: string;
2619
- readonly props: {
2620
- 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;
2621
- };
2622
- readonly children: readonly {
2623
- readonly type: "Text";
2624
- readonly id: string;
2625
- readonly text: string;
2626
- readonly marks: readonly (string | {
2627
- readonly name: string;
2628
- readonly props?: {
2629
- 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)[] | {
2630
- 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;
2631
- } | null;
2632
- };
2633
- })[];
2634
- }[];
2635
- readonly blocks?: readonly ( /*elided*/ any | {
2636
- readonly type: "Paragraph";
2637
- readonly id: string;
2638
- readonly children: readonly {
2639
- readonly type: "Text";
2640
- readonly id: string;
2641
- readonly text: string;
2642
- readonly marks: readonly (string | {
2643
- readonly name: string;
2644
- readonly props?: {
2645
- 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)[] | {
2646
- 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;
2647
- } | null;
2648
- };
2649
- })[];
2650
- }[];
2651
- } | {
2652
- readonly type: "Heading";
2653
- readonly id: string;
2654
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
2655
- readonly children: readonly {
2656
- readonly type: "Text";
2657
- readonly id: string;
2658
- readonly text: string;
2659
- readonly marks: readonly (string | {
2660
- readonly name: string;
2661
- readonly props?: {
2662
- 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)[] | {
2663
- 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;
2664
- } | null;
2665
- };
2666
- })[];
2667
- }[];
2668
- } | {
2669
- readonly type: "Unknown";
2670
- readonly id: string;
2671
- readonly originalType: string;
2672
- readonly props: {
2673
- 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)[] | {
2674
- 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;
2675
- } | null;
2676
- };
2677
- readonly children: readonly {
2678
- readonly type: "Text";
2679
- readonly id: string;
2680
- readonly text: string;
2681
- readonly marks: readonly (string | {
2682
- readonly name: string;
2683
- readonly props?: {
2684
- 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)[] | {
2685
- 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;
2686
- } | null;
2687
- };
2688
- })[];
2689
- }[];
2690
- })[];
2691
- } | {
2692
- readonly type: "Paragraph";
2693
- readonly id: string;
2694
- readonly children: readonly {
2695
- readonly type: "Text";
2696
- readonly id: string;
2697
- readonly text: string;
2698
- readonly marks: readonly (string | {
2699
- readonly name: string;
2700
- readonly props?: {
2701
- 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)[] | {
2702
- 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;
2703
- } | null;
2704
- };
2705
- })[];
2706
- }[];
2707
- } | {
2708
- readonly type: "Heading";
2709
- readonly id: string;
2710
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
2711
- readonly children: readonly {
2712
- readonly type: "Text";
2713
- readonly id: string;
2714
- readonly text: string;
2715
- readonly marks: readonly (string | {
2716
- readonly name: string;
2717
- readonly props?: {
2718
- 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)[] | {
2719
- 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;
2720
- } | null;
2721
- };
2722
- })[];
2723
- }[];
2724
- } | {
2725
- readonly type: "Unknown";
2726
- readonly id: string;
2727
- readonly originalType: string;
2728
- readonly props: {
2729
- 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)[] | {
2730
- 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;
2731
- } | null;
2732
- };
2733
- readonly children: readonly {
2734
- readonly type: "Text";
2735
- readonly id: string;
2736
- readonly text: string;
2737
- readonly marks: readonly (string | {
2738
- readonly name: string;
2739
- readonly props?: {
2740
- 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)[] | {
2741
- 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;
2742
- } | null;
2743
- };
2744
- })[];
2745
- }[];
2746
- })[], never, never>>>;
2747
- }>, Schema.Struct<{
2748
- readonly type: Schema.Literal<"Unknown">;
2749
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2750
- readonly originalType: Schema.NonEmptyString;
2751
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2752
- readonly children: Schema.$Array<Schema.Struct<{
2753
- readonly type: Schema.Literal<"Text">;
2754
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2755
- readonly text: Schema.String;
2756
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2757
- readonly name: Schema.NonEmptyString;
2758
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2759
- }>]>>;
2760
- }>>;
2761
- }>]>>;
2762
- }>;
2763
- readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
2764
- readonly type: Schema.Literal<"Range">;
2765
- readonly anchor: Schema.Struct<{
2766
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2767
- readonly offset: Schema.Number;
2768
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
2769
- }>;
2770
- readonly focus: Schema.Struct<{
2771
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2772
- readonly offset: Schema.Number;
2773
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
2774
- }>;
2775
- }>, Schema.Struct<{
2776
- readonly type: Schema.Literal<"Node">;
2777
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2778
- }>]>>;
2779
- }>>;
2780
- /** States undone from, nearest first. */
2781
- readonly future: Schema.$Array<Schema.Struct<{
2782
- readonly document: Schema.Struct<{
2783
- readonly version: Schema.Literal<1>;
2784
- readonly children: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
2785
- readonly type: Schema.Literal<"Paragraph">;
2786
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2787
- readonly children: Schema.$Array<Schema.Struct<{
2788
- readonly type: Schema.Literal<"Text">;
2789
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2790
- readonly text: Schema.String;
2791
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2792
- readonly name: Schema.NonEmptyString;
2793
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2794
- }>]>>;
2795
- }>>;
2796
- }>, Schema.Struct<{
2797
- readonly type: Schema.Literal<"Heading">;
2798
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2799
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
2800
- readonly children: Schema.$Array<Schema.Struct<{
2801
- readonly type: Schema.Literal<"Text">;
2802
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2803
- readonly text: Schema.String;
2804
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2805
- readonly name: Schema.NonEmptyString;
2806
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2807
- }>]>>;
2808
- }>>;
2809
- }>, Schema.Struct<{
2810
- readonly type: Schema.Literal<"Node">;
2811
- readonly kind: Schema.NonEmptyString;
2812
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2813
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2814
- readonly children: Schema.$Array<Schema.Struct<{
2815
- readonly type: Schema.Literal<"Text">;
2816
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2817
- readonly text: Schema.String;
2818
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2819
- readonly name: Schema.NonEmptyString;
2820
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2821
- }>]>>;
2822
- }>>;
2823
- readonly blocks: Schema.optionalKey<Schema.suspend<Schema.Codec<readonly Block[], readonly ({
2824
- readonly type: 'Node';
2825
- readonly kind: string;
2826
- readonly id: string;
2827
- readonly props: {
2828
- 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;
2829
- };
2830
- readonly children: readonly {
2831
- readonly type: "Text";
2832
- readonly id: string;
2833
- readonly text: string;
2834
- readonly marks: readonly (string | {
2835
- readonly name: string;
2836
- readonly props?: {
2837
- 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)[] | {
2838
- 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;
2839
- } | null;
2840
- };
2841
- })[];
2842
- }[];
2843
- readonly blocks?: readonly (any | {
2844
- readonly type: "Paragraph";
2845
- readonly id: string;
2846
- readonly children: readonly {
2847
- readonly type: "Text";
2848
- readonly id: string;
2849
- readonly text: string;
2850
- readonly marks: readonly (string | {
2851
- readonly name: string;
2852
- readonly props?: {
2853
- 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)[] | {
2854
- 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;
2855
- } | null;
2856
- };
2857
- })[];
2858
- }[];
2859
- } | {
2860
- readonly type: "Heading";
2861
- readonly id: string;
2862
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
2863
- readonly children: readonly {
2864
- readonly type: "Text";
2865
- readonly id: string;
2866
- readonly text: string;
2867
- readonly marks: readonly (string | {
2868
- readonly name: string;
2869
- readonly props?: {
2870
- 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)[] | {
2871
- 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;
2872
- } | null;
2873
- };
2874
- })[];
2875
- }[];
2876
- } | {
2877
- readonly type: "Unknown";
2878
- readonly id: string;
2879
- readonly originalType: string;
2880
- readonly props: {
2881
- 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)[] | {
2882
- 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;
2883
- } | null;
2884
- };
2885
- readonly children: readonly {
2886
- readonly type: "Text";
2887
- readonly id: string;
2888
- readonly text: string;
2889
- readonly marks: readonly (string | {
2890
- readonly name: string;
2891
- readonly props?: {
2892
- 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)[] | {
2893
- 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;
2894
- } | null;
2895
- };
2896
- })[];
2897
- }[];
2898
- })[];
2899
- } | {
2900
- readonly type: "Paragraph";
2901
- readonly id: string;
2902
- readonly children: readonly {
2903
- readonly type: "Text";
2904
- readonly id: string;
2905
- readonly text: string;
2906
- readonly marks: readonly (string | {
2907
- readonly name: string;
2908
- readonly props?: {
2909
- 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)[] | {
2910
- 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;
2911
- } | null;
2912
- };
2913
- })[];
2914
- }[];
2915
- } | {
2916
- readonly type: "Heading";
2917
- readonly id: string;
2918
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
2919
- readonly children: readonly {
2920
- readonly type: "Text";
2921
- readonly id: string;
2922
- readonly text: string;
2923
- readonly marks: readonly (string | {
2924
- readonly name: string;
2925
- readonly props?: {
2926
- 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)[] | {
2927
- 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;
2928
- } | null;
2929
- };
2930
- })[];
2931
- }[];
2932
- } | {
2933
- readonly type: "Unknown";
2934
- readonly id: string;
2935
- readonly originalType: string;
2936
- readonly props: {
2937
- 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)[] | {
2938
- 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;
2939
- } | null;
2940
- };
2941
- readonly children: readonly {
2942
- readonly type: "Text";
2943
- readonly id: string;
2944
- readonly text: string;
2945
- readonly marks: readonly (string | {
2946
- readonly name: string;
2947
- readonly props?: {
2948
- 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)[] | {
2949
- 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;
2950
- } | null;
2951
- };
2952
- })[];
2953
- }[];
2954
- })[], never, never>>>;
2955
- }>, Schema.Struct<{
2956
- readonly type: Schema.Literal<"Unknown">;
2957
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2958
- readonly originalType: Schema.NonEmptyString;
2959
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2960
- readonly children: Schema.$Array<Schema.Struct<{
2961
- readonly type: Schema.Literal<"Text">;
2962
- readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2963
- readonly text: Schema.String;
2964
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
2965
- readonly name: Schema.NonEmptyString;
2966
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2967
- }>]>>;
2968
- }>>;
2969
- }>]>>;
2970
- }>;
2971
- readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
2972
- readonly type: Schema.Literal<"Range">;
2973
- readonly anchor: Schema.Struct<{
2974
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2975
- readonly offset: Schema.Number;
2976
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
2977
- }>;
2978
- readonly focus: Schema.Struct<{
2979
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2980
- readonly offset: Schema.Number;
2981
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
2982
- }>;
2983
- }>, Schema.Struct<{
2984
- readonly type: Schema.Literal<"Node">;
2985
- readonly node: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">;
2986
- }>]>>;
2987
- }>>;
2988
- /** The group the last commit joined, if any. */
2989
- readonly group: Schema.optional<Schema.String>;
2990
- }>;
2991
- export type History = typeof History.Type;
2992
- export declare const emptyHistory: History;
2993
- interface CommitOptions {
2994
- /**
2995
- * Joins the previous step when it used the same group. Consecutive typing
2996
- * shares one undo step; omit the group and every commit stands alone.
2997
- */
2998
- readonly group?: string | undefined;
2999
- /** Most steps to keep; the oldest is dropped beyond this. Default 200. */
3000
- readonly capacity?: number;
3001
- }
3002
- /**
3003
- * Typing continues one undo step; every other command is its own step. Callers
3004
- * pass this to `commit`, so grouping policy lives with the editor vocabulary
3005
- * rather than being reinvented per adapter.
3006
- */
3007
- export declare const groupFor: (command: Command) => string | undefined;
3008
- /**
3009
- * Records a committed transition. `previous` is the state before the command
3010
- * and `next` the state after it; only `previous` is stored, because the caller
3011
- * already holds `next`.
3012
- */
3013
- export declare const commit: (history: History, previous: EditorState, options?: CommitOptions) => History;
3014
- interface Restore {
3015
- readonly history: History;
3016
- readonly state: EditorState;
3017
- }
3018
- /** Steps back one group. Returns undefined when there is nothing to undo. */
3019
- export declare const undo: (history: History, current: EditorState) => Restore | undefined;
3020
- /** Steps forward again. Returns undefined when there is nothing to redo. */
3021
- export declare const redo: (history: History, current: EditorState) => Restore | undefined;
3022
- export declare const canUndo: (history: History) => boolean;
3023
- export declare const canRedo: (history: History) => boolean;
3024
- /** Structural summary for tooling and tests. */
3025
- export declare const inspectHistory: (history: History) => {
3026
- past: number;
3027
- future: number;
3028
- group: string | null;
3029
- };
3030
- /**
3031
- * How an element is rendered: a tag and its attributes. Data, not a view (§121),
3032
- * so the DOM-free serializer writes it and the DOM interpreters build it without
3033
- * the core learning about Foldkit or the DOM.
3034
- */
3035
- interface ElementRendering {
3036
- readonly tag: string;
3037
- /** Values are escaped when written; a name that would end the markup is refused. */
3038
- readonly attributes: Readonly<Record<string, string>>;
3039
- /**
3040
- * An element the nested blocks go inside, where HTML's parser would insert one anyway: a
3041
- * `table`'s rows go in a `tbody`. Without it, markup sent from a server parses to a tree
3042
- * the renderer did not write, and Foldkit refuses to serialize it.
3043
- */
3044
- readonly inner?: string | undefined;
3045
- /**
3046
- * Elements drawn inside the block before its content that are not content: a task's
3047
- * checkbox, an image's picture and caption, a callout's icon. They hold no position, are
3048
- * never edited as text, and an HTML import skips them, so a block's text stays its runs'.
3049
- */
3050
- readonly adornments?: ReadonlyArray<Adornment> | undefined;
3051
- }
3052
- /**
3053
- * One element of a block's adornments. `toggles` names a boolean prop of the block that a click
3054
- * on the element flips, through the editor's own Message (a task's `checked`, a toggle's
3055
- * `open`), so the document stays the one place that state lives. `action` names something a
3056
- * click on it asks the application for that is not an edit, a code block's Copy or its language
3057
- * menu: the editor reports it, with the block, and changes nothing.
3058
- */
3059
- interface Adornment {
3060
- readonly tag: string;
3061
- readonly attributes: Readonly<Record<string, string>>;
3062
- readonly text?: string | undefined;
3063
- readonly toggles?: string | undefined;
3064
- readonly action?: string | undefined;
3065
- }
3066
- /** The attribute that marks an element as an adornment, which every interpreter skips as content. */
3067
- export declare const ADORNMENT_ATTRIBUTE = "data-adornment";
3068
- /** The attribute naming the prop an adornment's click flips. */
3069
- export declare const TOGGLES_ATTRIBUTE = "data-toggles";
3070
- /** The attribute naming what an adornment's click asks the application for. */
3071
- export declare const ACTION_ATTRIBUTE = "data-action";
3072
- /** An adornment's attributes as every interpreter writes them: its own, then the markers. */
3073
- export declare const adornmentAttributes: (adornment: Adornment) => ReadonlyArray<readonly [string, string]>;
3074
- /** Whether two renderings draw the same element: tag, attributes, holder and adornments. */
3075
- export declare const sameElementRendering: (left: ElementRendering, right: ElementRendering) => boolean;
3076
- /**
3077
- * A rendering entry: fixed data, or computed from the value being rendered, which
3078
- * is how a mark's attributes reach its props. `undefined` means the entry does not
3079
- * apply, so the name falls back the way an entry-less name does.
3080
- */
3081
- type RenderingEntry<Value> = ElementRendering | ((value: Value) => ElementRendering | undefined);
3082
- /**
3083
- * A vocabulary of renderings built *over* a Kit, never inside it (§34, §121). A
3084
- * name with no entry renders the shipped way: its mark nests in `strong`, `em`, or
3085
- * `code`, an application node keeps its default element, and any other name rides
3086
- * on `data-marks` — which is what keeps the slice format and an HTML round trip
3087
- * lossless rather than lossy.
3088
- */
3089
- interface Rendering {
3090
- readonly marks: Readonly<Record<string, RenderingEntry<RunMark>>>;
3091
- readonly nodes: Readonly<Record<string, RenderingEntry<NodeBlock>>>;
3092
- }
3093
- export declare const rendering: (definition?: {
3094
- readonly marks?: Readonly<Record<string, RenderingEntry<RunMark>>>;
3095
- readonly nodes?: Readonly<Record<string, RenderingEntry<NodeBlock>>>;
3096
- }) => Rendering;
3097
- /** The behaviour without a renderer: shipped tags for shipped marks, names otherwise. */
3098
- export declare const noRendering: Rendering;
3099
- /**
3100
- * A registry built over another: an entry named here wins, and every name the base
3101
- * renders keeps its entry, so an application extends a vocabulary like the standard one
3102
- * without restating it.
3103
- */
3104
- export declare const renderingOver: (base: Rendering, definition?: {
3105
- readonly marks?: Readonly<Record<string, RenderingEntry<RunMark>>>;
3106
- readonly nodes?: Readonly<Record<string, RenderingEntry<NodeBlock>>>;
3107
- }) => Rendering;
3108
- /** What a run's marks nest in, and which names nest nowhere. */
3109
- interface RunRendering {
3110
- /** Elements to wrap the run's text in, innermost first. */
3111
- readonly nest: ReadonlyArray<ElementRendering>;
3112
- /** Names with neither an entry nor a shipped tag, sorted so output is stable. */
3113
- readonly unrendered: ReadonlyArray<string>;
3114
- }
3115
- /**
3116
- * Resolves a run's marks to elements. Order is the vocabulary's, then names
3117
- * alphabetically, never the order marks happen to be stored in — the same set of
3118
- * marks must serialize the same way however it was assembled. An entry for a
3119
- * shipped name replaces that name's tag but keeps its place in the nesting.
3120
- */
3121
- export declare const runRendering: (definition: Rendering, run: Text) => RunRendering;
3122
- /** The element a node kind renders as, or undefined when no entry applies. */
3123
- export declare const nodeRendering: (definition: Rendering, block: NodeBlock) => ElementRendering | undefined;
3124
- /**
3125
- * HTML is an interchange format, not the document model (§70). This serializer
3126
- * exists so a copy can offer HTML to other applications and a preview can be
3127
- * read by anything; nothing here is ever parsed back into authority. Unknown
3128
- * marks survive as `data-marks` on a span and unknown blocks as a placeholder
3129
- * carrying their original type, so a round trip through HTML cannot silently
3130
- * invent formatting the document never had.
3131
- *
3132
- * A renderer (§121) decides which element a declared mark or node kind produces,
3133
- * which is how a Link's `href` becomes a real attribute. Without one, this
3134
- * fallback still carries mark *names*, and a mark's props travel in the slice
3135
- * format, which is the lossless path.
3136
- */
3137
- type BlockList = ReadonlyArray<Block>;
3138
- /** Serializes blocks as HTML, with text and attributes escaped. */
3139
- export declare const toHtml: (blocks: BlockList, renderer?: Rendering) => string;
3140
- /**
3141
- * Plain text of blocks, one line per text block; unknown blocks keep a
3142
- * placeholder and a container contributes its children's lines.
3143
- */
3144
- export declare const toText: (blocks: BlockList) => string;
3145
- /** Convenience for a whole document, whose blocks are its children. */
3146
- export declare const documentToHtml: (document: Document, renderer?: Rendering) => string;
3147
- export declare const documentToText: (document: Document) => string;
3148
- /**
3149
- * One decoration over a document range. `kind` is a fixed word the presentation is
3150
- * chosen by (`search`, `syntax`, `cursor`, …); `data` is the renderer's own payload,
3151
- * which the core never reads.
3152
- */
3153
- interface Decoration<Data = unknown> {
3154
- readonly from: Position;
3155
- readonly to: Position;
3156
- readonly kind: string;
3157
- readonly data?: Data;
3158
- }
3159
- /** A set of decorations is a value, computed for one render and then discarded. */
3160
- type DecorationSet<Data = unknown> = ReadonlyArray<Decoration<Data>>;
3161
- /** A decoration's sub-range inside one run, in that run's own offsets. */
3162
- interface DecorationSpan<Data = unknown> {
3163
- readonly from: number;
3164
- readonly to: number;
3165
- readonly decoration: Decoration<Data>;
3166
- }
3167
- /**
3168
- * The decorations covering each run, as offsets into it, in document order. A decoration
3169
- * that crosses runs is cut at each run's edge, so a renderer never has to reason about
3170
- * document order; a decoration whose endpoints do not resolve is skipped rather than
3171
- * guessed at, the way every other read treats a position it cannot resolve, and a
3172
- * direction is honoured rather than required to run forwards.
3173
- *
3174
- * The runs are indexed once, so a decoration costs the runs it covers: a hundred search
3175
- * matches over a long document is one walk, not a hundred.
3176
- */
3177
- export declare const decorationsIn: <Data>(document: Document, set: DecorationSet<Data>) => ReadonlyMap<NodeId, ReadonlyArray<DecorationSpan<Data>>>;
3178
- /** A stretch of one run's text, and the decorations covering all of it. */
3179
- interface RunPiece<Data = unknown> {
3180
- readonly text: string;
3181
- readonly decorations: ReadonlyArray<Decoration<Data>>;
3182
- }
3183
- /**
3184
- * A run's text cut at every edge of the spans over it, each piece with the decorations
3185
- * that cover it — what every interpreter draws, so each draws the same pieces. An empty run,
3186
- * or one no span touches, is one undecorated piece: an interpreter still has to render
3187
- * somewhere for a caret to sit, and nothing can be drawn over no text.
3188
- */
3189
- export declare const runPieces: <Data>(text: string, spans: ReadonlyArray<DecorationSpan<Data>>) => ReadonlyArray<RunPiece<Data>>;
3190
- /** The kind a search decoration carries, which is what a stylesheet reaches it by. */
3191
- export declare const SEARCH_DECORATION = "search";
3192
- /** The kind the match a find bar is on carries instead, so it can be drawn apart. */
3193
- export declare const SEARCH_CURRENT_DECORATION = "search-current";
3194
- interface SearchOptions {
3195
- /** Whether case counts; by default it does not. */
3196
- readonly caseSensitive?: boolean | undefined;
3197
- }
3198
- /** One occurrence: its block, its offset in the block's text, and its ends as positions. */
3199
- interface SearchMatch {
3200
- readonly block: NodeId;
3201
- readonly at: number;
3202
- readonly length: number;
3203
- readonly from: Position;
3204
- readonly to: Position;
3205
- }
3206
- /** Every occurrence of `query`, in document order; none for an empty query. */
3207
- export declare const findMatches: (document: Document, query: string, options?: SearchOptions) => ReadonlyArray<SearchMatch>;
3208
- /**
3209
- * Every occurrence of `query` in the document, as decorations a renderer can draw; the one at
3210
- * index `current`, when given, carries `search-current` instead of `search`.
3211
- */
3212
- export declare const searchDecorations: (document: Document, query: string, options?: SearchOptions & {
3213
- readonly current?: number | undefined;
3214
- }) => DecorationSet;
3215
- /**
3216
- * One token in a code block's text, as offsets into that text. `kind` becomes the
3217
- * decoration's kind, so it is what a stylesheet reaches the token by — a grammar names its
3218
- * kinds `syntax-string`, `syntax-number`, and so on (§129).
3219
- */
3220
- interface CodeToken {
3221
- readonly from: number;
3222
- readonly to: number;
3223
- readonly kind: string;
3224
- }
3225
- /** A pure read of one code block's text. A tokenizer that needs to load first is Shiki's case. */
3226
- type CodeTokenizer = (text: string) => ReadonlyArray<CodeToken>;
3227
- /**
3228
- * Every token the given tokenizers find in the document's `CodeBlock`s, as decorations. A
3229
- * block is tokenized by the tokenizer registered for its `language` prop; one with no
3230
- * language, or one nothing is registered for, yields nothing. The registry is a `Map`
3231
- * because the language is read from the document, and a plain object would answer a
3232
- * language named `constructor` from its prototype.
3233
- *
3234
- * A token outside its block's text, one that covers nothing, or one at a fractional offset
3235
- * throws with the language that produced it: it is a tokenizer's bug, and a decoration guessed from it would
3236
- * highlight the wrong text.
3237
- */
3238
- export declare const codeDecorations: (document: Document, tokenizers: ReadonlyMap<string, CodeTokenizer>) => DecorationSet;
3239
- /**
3240
- * The URL policy every importer shares (§70, §124 §10). A link's `href` and an image's `src`
3241
- * arrive from pasted HTML or Markdown, which is untrusted, and the standard rendering writes
3242
- * them into attributes, so each passes here before it can become a prop, and again before
3243
- * the standard rendering writes it.
3244
- */
3245
- /**
3246
- * A URL safe to carry into props, or `undefined` when it is not. Control characters are
3247
- * removed first, because `java\tscript:` and a leading NUL are how a scheme check is
3248
- * usually walked past; then a URL that names a scheme outside the allowlist is refused,
3249
- * and one with no scheme — a relative path, a fragment, a protocol-relative URL — is
3250
- * kept. The value is never interpreted, only copied, so what a policy leaves through is
3251
- * still the application's to trust.
3252
- */
3253
- export declare const safeUrl: (value: string | null) => string | undefined;
3254
- /**
3255
- * A struck-through span. It expands `after`, so typing at its edge continues it, as
3256
- * bold and italic do.
3257
- */
3258
- export declare const Strikethrough: MarkDef<undefined>;
3259
- /**
3260
- * A hyperlink. Its `href` is a prop rather than a mark name, which is what lets the
3261
- * serializer render a real `<a href>` (§121); it expands `none`, because text typed
3262
- * after a link is new text, not a continuation of the link.
3263
- */
3264
- export declare const Link: MarkDef<Schema.Struct<{
3265
- readonly href: Schema.String;
3266
- }>>;
3267
- /** The link a selection starts in: its `href`, and the range of runs it spans. */
3268
- interface LinkAt {
3269
- /** The stored `href`, or `''` when the stored one is not a string. */
3270
- readonly href: string;
3271
- readonly selection: Extract<Selection, {
3272
- readonly type: 'Range';
3273
- }>;
3274
- }
3275
- /**
3276
- * The link a selection starts in, which is what a link editor opens on: at a caret, the
3277
- * link around it; over a range, the link its start is in. Undefined outside a link, and for
3278
- * a node selection, which covers blocks rather than text.
3279
- */
3280
- export declare const linkAt: (document: Document, selection: Selection | null) => LinkAt | undefined;
3281
- /** Every mark the standard vocabulary names, in menu order. */
3282
- export declare const standardMarks: ReadonlyArray<MarkDef>;
3283
- /**
3284
- * The standard node kinds. Constraints are what make a kind more than a name: a
3285
- * `List` accepts only `ListItem`s and a `Table` only `TableRow`s, so `validate`
3286
- * reports a document that says otherwise (§125); a `CodeBlock` carries text with no
3287
- * formatting, and its `language` is a prop, not a mark.
3288
- */
3289
- export declare const standardNodes: ReadonlyArray<NodeDefinition>;
3290
- /**
3291
- * An `Image`'s `width` and `height` attributes from its props' `asset`, at its drawn `width`
3292
- * when it has one, so a page keeps the box before the file arrives; none without facts. The
3293
- * standard rendering writes them; a rendering of its own (a figure) spreads them on its `img`.
3294
- * The facts are trusted to be `src`'s: whatever changes `src` replaces or clears `asset`.
3295
- */
3296
- export declare const imageBox: (props: Readonly<Record<string, unknown>>) => Readonly<Record<string, string>>;
3297
- /**
3298
- * How the standard vocabulary renders (§121): the element each kind is, with the props
3299
- * that belong in attributes read from the block, so a `Link` is an `<a href>`, an `Image`
3300
- * carries its source, and a `List` is an `<ol>` or a `<ul>`. The shipped marks already
3301
- * nest in `strong`/`em`/`code`; this adds the two that do not. An application composes it
3302
- * with `renderingOver` and names its own kinds beside it:
3303
- *
3304
- * ```ts
3305
- * renderingOver(RichText.standardRendering, { nodes: { Callout: { tag: 'aside' } } })
3306
- * ```
3307
- */
3308
- export declare const standardRendering: Rendering;
3309
- /**
3310
- * Migrations move semantic data forward when a deployment changes its
3311
- * vocabulary (§73): a preserved node that is now implemented, a prop renamed, a
3312
- * block kind replaced. They operate on blocks, never on DOM, and they run at a
3313
- * boundary the application chooses — loading, publishing, or an explicit
3314
- * upgrade — never automatically on every read.
3315
- *
3316
- * Two rules keep a migration safe to run anywhere:
3317
- *
3318
- * - **Identity survives.** A migration returns the same `id`, so positions,
3319
- * references, and selections keep addressing the same node.
3320
- * - **Declining is allowed.** Returning `undefined` keeps the block as it is,
3321
- * which is what a migration does when the data is not its shape after all.
3322
- */
3323
- interface Migration {
3324
- readonly name: string;
3325
- /** The type, kind, or preserved `originalType` this migration reads. */
3326
- readonly from: string;
3327
- /** The kind it produces, for a report; the returned block is the truth. */
3328
- readonly to?: string | undefined;
3329
- readonly migrate: (block: Block) => Block | undefined;
3330
- }
3331
- interface MigrationApplied {
3332
- readonly name: string;
3333
- readonly node: NodeId;
3334
- }
3335
- interface MigrationReport {
3336
- readonly document: Document;
3337
- /** Every block a migration rewrote, in the order it happened. */
3338
- readonly applied: ReadonlyArray<MigrationApplied>;
3339
- /** Migrations that found no block of their `from` in this document. */
3340
- readonly unused: ReadonlyArray<string>;
3341
- }
3342
- /** Declares a migration, checking at construction that it is shaped like one. */
3343
- export declare const migration: (name: string, from: string, migrate: (block: Block) => Block | undefined, to?: string) => Migration;
3344
- /**
3345
- * Runs each migration over every block it reads, in list order, descending into
3346
- * containers. A migration that changes a block's identity is a bug and throws
3347
- * rather than silently breaking every reference to that node.
3348
- */
3349
- export declare const migrate: (document: Document, migrations: ReadonlyArray<Migration>) => MigrationReport;
3350
- /**
3351
- * A migration from a preserved unknown block into a declared node kind: the
3352
- * props are decoded by the target's own schema, and a block whose data does not
3353
- * decode is left alone rather than half-converted. The target's content mode
3354
- * decides whether the promoted node holds runs or (empty) nested blocks, so
3355
- * promoting into a container kind produces a valid block rather than one the
3356
- * Kit will call a mismatch.
3357
- */
3358
- export declare const promoteUnknown: (name: string, from: string, to: string, Props: Schema.Codec<any, any, never>, children?: ContentMode) => Migration;
3359
- /** A node block's props as the codec stores them: plain JSON, nothing more. */
3360
- export declare const nodeProps: (block: NodeBlock) => Readonly<Record<string, unknown>>;
3361
- declare namespace replicated_d_exports {
3362
- export { AnchoredPosition, AnchoredSelection, BlockShape, CharRange, CharRef, ReplicatedId, ReplicatedOp, ReplicatedState, anchor, applyOps, coalesce, empty, fromDocument, invert, project, resolve, translate };
3363
- }
3364
- /**
3365
- * A document shared by several replicas, where every character has an identity that
3366
- * outlives the edits around it.
3367
- *
3368
- * The editor keeps working on a plain `Document`: `project` derives one from this state.
3369
- * An edit runs as an ordinary command against that projection, `translate` restates the
3370
- * transactions it applied as `ReplicatedOp`s that name characters and blocks rather than
3371
- * offsets and indices, and `applyOps` folds those ops into the state. Replicas converge
3372
- * because a server gives every op one order and `applyOps` is a deterministic, total
3373
- * function of the state and the ops: it never throws.
3374
- */
3375
- /**
3376
- * An identity this state minted: segments joined by `:`, at least two of them. The colon
3377
- * keeps an id from ever naming an `Object.prototype` key, which is why the block record is
3378
- * indexed directly, and the absent `.` is what separates an id from a character reference
3379
- * built on it.
3380
- */
3381
- declare const ReplicatedId: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3382
- type ReplicatedId = typeof ReplicatedId.Type;
3383
- /** A character: the insert that created it, and its index within that insert's text. */
3384
- declare const CharRef: Schema.brand<Schema.String, "foldkit-richtext/CharRef">;
3385
- type CharRef = typeof CharRef.Type;
3386
- /** Characters `from` up to, not including, `to` of one insert. */
3387
- declare const CharRange: Schema.Struct<{
3388
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3389
- readonly from: Schema.Number;
3390
- readonly to: Schema.Number;
3391
- }>;
3392
- type CharRange = typeof CharRange.Type;
3393
- /** What a block is, apart from its content and place. */
3394
- declare const BlockShape: Schema.Union<readonly [Schema.Struct<{
3395
- readonly type: Schema.Literal<"Paragraph">;
3396
- }>, Schema.Struct<{
3397
- readonly type: Schema.Literal<"Heading">;
3398
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
3399
- }>, Schema.Struct<{
3400
- readonly type: Schema.Literal<"Node">;
3401
- readonly kind: Schema.NonEmptyString;
3402
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3403
- /** What the node holds: runs, nested blocks, or nothing (an atom such as an image). */
3404
- readonly holds: Schema.Literals<readonly ["text", "blocks", "none"]>;
3405
- }>, Schema.Struct<{
3406
- readonly type: Schema.Literal<"Unknown">;
3407
- readonly originalType: Schema.NonEmptyString;
3408
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3409
- }>]>;
3410
- type BlockShape = typeof BlockShape.Type;
3411
- declare const ReplicatedState: Schema.Struct<{
3412
- readonly version: Schema.Literal<1>;
3413
- readonly root: Schema.$Array<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3414
- readonly blocks: Schema.$Record<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">, Schema.Struct<{
3415
- readonly shape: Schema.Union<readonly [Schema.Struct<{
3416
- readonly type: Schema.Literal<"Paragraph">;
3417
- }>, Schema.Struct<{
3418
- readonly type: Schema.Literal<"Heading">;
3419
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
3420
- }>, Schema.Struct<{
3421
- readonly type: Schema.Literal<"Node">;
3422
- readonly kind: Schema.NonEmptyString;
3423
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3424
- /** What the node holds: runs, nested blocks, or nothing (an atom such as an image). */
3425
- readonly holds: Schema.Literals<readonly ["text", "blocks", "none"]>;
3426
- }>, Schema.Struct<{
3427
- readonly type: Schema.Literal<"Unknown">;
3428
- readonly originalType: Schema.NonEmptyString;
3429
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3430
- }>]>;
3431
- readonly parent: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3432
- readonly spans: Schema.$Array<Schema.Struct<{
3433
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3434
- readonly offset: Schema.Number;
3435
- readonly text: Schema.NonEmptyString;
3436
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
3437
- readonly name: Schema.NonEmptyString;
3438
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
3439
- }>]>>;
3440
- readonly deleted: Schema.Boolean;
3441
- /** Deleted when a `Collect` ran, so the next one removes it. */
3442
- readonly swept: Schema.optionalKey<Schema.Boolean>;
3443
- /**
3444
- * The last character of a collected stretch, kept only so its insert's indexes are never
3445
- * reused. It is never shown again, not even by an undo.
3446
- */
3447
- readonly kept: Schema.optionalKey<Schema.Literal<true>>;
3448
- }>>;
3449
- /** Nested blocks in order, deleted ones included, so a sibling anchor still resolves. */
3450
- readonly children: Schema.$Array<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3451
- readonly deleted: Schema.Boolean;
3452
- /** Deleted when a `Collect` ran, so the next one removes the text it holds. */
3453
- readonly swept: Schema.optionalKey<Schema.Boolean>;
3454
- /** Where a joined block's start now is: after this character of `into`, or its start. */
3455
- readonly joined: Schema.optionalKey<Schema.Struct<{
3456
- readonly into: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3457
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3458
- }>>;
3459
- }>>;
3460
- }>;
3461
- type ReplicatedState = typeof ReplicatedState.Type;
3462
- /**
3463
- * One change, naming what it touches by identity. Inserts and splits anchor after a
3464
- * character, or at a block's start when `after` is null; block ops anchor after a sibling,
3465
- * or at the start of the container when `after` is null.
3466
- */
3467
- declare const ReplicatedOp: Schema.Union<readonly [Schema.Struct<{
3468
- readonly type: Schema.Literal<"Insert">;
3469
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3470
- /** The block the anchor was in when the op was made: where a lost anchor falls back to. */
3471
- readonly block: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3472
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3473
- readonly text: Schema.NonEmptyString;
3474
- readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
3475
- readonly name: Schema.NonEmptyString;
3476
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
3477
- }>]>>;
3478
- /**
3479
- * The index of its first character, when it continues an insert of the same id rather
3480
- * than starting one: `id.from` onwards. Absent means 0.
3481
- */
3482
- readonly from: Schema.optionalKey<Schema.Number>;
3483
- }>, Schema.Struct<{
3484
- readonly type: Schema.Literal<"Delete">;
3485
- readonly ranges: Schema.$Array<Schema.Struct<{
3486
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3487
- readonly from: Schema.Number;
3488
- readonly to: Schema.Number;
3489
- }>>;
3490
- }>, Schema.Struct<{
3491
- readonly type: Schema.Literal<"Mark">;
3492
- readonly ranges: Schema.$Array<Schema.Struct<{
3493
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3494
- readonly from: Schema.Number;
3495
- readonly to: Schema.Number;
3496
- }>>;
3497
- readonly mark: Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{
3498
- readonly name: Schema.NonEmptyString;
3499
- readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
3500
- }>]>;
3501
- }>, Schema.Struct<{
3502
- readonly type: Schema.Literal<"Unmark">;
3503
- readonly ranges: Schema.$Array<Schema.Struct<{
3504
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3505
- readonly from: Schema.Number;
3506
- readonly to: Schema.Number;
3507
- }>>;
3508
- readonly name: Schema.NonEmptyString;
3509
- }>, Schema.Struct<{
3510
- readonly type: Schema.Literal<"InsertBlock">;
3511
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3512
- readonly shape: Schema.Union<readonly [Schema.Struct<{
3513
- readonly type: Schema.Literal<"Paragraph">;
3514
- }>, Schema.Struct<{
3515
- readonly type: Schema.Literal<"Heading">;
3516
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
3517
- }>, Schema.Struct<{
3518
- readonly type: Schema.Literal<"Node">;
3519
- readonly kind: Schema.NonEmptyString;
3520
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3521
- /** What the node holds: runs, nested blocks, or nothing (an atom such as an image). */
3522
- readonly holds: Schema.Literals<readonly ["text", "blocks", "none"]>;
3523
- }>, Schema.Struct<{
3524
- readonly type: Schema.Literal<"Unknown">;
3525
- readonly originalType: Schema.NonEmptyString;
3526
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3527
- }>]>;
3528
- readonly parent: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3529
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3530
- }>, Schema.Struct<{
3531
- readonly type: Schema.Literal<"DeleteBlock">;
3532
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3533
- }>, Schema.Struct<{
3534
- readonly type: Schema.Literal<"MoveBlock">;
3535
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3536
- readonly parent: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3537
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3538
- }>, Schema.Struct<{
3539
- readonly type: Schema.Literal<"Split">;
3540
- readonly block: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3541
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3542
- readonly into: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3543
- }>, Schema.Struct<{
3544
- readonly type: Schema.Literal<"Join">;
3545
- readonly into: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3546
- readonly removed: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3547
- /**
3548
- * The last character of `into` when the op was made, or null when it had none: the
3549
- * removed block's text goes right after it, wherever it has gone since, so a join still
3550
- * lands where it was made after `into` is split or joined itself.
3551
- */
3552
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3553
- /**
3554
- * `'end'` puts the text at the end of the block holding `after` (of `into` when null) as
3555
- * that block is when the join applies, so text typed at its end since stays before it.
3556
- * Only undo makes it: rejoining halves someone has typed into since.
3557
- */
3558
- readonly at: Schema.optionalKey<Schema.Literal<"end">>;
3559
- }>, Schema.Struct<{
3560
- readonly type: Schema.Literal<"Retype">;
3561
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3562
- readonly to: Schema.Union<readonly [Schema.Struct<{
3563
- readonly type: Schema.Literal<"Paragraph">;
3564
- }>, Schema.Struct<{
3565
- readonly type: Schema.Literal<"Heading">;
3566
- readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>;
3567
- }>, Schema.Struct<{
3568
- readonly type: Schema.Literal<"Node">;
3569
- readonly kind: Schema.NonEmptyString;
3570
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3571
- }>]>;
3572
- }>, Schema.Struct<{
3573
- readonly type: Schema.Literal<"SetProps">;
3574
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3575
- readonly props: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3576
- }>, Schema.Struct<{
3577
- readonly type: Schema.Literal<"Undelete">;
3578
- readonly ranges: Schema.$Array<Schema.Struct<{
3579
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3580
- readonly from: Schema.Number;
3581
- readonly to: Schema.Number;
3582
- }>>;
3583
- }>, Schema.Struct<{
3584
- readonly type: Schema.Literal<"UndeleteBlock">;
3585
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3586
- }>, Schema.Struct<{
3587
- readonly type: Schema.Literal<"Unjoin">;
3588
- /** The block a join removed, restored where it stood. */
3589
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3590
- /** The characters it held, taken back from wherever they are now. */
3591
- readonly ranges: Schema.$Array<Schema.Struct<{
3592
- readonly id: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3593
- readonly from: Schema.Number;
3594
- readonly to: Schema.Number;
3595
- }>>;
3596
- /** The nested blocks it held, taken back from the container they were joined into. */
3597
- readonly children: Schema.$Array<Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">>;
3598
- }>, Schema.Struct<{
3599
- readonly type: Schema.Literal<"Collect">;
3600
- }>]>;
3601
- type ReplicatedOp = typeof ReplicatedOp.Type;
3602
- declare const empty: ReplicatedState;
3603
- /**
3604
- * Folds ops into the state in order. Total: an op whose target is gone, whose ids are
3605
- * already taken, or that would make the tree cyclic changes nothing, and an insert or split
3606
- * anchored on a character that is gone (never arrived, or collected) lands at the end of the
3607
- * block it names, or of the block that one was joined into. It trusts the
3608
- * state to be one these functions made (the ops are the untrusted input): a state decoded
3609
- * from elsewhere is not checked for a block listed twice or a cycle of parents.
3610
- *
3611
- * The same ops on the same state give back the same state object, so the edit that made
3612
- * the ops and the durable Message that replays them agree on identity, and whatever is
3613
- * derived from it (`project`, an editor host's key) is derived once. The ops array is
3614
- * remembered by identity, so do not change one after applying it.
3615
- */
3616
- declare const applyOps: (state: ReplicatedState, ops: ReadonlyArray<ReplicatedOp>) => ReplicatedState;
3617
- /**
3618
- * The same ops with each insert that continues the one right before it folded into that one:
3619
- * a run of typing `translate` carried on as one insert becomes one op again. For ops
3620
- * `translate` made, which never reuse a character, applying the result shows what applying
3621
- * `ops` does.
3622
- */
3623
- declare const coalesce: (ops: ReadonlyArray<ReplicatedOp>) => ReadonlyArray<ReplicatedOp>;
3624
- /**
3625
- * The ops that undo `ops`, made against `state`, the state `ops` were applied to. Applied
3626
- * after `ops` and after whatever else has happened since, they take back what `ops` did
3627
- * and leave the rest alone. Characters it inserted are deleted, and characters it deleted
3628
- * come back. Marks, block types and props return to what they were, a split is joined and
3629
- * a join split out, and a moved block goes back beside the sibling it followed. A prop it
3630
- * added where there was none stays, since `SetProps` cannot delete one. Inverting the
3631
- * result gives the ops that redo it.
3632
- */
3633
- declare const invert: (state: ReplicatedState, ops: ReadonlyArray<ReplicatedOp>) => ReadonlyArray<ReplicatedOp>;
3634
- /** The document a state shows: visible blocks and characters, with runs merged by marks. */
3635
- declare const project: (state: ReplicatedState) => Document;
3636
- /**
3637
- * A state that shows `document`, with every block and character given a new identity
3638
- * under `key`, which must be unique among the keys this state's ops are minted under.
3639
- */
3640
- declare const fromDocument: (document: Document, key: string) => ReplicatedState;
3641
- /** A caret or selection end held by what it sits after, so it survives others' edits. */
3642
- declare const AnchoredPosition: Schema.Struct<{
3643
- readonly block: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3644
- /** The character just before the position, or null at the block's start. */
3645
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3646
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
3647
- }>;
3648
- type AnchoredPosition = typeof AnchoredPosition.Type;
3649
- declare const AnchoredSelection: Schema.Union<readonly [Schema.Struct<{
3650
- readonly type: Schema.Literal<"Range">;
3651
- readonly anchor: Schema.Struct<{
3652
- readonly block: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3653
- /** The character just before the position, or null at the block's start. */
3654
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3655
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
3656
- }>;
3657
- readonly focus: Schema.Struct<{
3658
- readonly block: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3659
- /** The character just before the position, or null at the block's start. */
3660
- readonly after: Schema.NullOr<Schema.brand<Schema.String, "foldkit-richtext/CharRef">>;
3661
- readonly affinity: Schema.Literals<readonly ["before", "after"]>;
3662
- }>;
3663
- }>, Schema.Struct<{
3664
- readonly type: Schema.Literal<"Node">;
3665
- readonly node: Schema.brand<Schema.String, "foldkit-richtext/ReplicatedId">;
3666
- }>]>;
3667
- type AnchoredSelection = typeof AnchoredSelection.Type;
3668
- /**
3669
- * Restates an edit's transactions as ops against `state`, which the edit ran on the
3670
- * projection of. `key` must be unique to this edit among everything the state has seen: it
3671
- * names the edit's new characters and blocks. Also anchors the edit's resulting selection.
3672
- * Throws if the transactions do not apply to the projection, which is a caller's bug. The
3673
- * transactions are replayed with `apply`'s default transforms, as `RichText.run` applies
3674
- * them; an edit normalized by other transforms does not translate.
3675
- *
3676
- * Text typed right after the last character of an insert `continues` accepts carries on that
3677
- * insert (`from` its next index) instead of starting one, so `coalesce` can fold a run of
3678
- * typing into one op. Accept only inserts this replica minted: two replicas continuing one
3679
- * insert at once would both claim its next characters, and the later would be dropped.
3680
- */
3681
- declare const translate: (state: ReplicatedState, result: Pick<Extract<TransactionResult, {
3682
- readonly ok: true;
3683
- }>, 'transactions' | 'state'>, key: string, options?: {
3684
- readonly continues?: (id: ReplicatedId) => boolean;
3685
- }) => {
3686
- readonly ops: ReadonlyArray<ReplicatedOp>;
3687
- readonly selection: AnchoredSelection | null;
3688
- };
3689
- /**
3690
- * Anchors a selection on the projection of `state`, so it can be resolved again after
3691
- * other replicas' ops change the text around it.
3692
- */
3693
- declare const anchor: (state: ReplicatedState, selection: Selection | null) => AnchoredSelection | null;
3694
- /**
3695
- * The selection an anchored one names in the projection of `state`. A position whose
3696
- * character was deleted moves back to the nearest character still shown; one whose block
3697
- * is gone resolves to nothing, and so does the selection.
3698
- */
3699
- declare const resolve: (state: ReplicatedState, selection: AnchoredSelection | null) => Selection | null;
3700
- /** Where a caret stands in a table: the table, its row and the cell's index in that row. */
3701
- interface TableAt {
3702
- readonly table: NodeBlock;
3703
- readonly rows: ReadonlyArray<NodeBlock>;
3704
- readonly row: number;
3705
- readonly column: number;
3706
- }
3707
- /**
3708
- * The table cell the selection starts in, the innermost one when tables nest, or undefined
3709
- * outside a table. A range is read from its start, as the other block commands read it.
3710
- */
3711
- export declare const tableAt: (document: Document, selection: Selection | null) => TableAt | undefined;
3712
- /** What one level of indentation is: two spaces. */
3713
- export declare const INDENT = " ";
3714
- /** One heading: its identity, its level, and its text. */
3715
- interface OutlineEntry {
3716
- readonly node: NodeId;
3717
- readonly level: number;
3718
- readonly text: string;
3719
- }
3720
- /** Every heading with text, in document order, inside containers too. */
3721
- export declare const outlineOf: (document: Document) => ReadonlyArray<OutlineEntry>;
3722
- /**
3723
- * The heading of the section the selection starts in: the last heading with text at or before
3724
- * its block. Undefined with no selection, or before the first heading.
3725
- */
3726
- export declare const sectionAt: (document: Document, selection: Selection | null) => NodeId | undefined;
3727
- /** Where a footnote is referred to: the run showing its label carries this mark. */
3728
- export declare const FootnoteRef: MarkDef<Schema.Struct<{
3729
- readonly label: Schema.String;
3730
- }>>;
3731
- /** A footnote's note, under the label its references carry. */
3732
- export declare const FootnoteDefinition: NodeDefinitionOf<"FootnoteDefinition", Schema.Struct<{
3733
- readonly label: Schema.String;
3734
- }>, "blocks">;
3735
- /** One footnote: its label, its definition if there is one, and the runs that refer to it. */
3736
- interface Footnote {
3737
- readonly label: string;
3738
- readonly definition: NodeId | undefined;
3739
- /** The runs carrying its reference, in document order. */
3740
- readonly references: ReadonlyArray<NodeId>;
3741
- /** The definition's text, one line per block. */
3742
- readonly text: string;
3743
- }
3744
- /** The label of the footnote a run refers to, if it carries a reference. */
3745
- export declare const referenceLabel: (run: Text) => string | undefined;
3746
- /**
3747
- * Every footnote, in the order its first reference appears; a definition nothing refers to comes
3748
- * after them, in document order.
3749
- */
3750
- export declare const footnotesOf: (document: Document) => ReadonlyArray<Footnote>;
3751
- /**
3752
- * The label of the footnote whose reference the selection starts in or right beside. A reference
3753
- * is a character or two, and its mark does not extend, so a click on one usually leaves the caret
3754
- * at its edge, in the run next to it; that caret counts as at the reference.
3755
- */
3756
- export declare const footnoteAt: (document: Document, selection: Selection | null) => string | undefined;
3757
- /** The smallest whole number no footnote uses as its label, as text: the next note's label. */
3758
- export declare const nextFootnoteLabel: (document: Document) => string;
3759
- /** A video, played with the browser's controls, at `width` CSS pixels when it says. */
3760
- export declare const Video: NodeDefinition;
3761
- /** A sound, played with the browser's controls. */
3762
- export declare const Audio: NodeDefinition;
3763
- /** A file to download, under its name, with its size and type when they are known. */
3764
- export declare const Attachment: NodeDefinition;
3765
- export declare const mediaNodes: NodeDefinition[];
3766
- /** A size as a reader says it: `820 B`, `12 KB`, `3.4 MB`. */
3767
- export declare const fileSize: (bytes: number) => string;
3768
- /**
3769
- * How media draws: a `video` or `audio` with `controls`, which loads only its metadata until it
3770
- * is played, and an attachment as a download link showing its name and size. A source the policy
3771
- * refuses leaves the element without one, so it draws nothing playable.
3772
- */
3773
- export declare const mediaRendering: Rendering;
3774
- /** A file a reader added, as its type says: where it is, and what it is called. */
3775
- interface MediaFile {
3776
- readonly src: string;
3777
- readonly name: string;
3778
- readonly type: string;
3779
- readonly size: number;
3780
- }
3781
- /**
3782
- * The block for a file a reader added: an `Image`, `Video` or `Audio` when its type is one, and
3783
- * an `Attachment` otherwise. Its identity is a placeholder, which `InsertBlock` replaces.
3784
- */
3785
- export declare const mediaBlock: (file: MediaFile) => Block;
3786
- export { type Action, type Adornment, type BlockConstraint, type BlockList, type BlockPath, type ChangeSet, type ChildrenDeclaration, type CodeToken, type CodeTokenizer, type CollapseStep, type Command, type CommandIds, type CommitOptions, type ContentMode, type Decoration, type DecorationSet, type DecorationSpan, type Diagnostic, type ElementRendering, type Footnote, type InputContext, type InputMatch, type InputRule, type Kit, type LinkAt, type LocatedRun, type MarkDef, type MarkExpansion, type MarkExtent, type MarkRegistry, type MarksPolicy, type MediaFile, type Migration, type MigrationApplied, type MigrationReport, type NodeDefinition, type NodeDefinitionOf, type NodeReference, type NodeRegistry, type OutlineEntry, type PositionStep, type RelocateStep, type Rendering, type RenderingEntry, replicated_d_exports as Replicated, type Restore, type RunOptions, type RunPiece, type RunPlace, type RunRendering, type SearchMatch, type SearchOptions, type SplitStep, type TableAt, type TextTarget, type TransactionResult, type Transform, type TransformContext, type TransformReport, type UnknownMark, type UnknownNode };
3787
- //# sourceMappingURL=index.d.mts.map