@portabletext/editor 1.47.12 → 1.47.13
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/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +2 -2
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +2 -2
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +4752 -164
- package/lib/behaviors/index.d.ts +4752 -164
- package/lib/index.d.cts +28 -41
- package/lib/index.d.ts +28 -41
- package/lib/plugins/index.d.cts +28 -41
- package/lib/plugins/index.d.ts +28 -41
- package/lib/selectors/index.d.cts +28 -40
- package/lib/selectors/index.d.ts +28 -40
- package/lib/utils/index.d.cts +28 -40
- package/lib/utils/index.d.ts +28 -40
- package/package.json +7 -7
- package/src/behaviors/behavior.perform-event.ts +2 -7
- package/src/behaviors/behavior.types.action.ts +7 -13
- package/src/behaviors/behavior.types.event.ts +30 -32
|
@@ -12,13 +12,11 @@ import type {EditorSelection} from '../types/editor'
|
|
|
12
12
|
*/
|
|
13
13
|
export type BehaviorEvent =
|
|
14
14
|
| SyntheticBehaviorEvent
|
|
15
|
-
| AbstractBehaviorEvent
|
|
16
15
|
| NativeBehaviorEvent
|
|
17
16
|
| CustomBehaviorEvent
|
|
18
17
|
|
|
19
18
|
export type BehaviorEventTypeNamespace =
|
|
20
19
|
| SyntheticBehaviorEventNamespace
|
|
21
|
-
| AbstractBehaviorEventNamespace
|
|
22
20
|
| NativeBehaviorEventNamespace
|
|
23
21
|
| CustomBehaviorEventNamespace
|
|
24
22
|
|
|
@@ -54,7 +52,6 @@ export type ExternalBehaviorEvent =
|
|
|
54
52
|
value?: {[prop: string]: unknown}
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
|
-
| AbstractBehaviorEvent
|
|
58
55
|
| SyntheticBehaviorEvent
|
|
59
56
|
| CustomBehaviorEvent
|
|
60
57
|
|
|
@@ -85,7 +82,9 @@ const syntheticBehaviorEventTypes = [
|
|
|
85
82
|
'select',
|
|
86
83
|
] as const
|
|
87
84
|
|
|
88
|
-
type SyntheticBehaviorEventType =
|
|
85
|
+
type SyntheticBehaviorEventType =
|
|
86
|
+
| (typeof syntheticBehaviorEventTypes)[number]
|
|
87
|
+
| (typeof abstractBehaviorEventTypes)[number]
|
|
89
88
|
|
|
90
89
|
type SyntheticBehaviorEventNamespace =
|
|
91
90
|
ExtractNamespace<SyntheticBehaviorEventType>
|
|
@@ -194,6 +193,7 @@ export type SyntheticBehaviorEvent =
|
|
|
194
193
|
type: StrictExtract<SyntheticBehaviorEventType, 'select'>
|
|
195
194
|
at: EditorSelection
|
|
196
195
|
}
|
|
196
|
+
| AbstractBehaviorEvent
|
|
197
197
|
|
|
198
198
|
export type InsertPlacement = 'auto' | 'after' | 'before'
|
|
199
199
|
|
|
@@ -233,33 +233,31 @@ const abstractBehaviorEventTypes = [
|
|
|
233
233
|
'style.toggle',
|
|
234
234
|
] as const
|
|
235
235
|
|
|
236
|
-
type AbstractBehaviorEventType =
|
|
237
|
-
|
|
238
|
-
type AbstractBehaviorEventNamespace =
|
|
239
|
-
ExtractNamespace<AbstractBehaviorEventType>
|
|
236
|
+
export type AbstractBehaviorEventType =
|
|
237
|
+
(typeof abstractBehaviorEventTypes)[number]
|
|
240
238
|
|
|
241
|
-
|
|
239
|
+
type AbstractBehaviorEvent =
|
|
242
240
|
| {
|
|
243
|
-
type: StrictExtract<
|
|
241
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'annotation.toggle'>
|
|
244
242
|
annotation: {
|
|
245
243
|
name: string
|
|
246
244
|
value: {[prop: string]: unknown}
|
|
247
245
|
}
|
|
248
246
|
}
|
|
249
247
|
| {
|
|
250
|
-
type: StrictExtract<
|
|
248
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.toggle'>
|
|
251
249
|
decorator: string
|
|
252
250
|
at?: {anchor: BlockOffset; focus: BlockOffset}
|
|
253
251
|
}
|
|
254
252
|
| {
|
|
255
|
-
type: StrictExtract<
|
|
253
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
256
254
|
at: {
|
|
257
255
|
anchor: BlockOffset
|
|
258
256
|
focus: BlockOffset
|
|
259
257
|
}
|
|
260
258
|
}
|
|
261
259
|
| {
|
|
262
|
-
type: StrictExtract<
|
|
260
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'deserialize'>
|
|
263
261
|
originEvent:
|
|
264
262
|
| PickFromUnion<
|
|
265
263
|
NativeBehaviorEvent,
|
|
@@ -269,7 +267,7 @@ export type AbstractBehaviorEvent =
|
|
|
269
267
|
| InputBehaviorEvent
|
|
270
268
|
}
|
|
271
269
|
| {
|
|
272
|
-
type: StrictExtract<
|
|
270
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'serialize'>
|
|
273
271
|
originEvent: PickFromUnion<
|
|
274
272
|
NativeBehaviorEvent,
|
|
275
273
|
'type',
|
|
@@ -277,7 +275,7 @@ export type AbstractBehaviorEvent =
|
|
|
277
275
|
>
|
|
278
276
|
}
|
|
279
277
|
| {
|
|
280
|
-
type: StrictExtract<
|
|
278
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.success'>
|
|
281
279
|
mimeType: MIMEType
|
|
282
280
|
data: Array<PortableTextBlock>
|
|
283
281
|
originEvent:
|
|
@@ -289,7 +287,7 @@ export type AbstractBehaviorEvent =
|
|
|
289
287
|
| InputBehaviorEvent
|
|
290
288
|
}
|
|
291
289
|
| {
|
|
292
|
-
type: StrictExtract<
|
|
290
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.failure'>
|
|
293
291
|
mimeType: MIMEType
|
|
294
292
|
reason: string
|
|
295
293
|
originEvent:
|
|
@@ -301,7 +299,7 @@ export type AbstractBehaviorEvent =
|
|
|
301
299
|
| InputBehaviorEvent
|
|
302
300
|
}
|
|
303
301
|
| {
|
|
304
|
-
type: StrictExtract<
|
|
302
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'serialization.success'>
|
|
305
303
|
mimeType: MIMEType
|
|
306
304
|
data: string
|
|
307
305
|
originEvent: PickFromUnion<
|
|
@@ -311,7 +309,7 @@ export type AbstractBehaviorEvent =
|
|
|
311
309
|
>
|
|
312
310
|
}
|
|
313
311
|
| {
|
|
314
|
-
type: StrictExtract<
|
|
312
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'serialization.failure'>
|
|
315
313
|
mimeType: MIMEType
|
|
316
314
|
reason: string
|
|
317
315
|
originEvent: PickFromUnion<
|
|
@@ -321,57 +319,57 @@ export type AbstractBehaviorEvent =
|
|
|
321
319
|
>
|
|
322
320
|
}
|
|
323
321
|
| {
|
|
324
|
-
type: StrictExtract<
|
|
322
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'insert.blocks'>
|
|
325
323
|
blocks: Array<PortableTextBlock>
|
|
326
324
|
placement: InsertPlacement
|
|
327
325
|
}
|
|
328
326
|
| {
|
|
329
|
-
type: StrictExtract<
|
|
327
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'insert.break'>
|
|
330
328
|
}
|
|
331
329
|
| {
|
|
332
|
-
type: StrictExtract<
|
|
330
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'insert.soft break'>
|
|
333
331
|
}
|
|
334
332
|
| {
|
|
335
|
-
type: StrictExtract<
|
|
333
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'list item.add'>
|
|
336
334
|
listItem: string
|
|
337
335
|
}
|
|
338
336
|
| {
|
|
339
|
-
type: StrictExtract<
|
|
337
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'list item.remove'>
|
|
340
338
|
listItem: string
|
|
341
339
|
}
|
|
342
340
|
| {
|
|
343
|
-
type: StrictExtract<
|
|
341
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'list item.toggle'>
|
|
344
342
|
listItem: string
|
|
345
343
|
}
|
|
346
344
|
| {
|
|
347
|
-
type: StrictExtract<
|
|
345
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'move.block down'>
|
|
348
346
|
at: [KeyedSegment]
|
|
349
347
|
}
|
|
350
348
|
| {
|
|
351
|
-
type: StrictExtract<
|
|
349
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'move.block up'>
|
|
352
350
|
at: [KeyedSegment]
|
|
353
351
|
}
|
|
354
352
|
| {
|
|
355
|
-
type: StrictExtract<
|
|
353
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'select.previous block'>
|
|
356
354
|
select?: 'start' | 'end'
|
|
357
355
|
}
|
|
358
356
|
| {
|
|
359
|
-
type: StrictExtract<
|
|
357
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'select.next block'>
|
|
360
358
|
select?: 'start' | 'end'
|
|
361
359
|
}
|
|
362
360
|
| {
|
|
363
|
-
type: StrictExtract<
|
|
361
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'split'>
|
|
364
362
|
}
|
|
365
363
|
| {
|
|
366
|
-
type: StrictExtract<
|
|
364
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'style.add'>
|
|
367
365
|
style: string
|
|
368
366
|
}
|
|
369
367
|
| {
|
|
370
|
-
type: StrictExtract<
|
|
368
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'style.remove'>
|
|
371
369
|
style: string
|
|
372
370
|
}
|
|
373
371
|
| {
|
|
374
|
-
type: StrictExtract<
|
|
372
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'style.toggle'>
|
|
375
373
|
style: string
|
|
376
374
|
}
|
|
377
375
|
|