@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
@@ -58,11 +58,9 @@ import {MIMEType as MIMEType_2} from '../internal-utils/mime-type'
58
58
  declare type Behavior<
59
59
  TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
60
60
  TGuardResponse = true,
61
- TBehaviorEvent extends BehaviorEvent = PickFromUnion<
62
- BehaviorEvent,
63
- 'type',
64
- TBehaviorEventType
65
- >,
61
+ TBehaviorEvent extends BehaviorEvent = TBehaviorEventType extends '*'
62
+ ? BehaviorEvent
63
+ : PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
66
64
  > = {
67
65
  /**
68
66
  * The internal editor event that triggers this behavior.
@@ -120,6 +118,9 @@ declare type BehaviorEvent =
120
118
  | SyntheticBehaviorEvent
121
119
  | NativeBehaviorEvent
122
120
  | CustomBehaviorEvent
121
+ | {
122
+ type: '*'
123
+ }
123
124
 
124
125
  /**
125
126
  * @beta
@@ -198,6 +199,17 @@ declare type CustomBehaviorEvent<
198
199
  type: TInternalType
199
200
  } & TPayload
200
201
 
202
+ /**
203
+ * @beta
204
+ */
205
+ export declare function DecoratorShortcutPlugin(config: {
206
+ decorator: ({schema}: {schema: EditorSchema}) => string | undefined
207
+ pair: {
208
+ char: string
209
+ amount: number
210
+ }
211
+ }): null
212
+
201
213
  declare type Deserializer<TMIMEType extends MIMEType> = ({
202
214
  snapshot,
203
215
  event,
@@ -399,7 +411,7 @@ declare const editorMachine: StateMachine<
399
411
  behaviors: Set<Behavior>
400
412
  converters: Set<Converter>
401
413
  keyGenerator: () => string
402
- pendingEvents: Array<PatchEvent | MutationEvent>
414
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
403
415
  schema: EditorSchema
404
416
  initialReadOnly: boolean
405
417
  maxBlocks: number | undefined
@@ -629,7 +641,7 @@ declare const editorMachine: StateMachine<
629
641
  } & {
630
642
  dataTransfer: DataTransfer
631
643
  })
632
- | PatchEvent
644
+ | InternalPatchEvent
633
645
  | MutationEvent
634
646
  | {
635
647
  type: 'normalizing'
@@ -1064,6 +1076,7 @@ declare const editorMachine: StateMachine<
1064
1076
  dataTransfer: DataTransfer
1065
1077
  })
1066
1078
  | PatchEvent
1079
+ | InternalPatchEvent
1067
1080
  | MutationEvent
1068
1081
  | PatchesEvent
1069
1082
  | {
@@ -1156,7 +1169,7 @@ declare const editorMachine: StateMachine<
1156
1169
  behaviors: Set<Behavior>
1157
1170
  converters: Set<Converter>
1158
1171
  keyGenerator: () => string
1159
- pendingEvents: Array<PatchEvent | MutationEvent>
1172
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1160
1173
  schema: EditorSchema
1161
1174
  initialReadOnly: boolean
1162
1175
  maxBlocks: number | undefined
@@ -1386,7 +1399,7 @@ declare const editorMachine: StateMachine<
1386
1399
  } & {
1387
1400
  dataTransfer: DataTransfer
1388
1401
  })
1389
- | PatchEvent
1402
+ | InternalPatchEvent
1390
1403
  | MutationEvent
1391
1404
  | {
1392
1405
  type: 'normalizing'
@@ -1743,7 +1756,7 @@ declare const editorMachine: StateMachine<
1743
1756
  } & {
1744
1757
  dataTransfer: DataTransfer
1745
1758
  })
1746
- | PatchEvent
1759
+ | InternalPatchEvent
1747
1760
  | MutationEvent
1748
1761
  | {
1749
1762
  type: 'normalizing'
@@ -1890,7 +1903,7 @@ declare const editorMachine: StateMachine<
1890
1903
  behaviors: Set<Behavior>
1891
1904
  converters: Set<Converter>
1892
1905
  keyGenerator: () => string
1893
- pendingEvents: Array<PatchEvent | MutationEvent>
1906
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1894
1907
  schema: EditorSchema
1895
1908
  initialReadOnly: boolean
1896
1909
  maxBlocks: number | undefined
@@ -2124,7 +2137,7 @@ declare const editorMachine: StateMachine<
2124
2137
  } & {
2125
2138
  dataTransfer: DataTransfer
2126
2139
  })
2127
- | PatchEvent
2140
+ | InternalPatchEvent
2128
2141
  | MutationEvent
2129
2142
  | {
2130
2143
  type: 'normalizing'
@@ -2480,6 +2493,7 @@ declare const editorMachine: StateMachine<
2480
2493
  dataTransfer: DataTransfer
2481
2494
  })
2482
2495
  | PatchEvent
2496
+ | InternalPatchEvent
2483
2497
  | MutationEvent
2484
2498
  | PatchesEvent
