@portabletext/editor 1.10.1 → 1.11.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.
package/lib/index.d.mts CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  JSX as JSX_2,
33
33
  MutableRefObject,
34
34
  PropsWithChildren,
35
+ default as React_2,
35
36
  RefAttributes,
36
37
  TextareaHTMLAttributes,
37
38
  } from 'react'
@@ -50,16 +51,12 @@ import {
50
51
  AnyActorLogic,
51
52
  AnyActorRef,
52
53
  AnyEventObject,
53
- CallbackActorLogic,
54
- ConditionalRequired,
55
54
  EventObject,
56
- GetConcreteByKey,
57
55
  InputFrom,
58
- IsNotNever,
59
56
  MachineSnapshot,
60
57
  MetaObject,
61
58
  NonReducibleUnknown,
62
- RequiredActorOptions,
59
+ Snapshot,
63
60
  StateMachine,
64
61
  StateValue,
65
62
  Values,
@@ -709,8 +706,8 @@ export declare interface EditableAPIDeleteOptions {
709
706
  */
710
707
  export declare type Editor = {
711
708
  send: (event: EditorEvent) => void
712
- on: EditorActor['on']
713
- readOnly: boolean
709
+ on: ActorRef<Snapshot<unknown>, EventObject, EditorEmittedEvent>['on']
710
+ editable: EditableAPI
714
711
  _internal: {
715
712
  editorActor: EditorActor
716
713
  slateEditor: SlateEditor
@@ -752,6 +749,8 @@ export declare type EditorChanges = Subject<EditorChange>
752
749
  export declare type EditorConfig = {
753
750
  behaviors?: Array<Behavior>
754
751
  keyGenerator?: () => string
752
+ maxBlocks?: number
753
+ readOnly?: boolean
755
754
  initialValue?: Array<PortableTextBlock>
756
755
  } & (
757
756
  | {
@@ -764,6 +763,26 @@ export declare type EditorConfig = {
764
763
  }
765
764
  )
766
765
 
766
+ /**
767
+ * @alpha
768
+ */
769
+ export declare type EditorEmittedEvent = PickFromUnion<
770
+ InternalEditorEmittedEvent,
771
+ 'type',
772
+ | 'blur'
773
+ | 'done loading'
774
+ | 'error'
775
+ | 'focus'
776
+ | 'invalid value'
777
+ | 'loading'
778
+ | 'mutation'
779
+ | 'patch'
780
+ | 'readOnly toggled'
781
+ | 'ready'
782
+ | 'selection'
783
+ | 'value changed'
784
+ >
785
+
767
786
  /**
768
787
  * @alpha
769
788
  */
@@ -778,6 +797,13 @@ export declare type EditorEvent = PickFromUnion<
778
797
  | 'update value'
779
798
  >
780
799
 
800
+ /**
801
+ * @alpha
802
+ */
803
+ export declare function EditorEventListener(props: {
804
+ on: (event: EditorEmittedEvent) => void
805
+ }): null
806
+
781
807
  /**
782
808
  * @internal
783
809
  */
@@ -890,30 +916,14 @@ export declare const editorMachine: StateMachine<
890
916
  type: 'focused'
891
917
  event: FocusEvent_2<HTMLDivElement, Element>
892
918
  }
893
- | {
894
- type: 'online'
895
- }
896
- | {
897
- type: 'offline'
898
- }
899
919
  | {
900
920
  type: 'loading'
901
921
  }
902
922
  | {
903
923
  type: 'done loading'
904
924
  },
905
- {
906
- [x: string]:
907
- | ActorRefFromLogic<
908
- CallbackActorLogic<EventObject, NonReducibleUnknown, EventObject>
909
- >
910
- | undefined
911
- },
912
- {
913
- src: 'networkLogic'
914
- logic: CallbackActorLogic<EventObject, NonReducibleUnknown, EventObject>
915
- id: string | undefined
916
- },
925
+ {},
926
+ never,
917
927
  Values<{
918
928
  'assign behaviors': {
919
929
  type: 'assign behaviors'
@@ -958,6 +968,8 @@ export declare const editorMachine: StateMachine<
958
968
  {
959
969
  behaviors?: Array<Behavior>
960
970
  keyGenerator: () => string
971
+ maxBlocks?: number
972
+ readOnly?: boolean
961
973
  schema: PortableTextMemberSchemaTypes
962
974
  value?: Array<PortableTextBlock>
963
975
  },
@@ -1026,17 +1038,15 @@ export declare const editorMachine: StateMachine<
1026
1038
  type: 'focused'
1027
1039
  event: FocusEvent_2<HTMLDivElement, Element>
1028
1040
  }
1029
- | {
1030
- type: 'online'
1031
- }
1032
- | {
1033
- type: 'offline'
1034
- }
1035
1041
  | {
1036
1042
  type: 'loading'
1037
1043
  }
1038
1044
  | {
1039
1045
  type: 'done loading'
1046
+ }
1047
+ | {
1048
+ type: 'readOnly toggled'
1049
+ readOnly: boolean
1040
1050
  },
1041
1051
  MetaObject,
1042
1052
  {
@@ -1045,60 +1055,10 @@ export declare const editorMachine: StateMachine<
1045
1055
  input,
1046
1056
  }: {
1047
1057
  spawn: {
1048
- <TSrc extends 'networkLogic'>(
1058
+ <TSrc extends never>(
1049
1059
  logic: TSrc,
1050
- ...[options]: {
1051
- src: 'networkLogic'
1052
- logic: CallbackActorLogic<
1053
- EventObject,
1054
- NonReducibleUnknown,
1055
- EventObject
1056
- >
1057
- id: string | undefined
1058
- } extends infer T
1059
- ? T extends {
1060
- src: 'networkLogic'
1061
- logic: CallbackActorLogic<
1062
- EventObject,
1063
- NonReducibleUnknown,
1064
- EventObject
1065
- >
1066
- id: string | undefined
1067
- }
1068
- ? T extends {
1069
- src: TSrc
1070
- }
1071
- ? ConditionalRequired<
1072
- [
1073
- options?:
1074
- | ({
1075
- id?: T['id'] | undefined
1076
- systemId?: string
1077
- input?: InputFrom<T['logic']> | undefined
1078
- syncSnapshot?: boolean
1079
- } & {[K in RequiredActorOptions<T>]: unknown})
1080
- | undefined,
1081
- ],
1082
- IsNotNever<RequiredActorOptions<T>>
1083
- >
1084
- : never
1085
- : never
1086
- : never
1087
- ): ActorRefFromLogic<
1088
- GetConcreteByKey<
1089
- {
1090
- src: 'networkLogic'
1091
- logic: CallbackActorLogic<
1092
- EventObject,
1093
- NonReducibleUnknown,
1094
- EventObject
1095
- >
1096
- id: string | undefined
1097
- },
1098
- 'src',
1099
- TSrc
1100
- >['logic']
1101
- >
1060
+ ...[options]: never
1061
+ ): ActorRefFromLogic<never>
1102
1062
  <TLogic extends AnyActorLogic>(
1103
1063
  src: TLogic,
1104
1064
  options?:
@@ -1114,6 +1074,8 @@ export declare const editorMachine: StateMachine<
1114
1074
  input: {
1115
1075
  behaviors?: Array<Behavior>
1116
1076
  keyGenerator: () => string
1077
+ maxBlocks?: number
1078
+ readOnly?: boolean
1117
1079
  schema: PortableTextMemberSchemaTypes
1118
1080
  value?: Array<PortableTextBlock>
1119
1081
  }
@@ -1227,12 +1189,6 @@ export declare const editorMachine: StateMachine<
1227
1189
  type: 'focused'
1228
1190
  event: FocusEvent_2<HTMLDivElement, Element>
1229
1191
  }
1230
- | {
1231
- type: 'online'
1232
- }
1233
- | {
1234
- type: 'offline'
1235
- }
1236
1192
  | {
1237
1193
  type: 'loading'
1238
1194
  }
@@ -1345,12 +1301,6 @@ export declare const editorMachine: StateMachine<
1345
1301
  type: 'focused'
1346
1302
  event: FocusEvent_2<HTMLDivElement, Element>
1347
1303
  }
1348
- | {
1349
- type: 'online'
1350
- }
1351
- | {
1352
- type: 'offline'
1353
- }
1354
1304
  | {
1355
1305
  type: 'loading'
1356
1306
  }
@@ -1364,14 +1314,10 @@ export declare const editorMachine: StateMachine<
1364
1314
  keyGenerator: () => string
1365
1315
  pendingEvents: never[]
1366
1316
  schema: PortableTextMemberSchemaTypes
1367
- readOnly: false
1368
- maxBlocks: undefined
1317
+ readOnly: boolean
1318
+ maxBlocks: number | undefined
1369
1319
  value: PortableTextBlock[] | undefined
1370
1320
  }
1371
- readonly invoke: {
1372
- readonly id: 'networkLogic'
1373
- readonly src: 'networkLogic'
1374
- }
1375
1321
  readonly on: {
1376
1322
  readonly 'annotation.add': {
1377
1323
  readonly actions: ActionFunction<
@@ -1492,12 +1438,6 @@ export declare const editorMachine: StateMachine<
1492
1438
  type: 'focused'
1493
1439
  event: FocusEvent_2<HTMLDivElement, Element>
1494
1440
  }
1495
- | {
1496
- type: 'online'
1497
- }
1498
- | {
1499
- type: 'offline'
1500
- }
1501
1441
  | {
1502
1442
  type: 'loading'
1503
1443
  }
@@ -1573,18 +1513,16 @@ export declare const editorMachine: StateMachine<
1573
1513
  type: 'focused'
1574
1514
  event: FocusEvent_2<HTMLDivElement, Element>
1575
1515
  }
1576
- | {
1577
- type: 'online'
1578
- }
1579
- | {
1580
- type: 'offline'
1581
- }
1582
1516
  | {
1583
1517
  type: 'loading'
1584
1518
  }
1585
1519
  | {
1586
1520
  type: 'done loading'
1587
1521
  }
1522
+ | {
1523
+ type: 'readOnly toggled'
1524
+ readOnly: boolean
1525
+ }
1588
1526
  >
1589
1527
  readonly guard: ({
1590
1528
  context,
@@ -1725,12 +1663,6 @@ export declare const editorMachine: StateMachine<
1725
1663
  type: 'focused'
1726
1664
  event: FocusEvent_2<HTMLDivElement, Element>
1727
1665
  }
1728
- | {
1729
- type: 'online'
1730
- }
1731
- | {
1732
- type: 'offline'
1733
- }
1734
1666
  | {
1735
1667
  type: 'loading'
1736
1668
  }
@@ -1806,18 +1738,16 @@ export declare const editorMachine: StateMachine<
1806
1738
  type: 'focused'
1807
1739
  event: FocusEvent_2<HTMLDivElement, Element>
1808
1740
  }
1809
- | {
1810
- type: 'online'
1811
- }
1812
- | {
1813
- type: 'offline'
1814
- }
1815
1741
  | {
1816
1742
  type: 'loading'
1817
1743
  }
1818
1744
  | {
1819
1745
  type: 'done loading'
1820
1746
  }
1747
+ | {
1748
+ type: 'readOnly toggled'
1749
+ readOnly: boolean
1750
+ }
1821
1751
  >
1822
1752
  readonly guard: ({
1823
1753
  context,
@@ -1958,12 +1888,6 @@ export declare const editorMachine: StateMachine<
1958
1888
  type: 'focused'
1959
1889
  event: FocusEvent_2<HTMLDivElement, Element>
1960
1890
  }
1961
- | {
1962
- type: 'online'
1963
- }
1964
- | {
1965
- type: 'offline'
1966
- }
1967
1891
  | {
1968
1892
  type: 'loading'
1969
1893
  }
@@ -2039,18 +1963,16 @@ export declare const editorMachine: StateMachine<
2039
1963
  type: 'focused'
2040
1964
  event: FocusEvent_2<HTMLDivElement, Element>
2041
1965
  }
2042
- | {
2043
- type: 'online'
2044
- }
2045
- | {
2046
- type: 'offline'
2047
- }
2048
1966
  | {
2049
1967
  type: 'loading'
2050
1968
  }
2051
1969
  | {
2052
1970
  type: 'done loading'
2053
1971
  }
1972
+ | {
1973
+ type: 'readOnly toggled'
1974
+ readOnly: boolean
1975
+ }
2054
1976
  >
2055
1977
  readonly guard: ({
2056
1978
  context,
@@ -2188,12 +2110,6 @@ export declare const editorMachine: StateMachine<
2188
2110
  type: 'focused'
2189
2111
  event: FocusEvent_2<HTMLDivElement, Element>
2190
2112
  }
2191
- | {
2192
- type: 'online'
2193
- }
2194
- | {
2195
- type: 'offline'
2196
- }
2197
2113
  | {
2198
2114
  type: 'loading'
2199
2115
  }
@@ -2269,18 +2185,16 @@ export declare const editorMachine: StateMachine<
2269
2185
  type: 'focused'
2270
2186
  event: FocusEvent_2<HTMLDivElement, Element>
2271
2187
  }
2272
- | {
2273
- type: 'online'
2274
- }
2275
- | {
2276
- type: 'offline'
2277
- }
2278
2188
  | {
2279
2189
  type: 'loading'
2280
2190
  }
2281
2191
  | {
2282
2192
  type: 'done loading'
2283
2193
  }
2194
+ | {
2195
+ type: 'readOnly toggled'
2196
+ readOnly: boolean
2197
+ }
2284
2198
  >
2285
2199
  readonly guard: ({
2286
2200
  context,
@@ -2412,12 +2326,6 @@ export declare const editorMachine: StateMachine<
2412
2326
  type: 'focused'
2413
2327
  event: FocusEvent_2<HTMLDivElement, Element>
2414
2328
  }
2415
- | {
2416
- type: 'online'
2417
- }
2418
- | {
2419
- type: 'offline'
2420
- }
2421
2329
  | {
2422
2330
  type: 'loading'
2423
2331
  }
@@ -2493,18 +2401,16 @@ export declare const editorMachine: StateMachine<
2493
2401
  type: 'focused'
2494
2402
  event: FocusEvent_2<HTMLDivElement, Element>
2495
2403
  }
2496
- | {
2497
- type: 'online'
2498
- }
2499
- | {
2500
- type: 'offline'
2501
- }
2502
2404
  | {
2503
2405
  type: 'loading'
2504
2406
  }
2505
2407
  | {
2506
2408
  type: 'done loading'
2507
2409
  }
2410
+ | {
2411
+ type: 'readOnly toggled'
2412
+ readOnly: boolean
2413
+ }
2508
2414
  >
2509
2415
  }
2510
2416
  readonly 'unset': {
@@ -2621,12 +2527,6 @@ export declare const editorMachine: StateMachine<
2621
2527
  type: 'focused'
2622
2528
  event: FocusEvent_2<HTMLDivElement, Element>
2623
2529
  }
2624
- | {
2625
- type: 'online'
2626
- }
2627
- | {
2628
- type: 'offline'
2629
- }
2630
2530
  | {
2631
2531
  type: 'loading'
2632
2532
  }
@@ -2702,18 +2602,16 @@ export declare const editorMachine: StateMachine<
2702
2602
  type: 'focused'
2703
2603
  event: FocusEvent_2<HTMLDivElement, Element>
2704
2604
  }
2705
- | {
2706
- type: 'online'
2707
- }
2708
- | {
2709
- type: 'offline'
2710
- }
2711
2605
  | {
2712
2606
  type: 'loading'
2713
2607
  }
2714
2608
  | {
2715
2609
  type: 'done loading'
2716
2610
  }
2611
+ | {
2612
+ type: 'readOnly toggled'
2613
+ readOnly: boolean
2614
+ }
2717
2615
  >
2718
2616
  }
2719
2617
  readonly 'value changed': {
@@ -2830,12 +2728,6 @@ export declare const editorMachine: StateMachine<
2830
2728
  type: 'focused'
2831
2729
  event: FocusEvent_2<HTMLDivElement, Element>
2832
2730
  }
2833
- | {
2834
- type: 'online'
2835
- }
2836
- | {
2837
- type: 'offline'
2838
- }
2839
2731
  | {
2840
2732
  type: 'loading'
2841
2733
  }
@@ -2911,18 +2803,16 @@ export declare const editorMachine: StateMachine<
2911
2803
  type: 'focused'
2912
2804
  event: FocusEvent_2<HTMLDivElement, Element>
2913
2805
  }
2914
- | {
2915
- type: 'online'
2916
- }
2917
- | {
2918
- type: 'offline'
2919
- }
2920
2806
  | {
2921
2807
  type: 'loading'
2922
2808
  }
2923
2809
  | {
2924
2810
  type: 'done loading'
2925
2811
  }
2812
+ | {
2813
+ type: 'readOnly toggled'
2814
+ readOnly: boolean
2815
+ }
2926
2816
  >
2927
2817
  }
