@portabletext/editor 1.22.0 → 1.23.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.cts CHANGED
@@ -615,6 +615,7 @@ export declare type EditorEvent =
615
615
  | 'style.toggle'
616
616
  | 'patches'
617
617
  | 'update behaviors'
618
+ | 'update key generator'
618
619
  | 'update readOnly'
619
620
  | 'update value'
620
621
  >
@@ -787,6 +788,10 @@ export declare const editorMachine: StateMachine<
787
788
  type: 'update behaviors'
788
789
  behaviors: Array<Behavior>
789
790
  }
791
+ | {
792
+ type: 'update key generator'
793
+ keyGenerator: () => string
794
+ }
790
795
  | {
791
796
  type: 'update value'
792
797
  value: Array<PortableTextBlock> | undefined
@@ -1180,6 +1185,10 @@ export declare const editorMachine: StateMachine<
1180
1185
  type: 'update behaviors'
1181
1186
  behaviors: Array<Behavior>
1182
1187
  }
1188
+ | {
1189
+ type: 'update key generator'
1190
+ keyGenerator: () => string
1191
+ }
1183
1192
  | {
1184
1193
  type: 'update value'
1185
1194
  value: Array<PortableTextBlock> | undefined
@@ -1342,6 +1351,10 @@ export declare const editorMachine: StateMachine<
1342
1351
  type: 'update behaviors'
1343
1352
  behaviors: Array<Behavior>
1344
1353
  }
1354
+ | {
1355
+ type: 'update key generator'
1356
+ keyGenerator: () => string
1357
+ }
1345
1358
  | {
1346
1359
  type: 'update value'
1347
1360
  value: Array<PortableTextBlock> | undefined
@@ -1532,6 +1545,10 @@ export declare const editorMachine: StateMachine<
1532
1545
  type: 'update behaviors'
1533
1546
  behaviors: Array<Behavior>
1534
1547
  }
1548
+ | {
1549
+ type: 'update key generator'
1550
+ keyGenerator: () => string
1551
+ }
1535
1552
  | {
1536
1553
  type: 'update value'
1537
1554
  value: Array<PortableTextBlock> | undefined
@@ -1819,6 +1836,10 @@ export declare const editorMachine: StateMachine<
1819
1836
  type: 'update behaviors'
1820
1837
  behaviors: Array<Behavior>
1821
1838
  }
1839
+ | {
1840
+ type: 'update key generator'
1841
+ keyGenerator: () => string
1842
+ }
1822
1843
  | {
1823
1844
  type: 'update value'
1824
1845
  value: Array<PortableTextBlock> | undefined
@@ -2107,6 +2128,10 @@ export declare const editorMachine: StateMachine<
2107
2128
  type: 'update behaviors'
2108
2129
  behaviors: Array<Behavior>
2109
2130
  }
2131
+ | {
2132
+ type: 'update key generator'
2133
+ keyGenerator: () => string
2134
+ }
2110
2135
  | {
2111
2136
  type: 'update value'
2112
2137
  value: Array<PortableTextBlock> | undefined
@@ -2396,6 +2421,10 @@ export declare const editorMachine: StateMachine<
2396
2421
  type: 'update behaviors'
2397
2422
  behaviors: Array<Behavior>
2398
2423
  }
2424
+ | {
2425
+ type: 'update key generator'
2426
+ keyGenerator: () => string
2427
+ }
2399
2428
  | {
2400
2429
  type: 'update value'
2401
2430
  value: Array<PortableTextBlock> | undefined
@@ -2684,6 +2713,10 @@ export declare const editorMachine: StateMachine<
2684
2713
  type: 'update behaviors'
2685
2714
  behaviors: Array<Behavior>
2686
2715
  }
2716
+ | {
2717
+ type: 'update key generator'
2718
+ keyGenerator: () => string
2719
+ }
2687
2720
  | {
2688
2721
  type: 'update value'
2689
2722
  value: Array<PortableTextBlock> | undefined
@@ -2861,6 +2894,10 @@ export declare const editorMachine: StateMachine<
2861
2894
  type: 'update behaviors'
2862
2895
  behaviors: Array<Behavior>
2863
2896
  }
2897
+ | {
2898
+ type: 'update key generator'
2899
+ keyGenerator: () => string
2900
+ }
2864
2901
  | {
2865
2902
  type: 'update value'
2866
2903
  value: Array<PortableTextBlock> | undefined
@@ -3149,6 +3186,10 @@ export declare const editorMachine: StateMachine<
3149
3186
  type: 'update behaviors'
3150
3187
  behaviors: Array<Behavior>
3151
3188
  }