2485
2499
  | {
@@ -2537,7 +2551,7 @@ declare const editorMachine: StateMachine<
2537
2551
  behaviors: Set<Behavior>
2538
2552
  converters: Set<Converter>
2539
2553
  keyGenerator: () => string
2540
- pendingEvents: Array<PatchEvent | MutationEvent>
2554
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
2541
2555
  schema: EditorSchema
2542
2556
  initialReadOnly: boolean
2543
2557
  maxBlocks: number | undefined
@@ -2770,7 +2784,7 @@ declare const editorMachine: StateMachine<
2770
2784
  } & {
2771
2785
  dataTransfer: DataTransfer
2772
2786
  })
2773
- | PatchEvent
2787
+ | InternalPatchEvent
2774
2788
  | MutationEvent
2775
2789
  | {
2776
2790
  type: 'normalizing'
@@ -3126,6 +3140,7 @@ declare const editorMachine: StateMachine<
3126
3140
  dataTransfer: DataTransfer
3127
3141
  })
3128
3142
  | PatchEvent
3143
+ | InternalPatchEvent
3129
3144
  | MutationEvent
3130
3145
  | PatchesEvent
3131
3146
  | {
@@ -3183,7 +3198,7 @@ declare const editorMachine: StateMachine<
3183
3198
  behaviors: Set<Behavior>
3184
3199
  converters: Set<Converter>
3185
3200
  keyGenerator: () => string
3186
- pendingEvents: Array<PatchEvent | MutationEvent>
3201
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3187
3202
  schema: EditorSchema
3188
3203
  initialReadOnly: boolean
3189
3204
  maxBlocks: number | undefined
@@ -3419,7 +3434,7 @@ declare const editorMachine: StateMachine<
3419
3434
  } & {
3420
3435
  dataTransfer: DataTransfer
3421
3436
  })
3422
- | PatchEvent
3437
+ | InternalPatchEvent
3423
3438
  | MutationEvent
3424
3439
  | {
3425
3440
  type: 'normalizing'
@@ -3775,6 +3790,7 @@ declare const editorMachine: StateMachine<
3775
3790
  dataTransfer: DataTransfer
3776
3791
  })
3777
3792
  | PatchEvent
3793
+ | InternalPatchEvent
3778
3794
  | MutationEvent
3779
3795
  | PatchesEvent
3780
3796
  | {
@@ -3832,7 +3848,7 @@ declare const editorMachine: StateMachine<
3832
3848
  behaviors: Set<Behavior>
3833
3849
  converters: Set<Converter>
3834
3850
  keyGenerator: () => string
3835
- pendingEvents: Array<PatchEvent | MutationEvent>
3851
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3836
3852
  schema: EditorSchema
3837
3853
  initialReadOnly: boolean
3838
3854
  maxBlocks: number | undefined
@@ -4067,7 +4083,7 @@ declare const editorMachine: StateMachine<
4067
4083
  } & {
4068
4084
  dataTransfer: DataTransfer
4069
4085
  })
4070
- | PatchEvent
4086
+ | InternalPatchEvent
4071
4087
  | MutationEvent
4072
4088
  | {
4073
4089
  type: 'normalizing'
@@ -4423,6 +4439,7 @@ declare const editorMachine: StateMachine<
4423
4439
  dataTransfer: DataTransfer
4424
4440
  })
4425
4441
  | PatchEvent
4442
+ | InternalPatchEvent
4426
4443
  | MutationEvent
4427
4444
  | PatchesEvent
4428
4445
  | {
@@ -4480,7 +4497,7 @@ declare const editorMachine: StateMachine<
4480
4497
  behaviors: Set<Behavior>
4481
4498
  converters: Set<Converter>
4482
4499
  keyGenerator: () => string
4483
- pendingEvents: Array<PatchEvent | MutationEvent>
4500
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
4484
4501
  schema: EditorSchema
4485
4502
  initialReadOnly: boolean
4486
4503
  maxBlocks: number | undefined
@@ -4714,7 +4731,7 @@ declare const editorMachine: StateMachine<
4714
4731
  } & {
4715
4732
  dataTransfer: DataTransfer
4716
4733
  })
4717
- | PatchEvent
4734
+ | InternalPatchEvent
4718
4735
  | MutationEvent
4719
4736
  | {
4720
4737
  type: 'normalizing'
@@ -5070,6 +5087,7 @@ declare const editorMachine: StateMachine<
5070
5087
  dataTransfer: DataTransfer
5071
5088
  })
5072
5089
  | PatchEvent
5090
+ | InternalPatchEvent
5073
5091
  | MutationEvent
5074
5092
  | PatchesEvent
5075
5093
  | {
@@ -5128,7 +5146,7 @@ declare const editorMachine: StateMachine<
5128
5146
  behaviors: Set<Behavior>
5129
5147
  converters: Set<Converter>
5130
5148
  keyGenerator: () => string
5131
- pendingEvents: Array<PatchEvent | MutationEvent>
5149
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5132
5150
  schema: EditorSchema
5133
5151
  initialReadOnly: boolean
5134
5152
  maxBlocks: number | undefined
@@ -5362,7 +5380,7 @@ declare const editorMachine: StateMachine<
5362
5380
  } & {
5363
5381
  dataTransfer: DataTransfer
5364
5382
  })
