@portabletext/editor 1.35.3 → 1.36.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 (34) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  2. package/lib/_chunks-cjs/editor-provider.cjs +211 -74
  3. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  4. package/lib/_chunks-es/behavior.core.js.map +1 -1
  5. package/lib/_chunks-es/editor-provider.js +212 -75
  6. package/lib/_chunks-es/editor-provider.js.map +1 -1
  7. package/lib/behaviors/index.d.cts +150 -354
  8. package/lib/behaviors/index.d.ts +150 -354
  9. package/lib/index.d.cts +145 -77
  10. package/lib/index.d.ts +145 -77
  11. package/lib/plugins/index.cjs +19 -19
  12. package/lib/plugins/index.cjs.map +1 -1
  13. package/lib/plugins/index.d.cts +134 -77
  14. package/lib/plugins/index.d.ts +134 -77
  15. package/lib/plugins/index.js +21 -21
  16. package/lib/plugins/index.js.map +1 -1
  17. package/lib/selectors/index.d.cts +123 -77
  18. package/lib/selectors/index.d.ts +123 -77
  19. package/lib/utils/index.d.cts +123 -77
  20. package/lib/utils/index.d.ts +123 -77
  21. package/package.json +6 -6
  22. package/src/behavior-actions/behavior.actions.ts +2 -2
  23. package/src/behaviors/behavior.types.ts +10 -7
  24. package/src/editor/PortableTextEditor.tsx +22 -0
  25. package/src/editor/__tests__/self-solving.test.tsx +33 -1
  26. package/src/editor/components/Synchronizer.tsx +17 -3
  27. package/src/editor/editor-machine.ts +31 -15
  28. package/src/editor/mutation-machine.ts +160 -46
  29. package/src/editor/plugins/create-with-event-listeners.ts +1 -0
  30. package/src/editor/plugins/createWithPatches.ts +10 -3
  31. package/src/editor/with-applying-behavior-actions.ts +8 -6
  32. package/src/plugins/index.ts +2 -1
  33. package/src/plugins/plugin.decorator-shortcut.ts +3 -0
  34. package/src/utils/util.slice-blocks.test.ts +64 -0
@@ -59,11 +59,9 @@ import {MIMEType as MIMEType_2} from '../internal-utils/mime-type'
59
59
  declare type Behavior<
60
60
  TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
61
61
  TGuardResponse = true,