3189
+ | {
3190
+ type: 'update key generator'
3191
+ keyGenerator: () => string
3192
+ }
3152
3193
  | {
3153
3194
  type: 'update value'
3154
3195
  value: Array<PortableTextBlock> | undefined
@@ -3436,6 +3477,10 @@ export declare const editorMachine: StateMachine<
3436
3477
  type: 'update behaviors'
3437
3478
  behaviors: Array<Behavior>
3438
3479
  }
3480
+ | {
3481
+ type: 'update key generator'
3482
+ keyGenerator: () => string
3483
+ }
3439
3484
  | {
3440
3485
  type: 'update value'
3441
3486
  value: Array<PortableTextBlock> | undefined
@@ -3722,6 +3767,10 @@ export declare const editorMachine: StateMachine<
3722
3767
  type: 'update behaviors'
3723
3768
  behaviors: Array<Behavior>
3724
3769
  }
3770
+ | {
3771
+ type: 'update key generator'
3772
+ keyGenerator: () => string
3773
+ }
3725
3774
  | {
3726
3775
  type: 'update value'
3727
3776
  value: Array<PortableTextBlock> | undefined
@@ -4006,6 +4055,10 @@ export declare const editorMachine: StateMachine<
4006
4055
  type: 'update behaviors'
4007
4056
  behaviors: Array<Behavior>
4008
4057
  }
4058
+ | {
4059
+ type: 'update key generator'
4060
+ keyGenerator: () => string
4061
+ }
4009
4062
  | {
4010
4063
  type: 'update value'
4011
4064
  value: Array<PortableTextBlock> | undefined
@@ -4292,6 +4345,10 @@ export declare const editorMachine: StateMachine<
4292
4345
  type: 'update behaviors'
4293
4346
  behaviors: Array<Behavior>
4294
4347
  }
