@portabletext/editor 1.48.8 → 1.48.10

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.
@@ -1,10 +1,18 @@
1
1
  import type {Patch} from '@portabletext/patches'
2
- import {ClientPerspective, SanityClient} from '@sanity/client'
3
- import {
4
- PortableTextObject as PortableTextObject_2,
5
- PortableTextSpan as PortableTextSpan_2,
2
+ import type {
3
+ ArraySchemaType,
4
+ BlockDecoratorDefinition,
5
+ BlockListDefinition,
6
+ BlockStyleDefinition,
7
+ KeyedSegment,
8
+ ObjectSchemaType,
9
+ Path,
10
+ PortableTextBlock,
11
+ PortableTextChild,
12
+ PortableTextListBlock,
13
+ PortableTextTextBlock,
6
14
  } from '@sanity/types'
7
- import {ComponentType, ElementType, ReactNode} from 'react'
15
+ import {PortableTextObject, PortableTextSpan} from '@sanity/types'
8
16
  import type {
9
17
  FocusEvent as FocusEvent_2,
10
18
  KeyboardEvent as KeyboardEvent_2,
@@ -205,277 +213,6 @@ declare const abstractBehaviorEventTypes: readonly [
205
213
  'style.toggle',
206
214
  ]
207
215
 
208
- /**
209
- * Types of array actions that can be performed
210
- * @beta
211
- */
212
- declare type ArrayActionName =
213
- /**
214
- * Add any item to the array at any position
215
- */
216
- | 'add'
217
- /**
218
- * Add item after an existing item
219
- */
220
- | 'addBefore'
221
- /**
222
- * Add item after an existing item
223
- */
224
- | 'addAfter'
225
- /**
226
- * Remove any item
227
- */
228
- | 'remove'
229
- /**
230
- * Duplicate item
231
- */
232
- | 'duplicate'
233
- /**
234
- * Copy item
235
- */
236
- | 'copy'
237
-
238
- /** @public */
239
- declare interface ArrayDefinition extends BaseSchemaDefinition {
240
- type: 'array'
241
- of: ArrayOfType[]
242
- initialValue?: InitialValueProperty<any, unknown[]>
243
- validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>
244
- options?: ArrayOptions
245
- }
246
-
247
- /** @public */
248
- declare type ArrayOfEntry<T> = Omit<T, 'name' | 'hidden'> & {
249
- name?: string
250
- }
251
-
252
- /** @public */
253
- declare type ArrayOfType<
254
- TType extends IntrinsicTypeName = IntrinsicTypeName,
255
- TAlias extends IntrinsicTypeName | undefined = undefined,
256
- > =
257
- | IntrinsicArrayOfDefinition[TType]
258
- | ArrayOfEntry<TypeAliasDefinition<string, TAlias>>
259
-
260
- /** @public */
261
- declare interface ArrayOptions<V = unknown>
262
- extends SearchConfiguration,
263
- BaseSchemaTypeOptions {
264
- list?: TitledListValue<V>[] | V[]
265
- layout?: 'list' | 'tags' | 'grid'
266
- /** @deprecated This option does not have any effect anymore */
267
- direction?: 'horizontal' | 'vertical'
268
- sortable?: boolean
269
- modal?: {
270
- type?: 'dialog' | 'popover'
271
- width?: number | 'auto'
272
- }
273
- /** @alpha This API may change */
274
- insertMenu?: InsertMenuOptions
275
- /**
276
- * A boolean flag to enable or disable tree editing for the array.
277
- * If there are any nested arrays, they will inherit this value.
278
- * @deprecated tree editing beta feature has been disabled
279
- */
280
- treeEditing?: boolean
281
- /**
282
- * A list of array actions to disable
283
- * Possible options are defined by {@link ArrayActionName}
284
- * @beta
285
- */
286
- disableActions?: ArrayActionName[]
287
- }
288
-
289
- /** @public */
290
- declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {
291
- min: (length: number | FieldReference) => ArrayRule<Value>
292
- max: (length: number | FieldReference) => ArrayRule<Value>
293
- length: (length: number | FieldReference) => ArrayRule<Value>
294
- unique: () => ArrayRule<Value>
295
- }
296
-
297
- /** @public */
298
- declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {
299
- jsonType: 'array'
300
- of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[]
301
- options?: ArrayOptions<V> & {
302
- layout?: V extends string ? 'tag' : 'grid'
303
- }
304
- }
305
-
306
- /** @public */
307
- declare interface Asset extends SanityDocument {
308
- url: string
309
- path: string
310
- assetId: string
311
- extension: string
312
- mimeType: string
313
- sha1hash: string
314
- size: number
315
- originalFilename?: string
316
- label?: string
317
- title?: string
318
- description?: string
319
- creditLine?: string
320
- source?: AssetSourceSpec
321
- }
322
-
323
- /** @public */
324
- declare type AssetFromSource = {
325
- kind: 'assetDocumentId' | 'file' | 'base64' | 'url'
326
- value: string | File_2
327
- assetDocumentProps?: ImageAsset
328
- mediaLibraryProps?: {
329
- mediaLibraryId: string
330
- assetId: string
331
- assetInstanceId: string
332
- }
333
- }
334
-
335
- /** @public */
336
- declare interface AssetSource {
337
- name: string
338
- /** @deprecated provide `i18nKey` instead */
339
- title?: string
340
- i18nKey?: string
341
- component: ComponentType<AssetSourceComponentProps>
342
- icon?: ComponentType<EmptyProps>
343
- /** @beta */
344
- uploader?: AssetSourceUploader
345
- }
346
-
347
- /** @public */
348
- declare interface AssetSourceComponentProps {
349
- action?: 'select' | 'upload'
350
- assetSource: AssetSource
351
- assetType?: 'file' | 'image'
352
- accept: string
353
- selectionType: 'single'
354
- dialogHeaderTitle?: React.ReactNode
355
- selectedAssets: Asset[]
356
- onClose: () => void
357
- onSelect: (assetFromSource: AssetFromSource[]) => void
358
- }
359
-
360
- /** @public */
361
- declare interface AssetSourceSpec {
362
- id: string
363
- name: string
364
- url?: string
365
- }
366
-
367
- /** @beta */
368
- declare interface AssetSourceUploader {
369
- upload(
370
- files: globalThis.File[],
371
- options?: {
372
- /**
373
- * The schema type of the field the asset is being uploaded to.
374
- * May be of interest to the uploader to read file and image options.
375
- */
376
- schemaType?: SchemaType
377
- /**
378
- * The uploader may send patches directly to the field
379
- * Typed 'unknown' as we don't have patch definitions in sanity/types yet.
380
- */
381
- onChange?: (patch: unknown) => void
382
- },
383
- ): AssetSourceUploadFile[]
384
- /**
385
- * Abort the upload of a file
386
- */
387
- abort(file?: AssetSourceUploadFile): void
388
- /**
389
- * Get the files that are currently being uploaded
390
- */
391
- getFiles(): AssetSourceUploadFile[]
392
- /**
393
- * Subscribe to upload events from the uploader
394
- */
395
- subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void
396
- /**
397
- * Update the status of a file. Will be emitted to subscribers.
398
- */
399
- updateFile(
400
- fileId: string,
401
- data: {
402
- progress?: number
403
- status?: string
404
- error?: Error
405
- },
406
- ): void
407
- /**
408
- * Reset the uploader (clear files). Should be called by the uploader when all files are done.
409
- */
410
- reset(): void
411
- }
412
-
413
- /** @beta */
414
- declare type AssetSourceUploadEvent =
415
- | AssetSourceUploadEventProgress
416
- | AssetSourceUploadEventStatus
417
- | AssetSourceUploadEventAllComplete
418
- | AssetSourceUploadEventError
419
- | AssetSourceUploadEventAbort
420
-
421
- /**
422
- * Emitted when all files are done, either successfully, aborted or with errors
423
- * @beta */
424
- declare type AssetSourceUploadEventAbort = {
425
- type: 'abort'
426
- /**
427
- * Files aborted
428
- */
429
- files: AssetSourceUploadFile[]
430
- }
431
-
432
- /**
433
- * Emitted when all files are done, either successfully, aborted or with errors
434
- * @beta */
435
- declare type AssetSourceUploadEventAllComplete = {
436
- type: 'all-complete'
437
- files: AssetSourceUploadFile[]
438
- }
439
-
440
- /**
441
- * Emitted when all files are done, either successfully, aborted or with errors
442
- * @beta */
443
- declare type AssetSourceUploadEventError = {
444
- type: 'error'
445
- /**
446
- * Files errored
447
- */
448
- files: AssetSourceUploadFile[]
449
- }
450
-
451
- /**
452
- * Emitted when a file upload is progressing
453
- * @beta */
454
- declare type AssetSourceUploadEventProgress = {
455
- type: 'progress'
456
- file: AssetSourceUploadFile
457
- progress: number
458
- }
459
-
460
- /**
461
- * Emitted when a file upload is changing status
462
- * @beta */
463
- declare type AssetSourceUploadEventStatus = {
464
- type: 'status'
465
- file: AssetSourceUploadFile
466
- status: AssetSourceUploadFile['status']
467
- }
468
-
469
- /** @beta */
470
- declare interface AssetSourceUploadFile {
471
- id: string
472
- file: globalThis.File
473
- progress: number
474
- status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted'
475
- error?: Error
476
- result?: unknown
477
- }
478
-
479
216
  /**
480
217
  * @public
481
218
  */
@@ -484,60 +221,6 @@ declare type BaseDefinition = {
484
221
  title?: string
485
222
  }
486
223
 
487
- /** @public */
488
- declare interface BaseSchemaDefinition {
489
- name: string
490
- title?: string
491
- description?: string | React.JSX.Element
492
- hidden?: ConditionalProperty
493
- readOnly?: ConditionalProperty
494
- icon?: ComponentType | ReactNode
495
- validation?: unknown
496
- initialValue?: unknown
497
- deprecated?: DeprecatedProperty
498
- }
499
-
500
- /** @public */
501
- declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
502
- name: string
503
- title?: string
504
- description?: string
505
- type?: SchemaType
506
- liveEdit?: boolean
507
- readOnly?: ConditionalProperty
508
- hidden?: ConditionalProperty
509
- icon?: ComponentType
510
- initialValue?: InitialValueProperty<any, any>
511
- validation?: SchemaValidationValue
512
- preview?: PreviewConfig
513
- /** @beta */
514
- components?: {
515
- block?: ComponentType<any>
516
- inlineBlock?: ComponentType<any>
517
- annotation?: ComponentType<any>
518
- diff?: ComponentType<any>
519
- field?: ComponentType<any>
520
- input?: ComponentType<any>
521
- item?: ComponentType<any>
522
- preview?: ComponentType<any>
523
- }
524
- /**
525
- * @deprecated This will be removed.
526
- */
527
- placeholder?: string
528
- }
529
-
530
- /**
531
- * `BaseOptions` applies to all type options.
532
- *
533
- * It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.
534
- *
535
- * @public
536
- * */
537
- declare interface BaseSchemaTypeOptions {
538
- sanityCreate?: SanityCreateOptions
539
- }
540
-
541
224
  /**
542
225
  * @beta
543
226
  */
@@ -623,142 +306,6 @@ declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
623
306
  event: TBehaviorEvent
624
307
  }) => TGuardResponse | false
625
308
 
626
- /**
627
- * Schema definition for text block decorators.
628
- *
629
- * @public
630
- * @example The default set of decorators
631
- * ```ts
632
- * {
633
- * name: 'blockContent',
634
- * title: 'Content',
635
- * type: 'array',
636
- * of: [
637
- * {
638
- * type: 'block',
639
- * marks: {
640
- * decorators: [
641
- * {title: 'Strong', value: 'strong'},
642
- * {title: 'Emphasis', value: 'em'},
643
- * {title: 'Underline', value: 'underline'},
644
- * {title: 'Strike', value: 'strike'},
645
- * {title: 'Code', value: 'code'},
646
- * ]
647
- * }
648
- * }
649
- * ]
650
- * }
651
- * ```
652
- */
653
- declare interface BlockDecoratorDefinition {
654
- title: string
655
- i18nTitleKey?: string
656
- value: string
657
- icon?: ReactNode | ComponentType
658
- }
659
-
660
- /**
661
- * Schema definition for text blocks.
662
- *
663
- * @public
664
- * @example the default block definition
665
- * ```ts
666
- * {
667
- * name: 'blockContent',
668
- * title: 'Content',
669
- * type: 'array',
670
- * of: [
671
- * {
672
- * type: 'block',
673
- * marks: {
674
- * decorators: [
675
- * {title: 'Strong', value: 'strong'},
676
- * {title: 'Emphasis', value: 'em'},
677
- * {title: 'Underline', value: 'underline'},
678
- * {title: 'Strike', value: 'strike'},
679
- * {title: 'Code', value: 'code'},
680
- * ],
681
- * annotations: [
682
- * {
683
- * type: 'object',
684
- * name: 'link',
685
- * fields: [
686
- * {
687
- * type: 'string',
688
- * name: 'href',
689
- * },
690
- * ],
691
- * },
692
- * ]
693
- * },
694
- * styles: [
695
- * {title: 'Normal', value: 'normal'},
696
- * {title: 'H1', value: 'h1'},
697
- * {title: 'H2', value: 'h2'},
698
- * {title: 'H3', value: 'h3'},
699
- * {title: 'H4', value: 'h4'},
700
- * {title: 'H5', value: 'h5'},
701
- * {title: 'H6', value: 'h6'},
702
- * {title: 'Quote', value: 'blockquote'}
703
- * ],
704
- * lists: [
705
- * {title: 'Bullet', value: 'bullet'},
706
- * {title: 'Number', value: 'number'},
707
- * ],
708
- * },
709
- * ]
710
- * }
711
- * ```
712
- */
713
- declare interface BlockDefinition extends BaseSchemaDefinition {
714
- type: 'block'
715
- styles?: BlockStyleDefinition[]
716
- lists?: BlockListDefinition[]
717
- marks?: BlockMarksDefinition
718
- of?: ArrayOfType<'object' | 'reference'>[]
719
- initialValue?: InitialValueProperty<any, any[]>
720
- options?: BlockOptions
721
- validation?: ValidationBuilder<BlockRule, any[]>
722
- }
723
-
724
- /**
725
- * Schema definition for a text block list style.
726
- *
727
- * @public
728
- * @example The defaults lists
729
- * ```ts
730
- * {
731
- * name: 'blockContent',
732
- * title: 'Content',
733
- * type: 'array',
734
- * of: [
735
- * {
736
- * type: 'block',
737
- * lists: [
738
- * {title: 'Bullet', value: 'bullet'},
739
- * {title: 'Number', value: 'number'},
740
- * ]
741
- * }
742
- * ]
743
- * }
744
- * ```
745
- */
746
- declare interface BlockListDefinition {
747
- title: string
748
- i18nTitleKey?: string
749
- value: string
750
- icon?: ReactNode | ComponentType
751
- }
752
-
753
- /**
754
- * Schema definition for text block marks (decorators and annotations).
755
- *
756
- * @public */
757
- declare interface BlockMarksDefinition {
758
- decorators?: BlockDecoratorDefinition[]
759
- annotations?: ArrayOfType<'object' | 'reference'>[]
760
- }
761
-
762
309
  /**
763
310
  * @beta
764
311
  */
@@ -825,108 +372,10 @@ export declare function blockOffsetToSpanSelectionPoint({
825
372
  }
826
373
  | undefined
827
374
 
828
- /**
829
- * Schema options for a Block schema definition
830
- * @public */
831
- declare interface BlockOptions extends BaseSchemaTypeOptions {
832
- /**
833
- * Turn on or off the builtin browser spellchecking. Default is on.
834
- */
835
- spellCheck?: boolean
836
- unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove'
837
- }
838
-
839
- /** @public */
840
- declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
841
-
842
- /**
843
- * Schema definition for a text block style.
844
- * A text block may have a block style like 'header', 'normal', 'lead'
845
- * attached to it, which is stored on the `.style` property for that block.
846
- *
847
- * @public
848
- * @remarks The first defined style will become the default style.´´
849
- * @example The default set of styles
850
- * ```ts
851
- * {
852
- * name: 'blockContent',
853
- * title: 'Content',
854
- * type: 'array',
855
- * of: [
856
- * {
857
- * type: 'block',
858
- * styles: [
859
- * {title: 'Normal', value: 'normal'},
860
- * {title: 'H1', value: 'h1'},
861
- * {title: 'H2', value: 'h2'},
862
- * {title: 'H3', value: 'h3'},
863
- * {title: 'H4', value: 'h4'},
864
- * {title: 'H5', value: 'h5'},
865
- * {title: 'H6', value: 'h6'},
866
- * {title: 'Quote', value: 'blockquote'}
867
- * ]
868
- * }
869
- * ]
870
- * }
871
- * ```
872
- * @example Example of defining a block type with custom styles and render components.
873
- * ```ts
874
- * defineArrayMember({
875
- * type: 'block',
876
- * styles: [
877
- * {
878
- * title: 'Paragraph',
879
- * value: 'paragraph',
880
- * component: ParagraphStyle,
881
- * },
882
- * {
883
- * title: 'Lead',
884
- * value: 'lead',
885
- * component: LeadStyle,
886
- * },
887
- * {
888
- * title: 'Heading',
889
- * value: 'heading',
890
- * component: HeadingStyle,
891
- * },
892
- * ],
893
- * })
894
- * ```
895
- */
896
- declare interface BlockStyleDefinition {
897
- title: string
898
- value: string
899
- i18nTitleKey?: string
900
- icon?: ReactNode | ComponentType
901
- }
902
-
903
375
  declare type BlockWithOptionalKey =
904
376
  | TextBlockWithOptionalKey
905
377
  | ObjectBlockWithOptionalKey
906
378
 
907
- /** @public */
908
- declare interface BooleanDefinition extends BaseSchemaDefinition {
909
- type: 'boolean'
910
- options?: BooleanOptions
911
- initialValue?: InitialValueProperty<any, boolean>
912
- validation?: ValidationBuilder<BooleanRule, boolean>
913
- }
914
-
915
- /** @public */
916
- declare interface BooleanOptions extends BaseSchemaTypeOptions {
917
- layout?: 'switch' | 'checkbox'
918
- }
919
-
920
- /** @public */
921
- declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}
922
-
923
- /** @public */
924
- declare interface BooleanSchemaType extends BaseSchemaType {
925
- jsonType: 'boolean'
926
- options?: BooleanOptions
927
- initialValue?: InitialValueProperty<any, boolean>
928
- }
929
-
930
379
  /**
931
380
  * @public
932
381
  */
