@portabletext/editor 1.19.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 (132) 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/selector.is-selection-collapsed.cjs.map +1 -1
  6. package/lib/_chunks-cjs/util.get-block-start-point.cjs +30 -0
  7. package/lib/_chunks-cjs/util.get-block-start-point.cjs.map +1 -0
  8. package/lib/_chunks-cjs/util.is-empty-text-block.cjs +71 -0
  9. package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -0
  10. package/lib/_chunks-cjs/util.is-keyed-segment.cjs +6 -0
  11. package/lib/_chunks-cjs/util.is-keyed-segment.cjs.map +1 -0
  12. package/lib/_chunks-es/behavior.core.js +7 -66
  13. package/lib/_chunks-es/behavior.core.js.map +1 -1
  14. package/lib/_chunks-es/selector.get-text-before.js +5 -31
  15. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  16. package/lib/_chunks-es/selector.is-selection-collapsed.js.map +1 -1
  17. package/lib/_chunks-es/util.get-block-start-point.js +31 -0
  18. package/lib/_chunks-es/util.get-block-start-point.js.map +1 -0
  19. package/lib/_chunks-es/util.is-empty-text-block.js +73 -0
  20. package/lib/_chunks-es/util.is-empty-text-block.js.map +1 -0
  21. package/lib/_chunks-es/util.is-keyed-segment.js +7 -0
  22. package/lib/_chunks-es/util.is-keyed-segment.js.map +1 -0
  23. package/lib/behaviors/index.cjs +7 -7
  24. package/lib/behaviors/index.cjs.map +1 -1
  25. package/lib/behaviors/index.d.cts +179 -119
  26. package/lib/behaviors/index.d.ts +179 -119
  27. package/lib/behaviors/index.js +3 -2
  28. package/lib/behaviors/index.js.map +1 -1
  29. package/lib/index.cjs +72 -177
  30. package/lib/index.cjs.map +1 -1
  31. package/lib/index.d.cts +1061 -140
  32. package/lib/index.d.ts +1061 -140
  33. package/lib/index.js +72 -177
  34. package/lib/index.js.map +1 -1
  35. package/lib/selectors/index.cjs +73 -1
  36. package/lib/selectors/index.cjs.map +1 -1
  37. package/lib/selectors/index.d.cts +14 -0
  38. package/lib/selectors/index.d.ts +14 -0
  39. package/lib/selectors/index.js +73 -0
  40. package/lib/selectors/index.js.map +1 -1
  41. package/lib/utils/index.cjs +11 -0
  42. package/lib/utils/index.cjs.map +1 -0
  43. package/lib/utils/index.d.cts +87 -0
  44. package/lib/utils/index.d.ts +87 -0
  45. package/lib/utils/index.js +13 -0
  46. package/lib/utils/index.js.map +1 -0
  47. package/package.json +18 -14
  48. package/src/behavior-actions/behavior.action-utils.insert-block.ts +1 -1
  49. package/src/behavior-actions/behavior.action.insert-block-object.ts +1 -1
  50. package/src/behavior-actions/behavior.action.insert-inline-object.ts +1 -1
  51. package/src/behavior-actions/behavior.action.text-block.set.ts +1 -1
  52. package/src/behavior-actions/behavior.action.text-block.unset.ts +1 -1
  53. package/src/behavior-actions/behavior.actions.ts +5 -5
  54. package/src/behaviors/behavior.code-editor.ts +1 -1
  55. package/src/behaviors/behavior.core.block-objects.ts +2 -2
  56. package/src/behaviors/behavior.core.decorators.ts +1 -1
  57. package/src/behaviors/behavior.core.lists.ts +2 -2
  58. package/src/behaviors/behavior.emoji-picker.ts +1 -1
  59. package/src/behaviors/behavior.links.ts +1 -1
  60. package/src/behaviors/behavior.markdown.ts +2 -2
  61. package/src/behaviors/behavior.types.ts +52 -19
  62. package/src/behaviors/index.ts +1 -0
  63. package/src/editor/Editable.tsx +12 -12
  64. package/src/editor/PortableTextEditor.tsx +2 -2
  65. package/src/editor/components/DraggableBlock.tsx +2 -2
  66. package/src/editor/components/Element.tsx +20 -26
  67. package/src/editor/components/Leaf.tsx +1 -1
  68. package/src/editor/components/Synchronizer.tsx +1 -1
  69. package/src/editor/create-editor.ts +39 -20
  70. package/src/editor/create-slate-editor.tsx +5 -2
  71. package/src/editor/editor-machine.ts +72 -18
  72. package/src/editor/get-value.ts +2 -2
  73. package/src/editor/hooks/usePortableTextEditorSelection.tsx +1 -1
  74. package/src/editor/mutation-machine.ts +2 -2
  75. package/src/editor/nodes/DefaultObject.tsx +2 -2
  76. package/src/editor/plugins/create-with-event-listeners.ts +11 -3
  77. package/src/editor/plugins/createWithEditableAPI.ts +7 -7
  78. package/src/editor/plugins/createWithHotKeys.ts +2 -2
  79. package/src/editor/plugins/createWithInsertData.ts +7 -7
  80. package/src/editor/plugins/createWithMaxBlocks.ts +2 -2
  81. package/src/editor/plugins/createWithObjectKeys.ts +2 -2
  82. package/src/editor/plugins/createWithPatches.ts +10 -10
  83. package/src/editor/plugins/createWithPlaceholderBlock.ts +3 -3
  84. package/src/editor/plugins/createWithPortableTextBlockStyle.ts +1 -1
  85. package/src/editor/plugins/createWithPortableTextMarkModel.ts +4 -4
  86. package/src/editor/plugins/createWithPortableTextSelections.ts +6 -6
  87. package/src/editor/plugins/createWithSchemaTypes.ts +1 -1
  88. package/src/editor/plugins/createWithUndoRedo.ts +5 -5
  89. package/src/editor/plugins/createWithUtils.ts +2 -2
  90. package/src/editor/plugins/with-plugins.ts +1 -1
  91. package/src/editor/sync-machine.ts +8 -5
  92. package/src/index.ts +5 -1
  93. package/src/selectors/index.ts +2 -0
  94. package/src/selectors/selector.get-selection-text.test.ts +75 -0
  95. package/src/selectors/selector.get-selection-text.ts +3 -3
  96. package/src/selectors/selector.get-text-before.ts +7 -4
  97. package/src/selectors/selector.is-point-after-selection.ts +82 -0
  98. package/src/selectors/selector.is-point-before-selection.ts +82 -0
  99. package/src/utils/_exports/index.ts +1 -0
  100. package/src/utils/index.ts +11 -0
  101. package/src/{editor/utils/utils.block-offset.test.ts → utils/util.block-offset.test.ts} +1 -1
  102. package/src/{editor/utils/utils.block-offset.ts → utils/util.block-offset.ts} +23 -7
  103. package/src/{editor/utils/utils.get-start-point.ts → utils/util.get-block-start-point.ts} +5 -2
  104. package/src/utils/util.get-text-block-text.ts +8 -0
  105. package/src/{editor/utils/utils.ts → utils/util.is-empty-text-block.ts} +4 -5
  106. package/src/{editor/utils/utils.is-keyed-segment.ts → utils/util.is-keyed-segment.ts} +3 -0
  107. package/src/{editor/utils/utils.reverse-selection.ts → utils/util.reverse-selection.ts} +4 -1
  108. package/src/editor/nodes/index.ts +0 -189
  109. /package/src/{utils → internal-utils}/__tests__/dmpToOperations.test.ts +0 -0
  110. /package/src/{utils → internal-utils}/__tests__/operationToPatches.test.ts +0 -0
  111. /package/src/{utils → internal-utils}/__tests__/patchToOperations.test.ts +0 -0
  112. /package/src/{utils → internal-utils}/__tests__/ranges.test.ts +0 -0
  113. /package/src/{utils → internal-utils}/__tests__/valueNormalization.test.tsx +0 -0
  114. /package/src/{utils → internal-utils}/__tests__/values.test.ts +0 -0
  115. /package/src/{utils → internal-utils}/applyPatch.ts +0 -0
  116. /package/src/{utils → internal-utils}/debug.ts +0 -0
  117. /package/src/{utils → internal-utils}/is-hotkey.test.ts +0 -0
  118. /package/src/{utils → internal-utils}/is-hotkey.ts +0 -0
  119. /package/src/{utils → internal-utils}/looks-like-url.test.ts +0 -0
  120. /package/src/{utils → internal-utils}/looks-like-url.ts +0 -0
  121. /package/src/{utils → internal-utils}/operationToPatches.ts +0 -0
  122. /package/src/{utils → internal-utils}/paths.ts +0 -0
  123. /package/src/{utils → internal-utils}/ranges.ts +0 -0
  124. /package/src/{utils → internal-utils}/schema.ts +0 -0
  125. /package/src/{utils → internal-utils}/selection.ts +0 -0
  126. /package/src/{utils → internal-utils}/sibling-utils.ts +0 -0
  127. /package/src/{utils → internal-utils}/validateValue.ts +0 -0
  128. /package/src/{utils → internal-utils}/values.ts +0 -0
  129. /package/src/{utils → internal-utils}/weakMaps.ts +0 -0
  130. /package/src/{utils → internal-utils}/withChanges.ts +0 -0
  131. /package/src/{utils → internal-utils}/withUndoRedo.ts +0 -0
  132. /package/src/{utils → internal-utils}/withoutPatching.ts +0 -0
package/lib/index.d.cts 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
  */
