svedit 0.5.0 → 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.
- package/README.md +761 -120
- package/dist/AnnotatedTextProperty.svelte +122 -75
- package/dist/AnnotatedTextProperty.svelte.d.ts.map +1 -1
- package/dist/Command.svelte.d.ts +118 -0
- package/dist/Command.svelte.d.ts.map +1 -0
- package/dist/Command.svelte.js +314 -0
- package/dist/CustomProperty.svelte +31 -42
- package/dist/CustomProperty.svelte.d.ts.map +1 -1
- package/dist/KeyMapper.svelte.d.ts +36 -0
- package/dist/KeyMapper.svelte.d.ts.map +1 -0
- package/dist/KeyMapper.svelte.js +141 -0
- package/dist/Node.svelte +33 -35
- package/dist/Node.svelte.d.ts.map +1 -1
- package/dist/NodeArrayProperty.svelte +40 -37
- package/dist/NodeArrayProperty.svelte.d.ts.map +1 -1
- package/dist/{Document.svelte.d.ts → Session.svelte.d.ts} +76 -83
- package/dist/Session.svelte.d.ts.map +1 -0
- package/dist/Session.svelte.js +594 -0
- package/dist/Svedit.svelte +1352 -1512
- package/dist/Svedit.svelte.d.ts.map +1 -1
- package/dist/Transaction.svelte.d.ts +114 -40
- package/dist/Transaction.svelte.d.ts.map +1 -1
- package/dist/Transaction.svelte.js +845 -661
- package/dist/UnknownNode.svelte +6 -6
- package/dist/UnknownNode.svelte.d.ts.map +1 -1
- package/dist/doc_utils.d.ts +127 -0
- package/dist/doc_utils.d.ts.map +1 -0
- package/dist/doc_utils.js +482 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +20 -4
- package/dist/{commands.svelte.d.ts → transforms.svelte.d.ts} +1 -2
- package/dist/transforms.svelte.d.ts.map +1 -0
- package/dist/transforms.svelte.js +155 -0
- package/dist/types.d.ts +256 -110
- package/dist/{util.d.ts → utils.d.ts} +22 -2
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +338 -0
- package/package.json +20 -18
- package/src/lib/AnnotatedTextProperty.svelte +122 -75
- package/src/lib/Command.svelte.js +314 -0
- package/src/lib/CustomProperty.svelte +31 -42
- package/src/lib/KeyMapper.svelte.js +141 -0
- package/src/lib/Node.svelte +33 -35
- package/src/lib/NodeArrayProperty.svelte +40 -37
- package/src/lib/Session.svelte.js +594 -0
- package/src/lib/Svedit.svelte +1352 -1512
- package/src/lib/Transaction.svelte.js +845 -661
- package/src/lib/UnknownNode.svelte +6 -6
- package/src/lib/doc_utils.js +482 -0
- package/src/lib/index.js +20 -4
- package/src/lib/transforms.svelte.js +155 -0
- package/src/lib/types.d.ts +256 -110
- package/src/lib/utils.js +338 -0
- package/dist/Document.svelte.d.ts.map +0 -1
- package/dist/Document.svelte.js +0 -833
- package/dist/commands.svelte.d.ts.map +0 -1
- package/dist/commands.svelte.js +0 -266
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -269
- package/src/lib/Document.svelte.js +0 -833
- package/src/lib/commands.svelte.js +0 -266
- package/src/lib/util.js +0 -269
package/src/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type Session from './Session.svelte.js';
|
|
2
2
|
import type Svedit from './Svedit.svelte';
|
|
3
3
|
|
|
4
4
|
// ===== SVELTE TYPE IMPORTS =====
|
|
@@ -24,28 +24,28 @@ export type DocumentPath = Array<string | number>;
|
|
|
24
24
|
* Text selection within a text property
|
|
25
25
|
*/
|
|
26
26
|
export type TextSelection = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
type: 'text';
|
|
28
|
+
path: DocumentPath;
|
|
29
|
+
anchor_offset: number;
|
|
30
|
+
focus_offset: number;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Node selection within a node array
|
|
35
35
|
*/
|
|
36
36
|
export type NodeSelection = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
type: 'node';
|
|
38
|
+
path: DocumentPath;
|
|
39
|
+
anchor_offset: number;
|
|
40
|
+
focus_offset: number;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Property selection within a node
|
|
45
45
|
*/
|
|
46
46
|
export type PropertySelection = {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
type: 'property';
|
|
48
|
+
path: DocumentPath;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -53,27 +53,35 @@ export type PropertySelection = {
|
|
|
53
53
|
*/
|
|
54
54
|
export type Selection = TextSelection | NodeSelection | PropertySelection;
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Represents only the range (no direction and payload) of a NodeSelection or TextSelection
|
|
58
|
+
*/
|
|
59
|
+
export type SelectionRange = {
|
|
60
|
+
start_offset: number;
|
|
61
|
+
end_offset: number;
|
|
62
|
+
};
|
|
63
|
+
|
|
56
64
|
// ===== SCHEMA TYPE DEFINITIONS =====
|
|
57
65
|
|
|
58
66
|
/**
|
|
59
67
|
* Basic scalar types supported by the schema system.
|
|
60
68
|
*/
|
|
61
|
-
export type ScalarType =
|
|
69
|
+
export type ScalarType = 'string' | 'number' | 'boolean' | 'integer' | 'datetime';
|
|
62
70
|
|
|
63
71
|
/**
|
|
64
72
|
* Array types for collections of scalar values.
|
|
65
73
|
*/
|
|
66
|
-
export type ArrayType =
|
|
74
|
+
export type ArrayType = 'string_array' | 'number_array' | 'boolean_array' | 'integer_array';
|
|
67
75
|
|
|
68
76
|
/**
|
|
69
77
|
* Special types for rich content.
|
|
70
78
|
*/
|
|
71
|
-
export type RichType =
|
|
79
|
+
export type RichType = 'annotated_text';
|
|
72
80
|
|
|
73
81
|
/**
|
|
74
82
|
* Node reference types for linking to other nodes.
|
|
75
83
|
*/
|
|
76
|
-
export type ReferenceType =
|
|
84
|
+
export type ReferenceType = 'node' | 'node_array';
|
|
77
85
|
|
|
78
86
|
/**
|
|
79
87
|
* All primitive types that can be used in property definitions.
|
|
@@ -88,71 +96,178 @@ export type PropertyType = PrimitiveType | ReferenceType;
|
|
|
88
96
|
/**
|
|
89
97
|
* Document schema primitive types - all possible property types in document schemas.
|
|
90
98
|
*/
|
|
91
|
-
export type DocumentSchemaPrimitive =
|
|
99
|
+
export type DocumentSchemaPrimitive =
|
|
100
|
+
| 'string'
|
|
101
|
+
| 'number'
|
|
102
|
+
| 'boolean'
|
|
103
|
+
| 'integer'
|
|
104
|
+
| 'datetime'
|
|
105
|
+
| 'string_array'
|
|
106
|
+
| 'number_array'
|
|
107
|
+
| 'boolean_array'
|
|
108
|
+
| 'integer_array'
|
|
109
|
+
| 'annotated_text'
|
|
110
|
+
| 'node'
|
|
111
|
+
| 'node_array';
|
|
92
112
|
|
|
93
113
|
/**
|
|
94
114
|
* Maps document schema types to their JavaScript runtime types.
|
|
95
115
|
*/
|
|
96
|
-
export type DocumentSchemaValueToJs<T> =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
export type DocumentSchemaValueToJs<T> = T extends 'string'
|
|
117
|
+
? string
|
|
118
|
+
: T extends 'number'
|
|
119
|
+
? number
|
|
120
|
+
: T extends 'boolean'
|
|
121
|
+
? boolean
|
|
122
|
+
: T extends 'integer'
|
|
123
|
+
? number
|
|
124
|
+
: T extends 'datetime'
|
|
125
|
+
? string
|
|
126
|
+
: T extends 'string_array'
|
|
127
|
+
? Array<string>
|
|
128
|
+
: T extends 'number_array'
|
|
129
|
+
? Array<number>
|
|
130
|
+
: T extends 'boolean_array'
|
|
131
|
+
? Array<boolean>
|
|
132
|
+
: T extends 'integer_array'
|
|
133
|
+
? Array<number>
|
|
134
|
+
: T extends 'annotated_text'
|
|
135
|
+
? AnnotatedText
|
|
136
|
+
: T extends 'node'
|
|
137
|
+
? string
|
|
138
|
+
: T extends 'node_array'
|
|
139
|
+
? Array<string>
|
|
140
|
+
: never;
|
|
110
141
|
|
|
111
142
|
/**
|
|
112
143
|
* Converts a document node schema definition to its inferred JS type.
|
|
113
144
|
* Handles the {type: "..."} wrapper structure used in document schemas.
|
|
114
145
|
*/
|
|
115
|
-
export type DocumentNodeToJs<S extends NodeSchema> =
|
|
116
|
-
|
|
146
|
+
export type DocumentNodeToJs<S extends NodeSchema> = { id: string; type: string } & {
|
|
147
|
+
[K in keyof S['properties']]: DocumentSchemaValueToJs<S['properties'][K]['type']>;
|
|
148
|
+
};
|
|
117
149
|
|
|
118
150
|
/**
|
|
119
151
|
* A property that stores an annotated text with required allow_newlines setting.
|
|
120
152
|
*/
|
|
121
153
|
export type AnnotatedTextProperty = {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
154
|
+
type: 'annotated_text';
|
|
155
|
+
node_types?: string[];
|
|
156
|
+
allow_newlines: boolean;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* A property that stores a string value.
|
|
161
|
+
*/
|
|
162
|
+
export type StringProperty = {
|
|
163
|
+
type: 'string';
|
|
164
|
+
default?: string;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A property that stores a number value.
|
|
169
|
+
*/
|
|
170
|
+
export type NumberProperty = {
|
|
171
|
+
type: 'number';
|
|
172
|
+
default?: number;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A property that stores a boolean value.
|
|
177
|
+
*/
|
|
178
|
+
export type BooleanProperty = {
|
|
179
|
+
type: 'boolean';
|
|
180
|
+
default?: boolean;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A property that stores an integer value.
|
|
185
|
+
*/
|
|
186
|
+
export type IntegerProperty = {
|
|
187
|
+
type: 'integer';
|
|
188
|
+
default?: number;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A property that stores a datetime value.
|
|
193
|
+
*/
|
|
194
|
+
export type DatetimeProperty = {
|
|
195
|
+
type: 'datetime';
|
|
196
|
+
default?: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* A property that stores an array of strings.
|
|
201
|
+
*/
|
|
202
|
+
export type StringArrayProperty = {
|
|
203
|
+
type: 'string_array';
|
|
204
|
+
default?: string[];
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A property that stores an array of numbers.
|
|
209
|
+
*/
|
|
210
|
+
export type NumberArrayProperty = {
|
|
211
|
+
type: 'number_array';
|
|
212
|
+
default?: number[];
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A property that stores an array of booleans.
|
|
217
|
+
*/
|
|
218
|
+
export type BooleanArrayProperty = {
|
|
219
|
+
type: 'boolean_array';
|
|
220
|
+
default?: boolean[];
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* A property that stores an array of integers.
|
|
225
|
+
*/
|
|
226
|
+
export type IntegerArrayProperty = {
|
|
227
|
+
type: 'integer_array';
|
|
228
|
+
default?: number[];
|
|
125
229
|
};
|
|
126
230
|
|
|
127
231
|
/**
|
|
128
232
|
* A property that stores a primitive value (excluding annotated_text).
|
|
129
233
|
*/
|
|
130
|
-
export type PrimitiveProperty =
|
|
131
|
-
|
|
132
|
-
|
|
234
|
+
export type PrimitiveProperty =
|
|
235
|
+
| StringProperty
|
|
236
|
+
| NumberProperty
|
|
237
|
+
| BooleanProperty
|
|
238
|
+
| IntegerProperty
|
|
239
|
+
| DatetimeProperty
|
|
240
|
+
| StringArrayProperty
|
|
241
|
+
| NumberArrayProperty
|
|
242
|
+
| BooleanArrayProperty
|
|
243
|
+
| IntegerArrayProperty;
|
|
133
244
|
|
|
134
245
|
/**
|
|
135
246
|
* A property that stores a reference to a single node.
|
|
136
247
|
*/
|
|
137
248
|
export type NodeProperty = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
249
|
+
type: 'node';
|
|
250
|
+
node_types: string[];
|
|
251
|
+
default_node_type?: string;
|
|
141
252
|
};
|
|
142
253
|
|
|
143
254
|
/**
|
|
144
255
|
* A property that stores an array of node references.
|
|
145
256
|
*/
|
|
146
257
|
export type NodeArrayProperty = {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
258
|
+
type: 'node_array';
|
|
259
|
+
node_types: string[];
|
|
260
|
+
default_node_type?: string;
|
|
150
261
|
};
|
|
151
262
|
|
|
152
263
|
/**
|
|
153
264
|
* Union type for all possible property definitions.
|
|
154
265
|
*/
|
|
155
|
-
export type PropertyDefinition =
|
|
266
|
+
export type PropertyDefinition =
|
|
267
|
+
| PrimitiveProperty
|
|
268
|
+
| AnnotatedTextProperty
|
|
269
|
+
| NodeProperty
|
|
270
|
+
| NodeArrayProperty;
|
|
156
271
|
|
|
157
272
|
/**
|
|
158
273
|
* Node kind values for different types of content nodes
|
|
@@ -163,18 +278,18 @@ export type NodeKind = 'document' | 'block' | 'text' | 'annotation';
|
|
|
163
278
|
* Schema for text nodes - must have a content property of type annotated_text
|
|
164
279
|
*/
|
|
165
280
|
export type TextNodeSchema = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
281
|
+
kind: 'text';
|
|
282
|
+
properties: {
|
|
283
|
+
content: AnnotatedTextProperty;
|
|
284
|
+
} & Record<string, PropertyDefinition>;
|
|
170
285
|
};
|
|
171
286
|
|
|
172
287
|
/**
|
|
173
288
|
* Schema for non-text nodes
|
|
174
289
|
*/
|
|
175
290
|
export type NonTextNodeSchema = {
|
|
176
|
-
|
|
177
|
-
|
|
291
|
+
kind: 'document' | 'block' | 'annotation';
|
|
292
|
+
properties: Record<string, PropertyDefinition>;
|
|
178
293
|
};
|
|
179
294
|
|
|
180
295
|
/**
|
|
@@ -190,120 +305,151 @@ export type NodeSchema = TextNodeSchema | NonTextNodeSchema;
|
|
|
190
305
|
export type DocumentSchema = Record<string, NodeSchema>;
|
|
191
306
|
|
|
192
307
|
/**
|
|
193
|
-
* A
|
|
308
|
+
* A node in the document.
|
|
194
309
|
* Must have id and type properties, with other properties defined by the schema.
|
|
195
310
|
*/
|
|
196
|
-
export type
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
311
|
+
export type DocumentNode = {
|
|
312
|
+
id: string;
|
|
313
|
+
type: string;
|
|
314
|
+
[key: string]: any;
|
|
200
315
|
};
|
|
201
316
|
|
|
202
317
|
/**
|
|
203
|
-
* The document
|
|
204
|
-
*
|
|
318
|
+
* The document format - an object with document_id and nodes.
|
|
319
|
+
* The nodes object maps node IDs to their node data.
|
|
205
320
|
*/
|
|
206
|
-
export type
|
|
321
|
+
export type Document = {
|
|
322
|
+
document_id: string;
|
|
323
|
+
nodes: {
|
|
324
|
+
[key: string]: DocumentNode;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
207
327
|
|
|
208
328
|
/**
|
|
209
329
|
* Props for the AnnotatedTextProperty component
|
|
210
330
|
*/
|
|
211
331
|
export type AnnotatedTextPropertyProps = {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
332
|
+
/** The full path to the property */
|
|
333
|
+
path: DocumentPath;
|
|
334
|
+
/** Optional custom HTML tag */
|
|
335
|
+
tag?: string;
|
|
336
|
+
/** The `class` attribute on the content element */
|
|
337
|
+
class?: string;
|
|
338
|
+
/** A placeholder to be rendered for empty content */
|
|
339
|
+
placeholder?: string;
|
|
218
340
|
};
|
|
219
341
|
|
|
220
342
|
/**
|
|
221
343
|
* Props for the CustomProperty component
|
|
222
344
|
*/
|
|
223
345
|
export type CustomPropertyProps = {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
346
|
+
/** The full path to the property */
|
|
347
|
+
path: DocumentPath;
|
|
348
|
+
/** Optional custom HTML tag */
|
|
349
|
+
tag?: string;
|
|
350
|
+
/** The `class` attribute on the content element */
|
|
351
|
+
class?: string;
|
|
352
|
+
/** The content of the custom property (e.g. an image) */
|
|
353
|
+
children: Snippet;
|
|
230
354
|
};
|
|
231
355
|
|
|
232
356
|
/**
|
|
233
357
|
* Props for the NodeArray component
|
|
234
358
|
*/
|
|
235
359
|
export type NodeArrayPropertyProps = {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
360
|
+
/** The full path to the property */
|
|
361
|
+
path: DocumentPath;
|
|
362
|
+
/** Optional custom HTML tag */
|
|
363
|
+
tag?: string;
|
|
364
|
+
/** Optional custom HTML tag */
|
|
365
|
+
tag?: string;
|
|
366
|
+
/** The `class` attribute on the container element */
|
|
367
|
+
class?: string;
|
|
240
368
|
};
|
|
241
369
|
|
|
242
370
|
/**
|
|
243
371
|
* Props for the Node component
|
|
244
372
|
*/
|
|
245
373
|
export type NodeProps = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
374
|
+
/** The full path to the node */
|
|
375
|
+
path: DocumentPath;
|
|
376
|
+
/** Optional custom HTML tag */
|
|
377
|
+
tag?: string;
|
|
378
|
+
/** Optional string of CSS classes */
|
|
379
|
+
class?: string;
|
|
380
|
+
/** The type-specific content of the node */
|
|
381
|
+
children: Snippet;
|
|
250
382
|
};
|
|
251
383
|
|
|
252
384
|
/**
|
|
253
385
|
* Props for the CustomProperty component
|
|
254
386
|
*/
|
|
255
387
|
export type CustomPropertyProps = {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
388
|
+
/** The full path to the property */
|
|
389
|
+
path: DocumentPath;
|
|
390
|
+
/** The `class` attribute on the content element */
|
|
391
|
+
class?: string;
|
|
392
|
+
/** The content of the custom property (e.g. an image) */
|
|
393
|
+
children: Snippet;
|
|
262
394
|
};
|
|
263
395
|
|
|
264
396
|
/**
|
|
265
397
|
* Props for the CustomProperty component
|
|
266
398
|
*/
|
|
267
399
|
export type SveditProps = {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
400
|
+
/** The session instance */
|
|
401
|
+
session: Session;
|
|
402
|
+
/** Determines wether the document should be editable or read-only. */
|
|
403
|
+
editable?: boolean;
|
|
404
|
+
/** The path to the root element (e.g. ['page_1']) */
|
|
405
|
+
path: DocumentPath;
|
|
406
|
+
/** The `class` attribute on the canvas element */
|
|
407
|
+
class?: string;
|
|
408
|
+
/** The `autocapitalize` attribute on the canvas element */
|
|
409
|
+
autocapitalize?: 'on' | 'off';
|
|
410
|
+
/** The `spellcheck` attribute on the canvas element */
|
|
411
|
+
spellcheck?: 'true' | 'false';
|
|
280
412
|
};
|
|
281
413
|
|
|
282
414
|
/**
|
|
283
415
|
* Represents an annotation in an annotated string
|
|
284
416
|
*/
|
|
285
417
|
export type Annotation = {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
418
|
+
start_offset: number;
|
|
419
|
+
end_offset: number;
|
|
420
|
+
node_id: NodeId;
|
|
289
421
|
};
|
|
290
422
|
|
|
291
423
|
/**
|
|
292
424
|
* Represents an annotated text with text and annotations
|
|
293
425
|
*/
|
|
294
426
|
export type AnnotatedText = {
|
|
295
|
-
|
|
296
|
-
|
|
427
|
+
text: string;
|
|
428
|
+
annotations: Array<Annotation>;
|
|
297
429
|
};
|
|
298
430
|
|
|
299
431
|
/**
|
|
300
|
-
* Represents a fragment
|
|
432
|
+
* Represents a selection highlight fragment for non-annotated text selections
|
|
433
|
+
*/
|
|
434
|
+
export type SelectionHighlightFragment = {
|
|
435
|
+
type: 'selection_highlight';
|
|
436
|
+
content: string;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Represents an annotation fragment in annotated text content
|
|
301
441
|
*/
|
|
302
|
-
export type AnnotationFragment =
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
442
|
+
export type AnnotationFragment = {
|
|
443
|
+
type: 'annotation';
|
|
444
|
+
/** NodeId that has annotation type and details */
|
|
445
|
+
node: any;
|
|
446
|
+
/** The text content of the annotation */
|
|
447
|
+
content: string;
|
|
448
|
+
/** Index of the annotation in the original array */
|
|
449
|
+
annotation_index: number;
|
|
309
450
|
};
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Represents a fragment of annotated text content
|
|
454
|
+
*/
|
|
455
|
+
export type Fragment = string | AnnotationFragment | SelectionHighlightFragment;
|