5365
- | PatchEvent
5383
+ | InternalPatchEvent
5366
5384
  | MutationEvent
5367
5385
  | {
5368
5386
  type: 'normalizing'
@@ -5501,7 +5519,7 @@ declare const editorMachine: StateMachine<
5501
5519
  behaviors: Set<Behavior>
5502
5520
  converters: Set<Converter>
5503
5521
  keyGenerator: () => string
5504
- pendingEvents: Array<PatchEvent | MutationEvent>
5522
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
5505
5523
  schema: EditorSchema
5506
5524
  initialReadOnly: boolean
5507
5525
  maxBlocks: number | undefined
@@ -5735,7 +5753,7 @@ declare const editorMachine: StateMachine<
5735
5753
  } & {
5736
5754
  dataTransfer: DataTransfer
5737
5755
  })
5738
- | PatchEvent
5756
+ | InternalPatchEvent
5739
5757
  | MutationEvent
5740
5758
  | {
5741
5759
  type: 'normalizing'
@@ -6091,6 +6109,7 @@ declare const editorMachine: StateMachine<
6091
6109
  dataTransfer: DataTransfer
6092
6110
  })
6093
6111
  | PatchEvent
6112
+ | InternalPatchEvent
6094
6113
  | MutationEvent
6095
6114
  | PatchesEvent
6096
6115
  | {
@@ -6149,7 +6168,7 @@ declare const editorMachine: StateMachine<
6149
6168
  behaviors: Set<Behavior>
6150
6169
  converters: Set<Converter>
6151
6170
  keyGenerator: () => string
6152
- pendingEvents: Array<PatchEvent | MutationEvent>
6171
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6153
6172
  schema: EditorSchema
6154
6173
  initialReadOnly: boolean
6155
6174
  maxBlocks: number | undefined
@@ -6383,7 +6402,7 @@ declare const editorMachine: StateMachine<
6383
6402
  } & {
6384
6403
  dataTransfer: DataTransfer
6385
6404
  })
6386
- | PatchEvent
6405
+ | InternalPatchEvent
6387
6406
  | MutationEvent
6388
6407
  | {
6389
6408
  type: 'normalizing'
@@ -6739,6 +6758,7 @@ declare const editorMachine: StateMachine<
6739
6758
  dataTransfer: DataTransfer
6740
6759
  })
6741
6760
  | PatchEvent
6761
+ | InternalPatchEvent
6742
6762
  | MutationEvent
6743
6763
  | PatchesEvent
6744
6764
  | {
@@ -6796,7 +6816,7 @@ declare const editorMachine: StateMachine<
6796
6816
  behaviors: Set<Behavior>
6797
6817
  converters: Set<Converter>
6798
6818
  keyGenerator: () => string
6799
- pendingEvents: Array<PatchEvent | MutationEvent>
6819
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
6800
6820
  schema: EditorSchema
6801
6821
  initialReadOnly: boolean
6802
6822
  maxBlocks: number | undefined
@@ -7029,7 +7049,7 @@ declare const editorMachine: StateMachine<
7029
7049
  } & {
7030
7050
  dataTransfer: DataTransfer
7031
7051
  })
7032
- | PatchEvent
7052
+ | InternalPatchEvent
7033
7053
  | MutationEvent
7034
7054
  | {
7035
7055
  type: 'normalizing'
@@ -7385,6 +7405,7 @@ declare const editorMachine: StateMachine<
7385
7405
  dataTransfer: DataTransfer
7386
7406
  })
7387
7407
  | PatchEvent
7408
+ | InternalPatchEvent
7388
7409
  | MutationEvent
7389
7410
  | PatchesEvent
7390
7411
  | {
@@ -7442,7 +7463,7 @@ declare const editorMachine: StateMachine<
7442
7463
  behaviors: Set<Behavior>
7443
7464
  converters: Set<Converter>
7444
7465
  keyGenerator: () => string
7445
- pendingEvents: Array<PatchEvent | MutationEvent>
7466
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
7446
7467
  schema: EditorSchema
7447
7468
  initialReadOnly: boolean
7448
7469
  maxBlocks: number | undefined
@@ -7676,7 +7697,7 @@ declare const editorMachine: StateMachine<
7676
7697
  } & {
7677
7698
  dataTransfer: DataTransfer
7678
7699
  })
7679
- | PatchEvent
7700
+ | InternalPatchEvent
7680
7701
  | MutationEvent
7681
7702
  | {
7682
7703
  type: 'normalizing'
@@ -8032,6 +8053,7 @@ declare const editorMachine: StateMachine<
8032
8053
  dataTransfer: DataTransfer
8033
8054
  })
8034
8055
  | PatchEvent
8056
+ | InternalPatchEvent
8035
8057
  | MutationEvent
