@portabletext/editor 1.20.0 → 1.21.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 (128) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +8 -68
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.get-text-before.cjs +11 -39
  4. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  5. package/lib/_chunks-cjs/util.get-block-start-point.cjs +30 -0
  6. package/lib/_chunks-cjs/util.get-block-start-point.cjs.map +1 -0
  7. package/lib/_chunks-cjs/util.is-empty-text-block.cjs +71 -0
  8. package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -0
  9. package/lib/_chunks-cjs/util.is-keyed-segment.cjs +6 -0
  10. package/lib/_chunks-cjs/util.is-keyed-segment.cjs.map +1 -0
  11. package/lib/_chunks-es/behavior.core.js +7 -66
  12. package/lib/_chunks-es/behavior.core.js.map +1 -1
  13. package/lib/_chunks-es/selector.get-text-before.js +5 -31
  14. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  15. package/lib/_chunks-es/util.get-block-start-point.js +31 -0
  16. package/lib/_chunks-es/util.get-block-start-point.js.map +1 -0
  17. package/lib/_chunks-es/util.is-empty-text-block.js +73 -0
  18. package/lib/_chunks-es/util.is-empty-text-block.js.map +1 -0
  19. package/lib/_chunks-es/util.is-keyed-segment.js +7 -0
  20. package/lib/_chunks-es/util.is-keyed-segment.js.map +1 -0
  21. package/lib/behaviors/index.cjs +7 -7
  22. package/lib/behaviors/index.cjs.map +1 -1
  23. package/lib/behaviors/index.d.cts +179 -119
  24. package/lib/behaviors/index.d.ts +179 -119
  25. package/lib/behaviors/index.js +3 -2
  26. package/lib/behaviors/index.js.map +1 -1
  27. package/lib/index.cjs +29 -6
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +844 -141
  30. package/lib/index.d.ts +844 -141
  31. package/lib/index.js +28 -4
  32. package/lib/index.js.map +1 -1
  33. package/lib/selectors/index.cjs +73 -1
  34. package/lib/selectors/index.cjs.map +1 -1
  35. package/lib/selectors/index.d.cts +14 -0
  36. package/lib/selectors/index.d.ts +14 -0
  37. package/lib/selectors/index.js +73 -0
  38. package/lib/selectors/index.js.map +1 -1
  39. package/lib/utils/index.cjs +11 -0
  40. package/lib/utils/index.cjs.map +1 -0
  41. package/lib/utils/index.d.cts +87 -0
  42. package/lib/utils/index.d.ts +87 -0
  43. package/lib/utils/index.js +13 -0
  44. package/lib/utils/index.js.map +1 -0
  45. package/package.json +15 -9
  46. package/src/behavior-actions/behavior.action-utils.insert-block.ts +1 -1
  47. package/src/behavior-actions/behavior.action.insert-block-object.ts +1 -1
  48. package/src/behavior-actions/behavior.action.insert-inline-object.ts +1 -1
  49. package/src/behavior-actions/behavior.action.text-block.set.ts +1 -1
  50. package/src/behavior-actions/behavior.action.text-block.unset.ts +1 -1
  51. package/src/behavior-actions/behavior.actions.ts +5 -5
  52. package/src/behaviors/behavior.code-editor.ts +1 -1
  53. package/src/behaviors/behavior.core.block-objects.ts +2 -2
  54. package/src/behaviors/behavior.core.decorators.ts +1 -1
  55. package/src/behaviors/behavior.core.lists.ts +2 -2
  56. package/src/behaviors/behavior.emoji-picker.ts +1 -1
  57. package/src/behaviors/behavior.links.ts +1 -1
  58. package/src/behaviors/behavior.markdown.ts +2 -2
  59. package/src/behaviors/behavior.types.ts +52 -19
  60. package/src/behaviors/index.ts +1 -0
  61. package/src/editor/Editable.tsx +12 -12
  62. package/src/editor/PortableTextEditor.tsx +2 -2
  63. package/src/editor/components/DraggableBlock.tsx +2 -2
  64. package/src/editor/components/Element.tsx +3 -3
  65. package/src/editor/components/Leaf.tsx +1 -1
  66. package/src/editor/components/Synchronizer.tsx +1 -1
  67. package/src/editor/create-editor.ts +22 -20
  68. package/src/editor/create-slate-editor.tsx +5 -2
  69. package/src/editor/editor-machine.ts +42 -14
  70. package/src/editor/get-value.ts +2 -2
  71. package/src/editor/hooks/usePortableTextEditorSelection.tsx +1 -1
  72. package/src/editor/mutation-machine.ts +2 -2
  73. package/src/editor/plugins/create-with-event-listeners.ts +11 -3
  74. package/src/editor/plugins/createWithEditableAPI.ts +7 -7
  75. package/src/editor/plugins/createWithHotKeys.ts +2 -2
  76. package/src/editor/plugins/createWithInsertData.ts +7 -7
  77. package/src/editor/plugins/createWithMaxBlocks.ts +2 -2
  78. package/src/editor/plugins/createWithObjectKeys.ts +2 -2
  79. package/src/editor/plugins/createWithPatches.ts +10 -10
  80. package/src/editor/plugins/createWithPlaceholderBlock.ts +3 -3
  81. package/src/editor/plugins/createWithPortableTextBlockStyle.ts +1 -1
  82. package/src/editor/plugins/createWithPortableTextMarkModel.ts +4 -4
  83. package/src/editor/plugins/createWithPortableTextSelections.ts +6 -6
  84. package/src/editor/plugins/createWithSchemaTypes.ts +1 -1
  85. package/src/editor/plugins/createWithUndoRedo.ts +5 -5
  86. package/src/editor/plugins/createWithUtils.ts +2 -2
  87. package/src/editor/plugins/with-plugins.ts +1 -1
  88. package/src/editor/sync-machine.ts +8 -5
  89. package/src/index.ts +5 -1
  90. package/src/selectors/index.ts +2 -0
  91. package/src/selectors/selector.get-selection-text.test.ts +75 -0
  92. package/src/selectors/selector.get-selection-text.ts +3 -3
  93. package/src/selectors/selector.get-text-before.ts +7 -4
  94. package/src/selectors/selector.is-point-after-selection.ts +82 -0
  95. package/src/selectors/selector.is-point-before-selection.ts +82 -0
  96. package/src/utils/_exports/index.ts +1 -0
  97. package/src/utils/index.ts +11 -0
  98. package/src/{editor/utils/utils.block-offset.test.ts → utils/util.block-offset.test.ts} +1 -1
  99. package/src/{editor/utils/utils.block-offset.ts → utils/util.block-offset.ts} +23 -7
  100. package/src/{editor/utils/utils.get-start-point.ts → utils/util.get-block-start-point.ts} +5 -2
  101. package/src/utils/util.get-text-block-text.ts +8 -0
  102. package/src/{editor/utils/utils.ts → utils/util.is-empty-text-block.ts} +4 -5
  103. package/src/{editor/utils/utils.is-keyed-segment.ts → utils/util.is-keyed-segment.ts} +3 -0
  104. package/src/{editor/utils/utils.reverse-selection.ts → utils/util.reverse-selection.ts} +4 -1
  105. /package/src/{utils → internal-utils}/__tests__/dmpToOperations.test.ts +0 -0
  106. /package/src/{utils → internal-utils}/__tests__/operationToPatches.test.ts +0 -0
  107. /package/src/{utils → internal-utils}/__tests__/patchToOperations.test.ts +0 -0
  108. /package/src/{utils → internal-utils}/__tests__/ranges.test.ts +0 -0
  109. /package/src/{utils → internal-utils}/__tests__/valueNormalization.test.tsx +0 -0
  110. /package/src/{utils → internal-utils}/__tests__/values.test.ts +0 -0
  111. /package/src/{utils → internal-utils}/applyPatch.ts +0 -0
  112. /package/src/{utils → internal-utils}/debug.ts +0 -0
  113. /package/src/{utils → internal-utils}/is-hotkey.test.ts +0 -0
  114. /package/src/{utils → internal-utils}/is-hotkey.ts +0 -0
  115. /package/src/{utils → internal-utils}/looks-like-url.test.ts +0 -0
  116. /package/src/{utils → internal-utils}/looks-like-url.ts +0 -0
  117. /package/src/{utils → internal-utils}/operationToPatches.ts +0 -0
  118. /package/src/{utils → internal-utils}/paths.ts +0 -0
  119. /package/src/{utils → internal-utils}/ranges.ts +0 -0
  120. /package/src/{utils → internal-utils}/schema.ts +0 -0
  121. /package/src/{utils → internal-utils}/selection.ts +0 -0
  122. /package/src/{utils → internal-utils}/sibling-utils.ts +0 -0
  123. /package/src/{utils → internal-utils}/validateValue.ts +0 -0
  124. /package/src/{utils → internal-utils}/values.ts +0 -0
  125. /package/src/{utils → internal-utils}/weakMaps.ts +0 -0
  126. /package/src/{utils → internal-utils}/withChanges.ts +0 -0
  127. /package/src/{utils → internal-utils}/withUndoRedo.ts +0 -0
  128. /package/src/{utils → internal-utils}/withoutPatching.ts +0 -0
package/lib/index.d.ts CHANGED
@@ -64,6 +64,7 @@ import {
64
64
  Values,
65
65
  } from 'xstate'
66
66
  import {GuardArgs} from 'xstate/guards'
67
+ import {PortableTextMemberSchemaTypes as PortableTextMemberSchemaTypes_2} from '..'
67
68
 
68
69
  /**
69
70
  * @public
@@ -97,6 +98,7 @@ export declare type BaseDefinition = {
97
98
  export declare type Behavior<
98
99
  TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
99
100
  TGuardResponse = true,
101
+ TBehaviorEvent extends BehaviorEvent = BehaviorEvent,
100
102
  > = {
101
103
  /**
102
104
  * The internal editor event that triggers this behavior.
@@ -107,14 +109,11 @@ export declare type Behavior<
107
109
  * Returning a non-nullable value from the guard will pass the value to the
108
110
  * actions and execute them.
109
111
  */
110
- guard?: BehaviorGuard<
111
- PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
112
- TGuardResponse
113
- >
112
+ guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>
114
113
  /**
115
114
  * Array of behavior action sets.
116
115
  */
117
- actions: Array<BehaviorActionIntendSet<TBehaviorEventType, TGuardResponse>>
116
+ actions: Array<BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse>>
118
117
  }
119
118
 