62
- TBehaviorEvent extends BehaviorEvent = PickFromUnion<
63
- BehaviorEvent,
64
- 'type',
65
- TBehaviorEventType
66
- >,
62
+ TBehaviorEvent extends BehaviorEvent = TBehaviorEventType extends '*'
63
+ ? BehaviorEvent
64
+ : PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
67
65
  > = {
68
66
  /**
69
67
  * The internal editor event that triggers this behavior.
@@ -121,6 +119,9 @@ declare type BehaviorEvent =
121
119
  | SyntheticBehaviorEvent
122
120
  | NativeBehaviorEvent
123
121
  | CustomBehaviorEvent
122
+ | {
123
+ type: '*'
124
+ }
124
125
 
125
126
  /**
126
127
  * @beta
@@ -318,7 +319,7 @@ declare const editorMachine: StateMachine<
318
319
  behaviors: Set<Behavior>
319
320
  converters: Set<Converter>
320
321
  keyGenerator: () => string
321
- pendingEvents: Array<PatchEvent | MutationEvent>
322
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
322
323
  schema: EditorSchema
323
324
  initialReadOnly: boolean
324
325
  maxBlocks: number | undefined
@@ -548,7 +549,7 @@ declare const editorMachine: StateMachine<
548
549
  } & {
549
550
  dataTransfer: DataTransfer
550
551
  })
551
- | PatchEvent
552
+ | InternalPatchEvent
552
553
  | MutationEvent
553
554
  | {
554
555
  type: 'normalizing'
@@ -983,6 +984,7 @@ declare const editorMachine: StateMachine<
983
984
  dataTransfer: DataTransfer
984
985
  })
985
986
  | PatchEvent
987
+ | InternalPatchEvent
986
988
  | MutationEvent
987
989
  | PatchesEvent
988
990
  | {
@@ -1075,7 +1077,7 @@ declare const editorMachine: StateMachine<
1075
1077
  behaviors: Set<Behavior>
1076
1078
  converters: Set<Converter>
1077
1079
  keyGenerator: () => string
1078
- pendingEvents: Array<PatchEvent | MutationEvent>
1080
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1079
1081
  schema: EditorSchema
1080
1082
  initialReadOnly: boolean
1081
1083
  maxBlocks: number | undefined
@@ -1305,7 +1307,7 @@ declare const editorMachine: StateMachine<
1305
1307
  } & {
1306
1308
  dataTransfer: DataTransfer
1307
1309
  })
1308
- | PatchEvent
1310
+ | InternalPatchEvent
1309
1311
  | MutationEvent
1310
1312
  | {
1311
1313
  type: 'normalizing'
@@ -1662,7 +1664,7 @@ declare const editorMachine: StateMachine<
1662
1664
  } & {
1663
1665
  dataTransfer: DataTransfer
1664
1666
  })
1665
- | PatchEvent
1667
+ | InternalPatchEvent
1666
1668
  | MutationEvent
1667
1669
  | {
1668
1670
  type: 'normalizing'
@@ -1809,7 +1811,7 @@ declare const editorMachine: StateMachine<
1809
1811
  behaviors: Set<Behavior>
1810
1812
  converters: Set<Converter>
1811
1813
  keyGenerator: () => string
1812
- pendingEvents: Array<PatchEvent | MutationEvent>
1814
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1813
1815
  schema: EditorSchema
1814
1816
  initialReadOnly: boolean
1815
1817
  maxBlocks: number | undefined
@@ -2043,7 +2045,7 @@ declare const editorMachine: StateMachine<
2043
2045
  } & {
2044
2046
  dataTransfer: DataTransfer
2045
2047
  })
2046
- | PatchEvent
2048
+ | InternalPatchEvent
2047
2049
  | MutationEvent
2048
2050
  | {
2049
2051
  type: 'normalizing'
@@ -2399,6 +2401,7 @@ declare const editorMachine: StateMachine<
2399
2401
  dataTransfer: DataTransfer
2400
2402
  })
2401
2403
  | PatchEvent
2404
+ | InternalPatchEvent
2402
2405
  | MutationEvent
2403
2406
  | PatchesEvent
2404
2407
  | {
@@ -2456,7 +2459,7 @@ declare const editorMachine: StateMachine<
2456
2459
  behaviors: Set<Behavior>
2457
2460
  converters: Set<Converter>
2458
2461
  keyGenerator: () => string
2459
- pendingEvents: Array<PatchEvent | MutationEvent>
2462
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
2460
2463
  schema: EditorSchema
2461
2464
  initialReadOnly: boolean
2462
2465
  maxBlocks: number | undefined
@@ -2689,7 +2692,7 @@ declare const editorMachine: StateMachine<
2689
2692
  } & {
2690
2693
  dataTransfer: DataTransfer
2691
2694
  })
2692
- | PatchEvent
2695
+ | InternalPatchEvent
2693
2696
  | MutationEvent
2694
2697
  | {
2695
2698
  type: 'normalizing'
@@ -3045,6 +3048,7 @@ declare const editorMachine: StateMachine<
3045
3048
  dataTransfer: DataTransfer
3046
3049
  })
3047
3050
  | PatchEvent
3051
+ | InternalPatchEvent
3048
3052
  | MutationEvent
3049
3053
  | PatchesEvent
3050
3054
  | {
@@ -3102,7 +3106,7 @@ declare const editorMachine: StateMachine<
3102
3106
  behaviors: Set<Behavior>
3103
3107
  converters: Set<Converter>
3104
3108
  keyGenerator: () => string
3105
- pendingEvents: Array<PatchEvent | MutationEvent>
3109
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3106
3110
  schema: EditorSchema
3107
3111
  initialReadOnly: boolean
3108
3112
  maxBlocks: number | undefined
@@ -3338,7 +3342,7 @@ declare const editorMachine: StateMachine<
3338
3342
  } & {
3339
3343
  dataTransfer: DataTransfer
3340
3344
  })
3341
- | PatchEvent
3345
+ | InternalPatchEvent
3342
3346
  | MutationEvent
3343
3347
  | {
3344
3348
  type: 'normalizing'
@@ -3694,6 +3698,7 @@ declare const editorMachine: StateMachine<
3694
3698
  dataTransfer: DataTransfer
3695
3699
  })
3696
3700
  | PatchEvent
3701
+ | InternalPatchEvent
3697
3702
  | MutationEvent
3698
3703
  | PatchesEvent
3699
3704
  | {
@@ -3751,7 +3756,7 @@ declare const editorMachine: StateMachine<
3751
3756
  behaviors: Set<Behavior>
3752
3757
  converters: Set<Converter>
3753
3758
  keyGenerator: () => string
3754
- pendingEvents: Array<PatchEvent | MutationEvent>
3759
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3755
3760
  schema: EditorSchema
3756
3761
  initialReadOnly: boolean
3757
3762
  maxBlocks: number | undefined
@@ -3986,7 +3991,7 @@ declare const editorMachine: StateMachine<
3986
3991
  } & {
3987
3992
  dataTransfer: DataTransfer
3988
3993
  })
3989
- | PatchEvent
3994
+ | InternalPatchEvent
3990
3995
  | MutationEvent
3991
3996
  | {
3992
3997
  type: 'normalizing'
@@ -4342,6 +4347,7 @@ declare const editorMachine: StateMachine<
4342
4347
  dataTransfer: DataTransfer
4343
4348
  })
4344
4349
  | PatchEvent
4350
+ | InternalPatchEvent
4345
4351
  | MutationEvent
4346
4352
  | PatchesEvent
4347
4353
  | {
@@ -4399,7 +4405,7 @@ declare const editorMachine: StateMachine<
4399
4405
  behaviors: Set<Behavior>
4400
4406
  converters: Set<Converter>
4401
4407
  keyGenerator: () => string
4402
- pendingEvents: Array<PatchEvent | MutationEvent>
4408
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
4403
4409
  schema: EditorSchema
4404
4410
  initialReadOnly: boolean
4405
4411
  maxBlocks: number | undefined
@@ -4633,7 +4639,7 @@ declare const editorMachine: StateMachine<
4633
4639
  } & {
4634
4640
  dataTransfer: DataTransfer
4635
4641
  })
4636
- | PatchEvent
4642
+ | InternalPatchEvent
4637
4643
  | MutationEvent
4638
4644
  | {
4639
4645
  type: 'normalizing'
@@ -4989,6 +4995,7 @@ declare const editorMachine: StateMachine<
4989
4995
  dataTransfer: DataTransfer
4990
4996
  })
4991
4997
  | PatchEvent
4998
+ | InternalPatchEvent
4992
4999
  | MutationEvent
4993
5000
  | PatchesEvent
4994
5001
  | {
@@ -5047,7 +5054,7 @@ declare const editorMachine: StateMachine<
5047
5054
  behaviors: Set<Behavior>
5048
5055
  converters: Set<Converter>
5049
5056
  keyGenerator: () => string
5050
- pendingEvents: Array<PatchEvent | MutationEvent>
5057
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5051
5058
  schema: EditorSchema
5052
5059
  initialReadOnly: boolean
5053
5060
  maxBlocks: number | undefined
@@ -5281,7 +5288,7 @@ declare const editorMachine: StateMachine<
5281
5288
  } & {
5282
5289
  dataTransfer: DataTransfer
5283
5290
  })
5284
- | PatchEvent
5291
+ | InternalPatchEvent
5285
5292
  | MutationEvent
5286
5293
  | {
5287
5294
  type: 'normalizing'
@@ -5420,7 +5427,7 @@ declare const editorMachine: StateMachine<
5420
5427
  behaviors: Set<Behavior>
5421
5428
  converters: Set<Converter>
5422
5429
  keyGenerator: () => string
5423
- pendingEvents: Array<PatchEvent | MutationEvent>
5430
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5424
5431
  schema: EditorSchema
5425
5432
  initialReadOnly: boolean
5426
5433
  maxBlocks: number | undefined
@@ -5654,7 +5661,7 @@ declare const editorMachine: StateMachine<
5654
5661
  } & {
5655
5662
  dataTransfer: DataTransfer
5656
5663
  })
5657
- | PatchEvent
5664
+ | InternalPatchEvent
5658
5665
  | MutationEvent
5659
5666
  | {
5660
5667
  type: 'normalizing'
@@ -6010,6 +6017,7 @@ declare const editorMachine: StateMachine<
6010
6017
  dataTransfer: DataTransfer
6011
6018
  })
6012
6019
  | PatchEvent
6020
+ | InternalPatchEvent
6013
6021
  | MutationEvent
6014
6022
  | PatchesEvent
6015
6023
  | {
@@ -6068,7 +6076,7 @@ declare const editorMachine: StateMachine<
6068
6076
  behaviors: Set<Behavior>
6069
6077
  converters: Set<Converter>
6070
6078
  keyGenerator: () => string
6071
- pendingEvents: Array<PatchEvent | MutationEvent>
6079
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6072
6080
  schema: EditorSchema
6073
6081
  initialReadOnly: boolean
6074
6082
  maxBlocks: number | undefined
@@ -6302,7 +6310,7 @@ declare const editorMachine: StateMachine<
6302
6310
  } & {
6303
6311
  dataTransfer: DataTransfer
6304
6312
  })
6305
- | PatchEvent
6313
+ | InternalPatchEvent
6306
6314
  | MutationEvent
6307
6315
  | {
6308
6316
  type: 'normalizing'
@@ -6658,6 +6666,7 @@ declare const editorMachine: StateMachine<
6658
6666
  dataTransfer: DataTransfer
6659
6667
  })
6660
6668
  | PatchEvent
6669
+ | InternalPatchEvent
6661
6670
  | MutationEvent
6662
6671
  | PatchesEvent
6663
6672
  | {
@@ -6715,7 +6724,7 @@ declare const editorMachine: StateMachine<
6715
6724
  behaviors: Set<Behavior>
6716
6725
  converters: Set<Converter>
6717
6726
  keyGenerator: () => string
6718
- pendingEvents: Array<PatchEvent | MutationEvent>
6727
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6719
6728
  schema: EditorSchema
6720
6729
  initialReadOnly: boolean
6721
6730
  maxBlocks: number | undefined
@@ -6948,7 +6957,7 @@ declare const editorMachine: StateMachine<
6948
6957
  } & {
6949
6958
  dataTransfer: DataTransfer
6950
6959
  })
6951
- | PatchEvent
6960
+ | InternalPatchEvent
6952
6961
  | MutationEvent
6953
6962
  | {
6954
6963
  type: 'normalizing'
@@ -7304,6 +7313,7 @@ declare const editorMachine: StateMachine<
7304
7313
  dataTransfer: DataTransfer
7305
7314
  })
7306
7315
  | PatchEvent
7316
+ | InternalPatchEvent
7307
7317
  | MutationEvent
7308
7318
  | PatchesEvent
7309
7319
  | {
@@ -7361,7 +7371,7 @@ declare const editorMachine: StateMachine<
7361
7371
  behaviors: Set<Behavior>
7362
7372
  converters: Set<Converter>
7363
7373
  keyGenerator: () => string
7364
- pendingEvents: Array<PatchEvent | MutationEvent>
7374
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
7365
7375
  schema: EditorSchema
7366
7376
  initialReadOnly: boolean
7367
7377
  maxBlocks: number | undefined
@@ -7595,7 +7605,7 @@ declare const editorMachine: StateMachine<
7595
7605
  } & {
7596
7606
  dataTransfer: DataTransfer
7597
7607
  })
7598
- | PatchEvent
7608
+ | InternalPatchEvent
7599
7609
  | MutationEvent
7600
7610
  | {
7601
7611
  type: 'normalizing'
@@ -7951,6 +7961,7 @@ declare const editorMachine: StateMachine<
7951
7961
  dataTransfer: DataTransfer
7952
7962
  })
7953
7963
  | PatchEvent
7964
+ | InternalPatchEvent
7954
7965
  | MutationEvent
7955
7966
  | PatchesEvent
7956
7967
  | {
@@ -8014,7 +8025,7 @@ declare const editorMachine: StateMachine<
8014
8025
  behaviors: Set<Behavior>
8015
8026
  converters: Set<Converter>
8016
8027
  keyGenerator: () => string
8017
- pendingEvents: Array<PatchEvent | MutationEvent>
8028
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8018
8029
  schema: EditorSchema
8019
8030
  initialReadOnly: boolean
8020
8031
  maxBlocks: number | undefined
@@ -8245,7 +8256,7 @@ declare const editorMachine: StateMachine<
8245
8256
  } & {
8246
8257
  dataTransfer: DataTransfer
8247
8258
  })
8248
- | PatchEvent
8259
+ | InternalPatchEvent
8249
8260
  | MutationEvent
8250
8261
  | {
8251
8262
  type: 'normalizing'
@@ -8601,6 +8612,7 @@ declare const editorMachine: StateMachine<
8601
8612
  dataTransfer: DataTransfer
8602
8613
  })
8603
8614
  | PatchEvent
8615
+ | InternalPatchEvent
8604
8616
  | MutationEvent
8605
8617
  | PatchesEvent
8606
8618
  | {
@@ -8661,7 +8673,7 @@ declare const editorMachine: StateMachine<
8661
8673
  behaviors: Set<Behavior>
8662
8674
  converters: Set<Converter>
8663
8675
  keyGenerator: () => string
8664
- pendingEvents: Array<PatchEvent | MutationEvent>
8676
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8665
8677
  schema: EditorSchema
8666
8678
  initialReadOnly: boolean
8667
8679
  maxBlocks: number | undefined
@@ -8895,7 +8907,7 @@ declare const editorMachine: StateMachine<
8895
8907
  } & {
8896
8908
  dataTransfer: DataTransfer
8897
8909
  })
8898
- | PatchEvent
8910
+ | InternalPatchEvent
8899
8911
  | MutationEvent
8900
8912
  | {
8901
8913
  type: 'normalizing'
@@ -9039,7 +9051,7 @@ declare const editorMachine: StateMachine<
9039
9051
  behaviors: Set<Behavior>
9040
9052
  converters: Set<Converter>
9041
9053
  keyGenerator: () => string
9042
- pendingEvents: Array<PatchEvent | MutationEvent>
9054
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9043
9055
  schema: EditorSchema
9044
9056
  initialReadOnly: boolean
9045
9057
  maxBlocks: number | undefined
@@ -9273,7 +9285,7 @@ declare const editorMachine: StateMachine<
9273
9285
  } & {
9274
9286
  dataTransfer: DataTransfer
9275
9287
  })
9276
- | PatchEvent
9288
+ | InternalPatchEvent
9277
9289
  | MutationEvent
9278
9290
  | {
9279
9291
  type: 'normalizing'
@@ -9414,7 +9426,7 @@ declare const editorMachine: StateMachine<
9414
9426
  behaviors: Set<Behavior>
9415
9427
  converters: Set<Converter>
9416
9428
  keyGenerator: () => string
9417
- pendingEvents: Array<PatchEvent | MutationEvent>
9429
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9418
9430
  schema: EditorSchema
9419
9431
  initialReadOnly: boolean
9420
9432
  maxBlocks: number | undefined
@@ -9648,7 +9660,7 @@ declare const editorMachine: StateMachine<
9648
9660
  } & {
9649
9661
  dataTransfer: DataTransfer
9650
9662
  })
9651
- | PatchEvent
9663
+ | InternalPatchEvent
9652
9664
  | MutationEvent
9653
9665
  | {
9654
9666
  type: 'normalizing'
@@ -9801,7 +9813,7 @@ declare const editorMachine: StateMachine<
9801
9813
  behaviors: Set<Behavior>
9802
9814
  converters: Set<Converter>
9803
9815
  keyGenerator: () => string
9804
- pendingEvents: Array<PatchEvent | MutationEvent>
9816
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9805
9817
  schema: EditorSchema
9806
9818
  initialReadOnly: boolean
9807
9819
  maxBlocks: number | undefined
@@ -9833,7 +9845,9 @@ declare const editorMachine: StateMachine<
9833
9845
  behaviors: Set<Behavior>
9834
9846
  converters: Set<Converter>
9835
9847
  keyGenerator: () => string
9836
- pendingEvents: Array<PatchEvent | MutationEvent>
9848
+ pendingEvents: Array<
9849
+ InternalPatchEvent | MutationEvent
9850
+ >
9837
9851
  schema: EditorSchema
9838
9852
  initialReadOnly: boolean
9839
9853
  maxBlocks: number | undefined
@@ -9861,7 +9875,7 @@ declare const editorMachine: StateMachine<
9861
9875
  behaviors: Set<Behavior>
9862
9876
  converters: Set<Converter>
9863
9877
  keyGenerator: () => string
9864
- pendingEvents: Array<PatchEvent | MutationEvent>
9878
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9865
9879
  schema: EditorSchema
9866
9880
  initialReadOnly: boolean
9867
9881
  maxBlocks: number | undefined
@@ -9890,7 +9904,7 @@ declare const editorMachine: StateMachine<
9890
9904
  behaviors: Set<Behavior>
9891
9905
  converters: Set<Converter>
9892
9906
  keyGenerator: () => string
9893
- pendingEvents: Array<PatchEvent | MutationEvent>
9907
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9894
9908
  schema: EditorSchema
9895
9909
  initialReadOnly: boolean
9896
9910
  maxBlocks: number | undefined
@@ -9917,7 +9931,7 @@ declare const editorMachine: StateMachine<
9917
9931
  behaviors: Set<Behavior>
9918
9932
  converters: Set<Converter>
9919
9933
  keyGenerator: () => string
9920
- pendingEvents: Array<PatchEvent | MutationEvent>
9934
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9921
9935
  schema: EditorSchema
9922
9936
  initialReadOnly: boolean
9923
9937
  maxBlocks: number | undefined
@@ -10171,7 +10185,7 @@ declare const editorMachine: StateMachine<
10171
10185
  } & {
10172
10186
  dataTransfer: DataTransfer
10173
10187
  })
10174
- | PatchEvent
10188
+ | InternalPatchEvent
10175
10189
  | MutationEvent
10176
10190
  | {
10177
10191
  type: 'normalizing'
@@ -10529,6 +10543,7 @@ declare const editorMachine: StateMachine<
10529
10543
  dataTransfer: DataTransfer
10530
10544
  })
10531
10545
  | PatchEvent
10546
+ | InternalPatchEvent
10532
10547
  | MutationEvent
10533
10548
  | PatchesEvent
10534
10549
  | {
@@ -10586,7 +10601,7 @@ declare const editorMachine: StateMachine<
10586
10601
  behaviors: Set<Behavior>
10587
10602
  converters: Set<Converter>
10588
10603
  keyGenerator: () => string
10589
- pendingEvents: Array<PatchEvent | MutationEvent>
10604
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
10590
10605
  schema: EditorSchema
10591
10606
  initialReadOnly: boolean
10592
10607
  maxBlocks: number | undefined
@@ -10826,7 +10841,7 @@ declare const editorMachine: StateMachine<
10826
10841
  } & {
10827
10842
  dataTransfer: DataTransfer
10828
10843
  })
10829
- | PatchEvent
10844
+ | InternalPatchEvent
10830
10845
  | MutationEvent
10831
10846
  | {
10832
10847
  type: 'normalizing'
@@ -11184,6 +11199,7 @@ declare const editorMachine: StateMachine<
11184
11199
  dataTransfer: DataTransfer
11185
11200
  })
11186
11201
  | PatchEvent
11202
+ | InternalPatchEvent
11187
11203
  | MutationEvent
11188
11204
  | PatchesEvent
11189
11205
  | {
@@ -11241,7 +11257,7 @@ declare const editorMachine: StateMachine<
11241
11257
  behaviors: Set<Behavior>
11242
11258
  converters: Set<Converter>
11243
11259
  keyGenerator: () => string
11244
- pendingEvents: Array<PatchEvent | MutationEvent>
11260
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11245
11261
  schema: EditorSchema
11246
11262
  initialReadOnly: boolean
11247
11263
  maxBlocks: number | undefined
@@ -11474,7 +11490,7 @@ declare const editorMachine: StateMachine<
11474
11490
  } & {
11475
11491
  dataTransfer: DataTransfer
11476
11492
  })
11477
- | PatchEvent
11493
+ | InternalPatchEvent
11478
11494
  | MutationEvent
11479
11495
  | {
11480
11496
  type: 'normalizing'
@@ -11832,6 +11848,7 @@ declare const editorMachine: StateMachine<
11832
11848
  dataTransfer: DataTransfer
11833
11849
  })
11834
11850
  | PatchEvent
11851
+ | InternalPatchEvent
11835
11852
  | MutationEvent
11836
11853
  | PatchesEvent
11837
11854
  | {
@@ -11889,7 +11906,7 @@ declare const editorMachine: StateMachine<
11889
11906
  behaviors: Set<Behavior>
11890
11907
  converters: Set<Converter>
11891
11908
  keyGenerator: () => string
11892
- pendingEvents: Array<PatchEvent | MutationEvent>
11909
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11893
11910
  schema: EditorSchema
11894
11911
  initialReadOnly: boolean
11895
11912
  maxBlocks: number | undefined
@@ -12122,7 +12139,7 @@ declare const editorMachine: StateMachine<
12122
12139
  } & {
12123
12140
  dataTransfer: DataTransfer
12124
12141
  })
12125
- | PatchEvent
12142
+ | InternalPatchEvent
12126
12143
  | MutationEvent
12127
12144
  | {
12128
12145
  type: 'normalizing'
@@ -12480,6 +12497,7 @@ declare const editorMachine: StateMachine<
12480
12497
  dataTransfer: DataTransfer
12481
12498
  })
12482
12499
  | PatchEvent
12500
+ | InternalPatchEvent
12483
12501
  | MutationEvent
12484
12502
  | PatchesEvent
12485
12503
  | {
@@ -12537,7 +12555,7 @@ declare const editorMachine: StateMachine<
12537
12555
  behaviors: Set<Behavior>
12538
12556
  converters: Set<Converter>
12539
12557
  keyGenerator: () => string
12540
- pendingEvents: Array<PatchEvent | MutationEvent>
12558
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
12541
12559
  schema: EditorSchema
12542
12560
  initialReadOnly: boolean
12543
12561
  maxBlocks: number | undefined
@@ -12783,7 +12801,7 @@ declare const editorMachine: StateMachine<
12783
12801
  } & {
12784
12802
  dataTransfer: DataTransfer
12785
12803
  })
12786
- | PatchEvent
12804
+ | InternalPatchEvent
12787
12805
  | MutationEvent
12788
12806
  | {
12789
12807
  type: 'normalizing'
@@ -13141,6 +13159,7 @@ declare const editorMachine: StateMachine<
13141
13159
  dataTransfer: DataTransfer
13142
13160
  })
13143
13161
  | PatchEvent
13162
+ | InternalPatchEvent
13144
13163
  | MutationEvent
13145
13164
  | PatchesEvent
13146
13165
  | {
@@ -13198,7 +13217,7 @@ declare const editorMachine: StateMachine<
13198
13217
  behaviors: Set<Behavior>
13199
13218
  converters: Set<Converter>
13200
13219
  keyGenerator: () => string
13201
- pendingEvents: Array<PatchEvent | MutationEvent>
13220
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13202
13221
  schema: EditorSchema
13203
13222
  initialReadOnly: boolean
13204
13223
  maxBlocks: number | undefined
@@ -13445,7 +13464,7 @@ declare const editorMachine: StateMachine<
13445
13464
  } & {
13446
13465
  dataTransfer: DataTransfer
13447
13466
  })
13448
- | PatchEvent
13467
+ | InternalPatchEvent
13449
13468
  | MutationEvent
13450
13469
  | {
13451
13470
  type: 'normalizing'
@@ -13803,6 +13822,7 @@ declare const editorMachine: StateMachine<
13803
13822
  dataTransfer: DataTransfer
13804
13823
  })
13805
13824
  | PatchEvent
13825
+ | InternalPatchEvent
13806
13826
  | MutationEvent
13807
13827
  | PatchesEvent
13808
13828
  | {
@@ -13860,7 +13880,7 @@ declare const editorMachine: StateMachine<
13860
13880
  behaviors: Set<Behavior>
13861
13881
  converters: Set<Converter>
13862
13882
  keyGenerator: () => string
13863
- pendingEvents: Array<PatchEvent | MutationEvent>
13883
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13864
13884
  schema: EditorSchema
13865
13885
  initialReadOnly: boolean
13866
13886
  maxBlocks: number | undefined
@@ -14093,7 +14113,7 @@ declare const editorMachine: StateMachine<
14093
14113
  } & {
14094
14114
  dataTransfer: DataTransfer
14095
14115
  })
14096
- | PatchEvent
14116
+ | InternalPatchEvent
14097
14117
  | MutationEvent
14098
14118
  | {
14099
14119
  type: 'normalizing'
@@ -14451,6 +14471,7 @@ declare const editorMachine: StateMachine<
14451
14471
  dataTransfer: DataTransfer
14452
14472
  })
14453
14473
  | PatchEvent
14474
+ | InternalPatchEvent
14454
14475
  | MutationEvent
14455
14476
  | PatchesEvent
14456
14477
  | {
@@ -14508,7 +14529,7 @@ declare const editorMachine: StateMachine<
14508
14529
  behaviors: Set<Behavior>
14509
14530
  converters: Set<Converter>
14510
14531
  keyGenerator: () => string
14511
- pendingEvents: Array<PatchEvent | MutationEvent>
14532
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
14512
14533
  schema: EditorSchema
14513
14534
  initialReadOnly: boolean
14514
14535
  maxBlocks: number | undefined
@@ -14744,7 +14765,7 @@ declare const editorMachine: StateMachine<
14744
14765
  } & {
14745
14766
  dataTransfer: DataTransfer
14746
14767
  })
14747
- | PatchEvent
14768
+ | InternalPatchEvent
14748
14769
  | MutationEvent
14749
14770
  | {
14750
14771
  type: 'normalizing'
@@ -15102,6 +15123,7 @@ declare const editorMachine: StateMachine<
15102
15123
  dataTransfer: DataTransfer
15103
15124
  })
15104
15125
  | PatchEvent
15126
+ | InternalPatchEvent
15105
15127
  | MutationEvent
15106
15128
  | PatchesEvent
15107
15129
  | {
@@ -15159,7 +15181,7 @@ declare const editorMachine: StateMachine<
15159
15181
  behaviors: Set<Behavior>
15160
15182
  converters: Set<Converter>
15161
15183
  keyGenerator: () => string
15162
- pendingEvents: Array<PatchEvent | MutationEvent>
15184
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15163
15185
  schema: EditorSchema
15164
15186
  initialReadOnly: boolean
15165
15187
  maxBlocks: number | undefined
@@ -15446,7 +15468,7 @@ declare const editorMachine: StateMachine<
15446
15468
  } & {
15447
15469
  dataTransfer: DataTransfer
15448
15470
  })
15449
- | PatchEvent
15471
+ | InternalPatchEvent
15450
15472
  | MutationEvent
15451
15473
  | {
15452
15474
  type: 'normalizing'
@@ -15804,6 +15826,7 @@ declare const editorMachine: StateMachine<
15804
15826
  dataTransfer: DataTransfer
15805
15827
  })
15806
15828
  | PatchEvent
15829
+ | InternalPatchEvent
15807
15830
  | MutationEvent
15808
15831
  | PatchesEvent
15809
15832
  | {
@@ -15861,7 +15884,7 @@ declare const editorMachine: StateMachine<
15861
15884
  behaviors: Set<Behavior>
15862
15885
  converters: Set<Converter>
15863
15886
  keyGenerator: () => string
15864
- pendingEvents: Array<PatchEvent | MutationEvent>
15887
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15865
15888
  schema: EditorSchema
15866
15889
  initialReadOnly: boolean
15867
15890
  maxBlocks: number | undefined
@@ -16103,7 +16126,7 @@ declare const editorMachine: StateMachine<
16103
16126
  } & {
16104
16127
  dataTransfer: DataTransfer
16105
16128
  })
16106
- | PatchEvent
16129
+ | InternalPatchEvent
16107
16130
  | MutationEvent
16108
16131
  | {
16109
16132
  type: 'normalizing'
@@ -16461,6 +16484,7 @@ declare const editorMachine: StateMachine<
16461
16484
  dataTransfer: DataTransfer
16462
16485
  })
16463
16486
  | PatchEvent
16487
+ | InternalPatchEvent
16464
16488
  | MutationEvent
16465
16489
  | PatchesEvent
16466
16490
  | {
@@ -16518,7 +16542,7 @@ declare const editorMachine: StateMachine<
16518
16542
  behaviors: Set<Behavior>
16519
16543
  converters: Set<Converter>
16520
16544
  keyGenerator: () => string
16521
- pendingEvents: Array<PatchEvent | MutationEvent>
16545
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
16522
16546
  schema: EditorSchema
16523
16547
  initialReadOnly: boolean
16524
16548
  maxBlocks: number | undefined
@@ -16761,7 +16785,7 @@ declare const editorMachine: StateMachine<
16761
16785
  } & {
16762
16786
  dataTransfer: DataTransfer
16763
16787
  })
16764
- | PatchEvent
16788
+ | InternalPatchEvent
16765
16789
  | MutationEvent
16766
16790
  | {
16767
16791
  type: 'normalizing'
@@ -17119,6 +17143,7 @@ declare const editorMachine: StateMachine<
17119
17143
  dataTransfer: DataTransfer
17120
17144
  })
17121
17145
  | PatchEvent
17146
+ | InternalPatchEvent
17122
17147
  | MutationEvent
17123
17148
  | PatchesEvent
17124
17149
  | {
@@ -17176,7 +17201,7 @@ declare const editorMachine: StateMachine<
17176
17201
  behaviors: Set<Behavior>
17177
17202
  converters: Set<Converter>
17178
17203
  keyGenerator: () => string
17179
- pendingEvents: Array<PatchEvent | MutationEvent>
17204
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17180
17205
  schema: EditorSchema
17181
17206
  initialReadOnly: boolean
17182
17207
  maxBlocks: number | undefined
@@ -17410,7 +17435,7 @@ declare const editorMachine: StateMachine<
17410
17435
  } & {
17411
17436
  dataTransfer: DataTransfer
17412
17437
  })
17413
- | PatchEvent
17438
+ | InternalPatchEvent
17414
17439
  | MutationEvent
17415
17440
  | {
17416
17441
  type: 'normalizing'
@@ -17768,6 +17793,7 @@ declare const editorMachine: StateMachine<
17768
17793
  dataTransfer: DataTransfer
17769
17794
  })
17770
17795
  | PatchEvent
17796
+ | InternalPatchEvent
17771
17797
  | MutationEvent
17772
17798
  | PatchesEvent
17773
17799
  | {
@@ -17825,7 +17851,7 @@ declare const editorMachine: StateMachine<
17825
17851
  behaviors: Set<Behavior>
17826
17852
  converters: Set<Converter>
17827
17853
  keyGenerator: () => string
17828
- pendingEvents: Array<PatchEvent | MutationEvent>
17854
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17829
17855
  schema: EditorSchema
17830
17856
  initialReadOnly: boolean
17831
17857
  maxBlocks: number | undefined
@@ -18061,7 +18087,7 @@ declare const editorMachine: StateMachine<
18061
18087
  } & {
18062
18088
  dataTransfer: DataTransfer
18063
18089
  })
18064
- | PatchEvent
18090
+ | InternalPatchEvent
18065
18091
  | MutationEvent
18066
18092
  | {
18067
18093
  type: 'normalizing'
@@ -18419,6 +18445,7 @@ declare const editorMachine: StateMachine<
18419
18445
  dataTransfer: DataTransfer
18420
18446
  })
18421
18447
  | PatchEvent
18448
+ | InternalPatchEvent
18422
18449
  | MutationEvent
18423
18450
  | PatchesEvent
18424
18451
  | {
@@ -18476,7 +18503,7 @@ declare const editorMachine: StateMachine<
18476
18503
  behaviors: Set<Behavior>
18477
18504
  converters: Set<Converter>
18478
18505
  keyGenerator: () => string
18479
- pendingEvents: Array<PatchEvent | MutationEvent>
18506
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
18480
18507
  schema: EditorSchema
18481
18508
  initialReadOnly: boolean
18482
18509
  maxBlocks: number | undefined
@@ -18718,7 +18745,7 @@ declare const editorMachine: StateMachine<
18718
18745
  } & {
18719
18746
  dataTransfer: DataTransfer
18720
18747
  })
18721
- | PatchEvent
18748
+ | InternalPatchEvent
18722
18749
  | MutationEvent
18723
18750
  | {
18724
18751
  type: 'normalizing'
@@ -19076,6 +19103,7 @@ declare const editorMachine: StateMachine<
19076
19103
  dataTransfer: DataTransfer
19077
19104
  })
19078
19105
  | PatchEvent
19106
+ | InternalPatchEvent
19079
19107
  | MutationEvent
19080
19108
  | PatchesEvent
19081
19109
  | {
@@ -19171,7 +19199,7 @@ declare const editorMachine: StateMachine<
19171
19199
  readonly 'setting up': {
19172
19200
  readonly exit: readonly ['emit ready']
19173
19201
  readonly on: {
19174
- readonly 'patch': {
19202
+ readonly 'internal.patch': {
19175
19203
  readonly actions: 'defer event'
19176
19204
  }
19177
19205
  readonly 'mutation': {
@@ -19187,14 +19215,14 @@ declare const editorMachine: StateMachine<
19187
19215
  readonly states: {
19188
19216
  readonly idle: {
19189
19217
  readonly on: {
19190
- readonly normalizing: {
19218
+ readonly 'normalizing': {
19191
19219
  readonly target: 'normalizing'
19192
19220
  }
19193
- readonly patch: {
19221
+ readonly 'internal.patch': {
19194
19222
  readonly actions: 'defer event'
19195
19223
  readonly target: '#editor.setup.dirty'
19196
19224
  }
19197
- readonly mutation: {
19225
+ readonly 'mutation': {
19198
19226
  readonly actions: 'defer event'
19199
19227
  readonly target: '#editor.setup.dirty'
19200
19228
  }
@@ -19205,7 +19233,7 @@ declare const editorMachine: StateMachine<
19205
19233
  readonly 'done normalizing': {
19206
19234
  readonly target: 'idle'
19207
19235
  }
19208
- readonly 'patch': {
19236
+ readonly 'internal.patch': {
19209
19237
  readonly actions: 'defer event'
19210
19238
  }
19211
19239
  readonly 'mutation': {
@@ -19221,10 +19249,10 @@ declare const editorMachine: StateMachine<
19221
19249
  'clear pending events',
19222
19250
  ]
19223
19251
  readonly on: {
19224
- readonly patch: {
19252
+ readonly 'internal.patch': {
19225
19253
  readonly actions: 'emit patch event'
19226
19254
  }
19227
- readonly mutation: {
19255
+ readonly 'mutation': {
19228
19256
  readonly actions: 'emit mutation event'
19229
19257
  }
19230
19258
  }
@@ -19590,6 +19618,11 @@ declare type HistoryItem = {
19590
19618
  timestamp: Date
19591
19619
  }
19592
19620
 
19621
+ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
19622
+ actionId?: string
19623
+ value: Array<PortableTextBlock>
19624
+ }
19625
+
19593
19626
  /**
19594
19627
  * The editor has invalid data in the value that can be resolved by the user
19595
19628
  * @beta */
@@ -19701,6 +19734,19 @@ declare type MutationEvent = {
19701
19734
  value: Array<PortableTextBlock> | undefined
19702
19735
  }
19703
19736
 
19737
+ declare type NamespaceEvent<
19738
+ TEvent,
19739
+ TNamespace extends string,
19740
+ > = TEvent extends {
19741
+ type: infer TEventType
19742
+ }
19743
+ ? {
19744
+ [K in keyof TEvent]: K extends 'type'
19745
+ ? `${TNamespace}.${TEventType & string}`
19746
+ : TEvent[K]
19747
+ }
19748
+ : never
19749
+
19704
19750
  /**
19705
19751
  * @beta
19706
19752
  */