@@ -469,6 +476,10 @@ export declare interface EditableAPIDeleteOptions {
469
476
  */
470
477
  export declare type Editor = {
471
478
  getSnapshot: () => EditorSnapshot
479
+ /**
480
+ * @beta
481
+ */
482
+ registerBehavior: (config: {behavior: Behavior}) => () => void
472
483
  send: (event: EditorEvent) => void
473
484
  on: ActorRef<Snapshot<unknown>, EventObject, EditorEmittedEvent>['on']
474
485
  _internal: {
@@ -568,24 +579,26 @@ export declare type EditorEmittedEvent = PickFromUnion<
568
579
  /**
569
580
  * @public
570
581
  */
571
- export declare type EditorEvent = PickFromUnion<
572
- InternalEditorEvent,
573
- 'type',
574
- | 'annotation.add'
575
- | 'annotation.remove'
576
- | 'blur'
577
- | 'decorator.toggle'
578
- | 'focus'
579
- | 'insert.block object'
580
- | 'insert.inline object'
581
- | 'list item.toggle'
582
- | 'select'
583
- | 'style.toggle'
584
- | 'patches'
585
- | 'update behaviors'
586
- | 'update readOnly'
587
- | 'update value'
588
- >
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
589
602
 
590
603
  /**
591
604
  * @public
@@ -599,9 +612,9 @@ export declare function EditorEventListener(props: {
599
612
  */
600
613
  export declare const editorMachine: StateMachine<
601
614
  {
602
- behaviors: Array<Behavior>
615
+ behaviors: Set<Behavior>
603
616
  keyGenerator: () => string
604
- pendingEvents: Array<PatchEvent | MutationEvent_2>
617
+ pendingEvents: Array<PatchEvent | MutationEvent>
605
618
  schema: EditorSchema
606
619
  initialReadOnly: boolean
607
620
  maxBlocks: number | undefined
@@ -661,7 +674,7 @@ export declare const editorMachine: StateMachine<
661
674
  style: string
662
675
  }
663
676
  | PatchEvent
664
- | MutationEvent_2
677
+ | MutationEvent
665
678
  | {
666
679
  type: 'normalizing'
667
680
  }
@@ -679,6 +692,23 @@ export declare const editorMachine: StateMachine<
679
692
  preventDefault: () => void
680
693
  }
681
694
  }
695
+ | {
696
+ type: 'custom behavior event'
697
+ behaviorEvent: CustomBehaviorEvent
698
+ editor: PortableTextSlateEditor
699
+ nativeEvent?: {
700
+ preventDefault: () => void
701
+ }
702
+ }
703
+ | CustomBehaviorEvent
704
+ | {
705
+ type: 'add behavior'
706
+ behavior: Behavior
707
+ }
708
+ | {
709
+ type: 'remove behavior'
710
+ behavior: Behavior
711
+ }
682
712
  | {
683
713
  type: 'update readOnly'
684
714
  readOnly: boolean
@@ -740,10 +770,22 @@ export declare const editorMachine: StateMachine<
740
770
  }
741
771
  | {
742
772
  type: 'done loading'
773
+ }
774
+ | {
775
+ type: 'custom.*'
776
+ event: CustomBehaviorEvent
743
777
  },
744
778
  {},
745
779
  never,
746
780
  Values<{
781
+ 'add behavior to context': {
782
+ type: 'add behavior to context'
783
+ params: NonReducibleUnknown
784
+ }
785
+ 'remove behavior from context': {
786
+ type: 'remove behavior from context'
787
+ params: NonReducibleUnknown
788
+ }
747
789
  'assign behaviors': {
748
790
  type: 'assign behaviors'
749
791
  params: NonReducibleUnknown
@@ -867,7 +909,7 @@ export declare const editorMachine: StateMachine<
867
909
  style: string
868
910
  }
869
911
  | PatchEvent
870
- | MutationEvent_2
912
+ | MutationEvent
871
913
  | {
872
914
  type: 'ready'
873
915
  }
@@ -918,6 +960,10 @@ export declare const editorMachine: StateMachine<
918
960
  }
919
961
  | {
920
962
  type: 'editable'
963
+ }
964
+ | {
965
+ type: 'custom.*'
966
+ event: CustomBehaviorEvent
921
967
  },
922
968
  MetaObject,
923
969
  {
@@ -958,9 +1004,9 @@ export declare const editorMachine: StateMachine<
958
1004
  self: ActorRef<
959
1005
  MachineSnapshot<
960
1006
  {
961
- behaviors: Array<Behavior>
1007
+ behaviors: Set<Behavior>
962
1008
  keyGenerator: () => string
963
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1009
+ pendingEvents: Array<PatchEvent | MutationEvent>
964
1010
  schema: EditorSchema
965
1011
  initialReadOnly: boolean
966
1012
  maxBlocks: number | undefined
@@ -1020,7 +1066,7 @@ export declare const editorMachine: StateMachine<
1020
1066
  style: string
1021
1067
  }
1022
1068
  | PatchEvent
1023
- | MutationEvent_2
1069
+ | MutationEvent
1024
1070
  | {
1025
1071
  type: 'normalizing'
1026
1072
  }
@@ -1038,6 +1084,23 @@ export declare const editorMachine: StateMachine<
1038
1084
  preventDefault: () => void
1039
1085
  }
1040
1086
  }
1087
+ | {
1088
+ type: 'custom behavior event'
1089
+ behaviorEvent: CustomBehaviorEvent
1090
+ editor: PortableTextSlateEditor
1091
+ nativeEvent?: {
1092
+ preventDefault: () => void
1093
+ }
1094
+ }
1095
+ | CustomBehaviorEvent
1096
+ | {
1097
+ type: 'add behavior'
1098
+ behavior: Behavior
1099
+ }
1100
+ | {
1101
+ type: 'remove behavior'
1102
+ behavior: Behavior
1103
+ }
1041
1104
  | {
1042
1105
  type: 'update readOnly'
1043
1106
  readOnly: boolean
@@ -1099,6 +1162,10 @@ export declare const editorMachine: StateMachine<
1099
1162
  }
1100
1163
  | {
1101
1164
  type: 'done loading'
1165
+ }
1166
+ | {
1167
+ type: 'custom.*'
1168
+ event: CustomBehaviorEvent
1102
1169
  },
1103
1170
  Record<string, AnyActorRef | undefined>,
1104
1171
  StateValue,
@@ -1160,7 +1227,7 @@ export declare const editorMachine: StateMachine<
1160
1227
  style: string
1161
1228
  }
1162
1229
  | PatchEvent
1163
- | MutationEvent_2
1230
+ | MutationEvent
1164
1231
  | {
1165
1232
  type: 'normalizing'
1166
1233
  }
@@ -1178,6 +1245,23 @@ export declare const editorMachine: StateMachine<
1178
1245
  preventDefault: () => void
1179
1246
  }
1180
1247
  }
1248
+ | {
1249
+ type: 'custom behavior event'
1250
+ behaviorEvent: CustomBehaviorEvent
1251
+ editor: PortableTextSlateEditor
1252
+ nativeEvent?: {
1253
+ preventDefault: () => void
1254
+ }
1255
+ }
1256
+ | CustomBehaviorEvent
1257
+ | {
1258
+ type: 'add behavior'
1259
+ behavior: Behavior
1260
+ }
1261
+ | {
1262
+ type: 'remove behavior'
1263
+ behavior: Behavior
1264
+ }
1181
1265
  | {
1182
1266
  type: 'update readOnly'
1183
1267
  readOnly: boolean
@@ -1239,26 +1323,36 @@ export declare const editorMachine: StateMachine<
1239
1323
  }
1240
1324
  | {
1241
1325
  type: 'done loading'
1326
+ }
1327
+ | {
1328
+ type: 'custom.*'
1329
+ event: CustomBehaviorEvent
1242
1330
  },
1243
1331
  AnyEventObject
1244
1332
  >
1245
1333
  }) => {
1246
- behaviors: Behavior[]
1334
+ behaviors: Set<Behavior>
1247
1335
  keyGenerator: () => string
1248
1336
  pendingEvents: never[]
1249
- schema: PortableTextMemberSchemaTypes
1337
+ schema: PortableTextMemberSchemaTypes_2
1250
1338
  selection: null
1251
1339
  initialReadOnly: boolean
1252
1340
  maxBlocks: number | undefined
1253
1341
  value: PortableTextBlock[] | undefined
1254
1342
  }
1255
1343
  readonly on: {
1344
+ readonly 'add behavior': {
1345
+ readonly actions: 'add behavior to context'
1346
+ }
1347
+ readonly 'remove behavior': {
1348
+ readonly actions: 'remove behavior from context'
1349
+ }
1256
1350
  readonly 'unset': {
1257
1351
  readonly actions: ActionFunction<
1258
1352
  {
1259
- behaviors: Array<Behavior>
1353
+ behaviors: Set<Behavior>
1260
1354
  keyGenerator: () => string
1261
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1355
+ pendingEvents: Array<PatchEvent | MutationEvent>
1262
1356
  schema: EditorSchema
1263
1357
  initialReadOnly: boolean
1264
1358
  maxBlocks: number | undefined
@@ -1322,7 +1416,7 @@ export declare const editorMachine: StateMachine<
1322
1416
  style: string
1323
1417
  }
1324
1418
  | PatchEvent
1325
- | MutationEvent_2
1419
+ | MutationEvent
1326
1420
  | {
1327
1421
  type: 'normalizing'
1328
1422
  }
@@ -1340,6 +1434,23 @@ export declare const editorMachine: StateMachine<
1340
1434
  preventDefault: () => void
1341
1435
  }
1342
1436
  }
1437
+ | {
1438
+ type: 'custom behavior event'
1439
+ behaviorEvent: CustomBehaviorEvent
1440
+ editor: PortableTextSlateEditor
1441
+ nativeEvent?: {
1442
+ preventDefault: () => void
1443
+ }
1444
+ }
1445
+ | CustomBehaviorEvent
1446
+ | {
1447
+ type: 'add behavior'
1448
+ behavior: Behavior
1449
+ }
1450
+ | {
1451
+ type: 'remove behavior'
1452
+ behavior: Behavior
1453
+ }
1343
1454
  | {
1344
1455
  type: 'update readOnly'
1345
1456
  readOnly: boolean
@@ -1401,6 +1512,10 @@ export declare const editorMachine: StateMachine<
1401
1512
  }
1402
1513
  | {
1403
1514
  type: 'done loading'
1515
+ }
1516
+ | {
1517
+ type: 'custom.*'
1518
+ event: CustomBehaviorEvent
1404
1519
  },
1405
1520
  undefined,
1406
1521
  never,
@@ -1460,7 +1575,7 @@ export declare const editorMachine: StateMachine<
1460
1575
  style: string
1461
1576
  }
1462
1577
  | PatchEvent
1463
- | MutationEvent_2
1578
+ | MutationEvent
1464
1579
  | {
1465
1580
  type: 'ready'
1466
1581
  }
@@ -1512,14 +1627,18 @@ export declare const editorMachine: StateMachine<
1512
1627
  | {
1513
1628
  type: 'editable'
1514
1629
  }
1630
+ | {
1631
+ type: 'custom.*'
1632
+ event: CustomBehaviorEvent
1633
+ }
1515
1634
  >
1516
1635
  }
1517
1636
  readonly 'value changed': {
1518
1637
  readonly actions: ActionFunction<
1519
1638
  {
1520
- behaviors: Array<Behavior>
1639
+ behaviors: Set<Behavior>
1521
1640
  keyGenerator: () => string
1522
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1641
+ pendingEvents: Array<PatchEvent | MutationEvent>
1523
1642
  schema: EditorSchema
1524
1643
  initialReadOnly: boolean
1525
1644
  maxBlocks: number | undefined
@@ -1583,7 +1702,7 @@ export declare const editorMachine: StateMachine<
1583
1702
  style: string
1584
1703
  }
1585
1704
  | PatchEvent
1586
- | MutationEvent_2
1705
+ | MutationEvent
1587
1706
  | {
1588
1707
  type: 'normalizing'
1589
1708
  }
@@ -1601,6 +1720,23 @@ export declare const editorMachine: StateMachine<
1601
1720
  preventDefault: () => void
1602
1721
  }
