@portabletext/editor 3.3.9 → 3.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-dts/index.d.ts +31 -2082
- package/lib/behaviors/index.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/plugins/index.d.ts +1 -1
- package/lib/selectors/index.d.ts +2 -1
- package/lib/utils/index.d.ts +10 -8
- package/package.json +6 -6
|
@@ -1,2067 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import * as react17 from "react";
|
|
4
|
-
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, ComponentType, ElementType, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, ReactNode, RefObject, TextareaHTMLAttributes } from "react";
|
|
1
|
+
import * as _sanity_types4 from "@sanity/types";
|
|
2
|
+
import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, ObjectSchemaType, Path, PortableTextBlock, PortableTextBlock as PortableTextBlock$1, PortableTextChild, PortableTextChild as PortableTextChild$1, PortableTextListBlock, PortableTextObject, PortableTextObject as PortableTextObject$2, PortableTextSpan, PortableTextSpan as PortableTextSpan$2, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$2, TypedObject } from "@sanity/types";
|
|
5
3
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
6
4
|
import * as xstate228 from "xstate";
|
|
7
5
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
6
|
+
import * as react18 from "react";
|
|
7
|
+
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
8
8
|
import { Patch, Patch as Patch$1 } from "@portabletext/patches";
|
|
9
9
|
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
10
|
-
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, PortableTextObject, PortableTextSpan, PortableTextTextBlock, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, defineSchema } from "@portabletext/schema";
|
|
10
|
+
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, PortableTextObject as PortableTextObject$1, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock as PortableTextTextBlock$1, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, defineSchema } from "@portabletext/schema";
|
|
11
11
|
import { Observable, Subject } from "rxjs";
|
|
12
12
|
import { ReactEditor } from "slate-react";
|
|
13
13
|
import * as xstate_guards12 from "xstate/guards";
|
|
14
|
-
/**
|
|
15
|
-
* Types of array actions that can be performed
|
|
16
|
-
* @beta
|
|
17
|
-
*/
|
|
18
|
-
declare type ArrayActionName =
|
|
19
|
-
/**
|
|
20
|
-
* Add any item to the array at any position
|
|
21
|
-
*/
|
|
22
|
-
'add'
|
|
23
|
-
/**
|
|
24
|
-
* Add item after an existing item
|
|
25
|
-
*/ | 'addBefore'
|
|
26
|
-
/**
|
|
27
|
-
* Add item after an existing item
|
|
28
|
-
*/ | 'addAfter'
|
|
29
|
-
/**
|
|
30
|
-
* Remove any item
|
|
31
|
-
*/ | 'remove'
|
|
32
|
-
/**
|
|
33
|
-
* Duplicate item
|
|
34
|
-
*/ | 'duplicate'
|
|
35
|
-
/**
|
|
36
|
-
* Copy item
|
|
37
|
-
*/ | 'copy';
|
|
38
|
-
/** @public */
|
|
39
|
-
declare interface ArrayDefinition extends BaseSchemaDefinition {
|
|
40
|
-
type: 'array';
|
|
41
|
-
of: ArrayOfType[];
|
|
42
|
-
initialValue?: InitialValueProperty<any, unknown[]>;
|
|
43
|
-
validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>;
|
|
44
|
-
options?: ArrayOptions;
|
|
45
|
-
}
|
|
46
|
-
/** @public */
|
|
47
|
-
declare type ArrayOfEntry<T$1> = Omit<T$1, 'name' | 'hidden'> & {
|
|
48
|
-
name?: string;
|
|
49
|
-
};
|
|
50
|
-
/** @public */
|
|
51
|
-
declare type ArrayOfType<TType$1 extends IntrinsicTypeName = IntrinsicTypeName, TAlias extends IntrinsicTypeName | undefined = undefined> = IntrinsicArrayOfDefinition[TType$1] | ArrayOfEntry<TypeAliasDefinition<string, TAlias>>;
|
|
52
|
-
/** @public */
|
|
53
|
-
declare interface ArrayOptions<V = unknown> extends SearchConfiguration, BaseSchemaTypeOptions {
|
|
54
|
-
list?: TitledListValue<V>[] | V[];
|
|
55
|
-
layout?: 'list' | 'tags' | 'grid';
|
|
56
|
-
/** @deprecated This option does not have any effect anymore */
|
|
57
|
-
direction?: 'horizontal' | 'vertical';
|
|
58
|
-
sortable?: boolean;
|
|
59
|
-
modal?: {
|
|
60
|
-
type?: 'dialog' | 'popover';
|
|
61
|
-
width?: number | 'auto';
|
|
62
|
-
};
|
|
63
|
-
/** @alpha This API may change */
|
|
64
|
-
insertMenu?: InsertMenuOptions;
|
|
65
|
-
/**
|
|
66
|
-
* A boolean flag to enable or disable tree editing for the array.
|
|
67
|
-
* If there are any nested arrays, they will inherit this value.
|
|
68
|
-
* @deprecated tree editing beta feature has been disabled
|
|
69
|
-
*/
|
|
70
|
-
treeEditing?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* A list of array actions to disable
|
|
73
|
-
* Possible options are defined by {@link ArrayActionName}
|
|
74
|
-
* @beta
|
|
75
|
-
*/
|
|
76
|
-
disableActions?: ArrayActionName[];
|
|
77
|
-
}
|
|
78
|
-
/** @public */
|
|
79
|
-
declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {
|
|
80
|
-
min: (length: number | FieldReference) => ArrayRule<Value>;
|
|
81
|
-
max: (length: number | FieldReference) => ArrayRule<Value>;
|
|
82
|
-
length: (length: number | FieldReference) => ArrayRule<Value>;
|
|
83
|
-
unique: () => ArrayRule<Value>;
|
|
84
|
-
}
|
|
85
|
-
/** @public */
|
|
86
|
-
declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {
|
|
87
|
-
jsonType: 'array';
|
|
88
|
-
of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[];
|
|
89
|
-
options?: ArrayOptions<V> & {
|
|
90
|
-
layout?: V extends string ? 'tag' : 'grid';
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/** @public */
|
|
94
|
-
declare interface Asset$1 extends SanityDocument {
|
|
95
|
-
url: string;
|
|
96
|
-
path: string;
|
|
97
|
-
assetId: string;
|
|
98
|
-
extension: string;
|
|
99
|
-
mimeType: string;
|
|
100
|
-
sha1hash: string;
|
|
101
|
-
size: number;
|
|
102
|
-
originalFilename?: string;
|
|
103
|
-
label?: string;
|
|
104
|
-
title?: string;
|
|
105
|
-
description?: string;
|
|
106
|
-
creditLine?: string;
|
|
107
|
-
source?: AssetSourceSpec;
|
|
108
|
-
}
|
|
109
|
-
/** @public */
|
|
110
|
-
declare type AssetFromSource = {
|
|
111
|
-
kind: 'assetDocumentId' | 'file' | 'base64' | 'url';
|
|
112
|
-
value: string | File_2;
|
|
113
|
-
assetDocumentProps?: ImageAsset;
|
|
114
|
-
mediaLibraryProps?: {
|
|
115
|
-
mediaLibraryId: string;
|
|
116
|
-
assetId: string;
|
|
117
|
-
assetInstanceId: string;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
/** @public */
|
|
121
|
-
declare interface AssetSource {
|
|
122
|
-
name: string;
|
|
123
|
-
/** @deprecated provide `i18nKey` instead */
|
|
124
|
-
title?: string;
|
|
125
|
-
i18nKey?: string;
|
|
126
|
-
component: ComponentType<AssetSourceComponentProps>;
|
|
127
|
-
icon?: ComponentType<EmptyProps>;
|
|
128
|
-
/** @beta */
|
|
129
|
-
Uploader?: AssetSourceUploaderClass;
|
|
130
|
-
}
|
|
131
|
-
/** @public */
|
|
132
|
-
declare interface AssetSourceComponentProps {
|
|
133
|
-
action?: 'select' | 'upload';
|
|
134
|
-
assetSource: AssetSource;
|
|
135
|
-
assetType?: 'file' | 'image' | 'sanity.video';
|
|
136
|
-
accept: string;
|
|
137
|
-
selectionType: 'single';
|
|
138
|
-
dialogHeaderTitle?: React.ReactNode;
|
|
139
|
-
selectedAssets: Asset$1[];
|
|
140
|
-
onClose: () => void;
|
|
141
|
-
onSelect: (assetFromSource: AssetFromSource[]) => void;
|
|
142
|
-
schemaType?: ImageSchemaType | FileSchemaType;
|
|
143
|
-
/** @beta */
|
|
144
|
-
uploader?: AssetSourceUploader;
|
|
145
|
-
}
|
|
146
|
-
/** @public */
|
|
147
|
-
declare interface AssetSourceSpec {
|
|
148
|
-
id: string;
|
|
149
|
-
name: string;
|
|
150
|
-
url?: string;
|
|
151
|
-
}
|
|
152
|
-
/** @beta */
|
|
153
|
-
declare interface AssetSourceUploader {
|
|
154
|
-
upload(files: globalThis.File[], options?: {
|
|
155
|
-
/**
|
|
156
|
-
* The schema type of the field the asset is being uploaded to.
|
|
157
|
-
* May be of interest to the uploader to read file and image options.
|
|
158
|
-
*/
|
|
159
|
-
schemaType?: SchemaType;
|
|
160
|
-
/**
|
|
161
|
-
* The uploader may send patches directly to the field
|
|
162
|
-
* Typed 'unknown' as we don't have patch definitions in sanity/types yet.
|
|
163
|
-
*/
|
|
164
|
-
onChange?: (patch: unknown) => void;
|
|
165
|
-
}): AssetSourceUploadFile[];
|
|
166
|
-
/**
|
|
167
|
-
* Abort the upload of a file
|
|
168
|
-
*/
|
|
169
|
-
abort(file?: AssetSourceUploadFile): void;
|
|
170
|
-
/**
|
|
171
|
-
* Get the files that are currently being uploaded
|
|
172
|
-
*/
|
|
173
|
-
getFiles(): AssetSourceUploadFile[];
|
|
174
|
-
/**
|
|
175
|
-
* Subscribe to upload events from the uploader
|
|
176
|
-
*/
|
|
177
|
-
subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void;
|
|
178
|
-
/**
|
|
179
|
-
* Update the status of a file. Will be emitted to subscribers.
|
|
180
|
-
*/
|
|
181
|
-
updateFile(fileId: string, data: {
|
|
182
|
-
progress?: number;
|
|
183
|
-
status?: string;
|
|
184
|
-
error?: Error;
|
|
185
|
-
}): void;
|
|
186
|
-
/**
|
|
187
|
-
* Reset the uploader (clear files). Should be called by the uploader when all files are done.
|
|
188
|
-
*/
|
|
189
|
-
reset(): void;
|
|
190
|
-
}
|
|
191
|
-
/** @beta */
|
|
192
|
-
declare type AssetSourceUploaderClass = new (...args: any[]) => AssetSourceUploader;
|
|
193
|
-
/** @beta */
|
|
194
|
-
declare type AssetSourceUploadEvent = AssetSourceUploadEventProgress | AssetSourceUploadEventStatus | AssetSourceUploadEventAllComplete | AssetSourceUploadEventError | AssetSourceUploadEventAbort;
|
|
195
|
-
/**
|
|
196
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
197
|
-
* @beta */
|
|
198
|
-
declare type AssetSourceUploadEventAbort = {
|
|
199
|
-
type: 'abort';
|
|
200
|
-
/**
|
|
201
|
-
* Files aborted
|
|
202
|
-
*/
|
|
203
|
-
files: AssetSourceUploadFile[];
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
207
|
-
* @beta */
|
|
208
|
-
declare type AssetSourceUploadEventAllComplete = {
|
|
209
|
-
type: 'all-complete';
|
|
210
|
-
files: AssetSourceUploadFile[];
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Emitted when all files are done, either successfully, aborted or with errors
|
|
214
|
-
* @beta */
|
|
215
|
-
declare type AssetSourceUploadEventError = {
|
|
216
|
-
type: 'error';
|
|
217
|
-
/**
|
|
218
|
-
* Files errored
|
|
219
|
-
*/
|
|
220
|
-
files: AssetSourceUploadFile[];
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* Emitted when a file upload is progressing
|
|
224
|
-
* @beta */
|
|
225
|
-
declare type AssetSourceUploadEventProgress = {
|
|
226
|
-
type: 'progress';
|
|
227
|
-
file: AssetSourceUploadFile;
|
|
228
|
-
progress: number;
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* Emitted when a file upload is changing status
|
|
232
|
-
* @beta */
|
|
233
|
-
declare type AssetSourceUploadEventStatus = {
|
|
234
|
-
type: 'status';
|
|
235
|
-
file: AssetSourceUploadFile;
|
|
236
|
-
status: AssetSourceUploadFile['status'];
|
|
237
|
-
};
|
|
238
|
-
/** @beta */
|
|
239
|
-
declare interface AssetSourceUploadFile {
|
|
240
|
-
id: string;
|
|
241
|
-
file: globalThis.File;
|
|
242
|
-
progress: number;
|
|
243
|
-
status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted' | 'alreadyExists';
|
|
244
|
-
error?: Error;
|
|
245
|
-
result?: unknown;
|
|
246
|
-
}
|
|
247
|
-
/** @public */
|
|
248
|
-
declare interface BaseSchemaDefinition {
|
|
249
|
-
name: string;
|
|
250
|
-
title?: string;
|
|
251
|
-
description?: string | React.JSX.Element;
|
|
252
|
-
hidden?: ConditionalProperty;
|
|
253
|
-
readOnly?: ConditionalProperty;
|
|
254
|
-
icon?: ComponentType | ReactNode;
|
|
255
|
-
validation?: unknown;
|
|
256
|
-
initialValue?: unknown;
|
|
257
|
-
deprecated?: DeprecatedProperty;
|
|
258
|
-
}
|
|
259
|
-
/** @public */
|
|
260
|
-
declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
|
|
261
|
-
name: string;
|
|
262
|
-
title?: string;
|
|
263
|
-
description?: string;
|
|
264
|
-
type?: SchemaType;
|
|
265
|
-
liveEdit?: boolean;
|
|
266
|
-
readOnly?: ConditionalProperty;
|
|
267
|
-
hidden?: ConditionalProperty;
|
|
268
|
-
icon?: ComponentType;
|
|
269
|
-
initialValue?: InitialValueProperty<any, any>;
|
|
270
|
-
validation?: SchemaValidationValue;
|
|
271
|
-
preview?: PreviewConfig;
|
|
272
|
-
/** @beta */
|
|
273
|
-
components?: {
|
|
274
|
-
block?: ComponentType<any>;
|
|
275
|
-
inlineBlock?: ComponentType<any>;
|
|
276
|
-
annotation?: ComponentType<any>;
|
|
277
|
-
diff?: ComponentType<any>;
|
|
278
|
-
field?: ComponentType<any>;
|
|
279
|
-
input?: ComponentType<any>;
|
|
280
|
-
item?: ComponentType<any>;
|
|
281
|
-
preview?: ComponentType<any>;
|
|
282
|
-
portableText?: {
|
|
283
|
-
plugins?: ComponentType<any>;
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* @deprecated This will be removed.
|
|
288
|
-
*/
|
|
289
|
-
placeholder?: string;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* `BaseOptions` applies to all type options.
|
|
293
|
-
*
|
|
294
|
-
* It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.
|
|
295
|
-
*
|
|
296
|
-
* @public
|
|
297
|
-
* */
|
|
298
|
-
declare interface BaseSchemaTypeOptions {
|
|
299
|
-
sanityCreate?: SanityCreateOptions;
|
|
300
|
-
canvasApp?: CanvasAppOptions;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Schema definition for text block decorators.
|
|
304
|
-
*
|
|
305
|
-
* @public
|
|
306
|
-
* @example The default set of decorators
|
|
307
|
-
* ```ts
|
|
308
|
-
* {
|
|
309
|
-
* name: 'blockContent',
|
|
310
|
-
* title: 'Content',
|
|
311
|
-
* type: 'array',
|
|
312
|
-
* of: [
|
|
313
|
-
* {
|
|
314
|
-
* type: 'block',
|
|
315
|
-
* marks: {
|
|
316
|
-
* decorators: [
|
|
317
|
-
* {title: 'Strong', value: 'strong'},
|
|
318
|
-
* {title: 'Emphasis', value: 'em'},
|
|
319
|
-
* {title: 'Underline', value: 'underline'},
|
|
320
|
-
* {title: 'Strike', value: 'strike-through'},
|
|
321
|
-
* {title: 'Code', value: 'code'},
|
|
322
|
-
* ]
|
|
323
|
-
* }
|
|
324
|
-
* }
|
|
325
|
-
* ]
|
|
326
|
-
* }
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
declare interface BlockDecoratorDefinition {
|
|
330
|
-
title: string;
|
|
331
|
-
i18nTitleKey?: string;
|
|
332
|
-
value: string;
|
|
333
|
-
icon?: ReactNode | ComponentType;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Schema definition for text blocks.
|
|
337
|
-
*
|
|
338
|
-
* @public
|
|
339
|
-
* @example the default block definition
|
|
340
|
-
* ```ts
|
|
341
|
-
* {
|
|
342
|
-
* name: 'blockContent',
|
|
343
|
-
* title: 'Content',
|
|
344
|
-
* type: 'array',
|
|
345
|
-
* of: [
|
|
346
|
-
* {
|
|
347
|
-
* type: 'block',
|
|
348
|
-
* marks: {
|
|
349
|
-
* decorators: [
|
|
350
|
-
* {title: 'Strong', value: 'strong'},
|
|
351
|
-
* {title: 'Emphasis', value: 'em'},
|
|
352
|
-
* {title: 'Underline', value: 'underline'},
|
|
353
|
-
* {title: 'Strike', value: 'strike-through'},
|
|
354
|
-
* {title: 'Code', value: 'code'},
|
|
355
|
-
* ],
|
|
356
|
-
* annotations: [
|
|
357
|
-
* {
|
|
358
|
-
* type: 'object',
|
|
359
|
-
* name: 'link',
|
|
360
|
-
* fields: [
|
|
361
|
-
* {
|
|
362
|
-
* type: 'string',
|
|
363
|
-
* name: 'href',
|
|
364
|
-
* },
|
|
365
|
-
* ],
|
|
366
|
-
* },
|
|
367
|
-
* ]
|
|
368
|
-
* },
|
|
369
|
-
* styles: [
|
|
370
|
-
* {title: 'Normal', value: 'normal'},
|
|
371
|
-
* {title: 'H1', value: 'h1'},
|
|
372
|
-
* {title: 'H2', value: 'h2'},
|
|
373
|
-
* {title: 'H3', value: 'h3'},
|
|
374
|
-
* {title: 'H4', value: 'h4'},
|
|
375
|
-
* {title: 'H5', value: 'h5'},
|
|
376
|
-
* {title: 'H6', value: 'h6'},
|
|
377
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
378
|
-
* ],
|
|
379
|
-
* lists: [
|
|
380
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
381
|
-
* {title: 'Number', value: 'number'},
|
|
382
|
-
* ],
|
|
383
|
-
* },
|
|
384
|
-
* ]
|
|
385
|
-
* }
|
|
386
|
-
* ```
|
|
387
|
-
*/
|
|
388
|
-
declare interface BlockDefinition extends BaseSchemaDefinition {
|
|
389
|
-
type: 'block';
|
|
390
|
-
styles?: BlockStyleDefinition[];
|
|
391
|
-
lists?: BlockListDefinition[];
|
|
392
|
-
marks?: BlockMarksDefinition;
|
|
393
|
-
of?: ArrayOfType<'object' | 'reference'>[];
|
|
394
|
-
initialValue?: InitialValueProperty<any, any[]>;
|
|
395
|
-
options?: BlockOptions;
|
|
396
|
-
validation?: ValidationBuilder<BlockRule, any[]>;
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Schema definition for a text block list style.
|
|
400
|
-
*
|
|
401
|
-
* @public
|
|
402
|
-
* @example The defaults lists
|
|
403
|
-
* ```ts
|
|
404
|
-
* {
|
|
405
|
-
* name: 'blockContent',
|
|
406
|
-
* title: 'Content',
|
|
407
|
-
* type: 'array',
|
|
408
|
-
* of: [
|
|
409
|
-
* {
|
|
410
|
-
* type: 'block',
|
|
411
|
-
* lists: [
|
|
412
|
-
* {title: 'Bullet', value: 'bullet'},
|
|
413
|
-
* {title: 'Number', value: 'number'},
|
|
414
|
-
* ]
|
|
415
|
-
* }
|
|
416
|
-
* ]
|
|
417
|
-
* }
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
declare interface BlockListDefinition {
|
|
421
|
-
title: string;
|
|
422
|
-
i18nTitleKey?: string;
|
|
423
|
-
value: string;
|
|
424
|
-
icon?: ReactNode | ComponentType;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Schema definition for text block marks (decorators and annotations).
|
|
428
|
-
*
|
|
429
|
-
* @public */
|
|
430
|
-
declare interface BlockMarksDefinition {
|
|
431
|
-
decorators?: BlockDecoratorDefinition[];
|
|
432
|
-
annotations?: ArrayOfType<'object' | 'reference'>[];
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Schema options for a Block schema definition
|
|
436
|
-
* @public */
|
|
437
|
-
declare interface BlockOptions extends BaseSchemaTypeOptions {
|
|
438
|
-
/**
|
|
439
|
-
* Turn on or off the builtin browser spellchecking. Default is on.
|
|
440
|
-
*/
|
|
441
|
-
spellCheck?: boolean;
|
|
442
|
-
unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove';
|
|
443
|
-
/**
|
|
444
|
-
* When enabled, the editor will restrict all line breaks and soft breaks,
|
|
445
|
-
* forcing content to remain on a single line. This will also update
|
|
446
|
-
* the styling of the editor to reflect the single-line constraint.
|
|
447
|
-
*
|
|
448
|
-
* Pasting content that is on multiple lines will be normalized to a single line, if possible.
|
|
449
|
-
*
|
|
450
|
-
* @defaultValue false
|
|
451
|
-
*/
|
|
452
|
-
oneLine?: boolean;
|
|
453
|
-
}
|
|
454
|
-
/** @public */
|
|
455
|
-
declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
|
|
456
|
-
/**
|
|
457
|
-
* Schema definition for a text block style.
|
|
458
|
-
* A text block may have a block style like 'header', 'normal', 'lead'
|
|
459
|
-
* attached to it, which is stored on the `.style` property for that block.
|
|
460
|
-
*
|
|
461
|
-
* @public
|
|
462
|
-
* @remarks The first defined style will become the default style.´´
|
|
463
|
-
* @example The default set of styles
|
|
464
|
-
* ```ts
|
|
465
|
-
* {
|
|
466
|
-
* name: 'blockContent',
|
|
467
|
-
* title: 'Content',
|
|
468
|
-
* type: 'array',
|
|
469
|
-
* of: [
|
|
470
|
-
* {
|
|
471
|
-
* type: 'block',
|
|
472
|
-
* styles: [
|
|
473
|
-
* {title: 'Normal', value: 'normal'},
|
|
474
|
-
* {title: 'H1', value: 'h1'},
|
|
475
|
-
* {title: 'H2', value: 'h2'},
|
|
476
|
-
* {title: 'H3', value: 'h3'},
|
|
477
|
-
* {title: 'H4', value: 'h4'},
|
|
478
|
-
* {title: 'H5', value: 'h5'},
|
|
479
|
-
* {title: 'H6', value: 'h6'},
|
|
480
|
-
* {title: 'Quote', value: 'blockquote'}
|
|
481
|
-
* ]
|
|
482
|
-
* }
|
|
483
|
-
* ]
|
|
484
|
-
* }
|
|
485
|
-
* ```
|
|
486
|
-
* @example Example of defining a block type with custom styles and render components.
|
|
487
|
-
* ```ts
|
|
488
|
-
* defineArrayMember({
|
|
489
|
-
* type: 'block',
|
|
490
|
-
* styles: [
|
|
491
|
-
* {
|
|
492
|
-
* title: 'Paragraph',
|
|
493
|
-
* value: 'paragraph',
|
|
494
|
-
* component: ParagraphStyle,
|
|
495
|
-
* },
|
|
496
|
-
* {
|
|
497
|
-
* title: 'Lead',
|
|
498
|
-
* value: 'lead',
|
|
499
|
-
* component: LeadStyle,
|
|
500
|
-
* },
|
|
501
|
-
* {
|
|
502
|
-
* title: 'Heading',
|
|
503
|
-
* value: 'heading',
|
|
504
|
-
* component: HeadingStyle,
|
|
505
|
-
* },
|
|
506
|
-
* ],
|
|
507
|
-
* })
|
|
508
|
-
* ```
|
|
509
|
-
*/
|
|
510
|
-
declare interface BlockStyleDefinition {
|
|
511
|
-
title: string;
|
|
512
|
-
value: string;
|
|
513
|
-
i18nTitleKey?: string;
|
|
514
|
-
icon?: ReactNode | ComponentType;
|
|
515
|
-
}
|
|
516
|
-
/** @public */
|
|
517
|
-
declare interface BooleanDefinition extends BaseSchemaDefinition {
|
|
518
|
-
type: 'boolean';
|
|
519
|
-
options?: BooleanOptions;
|
|
520
|
-
initialValue?: InitialValueProperty<any, boolean>;
|
|
521
|
-
validation?: ValidationBuilder<BooleanRule, boolean>;
|
|
522
|
-
}
|
|
523
|
-
/** @public */
|
|
524
|
-
declare interface BooleanOptions extends BaseSchemaTypeOptions {
|
|
525
|
-
layout?: 'switch' | 'checkbox';
|
|
526
|
-
}
|
|
527
|
-
/** @public */
|
|
528
|
-
declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}
|
|
529
|
-
/** @public */
|
|
530
|
-
declare interface BooleanSchemaType extends BaseSchemaType {
|
|
531
|
-
jsonType: 'boolean';
|
|
532
|
-
options?: BooleanOptions;
|
|
533
|
-
initialValue?: InitialValueProperty<any, boolean>;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Options for configuring how Canvas app interfaces with the type or field.
|
|
537
|
-
*
|
|
538
|
-
* @public
|
|
539
|
-
*/
|
|
540
|
-
declare interface CanvasAppOptions {
|
|
541
|
-
/** Set to true to exclude a type or field from appearing in Canvas */
|
|
542
|
-
exclude?: boolean;
|
|
543
|
-
/**
|
|
544
|
-
* A short description of what the type or field is used for.
|
|
545
|
-
* Purpose can be used to improve how and when content mapping uses the field.
|
|
546
|
-
* */
|
|
547
|
-
purpose?: string;
|
|
548
|
-
}
|
|
549
|
-
/** @public */
|
|
550
|
-
declare interface CollapseOptions {
|
|
551
|
-
collapsed?: boolean;
|
|
552
|
-
collapsible?: boolean;
|
|
553
|
-
/**
|
|
554
|
-
* @deprecated Use `collapsible` instead
|
|
555
|
-
*/
|
|
556
|
-
collapsable?: boolean;
|
|
557
|
-
}
|
|
558
|
-
/** @public */
|
|
559
|
-
declare type ConditionalProperty = boolean | ConditionalPropertyCallback | undefined;
|
|
560
|
-
/** @public */
|
|
561
|
-
declare type ConditionalPropertyCallback = (context: ConditionalPropertyCallbackContext) => boolean;
|
|
562
|
-
/** @public */
|
|
563
|
-
declare interface ConditionalPropertyCallbackContext {
|
|
564
|
-
document: SanityDocument | undefined;
|
|
565
|
-
parent: any;
|
|
566
|
-
value: any;
|
|
567
|
-
currentUser: Omit<CurrentUser, 'role'> | null;
|
|
568
|
-
}
|
|
569
|
-
/** @public */
|
|
570
|
-
declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {
|
|
571
|
-
type: 'crossDatasetReference';
|
|
572
|
-
weak?: boolean;
|
|
573
|
-
to: {
|
|
574
|
-
type: string;
|
|
575
|
-
title?: string;
|
|
576
|
-
icon?: ComponentType;
|
|
577
|
-
preview?: PreviewConfig;
|
|
578
|
-
/**
|
|
579
|
-
* @deprecated Unused. Configuring search is no longer supported.
|
|
580
|
-
*/
|
|
581
|
-
__experimental_search?: {
|
|
582
|
-
path: string | string[];
|
|
583
|
-
weight?: number;
|
|
584
|
-
mapWith?: string;
|
|
585
|
-
}[];
|
|
586
|
-
}[];
|
|
587
|
-
dataset: string;
|
|
588
|
-
studioUrl?: (document: {
|
|
589
|
-
id: string;
|
|
590
|
-
type?: string;
|
|
591
|
-
}) => string | null;
|
|
592
|
-
tokenId?: string;
|
|
593
|
-
options?: ReferenceOptions;
|
|
594
|
-
/**
|
|
595
|
-
* @deprecated Cross-project references are no longer supported, only cross-dataset
|
|
596
|
-
*/
|
|
597
|
-
projectId?: string;
|
|
598
|
-
}
|
|
599
|
-
/** @public */
|
|
600
|
-
declare interface CurrentUser {
|
|
601
|
-
id: string;
|
|
602
|
-
name: string;
|
|
603
|
-
email: string;
|
|
604
|
-
profileImage?: string;
|
|
605
|
-
provider?: string;
|
|
606
|
-
/** @deprecated use `roles` instead */
|
|
607
|
-
role: string;
|
|
608
|
-
roles: Role[];
|
|
609
|
-
}
|
|
610
|
-
/** @public */
|
|
611
|
-
declare interface CustomValidator<T$1 = unknown> {
|
|
612
|
-
(value: T$1, context: ValidationContext): CustomValidatorResult | Promise<CustomValidatorResult>;
|
|
613
|
-
bypassConcurrencyLimit?: boolean;
|
|
614
|
-
}
|
|
615
|
-
/** @public */
|
|
616
|
-
declare type CustomValidatorResult = true | string | ValidationError | ValidationError[] | LocalizedValidationMessages;
|
|
617
|
-
/** @public */
|
|
618
|
-
declare interface DateDefinition extends BaseSchemaDefinition {
|
|
619
|
-
type: 'date';
|
|
620
|
-
options?: DateOptions;
|
|
621
|
-
placeholder?: string;
|
|
622
|
-
validation?: ValidationBuilder<DateRule, string>;
|
|
623
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
624
|
-
}
|
|
625
|
-
/** @public */
|
|
626
|
-
declare interface DateOptions extends BaseSchemaTypeOptions {
|
|
627
|
-
dateFormat?: string;
|
|
628
|
-
}
|
|
629
|
-
/** @public */
|
|
630
|
-
declare interface DateRule extends RuleDef<DateRule, string> {
|
|
631
|
-
/**
|
|
632
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
633
|
-
*/
|
|
634
|
-
min: (minDate: string | FieldReference) => DateRule;
|
|
635
|
-
/**
|
|
636
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
637
|
-
*/
|
|
638
|
-
max: (maxDate: string | FieldReference) => DateRule;
|
|
639
|
-
}
|
|
640
|
-
/** @public */
|
|
641
|
-
declare interface DatetimeDefinition extends BaseSchemaDefinition {
|
|
642
|
-
type: 'datetime';
|
|
643
|
-
options?: DatetimeOptions;
|
|
644
|
-
placeholder?: string;
|
|
645
|
-
validation?: ValidationBuilder<DatetimeRule, string>;
|
|
646
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
647
|
-
}
|
|
648
|
-
/** @public */
|
|
649
|
-
declare interface DatetimeOptions extends BaseSchemaTypeOptions {
|
|
650
|
-
dateFormat?: string;
|
|
651
|
-
timeFormat?: string;
|
|
652
|
-
timeStep?: number;
|
|
653
|
-
displayTimeZone?: string;
|
|
654
|
-
allowTimeZoneSwitch?: boolean;
|
|
655
|
-
}
|
|
656
|
-
/** @public */
|
|
657
|
-
declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {
|
|
658
|
-
/**
|
|
659
|
-
* @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
|
|
660
|
-
*/
|
|
661
|
-
min: (minDate: string | FieldReference) => DatetimeRule;
|
|
662
|
-
/**
|
|
663
|
-
* @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
|
|
664
|
-
*/
|
|
665
|
-
max: (maxDate: string | FieldReference) => DatetimeRule;
|
|
666
|
-
}
|
|
667
|
-
/** @public */
|
|
668
|
-
declare interface DeprecatedProperty {
|
|
669
|
-
reason: string;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* @public
|
|
673
|
-
*/
|
|
674
|
-
declare interface DeprecationConfiguration {
|
|
675
|
-
deprecated: DeprecatedProperty;
|
|
676
|
-
}
|
|
677
|
-
/** @public */
|
|
678
|
-
declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
|
|
679
|
-
type: 'document';
|
|
680
|
-
liveEdit?: boolean;
|
|
681
|
-
/** @beta */
|
|
682
|
-
orderings?: SortOrdering[];
|
|
683
|
-
options?: DocumentOptions;
|
|
684
|
-
validation?: ValidationBuilder<DocumentRule, SanityDocument>;
|
|
685
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>;
|
|
686
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
687
|
-
__experimental_search?: {
|
|
688
|
-
path: string;
|
|
689
|
-
weight: number;
|
|
690
|
-
mapWith?: string;
|
|
691
|
-
}[];
|
|
692
|
-
/** @alpha */
|
|
693
|
-
__experimental_omnisearch_visibility?: boolean;
|
|
694
|
-
/**
|
|
695
|
-
* Determines whether the large preview title is displayed in the document pane form
|
|
696
|
-
* @alpha
|
|
697
|
-
* */
|
|
698
|
-
__experimental_formPreviewTitle?: boolean;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* This exists only to allow for extensions using declaration-merging.
|
|
702
|
-
*
|
|
703
|
-
* @public
|
|
704
|
-
*/
|
|
705
|
-
declare interface DocumentOptions extends BaseSchemaTypeOptions {}
|
|
706
|
-
/** @public */
|
|
707
|
-
declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}
|
|
708
|
-
/** @public */
|
|
709
|
-
declare interface EmailDefinition extends BaseSchemaDefinition {
|
|
710
|
-
type: 'email';
|
|
711
|
-
options?: EmailOptions;
|
|
712
|
-
placeholder?: string;
|
|
713
|
-
validation?: ValidationBuilder<EmailRule, string>;
|
|
714
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
715
|
-
}
|
|
716
|
-
/** @public */
|
|
717
|
-
declare interface EmailOptions extends BaseSchemaTypeOptions {}
|
|
718
|
-
/** @public */
|
|
719
|
-
declare interface EmailRule extends RuleDef<EmailRule, string> {}
|
|
720
|
-
/** @public */
|
|
721
|
-
declare interface EmptyProps {}
|
|
722
|
-
/** @public */
|
|
723
|
-
declare interface EnumListProps<V = unknown> {
|
|
724
|
-
list?: Array<TitledListValue<V> | V>;
|
|
725
|
-
layout?: 'radio' | 'dropdown';
|
|
726
|
-
direction?: 'horizontal' | 'vertical';
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* The shape of a field definition. Note, it's recommended to use the
|
|
730
|
-
* `defineField` function instead of using this type directly.
|
|
731
|
-
*
|
|
732
|
-
* Where `defineField` infers the exact field type,
|
|
733
|
-
* FieldDefinition is a compromise union of all types a field can have.
|
|
734
|
-
*
|
|
735
|
-
* A field definition can be a reference to another registered top-level type
|
|
736
|
-
* or a inline type definition.
|
|
737
|
-
*
|
|
738
|
-
* @public
|
|
739
|
-
*/
|
|
740
|
-
declare type FieldDefinition$1<TType$1 extends IntrinsicTypeName = IntrinsicTypeName, TAlias extends IntrinsicTypeName | undefined = undefined> = (InlineFieldDefinition[TType$1] | TypeAliasDefinition<string, TAlias>) & FieldDefinitionBase;
|
|
741
|
-
/** @public */
|
|
742
|
-
declare interface FieldDefinitionBase {
|
|
743
|
-
fieldset?: string;
|
|
744
|
-
group?: string | string[];
|
|
745
|
-
}
|
|
746
|
-
/** @public */
|
|
747
|
-
declare interface FieldGroup {
|
|
748
|
-
name: string;
|
|
749
|
-
icon?: ComponentType;
|
|
750
|
-
title?: string;
|
|
751
|
-
description?: string;
|
|
752
|
-
i18n?: I18nTextRecord<'title'>;
|
|
753
|
-
hidden?: ConditionalProperty;
|
|
754
|
-
default?: boolean;
|
|
755
|
-
fields?: ObjectField[];
|
|
756
|
-
}
|
|
757
|
-
/** @public */
|
|
758
|
-
declare type FieldGroupDefinition = {
|
|
759
|
-
name: string;
|
|
760
|
-
title?: string;
|
|
761
|
-
hidden?: ConditionalProperty;
|
|
762
|
-
icon?: ComponentType;
|
|
763
|
-
default?: boolean;
|
|
764
|
-
i18n?: I18nTextRecord<'title'>;
|
|
765
|
-
};
|
|
766
|
-
/**
|
|
767
|
-
* Holds a reference to a different field
|
|
768
|
-
* NOTE: Only use this through {@link Rule.valueOfField}
|
|
769
|
-
*
|
|
770
|
-
* @public
|
|
771
|
-
*/
|
|
772
|
-
declare interface FieldReference {
|
|
773
|
-
type: symbol;
|
|
774
|
-
path: string | string[];
|
|
775
|
-
}
|
|
776
|
-
/** @public */
|
|
777
|
-
declare type FieldRules = {
|
|
778
|
-
[fieldKey: string]: SchemaValidationValue;
|
|
779
|
-
};
|
|
780
|
-
/** @public */
|
|
781
|
-
declare type Fieldset = SingleFieldSet | MultiFieldSet;
|
|
782
|
-
/** @public */
|
|
783
|
-
declare type FieldsetDefinition = {
|
|
784
|
-
name: string;
|
|
785
|
-
title?: string;
|
|
786
|
-
description?: string;
|
|
787
|
-
group?: string;
|
|
788
|
-
hidden?: ConditionalProperty;
|
|
789
|
-
readOnly?: ConditionalProperty;
|
|
790
|
-
options?: ObjectOptions;
|
|
791
|
-
};
|
|
792
|
-
/** @public */
|
|
793
|
-
declare interface File_2 {
|
|
794
|
-
[key: string]: unknown;
|
|
795
|
-
asset?: Reference;
|
|
796
|
-
}
|
|
797
|
-
/** @public */
|
|
798
|
-
declare interface FileDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options' | 'groups' | 'validation'> {
|
|
799
|
-
type: 'file';
|
|
800
|
-
fields?: ObjectDefinition['fields'];
|
|
801
|
-
options?: FileOptions;
|
|
802
|
-
validation?: ValidationBuilder<FileRule, FileValue>;
|
|
803
|
-
initialValue?: InitialValueProperty<any, FileValue>;
|
|
804
|
-
}
|
|
805
|
-
/** @public */
|
|
806
|
-
declare interface FileOptions extends ObjectOptions {
|
|
807
|
-
storeOriginalFilename?: boolean;
|
|
808
|
-
accept?: string;
|
|
809
|
-
sources?: AssetSource[];
|
|
810
|
-
mediaLibrary?: MediaLibraryOptions;
|
|
811
|
-
}
|
|
812
|
-
/** @public */
|
|
813
|
-
declare interface FileRule extends RuleDef<FileRule, FileValue> {
|
|
814
|
-
/**
|
|
815
|
-
* Require a file field has an asset.
|
|
816
|
-
*
|
|
817
|
-
* @example
|
|
818
|
-
* ```ts
|
|
819
|
-
* defineField({
|
|
820
|
-
* name: 'file',
|
|
821
|
-
* title: 'File',
|
|
822
|
-
* type: 'file',
|
|
823
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
824
|
-
* })
|
|
825
|
-
* ```
|
|
826
|
-
*/
|
|
827
|
-
assetRequired(): FileRule;
|
|
828
|
-
}
|
|
829
|
-
/** @public */
|
|
830
|
-
declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {
|
|
831
|
-
options?: FileOptions;
|
|
832
|
-
}
|
|
833
|
-
/** @public */
|
|
834
|
-
declare interface FileValue {
|
|
835
|
-
asset?: Reference;
|
|
836
|
-
[index: string]: unknown;
|
|
837
|
-
}
|
|
838
|
-
/** @public */
|
|
839
|
-
declare interface GeopointDefinition extends BaseSchemaDefinition {
|
|
840
|
-
type: 'geopoint';
|
|
841
|
-
options?: GeopointOptions;
|
|
842
|
-
validation?: ValidationBuilder<GeopointRule, GeopointValue>;
|
|
843
|
-
initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>;
|
|
844
|
-
}
|
|
845
|
-
/** @public */
|
|
846
|
-
declare interface GeopointOptions extends BaseSchemaTypeOptions {}
|
|
847
|
-
/** @public */
|
|
848
|
-
declare interface GeopointRule extends RuleDef<GeopointRule, GeopointValue> {}
|
|
849
|
-
/**
|
|
850
|
-
* Geographical point representing a pair of latitude and longitude coordinates,
|
|
851
|
-
* stored as degrees, in the World Geodetic System 1984 (WGS 84) format. Also
|
|
852
|
-
* includes an optional `alt` property representing the altitude in meters.
|
|
853
|
-
*
|
|
854
|
-
* @public
|
|
855
|
-
*/
|
|
856
|
-
declare interface GeopointValue {
|
|
857
|
-
/**
|
|
858
|
-
* Type of the object. Must be `geopoint`.
|
|
859
|
-
*/
|
|
860
|
-
_type: 'geopoint';
|
|
861
|
-
/**
|
|
862
|
-
* Latitude in degrees
|
|
863
|
-
*/
|
|
864
|
-
lat: number;
|
|
865
|
-
/**
|
|
866
|
-
* Longitude in degrees
|
|
867
|
-
*/
|
|
868
|
-
lng: number;
|
|
869
|
-
/**
|
|
870
|
-
* Altitude in meters
|
|
871
|
-
*/
|
|
872
|
-
alt?: number;
|
|
873
|
-
}
|
|
874
|
-
/** @public */
|
|
875
|
-
declare interface GlobalDocumentReferenceDefinition extends BaseSchemaDefinition {
|
|
876
|
-
type: 'globalDocumentReference';
|
|
877
|
-
weak?: boolean;
|
|
878
|
-
to: {
|
|
879
|
-
type: string;
|
|
880
|
-
title?: string;
|
|
881
|
-
icon?: ComponentType;
|
|
882
|
-
preview?: PreviewConfig;
|
|
883
|
-
}[];
|
|
884
|
-
resourceType: string;
|
|
885
|
-
resourceId: string;
|
|
886
|
-
options?: ReferenceOptions;
|
|
887
|
-
studioUrl?: string | ((document: {
|
|
888
|
-
id: string;
|
|
889
|
-
type?: string;
|
|
890
|
-
}) => string | null);
|
|
891
|
-
}
|
|
892
|
-
/** @public */
|
|
893
|
-
declare interface HotspotOptions {
|
|
894
|
-
previews?: HotspotPreview[];
|
|
895
|
-
}
|
|
896
|
-
/** @public */
|
|
897
|
-
declare interface HotspotPreview {
|
|
898
|
-
title: string;
|
|
899
|
-
aspectRatio: number;
|
|
900
|
-
}
|
|
901
|
-
/** @public */
|
|
902
|
-
declare type I18nTextRecord<K$1 extends string> = { [P in K$1]?: {
|
|
903
|
-
key: string;
|
|
904
|
-
ns: string;
|
|
905
|
-
} };
|
|
906
|
-
/** @public */
|
|
907
|
-
declare interface ImageAsset extends Asset$1 {
|
|
908
|
-
_type: 'sanity.imageAsset';
|
|
909
|
-
metadata: ImageMetadata;
|
|
910
|
-
}
|
|
911
|
-
/** @public */
|
|
912
|
-
declare interface ImageCrop {
|
|
913
|
-
_type?: 'sanity.imageCrop';
|
|
914
|
-
left: number;
|
|
915
|
-
bottom: number;
|
|
916
|
-
right: number;
|
|
917
|
-
top: number;
|
|
918
|
-
}
|
|
919
|
-
/** @public */
|
|
920
|
-
declare interface ImageDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options' | 'groups' | 'validation'> {
|
|
921
|
-
type: 'image';
|
|
922
|
-
fields?: FieldDefinition$1[];
|
|
923
|
-
options?: ImageOptions;
|
|
924
|
-
validation?: ValidationBuilder<ImageRule, ImageValue>;
|
|
925
|
-
initialValue?: InitialValueProperty<any, ImageValue>;
|
|
926
|
-
}
|
|
927
|
-
/** @public */
|
|
928
|
-
declare interface ImageDimensions {
|
|
929
|
-
_type: 'sanity.imageDimensions';
|
|
930
|
-
height: number;
|
|
931
|
-
width: number;
|
|
932
|
-
aspectRatio: number;
|
|
933
|
-
}
|
|
934
|
-
/** @public */
|
|
935
|
-
declare interface ImageHotspot {
|
|
936
|
-
_type?: 'sanity.imageHotspot';
|
|
937
|
-
width: number;
|
|
938
|
-
height: number;
|
|
939
|
-
x: number;
|
|
940
|
-
y: number;
|
|
941
|
-
}
|
|
942
|
-
/** @public */
|
|
943
|
-
declare interface ImageMetadata {
|
|
944
|
-
[key: string]: unknown;
|
|
945
|
-
_type: 'sanity.imageMetadata';
|
|
946
|
-
dimensions: ImageDimensions;
|
|
947
|
-
palette?: ImagePalette;
|
|
948
|
-
lqip?: string;
|
|
949
|
-
blurHash?: string;
|
|
950
|
-
hasAlpha: boolean;
|
|
951
|
-
isOpaque: boolean;
|
|
952
|
-
}
|
|
953
|
-
/** @public */
|
|
954
|
-
declare type ImageMetadataType = 'blurhash' | 'lqip' | 'palette' | 'exif' | 'image' | 'location';
|
|
955
|
-
/** @public */
|
|
956
|
-
declare interface ImageOptions extends FileOptions {
|
|
957
|
-
metadata?: ImageMetadataType[];
|
|
958
|
-
hotspot?: boolean | HotspotOptions;
|
|
959
|
-
}
|
|
960
|
-
/** @public */
|
|
961
|
-
declare interface ImagePalette {
|
|
962
|
-
_type: 'sanity.imagePalette';
|
|
963
|
-
darkMuted?: ImageSwatch;
|
|
964
|
-
darkVibrant?: ImageSwatch;
|
|
965
|
-
dominant?: ImageSwatch;
|
|
966
|
-
lightMuted?: ImageSwatch;
|
|
967
|
-
lightVibrant?: ImageSwatch;
|
|
968
|
-
muted?: ImageSwatch;
|
|
969
|
-
vibrant?: ImageSwatch;
|
|
970
|
-
}
|
|
971
|
-
/** @public */
|
|
972
|
-
declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {
|
|
973
|
-
/**
|
|
974
|
-
* Require an image field has an asset.
|
|
975
|
-
*
|
|
976
|
-
* @example
|
|
977
|
-
* ```ts
|
|
978
|
-
* defineField({
|
|
979
|
-
* name: 'image',
|
|
980
|
-
* title: 'Image',
|
|
981
|
-
* type: 'image',
|
|
982
|
-
* validation: (Rule) => Rule.required().assetRequired(),
|
|
983
|
-
* })
|
|
984
|
-
* ```
|
|
985
|
-
*/
|
|
986
|
-
assetRequired(): ImageRule;
|
|
987
|
-
}
|
|
988
|
-
/** @public */
|
|
989
|
-
declare interface ImageSchemaType extends Omit<ObjectSchemaType, 'options'> {
|
|
990
|
-
options?: ImageOptions;
|
|
991
|
-
}
|
|
992
|
-
/** @public */
|
|
993
|
-
declare interface ImageSwatch {
|
|
994
|
-
_type: 'sanity.imagePaletteSwatch';
|
|
995
|
-
background: string;
|
|
996
|
-
foreground: string;
|
|
997
|
-
population: number;
|
|
998
|
-
title?: string;
|
|
999
|
-
}
|
|
1000
|
-
/** @public */
|
|
1001
|
-
declare interface ImageValue extends FileValue {
|
|
1002
|
-
crop?: ImageCrop;
|
|
1003
|
-
hotspot?: ImageHotspot;
|
|
1004
|
-
[index: string]: unknown;
|
|
1005
|
-
}
|
|
1006
|
-
/** @public */
|
|
1007
|
-
declare type IndexTuple = [number | '', number | ''];
|
|
1008
|
-
/** @public */
|
|
1009
|
-
declare type InitialValueProperty<Params, Value> = Value | InitialValueResolver<Params, Value> | undefined;
|
|
1010
|
-
/** @public */
|
|
1011
|
-
declare type InitialValueResolver<Params, Value> = (params: Params | undefined, context: InitialValueResolverContext) => Promise<Value> | Value;
|
|
1012
|
-
/** @public */
|
|
1013
|
-
declare interface InitialValueResolverContext {
|
|
1014
|
-
projectId: string;
|
|
1015
|
-
dataset: string;
|
|
1016
|
-
schema: Schema$1;
|
|
1017
|
-
currentUser: CurrentUser | null;
|
|
1018
|
-
getClient: (options: {
|
|
1019
|
-
apiVersion: string;
|
|
1020
|
-
}) => SanityClient;
|
|
1021
|
-
}
|
|
1022
|
-
/** @public */
|
|
1023
|
-
declare type InlineFieldDefinition = { [K in keyof IntrinsicDefinitions]: Omit<IntrinsicDefinitions[K], 'initialValue' | 'validation'> & {
|
|
1024
|
-
validation?: SchemaValidationValue;
|
|
1025
|
-
initialValue?: InitialValueProperty<any, any>;
|
|
1026
|
-
} };
|
|
1027
|
-
/** @alpha This API may change */
|
|
1028
|
-
declare interface InsertMenuOptions {
|
|
1029
|
-
/**
|
|
1030
|
-
* @defaultValue `'auto'`
|
|
1031
|
-
* `filter: 'auto'` automatically turns on filtering if there are more than 5
|
|
1032
|
-
* schema types added to the menu.
|
|
1033
|
-
*/
|
|
1034
|
-
filter?: 'auto' | boolean | undefined;
|
|
1035
|
-
groups?: Array<{
|
|
1036
|
-
name: string;
|
|
1037
|
-
title?: string;
|
|
1038
|
-
of?: Array<string>;
|
|
1039
|
-
}> | undefined;
|
|
1040
|
-
/** defaultValue `true` */
|
|
1041
|
-
showIcons?: boolean | undefined;
|
|
1042
|
-
/** @defaultValue `[{name: 'list'}]` */
|
|
1043
|
-
views?: Array<{
|
|
1044
|
-
name: 'list';
|
|
1045
|
-
} | {
|
|
1046
|
-
name: 'grid';
|
|
1047
|
-
previewImageUrl?: (schemaTypeName: string) => string | undefined;
|
|
1048
|
-
}> | undefined;
|
|
1049
|
-
}
|
|
1050
|
-
/** @public */
|
|
1051
|
-
declare type IntrinsicArrayOfDefinition = { [K in keyof IntrinsicDefinitions]: Omit<ArrayOfEntry<IntrinsicDefinitions[K]>, 'validation' | 'initialValue'> & {
|
|
1052
|
-
validation?: SchemaValidationValue;
|
|
1053
|
-
initialValue?: InitialValueProperty<any, any>;
|
|
1054
|
-
} };
|
|
1055
|
-
/**
|
|
1056
|
-
* `IntrinsicDefinitions` is a lookup map for "predefined" schema definitions.
|
|
1057
|
-
* Schema types in `IntrinsicDefinitions` will have good type-completion and type-safety in {@link defineType},
|
|
1058
|
-
* {@link defineField} and {@link defineArrayMember} once the `type` property is provided.
|
|
1059
|
-
*
|
|
1060
|
-
* By default, `IntrinsicDefinitions` contains all standard Sanity schema types (`array`, `string`, `number` ect),
|
|
1061
|
-
* but it is an interface and as such, open for extension.
|
|
1062
|
-
*
|
|
1063
|
-
* This type can be extended using declaration merging; this way new entries can be added.
|
|
1064
|
-
* See {@link defineType} for examples on how this can be accomplished.
|
|
1065
|
-
*
|
|
1066
|
-
* @see defineType
|
|
1067
|
-
*
|
|
1068
|
-
* @public
|
|
1069
|
-
*/
|
|
1070
|
-
declare interface IntrinsicDefinitions {
|
|
1071
|
-
array: ArrayDefinition;
|
|
1072
|
-
block: BlockDefinition;
|
|
1073
|
-
boolean: BooleanDefinition;
|
|
1074
|
-
date: DateDefinition;
|
|
1075
|
-
datetime: DatetimeDefinition;
|
|
1076
|
-
document: DocumentDefinition;
|
|
1077
|
-
file: FileDefinition;
|
|
1078
|
-
geopoint: GeopointDefinition;
|
|
1079
|
-
image: ImageDefinition;
|
|
1080
|
-
number: NumberDefinition;
|
|
1081
|
-
object: ObjectDefinition;
|
|
1082
|
-
reference: ReferenceDefinition;
|
|
1083
|
-
crossDatasetReference: CrossDatasetReferenceDefinition;
|
|
1084
|
-
globalDocumentReference: GlobalDocumentReferenceDefinition;
|
|
1085
|
-
slug: SlugDefinition;
|
|
1086
|
-
string: StringDefinition;
|
|
1087
|
-
text: TextDefinition;
|
|
1088
|
-
url: UrlDefinition;
|
|
1089
|
-
email: EmailDefinition;
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* A union of all intrinsic types allowed natively in the schema.
|
|
1093
|
-
*
|
|
1094
|
-
* @see IntrinsicDefinitions
|
|
1095
|
-
*
|
|
1096
|
-
* @public
|
|
1097
|
-
*/
|
|
1098
|
-
declare type IntrinsicTypeName = IntrinsicDefinitions[keyof IntrinsicDefinitions]['type'];
|
|
1099
|
-
/** @public */
|
|
1100
|
-
declare type KeyedSegment = {
|
|
1101
|
-
_key: string;
|
|
1102
|
-
};
|
|
1103
|
-
/**
|
|
1104
|
-
* Holds localized validation messages for a given field.
|
|
1105
|
-
*
|
|
1106
|
-
* @example Custom message for English (US) and Norwegian (Bokmål):
|
|
1107
|
-
* ```
|
|
1108
|
-
* {
|
|
1109
|
-
* 'en-US': 'Needs to start with a capital letter',
|
|
1110
|
-
* 'no-NB': 'Må starte med stor bokstav',
|
|
1111
|
-
* }
|
|
1112
|
-
* ```
|
|
1113
|
-
* @public
|
|
1114
|
-
*/
|
|
1115
|
-
declare interface LocalizedValidationMessages {
|
|
1116
|
-
[locale: string]: string;
|
|
1117
|
-
}
|
|
1118
|
-
/** @public */
|
|
1119
|
-
declare type MediaAssetTypes = AssetInstanceDocument['_type'];
|
|
1120
|
-
/** @public */
|
|
1121
|
-
declare interface MediaLibraryFilter {
|
|
1122
|
-
name: string;
|
|
1123
|
-
query: string;
|
|
1124
|
-
}
|
|
1125
|
-
/** @public */
|
|
1126
|
-
declare interface MediaLibraryOptions {
|
|
1127
|
-
filters?: MediaLibraryFilter[];
|
|
1128
|
-
}
|
|
1129
|
-
/** @public */
|
|
1130
|
-
declare interface MediaValidationValue<T$1 extends MediaAssetTypes = MediaAssetTypes> {
|
|
1131
|
-
/**
|
|
1132
|
-
* Media information
|
|
1133
|
-
*/
|
|
1134
|
-
media: {
|
|
1135
|
-
/**
|
|
1136
|
-
* The Media Library Asset.
|
|
1137
|
-
*/
|
|
1138
|
-
asset: Asset & {
|
|
1139
|
-
currentVersion: Extract<AssetInstanceDocument, {
|
|
1140
|
-
_type: T$1;
|
|
1141
|
-
}>;
|
|
1142
|
-
};
|
|
1143
|
-
};
|
|
1144
|
-
/**
|
|
1145
|
-
* The field value which the media is used in.
|
|
1146
|
-
*/
|
|
1147
|
-
value: unknown;
|
|
1148
|
-
}
|
|
1149
|
-
/** @public */
|
|
1150
|
-
declare interface MediaValidator<T$1 extends MediaAssetTypes = MediaAssetTypes> {
|
|
1151
|
-
(value: MediaValidationValue<T$1>, context: ValidationContext): CustomValidatorResult | Promise<CustomValidatorResult>;
|
|
1152
|
-
}
|
|
1153
|
-
/** @public */
|
|
1154
|
-
declare interface MultiFieldSet {
|
|
1155
|
-
name: string;
|
|
1156
|
-
title?: string;
|
|
1157
|
-
description?: string;
|
|
1158
|
-
single?: false;
|
|
1159
|
-
group?: string | string[];
|
|
1160
|
-
options?: CollapseOptions & {
|
|
1161
|
-
columns?: number;
|
|
1162
|
-
};
|
|
1163
|
-
fields: ObjectField[];
|
|
1164
|
-
hidden?: ConditionalProperty;
|
|
1165
|
-
readOnly?: ConditionalProperty;
|
|
1166
|
-
}
|
|
1167
|
-
/** @public */
|
|
1168
|
-
declare interface NumberDefinition extends BaseSchemaDefinition {
|
|
1169
|
-
type: 'number';
|
|
1170
|
-
options?: NumberOptions;
|
|
1171
|
-
placeholder?: string;
|
|
1172
|
-
validation?: ValidationBuilder<NumberRule, number>;
|
|
1173
|
-
initialValue?: InitialValueProperty<any, number>;
|
|
1174
|
-
}
|
|
1175
|
-
/** @public */
|
|
1176
|
-
declare interface NumberOptions extends EnumListProps<number>, BaseSchemaTypeOptions {}
|
|
1177
|
-
/** @public */
|
|
1178
|
-
declare interface NumberRule extends RuleDef<NumberRule, number> {
|
|
1179
|
-
min: (minNumber: number | FieldReference) => NumberRule;
|
|
1180
|
-
max: (maxNumber: number | FieldReference) => NumberRule;
|
|
1181
|
-
lessThan: (limit: number | FieldReference) => NumberRule;
|
|
1182
|
-
greaterThan: (limit: number | FieldReference) => NumberRule;
|
|
1183
|
-
integer: () => NumberRule;
|
|
1184
|
-
precision: (limit: number | FieldReference) => NumberRule;
|
|
1185
|
-
positive: () => NumberRule;
|
|
1186
|
-
negative: () => NumberRule;
|
|
1187
|
-
}
|
|
1188
|
-
/** @public */
|
|
1189
|
-
declare interface NumberSchemaType extends BaseSchemaType {
|
|
1190
|
-
jsonType: 'number';
|
|
1191
|
-
options?: NumberOptions;
|
|
1192
|
-
initialValue?: InitialValueProperty<any, number>;
|
|
1193
|
-
}
|
|
1194
|
-
/** @public */
|
|
1195
|
-
declare interface ObjectDefinition extends BaseSchemaDefinition {
|
|
1196
|
-
type: 'object';
|
|
1197
|
-
/**
|
|
1198
|
-
* Object must have at least one field. This is validated at Studio startup.
|
|
1199
|
-
*/
|
|
1200
|
-
fields: FieldDefinition$1[];
|
|
1201
|
-
groups?: FieldGroupDefinition[];
|
|
1202
|
-
fieldsets?: FieldsetDefinition[];
|
|
1203
|
-
preview?: PreviewConfig;
|
|
1204
|
-
options?: ObjectOptions;
|
|
1205
|
-
validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>;
|
|
1206
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>;
|
|
1207
|
-
}
|
|
1208
|
-
/** @public */
|
|
1209
|
-
declare interface ObjectField<T$1 extends SchemaType = SchemaType> {
|
|
1210
|
-
name: string;
|
|
1211
|
-
fieldset?: string;
|
|
1212
|
-
group?: string | string[];
|
|
1213
|
-
type: ObjectFieldType<T$1>;
|
|
1214
|
-
}
|
|
1215
|
-
/** @public */
|
|
1216
|
-
declare type ObjectFieldType<T$1 extends SchemaType = SchemaType> = T$1 & {
|
|
1217
|
-
hidden?: ConditionalProperty;
|
|
1218
|
-
readOnly?: ConditionalProperty;
|
|
1219
|
-
};
|
|
1220
|
-
/** @public */
|
|
1221
|
-
declare interface ObjectOptions extends BaseSchemaTypeOptions {
|
|
1222
|
-
collapsible?: boolean;
|
|
1223
|
-
collapsed?: boolean;
|
|
1224
|
-
columns?: number;
|
|
1225
|
-
modal?: {
|
|
1226
|
-
type?: 'dialog' | 'popover';
|
|
1227
|
-
width?: number | number[] | 'auto';
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
/** @public */
|
|
1231
|
-
declare interface ObjectRule extends RuleDef<ObjectRule, Record<string, unknown>> {}
|
|
1232
|
-
/** @public */
|
|
1233
|
-
declare interface ObjectSchemaType extends BaseSchemaType {
|
|
1234
|
-
jsonType: 'object';
|
|
1235
|
-
fields: ObjectField[];
|
|
1236
|
-
groups?: FieldGroup[];
|
|
1237
|
-
fieldsets?: Fieldset[];
|
|
1238
|
-
initialValue?: InitialValueProperty<any, Record<string, unknown>>;
|
|
1239
|
-
weak?: boolean;
|
|
1240
|
-
/** @deprecated Unused. Use the new field-level search config. */
|
|
1241
|
-
__experimental_search?: {
|
|
1242
|
-
path: (string | number)[];
|
|
1243
|
-
weight: number;
|
|
1244
|
-
mapWith?: string;
|
|
1245
|
-
}[];
|
|
1246
|
-
/** @alpha */
|
|
1247
|
-
__experimental_omnisearch_visibility?: boolean;
|
|
1248
|
-
/** @alpha */
|
|
1249
|
-
__experimental_actions?: string[];
|
|
1250
|
-
/** @alpha */
|
|
1251
|
-
__experimental_formPreviewTitle?: boolean;
|
|
1252
|
-
/**
|
|
1253
|
-
* @beta
|
|
1254
|
-
*/
|
|
1255
|
-
orderings?: SortOrdering[];
|
|
1256
|
-
options?: any;
|
|
1257
|
-
}
|
|
1258
|
-
/** @public */
|
|
1259
|
-
declare type Path = PathSegment[];
|
|
1260
|
-
/** @public */
|
|
1261
|
-
declare type PathSegment = string | number | KeyedSegment | IndexTuple;
|
|
1262
|
-
/** @alpha */
|
|
1263
|
-
declare type PortableTextBlock = PortableTextTextBlock$1 | PortableTextObject$1;
|
|
1264
|
-
/** @alpha */
|
|
1265
|
-
declare type PortableTextChild = PortableTextObject$1 | PortableTextSpan$1;
|
|
1266
|
-
/** @alpha */
|
|
1267
|
-
declare interface PortableTextListBlock extends PortableTextTextBlock$1 {
|
|
1268
|
-
listItem: string;
|
|
1269
|
-
level: number;
|
|
1270
|
-
}
|
|
1271
|
-
/** @alpha */
|
|
1272
|
-
declare interface PortableTextObject$1 {
|
|
1273
|
-
_type: string;
|
|
1274
|
-
_key: string;
|
|
1275
|
-
[other: string]: unknown;
|
|
1276
|
-
}
|
|
1277
|
-
/** @alpha */
|
|
1278
|
-
declare interface PortableTextSpan$1 {
|
|
1279
|
-
_key: string;
|
|
1280
|
-
_type: 'span';
|
|
1281
|
-
text: string;
|
|
1282
|
-
marks?: string[];
|
|
1283
|
-
}
|
|
1284
|
-
/** @alpha */
|
|
1285
|
-
declare interface PortableTextTextBlock$1<TChild = PortableTextSpan$1 | PortableTextObject$1> {
|
|
1286
|
-
_type: string;
|
|
1287
|
-
_key: string;
|
|
1288
|
-
children: TChild[];
|
|
1289
|
-
markDefs?: PortableTextObject$1[];
|
|
1290
|
-
listItem?: string;
|
|
1291
|
-
style?: string;
|
|
1292
|
-
level?: number;
|
|
1293
|
-
}
|
|
1294
|
-
/** @public */
|
|
1295
|
-
declare interface PrepareViewOptions {
|
|
1296
|
-
/** @beta */
|
|
1297
|
-
ordering?: SortOrdering;
|
|
1298
|
-
}
|
|
1299
|
-
/** @public */
|
|
1300
|
-
declare interface PreviewConfig<Select extends Record<string, string> = Record<string, string>, PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>> {
|
|
1301
|
-
select?: Select;
|
|
1302
|
-
prepare?: (value: PrepareValue, viewOptions?: PrepareViewOptions) => PreviewValue;
|
|
1303
|
-
}
|
|
1304
|
-
/** @public */
|
|
1305
|
-
declare interface PreviewValue {
|
|
1306
|
-
_id?: string;
|
|
1307
|
-
_createdAt?: string;
|
|
1308
|
-
_updatedAt?: string;
|
|
1309
|
-
title?: string;
|
|
1310
|
-
subtitle?: string;
|
|
1311
|
-
description?: string;
|
|
1312
|
-
media?: ReactNode | ElementType;
|
|
1313
|
-
imageUrl?: string;
|
|
1314
|
-
}
|
|
1315
|
-
/** @public */
|
|
1316
|
-
declare interface Reference {
|
|
1317
|
-
_type: string;
|
|
1318
|
-
_ref: string;
|
|
1319
|
-
_key?: string;
|
|
1320
|
-
_weak?: boolean;
|
|
1321
|
-
_strengthenOnPublish?: {
|
|
1322
|
-
type: string;
|
|
1323
|
-
weak?: boolean;
|
|
1324
|
-
template?: {
|
|
1325
|
-
id: string;
|
|
1326
|
-
params: Record<string, string | number | boolean>;
|
|
1327
|
-
};
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1330
|
-
/** @public */
|
|
1331
|
-
declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
|
|
1332
|
-
disableNew?: boolean;
|
|
1333
|
-
}
|
|
1334
|
-
/** @public */
|
|
1335
|
-
declare interface ReferenceDefinition extends BaseSchemaDefinition {
|
|
1336
|
-
type: 'reference';
|
|
1337
|
-
to: ReferenceTo;
|
|
1338
|
-
weak?: boolean;
|
|
1339
|
-
options?: ReferenceOptions;
|
|
1340
|
-
validation?: ValidationBuilder<ReferenceRule, ReferenceValue>;
|
|
1341
|
-
initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>;
|
|
1342
|
-
}
|
|
1343
|
-
/** @public */
|
|
1344
|
-
declare type ReferenceFilterOptions = ReferenceFilterResolverOptions | ReferenceFilterQueryOptions;
|
|
1345
|
-
/** @public */
|
|
1346
|
-
declare interface ReferenceFilterQueryOptions {
|
|
1347
|
-
filter: string;
|
|
1348
|
-
filterParams?: Record<string, unknown>;
|
|
1349
|
-
}
|
|
1350
|
-
/** @public */
|
|
1351
|
-
declare type ReferenceFilterResolver = (context: ReferenceFilterResolverContext) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>;
|
|
1352
|
-
/** @public */
|
|
1353
|
-
declare interface ReferenceFilterResolverContext {
|
|
1354
|
-
document: SanityDocument;
|
|
1355
|
-
parent?: Record<string, unknown> | Record<string, unknown>[];
|
|
1356
|
-
parentPath: Path;
|
|
1357
|
-
perspective: StackablePerspective[];
|
|
1358
|
-
getClient: (options: {
|
|
1359
|
-
apiVersion: string;
|
|
1360
|
-
}) => SanityClient;
|
|
1361
|
-
}
|
|
1362
|
-
/** @public */
|
|
1363
|
-
declare interface ReferenceFilterResolverOptions {
|
|
1364
|
-
filter?: ReferenceFilterResolver;
|
|
1365
|
-
filterParams?: never;
|
|
1366
|
-
}
|
|
1367
|
-
/** @public */
|
|
1368
|
-
declare type ReferenceFilterSearchOptions = {
|
|
1369
|
-
filter?: string;
|
|
1370
|
-
params?: Record<string, unknown>;
|
|
1371
|
-
tag?: string;
|
|
1372
|
-
maxFieldDepth?: number;
|
|
1373
|
-
strategy?: SearchStrategy;
|
|
1374
|
-
perspective?: Exclude<ClientPerspective, 'raw' | 'previewDrafts'>;
|
|
1375
|
-
};
|
|
1376
|
-
/**
|
|
1377
|
-
* Types are closed for extension. To add properties via declaration merging to this type,
|
|
1378
|
-
* redeclare and add the properties to the interfaces that make up ReferenceOptions type.
|
|
1379
|
-
*
|
|
1380
|
-
* @see ReferenceFilterOptions
|
|
1381
|
-
* @see ReferenceFilterResolverOptions
|
|
1382
|
-
* @see ReferenceBaseOptions
|
|
1383
|
-
*
|
|
1384
|
-
* @public
|
|
1385
|
-
*/
|
|
1386
|
-
declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions;
|
|
1387
|
-
/** @public */
|
|
1388
|
-
declare interface ReferenceRule extends RuleDef<ReferenceRule, ReferenceValue> {}
|
|
1389
|
-
/** @public */
|
|
1390
|
-
declare interface ReferenceSchemaType extends Omit<ObjectSchemaType, 'options'> {
|
|
1391
|
-
jsonType: 'object';
|
|
1392
|
-
to: ObjectSchemaType[];
|
|
1393
|
-
weak?: boolean;
|
|
1394
|
-
options?: ReferenceOptions;
|
|
1395
|
-
}
|
|
1396
|
-
/** @public */
|
|
1397
|
-
declare type ReferenceTo = SchemaTypeDefinition | TypeReference | Array<SchemaTypeDefinition | TypeReference>;
|
|
1398
|
-
/** @public */
|
|
1399
|
-
declare type ReferenceValue = Reference;
|
|
1400
|
-
/** @public */
|
|
1401
|
-
declare interface Role {
|
|
1402
|
-
name: string;
|
|
1403
|
-
title: string;
|
|
1404
|
-
description?: string;
|
|
1405
|
-
}
|
|
1406
|
-
/** @public */
|
|
1407
|
-
declare interface Rule {
|
|
1408
|
-
/**
|
|
1409
|
-
* @internal
|
|
1410
|
-
* @deprecated internal use only
|
|
1411
|
-
*/
|
|
1412
|
-
_type: RuleTypeConstraint | undefined;
|
|
1413
|
-
/**
|
|
1414
|
-
* @internal
|
|
1415
|
-
* @deprecated internal use only
|
|
1416
|
-
*/
|
|
1417
|
-
_level: 'error' | 'warning' | 'info' | undefined;
|
|
1418
|
-
/**
|
|
1419
|
-
* @internal
|
|
1420
|
-
* @deprecated internal use only
|
|
1421
|
-
*/
|
|
1422
|
-
_required: 'required' | 'optional' | undefined;
|
|
1423
|
-
/**
|
|
1424
|
-
* @internal
|
|
1425
|
-
* @deprecated internal use only
|
|
1426
|
-
*/
|
|
1427
|
-
_typeDef: SchemaType | undefined;
|
|
1428
|
-
/**
|
|
1429
|
-
* @internal
|
|
1430
|
-
* @deprecated internal use only
|
|
1431
|
-
*/
|
|
1432
|
-
_message: string | LocalizedValidationMessages | undefined;
|
|
1433
|
-
/**
|
|
1434
|
-
* @internal
|
|
1435
|
-
* @deprecated internal use only
|
|
1436
|
-
*/
|
|
1437
|
-
_rules: RuleSpec[];
|
|
1438
|
-
/**
|
|
1439
|
-
* @internal
|
|
1440
|
-
* @deprecated internal use only
|
|
1441
|
-
*/
|
|
1442
|
-
_fieldRules: FieldRules | undefined;
|
|
1443
|
-
/**
|
|
1444
|
-
* Takes in a path and returns an object with a symbol.
|
|
1445
|
-
*
|
|
1446
|
-
* When the validation lib sees this symbol, it will use the provided path to
|
|
1447
|
-
* get a value from the current field's parent and use that value as the input
|
|
1448
|
-
* to the Rule.
|
|
1449
|
-
*
|
|
1450
|
-
* The path that's given is forwarded to `lodash/get`
|
|
1451
|
-
*
|
|
1452
|
-
* ```js
|
|
1453
|
-
* fields: [
|
|
1454
|
-
* // ...
|
|
1455
|
-
* {
|
|
1456
|
-
* // ...
|
|
1457
|
-
* name: 'highestTemperature',
|
|
1458
|
-
* type: 'number',
|
|
1459
|
-
* validation: (Rule) => Rule.positive().min(Rule.valueOfField('lowestTemperature')),
|
|
1460
|
-
* // ...
|
|
1461
|
-
* },
|
|
1462
|
-
* ]
|
|
1463
|
-
* ```
|
|
1464
|
-
*/
|
|
1465
|
-
valueOfField: (path: string | string[]) => FieldReference;
|
|
1466
|
-
error(message?: string | LocalizedValidationMessages): Rule;
|
|
1467
|
-
warning(message?: string | LocalizedValidationMessages): Rule;
|
|
1468
|
-
info(message?: string | LocalizedValidationMessages): Rule;
|
|
1469
|
-
reset(): this;
|
|
1470
|
-
isRequired(): boolean;
|
|
1471
|
-
clone(): Rule;
|
|
1472
|
-
cloneWithRules(rules: RuleSpec[]): Rule;
|
|
1473
|
-
merge(rule: Rule): Rule;
|
|
1474
|
-
type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule;
|
|
1475
|
-
all(children: Rule[]): Rule;
|
|
1476
|
-
either(children: Rule[]): Rule;
|
|
1477
|
-
optional(): Rule;
|
|
1478
|
-
required(): Rule;
|
|
1479
|
-
custom<T$1 = unknown>(fn: CustomValidator<T$1>, options?: {
|
|
1480
|
-
bypassConcurrencyLimit?: boolean;
|
|
1481
|
-
}): Rule;
|
|
1482
|
-
media<T$1 extends MediaAssetTypes = MediaAssetTypes>(fn: MediaValidator<T$1>): Rule;
|
|
1483
|
-
min(len: number | string | FieldReference): Rule;
|
|
1484
|
-
max(len: number | string | FieldReference): Rule;
|
|
1485
|
-
length(len: number | FieldReference): Rule;
|
|
1486
|
-
valid(value: unknown | unknown[]): Rule;
|
|
1487
|
-
integer(): Rule;
|
|
1488
|
-
precision(limit: number | FieldReference): Rule;
|
|
1489
|
-
positive(): Rule;
|
|
1490
|
-
negative(): Rule;
|
|
1491
|
-
greaterThan(num: number | FieldReference): Rule;
|
|
1492
|
-
lessThan(num: number | FieldReference): Rule;
|
|
1493
|
-
uppercase(): Rule;
|
|
1494
|
-
lowercase(): Rule;
|
|
1495
|
-
regex(pattern: RegExp, name: string, options: {
|
|
1496
|
-
name?: string;
|
|
1497
|
-
invert?: boolean;
|
|
1498
|
-
}): Rule;
|
|
1499
|
-
regex(pattern: RegExp, options: {
|
|
1500
|
-
name?: string;
|
|
1501
|
-
invert?: boolean;
|
|
1502
|
-
}): Rule;
|
|
1503
|
-
regex(pattern: RegExp, name: string): Rule;
|
|
1504
|
-
regex(pattern: RegExp): Rule;
|
|
1505
|
-
email(): Rule;
|
|
1506
|
-
uri(options?: UriValidationOptions): Rule;
|
|
1507
|
-
unique(): Rule;
|
|
1508
|
-
reference(): Rule;
|
|
1509
|
-
fields(rules: FieldRules): Rule;
|
|
1510
|
-
assetRequired(): Rule;
|
|
1511
|
-
validate(value: unknown, options: ValidationContext & {
|
|
1512
|
-
/**
|
|
1513
|
-
* @deprecated Internal use only
|
|
1514
|
-
* @internal
|
|
1515
|
-
*/
|
|
1516
|
-
__internal?: {
|
|
1517
|
-
customValidationConcurrencyLimiter?: {
|
|
1518
|
-
ready: () => Promise<void>;
|
|
1519
|
-
release: () => void;
|
|
1520
|
-
};
|
|
1521
|
-
};
|
|
1522
|
-
}): Promise<ValidationMarker[]>;
|
|
1523
|
-
}
|
|
1524
|
-
/** @public */
|
|
1525
|
-
declare type RuleBuilder<T$1 extends RuleDef<T$1, FieldValue>, FieldValue = unknown> = T$1 | T$1[];
|
|
1526
|
-
/** @public */
|
|
1527
|
-
declare interface RuleDef<T$1, FieldValue = unknown> {
|
|
1528
|
-
required: () => T$1;
|
|
1529
|
-
custom: <LenientFieldValue extends FieldValue>(fn: CustomValidator<LenientFieldValue | undefined>) => T$1;
|
|
1530
|
-
info: (message?: string | LocalizedValidationMessages) => T$1;
|
|
1531
|
-
error: (message?: string | LocalizedValidationMessages) => T$1;
|
|
1532
|
-
warning: (message?: string | LocalizedValidationMessages) => T$1;
|
|
1533
|
-
valueOfField: (path: string | string[]) => FieldReference;
|
|
1534
|
-
}
|
|
1535
|
-
/** @public */
|
|
1536
|
-
declare type RuleSpec = {
|
|
1537
|
-
flag: 'integer';
|
|
1538
|
-
} | {
|
|
1539
|
-
flag: 'email';
|
|
1540
|
-
} | {
|
|
1541
|
-
flag: 'unique';
|
|
1542
|
-
} | {
|
|
1543
|
-
flag: 'reference';
|
|
1544
|
-
} | {
|
|
1545
|
-
flag: 'type';
|
|
1546
|
-
constraint: RuleTypeConstraint;
|
|
1547
|
-
} | {
|
|
1548
|
-
flag: 'all';
|
|
1549
|
-
constraint: Rule[];
|
|
1550
|
-
} | {
|
|
1551
|
-
flag: 'either';
|
|
1552
|
-
constraint: Rule[];
|
|
1553
|
-
} | {
|
|
1554
|
-
flag: 'presence';
|
|
1555
|
-
constraint: 'optional' | 'required';
|
|
1556
|
-
} | {
|
|
1557
|
-
flag: 'custom';
|
|
1558
|
-
constraint: CustomValidator;
|
|
1559
|
-
} | {
|
|
1560
|
-
flag: 'min';
|
|
1561
|
-
constraint: number | string | FieldReference;
|
|
1562
|
-
} | {
|
|
1563
|
-
flag: 'max';
|
|
1564
|
-
constraint: number | string | FieldReference;
|
|
1565
|
-
} | {
|
|
1566
|
-
flag: 'length';
|
|
1567
|
-
constraint: number | FieldReference;
|
|
1568
|
-
} | {
|
|
1569
|
-
flag: 'valid';
|
|
1570
|
-
constraint: unknown[];
|
|
1571
|
-
} | {
|
|
1572
|
-
flag: 'precision';
|
|
1573
|
-
constraint: number | FieldReference;
|
|
1574
|
-
} | {
|
|
1575
|
-
flag: 'lessThan';
|
|
1576
|
-
constraint: number | FieldReference;
|
|
1577
|
-
} | {
|
|
1578
|
-
flag: 'greaterThan';
|
|
1579
|
-
constraint: number | FieldReference;
|
|
1580
|
-
} | {
|
|
1581
|
-
flag: 'stringCasing';
|
|
1582
|
-
constraint: 'uppercase' | 'lowercase';
|
|
1583
|
-
} | {
|
|
1584
|
-
flag: 'assetRequired';
|
|
1585
|
-
constraint: {
|
|
1586
|
-
assetType: 'asset' | 'image' | 'file';
|
|
1587
|
-
};
|
|
1588
|
-
} | {
|
|
1589
|
-
flag: 'media';
|
|
1590
|
-
constraint: MediaValidator<any>;
|
|
1591
|
-
} | {
|
|
1592
|
-
flag: 'regex';
|
|
1593
|
-
constraint: {
|
|
1594
|
-
pattern: RegExp;
|
|
1595
|
-
name?: string;
|
|
1596
|
-
invert: boolean;
|
|
1597
|
-
};
|
|
1598
|
-
} | {
|
|
1599
|
-
flag: 'uri';
|
|
1600
|
-
constraint: {
|
|
1601
|
-
options: {
|
|
1602
|
-
scheme: RegExp[];
|
|
1603
|
-
allowRelative: boolean;
|
|
1604
|
-
relativeOnly: boolean;
|
|
1605
|
-
allowCredentials: boolean;
|
|
1606
|
-
};
|
|
1607
|
-
};
|
|
1608
|
-
};
|
|
1609
|
-
/** @public */
|
|
1610
|
-
declare type RuleTypeConstraint = 'Array' | 'Boolean' | 'Date' | 'Number' | 'Object' | 'String';
|
|
1611
|
-
/**
|
|
1612
|
-
* Options for configuring how Sanity Create interfaces with the type or field.
|
|
1613
|
-
*
|
|
1614
|
-
* @public
|
|
1615
|
-
*/
|
|
1616
|
-
declare interface SanityCreateOptions {
|
|
1617
|
-
/** Set to true to exclude a type or field from appearing in Sanity Create */
|
|
1618
|
-
exclude?: boolean;
|
|
1619
|
-
/**
|
|
1620
|
-
* A short description of what the type or field is used for.
|
|
1621
|
-
* Purpose can be used to improve how and when content mapping uses the field.
|
|
1622
|
-
* */
|
|
1623
|
-
purpose?: string;
|
|
1624
|
-
}
|
|
1625
|
-
/** @public */
|
|
1626
|
-
declare interface SanityDocument {
|
|
1627
|
-
_id: string;
|
|
1628
|
-
_type: string;
|
|
1629
|
-
_createdAt: string;
|
|
1630
|
-
_updatedAt: string;
|
|
1631
|
-
_rev: string;
|
|
1632
|
-
[key: string]: unknown;
|
|
1633
|
-
}
|
|
1634
|
-
/** @public */
|
|
1635
|
-
declare interface Schema$1 {
|
|
1636
|
-
/** @internal */
|
|
1637
|
-
_original?: {
|
|
1638
|
-
name: string;
|
|
1639
|
-
types: SchemaTypeDefinition[];
|
|
1640
|
-
};
|
|
1641
|
-
/** @internal */
|
|
1642
|
-
_registry: {
|
|
1643
|
-
[typeName: string]: any;
|
|
1644
|
-
};
|
|
1645
|
-
/** @internal */
|
|
1646
|
-
_validation?: SchemaValidationProblemGroup[];
|
|
1647
|
-
name: string;
|
|
1648
|
-
get: (name: string) => SchemaType | undefined;
|
|
1649
|
-
has: (name: string) => boolean;
|
|
1650
|
-
getTypeNames: () => string[];
|
|
1651
|
-
/**
|
|
1652
|
-
* Returns the types which were explicitly defined in this schema,
|
|
1653
|
-
* as opposed to the types which were inherited from the parent.
|
|
1654
|
-
*/
|
|
1655
|
-
getLocalTypeNames: () => string[];
|
|
1656
|
-
/**
|
|
1657
|
-
* Returns the parent schema.
|
|
1658
|
-
*/
|
|
1659
|
-
parent?: Schema$1;
|
|
1660
|
-
}
|
|
1661
|
-
/**
|
|
1662
|
-
* Note: you probably want `SchemaTypeDefinition` instead
|
|
1663
|
-
* @see SchemaTypeDefinition
|
|
1664
|
-
*
|
|
1665
|
-
* @public
|
|
1666
|
-
*/
|
|
1667
|
-
declare type SchemaType = ArraySchemaType | BooleanSchemaType | FileSchemaType | NumberSchemaType | ObjectSchemaType | StringSchemaType | ReferenceSchemaType;
|
|
1668
|
-
/**
|
|
1669
|
-
* Represents a Sanity schema type definition with an optional type parameter.
|
|
1670
|
-
*
|
|
1671
|
-
* It's recommend to use the `defineType` helper instead of this type by
|
|
1672
|
-
* itself.
|
|
1673
|
-
*
|
|
1674
|
-
* @see defineType
|
|
1675
|
-
*
|
|
1676
|
-
* @public
|
|
1677
|
-
*/
|
|
1678
|
-
declare type SchemaTypeDefinition<TType$1 extends IntrinsicTypeName = IntrinsicTypeName> = IntrinsicDefinitions[IntrinsicTypeName] | TypeAliasDefinition<string, TType$1>;
|
|
1679
|
-
/** @public */
|
|
1680
|
-
declare interface SchemaValidationError {
|
|
1681
|
-
helpId?: string;
|
|
1682
|
-
message: string;
|
|
1683
|
-
severity: 'error';
|
|
1684
|
-
}
|
|
1685
|
-
/** @internal */
|
|
1686
|
-
declare type SchemaValidationProblem = SchemaValidationError | SchemaValidationWarning;
|
|
1687
|
-
/** @internal */
|
|
1688
|
-
declare interface SchemaValidationProblemGroup {
|
|
1689
|
-
path: SchemaValidationProblemPath;
|
|
1690
|
-
problems: SchemaValidationProblem[];
|
|
1691
|
-
}
|
|
1692
|
-
/** @internal */
|
|
1693
|
-
declare type SchemaValidationProblemPath = Array<{
|
|
1694
|
-
kind: 'type';
|
|
1695
|
-
type: string;
|
|
1696
|
-
name?: string;
|
|
1697
|
-
} | {
|
|
1698
|
-
kind: 'property';
|
|
1699
|
-
name: string;
|
|
1700
|
-
}>;
|
|
1701
|
-
/**
|
|
1702
|
-
* Represents the possible values of a schema type's `validation` field.
|
|
1703
|
-
*
|
|
1704
|
-
* If the schema has not been run through `inferFromSchema` from
|
|
1705
|
-
* `sanity/validation` then value could be a function.
|
|
1706
|
-
*
|
|
1707
|
-
* `inferFromSchema` mutates the schema converts this value to an array of
|
|
1708
|
-
* `Rule` instances.
|
|
1709
|
-
*
|
|
1710
|
-
* @privateRemarks
|
|
1711
|
-
*
|
|
1712
|
-
* Usage of the schema inside the studio will almost always be from the compiled
|
|
1713
|
-
* `createSchema` function. In this case, you can cast the value or throw to
|
|
1714
|
-
* narrow the type. E.g.:
|
|
1715
|
-
*
|
|
1716
|
-
* ```ts
|
|
1717
|
-
* if (typeof type.validation === 'function') {
|
|
1718
|
-
* throw new Error(
|
|
1719
|
-
* `Schema type "${type.name}"'s \`validation\` was not run though \`inferFromSchema\``
|
|
1720
|
-
* )
|
|
1721
|
-
* }
|
|
1722
|
-
* ```
|
|
1723
|
-
*
|
|
1724
|
-
* @public
|
|
1725
|
-
*/
|
|
1726
|
-
declare type SchemaValidationValue = false | undefined | Rule | SchemaValidationValue[] | ((rule: Rule) => SchemaValidationValue);
|
|
1727
|
-
/** @internal */
|
|
1728
|
-
declare interface SchemaValidationWarning {
|
|
1729
|
-
helpId?: string;
|
|
1730
|
-
message: string;
|
|
1731
|
-
severity: 'warning';
|
|
1732
|
-
}
|
|
1733
|
-
/** @public */
|
|
1734
|
-
declare interface SearchConfiguration {
|
|
1735
|
-
search?: {
|
|
1736
|
-
/**
|
|
1737
|
-
* Defines a search weight for this field to prioritize its importance
|
|
1738
|
-
* during search operations in the Studio. This setting allows the specified
|
|
1739
|
-
* field to be ranked higher in search results compared to other fields.
|
|
1740
|
-
*
|
|
1741
|
-
* By default, all fields are assigned a weight of 1. However, if a field is
|
|
1742
|
-
* chosen as the `title` in the preview configuration's `select` option, it
|
|
1743
|
-
* will automatically receive a default weight of 10. Similarly, if selected
|
|
1744
|
-
* as the `subtitle`, the default weight is 5. Fields marked as
|
|
1745
|
-
* `hidden: true` (no function) are assigned a weight of 0 by default.
|
|
1746
|
-
*
|
|
1747
|
-
* Note: Search weight configuration is currently supported only for fields
|
|
1748
|
-
* of type string or portable text arrays.
|
|
1749
|
-
*/
|
|
1750
|
-
weight?: number;
|
|
1751
|
-
};
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* @public
|
|
1755
|
-
*/
|
|
1756
|
-
declare const searchStrategies: readonly ['groqLegacy', 'groq2024'];
|
|
1757
|
-
/**
|
|
1758
|
-
* @public
|
|
1759
|
-
*/
|
|
1760
|
-
declare type SearchStrategy = (typeof searchStrategies)[number];
|
|
1761
|
-
/** @public */
|
|
1762
|
-
declare interface SingleFieldSet {
|
|
1763
|
-
single: true;
|
|
1764
|
-
field: ObjectField;
|
|
1765
|
-
hidden?: ConditionalProperty;
|
|
1766
|
-
readOnly?: ConditionalProperty;
|
|
1767
|
-
group?: string | string[];
|
|
1768
|
-
}
|
|
1769
|
-
/** @public */
|
|
1770
|
-
declare interface SlugDefinition extends BaseSchemaDefinition {
|
|
1771
|
-
type: 'slug';
|
|
1772
|
-
options?: SlugOptions;
|
|
1773
|
-
validation?: ValidationBuilder<SlugRule, SlugValue>;
|
|
1774
|
-
initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>;
|
|
1775
|
-
}
|
|
1776
|
-
/** @public */
|
|
1777
|
-
declare type SlugifierFn = (source: string, schemaType: SlugSchemaType, context: SlugSourceContext) => string | Promise<string>;
|
|
1778
|
-
/** @public */
|
|
1779
|
-
declare type SlugIsUniqueValidator = (slug: string, context: SlugValidationContext) => boolean | Promise<boolean>;
|
|
1780
|
-
/** @public */
|
|
1781
|
-
declare interface SlugOptions extends SearchConfiguration, BaseSchemaTypeOptions {
|
|
1782
|
-
source?: string | Path | SlugSourceFn;
|
|
1783
|
-
maxLength?: number;
|
|
1784
|
-
slugify?: SlugifierFn;
|
|
1785
|
-
isUnique?: SlugIsUniqueValidator;
|
|
1786
|
-
disableArrayWarning?: boolean;
|
|
1787
|
-
}
|
|
1788
|
-
/** @public */
|
|
1789
|
-
declare type SlugParent = Record<string, unknown> | Record<string, unknown>[];
|
|
1790
|
-
/** @public */
|
|
1791
|
-
declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
|
|
1792
|
-
/** @public */
|
|
1793
|
-
declare interface SlugSchemaType extends ObjectSchemaType {
|
|
1794
|
-
jsonType: 'object';
|
|
1795
|
-
options?: SlugOptions;
|
|
1796
|
-
}
|
|
1797
|
-
/** @public */
|
|
1798
|
-
declare interface SlugSourceContext {
|
|
1799
|
-
parentPath: Path;
|
|
1800
|
-
parent: SlugParent;
|
|
1801
|
-
projectId: string;
|
|
1802
|
-
dataset: string;
|
|
1803
|
-
schema: Schema$1;
|
|
1804
|
-
currentUser: CurrentUser | null;
|
|
1805
|
-
getClient: (options: {
|
|
1806
|
-
apiVersion: string;
|
|
1807
|
-
}) => SanityClient;
|
|
1808
|
-
}
|
|
1809
|
-
/** @public */
|
|
1810
|
-
declare type SlugSourceFn = (document: SanityDocument, context: SlugSourceContext) => string | Promise<string>;
|
|
1811
|
-
/** @public */
|
|
1812
|
-
declare interface SlugValidationContext extends ValidationContext {
|
|
1813
|
-
parent: SlugParent;
|
|
1814
|
-
type: SlugSchemaType;
|
|
1815
|
-
defaultIsUnique: SlugIsUniqueValidator;
|
|
1816
|
-
}
|
|
1817
|
-
/** @public */
|
|
1818
|
-
declare interface SlugValue {
|
|
1819
|
-
_type: 'slug';
|
|
1820
|
-
current?: string;
|
|
1821
|
-
}
|
|
1822
|
-
/** @beta */
|
|
1823
|
-
declare type SortOrdering = {
|
|
1824
|
-
title: string;
|
|
1825
|
-
i18n?: I18nTextRecord<'title'>;
|
|
1826
|
-
name: string;
|
|
1827
|
-
by: SortOrderingItem[];
|
|
1828
|
-
};
|
|
1829
|
-
/** @beta */
|
|
1830
|
-
declare interface SortOrderingItem {
|
|
1831
|
-
field: string;
|
|
1832
|
-
direction: 'asc' | 'desc';
|
|
1833
|
-
}
|
|
1834
|
-
/** @public */
|
|
1835
|
-
declare interface StringDefinition extends BaseSchemaDefinition {
|
|
1836
|
-
type: 'string';
|
|
1837
|
-
options?: StringOptions;
|
|
1838
|
-
placeholder?: string;
|
|
1839
|
-
validation?: ValidationBuilder<StringRule, string>;
|
|
1840
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
1841
|
-
}
|
|
1842
|
-
/** @public */
|
|
1843
|
-
declare interface StringOptions extends EnumListProps<string>, SearchConfiguration, BaseSchemaTypeOptions {}
|
|
1844
|
-
/** @public */
|
|
1845
|
-
declare interface StringRule extends RuleDef<StringRule, string> {
|
|
1846
|
-
min: (minNumber: number | FieldReference) => StringRule;
|
|
1847
|
-
max: (maxNumber: number | FieldReference) => StringRule;
|
|
1848
|
-
length: (exactLength: number | FieldReference) => StringRule;
|
|
1849
|
-
uppercase: () => StringRule;
|
|
1850
|
-
lowercase: () => StringRule;
|
|
1851
|
-
regex(pattern: RegExp, name: string, options: {
|
|
1852
|
-
name?: string;
|
|
1853
|
-
invert?: boolean;
|
|
1854
|
-
}): StringRule;
|
|
1855
|
-
regex(pattern: RegExp, options: {
|
|
1856
|
-
name?: string;
|
|
1857
|
-
invert?: boolean;
|
|
1858
|
-
}): StringRule;
|
|
1859
|
-
regex(pattern: RegExp, name: string): StringRule;
|
|
1860
|
-
regex(pattern: RegExp): StringRule;
|
|
1861
|
-
email(): StringRule;
|
|
1862
|
-
}
|
|
1863
|
-
/**
|
|
1864
|
-
* This is used for string, text, date and datetime.
|
|
1865
|
-
* This interface represent the compiled version at runtime, when accessed through Schema.
|
|
1866
|
-
*
|
|
1867
|
-
* @public
|
|
1868
|
-
*/
|
|
1869
|
-
declare interface StringSchemaType extends BaseSchemaType {
|
|
1870
|
-
jsonType: 'string';
|
|
1871
|
-
options?: StringOptions & TextOptions & DateOptions & DatetimeOptions;
|
|
1872
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
1873
|
-
}
|
|
1874
|
-
/** @public */
|
|
1875
|
-
declare interface TextDefinition extends BaseSchemaDefinition {
|
|
1876
|
-
type: 'text';
|
|
1877
|
-
rows?: number;
|
|
1878
|
-
options?: TextOptions;
|
|
1879
|
-
placeholder?: string;
|
|
1880
|
-
validation?: ValidationBuilder<TextRule, string>;
|
|
1881
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
1882
|
-
}
|
|
1883
|
-
/** @public */
|
|
1884
|
-
declare interface TextOptions extends StringOptions {}
|
|
1885
|
-
/** @public */
|
|
1886
|
-
declare interface TextRule extends StringRule {}
|
|
1887
|
-
/** @public */
|
|
1888
|
-
declare interface TitledListValue<V = unknown> {
|
|
1889
|
-
_key?: string;
|
|
1890
|
-
title: string;
|
|
1891
|
-
value?: V;
|
|
1892
|
-
}
|
|
1893
|
-
/**
|
|
1894
|
-
* Represents a type definition that is an alias/extension of an existing type
|
|
1895
|
-
* in your schema. Creating a type alias will re-register that existing type
|
|
1896
|
-
* under a different name. You can also override the default type options with
|
|
1897
|
-
* a type alias definition.
|
|
1898
|
-
*
|
|
1899
|
-
* @public
|
|
1900
|
-
*/
|
|
1901
|
-
declare interface TypeAliasDefinition<TType$1 extends string, TAlias extends IntrinsicTypeName | undefined> extends BaseSchemaDefinition {
|
|
1902
|
-
type: TType$1;
|
|
1903
|
-
options?: TAlias extends IntrinsicTypeName ? IntrinsicDefinitions[TAlias]['options'] : unknown;
|
|
1904
|
-
validation?: SchemaValidationValue;
|
|
1905
|
-
initialValue?: InitialValueProperty<any, any>;
|
|
1906
|
-
preview?: PreviewConfig;
|
|
1907
|
-
components?: {
|
|
1908
|
-
annotation?: ComponentType<any>;
|
|
1909
|
-
block?: ComponentType<any>;
|
|
1910
|
-
inlineBlock?: ComponentType<any>;
|
|
1911
|
-
diff?: ComponentType<any>;
|
|
1912
|
-
field?: ComponentType<any>;
|
|
1913
|
-
input?: ComponentType<any>;
|
|
1914
|
-
item?: ComponentType<any>;
|
|
1915
|
-
preview?: ComponentType<any>;
|
|
1916
|
-
};
|
|
1917
|
-
}
|
|
1918
|
-
/** @public */
|
|
1919
|
-
declare interface TypedObject {
|
|
1920
|
-
[key: string]: unknown;
|
|
1921
|
-
_type: string;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Represents a reference to another type registered top-level in your schema.
|
|
1925
|
-
*
|
|
1926
|
-
* @public
|
|
1927
|
-
*/
|
|
1928
|
-
declare interface TypeReference {
|
|
1929
|
-
type: string;
|
|
1930
|
-
name?: string;
|
|
1931
|
-
icon?: ComponentType | ReactNode;
|
|
1932
|
-
options?: {
|
|
1933
|
-
[key: string]: unknown;
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
/** @public */
|
|
1937
|
-
declare interface UriValidationOptions {
|
|
1938
|
-
scheme?: (string | RegExp) | Array<string | RegExp>;
|
|
1939
|
-
allowRelative?: boolean;
|
|
1940
|
-
relativeOnly?: boolean;
|
|
1941
|
-
allowCredentials?: boolean;
|
|
1942
|
-
}
|
|
1943
|
-
/** @public */
|
|
1944
|
-
declare interface UrlDefinition extends BaseSchemaDefinition {
|
|
1945
|
-
type: 'url';
|
|
1946
|
-
options?: UrlOptions;
|
|
1947
|
-
placeholder?: string;
|
|
1948
|
-
validation?: ValidationBuilder<UrlRule, string>;
|
|
1949
|
-
initialValue?: InitialValueProperty<any, string>;
|
|
1950
|
-
}
|
|
1951
|
-
/** @public */
|
|
1952
|
-
declare interface UrlOptions extends BaseSchemaTypeOptions {}
|
|
1953
|
-
/** @public */
|
|
1954
|
-
declare interface UrlRule extends RuleDef<UrlRule, string> {
|
|
1955
|
-
uri(options: UriValidationOptions): UrlRule;
|
|
1956
|
-
}
|
|
1957
|
-
/** @public */
|
|
1958
|
-
declare type ValidationBuilder<T$1 extends RuleDef<T$1, FieldValue>, FieldValue = unknown> = (rule: T$1) => RuleBuilder<T$1, FieldValue>;
|
|
1959
|
-
/**
|
|
1960
|
-
* A context object passed around during validation. This includes the
|
|
1961
|
-
* `Rule.custom` context.
|
|
1962
|
-
*
|
|
1963
|
-
* e.g.
|
|
1964
|
-
*
|
|
1965
|
-
* ```js
|
|
1966
|
-
* Rule.custom((_, validationContext) => {
|
|
1967
|
-
* // ...
|
|
1968
|
-
* })`
|
|
1969
|
-
* ```
|
|
1970
|
-
*
|
|
1971
|
-
* @public
|
|
1972
|
-
*/
|
|
1973
|
-
declare interface ValidationContext {
|
|
1974
|
-
getClient: (options: {
|
|
1975
|
-
apiVersion: string;
|
|
1976
|
-
}) => SanityClient;
|
|
1977
|
-
schema: Schema$1;
|
|
1978
|
-
parent?: unknown;
|
|
1979
|
-
type?: SchemaType;
|
|
1980
|
-
document?: SanityDocument;
|
|
1981
|
-
path?: Path;
|
|
1982
|
-
getDocumentExists?: (options: {
|
|
1983
|
-
id: string;
|
|
1984
|
-
}) => Promise<boolean>;
|
|
1985
|
-
environment: 'cli' | 'studio';
|
|
1986
|
-
}
|
|
1987
|
-
/**
|
|
1988
|
-
* The shape that can be returned from a custom validator to be converted into
|
|
1989
|
-
* a validation marker by the validation logic. Inside of a custom validator,
|
|
1990
|
-
* you can return an array of these in order to specify multiple paths within
|
|
1991
|
-
* an object or array.
|
|
1992
|
-
*
|
|
1993
|
-
* @public
|
|
1994
|
-
*/
|
|
1995
|
-
declare interface ValidationError {
|
|
1996
|
-
/**
|
|
1997
|
-
* The message describing why the value is not valid. This message will be
|
|
1998
|
-
* included in the validation markers after validation has finished running.
|
|
1999
|
-
*/
|
|
2000
|
-
message: string;
|
|
2001
|
-
/**
|
|
2002
|
-
* If writing a custom validator, you can return validation messages to
|
|
2003
|
-
* specific path inside of the current value (object or array) by populating
|
|
2004
|
-
* this `path` prop.
|
|
2005
|
-
*
|
|
2006
|
-
* NOTE: This path is relative to the current value and _not_ relative to
|
|
2007
|
-
* the document.
|
|
2008
|
-
*/
|
|
2009
|
-
path?: Path;
|
|
2010
|
-
/**
|
|
2011
|
-
* Extra metadata for the validation error. Currently used by the Media Library asset source to ignore
|
|
2012
|
-
* certain validation markers when validating asset source media library assets.
|
|
2013
|
-
*
|
|
2014
|
-
* @internal
|
|
2015
|
-
*/
|
|
2016
|
-
__internal_metadata?: unknown;
|
|
2017
|
-
/**
|
|
2018
|
-
* Same as `path` but allows more than one value. If provided, the same
|
|
2019
|
-
* message will create two markers from each path with the same message
|
|
2020
|
-
* provided.
|
|
2021
|
-
*
|
|
2022
|
-
* @deprecated prefer `path`
|
|
2023
|
-
*/
|
|
2024
|
-
paths?: Path[];
|
|
2025
|
-
/**
|
|
2026
|
-
* @deprecated Unused. Was used to store the results from `.either()` /`.all()`
|
|
2027
|
-
*/
|
|
2028
|
-
children?: ValidationMarker[];
|
|
2029
|
-
/**
|
|
2030
|
-
* @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
|
|
2031
|
-
*/
|
|
2032
|
-
operation?: 'AND' | 'OR';
|
|
2033
|
-
/**
|
|
2034
|
-
* @deprecated Unused. Was relevant when validation error was used as a class.
|
|
2035
|
-
*/
|
|
2036
|
-
cloneWithMessage?(message: string): ValidationError;
|
|
2037
|
-
}
|
|
2038
|
-
/** @public */
|
|
2039
|
-
declare interface ValidationMarker {
|
|
2040
|
-
level: 'error' | 'warning' | 'info';
|
|
2041
|
-
/**
|
|
2042
|
-
* The validation message for this marker. E.g. "Must be greater than 0"
|
|
2043
|
-
*/
|
|
2044
|
-
message: string;
|
|
2045
|
-
/**
|
|
2046
|
-
* @deprecated use `message` instead
|
|
2047
|
-
*/
|
|
2048
|
-
item?: ValidationError;
|
|
2049
|
-
/**
|
|
2050
|
-
* The sanity path _relative to the root of the current document_ to this
|
|
2051
|
-
* marker.
|
|
2052
|
-
*
|
|
2053
|
-
* NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
|
|
2054
|
-
* are not compatible with deep getters like lodash/get
|
|
2055
|
-
*/
|
|
2056
|
-
path: Path;
|
|
2057
|
-
/**
|
|
2058
|
-
* Extra metadata for the validation marker. Currently used by the Media Library asset source to ignore
|
|
2059
|
-
* certain validation markers when validating asset source media library assets.
|
|
2060
|
-
*
|
|
2061
|
-
* @internal
|
|
2062
|
-
*/
|
|
2063
|
-
__internal_metadata?: unknown;
|
|
2064
|
-
}
|
|
2065
14
|
type MIMEType = `${string}/${string}`;
|
|
2066
15
|
/**
|
|
2067
16
|
* @internal
|
|
@@ -2135,8 +84,8 @@ interface PortableTextSlateEditor extends ReactEditor {
|
|
|
2135
84
|
_type: 'editor';
|
|
2136
85
|
createPlaceholderBlock: () => Descendant;
|
|
2137
86
|
history: History;
|
|
2138
|
-
isTextBlock: (value: unknown) => value is PortableTextTextBlock
|
|
2139
|
-
isTextSpan: (value: unknown) => value is PortableTextSpan
|
|
87
|
+
isTextBlock: (value: unknown) => value is PortableTextTextBlock;
|
|
88
|
+
isTextSpan: (value: unknown) => value is PortableTextSpan;
|
|
2140
89
|
isListBlock: (value: unknown) => value is PortableTextListBlock;
|
|
2141
90
|
value: Array<PortableTextBlock>;
|
|
2142
91
|
decoratedRanges: Array<DecoratedRange>;
|
|
@@ -2298,7 +247,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
2298
247
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
2299
248
|
componentWillUnmount(): void;
|
|
2300
249
|
setEditable: (editable: EditableAPI) => void;
|
|
2301
|
-
render():
|
|
250
|
+
render(): react18.JSX.Element;
|
|
2302
251
|
/**
|
|
2303
252
|
* @deprecated
|
|
2304
253
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -2309,7 +258,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
2309
258
|
* const isActive = useEditorSelector(editor, selectors.getActiveAnnotations)
|
|
2310
259
|
* ```
|
|
2311
260
|
*/
|
|
2312
|
-
static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject
|
|
261
|
+
static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[];
|
|
2313
262
|
/**
|
|
2314
263
|
* @deprecated
|
|
2315
264
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -2320,7 +269,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
2320
269
|
* const isActive = useEditorSelector(editor, selectors.isActiveAnnotation(...))
|
|
2321
270
|
* ```
|
|
2322
271
|
*/
|
|
2323
|
-
static isAnnotationActive: (editor: PortableTextEditor, annotationType: PortableTextObject
|
|
272
|
+
static isAnnotationActive: (editor: PortableTextEditor, annotationType: PortableTextObject["_type"]) => boolean;
|
|
2324
273
|
/**
|
|
2325
274
|
* @deprecated
|
|
2326
275
|
* Use `editor.send(...)` instead
|
|
@@ -2369,7 +318,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
2369
318
|
*/
|
|
2370
319
|
static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
|
|
2371
320
|
static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
|
|
2372
|
-
static findByPath: (editor: PortableTextEditor, path: Path) => [PortableTextTextBlock
|
|
321
|
+
static findByPath: (editor: PortableTextEditor, path: Path) => [_sanity_types4.PortableTextTextBlock<PortableTextObject | _sanity_types4.PortableTextSpan> | PortableTextObject | _sanity_types4.PortableTextSpan | undefined, Path | undefined];
|
|
2373
322
|
/**
|
|
2374
323
|
* @deprecated
|
|
2375
324
|
* Use `editor.send(...)` instead
|
|
@@ -2707,7 +656,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
2707
656
|
* ```
|
|
2708
657
|
* @group Components
|
|
2709
658
|
*/
|
|
2710
|
-
declare const PortableTextEditable:
|
|
659
|
+
declare const PortableTextEditable: react18.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react18.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
2711
660
|
/**
|
|
2712
661
|
* @public
|
|
2713
662
|
*/
|
|
@@ -2753,8 +702,8 @@ type AddedAnnotationPaths = {
|
|
|
2753
702
|
};
|
|
2754
703
|
/** @beta */
|
|
2755
704
|
interface EditableAPI {
|
|
2756
|
-
activeAnnotations: () => PortableTextObject
|
|
2757
|
-
isAnnotationActive: (annotationType: PortableTextObject
|
|
705
|
+
activeAnnotations: () => PortableTextObject[];
|
|
706
|
+
isAnnotationActive: (annotationType: PortableTextObject['_type']) => boolean;
|
|
2758
707
|
addAnnotation: <TSchemaType extends {
|
|
2759
708
|
name: string;
|
|
2760
709
|
}>(type: TSchemaType, value?: {
|
|
@@ -3006,7 +955,7 @@ interface BlockRenderProps {
|
|
|
3006
955
|
}
|
|
3007
956
|
/** @beta */
|
|
3008
957
|
interface BlockChildRenderProps {
|
|
3009
|
-
annotations: PortableTextObject
|
|
958
|
+
annotations: PortableTextObject[];
|
|
3010
959
|
children: ReactElement<any>;
|
|
3011
960
|
editorElementRef: RefObject<HTMLElement | null>;
|
|
3012
961
|
focused: boolean;
|
|
@@ -3028,7 +977,7 @@ interface BlockAnnotationRenderProps {
|
|
|
3028
977
|
selected: boolean;
|
|
3029
978
|
/** @deprecated Use `schemaType` instead */
|
|
3030
979
|
type: ObjectSchemaType;
|
|
3031
|
-
value: PortableTextObject
|
|
980
|
+
value: PortableTextObject;
|
|
3032
981
|
}
|
|
3033
982
|
/** @beta */
|
|
3034
983
|
interface BlockDecoratorRenderProps {
|
|
@@ -3044,7 +993,7 @@ interface BlockDecoratorRenderProps {
|
|
|
3044
993
|
}
|
|
3045
994
|
/** @beta */
|
|
3046
995
|
interface BlockListItemRenderProps {
|
|
3047
|
-
block: PortableTextTextBlock
|
|
996
|
+
block: PortableTextTextBlock;
|
|
3048
997
|
children: ReactElement<any>;
|
|
3049
998
|
editorElementRef: RefObject<HTMLElement | null>;
|
|
3050
999
|
focused: boolean;
|
|
@@ -3068,7 +1017,7 @@ type RenderPlaceholderFunction = () => React.ReactNode;
|
|
|
3068
1017
|
type RenderStyleFunction = (props: BlockStyleRenderProps) => JSX.Element;
|
|
3069
1018
|
/** @beta */
|
|
3070
1019
|
interface BlockStyleRenderProps {
|
|
3071
|
-
block: PortableTextTextBlock
|
|
1020
|
+
block: PortableTextTextBlock;
|
|
3072
1021
|
children: ReactElement<any>;
|
|
3073
1022
|
editorElementRef: RefObject<HTMLElement | null>;
|
|
3074
1023
|
focused: boolean;
|
|
@@ -3337,15 +1286,15 @@ type BlockOffset = {
|
|
|
3337
1286
|
path: BlockPath;
|
|
3338
1287
|
offset: number;
|
|
3339
1288
|
};
|
|
3340
|
-
type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
|
|
3341
|
-
_key?: PortableTextTextBlock['_key'];
|
|
1289
|
+
type TextBlockWithOptionalKey = Omit<PortableTextTextBlock$1, '_key'> & {
|
|
1290
|
+
_key?: PortableTextTextBlock$1['_key'];
|
|
3342
1291
|
};
|
|
3343
|
-
type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
3344
|
-
_key?: PortableTextObject['_key'];
|
|
1292
|
+
type ObjectBlockWithOptionalKey = Omit<PortableTextObject$1, '_key'> & {
|
|
1293
|
+
_key?: PortableTextObject$1['_key'];
|
|
3345
1294
|
};
|
|
3346
1295
|
type BlockWithOptionalKey = TextBlockWithOptionalKey | ObjectBlockWithOptionalKey;
|
|
3347
|
-
type SpanWithOptionalKey = Omit<PortableTextSpan, '_key'> & {
|
|
3348
|
-
_key?: PortableTextSpan['_key'];
|
|
1296
|
+
type SpanWithOptionalKey = Omit<PortableTextSpan$1, '_key'> & {
|
|
1297
|
+
_key?: PortableTextSpan$1['_key'];
|
|
3349
1298
|
};
|
|
3350
1299
|
type ChildWithOptionalKey = SpanWithOptionalKey | ObjectBlockWithOptionalKey;
|
|
3351
1300
|
type EditorPriority = {
|
|
@@ -3553,7 +1502,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
3553
1502
|
initialValue?: Array<PortableTextBlock>;
|
|
3554
1503
|
}, xstate228.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
3555
1504
|
type: "blurred";
|
|
3556
|
-
event:
|
|
1505
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
3557
1506
|
} | {
|
|
3558
1507
|
type: "done loading";
|
|
3559
1508
|
} | {
|
|
@@ -3565,7 +1514,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
3565
1514
|
data: unknown;
|
|
3566
1515
|
} | {
|
|
3567
1516
|
type: "focused";
|
|
3568
|
-
event:
|
|
1517
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
3569
1518
|
} | {
|
|
3570
1519
|
type: "invalid value";
|
|
3571
1520
|
resolution: InvalidValueResolution | null;
|
|
@@ -4132,7 +2081,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
4132
2081
|
editor: PortableTextSlateEditor;
|
|
4133
2082
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
4134
2083
|
type: "blurred";
|
|
4135
|
-
event:
|
|
2084
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
4136
2085
|
} | {
|
|
4137
2086
|
type: "done loading";
|
|
4138
2087
|
} | {
|
|
@@ -4144,7 +2093,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
4144
2093
|
data: unknown;
|
|
4145
2094
|
} | {
|
|
4146
2095
|
type: "focused";
|
|
4147
|
-
event:
|
|
2096
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
4148
2097
|
} | {
|
|
4149
2098
|
type: "invalid value";
|
|
4150
2099
|
resolution: InvalidValueResolution | null;
|
|
@@ -4964,7 +2913,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
4964
2913
|
editor: PortableTextSlateEditor;
|
|
4965
2914
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
4966
2915
|
type: "blurred";
|
|
4967
|
-
event:
|
|
2916
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
4968
2917
|
} | {
|
|
4969
2918
|
type: "done loading";
|
|
4970
2919
|
} | {
|
|
@@ -4976,7 +2925,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
4976
2925
|
data: unknown;
|
|
4977
2926
|
} | {
|
|
4978
2927
|
type: "focused";
|
|
4979
|
-
event:
|
|
2928
|
+
event: react18.FocusEvent<HTMLDivElement, Element>;
|
|
4980
2929
|
} | {
|
|
4981
2930
|
type: "invalid value";
|
|
4982
2931
|
resolution: InvalidValueResolution | null;
|
|
@@ -5526,4 +3475,4 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
|
5526
3475
|
event: TBehaviorEvent;
|
|
5527
3476
|
dom: EditorDom;
|
|
5528
3477
|
}, guardResponse: TGuardResponse) => Array<BehaviorAction>;
|
|
5529
|
-
export {
|
|
3478
|
+
export { BlockAnnotationRenderProps as $, EditorEmittedEvent as $t, PortableTextTextBlock$2 as A, ReadyChange as At, EditorSelector as B, ScrollSelectionIntoViewFunction as Bt, ListDefinition as C, OnPasteResultOrPromise as Ct, PortableTextChild$1 as D, PortableTextMemberSchemaTypes as Dt, PortableTextBlock$1 as E, PatchObservable as Et, BlockOffset as F, RenderDecoratorFunction as Ft, EditorConfig as G, AnnotationPath as Gt, EditorProvider as H, UndoChange as Ht, useEditor as I, RenderEditableFunction as It, defineBehavior as J, PortableTextEditable as Jt, EditorEvent as K, BlockPath as Kt, defaultKeyGenerator as L, RenderListItemFunction as Lt, StyleDefinition as M, RenderAnnotationFunction as Mt, StyleSchemaType as N, RenderBlockFunction as Nt, PortableTextObject$2 as O, RangeDecoration as Ot, defineSchema as P, RenderChildFunction as Pt, AddedAnnotationPaths as Q, PortableTextEditorProps as Qt, usePortableTextEditorSelection as R, RenderPlaceholderFunction as Rt, InlineObjectSchemaType as S, OnPasteResult as St, Patch$1 as T, PatchChange as Tt, EditorProviderProps as U, UnsetChange as Ut, useEditorSelector as V, SelectionChange as Vt, Editor as W, ValueChange as Wt, EditorContext as X, HotkeyOptions as Xt, BehaviorGuard as Y, PortableTextEditableProps as Yt, EditorSnapshot as Z, PortableTextEditor as Zt, BlockObjectSchemaType as _, LoadingChange as _t, forward as a, BlurChange as at, FieldDefinition as b, OnCopyFn as bt, CustomBehaviorEvent as c, EditableAPIDeleteOptions as ct, SyntheticBehaviorEvent as d, EditorSelection as dt, MutationEvent as en, BlockChildRenderProps as et, PatchesEvent as f, EditorSelectionPoint as ft, BlockObjectDefinition as g, InvalidValueResolution as gt, BaseDefinition as h, InvalidValue as ht, execute as i, BlockStyleRenderProps as it, SchemaDefinition$1 as j, RedoChange as jt, PortableTextSpan$2 as k, RangeDecorationOnMovedDetails as kt, InsertPlacement as l, EditorChange as lt, AnnotationSchemaType as m, FocusChange as mt, BehaviorActionSet as n, BlockListItemRenderProps as nt, raise as o, ConnectionChange as ot, AnnotationDefinition as p, ErrorChange as pt, Behavior as q, ChildPath as qt, effect as r, BlockRenderProps as rt, BehaviorEvent as s, EditableAPI as st, BehaviorAction as t, EditorSchema as tn, BlockDecoratorRenderProps as tt, NativeBehaviorEvent as u, EditorChanges as ut, DecoratorDefinition as v, MutationChange as vt, ListSchemaType as w, PasteData as wt, InlineObjectDefinition as x, OnPasteFn as xt, DecoratorSchemaType as y, OnBeforeInputFn as yt, usePortableTextEditor as z, RenderStyleFunction as zt };
|