@@ -961,35 +410,6 @@ declare type ClipboardBehaviorEvent =
961
410
  position: Pick<EventPosition, 'selection'>
962
411
  }
963
412
 
964
- /** @public */
965
- declare interface CollapseOptions {
966
- collapsed?: boolean
967
- collapsible?: boolean
968
- /**
969
- * @deprecated Use `collapsible` instead
970
- */
971
- collapsable?: boolean
972
- }
973
-
974
- /** @public */
975
- declare type ConditionalProperty =
976
- | boolean
977
- | ConditionalPropertyCallback
978
- | undefined
979
-
980
- /** @public */
981
- declare type ConditionalPropertyCallback = (
982
- context: ConditionalPropertyCallbackContext,
983
- ) => boolean
984
-
985
- /** @public */
986
- declare interface ConditionalPropertyCallbackContext {
987
- document: SanityDocument | undefined
988
- parent: any
989
- value: any
990
- currentUser: Omit<CurrentUser, 'role'> | null
991
- }
992
-
993
413
  declare type Converter<TMIMEType extends MIMEType = MIMEType> = {
994
414
  mimeType: TMIMEType
995
415
  serialize: Serializer<TMIMEType>
@@ -1028,46 +448,6 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
1028
448
  mimeType: TMIMEType
1029
449
  }
1030
450
 
1031
- /** @public */
1032
- declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {
1033
- type: 'crossDatasetReference'
1034
- weak?: boolean
1035
- to: {
1036
- type: string
1037
- title?: string
1038
- icon?: ComponentType
1039
- preview?: PreviewConfig
1040
- /**
1041
- * @deprecated Unused. Configuring search is no longer supported.
1042
- */
1043
- __experimental_search?: {
1044
- path: string | string[]
1045
- weight?: number
1046
- mapWith?: string
1047
- }[]
1048
- }[]
1049
- dataset: string
1050
- studioUrl?: (document: {id: string; type?: string}) => string | null
1051
- tokenId?: string
1052
- options?: ReferenceOptions
1053
- /**
1054
- * @deprecated Cross-project references are no longer supported, only cross-dataset
1055
- */
1056
- projectId?: string
1057
- }
1058
-
1059
- /** @public */
1060
- declare interface CurrentUser {
1061
- id: string
1062
- name: string
1063
- email: string
1064
- profileImage?: string
1065
- provider?: string
1066
- /** @deprecated use `roles` instead */
1067
- role: string
1068
- roles: Role[]
1069
- }
1070
-
1071
451
  /**
1072
452
  * @beta
1073
453
  */
@@ -1092,89 +472,6 @@ declare type CustomBehaviorEventType<
1092
472
  TType extends string = '',
1093
473
  > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
1094
474
 
1095
- /** @public */
1096
- declare interface CustomValidator<T = unknown> {
1097
- (
1098
- value: T,
1099
- context: ValidationContext,
1100
- ): CustomValidatorResult | Promise<CustomValidatorResult>
1101
- bypassConcurrencyLimit?: boolean
1102
- }
1103
-
1104
- /** @public */
1105
- declare type CustomValidatorResult =
1106
- | true
1107
- | string
1108
- | ValidationError
1109
- | ValidationError[]
1110
- | LocalizedValidationMessages
1111
-
1112
- /** @public */
1113
- declare interface DateDefinition extends BaseSchemaDefinition {
1114
- type: 'date'
1115
- options?: DateOptions
1116
- placeholder?: string
1117
- validation?: ValidationBuilder<DateRule, string>
1118
- initialValue?: InitialValueProperty<any, string>
1119
- }
1120
-
1121
- /** @public */
1122
- declare interface DateOptions extends BaseSchemaTypeOptions {
1123
- dateFormat?: string
1124
- }
1125
-
1126
- /** @public */
1127
- declare interface DateRule extends RuleDef<DateRule, string> {
1128
- /**
1129
- * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
1130
- */
1131
- min: (minDate: string | FieldReference) => DateRule
1132
- /**
1133
- * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
1134
- */
1135
- max: (maxDate: string | FieldReference) => DateRule
1136
- }
1137
-
1138
- /** @public */
1139
- declare interface DatetimeDefinition extends BaseSchemaDefinition {
1140
- type: 'datetime'
1141
- options?: DatetimeOptions
1142
- placeholder?: string
1143
- validation?: ValidationBuilder<DatetimeRule, string>
1144
- initialValue?: InitialValueProperty<any, string>
1145
- }
1146
-
1147
- /** @public */
1148
- declare interface DatetimeOptions extends BaseSchemaTypeOptions {
1149
- dateFormat?: string
1150
- timeFormat?: string
1151
- timeStep?: number
1152
- }
1153
-
1154
- /** @public */
1155
- declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {
1156
- /**
1157
- * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
1158
- */
1159
- min: (minDate: string | FieldReference) => DatetimeRule
1160
- /**
1161
- * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
1162
- */
1163
- max: (maxDate: string | FieldReference) => DatetimeRule
1164
- }
1165
-
1166
- /** @public */
1167
- declare interface DeprecatedProperty {
1168
- reason: string
1169
- }
1170
-
1171
- /**
1172
- * @public
1173
- */
1174
- declare interface DeprecationConfiguration {
1175
- deprecated: DeprecatedProperty
1176
- }
1177
-
1178
475
  declare type Deserializer<TMIMEType extends MIMEType> = ({
1179
476
  snapshot,
1180
477
  event,
@@ -1187,40 +484,6 @@ declare type Deserializer<TMIMEType extends MIMEType> = ({
1187
484
  'deserialization.success' | 'deserialization.failure'
1188
485
  >
1189
486
 
1190
- /** @public */
1191
- declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
1192
- type: 'document'
1193
- liveEdit?: boolean
1194
- /** @beta */
1195
- orderings?: SortOrdering[]
1196
- options?: DocumentOptions
1197
- validation?: ValidationBuilder<DocumentRule, SanityDocument>
1198
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
1199
- /** @deprecated Unused. Use the new field-level search config. */
1200
- __experimental_search?: {
1201
- path: string
1202
- weight: number
1203
- mapWith?: string
1204
- }[]
1205
- /** @alpha */
1206
- __experimental_omnisearch_visibility?: boolean
1207
- /**
1208
- * Determines whether the large preview title is displayed in the document pane form
1209
- * @alpha
1210
- * */
1211
- __experimental_formPreviewTitle?: boolean
1212
- }
1213
-
1214
- /**
1215
- * This exists only to allow for extensions using declaration-merging.
1216
- *
1217
- * @public
1218
- */
1219
- declare interface DocumentOptions extends BaseSchemaTypeOptions {}
1220
-
1221
- /** @public */
1222
- declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}
1223
-
1224
487
  declare type DragBehaviorEvent =
1225
488
  | {
1226
489
  type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
@@ -1386,6 +649,7 @@ declare const editorMachine: StateMachine<
1386
649
  getLegacySchema: () => PortableTextMemberSchemaTypes
1387
650
  keyGenerator: () => string
1388
651
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
652
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
1389
653
  schema: EditorSchema
1390
654
  initialReadOnly: boolean
1391
655
  maxBlocks: number | undefined
@@ -1399,6 +663,7 @@ declare const editorMachine: StateMachine<
1399
663
  },
1400
664
  | InternalPatchEvent
1401
665
  | MutationEvent
666
+ | PatchesEvent
1402
667
  | {
1403
668
  type: 'add behavior'
1404
669
  behavior: Behavior
@@ -1431,7 +696,6 @@ declare const editorMachine: StateMachine<
1431
696
  type: 'update maxBlocks'
1432
697
  maxBlocks: number | undefined
1433
698
  }
1434
- | PatchesEvent
1435
699
  | {
1436
700
  type: 'blur'
1437
701
  editor: PortableTextSlateEditor
@@ -1447,7 +711,10 @@ declare const editorMachine: StateMachine<
1447
711
  type: 'done normalizing'
1448
712
  }
1449
713
  | {
1450
- type: 'done syncing initial value'
714
+ type: 'done syncing value'
715
+ }
716
+ | {
717
+ type: 'syncing value'
1451
718
  }
1452
719
  | {
1453
720
  type: 'behavior event'
@@ -1575,6 +842,18 @@ declare const editorMachine: StateMachine<
1575
842
  type: 'clear pending events'
1576
843
  params: NonReducibleUnknown
1577
844
  }
845
+ 'defer incoming patches': {
846
+ type: 'defer incoming patches'
847
+ params: NonReducibleUnknown
848
+ }
849
+ 'emit pending incoming patches': {
850
+ type: 'emit pending incoming patches'
851
+ params: NonReducibleUnknown
852
+ }
853
+ 'clear pending incoming patches': {
854
+ type: 'clear pending incoming patches'
855
+ params: NonReducibleUnknown
856
+ }
1578
857
  'handle blur': {
1579
858
  type: 'handle blur'
1580
859
  params: unknown
@@ -1608,9 +887,15 @@ declare const editorMachine: StateMachine<
1608
887
  }
1609
888
  'setup':
1610
889
  | 'setting up'
1611
- | 'dirty'
1612
890
  | {
1613
- pristine: 'normalizing' | 'idle'
891
+ 'set up': {
892
+ 'value sync': 'syncing value' | 'idle'
893
+ 'writing':
894
+ | 'dirty'
895
+ | {
896
+ pristine: 'normalizing' | 'idle'
897
+ }
898
+ }
1614
899
  }
1615
900
  },
1616
901
  'dragging internally',
@@ -1718,6 +1003,7 @@ declare const editorMachine: StateMachine<
1718
1003
  getLegacySchema: () => PortableTextMemberSchemaTypes
1719
1004
  keyGenerator: () => string
1720
1005
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
1006
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
1721
1007
  schema: EditorSchema
1722
1008
  initialReadOnly: boolean
1723
1009
  maxBlocks: number | undefined
@@ -1731,6 +1017,7 @@ declare const editorMachine: StateMachine<
1731
1017
  },
1732
1018
  | InternalPatchEvent
1733
1019
  | MutationEvent
1020
+ | PatchesEvent
1734
1021
  | {
1735
1022
  type: 'add behavior'
1736
1023
  behavior: Behavior
@@ -1763,7 +1050,6 @@ declare const editorMachine: StateMachine<
1763
1050
  type: 'update maxBlocks'
1764
1051
  maxBlocks: number | undefined
1765
1052
  }
1766
- | PatchesEvent
1767
1053
  | {
1768
1054
  type: 'blur'
1769
1055
  editor: PortableTextSlateEditor
@@ -1779,7 +1065,10 @@ declare const editorMachine: StateMachine<
1779
1065
  type: 'done normalizing'
1780
1066
  }
1781
1067
  | {
1782
- type: 'done syncing initial value'
1068
+ type: 'done syncing value'
1069
+ }
1070
+ | {
1071
+ type: 'syncing value'
1783
1072
  }