1603
1722
  }
1723
+ | {
1724
+ type: 'custom behavior event'
1725
+ behaviorEvent: CustomBehaviorEvent
1726
+ editor: PortableTextSlateEditor
1727
+ nativeEvent?: {
1728
+ preventDefault: () => void
1729
+ }
1730
+ }
1731
+ | CustomBehaviorEvent
1732
+ | {
1733
+ type: 'add behavior'
1734
+ behavior: Behavior
1735
+ }
1736
+ | {
1737
+ type: 'remove behavior'
1738
+ behavior: Behavior
1739
+ }
1604
1740
  | {
1605
1741
  type: 'update readOnly'
1606
1742
  readOnly: boolean
@@ -1662,6 +1798,10 @@ export declare const editorMachine: StateMachine<
1662
1798
  }
1663
1799
  | {
1664
1800
  type: 'done loading'
1801
+ }
1802
+ | {
1803
+ type: 'custom.*'
1804
+ event: CustomBehaviorEvent
1665
1805
  },
1666
1806
  undefined,
1667
1807
  never,
@@ -1721,7 +1861,7 @@ export declare const editorMachine: StateMachine<
1721
1861
  style: string
1722
1862
  }
1723
1863
  | PatchEvent
1724
- | MutationEvent_2
1864
+ | MutationEvent
1725
1865
  | {
1726
1866
  type: 'ready'
1727
1867
  }
@@ -1773,14 +1913,18 @@ export declare const editorMachine: StateMachine<
1773
1913
  | {
1774
1914
  type: 'editable'
1775
1915
  }
1916
+ | {
1917
+ type: 'custom.*'
1918
+ event: CustomBehaviorEvent
1919
+ }
1776
1920
  >
1777
1921
  }
1778
1922
  readonly 'invalid value': {
1779
1923
  readonly actions: ActionFunction<
1780
1924
  {
1781
- behaviors: Array<Behavior>
1925
+ behaviors: Set<Behavior>
1782
1926
  keyGenerator: () => string
1783
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1927
+ pendingEvents: Array<PatchEvent | MutationEvent>
1784
1928
  schema: EditorSchema
1785
1929
  initialReadOnly: boolean
1786
1930
  maxBlocks: number | undefined
@@ -1845,7 +1989,7 @@ export declare const editorMachine: StateMachine<
1845
1989
  style: string
1846
1990
  }
1847
1991
  | PatchEvent
1848
- | MutationEvent_2
1992
+ | MutationEvent
1849
1993
  | {
1850
1994
  type: 'normalizing'
1851
1995
  }
@@ -1863,6 +2007,23 @@ export declare const editorMachine: StateMachine<
1863
2007
  preventDefault: () => void
1864
2008
  }
1865
2009
  }
2010
+ | {
2011
+ type: 'custom behavior event'
2012
+ behaviorEvent: CustomBehaviorEvent
2013
+ editor: PortableTextSlateEditor
2014
+ nativeEvent?: {
2015
+ preventDefault: () => void
2016
+ }
2017
+ }
2018
+ | CustomBehaviorEvent
2019
+ | {
2020
+ type: 'add behavior'
2021
+ behavior: Behavior
2022
+ }
2023
+ | {
2024
+ type: 'remove behavior'
2025
+ behavior: Behavior
2026
+ }
1866
2027
  | {
1867
2028
  type: 'update readOnly'
1868
2029
  readOnly: boolean
@@ -1924,6 +2085,10 @@ export declare const editorMachine: StateMachine<
1924
2085
  }
1925
2086
  | {
1926
2087
  type: 'done loading'
2088
+ }
2089
+ | {
2090
+ type: 'custom.*'
2091
+ event: CustomBehaviorEvent
1927
2092
  },
1928
2093
  undefined,
1929
2094
  never,
@@ -1983,7 +2148,7 @@ export declare const editorMachine: StateMachine<
1983
2148
  style: string
1984
2149
  }
1985
2150
  | PatchEvent
1986
- | MutationEvent_2
2151
+ | MutationEvent
1987
2152
  | {
1988
2153
  type: 'ready'
1989
2154
  }
@@ -2035,14 +2200,18 @@ export declare const editorMachine: StateMachine<
2035
2200
  | {
2036
2201
  type: 'editable'
2037
2202
  }
2203
+ | {
2204
+ type: 'custom.*'
2205
+ event: CustomBehaviorEvent
2206
+ }
2038
2207
  >
2039
2208
  }
2040
2209
  readonly 'error': {
2041
2210
  readonly actions: ActionFunction<
2042
2211
  {
2043
- behaviors: Array<Behavior>
2212
+ behaviors: Set<Behavior>
2044
2213
  keyGenerator: () => string
2045
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2214
+ pendingEvents: Array<PatchEvent | MutationEvent>
2046
2215
  schema: EditorSchema
2047
2216
  initialReadOnly: boolean
2048
2217
  maxBlocks: number | undefined
@@ -2108,7 +2277,7 @@ export declare const editorMachine: StateMachine<
2108
2277
  style: string
2109
2278
  }
2110
2279
  | PatchEvent
2111
- | MutationEvent_2
2280
+ | MutationEvent
2112
2281
  | {
2113
2282
  type: 'normalizing'
2114
2283
  }
@@ -2126,6 +2295,23 @@ export declare const editorMachine: StateMachine<
2126
2295
  preventDefault: () => void
2127
2296
  }
2128
2297
  }
2298
+ | {
2299
+ type: 'custom behavior event'
2300
+ behaviorEvent: CustomBehaviorEvent
2301
+ editor: PortableTextSlateEditor
2302
+ nativeEvent?: {
2303
+ preventDefault: () => void
2304
+ }
2305
+ }
2306
+ | CustomBehaviorEvent
2307
+ | {
2308
+ type: 'add behavior'
2309
+ behavior: Behavior
2310
+ }
2311
+ | {
2312
+ type: 'remove behavior'
2313
+ behavior: Behavior
2314
+ }
2129
2315
  | {
2130
2316
  type: 'update readOnly'
2131
2317
  readOnly: boolean
@@ -2187,6 +2373,10 @@ export declare const editorMachine: StateMachine<
2187
2373
  }
2188
2374
  | {
2189
2375
  type: 'done loading'
2376
+ }
2377
+ | {
2378
+ type: 'custom.*'
2379
+ event: CustomBehaviorEvent
2190
2380
  },
2191
2381
  undefined,
2192
2382
  never,
@@ -2246,7 +2436,7 @@ export declare const editorMachine: StateMachine<
2246
2436
  style: string
2247
2437
  }
2248
2438
  | PatchEvent
2249
- | MutationEvent_2
2439
+ | MutationEvent
2250
2440
  | {
2251
2441
  type: 'ready'
2252
2442
  }
@@ -2298,15 +2488,19 @@ export declare const editorMachine: StateMachine<
2298
2488
  | {
2299
2489
  type: 'editable'
2300
2490
  }
2491
+ | {
2492
+ type: 'custom.*'
2493
+ event: CustomBehaviorEvent
2494
+ }
2301
2495
  >
2302
2496
  }
2303
2497
  readonly 'selection': {
2304
2498
  readonly actions: readonly [
2305
2499
  ActionFunction<
2306
2500
  {
2307
- behaviors: Array<Behavior>
2501
+ behaviors: Set<Behavior>
2308
2502
  keyGenerator: () => string
2309
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2503
+ pendingEvents: Array<PatchEvent | MutationEvent>
2310
2504
  schema: EditorSchema
2311
2505
  initialReadOnly: boolean
2312
2506
  maxBlocks: number | undefined
@@ -2370,7 +2564,7 @@ export declare const editorMachine: StateMachine<
2370
2564
  style: string
2371
2565
  }
2372
2566
  | PatchEvent
2373
- | MutationEvent_2
2567
+ | MutationEvent
2374
2568
  | {
2375
2569
  type: 'normalizing'
2376
2570
  }
@@ -2388,6 +2582,23 @@ export declare const editorMachine: StateMachine<
2388
2582
  preventDefault: () => void
2389
2583
  }
2390
2584
  }
2585
+ | {
2586
+ type: 'custom behavior event'
2587
+ behaviorEvent: CustomBehaviorEvent
2588
+ editor: PortableTextSlateEditor
2589
+ nativeEvent?: {
2590
+ preventDefault: () => void
2591
+ }
2592
+ }
2593
+ | CustomBehaviorEvent
2594
+ | {
2595
+ type: 'add behavior'
2596
+ behavior: Behavior
2597
+ }
2598
+ | {
2599
+ type: 'remove behavior'
2600
+ behavior: Behavior
2601
+ }
2391
2602
  | {
2392
2603
  type: 'update readOnly'
2393
2604
  readOnly: boolean
@@ -2449,6 +2660,10 @@ export declare const editorMachine: StateMachine<
2449
2660
  }
2450
2661
  | {
2451
2662
  type: 'done loading'
2663
+ }
2664
+ | {
2665
+ type: 'custom.*'
2666
+ event: CustomBehaviorEvent
2452
2667
  },
2453
2668
  undefined,
2454
2669
  never,
@@ -2459,9 +2674,9 @@ export declare const editorMachine: StateMachine<
2459
2674
  >,
2460
2675
  ActionFunction<
2461
2676
  {
2462
- behaviors: Array<Behavior>
2677
+ behaviors: Set<Behavior>
2463
2678
  keyGenerator: () => string
2464
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2679
+ pendingEvents: Array<PatchEvent | MutationEvent>
2465
2680
  schema: EditorSchema
2466
2681
  initialReadOnly: boolean
2467
2682
  maxBlocks: number | undefined
@@ -2525,7 +2740,7 @@ export declare const editorMachine: StateMachine<
2525
2740
  style: string
2526
2741
  }
2527
2742
  | PatchEvent
2528
- | MutationEvent_2
2743
+ | MutationEvent
2529
2744
  | {
2530
2745
  type: 'normalizing'
2531
2746
  }
@@ -2543,6 +2758,23 @@ export declare const editorMachine: StateMachine<
2543
2758
  preventDefault: () => void
2544
2759
  }
2545
2760
  }
