@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/utils/index.d.cts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type {Patch} from '@portabletext/patches'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type {
|
|
3
|
+
ArraySchemaType,
|
|
4
|
+
BlockDecoratorDefinition,
|
|
5
|
+
BlockListDefinition,
|
|
6
|
+
BlockStyleDefinition,
|
|
7
|
+
KeyedSegment,
|
|
8
|
+
ObjectSchemaType,
|
|
9
|
+
Path,
|
|
10
|
+
PortableTextBlock,
|
|
11
|
+
PortableTextChild,
|
|
12
|
+
PortableTextListBlock,
|
|
13
|
+
PortableTextTextBlock,
|
|
6
14
|
} from '@sanity/types'
|
|
7
|
-
import {
|
|
15
|
+
import {PortableTextObject, PortableTextSpan} from '@sanity/types'
|
|
8
16
|
import type {
|
|
9
17
|
FocusEvent as FocusEvent_2,
|
|
10
18
|
KeyboardEvent as KeyboardEvent_2,
|
|
@@ -205,277 +213,6 @@ declare const abstractBehaviorEventTypes: readonly [
|
|
|
205
213
|
'style.toggle',
|
|
206
214
|
]
|
|
207
215
|
|
|
208
|
-
/**
|
|
209
|
-
* Types of array actions that can be performed
|
|
210
|
-
* @beta
|
|
211
|
-
*/
|
|
212
|
-
declare type ArrayActionName =
|
|
213
|
-
/**
|
|
214
|
-
* Add any item to the array at any position
|
|
215
|
-
*/
|
|
216
|
-
| 'add'
|
|
217
|
-
/**
|
|
218
|
-
* Add item after an existing item
|
|
219
|
-
*/
|
|
220
|
-
| 'addBefore'
|
|
221
|
-
/**
|
|
222
|
-
* Add item after an existing item
|
|
223
|
-
*/
|
|
224
|
-
| 'addAfter'
|
|
225
|
-
/**
|
|
226
|
-
* Remove any item
|
|
227
|
-
*/
|
|
228
|
-
| 'remove'
|
|
229
|
-
/**
|
|
230
|
-
* Duplicate item
|
|
231
|
-
*/
|
|
232
|
-
| 'duplicate'
|
|
233
|
-
/**
|
|
234
|
-
* Copy item
|
|
235
|
-
*/
|
|
236
|
-
| 'copy'
|
|
237
|
-
|
|
238
|
-
/** @public */
|
|
239
|
-
declare interface ArrayDefinition extends BaseSchemaDefinition {
|
|
240
|
-
type: 'array'
|
|
241
|
-
of: ArrayOfType[]
|
|
242
|
-
initialValue?: InitialValueProperty<any, unknown[]>
|
|
243
|
-
validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>
|
|
244
|
-
options?: ArrayOptions
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/** @public */
|
|
248
|
-
declare type ArrayOfEntry<T> = Omit<T, 'name' | 'hidden'> & {
|
|
249
|
-
name?: string
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/** @public */
|
|
253
|
-
declare type ArrayOfType<
|
|
254
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
255
|
-
TAlias extends IntrinsicTypeName | undefined = undefined,
|
|
256
|
-
> =
|
|
257
|
-
| IntrinsicArrayOfDefinition[TType]
|
|
258
|
-
| ArrayOfEntry<TypeAliasDefinition<string, TAlias>>
|
|
259
|
-
|
|
260
|
-
/** @public */
|
|
261
|
-
declare interface ArrayOptions<V = unknown>
|
|
262
|
-
extends SearchConfiguration,
|
|
263
|
-
BaseSchemaTypeOptions {
|
|
264
|
-
list?: TitledListValue<V>[] | V[]
|
|
265
|
-
layout?: 'list' | 'tags' | 'grid'
|
|
266
|
-
/** @deprecated This option does not have any effect anymore */
|
|
267
|
-
direction?: 'horizontal' | 'vertical'
|
|
268
|
-
sortable?: boolean
|
|
269
|
-
modal?: {
|
|
270
|
-
type?: 'dialog' | 'popover'
|
|
271
|
-
width?: number | 'auto'
|
|
272
|
-
}
|
|
273
|
-
/** @alpha This API may change */
|
|
274
|
-
insertMenu?: InsertMenuOptions
|
|
275
|
-
/**
|
|
276
|
-
* A boolean flag to enable or disable tree editing for the array.
|
|
277
|
-
* If there are any nested arrays, they will inherit this value.
|
|
278
|
-
* @deprecated tree editing beta feature has been disabled
|
|
279
|
-
*/
|
|
280
|
-
treeEditing?: boolean
|
|
281
|
-
/**
|
|
282
|
-
* A list of array actions to disable
|
|
283
|
-
* Possible options are defined by {@link ArrayActionName}
|
|
284
|
-
* @beta
|
|
285
|
-
*/
|
|
286
|
-
disableActions?: ArrayActionName[]
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/** @public */
|
|
290
|
-
declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {
|
|
291
|
-
min: (length: number | FieldReference) => ArrayRule<Value>
|
|
292
|
-
max: (length: number | FieldReference) => ArrayRule<Value>
|
|
293
|
-
length: (length: number | FieldReference) => ArrayRule<Value>
|
|
294
|
-
unique: () => ArrayRule<Value>
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/** @public */
|
|
298
|
-
declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {
|
|
299
|
-
jsonType: 'array'
|
|
300
|
-
of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[]
|
|
301
|
-
options?: ArrayOptions<V> & {
|
|
302
|
-
layout?: V extends string ? 'tag' : 'grid'
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/** @public */
|
|
307
|
-
declare interface Asset extends SanityDocument {
|
|
308
|
-
url: string
|
|
309
|
-
path: string
|
|
310
|
-
assetId: string
|
|
311
|
-
extension: string
|
|
312
|
-
mimeType: string
|
|
313
|
-
sha1hash: string
|
|
314
|
-
size: number
|
|
315
|
-
originalFilename?: string
|
|
316
|
-
label?: string
|
|
317
|
-
title?: string
|
|
318
|
-
description?: string
|
|
319
|
-
creditLine?: string
|
|
320
|
-
source?: AssetSourceSpec
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** @public */
|
|
324
|
-
declare type AssetFromSource = {
|
|
325
|
-
kind: 'assetDocumentId' | 'file' | 'base64' | 'url'
|
|
326
|
-
value: string | File_2
|
|
327
|
-
assetDocumentProps?: ImageAsset
|
|
328
|
-
mediaLibraryProps?: {
|
|
329
|
-
mediaLibraryId: string
|
|
330
|
-
assetId: string
|
|
331
|
-
assetInstanceId: string
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/** @public */
|
|
336
|
-
declare interface AssetSource {
|
|
337
|
-
name: string
|
|
338
|
-
/** @deprecated provide `i18nKey` instead */
|
|
339
|
-
title?: string
|
|
340
|
-
i18nKey?: string
|
|
341
|
-
component: ComponentType<AssetSourceComponentProps>
|
|
342
|
-
icon?: ComponentType<EmptyProps>
|
|
343
|
-
/** @beta */
|
|
344
|
-
uploader?: AssetSourceUploader
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/** @public */
|
|
348
|
-
declare interface AssetSourceComponentProps {
|
|
349
|
-
action?: 'select' | 'upload'
|
|
350
|
-
assetSource: AssetSource
|
|
351
|
-
assetType?: 'file' | 'image'
|
|
352
|
-
accept: string
|
|
353
|
-
selectionType: 'single'
|
|
354
|
-
dialogHeaderTitle?: React.ReactNode
|
|
355
|
-
selectedAssets: Asset[]
|
|
356
|
-
onClose: () => void
|
|
357
|
-
onSelect: (assetFromSource: AssetFromSource[]) => void
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/** @public */
|
|
361
|
-
declare interface AssetSourceSpec {
|
|
362
|
-
id: string
|
|
363
|
-
name: string
|
|
364
|
-
url?: string
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/** @beta */
|
|
368
|
-
declare interface AssetSourceUploader {
|
|
369
|
-
upload(
|
|
370
|
-
files: globalThis.File[],
|
|
371
|
-
options?: {
|
|
372
|
-
/**
|
|
373
|
-
* The schema type of the field the asset is being uploaded to.
|
|
374
|
-
* May be of interest to the uploader to read file and image options.
|
|
375
|
-
*/
|
|
376
|
-
schemaType?: SchemaType
|
|
377
|
-
/**
|
|
378
|
-
* The uploader may send patches directly to the field
|
|
379
|
-
* Typed 'unknown' as we don't have patch definitions in sanity/types yet.
|
|
380
|
-
*/
|
|
381
|
-
onChange?: (patch: unknown) => void
|
|
382
|
-
},
|
|
383
|
-
): AssetSourceUploadFile[]
|
|
384
|
-
/**
|
|
385
|
-
* Abort the upload of a file
|
|
386
|
-
*/
|
|
387
|
-
abort(file?: AssetSourceUploadFile): void
|
|
388
|
-
/**
|
|
389
|
-
* Get the files that are currently being uploaded
|
|
390
|
-
*/
|
|
391
|
-
getFiles(): AssetSourceUploadFile[]
|
|
392
|
-
/**
|
|
393
|
-
* Subscribe to upload events from the uploader
|
|
394
|
-
*/
|
|
395
|
-
subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void
|
|
396
|
-
/**
|
|
397
|
-
* Update the status of a file. Will be emitted to subscribers.
|
|
398
|
-
*/
|
|
399
|
-
updateFile(
|
|
400
|
-
fileId: string,
|
|
401
|
-
data: {
|
|
402
|
-
progress?: number
|
|
403
|
-
status?: string
|
|
404
|
-
error?: Error
|
|
405
|
-
},
|
|
406
|
-
): void
|
|
407
|
-
/**
|
|
408
|
-
* Reset the uploader (clear files). Should be called by the uploader when all files are done.
|
|
409
|
-
*/
|
|
410
|
-
reset(): void
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/** @beta */
|
|
414
|
-
declare type AssetSourceUploadEvent =
|
|
415
|
-
| AssetSourceUploadEventProgress
|
|
416
|
-
| AssetSourceUploadEventStatus
|
|
417
|
-
| AssetSourceUploadEventAllComplete
|
|
418
|
-
| AssetSourceUploadEventError
|
|
419
|
-
| AssetSourceUploadEventAbort
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
423
|
-
* @beta */
|
|
424
|
-
declare type AssetSourceUploadEventAbort = {
|
|
425
|
-
type: 'abort'
|
|
426
|
-
/**
|
|
427
|
-
* Files aborted
|
|
428
|
-
*/
|
|
429
|
-
files: AssetSourceUploadFile[]
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
434
|
-
* @beta */
|
|
435
|
-
declare type AssetSourceUploadEventAllComplete = {
|
|
436
|
-
type: 'all-complete'
|
|
437
|
-
files: AssetSourceUploadFile[]
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
442
|
-
* @beta */
|
|
443
|
-
declare type AssetSourceUploadEventError = {
|
|
444
|
-
type: 'error'
|
|
445
|
-
/**
|
|
446
|
-
* Files errored
|
|
447
|
-
*/
|
|
448
|
-
files: AssetSourceUploadFile[]
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Emitted when a file upload is progressing
|
|
453
|
-
* @beta */
|
|
454
|
-
declare type AssetSourceUploadEventProgress = {
|
|
455
|
-
type: 'progress'
|
|
456
|
-
file: AssetSourceUploadFile
|
|
457
|
-
progress: number
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Emitted when a file upload is changing status
|
|
462
|
-
* @beta */
|
|
463
|
-
declare type AssetSourceUploadEventStatus = {
|
|
464
|
-
type: 'status'
|
|
465
|
-
file: AssetSourceUploadFile
|
|
466
|
-
status: AssetSourceUploadFile['status']
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/** @beta */
|
|
470
|
-
declare interface AssetSourceUploadFile {
|
|
471
|
-
id: string
|
|
472
|
-
file: globalThis.File
|
|
473
|
-
progress: number
|
|
474
|
-
status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted'
|
|
475
|
-
error?: Error
|
|
476
|
-
result?: unknown
|
|
477
|
-
}
|
|
478
|
-
|
|
479
216
|
/**
|
|
480
217
|
* @public
|
|
481
218
|
*/
|
|
@@ -484,60 +221,6 @@ declare type BaseDefinition = {
|
|
|
484
221
|
title?: string
|
|
485
222
|
}
|
|
486
223
|
|
|
487
|
-
/** @public */
|
|
488
|
-
declare interface BaseSchemaDefinition {
|
|
489
|
-
name: string
|
|
490
|
-
title?: string
|
|
491
|
-
description?: string | React.JSX.Element
|
|
492
|
-
hidden?: ConditionalProperty
|
|
493
|
-
readOnly?: ConditionalProperty
|
|
494
|
-
icon?: ComponentType | ReactNode
|
|
495
|
-
validation?: unknown
|
|
496
|
-
initialValue?: unknown
|
|
497
|
-
deprecated?: DeprecatedProperty
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/** @public */
|
|
501
|
-
declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
|
|
502
|
-
name: string
|
|
503
|
-
title?: string
|
|
504
|
-
description?: string
|
|
505
|
-
type?: SchemaType
|
|
506
|
-
liveEdit?: boolean
|
|
507
|
-
readOnly?: ConditionalProperty
|
|
508
|
-
hidden?: ConditionalProperty
|
|
509
|
-
icon?: ComponentType
|
|
510
|
-
initialValue?: InitialValueProperty<any, any>
|
|
511
|
-
validation?: SchemaValidationValue
|
|
512
|
-
preview?: PreviewConfig
|
|
513
|
-
/** @beta */
|
|
514
|
-
components?: {
|
|
515
|
-
block?: ComponentType<any>
|
|
516
|
-
inlineBlock?: ComponentType<any>
|
|
517
|
-
annotation?: ComponentType<any>
|
|
518
|
-
diff?: ComponentType<any>
|
|
519
|
-
field?: ComponentType<any>
|
|
520
|
-
input?: ComponentType<any>
|
|
521
|
-
item?: ComponentType<any>
|
|
522
|
-
preview?: ComponentType<any>
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* @deprecated This will be removed.
|
|
526
|
-
*/
|
|
527
|
-
placeholder?: string
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* `BaseOptions` applies to all type options.
|
|
532
|
-
*
|
|
533
|
-
* It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.
|
|
534
|
-
*
|
|
535
|
-
* @public
|
|
536
|
-
* */
|
|
537
|
-
declare interface BaseSchemaTypeOptions {
|
|
538
|
-
sanityCreate?: SanityCreateOptions
|
|
539
|
-
}
|
|
540
|
-
|
|
541
224
|
/**
|
|
542
225
|
* @beta
|
|
543
226
|
*/
|
|
@@ -623,142 +306,6 @@ declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
|
623
306
|
event: TBehaviorEvent
|
|
624
307
|
}) => TGuardResponse | false
|
|
625
308
|
|
|
626
|
-
/**
|
|
627
|
-
* Schema definition for text block decorators.
|
|
628
|
-
*
|
|
629
|
-
* @public
|
|
630
|
-
* @example The default set of decorators
|
|
631
|
-
* ```ts
|
|
632
|
-
* {
|
|
633
|
-
* name: 'blockContent',
|
|
634
|
-
* title: 'Content',
|
|
635
|
-
* type: 'array',
|
|
636
|
-
* of: [
|
|
637
|
-
* {
|
|
638
|
-
* type: 'block',
|
|
639
|
-
* marks: {
|
|
640
|
-
* decorators: [
|
|
641
|
-
* {title: 'Strong', value: 'strong'},
|
|
642
|
-
* {title: 'Emphasis', value: 'em'},
|
|
643
|
-
* {title: 'Underline', value: 'underline'},
|
|
644
|
-
* {title: 'Strike', value: 'strike'},
|
|
645
|
-
* {title: 'Code', value: 'code'},
|
|
646
|
-
* ]
|
|
647
|
-
* }
|
|
648
|
-
* }
|
|
649
|
-
* ]
|
|
650
|
-
* }
|
|
651
|
-
* ```
|
|
652
|
-
*/
|
|
653
|
-
declare interface BlockDecoratorDefinition {
|
|
654
|
-
title: string
|
|
655
|
-
i18nTitleKey?: string
|
|
656
|
-
value: string
|
|
657
|
-
icon?: ReactNode | ComponentType
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Schema definition for text blocks.
|
|
662
|
-
*
|
|
663
|
-
* @public
|
|
664
|
-
* @example the default block definition
|
|
665
|
-
* ```ts
|
|
666
|
-
* {
|
|
667
|
-
* name: 'blockContent',
|
|
668
|
-
* title: 'Content',
|
|
669
|
-
* type: 'array',
|
|
670
|
-
* of: [
|
|
671
|
-
* {
|
|
672
|
-
* type: 'block',
|
|
673
|
-
* marks: {
|
|
674
|
-
* decorators: [
|
|
675
|
-
* {title: 'Strong', value: 'strong'},
|
|
676
|
-
* {title: 'Emphasis', value: 'em'},
|
|
677
|
-
* {title: 'Underline', value: 'underline'},
|
|
678
|
-
* {title: 'Strike', value: 'strike'},
|
|
679
|
-
* {title: 'Code', value: 'code'},
|
|
680
|
-
* ],
|
|
681
|
-
* annotations: [
|
|
682
|
-
* {
|
|
683
|
-
* type: 'object',
|
|
684
|
-
* name: 'link',
|
|
685
|
-
* fields: [
|
|
686
|
-
* {
|
|
687
|
-
* type: 'string',
|
|
688
|
-
* name: 'href',
|
|
689
|
-
* },
|
|
690
|
-
* ],
|
|
691
|
-
* },
|
|
692
|
-
* ]
|
|
693
|
-
* },
|
|
694
|
-
* styles: [
|
|
695
|
-
* {title: 'Normal', value: 'normal'},
|
|
696
|
-
* {title: 'H1', value: 'h1'},
|
|
697
|
-
* {title: 'H2', value: 'h2'},
|
|
698
|
-
* {title: 'H3', value: 'h3'},
|
|
699
|
-
* {title: 'H4', value: 'h4'},
|
|
700
|
-
* {title: 'H5', value: 'h5'},
|
|
701
|
-
* {title: 'H6', value: 'h6'},
|
|
702
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
703
|
-
* ],
|
|
704
|
-
* lists: [
|
|
705
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
706
|
-
* {title: 'Number', value: 'number'},
|
|
707
|
-
* ],
|
|
708
|
-
* },
|
|
709
|
-
* ]
|
|
710
|
-
* }
|
|
711
|
-
* ```
|
|
712
|
-
*/
|
|
713
|
-
declare interface BlockDefinition extends BaseSchemaDefinition {
|
|
714
|
-
type: 'block'
|
|
715
|
-
styles?: BlockStyleDefinition[]
|
|
716
|
-
lists?: BlockListDefinition[]
|
|
717
|
-
marks?: BlockMarksDefinition
|
|
718
|
-
of?: ArrayOfType<'object' | 'reference'>[]
|
|
719
|
-
initialValue?: InitialValueProperty<any, any[]>
|
|
720
|
-
options?: BlockOptions
|
|
721
|
-
validation?: ValidationBuilder<BlockRule, any[]>
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Schema definition for a text block list style.
|
|
726
|
-
*
|
|
727
|
-
* @public
|
|
728
|
-
* @example The defaults lists
|
|
729
|
-
* ```ts
|
|
730
|
-
* {
|
|
731
|
-
* name: 'blockContent',
|
|
732
|
-
* title: 'Content',
|
|
733
|
-
* type: 'array',
|
|
734
|
-
* of: [
|
|
735
|
-
* {
|
|
736
|
-
* type: 'block',
|
|
737
|
-
* lists: [
|
|
738
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
739
|
-
* {title: 'Number', value: 'number'},
|
|
740
|
-
* ]
|
|
741
|
-
* }
|
|
742
|
-
* ]
|
|
743
|
-
* }
|
|
744
|
-
* ```
|
|
745
|
-
*/
|
|
746
|
-
declare interface BlockListDefinition {
|
|
747
|
-
title: string
|
|
748
|
-
i18nTitleKey?: string
|
|
749
|
-
value: string
|
|
750
|
-
icon?: ReactNode | ComponentType
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* Schema definition for text block marks (decorators and annotations).
|
|
755
|
-
*
|
|
756
|
-
* @public */
|
|
757
|
-
declare interface BlockMarksDefinition {
|
|
758
|
-
decorators?: BlockDecoratorDefinition[]
|
|
759
|
-
annotations?: ArrayOfType<'object' | 'reference'>[]
|
|
760
|
-
}
|
|
761
|
-
|
|
762
309
|
/**
|
|
763
310
|
* @beta
|
|
764
311
|
*/
|
|
@@ -825,108 +372,10 @@ export declare function blockOffsetToSpanSelectionPoint({
|
|
|
825
372
|
}
|
|
826
373
|
| undefined
|
|
827
374
|
|
|
828
|
-
/**
|
|
829
|
-
* Schema options for a Block schema definition
|
|
830
|
-
* @public */
|
|
831
|
-
declare interface BlockOptions extends BaseSchemaTypeOptions {
|
|
832
|
-
/**
|
|
833
|
-
* Turn on or off the builtin browser spellchecking. Default is on.
|
|
834
|
-
*/
|
|
835
|
-
spellCheck?: boolean
|
|
836
|
-
unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove'
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/** @public */
|
|
840
|
-
declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Schema definition for a text block style.
|
|
844
|
-
* A text block may have a block style like 'header', 'normal', 'lead'
|
|
845
|
-
* attached to it, which is stored on the `.style` property for that block.
|
|
846
|
-
*
|
|
847
|
-
* @public
|
|
848
|
-
* @remarks The first defined style will become the default style.´´
|
|
849
|
-
* @example The default set of styles
|
|
850
|
-
* ```ts
|
|
851
|
-
* {
|
|
852
|
-
* name: 'blockContent',
|
|
853
|
-
* title: 'Content',
|
|
854
|
-
* type: 'array',
|
|
855
|
-
* of: [
|
|
856
|
-
* {
|
|
857
|
-
* type: 'block',
|
|
858
|
-
* styles: [
|
|
859
|
-
* {title: 'Normal', value: 'normal'},
|
|
860
|
-
* {title: 'H1', value: 'h1'},
|
|
861
|
-
* {title: 'H2', value: 'h2'},
|
|
862
|
-
* {title: 'H3', value: 'h3'},
|
|
863
|
-
* {title: 'H4', value: 'h4'},
|
|
864
|
-
* {title: 'H5', value: 'h5'},
|
|
865
|
-
* {title: 'H6', value: 'h6'},
|
|
866
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
867
|
-
* ]
|
|
868
|
-
* }
|
|
869
|
-
* ]
|
|
870
|
-
* }
|
|
871
|
-
* ```
|
|
872
|
-
* @example Example of defining a block type with custom styles and render components.
|
|
873
|
-
* ```ts
|
|
874
|
-
* defineArrayMember({
|
|
875
|
-
* type: 'block',
|
|
876
|
-
* styles: [
|
|
877
|
-
* {
|
|
878
|
-
* title: 'Paragraph',
|
|
879
|
-
* value: 'paragraph',
|
|
880
|
-
* component: ParagraphStyle,
|
|
881
|
-
* },
|
|
882
|
-
* {
|
|
883
|
-
* title: 'Lead',
|
|
884
|
-
* value: 'lead',
|
|
885
|
-
* component: LeadStyle,
|
|
886
|
-
* },
|
|
887
|
-
* {
|
|
888
|
-
* title: 'Heading',
|
|
889
|
-
* value: 'heading',
|
|
890
|
-
* component: HeadingStyle,
|
|
891
|
-
* },
|
|
892
|
-
* ],
|
|
893
|
-
* })
|
|
894
|
-
* ```
|
|
895
|
-
*/
|
|
896
|
-
declare interface BlockStyleDefinition {
|
|
897
|
-
title: string
|
|
898
|
-
value: string
|
|
899
|
-
i18nTitleKey?: string
|
|
900
|
-
icon?: ReactNode | ComponentType
|
|
901
|
-
}
|
|
902
|
-
|
|
903
375
|
declare type BlockWithOptionalKey =
|
|
904
376
|
| TextBlockWithOptionalKey
|
|
905
377
|
| ObjectBlockWithOptionalKey
|
|
906
378
|
|
|
907
|
-
/** @public */
|
|
908
|
-
declare interface BooleanDefinition extends BaseSchemaDefinition {
|
|
909
|
-
type: 'boolean'
|
|
910
|
-
options?: BooleanOptions
|
|
911
|
-
initialValue?: InitialValueProperty<any, boolean>
|
|
912
|
-
validation?: ValidationBuilder<BooleanRule, boolean>
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
/** @public */
|
|
916
|
-
declare interface BooleanOptions extends BaseSchemaTypeOptions {
|
|
917
|
-
layout?: 'switch' | 'checkbox'
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
/** @public */
|
|
921
|
-
declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}
|
|
922
|
-
|
|
923
|
-
/** @public */
|
|
924
|
-
declare interface BooleanSchemaType extends BaseSchemaType {
|
|
925
|
-
jsonType: 'boolean'
|
|
926
|
-
options?: BooleanOptions
|
|
927
|
-
initialValue?: InitialValueProperty<any, boolean>
|
|
928
|
-
}
|
|
929
|
-
|
|
930
379
|
/**
|
|
931
380
|
* @public
|
|
932
381
|
*/
|
|
@@ -961,35 +410,6 @@ declare type ClipboardBehaviorEvent =
|
|
|
961
410
|
position: Pick<EventPosition, 'selection'>
|
|
962
411
|
}
|
|
963
412
|
|
|
964
|
-
/** @public */
|
|
965
|
-
declare interface CollapseOptions {
|
|
966
|
-
collapsed?: boolean
|
|
967
|
-
collapsible?: boolean
|
|
968
|
-
/**
|
|
969
|
-
* @deprecated Use `collapsible` instead
|
|
970
|
-
*/
|
|
971
|
-
collapsable?: boolean
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
/** @public */
|
|
975
|
-
declare type ConditionalProperty =
|
|
976
|
-
| boolean
|
|
977
|
-
| ConditionalPropertyCallback
|
|
978
|
-
| undefined
|
|
979
|
-
|
|
980
|
-
/** @public */
|
|
981
|
-
declare type ConditionalPropertyCallback = (
|
|
982
|
-
context: ConditionalPropertyCallbackContext,
|
|
983
|
-
) => boolean
|
|
984
|
-
|
|
985
|
-
/** @public */
|
|
986
|
-
declare interface ConditionalPropertyCallbackContext {
|
|
987
|
-
document: SanityDocument | undefined
|
|
988
|
-
parent: any
|
|
989
|
-
value: any
|
|
990
|
-
currentUser: Omit<CurrentUser, 'role'> | null
|
|
991
|
-
}
|
|
992
|
-
|
|
993
413
|
declare type Converter<TMIMEType extends MIMEType = MIMEType> = {
|
|
994
414
|
mimeType: TMIMEType
|
|
995
415
|
serialize: Serializer<TMIMEType>
|
|
@@ -1028,46 +448,6 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
|
1028
448
|
mimeType: TMIMEType
|
|
1029
449
|
}
|
|
1030
450
|
|
|
1031
|
-
/** @public */
|
|
1032
|
-
declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {
|
|
1033
|
-
type: 'crossDatasetReference'
|
|
1034
|
-
weak?: boolean
|
|
1035
|
-
to: {
|
|
1036
|
-
type: string
|
|
1037
|
-
title?: string
|
|
1038
|
-
icon?: ComponentType
|
|
1039
|
-
preview?: PreviewConfig
|
|
1040
|
-
/**
|
|
1041
|
-
* @deprecated Unused. Configuring search is no longer supported.
|
|
1042
|
-
*/
|
|
1043
|
-
__experimental_search?: {
|
|
1044
|
-
path: string | string[]
|
|
1045
|
-
weight?: number
|
|
1046
|
-
mapWith?: string
|
|
1047
|
-
}[]
|
|
1048
|
-
}[]
|
|
1049
|
-
dataset: string
|
|
1050
|
-
studioUrl?: (document: {id: string; type?: string}) => string | null
|
|
1051
|
-
tokenId?: string
|
|
1052
|
-
options?: ReferenceOptions
|
|
1053
|
-
/**
|
|
1054
|
-
* @deprecated Cross-project references are no longer supported, only cross-dataset
|
|
1055
|
-
*/
|
|
1056
|
-
projectId?: string
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/** @public */
|
|
1060
|
-
declare interface CurrentUser {
|
|
1061
|
-
id: string
|
|
1062
|
-
name: string
|
|
1063
|
-
email: string
|
|
1064
|
-
profileImage?: string
|
|
1065
|
-
provider?: string
|
|
1066
|
-
/** @deprecated use `roles` instead */
|
|
1067
|
-
role: string
|
|
1068
|
-
roles: Role[]
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
451
|
/**
|
|
1072
452
|
* @beta
|
|
1073
453
|
*/
|
|
@@ -1092,89 +472,6 @@ declare type CustomBehaviorEventType<
|
|
|
1092
472
|
TType extends string = '',
|
|
1093
473
|
> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
|
|
1094
474
|
|
|
1095
|
-
/** @public */
|
|
1096
|
-
declare interface CustomValidator<T = unknown> {
|
|
1097
|
-
(
|
|
1098
|
-
value: T,
|
|
1099
|
-
context: ValidationContext,
|
|
1100
|
-
): CustomValidatorResult | Promise<CustomValidatorResult>
|
|
1101
|
-
bypassConcurrencyLimit?: boolean
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
/** @public */
|
|
1105
|
-
declare type CustomValidatorResult =
|
|
1106
|
-
| true
|
|
1107
|
-
| string
|
|
1108
|
-
| ValidationError
|
|
1109
|
-
| ValidationError[]
|
|
1110
|
-
| LocalizedValidationMessages
|
|
1111
|
-
|
|
1112
|
-
/** @public */
|
|
1113
|
-
declare interface DateDefinition extends BaseSchemaDefinition {
|
|
1114
|
-
type: 'date'
|
|
1115
|
-
options?: DateOptions
|
|
1116
|
-
placeholder?: string
|
|
1117
|
-
validation?: ValidationBuilder<DateRule, string>
|
|
1118
|
-
initialValue?: InitialValueProperty<any, string>
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
/** @public */
|
|
1122
|
-
declare interface DateOptions extends BaseSchemaTypeOptions {
|
|
1123
|
-
dateFormat?: string
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
/** @public */
|
|
1127
|
-
declare interface DateRule extends RuleDef<DateRule, string> {
|
|
1128
|
-
/**
|
|
1129
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
1130
|
-
*/
|
|
1131
|
-
min: (minDate: string | FieldReference) => DateRule
|
|
1132
|
-
/**
|
|
1133
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
1134
|
-
*/
|
|
1135
|
-
max: (maxDate: string | FieldReference) => DateRule
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
/** @public */
|
|
1139
|
-
declare interface DatetimeDefinition extends BaseSchemaDefinition {
|
|
1140
|
-
type: 'datetime'
|
|
1141
|
-
options?: DatetimeOptions
|
|
1142
|
-
placeholder?: string
|
|
1143
|
-
validation?: ValidationBuilder<DatetimeRule, string>
|
|
1144
|
-
initialValue?: InitialValueProperty<any, string>
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
/** @public */
|
|
1148
|
-
declare interface DatetimeOptions extends BaseSchemaTypeOptions {
|
|
1149
|
-
dateFormat?: string
|
|
1150
|
-
timeFormat?: string
|
|
1151
|
-
timeStep?: number
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
/** @public */
|
|
1155
|
-
declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {
|
|
1156
|
-
/**
|
|
1157
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
1158
|
-
*/
|
|
1159
|
-
min: (minDate: string | FieldReference) => DatetimeRule
|
|
1160
|
-
/**
|
|
1161
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
1162
|
-
*/
|
|
1163
|
-
max: (maxDate: string | FieldReference) => DatetimeRule
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
/** @public */
|
|
1167
|
-
declare interface DeprecatedProperty {
|
|
1168
|
-
reason: string
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
/**
|
|
1172
|
-
* @public
|
|
1173
|
-
*/
|
|
1174
|
-
declare interface DeprecationConfiguration {
|
|
1175
|
-
deprecated: DeprecatedProperty
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
475
|
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
1179
476
|
snapshot,
|
|
1180
477
|
event,
|
|
@@ -1187,40 +484,6 @@ declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
|
1187
484
|
'deserialization.success' | 'deserialization.failure'
|
|
1188
485
|
>
|
|
1189
486
|
|
|
1190
|
-
/** @public */
|
|
1191
|
-
declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
|
|
1192
|
-
type: 'document'
|
|
1193
|
-
liveEdit?: boolean
|
|
1194
|
-
/** @beta */
|
|
1195
|
-
orderings?: SortOrdering[]
|
|
1196
|
-
options?: DocumentOptions
|
|
1197
|
-
validation?: ValidationBuilder<DocumentRule, SanityDocument>
|
|
1198
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
1199
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
1200
|
-
__experimental_search?: {
|
|
1201
|
-
path: string
|
|
1202
|
-
weight: number
|
|
1203
|
-
mapWith?: string
|
|
1204
|
-
}[]
|
|
1205
|
-
/** @alpha */
|
|
1206
|
-
__experimental_omnisearch_visibility?: boolean
|
|
1207
|
-
/**
|
|
1208
|
-
* Determines whether the large preview title is displayed in the document pane form
|
|
1209
|
-
* @alpha
|
|
1210
|
-
* */
|
|
1211
|
-
__experimental_formPreviewTitle?: boolean
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* This exists only to allow for extensions using declaration-merging.
|
|
1216
|
-
*
|
|
1217
|
-
* @public
|
|
1218
|
-
*/
|
|
1219
|
-
declare interface DocumentOptions extends BaseSchemaTypeOptions {}
|
|
1220
|
-
|
|
1221
|
-
/** @public */
|
|
1222
|
-
declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}
|
|
1223
|
-
|
|
1224
487
|
declare type DragBehaviorEvent =
|
|
1225
488
|
| {
|
|
1226
489
|
type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
|
|
@@ -5932,214 +5195,18 @@ declare type EditorSnapshot = {
|
|
|
5932
5195
|
}
|
|
5933
5196
|
}
|
|
5934
5197
|
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
}
|
|
5943
|
-
|
|
5944
|
-
/** @public */
|
|
5945
|
-
declare interface EmailOptions extends BaseSchemaTypeOptions {}
|
|
5946
|
-
|
|
5947
|
-
/** @public */
|
|
5948
|
-
declare interface EmailRule extends RuleDef<EmailRule, string> {}
|
|
5949
|
-
|
|
5950
|
-
/** @public */
|
|
5951
|
-
declare interface EmptyProps {}
|
|
5952
|
-
|
|
5953
|
-
/** @public */
|
|
5954
|
-
declare interface EnumListProps<V = unknown> {
|
|
5955
|
-
list?: Array<TitledListValue<V> | V>
|
|
5956
|
-
layout?: 'radio' | 'dropdown'
|
|
5957
|
-
direction?: 'horizontal' | 'vertical'
|
|
5958
|
-
}
|
|
5959
|
-
|
|
5960
|
-
declare type EventPosition = {
|
|
5961
|
-
block: 'start' | 'end'
|
|
5962
|
-
/**
|
|
5963
|
-
* Did the event origin from the editor DOM node itself or from a child node?
|
|
5964
|
-
*/
|
|
5965
|
-
isEditor: boolean
|
|
5966
|
-
selection: NonNullable<EditorSelection>
|
|
5198
|
+
declare type EventPosition = {
|
|
5199
|
+
block: 'start' | 'end'
|
|
5200
|
+
/**
|
|
5201
|
+
* Did the event origin from the editor DOM node itself or from a child node?
|
|
5202
|
+
*/
|
|
5203
|
+
isEditor: boolean
|
|
5204
|
+
selection: NonNullable<EditorSelection>
|
|
5967
5205
|
}
|
|
5968
5206
|
|
|
5969
5207
|
declare type ExtractNamespace<TType extends string> =
|
|
5970
5208
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
5971
5209
|
|
|
5972
|
-
/**
|
|
5973
|
-
* The shape of a field definition. Note, it's recommended to use the
|
|
5974
|
-
* `defineField` function instead of using this type directly.
|
|
5975
|
-
*
|
|
5976
|
-
* Where `defineField` infers the exact field type,
|
|
5977
|
-
* FieldDefinition is a compromise union of all types a field can have.
|
|
5978
|
-
*
|
|
5979
|
-
* A field definition can be a reference to another registered top-level type
|
|
5980
|
-
* or a inline type definition.
|
|
5981
|
-
*
|
|
5982
|
-
* @public
|
|
5983
|
-
*/
|
|
5984
|
-
declare type FieldDefinition<
|
|
5985
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
5986
|
-
TAlias extends IntrinsicTypeName | undefined = undefined,
|
|
5987
|
-
> = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) &
|
|
5988
|
-
FieldDefinitionBase
|
|
5989
|
-
|
|
5990
|
-
/** @public */
|
|
5991
|
-
declare interface FieldDefinitionBase {
|
|
5992
|
-
fieldset?: string
|
|
5993
|
-
group?: string | string[]
|
|
5994
|
-
}
|
|
5995
|
-
|
|
5996
|
-
/** @public */
|
|
5997
|
-
declare interface FieldGroup {
|
|
5998
|
-
name: string
|
|
5999
|
-
icon?: ComponentType
|
|
6000
|
-
title?: string
|
|
6001
|
-
description?: string
|
|
6002
|
-
i18n?: I18nTextRecord<'title'>
|
|
6003
|
-
hidden?: ConditionalProperty
|
|
6004
|
-
default?: boolean
|
|
6005
|
-
fields?: ObjectField[]
|
|
6006
|
-
}
|
|
6007
|
-
|
|
6008
|
-
/** @public */
|
|
6009
|
-
declare type FieldGroupDefinition = {
|
|
6010
|
-
name: string
|
|
6011
|
-
title?: string
|
|
6012
|
-
hidden?: ConditionalProperty
|
|
6013
|
-
icon?: ComponentType
|
|
6014
|
-
default?: boolean
|
|
6015
|
-
i18n?: I18nTextRecord<'title'>
|
|
6016
|
-
}
|
|
6017
|
-
|
|
6018
|
-
/**
|
|
6019
|
-
* Holds a reference to a different field
|
|
6020
|
-
* NOTE: Only use this through {@link Rule.valueOfField}
|
|
6021
|
-
*
|
|
6022
|
-
* @public
|
|
6023
|
-
*/
|
|
6024
|
-
declare interface FieldReference {
|
|
6025
|
-
type: symbol
|
|
6026
|
-
path: string | string[]
|
|
6027
|
-
}
|
|
6028
|
-
|
|
6029
|
-
/** @public */
|
|
6030
|
-
declare type FieldRules = {
|
|
6031
|
-
[fieldKey: string]: SchemaValidationValue
|
|
6032
|
-
}
|
|
6033
|
-
|
|
6034
|
-
/** @public */
|
|
6035
|
-
declare type Fieldset = SingleFieldSet | MultiFieldSet
|
|
6036
|
-
|
|
6037
|
-
/** @public */
|
|
6038
|
-
declare type FieldsetDefinition = {
|
|
6039
|
-
name: string
|
|
6040
|
-
title?: string
|
|
6041
|
-
description?: string
|
|
6042
|
-
group?: string
|
|
6043
|
-
hidden?: ConditionalProperty
|
|
6044
|
-
readOnly?: ConditionalProperty
|
|
6045
|
-
options?: ObjectOptions
|
|
6046
|
-
}
|
|
6047
|
-
|
|
6048
|
-
/** @public */
|
|
6049
|
-
declare interface File_2 {
|
|
6050
|
-
[key: string]: unknown
|
|
6051
|
-
asset?: Reference
|
|
6052
|
-
}
|
|
6053
|
-
|
|
6054
|
-
/** @public */
|
|
6055
|
-
declare interface FileDefinition
|
|
6056
|
-
extends Omit<
|
|
6057
|
-
ObjectDefinition,
|
|
6058
|
-
'type' | 'fields' | 'options' | 'groups' | 'validation'
|
|
6059
|
-
> {
|
|
6060
|
-
type: 'file'
|
|
6061
|
-
fields?: ObjectDefinition['fields']
|
|
6062
|
-
options?: FileOptions
|
|
6063
|
-
validation?: ValidationBuilder<FileRule, FileValue>
|
|
6064
|
-
initialValue?: InitialValueProperty<any, FileValue>
|
|
6065
|
-
}
|
|
6066
|
-
|
|
6067
|
-
/** @public */
|
|
6068
|
-
declare interface FileOptions extends ObjectOptions {
|
|
6069
|
-
storeOriginalFilename?: boolean
|
|
6070
|
-
accept?: string
|
|
6071
|
-
sources?: AssetSource[]
|
|
6072
|
-
}
|
|
6073
|
-
|
|
6074
|
-
/** @public */
|
|
6075
|
-
declare interface FileRule extends RuleDef<FileRule, FileValue> {
|
|
6076
|
-
/**
|
|
6077
|
-
* Require a file field has an asset.
|
|
6078
|
-
*
|
|
6079
|
-
* @example
|
|
6080
|
-
* ```ts
|
|
6081
|
-
* defineField({
|
|
6082
|
-
* name: 'file',
|
|
6083
|
-
* title: 'File',
|
|
6084
|
-
* type: 'file',
|
|
6085
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
6086
|
-
* })
|
|
6087
|
-
* ```
|
|
6088
|
-
*/
|
|
6089
|
-
assetRequired(): FileRule
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
|
-
/** @public */
|
|
6093
|
-
declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {
|
|
6094
|
-
options?: FileOptions
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6097
|
-
/** @public */
|
|
6098
|
-
declare interface FileValue {
|
|
6099
|
-
asset?: Reference
|
|
6100
|
-
[index: string]: unknown
|
|
6101
|
-
}
|
|
6102
|
-
|
|
6103
|
-
/** @public */
|
|
6104
|
-
declare interface GeopointDefinition extends BaseSchemaDefinition {
|
|
6105
|
-
type: 'geopoint'
|
|
6106
|
-
options?: GeopointOptions
|
|
6107
|
-
validation?: ValidationBuilder<GeopointRule, GeopointValue>
|
|
6108
|
-
initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>
|
|
6109
|
-
}
|
|
6110
|
-
|
|
6111
|
-
/** @public */
|
|
6112
|
-
declare interface GeopointOptions extends BaseSchemaTypeOptions {}
|
|
6113
|
-
|
|
6114
|
-
/** @public */
|
|
6115
|
-
declare interface GeopointRule extends RuleDef<GeopointRule, GeopointValue> {}
|
|
6116
|
-
|
|
6117
|
-
/**
|
|
6118
|
-
* Geographical point representing a pair of latitude and longitude coordinates,
|
|
6119
|
-
* stored as degrees, in the World Geodetic System 1984 (WGS 84) format. Also
|
|
6120
|
-
* includes an optional `alt` property representing the altitude in meters.
|
|
6121
|
-
*
|
|
6122
|
-
* @public
|
|
6123
|
-
*/
|
|
6124
|
-
declare interface GeopointValue {
|
|
6125
|
-
/**
|
|
6126
|
-
* Type of the object. Must be `geopoint`.
|
|
6127
|
-
*/
|
|
6128
|
-
_type: 'geopoint'
|
|
6129
|
-
/**
|
|
6130
|
-
* Latitude in degrees
|
|
6131
|
-
*/
|
|
6132
|
-
lat: number
|
|
6133
|
-
/**
|
|
6134
|
-
* Longitude in degrees
|
|
6135
|
-
*/
|
|
6136
|
-
lng: number
|
|
6137
|
-
/**
|
|
6138
|
-
* Altitude in meters
|
|
6139
|
-
*/
|
|
6140
|
-
alt?: number
|
|
6141
|
-
}
|
|
6142
|
-
|
|
6143
5210
|
/**
|
|
6144
5211
|
* @public
|
|
6145
5212
|
*/
|
|
@@ -6195,23 +5262,6 @@ export declare function getSelectionStartPoint<
|
|
|
6195
5262
|
*/
|
|
6196
5263
|
export declare function getTextBlockText(block: PortableTextTextBlock): string
|
|
6197
5264
|
|
|
6198
|
-
/** @public */
|
|
6199
|
-
declare interface GlobalDocumentReferenceDefinition
|
|
6200
|
-
extends BaseSchemaDefinition {
|
|
6201
|
-
type: 'globalDocumentReference'
|
|
6202
|
-
weak?: boolean
|
|
6203
|
-
to: {
|
|
6204
|
-
type: string
|
|
6205
|
-
title?: string
|
|
6206
|
-
icon?: ComponentType
|
|
6207
|
-
preview?: PreviewConfig
|
|
6208
|
-
}[]
|
|
6209
|
-
resourceType: string
|
|
6210
|
-
resourceId: string
|
|
6211
|
-
options?: ReferenceOptions
|
|
6212
|
-
studioUrl?: (document: {id: string; type?: string}) => string | null
|
|
6213
|
-
}
|
|
6214
|
-
|
|
6215
5265
|
declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
|
|
6216
5266
|
|
|
6217
5267
|
declare interface History_2 {
|
|
@@ -6224,178 +5274,6 @@ declare type HistoryItem = {
|
|
|
6224
5274
|
timestamp: Date
|
|
6225
5275
|
}
|
|
6226
5276
|
|
|
6227
|
-
/** @public */
|
|
6228
|
-
declare interface HotspotOptions {
|
|
6229
|
-
previews?: HotspotPreview[]
|
|
6230
|
-
}
|
|
6231
|
-
|
|
6232
|
-
/** @public */
|
|
6233
|
-
declare interface HotspotPreview {
|
|
6234
|
-
title: string
|
|
6235
|
-
aspectRatio: number
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
|
-
/** @public */
|
|
6239
|
-
declare type I18nTextRecord<K extends string> = {
|
|
6240
|
-
[P in K]?: {
|
|
6241
|
-
key: string
|
|
6242
|
-
ns: string
|
|
6243
|
-
}
|
|
6244
|
-
}
|
|
6245
|
-
|
|
6246
|
-
/** @public */
|
|
6247
|
-
declare interface ImageAsset extends Asset {
|
|
6248
|
-
_type: 'sanity.imageAsset'
|
|
6249
|
-
metadata: ImageMetadata
|
|
6250
|
-
}
|
|
6251
|
-
|
|
6252
|
-
/** @public */
|
|
6253
|
-
declare interface ImageCrop {
|
|
6254
|
-
_type?: 'sanity.imageCrop'
|
|
6255
|
-
left: number
|
|
6256
|
-
bottom: number
|
|
6257
|
-
right: number
|
|
6258
|
-
top: number
|
|
6259
|
-
}
|
|
6260
|
-
|
|
6261
|
-
/** @public */
|
|
6262
|
-
declare interface ImageDefinition
|
|
6263
|
-
extends Omit<
|
|
6264
|
-
ObjectDefinition,
|
|
6265
|
-
'type' | 'fields' | 'options' | 'groups' | 'validation'
|
|
6266
|
-
> {
|
|
6267
|
-
type: 'image'
|
|
6268
|
-
fields?: FieldDefinition[]
|
|
6269
|
-
options?: ImageOptions
|
|
6270
|
-
validation?: ValidationBuilder<ImageRule, ImageValue>
|
|
6271
|
-
initialValue?: InitialValueProperty<any, ImageValue>
|
|
6272
|
-
}
|
|
6273
|
-
|
|
6274
|
-
/** @public */
|
|
6275
|
-
declare interface ImageDimensions {
|
|
6276
|
-
_type: 'sanity.imageDimensions'
|
|
6277
|
-
height: number
|
|
6278
|
-
width: number
|
|
6279
|
-
aspectRatio: number
|
|
6280
|
-
}
|
|
6281
|
-
|
|
6282
|
-
/** @public */
|
|
6283
|
-
declare interface ImageHotspot {
|
|
6284
|
-
_type?: 'sanity.imageHotspot'
|
|
6285
|
-
width: number
|
|
6286
|
-
height: number
|
|
6287
|
-
x: number
|
|
6288
|
-
y: number
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
|
-
/** @public */
|
|
6292
|
-
declare interface ImageMetadata {
|
|
6293
|
-
[key: string]: unknown
|
|
6294
|
-
_type: 'sanity.imageMetadata'
|
|
6295
|
-
dimensions: ImageDimensions
|
|
6296
|
-
palette?: ImagePalette
|
|
6297
|
-
lqip?: string
|
|
6298
|
-
blurHash?: string
|
|
6299
|
-
hasAlpha: boolean
|
|
6300
|
-
isOpaque: boolean
|
|
6301
|
-
}
|
|
6302
|
-
|
|
6303
|
-
/** @public */
|
|
6304
|
-
declare type ImageMetadataType =
|
|
6305
|
-
| 'blurhash'
|
|
6306
|
-
| 'lqip'
|
|
6307
|
-
| 'palette'
|
|
6308
|
-
| 'exif'
|
|
6309
|
-
| 'image'
|
|
6310
|
-
| 'location'
|
|
6311
|
-
|
|
6312
|
-
/** @public */
|
|
6313
|
-
declare interface ImageOptions extends FileOptions {
|
|
6314
|
-
metadata?: ImageMetadataType[]
|
|
6315
|
-
hotspot?: boolean | HotspotOptions
|
|
6316
|
-
}
|
|
6317
|
-
|
|
6318
|
-
/** @public */
|
|
6319
|
-
declare interface ImagePalette {
|
|
6320
|
-
_type: 'sanity.imagePalette'
|
|
6321
|
-
darkMuted?: ImageSwatch
|
|
6322
|
-
darkVibrant?: ImageSwatch
|
|
6323
|
-
dominant?: ImageSwatch
|
|
6324
|
-
lightMuted?: ImageSwatch
|
|
6325
|
-
lightVibrant?: ImageSwatch
|
|
6326
|
-
muted?: ImageSwatch
|
|
6327
|
-
vibrant?: ImageSwatch
|
|
6328
|
-
}
|
|
6329
|
-
|
|
6330
|
-
/** @public */
|
|
6331
|
-
declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {
|
|
6332
|
-
/**
|
|
6333
|
-
* Require an image field has an asset.
|
|
6334
|
-
*
|
|
6335
|
-
* @example
|
|
6336
|
-
* ```ts
|
|
6337
|
-
* defineField({
|
|
6338
|
-
* name: 'image',
|
|
6339
|
-
* title: 'Image',
|
|
6340
|
-
* type: 'image',
|
|
6341
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
6342
|
-
* })
|
|
6343
|
-
* ```
|
|
6344
|
-
*/
|
|
6345
|
-
assetRequired(): ImageRule
|
|
6346
|
-
}
|
|
6347
|
-
|
|
6348
|
-
/** @public */
|
|
6349
|
-
declare interface ImageSwatch {
|
|
6350
|
-
_type: 'sanity.imagePaletteSwatch'
|
|
6351
|
-
background: string
|
|
6352
|
-
foreground: string
|
|
6353
|
-
population: number
|
|
6354
|
-
title?: string
|
|
6355
|
-
}
|
|
6356
|
-
|
|
6357
|
-
/** @public */
|
|
6358
|
-
declare interface ImageValue extends FileValue {
|
|
6359
|
-
crop?: ImageCrop
|
|
6360
|
-
hotspot?: ImageHotspot
|
|
6361
|
-
[index: string]: unknown
|
|
6362
|
-
}
|
|
6363
|
-
|
|
6364
|
-
/** @public */
|
|
6365
|
-
declare type IndexTuple = [number | '', number | '']
|
|
6366
|
-
|
|
6367
|
-
/** @public */
|
|
6368
|
-
declare type InitialValueProperty<Params, Value> =
|
|
6369
|
-
| Value
|
|
6370
|
-
| InitialValueResolver<Params, Value>
|
|
6371
|
-
| undefined
|
|
6372
|
-
|
|
6373
|
-
/** @public */
|
|
6374
|
-
declare type InitialValueResolver<Params, Value> = (
|
|
6375
|
-
params: Params | undefined,
|
|
6376
|
-
context: InitialValueResolverContext,
|
|
6377
|
-
) => Promise<Value> | Value
|
|
6378
|
-
|
|
6379
|
-
/** @public */
|
|
6380
|
-
declare interface InitialValueResolverContext {
|
|
6381
|
-
projectId: string
|
|
6382
|
-
dataset: string
|
|
6383
|
-
schema: Schema
|
|
6384
|
-
currentUser: CurrentUser | null
|
|
6385
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
6386
|
-
}
|
|
6387
|
-
|
|
6388
|
-
/** @public */
|
|
6389
|
-
declare type InlineFieldDefinition = {
|
|
6390
|
-
[K in keyof IntrinsicDefinitions]: Omit<
|
|
6391
|
-
IntrinsicDefinitions[K],
|
|
6392
|
-
'initialValue' | 'validation'
|
|
6393
|
-
> & {
|
|
6394
|
-
validation?: SchemaValidationValue
|
|
6395
|
-
initialValue?: InitialValueProperty<any, any>
|
|
6396
|
-
}
|
|
6397
|
-
}
|
|
6398
|
-
|
|
6399
5277
|
/**
|
|
6400
5278
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
6401
5279
|
*
|
|
@@ -6414,33 +5292,6 @@ declare type InputBehaviorEvent = {
|
|
|
6414
5292
|
}
|
|
6415
5293
|
}
|
|
6416
5294
|
|
|
6417
|
-
/** @alpha This API may change */
|
|
6418
|
-
declare interface InsertMenuOptions {
|
|
6419
|
-
/**
|
|
6420
|
-
* @defaultValue `'auto'`
|
|
6421
|
-
* `filter: 'auto'` automatically turns on filtering if there are more than 5
|
|
6422
|
-
* schema types added to the menu.
|
|
6423
|
-
*/
|
|
6424
|
-
filter?: 'auto' | boolean
|
|
6425
|
-
groups?: Array<{
|
|
6426
|
-
name: string
|
|
6427
|
-
title?: string
|
|
6428
|
-
of?: Array<string>
|
|
6429
|
-
}>
|
|
6430
|
-
/** defaultValue `true` */
|
|
6431
|
-
showIcons?: boolean
|
|
6432
|
-
/** @defaultValue `[{name: 'list'}]` */
|
|
6433
|
-
views?: Array<
|
|
6434
|
-
| {
|
|
6435
|
-
name: 'list'
|
|
6436
|
-
}
|
|
6437
|
-
| {
|
|
6438
|
-
name: 'grid'
|
|
6439
|
-
previewImageUrl?: (schemaTypeName: string) => string | undefined
|
|
6440
|
-
}
|
|
6441
|
-
>
|
|
6442
|
-
}
|
|
6443
|
-
|
|
6444
5295
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
6445
5296
|
|
|
6446
5297
|
declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
|
|
@@ -6448,64 +5299,6 @@ declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
|
|
|
6448
5299
|
value: Array<PortableTextBlock>
|
|
6449
5300
|
}
|
|
6450
5301
|
|
|
6451
|
-
/** @public */
|
|
6452
|
-
declare type IntrinsicArrayOfDefinition = {
|
|
6453
|
-
[K in keyof IntrinsicDefinitions]: Omit<
|
|
6454
|
-
ArrayOfEntry<IntrinsicDefinitions[K]>,
|
|
6455
|
-
'validation' | 'initialValue'
|
|
6456
|
-
> & {
|
|
6457
|
-
validation?: SchemaValidationValue
|
|
6458
|
-
initialValue?: InitialValueProperty<any, any>
|
|
6459
|
-
}
|
|
6460
|
-
}
|
|
6461
|
-
|
|
6462
|
-
/**
|
|
6463
|
-
* `IntrinsicDefinitions` is a lookup map for "predefined" schema definitions.
|
|
6464
|
-
* Schema types in `IntrinsicDefinitions` will have good type-completion and type-safety in {@link defineType},
|
|
6465
|
-
* {@link defineField} and {@link defineArrayMember} once the `type` property is provided.
|
|
6466
|
-
*
|
|
6467
|
-
* By default, `IntrinsicDefinitions` contains all standard Sanity schema types (`array`, `string`, `number` ect),
|
|
6468
|
-
* but it is an interface and as such, open for extension.
|
|
6469
|
-
*
|
|
6470
|
-
* This type can be extended using declaration merging; this way new entries can be added.
|
|
6471
|
-
* See {@link defineType} for examples on how this can be accomplished.
|
|
6472
|
-
*
|
|
6473
|
-
* @see defineType
|
|
6474
|
-
*
|
|
6475
|
-
* @public
|
|
6476
|
-
*/
|
|
6477
|
-
declare interface IntrinsicDefinitions {
|
|
6478
|
-
array: ArrayDefinition
|
|
6479
|
-
block: BlockDefinition
|
|
6480
|
-
boolean: BooleanDefinition
|
|
6481
|
-
date: DateDefinition
|
|
6482
|
-
datetime: DatetimeDefinition
|
|
6483
|
-
document: DocumentDefinition
|
|
6484
|
-
file: FileDefinition
|
|
6485
|
-
geopoint: GeopointDefinition
|
|
6486
|
-
image: ImageDefinition
|
|
6487
|
-
number: NumberDefinition
|
|
6488
|
-
object: ObjectDefinition
|
|
6489
|
-
reference: ReferenceDefinition
|
|
6490
|
-
crossDatasetReference: CrossDatasetReferenceDefinition
|
|
6491
|
-
globalDocumentReference: GlobalDocumentReferenceDefinition
|
|
6492
|
-
slug: SlugDefinition
|
|
6493
|
-
string: StringDefinition
|
|
6494
|
-
text: TextDefinition
|
|
6495
|
-
url: UrlDefinition
|
|
6496
|
-
email: EmailDefinition
|
|
6497
|
-
}
|
|
6498
|
-
|
|
6499
|
-
/**
|
|
6500
|
-
* A union of all intrinsic types allowed natively in the schema.
|
|
6501
|
-
*
|
|
6502
|
-
* @see IntrinsicDefinitions
|
|
6503
|
-
*
|
|
6504
|
-
* @public
|
|
6505
|
-
*/
|
|
6506
|
-
declare type IntrinsicTypeName =
|
|
6507
|
-
IntrinsicDefinitions[keyof IntrinsicDefinitions]['type']
|
|
6508
|
-
|
|
6509
5302
|
/**
|
|
6510
5303
|
* The editor has invalid data in the value that can be resolved by the user
|
|
6511
5304
|
* @beta */
|
|
@@ -6599,27 +5392,6 @@ declare type KeyboardBehaviorEvent =
|
|
|
6599
5392
|
>
|
|
6600
5393
|
}
|
|
6601
5394
|
|
|
6602
|
-
/** @public */
|
|
6603
|
-
declare type KeyedSegment = {
|
|
6604
|
-
_key: string
|
|
6605
|
-
}
|
|
6606
|
-
|
|
6607
|
-
/**
|
|
6608
|
-
* Holds localized validation messages for a given field.
|
|
6609
|
-
*
|
|
6610
|
-
* @example Custom message for English (US) and Norwegian (Bokmål):
|
|
6611
|
-
* ```
|
|
6612
|
-
* {
|
|
6613
|
-
* 'en-US': 'Needs to start with a capital letter',
|
|
6614
|
-
* 'no-NB': 'Må starte med stor bokstav',
|
|
6615
|
-
* }
|
|
6616
|
-
* ```
|
|
6617
|
-
* @public
|
|
6618
|
-
*/
|
|
6619
|
-
declare interface LocalizedValidationMessages {
|
|
6620
|
-
[locale: string]: string
|
|
6621
|
-
}
|
|
6622
|
-
|
|
6623
5395
|
/**
|
|
6624
5396
|
* @beta
|
|
6625
5397
|
*/
|
|
@@ -6631,7 +5403,7 @@ export declare function mergeTextBlocks({
|
|
|
6631
5403
|
context: Pick<EditorContext, 'keyGenerator' | 'schema'>
|
|
6632
5404
|
targetBlock: PortableTextTextBlock
|
|
6633
5405
|
incomingBlock: PortableTextTextBlock
|
|
6634
|
-
}): PortableTextTextBlock<
|
|
5406
|
+
}): PortableTextTextBlock<PortableTextObject | PortableTextSpan>
|
|
6635
5407
|
|
|
6636
5408
|
declare type MIMEType = `${string}/${string}`
|
|
6637
5409
|
|
|
@@ -6640,21 +5412,6 @@ declare type MouseBehaviorEvent = {
|
|
|
6640
5412
|
position: EventPosition
|
|
6641
5413
|
}
|
|
6642
5414
|
|
|
6643
|
-
/** @public */
|
|
6644
|
-
declare interface MultiFieldSet {
|
|
6645
|
-
name: string
|
|
6646
|
-
title?: string
|
|
6647
|
-
description?: string
|
|
6648
|
-
single?: false
|
|
6649
|
-
group?: string | string[]
|
|
6650
|
-
options?: CollapseOptions & {
|
|
6651
|
-
columns?: number
|
|
6652
|
-
}
|
|
6653
|
-
fields: ObjectField[]
|
|
6654
|
-
hidden?: ConditionalProperty
|
|
6655
|
-
readOnly?: ConditionalProperty
|
|
6656
|
-
}
|
|
6657
|
-
|
|
6658
5415
|
/**
|
|
6659
5416
|
* @public
|
|
6660
5417
|
*/
|
|
@@ -6722,114 +5479,10 @@ declare const nativeBehaviorEventTypes: readonly [
|
|
|
6722
5479
|
'mouse.click',
|
|
6723
5480
|
]
|
|
6724
5481
|
|
|
6725
|
-
/** @public */
|
|
6726
|
-
declare interface NumberDefinition extends BaseSchemaDefinition {
|
|
6727
|
-
type: 'number'
|
|
6728
|
-
options?: NumberOptions
|
|
6729
|
-
placeholder?: string
|
|
6730
|
-
validation?: ValidationBuilder<NumberRule, number>
|
|
6731
|
-
initialValue?: InitialValueProperty<any, number>
|
|
6732
|
-
}
|
|
6733
|
-
|
|
6734
|
-
/** @public */
|
|
6735
|
-
declare interface NumberOptions
|
|
6736
|
-
extends EnumListProps<number>,
|
|
6737
|
-
BaseSchemaTypeOptions {}
|
|
6738
|
-
|
|
6739
|
-
/** @public */
|
|
6740
|
-
declare interface NumberRule extends RuleDef<NumberRule, number> {
|
|
6741
|
-
min: (minNumber: number | FieldReference) => NumberRule
|
|
6742
|
-
max: (maxNumber: number | FieldReference) => NumberRule
|
|
6743
|
-
lessThan: (limit: number | FieldReference) => NumberRule
|
|
6744
|
-
greaterThan: (limit: number | FieldReference) => NumberRule
|
|
6745
|
-
integer: () => NumberRule
|
|
6746
|
-
precision: (limit: number | FieldReference) => NumberRule
|
|
6747
|
-
positive: () => NumberRule
|
|
6748
|
-
negative: () => NumberRule
|
|
6749
|
-
}
|
|
6750
|
-
|
|
6751
|
-
/** @public */
|
|
6752
|
-
declare interface NumberSchemaType extends BaseSchemaType {
|
|
6753
|
-
jsonType: 'number'
|
|
6754
|
-
options?: NumberOptions
|
|
6755
|
-
initialValue?: InitialValueProperty<any, number>
|
|
6756
|
-
}
|
|
6757
|
-
|
|
6758
5482
|
declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
6759
5483
|
_key?: PortableTextObject['_key']
|
|
6760
5484
|
}
|
|
6761
5485
|
|
|
6762
|
-
/** @public */
|
|
6763
|
-
declare interface ObjectDefinition extends BaseSchemaDefinition {
|
|
6764
|
-
type: 'object'
|
|
6765
|
-
/**
|
|
6766
|
-
* Object must have at least one field. This is validated at Studio startup.
|
|
6767
|
-
*/
|
|
6768
|
-
fields: FieldDefinition[]
|
|
6769
|
-
groups?: FieldGroupDefinition[]
|
|
6770
|
-
fieldsets?: FieldsetDefinition[]
|
|
6771
|
-
preview?: PreviewConfig
|
|
6772
|
-
options?: ObjectOptions
|
|
6773
|
-
validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>
|
|
6774
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
6775
|
-
}
|
|
6776
|
-
|
|
6777
|
-
/** @public */
|
|
6778
|
-
declare interface ObjectField<T extends SchemaType = SchemaType> {
|
|
6779
|
-
name: string
|
|
6780
|
-
fieldset?: string
|
|
6781
|
-
group?: string | string[]
|
|
6782
|
-
type: ObjectFieldType<T>
|
|
6783
|
-
}
|
|
6784
|
-
|
|
6785
|
-
/** @public */
|
|
6786
|
-
declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & {
|
|
6787
|
-
hidden?: ConditionalProperty
|
|
6788
|
-
readOnly?: ConditionalProperty
|
|
6789
|
-
}
|
|
6790
|
-
|
|
6791
|
-
/** @public */
|
|
6792
|
-
declare interface ObjectOptions extends BaseSchemaTypeOptions {
|
|
6793
|
-
collapsible?: boolean
|
|
6794
|
-
collapsed?: boolean
|
|
6795
|
-
columns?: number
|
|
6796
|
-
modal?: {
|
|
6797
|
-
type?: 'dialog' | 'popover'
|
|
6798
|
-
width?: number | number[] | 'auto'
|
|
6799
|
-
}
|
|
6800
|
-
}
|
|
6801
|
-
|
|
6802
|
-
/** @public */
|
|
6803
|
-
declare interface ObjectRule
|
|
6804
|
-
extends RuleDef<ObjectRule, Record<string, unknown>> {}
|
|
6805
|
-
|
|
6806
|
-
/** @public */
|
|
6807
|
-
declare interface ObjectSchemaType extends BaseSchemaType {
|
|
6808
|
-
jsonType: 'object'
|
|
6809
|
-
fields: ObjectField[]
|
|
6810
|
-
groups?: FieldGroup[]
|
|
6811
|
-
fieldsets?: Fieldset[]
|
|
6812
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>
|
|
6813
|
-
weak?: boolean
|
|
6814
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
6815
|
-
__experimental_search?: {
|
|
6816
|
-
path: (string | number)[]
|
|
6817
|
-
weight: number
|
|
6818
|
-
mapWith?: string
|
|
6819
|
-
}[]
|
|
6820
|
-
/** @alpha */
|
|
6821
|
-
__experimental_omnisearch_visibility?: boolean
|
|
6822
|
-
/** @alpha */
|
|
6823
|
-
__experimental_actions?: string[]
|
|
6824
|
-
/** @alpha */
|
|
6825
|
-
__experimental_formPreviewTitle?: boolean
|
|
6826
|
-
/**
|
|
6827
|
-
* @beta
|
|
6828
|
-
*/
|
|
6829
|
-
orderings?: SortOrdering[]
|
|
6830
|
-
options?: any
|
|
6831
|
-
}
|
|
6832
|
-
|
|
6833
5486
|
/**
|
|
6834
5487
|
* @public
|
|
6835
5488
|
*/
|
|
@@ -6844,12 +5497,6 @@ declare type PatchEvent = {
|
|
|
6844
5497
|
patch: Patch
|
|
6845
5498
|
}
|
|
6846
5499
|
|
|
6847
|
-
/** @public */
|
|
6848
|
-
declare type Path = PathSegment[]
|
|
6849
|
-
|
|
6850
|
-
/** @public */
|
|
6851
|
-
declare type PathSegment = string | number | KeyedSegment | IndexTuple
|
|
6852
|
-
|
|
6853
5500
|
/**
|
|
6854
5501
|
* @internal
|
|
6855
5502
|
*/
|
|
@@ -6859,18 +5506,6 @@ declare type PickFromUnion<
|
|
|
6859
5506
|
TPickedTags extends TUnion[TTagKey],
|
|
6860
5507
|
> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never
|
|
6861
5508
|
|
|
6862
|
-
/** @alpha */
|
|
6863
|
-
declare type PortableTextBlock = PortableTextTextBlock | PortableTextObject
|
|
6864
|
-
|
|
6865
|
-
/** @alpha */
|
|
6866
|
-
declare type PortableTextChild = PortableTextObject | PortableTextSpan
|
|
6867
|
-
|
|
6868
|
-
/** @alpha */
|
|
6869
|
-
declare interface PortableTextListBlock extends PortableTextTextBlock {
|
|
6870
|
-
listItem: string
|
|
6871
|
-
level: number
|
|
6872
|
-
}
|
|
6873
|
-
|
|
6874
5509
|
/** @beta */
|
|
6875
5510
|
declare type PortableTextMemberSchemaTypes = {
|
|
6876
5511
|
annotations: (ObjectSchemaType & {
|
|
@@ -6886,13 +5521,6 @@ declare type PortableTextMemberSchemaTypes = {
|
|
|
6886
5521
|
lists: BlockListDefinition[]
|
|
6887
5522
|
}
|
|
6888
5523
|
|
|
6889
|
-
/** @alpha */
|
|
6890
|
-
declare interface PortableTextObject {
|
|
6891
|
-
_type: string
|
|
6892
|
-
_key: string
|
|
6893
|
-
[other: string]: unknown
|
|
6894
|
-
}
|
|
6895
|
-
|
|
6896
5524
|
declare interface PortableTextSlateEditor extends ReactEditor {
|
|
6897
5525
|
_key: 'editor'
|
|
6898
5526
|
_type: 'editor'
|
|
@@ -6926,162 +5554,6 @@ declare interface PortableTextSlateEditor extends ReactEditor {
|
|
|
6926
5554
|
redo: () => void
|
|
6927
5555
|
}
|
|
6928
5556
|
|
|
6929
|
-
/** @alpha */
|
|
6930
|
-
declare interface PortableTextSpan {
|
|
6931
|
-
_key: string
|
|
6932
|
-
_type: 'span'
|
|
6933
|
-
text: string
|
|
6934
|
-
marks?: string[]
|
|
6935
|
-
}
|
|
6936
|
-
|
|
6937
|
-
/** @alpha */
|
|
6938
|
-
declare interface PortableTextTextBlock<
|
|
6939
|
-
TChild = PortableTextSpan | PortableTextObject,
|
|
6940
|
-
> {
|
|
6941
|
-
_type: string
|
|
6942
|
-
_key: string
|
|
6943
|
-
children: TChild[]
|
|
6944
|
-
markDefs?: PortableTextObject[]
|
|
6945
|
-
listItem?: string
|
|
6946
|
-
style?: string
|
|
6947
|
-
level?: number
|
|
6948
|
-
}
|
|
6949
|
-
|
|
6950
|
-
/** @public */
|
|
6951
|
-
declare interface PrepareViewOptions {
|
|
6952
|
-
/** @beta */
|
|
6953
|
-
ordering?: SortOrdering
|
|
6954
|
-
}
|
|
6955
|
-
|
|
6956
|
-
/** @public */
|
|
6957
|
-
declare interface PreviewConfig<
|
|
6958
|
-
Select extends Record<string, string> = Record<string, string>,
|
|
6959
|
-
PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,
|
|
6960
|
-
> {
|
|
6961
|
-
select?: Select
|
|
6962
|
-
prepare?: (
|
|
6963
|
-
value: PrepareValue,
|
|
6964
|
-
viewOptions?: PrepareViewOptions,
|
|
6965
|
-
) => PreviewValue
|
|
6966
|
-
}
|
|
6967
|
-
|
|
6968
|
-
/** @public */
|
|
6969
|
-
declare interface PreviewValue {
|
|
6970
|
-
_id?: string
|
|
6971
|
-
_createdAt?: string
|
|
6972
|
-
_updatedAt?: string
|
|
6973
|
-
title?: string
|
|
6974
|
-
subtitle?: string
|
|
6975
|
-
description?: string
|
|
6976
|
-
media?: ReactNode | ElementType
|
|
6977
|
-
imageUrl?: string
|
|
6978
|
-
}
|
|
6979
|
-
|
|
6980
|
-
/** @public */
|
|
6981
|
-
declare interface Reference {
|
|
6982
|
-
_type: string
|
|
6983
|
-
_ref: string
|
|
6984
|
-
_key?: string
|
|
6985
|
-
_weak?: boolean
|
|
6986
|
-
_strengthenOnPublish?: {
|
|
6987
|
-
type: string
|
|
6988
|
-
weak?: boolean
|
|
6989
|
-
template?: {
|
|
6990
|
-
id: string
|
|
6991
|
-
params: Record<string, string | number | boolean>
|
|
6992
|
-
}
|
|
6993
|
-
}
|
|
6994
|
-
}
|
|
6995
|
-
|
|
6996
|
-
/** @public */
|
|
6997
|
-
declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
|
|
6998
|
-
disableNew?: boolean
|
|
6999
|
-
}
|
|
7000
|
-
|
|
7001
|
-
/** @public */
|
|
7002
|
-
declare interface ReferenceDefinition extends BaseSchemaDefinition {
|
|
7003
|
-
type: 'reference'
|
|
7004
|
-
to: ReferenceTo
|
|
7005
|
-
weak?: boolean
|
|
7006
|
-
options?: ReferenceOptions
|
|
7007
|
-
validation?: ValidationBuilder<ReferenceRule, ReferenceValue>
|
|
7008
|
-
initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>
|
|
7009
|
-
}
|
|
7010
|
-
|
|
7011
|
-
/** @public */
|
|
7012
|
-
declare type ReferenceFilterOptions =
|
|
7013
|
-
| ReferenceFilterResolverOptions
|
|
7014
|
-
| ReferenceFilterQueryOptions
|
|
7015
|
-
|
|
7016
|
-
/** @public */
|
|
7017
|
-
declare interface ReferenceFilterQueryOptions {
|
|
7018
|
-
filter: string
|
|
7019
|
-
filterParams?: Record<string, unknown>
|
|
7020
|
-
}
|
|
7021
|
-
|
|
7022
|
-
/** @public */
|
|
7023
|
-
declare type ReferenceFilterResolver = (
|
|
7024
|
-
context: ReferenceFilterResolverContext,
|
|
7025
|
-
) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>
|
|
7026
|
-
|
|
7027
|
-
/** @public */
|
|
7028
|
-
declare interface ReferenceFilterResolverContext {
|
|
7029
|
-
document: SanityDocument
|
|
7030
|
-
parent?: Record<string, unknown> | Record<string, unknown>[]
|
|
7031
|
-
parentPath: Path
|
|
7032
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
7033
|
-
}
|
|
7034
|
-
|
|
7035
|
-
/** @public */
|
|
7036
|
-
declare interface ReferenceFilterResolverOptions {
|
|
7037
|
-
filter?: ReferenceFilterResolver
|
|
7038
|
-
filterParams?: never
|
|
7039
|
-
}
|
|
7040
|
-
|
|
7041
|
-
/** @public */
|
|
7042
|
-
declare type ReferenceFilterSearchOptions = {
|
|
7043
|
-
filter?: string
|
|
7044
|
-
params?: Record<string, unknown>
|
|
7045
|
-
tag?: string
|
|
7046
|
-
maxFieldDepth?: number
|
|
7047
|
-
strategy?: SearchStrategy
|
|
7048
|
-
perspective?: ClientPerspective
|
|
7049
|
-
}
|
|
7050
|
-
|
|
7051
|
-
/**
|
|
7052
|
-
* Types are closed for extension. To add properties via declaration merging to this type,
|
|
7053
|
-
* redeclare and add the properties to the interfaces that make up ReferenceOptions type.
|
|
7054
|
-
*
|
|
7055
|
-
* @see ReferenceFilterOptions
|
|
7056
|
-
* @see ReferenceFilterResolverOptions
|
|
7057
|
-
* @see ReferenceBaseOptions
|
|
7058
|
-
*
|
|
7059
|
-
* @public
|
|
7060
|
-
*/
|
|
7061
|
-
declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions
|
|
7062
|
-
|
|
7063
|
-
/** @public */
|
|
7064
|
-
declare interface ReferenceRule
|
|
7065
|
-
extends RuleDef<ReferenceRule, ReferenceValue> {}
|
|
7066
|
-
|
|
7067
|
-
/** @public */
|
|
7068
|
-
declare interface ReferenceSchemaType
|
|
7069
|
-
extends Omit<ObjectSchemaType, 'options'> {
|
|
7070
|
-
jsonType: 'object'
|
|
7071
|
-
to: ObjectSchemaType[]
|
|
7072
|
-
weak?: boolean
|
|
7073
|
-
options?: ReferenceOptions
|
|
7074
|
-
}
|
|
7075
|
-
|
|
7076
|
-
/** @public */
|
|
7077
|
-
declare type ReferenceTo =
|
|
7078
|
-
| SchemaTypeDefinition
|
|
7079
|
-
| TypeReference
|
|
7080
|
-
| Array<SchemaTypeDefinition | TypeReference>
|
|
7081
|
-
|
|
7082
|
-
/** @public */
|
|
7083
|
-
declare type ReferenceValue = Reference
|
|
7084
|
-
|
|
7085
5557
|
/**************************************
|
|
7086
5558
|
* Resolve behavior event
|
|
7087
5559
|
**************************************/
|
|
@@ -7114,437 +5586,6 @@ export declare function reverseSelection<
|
|
|
7114
5586
|
TEditorSelection extends NonNullable<EditorSelection> | null,
|
|
7115
5587
|
>(selection: TEditorSelection): TEditorSelection
|
|
7116
5588
|
|
|
7117
|
-
/** @public */
|
|
7118
|
-
declare interface Role {
|
|
7119
|
-
name: string
|
|
7120
|
-
title: string
|
|
7121
|
-
description?: string
|
|
7122
|
-
}
|
|
7123
|
-
|
|
7124
|
-
/** @public */
|
|
7125
|
-
declare interface Rule {
|
|
7126
|
-
/**
|
|
7127
|
-
* @internal
|
|
7128
|
-
* @deprecated internal use only
|
|
7129
|
-
*/
|
|
7130
|
-
_type: RuleTypeConstraint | undefined
|
|
7131
|
-
/**
|
|
7132
|
-
* @internal
|
|
7133
|
-
* @deprecated internal use only
|
|
7134
|
-
*/
|
|
7135
|
-
_level: 'error' | 'warning' | 'info' | undefined
|
|
7136
|
-
/**
|
|
7137
|
-
* @internal
|
|
7138
|
-
* @deprecated internal use only
|
|
7139
|
-
*/
|
|
7140
|
-
_required: 'required' | 'optional' | undefined
|
|
7141
|
-
/**
|
|
7142
|
-
* @internal
|
|
7143
|
-
* @deprecated internal use only
|
|
7144
|
-
*/
|
|
7145
|
-
_typeDef: SchemaType | undefined
|
|
7146
|
-
/**
|
|
7147
|
-
* @internal
|
|
7148
|
-
* @deprecated internal use only
|
|
7149
|
-
*/
|
|
7150
|
-
_message: string | LocalizedValidationMessages | undefined
|
|
7151
|
-
/**
|
|
7152
|
-
* @internal
|
|
7153
|
-
* @deprecated internal use only
|
|
7154
|
-
*/
|
|
7155
|
-
_rules: RuleSpec[]
|
|
7156
|
-
/**
|
|
7157
|
-
* @internal
|
|
7158
|
-
* @deprecated internal use only
|
|
7159
|
-
*/
|
|
7160
|
-
_fieldRules: FieldRules | undefined
|
|
7161
|
-
/**
|
|
7162
|
-
* Takes in a path and returns an object with a symbol.
|
|
7163
|
-
*
|
|
7164
|
-
* When the validation lib sees this symbol, it will use the provided path to
|
|
7165
|
-
* get a value from the current field's parent and use that value as the input
|
|
7166
|
-
* to the Rule.
|
|
7167
|
-
*
|
|
7168
|
-
* The path that's given is forwarded to `lodash/get`
|
|
7169
|
-
*
|
|
7170
|
-
* ```js
|
|
7171
|
-
* fields: [
|
|
7172
|
-
* // ...
|
|
7173
|
-
* {
|
|
7174
|
-
* // ...
|
|
7175
|
-
* name: 'highestTemperature',
|
|
7176
|
-
* type: 'number',
|
|
7177
|
-
* validation: (Rule) => Rule.positive().min(Rule.valueOfField('lowestTemperature')),
|
|
7178
|
-
* // ...
|
|
7179
|
-
* },
|
|
7180
|
-
* ]
|
|
7181
|
-
* ```
|
|
7182
|
-
*/
|
|
7183
|
-
valueOfField: (path: string | string[]) => FieldReference
|
|
7184
|
-
error(message?: string | LocalizedValidationMessages): Rule
|
|
7185
|
-
warning(message?: string | LocalizedValidationMessages): Rule
|
|
7186
|
-
info(message?: string | LocalizedValidationMessages): Rule
|
|
7187
|
-
reset(): this
|
|
7188
|
-
isRequired(): boolean
|
|
7189
|
-
clone(): Rule
|
|
7190
|
-
cloneWithRules(rules: RuleSpec[]): Rule
|
|
7191
|
-
merge(rule: Rule): Rule
|
|
7192
|
-
type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule
|
|
7193
|
-
all(children: Rule[]): Rule
|
|
7194
|
-
either(children: Rule[]): Rule
|
|
7195
|
-
optional(): Rule
|
|
7196
|
-
required(): Rule
|
|
7197
|
-
custom<T = unknown>(
|
|
7198
|
-
fn: CustomValidator<T>,
|
|
7199
|
-
options?: {
|
|
7200
|
-
bypassConcurrencyLimit?: boolean
|
|
7201
|
-
},
|
|
7202
|
-
): Rule
|
|
7203
|
-
min(len: number | string | FieldReference): Rule
|
|
7204
|
-
max(len: number | string | FieldReference): Rule
|
|
7205
|
-
length(len: number | FieldReference): Rule
|
|
7206
|
-
valid(value: unknown | unknown[]): Rule
|
|
7207
|
-
integer(): Rule
|
|
7208
|
-
precision(limit: number | FieldReference): Rule
|
|
7209
|
-
positive(): Rule
|
|
7210
|
-
negative(): Rule
|
|
7211
|
-
greaterThan(num: number | FieldReference): Rule
|
|
7212
|
-
lessThan(num: number | FieldReference): Rule
|
|
7213
|
-
uppercase(): Rule
|
|
7214
|
-
lowercase(): Rule
|
|
7215
|
-
regex(
|
|
7216
|
-
pattern: RegExp,
|
|
7217
|
-
name: string,
|
|
7218
|
-
options: {
|
|
7219
|
-
name?: string
|
|
7220
|
-
invert?: boolean
|
|
7221
|
-
},
|
|
7222
|
-
): Rule
|
|
7223
|
-
regex(
|
|
7224
|
-
pattern: RegExp,
|
|
7225
|
-
options: {
|
|
7226
|
-
name?: string
|
|
7227
|
-
invert?: boolean
|
|
7228
|
-
},
|
|
7229
|
-
): Rule
|
|
7230
|
-
regex(pattern: RegExp, name: string): Rule
|
|
7231
|
-
regex(pattern: RegExp): Rule
|
|
7232
|
-
email(): Rule
|
|
7233
|
-
uri(options?: UriValidationOptions): Rule
|
|
7234
|
-
unique(): Rule
|
|
7235
|
-
reference(): Rule
|
|
7236
|
-
fields(rules: FieldRules): Rule
|
|
7237
|
-
assetRequired(): Rule
|
|
7238
|
-
validate(
|
|
7239
|
-
value: unknown,
|
|
7240
|
-
options: ValidationContext & {
|
|
7241
|
-
/**
|
|
7242
|
-
* @deprecated Internal use only
|
|
7243
|
-
* @internal
|
|
7244
|
-
*/
|
|
7245
|
-
__internal?: {
|
|
7246
|
-
customValidationConcurrencyLimiter?: {
|
|
7247
|
-
ready: () => Promise<void>
|
|
7248
|
-
release: () => void
|
|
7249
|
-
}
|
|
7250
|
-
}
|
|
7251
|
-
},
|
|
7252
|
-
): Promise<ValidationMarker[]>
|
|
7253
|
-
}
|
|
7254
|
-
|
|
7255
|
-
/** @public */
|
|
7256
|
-
declare type RuleBuilder<
|
|
7257
|
-
T extends RuleDef<T, FieldValue>,
|
|
7258
|
-
FieldValue = unknown,
|
|
7259
|
-
> = T | T[]
|
|
7260
|
-
|
|
7261
|
-
/** @public */
|
|
7262
|
-
declare interface RuleDef<T, FieldValue = unknown> {
|
|
7263
|
-
required: () => T
|
|
7264
|
-
custom: <LenientFieldValue extends FieldValue>(
|
|
7265
|
-
fn: CustomValidator<LenientFieldValue | undefined>,
|
|
7266
|
-
) => T
|
|
7267
|
-
info: (message?: string | LocalizedValidationMessages) => T
|
|
7268
|
-
error: (message?: string | LocalizedValidationMessages) => T
|
|
7269
|
-
warning: (message?: string | LocalizedValidationMessages) => T
|
|
7270
|
-
valueOfField: (path: string | string[]) => FieldReference
|
|
7271
|
-
}
|
|
7272
|
-
|
|
7273
|
-
/** @public */
|
|
7274
|
-
declare type RuleSpec =
|
|
7275
|
-
| {
|
|
7276
|
-
flag: 'integer'
|
|
7277
|
-
}
|
|
7278
|
-
| {
|
|
7279
|
-
flag: 'email'
|
|
7280
|
-
}
|
|
7281
|
-
| {
|
|
7282
|
-
flag: 'unique'
|
|
7283
|
-
}
|
|
7284
|
-
| {
|
|
7285
|
-
flag: 'reference'
|
|
7286
|
-
}
|
|
7287
|
-
| {
|
|
7288
|
-
flag: 'type'
|
|
7289
|
-
constraint: RuleTypeConstraint
|
|
7290
|
-
}
|
|
7291
|
-
| {
|
|
7292
|
-
flag: 'all'
|
|
7293
|
-
constraint: Rule[]
|
|
7294
|
-
}
|
|
7295
|
-
| {
|
|
7296
|
-
flag: 'either'
|
|
7297
|
-
constraint: Rule[]
|
|
7298
|
-
}
|
|
7299
|
-
| {
|
|
7300
|
-
flag: 'presence'
|
|
7301
|
-
constraint: 'optional' | 'required'
|
|
7302
|
-
}
|
|
7303
|
-
| {
|
|
7304
|
-
flag: 'custom'
|
|
7305
|
-
constraint: CustomValidator
|
|
7306
|
-
}
|
|
7307
|
-
| {
|
|
7308
|
-
flag: 'min'
|
|
7309
|
-
constraint: number | string
|
|
7310
|
-
}
|
|
7311
|
-
| {
|
|
7312
|
-
flag: 'max'
|
|
7313
|
-
constraint: number | string
|
|
7314
|
-
}
|
|
7315
|
-
| {
|
|
7316
|
-
flag: 'length'
|
|
7317
|
-
constraint: number
|
|
7318
|
-
}
|
|
7319
|
-
| {
|
|
7320
|
-
flag: 'valid'
|
|
7321
|
-
constraint: unknown[]
|
|
7322
|
-
}
|
|
7323
|
-
| {
|
|
7324
|
-
flag: 'precision'
|
|
7325
|
-
constraint: number
|
|
7326
|
-
}
|
|
7327
|
-
| {
|
|
7328
|
-
flag: 'lessThan'
|
|
7329
|
-
constraint: number
|
|
7330
|
-
}
|
|
7331
|
-
| {
|
|
7332
|
-
flag: 'greaterThan'
|
|
7333
|
-
constraint: number
|
|
7334
|
-
}
|
|
7335
|
-
| {
|
|
7336
|
-
flag: 'stringCasing'
|
|
7337
|
-
constraint: 'uppercase' | 'lowercase'
|
|
7338
|
-
}
|
|
7339
|
-
| {
|
|
7340
|
-
flag: 'assetRequired'
|
|
7341
|
-
constraint: {
|
|
7342
|
-
assetType: 'asset' | 'image' | 'file'
|
|
7343
|
-
}
|
|
7344
|
-
}
|
|
7345
|
-
| {
|
|
7346
|
-
flag: 'regex'
|
|
7347
|
-
constraint: {
|
|
7348
|
-
pattern: RegExp
|
|
7349
|
-
name?: string
|
|
7350
|
-
invert: boolean
|
|
7351
|
-
}
|
|
7352
|
-
}
|
|
7353
|
-
| {
|
|
7354
|
-
flag: 'uri'
|
|
7355
|
-
constraint: {
|
|
7356
|
-
options: {
|
|
7357
|
-
scheme: RegExp[]
|
|
7358
|
-
allowRelative: boolean
|
|
7359
|
-
relativeOnly: boolean
|
|
7360
|
-
allowCredentials: boolean
|
|
7361
|
-
}
|
|
7362
|
-
}
|
|
7363
|
-
}
|
|
7364
|
-
|
|
7365
|
-
/** @public */
|
|
7366
|
-
declare type RuleTypeConstraint =
|
|
7367
|
-
| 'Array'
|
|
7368
|
-
| 'Boolean'
|
|
7369
|
-
| 'Date'
|
|
7370
|
-
| 'Number'
|
|
7371
|
-
| 'Object'
|
|
7372
|
-
| 'String'
|
|
7373
|
-
|
|
7374
|
-
/**
|
|
7375
|
-
* Options for configuring how Sanity Create interfaces with the type or field.
|
|
7376
|
-
*
|
|
7377
|
-
* @public
|
|
7378
|
-
*/
|
|
7379
|
-
declare interface SanityCreateOptions {
|
|
7380
|
-
/** Set to true to exclude a type or field from appearing in Sanity Create */
|
|
7381
|
-
exclude?: boolean
|
|
7382
|
-
/**
|
|
7383
|
-
* A short description of what the type or field is used for.
|
|
7384
|
-
* Purpose can be used to improve how and when content mapping uses the field.
|
|
7385
|
-
* */
|
|
7386
|
-
purpose?: string
|
|
7387
|
-
}
|
|
7388
|
-
|
|
7389
|
-
/** @public */
|
|
7390
|
-
declare interface SanityDocument {
|
|
7391
|
-
_id: string
|
|
7392
|
-
_type: string
|
|
7393
|
-
_createdAt: string
|
|
7394
|
-
_updatedAt: string
|
|
7395
|
-
_rev: string
|
|
7396
|
-
[key: string]: unknown
|
|
7397
|
-
}
|
|
7398
|
-
|
|
7399
|
-
/** @public */
|
|
7400
|
-
declare interface Schema {
|
|
7401
|
-
/** @internal */
|
|
7402
|
-
_original?: {
|
|
7403
|
-
name: string
|
|
7404
|
-
types: SchemaTypeDefinition[]
|
|
7405
|
-
}
|
|
7406
|
-
/** @internal */
|
|
7407
|
-
_registry: {
|
|
7408
|
-
[typeName: string]: any
|
|
7409
|
-
}
|
|
7410
|
-
/** @internal */
|
|
7411
|
-
_validation?: SchemaValidationProblemGroup[]
|
|
7412
|
-
name: string
|
|
7413
|
-
get: (name: string) => SchemaType | undefined
|
|
7414
|
-
has: (name: string) => boolean
|
|
7415
|
-
getTypeNames: () => string[]
|
|
7416
|
-
}
|
|
7417
|
-
|
|
7418
|
-
/**
|
|
7419
|
-
* Note: you probably want `SchemaTypeDefinition` instead
|
|
7420
|
-
* @see SchemaTypeDefinition
|
|
7421
|
-
*
|
|
7422
|
-
* @public
|
|
7423
|
-
*/
|
|
7424
|
-
declare type SchemaType =
|
|
7425
|
-
| ArraySchemaType
|
|
7426
|
-
| BooleanSchemaType
|
|
7427
|
-
| FileSchemaType
|
|
7428
|
-
| NumberSchemaType
|
|
7429
|
-
| ObjectSchemaType
|
|
7430
|
-
| StringSchemaType
|
|
7431
|
-
| ReferenceSchemaType
|
|
7432
|
-
|
|
7433
|
-
/**
|
|
7434
|
-
* Represents a Sanity schema type definition with an optional type parameter.
|
|
7435
|
-
*
|
|
7436
|
-
* It's recommend to use the `defineType` helper instead of this type by
|
|
7437
|
-
* itself.
|
|
7438
|
-
*
|
|
7439
|
-
* @see defineType
|
|
7440
|
-
*
|
|
7441
|
-
* @public
|
|
7442
|
-
*/
|
|
7443
|
-
declare type SchemaTypeDefinition<
|
|
7444
|
-
TType extends IntrinsicTypeName = IntrinsicTypeName,
|
|
7445
|
-
> = IntrinsicDefinitions[IntrinsicTypeName] | TypeAliasDefinition<string, TType>
|
|
7446
|
-
|
|
7447
|
-
/** @public */
|
|
7448
|
-
declare interface SchemaValidationError {
|
|
7449
|
-
helpId?: string
|
|
7450
|
-
message: string
|
|
7451
|
-
severity: 'error'
|
|
7452
|
-
}
|
|
7453
|
-
|
|
7454
|
-
/** @internal */
|
|
7455
|
-
declare type SchemaValidationProblem =
|
|
7456
|
-
| SchemaValidationError
|
|
7457
|
-
| SchemaValidationWarning
|
|
7458
|
-
|
|
7459
|
-
/** @internal */
|
|
7460
|
-
declare interface SchemaValidationProblemGroup {
|
|
7461
|
-
path: SchemaValidationProblemPath
|
|
7462
|
-
problems: SchemaValidationProblem[]
|
|
7463
|
-
}
|
|
7464
|
-
|
|
7465
|
-
/** @internal */
|
|
7466
|
-
declare type SchemaValidationProblemPath = Array<
|
|
7467
|
-
| {
|
|
7468
|
-
kind: 'type'
|
|
7469
|
-
type: string
|
|
7470
|
-
name?: string
|
|
7471
|
-
}
|
|
7472
|
-
| {
|
|
7473
|
-
kind: 'property'
|
|
7474
|
-
name: string
|
|
7475
|
-
}
|
|
7476
|
-
>
|
|
7477
|
-
|
|
7478
|
-
/**
|
|
7479
|
-
* Represents the possible values of a schema type's `validation` field.
|
|
7480
|
-
*
|
|
7481
|
-
* If the schema has not been run through `inferFromSchema` from
|
|
7482
|
-
* `sanity/validation` then value could be a function.
|
|
7483
|
-
*
|
|
7484
|
-
* `inferFromSchema` mutates the schema converts this value to an array of
|
|
7485
|
-
* `Rule` instances.
|
|
7486
|
-
*
|
|
7487
|
-
* @privateRemarks
|
|
7488
|
-
*
|
|
7489
|
-
* Usage of the schema inside the studio will almost always be from the compiled
|
|
7490
|
-
* `createSchema` function. In this case, you can cast the value or throw to
|
|
7491
|
-
* narrow the type. E.g.:
|
|
7492
|
-
*
|
|
7493
|
-
* ```ts
|
|
7494
|
-
* if (typeof type.validation === 'function') {
|
|
7495
|
-
* throw new Error(
|
|
7496
|
-
* `Schema type "${type.name}"'s \`validation\` was not run though \`inferFromSchema\``
|
|
7497
|
-
* )
|
|
7498
|
-
* }
|
|
7499
|
-
* ```
|
|
7500
|
-
*
|
|
7501
|
-
* @public
|
|
7502
|
-
*/
|
|
7503
|
-
declare type SchemaValidationValue =
|
|
7504
|
-
| false
|
|
7505
|
-
| undefined
|
|
7506
|
-
| Rule
|
|
7507
|
-
| SchemaValidationValue[]
|
|
7508
|
-
| ((rule: Rule) => SchemaValidationValue)
|
|
7509
|
-
|
|
7510
|
-
/** @internal */
|
|
7511
|
-
declare interface SchemaValidationWarning {
|
|
7512
|
-
helpId?: string
|
|
7513
|
-
message: string
|
|
7514
|
-
severity: 'warning'
|
|
7515
|
-
}
|
|
7516
|
-
|
|
7517
|
-
/** @public */
|
|
7518
|
-
declare interface SearchConfiguration {
|
|
7519
|
-
search?: {
|
|
7520
|
-
/**
|
|
7521
|
-
* Defines a search weight for this field to prioritize its importance
|
|
7522
|
-
* during search operations in the Studio. This setting allows the specified
|
|
7523
|
-
* field to be ranked higher in search results compared to other fields.
|
|
7524
|
-
*
|
|
7525
|
-
* By default, all fields are assigned a weight of 1. However, if a field is
|
|
7526
|
-
* chosen as the `title` in the preview configuration's `select` option, it
|
|
7527
|
-
* will automatically receive a default weight of 10. Similarly, if selected
|
|
7528
|
-
* as the `subtitle`, the default weight is 5. Fields marked as
|
|
7529
|
-
* `hidden: true` (no function) are assigned a weight of 0 by default.
|
|
7530
|
-
*
|
|
7531
|
-
* Note: Search weight configuration is currently supported only for fields
|
|
7532
|
-
* of type string or portable text arrays.
|
|
7533
|
-
*/
|
|
7534
|
-
weight?: number
|
|
7535
|
-
}
|
|
7536
|
-
}
|
|
7537
|
-
|
|
7538
|
-
/**
|
|
7539
|
-
* @public
|
|
7540
|
-
*/
|
|
7541
|
-
declare const searchStrategies: readonly ['groqLegacy', 'groq2024']
|
|
7542
|
-
|
|
7543
|
-
/**
|
|
7544
|
-
* @public
|
|
7545
|
-
*/
|
|
7546
|
-
declare type SearchStrategy = (typeof searchStrategies)[number]
|
|
7547
|
-
|
|
7548
5589
|
/**
|
|
7549
5590
|
* @public
|
|
7550
5591
|
*/
|
|
@@ -7568,15 +5609,6 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
7568
5609
|
'serialization.success' | 'serialization.failure'
|
|
7569
5610
|
>
|
|
7570
5611
|
|
|
7571
|
-
/** @public */
|
|
7572
|
-
declare interface SingleFieldSet {
|
|
7573
|
-
single: true
|
|
7574
|
-
field: ObjectField
|
|
7575
|
-
hidden?: ConditionalProperty
|
|
7576
|
-
readOnly?: ConditionalProperty
|
|
7577
|
-
group?: string | string[]
|
|
7578
|
-
}
|
|
7579
|
-
|
|
7580
5612
|
/**
|
|
7581
5613
|
* @public
|
|
7582
5614
|
*/
|
|
@@ -7588,94 +5620,6 @@ export declare function sliceBlocks({
|
|
|
7588
5620
|
blocks: Array<PortableTextBlock>
|
|
7589
5621
|
}): Array<PortableTextBlock>
|
|
7590
5622
|
|
|
7591
|
-
/** @public */
|
|
7592
|
-
declare interface SlugDefinition extends BaseSchemaDefinition {
|
|
7593
|
-
type: 'slug'
|
|
7594
|
-
options?: SlugOptions
|
|
7595
|
-
validation?: ValidationBuilder<SlugRule, SlugValue>
|
|
7596
|
-
initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>
|
|
7597
|
-
}
|
|
7598
|
-
|
|
7599
|
-
/** @public */
|
|
7600
|
-
declare type SlugifierFn = (
|
|
7601
|
-
source: string,
|
|
7602
|
-
schemaType: SlugSchemaType,
|
|
7603
|
-
context: SlugSourceContext,
|
|
7604
|
-
) => string | Promise<string>
|
|
7605
|
-
|
|
7606
|
-
/** @public */
|
|
7607
|
-
declare type SlugIsUniqueValidator = (
|
|
7608
|
-
slug: string,
|
|
7609
|
-
context: SlugValidationContext,
|
|
7610
|
-
) => boolean | Promise<boolean>
|
|
7611
|
-
|
|
7612
|
-
/** @public */
|
|
7613
|
-
declare interface SlugOptions
|
|
7614
|
-
extends SearchConfiguration,
|
|
7615
|
-
BaseSchemaTypeOptions {
|
|
7616
|
-
source?: string | Path | SlugSourceFn
|
|
7617
|
-
maxLength?: number
|
|
7618
|
-
slugify?: SlugifierFn
|
|
7619
|
-
isUnique?: SlugIsUniqueValidator
|
|
7620
|
-
disableArrayWarning?: boolean
|
|
7621
|
-
}
|
|
7622
|
-
|
|
7623
|
-
/** @public */
|
|
7624
|
-
declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]
|
|
7625
|
-
|
|
7626
|
-
/** @public */
|
|
7627
|
-
declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
|
|
7628
|
-
|
|
7629
|
-
/** @public */
|
|
7630
|
-
declare interface SlugSchemaType extends ObjectSchemaType {
|
|
7631
|
-
jsonType: 'object'
|
|
7632
|
-
options?: SlugOptions
|
|
7633
|
-
}
|
|
7634
|
-
|
|
7635
|
-
/** @public */
|
|
7636
|
-
declare interface SlugSourceContext {
|
|
7637
|
-
parentPath: Path
|
|
7638
|
-
parent: SlugParent
|
|
7639
|
-
projectId: string
|
|
7640
|
-
dataset: string
|
|
7641
|
-
schema: Schema
|
|
7642
|
-
currentUser: CurrentUser | null
|
|
7643
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
7644
|
-
}
|
|
7645
|
-
|
|
7646
|
-
/** @public */
|
|
7647
|
-
declare type SlugSourceFn = (
|
|
7648
|
-
document: SanityDocument,
|
|
7649
|
-
context: SlugSourceContext,
|
|
7650
|
-
) => string | Promise<string>
|
|
7651
|
-
|
|
7652
|
-
/** @public */
|
|
7653
|
-
declare interface SlugValidationContext extends ValidationContext {
|
|
7654
|
-
parent: SlugParent
|
|
7655
|
-
type: SlugSchemaType
|
|
7656
|
-
defaultIsUnique: SlugIsUniqueValidator
|
|
7657
|
-
}
|
|
7658
|
-
|
|
7659
|
-
/** @public */
|
|
7660
|
-
declare interface SlugValue {
|
|
7661
|
-
_type: 'slug'
|
|
7662
|
-
current?: string
|
|
7663
|
-
}
|
|
7664
|
-
|
|
7665
|
-
/** @beta */
|
|
7666
|
-
declare type SortOrdering = {
|
|
7667
|
-
title: string
|
|
7668
|
-
i18n?: I18nTextRecord<'title'>
|
|
7669
|
-
name: string
|
|
7670
|
-
by: SortOrderingItem[]
|
|
7671
|
-
}
|
|
7672
|
-
|
|
7673
|
-
/** @beta */
|
|
7674
|
-
declare interface SortOrderingItem {
|
|
7675
|
-
field: string
|
|
7676
|
-
direction: 'asc' | 'desc'
|
|
7677
|
-
}
|
|
7678
|
-
|
|
7679
5623
|
/**
|
|
7680
5624
|
* @public
|
|
7681
5625
|
*/
|
|
@@ -7707,60 +5651,6 @@ export declare function splitTextBlock({
|
|
|
7707
5651
|
|
|
7708
5652
|
declare type StrictExtract<T, U extends T> = U
|
|
7709
5653
|
|
|
7710
|
-
/** @public */
|
|
7711
|
-
declare interface StringDefinition extends BaseSchemaDefinition {
|
|
7712
|
-
type: 'string'
|
|
7713
|
-
options?: StringOptions
|
|
7714
|
-
placeholder?: string
|
|
7715
|
-
validation?: ValidationBuilder<StringRule, string>
|
|
7716
|
-
initialValue?: InitialValueProperty<any, string>
|
|
7717
|
-
}
|
|
7718
|
-
|
|
7719
|
-
/** @public */
|
|
7720
|
-
declare interface StringOptions
|
|
7721
|
-
extends EnumListProps<string>,
|
|
7722
|
-
SearchConfiguration,
|
|
7723
|
-
BaseSchemaTypeOptions {}
|
|
7724
|
-
|
|
7725
|
-
/** @public */
|
|
7726
|
-
declare interface StringRule extends RuleDef<StringRule, string> {
|
|
7727
|
-
min: (minNumber: number | FieldReference) => StringRule
|
|
7728
|
-
max: (maxNumber: number | FieldReference) => StringRule
|
|
7729
|
-
length: (exactLength: number | FieldReference) => StringRule
|
|
7730
|
-
uppercase: () => StringRule
|
|
7731
|
-
lowercase: () => StringRule
|
|
7732
|
-
regex(
|
|
7733
|
-
pattern: RegExp,
|
|
7734
|
-
name: string,
|
|
7735
|
-
options: {
|
|
7736
|
-
name?: string
|
|
7737
|
-
invert?: boolean
|
|
7738
|
-
},
|
|
7739
|
-
): StringRule
|
|
7740
|
-
regex(
|
|
7741
|
-
pattern: RegExp,
|
|
7742
|
-
options: {
|
|
7743
|
-
name?: string
|
|
7744
|
-
invert?: boolean
|
|
7745
|
-
},
|
|
7746
|
-
): StringRule
|
|
7747
|
-
regex(pattern: RegExp, name: string): StringRule
|
|
7748
|
-
regex(pattern: RegExp): StringRule
|
|
7749
|
-
email(): StringRule
|
|
7750
|
-
}
|
|
7751
|
-
|
|
7752
|
-
/**
|
|
7753
|
-
* This is used for string, text, date and datetime.
|
|
7754
|
-
* This interface represent the compiled version at runtime, when accessed through Schema.
|
|
7755
|
-
*
|
|
7756
|
-
* @public
|
|
7757
|
-
*/
|
|
7758
|
-
declare interface StringSchemaType extends BaseSchemaType {
|
|
7759
|
-
jsonType: 'string'
|
|
7760
|
-
options?: StringOptions & TextOptions & DateOptions & DatetimeOptions
|
|
7761
|
-
initialValue?: InitialValueProperty<any, string>
|
|
7762
|
-
}
|
|
7763
|
-
|
|
7764
5654
|
/**
|
|
7765
5655
|
* @beta
|
|
7766
5656
|
*/
|
|
@@ -7910,199 +5800,9 @@ declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
|
|
|
7910
5800
|
_key?: PortableTextTextBlock['_key']
|
|
7911
5801
|
}
|
|
7912
5802
|
|
|
7913
|
-
/** @public */
|
|
7914
|
-
declare interface TextDefinition extends BaseSchemaDefinition {
|
|
7915
|
-
type: 'text'
|
|
7916
|
-
rows?: number
|
|
7917
|
-
options?: TextOptions
|
|
7918
|
-
placeholder?: string
|
|
7919
|
-
validation?: ValidationBuilder<TextRule, string>
|
|
7920
|
-
initialValue?: InitialValueProperty<any, string>
|
|
7921
|
-
}
|
|
7922
|
-
|
|
7923
|
-
/** @public */
|
|
7924
|
-
declare interface TextOptions extends StringOptions {}
|
|
7925
|
-
|
|
7926
|
-
/** @public */
|
|
7927
|
-
declare interface TextRule extends StringRule {}
|
|
7928
|
-
|
|
7929
|
-
/** @public */
|
|
7930
|
-
declare interface TitledListValue<V = unknown> {
|
|
7931
|
-
_key?: string
|
|
7932
|
-
title: string
|
|
7933
|
-
value?: V
|
|
7934
|
-
}
|
|
7935
|
-
|
|
7936
|
-
/**
|
|
7937
|
-
* Represents a type definition that is an alias/extension of an existing type
|
|
7938
|
-
* in your schema. Creating a type alias will re-register that existing type
|
|
7939
|
-
* under a different name. You can also override the default type options with
|
|
7940
|
-
* a type alias definition.
|
|
7941
|
-
*
|
|
7942
|
-
* @public
|
|
7943
|
-
*/
|
|
7944
|
-
declare interface TypeAliasDefinition<
|
|
7945
|
-
TType extends string,
|
|
7946
|
-
TAlias extends IntrinsicTypeName | undefined,
|
|
7947
|
-
> extends BaseSchemaDefinition {
|
|
7948
|
-
type: TType
|
|
7949
|
-
options?: TAlias extends IntrinsicTypeName
|
|
7950
|
-
? IntrinsicDefinitions[TAlias]['options']
|
|
7951
|
-
: unknown
|
|
7952
|
-
validation?: SchemaValidationValue
|
|
7953
|
-
initialValue?: InitialValueProperty<any, any>
|
|
7954
|
-
preview?: PreviewConfig
|
|
7955
|
-
components?: {
|
|
7956
|
-
annotation?: ComponentType<any>
|
|
7957
|
-
block?: ComponentType<any>
|
|
7958
|
-
inlineBlock?: ComponentType<any>
|
|
7959
|
-
diff?: ComponentType<any>
|
|
7960
|
-
field?: ComponentType<any>
|
|
7961
|
-
input?: ComponentType<any>
|
|
7962
|
-
item?: ComponentType<any>
|
|
7963
|
-
preview?: ComponentType<any>
|
|
7964
|
-
}
|
|
7965
|
-
}
|
|
7966
|
-
|
|
7967
|
-
/**
|
|
7968
|
-
* Represents a reference to another type registered top-level in your schema.
|
|
7969
|
-
*
|
|
7970
|
-
* @public
|
|
7971
|
-
*/
|
|
7972
|
-
declare interface TypeReference {
|
|
7973
|
-
type: string
|
|
7974
|
-
name?: string
|
|
7975
|
-
icon?: ComponentType | ReactNode
|
|
7976
|
-
options?: {
|
|
7977
|
-
[key: string]: unknown
|
|
7978
|
-
}
|
|
7979
|
-
}
|
|
7980
|
-
|
|
7981
5803
|
declare type UnsetEvent = {
|
|
7982
5804
|
type: 'unset'
|
|
7983
5805
|
previousValue: Array<PortableTextBlock>
|
|
7984
5806
|
}
|
|
7985
5807
|
|
|
7986
|
-
/** @public */
|
|
7987
|
-
declare interface UriValidationOptions {
|
|
7988
|
-
scheme?: (string | RegExp) | Array<string | RegExp>
|
|
7989
|
-
allowRelative?: boolean
|
|
7990
|
-
relativeOnly?: boolean
|
|
7991
|
-
allowCredentials?: boolean
|
|
7992
|
-
}
|
|
7993
|
-
|
|
7994
|
-
/** @public */
|
|
7995
|
-
declare interface UrlDefinition extends BaseSchemaDefinition {
|
|
7996
|
-
type: 'url'
|
|
7997
|
-
options?: UrlOptions
|
|
7998
|
-
placeholder?: string
|
|
7999
|
-
validation?: ValidationBuilder<UrlRule, string>
|
|
8000
|
-
initialValue?: InitialValueProperty<any, string>
|
|
8001
|
-
}
|
|
8002
|
-
|
|
8003
|
-
/** @public */
|
|
8004
|
-
declare interface UrlOptions extends BaseSchemaTypeOptions {}
|
|
8005
|
-
|
|
8006
|
-
/** @public */
|
|
8007
|
-
declare interface UrlRule extends RuleDef<UrlRule, string> {
|
|
8008
|
-
uri(options: UriValidationOptions): UrlRule
|
|
8009
|
-
}
|
|
8010
|
-
|
|
8011
|
-
/** @public */
|
|
8012
|
-
declare type ValidationBuilder<
|
|
8013
|
-
T extends RuleDef<T, FieldValue>,
|
|
8014
|
-
FieldValue = unknown,
|
|
8015
|
-
> = (rule: T) => RuleBuilder<T, FieldValue>
|
|
8016
|
-
|
|
8017
|
-
/**
|
|
8018
|
-
* A context object passed around during validation. This includes the
|
|
8019
|
-
* `Rule.custom` context.
|
|
8020
|
-
*
|
|
8021
|
-
* e.g.
|
|
8022
|
-
*
|
|
8023
|
-
* ```js
|
|
8024
|
-
* Rule.custom((_, validationContext) => {
|
|
8025
|
-
* // ...
|
|
8026
|
-
* })`
|
|
8027
|
-
* ```
|
|
8028
|
-
*
|
|
8029
|
-
* @public
|
|
8030
|
-
*/
|
|
8031
|
-
declare interface ValidationContext {
|
|
8032
|
-
getClient: (options: {apiVersion: string}) => SanityClient
|
|
8033
|
-
schema: Schema
|
|
8034
|
-
parent?: unknown
|
|
8035
|
-
type?: SchemaType
|
|
8036
|
-
document?: SanityDocument
|
|
8037
|
-
path?: Path
|
|
8038
|
-
getDocumentExists?: (options: {id: string}) => Promise<boolean>
|
|
8039
|
-
environment: 'cli' | 'studio'
|
|
8040
|
-
}
|
|
8041
|
-
|
|
8042
|
-
/**
|
|
8043
|
-
* The shape that can be returned from a custom validator to be converted into
|
|
8044
|
-
* a validation marker by the validation logic. Inside of a custom validator,
|
|
8045
|
-
* you can return an array of these in order to specify multiple paths within
|
|
8046
|
-
* an object or array.
|
|
8047
|
-
*
|
|
8048
|
-
* @public
|
|
8049
|
-
*/
|
|
8050
|
-
declare interface ValidationError {
|
|
8051
|
-
/**
|
|
8052
|
-
* The message describing why the value is not valid. This message will be
|
|
8053
|
-
* included in the validation markers after validation has finished running.
|
|
8054
|
-
*/
|
|
8055
|
-
message: string
|
|
8056
|
-
/**
|
|
8057
|
-
* If writing a custom validator, you can return validation messages to
|
|
8058
|
-
* specific path inside of the current value (object or array) by populating
|
|
8059
|
-
* this `path` prop.
|
|
8060
|
-
*
|
|
8061
|
-
* NOTE: This path is relative to the current value and _not_ relative to
|
|
8062
|
-
* the document.
|
|
8063
|
-
*/
|
|
8064
|
-
path?: Path
|
|
8065
|
-
/**
|
|
8066
|
-
* Same as `path` but allows more than one value. If provided, the same
|
|
8067
|
-
* message will create two markers from each path with the same message
|
|
8068
|
-
* provided.
|
|
8069
|
-
*
|
|
8070
|
-
* @deprecated prefer `path`
|
|
8071
|
-
*/
|
|
8072
|
-
paths?: Path[]
|
|
8073
|
-
/**
|
|
8074
|
-
* @deprecated Unused. Was used to store the results from `.either()` /`.all()`
|
|
8075
|
-
*/
|
|
8076
|
-
children?: ValidationMarker[]
|
|
8077
|
-
/**
|
|
8078
|
-
* @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
|
|
8079
|
-
*/
|
|
8080
|
-
operation?: 'AND' | 'OR'
|
|
8081
|
-
/**
|
|
8082
|
-
* @deprecated Unused. Was relevant when validation error was used as a class.
|
|
8083
|
-
*/
|
|
8084
|
-
cloneWithMessage?(message: string): ValidationError
|
|
8085
|
-
}
|
|
8086
|
-
|
|
8087
|
-
/** @public */
|
|
8088
|
-
declare interface ValidationMarker {
|
|
8089
|
-
level: 'error' | 'warning' | 'info'
|
|
8090
|
-
/**
|
|
8091
|
-
* The validation message for this marker. E.g. "Must be greater than 0"
|
|
8092
|
-
*/
|
|
8093
|
-
message: string
|
|
8094
|
-
/**
|
|
8095
|
-
* @deprecated use `message` instead
|
|
8096
|
-
*/
|
|
8097
|
-
item?: ValidationError
|
|
8098
|
-
/**
|
|
8099
|
-
* The sanity path _relative to the root of the current document_ to this
|
|
8100
|
-
* marker.
|
|
8101
|
-
*
|
|
8102
|
-
* NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
|
|
8103
|
-
* are not compatible with deep getters like lodash/get
|
|
8104
|
-
*/
|
|
8105
|
-
path: Path
|
|
8106
|
-
}
|
|
8107
|
-
|
|
8108
5808
|
export {}
|