@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
@@ -60,11 +60,9 @@ import {MIMEType as MIMEType_2} from '../internal-utils/mime-type'
60
60
  declare type Behavior<
61
61
  TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
62
62
  TGuardResponse = true,
63
- TBehaviorEvent extends BehaviorEvent = PickFromUnion<
64
- BehaviorEvent,
65
- 'type',
66
- TBehaviorEventType
67
- >,
63
+ TBehaviorEvent extends BehaviorEvent = TBehaviorEventType extends '*'
64
+ ? BehaviorEvent
65
+ : PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
68
66
  > = {
69
67
  /**
70
68
  * The internal editor event that triggers this behavior.
@@ -122,6 +120,9 @@ declare type BehaviorEvent =
122
120
  | SyntheticBehaviorEvent
123
121
  | NativeBehaviorEvent
124
122
  | CustomBehaviorEvent
123
+ | {
124
+ type: '*'
125
+ }
125
126
 
126
127
  /**
127
128
  * @beta
@@ -364,7 +365,7 @@ declare const editorMachine: StateMachine<
364
365
  behaviors: Set<Behavior>
365
366
  converters: Set<Converter>
366
367
  keyGenerator: () => string
367
- pendingEvents: Array<PatchEvent | MutationEvent>
368
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
368
369
  schema: EditorSchema
369
370
  initialReadOnly: boolean
370
371
  maxBlocks: number | undefined
@@ -594,7 +595,7 @@ declare const editorMachine: StateMachine<
594
595
  } & {
595
596
  dataTransfer: DataTransfer
596
597
  })
597
- | PatchEvent
598
+ | InternalPatchEvent
598
599
  | MutationEvent
599
600
  | {
600
601
  type: 'normalizing'
@@ -1029,6 +1030,7 @@ declare const editorMachine: StateMachine<
1029
1030
  dataTransfer: DataTransfer
1030
1031
  })
1031
1032
  | PatchEvent
1033
+ | InternalPatchEvent
1032
1034
  | MutationEvent
1033
1035
  | PatchesEvent
1034
1036
  | {
@@ -1121,7 +1123,7 @@ declare const editorMachine: StateMachine<
1121
1123
  behaviors: Set<Behavior>
1122
1124
  converters: Set<Converter>
1123
1125
  keyGenerator: () => string
1124
- pendingEvents: Array<PatchEvent | MutationEvent>
1126
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1125
1127
  schema: EditorSchema
1126
1128
  initialReadOnly: boolean
1127
1129
  maxBlocks: number | undefined
@@ -1351,7 +1353,7 @@ declare const editorMachine: StateMachine<
1351
1353
  } & {
1352
1354
  dataTransfer: DataTransfer
1353
1355
  })
1354
- | PatchEvent
1356
+ | InternalPatchEvent
1355
1357
  | MutationEvent
1356
1358
  | {
1357
1359
  type: 'normalizing'
@@ -1708,7 +1710,7 @@ declare const editorMachine: StateMachine<
1708
1710
  } & {
1709
1711
  dataTransfer: DataTransfer
1710
1712
  })
1711
- | PatchEvent
1713
+ | InternalPatchEvent
1712
1714
  | MutationEvent
1713
1715
  | {
1714
1716
  type: 'normalizing'
@@ -1855,7 +1857,7 @@ declare const editorMachine: StateMachine<
1855
1857
  behaviors: Set<Behavior>
1856
1858
  converters: Set<Converter>
1857
1859
  keyGenerator: () => string
1858
- pendingEvents: Array<PatchEvent | MutationEvent>
1860
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1859
1861
  schema: EditorSchema
1860
1862
  initialReadOnly: boolean
1861
1863
  maxBlocks: number | undefined
@@ -2089,7 +2091,7 @@ declare const editorMachine: StateMachine<
2089
2091
  } & {
2090
2092
  dataTransfer: DataTransfer
2091
2093
  })
2092
- | PatchEvent
2094
+ | InternalPatchEvent
2093
2095
  | MutationEvent
2094
2096
  | {
2095
2097
  type: 'normalizing'
@@ -2445,6 +2447,7 @@ declare const editorMachine: StateMachine<
2445
2447
  dataTransfer: DataTransfer
2446
2448
  })
2447
2449
  | PatchEvent
2450
+ | InternalPatchEvent
2448
2451
  | MutationEvent
2449
2452
  | PatchesEvent
2450
2453
  | {
@@ -2502,7 +2505,7 @@ declare const editorMachine: StateMachine<
2502
2505
  behaviors: Set<Behavior>
2503
2506
  converters: Set<Converter>
2504
2507
  keyGenerator: () => string
2505
- pendingEvents: Array<PatchEvent | MutationEvent>
2508
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
2506
2509
  schema: EditorSchema
2507
2510
  initialReadOnly: boolean
2508
2511
  maxBlocks: number | undefined
@@ -2735,7 +2738,7 @@ declare const editorMachine: StateMachine<
2735
2738
  } & {
2736
2739
  dataTransfer: DataTransfer
2737
2740
  })
2738
- | PatchEvent
2741
+ | InternalPatchEvent
2739
2742
  | MutationEvent
2740
2743
  | {
2741
2744
  type: 'normalizing'
@@ -3091,6 +3094,7 @@ declare const editorMachine: StateMachine<
3091
3094
  dataTransfer: DataTransfer
3092
3095
  })
3093
3096
  | PatchEvent
3097
+ | InternalPatchEvent
3094
3098
  | MutationEvent
3095
3099
  | PatchesEvent
3096
3100
  | {
@@ -3148,7 +3152,7 @@ declare const editorMachine: StateMachine<
3148
3152
  behaviors: Set<Behavior>
3149
3153
  converters: Set<Converter>
3150
3154
  keyGenerator: () => string
3151
- pendingEvents: Array<PatchEvent | MutationEvent>
3155
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3152
3156
  schema: EditorSchema
3153
3157
  initialReadOnly: boolean
3154
3158
  maxBlocks: number | undefined
@@ -3384,7 +3388,7 @@ declare const editorMachine: StateMachine<
3384
3388
  } & {
3385
3389
  dataTransfer: DataTransfer
3386
3390
  })
3387
- | PatchEvent
3391
+ | InternalPatchEvent
3388
3392
  | MutationEvent
3389
3393
  | {
3390
3394
  type: 'normalizing'
@@ -3740,6 +3744,7 @@ declare const editorMachine: StateMachine<
3740
3744
  dataTransfer: DataTransfer
3741
3745
  })
3742
3746
  | PatchEvent
3747
+ | InternalPatchEvent
3743
3748
  | MutationEvent
3744
3749
  | PatchesEvent
3745
3750
  | {
@@ -3797,7 +3802,7 @@ declare const editorMachine: StateMachine<
3797
3802
  behaviors: Set<Behavior>
3798
3803
  converters: Set<Converter>
3799
3804
  keyGenerator: () => string
3800
- pendingEvents: Array<PatchEvent | MutationEvent>
3805
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3801
3806
  schema: EditorSchema
3802
3807
  initialReadOnly: boolean
3803
3808
  maxBlocks: number | undefined
@@ -4032,7 +4037,7 @@ declare const editorMachine: StateMachine<
4032
4037
  } & {
4033
4038
  dataTransfer: DataTransfer
4034
4039
  })
4035
- | PatchEvent
4040
+ | InternalPatchEvent
4036
4041
  | MutationEvent
4037
4042
  | {
4038
4043
  type: 'normalizing'
@@ -4388,6 +4393,7 @@ declare const editorMachine: StateMachine<
4388
4393
  dataTransfer: DataTransfer
4389
4394
  })
4390
4395
  | PatchEvent
4396
+ | InternalPatchEvent
4391
4397
  | MutationEvent
4392
4398
  | PatchesEvent
4393
4399
  | {
@@ -4445,7 +4451,7 @@ declare const editorMachine: StateMachine<
4445
4451
  behaviors: Set<Behavior>
4446
4452
  converters: Set<Converter>
4447
4453
  keyGenerator: () => string
4448
- pendingEvents: Array<PatchEvent | MutationEvent>
4454
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
4449
4455
  schema: EditorSchema
4450
4456
  initialReadOnly: boolean
4451
4457
  maxBlocks: number | undefined
@@ -4679,7 +4685,7 @@ declare const editorMachine: StateMachine<
4679
4685
  } & {
4680
4686
  dataTransfer: DataTransfer
4681
4687
  })
4682
- | PatchEvent
4688
+ | InternalPatchEvent
4683
4689
  | MutationEvent
4684
4690
  | {
4685
4691
  type: 'normalizing'
@@ -5035,6 +5041,7 @@ declare const editorMachine: StateMachine<
5035
5041
  dataTransfer: DataTransfer
5036
5042
  })
5037
5043
  | PatchEvent
5044
+ | InternalPatchEvent
5038
5045
  | MutationEvent
5039
5046
  | PatchesEvent
5040
5047
  | {
@@ -5093,7 +5100,7 @@ declare const editorMachine: StateMachine<
5093
5100
  behaviors: Set<Behavior>
5094
5101
  converters: Set<Converter>
5095
5102
  keyGenerator: () => string
5096
- pendingEvents: Array<PatchEvent | MutationEvent>
5103
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5097
5104
  schema: EditorSchema
5098
5105
  initialReadOnly: boolean
5099
5106
  maxBlocks: number | undefined
@@ -5327,7 +5334,7 @@ declare const editorMachine: StateMachine<
5327
5334
  } & {
5328
5335
  dataTransfer: DataTransfer
5329
5336
  })
5330
- | PatchEvent
5337
+ | InternalPatchEvent
5331
5338
  | MutationEvent
5332
5339
  | {
5333
5340
  type: 'normalizing'
@@ -5466,7 +5473,7 @@ declare const editorMachine: StateMachine<
5466
5473
  behaviors: Set<Behavior>
5467
5474
  converters: Set<Converter>
5468
5475
  keyGenerator: () => string
5469
- pendingEvents: Array<PatchEvent | MutationEvent>
5476
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5470
5477
  schema: EditorSchema
5471
5478
  initialReadOnly: boolean
5472
5479
  maxBlocks: number | undefined
@@ -5700,7 +5707,7 @@ declare const editorMachine: StateMachine<
5700
5707
  } & {
5701
5708
  dataTransfer: DataTransfer
5702
5709
  })
5703
- | PatchEvent
5710
+ | InternalPatchEvent
5704
5711
  | MutationEvent
5705
5712
  | {
5706
5713
  type: 'normalizing'
@@ -6056,6 +6063,7 @@ declare const editorMachine: StateMachine<
6056
6063
  dataTransfer: DataTransfer
6057
6064
  })
6058
6065
  | PatchEvent
6066
+ | InternalPatchEvent
6059
6067
  | MutationEvent
6060
6068
  | PatchesEvent
6061
6069
  | {
@@ -6114,7 +6122,7 @@ declare const editorMachine: StateMachine<
6114
6122
  behaviors: Set<Behavior>
6115
6123
  converters: Set<Converter>
6116
6124
  keyGenerator: () => string
6117
- pendingEvents: Array<PatchEvent | MutationEvent>
6125
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6118
6126
  schema: EditorSchema
6119
6127
  initialReadOnly: boolean
6120
6128
  maxBlocks: number | undefined
@@ -6348,7 +6356,7 @@ declare const editorMachine: StateMachine<
6348
6356
  } & {
6349
6357
  dataTransfer: DataTransfer
6350
6358
  })
6351
- | PatchEvent
6359
+ | InternalPatchEvent
6352
6360
  | MutationEvent
6353
6361
  | {
6354
6362
  type: 'normalizing'
@@ -6704,6 +6712,7 @@ declare const editorMachine: StateMachine<
6704
6712
  dataTransfer: DataTransfer
6705
6713
  })
6706
6714
  | PatchEvent
6715
+ | InternalPatchEvent
6707
6716
  | MutationEvent
6708
6717
  | PatchesEvent
6709
6718
  | {
@@ -6761,7 +6770,7 @@ declare const editorMachine: StateMachine<
6761
6770
  behaviors: Set<Behavior>
6762
6771
  converters: Set<Converter>
6763
6772
  keyGenerator: () => string
6764
- pendingEvents: Array<PatchEvent | MutationEvent>
6773
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6765
6774
  schema: EditorSchema
6766
6775
  initialReadOnly: boolean
6767
6776
  maxBlocks: number | undefined
@@ -6994,7 +7003,7 @@ declare const editorMachine: StateMachine<
6994
7003
  } & {
6995
7004
  dataTransfer: DataTransfer
6996
7005
  })
6997
- | PatchEvent
7006
+ | InternalPatchEvent
6998
7007
  | MutationEvent
6999
7008
  | {
7000
7009
  type: 'normalizing'
@@ -7350,6 +7359,7 @@ declare const editorMachine: StateMachine<
7350
7359
  dataTransfer: DataTransfer
7351
7360
  })
7352
7361
  | PatchEvent
7362
+ | InternalPatchEvent
7353
7363
  | MutationEvent
7354
7364
  | PatchesEvent
7355
7365
  | {
@@ -7407,7 +7417,7 @@ declare const editorMachine: StateMachine<
7407
7417
  behaviors: Set<Behavior>
7408
7418
  converters: Set<Converter>
7409
7419
  keyGenerator: () => string
7410
- pendingEvents: Array<PatchEvent | MutationEvent>
7420
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
7411
7421
  schema: EditorSchema
7412
7422
  initialReadOnly: boolean
7413
7423
  maxBlocks: number | undefined
@@ -7641,7 +7651,7 @@ declare const editorMachine: StateMachine<
7641
7651
  } & {
7642
7652
  dataTransfer: DataTransfer
7643
7653
  })
7644
- | PatchEvent
7654
+ | InternalPatchEvent
7645
7655
  | MutationEvent
7646
7656
  | {
7647
7657
  type: 'normalizing'
@@ -7997,6 +8007,7 @@ declare const editorMachine: StateMachine<
7997
8007
  dataTransfer: DataTransfer
7998
8008
  })
7999
8009
  | PatchEvent
8010
+ | InternalPatchEvent
8000
8011
  | MutationEvent
8001
8012
  | PatchesEvent
8002
8013
  | {
@@ -8060,7 +8071,7 @@ declare const editorMachine: StateMachine<
8060
8071
  behaviors: Set<Behavior>
8061
8072
  converters: Set<Converter>
8062
8073
  keyGenerator: () => string
8063
- pendingEvents: Array<PatchEvent | MutationEvent>
8074
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8064
8075
  schema: EditorSchema
8065
8076
  initialReadOnly: boolean
8066
8077
  maxBlocks: number | undefined
@@ -8291,7 +8302,7 @@ declare const editorMachine: StateMachine<
8291
8302
  } & {
8292
8303
  dataTransfer: DataTransfer
8293
8304
  })
8294
- | PatchEvent
8305
+ | InternalPatchEvent
8295
8306
  | MutationEvent
8296
8307
  | {
8297
8308
  type: 'normalizing'
@@ -8647,6 +8658,7 @@ declare const editorMachine: StateMachine<
8647
8658
  dataTransfer: DataTransfer
8648
8659
  })
8649
8660
  | PatchEvent
8661
+ | InternalPatchEvent
8650
8662
  | MutationEvent
8651
8663
  | PatchesEvent
8652
8664
  | {
@@ -8707,7 +8719,7 @@ declare const editorMachine: StateMachine<
8707
8719
  behaviors: Set<Behavior>
8708
8720
  converters: Set<Converter>
8709
8721
  keyGenerator: () => string
8710
- pendingEvents: Array<PatchEvent | MutationEvent>
8722
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8711
8723
  schema: EditorSchema
8712
8724
  initialReadOnly: boolean
8713
8725
  maxBlocks: number | undefined
@@ -8941,7 +8953,7 @@ declare const editorMachine: StateMachine<
8941
8953
  } & {
8942
8954
  dataTransfer: DataTransfer
8943
8955
  })
8944
- | PatchEvent
8956
+ | InternalPatchEvent
8945
8957
  | MutationEvent
8946
8958
  | {
8947
8959
  type: 'normalizing'
@@ -9085,7 +9097,7 @@ declare const editorMachine: StateMachine<
9085
9097
  behaviors: Set<Behavior>
9086
9098
  converters: Set<Converter>
9087
9099
  keyGenerator: () => string
9088
- pendingEvents: Array<PatchEvent | MutationEvent>
9100
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9089
9101
  schema: EditorSchema
9090
9102
  initialReadOnly: boolean
9091
9103
  maxBlocks: number | undefined
@@ -9319,7 +9331,7 @@ declare const editorMachine: StateMachine<
9319
9331
  } & {
9320
9332
  dataTransfer: DataTransfer
9321
9333
  })
9322
- | PatchEvent
9334
+ | InternalPatchEvent
9323
9335
  | MutationEvent
9324
9336
  | {
9325
9337
  type: 'normalizing'
@@ -9460,7 +9472,7 @@ declare const editorMachine: StateMachine<
9460
9472
  behaviors: Set<Behavior>
9461
9473
  converters: Set<Converter>
9462
9474
  keyGenerator: () => string
9463
- pendingEvents: Array<PatchEvent | MutationEvent>
9475
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9464
9476
  schema: EditorSchema
9465
9477
  initialReadOnly: boolean
9466
9478
  maxBlocks: number | undefined
@@ -9694,7 +9706,7 @@ declare const editorMachine: StateMachine<
9694
9706
  } & {
9695
9707
  dataTransfer: DataTransfer
9696
9708
  })
9697
- | PatchEvent
9709
+ | InternalPatchEvent
9698
9710
  | MutationEvent
9699
9711
  | {
9700
9712
  type: 'normalizing'
@@ -9847,7 +9859,7 @@ declare const editorMachine: StateMachine<
9847
9859
  behaviors: Set<Behavior>
9848
9860
  converters: Set<Converter>
9849
9861
  keyGenerator: () => string
9850
- pendingEvents: Array<PatchEvent | MutationEvent>
9862
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9851
9863
  schema: EditorSchema
9852
9864
  initialReadOnly: boolean
9853
9865
  maxBlocks: number | undefined
@@ -9879,7 +9891,9 @@ declare const editorMachine: StateMachine<
9879
9891
  behaviors: Set<Behavior>
9880
9892
  converters: Set<Converter>
9881
9893
  keyGenerator: () => string
9882
- pendingEvents: Array<PatchEvent | MutationEvent>
9894
+ pendingEvents: Array<
9895
+ InternalPatchEvent | MutationEvent
9896
+ >
9883
9897
  schema: EditorSchema
9884
9898
  initialReadOnly: boolean
9885
9899
  maxBlocks: number | undefined
@@ -9907,7 +9921,7 @@ declare const editorMachine: StateMachine<
9907
9921
  behaviors: Set<Behavior>
9908
9922
  converters: Set<Converter>
9909
9923
  keyGenerator: () => string
9910
- pendingEvents: Array<PatchEvent | MutationEvent>
9924
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9911
9925
  schema: EditorSchema
9912
9926
  initialReadOnly: boolean
9913
9927
  maxBlocks: number | undefined
@@ -9936,7 +9950,7 @@ declare const editorMachine: StateMachine<
9936
9950
  behaviors: Set<Behavior>
9937
9951
  converters: Set<Converter>
9938
9952
  keyGenerator: () => string
9939
- pendingEvents: Array<PatchEvent | MutationEvent>
9953
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9940
9954
  schema: EditorSchema
9941
9955
  initialReadOnly: boolean
9942
9956
  maxBlocks: number | undefined
@@ -9963,7 +9977,7 @@ declare const editorMachine: StateMachine<
9963
9977
  behaviors: Set<Behavior>
9964
9978
  converters: Set<Converter>
9965
9979
  keyGenerator: () => string
9966
- pendingEvents: Array<PatchEvent | MutationEvent>
9980
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9967
9981
  schema: EditorSchema
9968
9982
  initialReadOnly: boolean
9969
9983
  maxBlocks: number | undefined
@@ -10217,7 +10231,7 @@ declare const editorMachine: StateMachine<
10217
10231
  } & {
10218
10232
  dataTransfer: DataTransfer
10219
10233
  })
10220
- | PatchEvent
10234
+ | InternalPatchEvent
10221
10235
  | MutationEvent
10222
10236
  | {
10223
10237
  type: 'normalizing'
@@ -10575,6 +10589,7 @@ declare const editorMachine: StateMachine<
10575
10589
  dataTransfer: DataTransfer
10576
10590
  })
10577
10591
  | PatchEvent
10592
+ | InternalPatchEvent
10578
10593
  | MutationEvent
10579
10594
  | PatchesEvent
10580
10595
  | {
@@ -10632,7 +10647,7 @@ declare const editorMachine: StateMachine<
10632
10647
  behaviors: Set<Behavior>
10633
10648
  converters: Set<Converter>
10634
10649
  keyGenerator: () => string
10635
- pendingEvents: Array<PatchEvent | MutationEvent>
10650
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
10636
10651
  schema: EditorSchema
10637
10652
  initialReadOnly: boolean
10638
10653
  maxBlocks: number | undefined
@@ -10872,7 +10887,7 @@ declare const editorMachine: StateMachine<
10872
10887
  } & {
10873
10888
  dataTransfer: DataTransfer
10874
10889
  })
10875
- | PatchEvent
10890
+ | InternalPatchEvent
10876
10891
  | MutationEvent
10877
10892
  | {
10878
10893
  type: 'normalizing'
@@ -11230,6 +11245,7 @@ declare const editorMachine: StateMachine<
11230
11245
  dataTransfer: DataTransfer
11231
11246
  })
11232
11247
  | PatchEvent
11248
+ | InternalPatchEvent
11233
11249
  | MutationEvent
11234
11250
  | PatchesEvent
11235
11251
  | {
@@ -11287,7 +11303,7 @@ declare const editorMachine: StateMachine<
11287
11303
  behaviors: Set<Behavior>
11288
11304
  converters: Set<Converter>
11289
11305
  keyGenerator: () => string
11290
- pendingEvents: Array<PatchEvent | MutationEvent>
11306
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11291
11307
  schema: EditorSchema
11292
11308
  initialReadOnly: boolean
11293
11309
  maxBlocks: number | undefined
@@ -11520,7 +11536,7 @@ declare const editorMachine: StateMachine<
11520
11536
  } & {
11521
11537
  dataTransfer: DataTransfer
11522
11538
  })
11523
- | PatchEvent
11539
+ | InternalPatchEvent
11524
11540
  | MutationEvent
11525
11541
  | {
11526
11542
  type: 'normalizing'
@@ -11878,6 +11894,7 @@ declare const editorMachine: StateMachine<
11878
11894
  dataTransfer: DataTransfer
11879
11895
  })
11880
11896
  | PatchEvent
11897
+ | InternalPatchEvent
11881
11898
  | MutationEvent
11882
11899
  | PatchesEvent
11883
11900
  | {
@@ -11935,7 +11952,7 @@ declare const editorMachine: StateMachine<
11935
11952
  behaviors: Set<Behavior>
11936
11953
  converters: Set<Converter>
11937
11954
  keyGenerator: () => string
11938
- pendingEvents: Array<PatchEvent | MutationEvent>
11955
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11939
11956
  schema: EditorSchema
11940
11957
  initialReadOnly: boolean
11941
11958
  maxBlocks: number | undefined
@@ -12168,7 +12185,7 @@ declare const editorMachine: StateMachine<
12168
12185
  } & {
12169
12186
  dataTransfer: DataTransfer
12170
12187
  })
12171
- | PatchEvent
12188
+ | InternalPatchEvent
12172
12189
  | MutationEvent
12173
12190
  | {
12174
12191
  type: 'normalizing'
@@ -12526,6 +12543,7 @@ declare const editorMachine: StateMachine<
12526
12543
  dataTransfer: DataTransfer
12527
12544
  })
12528
12545
  | PatchEvent
12546
+ | InternalPatchEvent
12529
12547
  | MutationEvent
12530
12548
  | PatchesEvent
12531
12549
  | {
@@ -12583,7 +12601,7 @@ declare const editorMachine: StateMachine<
12583
12601
  behaviors: Set<Behavior>
12584
12602
  converters: Set<Converter>
12585
12603
  keyGenerator: () => string
12586
- pendingEvents: Array<PatchEvent | MutationEvent>
12604
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
12587
12605
  schema: EditorSchema
12588
12606
  initialReadOnly: boolean
12589
12607
  maxBlocks: number | undefined
@@ -12829,7 +12847,7 @@ declare const editorMachine: StateMachine<
12829
12847
  } & {
12830
12848
  dataTransfer: DataTransfer
12831
12849
  })
12832
- | PatchEvent
12850
+ | InternalPatchEvent
12833
12851
  | MutationEvent
12834
12852
  | {
12835
12853
  type: 'normalizing'
@@ -13187,6 +13205,7 @@ declare const editorMachine: StateMachine<
13187
13205
  dataTransfer: DataTransfer
13188
13206
  })
13189
13207
  | PatchEvent
13208
+ | InternalPatchEvent
13190
13209
  | MutationEvent
13191
13210
  | PatchesEvent
13192
13211
  | {
@@ -13244,7 +13263,7 @@ declare const editorMachine: StateMachine<
13244
13263
  behaviors: Set<Behavior>
13245
13264
  converters: Set<Converter>
13246
13265
  keyGenerator: () => string
13247
- pendingEvents: Array<PatchEvent | MutationEvent>
13266
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13248
13267
  schema: EditorSchema
13249
13268
  initialReadOnly: boolean
13250
13269
  maxBlocks: number | undefined
@@ -13491,7 +13510,7 @@ declare const editorMachine: StateMachine<
13491
13510
  } & {
13492
13511
  dataTransfer: DataTransfer
13493
13512
  })
13494
- | PatchEvent
13513
+ | InternalPatchEvent
13495
13514
  | MutationEvent
13496
13515
  | {
13497
13516
  type: 'normalizing'
@@ -13849,6 +13868,7 @@ declare const editorMachine: StateMachine<
13849
13868
  dataTransfer: DataTransfer
13850
13869
  })
13851
13870
  | PatchEvent
13871
+ | InternalPatchEvent
13852
13872
  | MutationEvent
13853
13873
  | PatchesEvent
13854
13874
  | {
@@ -13906,7 +13926,7 @@ declare const editorMachine: StateMachine<
13906
13926
  behaviors: Set<Behavior>
13907
13927
  converters: Set<Converter>
13908
13928
  keyGenerator: () => string
13909
- pendingEvents: Array<PatchEvent | MutationEvent>
13929
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13910
13930
  schema: EditorSchema
13911
13931
  initialReadOnly: boolean
13912
13932
  maxBlocks: number | undefined
@@ -14139,7 +14159,7 @@ declare const editorMachine: StateMachine<
14139
14159
  } & {
14140
14160
  dataTransfer: DataTransfer
14141
14161
  })
14142
- | PatchEvent
14162
+ | InternalPatchEvent
14143
14163
  | MutationEvent
14144
14164
  | {
14145
14165
  type: 'normalizing'
@@ -14497,6 +14517,7 @@ declare const editorMachine: StateMachine<
14497
14517
  dataTransfer: DataTransfer
14498
14518
  })
14499
14519
  | PatchEvent
14520
+ | InternalPatchEvent
14500
14521
  | MutationEvent
14501
14522
  | PatchesEvent
14502
14523
  | {
@@ -14554,7 +14575,7 @@ declare const editorMachine: StateMachine<
14554
14575
  behaviors: Set<Behavior>
14555
14576
  converters: Set<Converter>
14556
14577
  keyGenerator: () => string
14557
- pendingEvents: Array<PatchEvent | MutationEvent>
14578
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
14558
14579
  schema: EditorSchema
14559
14580
  initialReadOnly: boolean
14560
14581
  maxBlocks: number | undefined
@@ -14790,7 +14811,7 @@ declare const editorMachine: StateMachine<
14790
14811
  } & {
14791
14812
  dataTransfer: DataTransfer
14792
14813
  })
14793
- | PatchEvent
14814
+ | InternalPatchEvent
14794
14815
  | MutationEvent
14795
14816
  | {
14796
14817
  type: 'normalizing'
@@ -15148,6 +15169,7 @@ declare const editorMachine: StateMachine<
15148
15169
  dataTransfer: DataTransfer
15149
15170
  })
15150
15171
  | PatchEvent
15172
+ | InternalPatchEvent
15151
15173
  | MutationEvent
15152
15174
  | PatchesEvent
15153
15175
  | {
@@ -15205,7 +15227,7 @@ declare const editorMachine: StateMachine<
15205
15227
  behaviors: Set<Behavior>
15206
15228
  converters: Set<Converter>
15207
15229
  keyGenerator: () => string
15208
- pendingEvents: Array<PatchEvent | MutationEvent>
15230
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15209
15231
  schema: EditorSchema
15210
15232
  initialReadOnly: boolean
15211
15233
  maxBlocks: number | undefined
@@ -15492,7 +15514,7 @@ declare const editorMachine: StateMachine<
15492
15514
  } & {
15493
15515
  dataTransfer: DataTransfer
15494
15516
  })
15495
- | PatchEvent
15517
+ | InternalPatchEvent
15496
15518
  | MutationEvent
15497
15519
  | {
15498
15520
  type: 'normalizing'
@@ -15850,6 +15872,7 @@ declare const editorMachine: StateMachine<
15850
15872
  dataTransfer: DataTransfer
15851
15873
  })
15852
15874
  | PatchEvent
15875
+ | InternalPatchEvent
15853
15876
  | MutationEvent
15854
15877
  | PatchesEvent
15855
15878
  | {
@@ -15907,7 +15930,7 @@ declare const editorMachine: StateMachine<
15907
15930
  behaviors: Set<Behavior>
15908
15931
  converters: Set<Converter>
15909
15932
  keyGenerator: () => string
15910
- pendingEvents: Array<PatchEvent | MutationEvent>
15933
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15911
15934
  schema: EditorSchema
15912
15935
  initialReadOnly: boolean
15913
15936
  maxBlocks: number | undefined
@@ -16149,7 +16172,7 @@ declare const editorMachine: StateMachine<
16149
16172
  } & {
16150
16173
  dataTransfer: DataTransfer
16151
16174
  })
16152
- | PatchEvent
16175
+ | InternalPatchEvent
16153
16176
  | MutationEvent
16154
16177
  | {
16155
16178
  type: 'normalizing'
@@ -16507,6 +16530,7 @@ declare const editorMachine: StateMachine<
16507
16530
  dataTransfer: DataTransfer
16508
16531
  })
16509
16532
  | PatchEvent
16533
+ | InternalPatchEvent
16510
16534
  | MutationEvent
16511
16535
  | PatchesEvent
16512
16536
  | {
@@ -16564,7 +16588,7 @@ declare const editorMachine: StateMachine<
16564
16588
  behaviors: Set<Behavior>
16565
16589
  converters: Set<Converter>
16566
16590
  keyGenerator: () => string
16567
- pendingEvents: Array<PatchEvent | MutationEvent>
16591
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
16568
16592
  schema: EditorSchema
16569
16593
  initialReadOnly: boolean
16570
16594
  maxBlocks: number | undefined
@@ -16807,7 +16831,7 @@ declare const editorMachine: StateMachine<
16807
16831
  } & {
16808
16832
  dataTransfer: DataTransfer
16809
16833
  })
16810
- | PatchEvent
16834
+ | InternalPatchEvent
16811
16835
  | MutationEvent
16812
16836
  | {
16813
16837
  type: 'normalizing'
@@ -17165,6 +17189,7 @@ declare const editorMachine: StateMachine<
17165
17189
  dataTransfer: DataTransfer
17166
17190
  })
17167
17191
  | PatchEvent
17192
+ | InternalPatchEvent
17168
17193
  | MutationEvent
17169
17194
  | PatchesEvent
17170
17195
  | {
@@ -17222,7 +17247,7 @@ declare const editorMachine: StateMachine<
17222
17247
  behaviors: Set<Behavior>
17223
17248
  converters: Set<Converter>
17224
17249
  keyGenerator: () => string
17225
- pendingEvents: Array<PatchEvent | MutationEvent>
17250
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17226
17251
  schema: EditorSchema
17227
17252
  initialReadOnly: boolean
17228
17253
  maxBlocks: number | undefined
@@ -17456,7 +17481,7 @@ declare const editorMachine: StateMachine<
17456
17481
  } & {
17457
17482
  dataTransfer: DataTransfer
17458
17483
  })
17459
- | PatchEvent
17484
+ | InternalPatchEvent
17460
17485
  | MutationEvent
17461
17486
  | {
17462
17487
  type: 'normalizing'
@@ -17814,6 +17839,7 @@ declare const editorMachine: StateMachine<
17814
17839
  dataTransfer: DataTransfer
17815
17840
  })
17816
17841
  | PatchEvent
17842
+ | InternalPatchEvent
17817
17843
  | MutationEvent
17818
17844
  | PatchesEvent
17819
17845
  | {
@@ -17871,7 +17897,7 @@ declare const editorMachine: StateMachine<
17871
17897
  behaviors: Set<Behavior>
17872
17898
  converters: Set<Converter>
17873
17899
  keyGenerator: () => string
17874
- pendingEvents: Array<PatchEvent | MutationEvent>
17900
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17875
17901
  schema: EditorSchema
17876
17902
  initialReadOnly: boolean
17877
17903
  maxBlocks: number | undefined
@@ -18107,7 +18133,7 @@ declare const editorMachine: StateMachine<
18107
18133
  } & {
18108
18134
  dataTransfer: DataTransfer
18109
18135
  })
18110
- | PatchEvent
18136
+ | InternalPatchEvent
18111
18137
  | MutationEvent
18112
18138
  | {
18113
18139
  type: 'normalizing'
@@ -18465,6 +18491,7 @@ declare const editorMachine: StateMachine<
18465
18491
  dataTransfer: DataTransfer
18466
18492
  })
18467
18493
  | PatchEvent
18494
+ | InternalPatchEvent
18468
18495
  | MutationEvent
18469
18496
  | PatchesEvent
18470
18497
  | {
@@ -18522,7 +18549,7 @@ declare const editorMachine: StateMachine<
18522
18549
  behaviors: Set<Behavior>
18523
18550
  converters: Set<Converter>
18524
18551
  keyGenerator: () => string
18525
- pendingEvents: Array<PatchEvent | MutationEvent>
18552
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
18526
18553
  schema: EditorSchema
18527
18554
  initialReadOnly: boolean
18528
18555
  maxBlocks: number | undefined
@@ -18764,7 +18791,7 @@ declare const editorMachine: StateMachine<
18764
18791
  } & {
18765
18792
  dataTransfer: DataTransfer
18766
18793
  })
18767
- | PatchEvent
18794
+ | InternalPatchEvent
18768
18795
  | MutationEvent
18769
18796
  | {
18770
18797
  type: 'normalizing'
@@ -19122,6 +19149,7 @@ declare const editorMachine: StateMachine<
19122
19149
  dataTransfer: DataTransfer
19123
19150
  })
19124
19151
  | PatchEvent
19152
+ | InternalPatchEvent
19125
19153
  | MutationEvent
19126
19154
  | PatchesEvent
19127
19155
  | {
@@ -19217,7 +19245,7 @@ declare const editorMachine: StateMachine<
19217
19245
  readonly 'setting up': {
19218
19246
  readonly exit: readonly ['emit ready']
19219
19247
  readonly on: {
19220
- readonly 'patch': {
19248
+ readonly 'internal.patch': {
19221
19249
  readonly actions: 'defer event'
19222
19250
  }
19223
19251
  readonly 'mutation': {
@@ -19233,14 +19261,14 @@ declare const editorMachine: StateMachine<
19233
19261
  readonly states: {
19234
19262
  readonly idle: {
19235
19263
  readonly on: {
19236
- readonly normalizing: {
19264
+ readonly 'normalizing': {
19237
19265
  readonly target: 'normalizing'
19238
19266
  }
19239
- readonly patch: {
19267
+ readonly 'internal.patch': {
19240
19268
  readonly actions: 'defer event'
19241
19269
  readonly target: '#editor.setup.dirty'
19242
19270
  }
19243
- readonly mutation: {
19271
+ readonly 'mutation': {
19244
19272
  readonly actions: 'defer event'
19245
19273
  readonly target: '#editor.setup.dirty'
19246
19274
  }
@@ -19251,7 +19279,7 @@ declare const editorMachine: StateMachine<
19251
19279
  readonly 'done normalizing': {
19252
19280
  readonly target: 'idle'
19253
19281
  }
19254
- readonly 'patch': {
19282
+ readonly 'internal.patch': {
19255
19283
  readonly actions: 'defer event'
19256
19284
  }
19257
19285
  readonly 'mutation': {
@@ -19267,10 +19295,10 @@ declare const editorMachine: StateMachine<
19267
19295
  'clear pending events',
19268
19296
  ]
19269
19297
  readonly on: {
19270
- readonly patch: {
19298
+ readonly 'internal.patch': {
19271
19299
  readonly actions: 'emit patch event'
19272
19300
  }
19273
- readonly mutation: {
19301
+ readonly 'mutation': {
19274
19302
  readonly actions: 'emit mutation event'
19275
19303
  }
19276
19304
  }
@@ -19354,6 +19382,11 @@ declare type HistoryItem = {
19354
19382
  timestamp: Date
19355
19383
  }
19356
19384
 
19385
+ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
19386
+ actionId?: string
19387
+ value: Array<PortableTextBlock>
19388
+ }
19389
+
19357
19390
  /**
19358
19391
  * The editor has invalid data in the value that can be resolved by the user
19359
19392
  * @beta */
@@ -19441,6 +19474,19 @@ declare type MutationEvent = {
19441
19474
  value: Array<PortableTextBlock> | undefined
19442
19475
  }
19443
19476
 
19477
+ declare type NamespaceEvent<
19478
+ TEvent,
19479
+ TNamespace extends string,
19480
+ > = TEvent extends {
19481
+ type: infer TEventType
19482
+ }
19483
+ ? {
19484
+ [K in keyof TEvent]: K extends 'type'
19485
+ ? `${TNamespace}.${TEventType & string}`
19486
+ : TEvent[K]
19487
+ }
19488
+ : never
19489
+
19444
19490
  /**
19445
19491
  * @beta
19446
19492
  */