2928
2818
  readonly 'invalid value': {
@@ -3040,12 +2930,6 @@ export declare const editorMachine: StateMachine<
3040
2930
  type: 'focused'
3041
2931
  event: FocusEvent_2<HTMLDivElement, Element>
3042
2932
  }
3043
- | {
3044
- type: 'online'
3045
- }
3046
- | {
3047
- type: 'offline'
3048
- }
3049
2933
  | {
3050
2934
  type: 'loading'
3051
2935
  }
@@ -3121,18 +3005,16 @@ export declare const editorMachine: StateMachine<
3121
3005
  type: 'focused'
3122
3006
  event: FocusEvent_2<HTMLDivElement, Element>
3123
3007
  }
3124
- | {
3125
- type: 'online'
3126
- }
3127
- | {
3128
- type: 'offline'
3129
- }
3130
3008
  | {
3131
3009
  type: 'loading'
3132
3010
  }
3133
3011
  | {
3134
3012
  type: 'done loading'
3135
3013
  }
3014
+ | {
3015
+ type: 'readOnly toggled'
3016
+ readOnly: boolean
3017
+ }
3136
3018
  >
3137
3019
  }
3138
3020
  readonly 'error': {
@@ -3251,12 +3133,6 @@ export declare const editorMachine: StateMachine<
3251
3133
  type: 'focused'
3252
3134
  event: FocusEvent_2<HTMLDivElement, Element>
3253
3135
  }