1784
1073
  | {
1785
1074
  type: 'behavior event'
@@ -1865,6 +1154,7 @@ declare const editorMachine: StateMachine<
1865
1154
  >,
1866
1155
  | InternalPatchEvent
1867
1156
  | MutationEvent
1157
+ | PatchesEvent
1868
1158
  | {
1869
1159
  type: 'add behavior'
1870
1160
  behavior: Behavior
@@ -1897,7 +1187,6 @@ declare const editorMachine: StateMachine<
1897
1187
  type: 'update maxBlocks'
1898
1188
  maxBlocks: number | undefined
1899
1189
  }
1900
- | PatchesEvent
1901
1190
  | {
1902
1191
  type: 'blur'
1903
1192
  editor: PortableTextSlateEditor
@@ -1913,7 +1202,10 @@ declare const editorMachine: StateMachine<
1913
1202
  type: 'done normalizing'
1914
1203
  }
1915
1204
  | {
1916
- type: 'done syncing initial value'
1205
+ type: 'done syncing value'
1206
+ }
1207
+ | {
1208
+ type: 'syncing value'
1917
1209
  }
1918
1210
  | {
1919
1211
  type: 'behavior event'
@@ -1998,6 +1290,7 @@ declare const editorMachine: StateMachine<
1998
1290
  getLegacySchema: () => PortableTextMemberSchemaTypes
1999
1291
  keyGenerator: () => string
2000
1292
  pendingEvents: never[]
1293
+ pendingIncomingPatchesEvents: never[]
2001
1294
  schema: EditorSchema
2002
1295
  selection: null
2003
1296
  initialReadOnly: boolean
@@ -2013,6 +1306,7 @@ declare const editorMachine: StateMachine<
2013
1306
  getLegacySchema: () => PortableTextMemberSchemaTypes
2014
1307
  keyGenerator: () => string
2015
1308
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
1309
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
2016
1310
  schema: EditorSchema
2017
1311
  initialReadOnly: boolean
2018
1312
  maxBlocks: number | undefined
@@ -2030,6 +1324,7 @@ declare const editorMachine: StateMachine<
2030
1324
  },
2031
1325
  | InternalPatchEvent
2032
1326
  | MutationEvent
1327
+ | PatchesEvent
2033
1328
  | {
2034
1329
  type: 'add behavior'
2035
1330
  behavior: Behavior
@@ -2062,7 +1357,6 @@ declare const editorMachine: StateMachine<
2062
1357
  type: 'update maxBlocks'
2063
1358
  maxBlocks: number | undefined
2064
1359
  }
2065
- | PatchesEvent
2066
1360
  | {
2067
1361
  type: 'blur'
2068
1362
  editor: PortableTextSlateEditor
@@ -2078,7 +1372,10 @@ declare const editorMachine: StateMachine<
2078
1372
  type: 'done normalizing'
2079
1373
  }
2080
1374
  | {
2081
- type: 'done syncing initial value'
1375
+ type: 'done syncing value'
1376
+ }
1377
+ | {
1378
+ type: 'syncing value'
2082
1379
  }
2083
1380
  | {
2084
1381
  type: 'behavior event'
@@ -2217,6 +1514,7 @@ declare const editorMachine: StateMachine<
2217
1514
  getLegacySchema: () => PortableTextMemberSchemaTypes
2218
1515
  keyGenerator: () => string
2219
1516
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
1517
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
2220
1518
  schema: EditorSchema
2221
1519
  initialReadOnly: boolean
2222
1520
  maxBlocks: number | undefined
@@ -2233,6 +1531,7 @@ declare const editorMachine: StateMachine<
2233
1531
  },
2234
1532
  | InternalPatchEvent
2235
1533
  | MutationEvent
1534
+ | PatchesEvent
2236
1535
  | {
2237
1536
  type: 'add behavior'
2238
1537
  behavior: Behavior
@@ -2265,7 +1564,6 @@ declare const editorMachine: StateMachine<
2265
1564
  type: 'update maxBlocks'
2266
1565
  maxBlocks: number | undefined
2267
1566
  }
2268
- | PatchesEvent
2269
1567
  | {
2270
1568
  type: 'blur'
2271
1569
  editor: PortableTextSlateEditor
@@ -2281,7 +1579,10 @@ declare const editorMachine: StateMachine<
2281
1579
  type: 'done normalizing'
2282
1580
  }
2283
1581
  | {
2284
- type: 'done syncing initial value'
1582
+ type: 'done syncing value'
1583
+ }
1584
+ | {
1585
+ type: 'syncing value'
2285
1586
  }
2286
1587
  | {
2287
1588
  type: 'behavior event'
@@ -2420,6 +1721,7 @@ declare const editorMachine: StateMachine<
2420
1721
  getLegacySchema: () => PortableTextMemberSchemaTypes
2421
1722
  keyGenerator: () => string
2422
1723
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
1724
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
2423
1725
  schema: EditorSchema
2424
1726
  initialReadOnly: boolean
2425
1727
  maxBlocks: number | undefined
@@ -2439,6 +1741,7 @@ declare const editorMachine: StateMachine<
2439
1741
  },
2440
1742
  | InternalPatchEvent
2441
1743
  | MutationEvent
1744
+ | PatchesEvent
2442
1745
  | {
2443
1746
  type: 'add behavior'
2444
1747
  behavior: Behavior
@@ -2471,7 +1774,6 @@ declare const editorMachine: StateMachine<
2471
1774
  type: 'update maxBlocks'
2472
1775
  maxBlocks: number | undefined
2473
1776
  }
2474
- | PatchesEvent
2475
1777
  | {
2476
1778
  type: 'blur'
2477
1779
  editor: PortableTextSlateEditor
@@ -2487,7 +1789,10 @@ declare const editorMachine: StateMachine<
2487
1789
  type: 'done normalizing'
2488
1790
  }
2489
1791
  | {
2490
- type: 'done syncing initial value'
1792
+ type: 'done syncing value'
1793
+ }
1794
+ | {
1795
+ type: 'syncing value'
2491
1796
  }
2492
1797
  | {
2493
1798
  type: 'behavior event'
@@ -2626,6 +1931,7 @@ declare const editorMachine: StateMachine<
2626
1931
  getLegacySchema: () => PortableTextMemberSchemaTypes
2627
1932
  keyGenerator: () => string
2628
1933
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
1934
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
2629
1935
  schema: EditorSchema
2630
1936
  initialReadOnly: boolean
2631
1937
  maxBlocks: number | undefined
@@ -2644,6 +1950,7 @@ declare const editorMachine: StateMachine<
2644
1950
  },
2645
1951
  | InternalPatchEvent
2646
1952
  | MutationEvent
1953
+ | PatchesEvent
2647
1954
  | {
2648
1955
  type: 'add behavior'
2649
1956
  behavior: Behavior
@@ -2676,7 +1983,6 @@ declare const editorMachine: StateMachine<
2676
1983
  type: 'update maxBlocks'
2677
1984
  maxBlocks: number | undefined
2678
1985
  }
2679
- | PatchesEvent
2680
1986
  | {
2681
1987
  type: 'blur'
2682
1988
  editor: PortableTextSlateEditor
@@ -2692,7 +1998,10 @@ declare const editorMachine: StateMachine<
2692
1998
  type: 'done normalizing'
2693
1999
  }
2694
2000
  | {
2695
- type: 'done syncing initial value'
2001
+ type: 'done syncing value'
2002
+ }
2003
+ | {
2004
+ type: 'syncing value'
2696
2005
  }
2697
2006
  | {
2698
2007
  type: 'behavior event'
@@ -2831,6 +2140,7 @@ declare const editorMachine: StateMachine<
2831
2140
  getLegacySchema: () => PortableTextMemberSchemaTypes
2832
2141
  keyGenerator: () => string
2833
2142
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
2143
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
2834
2144
  schema: EditorSchema
2835
2145
  initialReadOnly: boolean
2836
2146
  maxBlocks: number | undefined
@@ -2848,6 +2158,7 @@ declare const editorMachine: StateMachine<
2848
2158
  },
2849
2159
  | InternalPatchEvent
2850
2160
  | MutationEvent
2161
+ | PatchesEvent
2851
2162
  | {
2852
2163
  type: 'add behavior'
2853
2164
  behavior: Behavior
@@ -2880,7 +2191,6 @@ declare const editorMachine: StateMachine<
2880
2191
  type: 'update maxBlocks'
2881
2192
  maxBlocks: number | undefined
2882
2193
  }
2883
- | PatchesEvent
2884
2194
  | {
2885
2195
  type: 'blur'
2886
2196
  editor: PortableTextSlateEditor
@@ -2896,7 +2206,10 @@ declare const editorMachine: StateMachine<
2896
2206
  type: 'done normalizing'
2897
2207
  }
2898
2208
  | {
2899
- type: 'done syncing initial value'
2209
+ type: 'done syncing value'
2210
+ }
2211
+ | {
2212
+ type: 'syncing value'
2900
2213
  }
2901
2214
  | {
2902
2215
  type: 'behavior event'
@@ -3036,6 +2349,7 @@ declare const editorMachine: StateMachine<
3036
2349
  getLegacySchema: () => PortableTextMemberSchemaTypes
3037
2350
  keyGenerator: () => string
3038
2351
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
2352
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3039
2353
  schema: EditorSchema
3040
2354
  initialReadOnly: boolean
3041
2355
  maxBlocks: number | undefined
@@ -3053,6 +2367,7 @@ declare const editorMachine: StateMachine<
3053
2367
  },
3054
2368
  | InternalPatchEvent
3055
2369
  | MutationEvent
2370
+ | PatchesEvent
3056
2371
  | {
3057
2372
  type: 'add behavior'
3058
2373
  behavior: Behavior
@@ -3085,7 +2400,6 @@ declare const editorMachine: StateMachine<
3085
2400
  type: 'update maxBlocks'
3086
2401
  maxBlocks: number | undefined
3087
2402
  }
3088
- | PatchesEvent
3089
2403
  | {
3090
2404
  type: 'blur'
3091
2405
  editor: PortableTextSlateEditor
@@ -3101,7 +2415,10 @@ declare const editorMachine: StateMachine<
3101
2415
  type: 'done normalizing'
3102
2416
  }
3103
2417
  | {
3104
- type: 'done syncing initial value'
2418
+ type: 'done syncing value'
2419
+ }
2420
+ | {
2421
+ type: 'syncing value'
3105
2422
  }
3106
2423
  | {
3107
2424
  type: 'behavior event'
@@ -3192,6 +2509,7 @@ declare const editorMachine: StateMachine<
3192
2509
  getLegacySchema: () => PortableTextMemberSchemaTypes
3193
2510
  keyGenerator: () => string
3194
2511
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
2512
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3195
2513
  schema: EditorSchema
3196
2514
  initialReadOnly: boolean
3197
2515
  maxBlocks: number | undefined
@@ -3209,6 +2527,7 @@ declare const editorMachine: StateMachine<
3209
2527
  },
3210
2528
  | InternalPatchEvent
3211
2529
  | MutationEvent
2530
+ | PatchesEvent
3212
2531
  | {
3213
2532
  type: 'add behavior'
3214
2533
  behavior: Behavior
@@ -3241,7 +2560,6 @@ declare const editorMachine: StateMachine<
3241
2560
  type: 'update maxBlocks'
3242
2561
  maxBlocks: number | undefined
3243
2562
  }
3244
- | PatchesEvent
3245
2563
  | {
3246
2564
  type: 'blur'
3247
2565
  editor: PortableTextSlateEditor
@@ -3257,7 +2575,10 @@ declare const editorMachine: StateMachine<
3257
2575
  type: 'done normalizing'
3258
2576
  }
3259
2577
  | {
3260
- type: 'done syncing initial value'
2578
+ type: 'done syncing value'
2579
+ }
2580
+ | {
2581
+ type: 'syncing value'
3261
2582
  }
3262
2583
  | {
3263
2584
  type: 'behavior event'
@@ -3397,6 +2718,7 @@ declare const editorMachine: StateMachine<
3397
2718
  getLegacySchema: () => PortableTextMemberSchemaTypes
3398
2719
  keyGenerator: () => string
3399
2720
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
2721
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3400
2722
  schema: EditorSchema
3401
2723
  initialReadOnly: boolean
3402
2724
  maxBlocks: number | undefined
@@ -3414,6 +2736,7 @@ declare const editorMachine: StateMachine<
3414
2736
  },
3415
2737
  | InternalPatchEvent
3416
2738
  | MutationEvent
2739
+ | PatchesEvent
3417
2740
  | {
3418
2741
  type: 'add behavior'
3419
2742
  behavior: Behavior
@@ -3446,7 +2769,6 @@ declare const editorMachine: StateMachine<
3446
2769
  type: 'update maxBlocks'
3447
2770
  maxBlocks: number | undefined
3448
2771
  }
3449
- | PatchesEvent
3450
2772
  | {
3451
2773
  type: 'blur'
3452
2774
  editor: PortableTextSlateEditor
@@ -3462,7 +2784,10 @@ declare const editorMachine: StateMachine<
3462
2784
  type: 'done normalizing'
3463
2785
  }
3464
2786
  | {
3465
- type: 'done syncing initial value'
2787
+ type: 'done syncing value'
2788
+ }
2789
+ | {
2790
+ type: 'syncing value'
3466
2791
  }
3467
2792
  | {
3468
2793
  type: 'behavior event'
@@ -3601,6 +2926,7 @@ declare const editorMachine: StateMachine<
3601
2926
  getLegacySchema: () => PortableTextMemberSchemaTypes
3602
2927
  keyGenerator: () => string
3603
2928
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
2929
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3604
2930
  schema: EditorSchema
3605
2931
  initialReadOnly: boolean
3606
2932
  maxBlocks: number | undefined
@@ -3617,6 +2943,7 @@ declare const editorMachine: StateMachine<
3617
2943
  },
3618
2944
  | InternalPatchEvent
3619
2945
  | MutationEvent
2946
+ | PatchesEvent
3620
2947
  | {
3621
2948
  type: 'add behavior'
3622
2949
  behavior: Behavior
@@ -3649,7 +2976,6 @@ declare const editorMachine: StateMachine<
3649
2976
  type: 'update maxBlocks'
3650
2977
  maxBlocks: number | undefined
3651
2978
  }
3652
- | PatchesEvent
3653
2979
  | {
3654
2980
  type: 'blur'
3655
2981
  editor: PortableTextSlateEditor
@@ -3665,7 +2991,10 @@ declare const editorMachine: StateMachine<
3665
2991
  type: 'done normalizing'
3666
2992
  }
3667
2993
  | {
3668
- type: 'done syncing initial value'
2994
+ type: 'done syncing value'
2995
+ }
2996
+ | {
2997
+ type: 'syncing value'
3669
2998
  }
3670
2999
  | {
3671
3000
  type: 'behavior event'
@@ -3804,6 +3133,7 @@ declare const editorMachine: StateMachine<
3804
3133
  getLegacySchema: () => PortableTextMemberSchemaTypes
3805
3134
  keyGenerator: () => string
3806
3135
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3136
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3807
3137
  schema: EditorSchema
3808
3138
  initialReadOnly: boolean
3809
3139
  maxBlocks: number | undefined
@@ -3821,6 +3151,7 @@ declare const editorMachine: StateMachine<
3821
3151
  },
3822
3152
  | InternalPatchEvent
3823
3153
  | MutationEvent
3154
+ | PatchesEvent
3824
3155
  | {
3825
3156
  type: 'add behavior'
3826
3157
  behavior: Behavior
@@ -3853,7 +3184,6 @@ declare const editorMachine: StateMachine<
3853
3184
  type: 'update maxBlocks'
3854
3185
  maxBlocks: number | undefined
3855
3186
  }
3856
- | PatchesEvent
3857
3187
  | {
3858
3188
  type: 'blur'
3859
3189
  editor: PortableTextSlateEditor
@@ -3869,7 +3199,10 @@ declare const editorMachine: StateMachine<
3869
3199
  type: 'done normalizing'
3870
3200
  }
3871
3201
  | {
3872
- type: 'done syncing initial value'
3202
+ type: 'done syncing value'
3203
+ }
3204
+ | {
3205
+ type: 'syncing value'
3873
3206
  }
3874
3207
  | {
3875
3208
  type: 'behavior event'
@@ -4006,7 +3339,10 @@ declare const editorMachine: StateMachine<
4006
3339
  readonly 'remove behavior': {
4007
3340
  readonly actions: 'remove behavior from context'
4008
3341
  }
4009
- readonly 'patches': {
3342
+ readonly 'update behaviors': {
3343
+ readonly actions: 'assign behaviors'
3344
+ }
3345
+ readonly 'update key generator': {
4010
3346
  readonly actions: ActionFunction<
4011
3347
  {
4012
3348
  behaviors: Set<Behavior>
@@ -4014,6 +3350,7 @@ declare const editorMachine: StateMachine<
4014
3350
  getLegacySchema: () => PortableTextMemberSchemaTypes
4015
3351
  keyGenerator: () => string
4016
3352
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3353
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4017
3354
  schema: EditorSchema
4018
3355
  initialReadOnly: boolean
4019
3356
  maxBlocks: number | undefined
@@ -4025,9 +3362,13 @@ declare const editorMachine: StateMachine<
4025
3362
  }
4026
3363
  slateEditor?: PortableTextSlateEditor
4027
3364
  },
4028
- PatchesEvent,
3365
+ {
3366
+ type: 'update key generator'
3367
+ keyGenerator: () => string
3368
+ },
4029
3369
  | InternalPatchEvent
4030
3370
  | MutationEvent
3371
+ | PatchesEvent
4031
3372
  | {
4032
3373
  type: 'add behavior'
4033
3374
  behavior: Behavior
@@ -4060,7 +3401,6 @@ declare const editorMachine: StateMachine<
4060
3401
  type: 'update maxBlocks'
4061
3402
  maxBlocks: number | undefined
4062
3403
  }
4063
- | PatchesEvent
4064
3404
  | {
4065
3405
  type: 'blur'
4066
3406
  editor: PortableTextSlateEditor
@@ -4076,7 +3416,10 @@ declare const editorMachine: StateMachine<
4076
3416
  type: 'done normalizing'
4077
3417
  }
4078
3418
  | {
4079
- type: 'done syncing initial value'
3419
+ type: 'done syncing value'
3420
+ }
3421
+ | {
3422
+ type: 'syncing value'
4080
3423
  }
4081
3424
  | {
4082
3425
  type: 'behavior event'
@@ -4158,59 +3501,13 @@ declare const editorMachine: StateMachine<
4158
3501
  never,
4159
3502
  never,
4160
3503
  never,
4161
- | PatchEvent
4162
- | InternalPatchEvent
4163
- | MutationEvent
4164
- | PatchesEvent
4165
- | {
4166
- type: 'blurred'
4167
- event: FocusEvent_2<HTMLDivElement, Element>
4168
- }
4169
- | {
4170
- type: 'done loading'
4171
- }
4172
- | {
4173
- type: 'editable'
4174
- }
4175
- | {
4176
- type: 'error'
4177
- name: string
4178
- description: string
4179
- data: unknown
4180
- }
4181
- | {
4182
- type: 'focused'
4183
- event: FocusEvent_2<HTMLDivElement, Element>
4184
- }
4185
- | {
4186
- type: 'invalid value'
4187
- resolution: InvalidValueResolution | null
4188
- value: Array<PortableTextBlock> | undefined
4189
- }
4190
- | {
4191
- type: 'loading'
4192
- }
4193
- | {
4194
- type: 'read only'
4195
- }
4196
- | {
4197
- type: 'ready'
4198
- }
4199
- | {
4200
- type: 'selection'
4201
- selection: EditorSelection
4202
- }
4203
- | {
4204
- type: 'value changed'
4205
- value: Array<PortableTextBlock> | undefined
4206
- }
4207
- | UnsetEvent
3504
+ never
4208
3505
  >
4209
3506
  }
4210
- readonly 'update behaviors': {
4211
- readonly actions: 'assign behaviors'
3507
+ readonly 'update schema': {
3508
+ readonly actions: 'assign schema'
4212
3509
  }
4213
- readonly 'update key generator': {
3510
+ readonly 'update value': {
4214
3511
  readonly actions: ActionFunction<
4215
3512
  {
4216
3513
  behaviors: Set<Behavior>
@@ -4218,6 +3515,7 @@ declare const editorMachine: StateMachine<
4218
3515
  getLegacySchema: () => PortableTextMemberSchemaTypes
4219
3516
  keyGenerator: () => string
4220
3517
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3518
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4221
3519
  schema: EditorSchema
4222
3520
  initialReadOnly: boolean
4223
3521
  maxBlocks: number | undefined
@@ -4230,11 +3528,12 @@ declare const editorMachine: StateMachine<
4230
3528
  slateEditor?: PortableTextSlateEditor
4231
3529
  },
4232
3530
  {
4233
- type: 'update key generator'
4234
- keyGenerator: () => string
3531
+ type: 'update value'
3532
+ value: Array<PortableTextBlock> | undefined
4235
3533
  },
4236
3534
  | InternalPatchEvent
4237
3535
  | MutationEvent
3536
+ | PatchesEvent
4238
3537
  | {
4239
3538
  type: 'add behavior'
4240
3539
  behavior: Behavior
@@ -4267,7 +3566,6 @@ declare const editorMachine: StateMachine<
4267
3566
  type: 'update maxBlocks'
4268
3567
  maxBlocks: number | undefined
4269
3568
  }
4270
- | PatchesEvent
4271
3569
  | {
4272
3570
  type: 'blur'
4273
3571
  editor: PortableTextSlateEditor
@@ -4283,7 +3581,10 @@ declare const editorMachine: StateMachine<
4283
3581
  type: 'done normalizing'
4284
3582
  }
4285
3583
  | {
4286
- type: 'done syncing initial value'
3584
+ type: 'done syncing value'
3585
+ }
3586
+ | {
3587
+ type: 'syncing value'
4287
3588
  }
4288
3589
  | {
4289
3590
  type: 'behavior event'
@@ -4368,10 +3669,7 @@ declare const editorMachine: StateMachine<
4368
3669
  never
4369
3670
  >
4370
3671
  }
4371
- readonly 'update schema': {
4372
- readonly actions: 'assign schema'
4373
- }
4374
- readonly 'update value': {
3672
+ readonly 'update maxBlocks': {
4375
3673
  readonly actions: ActionFunction<
4376
3674
  {
4377
3675
  behaviors: Set<Behavior>
@@ -4379,6 +3677,7 @@ declare const editorMachine: StateMachine<
4379
3677
  getLegacySchema: () => PortableTextMemberSchemaTypes
4380
3678
  keyGenerator: () => string
4381
3679
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3680
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4382
3681
  schema: EditorSchema
4383
3682
  initialReadOnly: boolean
4384
3683
  maxBlocks: number | undefined
@@ -4391,11 +3690,12 @@ declare const editorMachine: StateMachine<
4391
3690
  slateEditor?: PortableTextSlateEditor
4392
3691
  },
4393
3692
  {
4394
- type: 'update value'
4395
- value: Array<PortableTextBlock> | undefined
3693
+ type: 'update maxBlocks'
3694
+ maxBlocks: number | undefined
4396
3695
  },
4397
3696
  | InternalPatchEvent
4398
3697
  | MutationEvent
3698
+ | PatchesEvent
4399
3699
  | {
4400
3700
  type: 'add behavior'
4401
3701
  behavior: Behavior
@@ -4428,7 +3728,6 @@ declare const editorMachine: StateMachine<
4428
3728
  type: 'update maxBlocks'
4429
3729
  maxBlocks: number | undefined
4430
3730
  }
4431
- | PatchesEvent
4432
3731
  | {
4433
3732
  type: 'blur'
4434
3733
  editor: PortableTextSlateEditor
@@ -4444,7 +3743,10 @@ declare const editorMachine: StateMachine<
4444
3743
  type: 'done normalizing'
4445
3744
  }
4446
3745
  | {
4447
- type: 'done syncing initial value'
3746
+ type: 'done syncing value'
3747
+ }
3748
+ | {
3749
+ type: 'syncing value'
4448
3750
  }
4449
3751
  | {
4450
3752
  type: 'behavior event'
@@ -4529,210 +3831,53 @@ declare const editorMachine: StateMachine<
4529
3831
  never
4530
3832
  >
4531
3833
  }
4532
- readonly 'update maxBlocks': {
4533
- readonly actions: ActionFunction<
4534
- {
4535
- behaviors: Set<Behavior>
4536
- converters: Set<Converter>
4537
- getLegacySchema: () => PortableTextMemberSchemaTypes
4538
- keyGenerator: () => string
4539
- pendingEvents: Array<InternalPatchEvent | MutationEvent>
4540
- schema: EditorSchema
4541
- initialReadOnly: boolean
4542
- maxBlocks: number | undefined
4543
- selection: EditorSelection
4544
- incomingValue: Array<PortableTextBlock> | undefined
4545
- internalDrag?: {
4546
- ghost?: HTMLElement
4547
- origin: Pick<EventPosition, 'selection'>
4548
- }
4549
- slateEditor?: PortableTextSlateEditor
4550
- },
4551
- {
4552
- type: 'update maxBlocks'
4553
- maxBlocks: number | undefined
4554
- },
4555
- | InternalPatchEvent
4556
- | MutationEvent
4557
- | {
4558
- type: 'add behavior'
4559
- behavior: Behavior
4560
- }
4561
- | {
4562
- type: 'remove behavior'
4563
- behavior: Behavior
4564
- }
4565
- | {
4566
- type: 'update readOnly'
4567
- readOnly: boolean
4568
- }
4569
- | {
4570
- type: 'update schema'
4571
- schema: EditorSchema
4572
- }
4573
- | {
4574
- type: 'update behaviors'
4575
- behaviors: Array<Behavior>
4576
- }
4577
- | {
4578
- type: 'update key generator'
4579
- keyGenerator: () => string
4580
- }
4581
- | {
4582
- type: 'update value'
4583
- value: Array<PortableTextBlock> | undefined
4584
- }
4585
- | {
4586
- type: 'update maxBlocks'
4587
- maxBlocks: number | undefined
4588
- }
4589
- | PatchesEvent
4590
- | {
4591
- type: 'blur'
4592
- editor: PortableTextSlateEditor
4593
- }
4594
- | {
4595
- type: 'focus'
4596
- editor: PortableTextSlateEditor
4597
- }
4598
- | {
4599
- type: 'normalizing'
4600
- }
4601
- | {
4602
- type: 'done normalizing'
4603
- }
4604
- | {
4605
- type: 'done syncing initial value'
4606
- }
4607
- | {
4608
- type: 'behavior event'
4609
- behaviorEvent: BehaviorEvent
4610
- editor: PortableTextSlateEditor
4611
- nativeEvent?: {
4612
- preventDefault: () => void
4613
- }
4614
- }
4615
- | {
4616
- type: 'notify.patch'
4617
- patch: Patch
4618
- }
4619
- | {
4620
- type: 'notify.mutation'
4621
- patches: Array<Patch>
4622
- snapshot: Array<PortableTextBlock> | undefined
4623
- value: Array<PortableTextBlock> | undefined
4624
- }
4625
- | {
4626
- type: 'notify.blurred'
4627
- event: FocusEvent_2<HTMLDivElement, Element>
4628
- }
4629
- | {
4630
- type: 'notify.done loading'
4631
- }
4632
- | {
4633
- type: 'notify.editable'
4634
- }
4635
- | {
4636
- type: 'notify.error'
4637
- name: string
4638
- description: string
4639
- data: unknown
4640
- }
4641
- | {
4642
- type: 'notify.focused'
4643
- event: FocusEvent_2<HTMLDivElement, Element>
4644
- }
4645
- | {
4646
- type: 'notify.invalid value'
4647
- resolution: InvalidValueResolution | null
4648
- value: Array<PortableTextBlock> | undefined
4649
- }
4650
- | {
4651
- type: 'notify.loading'
4652
- }
4653
- | {
4654
- type: 'notify.read only'
4655
- }
4656
- | {
4657
- type: 'notify.ready'
4658
- }
4659
- | {
4660
- type: 'notify.selection'
4661
- selection: EditorSelection
4662
- }
4663
- | {
4664
- type: 'notify.value changed'
4665
- value: Array<PortableTextBlock> | undefined
4666
- }
4667
- | {
4668
- type: 'notify.unset'
4669
- previousValue: Array<PortableTextBlock>
4670
- }
4671
- | {
4672
- type: 'dragstart'
4673
- origin: Pick<EventPosition, 'selection'>
4674
- ghost?: HTMLElement
4675
- }
4676
- | {
4677
- type: 'dragend'
4678
- }
4679
- | {
4680
- type: 'drop'
4681
- },
4682
- undefined,
4683
- never,
4684
- never,
4685
- never,
4686
- never,
4687
- never
4688
- >
4689
- }
4690
- }
4691
- readonly type: 'parallel'
4692
- readonly states: {
4693
- readonly 'edit mode': {
4694
- readonly initial: 'read only'
4695
- readonly states: {
4696
- readonly 'read only': {
4697
- readonly initial: 'determine initial edit mode'
4698
- readonly on: {
4699
- readonly 'behavior event': {
4700
- readonly actions: 'handle behavior event'
4701
- readonly guard: ({
4702
- event,
4703
- }: GuardArgs<
4704
- {
4705
- behaviors: Set<Behavior>
4706
- converters: Set<Converter>
4707
- getLegacySchema: () => PortableTextMemberSchemaTypes
4708
- keyGenerator: () => string
4709
- pendingEvents: Array<InternalPatchEvent | MutationEvent>
4710
- schema: EditorSchema
4711
- initialReadOnly: boolean
4712
- maxBlocks: number | undefined
4713
- selection: EditorSelection
4714
- incomingValue: Array<PortableTextBlock> | undefined
4715
- internalDrag?: {
4716
- ghost?: HTMLElement
4717
- origin: Pick<EventPosition, 'selection'>
4718
- }
4719
- slateEditor?: PortableTextSlateEditor
4720
- },
4721
- {
4722
- type: 'behavior event'
4723
- behaviorEvent: BehaviorEvent
4724
- editor: PortableTextSlateEditor
4725
- nativeEvent?: {
4726
- preventDefault: () => void
4727
- }
4728
- }
4729
- >) => boolean
4730
- }
3834
+ }
3835
+ readonly type: 'parallel'
3836
+ readonly states: {
3837
+ readonly 'edit mode': {
3838
+ readonly initial: 'read only'
3839
+ readonly states: {
3840
+ readonly 'read only': {
3841
+ readonly initial: 'determine initial edit mode'
3842
+ readonly on: {
3843
+ readonly 'behavior event': {
3844
+ readonly actions: 'handle behavior event'
3845
+ readonly guard: ({
3846
+ event,
3847
+ }: GuardArgs<
3848
+ {
3849
+ behaviors: Set<Behavior>
3850
+ converters: Set<Converter>
3851
+ getLegacySchema: () => PortableTextMemberSchemaTypes
3852
+ keyGenerator: () => string
3853
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
3854
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
3855
+ schema: EditorSchema
3856
+ initialReadOnly: boolean
3857
+ maxBlocks: number | undefined
3858
+ selection: EditorSelection
3859
+ incomingValue: Array<PortableTextBlock> | undefined
3860
+ internalDrag?: {
3861
+ ghost?: HTMLElement
3862
+ origin: Pick<EventPosition, 'selection'>
3863
+ }
3864
+ slateEditor?: PortableTextSlateEditor
3865
+ },
3866
+ {
3867
+ type: 'behavior event'
3868
+ behaviorEvent: BehaviorEvent
3869
+ editor: PortableTextSlateEditor
3870
+ nativeEvent?: {
3871
+ preventDefault: () => void
3872
+ }
3873
+ }
3874
+ >) => boolean
3875
+ }
4731
3876
  }
4732
3877
  readonly states: {
4733
3878
  readonly 'determine initial edit mode': {
4734
3879
  readonly on: {
4735
- readonly 'done syncing initial value': readonly [
3880
+ readonly 'done syncing value': readonly [
4736
3881
  {
4737
3882
  readonly target: '#editor.edit mode.read only.read only'
4738
3883
  readonly guard: ({
@@ -4746,6 +3891,7 @@ declare const editorMachine: StateMachine<
4746
3891
  pendingEvents: Array<
4747
3892
  InternalPatchEvent | MutationEvent
4748
3893
  >
3894
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4749
3895
  schema: EditorSchema
4750
3896
  initialReadOnly: boolean
4751
3897
  maxBlocks: number | undefined
@@ -4758,7 +3904,7 @@ declare const editorMachine: StateMachine<
4758
3904
  slateEditor?: PortableTextSlateEditor
4759
3905
  },
4760
3906
  {
4761
- type: 'done syncing initial value'
3907
+ type: 'done syncing value'
4762
3908
  }
4763
3909
  >) => boolean
4764
3910
  },
@@ -4780,6 +3926,7 @@ declare const editorMachine: StateMachine<
4780
3926
  getLegacySchema: () => PortableTextMemberSchemaTypes
4781
3927
  keyGenerator: () => string
4782
3928
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3929
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4783
3930
  schema: EditorSchema
4784
3931
  initialReadOnly: boolean
4785
3932
  maxBlocks: number | undefined
@@ -4815,6 +3962,7 @@ declare const editorMachine: StateMachine<
4815
3962
  getLegacySchema: () => PortableTextMemberSchemaTypes
4816
3963
  keyGenerator: () => string
4817
3964
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
3965
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4818
3966
  schema: EditorSchema
4819
3967
  initialReadOnly: boolean
4820
3968
  maxBlocks: number | undefined
@@ -4850,6 +3998,7 @@ declare const editorMachine: StateMachine<
4850
3998
  getLegacySchema: () => PortableTextMemberSchemaTypes
4851
3999
  keyGenerator: () => string
4852
4000
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
4001
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4853
4002
  schema: EditorSchema
4854
4003
  initialReadOnly: boolean
4855
4004
  maxBlocks: number | undefined
@@ -4867,6 +4016,7 @@ declare const editorMachine: StateMachine<
4867
4016
  },
4868
4017
  | InternalPatchEvent
4869
4018
  | MutationEvent
4019
+ | PatchesEvent
4870
4020
  | {
4871
4021
  type: 'add behavior'
4872
4022
  behavior: Behavior
@@ -4899,7 +4049,6 @@ declare const editorMachine: StateMachine<
4899
4049
  type: 'update maxBlocks'
4900
4050
  maxBlocks: number | undefined
4901
4051
  }
4902
- | PatchesEvent
4903
4052
  | {
4904
4053
  type: 'blur'
4905
4054
  editor: PortableTextSlateEditor
@@ -4915,7 +4064,10 @@ declare const editorMachine: StateMachine<
4915
4064
  type: 'done normalizing'
4916
4065
  }
4917
4066
  | {
4918
- type: 'done syncing initial value'
4067
+ type: 'done syncing value'
4068
+ }
4069
+ | {
4070
+ type: 'syncing value'
4919
4071
  }
4920
4072
  | {
4921
4073
  type: 'behavior event'
@@ -5017,6 +4169,7 @@ declare const editorMachine: StateMachine<
5017
4169
  pendingEvents: Array<
5018
4170
  InternalPatchEvent | MutationEvent
5019
4171
  >
4172
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
5020
4173
  schema: EditorSchema
5021
4174
  initialReadOnly: boolean
5022
4175
  maxBlocks: number | undefined
@@ -5035,6 +4188,7 @@ declare const editorMachine: StateMachine<
5035
4188
  },
5036
4189
  | InternalPatchEvent
5037
4190
  | MutationEvent
4191
+ | PatchesEvent
5038
4192
  | {
5039
4193
  type: 'add behavior'
5040
4194
  behavior: Behavior
@@ -5067,7 +4221,6 @@ declare const editorMachine: StateMachine<
5067
4221
  type: 'update maxBlocks'
5068
4222
  maxBlocks: number | undefined
5069
4223
  }
5070
- | PatchesEvent
5071
4224
  | {
5072
4225
  type: 'blur'
5073
4226
  editor: PortableTextSlateEditor
@@ -5083,7 +4236,10 @@ declare const editorMachine: StateMachine<
5083
4236
  type: 'done normalizing'
5084
4237
  }
5085
4238
  | {
5086
- type: 'done syncing initial value'
4239
+ type: 'done syncing value'
4240
+ }
4241
+ | {
4242
+ type: 'syncing value'
5087
4243
  }
5088
4244
  | {
5089
4245
  type: 'behavior event'
@@ -5207,6 +4363,7 @@ declare const editorMachine: StateMachine<
5207
4363
  getLegacySchema: () => PortableTextMemberSchemaTypes
5208
4364
  keyGenerator: () => string
5209
4365
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
4366
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
5210
4367
  schema: EditorSchema
5211
4368
  initialReadOnly: boolean
5212
4369
  maxBlocks: number | undefined
@@ -5220,6 +4377,7 @@ declare const editorMachine: StateMachine<
5220
4377
  },
5221
4378
  | InternalPatchEvent
5222
4379
  | MutationEvent
4380
+ | PatchesEvent
5223
4381
  | {
5224
4382
  type: 'add behavior'
5225
4383
  behavior: Behavior
@@ -5252,7 +4410,6 @@ declare const editorMachine: StateMachine<
5252
4410
  type: 'update maxBlocks'
5253
4411
  maxBlocks: number | undefined
5254
4412
  }
5255
- | PatchesEvent
5256
4413
  | {
5257
4414
  type: 'blur'
5258
4415
  editor: PortableTextSlateEditor
@@ -5268,7 +4425,10 @@ declare const editorMachine: StateMachine<
5268
4425
  type: 'done normalizing'
5269
4426
  }
5270
4427
  | {
5271
- type: 'done syncing initial value'
4428
+ type: 'done syncing value'
4429
+ }
4430
+ | {
4431
+ type: 'syncing value'
5272
4432
  }
5273
4433
  | {
5274
4434
  type: 'behavior event'
@@ -5347,6 +4507,7 @@ declare const editorMachine: StateMachine<
5347
4507
  },
5348
4508
  | InternalPatchEvent
5349
4509
  | MutationEvent
4510
+ | PatchesEvent
5350
4511
  | {
5351
4512
  type: 'add behavior'
5352
4513
  behavior: Behavior
@@ -5379,7 +4540,6 @@ declare const editorMachine: StateMachine<
5379
4540
  type: 'update maxBlocks'
5380
4541
  maxBlocks: number | undefined
5381
4542
  }
5382
- | PatchesEvent
5383
4543
  | {
5384
4544
  type: 'blur'
5385
4545
  editor: PortableTextSlateEditor
@@ -5395,7 +4555,10 @@ declare const editorMachine: StateMachine<
5395
4555
  type: 'done normalizing'
5396
4556
  }
5397
4557
  | {
5398
- type: 'done syncing initial value'
4558
+ type: 'done syncing value'
4559
+ }
4560
+ | {
4561
+ type: 'syncing value'
5399
4562
  }
5400
4563
  | {
5401
4564
  type: 'behavior event'
@@ -5480,6 +4643,7 @@ declare const editorMachine: StateMachine<
5480
4643
  getLegacySchema: () => PortableTextMemberSchemaTypes
5481
4644
  keyGenerator: () => string
5482
4645
  pendingEvents: Array<InternalPatchEvent | MutationEvent>
4646
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
5483
4647
  schema: EditorSchema
5484
4648
  initialReadOnly: boolean
5485
4649
  maxBlocks: number | undefined
@@ -5493,6 +4657,7 @@ declare const editorMachine: StateMachine<
5493
4657
  },
5494
4658
  | InternalPatchEvent
5495
4659
  | MutationEvent
4660
+ | PatchesEvent
5496
4661
  | {
5497
4662
  type: 'add behavior'
5498
4663
  behavior: Behavior
@@ -5525,7 +4690,6 @@ declare const editorMachine: StateMachine<
5525
4690
  type: 'update maxBlocks'
5526
4691
  maxBlocks: number | undefined
5527
4692
  }
5528
- | PatchesEvent
5529
4693
  | {
5530
4694
  type: 'blur'
5531
4695
  editor: PortableTextSlateEditor
@@ -5541,7 +4705,10 @@ declare const editorMachine: StateMachine<
5541
4705
  type: 'done normalizing'
5542
4706
  }
5543
4707
  | {
5544
- type: 'done syncing initial value'
4708
+ type: 'done syncing value'
4709
+ }
4710
+ | {
4711
+ type: 'syncing value'
5545
4712
  }
5546
4713
  | {
5547
4714
  type: 'behavior event'
@@ -5620,6 +4787,7 @@ declare const editorMachine: StateMachine<
5620
4787
  },
5621
4788
  | InternalPatchEvent
5622
4789
  | MutationEvent
4790
+ | PatchesEvent
5623
4791
  | {
5624
4792
  type: 'add behavior'
5625
4793
  behavior: Behavior
@@ -5652,7 +4820,6 @@ declare const editorMachine: StateMachine<
5652
4820
  type: 'update maxBlocks'
5653
4821
  maxBlocks: number | undefined
5654
4822
  }
5655
- | PatchesEvent
5656
4823
  | {
5657
4824
  type: 'blur'
5658
4825
  editor: PortableTextSlateEditor
@@ -5668,7 +4835,10 @@ declare const editorMachine: StateMachine<
5668
4835
  type: 'done normalizing'
5669
4836
  }
5670
4837
  | {
5671
- type: 'done syncing initial value'
4838
+ type: 'done syncing value'
4839
+ }
4840
+ | {
4841
+ type: 'syncing value'
5672
4842
  }
5673
4843
  | {
5674
4844
  type: 'behavior event'
@@ -5771,7 +4941,11 @@ declare const editorMachine: StateMachine<
5771
4941
  readonly initial: 'setting up'
5772
4942
  readonly states: {
5773
4943
  readonly 'setting up': {
5774
- readonly exit: readonly ['emit ready']
4944
+ readonly exit: readonly [
4945
+ 'emit ready',
4946
+ 'emit pending incoming patches',
4947
+ 'clear pending incoming patches',
4948
+ ]
5775
4949
  readonly on: {
5776
4950
  readonly 'internal.patch': {
5777
4951
  readonly actions: 'defer event'
@@ -5779,58 +4953,308 @@ declare const editorMachine: StateMachine<
5779
4953
  readonly 'mutation': {
5780
4954
  readonly actions: 'defer event'
5781
4955
  }
5782
- readonly 'done syncing initial value': {
5783
- readonly target: 'pristine'
4956
+ readonly 'done syncing value': {
4957
+ readonly target: 'set up'
4958
+ }
4959
+ readonly 'patches': {
4960
+ readonly actions: readonly ['defer incoming patches']
5784
4961
  }
5785
4962
  }
5786
4963
  }
5787
- readonly 'pristine': {
5788
- readonly initial: 'idle'
4964
+ readonly 'set up': {
4965
+ readonly type: 'parallel'
5789
4966
  readonly states: {
5790
- readonly idle: {
5791
- readonly on: {
5792
- readonly 'normalizing': {
5793
- readonly target: 'normalizing'
5794
- }
5795
- readonly 'internal.patch': {
5796
- readonly actions: 'defer event'
5797
- readonly target: '#editor.setup.dirty'
4967
+ readonly 'value sync': {
4968
+ readonly initial: 'idle'
4969
+ readonly states: {
4970
+ readonly 'idle': {
4971
+ readonly on: {
4972
+ readonly 'patches': {
4973
+ readonly actions: readonly [
4974
+ ActionFunction<
4975
+ {
4976
+ behaviors: Set<Behavior>
4977
+ converters: Set<Converter>
4978
+ getLegacySchema: () => PortableTextMemberSchemaTypes
4979
+ keyGenerator: () => string
4980
+ pendingEvents: Array<
4981
+ InternalPatchEvent | MutationEvent
4982
+ >
4983
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
4984
+ schema: EditorSchema
4985
+ initialReadOnly: boolean
4986
+ maxBlocks: number | undefined
4987
+ selection: EditorSelection
4988
+ incomingValue:
4989
+ | Array<PortableTextBlock>
4990
+ | undefined
4991
+ internalDrag?: {
4992
+ ghost?: HTMLElement
4993
+ origin: Pick<EventPosition, 'selection'>
4994
+ }
4995
+ slateEditor?: PortableTextSlateEditor
4996
+ },
4997
+ PatchesEvent,
4998
+ | InternalPatchEvent
4999
+ | MutationEvent
5000
+ | PatchesEvent
5001
+ | {
5002
+ type: 'add behavior'
5003
+ behavior: Behavior
5004
+ }
5005
+ | {
5006
+ type: 'remove behavior'
5007
+ behavior: Behavior
5008
+ }
5009
+ | {
5010
+ type: 'update readOnly'
5011
+ readOnly: boolean
5012
+ }
5013
+ | {
5014
+ type: 'update schema'
5015
+ schema: EditorSchema
5016
+ }
5017
+ | {
5018
+ type: 'update behaviors'
5019
+ behaviors: Array<Behavior>
5020
+ }
5021
+ | {
5022
+ type: 'update key generator'
5023
+ keyGenerator: () => string
5024
+ }
5025
+ | {
5026
+ type: 'update value'
5027
+ value: Array<PortableTextBlock> | undefined
5028
+ }
5029
+ | {
5030
+ type: 'update maxBlocks'
5031
+ maxBlocks: number | undefined
5032
+ }
5033
+ | {
5034
+ type: 'blur'
5035
+ editor: PortableTextSlateEditor
5036
+ }
5037
+ | {
5038
+ type: 'focus'
5039
+ editor: PortableTextSlateEditor
5040
+ }
5041
+ | {
5042
+ type: 'normalizing'
5043
+ }
5044
+ | {
5045
+ type: 'done normalizing'
5046
+ }
5047
+ | {
5048
+ type: 'done syncing value'
5049
+ }
5050
+ | {
5051
+ type: 'syncing value'
5052
+ }
5053
+ | {
5054
+ type: 'behavior event'
5055
+ behaviorEvent: BehaviorEvent
5056
+ editor: PortableTextSlateEditor
5057
+ nativeEvent?: {
5058
+ preventDefault: () => void
5059
+ }
5060
+ }
5061
+ | {
5062
+ type: 'notify.patch'
5063
+ patch: Patch
5064
+ }
5065
+ | {
5066
+ type: 'notify.mutation'
5067
+ patches: Array<Patch>
5068
+ snapshot: Array<PortableTextBlock> | undefined
5069
+ value: Array<PortableTextBlock> | undefined
5070
+ }
5071
+ | {
5072
+ type: 'notify.blurred'
5073
+ event: FocusEvent_2<HTMLDivElement, Element>
5074
+ }
5075
+ | {
5076
+ type: 'notify.done loading'
5077
+ }
5078
+ | {
5079
+ type: 'notify.editable'
5080
+ }
5081
+ | {
5082
+ type: 'notify.error'
5083
+ name: string
5084
+ description: string
5085
+ data: unknown
5086
+ }
5087
+ | {
5088
+ type: 'notify.focused'
5089
+ event: FocusEvent_2<HTMLDivElement, Element>
5090
+ }
5091
+ | {
5092
+ type: 'notify.invalid value'
5093
+ resolution: InvalidValueResolution | null
5094
+ value: Array<PortableTextBlock> | undefined
5095
+ }
5096
+ | {
5097
+ type: 'notify.loading'
5098
+ }
5099
+ | {
5100
+ type: 'notify.read only'
5101
+ }
5102
+ | {
5103
+ type: 'notify.ready'
5104
+ }
5105
+ | {
5106
+ type: 'notify.selection'
5107
+ selection: EditorSelection
5108
+ }
5109
+ | {
5110
+ type: 'notify.value changed'
5111
+ value: Array<PortableTextBlock> | undefined
5112
+ }
5113
+ | {
5114
+ type: 'notify.unset'
5115
+ previousValue: Array<PortableTextBlock>
5116
+ }
5117
+ | {
5118
+ type: 'dragstart'
5119
+ origin: Pick<EventPosition, 'selection'>
5120
+ ghost?: HTMLElement
5121
+ }
5122
+ | {
5123
+ type: 'dragend'
5124
+ }
5125
+ | {
5126
+ type: 'drop'
5127
+ },
5128
+ undefined,
5129
+ never,
5130
+ never,
5131
+ never,
5132
+ never,
5133
+ | PatchEvent
5134
+ | InternalPatchEvent
5135
+ | MutationEvent
5136
+ | PatchesEvent
5137
+ | {
5138
+ type: 'blurred'
5139
+ event: FocusEvent_2<HTMLDivElement, Element>
5140
+ }
5141
+ | {
5142
+ type: 'done loading'
5143
+ }
5144
+ | {
5145
+ type: 'editable'
5146
+ }
5147
+ | {
5148
+ type: 'error'
5149
+ name: string
5150
+ description: string
5151
+ data: unknown
5152
+ }
5153
+ | {
5154
+ type: 'focused'
5155
+ event: FocusEvent_2<HTMLDivElement, Element>
5156
+ }
5157
+ | {
5158
+ type: 'invalid value'
5159
+ resolution: InvalidValueResolution | null
5160
+ value: Array<PortableTextBlock> | undefined
5161
+ }
5162
+ | {
5163
+ type: 'loading'
5164
+ }
5165
+ | {
5166
+ type: 'read only'
5167
+ }
5168
+ | {
5169
+ type: 'ready'
5170
+ }
5171
+ | {
5172
+ type: 'selection'
5173
+ selection: EditorSelection
5174
+ }
5175
+ | {
5176
+ type: 'value changed'
5177
+ value: Array<PortableTextBlock> | undefined
5178
+ }
5179
+ | UnsetEvent
5180
+ >,
5181
+ ]
5182
+ }
5183
+ readonly 'syncing value': {
5184
+ readonly target: 'syncing value'
5185
+ }
5186
+ }
5798
5187
  }
5799
- readonly 'mutation': {
5800
- readonly actions: 'defer event'
5801
- readonly target: '#editor.setup.dirty'
5188
+ readonly 'syncing value': {
5189
+ readonly exit: readonly [
5190
+ 'emit pending incoming patches',
5191
+ 'clear pending incoming patches',
5192
+ ]
5193
+ readonly on: {
5194
+ readonly 'patches': {
5195
+ readonly actions: readonly ['defer incoming patches']
5196
+ }
5197
+ readonly 'done syncing value': {
5198
+ readonly target: 'idle'
5199
+ }
5200
+ }
5802
5201
  }
5803
5202
  }
5804
5203
  }
5805
- readonly normalizing: {
5806
- readonly on: {
5807
- readonly 'done normalizing': {
5808
- readonly target: 'idle'
5809
- }
5810
- readonly 'internal.patch': {
5811
- readonly actions: 'defer event'
5204
+ readonly 'writing': {
5205
+ readonly initial: 'pristine'
5206
+ readonly states: {
5207
+ readonly pristine: {
5208
+ readonly initial: 'idle'
5209
+ readonly states: {
5210
+ readonly idle: {
5211
+ readonly on: {
5212
+ readonly 'normalizing': {
5213
+ readonly target: 'normalizing'
5214
+ }
5215
+ readonly 'internal.patch': {
5216
+ readonly actions: 'defer event'
5217
+ readonly target: '#editor.setup.set up.writing.dirty'
5218
+ }
5219
+ readonly 'mutation': {
5220
+ readonly actions: 'defer event'
5221
+ readonly target: '#editor.setup.set up.writing.dirty'
5222
+ }
5223
+ }
5224
+ }
5225
+ readonly normalizing: {
5226
+ readonly on: {
5227
+ readonly 'done normalizing': {
5228
+ readonly target: 'idle'
5229
+ }
5230
+ readonly 'internal.patch': {
5231
+ readonly actions: 'defer event'
5232
+ }
5233
+ readonly 'mutation': {
5234
+ readonly actions: 'defer event'
5235
+ }
5236
+ }
5237
+ }
5238
+ }
5812
5239
  }
5813
- readonly 'mutation': {
5814
- readonly actions: 'defer event'
5240
+ readonly dirty: {
5241
+ readonly entry: readonly [
5242
+ 'emit pending events',
5243
+ 'clear pending events',
5244
+ ]
5245
+ readonly on: {
5246
+ readonly 'internal.patch': {
5247
+ readonly actions: 'emit patch event'
5248
+ }
5249
+ readonly 'mutation': {
5250
+ readonly actions: 'emit mutation event'
5251
+ }
5252
+ }
5815
5253
  }
5816
5254
  }
5817
5255
  }
5818
5256
  }
5819
5257
  }
5820
- readonly 'dirty': {
5821
- readonly entry: readonly [
5822
- 'emit pending events',
5823
- 'clear pending events',
5824
- ]
5825
- readonly on: {
5826
- readonly 'internal.patch': {
5827
- readonly actions: 'emit patch event'
5828
- }
5829
- readonly 'mutation': {
5830
- readonly actions: 'emit mutation event'
5831
- }
5832
- }
5833
- }
5834
5258
  }
5835
5259
  }
5836
5260
  }
@@ -5932,31 +5356,6 @@ declare type EditorSnapshot = {
5932
5356
  }
5933
5357
  }
5934
5358
 
5935
- /** @public */
5936
- declare interface EmailDefinition extends BaseSchemaDefinition {
5937
- type: 'email'
5938
- options?: EmailOptions
5939
- placeholder?: string
5940
- validation?: ValidationBuilder<EmailRule, string>
5941
- initialValue?: InitialValueProperty<any, string>
5942
- }
5943
-
5944
- /** @public */
5945
- declare interface EmailOptions extends BaseSchemaTypeOptions {}
5946
-
5947
- /** @public */
5948
- declare interface EmailRule extends RuleDef<EmailRule, string> {}
5949
-
5950
- /** @public */
5951
- declare interface EmptyProps {}
5952
-
5953
- /** @public */
5954
- declare interface EnumListProps<V = unknown> {
5955
- list?: Array<TitledListValue<V> | V>
5956
- layout?: 'radio' | 'dropdown'
5957
- direction?: 'horizontal' | 'vertical'
5958
- }
5959
-
5960
5359
  declare type EventPosition = {
5961
5360
  block: 'start' | 'end'
5962
5361
  /**
@@ -5970,247 +5369,59 @@ declare type ExtractNamespace<TType extends string> =
5970
5369
  TType extends `${infer Namespace}.${string}` ? Namespace : TType
5971
5370
 
5972
5371
  /**
5973
- * The shape of a field definition. Note, it's recommended to use the
5974
- * `defineField` function instead of using this type directly.
5975
- *
5976
- * Where `defineField` infers the exact field type,
5977
- * FieldDefinition is a compromise union of all types a field can have.
5978
- *
5979
- * A field definition can be a reference to another registered top-level type
5980
- * or a inline type definition.
5981
- *
5982
5372
  * @public
5983
5373
  */
5984
- declare type FieldDefinition<
5985
- TType extends IntrinsicTypeName = IntrinsicTypeName,
5986
- TAlias extends IntrinsicTypeName | undefined = undefined,
5987
- > = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) &
5988
- FieldDefinitionBase
5374
+ export declare function getBlockEndPoint({
5375
+ context,
5376
+ block,
5377
+ }: {
5378
+ context: Pick<EditorContext, 'schema'>
5379
+ block: {
5380
+ node: PortableTextBlock
5381
+ path: [KeyedSegment]
5382
+ }
5383
+ }): EditorSelectionPoint
5989
5384
 
5990
- /** @public */
5991
- declare interface FieldDefinitionBase {
5992
- fieldset?: string
5993
- group?: string | string[]
5994
- }
5385
+ /**
5386
+ * @public
5387
+ */
5388
+ export declare function getBlockStartPoint({
5389
+ context,
5390
+ block,
5391
+ }: {
5392
+ context: Pick<EditorContext, 'schema'>
5393
+ block: {
5394
+ node: PortableTextBlock
5395
+ path: [KeyedSegment]
5396
+ }
5397
+ }): EditorSelectionPoint
5995
5398
 
5996
- /** @public */
5997
- declare interface FieldGroup {
5998
- name: string
5999
- icon?: ComponentType
6000
- title?: string
6001
- description?: string
6002
- i18n?: I18nTextRecord<'title'>
6003
- hidden?: ConditionalProperty
6004
- default?: boolean
6005
- fields?: ObjectField[]
6006
- }
5399
+ /**
5400
+ * @public
5401
+ */
5402
+ export declare function getSelectionEndPoint<
5403
+ TEditorSelection extends NonNullable<EditorSelection> | null,
5404
+ TEditorSelectionPoint extends
5405
+ EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
5406
+ ? EditorSelectionPoint
5407
+ : null,
5408
+ >(selection: TEditorSelection): TEditorSelectionPoint
6007
5409
 
6008
- /** @public */
6009
- declare type FieldGroupDefinition = {
6010
- name: string
6011
- title?: string
6012
- hidden?: ConditionalProperty
6013
- icon?: ComponentType
6014
- default?: boolean
6015
- i18n?: I18nTextRecord<'title'>
6016
- }
5410
+ /**
5411
+ * @public
5412
+ */
5413
+ export declare function getSelectionStartPoint<
5414
+ TEditorSelection extends NonNullable<EditorSelection> | null,
5415
+ TEditorSelectionPoint extends
5416
+ EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
5417
+ ? EditorSelectionPoint
5418
+ : null,
5419
+ >(selection: TEditorSelection): TEditorSelectionPoint
6017
5420
 
6018
5421
  /**
6019
- * Holds a reference to a different field
6020
- * NOTE: Only use this through {@link Rule.valueOfField}
6021
- *
6022
5422
  * @public
6023
5423
  */
6024
- declare interface FieldReference {
6025
- type: symbol
6026
- path: string | string[]
6027
- }
6028
-
6029
- /** @public */
6030
- declare type FieldRules = {
6031
- [fieldKey: string]: SchemaValidationValue
6032
- }
6033
-
6034
- /** @public */
6035
- declare type Fieldset = SingleFieldSet | MultiFieldSet
6036
-
6037
- /** @public */
6038
- declare type FieldsetDefinition = {
6039
- name: string
6040
- title?: string
6041
- description?: string
6042
- group?: string
6043
- hidden?: ConditionalProperty
6044
- readOnly?: ConditionalProperty
6045
- options?: ObjectOptions
6046
- }
6047
-
6048
- /** @public */
6049
- declare interface File_2 {
6050
- [key: string]: unknown
6051
- asset?: Reference
6052
- }
6053
-
6054
- /** @public */
6055
- declare interface FileDefinition
6056
- extends Omit<
6057
- ObjectDefinition,
6058
- 'type' | 'fields' | 'options' | 'groups' | 'validation'
6059
- > {
6060
- type: 'file'
6061
- fields?: ObjectDefinition['fields']
6062
- options?: FileOptions
6063
- validation?: ValidationBuilder<FileRule, FileValue>
6064
- initialValue?: InitialValueProperty<any, FileValue>
6065
- }
6066
-
6067
- /** @public */
6068
- declare interface FileOptions extends ObjectOptions {
6069
- storeOriginalFilename?: boolean
6070
- accept?: string
6071
- sources?: AssetSource[]
6072
- }
6073
-
6074
- /** @public */
6075
- declare interface FileRule extends RuleDef<FileRule, FileValue> {
6076
- /**
6077
- * Require a file field has an asset.
6078
- *
6079
- * @example
6080
- * ```ts
6081
- * defineField({
6082
- * name: 'file',
6083
- * title: 'File',
6084
- * type: 'file',
6085
- * validation: (Rule) => Rule.required().assetRequired(),
6086
- * })
6087
- * ```
6088
- */
6089
- assetRequired(): FileRule
6090
- }
6091
-
6092
- /** @public */
6093
- declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {
6094
- options?: FileOptions
6095
- }
6096
-
6097
- /** @public */
6098
- declare interface FileValue {
6099
- asset?: Reference
6100
- [index: string]: unknown
6101
- }
6102
-
6103
- /** @public */
6104
- declare interface GeopointDefinition extends BaseSchemaDefinition {
6105
- type: 'geopoint'
6106
- options?: GeopointOptions
6107
- validation?: ValidationBuilder<GeopointRule, GeopointValue>
6108
- initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>
6109
- }
6110
-
6111
- /** @public */
6112
- declare interface GeopointOptions extends BaseSchemaTypeOptions {}
6113
-
6114
- /** @public */
6115
- declare interface GeopointRule extends RuleDef<GeopointRule, GeopointValue> {}
6116
-
6117
- /**
6118
- * Geographical point representing a pair of latitude and longitude coordinates,
6119
- * stored as degrees, in the World Geodetic System 1984 (WGS 84) format. Also
6120
- * includes an optional `alt` property representing the altitude in meters.
6121
- *
6122
- * @public
6123
- */
6124
- declare interface GeopointValue {
6125
- /**
6126
- * Type of the object. Must be `geopoint`.
6127
- */
6128
- _type: 'geopoint'
6129
- /**
6130
- * Latitude in degrees
6131
- */
6132
- lat: number
6133
- /**
6134
- * Longitude in degrees
6135
- */
6136
- lng: number
6137
- /**
6138
- * Altitude in meters
6139
- */
6140
- alt?: number
6141
- }
6142
-
6143
- /**
6144
- * @public
6145
- */
6146
- export declare function getBlockEndPoint({
6147
- context,
6148
- block,
6149
- }: {
6150
- context: Pick<EditorContext, 'schema'>
6151
- block: {
6152
- node: PortableTextBlock
6153
- path: [KeyedSegment]
6154
- }
6155
- }): EditorSelectionPoint
6156
-
6157
- /**
6158
- * @public
6159
- */
6160
- export declare function getBlockStartPoint({
6161
- context,
6162
- block,
6163
- }: {
6164
- context: Pick<EditorContext, 'schema'>
6165
- block: {
6166
- node: PortableTextBlock
6167
- path: [KeyedSegment]
6168
- }
6169
- }): EditorSelectionPoint
6170
-
6171
- /**
6172
- * @public
6173
- */
6174
- export declare function getSelectionEndPoint<
6175
- TEditorSelection extends NonNullable<EditorSelection> | null,
6176
- TEditorSelectionPoint extends
6177
- EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
6178
- ? EditorSelectionPoint
6179
- : null,
6180
- >(selection: TEditorSelection): TEditorSelectionPoint
6181
-
6182
- /**
6183
- * @public
6184
- */
6185
- export declare function getSelectionStartPoint<
6186
- TEditorSelection extends NonNullable<EditorSelection> | null,
6187
- TEditorSelectionPoint extends
6188
- EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
6189
- ? EditorSelectionPoint
6190
- : null,
6191
- >(selection: TEditorSelection): TEditorSelectionPoint
6192
-
6193
- /**
6194
- * @public
6195
- */
6196
- export declare function getTextBlockText(block: PortableTextTextBlock): string
6197
-
6198
- /** @public */
6199
- declare interface GlobalDocumentReferenceDefinition
6200
- extends BaseSchemaDefinition {
6201
- type: 'globalDocumentReference'
6202
- weak?: boolean
6203
- to: {
6204
- type: string
6205
- title?: string
6206
- icon?: ComponentType
6207
- preview?: PreviewConfig
6208
- }[]
6209
- resourceType: string
6210
- resourceId: string
6211
- options?: ReferenceOptions
6212
- studioUrl?: (document: {id: string; type?: string}) => string | null
6213
- }
5424
+ export declare function getTextBlockText(block: PortableTextTextBlock): string
6214
5425
 
6215
5426
  declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
6216
5427
 
@@ -6224,178 +5435,6 @@ declare type HistoryItem = {
6224
5435
  timestamp: Date
6225
5436
  }
6226
5437
 
6227
- /** @public */
6228
- declare interface HotspotOptions {
6229
- previews?: HotspotPreview[]
6230
- }
6231
-
6232
- /** @public */
6233
- declare interface HotspotPreview {
6234
- title: string
6235
- aspectRatio: number
6236
- }
6237
-
6238
- /** @public */
6239
- declare type I18nTextRecord<K extends string> = {
6240
- [P in K]?: {
6241
- key: string
6242
- ns: string
6243
- }
6244
- }
6245
-
6246
- /** @public */
6247
- declare interface ImageAsset extends Asset {
6248
- _type: 'sanity.imageAsset'
6249
- metadata: ImageMetadata
6250
- }
6251
-
6252
- /** @public */
6253
- declare interface ImageCrop {
6254
- _type?: 'sanity.imageCrop'
6255
- left: number
6256
- bottom: number
6257
- right: number
6258
- top: number
6259
- }
6260
-
6261
- /** @public */
6262
- declare interface ImageDefinition
6263
- extends Omit<
6264
- ObjectDefinition,
6265
- 'type' | 'fields' | 'options' | 'groups' | 'validation'
6266
- > {
6267
- type: 'image'
6268
- fields?: FieldDefinition[]
6269
- options?: ImageOptions
6270
- validation?: ValidationBuilder<ImageRule, ImageValue>
6271
- initialValue?: InitialValueProperty<any, ImageValue>
6272
- }
6273
-
6274
- /** @public */
6275
- declare interface ImageDimensions {
6276
- _type: 'sanity.imageDimensions'
6277
- height: number
6278
- width: number
6279
- aspectRatio: number
6280
- }
6281
-
6282
- /** @public */
6283
- declare interface ImageHotspot {
6284
- _type?: 'sanity.imageHotspot'
6285
- width: number
6286
- height: number
6287
- x: number
6288
- y: number
6289
- }
6290
-
6291
- /** @public */
6292
- declare interface ImageMetadata {
6293
- [key: string]: unknown
6294
- _type: 'sanity.imageMetadata'
6295
- dimensions: ImageDimensions
6296
- palette?: ImagePalette
6297
- lqip?: string
6298
- blurHash?: string
6299
- hasAlpha: boolean
6300
- isOpaque: boolean
6301
- }
6302
-
6303
- /** @public */
6304
- declare type ImageMetadataType =
6305
- | 'blurhash'
6306
- | 'lqip'
6307
- | 'palette'
6308
- | 'exif'
6309
- | 'image'
6310
- | 'location'
6311
-
6312
- /** @public */
6313
- declare interface ImageOptions extends FileOptions {
6314
- metadata?: ImageMetadataType[]
6315
- hotspot?: boolean | HotspotOptions
6316
- }
6317
-
6318
- /** @public */
6319
- declare interface ImagePalette {
6320
- _type: 'sanity.imagePalette'
6321
- darkMuted?: ImageSwatch
6322
- darkVibrant?: ImageSwatch
6323
- dominant?: ImageSwatch
6324
- lightMuted?: ImageSwatch
6325
- lightVibrant?: ImageSwatch
6326
- muted?: ImageSwatch
6327
- vibrant?: ImageSwatch
6328
- }
6329
-
6330
- /** @public */
6331
- declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {
6332
- /**
6333
- * Require an image field has an asset.
6334
- *
6335
- * @example
6336
- * ```ts
6337
- * defineField({
6338
- * name: 'image',
6339
- * title: 'Image',
6340
- * type: 'image',
6341
- * validation: (Rule) => Rule.required().assetRequired(),
6342
- * })
6343
- * ```
6344
- */
6345
- assetRequired(): ImageRule
6346
- }
6347
-
6348
- /** @public */
6349
- declare interface ImageSwatch {
6350
- _type: 'sanity.imagePaletteSwatch'
6351
- background: string
6352
- foreground: string
6353
- population: number
6354
- title?: string
6355
- }
6356
-
6357
- /** @public */
6358
- declare interface ImageValue extends FileValue {
6359
- crop?: ImageCrop
6360
- hotspot?: ImageHotspot
6361
- [index: string]: unknown
6362
- }
6363
-
6364
- /** @public */
6365
- declare type IndexTuple = [number | '', number | '']
6366
-
6367
- /** @public */
6368
- declare type InitialValueProperty<Params, Value> =
6369
- | Value
6370
- | InitialValueResolver<Params, Value>
6371
- | undefined
6372
-
6373
- /** @public */
6374
- declare type InitialValueResolver<Params, Value> = (
6375
- params: Params | undefined,
6376
- context: InitialValueResolverContext,
6377
- ) => Promise<Value> | Value
6378
-
6379
- /** @public */
6380
- declare interface InitialValueResolverContext {
6381
- projectId: string
6382
- dataset: string
6383
- schema: Schema
6384
- currentUser: CurrentUser | null
6385
- getClient: (options: {apiVersion: string}) => SanityClient
6386
- }
6387
-
6388
- /** @public */
6389
- declare type InlineFieldDefinition = {
6390
- [K in keyof IntrinsicDefinitions]: Omit<
6391
- IntrinsicDefinitions[K],
6392
- 'initialValue' | 'validation'
6393
- > & {
6394
- validation?: SchemaValidationValue
6395
- initialValue?: InitialValueProperty<any, any>
6396
- }
6397
- }
6398
-
6399
5438
  /**
6400
5439
  * Used to represent native InputEvents that hold a DataTransfer object.
6401
5440
  *
@@ -6414,33 +5453,6 @@ declare type InputBehaviorEvent = {
6414
5453
  }
6415
5454
  }
6416
5455
 
6417
- /** @alpha This API may change */
6418
- declare interface InsertMenuOptions {
6419
- /**
6420
- * @defaultValue `'auto'`
6421
- * `filter: 'auto'` automatically turns on filtering if there are more than 5
6422
- * schema types added to the menu.
6423
- */
6424
- filter?: 'auto' | boolean
6425
- groups?: Array<{
6426
- name: string
6427
- title?: string
6428
- of?: Array<string>
6429
- }>
6430
- /** defaultValue `true` */
6431
- showIcons?: boolean
6432
- /** @defaultValue `[{name: 'list'}]` */
6433
- views?: Array<
6434
- | {
6435
- name: 'list'
6436
- }
6437
- | {
6438
- name: 'grid'
6439
- previewImageUrl?: (schemaTypeName: string) => string | undefined
6440
- }
6441
- >
6442
- }
6443
-
6444
5456
  declare type InsertPlacement = 'auto' | 'after' | 'before'
6445
5457
 
6446
5458
  declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
@@ -6448,64 +5460,6 @@ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
6448
5460
  value: Array<PortableTextBlock>
6449
5461
  }
6450
5462
 
6451
- /** @public */
6452
- declare type IntrinsicArrayOfDefinition = {
6453
- [K in keyof IntrinsicDefinitions]: Omit<
6454
- ArrayOfEntry<IntrinsicDefinitions[K]>,
6455
- 'validation' | 'initialValue'
6456
- > & {
6457
- validation?: SchemaValidationValue
6458
- initialValue?: InitialValueProperty<any, any>
6459
- }
6460
- }
6461
-
6462
- /**
6463
- * `IntrinsicDefinitions` is a lookup map for "predefined" schema definitions.
6464
- * Schema types in `IntrinsicDefinitions` will have good type-completion and type-safety in {@link defineType},
6465
- * {@link defineField} and {@link defineArrayMember} once the `type` property is provided.
6466
- *
6467
- * By default, `IntrinsicDefinitions` contains all standard Sanity schema types (`array`, `string`, `number` ect),
6468
- * but it is an interface and as such, open for extension.
6469
- *
6470
- * This type can be extended using declaration merging; this way new entries can be added.
6471
- * See {@link defineType} for examples on how this can be accomplished.
6472
- *
6473
- * @see defineType
6474
- *
6475
- * @public
6476
- */
6477
- declare interface IntrinsicDefinitions {
6478
- array: ArrayDefinition
6479
- block: BlockDefinition
6480
- boolean: BooleanDefinition
6481
- date: DateDefinition
6482
- datetime: DatetimeDefinition
6483
- document: DocumentDefinition
6484
- file: FileDefinition
6485
- geopoint: GeopointDefinition
6486
- image: ImageDefinition
6487
- number: NumberDefinition
6488
- object: ObjectDefinition
6489
- reference: ReferenceDefinition
6490
- crossDatasetReference: CrossDatasetReferenceDefinition
6491
- globalDocumentReference: GlobalDocumentReferenceDefinition
6492
- slug: SlugDefinition
6493
- string: StringDefinition
6494
- text: TextDefinition
6495
- url: UrlDefinition
6496
- email: EmailDefinition
6497
- }
6498
-
6499
- /**
6500
- * A union of all intrinsic types allowed natively in the schema.
6501
- *
6502
- * @see IntrinsicDefinitions
6503
- *
6504
- * @public
6505
- */
6506
- declare type IntrinsicTypeName =
6507
- IntrinsicDefinitions[keyof IntrinsicDefinitions]['type']
6508
-
6509
5463
  /**
6510
5464
  * The editor has invalid data in the value that can be resolved by the user
6511
5465
  * @beta */
@@ -6599,27 +5553,6 @@ declare type KeyboardBehaviorEvent =
6599
5553
  >
6600
5554
  }
6601
5555
 
6602
- /** @public */
6603
- declare type KeyedSegment = {
6604
- _key: string
6605
- }
6606
-
6607
- /**
6608
- * Holds localized validation messages for a given field.
6609
- *
6610
- * @example Custom message for English (US) and Norwegian (Bokmål):
6611
- * ```
6612
- * {
6613
- * 'en-US': 'Needs to start with a capital letter',
6614
- * 'no-NB': 'Må starte med stor bokstav',
6615
- * }
6616
- * ```
6617
- * @public
6618
- */
6619
- declare interface LocalizedValidationMessages {
6620
- [locale: string]: string
6621
- }
6622
-
6623
5556
  /**
6624
5557
  * @beta
6625
5558
  */
@@ -6631,7 +5564,7 @@ export declare function mergeTextBlocks({
6631
5564
  context: Pick<EditorContext, 'keyGenerator' | 'schema'>
6632
5565
  targetBlock: PortableTextTextBlock
6633
5566
  incomingBlock: PortableTextTextBlock
6634
- }): PortableTextTextBlock<PortableTextObject_2 | PortableTextSpan_2>
5567
+ }): PortableTextTextBlock<PortableTextObject | PortableTextSpan>
6635
5568
 
6636
5569
  declare type MIMEType = `${string}/${string}`
6637
5570
 
@@ -6640,21 +5573,6 @@ declare type MouseBehaviorEvent = {
6640
5573
  position: EventPosition
6641
5574
  }
6642
5575
 
6643
- /** @public */
6644
- declare interface MultiFieldSet {
6645
- name: string
6646
- title?: string
6647
- description?: string
6648
- single?: false
6649
- group?: string | string[]
6650
- options?: CollapseOptions & {
6651
- columns?: number
6652
- }
6653
- fields: ObjectField[]
6654
- hidden?: ConditionalProperty
6655
- readOnly?: ConditionalProperty
6656
- }
6657
-
6658
5576
  /**
6659
5577
  * @public
6660
5578
  */
@@ -6722,114 +5640,10 @@ declare const nativeBehaviorEventTypes: readonly [
6722
5640
  'mouse.click',
6723
5641
  ]
6724
5642
 
6725
- /** @public */
6726
- declare interface NumberDefinition extends BaseSchemaDefinition {
6727
- type: 'number'
6728
- options?: NumberOptions
6729
- placeholder?: string
6730
- validation?: ValidationBuilder<NumberRule, number>
6731
- initialValue?: InitialValueProperty<any, number>
6732
- }
6733
-
6734
- /** @public */
6735
- declare interface NumberOptions
6736
- extends EnumListProps<number>,
6737
- BaseSchemaTypeOptions {}
6738
-
6739
- /** @public */
6740
- declare interface NumberRule extends RuleDef<NumberRule, number> {
6741
- min: (minNumber: number | FieldReference) => NumberRule
6742
- max: (maxNumber: number | FieldReference) => NumberRule
6743
- lessThan: (limit: number | FieldReference) => NumberRule
6744
- greaterThan: (limit: number | FieldReference) => NumberRule
6745
- integer: () => NumberRule
6746
- precision: (limit: number | FieldReference) => NumberRule
6747
- positive: () => NumberRule
6748
- negative: () => NumberRule
6749
- }
6750
-
6751
- /** @public */
6752
- declare interface NumberSchemaType extends BaseSchemaType {
6753
- jsonType: 'number'
6754
- options?: NumberOptions
6755
- initialValue?: InitialValueProperty<any, number>
6756
- }
6757
-
6758
5643
  declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
6759
5644
  _key?: PortableTextObject['_key']
6760
5645
  }
6761
5646
 
6762
- /** @public */
6763
- declare interface ObjectDefinition extends BaseSchemaDefinition {
6764
- type: 'object'
6765
- /**
6766
- * Object must have at least one field. This is validated at Studio startup.
6767
- */
6768
- fields: FieldDefinition[]
6769
- groups?: FieldGroupDefinition[]
6770
- fieldsets?: FieldsetDefinition[]
6771
- preview?: PreviewConfig
6772
- options?: ObjectOptions
6773
- validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>
6774
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
6775
- }
6776
-
6777
- /** @public */
6778
- declare interface ObjectField<T extends SchemaType = SchemaType> {
6779
- name: string
6780
- fieldset?: string
6781
- group?: string | string[]
6782
- type: ObjectFieldType<T>
6783
- }
6784
-
6785
- /** @public */
6786
- declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & {
6787
- hidden?: ConditionalProperty
6788
- readOnly?: ConditionalProperty
6789
- }
6790
-
6791
- /** @public */
6792
- declare interface ObjectOptions extends BaseSchemaTypeOptions {
6793
- collapsible?: boolean
6794
- collapsed?: boolean
6795
- columns?: number
6796
- modal?: {
6797
- type?: 'dialog' | 'popover'
6798
- width?: number | number[] | 'auto'
6799
- }
6800
- }
6801
-
6802
- /** @public */
6803
- declare interface ObjectRule
6804
- extends RuleDef<ObjectRule, Record<string, unknown>> {}
6805
-
6806
- /** @public */
6807
- declare interface ObjectSchemaType extends BaseSchemaType {
6808
- jsonType: 'object'
6809
- fields: ObjectField[]
6810
- groups?: FieldGroup[]
6811
- fieldsets?: Fieldset[]
6812
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
6813
- weak?: boolean
6814
- /** @deprecated Unused. Use the new field-level search config. */
6815
- __experimental_search?: {
6816
- path: (string | number)[]
6817
- weight: number
6818
- mapWith?: string
6819
- }[]
6820
- /** @alpha */
6821
- __experimental_omnisearch_visibility?: boolean
6822
- /** @alpha */
6823
- __experimental_actions?: string[]
6824
- /** @alpha */
6825
- __experimental_formPreviewTitle?: boolean
6826
- /**
6827
- * @beta
6828
- */
6829
- orderings?: SortOrdering[]
6830
- options?: any
6831
- }
6832
-
6833
5647
  /**
6834
5648
  * @public
6835
5649
  */
@@ -6844,12 +5658,6 @@ declare type PatchEvent = {
6844
5658
  patch: Patch
6845
5659
  }
6846
5660
 
6847
- /** @public */
6848
- declare type Path = PathSegment[]
6849
-
6850
- /** @public */
6851
- declare type PathSegment = string | number | KeyedSegment | IndexTuple
6852
-
6853
5661
  /**
6854
5662
  * @internal
6855
5663
  */
@@ -6859,18 +5667,6 @@ declare type PickFromUnion<
6859
5667
  TPickedTags extends TUnion[TTagKey],
6860
5668
  > = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never
6861
5669
 
6862
- /** @alpha */
6863
- declare type PortableTextBlock = PortableTextTextBlock | PortableTextObject
6864
-
6865
- /** @alpha */
6866
- declare type PortableTextChild = PortableTextObject | PortableTextSpan
6867
-
6868
- /** @alpha */
6869
- declare interface PortableTextListBlock extends PortableTextTextBlock {
6870
- listItem: string
6871
- level: number
6872
- }
6873
-
6874
5670
  /** @beta */
6875
5671
  declare type PortableTextMemberSchemaTypes = {
6876
5672
  annotations: (ObjectSchemaType & {
@@ -6886,13 +5682,6 @@ declare type PortableTextMemberSchemaTypes = {
6886
5682
  lists: BlockListDefinition[]
6887
5683
  }
6888
5684
 
6889
- /** @alpha */
6890
- declare interface PortableTextObject {
6891
- _type: string
6892
- _key: string
6893
- [other: string]: unknown
6894
- }
6895
-
6896
5685
  declare interface PortableTextSlateEditor extends ReactEditor {
6897
5686
  _key: 'editor'
6898
5687
  _type: 'editor'
@@ -6926,162 +5715,6 @@ declare interface PortableTextSlateEditor extends ReactEditor {
6926
5715
  redo: () => void
6927
5716
  }
6928
5717
 
6929
- /** @alpha */
6930
- declare interface PortableTextSpan {
6931
- _key: string
6932
- _type: 'span'
6933
- text: string
6934
- marks?: string[]
6935
- }
6936
-
6937
- /** @alpha */
6938
- declare interface PortableTextTextBlock<
6939
- TChild = PortableTextSpan | PortableTextObject,
6940
- > {
6941
- _type: string
6942
- _key: string
6943
- children: TChild[]
6944
- markDefs?: PortableTextObject[]
6945
- listItem?: string
6946
- style?: string
6947
- level?: number
6948
- }
6949
-
6950
- /** @public */
6951
- declare interface PrepareViewOptions {
6952
- /** @beta */
6953
- ordering?: SortOrdering
6954
- }
6955
-
6956
- /** @public */
6957
- declare interface PreviewConfig<
6958
- Select extends Record<string, string> = Record<string, string>,
6959
- PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,
6960
- > {
6961
- select?: Select
6962
- prepare?: (
6963
- value: PrepareValue,
6964
- viewOptions?: PrepareViewOptions,
6965
- ) => PreviewValue
6966
- }
6967
-
6968
- /** @public */
6969
- declare interface PreviewValue {
6970
- _id?: string
6971
- _createdAt?: string
6972
- _updatedAt?: string
6973
- title?: string
6974
- subtitle?: string
6975
- description?: string
6976
- media?: ReactNode | ElementType
6977
- imageUrl?: string
6978
- }
6979
-
6980
- /** @public */
6981
- declare interface Reference {
6982
- _type: string
6983
- _ref: string
6984
- _key?: string
6985
- _weak?: boolean
6986
- _strengthenOnPublish?: {
6987
- type: string
6988
- weak?: boolean
6989
- template?: {
6990
- id: string
6991
- params: Record<string, string | number | boolean>
6992
- }
6993
- }
6994
- }
6995
-
6996
- /** @public */
6997
- declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
6998
- disableNew?: boolean
6999
- }
7000
-
7001
- /** @public */
7002
- declare interface ReferenceDefinition extends BaseSchemaDefinition {
7003
- type: 'reference'
7004
- to: ReferenceTo
7005
- weak?: boolean
7006
- options?: ReferenceOptions
7007
- validation?: ValidationBuilder<ReferenceRule, ReferenceValue>
7008
- initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>
7009
- }
7010
-
7011
- /** @public */
7012
- declare type ReferenceFilterOptions =
7013
- | ReferenceFilterResolverOptions
7014
- | ReferenceFilterQueryOptions
7015
-
7016
- /** @public */
7017
- declare interface ReferenceFilterQueryOptions {
7018
- filter: string
7019
- filterParams?: Record<string, unknown>
7020
- }
7021
-
7022
- /** @public */
7023
- declare type ReferenceFilterResolver = (
7024
- context: ReferenceFilterResolverContext,
7025
- ) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>
7026
-
7027
- /** @public */
7028
- declare interface ReferenceFilterResolverContext {
7029
- document: SanityDocument
7030
- parent?: Record<string, unknown> | Record<string, unknown>[]
7031
- parentPath: Path
7032
- getClient: (options: {apiVersion: string}) => SanityClient
7033
- }
7034
-
7035
- /** @public */
7036
- declare interface ReferenceFilterResolverOptions {
7037
- filter?: ReferenceFilterResolver
7038
- filterParams?: never
7039
- }
7040
-
7041
- /** @public */
7042
- declare type ReferenceFilterSearchOptions = {
7043
- filter?: string
7044
- params?: Record<string, unknown>
7045
- tag?: string
7046
- maxFieldDepth?: number
7047
- strategy?: SearchStrategy
7048
- perspective?: ClientPerspective
7049
- }
7050
-
7051
- /**
7052
- * Types are closed for extension. To add properties via declaration merging to this type,
7053
- * redeclare and add the properties to the interfaces that make up ReferenceOptions type.
7054
- *
7055
- * @see ReferenceFilterOptions
7056
- * @see ReferenceFilterResolverOptions
7057
- * @see ReferenceBaseOptions
7058
- *
7059
- * @public
7060
- */
7061
- declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions
7062
-
7063
- /** @public */
7064
- declare interface ReferenceRule
7065
- extends RuleDef<ReferenceRule, ReferenceValue> {}
7066
-
7067
- /** @public */
7068
- declare interface ReferenceSchemaType
7069
- extends Omit<ObjectSchemaType, 'options'> {
7070
- jsonType: 'object'
7071
- to: ObjectSchemaType[]
7072
- weak?: boolean
7073
- options?: ReferenceOptions
7074
- }
7075
-
7076
- /** @public */
7077
- declare type ReferenceTo =
7078
- | SchemaTypeDefinition
7079
- | TypeReference
7080
- | Array<SchemaTypeDefinition | TypeReference>
7081
-
7082
- /** @public */
7083
- declare type ReferenceValue = Reference
7084
-
7085
5718
  /**************************************
7086
5719
  * Resolve behavior event
7087
5720
  **************************************/
@@ -7114,437 +5747,6 @@ export declare function reverseSelection<
7114
5747
  TEditorSelection extends NonNullable<EditorSelection> | null,
7115
5748
  >(selection: TEditorSelection): TEditorSelection
7116
5749
 
7117
- /** @public */
7118
- declare interface Role {
7119
- name: string
7120
- title: string
7121
- description?: string
7122
- }
7123
-
7124
- /** @public */
7125
- declare interface Rule {
7126
- /**
7127
- * @internal
7128
- * @deprecated internal use only
7129
- */
7130
- _type: RuleTypeConstraint | undefined
7131
- /**
7132
- * @internal
7133
- * @deprecated internal use only
7134
- */
7135
- _level: 'error' | 'warning' | 'info' | undefined
7136
- /**
7137
- * @internal
7138
- * @deprecated internal use only
7139
- */
7140
- _required: 'required' | 'optional' | undefined
7141
- /**
7142
- * @internal
7143
- * @deprecated internal use only
7144
- */
7145
- _typeDef: SchemaType | undefined
7146
- /**
7147
- * @internal
7148
- * @deprecated internal use only
7149
- */
7150
- _message: string | LocalizedValidationMessages | undefined
7151
- /**
7152
- * @internal
7153
- * @deprecated internal use only
7154
- */
7155
- _rules: RuleSpec[]
7156
- /**
7157
- * @internal
7158
- * @deprecated internal use only
7159
- */
7160
- _fieldRules: FieldRules | undefined
7161
- /**
7162
- * Takes in a path and returns an object with a symbol.
7163
- *
7164
- * When the validation lib sees this symbol, it will use the provided path to
7165
- * get a value from the current field's parent and use that value as the input
7166
- * to the Rule.
7167
- *
7168
- * The path that's given is forwarded to `lodash/get`
7169
- *
7170
- * ```js
7171
- * fields: [
7172
- * // ...
7173
- * {
7174
- * // ...
7175
- * name: 'highestTemperature',
7176
- * type: 'number',
7177
- * validation: (Rule) => Rule.positive().min(Rule.valueOfField('lowestTemperature')),
7178
- * // ...
7179
- * },
7180
- * ]
7181
- * ```
7182
- */
7183
- valueOfField: (path: string | string[]) => FieldReference
7184
- error(message?: string | LocalizedValidationMessages): Rule
7185
- warning(message?: string | LocalizedValidationMessages): Rule
7186
- info(message?: string | LocalizedValidationMessages): Rule
7187
- reset(): this
7188
- isRequired(): boolean
7189
- clone(): Rule
7190
- cloneWithRules(rules: RuleSpec[]): Rule
7191
- merge(rule: Rule): Rule
7192
- type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule
7193
- all(children: Rule[]): Rule
7194
- either(children: Rule[]): Rule
7195
- optional(): Rule
7196
- required(): Rule
7197
- custom<T = unknown>(
7198
- fn: CustomValidator<T>,
7199
- options?: {
7200
- bypassConcurrencyLimit?: boolean
7201
- },
7202
- ): Rule
7203
- min(len: number | string | FieldReference): Rule
7204
- max(len: number | string | FieldReference): Rule
7205
- length(len: number | FieldReference): Rule
7206
- valid(value: unknown | unknown[]): Rule
7207
- integer(): Rule
7208
- precision(limit: number | FieldReference): Rule
7209
- positive(): Rule
7210
- negative(): Rule
7211
- greaterThan(num: number | FieldReference): Rule
7212
- lessThan(num: number | FieldReference): Rule
7213
- uppercase(): Rule
7214
- lowercase(): Rule
7215
- regex(
7216
- pattern: RegExp,
7217
- name: string,
7218
- options: {
7219
- name?: string
7220
- invert?: boolean
7221
- },
7222
- ): Rule
7223
- regex(
7224
- pattern: RegExp,
7225
- options: {
7226
- name?: string
7227
- invert?: boolean
7228
- },
7229
- ): Rule
7230
- regex(pattern: RegExp, name: string): Rule
7231
- regex(pattern: RegExp): Rule
7232
- email(): Rule
7233
- uri(options?: UriValidationOptions): Rule
7234
- unique(): Rule
7235
- reference(): Rule
7236
- fields(rules: FieldRules): Rule
7237
- assetRequired(): Rule
7238
- validate(
7239
- value: unknown,
7240
- options: ValidationContext & {
7241
- /**
7242
- * @deprecated Internal use only
7243
- * @internal
7244
- */
7245
- __internal?: {
7246
- customValidationConcurrencyLimiter?: {
7247
- ready: () => Promise<void>
7248
- release: () => void
7249
- }
7250
- }
7251
- },
7252
- ): Promise<ValidationMarker[]>
7253
- }
7254
-
7255
- /** @public */
7256
- declare type RuleBuilder<
7257
- T extends RuleDef<T, FieldValue>,
7258
- FieldValue = unknown,
7259
- > = T | T[]
7260
-
7261
- /** @public */
7262
- declare interface RuleDef<T, FieldValue = unknown> {
7263
- required: () => T
7264
- custom: <LenientFieldValue extends FieldValue>(
7265
- fn: CustomValidator<LenientFieldValue | undefined>,
7266
- ) => T
7267
- info: (message?: string | LocalizedValidationMessages) => T
7268
- error: (message?: string | LocalizedValidationMessages) => T
7269
- warning: (message?: string | LocalizedValidationMessages) => T
7270
- valueOfField: (path: string | string[]) => FieldReference
7271
- }
7272
-
7273
- /** @public */
7274
- declare type RuleSpec =
7275
- | {
7276
- flag: 'integer'
7277
- }
7278
- | {
7279
- flag: 'email'
7280
- }
7281
- | {
7282
- flag: 'unique'
7283
- }
7284
- | {
7285
- flag: 'reference'
7286
- }
7287
- | {
7288
- flag: 'type'
7289
- constraint: RuleTypeConstraint
7290
- }
7291
- | {
7292
- flag: 'all'
7293
- constraint: Rule[]
7294
- }
7295
- | {
7296
- flag: 'either'
7297
- constraint: Rule[]
7298
- }
7299
- | {
7300
- flag: 'presence'
7301
- constraint: 'optional' | 'required'
7302
- }
7303
- | {
7304
- flag: 'custom'
7305
- constraint: CustomValidator
7306
- }
7307
- | {
7308
- flag: 'min'
7309
- constraint: number | string
7310
- }
7311
- | {
7312
- flag: 'max'
7313
- constraint: number | string
7314
- }
7315
- | {
7316
- flag: 'length'
7317
- constraint: number
7318
- }
7319
- | {
7320
- flag: 'valid'
7321
- constraint: unknown[]
7322
- }
7323
- | {
7324
- flag: 'precision'
7325
- constraint: number
7326
- }
7327
- | {
7328
- flag: 'lessThan'
7329
- constraint: number
7330
- }
7331
- | {
7332
- flag: 'greaterThan'
7333
- constraint: number
7334
- }
7335
- | {
7336
- flag: 'stringCasing'
7337
- constraint: 'uppercase' | 'lowercase'
7338
- }
7339
- | {
7340
- flag: 'assetRequired'
7341
- constraint: {
7342
- assetType: 'asset' | 'image' | 'file'
7343
- }
7344
- }
7345
- | {
7346
- flag: 'regex'
7347
- constraint: {
7348
- pattern: RegExp
7349
- name?: string
7350
- invert: boolean
7351
- }
7352
- }
7353
- | {
7354
- flag: 'uri'
7355
- constraint: {
7356
- options: {
7357
- scheme: RegExp[]
7358
- allowRelative: boolean
7359
- relativeOnly: boolean
7360
- allowCredentials: boolean
7361
- }
7362
- }
7363
- }
7364
-
7365
- /** @public */
7366
- declare type RuleTypeConstraint =
7367
- | 'Array'
7368
- | 'Boolean'
7369
- | 'Date'
7370
- | 'Number'
7371
- | 'Object'
7372
- | 'String'
7373
-
7374
- /**
7375
- * Options for configuring how Sanity Create interfaces with the type or field.
7376
- *
7377
- * @public
7378
- */
7379
- declare interface SanityCreateOptions {
7380
- /** Set to true to exclude a type or field from appearing in Sanity Create */
7381
- exclude?: boolean
7382
- /**
7383
- * A short description of what the type or field is used for.
7384
- * Purpose can be used to improve how and when content mapping uses the field.
7385
- * */
7386
- purpose?: string
7387
- }
7388
-
7389
- /** @public */
7390
- declare interface SanityDocument {
7391
- _id: string
7392
- _type: string
7393
- _createdAt: string
7394
- _updatedAt: string
7395
- _rev: string
7396
- [key: string]: unknown
7397
- }
7398
-
7399
- /** @public */
7400
- declare interface Schema {
7401
- /** @internal */
7402
- _original?: {
7403
- name: string
7404
- types: SchemaTypeDefinition[]
7405
- }
7406
- /** @internal */
7407
- _registry: {
7408
- [typeName: string]: any
7409
- }
7410
- /** @internal */
7411
- _validation?: SchemaValidationProblemGroup[]
7412
- name: string
7413
- get: (name: string) => SchemaType | undefined
7414
- has: (name: string) => boolean
7415
- getTypeNames: () => string[]
7416
- }
7417
-
7418
- /**
7419
- * Note: you probably want `SchemaTypeDefinition` instead
7420
- * @see SchemaTypeDefinition
7421
- *
7422
- * @public
7423
- */
7424
- declare type SchemaType =
7425
- | ArraySchemaType
7426
- | BooleanSchemaType
7427
- | FileSchemaType
7428
- | NumberSchemaType
7429
- | ObjectSchemaType
7430
- | StringSchemaType
7431
- | ReferenceSchemaType
7432
-
7433
- /**
7434
- * Represents a Sanity schema type definition with an optional type parameter.
7435
- *
7436
- * It's recommend to use the `defineType` helper instead of this type by
7437
- * itself.
7438
- *
7439
- * @see defineType
7440
- *
7441
- * @public
7442
- */
7443
- declare type SchemaTypeDefinition<
7444
- TType extends IntrinsicTypeName = IntrinsicTypeName,
7445
- > = IntrinsicDefinitions[IntrinsicTypeName] | TypeAliasDefinition<string, TType>
7446
-
7447
- /** @public */
7448
- declare interface SchemaValidationError {
7449
- helpId?: string
7450
- message: string
7451
- severity: 'error'
7452
- }
7453
-
7454
- /** @internal */
7455
- declare type SchemaValidationProblem =
7456
- | SchemaValidationError
7457
- | SchemaValidationWarning
7458
-
7459
- /** @internal */
7460
- declare interface SchemaValidationProblemGroup {
7461
- path: SchemaValidationProblemPath
7462
- problems: SchemaValidationProblem[]
7463
- }
7464
-
7465
- /** @internal */
7466
- declare type SchemaValidationProblemPath = Array<
7467
- | {
7468
- kind: 'type'
7469
- type: string
7470
- name?: string
7471
- }
7472
- | {
7473
- kind: 'property'
7474
- name: string
7475
- }
7476
- >
7477
-
7478
- /**
7479
- * Represents the possible values of a schema type's `validation` field.
7480
- *
7481
- * If the schema has not been run through `inferFromSchema` from
7482
- * `sanity/validation` then value could be a function.
7483
- *
7484
- * `inferFromSchema` mutates the schema converts this value to an array of
7485
- * `Rule` instances.
7486
- *
7487
- * @privateRemarks
7488
- *
7489
- * Usage of the schema inside the studio will almost always be from the compiled
7490
- * `createSchema` function. In this case, you can cast the value or throw to
7491
- * narrow the type. E.g.:
7492
- *
7493
- * ```ts
7494
- * if (typeof type.validation === 'function') {
7495
- * throw new Error(
7496
- * `Schema type "${type.name}"'s \`validation\` was not run though \`inferFromSchema\``
7497
- * )
7498
- * }
7499
- * ```
7500
- *
7501
- * @public
7502
- */
7503
- declare type SchemaValidationValue =
7504
- | false
7505
- | undefined
7506
- | Rule
7507
- | SchemaValidationValue[]
7508
- | ((rule: Rule) => SchemaValidationValue)
7509
-
7510
- /** @internal */
7511
- declare interface SchemaValidationWarning {
7512
- helpId?: string
7513
- message: string
7514
- severity: 'warning'
7515
- }
7516
-
7517
- /** @public */
7518
- declare interface SearchConfiguration {
7519
- search?: {
7520
- /**
7521
- * Defines a search weight for this field to prioritize its importance
7522
- * during search operations in the Studio. This setting allows the specified
7523
- * field to be ranked higher in search results compared to other fields.
7524
- *
7525
- * By default, all fields are assigned a weight of 1. However, if a field is
7526
- * chosen as the `title` in the preview configuration's `select` option, it
7527
- * will automatically receive a default weight of 10. Similarly, if selected
7528
- * as the `subtitle`, the default weight is 5. Fields marked as
7529
- * `hidden: true` (no function) are assigned a weight of 0 by default.
7530
- *
7531
- * Note: Search weight configuration is currently supported only for fields
7532
- * of type string or portable text arrays.
7533
- */
7534
- weight?: number
7535
- }
7536
- }
7537
-
7538
- /**
7539
- * @public
7540
- */
7541
- declare const searchStrategies: readonly ['groqLegacy', 'groq2024']
7542
-
7543
- /**
7544
- * @public
7545
- */
7546
- declare type SearchStrategy = (typeof searchStrategies)[number]
7547
-
7548
5750
  /**
7549
5751
  * @public
7550
5752
  */
@@ -7568,15 +5770,6 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
7568
5770
  'serialization.success' | 'serialization.failure'
7569
5771
  >
7570
5772
 
7571
- /** @public */
7572
- declare interface SingleFieldSet {
7573
- single: true
7574
- field: ObjectField
7575
- hidden?: ConditionalProperty
7576
- readOnly?: ConditionalProperty
7577
- group?: string | string[]
7578
- }
7579
-
7580
5773
  /**
7581
5774
  * @public
7582
5775
  */
@@ -7588,94 +5781,6 @@ export declare function sliceBlocks({
7588
5781
  blocks: Array<PortableTextBlock>
7589
5782
  }): Array<PortableTextBlock>
7590
5783
 
7591
- /** @public */
7592
- declare interface SlugDefinition extends BaseSchemaDefinition {
7593
- type: 'slug'
7594
- options?: SlugOptions
7595
- validation?: ValidationBuilder<SlugRule, SlugValue>
7596
- initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>
7597
- }
7598
-
7599
- /** @public */
7600
- declare type SlugifierFn = (
7601
- source: string,
7602
- schemaType: SlugSchemaType,
7603
- context: SlugSourceContext,
7604
- ) => string | Promise<string>
7605
-
7606
- /** @public */
7607
- declare type SlugIsUniqueValidator = (
7608
- slug: string,
7609
- context: SlugValidationContext,
7610
- ) => boolean | Promise<boolean>
7611
-
7612
- /** @public */
7613
- declare interface SlugOptions
7614
- extends SearchConfiguration,
7615
- BaseSchemaTypeOptions {
7616
- source?: string | Path | SlugSourceFn
7617
- maxLength?: number
7618
- slugify?: SlugifierFn
7619
- isUnique?: SlugIsUniqueValidator
7620
- disableArrayWarning?: boolean
7621
- }
7622
-
7623
- /** @public */
7624
- declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]
7625
-
7626
- /** @public */
7627
- declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
7628
-
7629
- /** @public */
7630
- declare interface SlugSchemaType extends ObjectSchemaType {
7631
- jsonType: 'object'
7632
- options?: SlugOptions
7633
- }
7634
-
7635
- /** @public */
7636
- declare interface SlugSourceContext {
7637
- parentPath: Path
7638
- parent: SlugParent
7639
- projectId: string
7640
- dataset: string
7641
- schema: Schema
7642
- currentUser: CurrentUser | null
7643
- getClient: (options: {apiVersion: string}) => SanityClient
7644
- }
7645
-
7646
- /** @public */
7647
- declare type SlugSourceFn = (
7648
- document: SanityDocument,
7649
- context: SlugSourceContext,
7650
- ) => string | Promise<string>
7651
-
7652
- /** @public */
7653
- declare interface SlugValidationContext extends ValidationContext {
7654
- parent: SlugParent
7655
- type: SlugSchemaType
7656
- defaultIsUnique: SlugIsUniqueValidator
7657
- }
7658
-
7659
- /** @public */
7660
- declare interface SlugValue {
7661
- _type: 'slug'
7662
- current?: string
7663
- }
7664
-
7665
- /** @beta */
7666
- declare type SortOrdering = {
7667
- title: string
7668
- i18n?: I18nTextRecord<'title'>
7669
- name: string
7670
- by: SortOrderingItem[]
7671
- }
7672
-
7673
- /** @beta */
7674
- declare interface SortOrderingItem {
7675
- field: string
7676
- direction: 'asc' | 'desc'
7677
- }
7678
-
7679
5784
  /**
7680
5785
  * @public
7681
5786
  */
@@ -7707,60 +5812,6 @@ export declare function splitTextBlock({
7707
5812
 
7708
5813
  declare type StrictExtract<T, U extends T> = U
7709
5814
 
7710
- /** @public */
7711
- declare interface StringDefinition extends BaseSchemaDefinition {
7712
- type: 'string'
7713
- options?: StringOptions
7714
- placeholder?: string
7715
- validation?: ValidationBuilder<StringRule, string>
7716
- initialValue?: InitialValueProperty<any, string>
7717
- }
7718
-
7719
- /** @public */
7720
- declare interface StringOptions
7721
- extends EnumListProps<string>,
7722
- SearchConfiguration,
7723
- BaseSchemaTypeOptions {}
7724
-
7725
- /** @public */
7726
- declare interface StringRule extends RuleDef<StringRule, string> {
7727
- min: (minNumber: number | FieldReference) => StringRule
7728
- max: (maxNumber: number | FieldReference) => StringRule
7729
- length: (exactLength: number | FieldReference) => StringRule
7730
- uppercase: () => StringRule
7731
- lowercase: () => StringRule
7732
- regex(
7733
- pattern: RegExp,
7734
- name: string,
7735
- options: {
7736
- name?: string
7737
- invert?: boolean
7738
- },
7739
- ): StringRule
7740
- regex(
7741
- pattern: RegExp,
7742
- options: {
7743
- name?: string
7744
- invert?: boolean
7745
- },
7746
- ): StringRule
7747
- regex(pattern: RegExp, name: string): StringRule
7748
- regex(pattern: RegExp): StringRule
7749
- email(): StringRule
7750
- }
7751
-
7752
- /**
7753
- * This is used for string, text, date and datetime.
7754
- * This interface represent the compiled version at runtime, when accessed through Schema.
7755
- *
7756
- * @public
7757
- */
7758
- declare interface StringSchemaType extends BaseSchemaType {
7759
- jsonType: 'string'
7760
- options?: StringOptions & TextOptions & DateOptions & DatetimeOptions
7761
- initialValue?: InitialValueProperty<any, string>
7762
- }
7763
-
7764
5815
  /**
7765
5816
  * @beta
7766
5817
  */
@@ -7910,199 +5961,9 @@ declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
7910
5961
  _key?: PortableTextTextBlock['_key']
7911
5962
  }
7912
5963
 
7913
- /** @public */
7914
- declare interface TextDefinition extends BaseSchemaDefinition {
7915
- type: 'text'
7916
- rows?: number
7917
- options?: TextOptions
7918
- placeholder?: string
7919
- validation?: ValidationBuilder<TextRule, string>
7920
- initialValue?: InitialValueProperty<any, string>
7921
- }
7922
-
7923
- /** @public */
7924
- declare interface TextOptions extends StringOptions {}
7925
-
7926
- /** @public */
7927
- declare interface TextRule extends StringRule {}
7928
-
7929
- /** @public */
7930
- declare interface TitledListValue<V = unknown> {
7931
- _key?: string
7932
- title: string
7933
- value?: V
7934
- }
7935
-
7936
- /**
7937
- * Represents a type definition that is an alias/extension of an existing type
7938
- * in your schema. Creating a type alias will re-register that existing type
7939
- * under a different name. You can also override the default type options with
7940
- * a type alias definition.
7941
- *
7942
- * @public
7943
- */
7944
- declare interface TypeAliasDefinition<
7945
- TType extends string,
7946
- TAlias extends IntrinsicTypeName | undefined,
7947
- > extends BaseSchemaDefinition {
7948
- type: TType
7949
- options?: TAlias extends IntrinsicTypeName
7950
- ? IntrinsicDefinitions[TAlias]['options']
7951
- : unknown
7952
- validation?: SchemaValidationValue
7953
- initialValue?: InitialValueProperty<any, any>
7954
- preview?: PreviewConfig
7955
- components?: {
7956
- annotation?: ComponentType<any>
7957
- block?: ComponentType<any>
7958
- inlineBlock?: ComponentType<any>
7959
- diff?: ComponentType<any>
7960
- field?: ComponentType<any>
7961
- input?: ComponentType<any>
7962
- item?: ComponentType<any>
7963
- preview?: ComponentType<any>
7964
- }
7965
- }
7966
-
7967
- /**
7968
- * Represents a reference to another type registered top-level in your schema.
7969
- *
7970
- * @public
7971
- */
7972
- declare interface TypeReference {
7973
- type: string
7974
- name?: string
7975
- icon?: ComponentType | ReactNode
7976
- options?: {
7977
- [key: string]: unknown
7978
- }
7979
- }
7980
-
7981
5964
  declare type UnsetEvent = {
7982
5965
  type: 'unset'
7983
5966
  previousValue: Array<PortableTextBlock>
7984
5967
  }
7985
5968
 
7986
- /** @public */
7987
- declare interface UriValidationOptions {
7988
- scheme?: (string | RegExp) | Array<string | RegExp>
7989
- allowRelative?: boolean
7990
- relativeOnly?: boolean
7991
- allowCredentials?: boolean
7992
- }
7993
-
7994
- /** @public */
7995
- declare interface UrlDefinition extends BaseSchemaDefinition {
7996
- type: 'url'
7997
- options?: UrlOptions
7998
- placeholder?: string
7999
- validation?: ValidationBuilder<UrlRule, string>
8000
- initialValue?: InitialValueProperty<any, string>
8001
- }
8002
-
8003
- /** @public */
8004
- declare interface UrlOptions extends BaseSchemaTypeOptions {}
8005
-
8006
- /** @public */
8007
- declare interface UrlRule extends RuleDef<UrlRule, string> {
8008
- uri(options: UriValidationOptions): UrlRule
8009
- }
8010
-
8011
- /** @public */
8012
- declare type ValidationBuilder<
8013
- T extends RuleDef<T, FieldValue>,
8014
- FieldValue = unknown,
8015
- > = (rule: T) => RuleBuilder<T, FieldValue>
8016
-
8017
- /**
8018
- * A context object passed around during validation. This includes the
8019
- * `Rule.custom` context.
8020
- *
8021
- * e.g.
8022
- *
8023
- * ```js
8024
- * Rule.custom((_, validationContext) => {
8025
- * // ...
8026
- * })`
8027
- * ```
8028
- *
8029
- * @public
8030
- */
8031
- declare interface ValidationContext {
8032
- getClient: (options: {apiVersion: string}) => SanityClient
8033
- schema: Schema
8034
- parent?: unknown
8035
- type?: SchemaType
8036
- document?: SanityDocument
8037
- path?: Path
8038
- getDocumentExists?: (options: {id: string}) => Promise<boolean>
8039
- environment: 'cli' | 'studio'
8040
- }
8041
-
8042
- /**
8043
- * The shape that can be returned from a custom validator to be converted into
8044
- * a validation marker by the validation logic. Inside of a custom validator,
8045
- * you can return an array of these in order to specify multiple paths within
8046
- * an object or array.
8047
- *
8048
- * @public
8049
- */
8050
- declare interface ValidationError {
8051
- /**
8052
- * The message describing why the value is not valid. This message will be
8053
- * included in the validation markers after validation has finished running.
8054
- */
8055
- message: string
8056
- /**
8057
- * If writing a custom validator, you can return validation messages to
8058
- * specific path inside of the current value (object or array) by populating
8059
- * this `path` prop.
8060
- *
8061
- * NOTE: This path is relative to the current value and _not_ relative to
8062
- * the document.
8063
- */
8064
- path?: Path
8065
- /**
8066
- * Same as `path` but allows more than one value. If provided, the same
8067
- * message will create two markers from each path with the same message
8068
- * provided.
8069
- *
8070
- * @deprecated prefer `path`
8071
- */
8072
- paths?: Path[]
8073
- /**
8074
- * @deprecated Unused. Was used to store the results from `.either()` /`.all()`
8075
- */
8076
- children?: ValidationMarker[]
8077
- /**
8078
- * @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
8079
- */
8080
- operation?: 'AND' | 'OR'
8081
- /**
8082
- * @deprecated Unused. Was relevant when validation error was used as a class.
8083
- */
8084
- cloneWithMessage?(message: string): ValidationError
8085
- }
8086
-
8087
- /** @public */
8088
- declare interface ValidationMarker {
8089
- level: 'error' | 'warning' | 'info'
8090
- /**
8091
- * The validation message for this marker. E.g. "Must be greater than 0"
8092
- */
8093
- message: string
8094
- /**
8095
- * @deprecated use `message` instead
8096
- */
8097
- item?: ValidationError
8098
- /**
8099
- * The sanity path _relative to the root of the current document_ to this
8100
- * marker.
8101
- *
8102
- * NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
8103
- * are not compatible with deep getters like lodash/get
8104
- */
8105
- path: Path
8106
- }
8107
-
8108
5969
  export {}