8036
8058
  | PatchesEvent
8037
8059
  | {
@@ -8095,7 +8117,7 @@ declare const editorMachine: StateMachine<
8095
8117
  behaviors: Set<Behavior>
8096
8118
  converters: Set<Converter>
8097
8119
  keyGenerator: () => string
8098
- pendingEvents: Array<PatchEvent | MutationEvent>
8120
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8099
8121
  schema: EditorSchema
8100
8122
  initialReadOnly: boolean
8101
8123
  maxBlocks: number | undefined
@@ -8326,7 +8348,7 @@ declare const editorMachine: StateMachine<
8326
8348
  } & {
8327
8349
  dataTransfer: DataTransfer
8328
8350
  })
8329
- | PatchEvent
8351
+ | InternalPatchEvent
8330
8352
  | MutationEvent
8331
8353
  | {
8332
8354
  type: 'normalizing'
@@ -8682,6 +8704,7 @@ declare const editorMachine: StateMachine<
8682
8704
  dataTransfer: DataTransfer
8683
8705
  })
8684
8706
  | PatchEvent
8707
+ | InternalPatchEvent
8685
8708
  | MutationEvent
8686
8709
  | PatchesEvent
8687
8710
  | {
@@ -8742,7 +8765,7 @@ declare const editorMachine: StateMachine<
8742
8765
  behaviors: Set<Behavior>
8743
8766
  converters: Set<Converter>
8744
8767
  keyGenerator: () => string
8745
- pendingEvents: Array<PatchEvent | MutationEvent>
8768
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
8746
8769
  schema: EditorSchema
8747
8770
  initialReadOnly: boolean
8748
8771
  maxBlocks: number | undefined
@@ -8976,7 +8999,7 @@ declare const editorMachine: StateMachine<
8976
8999
  } & {
8977
9000
  dataTransfer: DataTransfer
8978
9001
  })
8979
- | PatchEvent
9002
+ | InternalPatchEvent
8980
9003
  | MutationEvent
8981
9004
  | {
8982
9005
  type: 'normalizing'
@@ -9120,7 +9143,7 @@ declare const editorMachine: StateMachine<
9120
9143
  behaviors: Set<Behavior>
9121
9144
  converters: Set<Converter>
9122
9145
  keyGenerator: () => string
9123
- pendingEvents: Array<PatchEvent | MutationEvent>
9146
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9124
9147
  schema: EditorSchema
9125
9148
  initialReadOnly: boolean
9126
9149
  maxBlocks: number | undefined
@@ -9354,7 +9377,7 @@ declare const editorMachine: StateMachine<
9354
9377
  } & {
9355
9378
  dataTransfer: DataTransfer
9356
9379
  })
9357
- | PatchEvent
9380
+ | InternalPatchEvent
9358
9381
  | MutationEvent
9359
9382
  | {
9360
9383
  type: 'normalizing'
@@ -9495,7 +9518,7 @@ declare const editorMachine: StateMachine<
9495
9518
  behaviors: Set<Behavior>
9496
9519
  converters: Set<Converter>
9497
9520
  keyGenerator: () => string
9498
- pendingEvents: Array<PatchEvent | MutationEvent>
9521
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9499
9522
  schema: EditorSchema
9500
9523
  initialReadOnly: boolean
9501
9524
  maxBlocks: number | undefined
@@ -9729,7 +9752,7 @@ declare const editorMachine: StateMachine<
9729
9752
  } & {
9730
9753
  dataTransfer: DataTransfer
9731
9754
  })
9732
- | PatchEvent
9755
+ | InternalPatchEvent
9733
9756
  | MutationEvent
9734
9757
  | {
9735
9758
  type: 'normalizing'
@@ -9882,7 +9905,7 @@ declare const editorMachine: StateMachine<
9882
9905
  behaviors: Set<Behavior>
9883
9906
  converters: Set<Converter>
9884
9907
  keyGenerator: () => string
9885
- pendingEvents: Array<PatchEvent | MutationEvent>
9908
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9886
9909
  schema: EditorSchema
9887
9910
  initialReadOnly: boolean
9888
9911
  maxBlocks: number | undefined
@@ -9914,7 +9937,9 @@ declare const editorMachine: StateMachine<
9914
9937
  behaviors: Set<Behavior>
9915
9938
  converters: Set<Converter>
9916
9939
  keyGenerator: () => string
9917
- pendingEvents: Array<PatchEvent | MutationEvent>
9940
+ pendingEvents: Array<
9941
+ InternalPatchEvent | MutationEvent
9942
+ >
9918
9943
  schema: EditorSchema
9919
9944
  initialReadOnly: boolean
9920
9945
  maxBlocks: number | undefined
@@ -9942,7 +9967,7 @@ declare const editorMachine: StateMachine<
9942
9967
  behaviors: Set<Behavior>
9943
9968
  converters: Set<Converter>
9944
9969
  keyGenerator: () => string
9945
- pendingEvents: Array<PatchEvent | MutationEvent>
9970
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9946
9971
  schema: EditorSchema
9947
9972
  initialReadOnly: boolean
9948
9973
  maxBlocks: number | undefined
@@ -9971,7 +9996,7 @@ declare const editorMachine: StateMachine<
9971
9996
  behaviors: Set<Behavior>
9972
9997
  converters: Set<Converter>
9973
9998
  keyGenerator: () => string
9974
- pendingEvents: Array<PatchEvent | MutationEvent>
9999
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
9975
10000
  schema: EditorSchema
9976
10001
  initialReadOnly: boolean
9977
10002
  maxBlocks: number | undefined
@@ -9998,7 +10023,7 @@ declare const editorMachine: StateMachine<
9998
10023
  behaviors: Set<Behavior>
9999
10024
  converters: Set<Converter>
10000
10025
  keyGenerator: () => string
10001
- pendingEvents: Array<PatchEvent | MutationEvent>
10026
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
10002
10027
  schema: EditorSchema
10003
10028
  initialReadOnly: boolean
10004
10029
  maxBlocks: number | undefined
@@ -10252,7 +10277,7 @@ declare const editorMachine: StateMachine<
10252
10277
  } & {
10253
10278
  dataTransfer: DataTransfer
10254
10279
  })