2761
+ | {
2762
+ type: 'custom behavior event'
2763
+ behaviorEvent: CustomBehaviorEvent
2764
+ editor: PortableTextSlateEditor
2765
+ nativeEvent?: {
2766
+ preventDefault: () => void
2767
+ }
2768
+ }
2769
+ | CustomBehaviorEvent
2770
+ | {
2771
+ type: 'add behavior'
2772
+ behavior: Behavior
2773
+ }
2774
+ | {
2775
+ type: 'remove behavior'
2776
+ behavior: Behavior
2777
+ }
2546
2778
  | {
2547
2779
  type: 'update readOnly'
2548
2780
  readOnly: boolean
@@ -2604,6 +2836,10 @@ export declare const editorMachine: StateMachine<
2604
2836
  }
2605
2837
  | {
2606
2838
  type: 'done loading'
2839
+ }
2840
+ | {
2841
+ type: 'custom.*'
2842
+ event: CustomBehaviorEvent
2607
2843
  },
2608
2844
  undefined,
2609
2845
  never,
@@ -2663,7 +2899,7 @@ export declare const editorMachine: StateMachine<
2663
2899
  style: string
2664
2900
  }
2665
2901
  | PatchEvent
2666
- | MutationEvent_2
2902
+ | MutationEvent
2667
2903
  | {
2668
2904
  type: 'ready'
2669
2905
  }
@@ -2715,15 +2951,19 @@ export declare const editorMachine: StateMachine<
2715
2951
  | {
2716
2952
  type: 'editable'
2717
2953
  }
2954
+ | {
2955
+ type: 'custom.*'
2956
+ event: CustomBehaviorEvent
2957
+ }
2718
2958
  >,
2719
2959
  ]
2720
2960
  }
2721
2961
  readonly 'blurred': {
2722
2962
  readonly actions: ActionFunction<
2723
2963
  {
2724
- behaviors: Array<Behavior>
2964
+ behaviors: Set<Behavior>
2725
2965
  keyGenerator: () => string
2726
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2966
+ pendingEvents: Array<PatchEvent | MutationEvent>
2727
2967
  schema: EditorSchema
2728
2968
  initialReadOnly: boolean
2729
2969
  maxBlocks: number | undefined
@@ -2787,7 +3027,7 @@ export declare const editorMachine: StateMachine<
2787
3027
  style: string
2788
3028
  }
2789
3029
  | PatchEvent
2790
- | MutationEvent_2
3030
+ | MutationEvent
2791
3031
  | {
2792
3032
  type: 'normalizing'
2793
3033
  }
@@ -2805,6 +3045,23 @@ export declare const editorMachine: StateMachine<
2805
3045
  preventDefault: () => void
2806
3046
  }
2807
3047
  }
3048
+ | {
3049
+ type: 'custom behavior event'
3050
+ behaviorEvent: CustomBehaviorEvent
3051
+ editor: PortableTextSlateEditor
3052
+ nativeEvent?: {
3053
+ preventDefault: () => void
3054
+ }
3055
+ }
3056
+ | CustomBehaviorEvent
3057
+ | {
3058
+ type: 'add behavior'
3059
+ behavior: Behavior
3060
+ }
3061
+ | {
3062
+ type: 'remove behavior'
3063
+ behavior: Behavior
3064
+ }
2808
3065
  | {
2809
3066
  type: 'update readOnly'
2810
3067
  readOnly: boolean
@@ -2866,6 +3123,10 @@ export declare const editorMachine: StateMachine<
2866
3123
  }
2867
3124
  | {
2868
3125
  type: 'done loading'
3126
+ }
3127
+ | {
3128
+ type: 'custom.*'
3129
+ event: CustomBehaviorEvent
2869
3130
  },
2870
3131
  undefined,
2871
3132
  never,
@@ -2925,7 +3186,7 @@ export declare const editorMachine: StateMachine<
2925
3186
  style: string
2926
3187
  }
2927
3188
  | PatchEvent
2928
- | MutationEvent_2
3189
+ | MutationEvent
2929
3190
  | {
2930
3191
  type: 'ready'
2931
3192
  }
@@ -2977,14 +3238,18 @@ export declare const editorMachine: StateMachine<
2977
3238
  | {
2978
3239
  type: 'editable'
2979
3240
  }
3241
+ | {
3242
+ type: 'custom.*'
3243
+ event: CustomBehaviorEvent
3244
+ }
2980
3245
  >
2981
3246
  }
2982
3247
  readonly 'focused': {
2983
3248
  readonly actions: ActionFunction<
2984
3249
  {
2985
- behaviors: Array<Behavior>
3250
+ behaviors: Set<Behavior>
2986
3251
  keyGenerator: () => string
2987
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3252
+ pendingEvents: Array<PatchEvent | MutationEvent>
2988
3253
  schema: EditorSchema
2989
3254
  initialReadOnly: boolean
2990
3255
  maxBlocks: number | undefined
@@ -3048,7 +3313,7 @@ export declare const editorMachine: StateMachine<
3048
3313
  style: string
3049
3314
  }
3050
3315
  | PatchEvent
3051
- | MutationEvent_2
3316
+ | MutationEvent
3052
3317
  | {
3053
3318
  type: 'normalizing'
3054
3319
  }
@@ -3066,6 +3331,23 @@ export declare const editorMachine: StateMachine<
3066
3331
  preventDefault: () => void
3067
3332
  }
3068
3333
  }
3334
+ | {
3335
+ type: 'custom behavior event'
3336
+ behaviorEvent: CustomBehaviorEvent
3337
+ editor: PortableTextSlateEditor
3338
+ nativeEvent?: {
3339
+ preventDefault: () => void
3340
+ }
3341
+ }
3342
+ | CustomBehaviorEvent
3343
+ | {
3344
+ type: 'add behavior'
3345
+ behavior: Behavior
3346
+ }
3347
+ | {
3348
+ type: 'remove behavior'
3349
+ behavior: Behavior
3350
+ }
3069
3351
  | {
3070
3352
  type: 'update readOnly'
3071
3353
  readOnly: boolean
@@ -3127,6 +3409,10 @@ export declare const editorMachine: StateMachine<
3127
3409
  }
3128
3410
  | {
3129
3411
  type: 'done loading'
3412
+ }
3413
+ | {
3414
+ type: 'custom.*'
3415
+ event: CustomBehaviorEvent
3130
3416
  },
3131
3417
  undefined,
3132
3418
  never,
@@ -3186,7 +3472,7 @@ export declare const editorMachine: StateMachine<
3186
3472
  style: string
3187
3473
  }
3188
3474
  | PatchEvent
3189
- | MutationEvent_2
3475
+ | MutationEvent
3190
3476
  | {
3191
3477
  type: 'ready'
3192
3478
  }
@@ -3238,14 +3524,18 @@ export declare const editorMachine: StateMachine<
3238
3524
  | {
3239
3525
  type: 'editable'
3240
3526
  }
3527
+ | {
3528
+ type: 'custom.*'
3529
+ event: CustomBehaviorEvent
3530
+ }
3241
3531
  >
3242
3532
  }
3243
3533
  readonly 'loading': {
3244
3534
  readonly actions: ActionFunction<
3245
3535
  {
3246
- behaviors: Array<Behavior>
3536
+ behaviors: Set<Behavior>
3247
3537
  keyGenerator: () => string
3248
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3538
+ pendingEvents: Array<PatchEvent | MutationEvent>
3249
3539
  schema: EditorSchema
3250
3540
  initialReadOnly: boolean
3251
3541
  maxBlocks: number | undefined
@@ -3308,7 +3598,7 @@ export declare const editorMachine: StateMachine<
3308
3598
  style: string
3309
3599
  }
3310
3600
  | PatchEvent
3311
- | MutationEvent_2
3601
+ | MutationEvent
3312
3602
  | {
3313
3603
  type: 'normalizing'
3314
3604
  }
@@ -3326,6 +3616,23 @@ export declare const editorMachine: StateMachine<
3326
3616
  preventDefault: () => void
3327
3617
  }
3328
3618
  }
3619
+ | {
3620
+ type: 'custom behavior event'
3621
+ behaviorEvent: CustomBehaviorEvent
3622
+ editor: PortableTextSlateEditor
3623
+ nativeEvent?: {
3624
+ preventDefault: () => void
3625
+ }
3626
+ }
3627
+ | CustomBehaviorEvent
3628
+ | {
3629
+ type: 'add behavior'
3630
+ behavior: Behavior
3631
+ }
3632
+ | {
3633
+ type: 'remove behavior'
3634
+ behavior: Behavior
3635
+ }
3329
3636
  | {
3330
3637
  type: 'update readOnly'
3331
3638
  readOnly: boolean
@@ -3387,6 +3694,10 @@ export declare const editorMachine: StateMachine<
3387
3694
  }
3388
3695
  | {
3389
3696
  type: 'done loading'
3697
+ }
3698
+ | {
3699
+ type: 'custom.*'
3700
+ event: CustomBehaviorEvent
3390
3701
  },
3391
3702
  undefined,
3392
3703
  never,
@@ -3446,7 +3757,7 @@ export declare const editorMachine: StateMachine<
3446
3757
  style: string
3447
3758
  }
3448
3759
  | PatchEvent
3449
- | MutationEvent_2
3760
+ | MutationEvent
3450
3761
  | {
3451
3762
  type: 'ready'
3452
3763
  }
@@ -3498,14 +3809,18 @@ export declare const editorMachine: StateMachine<
3498
3809
  | {
3499
3810
  type: 'editable'
3500
3811
  }
3812
+ | {
3813
+ type: 'custom.*'
3814
+ event: CustomBehaviorEvent
3815
+ }
3501
3816
  >
3502
3817
  }
3503
3818
  readonly 'patches': {
3504
3819
  readonly actions: ActionFunction<
3505
3820
  {
3506
- behaviors: Array<Behavior>
3821
+ behaviors: Set<Behavior>
3507
3822
  keyGenerator: () => string
3508
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3823
+ pendingEvents: Array<PatchEvent | MutationEvent>
3509
3824
  schema: EditorSchema
3510
3825
  initialReadOnly: boolean
3511
3826
  maxBlocks: number | undefined
@@ -3566,7 +3881,7 @@ export declare const editorMachine: StateMachine<
3566
3881
  style: string
3567
3882
  }
3568
3883
  | PatchEvent
3569
- | MutationEvent_2
3884
+ | MutationEvent
3570
3885
  | {
3571
3886
  type: 'normalizing'
3572
3887
  }
@@ -3584,6 +3899,23 @@ export declare const editorMachine: StateMachine<
3584
3899
  preventDefault: () => void
3585
3900
  }
3586
3901
  }
