@portabletext/editor 1.48.8 → 1.48.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-cjs/editor-provider.cjs +38 -38
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs +2 -2
- package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +3 -23
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +2 -1
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/selector.get-focus-inline-object.js +2 -1
- package/lib/_chunks-es/selector.get-focus-inline-object.js.map +1 -1
- package/lib/_chunks-es/selector.is-overlapping-selection.js +1 -20
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/behaviors/index.d.cts +228 -2529
- package/lib/behaviors/index.d.ts +228 -2529
- package/lib/index.d.cts +26 -2325
- package/lib/index.d.ts +26 -2325
- package/lib/plugins/index.d.cts +16 -2316
- package/lib/plugins/index.d.ts +16 -2316
- package/lib/selectors/index.cjs +2 -2
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +22 -2319
- package/lib/selectors/index.d.ts +22 -2319
- package/lib/selectors/index.js +2 -1
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.d.cts +21 -2321
- package/lib/utils/index.d.ts +21 -2321
- package/package.json +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import {Patch} from '@portabletext/patches'
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
|
+
ArrayDefinition,
|
|
4
|
+
ArraySchemaType,
|
|
5
|
+
BlockDecoratorDefinition,
|
|
6
|
+
BlockListDefinition,
|
|
7
|
+
BlockStyleDefinition,
|
|
8
|
+
KeyedSegment,
|
|
9
|
+
ObjectSchemaType,
|
|
10
|
+
Path,
|
|
11
|
+
PortableTextListBlock,
|
|
12
|
+
PortableTextObject,
|
|
13
|
+
TypedObject,
|
|
14
|
+
} from '@sanity/types'
|
|
3
15
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
16
|
+
PortableTextBlock,
|
|
17
|
+
PortableTextChild,
|
|
18
|
+
PortableTextSpan,
|
|
19
|
+
PortableTextTextBlock,
|
|
6
20
|
} from '@sanity/types'
|
|
7
21
|
import type {
|
|
8
22
|
BaseSyntheticEvent,
|
|
@@ -14,14 +28,11 @@ import type {
|
|
|
14
28
|
} from 'react'
|
|
15
29
|
import {
|
|
16
30
|
Component,
|
|
17
|
-
ComponentType,
|
|
18
|
-
ElementType,
|
|
19
31
|
ForwardRefExoticComponent,
|
|
20
32
|
JSX,
|
|
21
33
|
MutableRefObject,
|
|
22
34
|
PropsWithChildren,
|
|
23
35
|
default as React_2,
|
|
24
|
-
ReactNode,
|
|
25
36
|
RefAttributes,
|
|
26
37
|
TextareaHTMLAttributes,
|
|
27
38
|
} from 'react'
|
|
@@ -243,277 +254,6 @@ export declare type AddedAnnotationPaths = {
|
|
|
243
254
|
spanPath: Path
|
|
244
255
|
}
|
|
245
256
|
|
|
246
|
-
/**
|
|
247
|
-
* Types of array actions that can be performed
|
|
248
|
-
* @beta
|
|
249
|
-
*/
|
|
250
|
-
declare type ArrayActionName =
|
|
251
|
-
/**
|
|
252
|
-
* Add any item to the array at any position
|
|
253
|
-
*/
|
|
254
|
-
| 'add'
|
|
255
|
-
/**
|
|
256
|
-
* Add item after an existing item
|
|
257
|
-
*/
|
|
258
|
-
| 'addBefore'
|
|
259
|
-
/**
|
|
260
|
-
* Add item after an existing item
|
|
261
|
-
*/
|
|
262
|
-
| 'addAfter'
|
|
263
|
-
/**
|
|
264
|
-
* Remove any item
|
|
265
|
-
*/
|
|
266
|
-
| 'remove'
|
|
267
|
-
/**
|
|
268
|
-
* Duplicate item
|
|
269
|
-
*/
|
|
270
|
-
| 'duplicate'
|
|
271
|
-
/**
|
|
272
|
-
* Copy item
|
|
273
|
-
*/
|
|
274
|
-
| 'copy'
|
|
275
|
-
|
|
276
|
-
/** @public */
|
|
277
|
-
declare interface ArrayDefinition extends BaseSchemaDefinition {
|
|
278
|
-
type: 'array'
|
|
279
|
-
of: ArrayOfType[]
|
|
280
|
-
initialValue?: InitialValueProperty<any, unknown[]>
|
|
281
|
-
validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>
|
|
282
|
-
options?: ArrayOptions
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/** @public */
|
|
286
|
-
declare type ArrayOfEntry<T> = Omit<T, 'name' | 'hidden'> & {
|
|
287
|
-
name?: string
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/** @public */
|
|
291
|
-
declare type ArrayOfType<
|
|
292
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
293
|
-
TAlias extends IntrinsicTypeName | undefined = undefined,
|
|
294
|
-
> =
|
|
295
|
-
| IntrinsicArrayOfDefinition[TType]
|
|
296
|
-
| ArrayOfEntry<TypeAliasDefinition<string, TAlias>>
|
|
297
|
-
|
|
298
|
-
/** @public */
|
|
299
|
-
declare interface ArrayOptions<V = unknown>
|
|
300
|
-
extends SearchConfiguration,
|
|
301
|
-
BaseSchemaTypeOptions {
|
|
302
|
-
list?: TitledListValue<V>[] | V[]
|
|
303
|
-
layout?: 'list' | 'tags' | 'grid'
|
|
304
|
-
/** @deprecated This option does not have any effect anymore */
|
|
305
|
-
direction?: 'horizontal' | 'vertical'
|
|
306
|
-
sortable?: boolean
|
|
307
|
-
modal?: {
|
|
308
|
-
type?: 'dialog' | 'popover'
|
|
309
|
-
width?: number | 'auto'
|
|
310
|
-
}
|
|
311
|
-
/** @alpha This API may change */
|
|
312
|
-
insertMenu?: InsertMenuOptions
|
|
313
|
-
/**
|
|
314
|
-
* A boolean flag to enable or disable tree editing for the array.
|
|
315
|
-
* If there are any nested arrays, they will inherit this value.
|
|
316
|
-
* @deprecated tree editing beta feature has been disabled
|
|
317
|
-
*/
|
|
318
|
-
treeEditing?: boolean
|
|
319
|
-
/**
|
|
320
|
-
* A list of array actions to disable
|
|
321
|
-
* Possible options are defined by {@link ArrayActionName}
|
|
322
|
-
* @beta
|
|
323
|
-
*/
|
|
324
|
-
disableActions?: ArrayActionName[]
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/** @public */
|
|
328
|
-
declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {
|
|
329
|
-
min: (length: number | FieldReference) => ArrayRule<Value>
|
|
330
|
-
max: (length: number | FieldReference) => ArrayRule<Value>
|
|
331
|
-
length: (length: number | FieldReference) => ArrayRule<Value>
|
|
332
|
-
unique: () => ArrayRule<Value>
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/** @public */
|
|
336
|
-
declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {
|
|
337
|
-
jsonType: 'array'
|
|
338
|
-
of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[]
|
|
339
|
-
options?: ArrayOptions<V> & {
|
|
340
|
-
layout?: V extends string ? 'tag' : 'grid'
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/** @public */
|
|
345
|
-
declare interface Asset extends SanityDocument {
|
|
346
|
-
url: string
|
|
347
|
-
path: string
|
|
348
|
-
assetId: string
|
|
349
|
-
extension: string
|
|
350
|
-
mimeType: string
|
|
351
|
-
sha1hash: string
|
|
352
|
-
size: number
|
|
353
|
-
originalFilename?: string
|
|
354
|
-
label?: string
|
|
355
|
-
title?: string
|
|
356
|
-
description?: string
|
|
357
|
-
creditLine?: string
|
|
358
|
-
source?: AssetSourceSpec
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/** @public */
|
|
362
|
-
declare type AssetFromSource = {
|
|
363
|
-
kind: 'assetDocumentId' | 'file' | 'base64' | 'url'
|
|
364
|
-
value: string | File_2
|
|
365
|
-
assetDocumentProps?: ImageAsset
|
|
366
|
-
mediaLibraryProps?: {
|
|
367
|
-
mediaLibraryId: string
|
|
368
|
-
assetId: string
|
|
369
|
-
assetInstanceId: string
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/** @public */
|
|
374
|
-
declare interface AssetSource {
|
|
375
|
-
name: string
|
|
376
|
-
/** @deprecated provide `i18nKey` instead */
|
|
377
|
-
title?: string
|
|
378
|
-
i18nKey?: string
|
|
379
|
-
component: ComponentType<AssetSourceComponentProps>
|
|
380
|
-
icon?: ComponentType<EmptyProps>
|
|
381
|
-
/** @beta */
|
|
382
|
-
uploader?: AssetSourceUploader
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/** @public */
|
|
386
|
-
declare interface AssetSourceComponentProps {
|
|
387
|
-
action?: 'select' | 'upload'
|
|
388
|
-
assetSource: AssetSource
|
|
389
|
-
assetType?: 'file' | 'image'
|
|
390
|
-
accept: string
|
|
391
|
-
selectionType: 'single'
|
|
392
|
-
dialogHeaderTitle?: React.ReactNode
|
|
393
|
-
selectedAssets: Asset[]
|
|
394
|
-
onClose: () => void
|
|
395
|
-
onSelect: (assetFromSource: AssetFromSource[]) => void
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/** @public */
|
|
399
|
-
declare interface AssetSourceSpec {
|
|
400
|
-
id: string
|
|
401
|
-
name: string
|
|
402
|
-
url?: string
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/** @beta */
|
|
406
|
-
declare interface AssetSourceUploader {
|
|
407
|
-
upload(
|
|
408
|
-
files: globalThis.File[],
|
|
409
|
-
options?: {
|
|
410
|
-
/**
|
|
411
|
-
* The schema type of the field the asset is being uploaded to.
|
|
412
|
-
* May be of interest to the uploader to read file and image options.
|
|
413
|
-
*/
|
|
414
|
-
schemaType?: SchemaType
|
|
415
|
-
/**
|
|
416
|
-
* The uploader may send patches directly to the field
|
|
417
|
-
* Typed 'unknown' as we don't have patch definitions in sanity/types yet.
|
|
418
|
-
*/
|
|
419
|
-
onChange?: (patch: unknown) => void
|
|
420
|
-
},
|
|
421
|
-
): AssetSourceUploadFile[]
|
|
422
|
-
/**
|
|
423
|
-
* Abort the upload of a file
|
|
424
|
-
*/
|
|
425
|
-
abort(file?: AssetSourceUploadFile): void
|
|
426
|
-
/**
|
|
427
|
-
* Get the files that are currently being uploaded
|
|
428
|
-
*/
|
|
429
|
-
getFiles(): AssetSourceUploadFile[]
|
|
430
|
-
/**
|
|
431
|
-
* Subscribe to upload events from the uploader
|
|
432
|
-
*/
|
|
433
|
-
subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void
|
|
434
|
-
/**
|
|
435
|
-
* Update the status of a file. Will be emitted to subscribers.
|
|
436
|
-
*/
|
|
437
|
-
updateFile(
|
|
438
|
-
fileId: string,
|
|
439
|
-
data: {
|
|
440
|
-
progress?: number
|
|
441
|
-
status?: string
|
|
442
|
-
error?: Error
|
|
443
|
-
},
|
|
444
|
-
): void
|
|
445
|
-
/**
|
|
446
|
-
* Reset the uploader (clear files). Should be called by the uploader when all files are done.
|
|
447
|
-
*/
|
|
448
|
-
reset(): void
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/** @beta */
|
|
452
|
-
declare type AssetSourceUploadEvent =
|
|
453
|
-
| AssetSourceUploadEventProgress
|
|
454
|
-
| AssetSourceUploadEventStatus
|
|
455
|
-
| AssetSourceUploadEventAllComplete
|
|
456
|
-
| AssetSourceUploadEventError
|
|
457
|
-
| AssetSourceUploadEventAbort
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
461
|
-
* @beta */
|
|
462
|
-
declare type AssetSourceUploadEventAbort = {
|
|
463
|
-
type: 'abort'
|
|
464
|
-
/**
|
|
465
|
-
* Files aborted
|
|
466
|
-
*/
|
|
467
|
-
files: AssetSourceUploadFile[]
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
472
|
-
* @beta */
|
|
473
|
-
declare type AssetSourceUploadEventAllComplete = {
|
|
474
|
-
type: 'all-complete'
|
|
475
|
-
files: AssetSourceUploadFile[]
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
480
|
-
* @beta */
|
|
481
|
-
declare type AssetSourceUploadEventError = {
|
|
482
|
-
type: 'error'
|
|
483
|
-
/**
|
|
484
|
-
* Files errored
|
|
485
|
-
*/
|
|
486
|
-
files: AssetSourceUploadFile[]
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Emitted when a file upload is progressing
|
|
491
|
-
* @beta */
|
|
492
|
-
declare type AssetSourceUploadEventProgress = {
|
|
493
|
-
type: 'progress'
|
|
494
|
-
file: AssetSourceUploadFile
|
|
495
|
-
progress: number
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Emitted when a file upload is changing status
|
|
500
|
-
* @beta */
|
|
501
|
-
declare type AssetSourceUploadEventStatus = {
|
|
502
|
-
type: 'status'
|
|
503
|
-
file: AssetSourceUploadFile
|
|
504
|
-
status: AssetSourceUploadFile['status']
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/** @beta */
|
|
508
|
-
declare interface AssetSourceUploadFile {
|
|
509
|
-
id: string
|
|
510
|
-
file: globalThis.File
|
|
511
|
-
progress: number
|
|
512
|
-
status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted'
|
|
513
|
-
error?: Error
|
|
514
|
-
result?: unknown
|
|
515
|
-
}
|
|
516
|
-
|
|
517
257
|
/**
|
|
518
258
|
* @public
|
|
519
259
|
*/
|
|
@@ -522,60 +262,6 @@ export declare type BaseDefinition = {
|
|
|
522
262
|
title?: string
|
|
523
263
|
}
|
|
524
264
|
|
|
525
|
-
/** @public */
|
|
526
|
-
declare interface BaseSchemaDefinition {
|
|
527
|
-
name: string
|
|
528
|
-
title?: string
|
|
529
|
-
description?: string | React.JSX.Element
|
|
530
|
-
hidden?: ConditionalProperty
|
|
531
|
-
readOnly?: ConditionalProperty
|
|
532
|
-
icon?: ComponentType | ReactNode
|
|
533
|
-
validation?: unknown
|
|
534
|
-
initialValue?: unknown
|
|
535
|
-
deprecated?: DeprecatedProperty
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/** @public */
|
|
539
|
-
declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
|
|
540
|
-
name: string
|
|
541
|
-
title?: string
|
|
542
|
-
description?: string
|
|
543
|
-
type?: SchemaType
|
|
544
|
-
liveEdit?: boolean
|
|
545
|
-
readOnly?: ConditionalProperty
|
|
546
|
-
hidden?: ConditionalProperty
|
|
547
|
-
icon?: ComponentType
|
|
548
|
-
initialValue?: InitialValueProperty<any, any>
|
|
549
|
-
validation?: SchemaValidationValue
|
|
550
|
-
preview?: PreviewConfig
|
|
551
|
-
/** @beta */
|
|
552
|
-
components?: {
|
|
553
|
-
block?: ComponentType<any>
|
|
554
|
-
inlineBlock?: ComponentType<any>
|
|
555
|
-
annotation?: ComponentType<any>
|
|
556
|
-
diff?: ComponentType<any>
|
|
557
|
-
field?: ComponentType<any>
|
|
558
|
-
input?: ComponentType<any>
|
|
559
|
-
item?: ComponentType<any>
|
|
560
|
-
preview?: ComponentType<any>
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* @deprecated This will be removed.
|
|
564
|
-
*/
|
|
565
|
-
placeholder?: string
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* `BaseOptions` applies to all type options.
|
|
570
|
-
*
|
|
571
|
-
* It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.
|
|
572
|
-
*
|
|
573
|
-
* @public
|
|
574
|
-
* */
|
|
575
|
-
declare interface BaseSchemaTypeOptions {
|
|
576
|
-
sanityCreate?: SanityCreateOptions
|
|
577
|
-
}
|
|
578
|
-
|
|
579
265
|
/**
|
|
580
266
|
* @beta
|
|
581
267
|
*/
|
|
@@ -689,40 +375,6 @@ export declare interface BlockChildRenderProps {
|
|
|
689
375
|
value: PortableTextChild
|
|
690
376
|
}
|
|
691
377
|
|
|
692
|
-
/**
|
|
693
|
-
* Schema definition for text block decorators.
|
|
694
|
-
*
|
|
695
|
-
* @public
|
|
696
|
-
* @example The default set of decorators
|
|
697
|
-
* ```ts
|
|
698
|
-
* {
|
|
699
|
-
* name: 'blockContent',
|
|
700
|
-
* title: 'Content',
|
|
701
|
-
* type: 'array',
|
|
702
|
-
* of: [
|
|
703
|
-
* {
|
|
704
|
-
* type: 'block',
|
|
705
|
-
* marks: {
|
|
706
|
-
* decorators: [
|
|
707
|
-
* {title: 'Strong', value: 'strong'},
|
|
708
|
-
* {title: 'Emphasis', value: 'em'},
|
|
709
|
-
* {title: 'Underline', value: 'underline'},
|
|
710
|
-
* {title: 'Strike', value: 'strike'},
|
|
711
|
-
* {title: 'Code', value: 'code'},
|
|
712
|
-
* ]
|
|
713
|
-
* }
|
|
714
|
-
* }
|
|
715
|
-
* ]
|
|
716
|
-
* }
|
|
717
|
-
* ```
|
|
718
|
-
*/
|
|
719
|
-
declare interface BlockDecoratorDefinition {
|
|
720
|
-
title: string
|
|
721
|
-
i18nTitleKey?: string
|
|
722
|
-
value: string
|
|
723
|
-
icon?: ReactNode | ComponentType
|
|
724
|
-
}
|
|
725
|
-
|
|
726
378
|
/** @beta */
|
|
727
379
|
export declare interface BlockDecoratorRenderProps {
|
|
728
380
|
children: ReactElement<any>
|
|
@@ -736,99 +388,6 @@ export declare interface BlockDecoratorRenderProps {
|
|
|
736
388
|
value: string
|
|
737
389
|
}
|
|
738
390
|
|
|
739
|
-
/**
|
|
740
|
-
* Schema definition for text blocks.
|
|
741
|
-
*
|
|
742
|
-
* @public
|
|
743
|
-
* @example the default block definition
|
|
744
|
-
* ```ts
|
|
745
|
-
* {
|
|
746
|
-
* name: 'blockContent',
|
|
747
|
-
* title: 'Content',
|
|
748
|
-
* type: 'array',
|
|
749
|
-
* of: [
|
|
750
|
-
* {
|
|
751
|
-
* type: 'block',
|
|
752
|
-
* marks: {
|
|
753
|
-
* decorators: [
|
|
754
|
-
* {title: 'Strong', value: 'strong'},
|
|
755
|
-
* {title: 'Emphasis', value: 'em'},
|
|
756
|
-
* {title: 'Underline', value: 'underline'},
|
|
757
|
-
* {title: 'Strike', value: 'strike'},
|
|
758
|
-
* {title: 'Code', value: 'code'},
|
|
759
|
-
* ],
|
|
760
|
-
* annotations: [
|
|
761
|
-
* {
|
|
762
|
-
* type: 'object',
|
|
763
|
-
* name: 'link',
|
|
764
|
-
* fields: [
|
|
765
|
-
* {
|
|
766
|
-
* type: 'string',
|
|
767
|
-
* name: 'href',
|
|
768
|
-
* },
|
|
769
|
-
* ],
|
|
770
|
-
* },
|
|
771
|
-
* ]
|
|
772
|
-
* },
|
|
773
|
-
* styles: [
|
|
774
|
-
* {title: 'Normal', value: 'normal'},
|
|
775
|
-
* {title: 'H1', value: 'h1'},
|
|
776
|
-
* {title: 'H2', value: 'h2'},
|
|
777
|
-
* {title: 'H3', value: 'h3'},
|
|
778
|
-
* {title: 'H4', value: 'h4'},
|
|
779
|
-
* {title: 'H5', value: 'h5'},
|
|
780
|
-
* {title: 'H6', value: 'h6'},
|
|
781
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
782
|
-
* ],
|
|
783
|
-
* lists: [
|
|
784
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
785
|
-
* {title: 'Number', value: 'number'},
|
|
786
|
-
* ],
|
|
787
|
-
* },
|
|
788
|
-
* ]
|
|
789
|
-
* }
|
|
790
|
-
* ```
|
|
791
|
-
*/
|
|
792
|
-
declare interface BlockDefinition extends BaseSchemaDefinition {
|
|
793
|
-
type: 'block'
|
|
794
|
-
styles?: BlockStyleDefinition[]
|
|
795
|
-
lists?: BlockListDefinition[]
|
|
796
|
-
marks?: BlockMarksDefinition
|
|
797
|
-
of?: ArrayOfType<'object' | 'reference'>[]
|
|
798
|
-
initialValue?: InitialValueProperty<any, any[]>
|
|
799
|
-
options?: BlockOptions
|
|
800
|
-
validation?: ValidationBuilder<BlockRule, any[]>
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* Schema definition for a text block list style.
|
|
805
|
-
*
|
|
806
|
-
* @public
|
|
807
|
-
* @example The defaults lists
|
|
808
|
-
* ```ts
|
|
809
|
-
* {
|
|
810
|
-
* name: 'blockContent',
|
|
811
|
-
* title: 'Content',
|
|
812
|
-
* type: 'array',
|
|
813
|
-
* of: [
|
|
814
|
-
* {
|
|
815
|
-
* type: 'block',
|
|
816
|
-
* lists: [
|
|
817
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
818
|
-
* {title: 'Number', value: 'number'},
|
|
819
|
-
* ]
|
|
820
|
-
* }
|
|
821
|
-
* ]
|
|
822
|
-
* }
|
|
823
|
-
* ```
|
|
824
|
-
*/
|
|
825
|
-
declare interface BlockListDefinition {
|
|
826
|
-
title: string
|
|
827
|
-
i18nTitleKey?: string
|
|
828
|
-
value: string
|
|
829
|
-
icon?: ReactNode | ComponentType
|
|
830
|
-
}
|
|
831
|
-
|
|
832
391
|
/** @beta */
|
|
833
392
|
export declare interface BlockListItemRenderProps {
|
|
834
393
|
block: PortableTextTextBlock
|
|
@@ -842,15 +401,6 @@ export declare interface BlockListItemRenderProps {
|
|
|
842
401
|
value: string
|
|
843
402
|
}
|
|
844
403
|
|
|
845
|
-
/**
|
|
846
|
-
* Schema definition for text block marks (decorators and annotations).
|
|
847
|
-
*
|
|
848
|
-
* @public */
|
|
849
|
-
declare interface BlockMarksDefinition {
|
|
850
|
-
decorators?: BlockDecoratorDefinition[]
|
|
851
|
-
annotations?: ArrayOfType<'object' | 'reference'>[]
|
|
852
|
-
}
|
|
853
|
-
|
|
854
404
|
/**
|
|
855
405
|
* @beta
|
|
856
406
|
*/
|
|
@@ -859,17 +409,6 @@ export declare type BlockOffset = {
|
|
|
859
409
|
offset: number
|
|
860
410
|
}
|
|
861
411
|
|
|
862
|
-
/**
|
|
863
|
-
* Schema options for a Block schema definition
|
|
864
|
-
* @public */
|
|
865
|
-
declare interface BlockOptions extends BaseSchemaTypeOptions {
|
|
866
|
-
/**
|
|
867
|
-
* Turn on or off the builtin browser spellchecking. Default is on.
|
|
868
|
-
*/
|
|
869
|
-
spellCheck?: boolean
|
|
870
|
-
unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove'
|
|
871
|
-
}
|
|
872
|
-
|
|
873
412
|
/** @beta */
|
|
874
413
|
export declare interface BlockRenderProps {
|
|
875
414
|
children: ReactElement<any>
|
|
@@ -886,70 +425,6 @@ export declare interface BlockRenderProps {
|
|
|
886
425
|
value: PortableTextBlock
|
|
887
426
|
}
|
|
888
427
|
|
|
889
|
-
/** @public */
|
|
890
|
-
declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Schema definition for a text block style.
|
|
894
|
-
* A text block may have a block style like 'header', 'normal', 'lead'
|
|
895
|
-
* attached to it, which is stored on the `.style` property for that block.
|
|
896
|
-
*
|
|
897
|
-
* @public
|
|
898
|
-
* @remarks The first defined style will become the default style.´´
|
|
899
|
-
* @example The default set of styles
|
|
900
|
-
* ```ts
|
|
901
|
-
* {
|
|
902
|
-
* name: 'blockContent',
|
|
903
|
-
* title: 'Content',
|
|
904
|
-
* type: 'array',
|
|
905
|
-
* of: [
|
|
906
|
-
* {
|
|
907
|
-
* type: 'block',
|
|
908
|
-
* styles: [
|
|
909
|
-
* {title: 'Normal', value: 'normal'},
|
|
910
|
-
* {title: 'H1', value: 'h1'},
|
|
911
|
-
* {title: 'H2', value: 'h2'},
|
|
912
|
-
* {title: 'H3', value: 'h3'},
|
|
913
|
-
* {title: 'H4', value: 'h4'},
|
|
914
|
-
* {title: 'H5', value: 'h5'},
|
|
915
|
-
* {title: 'H6', value: 'h6'},
|
|
916
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
917
|
-
* ]
|
|
918
|
-
* }
|
|
919
|
-
* ]
|
|
920
|
-
* }
|
|
921
|
-
* ```
|
|
922
|
-
* @example Example of defining a block type with custom styles and render components.
|
|
923
|
-
* ```ts
|
|
924
|
-
* defineArrayMember({
|
|
925
|
-
* type: 'block',
|
|
926
|
-
* styles: [
|
|
927
|
-
* {
|
|
928
|
-
* title: 'Paragraph',
|
|
929
|
-
* value: 'paragraph',
|
|
930
|
-
* component: ParagraphStyle,
|
|
931
|
-
* },
|
|
932
|
-
* {
|
|
933
|
-
* title: 'Lead',
|
|
934
|
-
* value: 'lead',
|
|
935
|
-
* component: LeadStyle,
|
|
936
|
-
* },
|
|
937
|
-
* {
|
|
938
|
-
* title: 'Heading',
|
|
939
|
-
* value: 'heading',
|
|
940
|
-
* component: HeadingStyle,
|
|
941
|
-
* },
|
|
942
|
-
* ],
|
|
943
|
-
* })
|
|
944
|
-
* ```
|
|
945
|
-
*/
|
|
946
|
-
declare interface BlockStyleDefinition {
|
|
947
|
-
title: string
|
|
948
|
-
value: string
|
|
949
|
-
i18nTitleKey?: string
|
|
950
|
-
icon?: ReactNode | ComponentType
|
|
951
|
-
}
|
|
952
|
-
|
|
953
428
|
/** @beta */
|
|
954
429
|
export declare interface BlockStyleRenderProps {
|
|
955
430
|
block: PortableTextTextBlock
|
|
@@ -974,29 +449,6 @@ export declare type BlurChange = {
|
|
|
974
449
|
event: FocusEvent_2<HTMLDivElement, Element>
|
|
975
450
|
}
|
|
976
451
|
|
|
977
|
-
/** @public */
|
|
978
|
-
declare interface BooleanDefinition extends BaseSchemaDefinition {
|
|
979
|
-
type: 'boolean'
|
|
980
|
-
options?: BooleanOptions
|
|
981
|
-
initialValue?: InitialValueProperty<any, boolean>
|
|
982
|
-
validation?: ValidationBuilder<BooleanRule, boolean>
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
/** @public */
|
|
986
|
-
declare interface BooleanOptions extends BaseSchemaTypeOptions {
|
|
987
|
-
layout?: 'switch' | 'checkbox'
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/** @public */
|
|
991
|
-
declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}
|
|
992
|
-
|
|
993
|
-
/** @public */
|
|
994
|
-
declare interface BooleanSchemaType extends BaseSchemaType {
|
|
995
|
-
jsonType: 'boolean'
|
|
996
|
-
options?: BooleanOptions
|
|
997
|
-
initialValue?: InitialValueProperty<any, boolean>
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
452
|
declare type ClipboardBehaviorEvent =
|
|
1001
453
|
| {
|
|
1002
454
|
type: StrictExtract<NativeBehaviorEventType, 'clipboard.copy'>
|
|
@@ -1020,35 +472,6 @@ declare type ClipboardBehaviorEvent =
|
|
|
1020
472
|
position: Pick<EventPosition, 'selection'>
|
|
1021
473
|
}
|
|
1022
474
|
|
|
1023
|
-
/** @public */
|
|
1024
|
-
declare interface CollapseOptions {
|
|
1025
|
-
collapsed?: boolean
|
|
1026
|
-
collapsible?: boolean
|
|
1027
|
-
/**
|
|
1028
|
-
* @deprecated Use `collapsible` instead
|
|
1029
|
-
*/
|
|
1030
|
-
collapsable?: boolean
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
/** @public */
|
|
1034
|
-
declare type ConditionalProperty =
|
|
1035
|
-
| boolean
|
|
1036
|
-
| ConditionalPropertyCallback
|
|
1037
|
-
| undefined
|
|
1038
|
-
|
|
1039
|
-
/** @public */
|
|
1040
|
-
declare type ConditionalPropertyCallback = (
|
|
1041
|
-
context: ConditionalPropertyCallbackContext,
|
|
1042
|
-
) => boolean
|
|
1043
|
-
|
|
1044
|
-
/** @public */
|
|
1045
|
-
declare interface ConditionalPropertyCallbackContext {
|
|
1046
|
-
document: SanityDocument | undefined
|
|
1047
|
-
parent: any
|
|
1048
|
-
value: any
|
|
1049
|
-
currentUser: Omit<CurrentUser, 'role'> | null
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
475
|
/**
|
|
1053
476
|
* The editor was either connected or disconnected to the network
|
|
1054
477
|
* To show out of sync warnings etc when in collaborative mode.
|
|
@@ -1096,46 +519,6 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
|
1096
519
|
mimeType: TMIMEType
|
|
1097
520
|
}
|
|
1098
521
|
|
|
1099
|
-
/** @public */
|
|
1100
|
-
declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {
|
|
1101
|
-
type: 'crossDatasetReference'
|
|
1102
|
-
weak?: boolean
|
|
1103
|
-
to: {
|
|
1104
|
-
type: string
|
|
1105
|
-
title?: string
|
|
1106
|
-
icon?: ComponentType
|
|
1107
|
-
preview?: PreviewConfig
|
|
1108
|
-
/**
|
|
1109
|
-
* @deprecated Unused. Configuring search is no longer supported.
|
|
1110
|
-
*/
|
|
1111
|
-
__experimental_search?: {
|
|
1112
|
-
path: string | string[]
|
|
1113
|
-
weight?: number
|
|
1114
|
-
mapWith?: string
|
|
1115
|
-
}[]
|
|
1116
|
-
}[]
|
|
1117
|
-
dataset: string
|
|
1118
|
-
studioUrl?: (document: {id: string; type?: string}) => string | null
|
|
1119
|
-
tokenId?: string
|
|
1120
|
-
options?: ReferenceOptions
|
|
1121
|
-
/**
|
|
1122
|
-
* @deprecated Cross-project references are no longer supported, only cross-dataset
|
|
1123
|
-
*/
|
|
1124
|
-
projectId?: string
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
/** @public */
|
|
1128
|
-
declare interface CurrentUser {
|
|
1129
|
-
id: string
|
|
1130
|
-
name: string
|
|
1131
|
-
email: string
|
|
1132
|
-
profileImage?: string
|
|
1133
|
-
provider?: string
|
|
1134
|
-
/** @deprecated use `roles` instead */
|
|
1135
|
-
role: string
|
|
1136
|
-
roles: Role[]
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
522
|
/**
|
|
1140
523
|
* @beta
|
|
1141
524
|
*/
|
|
@@ -1160,77 +543,6 @@ declare type CustomBehaviorEventType<
|
|
|
1160
543
|
TType extends string = '',
|
|
1161
544
|
> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
|
|
1162
545
|
|
|
1163
|
-
/** @public */
|
|
1164
|
-
declare interface CustomValidator<T = unknown> {
|
|
1165
|
-
(
|
|
1166
|
-
value: T,
|
|
1167
|
-
context: ValidationContext,
|
|
1168
|
-
): CustomValidatorResult | Promise<CustomValidatorResult>
|
|
1169
|
-
bypassConcurrencyLimit?: boolean
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
/** @public */
|
|
1173
|
-
declare type CustomValidatorResult =
|
|
1174
|
-
| true
|
|
1175
|
-
| string
|
|
1176
|
-
| ValidationError
|
|
1177
|
-
| ValidationError[]
|
|
1178
|
-
| LocalizedValidationMessages
|
|
1179
|
-
|
|
1180
|
-
/** @public */
|
|
1181
|
-
declare interface DateDefinition extends BaseSchemaDefinition {
|
|
1182
|
-
type: 'date'
|
|
1183
|
-
options?: DateOptions
|
|
1184
|
-
placeholder?: string
|
|
1185
|
-
validation?: ValidationBuilder<DateRule, string>
|
|
1186
|
-
initialValue?: InitialValueProperty<any, string>
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/** @public */
|
|
1190
|
-
declare interface DateOptions extends BaseSchemaTypeOptions {
|
|
1191
|
-
dateFormat?: string
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
/** @public */
|
|
1195
|
-
declare interface DateRule extends RuleDef<DateRule, string> {
|
|
1196
|
-
/**
|
|
1197
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
1198
|
-
*/
|
|
1199
|
-
min: (minDate: string | FieldReference) => DateRule
|
|
1200
|
-
/**
|
|
1201
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
1202
|
-
*/
|
|
1203
|
-
max: (maxDate: string | FieldReference) => DateRule
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
/** @public */
|
|
1207
|
-
declare interface DatetimeDefinition extends BaseSchemaDefinition {
|
|
1208
|
-
type: 'datetime'
|
|
1209
|
-
options?: DatetimeOptions
|
|
1210
|
-
placeholder?: string
|
|
1211
|
-
validation?: ValidationBuilder<DatetimeRule, string>
|
|
1212
|
-
initialValue?: InitialValueProperty<any, string>
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
/** @public */
|
|
1216
|
-
declare interface DatetimeOptions extends BaseSchemaTypeOptions {
|
|
1217
|
-
dateFormat?: string
|
|
1218
|
-
timeFormat?: string
|
|
1219
|
-
timeStep?: number
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
/** @public */
|
|
1223
|
-
declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {
|
|
1224
|
-
/**
|
|
1225
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
1226
|
-
*/
|
|
1227
|
-
min: (minDate: string | FieldReference) => DatetimeRule
|
|
1228
|
-
/**
|
|
1229
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
1230
|
-
*/
|
|
1231
|
-
max: (maxDate: string | FieldReference) => DatetimeRule
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
546
|
/**
|
|
1235
547
|
* @public
|
|
1236
548
|
* A helper wrapper that adds editor support, such as autocomplete and type checking, for a schema definition.
|
|
@@ -1258,18 +570,6 @@ export declare function defineSchema<
|
|
|
1258
570
|
const TSchemaDefinition extends SchemaDefinition,
|
|
1259
571
|
>(definition: TSchemaDefinition): TSchemaDefinition
|
|
1260
572
|
|
|
1261
|
-
/** @public */
|
|
1262
|
-
declare interface DeprecatedProperty {
|
|
1263
|
-
reason: string
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
* @public
|
|
1268
|
-
*/
|
|
1269
|
-
declare interface DeprecationConfiguration {
|
|
1270
|
-
deprecated: DeprecatedProperty
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
573
|
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
1274
574
|
snapshot,
|
|
1275
575
|
event,
|
|
@@ -1282,40 +582,6 @@ declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
|
1282
582
|
'deserialization.success' | 'deserialization.failure'
|
|
1283
583
|
>
|
|
1284
584
|
|
|
1285
|
-
/** @public */
|
|
1286
|
-
declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
|
|
1287
|
-
type: 'document'
|
|
1288
|
-
liveEdit?: boolean
|
|
1289
|
-
/** @beta */
|
|
1290
|
-
orderings?: SortOrdering[]
|
|
1291
|
-
options?: DocumentOptions
|
|
1292
|
-
validation?: ValidationBuilder<DocumentRule, SanityDocument>
|
|
1293
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
1294
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
1295
|
-
__experimental_search?: {
|
|
1296
|
-
path: string
|
|
1297
|
-
weight: number
|
|
1298
|
-
mapWith?: string
|
|
1299
|
-
}[]
|
|
1300
|
-
/** @alpha */
|
|
1301
|
-
__experimental_omnisearch_visibility?: boolean
|
|
1302
|
-
/**
|
|
1303
|
-
* Determines whether the large preview title is displayed in the document pane form
|
|
1304
|
-
* @alpha
|
|
1305
|
-
* */
|
|
1306
|
-
__experimental_formPreviewTitle?: boolean
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
/**
|
|
1310
|
-
* This exists only to allow for extensions using declaration-merging.
|
|
1311
|
-
*
|
|
1312
|
-
* @public
|
|
1313
|
-
*/
|
|
1314
|
-
declare interface DocumentOptions extends BaseSchemaTypeOptions {}
|
|
1315
|
-
|
|
1316
|
-
/** @public */
|
|
1317
|
-
declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}
|
|
1318
|
-
|
|
1319
585
|
declare type DragBehaviorEvent =
|
|
1320
586
|
| {
|
|
1321
587
|
type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
|
|
@@ -6194,31 +5460,6 @@ export declare type EditorSnapshot = {
|
|
|
6194
5460
|
}
|
|
6195
5461
|
}
|
|
6196
5462
|
|
|
6197
|
-
/** @public */
|
|
6198
|
-
declare interface EmailDefinition extends BaseSchemaDefinition {
|
|
6199
|
-
type: 'email'
|
|
6200
|
-
options?: EmailOptions
|
|
6201
|
-
placeholder?: string
|
|
6202
|
-
validation?: ValidationBuilder<EmailRule, string>
|
|
6203
|
-
initialValue?: InitialValueProperty<any, string>
|
|
6204
|
-
}
|
|
6205
|
-
|
|
6206
|
-
/** @public */
|
|
6207
|
-
declare interface EmailOptions extends BaseSchemaTypeOptions {}
|
|
6208
|
-
|
|
6209
|
-
/** @public */
|
|
6210
|
-
declare interface EmailRule extends RuleDef<EmailRule, string> {}
|
|
6211
|
-
|
|
6212
|
-
/** @public */
|
|
6213
|
-
declare interface EmptyProps {}
|
|
6214
|
-
|
|
6215
|
-
/** @public */
|
|
6216
|
-
declare interface EnumListProps<V = unknown> {
|
|
6217
|
-
list?: Array<TitledListValue<V> | V>
|
|
6218
|
-
layout?: 'radio' | 'dropdown'
|
|
6219
|
-
direction?: 'horizontal' | 'vertical'
|
|
6220
|
-
}
|
|
6221
|
-
|
|
6222
5463
|
/**
|
|
6223
5464
|
* The editor produced an error
|
|
6224
5465
|
* @beta */
|
|
@@ -6310,142 +5551,11 @@ declare type ExternalEditorEvent =
|
|
|
6310
5551
|
declare type ExtractNamespace<TType extends string> =
|
|
6311
5552
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
6312
5553
|
|
|
6313
|
-
|
|
6314
|
-
* The shape of a field definition. Note, it's recommended to use the
|
|
6315
|
-
* `defineField` function instead of using this type directly.
|
|
6316
|
-
*
|
|
6317
|
-
* Where `defineField` infers the exact field type,
|
|
6318
|
-
* FieldDefinition is a compromise union of all types a field can have.
|
|
6319
|
-
*
|
|
6320
|
-
* A field definition can be a reference to another registered top-level type
|
|
6321
|
-
* or a inline type definition.
|
|
6322
|
-
*
|
|
6323
|
-
* @public
|
|
6324
|
-
*/
|
|
6325
|
-
declare type FieldDefinition<
|
|
6326
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
6327
|
-
TAlias extends IntrinsicTypeName | undefined = undefined,
|
|
6328
|
-
> = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) &
|
|
6329
|
-
FieldDefinitionBase
|
|
6330
|
-
|
|
6331
|
-
declare type FieldDefinition_2 = {
|
|
5554
|
+
declare type FieldDefinition = {
|
|
6332
5555
|
name: string
|
|
6333
5556
|
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
6334
5557
|
}
|
|
6335
5558
|
|
|
6336
|
-
/** @public */
|
|
6337
|
-
declare interface FieldDefinitionBase {
|
|
6338
|
-
fieldset?: string
|
|
6339
|
-
group?: string | string[]
|
|
6340
|
-
}
|
|
6341
|
-
|
|
6342
|
-
/** @public */
|
|
6343
|
-
declare interface FieldGroup {
|
|
6344
|
-
name: string
|
|
6345
|
-
icon?: ComponentType
|
|
6346
|
-
title?: string
|
|
6347
|
-
description?: string
|
|
6348
|
-
i18n?: I18nTextRecord<'title'>
|
|
6349
|
-
hidden?: ConditionalProperty
|
|
6350
|
-
default?: boolean
|
|
6351
|
-
fields?: ObjectField[]
|
|
6352
|
-
}
|
|
6353
|
-
|
|
6354
|
-
/** @public */
|
|
6355
|
-
declare type FieldGroupDefinition = {
|
|
6356
|
-
name: string
|
|
6357
|
-
title?: string
|
|
6358
|
-
hidden?: ConditionalProperty
|
|
6359
|
-
icon?: ComponentType
|
|
6360
|
-
default?: boolean
|
|
6361
|
-
i18n?: I18nTextRecord<'title'>
|
|
6362
|
-
}
|
|
6363
|
-
|
|
6364
|
-
/**
|
|
6365
|
-
* Holds a reference to a different field
|
|
6366
|
-
* NOTE: Only use this through {@link Rule.valueOfField}
|
|
6367
|
-
*
|
|
6368
|
-
* @public
|
|
6369
|
-
*/
|
|
6370
|
-
declare interface FieldReference {
|
|
6371
|
-
type: symbol
|
|
6372
|
-
path: string | string[]
|
|
6373
|
-
}
|
|
6374
|
-
|
|
6375
|
-
/** @public */
|
|
6376
|
-
declare type FieldRules = {
|
|
6377
|
-
[fieldKey: string]: SchemaValidationValue
|
|
6378
|
-
}
|
|
6379
|
-
|
|
6380
|
-
/** @public */
|
|
6381
|
-
declare type Fieldset = SingleFieldSet | MultiFieldSet
|
|
6382
|
-
|
|
6383
|
-
/** @public */
|
|
6384
|
-
declare type FieldsetDefinition = {
|
|
6385
|
-
name: string
|
|
6386
|
-
title?: string
|
|
6387
|
-
description?: string
|
|
6388
|
-
group?: string
|
|
6389
|
-
hidden?: ConditionalProperty
|
|
6390
|
-
readOnly?: ConditionalProperty
|
|
6391
|
-
options?: ObjectOptions
|
|
6392
|
-
}
|
|
6393
|
-
|
|
6394
|
-
/** @public */
|
|
6395
|
-
declare interface File_2 {
|
|
6396
|
-
[key: string]: unknown
|
|
6397
|
-
asset?: Reference
|
|
6398
|
-
}
|
|
6399
|
-
|
|
6400
|
-
/** @public */
|
|
6401
|
-
declare interface FileDefinition
|
|
6402
|
-
extends Omit<
|
|
6403
|
-
ObjectDefinition,
|
|
6404
|
-
'type' | 'fields' | 'options' | 'groups' | 'validation'
|
|
6405
|
-
> {
|
|
6406
|
-
type: 'file'
|
|
6407
|
-
fields?: ObjectDefinition['fields']
|
|
6408
|
-
options?: FileOptions
|
|
6409
|
-
validation?: ValidationBuilder<FileRule, FileValue>
|
|
6410
|
-
initialValue?: InitialValueProperty<any, FileValue>
|
|
6411
|
-
}
|
|
6412
|
-
|
|
6413
|
-
/** @public */
|
|
6414
|
-
declare interface FileOptions extends ObjectOptions {
|
|
6415
|
-
storeOriginalFilename?: boolean
|
|
6416
|
-
accept?: string
|
|
6417
|
-
sources?: AssetSource[]
|
|
6418
|
-
}
|
|
6419
|
-
|
|
6420
|
-
/** @public */
|
|
6421
|
-
declare interface FileRule extends RuleDef<FileRule, FileValue> {
|
|
6422
|
-
/**
|
|
6423
|
-
* Require a file field has an asset.
|
|
6424
|
-
*
|
|
6425
|
-
* @example
|
|
6426
|
-
* ```ts
|
|
6427
|
-
* defineField({
|
|
6428
|
-
* name: 'file',
|
|
6429
|
-
* title: 'File',
|
|
6430
|
-
* type: 'file',
|
|
6431
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
6432
|
-
* })
|
|
6433
|
-
* ```
|
|
6434
|
-
*/
|
|
6435
|
-
assetRequired(): FileRule
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
/** @public */
|
|
6439
|
-
declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {
|
|
6440
|
-
options?: FileOptions
|
|
6441
|
-
}
|
|
6442
|
-
|
|
6443
|
-
/** @public */
|
|
6444
|
-
declare interface FileValue {
|
|
6445
|
-
asset?: Reference
|
|
6446
|
-
[index: string]: unknown
|
|
6447
|
-
}
|
|
6448
|
-
|
|
6449
5559
|
/**
|
|
6450
5560
|
* The editor received focus
|
|
6451
5561
|
* @beta */
|
|
@@ -6454,63 +5564,6 @@ export declare type FocusChange = {
|
|
|
6454
5564
|
event: FocusEvent_2<HTMLDivElement, Element>
|
|
6455
5565
|
}
|
|
6456
5566
|
|
|
6457
|
-
/** @public */
|
|
6458
|
-
declare interface GeopointDefinition extends BaseSchemaDefinition {
|
|
6459
|
-
type: 'geopoint'
|
|
6460
|
-
options?: GeopointOptions
|
|
6461
|
-
validation?: ValidationBuilder<GeopointRule, GeopointValue>
|
|
6462
|
-
initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>
|
|
6463
|
-
}
|
|
6464
|
-
|
|
6465
|
-
/** @public */
|
|
6466
|
-
declare interface GeopointOptions extends BaseSchemaTypeOptions {}
|
|
6467
|
-
|
|
6468
|
-
/** @public */
|
|
6469
|
-
declare interface GeopointRule extends RuleDef<GeopointRule, GeopointValue> {}
|
|
6470
|
-
|
|
6471
|
-
/**
|
|
6472
|
-
* Geographical point representing a pair of latitude and longitude coordinates,
|
|
6473
|
-
* stored as degrees, in the World Geodetic System 1984 (WGS 84) format. Also
|
|
6474
|
-
* includes an optional `alt` property representing the altitude in meters.
|
|
6475
|
-
*
|
|
6476
|
-
* @public
|
|
6477
|
-
*/
|
|
6478
|
-
declare interface GeopointValue {
|
|
6479
|
-
/**
|
|
6480
|
-
* Type of the object. Must be `geopoint`.
|
|
6481
|
-
*/
|
|
6482
|
-
_type: 'geopoint'
|
|
6483
|
-
/**
|
|
6484
|
-
* Latitude in degrees
|
|
6485
|
-
*/
|
|
6486
|
-
lat: number
|
|
6487
|
-
/**
|
|
6488
|
-
* Longitude in degrees
|
|
6489
|
-
*/
|
|
6490
|
-
lng: number
|
|
6491
|
-
/**
|
|
6492
|
-
* Altitude in meters
|
|
6493
|
-
*/
|
|
6494
|
-
alt?: number
|
|
6495
|
-
}
|
|
6496
|
-
|
|
6497
|
-
/** @public */
|
|
6498
|
-
declare interface GlobalDocumentReferenceDefinition
|
|
6499
|
-
extends BaseSchemaDefinition {
|
|
6500
|
-
type: 'globalDocumentReference'
|
|
6501
|
-
weak?: boolean
|
|
6502
|
-
to: {
|
|
6503
|
-
type: string
|
|
6504
|
-
title?: string
|
|
6505
|
-
icon?: ComponentType
|
|
6506
|
-
preview?: PreviewConfig
|
|
6507
|
-
}[]
|
|
6508
|
-
resourceType: string
|
|
6509
|
-
resourceId: string
|
|
6510
|
-
options?: ReferenceOptions
|
|
6511
|
-
studioUrl?: (document: {id: string; type?: string}) => string | null
|
|
6512
|
-
}
|
|
6513
|
-
|
|
6514
5567
|
declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
|
|
6515
5568
|
|
|
6516
5569
|
declare interface History_2 {
|
|
@@ -6534,178 +5587,6 @@ export declare type HotkeyOptions = {
|
|
|
6534
5587
|
>
|
|
6535
5588
|
}
|
|
6536
5589
|
|
|
6537
|
-
/** @public */
|
|
6538
|
-
declare interface HotspotOptions {
|
|
6539
|
-
previews?: HotspotPreview[]
|
|
6540
|
-
}
|
|
6541
|
-
|
|
6542
|
-
/** @public */
|
|
6543
|
-
declare interface HotspotPreview {
|
|
6544
|
-
title: string
|
|
6545
|
-
aspectRatio: number
|
|
6546
|
-
}
|
|
6547
|
-
|
|
6548
|
-
/** @public */
|
|
6549
|
-
declare type I18nTextRecord<K extends string> = {
|
|
6550
|
-
[P in K]?: {
|
|
6551
|
-
key: string
|
|
6552
|
-
ns: string
|
|
6553
|
-
}
|
|
6554
|
-
}
|
|
6555
|
-
|
|
6556
|
-
/** @public */
|
|
6557
|
-
declare interface ImageAsset extends Asset {
|
|
6558
|
-
_type: 'sanity.imageAsset'
|
|
6559
|
-
metadata: ImageMetadata
|
|
6560
|
-
}
|
|
6561
|
-
|
|
6562
|
-
/** @public */
|
|
6563
|
-
declare interface ImageCrop {
|
|
6564
|
-
_type?: 'sanity.imageCrop'
|
|
6565
|
-
left: number
|
|
6566
|
-
bottom: number
|
|
6567
|
-
right: number
|
|
6568
|
-
top: number
|
|
6569
|
-
}
|
|
6570
|
-
|
|
6571
|
-
/** @public */
|
|
6572
|
-
declare interface ImageDefinition
|
|
6573
|
-
extends Omit<
|
|
6574
|
-
ObjectDefinition,
|
|
6575
|
-
'type' | 'fields' | 'options' | 'groups' | 'validation'
|
|
6576
|
-
> {
|
|
6577
|
-
type: 'image'
|
|
6578
|
-
fields?: FieldDefinition[]
|
|
6579
|
-
options?: ImageOptions
|
|
6580
|
-
validation?: ValidationBuilder<ImageRule, ImageValue>
|
|
6581
|
-
initialValue?: InitialValueProperty<any, ImageValue>
|
|
6582
|
-
}
|
|
6583
|
-
|
|
6584
|
-
/** @public */
|
|
6585
|
-
declare interface ImageDimensions {
|
|
6586
|
-
_type: 'sanity.imageDimensions'
|
|
6587
|
-
height: number
|
|
6588
|
-
width: number
|
|
6589
|
-
aspectRatio: number
|
|
6590
|
-
}
|
|
6591
|
-
|
|
6592
|
-
/** @public */
|
|
6593
|
-
declare interface ImageHotspot {
|
|
6594
|
-
_type?: 'sanity.imageHotspot'
|
|
6595
|
-
width: number
|
|
6596
|
-
height: number
|
|
6597
|
-
x: number
|
|
6598
|
-
y: number
|
|
6599
|
-
}
|
|
6600
|
-
|
|
6601
|
-
/** @public */
|
|
6602
|
-
declare interface ImageMetadata {
|
|
6603
|
-
[key: string]: unknown
|
|
6604
|
-
_type: 'sanity.imageMetadata'
|
|
6605
|
-
dimensions: ImageDimensions
|
|
6606
|
-
palette?: ImagePalette
|
|
6607
|
-
lqip?: string
|
|
6608
|
-
blurHash?: string
|
|
6609
|
-
hasAlpha: boolean
|
|
6610
|
-
isOpaque: boolean
|
|
6611
|
-
}
|
|
6612
|
-
|
|
6613
|
-
/** @public */
|
|
6614
|
-
declare type ImageMetadataType =
|
|
6615
|
-
| 'blurhash'
|
|
6616
|
-
| 'lqip'
|
|
6617
|
-
| 'palette'
|
|
6618
|
-
| 'exif'
|
|
6619
|
-
| 'image'
|
|
6620
|
-
| 'location'
|
|
6621
|
-
|
|
6622
|
-
/** @public */
|
|
6623
|
-
declare interface ImageOptions extends FileOptions {
|
|
6624
|
-
metadata?: ImageMetadataType[]
|
|
6625
|
-
hotspot?: boolean | HotspotOptions
|
|
6626
|
-
}
|
|
6627
|
-
|
|
6628
|
-
/** @public */
|
|
6629
|
-
declare interface ImagePalette {
|
|
6630
|
-
_type: 'sanity.imagePalette'
|
|
6631
|
-
darkMuted?: ImageSwatch
|
|
6632
|
-
darkVibrant?: ImageSwatch
|
|
6633
|
-
dominant?: ImageSwatch
|
|
6634
|
-
lightMuted?: ImageSwatch
|
|
6635
|
-
lightVibrant?: ImageSwatch
|
|
6636
|
-
muted?: ImageSwatch
|
|
6637
|
-
vibrant?: ImageSwatch
|
|
6638
|
-
}
|
|
6639
|
-
|
|
6640
|
-
/** @public */
|
|
6641
|
-
declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {
|
|
6642
|
-
/**
|
|
6643
|
-
* Require an image field has an asset.
|
|
6644
|
-
*
|
|
6645
|
-
* @example
|
|
6646
|
-
* ```ts
|
|
6647
|
-
* defineField({
|
|
6648
|
-
* name: 'image',
|
|
6649
|
-
* title: 'Image',
|
|
6650
|
-
* type: 'image',
|
|
6651
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
6652
|
-
* })
|
|
6653
|
-
* ```
|
|
6654
|
-
*/
|
|
6655
|
-
assetRequired(): ImageRule
|
|
6656
|
-
}
|
|
6657
|
-
|
|
6658
|
-
/** @public */
|
|
6659
|
-
declare interface ImageSwatch {
|
|
6660
|
-
_type: 'sanity.imagePaletteSwatch'
|
|
6661
|
-
background: string
|
|
6662
|
-
foreground: string
|
|
6663
|
-
population: number
|
|
6664
|
-
title?: string
|
|
6665
|
-
}
|
|
6666
|
-
|
|
6667
|
-
/** @public */
|
|
6668
|
-
declare interface ImageValue extends FileValue {
|
|
6669
|
-
crop?: ImageCrop
|
|
6670
|
-
hotspot?: ImageHotspot
|
|
6671
|
-
[index: string]: unknown
|
|
6672
|
-
}
|
|
6673
|
-
|
|
6674
|
-
/** @public */
|
|
6675
|
-
declare type IndexTuple = [number | '', number | '']
|
|
6676
|
-
|
|
6677
|
-
/** @public */
|
|
6678
|
-
declare type InitialValueProperty<Params, Value> =
|
|
6679
|
-
| Value
|
|
6680
|
-
| InitialValueResolver<Params, Value>
|
|
6681
|
-
| undefined
|
|
6682
|
-
|
|
6683
|
-
/** @public */
|
|
6684
|
-
declare type InitialValueResolver<Params, Value> = (
|
|
6685
|
-
params: Params | undefined,
|
|
6686
|
-
context: InitialValueResolverContext,
|
|
6687
|
-
) => Promise<Value> | Value
|
|
6688
|
-
|
|
6689
|
-
/** @public */
|
|
6690
|
-
declare interface InitialValueResolverContext {
|
|
6691
|
-
projectId: string
|
|
6692
|
-
dataset: string
|
|
6693
|
-
schema: Schema
|
|
6694
|
-
currentUser: CurrentUser | null
|
|
6695
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
6696
|
-
}
|
|
6697
|
-
|
|
6698
|
-
/** @public */
|
|
6699
|
-
declare type InlineFieldDefinition = {
|
|
6700
|
-
[K in keyof IntrinsicDefinitions]: Omit<
|
|
6701
|
-
IntrinsicDefinitions[K],
|
|
6702
|
-
'initialValue' | 'validation'
|
|
6703
|
-
> & {
|
|
6704
|
-
validation?: SchemaValidationValue
|
|
6705
|
-
initialValue?: InitialValueProperty<any, any>
|
|
6706
|
-
}
|
|
6707
|
-
}
|
|
6708
|
-
|
|
6709
5590
|
/**
|
|
6710
5591
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
6711
5592
|
*
|
|
@@ -6724,33 +5605,6 @@ declare type InputBehaviorEvent = {
|
|
|
6724
5605
|
}
|
|
6725
5606
|
}
|
|
6726
5607
|
|
|
6727
|
-
/** @alpha This API may change */
|
|
6728
|
-
declare interface InsertMenuOptions {
|
|
6729
|
-
/**
|
|
6730
|
-
* @defaultValue `'auto'`
|
|
6731
|
-
* `filter: 'auto'` automatically turns on filtering if there are more than 5
|
|
6732
|
-
* schema types added to the menu.
|
|
6733
|
-
*/
|
|
6734
|
-
filter?: 'auto' | boolean
|
|
6735
|
-
groups?: Array<{
|
|
6736
|
-
name: string
|
|
6737
|
-
title?: string
|
|
6738
|
-
of?: Array<string>
|
|
6739
|
-
}>
|
|
6740
|
-
/** defaultValue `true` */
|
|
6741
|
-
showIcons?: boolean
|
|
6742
|
-
/** @defaultValue `[{name: 'list'}]` */
|
|
6743
|
-
views?: Array<
|
|
6744
|
-
| {
|
|
6745
|
-
name: 'list'
|
|
6746
|
-
}
|
|
6747
|
-
| {
|
|
6748
|
-
name: 'grid'
|
|
6749
|
-
previewImageUrl?: (schemaTypeName: string) => string | undefined
|
|
6750
|
-
}
|
|
6751
|
-
>
|
|
6752
|
-
}
|
|
6753
|
-
|
|
6754
5608
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
6755
5609
|
|
|
6756
5610
|
declare type InternalEditor = Editor & {
|
|
@@ -6766,64 +5620,6 @@ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
|
|
|
6766
5620
|
value: Array<PortableTextBlock>
|
|
6767
5621
|
}
|
|
6768
5622
|
|
|
6769
|
-
/** @public */
|
|
6770
|
-
declare type IntrinsicArrayOfDefinition = {
|
|
6771
|
-
[K in keyof IntrinsicDefinitions]: Omit<
|
|
6772
|
-
ArrayOfEntry<IntrinsicDefinitions[K]>,
|
|
6773
|
-
'validation' | 'initialValue'
|
|
6774
|
-
> & {
|
|
6775
|
-
validation?: SchemaValidationValue
|
|
6776
|
-
initialValue?: InitialValueProperty<any, any>
|
|
6777
|
-
}
|
|
6778
|
-
}
|
|
6779
|
-
|
|
6780
|
-
/**
|
|
6781
|
-
* `IntrinsicDefinitions` is a lookup map for "predefined" schema definitions.
|
|
6782
|
-
* Schema types in `IntrinsicDefinitions` will have good type-completion and type-safety in {@link defineType},
|
|
6783
|
-
* {@link defineField} and {@link defineArrayMember} once the `type` property is provided.
|
|
6784
|
-
*
|
|
6785
|
-
* By default, `IntrinsicDefinitions` contains all standard Sanity schema types (`array`, `string`, `number` ect),
|
|
6786
|
-
* but it is an interface and as such, open for extension.
|
|
6787
|
-
*
|
|
6788
|
-
* This type can be extended using declaration merging; this way new entries can be added.
|
|
6789
|
-
* See {@link defineType} for examples on how this can be accomplished.
|
|
6790
|
-
*
|
|
6791
|
-
* @see defineType
|
|
6792
|
-
*
|
|
6793
|
-
* @public
|
|
6794
|
-
*/
|
|
6795
|
-
declare interface IntrinsicDefinitions {
|
|
6796
|
-
array: ArrayDefinition
|
|
6797
|
-
block: BlockDefinition
|
|
6798
|
-
boolean: BooleanDefinition
|
|
6799
|
-
date: DateDefinition
|
|
6800
|
-
datetime: DatetimeDefinition
|
|
6801
|
-
document: DocumentDefinition
|
|
6802
|
-
file: FileDefinition
|
|
6803
|
-
geopoint: GeopointDefinition
|
|
6804
|
-
image: ImageDefinition
|
|
6805
|
-
number: NumberDefinition
|
|
6806
|
-
object: ObjectDefinition
|
|
6807
|
-
reference: ReferenceDefinition
|
|
6808
|
-
crossDatasetReference: CrossDatasetReferenceDefinition
|
|
6809
|
-
globalDocumentReference: GlobalDocumentReferenceDefinition
|
|
6810
|
-
slug: SlugDefinition
|
|
6811
|
-
string: StringDefinition
|
|
6812
|
-
text: TextDefinition
|
|
6813
|
-
url: UrlDefinition
|
|
6814
|
-
email: EmailDefinition
|
|
6815
|
-
}
|
|
6816
|
-
|
|
6817
|
-
/**
|
|
6818
|
-
* A union of all intrinsic types allowed natively in the schema.
|
|
6819
|
-
*
|
|
6820
|
-
* @see IntrinsicDefinitions
|
|
6821
|
-
*
|
|
6822
|
-
* @public
|
|
6823
|
-
*/
|
|
6824
|
-
declare type IntrinsicTypeName =
|
|
6825
|
-
IntrinsicDefinitions[keyof IntrinsicDefinitions]['type']
|
|
6826
|
-
|
|
6827
5623
|
/**
|
|
6828
5624
|
* The editor has an invalid value
|
|
6829
5625
|
* @beta */
|
|
@@ -6872,11 +5668,6 @@ declare type KeyboardBehaviorEvent =
|
|
|
6872
5668
|
>
|
|
6873
5669
|
}
|
|
6874
5670
|
|
|
6875
|
-
/** @public */
|
|
6876
|
-
declare type KeyedSegment = {
|
|
6877
|
-
_key: string
|
|
6878
|
-
}
|
|
6879
|
-
|
|
6880
5671
|
/**
|
|
6881
5672
|
* @public
|
|
6882
5673
|
*/
|
|
@@ -6891,22 +5682,6 @@ export declare type LoadingChange = {
|
|
|
6891
5682
|
isLoading: boolean
|
|
6892
5683
|
}
|
|
6893
5684
|
|
|
6894
|
-
/**
|
|
6895
|
-
* Holds localized validation messages for a given field.
|
|
6896
|
-
*
|
|
6897
|
-
* @example Custom message for English (US) and Norwegian (Bokmål):
|
|
6898
|
-
* ```
|
|
6899
|
-
* {
|
|
6900
|
-
* 'en-US': 'Needs to start with a capital letter',
|
|
6901
|
-
* 'no-NB': 'Må starte med stor bokstav',
|
|
6902
|
-
* }
|
|
6903
|
-
* ```
|
|
6904
|
-
* @public
|
|
6905
|
-
*/
|
|
6906
|
-
declare interface LocalizedValidationMessages {
|
|
6907
|
-
[locale: string]: string
|
|
6908
|
-
}
|
|
6909
|
-
|
|
6910
5685
|
declare type MIMEType = `${string}/${string}`
|
|
6911
5686
|
|
|
6912
5687
|
declare type MouseBehaviorEvent = {
|
|
@@ -6914,21 +5689,6 @@ declare type MouseBehaviorEvent = {
|
|
|
6914
5689
|
position: EventPosition
|
|
6915
5690
|
}
|
|
6916
5691
|
|
|
6917
|
-
/** @public */
|
|
6918
|
-
declare interface MultiFieldSet {
|
|
6919
|
-
name: string
|
|
6920
|
-
title?: string
|
|
6921
|
-
description?: string
|
|
6922
|
-
single?: false
|
|
6923
|
-
group?: string | string[]
|
|
6924
|
-
options?: CollapseOptions & {
|
|
6925
|
-
columns?: number
|
|
6926
|
-
}
|
|
6927
|
-
fields: ObjectField[]
|
|
6928
|
-
hidden?: ConditionalProperty
|
|
6929
|
-
readOnly?: ConditionalProperty
|
|
6930
|
-
}
|
|
6931
|
-
|
|
6932
5692
|
/**
|
|
6933
5693
|
* The editor has mutated it's content.
|
|
6934
5694
|
* @beta */
|
|
@@ -7005,114 +5765,10 @@ declare const nativeBehaviorEventTypes: readonly [
|
|
|
7005
5765
|
'mouse.click',
|
|
7006
5766
|
]
|
|
7007
5767
|
|
|
7008
|
-
/** @public */
|
|
7009
|
-
declare interface NumberDefinition extends BaseSchemaDefinition {
|
|
7010
|
-
type: 'number'
|
|
7011
|
-
options?: NumberOptions
|
|
7012
|
-
placeholder?: string
|
|
7013
|
-
validation?: ValidationBuilder<NumberRule, number>
|
|
7014
|
-
initialValue?: InitialValueProperty<any, number>
|
|
7015
|
-
}
|
|
7016
|
-
|
|
7017
|
-
/** @public */
|
|
7018
|
-
declare interface NumberOptions
|
|
7019
|
-
extends EnumListProps<number>,
|
|
7020
|
-
BaseSchemaTypeOptions {}
|
|
7021
|
-
|
|
7022
|
-
/** @public */
|
|
7023
|
-
declare interface NumberRule extends RuleDef<NumberRule, number> {
|
|
7024
|
-
min: (minNumber: number | FieldReference) => NumberRule
|
|
7025
|
-
max: (maxNumber: number | FieldReference) => NumberRule
|
|
7026
|
-
lessThan: (limit: number | FieldReference) => NumberRule
|
|
7027
|
-
greaterThan: (limit: number | FieldReference) => NumberRule
|
|
7028
|
-
integer: () => NumberRule
|
|
7029
|
-
precision: (limit: number | FieldReference) => NumberRule
|
|
7030
|
-
positive: () => NumberRule
|
|
7031
|
-
negative: () => NumberRule
|
|
7032
|
-
}
|
|
7033
|
-
|
|
7034
|
-
/** @public */
|
|
7035
|
-
declare interface NumberSchemaType extends BaseSchemaType {
|
|
7036
|
-
jsonType: 'number'
|
|
7037
|
-
options?: NumberOptions
|
|
7038
|
-
initialValue?: InitialValueProperty<any, number>
|
|
7039
|
-
}
|
|
7040
|
-
|
|
7041
5768
|
declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
7042
5769
|
_key?: PortableTextObject['_key']
|
|
7043
5770
|
}
|
|
7044
5771
|
|
|
7045
|
-
/** @public */
|
|
7046
|
-
declare interface ObjectDefinition extends BaseSchemaDefinition {
|
|
7047
|
-
type: 'object'
|
|
7048
|
-
/**
|
|
7049
|
-
* Object must have at least one field. This is validated at Studio startup.
|
|
7050
|
-
*/
|
|
7051
|
-
fields: FieldDefinition[]
|
|
7052
|
-
groups?: FieldGroupDefinition[]
|
|
7053
|
-
fieldsets?: FieldsetDefinition[]
|
|
7054
|
-
preview?: PreviewConfig
|
|
7055
|
-
options?: ObjectOptions
|
|
7056
|
-
validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>
|
|
7057
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
7058
|
-
}
|
|
7059
|
-
|
|
7060
|
-
/** @public */
|
|
7061
|
-
declare interface ObjectField<T extends SchemaType = SchemaType> {
|
|
7062
|
-
name: string
|
|
7063
|
-
fieldset?: string
|
|
7064
|
-
group?: string | string[]
|
|
7065
|
-
type: ObjectFieldType<T>
|
|
7066
|
-
}
|
|
7067
|
-
|
|
7068
|
-
/** @public */
|
|
7069
|
-
declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & {
|
|
7070
|
-
hidden?: ConditionalProperty
|
|
7071
|
-
readOnly?: ConditionalProperty
|
|
7072
|
-
}
|
|
7073
|
-
|
|
7074
|
-
/** @public */
|
|
7075
|
-
declare interface ObjectOptions extends BaseSchemaTypeOptions {
|
|
7076
|
-
collapsible?: boolean
|
|
7077
|
-
collapsed?: boolean
|
|
7078
|
-
columns?: number
|
|
7079
|
-
modal?: {
|
|
7080
|
-
type?: 'dialog' | 'popover'
|
|
7081
|
-
width?: number | number[] | 'auto'
|
|
7082
|
-
}
|
|
7083
|
-
}
|
|
7084
|
-
|
|
7085
|
-
/** @public */
|
|
7086
|
-
declare interface ObjectRule
|
|
7087
|
-
extends RuleDef<ObjectRule, Record<string, unknown>> {}
|
|
7088
|
-
|
|
7089
|
-
/** @public */
|
|
7090
|
-
declare interface ObjectSchemaType extends BaseSchemaType {
|
|
7091
|
-
jsonType: 'object'
|
|
7092
|
-
fields: ObjectField[]
|
|
7093
|
-
groups?: FieldGroup[]
|
|
7094
|
-
fieldsets?: Fieldset[]
|
|
7095
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
7096
|
-
weak?: boolean
|
|
7097
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
7098
|
-
__experimental_search?: {
|
|
7099
|
-
path: (string | number)[]
|
|
7100
|
-
weight: number
|
|
7101
|
-
mapWith?: string
|
|
7102
|
-
}[]
|
|
7103
|
-
/** @alpha */
|
|
7104
|
-
__experimental_omnisearch_visibility?: boolean
|
|
7105
|
-
/** @alpha */
|
|
7106
|
-
__experimental_actions?: string[]
|
|
7107
|
-
/** @alpha */
|
|
7108
|
-
__experimental_formPreviewTitle?: boolean
|
|
7109
|
-
/**
|
|
7110
|
-
* @beta
|
|
7111
|
-
*/
|
|
7112
|
-
orderings?: SortOrdering[]
|
|
7113
|
-
options?: any
|
|
7114
|
-
}
|
|
7115
|
-
|
|
7116
5772
|
/** @beta */
|
|
7117
5773
|
export declare type OnBeforeInputFn = (event: InputEvent) => void
|
|
7118
5774
|
|
|
@@ -7182,12 +5838,6 @@ export declare type PatchObservable = Observable<{
|
|
|
7182
5838
|
snapshot: PortableTextBlock[] | undefined
|
|
7183
5839
|
}>
|
|
7184
5840
|
|
|
7185
|
-
/** @public */
|
|
7186
|
-
declare type Path = PathSegment[]
|
|
7187
|
-
|
|
7188
|
-
/** @public */
|
|
7189
|
-
declare type PathSegment = string | number | KeyedSegment | IndexTuple
|
|
7190
|
-
|
|
7191
5841
|
/**
|
|
7192
5842
|
* @internal
|
|
7193
5843
|
*/
|
|
@@ -7197,13 +5847,9 @@ declare type PickFromUnion<
|
|
|
7197
5847
|
TPickedTags extends TUnion[TTagKey],
|
|
7198
5848
|
> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never
|
|
7199
5849
|
|
|
7200
|
-
|
|
7201
|
-
export declare type PortableTextBlock =
|
|
7202
|
-
| PortableTextTextBlock
|
|
7203
|
-
| PortableTextObject
|
|
5850
|
+
export {PortableTextBlock}
|
|
7204
5851
|
|
|
7205
|
-
|
|
7206
|
-
export declare type PortableTextChild = PortableTextObject | PortableTextSpan
|
|
5852
|
+
export {PortableTextChild}
|
|
7207
5853
|
|
|
7208
5854
|
/**
|
|
7209
5855
|
* @public
|
|
@@ -7358,9 +6004,9 @@ export declare class PortableTextEditor extends Component<
|
|
|
7358
6004
|
path: Path,
|
|
7359
6005
|
) => [
|
|
7360
6006
|
(
|
|
7361
|
-
|
|
|
6007
|
+
| PortableTextTextBlock<PortableTextObject | PortableTextSpan>
|
|
7362
6008
|
| PortableTextObject
|
|
7363
|
-
|
|
|
6009
|
+
| PortableTextSpan
|
|
7364
6010
|
| undefined
|
|
7365
6011
|
),
|
|
7366
6012
|
Path | undefined,
|
|
@@ -7756,12 +6402,6 @@ export declare type PortableTextEditorProps<
|
|
|
7756
6402
|
}
|
|
7757
6403
|
>
|
|
7758
6404
|
|
|
7759
|
-
/** @alpha */
|
|
7760
|
-
declare interface PortableTextListBlock extends PortableTextTextBlock {
|
|
7761
|
-
listItem: string
|
|
7762
|
-
level: number
|
|
7763
|
-
}
|
|
7764
|
-
|
|
7765
6405
|
/** @beta */
|
|
7766
6406
|
export declare type PortableTextMemberSchemaTypes = {
|
|
7767
6407
|
annotations: (ObjectSchemaType & {
|
|
@@ -7777,13 +6417,6 @@ export declare type PortableTextMemberSchemaTypes = {
|
|
|
7777
6417
|
lists: BlockListDefinition[]
|
|
7778
6418
|
}
|
|
7779
6419
|
|
|
7780
|
-
/** @alpha */
|
|
7781
|
-
declare interface PortableTextObject {
|
|
7782
|
-
_type: string
|
|
7783
|
-
_key: string
|
|
7784
|
-
[other: string]: unknown
|
|
7785
|
-
}
|
|
7786
|
-
|
|
7787
6420
|
declare interface PortableTextSlateEditor extends ReactEditor {
|
|
7788
6421
|
_key: 'editor'
|
|
7789
6422
|
_type: 'editor'
|
|
@@ -7817,56 +6450,7 @@ declare interface PortableTextSlateEditor extends ReactEditor {
|
|
|
7817
6450
|
redo: () => void
|
|
7818
6451
|
}
|
|
7819
6452
|
|
|
7820
|
-
|
|
7821
|
-
export declare interface PortableTextSpan {
|
|
7822
|
-
_key: string
|
|
7823
|
-
_type: 'span'
|
|
7824
|
-
text: string
|
|
7825
|
-
marks?: string[]
|
|
7826
|
-
}
|
|
7827
|
-
|
|
7828
|
-
/** @alpha */
|
|
7829
|
-
declare interface PortableTextTextBlock<
|
|
7830
|
-
TChild = PortableTextSpan | PortableTextObject,
|
|
7831
|
-
> {
|
|
7832
|
-
_type: string
|
|
7833
|
-
_key: string
|
|
7834
|
-
children: TChild[]
|
|
7835
|
-
markDefs?: PortableTextObject[]
|
|
7836
|
-
listItem?: string
|
|
7837
|
-
style?: string
|
|
7838
|
-
level?: number
|
|
7839
|
-
}
|
|
7840
|
-
|
|
7841
|
-
/** @public */
|
|
7842
|
-
declare interface PrepareViewOptions {
|
|
7843
|
-
/** @beta */
|
|
7844
|
-
ordering?: SortOrdering
|
|
7845
|
-
}
|
|
7846
|
-
|
|
7847
|
-
/** @public */
|
|
7848
|
-
declare interface PreviewConfig<
|
|
7849
|
-
Select extends Record<string, string> = Record<string, string>,
|
|
7850
|
-
PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,
|
|
7851
|
-
> {
|
|
7852
|
-
select?: Select
|
|
7853
|
-
prepare?: (
|
|
7854
|
-
value: PrepareValue,
|
|
7855
|
-
viewOptions?: PrepareViewOptions,
|
|
7856
|
-
) => PreviewValue
|
|
7857
|
-
}
|
|
7858
|
-
|
|
7859
|
-
/** @public */
|
|
7860
|
-
declare interface PreviewValue {
|
|
7861
|
-
_id?: string
|
|
7862
|
-
_createdAt?: string
|
|
7863
|
-
_updatedAt?: string
|
|
7864
|
-
title?: string
|
|
7865
|
-
subtitle?: string
|
|
7866
|
-
description?: string
|
|
7867
|
-
media?: ReactNode | ElementType
|
|
7868
|
-
imageUrl?: string
|
|
7869
|
-
}
|
|
6453
|
+
export {PortableTextSpan}
|
|
7870
6454
|
|
|
7871
6455
|
/**
|
|
7872
6456
|
* A range decoration is a UI affordance that wraps a given selection range in the editor
|
|
@@ -7927,111 +6511,6 @@ export declare type RedoChange = {
|
|
|
7927
6511
|
timestamp: Date
|
|
7928
6512
|
}
|
|
7929
6513
|
|
|
7930
|
-
/** @public */
|
|
7931
|
-
declare interface Reference {
|
|
7932
|
-
_type: string
|
|
7933
|
-
_ref: string
|
|
7934
|
-
_key?: string
|
|
7935
|
-
_weak?: boolean
|
|
7936
|
-
_strengthenOnPublish?: {
|
|
7937
|
-
type: string
|
|
7938
|
-
weak?: boolean
|
|
7939
|
-
template?: {
|
|
7940
|
-
id: string
|
|
7941
|
-
params: Record<string, string | number | boolean>
|
|
7942
|
-
}
|
|
7943
|
-
}
|
|
7944
|
-
}
|
|
7945
|
-
|
|
7946
|
-
/** @public */
|
|
7947
|
-
declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
|
|
7948
|
-
disableNew?: boolean
|
|
7949
|
-
}
|
|
7950
|
-
|
|
7951
|
-
/** @public */
|
|
7952
|
-
declare interface ReferenceDefinition extends BaseSchemaDefinition {
|
|
7953
|
-
type: 'reference'
|
|
7954
|
-
to: ReferenceTo
|
|
7955
|
-
weak?: boolean
|
|
7956
|
-
options?: ReferenceOptions
|
|
7957
|
-
validation?: ValidationBuilder<ReferenceRule, ReferenceValue>
|
|
7958
|
-
initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>
|
|
7959
|
-
}
|
|
7960
|
-
|
|
7961
|
-
/** @public */
|
|
7962
|
-
declare type ReferenceFilterOptions =
|
|
7963
|
-
| ReferenceFilterResolverOptions
|
|
7964
|
-
| ReferenceFilterQueryOptions
|
|
7965
|
-
|
|
7966
|
-
/** @public */
|
|
7967
|
-
declare interface ReferenceFilterQueryOptions {
|
|
7968
|
-
filter: string
|
|
7969
|
-
filterParams?: Record<string, unknown>
|
|
7970
|
-
}
|
|
7971
|
-
|
|
7972
|
-
/** @public */
|
|
7973
|
-
declare type ReferenceFilterResolver = (
|
|
7974
|
-
context: ReferenceFilterResolverContext,
|
|
7975
|
-
) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>
|
|
7976
|
-
|
|
7977
|
-
/** @public */
|
|
7978
|
-
declare interface ReferenceFilterResolverContext {
|
|
7979
|
-
document: SanityDocument
|
|
7980
|
-
parent?: Record<string, unknown> | Record<string, unknown>[]
|
|
7981
|
-
parentPath: Path
|
|
7982
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
7983
|
-
}
|
|
7984
|
-
|
|
7985
|
-
/** @public */
|
|
7986
|
-
declare interface ReferenceFilterResolverOptions {
|
|
7987
|
-
filter?: ReferenceFilterResolver
|
|
7988
|
-
filterParams?: never
|
|
7989
|
-
}
|
|
7990
|
-
|
|
7991
|
-
/** @public */
|
|
7992
|
-
declare type ReferenceFilterSearchOptions = {
|
|
7993
|
-
filter?: string
|
|
7994
|
-
params?: Record<string, unknown>
|
|
7995
|
-
tag?: string
|
|
7996
|
-
maxFieldDepth?: number
|
|
7997
|
-
strategy?: SearchStrategy
|
|
7998
|
-
perspective?: ClientPerspective
|
|
7999
|
-
}
|
|
8000
|
-
|
|
8001
|
-
/**
|
|
8002
|
-
* Types are closed for extension. To add properties via declaration merging to this type,
|
|
8003
|
-
* redeclare and add the properties to the interfaces that make up ReferenceOptions type.
|
|
8004
|
-
*
|
|
8005
|
-
* @see ReferenceFilterOptions
|
|
8006
|
-
* @see ReferenceFilterResolverOptions
|
|
8007
|
-
* @see ReferenceBaseOptions
|
|
8008
|
-
*
|
|
8009
|
-
* @public
|
|
8010
|
-
*/
|
|
8011
|
-
declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions
|
|
8012
|
-
|
|
8013
|
-
/** @public */
|
|
8014
|
-
declare interface ReferenceRule
|
|
8015
|
-
extends RuleDef<ReferenceRule, ReferenceValue> {}
|
|
8016
|
-
|
|
8017
|
-
/** @public */
|
|
8018
|
-
declare interface ReferenceSchemaType
|
|
8019
|
-
extends Omit<ObjectSchemaType, 'options'> {
|
|
8020
|
-
jsonType: 'object'
|
|
8021
|
-
to: ObjectSchemaType[]
|
|
8022
|
-
weak?: boolean
|
|
8023
|
-
options?: ReferenceOptions
|
|
8024
|
-
}
|
|
8025
|
-
|
|
8026
|
-
/** @public */
|
|
8027
|
-
declare type ReferenceTo =
|
|
8028
|
-
| SchemaTypeDefinition
|
|
8029
|
-
| TypeReference
|
|
8030
|
-
| Array<SchemaTypeDefinition | TypeReference>
|
|
8031
|
-
|
|
8032
|
-
/** @public */
|
|
8033
|
-
declare type ReferenceValue = Reference
|
|
8034
|
-
|
|
8035
6514
|
/** @beta */
|
|
8036
6515
|
export declare type RenderAnnotationFunction = (
|
|
8037
6516
|
props: BlockAnnotationRenderProps,
|
|
@@ -8095,307 +6574,6 @@ declare type ResolveBehaviorEvent<
|
|
|
8095
6574
|
? PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>
|
|
8096
6575
|
: never
|
|
8097
6576
|
|
|
8098
|
-
/** @public */
|
|
8099
|
-
declare interface Role {
|
|
8100
|
-
name: string
|
|
8101
|
-
title: string
|
|
8102
|
-
description?: string
|
|
8103
|
-
}
|
|
8104
|
-
|
|
8105
|
-
/** @public */
|
|
8106
|
-
declare interface Rule {
|
|
8107
|
-
/**
|
|
8108
|
-
* @internal
|
|
8109
|
-
* @deprecated internal use only
|
|
8110
|
-
*/
|
|
8111
|
-
_type: RuleTypeConstraint | undefined
|
|
8112
|
-
/**
|
|
8113
|
-
* @internal
|
|
8114
|
-
* @deprecated internal use only
|
|
8115
|
-
*/
|
|
8116
|
-
_level: 'error' | 'warning' | 'info' | undefined
|
|
8117
|
-
/**
|
|
8118
|
-
* @internal
|
|
8119
|
-
* @deprecated internal use only
|
|
8120
|
-
*/
|
|
8121
|
-
_required: 'required' | 'optional' | undefined
|
|
8122
|
-
/**
|
|
8123
|
-
* @internal
|
|
8124
|
-
* @deprecated internal use only
|
|
8125
|
-
*/
|
|
8126
|
-
_typeDef: SchemaType | undefined
|
|
8127
|
-
/**
|
|
8128
|
-
* @internal
|
|
8129
|
-
* @deprecated internal use only
|
|
8130
|
-
*/
|
|
8131
|
-
_message: string | LocalizedValidationMessages | undefined
|
|
8132
|
-
/**
|
|
8133
|
-
* @internal
|
|
8134
|
-
* @deprecated internal use only
|
|
8135
|
-
*/
|
|
8136
|
-
_rules: RuleSpec[]
|
|
8137
|
-
/**
|
|
8138
|
-
* @internal
|
|
8139
|
-
* @deprecated internal use only
|
|
8140
|
-
*/
|
|
8141
|
-
_fieldRules: FieldRules | undefined
|
|
8142
|
-
/**
|
|
8143
|
-
* Takes in a path and returns an object with a symbol.
|
|
8144
|
-
*
|
|
8145
|
-
* When the validation lib sees this symbol, it will use the provided path to
|
|
8146
|
-
* get a value from the current field's parent and use that value as the input
|
|
8147
|
-
* to the Rule.
|
|
8148
|
-
*
|
|
8149
|
-
* The path that's given is forwarded to `lodash/get`
|
|
8150
|
-
*
|
|
8151
|
-
* ```js
|
|
8152
|
-
* fields: [
|
|
8153
|
-
* // ...
|
|
8154
|
-
* {
|
|
8155
|
-
* // ...
|
|
8156
|
-
* name: 'highestTemperature',
|
|
8157
|
-
* type: 'number',
|
|
8158
|
-
* validation: (Rule) => Rule.positive().min(Rule.valueOfField('lowestTemperature')),
|
|
8159
|
-
* // ...
|
|
8160
|
-
* },
|
|
8161
|
-
* ]
|
|
8162
|
-
* ```
|
|
8163
|
-
*/
|
|
8164
|
-
valueOfField: (path: string | string[]) => FieldReference
|
|
8165
|
-
error(message?: string | LocalizedValidationMessages): Rule
|
|
8166
|
-
warning(message?: string | LocalizedValidationMessages): Rule
|
|
8167
|
-
info(message?: string | LocalizedValidationMessages): Rule
|
|
8168
|
-
reset(): this
|
|
8169
|
-
isRequired(): boolean
|
|
8170
|
-
clone(): Rule
|
|
8171
|
-
cloneWithRules(rules: RuleSpec[]): Rule
|
|
8172
|
-
merge(rule: Rule): Rule
|
|
8173
|
-
type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule
|
|
8174
|
-
all(children: Rule[]): Rule
|
|
8175
|
-
either(children: Rule[]): Rule
|
|
8176
|
-
optional(): Rule
|
|
8177
|
-
required(): Rule
|
|
8178
|
-
custom<T = unknown>(
|
|
8179
|
-
fn: CustomValidator<T>,
|
|
8180
|
-
options?: {
|
|
8181
|
-
bypassConcurrencyLimit?: boolean
|
|
8182
|
-
},
|
|
8183
|
-
): Rule
|
|
8184
|
-
min(len: number | string | FieldReference): Rule
|
|
8185
|
-
max(len: number | string | FieldReference): Rule
|
|
8186
|
-
length(len: number | FieldReference): Rule
|
|
8187
|
-
valid(value: unknown | unknown[]): Rule
|
|
8188
|
-
integer(): Rule
|
|
8189
|
-
precision(limit: number | FieldReference): Rule
|
|
8190
|
-
positive(): Rule
|
|
8191
|
-
negative(): Rule
|
|
8192
|
-
greaterThan(num: number | FieldReference): Rule
|
|
8193
|
-
lessThan(num: number | FieldReference): Rule
|
|
8194
|
-
uppercase(): Rule
|
|
8195
|
-
lowercase(): Rule
|
|
8196
|
-
regex(
|
|
8197
|
-
pattern: RegExp,
|
|
8198
|
-
name: string,
|
|
8199
|
-
options: {
|
|
8200
|
-
name?: string
|
|
8201
|
-
invert?: boolean
|
|
8202
|
-
},
|
|
8203
|
-
): Rule
|
|
8204
|
-
regex(
|
|
8205
|
-
pattern: RegExp,
|
|
8206
|
-
options: {
|
|
8207
|
-
name?: string
|
|
8208
|
-
invert?: boolean
|
|
8209
|
-
},
|
|
8210
|
-
): Rule
|
|
8211
|
-
regex(pattern: RegExp, name: string): Rule
|
|
8212
|
-
regex(pattern: RegExp): Rule
|
|
8213
|
-
email(): Rule
|
|
8214
|
-
uri(options?: UriValidationOptions): Rule
|
|
8215
|
-
unique(): Rule
|
|
8216
|
-
reference(): Rule
|
|
8217
|
-
fields(rules: FieldRules): Rule
|
|
8218
|
-
assetRequired(): Rule
|
|
8219
|
-
validate(
|
|
8220
|
-
value: unknown,
|
|
8221
|
-
options: ValidationContext & {
|
|
8222
|
-
/**
|
|
8223
|
-
* @deprecated Internal use only
|
|
8224
|
-
* @internal
|
|
8225
|
-
*/
|
|
8226
|
-
__internal?: {
|
|
8227
|
-
customValidationConcurrencyLimiter?: {
|
|
8228
|
-
ready: () => Promise<void>
|
|
8229
|
-
release: () => void
|
|
8230
|
-
}
|
|
8231
|
-
}
|
|
8232
|
-
},
|
|
8233
|
-
): Promise<ValidationMarker[]>
|
|
8234
|
-
}
|
|
8235
|
-
|
|
8236
|
-
/** @public */
|
|
8237
|
-
declare type RuleBuilder<
|
|
8238
|
-
T extends RuleDef<T, FieldValue>,
|
|
8239
|
-
FieldValue = unknown,
|
|
8240
|
-
> = T | T[]
|
|
8241
|
-
|
|
8242
|
-
/** @public */
|
|
8243
|
-
declare interface RuleDef<T, FieldValue = unknown> {
|
|
8244
|
-
required: () => T
|
|
8245
|
-
custom: <LenientFieldValue extends FieldValue>(
|
|
8246
|
-
fn: CustomValidator<LenientFieldValue | undefined>,
|
|
8247
|
-
) => T
|
|
8248
|
-
info: (message?: string | LocalizedValidationMessages) => T
|
|
8249
|
-
error: (message?: string | LocalizedValidationMessages) => T
|
|
8250
|
-
warning: (message?: string | LocalizedValidationMessages) => T
|
|
8251
|
-
valueOfField: (path: string | string[]) => FieldReference
|
|
8252
|
-
}
|
|
8253
|
-
|
|
8254
|
-
/** @public */
|
|
8255
|
-
declare type RuleSpec =
|
|
8256
|
-
| {
|
|
8257
|
-
flag: 'integer'
|
|
8258
|
-
}
|
|
8259
|
-
| {
|
|
8260
|
-
flag: 'email'
|
|
8261
|
-
}
|
|
8262
|
-
| {
|
|
8263
|
-
flag: 'unique'
|
|
8264
|
-
}
|
|
8265
|
-
| {
|
|
8266
|
-
flag: 'reference'
|
|
8267
|
-
}
|
|
8268
|
-
| {
|
|
8269
|
-
flag: 'type'
|
|
8270
|
-
constraint: RuleTypeConstraint
|
|
8271
|
-
}
|
|
8272
|
-
| {
|
|
8273
|
-
flag: 'all'
|
|
8274
|
-
constraint: Rule[]
|
|
8275
|
-
}
|
|
8276
|
-
| {
|
|
8277
|
-
flag: 'either'
|
|
8278
|
-
constraint: Rule[]
|
|
8279
|
-
}
|
|
8280
|
-
| {
|
|
8281
|
-
flag: 'presence'
|
|
8282
|
-
constraint: 'optional' | 'required'
|
|
8283
|
-
}
|
|
8284
|
-
| {
|
|
8285
|
-
flag: 'custom'
|
|
8286
|
-
constraint: CustomValidator
|
|
8287
|
-
}
|
|
8288
|
-
| {
|
|
8289
|
-
flag: 'min'
|
|
8290
|
-
constraint: number | string
|
|
8291
|
-
}
|
|
8292
|
-
| {
|
|
8293
|
-
flag: 'max'
|
|
8294
|
-
constraint: number | string
|
|
8295
|
-
}
|
|
8296
|
-
| {
|
|
8297
|
-
flag: 'length'
|
|
8298
|
-
constraint: number
|
|
8299
|
-
}
|
|
8300
|
-
| {
|
|
8301
|
-
flag: 'valid'
|
|
8302
|
-
constraint: unknown[]
|
|
8303
|
-
}
|
|
8304
|
-
| {
|
|
8305
|
-
flag: 'precision'
|
|
8306
|
-
constraint: number
|
|
8307
|
-
}
|
|
8308
|
-
| {
|
|
8309
|
-
flag: 'lessThan'
|
|
8310
|
-
constraint: number
|
|
8311
|
-
}
|
|
8312
|
-
| {
|
|
8313
|
-
flag: 'greaterThan'
|
|
8314
|
-
constraint: number
|
|
8315
|
-
}
|
|
8316
|
-
| {
|
|
8317
|
-
flag: 'stringCasing'
|
|
8318
|
-
constraint: 'uppercase' | 'lowercase'
|
|
8319
|
-
}
|
|
8320
|
-
| {
|
|
8321
|
-
flag: 'assetRequired'
|
|
8322
|
-
constraint: {
|
|
8323
|
-
assetType: 'asset' | 'image' | 'file'
|
|
8324
|
-
}
|
|
8325
|
-
}
|
|
8326
|
-
| {
|
|
8327
|
-
flag: 'regex'
|
|
8328
|
-
constraint: {
|
|
8329
|
-
pattern: RegExp
|
|
8330
|
-
name?: string
|
|
8331
|
-
invert: boolean
|
|
8332
|
-
}
|
|
8333
|
-
}
|
|
8334
|
-
| {
|
|
8335
|
-
flag: 'uri'
|
|
8336
|
-
constraint: {
|
|
8337
|
-
options: {
|
|
8338
|
-
scheme: RegExp[]
|
|
8339
|
-
allowRelative: boolean
|
|
8340
|
-
relativeOnly: boolean
|
|
8341
|
-
allowCredentials: boolean
|
|
8342
|
-
}
|
|
8343
|
-
}
|
|
8344
|
-
}
|
|
8345
|
-
|
|
8346
|
-
/** @public */
|
|
8347
|
-
declare type RuleTypeConstraint =
|
|
8348
|
-
| 'Array'
|
|
8349
|
-
| 'Boolean'
|
|
8350
|
-
| 'Date'
|
|
8351
|
-
| 'Number'
|
|
8352
|
-
| 'Object'
|
|
8353
|
-
| 'String'
|
|
8354
|
-
|
|
8355
|
-
/**
|
|
8356
|
-
* Options for configuring how Sanity Create interfaces with the type or field.
|
|
8357
|
-
*
|
|
8358
|
-
* @public
|
|
8359
|
-
*/
|
|
8360
|
-
declare interface SanityCreateOptions {
|
|
8361
|
-
/** Set to true to exclude a type or field from appearing in Sanity Create */
|
|
8362
|
-
exclude?: boolean
|
|
8363
|
-
/**
|
|
8364
|
-
* A short description of what the type or field is used for.
|
|
8365
|
-
* Purpose can be used to improve how and when content mapping uses the field.
|
|
8366
|
-
* */
|
|
8367
|
-
purpose?: string
|
|
8368
|
-
}
|
|
8369
|
-
|
|
8370
|
-
/** @public */
|
|
8371
|
-
declare interface SanityDocument {
|
|
8372
|
-
_id: string
|
|
8373
|
-
_type: string
|
|
8374
|
-
_createdAt: string
|
|
8375
|
-
_updatedAt: string
|
|
8376
|
-
_rev: string
|
|
8377
|
-
[key: string]: unknown
|
|
8378
|
-
}
|
|
8379
|
-
|
|
8380
|
-
/** @public */
|
|
8381
|
-
declare interface Schema {
|
|
8382
|
-
/** @internal */
|
|
8383
|
-
_original?: {
|
|
8384
|
-
name: string
|
|
8385
|
-
types: SchemaTypeDefinition[]
|
|
8386
|
-
}
|
|
8387
|
-
/** @internal */
|
|
8388
|
-
_registry: {
|
|
8389
|
-
[typeName: string]: any
|
|
8390
|
-
}
|
|
8391
|
-
/** @internal */
|
|
8392
|
-
_validation?: SchemaValidationProblemGroup[]
|
|
8393
|
-
name: string
|
|
8394
|
-
get: (name: string) => SchemaType | undefined
|
|
8395
|
-
has: (name: string) => boolean
|
|
8396
|
-
getTypeNames: () => string[]
|
|
8397
|
-
}
|
|
8398
|
-
|
|
8399
6577
|
/**
|
|
8400
6578
|
* @public
|
|
8401
6579
|
*/
|
|
@@ -8405,159 +6583,29 @@ export declare type SchemaDefinition<
|
|
|
8405
6583
|
decorators?: ReadonlyArray<TBaseDefinition>
|
|
8406
6584
|
blockObjects?: ReadonlyArray<
|
|
8407
6585
|
TBaseDefinition & {
|
|
8408
|
-
fields?: ReadonlyArray<
|
|
6586
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
8409
6587
|
}
|
|
8410
6588
|
>
|
|
8411
6589
|
inlineObjects?: ReadonlyArray<
|
|
8412
6590
|
TBaseDefinition & {
|
|
8413
|
-
fields?: ReadonlyArray<
|
|
6591
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
8414
6592
|
}
|
|
8415
6593
|
>
|
|
8416
6594
|
annotations?: ReadonlyArray<
|
|
8417
6595
|
TBaseDefinition & {
|
|
8418
|
-
fields?: ReadonlyArray<
|
|
6596
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
8419
6597
|
}
|
|
8420
6598
|
>
|
|
8421
6599
|
lists?: ReadonlyArray<TBaseDefinition>
|
|
8422
6600
|
styles?: ReadonlyArray<TBaseDefinition>
|
|
8423
6601
|
}
|
|
8424
6602
|
|
|
8425
|
-
/**
|
|
8426
|
-
* Note: you probably want `SchemaTypeDefinition` instead
|
|
8427
|
-
* @see SchemaTypeDefinition
|
|
8428
|
-
*
|
|
8429
|
-
* @public
|
|
8430
|
-
*/
|
|
8431
|
-
declare type SchemaType =
|
|
8432
|
-
| ArraySchemaType
|
|
8433
|
-
| BooleanSchemaType
|
|
8434
|
-
| FileSchemaType
|
|
8435
|
-
| NumberSchemaType
|
|
8436
|
-
| ObjectSchemaType
|
|
8437
|
-
| StringSchemaType
|
|
8438
|
-
| ReferenceSchemaType
|
|
8439
|
-
|
|
8440
|
-
/**
|
|
8441
|
-
* Represents a Sanity schema type definition with an optional type parameter.
|
|
8442
|
-
*
|
|
8443
|
-
* It's recommend to use the `defineType` helper instead of this type by
|
|
8444
|
-
* itself.
|
|
8445
|
-
*
|
|
8446
|
-
* @see defineType
|
|
8447
|
-
*
|
|
8448
|
-
* @public
|
|
8449
|
-
*/
|
|
8450
|
-
declare type SchemaTypeDefinition<
|
|
8451
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
8452
|
-
> = IntrinsicDefinitions[IntrinsicTypeName] | TypeAliasDefinition<string, TType>
|
|
8453
|
-
|
|
8454
|
-
/** @public */
|
|
8455
|
-
declare interface SchemaValidationError {
|
|
8456
|
-
helpId?: string
|
|
8457
|
-
message: string
|
|
8458
|
-
severity: 'error'
|
|
8459
|
-
}
|
|
8460
|
-
|
|
8461
|
-
/** @internal */
|
|
8462
|
-
declare type SchemaValidationProblem =
|
|
8463
|
-
| SchemaValidationError
|
|
8464
|
-
| SchemaValidationWarning
|
|
8465
|
-
|
|
8466
|
-
/** @internal */
|
|
8467
|
-
declare interface SchemaValidationProblemGroup {
|
|
8468
|
-
path: SchemaValidationProblemPath
|
|
8469
|
-
problems: SchemaValidationProblem[]
|
|
8470
|
-
}
|
|
8471
|
-
|
|
8472
|
-
/** @internal */
|
|
8473
|
-
declare type SchemaValidationProblemPath = Array<
|
|
8474
|
-
| {
|
|
8475
|
-
kind: 'type'
|
|
8476
|
-
type: string
|
|
8477
|
-
name?: string
|
|
8478
|
-
}
|
|
8479
|
-
| {
|
|
8480
|
-
kind: 'property'
|
|
8481
|
-
name: string
|
|
8482
|
-
}
|
|
8483
|
-
>
|
|
8484
|
-
|
|
8485
|
-
/**
|
|
8486
|
-
* Represents the possible values of a schema type's `validation` field.
|
|
8487
|
-
*
|
|
8488
|
-
* If the schema has not been run through `inferFromSchema` from
|
|
8489
|
-
* `sanity/validation` then value could be a function.
|
|
8490
|
-
*
|
|
8491
|
-
* `inferFromSchema` mutates the schema converts this value to an array of
|
|
8492
|
-
* `Rule` instances.
|
|
8493
|
-
*
|
|
8494
|
-
* @privateRemarks
|
|
8495
|
-
*
|
|
8496
|
-
* Usage of the schema inside the studio will almost always be from the compiled
|
|
8497
|
-
* `createSchema` function. In this case, you can cast the value or throw to
|
|
8498
|
-
* narrow the type. E.g.:
|
|
8499
|
-
*
|
|
8500
|
-
* ```ts
|
|
8501
|
-
* if (typeof type.validation === 'function') {
|
|
8502
|
-
* throw new Error(
|
|
8503
|
-
* `Schema type "${type.name}"'s \`validation\` was not run though \`inferFromSchema\``
|
|
8504
|
-
* )
|
|
8505
|
-
* }
|
|
8506
|
-
* ```
|
|
8507
|
-
*
|
|
8508
|
-
* @public
|
|
8509
|
-
*/
|
|
8510
|
-
declare type SchemaValidationValue =
|
|
8511
|
-
| false
|
|
8512
|
-
| undefined
|
|
8513
|
-
| Rule
|
|
8514
|
-
| SchemaValidationValue[]
|
|
8515
|
-
| ((rule: Rule) => SchemaValidationValue)
|
|
8516
|
-
|
|
8517
|
-
/** @internal */
|
|
8518
|
-
declare interface SchemaValidationWarning {
|
|
8519
|
-
helpId?: string
|
|
8520
|
-
message: string
|
|
8521
|
-
severity: 'warning'
|
|
8522
|
-
}
|
|
8523
|
-
|
|
8524
6603
|
/** @beta */
|
|
8525
6604
|
export declare type ScrollSelectionIntoViewFunction = (
|
|
8526
6605
|
editor: PortableTextEditor,
|
|
8527
6606
|
domRange: globalThis.Range,
|
|
8528
6607
|
) => void
|
|
8529
6608
|
|
|
8530
|
-
/** @public */
|
|
8531
|
-
declare interface SearchConfiguration {
|
|
8532
|
-
search?: {
|
|
8533
|
-
/**
|
|
8534
|
-
* Defines a search weight for this field to prioritize its importance
|
|
8535
|
-
* during search operations in the Studio. This setting allows the specified
|
|
8536
|
-
* field to be ranked higher in search results compared to other fields.
|
|
8537
|
-
*
|
|
8538
|
-
* By default, all fields are assigned a weight of 1. However, if a field is
|
|
8539
|
-
* chosen as the `title` in the preview configuration's `select` option, it
|
|
8540
|
-
* will automatically receive a default weight of 10. Similarly, if selected
|
|
8541
|
-
* as the `subtitle`, the default weight is 5. Fields marked as
|
|
8542
|
-
* `hidden: true` (no function) are assigned a weight of 0 by default.
|
|
8543
|
-
*
|
|
8544
|
-
* Note: Search weight configuration is currently supported only for fields
|
|
8545
|
-
* of type string or portable text arrays.
|
|
8546
|
-
*/
|
|
8547
|
-
weight?: number
|
|
8548
|
-
}
|
|
8549
|
-
}
|
|
8550
|
-
|
|
8551
|
-
/**
|
|
8552
|
-
* @public
|
|
8553
|
-
*/
|
|
8554
|
-
declare const searchStrategies: readonly ['groqLegacy', 'groq2024']
|
|
8555
|
-
|
|
8556
|
-
/**
|
|
8557
|
-
* @public
|
|
8558
|
-
*/
|
|
8559
|
-
declare type SearchStrategy = (typeof searchStrategies)[number]
|
|
8560
|
-
|
|
8561
6609
|
/**
|
|
8562
6610
|
* The editor has a new selection
|
|
8563
6611
|
* @beta */
|
|
@@ -8578,164 +6626,13 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
8578
6626
|
'serialization.success' | 'serialization.failure'
|
|
8579
6627
|
>
|
|
8580
6628
|
|
|
8581
|
-
/** @public */
|
|
8582
|
-
declare interface SingleFieldSet {
|
|
8583
|
-
single: true
|
|
8584
|
-
field: ObjectField
|
|
8585
|
-
hidden?: ConditionalProperty
|
|
8586
|
-
readOnly?: ConditionalProperty
|
|
8587
|
-
group?: string | string[]
|
|
8588
|
-
}
|
|
8589
|
-
|
|
8590
6629
|
declare type SlateEditor = {
|
|
8591
6630
|
instance: PortableTextSlateEditor
|
|
8592
6631
|
initialValue: Array<Descendant>
|
|
8593
6632
|
}
|
|
8594
6633
|
|
|
8595
|
-
/** @public */
|
|
8596
|
-
declare interface SlugDefinition extends BaseSchemaDefinition {
|
|
8597
|
-
type: 'slug'
|
|
8598
|
-
options?: SlugOptions
|
|
8599
|
-
validation?: ValidationBuilder<SlugRule, SlugValue>
|
|
8600
|
-
initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>
|
|
8601
|
-
}
|
|
8602
|
-
|
|
8603
|
-
/** @public */
|
|
8604
|
-
declare type SlugifierFn = (
|
|
8605
|
-
source: string,
|
|
8606
|
-
schemaType: SlugSchemaType,
|
|
8607
|
-
context: SlugSourceContext,
|
|
8608
|
-
) => string | Promise<string>
|
|
8609
|
-
|
|
8610
|
-
/** @public */
|
|
8611
|
-
declare type SlugIsUniqueValidator = (
|
|
8612
|
-
slug: string,
|
|
8613
|
-
context: SlugValidationContext,
|
|
8614
|
-
) => boolean | Promise<boolean>
|
|
8615
|
-
|
|
8616
|
-
/** @public */
|
|
8617
|
-
declare interface SlugOptions
|
|
8618
|
-
extends SearchConfiguration,
|
|
8619
|
-
BaseSchemaTypeOptions {
|
|
8620
|
-
source?: string | Path | SlugSourceFn
|
|
8621
|
-
maxLength?: number
|
|
8622
|
-
slugify?: SlugifierFn
|
|
8623
|
-
isUnique?: SlugIsUniqueValidator
|
|
8624
|
-
disableArrayWarning?: boolean
|
|
8625
|
-
}
|
|
8626
|
-
|
|
8627
|
-
/** @public */
|
|
8628
|
-
declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]
|
|
8629
|
-
|
|
8630
|
-
/** @public */
|
|
8631
|
-
declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
|
|
8632
|
-
|
|
8633
|
-
/** @public */
|
|
8634
|
-
declare interface SlugSchemaType extends ObjectSchemaType {
|
|
8635
|
-
jsonType: 'object'
|
|
8636
|
-
options?: SlugOptions
|
|
8637
|
-
}
|
|
8638
|
-
|
|
8639
|
-
/** @public */
|
|
8640
|
-
declare interface SlugSourceContext {
|
|
8641
|
-
parentPath: Path
|
|
8642
|
-
parent: SlugParent
|
|
8643
|
-
projectId: string
|
|
8644
|
-
dataset: string
|
|
8645
|
-
schema: Schema
|
|
8646
|
-
currentUser: CurrentUser | null
|
|
8647
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
8648
|
-
}
|
|
8649
|
-
|
|
8650
|
-
/** @public */
|
|
8651
|
-
declare type SlugSourceFn = (
|
|
8652
|
-
document: SanityDocument,
|
|
8653
|
-
context: SlugSourceContext,
|
|
8654
|
-
) => string | Promise<string>
|
|
8655
|
-
|
|
8656
|
-
/** @public */
|
|
8657
|
-
declare interface SlugValidationContext extends ValidationContext {
|
|
8658
|
-
parent: SlugParent
|
|
8659
|
-
type: SlugSchemaType
|
|
8660
|
-
defaultIsUnique: SlugIsUniqueValidator
|
|
8661
|
-
}
|
|
8662
|
-
|
|
8663
|
-
/** @public */
|
|
8664
|
-
declare interface SlugValue {
|
|
8665
|
-
_type: 'slug'
|
|
8666
|
-
current?: string
|
|
8667
|
-
}
|
|
8668
|
-
|
|
8669
|
-
/** @beta */
|
|
8670
|
-
declare type SortOrdering = {
|
|
8671
|
-
title: string
|
|
8672
|
-
i18n?: I18nTextRecord<'title'>
|
|
8673
|
-
name: string
|
|
8674
|
-
by: SortOrderingItem[]
|
|
8675
|
-
}
|
|
8676
|
-
|
|
8677
|
-
/** @beta */
|
|
8678
|
-
declare interface SortOrderingItem {
|
|
8679
|
-
field: string
|
|
8680
|
-
direction: 'asc' | 'desc'
|
|
8681
|
-
}
|
|
8682
|
-
|
|
8683
6634
|
declare type StrictExtract<T, U extends T> = U
|
|
8684
6635
|
|
|
8685
|
-
/** @public */
|
|
8686
|
-
declare interface StringDefinition extends BaseSchemaDefinition {
|
|
8687
|
-
type: 'string'
|
|
8688
|
-
options?: StringOptions
|
|
8689
|
-
placeholder?: string
|
|
8690
|
-
validation?: ValidationBuilder<StringRule, string>
|
|
8691
|
-
initialValue?: InitialValueProperty<any, string>
|
|
8692
|
-
}
|
|
8693
|
-
|
|
8694
|
-
/** @public */
|
|
8695
|
-
declare interface StringOptions
|
|
8696
|
-
extends EnumListProps<string>,
|
|
8697
|
-
SearchConfiguration,
|
|
8698
|
-
BaseSchemaTypeOptions {}
|
|
8699
|
-
|
|
8700
|
-
/** @public */
|
|
8701
|
-
declare interface StringRule extends RuleDef<StringRule, string> {
|
|
8702
|
-
min: (minNumber: number | FieldReference) => StringRule
|
|
8703
|
-
max: (maxNumber: number | FieldReference) => StringRule
|
|
8704
|
-
length: (exactLength: number | FieldReference) => StringRule
|
|
8705
|
-
uppercase: () => StringRule
|
|
8706
|
-
lowercase: () => StringRule
|
|
8707
|
-
regex(
|
|
8708
|
-
pattern: RegExp,
|
|
8709
|
-
name: string,
|
|
8710
|
-
options: {
|
|
8711
|
-
name?: string
|
|
8712
|
-
invert?: boolean
|
|
8713
|
-
},
|
|
8714
|
-
): StringRule
|
|
8715
|
-
regex(
|
|
8716
|
-
pattern: RegExp,
|
|
8717
|
-
options: {
|
|
8718
|
-
name?: string
|
|
8719
|
-
invert?: boolean
|
|
8720
|
-
},
|
|
8721
|
-
): StringRule
|
|
8722
|
-
regex(pattern: RegExp, name: string): StringRule
|
|
8723
|
-
regex(pattern: RegExp): StringRule
|
|
8724
|
-
email(): StringRule
|
|
8725
|
-
}
|
|
8726
|
-
|
|
8727
|
-
/**
|
|
8728
|
-
* This is used for string, text, date and datetime.
|
|
8729
|
-
* This interface represent the compiled version at runtime, when accessed through Schema.
|
|
8730
|
-
*
|
|
8731
|
-
* @public
|
|
8732
|
-
*/
|
|
8733
|
-
declare interface StringSchemaType extends BaseSchemaType {
|
|
8734
|
-
jsonType: 'string'
|
|
8735
|
-
options?: StringOptions & TextOptions & DateOptions & DatetimeOptions
|
|
8736
|
-
initialValue?: InitialValueProperty<any, string>
|
|
8737
|
-
}
|
|
8738
|
-
|
|
8739
6636
|
/**
|
|
8740
6637
|
* @beta
|
|
8741
6638
|
*/
|
|
@@ -8885,80 +6782,6 @@ declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
|
|
|
8885
6782
|
_key?: PortableTextTextBlock['_key']
|
|
8886
6783
|
}
|
|
8887
6784
|
|
|
8888
|
-
/** @public */
|
|
8889
|
-
declare interface TextDefinition extends BaseSchemaDefinition {
|
|
8890
|
-
type: 'text'
|
|
8891
|
-
rows?: number
|
|
8892
|
-
options?: TextOptions
|
|
8893
|
-
placeholder?: string
|
|
8894
|
-
validation?: ValidationBuilder<TextRule, string>
|
|
8895
|
-
initialValue?: InitialValueProperty<any, string>
|
|
8896
|
-
}
|
|
8897
|
-
|
|
8898
|
-
/** @public */
|
|
8899
|
-
declare interface TextOptions extends StringOptions {}
|
|
8900
|
-
|
|
8901
|
-
/** @public */
|
|
8902
|
-
declare interface TextRule extends StringRule {}
|
|
8903
|
-
|
|
8904
|
-
/** @public */
|
|
8905
|
-
declare interface TitledListValue<V = unknown> {
|
|
8906
|
-
_key?: string
|
|
8907
|
-
title: string
|
|
8908
|
-
value?: V
|
|
8909
|
-
}
|
|
8910
|
-
|
|
8911
|
-
/**
|
|
8912
|
-
* Represents a type definition that is an alias/extension of an existing type
|
|
8913
|
-
* in your schema. Creating a type alias will re-register that existing type
|
|
8914
|
-
* under a different name. You can also override the default type options with
|
|
8915
|
-
* a type alias definition.
|
|
8916
|
-
*
|
|
8917
|
-
* @public
|
|
8918
|
-
*/
|
|
8919
|
-
declare interface TypeAliasDefinition<
|
|
8920
|
-
TType extends string,
|
|
8921
|
-
TAlias extends IntrinsicTypeName | undefined,
|
|
8922
|
-
> extends BaseSchemaDefinition {
|
|
8923
|
-
type: TType
|
|
8924
|
-
options?: TAlias extends IntrinsicTypeName
|
|
8925
|
-
? IntrinsicDefinitions[TAlias]['options']
|
|
8926
|
-
: unknown
|
|
8927
|
-
validation?: SchemaValidationValue
|
|
8928
|
-
initialValue?: InitialValueProperty<any, any>
|
|
8929
|
-
preview?: PreviewConfig
|
|
8930
|
-
components?: {
|
|
8931
|
-
annotation?: ComponentType<any>
|
|
8932
|
-
block?: ComponentType<any>
|
|
8933
|
-
inlineBlock?: ComponentType<any>
|
|
8934
|
-
diff?: ComponentType<any>
|
|
8935
|
-
field?: ComponentType<any>
|
|
8936
|
-
input?: ComponentType<any>
|
|
8937
|
-
item?: ComponentType<any>
|
|
8938
|
-
preview?: ComponentType<any>
|
|
8939
|
-
}
|
|
8940
|
-
}
|
|
8941
|
-
|
|
8942
|
-
/** @public */
|
|
8943
|
-
declare interface TypedObject {
|
|
8944
|
-
[key: string]: unknown
|
|
8945
|
-
_type: string
|
|
8946
|
-
}
|
|
8947
|
-
|
|
8948
|
-
/**
|
|
8949
|
-
* Represents a reference to another type registered top-level in your schema.
|
|
8950
|
-
*
|
|
8951
|
-
* @public
|
|
8952
|
-
*/
|
|
8953
|
-
declare interface TypeReference {
|
|
8954
|
-
type: string
|
|
8955
|
-
name?: string
|
|
8956
|
-
icon?: ComponentType | ReactNode
|
|
8957
|
-
options?: {
|
|
8958
|
-
[key: string]: unknown
|
|
8959
|
-
}
|
|
8960
|
-
}
|
|
8961
|
-
|
|
8962
6785
|
/**
|
|
8963
6786
|
* The editor performed a undo history step
|
|
8964
6787
|
* @beta */
|
|
@@ -8979,31 +6802,6 @@ declare type UnsetEvent = {
|
|
|
8979
6802
|
previousValue: Array<PortableTextBlock>
|
|
8980
6803
|
}
|
|
8981
6804
|
|
|
8982
|
-
/** @public */
|
|
8983
|
-
declare interface UriValidationOptions {
|
|
8984
|
-
scheme?: (string | RegExp) | Array<string | RegExp>
|
|
8985
|
-
allowRelative?: boolean
|
|
8986
|
-
relativeOnly?: boolean
|
|
8987
|
-
allowCredentials?: boolean
|
|
8988
|
-
}
|
|
8989
|
-
|
|
8990
|
-
/** @public */
|
|
8991
|
-
declare interface UrlDefinition extends BaseSchemaDefinition {
|
|
8992
|
-
type: 'url'
|
|
8993
|
-
options?: UrlOptions
|
|
8994
|
-
placeholder?: string
|
|
8995
|
-
validation?: ValidationBuilder<UrlRule, string>
|
|
8996
|
-
initialValue?: InitialValueProperty<any, string>
|
|
8997
|
-
}
|
|
8998
|
-
|
|
8999
|
-
/** @public */
|
|
9000
|
-
declare interface UrlOptions extends BaseSchemaTypeOptions {}
|
|
9001
|
-
|
|
9002
|
-
/** @public */
|
|
9003
|
-
declare interface UrlRule extends RuleDef<UrlRule, string> {
|
|
9004
|
-
uri(options: UriValidationOptions): UrlRule
|
|
9005
|
-
}
|
|
9006
|
-
|
|
9007
6805
|
/**
|
|
9008
6806
|
* @public
|
|
9009
6807
|
* Get the current editor context from the `EditorProvider`.
|
|
@@ -9065,103 +6863,6 @@ export declare const usePortableTextEditor: () => PortableTextEditor
|
|
|
9065
6863
|
*/
|
|
9066
6864
|
export declare const usePortableTextEditorSelection: () => EditorSelection
|
|
9067
6865
|
|
|
9068
|
-
/** @public */
|
|
9069
|
-
declare type ValidationBuilder<
|
|
9070
|
-
T extends RuleDef<T, FieldValue>,
|
|
9071
|
-
FieldValue = unknown,
|
|
9072
|
-
> = (rule: T) => RuleBuilder<T, FieldValue>
|
|
9073
|
-
|
|
9074
|
-
/**
|
|
9075
|
-
* A context object passed around during validation. This includes the
|
|
9076
|
-
* `Rule.custom` context.
|
|
9077
|
-
*
|
|
9078
|
-
* e.g.
|
|
9079
|
-
*
|
|
9080
|
-
* ```js
|
|
9081
|
-
* Rule.custom((_, validationContext) => {
|
|
9082
|
-
* // ...
|
|
9083
|
-
* })`
|
|
9084
|
-
* ```
|
|
9085
|
-
*
|
|
9086
|
-
* @public
|
|
9087
|
-
*/
|
|
9088
|
-
declare interface ValidationContext {
|
|
9089
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
9090
|
-
schema: Schema
|
|
9091
|
-
parent?: unknown
|
|
9092
|
-
type?: SchemaType
|
|
9093
|
-
document?: SanityDocument
|
|
9094
|
-
path?: Path
|
|
9095
|
-
getDocumentExists?: (options: {id: string}) => Promise<boolean>
|
|
9096
|
-
environment: 'cli' | 'studio'
|
|
9097
|
-
}
|
|
9098
|
-
|
|
9099
|
-
/**
|
|
9100
|
-
* The shape that can be returned from a custom validator to be converted into
|
|
9101
|
-
* a validation marker by the validation logic. Inside of a custom validator,
|
|
9102
|
-
* you can return an array of these in order to specify multiple paths within
|
|
9103
|
-
* an object or array.
|
|
9104
|
-
*
|
|
9105
|
-
* @public
|
|
9106
|
-
*/
|
|
9107
|
-
declare interface ValidationError {
|
|
9108
|
-
/**
|
|
9109
|
-
* The message describing why the value is not valid. This message will be
|
|
9110
|
-
* included in the validation markers after validation has finished running.
|
|
9111
|
-
*/
|
|
9112
|
-
message: string
|
|
9113
|
-
/**
|
|
9114
|
-
* If writing a custom validator, you can return validation messages to
|
|
9115
|
-
* specific path inside of the current value (object or array) by populating
|
|
9116
|
-
* this `path` prop.
|
|
9117
|
-
*
|
|
9118
|
-
* NOTE: This path is relative to the current value and _not_ relative to
|
|
9119
|
-
* the document.
|
|
9120
|
-
*/
|
|
9121
|
-
path?: Path
|
|
9122
|
-
/**
|
|
9123
|
-
* Same as `path` but allows more than one value. If provided, the same
|
|
9124
|
-
* message will create two markers from each path with the same message
|
|
9125
|
-
* provided.
|
|
9126
|
-
*
|
|
9127
|
-
* @deprecated prefer `path`
|
|
9128
|
-
*/
|
|
9129
|
-
paths?: Path[]
|
|
9130
|
-
/**
|
|
9131
|
-
* @deprecated Unused. Was used to store the results from `.either()` /`.all()`
|
|
9132
|
-
*/
|
|
9133
|
-
children?: ValidationMarker[]
|
|
9134
|
-
/**
|
|
9135
|
-
* @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
|
|
9136
|
-
*/
|
|
9137
|
-
operation?: 'AND' | 'OR'
|
|
9138
|
-
/**
|
|
9139
|
-
* @deprecated Unused. Was relevant when validation error was used as a class.
|
|
9140
|
-
*/
|
|
9141
|
-
cloneWithMessage?(message: string): ValidationError
|
|
9142
|
-
}
|
|
9143
|
-
|
|
9144
|
-
/** @public */
|
|
9145
|
-
declare interface ValidationMarker {
|
|
9146
|
-
level: 'error' | 'warning' | 'info'
|
|
9147
|
-
/**
|
|
9148
|
-
* The validation message for this marker. E.g. "Must be greater than 0"
|
|
9149
|
-
*/
|
|
9150
|
-
message: string
|
|
9151
|
-
/**
|
|
9152
|
-
* @deprecated use `message` instead
|
|
9153
|
-
*/
|
|
9154
|
-
item?: ValidationError
|
|
9155
|
-
/**
|
|
9156
|
-
* The sanity path _relative to the root of the current document_ to this
|
|
9157
|
-
* marker.
|
|
9158
|
-
*
|
|
9159
|
-
* NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
|
|
9160
|
-
* are not compatible with deep getters like lodash/get
|
|
9161
|
-
*/
|
|
9162
|
-
path: Path
|
|
9163
|
-
}
|
|
9164
|
-
|
|
9165
6866
|
/**
|
|
9166
6867
|
* The editor has received a new (props) value
|
|
9167
6868
|
* @beta */
|