10255
- | PatchEvent
10280
+ | InternalPatchEvent
10256
10281
  | MutationEvent
10257
10282
  | {
10258
10283
  type: 'normalizing'
@@ -10610,6 +10635,7 @@ declare const editorMachine: StateMachine<
10610
10635
  dataTransfer: DataTransfer
10611
10636
  })
10612
10637
  | PatchEvent
10638
+ | InternalPatchEvent
10613
10639
  | MutationEvent
10614
10640
  | PatchesEvent
10615
10641
  | {
@@ -10667,7 +10693,7 @@ declare const editorMachine: StateMachine<
10667
10693
  behaviors: Set<Behavior>
10668
10694
  converters: Set<Converter>
10669
10695
  keyGenerator: () => string
10670
- pendingEvents: Array<PatchEvent | MutationEvent>
10696
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
10671
10697
  schema: EditorSchema
10672
10698
  initialReadOnly: boolean
10673
10699
  maxBlocks: number | undefined
@@ -10907,7 +10933,7 @@ declare const editorMachine: StateMachine<
10907
10933
  } & {
10908
10934
  dataTransfer: DataTransfer
10909
10935
  })
10910
- | PatchEvent
10936
+ | InternalPatchEvent
10911
10937
  | MutationEvent
10912
10938
  | {
10913
10939
  type: 'normalizing'
@@ -11265,6 +11291,7 @@ declare const editorMachine: StateMachine<
11265
11291
  dataTransfer: DataTransfer
11266
11292
  })
11267
11293
  | PatchEvent
11294
+ | InternalPatchEvent
11268
11295
  | MutationEvent
11269
11296
  | PatchesEvent
11270
11297
  | {
@@ -11322,7 +11349,7 @@ declare const editorMachine: StateMachine<
11322
11349
  behaviors: Set<Behavior>
11323
11350
  converters: Set<Converter>
11324
11351
  keyGenerator: () => string
11325
- pendingEvents: Array<PatchEvent | MutationEvent>
11352
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11326
11353
  schema: EditorSchema
11327
11354
  initialReadOnly: boolean
11328
11355
  maxBlocks: number | undefined
@@ -11555,7 +11582,7 @@ declare const editorMachine: StateMachine<
11555
11582
  } & {
11556
11583
  dataTransfer: DataTransfer
11557
11584
  })
11558
- | PatchEvent
11585
+ | InternalPatchEvent
11559
11586
  | MutationEvent
11560
11587
  | {
11561
11588
  type: 'normalizing'
@@ -11913,6 +11940,7 @@ declare const editorMachine: StateMachine<
11913
11940
  dataTransfer: DataTransfer
11914
11941
  })
11915
11942
  | PatchEvent
11943
+ | InternalPatchEvent
11916
11944
  | MutationEvent
11917
11945
  | PatchesEvent
11918
11946
  | {
@@ -11970,7 +11998,7 @@ declare const editorMachine: StateMachine<
11970
11998
  behaviors: Set<Behavior>
11971
11999
  converters: Set<Converter>
11972
12000
  keyGenerator: () => string
11973
- pendingEvents: Array<PatchEvent | MutationEvent>
12001
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
11974
12002
  schema: EditorSchema
11975
12003
  initialReadOnly: boolean
11976
12004
  maxBlocks: number | undefined
@@ -12203,7 +12231,7 @@ declare const editorMachine: StateMachine<
12203
12231
  } & {
12204
12232
  dataTransfer: DataTransfer
12205
12233
  })
12206
- | PatchEvent
12234
+ | InternalPatchEvent
12207
12235
  | MutationEvent
12208
12236
  | {
12209
12237
  type: 'normalizing'
@@ -12561,6 +12589,7 @@ declare const editorMachine: StateMachine<
12561
12589
  dataTransfer: DataTransfer
12562
12590
  })