3902
+ | {
3903
+ type: 'custom behavior event'
3904
+ behaviorEvent: CustomBehaviorEvent
3905
+ editor: PortableTextSlateEditor
3906
+ nativeEvent?: {
3907
+ preventDefault: () => void
3908
+ }
3909
+ }
3910
+ | CustomBehaviorEvent
3911
+ | {
3912
+ type: 'add behavior'
3913
+ behavior: Behavior
3914
+ }
3915
+ | {
3916
+ type: 'remove behavior'
3917
+ behavior: Behavior
3918
+ }
3587
3919
  | {
3588
3920
  type: 'update readOnly'
3589
3921
  readOnly: boolean
@@ -3645,6 +3977,10 @@ export declare const editorMachine: StateMachine<
3645
3977
  }
3646
3978
  | {
3647
3979
  type: 'done loading'
3980
+ }
3981
+ | {
3982
+ type: 'custom.*'
3983
+ event: CustomBehaviorEvent
3648
3984
  },
3649
3985
  undefined,
3650
3986
  never,
@@ -3704,7 +4040,7 @@ export declare const editorMachine: StateMachine<
3704
4040
  style: string
3705
4041
  }
3706
4042
  | PatchEvent
3707
- | MutationEvent_2
4043
+ | MutationEvent
3708
4044
  | {
3709
4045
  type: 'ready'
3710
4046
  }
@@ -3756,14 +4092,18 @@ export declare const editorMachine: StateMachine<
3756
4092
  | {
3757
4093
  type: 'editable'
3758
4094
  }
4095
+ | {
4096
+ type: 'custom.*'
4097
+ event: CustomBehaviorEvent
4098
+ }
3759
4099
  >
3760
4100
  }
3761
4101
  readonly 'done loading': {
3762
4102
  readonly actions: ActionFunction<
3763
4103
  {
3764
- behaviors: Array<Behavior>
4104
+ behaviors: Set<Behavior>
3765
4105
  keyGenerator: () => string
3766
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4106
+ pendingEvents: Array<PatchEvent | MutationEvent>
3767
4107
  schema: EditorSchema
3768
4108
  initialReadOnly: boolean
3769
4109
  maxBlocks: number | undefined
@@ -3826,7 +4166,7 @@ export declare const editorMachine: StateMachine<
3826
4166
  style: string
3827
4167
  }
3828
4168
  | PatchEvent
3829
- | MutationEvent_2
4169
+ | MutationEvent
3830
4170
  | {
3831
4171
  type: 'normalizing'
3832
4172
  }
@@ -3844,6 +4184,23 @@ export declare const editorMachine: StateMachine<
3844
4184
  preventDefault: () => void
3845
4185
  }
3846
4186
  }
4187
+ | {
4188
+ type: 'custom behavior event'
4189
+ behaviorEvent: CustomBehaviorEvent
4190
+ editor: PortableTextSlateEditor
4191
+ nativeEvent?: {
4192
+ preventDefault: () => void
4193
+ }
4194
+ }
4195
+ | CustomBehaviorEvent
4196
+ | {
4197
+ type: 'add behavior'
4198
+ behavior: Behavior
4199
+ }
4200
+ | {
4201
+ type: 'remove behavior'
4202
+ behavior: Behavior
4203
+ }
3847
4204
  | {
3848
4205
  type: 'update readOnly'
3849
4206
  readOnly: boolean
@@ -3905,6 +4262,10 @@ export declare const editorMachine: StateMachine<
3905
4262
  }
3906
4263
  | {
3907
4264
  type: 'done loading'
4265
+ }
4266
+ | {
4267
+ type: 'custom.*'
4268
+ event: CustomBehaviorEvent
3908
4269
  },
3909
4270
  undefined,
3910
4271
  never,
@@ -3964,7 +4325,7 @@ export declare const editorMachine: StateMachine<
3964
4325
  style: string
3965
4326
  }
3966
4327
  | PatchEvent
3967
- | MutationEvent_2
4328
+ | MutationEvent
3968
4329
  | {
3969
4330
  type: 'ready'
3970
4331
  }
@@ -4016,6 +4377,10 @@ export declare const editorMachine: StateMachine<
4016
4377
  | {
4017
4378
  type: 'editable'
4018
4379
  }
4380
+ | {
4381
+ type: 'custom.*'
4382
+ event: CustomBehaviorEvent
4383
+ }
4019
4384
  >
4020
4385
  }
4021
4386
  readonly 'update behaviors': {
@@ -4027,9 +4392,9 @@ export declare const editorMachine: StateMachine<
4027
4392
  readonly 'update value': {
4028
4393
  readonly actions: ActionFunction<
4029
4394
  {
4030
- behaviors: Array<Behavior>
4395
+ behaviors: Set<Behavior>
4031
4396
  keyGenerator: () => string
4032
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4397
+ pendingEvents: Array<PatchEvent | MutationEvent>
4033
4398
  schema: EditorSchema
4034
4399
  initialReadOnly: boolean
4035
4400
  maxBlocks: number | undefined
@@ -4093,7 +4458,7 @@ export declare const editorMachine: StateMachine<
4093
4458
  style: string
4094
4459
  }
4095
4460
  | PatchEvent
4096
- | MutationEvent_2
4461
+ | MutationEvent
4097
4462
  | {
4098
4463
  type: 'normalizing'
4099
4464
  }
@@ -4111,6 +4476,23 @@ export declare const editorMachine: StateMachine<
4111
4476
  preventDefault: () => void
4112
4477
  }
4113
4478
  }
4479
+ | {
4480
+ type: 'custom behavior event'
4481
+ behaviorEvent: CustomBehaviorEvent
4482
+ editor: PortableTextSlateEditor
4483
+ nativeEvent?: {
4484
+ preventDefault: () => void
4485
+ }
4486
+ }
4487
+ | CustomBehaviorEvent
4488
+ | {
4489
+ type: 'add behavior'
4490
+ behavior: Behavior
4491
+ }
4492
+ | {
4493
+ type: 'remove behavior'
4494
+ behavior: Behavior
4495
+ }
4114
4496
  | {
4115
4497
  type: 'update readOnly'
4116
4498
  readOnly: boolean
@@ -4172,6 +4554,10 @@ export declare const editorMachine: StateMachine<
4172
4554
  }
4173
4555
  | {
4174
4556
  type: 'done loading'
4557
+ }
4558
+ | {
4559
+ type: 'custom.*'
4560
+ event: CustomBehaviorEvent
4175
4561
  },
4176
4562
  undefined,
4177
4563
  never,
@@ -4184,9 +4570,9 @@ export declare const editorMachine: StateMachine<
4184
4570
  readonly 'update maxBlocks': {
4185
4571
  readonly actions: ActionFunction<
4186
4572
  {
4187
- behaviors: Array<Behavior>
4573
+ behaviors: Set<Behavior>
4188
4574
  keyGenerator: () => string
4189
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4575
+ pendingEvents: Array<PatchEvent | MutationEvent>
4190
4576
  schema: EditorSchema
4191
4577
  initialReadOnly: boolean
4192
4578
  maxBlocks: number | undefined
@@ -4250,7 +4636,7 @@ export declare const editorMachine: StateMachine<
4250
4636
  style: string
4251
4637
  }
4252
4638
  | PatchEvent
4253
- | MutationEvent_2
4639
+ | MutationEvent
4254
4640
  | {
4255
4641
  type: 'normalizing'
4256
4642
  }
@@ -4269,12 +4655,29 @@ export declare const editorMachine: StateMachine<
4269
4655
  }
4270
4656
  }
4271
4657
  | {
4272
- type: 'update readOnly'
4273
- readOnly: boolean
4658
+ type: 'custom behavior event'
4659
+ behaviorEvent: CustomBehaviorEvent
4660
+ editor: PortableTextSlateEditor
4661
+ nativeEvent?: {
4662
+ preventDefault: () => void
4663
+ }
4274
4664
  }
4665
+ | CustomBehaviorEvent
4275
4666
  | {
4276
- type: 'update schema'
4277
- schema: EditorSchema
4667
+ type: 'add behavior'
4668
+ behavior: Behavior
4669
+ }
4670
+ | {
4671
+ type: 'remove behavior'
4672
+ behavior: Behavior
4673
+ }
4674
+ | {
4675
+ type: 'update readOnly'
4676
+ readOnly: boolean
4677
+ }
4678
+ | {
4679
+ type: 'update schema'
4680
+ schema: EditorSchema
4278
4681
  }
4279
4682
  | {
4280
4683
  type: 'update behaviors'
@@ -4329,6 +4732,10 @@ export declare const editorMachine: StateMachine<
4329
4732
  }
4330
4733
  | {
4331
4734
  type: 'done loading'
4735
+ }
4736
+ | {
4737
+ type: 'custom.*'
4738
+ event: CustomBehaviorEvent
4332
4739
  },
4333
4740
  undefined,
4334
4741
  never,
@@ -4356,9 +4763,9 @@ export declare const editorMachine: StateMachine<
4356
4763
  context,
4357
4764
  }: GuardArgs<
4358
4765
  {
4359
- behaviors: Array<Behavior>
4766
+ behaviors: Set<Behavior>
4360
4767
  keyGenerator: () => string
4361
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4768
+ pendingEvents: Array<PatchEvent | MutationEvent>
4362
4769
  schema: EditorSchema
4363
4770
  initialReadOnly: boolean
4364
4771
  maxBlocks: number | undefined
@@ -4383,9 +4790,9 @@ export declare const editorMachine: StateMachine<
4383
4790
  event,
4384
4791
  }: GuardArgs<
4385
4792
  {
4386
- behaviors: Array<Behavior>
4793
+ behaviors: Set<Behavior>
4387
4794
  keyGenerator: () => string
4388
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4795
+ pendingEvents: Array<PatchEvent | MutationEvent>
4389
4796
  schema: EditorSchema
4390
4797
  initialReadOnly: boolean
4391
4798
  maxBlocks: number | undefined
@@ -4411,9 +4818,9 @@ export declare const editorMachine: StateMachine<
4411
4818
  event,
4412
4819
  }: GuardArgs<