3254
- | {
3255
- type: 'online'
3256
- }
3257
- | {
3258
- type: 'offline'
3259
- }
3260
3136
  | {
3261
3137
  type: 'loading'
3262
3138
  }
@@ -3332,18 +3208,16 @@ export declare const editorMachine: StateMachine<
3332
3208
  type: 'focused'
3333
3209
  event: FocusEvent_2<HTMLDivElement, Element>
3334
3210
  }
3335
- | {
3336
- type: 'online'
3337
- }
3338
- | {
3339
- type: 'offline'
3340
- }
3341
3211
  | {
3342
3212
  type: 'loading'
3343
3213
  }
3344
3214
  | {
3345
3215
  type: 'done loading'
3346
3216
  }
3217
+ | {
3218
+ type: 'readOnly toggled'
3219
+ readOnly: boolean
3220
+ }
3347
3221
  >
3348
3222
  }
3349
3223
  readonly 'selection': {
@@ -3460,12 +3334,6 @@ export declare const editorMachine: StateMachine<
3460
3334
  type: 'focused'
3461
3335
  event: FocusEvent_2<HTMLDivElement, Element>
3462
3336
  }
3463
- | {
3464
- type: 'online'
3465
- }
3466
- | {
3467
- type: 'offline'
3468
- }
3469
3337
  | {
3470
3338
  type: 'loading'
3471
3339
  }
@@ -3541,18 +3409,16 @@ export declare const editorMachine: StateMachine<
3541
3409
  type: 'focused'
3542
3410
  event: FocusEvent_2<HTMLDivElement, Element>
3543
3411
  }
3544
- | {
3545
- type: 'online'
3546
- }
3547
- | {
3548
- type: 'offline'
3549
- }
3550
3412
  | {
3551
3413
  type: 'loading'
3552
3414
  }
3553
3415
  | {
3554
3416
  type: 'done loading'
3555
3417
  }
3418
+ | {
3419
+ type: 'readOnly toggled'
3420
+ readOnly: boolean
3421
+ }
3556
3422
  >
3557
3423
  }
3558
3424
  readonly 'blur': {
@@ -3669,12 +3535,6 @@ export declare const editorMachine: StateMachine<
3669
3535
  type: 'focused'
3670
3536
  event: FocusEvent_2<HTMLDivElement, Element>
3671
3537
  }
3672
- | {
3673
- type: 'online'
3674
- }
3675
- | {
3676
- type: 'offline'
3677
- }
3678
3538
  | {
3679
3539
  type: 'loading'
3680
3540
  }
@@ -3750,18 +3610,16 @@ export declare const editorMachine: StateMachine<
3750
3610
  type: 'focused'
3751
3611
  event: FocusEvent_2<HTMLDivElement, Element>
3752
3612
  }
3753
- | {
3754
- type: 'online'
3755
- }
3756
- | {
3757
- type: 'offline'
3758
- }
3759
3613
  | {
3760
3614
  type: 'loading'
3761
3615
  }
3762
3616
  | {
3763
3617
  type: 'done loading'
3764
3618
  }
3619
+ | {
3620
+ type: 'readOnly toggled'
3621
+ readOnly: boolean
3622
+ }
3765
3623
  >
3766
3624
  }
3767
3625
  readonly 'focused': {
@@ -3878,12 +3736,6 @@ export declare const editorMachine: StateMachine<
3878
3736
  type: 'focused'
3879
3737
  event: FocusEvent_2<HTMLDivElement, Element>
3880
3738
  }
3881
- | {
3882
- type: 'online'
3883
- }
3884
- | {
3885
- type: 'offline'
3886
- }
3887
3739
  | {
3888
3740
  type: 'loading'
3889
3741
  }
@@ -3959,21 +3811,19 @@ export declare const editorMachine: StateMachine<
3959
3811
  type: 'focused'
3960
3812
  event: FocusEvent_2<HTMLDivElement, Element>
3961
3813
  }
3962
- | {
3963
- type: 'online'
3964
- }
3965
- | {
3966
- type: 'offline'
3967
- }
3968
3814
  | {
3969
3815
  type: 'loading'
3970
3816
  }
3971
3817
  | {
3972
3818
  type: 'done loading'
3973
3819
  }
3820
+ | {
3821
+ type: 'readOnly toggled'
3822
+ readOnly: boolean
3823
+ }
3974
3824
  >
3975
3825
  }
3976
- readonly 'online': {
3826
+ readonly 'loading': {
3977
3827
  readonly actions: ActionFunction<
3978
3828
  {
3979
3829
  behaviors: Array<Behavior>
@@ -3985,7 +3835,7 @@ export declare const editorMachine: StateMachine<
3985
3835
  value: Array<PortableTextBlock> | undefined
3986
3836
  },
3987
3837
  {
3988
- type: 'online'
3838
+ type: 'loading'
3989
3839
  },
3990
3840
  | {
3991
3841
  type: 'annotation.add'
@@ -4086,12 +3936,6 @@ export declare const editorMachine: StateMachine<
4086
3936
  type: 'focused'
4087
3937
  event: FocusEvent_2<HTMLDivElement, Element>
4088
3938
  }
4089
- | {
4090
- type: 'online'
4091
- }
4092
- | {
4093
- type: 'offline'
4094
- }
4095
3939
  | {
4096
3940
  type: 'loading'
4097
3941
  }
@@ -4167,21 +4011,19 @@ export declare const editorMachine: StateMachine<
4167
4011
  type: 'focused'
4168
4012
  event: FocusEvent_2<HTMLDivElement, Element>
4169
4013
  }
4170
- | {
4171
- type: 'online'
4172
- }
4173
- | {
4174
- type: 'offline'
4175
- }
4176
4014
  | {
4177
4015
  type: 'loading'
4178
4016
  }
4179
4017
  | {
4180
4018
  type: 'done loading'
4181
4019
  }
4020
+ | {
4021
+ type: 'readOnly toggled'
4022
+ readOnly: boolean
4023
+ }
4182
4024
  >
4183
4025
  }