12563
12591
  | PatchEvent
12592
+ | InternalPatchEvent
12564
12593
  | MutationEvent
12565
12594
  | PatchesEvent
12566
12595
  | {
@@ -12618,7 +12647,7 @@ declare const editorMachine: StateMachine<
12618
12647
  behaviors: Set<Behavior>
12619
12648
  converters: Set<Converter>
12620
12649
  keyGenerator: () => string
12621
- pendingEvents: Array<PatchEvent | MutationEvent>
12650
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
12622
12651
  schema: EditorSchema
12623
12652
  initialReadOnly: boolean
12624
12653
  maxBlocks: number | undefined
@@ -12864,7 +12893,7 @@ declare const editorMachine: StateMachine<
12864
12893
  } & {
12865
12894
  dataTransfer: DataTransfer
12866
12895
  })
12867
- | PatchEvent
12896
+ | InternalPatchEvent
12868
12897
  | MutationEvent
12869
12898
  | {
12870
12899
  type: 'normalizing'
@@ -13222,6 +13251,7 @@ declare const editorMachine: StateMachine<
13222
13251
  dataTransfer: DataTransfer
13223
13252
  })
13224
13253
  | PatchEvent
13254
+ | InternalPatchEvent
13225
13255
  | MutationEvent
13226
13256
  | PatchesEvent
13227
13257
  | {
@@ -13279,7 +13309,7 @@ declare const editorMachine: StateMachine<
13279
13309
  behaviors: Set<Behavior>
13280
13310
  converters: Set<Converter>
13281
13311
  keyGenerator: () => string
13282
- pendingEvents: Array<PatchEvent | MutationEvent>
13312
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13283
13313
  schema: EditorSchema
13284
13314
  initialReadOnly: boolean
13285
13315
  maxBlocks: number | undefined
@@ -13526,7 +13556,7 @@ declare const editorMachine: StateMachine<
13526
13556
  } & {
13527
13557
  dataTransfer: DataTransfer
13528
13558
  })
13529
- | PatchEvent
13559
+ | InternalPatchEvent
13530
13560
  | MutationEvent
13531
13561
  | {
13532
13562
  type: 'normalizing'
@@ -13884,6 +13914,7 @@ declare const editorMachine: StateMachine<
13884
13914
  dataTransfer: DataTransfer
13885
13915
  })
13886
13916
  | PatchEvent
13917
+ | InternalPatchEvent
13887
13918
  | MutationEvent
13888
13919
  | PatchesEvent
13889
13920
  | {
@@ -13941,7 +13972,7 @@ declare const editorMachine: StateMachine<
13941
13972
  behaviors: Set<Behavior>
13942
13973
  converters: Set<Converter>
13943
13974
  keyGenerator: () => string
13944
- pendingEvents: Array<PatchEvent | MutationEvent>
13975
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
13945
13976
  schema: EditorSchema
13946
13977
  initialReadOnly: boolean
13947
13978
  maxBlocks: number | undefined
@@ -14174,7 +14205,7 @@ declare const editorMachine: StateMachine<
14174
14205
  } & {
14175
14206
  dataTransfer: DataTransfer
14176
14207
  })
14177
- | PatchEvent
14208
+ | InternalPatchEvent
14178
14209
  | MutationEvent
14179
14210
  | {
14180
14211
  type: 'normalizing'
@@ -14532,6 +14563,7 @@ declare const editorMachine: StateMachine<
14532
14563
  dataTransfer: DataTransfer
14533
14564
  })
14534
14565
  | PatchEvent
14566
+ | InternalPatchEvent
14535
14567
  | MutationEvent
14536
14568
  | PatchesEvent
14537
14569
  | {
@@ -14589,7 +14621,7 @@ declare const editorMachine: StateMachine<
14589
14621
  behaviors: Set<Behavior>
14590
14622
  converters: Set<Converter>
14591
14623
  keyGenerator: () => string
14592
- pendingEvents: Array<PatchEvent | MutationEvent>
14624
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
14593
14625
  schema: EditorSchema
14594
14626
  initialReadOnly: boolean
14595
14627
  maxBlocks: number | undefined
@@ -14825,7 +14857,7 @@ declare const editorMachine: StateMachine<
14825
14857
  } & {
14826
14858
  dataTransfer: DataTransfer
14827
14859
  })
14828
- | PatchEvent
14860
+ | InternalPatchEvent
14829
14861
  | MutationEvent
14830
14862
  | {
14831
14863
  type: 'normalizing'
@@ -15183,6 +15215,7 @@ declare const editorMachine: StateMachine<
15183
15215
  dataTransfer: DataTransfer
15184
15216
  })
15185
15217
  | PatchEvent
15218
+ | InternalPatchEvent
15186
15219
  | MutationEvent
15187
15220
  | PatchesEvent