4413
4820
  {
4414
- behaviors: Array<Behavior>
4821
+ behaviors: Set<Behavior>
4415
4822
  keyGenerator: () => string
4416
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4823
+ pendingEvents: Array<PatchEvent | MutationEvent>
4417
4824
  schema: EditorSchema
4418
4825
  initialReadOnly: boolean
4419
4826
  maxBlocks: number | undefined
@@ -4431,12 +4838,15 @@ export declare const editorMachine: StateMachine<
4431
4838
  readonly 'behavior event': {
4432
4839
  readonly actions: 'handle behavior event'
4433
4840
  }
4841
+ readonly 'custom behavior event': {
4842
+ readonly actions: 'handle behavior event'
4843
+ }
4434
4844
  readonly 'annotation.*': {
4435
4845
  readonly actions: ActionFunction<
4436
4846
  {
4437
- behaviors: Array<Behavior>
4847
+ behaviors: Set<Behavior>
4438
4848
  keyGenerator: () => string
4439
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4849
+ pendingEvents: Array<PatchEvent | MutationEvent>
4440
4850
  schema: EditorSchema
4441
4851
  initialReadOnly: boolean
4442
4852
  maxBlocks: number | undefined
@@ -4511,7 +4921,7 @@ export declare const editorMachine: StateMachine<
4511
4921
  style: string
4512
4922
  }
4513
4923
  | PatchEvent
4514
- | MutationEvent_2
4924
+ | MutationEvent
4515
4925
  | {
4516
4926
  type: 'normalizing'
4517
4927
  }
@@ -4531,6 +4941,23 @@ export declare const editorMachine: StateMachine<
4531
4941
  preventDefault: () => void
4532
4942
  }
4533
4943
  }
4944
+ | {
4945
+ type: 'custom behavior event'
4946
+ behaviorEvent: CustomBehaviorEvent
4947
+ editor: PortableTextSlateEditor
4948
+ nativeEvent?: {
4949
+ preventDefault: () => void
4950
+ }
4951
+ }
4952
+ | CustomBehaviorEvent
4953
+ | {
4954
+ type: 'add behavior'
4955
+ behavior: Behavior
4956
+ }
4957
+ | {
4958
+ type: 'remove behavior'
4959
+ behavior: Behavior
4960
+ }
4534
4961
  | {
4535
4962
  type: 'update readOnly'
4536
4963
  readOnly: boolean
@@ -4592,6 +5019,10 @@ export declare const editorMachine: StateMachine<
4592
5019
  }
4593
5020
  | {
4594
5021
  type: 'done loading'
5022
+ }
5023
+ | {
5024
+ type: 'custom.*'
5025
+ event: CustomBehaviorEvent
4595
5026
  },
4596
5027
  undefined,
4597
5028
  never,
@@ -4651,7 +5082,7 @@ export declare const editorMachine: StateMachine<
4651
5082
  style: string
4652
5083
  }
4653
5084
  | PatchEvent
4654
- | MutationEvent_2
5085
+ | MutationEvent
4655
5086
  | {
4656
5087
  type: 'ready'
4657
5088
  }
@@ -4703,14 +5134,18 @@ export declare const editorMachine: StateMachine<
4703
5134
  | {
4704
5135
  type: 'editable'
4705
5136
  }
5137
+ | {
5138
+ type: 'custom.*'
5139
+ event: CustomBehaviorEvent
5140
+ }
4706
5141
  >
4707
5142
  }
4708
5143
  readonly 'blur': {
4709
5144
  readonly actions: ActionFunction<
4710
5145
  {
4711
- behaviors: Array<Behavior>
5146
+ behaviors: Set<Behavior>
4712
5147
  keyGenerator: () => string
4713
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5148
+ pendingEvents: Array<PatchEvent | MutationEvent>
4714
5149
  schema: EditorSchema
4715
5150
  initialReadOnly: boolean
4716
5151
  maxBlocks: number | undefined
@@ -4773,7 +5208,7 @@ export declare const editorMachine: StateMachine<
4773
5208
  style: string
4774
5209
  }
4775
5210
  | PatchEvent
4776
- | MutationEvent_2
5211
+ | MutationEvent
4777
5212
  | {
4778
5213
  type: 'normalizing'
4779
5214
  }
@@ -4793,6 +5228,23 @@ export declare const editorMachine: StateMachine<
4793
5228
  preventDefault: () => void
4794
5229
  }
4795
5230
  }
5231
+ | {
5232
+ type: 'custom behavior event'
5233
+ behaviorEvent: CustomBehaviorEvent
5234
+ editor: PortableTextSlateEditor
5235
+ nativeEvent?: {
5236
+ preventDefault: () => void
5237
+ }
5238
+ }
5239
+ | CustomBehaviorEvent
5240
+ | {
5241
+ type: 'add behavior'
5242
+ behavior: Behavior
5243
+ }
5244
+ | {
5245
+ type: 'remove behavior'
5246
+ behavior: Behavior
5247
+ }
4796
5248
  | {
4797
5249
  type: 'update readOnly'
4798
5250
  readOnly: boolean
@@ -4854,6 +5306,10 @@ export declare const editorMachine: StateMachine<
4854
5306
  }
4855
5307
  | {
4856
5308
  type: 'done loading'
5309
+ }
5310
+ | {
5311
+ type: 'custom.*'
5312
+ event: CustomBehaviorEvent
4857
5313
  },
4858
5314
  undefined,
4859
5315
  never,
@@ -4913,7 +5369,7 @@ export declare const editorMachine: StateMachine<
4913
5369
  style: string
4914
5370
  }
4915
5371
  | PatchEvent
4916
- | MutationEvent_2
5372
+ | MutationEvent
4917
5373
  | {
4918
5374
  type: 'ready'
4919
5375
  }
@@ -4965,14 +5421,307 @@ export declare const editorMachine: StateMachine<
4965
5421
  | {
4966
5422
  type: 'editable'
4967
5423
  }
5424
+ | {
5425
+ type: 'custom.*'
5426
+ event: CustomBehaviorEvent
5427
+ }
5428
+ >
5429
+ }
5430
+ readonly 'custom.*': {
5431
+ readonly actions: ActionFunction<
5432
+ {
5433
+ behaviors: Set<Behavior>
5434
+ keyGenerator: () => string
5435
+ pendingEvents: Array<PatchEvent | MutationEvent>
5436
+ schema: EditorSchema
5437
+ initialReadOnly: boolean
5438
+ maxBlocks: number | undefined
5439
+ selection: EditorSelection
5440
+ value: Array<PortableTextBlock> | undefined
5441
+ },
5442
+ | CustomBehaviorEvent
5443
+ | {
5444
+ type: 'custom.*'
5445
+ event: CustomBehaviorEvent
5446
+ },
5447
+ | {
5448
+ type: 'annotation.add'
5449
+ annotation: {
5450
+ name: string
5451
+ value: {
5452
+ [prop: string]: unknown
5453
+ }
5454
+ }
5455
+ }
5456
+ | {
5457
+ type: 'annotation.remove'
5458
+ annotation: {
5459
+ name: string
5460
+ }
5461
+ }
5462
+ | {
5463
+ type: 'blur'
5464
+ }
5465
+ | {
5466
+ type: 'decorator.toggle'
5467
+ decorator: string
5468
+ }
5469
+ | {
5470
+ type: 'focus'
5471
+ }
5472
+ | {
5473
+ type: 'insert.block object'
5474
+ placement: 'auto' | 'after' | 'before'
5475
+ blockObject: {
5476
+ name: string
5477
+ value?: {
5478
+ [prop: string]: unknown
5479
+ }
5480
+ }
5481
+ }
5482
+ | {
5483
+ type: 'insert.inline object'
5484
+ inlineObject: {
5485
+ name: string
5486
+ value?: {
5487
+ [prop: string]: unknown
5488
+ }
5489
+ }
5490
+ }
5491
+ | {
5492
+ type: 'list item.toggle'
5493
+ listItem: string
5494
+ }
5495
+ | {
5496
+ type: 'style.toggle'
5497
+ style: string
5498
+ }
5499
+ | PatchEvent
5500
+ | MutationEvent
5501
+ | {
5502
+ type: 'normalizing'
5503
+ }
5504
+ | {
5505
+ type: 'done normalizing'
5506
+ }
5507
+ | {
5508
+ type: 'done syncing initial value'
5509
+ }
5510
+ | {
5511
+ type: 'behavior event'
5512
+ behaviorEvent:
5513
+ | SyntheticBehaviorEvent
5514
+ | NativeBehaviorEvent
5515
+ editor: PortableTextSlateEditor
5516
+ nativeEvent?: {
5517
+ preventDefault: () => void
5518
+ }
5519
+ }
5520
+ | {
5521
+ type: 'custom behavior event'
5522
+ behaviorEvent: CustomBehaviorEvent
5523
+ editor: PortableTextSlateEditor
5524
+ nativeEvent?: {
5525
+ preventDefault: () => void
5526
+ }
5527
+ }
5528
+ | CustomBehaviorEvent
5529
+ | {
5530
+ type: 'add behavior'
5531
+ behavior: Behavior
5532
+ }
5533
+ | {
5534
+ type: 'remove behavior'
5535
+ behavior: Behavior
5536
+ }
5537
+ | {
5538
+ type: 'update readOnly'
5539
+ readOnly: boolean
5540
+ }
5541
+ | {
5542
+ type: 'update schema'
5543
+ schema: EditorSchema
5544
+ }
5545
+ | {
5546
+ type: 'update behaviors'
5547
+ behaviors: Array<Behavior>
5548
+ }
5549
+ | {
5550
+ type: 'update value'
5551
+ value: Array<PortableTextBlock> | undefined
5552
+ }
5553
+ | {
5554
+ type: 'update maxBlocks'
5555
+ maxBlocks: number | undefined
5556
+ }
5557
+ | PatchesEvent
5558
+ | {
5559
+ type: 'unset'
5560
+ previousValue: Array<PortableTextBlock>
5561
+ }
5562
+ | {
5563
+ type: 'value changed'
5564
+ value: Array<PortableTextBlock> | undefined
5565
+ }
5566
+ | {
5567
+ type: 'invalid value'
5568
+ resolution: InvalidValueResolution | null
5569
+ value: Array<PortableTextBlock> | undefined
5570
+ }
5571
+ | {
5572
+ type: 'error'
5573
+ name: string
5574
+ description: string
5575
+ data: unknown
5576
+ }
5577
+ | {
5578
+ type: 'select'
5579
+ selection: EditorSelection
5580
+ }
5581
+ | {
5582
+ type: 'selection'
5583
+ selection: EditorSelection
5584
+ }
5585
+ | {
5586
+ type: 'blurred'
5587
+ event: FocusEvent_2<HTMLDivElement, Element>
5588
+ }
5589
+ | {
5590
+ type: 'focused'
5591
+ event: FocusEvent_2<HTMLDivElement, Element>
5592
+ }
5593
+ | {
5594
+ type: 'loading'
5595
+ }
5596
+ | {
5597
+ type: 'done loading'
5598
+ }
5599
+ | {
5600
+ type: 'custom.*'
5601
+ event: CustomBehaviorEvent
5602
+ },
5603
+ undefined,
5604
+ never,
5605
+ never,
5606
+ never,
5607
+ never,
5608
+ | {
5609
+ type: 'annotation.add'
5610
+ annotation: {
5611
+ name: string
5612
+ value: {
5613
+ [prop: string]: unknown
5614
+ }
5615
+ }
5616
+ }
5617
+ | {
5618
+ type: 'annotation.remove'
5619
+ annotation: {
5620
+ name: string
5621
+ }
5622
+ }
5623
+ | {
5624
+ type: 'blur'
5625
+ }
5626
+ | {
5627
+ type: 'decorator.toggle'
5628
+ decorator: string
5629
+ }
5630
+ | {
5631
+ type: 'focus'
5632
+ }
5633
+ | {
5634
+ type: 'insert.block object'
5635
+ placement: 'auto' | 'after' | 'before'
5636
+ blockObject: {
5637
+ name: string
5638
+ value?: {
5639
+ [prop: string]: unknown
5640
+ }
5641
+ }
5642
+ }
5643
+ | {
5644
+ type: 'insert.inline object'
5645
+ inlineObject: {
5646
+ name: string
5647
+ value?: {
5648
+ [prop: string]: unknown
5649
+ }
5650
+ }
5651
+ }
5652
+ | {
5653
+ type: 'list item.toggle'
5654
+ listItem: string
5655
+ }
5656
+ | {
5657
+ type: 'style.toggle'
5658
+ style: string
5659
+ }
5660
+ | PatchEvent
5661
+ | MutationEvent
5662
+ | {
5663
+ type: 'ready'
5664
+ }
5665
+ | PatchesEvent
5666
+ | {
5667
+ type: 'unset'
5668
+ previousValue: Array<PortableTextBlock>
5669
+ }
5670
+ | {
5671
+ type: 'value changed'
5672
+ value: Array<PortableTextBlock> | undefined
5673
+ }
5674
+ | {
5675
+ type: 'invalid value'
5676
+ resolution: InvalidValueResolution | null
5677
+ value: Array<PortableTextBlock> | undefined
5678
+ }
5679
+ | {
5680
+ type: 'error'
5681
+ name: string
5682
+ description: string
5683
+ data: unknown
5684
+ }
5685
+ | {
5686
+ type: 'select'
5687
+ selection: EditorSelection
5688
+ }
5689
+ | {
5690
+ type: 'selection'
5691
+ selection: EditorSelection
5692
+ }
5693
+ | {
5694
+ type: 'blurred'
5695
+ event: FocusEvent_2<HTMLDivElement, Element>
5696
+ }
5697
+ | {
5698
+ type: 'focused'
5699
+ event: FocusEvent_2<HTMLDivElement, Element>
5700
+ }
5701
+ | {
5702
+ type: 'loading'
5703
+ }
5704
+ | {
5705
+ type: 'done loading'
5706
+ }
5707
+ | {
5708
+ type: 'read only'
5709
+ }
5710
+ | {
5711
+ type: 'editable'
5712
+ }
5713
+ | {
5714
+ type: 'custom.*'
5715
+ event: CustomBehaviorEvent
5716
+ }
4968
5717
  >
4969
5718
  }