4184
- readonly 'offline': {
4026
+ readonly 'patches': {
4185
4027
  readonly actions: ActionFunction<
4186
4028
  {
4187
4029
  behaviors: Array<Behavior>
@@ -4192,9 +4034,7 @@ export declare const editorMachine: StateMachine<
4192
4034
  maxBlocks: number | undefined
4193
4035
  value: Array<PortableTextBlock> | undefined
4194
4036
  },
4195
- {
4196
- type: 'offline'
4197
- },
4037
+ PatchesEvent,
4198
4038
  | {
4199
4039
  type: 'annotation.add'
4200
4040
  annotation: {
@@ -4294,12 +4134,6 @@ export declare const editorMachine: StateMachine<
4294
4134
  type: 'focused'
4295
4135
  event: FocusEvent_2<HTMLDivElement, Element>
4296
4136
  }
4297
- | {
4298
- type: 'online'
4299
- }
4300
- | {
4301
- type: 'offline'
4302
- }
4303
4137
  | {
4304
4138
  type: 'loading'
4305
4139
  }
@@ -4375,21 +4209,19 @@ export declare const editorMachine: StateMachine<
4375
4209
  type: 'focused'
4376
4210
  event: FocusEvent_2<HTMLDivElement, Element>
4377
4211
  }
4378
- | {
4379
- type: 'online'
4380
- }
4381
- | {
4382
- type: 'offline'
4383
- }
4384
4212
  | {
4385
4213
  type: 'loading'
4386
4214
  }
4387
4215
  | {
4388
4216
  type: 'done loading'
4389
4217
  }
4218
+ | {
4219
+ type: 'readOnly toggled'
4220
+ readOnly: boolean
4221
+ }
4390
4222
  >
4391
4223
  }
4392
- readonly 'loading': {
4224
+ readonly 'done loading': {
4393
4225
  readonly actions: ActionFunction<
4394
4226
  {
4395
4227
  behaviors: Array<Behavior>
@@ -4401,7 +4233,7 @@ export declare const editorMachine: StateMachine<
4401
4233
  value: Array<PortableTextBlock> | undefined
4402
4234
  },
4403
4235
  {
4404
- type: 'loading'
4236
+ type: 'done loading'
4405
4237
  },
4406
4238
  | {
4407
4239
  type: 'annotation.add'
@@ -4502,12 +4334,6 @@ export declare const editorMachine: StateMachine<
4502
4334
  type: 'focused'
4503
4335
  event: FocusEvent_2<HTMLDivElement, Element>
4504
4336
  }
4505
- | {
4506
- type: 'online'
4507
- }
4508
- | {
4509
- type: 'offline'
4510
- }
4511
4337
  | {
4512
4338
  type: 'loading'
4513
4339
  }
@@ -4583,21 +4409,25 @@ export declare const editorMachine: StateMachine<
4583
4409
  type: 'focused'
4584
4410
  event: FocusEvent_2<HTMLDivElement, Element>
4585
4411
  }
4586
- | {
4587
- type: 'online'
4588
- }
4589
- | {
4590
- type: 'offline'
4591
- }
4592
4412
  | {
4593
4413
  type: 'loading'
4594
4414
  }
4595
4415
  | {
4596
4416
  type: 'done loading'
4597
4417
  }
4418
+ | {
4419
+ type: 'readOnly toggled'
4420
+ readOnly: boolean
4421
+ }
4598
4422
  >
4599
4423
  }
4600
- readonly 'patches': {
4424
+ readonly 'update behaviors': {
4425
+ readonly actions: 'assign behaviors'
4426
+ }
4427
+ readonly 'update schema': {
4428
+ readonly actions: 'assign schema'
4429
+ }
4430
+ readonly 'update value': {
4601
4431
  readonly actions: ActionFunction<
4602
4432
  {
4603
4433
  behaviors: Array<Behavior>
@@ -4608,7 +4438,10 @@ export declare const editorMachine: StateMachine<
4608
4438
  maxBlocks: number | undefined
4609
4439
  value: Array<PortableTextBlock> | undefined
4610
4440
  },
4611
- PatchesEvent,
4441
+ {
4442
+ type: 'update value'
4443
+ value: Array<PortableTextBlock> | undefined
4444
+ },
4612
4445
  | {
4613
4446
  type: 'annotation.add'
4614
4447
  annotation: {
@@ -4708,12 +4541,6 @@ export declare const editorMachine: StateMachine<
4708
4541
  type: 'focused'
4709
4542
  event: FocusEvent_2<HTMLDivElement, Element>
4710
4543
  }
4711
- | {
4712
- type: 'online'
4713
- }
4714
- | {
4715
- type: 'offline'
4716
- }
4717
4544
  | {
4718
4545
  type: 'loading'
4719
4546
  }
@@ -4725,580 +4552,335 @@ export declare const editorMachine: StateMachine<
4725
4552
  never,
4726
4553
  never,
4727
4554
  never,
4728
- | {
4729
- type: 'annotation.add'
4730
- annotation: {
4731
- name: string
4732
- value: {
4733
- [prop: string]: unknown
4734
- }
4735
- }
4736
- }
4737
- | {
4738
- type: 'annotation.remove'
4739
- annotation: {
4740
- name: string
4741
- }
4742
- }
4743
- | {
4744
- type: 'annotation.toggle'
4745
- annotation: {
4746
- name: string
4747
- value: {
4748
- [prop: string]: unknown
4749
- }
4750
- }
4751
- }
4752
- | {
4753
- type: 'focus'
4754
- }
4755
- | PatchEvent
4756
- | MutationEvent_2
4757
- | {
4758
- type: 'ready'
4759
- }
4760
- | PatchesEvent
4761
- | {
4762
- type: 'unset'
4763
- previousValue: Array<PortableTextBlock>
4764
- }
4765
- | {
4766
- type: 'value changed'
4767
- value: Array<PortableTextBlock> | undefined
4768
- }
4769
- | {
4770
- type: 'invalid value'
4771
- resolution: InvalidValueResolution | null
4772
- value: Array<PortableTextBlock> | undefined
4773
- }
4774
- | {
4775
- type: 'error'
4776
- name: string
4777
- description: string
4778
- data: unknown
4779
- }
4780
- | {
4781
- type: 'selection'
4782
- selection: EditorSelection
4783
- }
4784
- | {
4785
- type: 'blur'
4786
- event: FocusEvent_2<HTMLDivElement, Element>
4787
- }
4788
- | {
4789
- type: 'focused'
4790
- event: FocusEvent_2<HTMLDivElement, Element>
4791
- }
4792
- | {
4793
- type: 'online'
4794
- }
4795
- | {
4796
- type: 'offline'
4797
- }
4798
- | {
4799
- type: 'loading'
4800
- }
4801
- | {
4802
- type: 'done loading'
4803
- }
4555
+ never
4804
4556
  >
4805
4557
  }
4806
- readonly 'done loading': {
4807
- readonly actions: ActionFunction<
4808
- {
4809
- behaviors: Array<Behavior>
4810
- keyGenerator: () => string
4811
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4812
- schema: PortableTextMemberSchemaTypes
4813
- readOnly: boolean
4814
- maxBlocks: number | undefined
4815
- value: Array<PortableTextBlock> | undefined
4816
- },
4817
- {
4818
- type: 'done loading'
4819
- },
4820
- | {
4821
- type: 'annotation.add'
4822
- annotation: {
4823
- name: string
4824
- value: {
4825
- [prop: string]: unknown
4826
- }
4827
- }
4828
- }
4829
- | {
4830
- type: 'annotation.remove'
4831
- annotation: {
4832
- name: string
4833
- }
4834
- }
4835
- | {
4836
- type: 'annotation.toggle'
4837
- annotation: {
4838
- name: string
4839
- value: {
4840
- [prop: string]: unknown
4841
- }
4842
- }
4843
- }
4844
- | {
4845
- type: 'focus'
4846
- }
4847
- | PatchEvent
4848
- | MutationEvent_2
4849
- | {
4850
- type: 'normalizing'
4851
- }
4852
- | {
4853
- type: 'done normalizing'
4854
- }
4855
- | {
4856
- type: 'behavior event'
4857
- behaviorEvent: BehaviorEvent
4858
- editor: PortableTextSlateEditor
4859
- }
4860
- | {
4861
- type: 'behavior action intends'
4862
- editor: PortableTextSlateEditor
4863
- actionIntends: Array<BehaviorActionIntend>
4864
- }
4865
- | {
4866
- type: 'update schema'
4867
- schema: PortableTextMemberSchemaTypes
4868
- }
4869
- | {
4870
- type: 'update behaviors'
4558
+ readonly 'toggle readOnly': {
4559
+ readonly actions: readonly [
4560
+ ActionFunction<
4561
+ {
4871
4562
  behaviors: Array<Behavior>
4872
- }
4873
- | {
4874
- type: 'update value'
4875
- value: Array<PortableTextBlock> | undefined
4876
- }
4877
- | {
4878
- type: 'toggle readOnly'
4879
- }
4880
- | {
4881
- type: 'update maxBlocks'
4563
+ keyGenerator: () => string
4564
+ pendingEvents: Array<PatchEvent | MutationEvent_2>
4565
+ schema: PortableTextMemberSchemaTypes
4566
+ readOnly: boolean
4882
4567
  maxBlocks: number | undefined
4883
- }
4884
- | {
4885
- type: 'ready'
4886
- }
4887
- | PatchesEvent
4888
- | {
4889
- type: 'unset'
4890
- previousValue: Array<PortableTextBlock>
4891
- }
4892
- | {
4893
- type: 'value changed'
4894
- value: Array<PortableTextBlock> | undefined
4895
- }
4896
- | {
4897
- type: 'invalid value'
4898
- resolution: InvalidValueResolution | null
4899
4568
  value: Array<PortableTextBlock> | undefined
4900
- }
4901
- | {
4902
- type: 'error'
4903
- name: string
4904
- description: string
4905
- data: unknown
4906
- }
4907
- | {
4908
- type: 'selection'
4909
- selection: EditorSelection
4910
- }
4911
- | {
4912
- type: 'blur'
4913
- event: FocusEvent_2<HTMLDivElement, Element>
4914
- }
4915
- | {
4916
- type: 'focused'
4917
- event: FocusEvent_2<HTMLDivElement, Element>
4918
- }
4919
- | {
4920
- type: 'online'
4921
- }
4922
- | {
4923
- type: 'offline'
4924
- }
4925
- | {
4926
- type: 'loading'
4927
- }
4928
- | {
4929
- type: 'done loading'
4930
4569
  },
4931
- undefined,
4932
- never,
4933
- never,
4934
- never,
4935
- never,
4936
- | {
4937
- type: 'annotation.add'
4938
- annotation: {
4939
- name: string
4940
- value: {
4941
- [prop: string]: unknown
4570
+ {
4571
+ type: 'toggle readOnly'
4572
+ },
4573
+ | {
4574
+ type: 'annotation.add'
4575
+ annotation: {
4576
+ name: string
4577
+ value: {
4578
+ [prop: string]: unknown
4579
+ }
4942
4580
  }
4943
4581
  }
4944
- }
4945
- | {
4946
- type: 'annotation.remove'
4947
- annotation: {
4948
- name: string
4582
+ | {
4583
+ type: 'annotation.remove'
4584
+ annotation: {
4585
+ name: string
4586
+ }
4949
4587
  }
4950
- }
4951
- | {
4952
- type: 'annotation.toggle'
4953
- annotation: {
4954
- name: string
4955
- value: {
4956
- [prop: string]: unknown
4588
+ | {
4589
+ type: 'annotation.toggle'
4590
+ annotation: {
4591
+ name: string
4592
+ value: {
4593
+ [prop: string]: unknown
4594
+ }
4957
4595
  }
4958
4596
  }
4959
- }
4960
- | {
4961
- type: 'focus'
4962
- }
4963
- | PatchEvent
4964
- | MutationEvent_2
4965
- | {
4966
- type: 'ready'
4967
- }
4968
- | PatchesEvent
4969
- | {
4970
- type: 'unset'
4971
- previousValue: Array<PortableTextBlock>
4972
- }
4973
- | {
4974
- type: 'value changed'
4975
- value: Array<PortableTextBlock> | undefined
4976
- }
4977
- | {
4978
- type: 'invalid value'
4979
- resolution: InvalidValueResolution | null
4980
- value: Array<PortableTextBlock> | undefined
4981
- }
4982
- | {
4983
- type: 'error'
4984
- name: string
4985
- description: string
4986
- data: unknown
4987
- }
4988
- | {
4989
- type: 'selection'
4990
- selection: EditorSelection
4991
- }
4992
- | {
4993
- type: 'blur'
4994
- event: FocusEvent_2<HTMLDivElement, Element>
4995
- }
4996
- | {
4997
- type: 'focused'
4998
- event: FocusEvent_2<HTMLDivElement, Element>
4999
- }
5000
- | {
5001
- type: 'online'
5002
- }
5003
- | {
5004
- type: 'offline'
5005
- }
5006
- | {
5007
- type: 'loading'
5008
- }
5009
- | {
5010
- type: 'done loading'
5011
- }
5012
- >
5013
- }
5014
- readonly 'update behaviors': {
5015
- readonly actions: 'assign behaviors'
5016
- }
5017
- readonly 'update schema': {
5018
- readonly actions: 'assign schema'
5019
- }
5020
- readonly 'update value': {
5021
- readonly actions: ActionFunction<
5022
- {
5023
- behaviors: Array<Behavior>
5024
- keyGenerator: () => string
5025
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5026
- schema: PortableTextMemberSchemaTypes
5027
- readOnly: boolean
5028
- maxBlocks: number | undefined
5029
- value: Array<PortableTextBlock> | undefined
5030
- },
5031
- {
5032
- type: 'update value'
5033
- value: Array<PortableTextBlock> | undefined
5034
- },
5035
- | {
5036
- type: 'annotation.add'
5037
- annotation: {
5038
- name: string
5039
- value: {
5040
- [prop: string]: unknown
5041
- }
4597
+ | {
4598
+ type: 'focus'
5042
4599
  }
5043
- }
5044
- | {
5045
- type: 'annotation.remove'
5046
- annotation: {
5047
- name: string
4600
+ | PatchEvent
4601
+ | MutationEvent_2
4602
+ | {
4603
+ type: 'normalizing'
5048
4604
  }
5049
- }
5050
- | {
5051
- type: 'annotation.toggle'
5052
- annotation: {
4605
+ | {
4606
+ type: 'done normalizing'
4607
+ }
4608
+ | {
4609
+ type: 'behavior event'
4610
+ behaviorEvent: BehaviorEvent
4611
+ editor: PortableTextSlateEditor
4612
+ }
4613
+ | {
4614
+ type: 'behavior action intends'
4615
+ editor: PortableTextSlateEditor
4616
+ actionIntends: Array<BehaviorActionIntend>
4617
+ }
4618
+ | {
4619
+ type: 'update schema'
4620
+ schema: PortableTextMemberSchemaTypes
4621
+ }
4622
+ | {
4623
+ type: 'update behaviors'
4624
+ behaviors: Array<Behavior>
4625
+ }
4626
+ | {
4627
+ type: 'update value'
4628
+ value: Array<PortableTextBlock> | undefined
4629
+ }
4630
+ | {
4631
+ type: 'toggle readOnly'
4632
+ }
4633
+ | {
4634
+ type: 'update maxBlocks'
4635
+ maxBlocks: number | undefined
4636
+ }
4637
+ | {
4638
+ type: 'ready'
4639
+ }
4640
+ | PatchesEvent
4641
+ | {
4642
+ type: 'unset'
4643
+ previousValue: Array<PortableTextBlock>
4644
+ }
4645
+ | {
4646
+ type: 'value changed'
4647
+ value: Array<PortableTextBlock> | undefined
4648
+ }
4649
+ | {
4650
+ type: 'invalid value'
4651
+ resolution: InvalidValueResolution | null
4652
+ value: Array<PortableTextBlock> | undefined
4653
+ }
4654
+ | {
4655
+ type: 'error'
5053
4656
  name: string
5054
- value: {
5055
- [prop: string]: unknown
5056
- }
4657
+ description: string
4658
+ data: unknown
5057
4659
  }
5058
- }
5059
- | {
5060
- type: 'focus'
5061
- }
5062
- | PatchEvent
5063
- | MutationEvent_2
5064
- | {
5065
- type: 'normalizing'
5066
- }
5067
- | {
5068
- type: 'done normalizing'
5069
- }
5070
- | {
5071
- type: 'behavior event'
5072
- behaviorEvent: BehaviorEvent
5073
- editor: PortableTextSlateEditor
5074
- }
5075
- | {
5076
- type: 'behavior action intends'
5077
- editor: PortableTextSlateEditor
5078
- actionIntends: Array<BehaviorActionIntend>
5079
- }
5080
- | {
5081
- type: 'update schema'
5082
- schema: PortableTextMemberSchemaTypes
5083
- }
5084
- | {
5085
- type: 'update behaviors'
4660
+ | {
4661
+ type: 'selection'
4662
+ selection: EditorSelection
4663
+ }
4664
+ | {
4665
+ type: 'blur'
4666
+ event: FocusEvent_2<HTMLDivElement, Element>
4667
+ }
4668
+ | {
4669
+ type: 'focused'
4670
+ event: FocusEvent_2<HTMLDivElement, Element>
4671
+ }
4672
+ | {
4673
+ type: 'loading'
4674
+ }
4675
+ | {
4676
+ type: 'done loading'
4677
+ },
4678
+ undefined,
4679
+ never,
4680
+ never,
4681
+ never,
4682
+ never,
4683
+ never
4684
+ >,
4685
+ ActionFunction<
4686
+ {
5086
4687
  behaviors: Array<Behavior>
5087
- }
5088
- | {
5089
- type: 'update value'
5090
- value: Array<PortableTextBlock> | undefined
5091
- }
5092
- | {
5093
- type: 'toggle readOnly'
5094
- }
5095
- | {
5096
- type: 'update maxBlocks'
4688
+ keyGenerator: () => string
4689
+ pendingEvents: Array<PatchEvent | MutationEvent_2>
4690
+ schema: PortableTextMemberSchemaTypes
4691
+ readOnly: boolean
5097
4692
  maxBlocks: number | undefined
5098
- }
5099
- | {
5100
- type: 'ready'
5101
- }
5102
- | PatchesEvent
5103
- | {
5104
- type: 'unset'
5105
- previousValue: Array<PortableTextBlock>
5106
- }
5107
- | {
5108
- type: 'value changed'
5109
- value: Array<PortableTextBlock> | undefined
5110
- }
5111
- | {
5112
- type: 'invalid value'
5113
- resolution: InvalidValueResolution | null
5114
4693
  value: Array<PortableTextBlock> | undefined
5115
- }
5116
- | {
5117
- type: 'error'
5118
- name: string
5119
- description: string
5120
- data: unknown
5121
- }
5122
- | {
5123
- type: 'selection'
5124
- selection: EditorSelection
5125
- }
5126
- | {
5127
- type: 'blur'
5128
- event: FocusEvent_2<HTMLDivElement, Element>
5129
- }
5130
- | {
5131
- type: 'focused'
5132
- event: FocusEvent_2<HTMLDivElement, Element>
5133
- }
5134
- | {
5135
- type: 'online'
5136
- }
5137
- | {
5138
- type: 'offline'
5139
- }
5140
- | {
5141
- type: 'loading'
5142
- }
5143
- | {
5144
- type: 'done loading'
5145
4694
  },
5146
- undefined,
5147
- {
5148
- src: 'networkLogic'
5149
- logic: CallbackActorLogic<
5150
- EventObject,
5151
- NonReducibleUnknown,
5152
- EventObject
5153
- >
5154
- id: string | undefined
5155
- },
5156
- never,
5157
- never,
5158
- never,
5159
- never
5160
- >
5161
- }
5162
- readonly 'toggle readOnly': {
5163
- readonly actions: ActionFunction<
5164
- {
5165
- behaviors: Array<Behavior>
5166
- keyGenerator: () => string
5167
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5168
- schema: PortableTextMemberSchemaTypes
5169
- readOnly: boolean
5170
- maxBlocks: number | undefined
5171
- value: Array<PortableTextBlock> | undefined
5172
- },
5173
- {
5174
- type: 'toggle readOnly'
5175
- },
5176
- | {
5177
- type: 'annotation.add'
5178
- annotation: {
4695
+ {
4696
+ type: 'toggle readOnly'
4697
+ },
4698
+ | {
4699
+ type: 'annotation.add'
4700
+ annotation: {
4701
+ name: string
4702
+ value: {
4703
+ [prop: string]: unknown
4704
+ }
4705
+ }
4706
+ }
4707
+ | {
4708
+ type: 'annotation.remove'
4709
+ annotation: {
4710
+ name: string
4711
+ }
4712
+ }
4713
+ | {
4714
+ type: 'annotation.toggle'
4715
+ annotation: {
4716
+ name: string
4717
+ value: {
4718
+ [prop: string]: unknown
4719
+ }
4720
+ }
4721
+ }
4722
+ | {
4723
+ type: 'focus'
4724
+ }
4725
+ | PatchEvent
4726
+ | MutationEvent_2
4727
+ | {
4728
+ type: 'normalizing'
4729
+ }
4730
+ | {
4731
+ type: 'done normalizing'
4732
+ }
4733
+ | {
4734
+ type: 'behavior event'
4735
+ behaviorEvent: BehaviorEvent
4736
+ editor: PortableTextSlateEditor
4737
+ }
4738
+ | {
4739
+ type: 'behavior action intends'
4740
+ editor: PortableTextSlateEditor
4741
+ actionIntends: Array<BehaviorActionIntend>
4742
+ }
4743
+ | {
4744
+ type: 'update schema'
4745
+ schema: PortableTextMemberSchemaTypes
4746
+ }
4747
+ | {
4748
+ type: 'update behaviors'
4749
+ behaviors: Array<Behavior>
4750
+ }
4751
+ | {
4752
+ type: 'update value'
4753
+ value: Array<PortableTextBlock> | undefined
4754
+ }
4755
+ | {
4756
+ type: 'toggle readOnly'
4757
+ }
4758
+ | {
4759
+ type: 'update maxBlocks'
4760
+ maxBlocks: number | undefined
4761
+ }
4762
+ | {
4763
+ type: 'ready'
4764
+ }
4765
+ | PatchesEvent
4766
+ | {
4767
+ type: 'unset'
4768
+ previousValue: Array<PortableTextBlock>
4769
+ }
4770
+ | {
4771
+ type: 'value changed'
4772
+ value: Array<PortableTextBlock> | undefined
4773
+ }
4774
+ | {
4775
+ type: 'invalid value'
4776
+ resolution: InvalidValueResolution | null
4777
+ value: Array<PortableTextBlock> | undefined
4778
+ }
4779
+ | {
4780
+ type: 'error'
5179
4781
  name: string
5180
- value: {
5181
- [prop: string]: unknown
4782
+ description: string
4783
+ data: unknown
4784
+ }
4785
+ | {
4786
+ type: 'selection'
4787
+ selection: EditorSelection
4788
+ }
4789
+ | {
4790
+ type: 'blur'
4791
+ event: FocusEvent_2<HTMLDivElement, Element>
4792
+ }
4793
+ | {
4794
+ type: 'focused'
4795
+ event: FocusEvent_2<HTMLDivElement, Element>
4796
+ }
4797
+ | {
4798
+ type: 'loading'
4799
+ }
4800
+ | {
4801
+ type: 'done loading'
4802
+ },
4803
+ undefined,
4804
+ never,
4805
+ never,
4806
+ never,
4807
+ never,
4808
+ | {
4809
+ type: 'annotation.add'
4810
+ annotation: {
4811
+ name: string
4812
+ value: {
4813
+ [prop: string]: unknown
4814
+ }
5182
4815
  }
5183
4816
  }
5184
- }
5185
- | {
5186
- type: 'annotation.remove'
5187
- annotation: {
5188
- name: string
4817
+ | {
4818
+ type: 'annotation.remove'
4819
+ annotation: {
4820
+ name: string
4821
+ }
5189
4822
  }
5190
- }
5191
- | {
5192
- type: 'annotation.toggle'
5193
- annotation: {
5194
- name: string
5195
- value: {
5196
- [prop: string]: unknown
4823
+ | {
4824
+ type: 'annotation.toggle'
4825
+ annotation: {
4826
+ name: string
4827
+ value: {
4828
+ [prop: string]: unknown
4829
+ }
5197
4830
  }
5198
4831
  }
5199
- }
5200
- | {
5201
- type: 'focus'
5202
- }
5203
- | PatchEvent
5204
- | MutationEvent_2
5205
- | {
5206
- type: 'normalizing'
5207
- }
5208
- | {
5209
- type: 'done normalizing'
5210
- }
5211
- | {
5212
- type: 'behavior event'
5213
- behaviorEvent: BehaviorEvent
5214
- editor: PortableTextSlateEditor
5215
- }
5216
- | {
5217
- type: 'behavior action intends'
5218
- editor: PortableTextSlateEditor
5219
- actionIntends: Array<BehaviorActionIntend>
5220
- }
5221
- | {
5222
- type: 'update schema'
5223
- schema: PortableTextMemberSchemaTypes
5224
- }
5225
- | {
5226
- type: 'update behaviors'
5227
- behaviors: Array<Behavior>
5228
- }
5229
- | {
5230
- type: 'update value'
5231
- value: Array<PortableTextBlock> | undefined
5232
- }
5233
- | {
5234
- type: 'toggle readOnly'
5235
- }
5236
- | {
5237
- type: 'update maxBlocks'
5238
- maxBlocks: number | undefined
5239
- }
5240
- | {
5241
- type: 'ready'
5242
- }
5243
- | PatchesEvent
5244
- | {
5245
- type: 'unset'
5246
- previousValue: Array<PortableTextBlock>
5247
- }
5248
- | {
5249
- type: 'value changed'
5250
- value: Array<PortableTextBlock> | undefined
5251
- }
5252
- | {
5253
- type: 'invalid value'
5254
- resolution: InvalidValueResolution | null
5255
- value: Array<PortableTextBlock> | undefined
5256
- }
5257
- | {
5258
- type: 'error'
5259
- name: string
5260
- description: string
5261
- data: unknown
5262
- }
5263
- | {
5264
- type: 'selection'
5265
- selection: EditorSelection
5266
- }
5267
- | {
5268
- type: 'blur'
5269
- event: FocusEvent_2<HTMLDivElement, Element>
5270
- }
5271
- | {
5272
- type: 'focused'
5273
- event: FocusEvent_2<HTMLDivElement, Element>
5274
- }
5275
- | {
5276
- type: 'online'
5277
- }
5278
- | {
5279
- type: 'offline'
5280
- }
5281
- | {
5282
- type: 'loading'
5283
- }
5284
- | {
5285
- type: 'done loading'
5286
- },
5287
- undefined,
5288
- {
5289
- src: 'networkLogic'
5290
- logic: CallbackActorLogic<
5291
- EventObject,
5292
- NonReducibleUnknown,
5293
- EventObject
5294
- >
5295
- id: string | undefined
5296
- },
5297
- never,
5298
- never,
5299
- never,
5300
- never
5301
- >
4832
+ | {
4833
+ type: 'focus'
4834
+ }
4835
+ | PatchEvent
4836
+ | MutationEvent_2
4837
+ | {
4838
+ type: 'ready'
4839
+ }
4840
+ | PatchesEvent
4841
+ | {
4842
+ type: 'unset'
4843
+ previousValue: Array<PortableTextBlock>
4844
+ }
4845
+ | {
4846
+ type: 'value changed'
4847
+ value: Array<PortableTextBlock> | undefined
4848
+ }
4849
+ | {
4850
+ type: 'invalid value'
4851
+ resolution: InvalidValueResolution | null
4852
+ value: Array<PortableTextBlock> | undefined
4853
+ }
4854
+ | {
4855
+ type: 'error'
4856
+ name: string
4857
+ description: string
4858
+ data: unknown
4859
+ }
4860
+ | {
4861
+ type: 'selection'
4862
+ selection: EditorSelection
4863
+ }
4864
+ | {
4865
+ type: 'blur'
4866
+ event: FocusEvent_2<HTMLDivElement, Element>
4867
+ }
4868
+ | {
4869
+ type: 'focused'
4870
+ event: FocusEvent_2<HTMLDivElement, Element>
4871
+ }
4872
+ | {
4873
+ type: 'loading'
4874
+ }
4875
+ | {
4876
+ type: 'done loading'
4877
+ }
4878
+ | {
4879
+ type: 'readOnly toggled'
4880
+ readOnly: boolean
4881
+ }
4882
+ >,
4883
+ ]
5302
4884
  }
5303
4885
  readonly 'update maxBlocks': {
5304
4886
  readonly actions: ActionFunction<
@@ -5414,12 +4996,6 @@ export declare const editorMachine: StateMachine<
5414
4996
  type: 'focused'
5415
4997
  event: FocusEvent_2<HTMLDivElement, Element>
5416
4998
  }
5417
- | {
5418
- type: 'online'
5419
- }
5420
- | {
5421
- type: 'offline'
5422
- }
5423
4999
  | {
5424
5000
  type: 'loading'
5425
5001
  }
@@ -5427,15 +5003,7 @@ export declare const editorMachine: StateMachine<
5427
5003
  type: 'done loading'
5428
5004
  },
5429
5005
  undefined,
5430
- {
5431
- src: 'networkLogic'
5432
- logic: CallbackActorLogic<
5433
- EventObject,
5434
- NonReducibleUnknown,
5435
- EventObject
5436
- >
5437
- id: string | undefined
5438
- },
5006
+ never,
5439
5007
  never,
5440
5008
  never,
5441
5009
  never,
@@ -5582,12 +5150,6 @@ export declare const editorMachine: StateMachine<
5582
5150
  type: 'focused'
5583
5151
  event: FocusEvent_2<HTMLDivElement, Element>
5584
5152
  }
5585
- | {
5586
- type: 'online'
5587
- }
5588
- | {
5589
- type: 'offline'
5590
- }
5591
5153
  | {
5592
5154
  type: 'loading'
5593
5155
  }
@@ -5709,12 +5271,6 @@ export declare const editorMachine: StateMachine<
5709
5271
  type: 'focused'
5710
5272
  event: FocusEvent_2<HTMLDivElement, Element>
5711
5273
  }
5712
- | {
5713
- type: 'online'
5714
- }
5715
- | {
5716
- type: 'offline'
5717
- }
5718
5274
  | {
5719
5275
  type: 'loading'
5720
5276
  }
@@ -5722,15 +5278,7 @@ export declare const editorMachine: StateMachine<
5722
5278
  type: 'done loading'
5723
5279
  },
5724
5280
  undefined,
5725
- {
5726
- src: 'networkLogic'
5727
- logic: CallbackActorLogic<
5728
- EventObject,
5729
- NonReducibleUnknown,
5730
- EventObject
5731
- >
5732
- id: string | undefined
5733
- },
5281
+ never,
5734
5282
  Values<{
5735
5283
  'assign behaviors': {
5736
5284
  type: 'assign behaviors'
@@ -5831,18 +5379,16 @@ export declare const editorMachine: StateMachine<
5831
5379
  type: 'focused'
5832
5380
  event: FocusEvent_2<HTMLDivElement, Element>
5833
5381
  }
5834
- | {
5835
- type: 'online'
5836
- }
5837
- | {
5838
- type: 'offline'
5839
- }
5840
5382
  | {
5841
5383
  type: 'loading'
5842
5384
  }
5843
5385
  | {
5844
5386
  type: 'done loading'
5845
5387
  }
5388
+ | {
5389
+ type: 'readOnly toggled'
5390
+ readOnly: boolean
5391
+ }
5846
5392
  >,
5847
5393
  ]
5848
5394
  }
@@ -5903,6 +5449,21 @@ export declare type EditorNode = Node_2 & {
5903
5449
  _type: string
5904
5450
  }
5905
5451
 
5452
+ /**
5453
+ * @alpha
5454
+ */
5455
+ export declare function EditorProvider(
5456
+ props: EditorProviderProps,
5457
+ ): React_2.JSX.Element
5458
+
5459
+ /**
5460
+ * @alpha
5461
+ */
5462
+ export declare type EditorProviderProps = {
5463
+ config: EditorConfig
5464
+ children?: React_2.ReactNode
5465
+ }
5466
+
5906
5467
  /** @beta */
5907
5468
  export declare type EditorSelection = {
5908
5469
  anchor: EditorSelectionPoint
@@ -6000,18 +5561,16 @@ export declare type InternalEditorEmittedEvent =
6000
5561
  type: 'focused'
6001
5562
  event: FocusEvent_2<HTMLDivElement, Element>
6002
5563
  }
6003
- | {
6004
- type: 'online'
6005
- }
6006
- | {
6007
- type: 'offline'
6008
- }
6009
5564
  | {
6010
5565
  type: 'loading'
6011
5566
  }
6012
5567
  | {
6013
5568
  type: 'done loading'
6014
5569
  }
5570
+ | {
5571
+ type: 'readOnly toggled'
5572
+ readOnly: boolean
5573
+ }
6015
5574
  | PickFromUnion<
6016
5575
  BehaviorEvent,
6017
5576
  'type',
@@ -6057,7 +5616,7 @@ export declare type InternalEditorEvent =
6057
5616
  type: 'update maxBlocks'
6058
5617
  maxBlocks: number | undefined
6059
5618
  }
6060
- | InternalEditorEmittedEvent
5619
+ | OmitFromUnion<InternalEditorEmittedEvent, 'type', 'readOnly toggled'>
6061
5620
 
6062
5621
  /**
6063
5622
  * The editor has an invalid value
@@ -6171,6 +5730,15 @@ declare type MutationEvent_2 = {
6171
5730
  }
6172
5731
  export {MutationEvent_2 as MutationEvent}
6173
5732
 
5733
+ /**
5734
+ * @alpha
5735
+ */
5736
+ export declare type OmitFromUnion<
5737
+ TUnion,
5738
+ TTagKey extends keyof TUnion,
5739
+ TOmittedTags extends TUnion[TTagKey],
5740
+ > = TUnion extends Record<TTagKey, TOmittedTags> ? never : TUnion
5741
+
6174
5742
  /** @beta */
6175
5743
  export declare type OnBeforeInputFn = (event: InputEvent) => void
6176
5744
 
@@ -6306,15 +5874,13 @@ export declare class PortableTextEditor extends Component<
6306
5874
  */
6307
5875
  schemaTypes: PortableTextMemberSchemaTypes
6308
5876
  /**
6309
- * The editor API (currently implemented with Slate).
5877
+ * The editor instance
6310
5878
  */
6311
- private editable?
6312
- private editorActor
6313
- private slateEditor
5879
+ private editor
5880
+ private editable
6314
5881
  constructor(props: PortableTextEditorProps)
6315
5882
  componentDidUpdate(prevProps: PortableTextEditorProps): void
6316
5883
  setEditable: (editable: EditableAPI) => void
6317
- private getValue
6318
5884
  render(): JSX_2.Element
6319
5885
  static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[]
6320
5886
  static isAnnotationActive: (
@@ -6337,7 +5903,7 @@ export declare class PortableTextEditor extends Component<
6337
5903
  editor: PortableTextEditor,
6338
5904
  selection: EditorSelection,
6339
5905
  options?: EditableAPIDeleteOptions,
6340
- ) => void | undefined
5906
+ ) => void
6341
5907
  static findDOMNode: (
6342
5908
  editor: PortableTextEditor,
6343
5909
  element: PortableTextBlock | PortableTextChild,
@@ -6345,17 +5911,15 @@ export declare class PortableTextEditor extends Component<
6345
5911
  static findByPath: (
6346
5912
  editor: PortableTextEditor,
6347
5913
  path: Path,
6348
- ) =>
6349
- | []
6350
- | [
6351
- (
6352
- | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
6353
- | PortableTextObject
6354
- | PortableTextSpan
6355
- | undefined
6356
- ),
6357
- Path | undefined,
6358
- ]
5914
+ ) => [
5915
+ (
5916
+ | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
5917
+ | PortableTextObject
5918
+ | PortableTextSpan
5919
+ | undefined
5920
+ ),
5921
+ Path | undefined,
5922
+ ]
6359
5923
  static focus: (editor: PortableTextEditor) => void
6360
5924
  static focusBlock: (
6361
5925
  editor: PortableTextEditor,
@@ -6370,21 +5934,14 @@ export declare class PortableTextEditor extends Component<
6370
5934
  static hasBlockStyle: (
6371
5935
  editor: PortableTextEditor,
6372
5936
  blockStyle: string,
6373
- ) => boolean | undefined
5937
+ ) => boolean
6374
5938
  static hasListStyle: (
6375
5939
  editor: PortableTextEditor,
6376
5940
  listStyle: string,
6377
- ) => boolean | undefined
6378
- static isCollapsedSelection: (
6379
- editor: PortableTextEditor,
6380
- ) => boolean | undefined
6381
- static isExpandedSelection: (
6382
- editor: PortableTextEditor,
6383
- ) => boolean | undefined
6384
- static isMarkActive: (
6385
- editor: PortableTextEditor,
6386
- mark: string,
6387
- ) => boolean | undefined
5941
+ ) => boolean
5942
+ static isCollapsedSelection: (editor: PortableTextEditor) => boolean
5943
+ static isExpandedSelection: (editor: PortableTextEditor) => boolean
5944
+ static isMarkActive: (editor: PortableTextEditor, mark: string) => boolean
6388
5945
  static insertChild: <
6389
5946
  TSchemaType extends {
6390
5947
  name: string
@@ -6411,9 +5968,9 @@ export declare class PortableTextEditor extends Component<
6411
5968
  static isVoid: (
6412
5969
  editor: PortableTextEditor,
6413
5970
  element: PortableTextBlock | PortableTextChild,
6414
- ) => boolean | undefined
5971
+ ) => boolean
6415
5972
  static isObjectPath: (_editor: PortableTextEditor, path: Path) => boolean
6416
- static marks: (editor: PortableTextEditor) => string[] | undefined
5973
+ static marks: (editor: PortableTextEditor) => string[]
6417
5974
  static select: (
6418
5975
  editor: PortableTextEditor,
6419
5976
  selection: EditorSelection | null,
@@ -6425,11 +5982,11 @@ export declare class PortableTextEditor extends Component<
6425
5982
  >(
6426
5983
  editor: PortableTextEditor,
6427
5984
  type: TSchemaType,
6428
- ) => void | undefined
5985
+ ) => void
6429
5986
  static toggleBlockStyle: (
6430
5987
  editor: PortableTextEditor,
6431
5988
  blockStyle: string,
6432
- ) => void | undefined
5989
+ ) => void
6433
5990
  static toggleList: (editor: PortableTextEditor, listStyle: string) => void
6434
5991
  static toggleMark: (editor: PortableTextEditor, mark: string) => void
6435
5992
  static getFragment: (
@@ -6441,7 +5998,7 @@ export declare class PortableTextEditor extends Component<
6441
5998
  editor: PortableTextEditor,
6442
5999
  selectionA: EditorSelection,
6443
6000
  selectionB: EditorSelection,
6444
- ) => boolean | undefined
6001
+ ) => boolean
6445
6002
  }
6446
6003
 
6447
6004
  /**
@@ -6452,7 +6009,7 @@ export declare class PortableTextEditor extends Component<
6452
6009
  export declare type PortableTextEditorProps<
6453
6010
  TEditor extends Editor | undefined = undefined,
6454
6011
  > = PropsWithChildren<
6455
- (TEditor extends Editor
6012
+ TEditor extends Editor
6456
6013
  ? {
6457
6014
  /**
6458
6015
  * @alpha
@@ -6497,7 +6054,7 @@ export declare type PortableTextEditorProps<
6497
6054
  * A ref to the editor instance
6498
6055
  */
6499
6056
  editorRef?: MutableRefObject<PortableTextEditor | null>
6500
- }) & {}
6057
+ }
6501
6058
  >
6502
6059
 
6503
6060
  /** @internal */
@@ -6519,7 +6076,6 @@ export declare type PortableTextMemberSchemaTypes = {
6519
6076
  export declare interface PortableTextSlateEditor extends ReactEditor {
6520
6077
  _key: 'editor'
6521
6078
  _type: 'editor'
6522
- destroy: () => void
6523
6079
  createPlaceholderBlock: () => Descendant
6524
6080
  editable: EditableAPI
6525
6081
  history: History_2
@@ -6759,6 +6315,11 @@ export declare type UnsetChange = {
6759
6315
  */
6760
6316
  export declare function useEditor(config: EditorConfig): Editor
6761
6317
 
6318
+ /**
6319
+ * @alpha
6320
+ */
6321
+ export declare function useEditorContext(): Editor
6322
+
6762
6323
  /**
6763
6324
  * @public
6764
6325
  * Get the current editor object from the React context.