15188
15221
  | {
@@ -15240,7 +15273,7 @@ declare const editorMachine: StateMachine<
15240
15273
  behaviors: Set<Behavior>
15241
15274
  converters: Set<Converter>
15242
15275
  keyGenerator: () => string
15243
- pendingEvents: Array<PatchEvent | MutationEvent>
15276
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15244
15277
  schema: EditorSchema
15245
15278
  initialReadOnly: boolean
15246
15279
  maxBlocks: number | undefined
@@ -15527,7 +15560,7 @@ declare const editorMachine: StateMachine<
15527
15560
  } & {
15528
15561
  dataTransfer: DataTransfer
15529
15562
  })
15530
- | PatchEvent
15563
+ | InternalPatchEvent
15531
15564
  | MutationEvent
15532
15565
  | {
15533
15566
  type: 'normalizing'
@@ -15885,6 +15918,7 @@ declare const editorMachine: StateMachine<
15885
15918
  dataTransfer: DataTransfer
15886
15919
  })
15887
15920
  | PatchEvent
15921
+ | InternalPatchEvent
15888
15922
  | MutationEvent
15889
15923
  | PatchesEvent
15890
15924
  | {
@@ -15942,7 +15976,7 @@ declare const editorMachine: StateMachine<
15942
15976
  behaviors: Set<Behavior>
15943
15977
  converters: Set<Converter>
15944
15978
  keyGenerator: () => string
15945
- pendingEvents: Array<PatchEvent | MutationEvent>
15979
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
15946
15980
  schema: EditorSchema
15947
15981
  initialReadOnly: boolean
15948
15982
  maxBlocks: number | undefined
@@ -16184,7 +16218,7 @@ declare const editorMachine: StateMachine<
16184
16218
  } & {
16185
16219
  dataTransfer: DataTransfer
16186
16220
  })
16187
- | PatchEvent
16221
+ | InternalPatchEvent
16188
16222
  | MutationEvent
16189
16223
  | {
16190
16224
  type: 'normalizing'
@@ -16542,6 +16576,7 @@ declare const editorMachine: StateMachine<
16542
16576
  dataTransfer: DataTransfer
16543
16577
  })
16544
16578
  | PatchEvent
16579
+ | InternalPatchEvent
16545
16580
  | MutationEvent
16546
16581
  | PatchesEvent
16547
16582
  | {
@@ -16599,7 +16634,7 @@ declare const editorMachine: StateMachine<
16599
16634
  behaviors: Set<Behavior>
16600
16635
  converters: Set<Converter>
16601
16636
  keyGenerator: () => string
16602
- pendingEvents: Array<PatchEvent | MutationEvent>
16637
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
16603
16638
  schema: EditorSchema
16604
16639
  initialReadOnly: boolean
16605
16640
  maxBlocks: number | undefined
@@ -16842,7 +16877,7 @@ declare const editorMachine: StateMachine<
16842
16877
  } & {
16843
16878
  dataTransfer: DataTransfer
16844
16879
  })
16845
- | PatchEvent
16880
+ | InternalPatchEvent
16846
16881
  | MutationEvent
16847
16882
  | {
16848
16883
  type: 'normalizing'
@@ -17200,6 +17235,7 @@ declare const editorMachine: StateMachine<
17200
17235
  dataTransfer: DataTransfer
17201
17236
  })
17202
17237
  | PatchEvent
17238
+ | InternalPatchEvent
17203
17239
  | MutationEvent
17204
17240
  | PatchesEvent
17205
17241
  | {
@@ -17257,7 +17293,7 @@ declare const editorMachine: StateMachine<
17257
17293
  behaviors: Set<Behavior>
17258
17294
  converters: Set<Converter>
17259
17295
  keyGenerator: () => string
17260
- pendingEvents: Array<PatchEvent | MutationEvent>
17296
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17261
17297
  schema: EditorSchema
17262
17298
  initialReadOnly: boolean
17263
17299
  maxBlocks: number | undefined
@@ -17491,7 +17527,7 @@ declare const editorMachine: StateMachine<
17491
17527
  } & {
17492
17528
  dataTransfer: DataTransfer
17493
17529
  })
17494
- | PatchEvent
17530
+ | InternalPatchEvent
17495
17531
  | MutationEvent
17496
17532
  | {
17497
17533
  type: 'normalizing'
@@ -17849,6 +17885,7 @@ declare const editorMachine: StateMachine<
17849
17885
  dataTransfer: DataTransfer
17850
17886
  })
17851
17887
  | PatchEvent
17888
+ | InternalPatchEvent
17852
17889
  | MutationEvent
17853
17890
  | PatchesEvent
17854
17891
  | {
@@ -17906,7 +17943,7 @@ declare const editorMachine: StateMachine<
17906
17943
  behaviors: Set<Behavior>
17907
17944
  converters: Set<Converter>
17908
17945
  keyGenerator: () => string
17909
- pendingEvents: Array<PatchEvent | MutationEvent>
17946
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
17910
17947
  schema: EditorSchema
17911
17948
  initialReadOnly: boolean
17912
17949
  maxBlocks: number | undefined
@@ -18142,7 +18179,7 @@ declare const editorMachine: StateMachine<
18142
18179
  } & {
18143
18180
  dataTransfer: DataTransfer
18144
18181
  })