4970
5719
  readonly 'decorator.*': {
4971
5720
  readonly actions: ActionFunction<
4972
5721
  {
4973
- behaviors: Array<Behavior>
5722
+ behaviors: Set<Behavior>
4974
5723
  keyGenerator: () => string
4975
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5724
+ pendingEvents: Array<PatchEvent | MutationEvent>
4976
5725
  schema: EditorSchema
4977
5726
  initialReadOnly: boolean
4978
5727
  maxBlocks: number | undefined
@@ -5036,7 +5785,7 @@ export declare const editorMachine: StateMachine<
5036
5785
  style: string
5037
5786
  }
5038
5787
  | PatchEvent
5039
- | MutationEvent_2
5788
+ | MutationEvent
5040
5789
  | {
5041
5790
  type: 'normalizing'
5042
5791
  }
@@ -5056,6 +5805,23 @@ export declare const editorMachine: StateMachine<
5056
5805
  preventDefault: () => void
5057
5806
  }
5058
5807
  }
5808
+ | {
5809
+ type: 'custom behavior event'
5810
+ behaviorEvent: CustomBehaviorEvent
5811
+ editor: PortableTextSlateEditor
5812
+ nativeEvent?: {
5813
+ preventDefault: () => void
5814
+ }
5815
+ }
5816
+ | CustomBehaviorEvent
5817
+ | {
5818
+ type: 'add behavior'
5819
+ behavior: Behavior
5820
+ }
5821
+ | {
5822
+ type: 'remove behavior'
5823
+ behavior: Behavior
5824
+ }
5059
5825
  | {
5060
5826
  type: 'update readOnly'
5061
5827
  readOnly: boolean
@@ -5117,6 +5883,10 @@ export declare const editorMachine: StateMachine<
5117
5883
  }
5118
5884
  | {
5119
5885
  type: 'done loading'
5886
+ }
5887
+ | {
5888
+ type: 'custom.*'
5889
+ event: CustomBehaviorEvent
5120
5890
  },
5121
5891
  undefined,
5122
5892
  never,
@@ -5176,7 +5946,7 @@ export declare const editorMachine: StateMachine<
5176
5946
  style: string
5177
5947
  }
5178
5948
  | PatchEvent
5179
- | MutationEvent_2
5949
+ | MutationEvent
5180
5950
  | {
5181
5951
  type: 'ready'
5182
5952
  }
@@ -5228,14 +5998,18 @@ export declare const editorMachine: StateMachine<
5228
5998
  | {
5229
5999
  type: 'editable'
5230
6000
  }
6001
+ | {
6002
+ type: 'custom.*'
6003
+ event: CustomBehaviorEvent
6004
+ }
5231
6005
  >
5232
6006
  }
5233
6007
  readonly 'focus': {
5234
6008
  readonly actions: ActionFunction<
5235
6009
  {
5236
- behaviors: Array<Behavior>
6010
+ behaviors: Set<Behavior>
5237
6011
  keyGenerator: () => string
5238
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6012
+ pendingEvents: Array<PatchEvent | MutationEvent>
5239
6013
  schema: EditorSchema
5240
6014
  initialReadOnly: boolean
5241
6015
  maxBlocks: number | undefined
@@ -5298,7 +6072,7 @@ export declare const editorMachine: StateMachine<
5298
6072
  style: string
5299
6073
  }
5300
6074
  | PatchEvent
5301
- | MutationEvent_2
6075
+ | MutationEvent
5302
6076
  | {
5303
6077
  type: 'normalizing'
5304
6078
  }
@@ -5318,6 +6092,23 @@ export declare const editorMachine: StateMachine<
5318
6092
  preventDefault: () => void
5319
6093
  }
5320
6094
  }
6095
+ | {
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'
6110
+ behavior: Behavior
6111
+ }
5321
6112
  | {
5322
6113
  type: 'update readOnly'
5323
6114
  readOnly: boolean
@@ -5379,6 +6170,10 @@ export declare const editorMachine: StateMachine<
5379
6170
  }
5380
6171
  | {
5381
6172
  type: 'done loading'
6173
+ }
6174
+ | {
6175
+ type: 'custom.*'
6176
+ event: CustomBehaviorEvent
5382
6177
  },
5383
6178
  undefined,
5384
6179
  never,
@@ -5438,7 +6233,7 @@ export declare const editorMachine: StateMachine<
5438
6233
  style: string
5439
6234
  }
5440
6235
  | PatchEvent
5441
- | MutationEvent_2
6236
+ | MutationEvent
5442
6237
  | {
5443
6238
  type: 'ready'
5444
6239
  }
@@ -5490,14 +6285,18 @@ export declare const editorMachine: StateMachine<
5490
6285
  | {
5491
6286
  type: 'editable'
5492
6287
  }
6288
+ | {
6289
+ type: 'custom.*'
6290
+ event: CustomBehaviorEvent
6291
+ }
5493
6292
  >
5494
6293
  }
5495
6294
  readonly 'insert.*': {
5496
6295
  readonly actions: ActionFunction<
5497
6296
  {
5498
- behaviors: Array<Behavior>
6297
+ behaviors: Set<Behavior>
5499
6298
  keyGenerator: () => string
5500
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6299
+ pendingEvents: Array<PatchEvent | MutationEvent>
5501
6300
  schema: EditorSchema
5502
6301
  initialReadOnly: boolean
5503
6302
  maxBlocks: number | undefined
@@ -5576,7 +6375,7 @@ export declare const editorMachine: StateMachine<
5576
6375
  style: string
5577
6376
  }
5578
6377
  | PatchEvent
5579
- | MutationEvent_2
6378
+ | MutationEvent
5580
6379
  | {
5581
6380
  type: 'normalizing'
5582
6381
  }
@@ -5596,6 +6395,23 @@ export declare const editorMachine: StateMachine<
5596
6395
  preventDefault: () => void
5597
6396
  }
5598
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
+ }
5599
6415
  | {
5600
6416
  type: 'update readOnly'
5601
6417
  readOnly: boolean
@@ -5657,6 +6473,10 @@ export declare const editorMachine: StateMachine<
5657
6473
  }
5658
6474
  | {
5659
6475
  type: 'done loading'
6476
+ }
6477
+ | {
6478
+ type: 'custom.*'
6479
+ event: CustomBehaviorEvent
5660
6480
  },
5661
6481
  undefined,
5662
6482
  never,
@@ -5716,7 +6536,7 @@ export declare const editorMachine: StateMachine<
5716
6536
  style: string
5717
6537
  }
5718
6538
  | PatchEvent
5719
- | MutationEvent_2
6539
+ | MutationEvent
5720
6540
  | {
5721
6541
  type: 'ready'
5722
6542
  }
@@ -5768,14 +6588,18 @@ export declare const editorMachine: StateMachine<
5768
6588
  | {
5769
6589
  type: 'editable'
5770
6590
  }
6591
+ | {
6592
+ type: 'custom.*'
6593
+ event: CustomBehaviorEvent
6594
+ }
5771
6595
  >
5772
6596
  }
5773
6597
  readonly 'list item.*': {
5774
6598
  readonly actions: ActionFunction<
5775
6599
  {
5776
- behaviors: Array<Behavior>
6600
+ behaviors: Set<Behavior>
5777
6601
  keyGenerator: () => string
5778
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6602
+ pendingEvents: Array<PatchEvent | MutationEvent>
5779
6603
  schema: EditorSchema
5780
6604
  initialReadOnly: boolean
5781
6605
  maxBlocks: number | undefined
@@ -5839,7 +6663,7 @@ export declare const editorMachine: StateMachine<
5839
6663
  style: string
5840
6664
  }
5841
6665
  | PatchEvent
5842
- | MutationEvent_2
6666
+ | MutationEvent
5843
6667
  | {
5844
6668
  type: 'normalizing'
5845
6669
  }
@@ -5859,6 +6683,23 @@ export declare const editorMachine: StateMachine<
5859
6683
  preventDefault: () => void
5860
6684
  }
