@portabletext/editor 1.14.0 → 1.14.2

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/index.d.ts CHANGED
@@ -94,20 +94,20 @@ export declare type BaseDefinition = {
94
94
  * @alpha
95
95
  */
96
96
  export declare type Behavior<
97
- TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
97
+ TAnyBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
98
98
  TGuardResponse = true,
99
99
  > = {
100
100
  /**
101
101
  * The internal editor event that triggers this behavior.
102
102
  */
103
- on: TBehaviorEventType
103
+ on: TAnyBehaviorEventType
104
104
  /**
105
105
  * Predicate function that determines if the behavior should be executed.
106
106
  * Returning a non-nullable value from the guard will pass the value to the
107
107
  * actions and execute them.
108
108
  */
109
109
  guard?: BehaviorGuard<
110
- PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
110
+ PickFromUnion<BehaviorEvent, 'type', TAnyBehaviorEventType>,
111
111
  TGuardResponse
112
112
  >
113
113
  /**
@@ -120,7 +120,7 @@ export declare type Behavior<
120
120
  * @alpha
121
121
  */
122
122
  export declare type BehaviorActionIntend =
123
- | BehaviorEvent
123
+ | SyntheticBehaviorEvent
124
124
  | {
125
125
  type: 'insert.span'
126
126
  text: string
@@ -215,141 +215,25 @@ export declare type BehaviorActionIntend =
215
215
  */
216
216
  export declare type BehaviorActionIntendSet<TGuardResponse = true> = (
217
217
  guardResponse: TGuardResponse,
218
- ) => Array<
219
- OmitFromUnion<
220
- BehaviorActionIntend,
221
- 'type',
222
- 'copy' | 'key.down' | 'key.up' | 'paste'
223
- >
224
- >
218
+ ) => Array<BehaviorActionIntend>
225
219
 
226
220
  /**
227
221
  * @alpha
228
222
  */
229
- export declare type BehaviorEvent =
230
- | {
231
- type: 'annotation.add'
232
- annotation: {
233
- name: string
234
- value: {
235
- [prop: string]: unknown
236
- }
237
- }
238
- }
239
- | {
240
- type: 'annotation.remove'
241
- annotation: {
242
- name: string
243
- }
244
- }
245
- | {
246
- type: 'annotation.toggle'
247
- annotation: {
248
- name: string
249
- value: {
250
- [prop: string]: unknown
251
- }
252
- }
253
- }
254
- | {
255
- type: 'blur'
256
- }
257
- | {
258
- type: 'copy'
259
- data: DataTransfer
260
- }
261
- | {
262
- type: 'decorator.add'
263
- decorator: string
264
- }
265
- | {
266
- type: 'decorator.remove'
267
- decorator: string
268
- }
269
- | {
270
- type: 'decorator.toggle'
271
- decorator: string
272
- }
273
- | {
274
- type: 'delete.backward'
275
- unit: TextUnit
276
- }
277
- | {
278
- type: 'delete.forward'
279
- unit: TextUnit
280
- }
281
- | {
282
- type: 'focus'
283
- }
284
- | {
285
- type: 'insert.block object'
286
- placement: 'auto' | 'after' | 'before'
287
- blockObject: {
288
- name: string
289
- value?: {
290
- [prop: string]: unknown
291
- }
292
- }
293
- }
294
- | {
295
- type: 'insert.inline object'
296
- inlineObject: {
297
- name: string
298
- value?: {
299
- [prop: string]: unknown
300
- }
301
- }
302
- }
303
- | {
304
- type: 'insert.soft break'
305
- }
306
- | {
307
- type: 'insert.break'
308
- }
309
- | {
310
- type: 'insert.text'
311
- text: string
312
- options?: TextInsertTextOptions
313
- }
314
- | {
315
- type: 'paste'
316
- data: DataTransfer
317
- }
318
- | {
319
- type: 'key.down'
320
- keyboardEvent: Pick<
321
- KeyboardEvent,
322
- 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
323
- >
324
- }
325
- | {
326
- type: 'key.up'
327
- keyboardEvent: Pick<
328
- KeyboardEvent,
329
- 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
330
- >
331
- }
332
- | {
333
- type: 'list item.toggle'
334
- listItem: string
335
- }
336
- | {
337
- type: 'style.toggle'
338
- style: string
339
- }
223
+ export declare type BehaviorEvent = SyntheticBehaviorEvent | NativeBehaviorEvent
340
224
 
341
225
  /**
342
226
  * @alpha
343
227
  */
344
228
  export declare type BehaviorGuard<
345
- TBehaviorEvent extends BehaviorEvent,
229
+ TAnyBehaviorEvent extends BehaviorEvent,
346
230
  TGuardResponse,
347
231
  > = ({
348
232
  context,
349
233
  event,
350
234
  }: {
351
235
  context: EditorContext
352
- event: TBehaviorEvent
236
+ event: TAnyBehaviorEvent
353
237
  }) => TGuardResponse | false
354
238
 
355
239
  /** @beta */
@@ -478,7 +362,6 @@ export declare const coreBehavior: {
478
362
  | 'annotation.remove'
479
363
  | 'annotation.toggle'
480
364
  | 'blur'
481
- | 'copy'
482
365
  | 'decorator.add'
483
366
  | 'decorator.remove'
484
367
  | 'decorator.toggle'
@@ -489,10 +372,11 @@ export declare const coreBehavior: {
489
372
  | 'insert.soft break'
490
373
  | 'insert.break'
491
374
  | 'insert.text'
492
- | 'paste'
375
+ | 'style.toggle'
376
+ | 'copy'
493
377
  | 'key.down'
494
378
  | 'key.up'
495
- | 'style.toggle',
379
+ | 'paste',
496
380
  true
497
381
  >
498
382
  decorators: {
@@ -503,7 +387,6 @@ export declare const coreBehavior: {
503
387
  | 'annotation.remove'
504
388
  | 'annotation.toggle'
505
389
  | 'blur'
506
- | 'copy'
507
390
  | 'decorator.add'
508
391
  | 'decorator.remove'
509
392
  | 'decorator.toggle'
@@ -514,10 +397,11 @@ export declare const coreBehavior: {
514
397
  | 'insert.soft break'
515
398
  | 'insert.break'
516
399
  | 'insert.text'
517
- | 'paste'
400
+ | 'style.toggle'
401
+ | 'copy'
518
402
  | 'key.down'
519
403
  | 'key.up'
520
- | 'style.toggle',
404
+ | 'paste',
521
405
  true
522
406
  >
523
407
  decoratorRemove: Behavior<
@@ -527,7 +411,6 @@ export declare const coreBehavior: {
527
411
  | 'annotation.remove'
528
412
  | 'annotation.toggle'
529
413
  | 'blur'
530
- | 'copy'
531
414
  | 'decorator.add'
532
415
  | 'decorator.remove'
533
416
  | 'decorator.toggle'
@@ -538,10 +421,11 @@ export declare const coreBehavior: {
538
421
  | 'insert.soft break'
539
422
  | 'insert.break'
540
423
  | 'insert.text'
541
- | 'paste'
424
+ | 'style.toggle'
425
+ | 'copy'
542
426
  | 'key.down'
543
427
  | 'key.up'
544
- | 'style.toggle',
428
+ | 'paste',
545
429
  true
546
430
  >
547
431
  decoratorToggle: Behavior<
@@ -551,7 +435,6 @@ export declare const coreBehavior: {
551
435
  | 'annotation.remove'
552
436
  | 'annotation.toggle'
553
437
  | 'blur'
554
- | 'copy'
555
438
  | 'decorator.add'
556
439
  | 'decorator.remove'
557
440
  | 'decorator.toggle'
@@ -562,10 +445,11 @@ export declare const coreBehavior: {
562
445
  | 'insert.soft break'
563
446
  | 'insert.break'
564
447
  | 'insert.text'
565
- | 'paste'
448
+ | 'style.toggle'
449
+ | 'copy'
566
450
  | 'key.down'
567
451
  | 'key.up'
568
- | 'style.toggle',
452
+ | 'paste',
569
453
  true
570
454
  >
571
455
  }
@@ -577,7 +461,6 @@ export declare const coreBehavior: {
577
461
  | 'annotation.remove'
578
462
  | 'annotation.toggle'
579
463
  | 'blur'
580
- | 'copy'
581
464
  | 'decorator.add'
582
465
  | 'decorator.remove'
583
466
  | 'decorator.toggle'
@@ -588,10 +471,11 @@ export declare const coreBehavior: {
588
471
  | 'insert.soft break'
589
472
  | 'insert.break'
590
473
  | 'insert.text'
591
- | 'paste'
474
+ | 'style.toggle'
475
+ | 'copy'
592
476
  | 'key.down'
593
477
  | 'key.up'
594
- | 'style.toggle',
478
+ | 'paste',
595
479
  true
596
480
  >
597
481
  arrowUpOnLonelyBlockObject: Behavior<
@@ -601,7 +485,6 @@ export declare const coreBehavior: {
601
485
  | 'annotation.remove'
602
486
  | 'annotation.toggle'
603
487
  | 'blur'
604
- | 'copy'
605
488
  | 'decorator.add'
606
489
  | 'decorator.remove'
607
490
  | 'decorator.toggle'
@@ -612,10 +495,11 @@ export declare const coreBehavior: {
612
495
  | 'insert.soft break'
613
496
  | 'insert.break'
614
497
  | 'insert.text'
615
- | 'paste'
498
+ | 'style.toggle'
499
+ | 'copy'
616
500
  | 'key.down'
617
501
  | 'key.up'
618
- | 'style.toggle',
502
+ | 'paste',
619
503
  true
620
504
  >
621
505
  breakingBlockObject: Behavior<
@@ -625,7 +509,6 @@ export declare const coreBehavior: {
625
509
  | 'annotation.remove'
626
510
  | 'annotation.toggle'
627
511
  | 'blur'
628
- | 'copy'
629
512
  | 'decorator.add'
630
513
  | 'decorator.remove'
631
514
  | 'decorator.toggle'
@@ -636,10 +519,11 @@ export declare const coreBehavior: {
636
519
  | 'insert.soft break'
637
520
  | 'insert.break'
638
521
  | 'insert.text'
639
- | 'paste'
522
+ | 'style.toggle'
523
+ | 'copy'
640
524
  | 'key.down'
641
525
  | 'key.up'
642
- | 'style.toggle',
526
+ | 'paste',
643
527
  true
644
528
  >
645
529
  deletingEmptyTextBlockAfterBlockObject: Behavior<
@@ -649,7 +533,6 @@ export declare const coreBehavior: {
649
533
  | 'annotation.remove'
650
534
  | 'annotation.toggle'
651
535
  | 'blur'
652
- | 'copy'
653
536
  | 'decorator.add'
654
537
  | 'decorator.remove'
655
538
  | 'decorator.toggle'
@@ -660,10 +543,11 @@ export declare const coreBehavior: {
660
543
  | 'insert.soft break'
661
544
  | 'insert.break'
662
545
  | 'insert.text'
663
- | 'paste'
546
+ | 'style.toggle'
547
+ | 'copy'
664
548
  | 'key.down'
665
549
  | 'key.up'
666
- | 'style.toggle',
550
+ | 'paste',
667
551
  true
668
552
  >
669
553
  deletingEmptyTextBlockBeforeBlockObject: Behavior<
@@ -673,7 +557,6 @@ export declare const coreBehavior: {
673
557
  | 'annotation.remove'
674
558
  | 'annotation.toggle'
675
559
  | 'blur'
676
- | 'copy'
677
560
  | 'decorator.add'
678
561
  | 'decorator.remove'
679
562
  | 'decorator.toggle'
@@ -684,10 +567,11 @@ export declare const coreBehavior: {
684
567
  | 'insert.soft break'
685
568
  | 'insert.break'
686
569
  | 'insert.text'
687
- | 'paste'
570
+ | 'style.toggle'
571
+ | 'copy'
688
572
  | 'key.down'
689
573
  | 'key.up'
690
- | 'style.toggle',
574
+ | 'paste',
691
575
  true
692
576
  >
693
577
  }
@@ -699,7 +583,6 @@ export declare const coreBehavior: {
699
583
  | 'annotation.remove'
700
584
  | 'annotation.toggle'
701
585
  | 'blur'
702
- | 'copy'
703
586
  | 'decorator.add'
704
587
  | 'decorator.remove'
705
588
  | 'decorator.toggle'
@@ -710,10 +593,11 @@ export declare const coreBehavior: {
710
593
  | 'insert.soft break'
711
594
  | 'insert.break'
712
595
  | 'insert.text'
713
- | 'paste'
596
+ | 'style.toggle'
597
+ | 'copy'
714
598
  | 'key.down'
715
599
  | 'key.up'
716
- | 'style.toggle',
600
+ | 'paste',
717
601
  true
718
602
  >
719
603
  unindentListOnBackspace: Behavior<
@@ -723,7 +607,6 @@ export declare const coreBehavior: {
723
607
  | 'annotation.remove'
724
608
  | 'annotation.toggle'
725
609
  | 'blur'
726
- | 'copy'
727
610
  | 'decorator.add'
728
611
  | 'decorator.remove'
729
612
  | 'decorator.toggle'
@@ -734,10 +617,11 @@ export declare const coreBehavior: {
734
617
  | 'insert.soft break'
735
618
  | 'insert.break'
736
619
  | 'insert.text'
737
- | 'paste'
620
+ | 'style.toggle'
621
+ | 'copy'
738
622
  | 'key.down'
739
623
  | 'key.up'
740
- | 'style.toggle',
624
+ | 'paste',
741
625
  true
742
626
  >
743
627
  clearListOnEnter: Behavior<
@@ -747,7 +631,6 @@ export declare const coreBehavior: {
747
631
  | 'annotation.remove'
748
632
  | 'annotation.toggle'
749
633
  | 'blur'
750
- | 'copy'
751
634
  | 'decorator.add'
752
635
  | 'decorator.remove'
753
636
  | 'decorator.toggle'
@@ -758,10 +641,11 @@ export declare const coreBehavior: {
758
641
  | 'insert.soft break'
759
642
  | 'insert.break'
760
643
  | 'insert.text'
761
- | 'paste'
644
+ | 'style.toggle'
645
+ | 'copy'
762
646
  | 'key.down'
763
647
  | 'key.up'
764
- | 'style.toggle',
648
+ | 'paste',
765
649
  true
766
650
  >
767
651
  indentListOnTab: Behavior<
@@ -771,7 +655,6 @@ export declare const coreBehavior: {
771
655
  | 'annotation.remove'
772
656
  | 'annotation.toggle'
773
657
  | 'blur'
774
- | 'copy'
775
658
  | 'decorator.add'
776
659
  | 'decorator.remove'
777
660
  | 'decorator.toggle'
@@ -782,10 +665,11 @@ export declare const coreBehavior: {
782
665
  | 'insert.soft break'
783
666
  | 'insert.break'
784
667
  | 'insert.text'
785
- | 'paste'
668
+ | 'style.toggle'
669
+ | 'copy'
786
670
  | 'key.down'
787
671
  | 'key.up'
788
- | 'style.toggle',
672
+ | 'paste',
789
673
  true
790
674
  >
791
675
  unindentListOnShiftTab: Behavior<
@@ -795,7 +679,6 @@ export declare const coreBehavior: {
795
679
  | 'annotation.remove'
796
680
  | 'annotation.toggle'
797
681
  | 'blur'
798
- | 'copy'
799
682
  | 'decorator.add'
800
683
  | 'decorator.remove'
801
684
  | 'decorator.toggle'
@@ -806,10 +689,11 @@ export declare const coreBehavior: {
806
689
  | 'insert.soft break'
807
690
  | 'insert.break'
808
691
  | 'insert.text'
809
- | 'paste'
692
+ | 'style.toggle'
693
+ | 'copy'
810
694
  | 'key.down'
811
695
  | 'key.up'
812
- | 'style.toggle',
696
+ | 'paste',
813
697
  true
814
698
  >
815
699
  }
@@ -825,7 +709,6 @@ export declare const coreBehaviors: Behavior<
825
709
  | 'annotation.remove'
826
710
  | 'annotation.toggle'
827
711
  | 'blur'
828
- | 'copy'
829
712
  | 'decorator.add'
830
713
  | 'decorator.remove'
831
714
  | 'decorator.toggle'
@@ -836,10 +719,11 @@ export declare const coreBehaviors: Behavior<
836
719
  | 'insert.soft break'
837
720
  | 'insert.break'
838
721
  | 'insert.text'
839
- | 'paste'
722
+ | 'style.toggle'
723
+ | 'copy'
840
724
  | 'key.down'
841
725
  | 'key.up'
842
- | 'style.toggle',
726
+ | 'paste',
843
727
  true
844
728
  >[]
845
729
 
@@ -855,7 +739,6 @@ export declare function createCodeEditorBehaviors(
855
739
  | 'annotation.remove'
856
740
  | 'annotation.toggle'
857
741
  | 'blur'
858
- | 'copy'
859
742
  | 'decorator.add'
860
743
  | 'decorator.remove'
861
744
  | 'decorator.toggle'
@@ -866,10 +749,11 @@ export declare function createCodeEditorBehaviors(
866
749
  | 'insert.soft break'
867
750
  | 'insert.break'
868
751
  | 'insert.text'
869
- | 'paste'
752
+ | 'style.toggle'
753
+ | 'copy'
870
754
  | 'key.down'
871
755
  | 'key.up'
872
- | 'style.toggle',
756
+ | 'paste',
873
757
  true
874
758
  >[]
875
759
 
@@ -885,7 +769,6 @@ export declare function createLinkBehaviors(
885
769
  | 'annotation.remove'
886
770
  | 'annotation.toggle'
887
771
  | 'blur'
888
- | 'copy'
889
772
  | 'decorator.add'
890
773
  | 'decorator.remove'
891
774
  | 'decorator.toggle'
@@ -896,10 +779,11 @@ export declare function createLinkBehaviors(
896
779
  | 'insert.soft break'
897
780
  | 'insert.break'
898
781
  | 'insert.text'
899
- | 'paste'
782
+ | 'style.toggle'
783
+ | 'copy'
900
784
  | 'key.down'
901
785
  | 'key.up'
902
- | 'style.toggle',
786
+ | 'paste',
903
787
  true
904
788
  >[]
905
789
 
@@ -915,7 +799,6 @@ export declare function createMarkdownBehaviors(
915
799
  | 'annotation.remove'
916
800
  | 'annotation.toggle'
917
801
  | 'blur'
918
- | 'copy'
919
802
  | 'decorator.add'
920
803
  | 'decorator.remove'
921
804
  | 'decorator.toggle'
@@ -926,10 +809,11 @@ export declare function createMarkdownBehaviors(
926
809
  | 'insert.soft break'
927
810
  | 'insert.break'
928
811
  | 'insert.text'
929
- | 'paste'
812
+ | 'style.toggle'
813
+ | 'copy'
930
814
  | 'key.down'
931
815
  | 'key.up'
932
- | 'style.toggle',
816
+ | 'paste',
933
817
  true
934
818
  >[]
935
819
 
@@ -937,9 +821,9 @@ export declare function createMarkdownBehaviors(
937
821
  * @alpha
938
822
  */
939
823
  export declare function defineBehavior<
940
- TBehaviorEventType extends BehaviorEvent['type'],
824
+ TAnyBehaviorEventType extends BehaviorEvent['type'],
941
825
  TGuardResponse = true,
942
- >(behavior: Behavior<TBehaviorEventType, TGuardResponse>): Behavior
826
+ >(behavior: Behavior<TAnyBehaviorEventType, TGuardResponse>): Behavior
943
827
 
944
828
  /**
945
829
  * @alpha
@@ -1115,10 +999,10 @@ export declare type EditorContext = {
1115
999
  export declare type EditorEmittedEvent = PickFromUnion<
1116
1000
  InternalEditorEmittedEvent,
1117
1001
  'type',
1118
- | 'blur'
1002
+ | 'blurred'
1119
1003
  | 'done loading'
1120
1004
  | 'error'
1121
- | 'focus'
1005
+ | 'focused'
1122
1006
  | 'invalid value'
1123
1007
  | 'loading'
1124
1008
  | 'mutation'
@@ -1251,7 +1135,7 @@ export declare const editorMachine: StateMachine<
1251
1135
  }
1252
1136
  | {
1253
1137
  type: 'behavior event'
1254
- behaviorEvent: BehaviorEvent
1138
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1255
1139
  editor: PortableTextSlateEditor
1256
1140
  nativeEvent?: {
1257
1141
  preventDefault: () => void
@@ -1612,7 +1496,7 @@ export declare const editorMachine: StateMachine<
1612
1496
  }
1613
1497
  | {
1614
1498
  type: 'behavior event'
1615
- behaviorEvent: BehaviorEvent
1499
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1616
1500
  editor: PortableTextSlateEditor
1617
1501
  nativeEvent?: {
1618
1502
  preventDefault: () => void
@@ -1769,7 +1653,7 @@ export declare const editorMachine: StateMachine<
1769
1653
  }
1770
1654
  | {
1771
1655
  type: 'behavior event'
1772
- behaviorEvent: BehaviorEvent
1656
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1773
1657
  editor: PortableTextSlateEditor
1774
1658
  nativeEvent?: {
1775
1659
  preventDefault: () => void
@@ -1953,7 +1837,7 @@ export declare const editorMachine: StateMachine<
1953
1837
  }
1954
1838
  | {
1955
1839
  type: 'behavior event'
1956
- behaviorEvent: BehaviorEvent
1840
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1957
1841
  editor: PortableTextSlateEditor
1958
1842
  nativeEvent?: {
1959
1843
  preventDefault: () => void
@@ -2267,7 +2151,7 @@ export declare const editorMachine: StateMachine<
2267
2151
  }
2268
2152
  | {
2269
2153
  type: 'behavior event'
2270
- behaviorEvent: BehaviorEvent
2154
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2271
2155
  editor: PortableTextSlateEditor
2272
2156
  nativeEvent?: {
2273
2157
  preventDefault: () => void
@@ -2581,7 +2465,7 @@ export declare const editorMachine: StateMachine<
2581
2465
  }
2582
2466
  | {
2583
2467
  type: 'behavior event'
2584
- behaviorEvent: BehaviorEvent
2468
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2585
2469
  editor: PortableTextSlateEditor
2586
2470
  nativeEvent?: {
2587
2471
  preventDefault: () => void
@@ -2892,7 +2776,7 @@ export declare const editorMachine: StateMachine<
2892
2776
  }
2893
2777
  | {
2894
2778
  type: 'behavior event'
2895
- behaviorEvent: BehaviorEvent
2779
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2896
2780
  editor: PortableTextSlateEditor
2897
2781
  nativeEvent?: {
2898
2782
  preventDefault: () => void
@@ -3206,7 +3090,7 @@ export declare const editorMachine: StateMachine<
3206
3090
  }
3207
3091
  | {
3208
3092
  type: 'behavior event'
3209
- behaviorEvent: BehaviorEvent
3093
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3210
3094
  editor: PortableTextSlateEditor
3211
3095
  nativeEvent?: {
3212
3096
  preventDefault: () => void
@@ -3520,7 +3404,7 @@ export declare const editorMachine: StateMachine<
3520
3404
  }
3521
3405
  | {
3522
3406
  type: 'behavior event'
3523
- behaviorEvent: BehaviorEvent
3407
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3524
3408
  editor: PortableTextSlateEditor
3525
3409
  nativeEvent?: {
3526
3410
  preventDefault: () => void
@@ -3841,7 +3725,7 @@ export declare const editorMachine: StateMachine<
3841
3725
  }
3842
3726
  | {
3843
3727
  type: 'behavior event'
3844
- behaviorEvent: BehaviorEvent
3728
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3845
3729
  editor: PortableTextSlateEditor
3846
3730
  nativeEvent?: {
3847
3731
  preventDefault: () => void
@@ -4163,7 +4047,7 @@ export declare const editorMachine: StateMachine<
4163
4047
  }
4164
4048
  | {
4165
4049
  type: 'behavior event'
4166
- behaviorEvent: BehaviorEvent
4050
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4167
4051
  editor: PortableTextSlateEditor
4168
4052
  nativeEvent?: {
4169
4053
  preventDefault: () => void
@@ -4470,7 +4354,7 @@ export declare const editorMachine: StateMachine<
4470
4354
  }
4471
4355
  | {
4472
4356
  type: 'behavior event'
4473
- behaviorEvent: BehaviorEvent
4357
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4474
4358
  editor: PortableTextSlateEditor
4475
4359
  nativeEvent?: {
4476
4360
  preventDefault: () => void
@@ -4776,7 +4660,7 @@ export declare const editorMachine: StateMachine<
4776
4660
  }
4777
4661
  | {
4778
4662
  type: 'behavior event'
4779
- behaviorEvent: BehaviorEvent
4663
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4780
4664
  editor: PortableTextSlateEditor
4781
4665
  nativeEvent?: {
4782
4666
  preventDefault: () => void
@@ -5065,7 +4949,7 @@ export declare const editorMachine: StateMachine<
5065
4949
  }
5066
4950
  | {
5067
4951
  type: 'behavior event'
5068
- behaviorEvent: BehaviorEvent
4952
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
5069
4953
  editor: PortableTextSlateEditor
5070
4954
  nativeEvent?: {
5071
4955
  preventDefault: () => void
@@ -5354,7 +5238,7 @@ export declare const editorMachine: StateMachine<
5354
5238
  }
5355
5239
  | {
5356
5240
  type: 'behavior event'
5357
- behaviorEvent: BehaviorEvent
5241
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
5358
5242
  editor: PortableTextSlateEditor
5359
5243
  nativeEvent?: {
5360
5244
  preventDefault: () => void
@@ -5644,7 +5528,7 @@ export declare const editorMachine: StateMachine<
5644
5528
  }
5645
5529
  | {
5646
5530
  type: 'behavior event'
5647
- behaviorEvent: BehaviorEvent
5531
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
5648
5532
  editor: PortableTextSlateEditor
5649
5533
  nativeEvent?: {
5650
5534
  preventDefault: () => void
@@ -5935,7 +5819,7 @@ export declare const editorMachine: StateMachine<
5935
5819
  }
5936
5820
  | {
5937
5821
  type: 'behavior event'
5938
- behaviorEvent: BehaviorEvent
5822
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
5939
5823
  editor: PortableTextSlateEditor
5940
5824
  nativeEvent?: {
5941
5825
  preventDefault: () => void
@@ -6225,7 +6109,7 @@ export declare const editorMachine: StateMachine<
6225
6109
  }
6226
6110
  | {
6227
6111
  type: 'behavior event'
6228
- behaviorEvent: BehaviorEvent
6112
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
6229
6113
  editor: PortableTextSlateEditor
6230
6114
  nativeEvent?: {
6231
6115
  preventDefault: () => void
@@ -6397,7 +6281,7 @@ export declare const editorMachine: StateMachine<
6397
6281
  }
6398
6282
  | {
6399
6283
  type: 'behavior event'
6400
- behaviorEvent: BehaviorEvent
6284
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
6401
6285
  editor: PortableTextSlateEditor
6402
6286
  nativeEvent?: {
6403
6287
  preventDefault: () => void
@@ -6687,7 +6571,7 @@ export declare const editorMachine: StateMachine<
6687
6571
  }
6688
6572
  | {
6689
6573
  type: 'behavior event'
6690
- behaviorEvent: BehaviorEvent
6574
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
6691
6575
  editor: PortableTextSlateEditor
6692
6576
  nativeEvent?: {
6693
6577
  preventDefault: () => void
@@ -6976,7 +6860,7 @@ export declare const editorMachine: StateMachine<
6976
6860
  }
6977
6861
  | {
6978
6862
  type: 'behavior event'
6979
- behaviorEvent: BehaviorEvent
6863
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
6980
6864
  editor: PortableTextSlateEditor
6981
6865
  nativeEvent?: {
6982
6866
  preventDefault: () => void
@@ -7264,7 +7148,7 @@ export declare const editorMachine: StateMachine<
7264
7148
  }
7265
7149
  | {
7266
7150
  type: 'behavior event'
7267
- behaviorEvent: BehaviorEvent
7151
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
7268
7152
  editor: PortableTextSlateEditor
7269
7153
  nativeEvent?: {
7270
7154
  preventDefault: () => void
@@ -7550,7 +7434,7 @@ export declare const editorMachine: StateMachine<
7550
7434
  }
7551
7435
  | {
7552
7436
  type: 'behavior event'
7553
- behaviorEvent: BehaviorEvent
7437
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
7554
7438
  editor: PortableTextSlateEditor
7555
7439
  nativeEvent?: {
7556
7440
  preventDefault: () => void
@@ -7838,7 +7722,7 @@ export declare const editorMachine: StateMachine<
7838
7722
  }
7839
7723
  | {
7840
7724
  type: 'behavior event'
7841
- behaviorEvent: BehaviorEvent
7725
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
7842
7726
  editor: PortableTextSlateEditor
7843
7727
  nativeEvent?: {
7844
7728
  preventDefault: () => void
@@ -8133,7 +8017,7 @@ export declare const editorMachine: StateMachine<
8133
8017
  }
8134
8018
  | {
8135
8019
  type: 'behavior event'
8136
- behaviorEvent: BehaviorEvent
8020
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8137
8021
  editor: PortableTextSlateEditor
8138
8022
  nativeEvent?: {
8139
8023
  preventDefault: () => void
@@ -8307,7 +8191,7 @@ export declare const editorMachine: StateMachine<
8307
8191
  }
8308
8192
  | {
8309
8193
  type: 'behavior event'
8310
- behaviorEvent: BehaviorEvent
8194
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8311
8195
  editor: PortableTextSlateEditor
8312
8196
  nativeEvent?: {
8313
8197
  preventDefault: () => void
@@ -8478,7 +8362,7 @@ export declare const editorMachine: StateMachine<
8478
8362
  }
8479
8363
  | {
8480
8364
  type: 'behavior event'
8481
- behaviorEvent: BehaviorEvent
8365
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8482
8366
  editor: PortableTextSlateEditor
8483
8367
  nativeEvent?: {
8484
8368
  preventDefault: () => void
@@ -8768,7 +8652,7 @@ export declare const editorMachine: StateMachine<
8768
8652
  }
8769
8653
  | {
8770
8654
  type: 'behavior event'
8771
- behaviorEvent: BehaviorEvent
8655
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8772
8656
  editor: PortableTextSlateEditor
8773
8657
  nativeEvent?: {
8774
8658
  preventDefault: () => void
@@ -8864,7 +8748,7 @@ export declare const editorMachine: StateMachine<
8864
8748
  },
8865
8749
  {
8866
8750
  type: 'behavior event'
8867
- behaviorEvent: BehaviorEvent
8751
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8868
8752
  editor: PortableTextSlateEditor
8869
8753
  nativeEvent?: {
8870
8754
  preventDefault: () => void
@@ -8972,7 +8856,7 @@ export declare const editorMachine: StateMachine<
8972
8856
  }
8973
8857
  | {
8974
8858
  type: 'behavior event'
8975
- behaviorEvent: BehaviorEvent
8859
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
8976
8860
  editor: PortableTextSlateEditor
8977
8861
  nativeEvent?: {
8978
8862
  preventDefault: () => void
@@ -9139,7 +9023,7 @@ export declare const editorMachine: StateMachine<
9139
9023
  }
9140
9024
  | {
9141
9025
  type: 'behavior event'
9142
- behaviorEvent: BehaviorEvent
9026
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
9143
9027
  editor: PortableTextSlateEditor
9144
9028
  nativeEvent?: {
9145
9029
  preventDefault: () => void
@@ -9570,7 +9454,7 @@ export declare type InternalEditorEmittedEvent =
9570
9454
  readOnly: boolean
9571
9455
  }
9572
9456
  | PickFromUnion<
9573
- BehaviorEvent,
9457
+ SyntheticBehaviorEvent,
9574
9458
  'type',
9575
9459
  | 'annotation.add'
9576
9460
  | 'annotation.remove'
@@ -9598,7 +9482,7 @@ export declare type InternalEditorEvent =
9598
9482
  }
9599
9483
  | {
9600
9484
  type: 'behavior event'
9601
- behaviorEvent: BehaviorEvent
9485
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
9602
9486
  editor: PortableTextSlateEditor
9603
9487
  nativeEvent?: {
9604
9488
  preventDefault: () => void
@@ -9742,6 +9626,33 @@ declare type MutationEvent_2 = {
9742
9626
  }
9743
9627
  export {MutationEvent_2 as MutationEvent}
9744
9628
 
9629
+ /**
9630
+ * @alpha
9631
+ */
9632
+ export declare type NativeBehaviorEvent =
9633
+ | {
9634
+ type: 'copy'
9635
+ data: DataTransfer
9636
+ }
9637
+ | {
9638
+ type: 'key.down'
9639
+ keyboardEvent: Pick<
9640
+ KeyboardEvent,
9641
+ 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
9642
+ >
9643
+ }
9644
+ | {
9645
+ type: 'key.up'
9646
+ keyboardEvent: Pick<
9647
+ KeyboardEvent,
9648
+ 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
9649
+ >
9650
+ }
9651
+ | {
9652
+ type: 'paste'
9653
+ data: DataTransfer
9654
+ }
9655
+
9745
9656
  /**
9746
9657
  * @alpha
9747
9658
  */
@@ -10255,6 +10166,99 @@ export declare type SlateEditor = {
10255
10166
  initialValue: Array<Descendant>
10256
10167
  }
10257
10168
 
10169
+ /**
10170
+ * @alpha
10171
+ */
10172
+ export declare type SyntheticBehaviorEvent =
10173
+ | {
10174
+ type: 'annotation.add'
10175
+ annotation: {
10176
+ name: string
10177
+ value: {
10178
+ [prop: string]: unknown
10179
+ }
10180
+ }
10181
+ }
10182
+ | {
10183
+ type: 'annotation.remove'
10184
+ annotation: {
10185
+ name: string
10186
+ }
10187
+ }
10188
+ | {
10189
+ type: 'annotation.toggle'
10190
+ annotation: {
10191
+ name: string
10192
+ value: {
10193
+ [prop: string]: unknown
10194
+ }
10195
+ }
10196
+ }
10197
+ | {
10198
+ type: 'blur'
10199
+ }
10200
+ | {
10201
+ type: 'decorator.add'
10202
+ decorator: string
10203
+ }
10204
+ | {
10205
+ type: 'decorator.remove'
10206
+ decorator: string
10207
+ }
10208
+ | {
10209
+ type: 'decorator.toggle'
10210
+ decorator: string
10211
+ }
10212
+ | {
10213
+ type: 'delete.backward'
10214
+ unit: TextUnit
10215
+ }
10216
+ | {
10217
+ type: 'delete.forward'
10218
+ unit: TextUnit
10219
+ }
10220
+ | {
10221
+ type: 'focus'
10222
+ }
10223
+ | {
10224
+ type: 'insert.block object'
10225
+ placement: 'auto' | 'after' | 'before'
10226
+ blockObject: {
10227
+ name: string
10228
+ value?: {
10229
+ [prop: string]: unknown
10230
+ }
10231
+ }
10232
+ }
10233
+ | {
10234
+ type: 'insert.inline object'
10235
+ inlineObject: {
10236
+ name: string
10237
+ value?: {
10238
+ [prop: string]: unknown
10239
+ }
10240
+ }
10241
+ }
10242
+ | {
10243
+ type: 'insert.soft break'
10244
+ }
10245
+ | {
10246
+ type: 'insert.break'
10247
+ }
10248
+ | {
10249
+ type: 'insert.text'
10250
+ text: string
10251
+ options?: TextInsertTextOptions
10252
+ }
10253
+ | {
10254
+ type: 'list item.toggle'
10255
+ listItem: string
10256
+ }
10257
+ | {
10258
+ type: 'style.toggle'
10259
+ style: string
10260
+ }
10261
+
10258
10262
  /**
10259
10263
  * The editor performed a undo history step
10260
10264
  * @beta */