18145
- | PatchEvent
18182
+ | InternalPatchEvent
18146
18183
  | MutationEvent
18147
18184
  | {
18148
18185
  type: 'normalizing'
@@ -18500,6 +18537,7 @@ declare const editorMachine: StateMachine<
18500
18537
  dataTransfer: DataTransfer
18501
18538
  })
18502
18539
  | PatchEvent
18540
+ | InternalPatchEvent
18503
18541
  | MutationEvent
18504
18542
  | PatchesEvent
18505
18543
  | {
@@ -18557,7 +18595,7 @@ declare const editorMachine: StateMachine<
18557
18595
  behaviors: Set<Behavior>
18558
18596
  converters: Set<Converter>
18559
18597
  keyGenerator: () => string
18560
- pendingEvents: Array<PatchEvent | MutationEvent>
18598
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
18561
18599
  schema: EditorSchema
18562
18600
  initialReadOnly: boolean
18563
18601
  maxBlocks: number | undefined
@@ -18799,7 +18837,7 @@ declare const editorMachine: StateMachine<
18799
18837
  } & {
18800
18838
  dataTransfer: DataTransfer
18801
18839
  })
18802
- | PatchEvent
18840
+ | InternalPatchEvent
18803
18841
  | MutationEvent
18804
18842
  | {
18805
18843
  type: 'normalizing'
@@ -19157,6 +19195,7 @@ declare const editorMachine: StateMachine<
19157
19195
  dataTransfer: DataTransfer
19158
19196
  })
19159
19197
  | PatchEvent
19198
+ | InternalPatchEvent
19160
19199
  | MutationEvent
19161
19200
  | PatchesEvent
19162
19201
  | {
@@ -19252,7 +19291,7 @@ declare const editorMachine: StateMachine<
19252
19291
  readonly 'setting up': {
19253
19292
  readonly exit: readonly ['emit ready']
19254
19293
  readonly on: {
19255
- readonly 'patch': {
19294
+ readonly 'internal.patch': {
19256
19295
  readonly actions: 'defer event'
19257
19296
  }
19258
19297
  readonly 'mutation': {
@@ -19268,14 +19307,14 @@ declare const editorMachine: StateMachine<
19268
19307
  readonly states: {
19269
19308
  readonly idle: {
19270
19309
  readonly on: {
19271
- readonly normalizing: {
19310
+ readonly 'normalizing': {
19272
19311
  readonly target: 'normalizing'
19273
19312
  }
19274
- readonly patch: {
19313
+ readonly 'internal.patch': {
19275
19314
  readonly actions: 'defer event'
19276
19315
  readonly target: '#editor.setup.dirty'
19277
19316
  }
19278
- readonly mutation: {
19317
+ readonly 'mutation': {
19279
19318
  readonly actions: 'defer event'
19280
19319
  readonly target: '#editor.setup.dirty'
19281
19320
  }
@@ -19286,7 +19325,7 @@ declare const editorMachine: StateMachine<
19286
19325
  readonly 'done normalizing': {
19287
19326
  readonly target: 'idle'
19288
19327
  }
19289
- readonly 'patch': {
19328
+ readonly 'internal.patch': {
19290
19329
  readonly actions: 'defer event'
19291
19330
  }
19292
19331
  readonly 'mutation': {
@@ -19302,10 +19341,10 @@ declare const editorMachine: StateMachine<
19302
19341
  'clear pending events',
19303
19342
  ]
19304
19343
  readonly on: {
19305
- readonly patch: {
19344
+ readonly 'internal.patch': {
19306
19345
  readonly actions: 'emit patch event'
19307
19346
  }
19308
- readonly mutation: {
19347
+ readonly 'mutation': {
19309
19348
  readonly actions: 'emit mutation event'
19310
19349
  }
19311
19350
  }
@@ -19460,6 +19499,11 @@ declare type HistoryItem = {
19460
19499
  timestamp: Date
19461
19500
  }
19462
19501
 
19502
+ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
19503
+ actionId?: string
19504
+ value: Array<PortableTextBlock>
19505
+ }
19506
+
19463
19507
  /**
19464
19508
  * The editor has invalid data in the value that can be resolved by the user
19465
19509
  * @beta */
@@ -19585,6 +19629,19 @@ declare type MutationEvent = {
19585
19629
  value: Array<PortableTextBlock> | undefined
19586
19630
  }
19587
19631
 
19632
+ declare type NamespaceEvent<
19633
+ TEvent,
19634
+ TNamespace extends string,
19635
+ > = TEvent extends {
19636
+ type: infer TEventType
19637
+ }
19638
+ ? {
19639
+ [K in keyof TEvent]: K extends 'type'
19640
+ ? `${TNamespace}.${TEventType & string}`
19641
+ : TEvent[K]
19642
+ }
19643
+ : never
19644
+
19588
19645
  /**
19589
19646
  * @beta
19590
19647
  */