4348
+ | {
4349
+ type: 'update key generator'
4350
+ keyGenerator: () => string
4351
+ }
4295
4352
  | {
4296
4353
  type: 'update value'
4297
4354
  value: Array<PortableTextBlock> | undefined
@@ -4465,6 +4522,189 @@ export declare const editorMachine: StateMachine<
4465
4522
  readonly 'update behaviors': {
4466
4523
  readonly actions: 'assign behaviors'
4467
4524
  }
4525
+ readonly 'update key generator': {
4526
+ readonly actions: ActionFunction<
4527
+ {
4528
+ behaviors: Set<Behavior>
4529
+ keyGenerator: () => string
4530
+ pendingEvents: Array<PatchEvent | MutationEvent>
4531
+ schema: EditorSchema
4532
+ initialReadOnly: boolean
4533
+ maxBlocks: number | undefined
4534
+ selection: EditorSelection
4535
+ value: Array<PortableTextBlock> | undefined
4536
+ },
4537
+ {
4538
+ type: 'update key generator'
4539
+ keyGenerator: () => string
4540
+ },
4541
+ | {
4542
+ type: 'annotation.add'
4543
+ annotation: {
4544
+ name: string
4545
+ value: {
4546
+ [prop: string]: unknown
4547
+ }
4548
+ }
4549
+ }
4550
+ | {
4551
+ type: 'annotation.remove'
4552
+ annotation: {
4553
+ name: string
4554
+ }
4555
+ }
4556
+ | {
4557
+ type: 'blur'
4558
+ }
4559
+ | {
4560
+ type: 'decorator.toggle'
4561
+ decorator: string
4562
+ }
4563
+ | {
4564
+ type: 'focus'
4565
+ }
4566
+ | {
4567
+ type: 'insert.block object'
4568
+ placement: 'auto' | 'after' | 'before'
4569
+ blockObject: {
4570
+ name: string
4571
+ value?: {
4572
+ [prop: string]: unknown
4573
+ }
4574
+ }
4575
+ }
4576
+ | {
4577
+ type: 'insert.inline object'
4578
+ inlineObject: {
4579
+ name: string
4580
+ value?: {
4581
+ [prop: string]: unknown
4582
+ }
4583
+ }
4584
+ }
4585
+ | {
4586
+ type: 'list item.toggle'
4587
+ listItem: string
4588
+ }
4589
+ | {
4590
+ type: 'style.toggle'
4591
+ style: string
4592
+ }
4593
+ | PatchEvent
4594
+ | MutationEvent
4595
+ | {
4596
+ type: 'normalizing'
4597
+ }
4598
+ | {
4599
+ type: 'done normalizing'
4600
+ }
4601
+ | {
4602
+ type: 'done syncing initial value'
4603
+ }
4604
+ | {
4605
+ type: 'behavior event'
4606
+ behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4607
+ editor: PortableTextSlateEditor
4608
+ defaultActionCallback?: () => void
4609
+ nativeEvent?: {
4610
+ preventDefault: () => void
4611
+ }
4612
+ }
4613
+ | {
4614
+ type: 'custom behavior event'
4615
+ behaviorEvent: CustomBehaviorEvent
4616
+ editor: PortableTextSlateEditor
4617
+ nativeEvent?: {
4618
+ preventDefault: () => void
4619
+ }
4620
+ }
4621
+ | CustomBehaviorEvent
4622
+ | {
4623
+ type: 'add behavior'
4624
+ behavior: Behavior
4625
+ }
4626
+ | {
4627
+ type: 'remove behavior'
4628
+ behavior: Behavior
4629
+ }
4630
+ | {
4631
+ type: 'update readOnly'
4632
+ readOnly: boolean
4633
+ }
4634
+ | {
4635
+ type: 'update schema'
4636
+ schema: EditorSchema
4637
+ }
4638
+ | {
4639
+ type: 'update behaviors'
4640
+ behaviors: Array<Behavior>
4641
+ }
4642
+ | {
4643
+ type: 'update key generator'
4644
+ keyGenerator: () => string
4645
+ }
4646
+ | {
4647
+ type: 'update value'
4648
+ value: Array<PortableTextBlock> | undefined
4649
+ }
4650
+ | {
4651
+ type: 'update maxBlocks'
4652
+ maxBlocks: number | undefined
4653
+ }
4654
+ | PatchesEvent
4655
+ | {
4656
+ type: 'unset'
4657
+ previousValue: Array<PortableTextBlock>
4658
+ }
4659
+ | {
4660
+ type: 'value changed'
4661
+ value: Array<PortableTextBlock> | undefined
4662
+ }
4663
+ | {
4664
+ type: 'invalid value'
4665
+ resolution: InvalidValueResolution | null
4666
+ value: Array<PortableTextBlock> | undefined
4667
+ }
4668
+ | {
4669
+ type: 'error'
4670
+ name: string
4671
+ description: string
4672
+ data: unknown
4673
+ }
4674
+ | {
4675
+ type: 'select'
4676
+ selection: EditorSelection
4677
+ }
4678
+ | {
4679
+ type: 'selection'
4680
+ selection: EditorSelection
4681
+ }
4682
+ | {
4683
+ type: 'blurred'
4684
+ event: FocusEvent_2<HTMLDivElement, Element>
4685
+ }
4686
+ | {
4687
+ type: 'focused'
4688
+ event: FocusEvent_2<HTMLDivElement, Element>
4689
+ }
4690
+ | {
4691
+ type: 'loading'
4692
+ }
4693
+ | {
4694
+ type: 'done loading'
4695
+ }
4696
+ | {
4697
+ type: 'custom.*'
4698
+ event: CustomBehaviorEvent
4699
+ },
4700
+ undefined,
4701
+ never,
4702
+ never,
4703
+ never,
4704
+ never,
4705
+ never
4706
+ >
4707
+ }
4468
4708
  readonly 'update schema': {
4469
4709
  readonly actions: 'assign schema'
4470
4710
  }
@@ -4585,6 +4825,10 @@ export declare const editorMachine: StateMachine<
4585
4825
  type: 'update behaviors'
4586
4826
  behaviors: Array<Behavior>
4587
4827
  }
4828
+ | {
4829
+ type: 'update key generator'
4830
+ keyGenerator: () => string
4831
+ }
4588
4832
  | {
4589
4833
  type: 'update value'
4590
4834
  value: Array<PortableTextBlock> | undefined
@@ -4764,6 +5008,10 @@ export declare const editorMachine: StateMachine<
4764
5008
  type: 'update behaviors'
4765
5009
  behaviors: Array<Behavior>
4766
5010
  }
5011
+ | {
5012
+ type: 'update key generator'
5013
+ keyGenerator: () => string
5014
+ }
4767
5015
  | {
4768
5016
  type: 'update value'
4769
5017
  value: Array<PortableTextBlock> | undefined
@@ -5052,6 +5300,10 @@ export declare const editorMachine: StateMachine<
5052
5300
  type: 'update behaviors'
5053
5301
  behaviors: Array<Behavior>
5054
5302
  }