120
119
  /**
@@ -124,7 +123,7 @@ export declare type BehaviorActionIntend =
124
123
  | SyntheticBehaviorEvent
125
124
  | {
126
125
  type: 'raise'
127
- event: SyntheticBehaviorEvent
126
+ event: SyntheticBehaviorEvent | CustomBehaviorEvent
128
127
  }
129
128
  | {
130
129
  type: 'annotation.toggle'
@@ -228,16 +227,13 @@ export declare type BehaviorActionIntend =
228
227
  /**
229
228
  * @beta
230
229
  */
231
- export declare type BehaviorActionIntendSet<
232
- TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
233
- TGuardResponse = true,
234
- > = (
230
+ export declare type BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse> = (
235
231
  {
236
232
  context,
237
233
  event,
238
234
  }: {
239
235
  context: EditorContext
240
- event: PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>
236
+ event: TBehaviorEvent
241
237
  },
242
238
  guardResponse: TGuardResponse,
243
239
  ) => Array<BehaviorActionIntend>
@@ -245,15 +241,15 @@ export declare type BehaviorActionIntendSet<
245
241
  /**
246
242
  * @beta
247
243
  */
248
- export declare type BehaviorEvent = SyntheticBehaviorEvent | NativeBehaviorEvent
244
+ export declare type BehaviorEvent =
245
+ | SyntheticBehaviorEvent
246
+ | NativeBehaviorEvent
247
+ | CustomBehaviorEvent
249
248
 
250
249
  /**
251
250
  * @beta
252
251
  */
253
- export declare type BehaviorGuard<
254
- TBehaviorEvent extends BehaviorEvent,
255
- TGuardResponse,
256
- > = ({
252
+ export declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = ({
257
253
  context,
258
254
  event,
259
255
  }: {
@@ -368,6 +364,17 @@ export declare type ConnectionChange = {
368
364
  value: 'online' | 'offline'
369
365
  }
370
366
 
367
+ /**
368
+ * @beta
369
+ */
370
+ declare type CustomBehaviorEvent<
371
+ TPayload extends Record<string, unknown> = Record<string, unknown>,
372
+ TType extends string = string,
373
+ TInternalType extends `custom.${TType}` = `custom.${TType}`,
374
+ > = {
375
+ type: TInternalType
376
+ } & TPayload
377
+
371
378
  /**
372
379
  * @public
373
380
  */
@@ -572,24 +579,26 @@ export declare type EditorEmittedEvent = PickFromUnion<
572
579
  /**
573
580
  * @public
574
581
  */
575
- export declare type EditorEvent = PickFromUnion<
576
- InternalEditorEvent,
577
- 'type',
578
- | 'annotation.add'
579
- | 'annotation.remove'
580
- | 'blur'
581
- | 'decorator.toggle'
582
- | 'focus'
583
- | 'insert.block object'
584
- | 'insert.inline object'
585
- | 'list item.toggle'
586
- | 'select'
587
- | 'style.toggle'
588
- | 'patches'
589
- | 'update behaviors'
590
- | 'update readOnly'
591
- | 'update value'
592
- >
582
+ export declare type EditorEvent =
583
+ | PickFromUnion<
584
+ InternalEditorEvent,
585
+ 'type',
586
+ | 'annotation.add'
587
+ | 'annotation.remove'
588
+ | 'blur'
589
+ | 'decorator.toggle'
590
+ | 'focus'
591
+ | 'insert.block object'
592
+ | 'insert.inline object'
593
+ | 'list item.toggle'
594
+ | 'select'
595
+ | 'style.toggle'
596
+ | 'patches'
597
+ | 'update behaviors'
598
+ | 'update readOnly'
599
+ | 'update value'
600
+ >
601
+ | CustomBehaviorEvent
593
602
 
594
603
  /**
595
604
  * @public
@@ -605,7 +614,7 @@ export declare const editorMachine: StateMachine<
605
614
  {
606
615
  behaviors: Set<Behavior>
607
616
  keyGenerator: () => string
608
- pendingEvents: Array<PatchEvent | MutationEvent_2>
617
+ pendingEvents: Array<PatchEvent | MutationEvent>
609
618
  schema: EditorSchema
610
619
  initialReadOnly: boolean
611
620
  maxBlocks: number | undefined
@@ -665,7 +674,7 @@ export declare const editorMachine: StateMachine<
665
674
  style: string
666
675
  }
667
676
  | PatchEvent
668
- | MutationEvent_2
677
+ | MutationEvent
669
678
  | {
670
679
  type: 'normalizing'
671
680
  }
@@ -683,6 +692,15 @@ export declare const editorMachine: StateMachine<
683
692
  preventDefault: () => void
684
693
  }
685
694
  }
695
+ | {
696
+ type: 'custom behavior event'
697
+ behaviorEvent: CustomBehaviorEvent
698
+ editor: PortableTextSlateEditor
699
+ nativeEvent?: {
700
+ preventDefault: () => void
701
+ }
702
+ }
703
+ | CustomBehaviorEvent
686
704
  | {
687
705
  type: 'add behavior'
688
706
  behavior: Behavior
@@ -752,6 +770,10 @@ export declare const editorMachine: StateMachine<
752
770
  }
753
771
  | {
754
772
  type: 'done loading'
773
+ }
774
+ | {
775
+ type: 'custom.*'
776
+ event: CustomBehaviorEvent
755
777
  },
756
778
  {},
757
779
  never,
@@ -887,7 +909,7 @@ export declare const editorMachine: StateMachine<
887
909
  style: string
888
910
  }
889
911
  | PatchEvent
890
- | MutationEvent_2
912
+ | MutationEvent
891
913
  | {
892
914
  type: 'ready'
893
915
  }
@@ -938,6 +960,10 @@ export declare const editorMachine: StateMachine<
938
960
  }
939
961
  | {
940
962
  type: 'editable'
963
+ }
964
+ | {
965
+ type: 'custom.*'
966
+ event: CustomBehaviorEvent
941
967
  },
942
968
  MetaObject,
943
969
  {
@@ -980,7 +1006,7 @@ export declare const editorMachine: StateMachine<
980
1006
  {
981
1007
  behaviors: Set<Behavior>
982
1008
  keyGenerator: () => string
983
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1009
+ pendingEvents: Array<PatchEvent | MutationEvent>
984
1010
  schema: EditorSchema
985
1011
  initialReadOnly: boolean
986
1012
  maxBlocks: number | undefined
@@ -1040,7 +1066,7 @@ export declare const editorMachine: StateMachine<
1040
1066
  style: string
1041
1067
  }
1042
1068
  | PatchEvent
1043
- | MutationEvent_2
1069
+ | MutationEvent
1044
1070
  | {
1045
1071
  type: 'normalizing'
1046
1072
  }
@@ -1058,6 +1084,15 @@ export declare const editorMachine: StateMachine<
1058
1084
  preventDefault: () => void
1059
1085
  }
1060
1086
  }
1087
+ | {
1088
+ type: 'custom behavior event'
1089
+ behaviorEvent: CustomBehaviorEvent
1090
+ editor: PortableTextSlateEditor
1091
+ nativeEvent?: {
1092
+ preventDefault: () => void
1093
+ }
1094
+ }
1095
+ | CustomBehaviorEvent
1061
1096
  | {
1062
1097
  type: 'add behavior'
1063
1098
  behavior: Behavior
@@ -1127,6 +1162,10 @@ export declare const editorMachine: StateMachine<
1127
1162
  }
1128
1163
  | {
1129
1164
  type: 'done loading'
1165
+ }
1166
+ | {
1167
+ type: 'custom.*'
1168
+ event: CustomBehaviorEvent
1130
1169
  },
1131
1170
  Record<string, AnyActorRef | undefined>,
1132
1171
  StateValue,
@@ -1188,7 +1227,7 @@ export declare const editorMachine: StateMachine<
1188
1227
  style: string
1189
1228
  }
1190
1229
  | PatchEvent
1191
- | MutationEvent_2
1230
+ | MutationEvent
1192
1231
  | {
1193
1232
  type: 'normalizing'
1194
1233
  }
@@ -1206,6 +1245,15 @@ export declare const editorMachine: StateMachine<
1206
1245
  preventDefault: () => void
1207
1246
  }
1208
1247
  }
1248
+ | {
1249
+ type: 'custom behavior event'
1250
+ behaviorEvent: CustomBehaviorEvent
1251
+ editor: PortableTextSlateEditor
1252
+ nativeEvent?: {
1253
+ preventDefault: () => void
1254
+ }
1255
+ }
1256
+ | CustomBehaviorEvent
1209
1257
  | {
1210
1258
  type: 'add behavior'
1211
1259
  behavior: Behavior
@@ -1275,6 +1323,10 @@ export declare const editorMachine: StateMachine<
1275
1323
  }
1276
1324
  | {
1277
1325
  type: 'done loading'
1326
+ }
1327
+ | {
1328
+ type: 'custom.*'
1329
+ event: CustomBehaviorEvent
1278
1330
  },
1279
1331
  AnyEventObject
1280
1332
  >
@@ -1282,7 +1334,7 @@ export declare const editorMachine: StateMachine<
1282
1334
  behaviors: Set<Behavior>
1283
1335
  keyGenerator: () => string
1284
1336
  pendingEvents: never[]
1285
- schema: PortableTextMemberSchemaTypes
1337
+ schema: PortableTextMemberSchemaTypes_2
1286
1338
  selection: null
1287
1339
  initialReadOnly: boolean
1288
1340
  maxBlocks: number | undefined
@@ -1300,7 +1352,7 @@ export declare const editorMachine: StateMachine<
1300
1352
  {
1301
1353
  behaviors: Set<Behavior>
1302
1354
  keyGenerator: () => string
1303
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1355
+ pendingEvents: Array<PatchEvent | MutationEvent>
1304
1356
  schema: EditorSchema
1305
1357
  initialReadOnly: boolean
1306
1358
  maxBlocks: number | undefined
@@ -1364,7 +1416,7 @@ export declare const editorMachine: StateMachine<
1364
1416
  style: string
1365
1417
  }
1366
1418
  | PatchEvent
1367
- | MutationEvent_2
1419
+ | MutationEvent
1368
1420
  | {
1369
1421
  type: 'normalizing'
1370
1422
  }
@@ -1382,6 +1434,15 @@ export declare const editorMachine: StateMachine<
1382
1434
  preventDefault: () => void
1383
1435
  }
1384
1436
  }
1437
+ | {
1438
+ type: 'custom behavior event'
1439
+ behaviorEvent: CustomBehaviorEvent
1440
+ editor: PortableTextSlateEditor
1441
+ nativeEvent?: {
1442
+ preventDefault: () => void
1443
+ }
1444
+ }
1445
+ | CustomBehaviorEvent
1385
1446
  | {
1386
1447
  type: 'add behavior'
1387
1448
  behavior: Behavior
@@ -1451,6 +1512,10 @@ export declare const editorMachine: StateMachine<
1451
1512
  }
1452
1513
  | {
1453
1514
  type: 'done loading'
1515
+ }
1516
+ | {
1517
+ type: 'custom.*'
1518
+ event: CustomBehaviorEvent
1454
1519
  },
1455
1520
  undefined,
1456
1521
  never,
@@ -1510,7 +1575,7 @@ export declare const editorMachine: StateMachine<
1510
1575
  style: string
1511
1576
  }
1512
1577
  | PatchEvent
1513
- | MutationEvent_2
1578
+ | MutationEvent
1514
1579
  | {
1515
1580
  type: 'ready'
1516
1581
  }
@@ -1562,6 +1627,10 @@ export declare const editorMachine: StateMachine<
1562
1627
  | {
1563
1628
  type: 'editable'
1564
1629
  }
1630
+ | {
1631
+ type: 'custom.*'
1632
+ event: CustomBehaviorEvent
1633
+ }
1565
1634
  >
1566
1635
  }
1567
1636
  readonly 'value changed': {
@@ -1569,7 +1638,7 @@ export declare const editorMachine: StateMachine<
1569
1638
  {
1570
1639
  behaviors: Set<Behavior>
1571
1640
  keyGenerator: () => string
1572
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1641
+ pendingEvents: Array<PatchEvent | MutationEvent>
1573
1642
  schema: EditorSchema
1574
1643
  initialReadOnly: boolean
1575
1644
  maxBlocks: number | undefined
@@ -1633,7 +1702,7 @@ export declare const editorMachine: StateMachine<
1633
1702
  style: string
1634
1703
  }
1635
1704
  | PatchEvent
1636
- | MutationEvent_2
1705
+ | MutationEvent
1637
1706
  | {
1638
1707
  type: 'normalizing'
1639
1708
  }
@@ -1651,6 +1720,15 @@ export declare const editorMachine: StateMachine<
1651
1720
  preventDefault: () => void
1652
1721
  }
1653
1722
  }
1723
+ | {
1724
+ type: 'custom behavior event'
1725
+ behaviorEvent: CustomBehaviorEvent
1726
+ editor: PortableTextSlateEditor
1727
+ nativeEvent?: {
1728
+ preventDefault: () => void
1729
+ }
1730
+ }
1731
+ | CustomBehaviorEvent
1654
1732
  | {
1655
1733
  type: 'add behavior'
1656
1734
  behavior: Behavior
@@ -1720,6 +1798,10 @@ export declare const editorMachine: StateMachine<
1720
1798
  }
1721
1799
  | {
1722
1800
  type: 'done loading'
1801
+ }
1802
+ | {
1803
+ type: 'custom.*'
1804
+ event: CustomBehaviorEvent
1723
1805
  },
1724
1806
  undefined,
1725
1807
  never,
@@ -1779,7 +1861,7 @@ export declare const editorMachine: StateMachine<
1779
1861
  style: string
1780
1862
  }
1781
1863
  | PatchEvent
1782
- | MutationEvent_2
1864
+ | MutationEvent
1783
1865
  | {
1784
1866
  type: 'ready'
1785
1867
  }
@@ -1831,6 +1913,10 @@ export declare const editorMachine: StateMachine<
1831
1913
  | {
1832
1914
  type: 'editable'
1833
1915
  }
1916
+ | {
1917
+ type: 'custom.*'
1918
+ event: CustomBehaviorEvent
1919
+ }
1834
1920
  >
1835
1921
  }
1836
1922
  readonly 'invalid value': {
@@ -1838,7 +1924,7 @@ export declare const editorMachine: StateMachine<
1838
1924
  {
1839
1925
  behaviors: Set<Behavior>
1840
1926
  keyGenerator: () => string
1841
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1927
+ pendingEvents: Array<PatchEvent | MutationEvent>
1842
1928
  schema: EditorSchema
1843
1929
  initialReadOnly: boolean
1844
1930
  maxBlocks: number | undefined
@@ -1903,7 +1989,7 @@ export declare const editorMachine: StateMachine<
1903
1989
  style: string
1904
1990
  }
1905
1991
  | PatchEvent
1906
- | MutationEvent_2
1992
+ | MutationEvent
1907
1993
  | {
1908
1994
  type: 'normalizing'
1909
1995
  }
@@ -1921,6 +2007,15 @@ export declare const editorMachine: StateMachine<
1921
2007
  preventDefault: () => void
1922
2008
  }
1923
2009
  }
2010
+ | {
2011
+ type: 'custom behavior event'
2012
+ behaviorEvent: CustomBehaviorEvent
2013
+ editor: PortableTextSlateEditor
2014
+ nativeEvent?: {
2015
+ preventDefault: () => void
2016
+ }
2017
+ }
2018
+ | CustomBehaviorEvent
1924
2019
  | {
1925
2020
  type: 'add behavior'
1926
2021
  behavior: Behavior
@@ -1990,6 +2085,10 @@ export declare const editorMachine: StateMachine<
1990
2085
  }
1991
2086
  | {
1992
2087
  type: 'done loading'
2088
+ }
2089
+ | {
2090
+ type: 'custom.*'
2091
+ event: CustomBehaviorEvent
1993
2092
  },
1994
2093
  undefined,
1995
2094
  never,
@@ -2049,7 +2148,7 @@ export declare const editorMachine: StateMachine<
2049
2148
  style: string
2050
2149
  }
2051
2150
  | PatchEvent
2052
- | MutationEvent_2
2151
+ | MutationEvent
2053
2152
  | {
2054
2153
  type: 'ready'
2055
2154
  }
@@ -2101,6 +2200,10 @@ export declare const editorMachine: StateMachine<
2101
2200
  | {
2102
2201
  type: 'editable'
2103
2202
  }
2203
+ | {
2204
+ type: 'custom.*'
2205
+ event: CustomBehaviorEvent
2206
+ }
2104
2207
  >
2105
2208
  }
2106
2209
  readonly 'error': {
@@ -2108,7 +2211,7 @@ export declare const editorMachine: StateMachine<
2108
2211
  {
2109
2212
  behaviors: Set<Behavior>
2110
2213
  keyGenerator: () => string
2111
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2214
+ pendingEvents: Array<PatchEvent | MutationEvent>
2112
2215
  schema: EditorSchema
2113
2216
  initialReadOnly: boolean
2114
2217
  maxBlocks: number | undefined
@@ -2174,7 +2277,7 @@ export declare const editorMachine: StateMachine<
2174
2277
  style: string
2175
2278
  }
2176
2279
  | PatchEvent
2177
- | MutationEvent_2
2280
+ | MutationEvent
2178
2281
  | {
2179
2282
  type: 'normalizing'
2180
2283
  }
@@ -2192,6 +2295,15 @@ export declare const editorMachine: StateMachine<
2192
2295
  preventDefault: () => void
2193
2296
  }
2194
2297
  }
2298
+ | {
2299
+ type: 'custom behavior event'
2300
+ behaviorEvent: CustomBehaviorEvent
2301
+ editor: PortableTextSlateEditor
2302
+ nativeEvent?: {
2303
+ preventDefault: () => void
2304
+ }
2305
+ }
2306
+ | CustomBehaviorEvent
2195
2307
  | {
2196
2308
  type: 'add behavior'
2197
2309
  behavior: Behavior
@@ -2261,6 +2373,10 @@ export declare const editorMachine: StateMachine<
2261
2373
  }
2262
2374
  | {
2263
2375
  type: 'done loading'
2376
+ }
2377
+ | {
2378
+ type: 'custom.*'
2379
+ event: CustomBehaviorEvent
2264
2380
  },
2265
2381
  undefined,
2266
2382
  never,
@@ -2320,7 +2436,7 @@ export declare const editorMachine: StateMachine<
2320
2436
  style: string
2321
2437
  }
2322
2438
  | PatchEvent
2323
- | MutationEvent_2
2439
+ | MutationEvent
2324
2440
  | {
2325
2441
  type: 'ready'
2326
2442
  }
@@ -2372,6 +2488,10 @@ export declare const editorMachine: StateMachine<
2372
2488
  | {
2373
2489
  type: 'editable'
2374
2490
  }
2491
+ | {
2492
+ type: 'custom.*'
2493
+ event: CustomBehaviorEvent
2494
+ }
2375
2495
  >
2376
2496
  }
2377
2497
  readonly 'selection': {
@@ -2380,7 +2500,7 @@ export declare const editorMachine: StateMachine<
2380
2500
  {
2381
2501
  behaviors: Set<Behavior>
2382
2502
  keyGenerator: () => string
2383
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2503
+ pendingEvents: Array<PatchEvent | MutationEvent>
2384
2504
  schema: EditorSchema
2385
2505
  initialReadOnly: boolean
2386
2506
  maxBlocks: number | undefined
@@ -2444,7 +2564,7 @@ export declare const editorMachine: StateMachine<
2444
2564
  style: string
2445
2565
  }
2446
2566
  | PatchEvent
2447
- | MutationEvent_2
2567
+ | MutationEvent
2448
2568
  | {
2449
2569
  type: 'normalizing'
2450
2570
  }
@@ -2462,6 +2582,15 @@ export declare const editorMachine: StateMachine<
2462
2582
  preventDefault: () => void
2463
2583
  }
2464
2584
  }
2585
+ | {
2586
+ type: 'custom behavior event'
2587
+ behaviorEvent: CustomBehaviorEvent
2588
+ editor: PortableTextSlateEditor
2589
+ nativeEvent?: {
2590
+ preventDefault: () => void
2591
+ }
2592
+ }
2593
+ | CustomBehaviorEvent
2465
2594
  | {
2466
2595
  type: 'add behavior'
2467
2596
  behavior: Behavior
@@ -2531,6 +2660,10 @@ export declare const editorMachine: StateMachine<
2531
2660
  }
2532
2661
  | {
2533
2662
  type: 'done loading'
2663
+ }
2664
+ | {
2665
+ type: 'custom.*'
2666
+ event: CustomBehaviorEvent
2534
2667
  },
2535
2668
  undefined,
2536
2669
  never,
@@ -2543,7 +2676,7 @@ export declare const editorMachine: StateMachine<
2543
2676
  {
2544
2677
  behaviors: Set<Behavior>
2545
2678
  keyGenerator: () => string
2546
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2679
+ pendingEvents: Array<PatchEvent | MutationEvent>
2547
2680
  schema: EditorSchema
2548
2681
  initialReadOnly: boolean
2549
2682
  maxBlocks: number | undefined
@@ -2607,7 +2740,7 @@ export declare const editorMachine: StateMachine<
2607
2740
  style: string
2608
2741
  }
2609
2742
  | PatchEvent
2610
- | MutationEvent_2
2743
+ | MutationEvent
2611
2744
  | {
2612
2745
  type: 'normalizing'
2613
2746
  }
@@ -2625,6 +2758,15 @@ export declare const editorMachine: StateMachine<
2625
2758
  preventDefault: () => void
2626
2759
  }
2627
2760
  }
2761
+ | {
2762
+ type: 'custom behavior event'
2763
+ behaviorEvent: CustomBehaviorEvent
2764
+ editor: PortableTextSlateEditor
2765
+ nativeEvent?: {
2766
+ preventDefault: () => void
2767
+ }
2768
+ }
2769
+ | CustomBehaviorEvent
2628
2770
  | {
2629
2771
  type: 'add behavior'
2630
2772
  behavior: Behavior
@@ -2694,6 +2836,10 @@ export declare const editorMachine: StateMachine<
2694
2836
  }
2695
2837
  | {
2696
2838
  type: 'done loading'
2839
+ }
2840
+ | {
2841
+ type: 'custom.*'
2842
+ event: CustomBehaviorEvent
2697
2843
  },
2698
2844
  undefined,
2699
2845
  never,
@@ -2753,7 +2899,7 @@ export declare const editorMachine: StateMachine<
2753
2899
  style: string
2754
2900
  }
2755
2901
  | PatchEvent
2756
- | MutationEvent_2
2902
+ | MutationEvent
2757
2903
  | {
2758
2904
  type: 'ready'
2759
2905
  }
@@ -2805,6 +2951,10 @@ export declare const editorMachine: StateMachine<
2805
2951
  | {
2806
2952
  type: 'editable'
2807
2953
  }
2954
+ | {
2955
+ type: 'custom.*'
2956
+ event: CustomBehaviorEvent
2957
+ }
2808
2958
  >,
2809
2959
  ]
2810
2960
  }
@@ -2813,7 +2963,7 @@ export declare const editorMachine: StateMachine<
2813
2963
  {
2814
2964
  behaviors: Set<Behavior>
2815
2965
  keyGenerator: () => string
2816
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2966
+ pendingEvents: Array<PatchEvent | MutationEvent>
2817
2967
  schema: EditorSchema
2818
2968
  initialReadOnly: boolean
2819
2969
  maxBlocks: number | undefined
@@ -2877,7 +3027,7 @@ export declare const editorMachine: StateMachine<
2877
3027
  style: string
2878
3028
  }
2879
3029
  | PatchEvent
2880
- | MutationEvent_2
3030
+ | MutationEvent
2881
3031
  | {
2882
3032
  type: 'normalizing'
2883
3033
  }
@@ -2895,6 +3045,15 @@ export declare const editorMachine: StateMachine<
2895
3045
  preventDefault: () => void
2896
3046
  }
2897
3047
  }
3048
+ | {
3049
+ type: 'custom behavior event'
3050
+ behaviorEvent: CustomBehaviorEvent
3051
+ editor: PortableTextSlateEditor
3052
+ nativeEvent?: {
3053
+ preventDefault: () => void
3054
+ }
3055
+ }
3056
+ | CustomBehaviorEvent
2898
3057
  | {
2899
3058
  type: 'add behavior'
2900
3059
  behavior: Behavior
@@ -2964,6 +3123,10 @@ export declare const editorMachine: StateMachine<
2964
3123
  }
2965
3124
  | {
2966
3125
  type: 'done loading'
3126
+ }
3127
+ | {
3128
+ type: 'custom.*'
3129
+ event: CustomBehaviorEvent
2967
3130
  },
2968
3131
  undefined,
2969
3132
  never,
@@ -3023,7 +3186,7 @@ export declare const editorMachine: StateMachine<
3023
3186
  style: string
3024
3187
  }
3025
3188
  | PatchEvent
3026
- | MutationEvent_2
3189
+ | MutationEvent
3027
3190
  | {
3028
3191
  type: 'ready'
3029
3192
  }
@@ -3075,6 +3238,10 @@ export declare const editorMachine: StateMachine<
3075
3238
  | {
3076
3239
  type: 'editable'
3077
3240
  }
3241
+ | {
3242
+ type: 'custom.*'
3243
+ event: CustomBehaviorEvent
3244
+ }
3078
3245
  >
3079
3246
  }
3080
3247
  readonly 'focused': {
@@ -3082,7 +3249,7 @@ export declare const editorMachine: StateMachine<
3082
3249
  {
3083
3250
  behaviors: Set<Behavior>
3084
3251
  keyGenerator: () => string
3085
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3252
+ pendingEvents: Array<PatchEvent | MutationEvent>
3086
3253
  schema: EditorSchema
3087
3254
  initialReadOnly: boolean
3088
3255
  maxBlocks: number | undefined
@@ -3146,7 +3313,7 @@ export declare const editorMachine: StateMachine<
3146
3313
  style: string
3147
3314
  }
3148
3315
  | PatchEvent
3149
- | MutationEvent_2
3316
+ | MutationEvent
3150
3317
  | {
3151
3318
  type: 'normalizing'
3152
3319
  }
@@ -3164,6 +3331,15 @@ export declare const editorMachine: StateMachine<
3164
3331
  preventDefault: () => void
3165
3332
  }
3166
3333
  }
3334
+ | {
3335
+ type: 'custom behavior event'
3336
+ behaviorEvent: CustomBehaviorEvent
3337
+ editor: PortableTextSlateEditor
3338
+ nativeEvent?: {
3339
+ preventDefault: () => void
3340
+ }
3341
+ }
3342
+ | CustomBehaviorEvent
3167
3343
  | {
3168
3344
  type: 'add behavior'
3169
3345
  behavior: Behavior
@@ -3233,6 +3409,10 @@ export declare const editorMachine: StateMachine<
3233
3409
  }
3234
3410
  | {
3235
3411
  type: 'done loading'
3412
+ }
3413
+ | {
3414
+ type: 'custom.*'
3415
+ event: CustomBehaviorEvent
3236
3416
  },
3237
3417
  undefined,
3238
3418
  never,
@@ -3292,7 +3472,7 @@ export declare const editorMachine: StateMachine<
3292
3472
  style: string
3293
3473
  }
3294
3474
  | PatchEvent
3295
- | MutationEvent_2
3475
+ | MutationEvent
3296
3476
  | {
3297
3477
  type: 'ready'
3298
3478
  }
@@ -3344,6 +3524,10 @@ export declare const editorMachine: StateMachine<
3344
3524
  | {
3345
3525
  type: 'editable'
3346
3526
  }
3527
+ | {
3528
+ type: 'custom.*'
3529
+ event: CustomBehaviorEvent
3530
+ }
3347
3531
  >
3348
3532
  }
3349
3533
  readonly 'loading': {
@@ -3351,7 +3535,7 @@ export declare const editorMachine: StateMachine<
3351
3535
  {
3352
3536
  behaviors: Set<Behavior>
3353
3537
  keyGenerator: () => string
3354
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3538
+ pendingEvents: Array<PatchEvent | MutationEvent>
3355
3539
  schema: EditorSchema
3356
3540
  initialReadOnly: boolean
3357
3541
  maxBlocks: number | undefined
@@ -3414,7 +3598,7 @@ export declare const editorMachine: StateMachine<
3414
3598
  style: string
3415
3599
  }
3416
3600
  | PatchEvent
3417
- | MutationEvent_2
3601
+ | MutationEvent
3418
3602
  | {
3419
3603
  type: 'normalizing'
3420
3604
  }
@@ -3432,6 +3616,15 @@ export declare const editorMachine: StateMachine<
3432
3616
  preventDefault: () => void
3433
3617
  }
3434
3618
  }
3619
+ | {
3620
+ type: 'custom behavior event'
3621
+ behaviorEvent: CustomBehaviorEvent
3622
+ editor: PortableTextSlateEditor
3623
+ nativeEvent?: {
3624
+ preventDefault: () => void
3625
+ }
3626
+ }
3627
+ | CustomBehaviorEvent
3435
3628
  | {
3436
3629
  type: 'add behavior'
3437
3630
  behavior: Behavior
@@ -3501,6 +3694,10 @@ export declare const editorMachine: StateMachine<
3501
3694
  }
3502
3695
  | {
3503
3696
  type: 'done loading'
3697
+ }
3698
+ | {
3699
+ type: 'custom.*'
3700
+ event: CustomBehaviorEvent
3504
3701
  },
3505
3702
  undefined,
3506
3703
  never,
@@ -3560,7 +3757,7 @@ export declare const editorMachine: StateMachine<
3560
3757
  style: string
3561
3758
  }
3562
3759
  | PatchEvent
3563
- | MutationEvent_2
3760
+ | MutationEvent
3564
3761
  | {
3565
3762
  type: 'ready'
3566
3763
  }
@@ -3612,6 +3809,10 @@ export declare const editorMachine: StateMachine<
3612
3809
  | {
3613
3810
  type: 'editable'
3614
3811
  }
3812
+ | {
3813
+ type: 'custom.*'
3814
+ event: CustomBehaviorEvent
3815
+ }
3615
3816
  >
3616
3817
  }
3617
3818
  readonly 'patches': {
@@ -3619,7 +3820,7 @@ export declare const editorMachine: StateMachine<
3619
3820
  {
3620
3821
  behaviors: Set<Behavior>
3621
3822
  keyGenerator: () => string
3622
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3823
+ pendingEvents: Array<PatchEvent | MutationEvent>
3623
3824
  schema: EditorSchema
3624
3825
  initialReadOnly: boolean
3625
3826
  maxBlocks: number | undefined
@@ -3680,7 +3881,7 @@ export declare const editorMachine: StateMachine<
3680
3881
  style: string
3681
3882
  }
3682
3883
  | PatchEvent
3683
- | MutationEvent_2
3884
+ | MutationEvent
3684
3885
  | {
3685
3886
  type: 'normalizing'
3686
3887
  }
@@ -3698,6 +3899,15 @@ export declare const editorMachine: StateMachine<
3698
3899
  preventDefault: () => void
3699
3900
  }
3700
3901
  }
3902
+ | {
3903
+ type: 'custom behavior event'
3904
+ behaviorEvent: CustomBehaviorEvent
3905
+ editor: PortableTextSlateEditor
3906
+ nativeEvent?: {
3907
+ preventDefault: () => void
3908
+ }
3909
+ }
3910
+ | CustomBehaviorEvent
3701
3911
  | {
3702
3912
  type: 'add behavior'
3703
3913
  behavior: Behavior
@@ -3767,6 +3977,10 @@ export declare const editorMachine: StateMachine<
3767
3977
  }
3768
3978
  | {
3769
3979
  type: 'done loading'
3980
+ }
3981
+ | {
3982
+ type: 'custom.*'
3983
+ event: CustomBehaviorEvent
3770
3984
  },
3771
3985
  undefined,
3772
3986
  never,
@@ -3826,7 +4040,7 @@ export declare const editorMachine: StateMachine<
3826
4040
  style: string
3827
4041
  }
3828
4042
  | PatchEvent
3829
- | MutationEvent_2
4043
+ | MutationEvent
3830
4044
  | {
3831
4045
  type: 'ready'
3832
4046
  }
@@ -3878,6 +4092,10 @@ export declare const editorMachine: StateMachine<
3878
4092
  | {
3879
4093
  type: 'editable'
3880
4094
  }
4095
+ | {
4096
+ type: 'custom.*'
4097
+ event: CustomBehaviorEvent
4098
+ }
3881
4099
  >
3882
4100
  }
3883
4101
  readonly 'done loading': {
@@ -3885,7 +4103,7 @@ export declare const editorMachine: StateMachine<
3885
4103
  {
3886
4104
  behaviors: Set<Behavior>
3887
4105
  keyGenerator: () => string
3888
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4106
+ pendingEvents: Array<PatchEvent | MutationEvent>
3889
4107
  schema: EditorSchema
3890
4108
  initialReadOnly: boolean
3891
4109
  maxBlocks: number | undefined
@@ -3948,7 +4166,7 @@ export declare const editorMachine: StateMachine<
3948
4166
  style: string
3949
4167
  }
3950
4168
  | PatchEvent
3951
- | MutationEvent_2
4169
+ | MutationEvent
3952
4170
  | {
3953
4171
  type: 'normalizing'
3954
4172
  }
@@ -3966,6 +4184,15 @@ export declare const editorMachine: StateMachine<
3966
4184
  preventDefault: () => void
3967
4185
  }
3968
4186
  }
4187
+ | {
4188
+ type: 'custom behavior event'
4189
+ behaviorEvent: CustomBehaviorEvent
4190
+ editor: PortableTextSlateEditor
4191
+ nativeEvent?: {
4192
+ preventDefault: () => void
4193
+ }
4194
+ }
4195
+ | CustomBehaviorEvent
3969
4196
  | {
3970
4197
  type: 'add behavior'
3971
4198
  behavior: Behavior
@@ -4035,6 +4262,10 @@ export declare const editorMachine: StateMachine<
4035
4262
  }
4036
4263
  | {
4037
4264
  type: 'done loading'
4265
+ }
4266
+ | {
4267
+ type: 'custom.*'
4268
+ event: CustomBehaviorEvent
4038
4269
  },
4039
4270
  undefined,
4040
4271
  never,
@@ -4094,7 +4325,7 @@ export declare const editorMachine: StateMachine<
4094
4325
  style: string
4095
4326
  }
4096
4327
  | PatchEvent
4097
- | MutationEvent_2
4328
+ | MutationEvent
4098
4329
  | {
4099
4330
  type: 'ready'
4100
4331
  }
@@ -4146,6 +4377,10 @@ export declare const editorMachine: StateMachine<
4146
4377
  | {
4147
4378
  type: 'editable'
4148
4379
  }
4380
+ | {
4381
+ type: 'custom.*'
4382
+ event: CustomBehaviorEvent
4383
+ }
4149
4384
  >
4150
4385
  }
4151
4386
  readonly 'update behaviors': {
@@ -4159,7 +4394,7 @@ export declare const editorMachine: StateMachine<
4159
4394
  {
4160
4395
  behaviors: Set<Behavior>
4161
4396
  keyGenerator: () => string
4162
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4397
+ pendingEvents: Array<PatchEvent | MutationEvent>
4163
4398
  schema: EditorSchema
4164
4399
  initialReadOnly: boolean
4165
4400
  maxBlocks: number | undefined
@@ -4223,7 +4458,7 @@ export declare const editorMachine: StateMachine<
4223
4458
  style: string
4224
4459
  }
4225
4460
  | PatchEvent
4226
- | MutationEvent_2
4461
+ | MutationEvent
4227
4462
  | {
4228
4463
  type: 'normalizing'
4229
4464
  }
@@ -4241,6 +4476,15 @@ export declare const editorMachine: StateMachine<
4241
4476
  preventDefault: () => void
4242
4477
  }
4243
4478
  }
4479
+ | {
4480
+ type: 'custom behavior event'
4481
+ behaviorEvent: CustomBehaviorEvent
4482
+ editor: PortableTextSlateEditor
4483
+ nativeEvent?: {
4484
+ preventDefault: () => void
4485
+ }
4486
+ }
4487
+ | CustomBehaviorEvent
4244
4488
  | {
4245
4489
  type: 'add behavior'
4246
4490
  behavior: Behavior
@@ -4310,6 +4554,10 @@ export declare const editorMachine: StateMachine<
4310
4554
  }
4311
4555
  | {
4312
4556
  type: 'done loading'
4557
+ }
4558
+ | {
4559
+ type: 'custom.*'
4560
+ event: CustomBehaviorEvent
4313
4561
  },
4314
4562
  undefined,
4315
4563
  never,
@@ -4324,7 +4572,7 @@ export declare const editorMachine: StateMachine<
4324
4572
  {
4325
4573
  behaviors: Set<Behavior>
4326
4574
  keyGenerator: () => string
4327
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4575
+ pendingEvents: Array<PatchEvent | MutationEvent>
4328
4576
  schema: EditorSchema
4329
4577
  initialReadOnly: boolean
4330
4578
  maxBlocks: number | undefined
@@ -4388,7 +4636,7 @@ export declare const editorMachine: StateMachine<
4388
4636
  style: string
4389
4637
  }
4390
4638
  | PatchEvent
4391
- | MutationEvent_2
4639
+ | MutationEvent
4392
4640
  | {
4393
4641
  type: 'normalizing'
4394
4642
  }
@@ -4406,6 +4654,15 @@ export declare const editorMachine: StateMachine<
4406
4654
  preventDefault: () => void
4407
4655
  }
4408
4656
  }
4657
+ | {
4658
+ type: 'custom behavior event'
4659
+ behaviorEvent: CustomBehaviorEvent
4660
+ editor: PortableTextSlateEditor
4661
+ nativeEvent?: {
4662
+ preventDefault: () => void
4663
+ }
4664
+ }
4665
+ | CustomBehaviorEvent
4409
4666
  | {
4410
4667
  type: 'add behavior'
4411
4668
  behavior: Behavior
@@ -4475,6 +4732,10 @@ export declare const editorMachine: StateMachine<
4475
4732
  }
4476
4733
  | {
4477
4734
  type: 'done loading'
4735
+ }
4736
+ | {
4737
+ type: 'custom.*'
4738
+ event: CustomBehaviorEvent
4478
4739
  },
4479
4740
  undefined,
4480
4741
  never,
@@ -4504,7 +4765,7 @@ export declare const editorMachine: StateMachine<
4504
4765
  {
4505
4766
  behaviors: Set<Behavior>
4506
4767
  keyGenerator: () => string
4507
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4768
+ pendingEvents: Array<PatchEvent | MutationEvent>
4508
4769
  schema: EditorSchema
4509
4770
  initialReadOnly: boolean
4510
4771
  maxBlocks: number | undefined
@@ -4531,7 +4792,7 @@ export declare const editorMachine: StateMachine<
4531
4792
  {
4532
4793
  behaviors: Set<Behavior>
4533
4794
  keyGenerator: () => string
4534
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4795
+ pendingEvents: Array<PatchEvent | MutationEvent>
4535
4796
  schema: EditorSchema
4536
4797
  initialReadOnly: boolean
4537
4798
  maxBlocks: number | undefined
@@ -4559,7 +4820,7 @@ export declare const editorMachine: StateMachine<
4559
4820
  {
4560
4821
  behaviors: Set<Behavior>
4561
4822
  keyGenerator: () => string
4562
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4823
+ pendingEvents: Array<PatchEvent | MutationEvent>
4563
4824
  schema: EditorSchema
4564
4825
  initialReadOnly: boolean
4565
4826
  maxBlocks: number | undefined
@@ -4577,12 +4838,15 @@ export declare const editorMachine: StateMachine<
4577
4838
  readonly 'behavior event': {
4578
4839
  readonly actions: 'handle behavior event'
4579
4840
  }
4841
+ readonly 'custom behavior event': {
4842
+ readonly actions: 'handle behavior event'
4843
+ }
4580
4844
  readonly 'annotation.*': {
4581
4845
  readonly actions: ActionFunction<
4582
4846
  {
4583
4847
  behaviors: Set<Behavior>
4584
4848
  keyGenerator: () => string
4585
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4849
+ pendingEvents: Array<PatchEvent | MutationEvent>
4586
4850
  schema: EditorSchema
4587
4851
  initialReadOnly: boolean
4588
4852
  maxBlocks: number | undefined
@@ -4657,7 +4921,7 @@ export declare const editorMachine: StateMachine<
4657
4921
  style: string
4658
4922
  }
4659
4923
  | PatchEvent
4660
- | MutationEvent_2
4924
+ | MutationEvent
4661
4925
  | {
4662
4926
  type: 'normalizing'
4663
4927
  }
@@ -4677,6 +4941,15 @@ export declare const editorMachine: StateMachine<
4677
4941
  preventDefault: () => void
4678
4942
  }
4679
4943
  }
4944
+ | {
4945
+ type: 'custom behavior event'
4946
+ behaviorEvent: CustomBehaviorEvent
4947
+ editor: PortableTextSlateEditor
4948
+ nativeEvent?: {
4949
+ preventDefault: () => void
4950
+ }
4951
+ }
4952
+ | CustomBehaviorEvent
4680
4953
  | {
4681
4954
  type: 'add behavior'
4682
4955
  behavior: Behavior
@@ -4746,6 +5019,10 @@ export declare const editorMachine: StateMachine<
4746
5019
  }
4747
5020
  | {
4748
5021
  type: 'done loading'
5022
+ }
5023
+ | {
5024
+ type: 'custom.*'
5025
+ event: CustomBehaviorEvent
4749
5026
  },
4750
5027
  undefined,
4751
5028
  never,
@@ -4805,7 +5082,7 @@ export declare const editorMachine: StateMachine<
4805
5082
  style: string
4806
5083
  }
4807
5084
  | PatchEvent
4808
- | MutationEvent_2
5085
+ | MutationEvent
4809
5086
  | {
4810
5087
  type: 'ready'
4811
5088
  }
@@ -4857,6 +5134,10 @@ export declare const editorMachine: StateMachine<
4857
5134
  | {
4858
5135
  type: 'editable'
4859
5136
  }
5137
+ | {
5138
+ type: 'custom.*'
5139
+ event: CustomBehaviorEvent
5140
+ }
4860
5141
  >
4861
5142
  }
4862
5143
  readonly 'blur': {
@@ -4864,7 +5145,7 @@ export declare const editorMachine: StateMachine<
4864
5145
  {
4865
5146
  behaviors: Set<Behavior>
4866
5147
  keyGenerator: () => string
4867
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5148
+ pendingEvents: Array<PatchEvent | MutationEvent>
4868
5149
  schema: EditorSchema
4869
5150
  initialReadOnly: boolean
4870
5151
  maxBlocks: number | undefined
@@ -4927,7 +5208,7 @@ export declare const editorMachine: StateMachine<
4927
5208
  style: string
4928
5209
  }
4929
5210
  | PatchEvent
4930
- | MutationEvent_2
5211
+ | MutationEvent
4931
5212
  | {
4932
5213
  type: 'normalizing'
4933
5214
  }
@@ -4947,6 +5228,15 @@ export declare const editorMachine: StateMachine<
4947
5228
  preventDefault: () => void
4948
5229
  }
4949
5230
  }
5231
+ | {
5232
+ type: 'custom behavior event'
5233
+ behaviorEvent: CustomBehaviorEvent
5234
+ editor: PortableTextSlateEditor
5235
+ nativeEvent?: {
5236
+ preventDefault: () => void
5237
+ }
5238
+ }
5239
+ | CustomBehaviorEvent
4950
5240
  | {
4951
5241
  type: 'add behavior'
4952
5242
  behavior: Behavior
@@ -5016,6 +5306,10 @@ export declare const editorMachine: StateMachine<
5016
5306
  }
5017
5307
  | {
5018
5308
  type: 'done loading'
5309
+ }
5310
+ | {
5311
+ type: 'custom.*'
5312
+ event: CustomBehaviorEvent
5019
5313
  },
5020
5314
  undefined,
5021
5315
  never,
@@ -5075,7 +5369,7 @@ export declare const editorMachine: StateMachine<
5075
5369
  style: string
5076
5370
  }
5077
5371
  | PatchEvent
5078
- | MutationEvent_2
5372
+ | MutationEvent
5079
5373
  | {
5080
5374
  type: 'ready'
5081
5375
  }
@@ -5127,24 +5421,29 @@ export declare const editorMachine: StateMachine<
5127
5421
  | {
5128
5422
  type: 'editable'
5129
5423
  }
5424
+ | {
5425
+ type: 'custom.*'
5426
+ event: CustomBehaviorEvent
5427
+ }
5130
5428
  >
5131
5429
  }
5132
- readonly 'decorator.*': {
5430
+ readonly 'custom.*': {
5133
5431
  readonly actions: ActionFunction<
5134
5432
  {
5135
5433
  behaviors: Set<Behavior>
5136
5434
  keyGenerator: () => string
5137
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5435
+ pendingEvents: Array<PatchEvent | MutationEvent>
5138
5436
  schema: EditorSchema
5139
5437
  initialReadOnly: boolean
5140
5438
  maxBlocks: number | undefined
5141
5439
  selection: EditorSelection
5142
5440
  value: Array<PortableTextBlock> | undefined
5143
5441
  },
5144
- {
5145
- type: 'decorator.toggle'
5146
- decorator: string
5147
- },
5442
+ | CustomBehaviorEvent
5443
+ | {
5444
+ type: 'custom.*'
5445
+ event: CustomBehaviorEvent
5446
+ },
5148
5447
  | {
5149
5448
  type: 'annotation.add'
5150
5449
  annotation: {
@@ -5198,7 +5497,7 @@ export declare const editorMachine: StateMachine<
5198
5497
  style: string
5199
5498
  }
5200
5499
  | PatchEvent
5201
- | MutationEvent_2
5500
+ | MutationEvent
5202
5501
  | {
5203
5502
  type: 'normalizing'
5204
5503
  }
@@ -5218,6 +5517,15 @@ export declare const editorMachine: StateMachine<
5218
5517
  preventDefault: () => void
5219
5518
  }
5220
5519
  }
5520
+ | {
5521
+ type: 'custom behavior event'
5522
+ behaviorEvent: CustomBehaviorEvent
5523
+ editor: PortableTextSlateEditor
5524
+ nativeEvent?: {
5525
+ preventDefault: () => void
5526
+ }
5527
+ }
5528
+ | CustomBehaviorEvent
5221
5529
  | {
5222
5530
  type: 'add behavior'
5223
5531
  behavior: Behavior
@@ -5287,6 +5595,10 @@ export declare const editorMachine: StateMachine<
5287
5595
  }
5288
5596
  | {
5289
5597
  type: 'done loading'
5598
+ }
5599
+ | {
5600
+ type: 'custom.*'
5601
+ event: CustomBehaviorEvent
5290
5602
  },
5291
5603
  undefined,
5292
5604
  never,
@@ -5346,7 +5658,7 @@ export declare const editorMachine: StateMachine<
5346
5658
  style: string
5347
5659
  }
5348
5660
  | PatchEvent
5349
- | MutationEvent_2
5661
+ | MutationEvent
5350
5662
  | {
5351
5663
  type: 'ready'
5352
5664
  }
@@ -5398,14 +5710,18 @@ export declare const editorMachine: StateMachine<
5398
5710
  | {
5399
5711
  type: 'editable'
5400
5712
  }
5713
+ | {
5714
+ type: 'custom.*'
5715
+ event: CustomBehaviorEvent
5716
+ }
5401
5717
  >
5402
5718
  }
5403
- readonly 'focus': {
5719
+ readonly 'decorator.*': {
5404
5720
  readonly actions: ActionFunction<
5405
5721
  {
5406
5722
  behaviors: Set<Behavior>
5407
5723
  keyGenerator: () => string
5408
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5724
+ pendingEvents: Array<PatchEvent | MutationEvent>
5409
5725
  schema: EditorSchema
5410
5726
  initialReadOnly: boolean
5411
5727
  maxBlocks: number | undefined
@@ -5413,7 +5729,8 @@ export declare const editorMachine: StateMachine<
5413
5729
  value: Array<PortableTextBlock> | undefined
5414
5730
  },
5415
5731
  {
5416
- type: 'focus'
5732
+ type: 'decorator.toggle'
5733
+ decorator: string
5417
5734
  },
5418
5735
  | {
5419
5736
  type: 'annotation.add'
@@ -5468,7 +5785,7 @@ export declare const editorMachine: StateMachine<
5468
5785
  style: string
5469
5786
  }
5470
5787
  | PatchEvent
5471
- | MutationEvent_2
5788
+ | MutationEvent
5472
5789
  | {
5473
5790
  type: 'normalizing'
5474
5791
  }
@@ -5488,6 +5805,15 @@ export declare const editorMachine: StateMachine<
5488
5805
  preventDefault: () => void
5489
5806
  }
5490
5807
  }
5808
+ | {
5809
+ type: 'custom behavior event'
5810
+ behaviorEvent: CustomBehaviorEvent
5811
+ editor: PortableTextSlateEditor
5812
+ nativeEvent?: {
5813
+ preventDefault: () => void
5814
+ }
5815
+ }
5816
+ | CustomBehaviorEvent
5491
5817
  | {
5492
5818
  type: 'add behavior'
5493
5819
  behavior: Behavior
@@ -5557,6 +5883,10 @@ export declare const editorMachine: StateMachine<
5557
5883
  }
5558
5884
  | {
5559
5885
  type: 'done loading'
5886
+ }
5887
+ | {
5888
+ type: 'custom.*'
5889
+ event: CustomBehaviorEvent
5560
5890
  },
5561
5891
  undefined,
5562
5892
  never,
@@ -5616,7 +5946,7 @@ export declare const editorMachine: StateMachine<
5616
5946
  style: string
5617
5947
  }
5618
5948
  | PatchEvent
5619
- | MutationEvent_2
5949
+ | MutationEvent
5620
5950
  | {
5621
5951
  type: 'ready'
5622
5952
  }
@@ -5668,39 +5998,27 @@ export declare const editorMachine: StateMachine<
5668
5998
  | {
5669
5999
  type: 'editable'
5670
6000
  }
6001
+ | {
6002
+ type: 'custom.*'
6003
+ event: CustomBehaviorEvent
6004
+ }
5671
6005
  >
5672
6006
  }
5673
- readonly 'insert.*': {
6007
+ readonly 'focus': {
5674
6008
  readonly actions: ActionFunction<
5675
6009
  {
5676
6010
  behaviors: Set<Behavior>
5677
6011
  keyGenerator: () => string
5678
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6012
+ pendingEvents: Array<PatchEvent | MutationEvent>
5679
6013
  schema: EditorSchema
5680
6014
  initialReadOnly: boolean
5681
6015
  maxBlocks: number | undefined
5682
6016
  selection: EditorSelection
5683
6017
  value: Array<PortableTextBlock> | undefined
5684
6018
  },
5685
- | {
5686
- type: 'insert.block object'
5687
- placement: 'auto' | 'after' | 'before'
5688
- blockObject: {
5689
- name: string
5690
- value?: {
5691
- [prop: string]: unknown
5692
- }
5693
- }
5694
- }
5695
- | {
5696
- type: 'insert.inline object'
5697
- inlineObject: {
5698
- name: string
5699
- value?: {
5700
- [prop: string]: unknown
5701
- }
5702
- }
5703
- },
6019
+ {
6020
+ type: 'focus'
6021
+ },
5704
6022
  | {
5705
6023
  type: 'annotation.add'
5706
6024
  annotation: {
@@ -5754,7 +6072,7 @@ export declare const editorMachine: StateMachine<
5754
6072
  style: string
5755
6073
  }
5756
6074
  | PatchEvent
5757
- | MutationEvent_2
6075
+ | MutationEvent
5758
6076
  | {
5759
6077
  type: 'normalizing'
5760
6078
  }
@@ -5775,11 +6093,20 @@ export declare const editorMachine: StateMachine<
5775
6093
  }
5776
6094
  }
5777
6095
  | {
5778
- type: 'add behavior'
5779
- behavior: Behavior
5780
- }
5781
- | {
5782
- type: 'remove behavior'
6096
+ type: 'custom behavior event'
6097
+ behaviorEvent: CustomBehaviorEvent
6098
+ editor: PortableTextSlateEditor
6099
+ nativeEvent?: {
6100
+ preventDefault: () => void
6101
+ }
6102
+ }
6103
+ | CustomBehaviorEvent
6104
+ | {
6105
+ type: 'add behavior'
6106
+ behavior: Behavior
6107
+ }
6108
+ | {
6109
+ type: 'remove behavior'
5783
6110
  behavior: Behavior
5784
6111
  }
5785
6112
  | {
@@ -5843,6 +6170,10 @@ export declare const editorMachine: StateMachine<
5843
6170
  }
5844
6171
  | {
5845
6172
  type: 'done loading'
6173
+ }
6174
+ | {
6175
+ type: 'custom.*'
6176
+ event: CustomBehaviorEvent
5846
6177
  },
5847
6178
  undefined,
5848
6179
  never,
@@ -5902,7 +6233,7 @@ export declare const editorMachine: StateMachine<
5902
6233
  style: string
5903
6234
  }
5904
6235
  | PatchEvent
5905
- | MutationEvent_2
6236
+ | MutationEvent
5906
6237
  | {
5907
6238
  type: 'ready'
5908
6239
  }
@@ -5954,6 +6285,313 @@ export declare const editorMachine: StateMachine<
5954
6285
  | {
5955
6286
  type: 'editable'
5956
6287
  }
6288
+ | {
6289
+ type: 'custom.*'
6290
+ event: CustomBehaviorEvent
6291
+ }
6292
+ >
6293
+ }
6294
+ readonly 'insert.*': {
6295
+ readonly actions: ActionFunction<
6296
+ {
6297
+ behaviors: Set<Behavior>
6298
+ keyGenerator: () => string
6299
+ pendingEvents: Array<PatchEvent | MutationEvent>
6300
+ schema: EditorSchema
6301
+ initialReadOnly: boolean
6302
+ maxBlocks: number | undefined
6303
+ selection: EditorSelection
6304
+ value: Array<PortableTextBlock> | undefined
6305
+ },
6306
+ | {
6307
+ type: 'insert.block object'
6308
+ placement: 'auto' | 'after' | 'before'
6309
+ blockObject: {
6310
+ name: string
6311
+ value?: {
6312
+ [prop: string]: unknown
6313
+ }
6314
+ }
6315
+ }
6316
+ | {
6317
+ type: 'insert.inline object'
6318
+ inlineObject: {
6319
+ name: string
6320
+ value?: {
6321
+ [prop: string]: unknown
6322
+ }
6323
+ }
6324
+ },
6325
+ | {
6326
+ type: 'annotation.add'
6327
+ annotation: {
6328
+ name: string
6329
+ value: {
6330
+ [prop: string]: unknown
6331
+ }
6332
+ }
6333
+ }
6334
+ | {
6335
+ type: 'annotation.remove'
6336
+ annotation: {
6337
+ name: string
6338
+ }
6339
+ }
6340
+ | {
6341
+ type: 'blur'
6342
+ }
6343
+ | {
6344
+ type: 'decorator.toggle'
6345
+ decorator: string
6346
+ }
6347
+ | {
6348
+ type: 'focus'
6349
+ }
6350
+ | {
6351
+ type: 'insert.block object'
6352
+ placement: 'auto' | 'after' | 'before'
6353
+ blockObject: {
6354
+ name: string
6355
+ value?: {
6356
+ [prop: string]: unknown
6357
+ }
6358
+ }
6359
+ }
6360
+ | {
6361
+ type: 'insert.inline object'
6362
+ inlineObject: {
6363
+ name: string
6364
+ value?: {
6365
+ [prop: string]: unknown
6366
+ }
6367
+ }
6368
+ }
6369
+ | {
6370
+ type: 'list item.toggle'
6371
+ listItem: string
6372
+ }
6373
+ | {
6374
+ type: 'style.toggle'
6375
+ style: string
6376
+ }
6377
+ | PatchEvent
6378
+ | MutationEvent
6379
+ | {
6380
+ type: 'normalizing'
6381
+ }
6382
+ | {
6383
+ type: 'done normalizing'
6384
+ }
6385
+ | {
6386
+ type: 'done syncing initial value'
6387
+ }
6388
+ | {
6389
+ type: 'behavior event'
6390
+ behaviorEvent:
6391
+ | SyntheticBehaviorEvent
6392
+ | NativeBehaviorEvent
6393
+ editor: PortableTextSlateEditor
6394
+ nativeEvent?: {
6395
+ preventDefault: () => void
6396
+ }
6397
+ }
6398
+ | {
6399
+ type: 'custom behavior event'
6400
+ behaviorEvent: CustomBehaviorEvent
6401
+ editor: PortableTextSlateEditor
6402
+ nativeEvent?: {
6403
+ preventDefault: () => void
6404
+ }
6405
+ }
6406
+ | CustomBehaviorEvent
6407
+ | {
6408
+ type: 'add behavior'
6409
+ behavior: Behavior
6410
+ }
6411
+ | {
6412
+ type: 'remove behavior'
6413
+ behavior: Behavior
6414
+ }
6415
+ | {
6416
+ type: 'update readOnly'
6417
+ readOnly: boolean
6418
+ }
6419
+ | {
6420
+ type: 'update schema'
6421
+ schema: EditorSchema
6422
+ }
6423
+ | {
6424
+ type: 'update behaviors'
6425
+ behaviors: Array<Behavior>
6426
+ }
6427
+ | {
6428
+ type: 'update value'
6429
+ value: Array<PortableTextBlock> | undefined
6430
+ }
6431
+ | {
6432
+ type: 'update maxBlocks'
6433
+ maxBlocks: number | undefined
6434
+ }
6435
+ | PatchesEvent
6436
+ | {
6437
+ type: 'unset'
6438
+ previousValue: Array<PortableTextBlock>
6439
+ }
6440
+ | {
6441
+ type: 'value changed'
6442
+ value: Array<PortableTextBlock> | undefined
6443
+ }
6444
+ | {
6445
+ type: 'invalid value'
6446
+ resolution: InvalidValueResolution | null
6447
+ value: Array<PortableTextBlock> | undefined
6448
+ }
6449
+ | {
6450
+ type: 'error'
6451
+ name: string
6452
+ description: string
6453
+ data: unknown
6454
+ }
6455
+ | {
6456
+ type: 'select'
6457
+ selection: EditorSelection
6458
+ }
6459
+ | {
6460
+ type: 'selection'
6461
+ selection: EditorSelection
6462
+ }
6463
+ | {
6464
+ type: 'blurred'
6465
+ event: FocusEvent_2<HTMLDivElement, Element>
6466
+ }
6467
+ | {
6468
+ type: 'focused'
6469
+ event: FocusEvent_2<HTMLDivElement, Element>
6470
+ }
6471
+ | {
6472
+ type: 'loading'
6473
+ }
6474
+ | {
6475
+ type: 'done loading'
6476
+ }
6477
+ | {
6478
+ type: 'custom.*'
6479
+ event: CustomBehaviorEvent
6480
+ },
6481
+ undefined,
6482
+ never,
6483
+ never,
6484
+ never,
6485
+ never,
6486
+ | {
6487
+ type: 'annotation.add'
6488
+ annotation: {
6489
+ name: string
6490
+ value: {
6491
+ [prop: string]: unknown
6492
+ }
6493
+ }
6494
+ }
6495
+ | {
6496
+ type: 'annotation.remove'
6497
+ annotation: {
6498
+ name: string
6499
+ }
6500
+ }
6501
+ | {
6502
+ type: 'blur'
6503
+ }
6504
+ | {
6505
+ type: 'decorator.toggle'
6506
+ decorator: string
6507
+ }
6508
+ | {
6509
+ type: 'focus'
6510
+ }
6511
+ | {
6512
+ type: 'insert.block object'
6513
+ placement: 'auto' | 'after' | 'before'
6514
+ blockObject: {
6515
+ name: string
6516
+ value?: {
6517
+ [prop: string]: unknown
6518
+ }
6519
+ }
6520
+ }
6521
+ | {
6522
+ type: 'insert.inline object'
6523
+ inlineObject: {
6524
+ name: string
6525
+ value?: {
6526
+ [prop: string]: unknown
6527
+ }
6528
+ }
6529
+ }
6530
+ | {
6531
+ type: 'list item.toggle'
6532
+ listItem: string
6533
+ }
6534
+ | {
6535
+ type: 'style.toggle'
6536
+ style: string
6537
+ }
6538
+ | PatchEvent
6539
+ | MutationEvent
6540
+ | {
6541
+ type: 'ready'
6542
+ }
6543
+ | PatchesEvent
6544
+ | {
6545
+ type: 'unset'
6546
+ previousValue: Array<PortableTextBlock>
6547
+ }
6548
+ | {
6549
+ type: 'value changed'
6550
+ value: Array<PortableTextBlock> | undefined
6551
+ }
6552
+ | {
6553
+ type: 'invalid value'
6554
+ resolution: InvalidValueResolution | null
6555
+ value: Array<PortableTextBlock> | undefined
6556
+ }
6557
+ | {
6558
+ type: 'error'
6559
+ name: string
6560
+ description: string
6561
+ data: unknown
6562
+ }
6563
+ | {
6564
+ type: 'select'
6565
+ selection: EditorSelection
6566
+ }
6567
+ | {
6568
+ type: 'selection'
6569
+ selection: EditorSelection
6570
+ }
6571
+ | {
6572
+ type: 'blurred'
6573
+ event: FocusEvent_2<HTMLDivElement, Element>
6574
+ }
6575
+ | {
6576
+ type: 'focused'
6577
+ event: FocusEvent_2<HTMLDivElement, Element>
6578
+ }
6579
+ | {
6580
+ type: 'loading'
6581
+ }
6582
+ | {
6583
+ type: 'done loading'
6584
+ }
6585
+ | {
6586
+ type: 'read only'
6587
+ }
6588
+ | {
6589
+ type: 'editable'
6590
+ }
6591
+ | {
6592
+ type: 'custom.*'
6593
+ event: CustomBehaviorEvent
6594
+ }
5957
6595
  >
5958
6596
  }
5959
6597
  readonly 'list item.*': {
@@ -5961,7 +6599,7 @@ export declare const editorMachine: StateMachine<
5961
6599
  {
5962
6600
  behaviors: Set<Behavior>
5963
6601
  keyGenerator: () => string
5964
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6602
+ pendingEvents: Array<PatchEvent | MutationEvent>
5965
6603
  schema: EditorSchema
5966
6604
  initialReadOnly: boolean
5967
6605
  maxBlocks: number | undefined
@@ -6025,7 +6663,7 @@ export declare const editorMachine: StateMachine<
6025
6663
  style: string
6026
6664
  }
6027
6665
  | PatchEvent
6028
- | MutationEvent_2
6666
+ | MutationEvent
6029
6667
  | {
6030
6668
  type: 'normalizing'
6031
6669
  }
@@ -6045,6 +6683,15 @@ export declare const editorMachine: StateMachine<
6045
6683
  preventDefault: () => void
6046
6684
  }
6047
6685
  }
6686
+ | {
6687
+ type: 'custom behavior event'
6688
+ behaviorEvent: CustomBehaviorEvent
6689
+ editor: PortableTextSlateEditor
6690
+ nativeEvent?: {
6691
+ preventDefault: () => void
6692
+ }
6693
+ }
6694
+ | CustomBehaviorEvent
6048
6695
  | {
6049
6696
  type: 'add behavior'
6050
6697
  behavior: Behavior
@@ -6114,6 +6761,10 @@ export declare const editorMachine: StateMachine<
6114
6761
  }
6115
6762
  | {
6116
6763
  type: 'done loading'
6764
+ }
6765
+ | {
6766
+ type: 'custom.*'
6767
+ event: CustomBehaviorEvent
6117
6768
  },
6118
6769
  undefined,
6119
6770
  never,
@@ -6173,7 +6824,7 @@ export declare const editorMachine: StateMachine<
6173
6824
  style: string
6174
6825
  }
6175
6826
  | PatchEvent
6176
- | MutationEvent_2
6827
+ | MutationEvent
6177
6828
  | {
6178
6829
  type: 'ready'
6179
6830
  }
@@ -6225,6 +6876,10 @@ export declare const editorMachine: StateMachine<
6225
6876
  | {
6226
6877
  type: 'editable'
6227
6878
  }
6879
+ | {
6880
+ type: 'custom.*'
6881
+ event: CustomBehaviorEvent
6882
+ }
6228
6883
  >
6229
6884
  }
6230
6885
  readonly 'select': {
@@ -6232,7 +6887,7 @@ export declare const editorMachine: StateMachine<
6232
6887
  {
6233
6888
  behaviors: Set<Behavior>
6234
6889
  keyGenerator: () => string
6235
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6890
+ pendingEvents: Array<PatchEvent | MutationEvent>
6236
6891
  schema: EditorSchema
6237
6892
  initialReadOnly: boolean
6238
6893
  maxBlocks: number | undefined
@@ -6296,7 +6951,7 @@ export declare const editorMachine: StateMachine<
6296
6951
  style: string
6297
6952
  }
6298
6953
  | PatchEvent
6299
- | MutationEvent_2
6954
+ | MutationEvent
6300
6955
  | {
6301
6956
  type: 'normalizing'
6302
6957
  }
@@ -6316,6 +6971,15 @@ export declare const editorMachine: StateMachine<
6316
6971
  preventDefault: () => void
6317
6972
  }
6318
6973
  }
6974
+ | {
6975
+ type: 'custom behavior event'
6976
+ behaviorEvent: CustomBehaviorEvent
6977
+ editor: PortableTextSlateEditor
6978
+ nativeEvent?: {
6979
+ preventDefault: () => void
6980
+ }
6981
+ }
6982
+ | CustomBehaviorEvent
6319
6983
  | {
6320
6984
  type: 'add behavior'
6321
6985
  behavior: Behavior
@@ -6385,6 +7049,10 @@ export declare const editorMachine: StateMachine<
6385
7049
  }
6386
7050
  | {
6387
7051
  type: 'done loading'
7052
+ }
7053
+ | {
7054
+ type: 'custom.*'
7055
+ event: CustomBehaviorEvent
6388
7056
  },
6389
7057
  undefined,
6390
7058
  never,
@@ -6444,7 +7112,7 @@ export declare const editorMachine: StateMachine<
6444
7112
  style: string
6445
7113
  }
6446
7114
  | PatchEvent
6447
- | MutationEvent_2
7115
+ | MutationEvent
6448
7116
  | {
6449
7117
  type: 'ready'
6450
7118
  }
@@ -6496,6 +7164,10 @@ export declare const editorMachine: StateMachine<
6496
7164
  | {
6497
7165
  type: 'editable'
6498
7166
  }
7167
+ | {
7168
+ type: 'custom.*'
7169
+ event: CustomBehaviorEvent
7170
+ }
6499
7171
  >
6500
7172
  }
6501
7173
  readonly 'style.*': {
@@ -6503,7 +7175,7 @@ export declare const editorMachine: StateMachine<
6503
7175
  {
6504
7176
  behaviors: Set<Behavior>
6505
7177
  keyGenerator: () => string
6506
- pendingEvents: Array<PatchEvent | MutationEvent_2>
7178
+ pendingEvents: Array<PatchEvent | MutationEvent>
6507
7179
  schema: EditorSchema
6508
7180
  initialReadOnly: boolean
6509
7181
  maxBlocks: number | undefined
@@ -6567,7 +7239,7 @@ export declare const editorMachine: StateMachine<
6567
7239
  style: string
6568
7240
  }
6569
7241
  | PatchEvent
6570
- | MutationEvent_2
7242
+ | MutationEvent
6571
7243
  | {
6572
7244
  type: 'normalizing'
6573
7245
  }
@@ -6587,6 +7259,15 @@ export declare const editorMachine: StateMachine<
6587
7259
  preventDefault: () => void
6588
7260
  }
6589
7261
  }
7262
+ | {
7263
+ type: 'custom behavior event'
7264
+ behaviorEvent: CustomBehaviorEvent
7265
+ editor: PortableTextSlateEditor
7266
+ nativeEvent?: {
7267
+ preventDefault: () => void
7268
+ }
7269
+ }
7270
+ | CustomBehaviorEvent
6590
7271
  | {
6591
7272
  type: 'add behavior'
6592
7273
  behavior: Behavior
@@ -6656,6 +7337,10 @@ export declare const editorMachine: StateMachine<
6656
7337
  }
6657
7338
  | {
6658
7339
  type: 'done loading'
7340
+ }
7341
+ | {
7342
+ type: 'custom.*'
7343
+ event: CustomBehaviorEvent
6659
7344
  },
6660
7345
  undefined,
6661
7346
  never,
@@ -6715,7 +7400,7 @@ export declare const editorMachine: StateMachine<
6715
7400
  style: string
6716
7401
  }
6717
7402
  | PatchEvent
6718
- | MutationEvent_2
7403
+ | MutationEvent
6719
7404
  | {
6720
7405
  type: 'ready'
6721
7406
  }
@@ -6767,6 +7452,10 @@ export declare const editorMachine: StateMachine<
6767
7452
  | {
6768
7453
  type: 'editable'
6769
7454
  }
7455
+ | {
7456
+ type: 'custom.*'
7457
+ event: CustomBehaviorEvent
7458
+ }
6770
7459
  >
6771
7460
  }
6772
7461
  }
@@ -6948,7 +7637,7 @@ export declare type InternalEditorEmittedEvent =
6948
7637
  }
6949
7638
  | PatchEvent
6950
7639
  | PatchesEvent
6951
- | MutationEvent_2
7640
+ | MutationEvent
6952
7641
  | {
6953
7642
  type: 'unset'
6954
7643
  previousValue: Array<PortableTextBlock>
@@ -7009,6 +7698,10 @@ export declare type InternalEditorEmittedEvent =
7009
7698
  | 'focus'
7010
7699
  | 'style.toggle'
7011
7700
  >
7701
+ | {
7702
+ type: 'custom.*'
7703
+ event: CustomBehaviorEvent
7704
+ }
7012
7705
 
7013
7706
  /**
7014
7707
  * @internal
@@ -7031,6 +7724,15 @@ export declare type InternalEditorEvent =
7031
7724
  preventDefault: () => void
7032
7725
  }
7033
7726
  }
7727
+ | {
7728
+ type: 'custom behavior event'
7729
+ behaviorEvent: CustomBehaviorEvent
7730
+ editor: PortableTextSlateEditor
7731
+ nativeEvent?: {
7732
+ preventDefault: () => void
7733
+ }
7734
+ }
7735
+ | CustomBehaviorEvent
7034
7736
  | {
7035
7737
  type: 'add behavior'
7036
7738
  behavior: Behavior
@@ -7123,7 +7825,7 @@ export declare type MutationChange = {
7123
7825
  /**
7124
7826
  * @internal
7125
7827
  */
7126
- declare type MutationEvent_2 = {
7828
+ export declare type MutationEvent = {
7127
7829
  type: 'mutation'
7128
7830
  patches: Array<Patch>
7129
7831
  /**
@@ -7132,7 +7834,6 @@ declare type MutationEvent_2 = {
7132
7834
  snapshot: Array<PortableTextBlock> | undefined
7133
7835
  value: Array<PortableTextBlock> | undefined
7134
7836
  }
7135
- export {MutationEvent_2 as MutationEvent}
7136
7837
 
7137
7838
  /**
7138
7839
  * @beta
@@ -7345,9 +8046,9 @@ export declare class PortableTextEditor extends Component<
7345
8046
  path: Path,
7346
8047
  ) => [
7347
8048
  (
7348
- | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
7349
- | PortableTextObject
7350
8049
  | PortableTextSpan
8050
+ | PortableTextObject
8051
+ | PortableTextTextBlock<PortableTextSpan | PortableTextObject>
7351
8052
  | undefined
7352
8053
  ),
7353
8054
  Path | undefined,
@@ -7543,6 +8244,8 @@ export declare interface PortableTextSlateEditor extends ReactEditor {
7543
8244
  redo: () => void
7544
8245
  }
7545
8246
 
8247
+ export {PortableTextSpan}
8248
+
7546
8249
  /**
7547
8250
  * A range decoration is a UI affordance that wraps a given selection range in the editor
7548
8251
  * with a custom component. This can be used to highlight search results,