5861
6685
  }
6686
+ | {
6687
+ type: 'custom behavior event'
6688
+ behaviorEvent: CustomBehaviorEvent
6689
+ editor: PortableTextSlateEditor
6690
+ nativeEvent?: {
6691
+ preventDefault: () => void
6692
+ }
6693
+ }
6694
+ | CustomBehaviorEvent
6695
+ | {
6696
+ type: 'add behavior'
6697
+ behavior: Behavior
6698
+ }
6699
+ | {
6700
+ type: 'remove behavior'
6701
+ behavior: Behavior
6702
+ }
5862
6703
  | {
5863
6704
  type: 'update readOnly'
5864
6705
  readOnly: boolean
@@ -5920,6 +6761,10 @@ export declare const editorMachine: StateMachine<
5920
6761
  }
5921
6762
  | {
5922
6763
  type: 'done loading'
6764
+ }
6765
+ | {
6766
+ type: 'custom.*'
6767
+ event: CustomBehaviorEvent
5923
6768
  },
5924
6769
  undefined,
5925
6770
  never,
@@ -5979,7 +6824,7 @@ export declare const editorMachine: StateMachine<
5979
6824
  style: string
5980
6825
  }
5981
6826
  | PatchEvent
5982
- | MutationEvent_2
6827
+ | MutationEvent
5983
6828
  | {
5984
6829
  type: 'ready'
5985
6830
  }
@@ -6031,14 +6876,18 @@ export declare const editorMachine: StateMachine<
6031
6876
  | {
6032
6877
  type: 'editable'
6033
6878
  }
6879
+ | {
6880
+ type: 'custom.*'
6881
+ event: CustomBehaviorEvent
6882
+ }
6034
6883
  >
6035
6884
  }
6036
6885
  readonly 'select': {
6037
6886
  readonly actions: ActionFunction<
6038
6887
  {
6039
- behaviors: Array<Behavior>
6888
+ behaviors: Set<Behavior>
6040
6889
  keyGenerator: () => string
6041
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6890
+ pendingEvents: Array<PatchEvent | MutationEvent>
6042
6891
  schema: EditorSchema
6043
6892
  initialReadOnly: boolean
6044
6893
  maxBlocks: number | undefined
@@ -6102,7 +6951,7 @@ export declare const editorMachine: StateMachine<
6102
6951
  style: string
6103
6952
  }
6104
6953
  | PatchEvent
6105
- | MutationEvent_2
6954
+ | MutationEvent
6106
6955
  | {
6107
6956
  type: 'normalizing'
6108
6957
  }
@@ -6122,6 +6971,23 @@ export declare const editorMachine: StateMachine<
6122
6971
  preventDefault: () => void
6123
6972
  }
6124
6973
  }
6974
+ | {
6975
+ type: 'custom behavior event'
6976
+ behaviorEvent: CustomBehaviorEvent
6977
+ editor: PortableTextSlateEditor
6978
+ nativeEvent?: {
6979
+ preventDefault: () => void
6980
+ }
6981
+ }
6982
+ | CustomBehaviorEvent
6983
+ | {
6984
+ type: 'add behavior'
6985
+ behavior: Behavior
6986
+ }
6987
+ | {
6988
+ type: 'remove behavior'
6989
+ behavior: Behavior
6990
+ }
6125
6991
  | {
6126
6992
  type: 'update readOnly'
6127
6993
  readOnly: boolean
@@ -6183,6 +7049,10 @@ export declare const editorMachine: StateMachine<
6183
7049
  }
6184
7050
  | {
6185
7051
  type: 'done loading'
7052
+ }
7053
+ | {
7054
+ type: 'custom.*'
7055
+ event: CustomBehaviorEvent
6186
7056
  },
6187
7057
  undefined,
6188
7058
  never,
@@ -6242,7 +7112,7 @@ export declare const editorMachine: StateMachine<
6242
7112
  style: string
6243
7113
  }
6244
7114
  | PatchEvent
6245
- | MutationEvent_2
7115
+ | MutationEvent
6246
7116
  | {
6247
7117
  type: 'ready'
6248
7118
  }
@@ -6294,14 +7164,18 @@ export declare const editorMachine: StateMachine<
6294
7164
  | {
6295
7165
  type: 'editable'
6296
7166
  }
7167
+ | {
7168
+ type: 'custom.*'
7169
+ event: CustomBehaviorEvent
7170
+ }
6297
7171
  >
6298
7172
  }
6299
7173
  readonly 'style.*': {
6300
7174
  readonly actions: ActionFunction<
6301
7175
  {
6302
- behaviors: Array<Behavior>
7176
+ behaviors: Set<Behavior>
6303
7177
  keyGenerator: () => string
6304
- pendingEvents: Array<PatchEvent | MutationEvent_2>
7178
+ pendingEvents: Array<PatchEvent | MutationEvent>
6305
7179
  schema: EditorSchema
6306
7180
  initialReadOnly: boolean
6307
7181
  maxBlocks: number | undefined
@@ -6365,7 +7239,7 @@ export declare const editorMachine: StateMachine<
6365
7239
  style: string
6366
7240
  }
6367
7241
  | PatchEvent
6368
- | MutationEvent_2
7242
+ | MutationEvent
6369
7243
  | {
6370
7244
  type: 'normalizing'
6371
7245
  }
@@ -6385,6 +7259,23 @@ export declare const editorMachine: StateMachine<
6385
7259
  preventDefault: () => void
6386
7260
  }
6387
7261
  }
7262
+ | {
7263
+ type: 'custom behavior event'
7264
+ behaviorEvent: CustomBehaviorEvent
7265
+ editor: PortableTextSlateEditor
7266
+ nativeEvent?: {
7267
+ preventDefault: () => void
7268
+ }
7269
+ }
7270
+ | CustomBehaviorEvent
7271
+ | {
7272
+ type: 'add behavior'
7273
+ behavior: Behavior
7274
+ }
7275
+ | {
7276
+ type: 'remove behavior'
7277
+ behavior: Behavior
7278
+ }
6388
7279
  | {
6389
7280
  type: 'update readOnly'
6390
7281
  readOnly: boolean
@@ -6446,6 +7337,10 @@ export declare const editorMachine: StateMachine<
6446
7337
  }
6447
7338
  | {
6448
7339
  type: 'done loading'
7340
+ }
7341
+ | {
7342
+ type: 'custom.*'
7343
+ event: CustomBehaviorEvent
6449
7344
  },
6450
7345
  undefined,
6451
7346
  never,
@@ -6505,7 +7400,7 @@ export declare const editorMachine: StateMachine<
6505
7400
  style: string
6506
7401
  }
6507
7402
  | PatchEvent
6508
- | MutationEvent_2
7403
+ | MutationEvent
6509
7404
  | {
6510
7405
  type: 'ready'
6511
7406
  }
@@ -6557,6 +7452,10 @@ export declare const editorMachine: StateMachine<
6557
7452
  | {
6558
7453
  type: 'editable'
6559
7454
  }
7455
+ | {
7456
+ type: 'custom.*'
7457
+ event: CustomBehaviorEvent
7458
+ }
6560
7459
  >
6561
7460
  }
6562
7461
  }
@@ -6738,7 +7637,7 @@ export declare type InternalEditorEmittedEvent =
6738
7637
  }
6739
7638
  | PatchEvent
6740
7639
  | PatchesEvent
6741
- | MutationEvent_2
7640
+ | MutationEvent
6742
7641
  | {
6743
7642
  type: 'unset'
6744
7643
  previousValue: Array<PortableTextBlock>
@@ -6799,6 +7698,10 @@ export declare type InternalEditorEmittedEvent =
6799
7698
  | 'focus'
6800
7699
  | 'style.toggle'
6801
7700
  >
7701
+ | {
7702
+ type: 'custom.*'
7703
+ event: CustomBehaviorEvent
7704
+ }
6802
7705
 
6803
7706
  /**
6804
7707
  * @internal
@@ -6821,6 +7724,23 @@ export declare type InternalEditorEvent =
6821
7724
  preventDefault: () => void
6822
7725
  }
6823
7726
  }
7727
+ | {
7728
+ type: 'custom behavior event'
7729
+ behaviorEvent: CustomBehaviorEvent
7730
+ editor: PortableTextSlateEditor
7731
+ nativeEvent?: {
7732
+ preventDefault: () => void
7733
+ }
7734
+ }
7735
+ | CustomBehaviorEvent
7736
+ | {
7737
+ type: 'add behavior'
7738
+ behavior: Behavior
7739
+ }
7740
+ | {
7741
+ type: 'remove behavior'
7742
+ behavior: Behavior
7743
+ }
6824
7744
  | {
6825
7745
  type: 'update readOnly'
6826
7746
  readOnly: boolean
@@ -6905,7 +7825,7 @@ export declare type MutationChange = {
6905
7825
  /**
6906
7826
  * @internal
6907
7827
  */
6908
- declare type MutationEvent_2 = {
7828
+ export declare type MutationEvent = {
6909
7829
  type: 'mutation'
6910
7830
  patches: Array<Patch>
6911
7831
  /**
@@ -6914,7 +7834,6 @@ declare type MutationEvent_2 = {
6914
7834
  snapshot: Array<PortableTextBlock> | undefined
6915
7835
  value: Array<PortableTextBlock> | undefined
6916
7836
  }
6917
- export {MutationEvent_2 as MutationEvent}
6918
7837
 
6919
7838
  /**
6920
7839
  * @beta
@@ -7127,9 +8046,9 @@ export declare class PortableTextEditor extends Component<
7127
8046
  path: Path,
7128
8047
  ) => [
7129
8048
  (
7130
- | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
7131
- | PortableTextObject
7132
8049
  | PortableTextSpan
8050
+ | PortableTextObject
8051
+ | PortableTextTextBlock<PortableTextSpan | PortableTextObject>
7133
8052
  | undefined
7134
8053
  ),
7135
8054
  Path | undefined,
@@ -7325,6 +8244,8 @@ export declare interface PortableTextSlateEditor extends ReactEditor {
7325
8244
  redo: () => void
7326
8245
  }
7327
8246
 
8247
+ export {PortableTextSpan}
8248
+
7328
8249
  /**
7329
8250
  * A range decoration is a UI affordance that wraps a given selection range in the editor
7330
8251
  * with a custom component. This can be used to highlight search results,