5303
+ | {
5304
+ type: 'update key generator'
5305
+ keyGenerator: () => string
5306
+ }
5055
5307
  | {
5056
5308
  type: 'update value'
5057
5309
  value: Array<PortableTextBlock> | undefined
@@ -5340,6 +5592,10 @@ export declare const editorMachine: StateMachine<
5340
5592
  type: 'update behaviors'
5341
5593
  behaviors: Array<Behavior>
5342
5594
  }
5595
+ | {
5596
+ type: 'update key generator'
5597
+ keyGenerator: () => string
5598
+ }
5343
5599
  | {
5344
5600
  type: 'update value'
5345
5601
  value: Array<PortableTextBlock> | undefined
@@ -5630,6 +5886,10 @@ export declare const editorMachine: StateMachine<
5630
5886
  type: 'update behaviors'
5631
5887
  behaviors: Array<Behavior>
5632
5888
  }
5889
+ | {
5890
+ type: 'update key generator'
5891
+ keyGenerator: () => string
5892
+ }
5633
5893
  | {
5634
5894
  type: 'update value'
5635
5895
  value: Array<PortableTextBlock> | undefined
@@ -5919,6 +6179,10 @@ export declare const editorMachine: StateMachine<
5919
6179
  type: 'update behaviors'
5920
6180
  behaviors: Array<Behavior>
5921
6181
  }
6182
+ | {
6183
+ type: 'update key generator'
6184
+ keyGenerator: () => string
6185
+ }
5922
6186
  | {
5923
6187
  type: 'update value'
5924
6188
  value: Array<PortableTextBlock> | undefined
@@ -6207,6 +6471,10 @@ export declare const editorMachine: StateMachine<
6207
6471
  type: 'update behaviors'
6208
6472
  behaviors: Array<Behavior>
6209
6473
  }
6474
+ | {
6475
+ type: 'update key generator'
6476
+ keyGenerator: () => string
6477
+ }
6210
6478
  | {
6211
6479
  type: 'update value'
6212
6480
  value: Array<PortableTextBlock> | undefined
@@ -6511,6 +6779,10 @@ export declare const editorMachine: StateMachine<
6511
6779
  type: 'update behaviors'
6512
6780
  behaviors: Array<Behavior>
6513
6781
  }
6782
+ | {
6783
+ type: 'update key generator'
6784
+ keyGenerator: () => string
6785
+ }
6514
6786
  | {
6515
6787
  type: 'update value'
6516
6788
  value: Array<PortableTextBlock> | undefined
@@ -6800,6 +7072,10 @@ export declare const editorMachine: StateMachine<
6800
7072
  type: 'update behaviors'
6801
7073
  behaviors: Array<Behavior>
6802
7074
  }
7075
+ | {
7076
+ type: 'update key generator'
7077
+ keyGenerator: () => string
7078
+ }
6803
7079
  | {
6804
7080
  type: 'update value'
6805
7081
  value: Array<PortableTextBlock> | undefined
@@ -7089,6 +7365,10 @@ export declare const editorMachine: StateMachine<
7089
7365
  type: 'update behaviors'
7090
7366
  behaviors: Array<Behavior>
7091
7367
  }
7368
+ | {
7369
+ type: 'update key generator'
7370
+ keyGenerator: () => string
7371
+ }
7092
7372
  | {
7093
7373
  type: 'update value'
7094
7374
  value: Array<PortableTextBlock> | undefined
@@ -7378,6 +7658,10 @@ export declare const editorMachine: StateMachine<
7378
7658
  type: 'update behaviors'
7379
7659
  behaviors: Array<Behavior>
7380
7660
  }
7661
+ | {
7662
+ type: 'update key generator'
7663
+ keyGenerator: () => string
7664
+ }
7381
7665
  | {
7382
7666
  type: 'update value'
7383
7667
  value: Array<PortableTextBlock> | undefined
@@ -7859,6 +8143,10 @@ export declare type InternalEditorEvent =
7859
8143
  type: 'update behaviors'
7860
8144
  behaviors: Array<Behavior>
7861
8145
  }
8146
+ | {
8147
+ type: 'update key generator'
8148
+ keyGenerator: () => string
8149
+ }
7862
8150
  | {
7863
8151
  type: 'update value'
7864
8152
  value: Array<PortableTextBlock> | undefined