@depup/sanity 5.17.1-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/bin/sanity +209 -0
- package/changes.json +114 -0
- package/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts +16164 -0
- package/lib/_chunks-dts/index.d.ts +780 -0
- package/lib/_chunks-dts/types.d.ts +2765 -0
- package/lib/_chunks-dts/types2.d.ts +656 -0
- package/lib/_chunks-dts/types3.d.ts +303 -0
- package/lib/_chunks-es/BroadcastDisplayedDocument.js +20 -0
- package/lib/_chunks-es/BroadcastDisplayedDocument.js.map +1 -0
- package/lib/_chunks-es/DisplayedDocumentBroadcaster.js +32 -0
- package/lib/_chunks-es/DisplayedDocumentBroadcaster.js.map +1 -0
- package/lib/_chunks-es/LiveQueries.js +339 -0
- package/lib/_chunks-es/LiveQueries.js.map +1 -0
- package/lib/_chunks-es/MenuGroup.js +106 -0
- package/lib/_chunks-es/MenuGroup.js.map +1 -0
- package/lib/_chunks-es/PostMessageDocuments.js +72 -0
- package/lib/_chunks-es/PostMessageDocuments.js.map +1 -0
- package/lib/_chunks-es/PostMessagePerspective.js +23 -0
- package/lib/_chunks-es/PostMessagePerspective.js.map +1 -0
- package/lib/_chunks-es/PostMessagePreviewSnapshots.js +69 -0
- package/lib/_chunks-es/PostMessagePreviewSnapshots.js.map +1 -0
- package/lib/_chunks-es/PostMessageRefreshMutations.js +74 -0
- package/lib/_chunks-es/PostMessageRefreshMutations.js.map +1 -0
- package/lib/_chunks-es/PostMessageSchema.js +502 -0
- package/lib/_chunks-es/PostMessageSchema.js.map +1 -0
- package/lib/_chunks-es/PostMessageTelemetry.js +21 -0
- package/lib/_chunks-es/PostMessageTelemetry.js.map +1 -0
- package/lib/_chunks-es/PresentationToolGrantsCheck.js +3848 -0
- package/lib/_chunks-es/PresentationToolGrantsCheck.js.map +1 -0
- package/lib/_chunks-es/QRCodeSVG.js +692 -0
- package/lib/_chunks-es/QRCodeSVG.js.map +1 -0
- package/lib/_chunks-es/StructureToolProvider.js +2360 -0
- package/lib/_chunks-es/StructureToolProvider.js.map +1 -0
- package/lib/_chunks-es/VideoPlayer.js +22 -0
- package/lib/_chunks-es/VideoPlayer.js.map +1 -0
- package/lib/_chunks-es/ViteDevServerStopped.js +52 -0
- package/lib/_chunks-es/ViteDevServerStopped.js.map +1 -0
- package/lib/_chunks-es/index.js +285 -0
- package/lib/_chunks-es/index.js.map +1 -0
- package/lib/_chunks-es/index2.js +105 -0
- package/lib/_chunks-es/index2.js.map +1 -0
- package/lib/_chunks-es/index3.js +139 -0
- package/lib/_chunks-es/index3.js.map +1 -0
- package/lib/_chunks-es/index4.js +1020 -0
- package/lib/_chunks-es/index4.js.map +1 -0
- package/lib/_chunks-es/pane.js +5 -0
- package/lib/_chunks-es/pane.js.map +1 -0
- package/lib/_chunks-es/pane2.js +5 -0
- package/lib/_chunks-es/pane2.js.map +1 -0
- package/lib/_chunks-es/presentation.js +549 -0
- package/lib/_chunks-es/presentation.js.map +1 -0
- package/lib/_chunks-es/resources.js +303 -0
- package/lib/_chunks-es/resources.js.map +1 -0
- package/lib/_chunks-es/resources2.js +459 -0
- package/lib/_chunks-es/resources2.js.map +1 -0
- package/lib/_chunks-es/resources3.js +281 -0
- package/lib/_chunks-es/resources3.js.map +1 -0
- package/lib/_chunks-es/resources4.js +184 -0
- package/lib/_chunks-es/resources4.js.map +1 -0
- package/lib/_chunks-es/resources5.js +161 -0
- package/lib/_chunks-es/resources5.js.map +1 -0
- package/lib/_chunks-es/resources6.js +141 -0
- package/lib/_chunks-es/resources6.js.map +1 -0
- package/lib/_chunks-es/resources7.js +24 -0
- package/lib/_chunks-es/resources7.js.map +1 -0
- package/lib/_chunks-es/resources8.js +603 -0
- package/lib/_chunks-es/resources8.js.map +1 -0
- package/lib/_chunks-es/resources9.js +126 -0
- package/lib/_chunks-es/resources9.js.map +1 -0
- package/lib/_chunks-es/structureTool.js +13673 -0
- package/lib/_chunks-es/structureTool.js.map +1 -0
- package/lib/_chunks-es/version.js +17 -0
- package/lib/_chunks-es/version.js.map +1 -0
- package/lib/_createContext.d.ts +12 -0
- package/lib/_createContext.js +38 -0
- package/lib/_createContext.js.map +1 -0
- package/lib/_internal.d.ts +9 -0
- package/lib/_internal.js +12 -0
- package/lib/_internal.js.map +1 -0
- package/lib/_singletons.d.ts +951 -0
- package/lib/_singletons.js +284 -0
- package/lib/_singletons.js.map +1 -0
- package/lib/cli.d.ts +3 -0
- package/lib/cli.js +9 -0
- package/lib/cli.js.map +1 -0
- package/lib/desk.d.ts +910 -0
- package/lib/desk.js +71 -0
- package/lib/desk.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +92934 -0
- package/lib/index.js.map +1 -0
- package/lib/media-library.d.ts +85 -0
- package/lib/media-library.js +11 -0
- package/lib/media-library.js.map +1 -0
- package/lib/migrate.d.ts +1 -0
- package/lib/migrate.js +2 -0
- package/lib/migrate.js.map +1 -0
- package/lib/presentation.d.ts +28 -0
- package/lib/presentation.js +10 -0
- package/lib/presentation.js.map +1 -0
- package/lib/router.d.ts +560 -0
- package/lib/router.js +777 -0
- package/lib/router.js.map +1 -0
- package/lib/structure.d.ts +3 -0
- package/lib/structure.js +639 -0
- package/lib/structure.js.map +1 -0
- package/mock-browser-env-stub-loader.mjs +27 -0
- package/package.json +383 -0
- package/static/favicons/apple-touch-icon.png +0 -0
- package/static/favicons/favicon-192.png +0 -0
- package/static/favicons/favicon-512.png +0 -0
- package/static/favicons/favicon-96.png +0 -0
- package/static/favicons/favicon.ico +0 -0
- package/static/favicons/favicon.svg +12 -0
|
@@ -0,0 +1,2765 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { ObjectSchemaType, Path, SanityDocument, SanityDocumentLike, SchemaType, SortOrdering, SortOrderingItem, ValidationMarker } from "@sanity/types";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { SearchParam } from "sanity/router";
|
|
5
|
+
import { ConfigContext, DocumentActionComponent, DocumentBadgeComponent, DocumentFieldAction, DocumentFieldActionNode, DocumentFormNode, DocumentInspector, DocumentLanguageFilterComponent, DocumentStore, EditStateFor, GeneralPreviewLayoutKey, I18nTextRecord as I18nTextRecord$1, InitialValueTemplateItem, LocaleSource, NodeChronologyProps, PatchEvent, PermissionCheckResult, PerspectiveStack, PreviewLayoutKey, ReleaseId, Source, StateTree, TimelineStore } from "sanity";
|
|
6
|
+
/**
|
|
7
|
+
* Intent parameters (json)
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
type IntentJsonParams = {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Base intent parameters
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
* @todo dedupe with core
|
|
19
|
+
*/
|
|
20
|
+
interface BaseIntentParams {
|
|
21
|
+
/**
|
|
22
|
+
* Document schema type name to create/edit.
|
|
23
|
+
* Required for `create` intents, optional for `edit` (but encouraged, safer and faster)
|
|
24
|
+
*/
|
|
25
|
+
type?: string;
|
|
26
|
+
/**
|
|
27
|
+
* ID of the document to create/edit.
|
|
28
|
+
* Required for `edit` intents, optional for `create`.
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Name (ID) of initial value template to use for `create` intent. Optional.
|
|
33
|
+
*/
|
|
34
|
+
template?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Experimental field path
|
|
37
|
+
*
|
|
38
|
+
* @beta
|
|
39
|
+
* @experimental
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
path?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional "mode" to use for edit intent.
|
|
45
|
+
* Known modes are `structure` and `presentation`.
|
|
46
|
+
*/
|
|
47
|
+
mode?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Arbitrary/custom parameters are generally discouraged - try to keep them to a minimum,
|
|
50
|
+
* or use `payload` (arbitrary JSON-serializable object) instead.
|
|
51
|
+
*/
|
|
52
|
+
[key: string]: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
/** @internal */
|
|
55
|
+
declare const DEFAULT_INTENT_HANDLER: unique symbol;
|
|
56
|
+
/**
|
|
57
|
+
* Intent parameters
|
|
58
|
+
* See {@link structure.BaseIntentParams} and {@link structure.IntentJsonParams}
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
type IntentParams = BaseIntentParams | [BaseIntentParams, IntentJsonParams];
|
|
63
|
+
/**
|
|
64
|
+
* Interface for intents
|
|
65
|
+
* @public */
|
|
66
|
+
interface Intent {
|
|
67
|
+
/** Intent type */
|
|
68
|
+
type: string;
|
|
69
|
+
/** Intent parameters. See {@link IntentParams}
|
|
70
|
+
*/
|
|
71
|
+
params?: IntentParams;
|
|
72
|
+
searchParams?: SearchParam[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Interface for intent checker
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
interface IntentChecker {
|
|
80
|
+
(/** Intent name */intentName: string, /** Intent checker parameter */params: {
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}, /** Structure context. See {@link StructureNode} */context: {
|
|
83
|
+
pane: StructureNode;
|
|
84
|
+
index: number;
|
|
85
|
+
}): boolean;
|
|
86
|
+
/** intent checker identify */
|
|
87
|
+
identity?: symbol;
|
|
88
|
+
}
|
|
89
|
+
declare function defaultIntentChecker(intentName: string, params: {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}, {
|
|
92
|
+
pane
|
|
93
|
+
}: {
|
|
94
|
+
pane: StructureNode;
|
|
95
|
+
index: number;
|
|
96
|
+
}): boolean;
|
|
97
|
+
declare namespace defaultIntentChecker {
|
|
98
|
+
var identity: symbol | undefined;
|
|
99
|
+
}
|
|
100
|
+
declare class DividerBuilder implements Serializable<Divider> {
|
|
101
|
+
protected spec: Divider;
|
|
102
|
+
constructor(spec?: Divider);
|
|
103
|
+
/** Set the title of the divider
|
|
104
|
+
* @param title - the title of the divider
|
|
105
|
+
* @returns divider builder based on title provided
|
|
106
|
+
*/
|
|
107
|
+
title(title: string): DividerBuilder;
|
|
108
|
+
/** Get the title of the divider
|
|
109
|
+
* @returns the title of the divider
|
|
110
|
+
*/
|
|
111
|
+
getTitle(): Divider['title'];
|
|
112
|
+
/** Set the i18n key and namespace used to populate the localized title.
|
|
113
|
+
* @param i18n - the key and namespaced used to populate the localized title.
|
|
114
|
+
* @returns divider builder based on i18n key and ns provided
|
|
115
|
+
*/
|
|
116
|
+
i18n(i18n: I18nTextRecord$1<'title'>): DividerBuilder;
|
|
117
|
+
/** Get i18n key and namespace used to populate the localized title
|
|
118
|
+
* @returns the i18n key and namespace used to populate the localized title
|
|
119
|
+
*/
|
|
120
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
121
|
+
/** Serialize the divider
|
|
122
|
+
* @returns the serialized divider
|
|
123
|
+
*/
|
|
124
|
+
serialize(): Divider;
|
|
125
|
+
/** Clone divider builder (allows for options overriding)
|
|
126
|
+
* @param withSpec - divider builder options
|
|
127
|
+
* @returns cloned builder
|
|
128
|
+
*/
|
|
129
|
+
clone(withSpec?: Partial<Divider>): DividerBuilder;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Interface for component views.
|
|
133
|
+
*
|
|
134
|
+
* @public */
|
|
135
|
+
interface ComponentView<TOptions = Record<string, any>> extends BaseView {
|
|
136
|
+
type: 'component';
|
|
137
|
+
/** Component view components. See {@link UserViewComponent} */
|
|
138
|
+
component: UserViewComponent;
|
|
139
|
+
/** Component view options */
|
|
140
|
+
options: TOptions;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Class for building a component view.
|
|
144
|
+
*
|
|
145
|
+
* @public */
|
|
146
|
+
declare class ComponentViewBuilder extends GenericViewBuilder<Partial<ComponentView>, ComponentViewBuilder> {
|
|
147
|
+
/** Partial Component view option object. See {@link ComponentView} */
|
|
148
|
+
protected spec: Partial<ComponentView>;
|
|
149
|
+
constructor(
|
|
150
|
+
/**
|
|
151
|
+
* Component view component or spec
|
|
152
|
+
* @param componentOrSpec - user view component or partial component view. See {@link UserViewComponent} and {@link ComponentView}
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
componentOrSpec?: UserViewComponent | Partial<ComponentView>);
|
|
156
|
+
/** Set view Component
|
|
157
|
+
* @param component - component view component. See {@link UserViewComponent}
|
|
158
|
+
* @returns component view builder based on component view provided. See {@link ComponentViewBuilder}
|
|
159
|
+
*/
|
|
160
|
+
component(component: UserViewComponent): ComponentViewBuilder;
|
|
161
|
+
/** Get view Component
|
|
162
|
+
* @returns Partial component view. See {@link ComponentView}
|
|
163
|
+
*/
|
|
164
|
+
getComponent(): Partial<ComponentView>['component'];
|
|
165
|
+
/** Set view Component options
|
|
166
|
+
* @param options - component view options
|
|
167
|
+
* @returns component view builder based on options provided. See {@link ComponentViewBuilder}
|
|
168
|
+
*/
|
|
169
|
+
options(options: {
|
|
170
|
+
[key: string]: any;
|
|
171
|
+
}): ComponentViewBuilder;
|
|
172
|
+
/** Get view Component options
|
|
173
|
+
* @returns component view options. See {@link ComponentView}
|
|
174
|
+
*/
|
|
175
|
+
getOptions(): ComponentView['options'];
|
|
176
|
+
/** Serialize view Component
|
|
177
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
178
|
+
* @returns component view based on path provided in options. See {@link ComponentView}
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
serialize(options?: SerializeOptions): ComponentView;
|
|
182
|
+
/** Clone Component view builder (allows for options overriding)
|
|
183
|
+
* @param withSpec - partial for component view option. See {@link ComponentView}
|
|
184
|
+
* @returns component view builder. See {@link ComponentViewBuilder}
|
|
185
|
+
*/
|
|
186
|
+
clone(withSpec?: Partial<ComponentView>): ComponentViewBuilder;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Interface for form views.
|
|
190
|
+
*
|
|
191
|
+
* @public */
|
|
192
|
+
interface FormView extends BaseView {
|
|
193
|
+
type: 'form';
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Class for building a form view.
|
|
197
|
+
*
|
|
198
|
+
* @public */
|
|
199
|
+
declare class FormViewBuilder extends GenericViewBuilder<Partial<BaseView>, FormViewBuilder> {
|
|
200
|
+
/** Document list options. See {@link FormView} */
|
|
201
|
+
protected spec: Partial<FormView>;
|
|
202
|
+
constructor(spec?: Partial<FormView>);
|
|
203
|
+
/**
|
|
204
|
+
* Serialize Form view builder
|
|
205
|
+
* @param options - Serialize options. See {@link SerializeOptions}
|
|
206
|
+
* @returns form view builder based on path provided in options. See {@link FormView}
|
|
207
|
+
*/
|
|
208
|
+
serialize(options?: SerializeOptions): FormView;
|
|
209
|
+
/**
|
|
210
|
+
* Clone Form view builder (allows for options overriding)
|
|
211
|
+
* @param withSpec - Partial form view builder options. See {@link FormView}
|
|
212
|
+
* @returns form view builder. See {@link FormViewBuilder}
|
|
213
|
+
*/
|
|
214
|
+
clone(withSpec?: Partial<FormView>): FormViewBuilder;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Interface for base view
|
|
218
|
+
*
|
|
219
|
+
* @public */
|
|
220
|
+
interface BaseView {
|
|
221
|
+
/** View id */
|
|
222
|
+
id: string;
|
|
223
|
+
/** View Title */
|
|
224
|
+
title: string;
|
|
225
|
+
/** View Icon */
|
|
226
|
+
icon?: React.ComponentType | React.ReactNode;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Class for building generic views.
|
|
230
|
+
*
|
|
231
|
+
* @public
|
|
232
|
+
*/
|
|
233
|
+
declare abstract class GenericViewBuilder<TView extends Partial<BaseView>, ConcreteImpl> implements Serializable<BaseView> {
|
|
234
|
+
/** Generic view option object */
|
|
235
|
+
protected spec: TView;
|
|
236
|
+
/** Set generic view ID
|
|
237
|
+
* @param id - generic view ID
|
|
238
|
+
* @returns generic view builder based on ID provided.
|
|
239
|
+
*/
|
|
240
|
+
id(id: string): ConcreteImpl;
|
|
241
|
+
/** Get generic view ID
|
|
242
|
+
* @returns generic view ID
|
|
243
|
+
*/
|
|
244
|
+
getId(): TView['id'];
|
|
245
|
+
/** Set generic view title
|
|
246
|
+
* @param title - generic view title
|
|
247
|
+
* @returns generic view builder based on title provided and (if provided) its ID.
|
|
248
|
+
*/
|
|
249
|
+
title(title: string): ConcreteImpl;
|
|
250
|
+
/** Get generic view title
|
|
251
|
+
* @returns generic view title
|
|
252
|
+
*/
|
|
253
|
+
getTitle(): TView['title'];
|
|
254
|
+
/** Set generic view icon
|
|
255
|
+
* @param icon - generic view icon
|
|
256
|
+
* @returns generic view builder based on icon provided.
|
|
257
|
+
*/
|
|
258
|
+
icon(icon: React.ComponentType | React.ReactNode): ConcreteImpl;
|
|
259
|
+
/** Get generic view icon
|
|
260
|
+
* @returns generic view icon
|
|
261
|
+
*/
|
|
262
|
+
getIcon(): TView['icon'];
|
|
263
|
+
/** Serialize generic view
|
|
264
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
265
|
+
* @returns generic view object based on path provided in options. See {@link BaseView}
|
|
266
|
+
*/
|
|
267
|
+
serialize(options?: SerializeOptions): BaseView;
|
|
268
|
+
/** Clone generic view builder (allows for options overriding)
|
|
269
|
+
* @param withSpec - Partial generic view builder options. See {@link BaseView}
|
|
270
|
+
* @returns Generic view builder.
|
|
271
|
+
*/
|
|
272
|
+
abstract clone(withSpec?: Partial<BaseView>): ConcreteImpl;
|
|
273
|
+
}
|
|
274
|
+
/** @internal */
|
|
275
|
+
declare function maybeSerializeView(item: View | Serializable<View>, index: number, path: SerializePath): View;
|
|
276
|
+
/**
|
|
277
|
+
* View builder. See {@link ComponentViewBuilder} and {@link FormViewBuilder}
|
|
278
|
+
*
|
|
279
|
+
* @public
|
|
280
|
+
*/
|
|
281
|
+
type ViewBuilder = ComponentViewBuilder | FormViewBuilder;
|
|
282
|
+
/**
|
|
283
|
+
* Interface for options of Partial Documents. See {@link PartialDocumentNode}
|
|
284
|
+
*
|
|
285
|
+
* @public */
|
|
286
|
+
interface DocumentOptions {
|
|
287
|
+
/** Document Id */
|
|
288
|
+
id: string;
|
|
289
|
+
/** Document Type */
|
|
290
|
+
type: string;
|
|
291
|
+
/** Document Template */
|
|
292
|
+
template?: string;
|
|
293
|
+
/** Template parameters */
|
|
294
|
+
templateParameters?: Record<string, unknown>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Interface for partial document (focused on the document pane)
|
|
298
|
+
*
|
|
299
|
+
* @public */
|
|
300
|
+
interface PartialDocumentNode {
|
|
301
|
+
/** Document Id */
|
|
302
|
+
id?: string;
|
|
303
|
+
/** Document title */
|
|
304
|
+
title?: string;
|
|
305
|
+
/** I18n key and namespace used to populate the localized title */
|
|
306
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
307
|
+
/** Document children of type {@link Child} */
|
|
308
|
+
child?: Child;
|
|
309
|
+
/**
|
|
310
|
+
* Views for the document pane. See {@link ViewBuilder} and {@link View}
|
|
311
|
+
*/
|
|
312
|
+
views?: (View | ViewBuilder)[];
|
|
313
|
+
/**
|
|
314
|
+
* Document options. See {@link DocumentOptions}
|
|
315
|
+
*/
|
|
316
|
+
options?: Partial<DocumentOptions>;
|
|
317
|
+
/**
|
|
318
|
+
* View IDs to open as split panes by default when the document is opened.
|
|
319
|
+
* Pass an array of view IDs that match the IDs defined in `views`.
|
|
320
|
+
* If specified with 2+ valid view IDs, the document will open in split-pane mode.
|
|
321
|
+
*/
|
|
322
|
+
defaultPanes?: string[];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A `DocumentBuilder` is used to build a document node.
|
|
326
|
+
*
|
|
327
|
+
* @public */
|
|
328
|
+
declare class DocumentBuilder implements Serializable<DocumentNode> {
|
|
329
|
+
/** Component builder option object See {@link PartialDocumentNode} */
|
|
330
|
+
protected spec: PartialDocumentNode;
|
|
331
|
+
protected _context: StructureContext;
|
|
332
|
+
constructor(
|
|
333
|
+
/**
|
|
334
|
+
* Structure context. See {@link StructureContext}
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
_context: StructureContext, spec?: PartialDocumentNode);
|
|
338
|
+
/** Set Document Builder ID
|
|
339
|
+
* @param id - document builder ID
|
|
340
|
+
* @returns document builder based on ID provided. See {@link DocumentBuilder}
|
|
341
|
+
*/
|
|
342
|
+
id(id: string): DocumentBuilder;
|
|
343
|
+
/** Get Document Builder ID
|
|
344
|
+
* @returns document ID. See {@link PartialDocumentNode}
|
|
345
|
+
*/
|
|
346
|
+
getId(): PartialDocumentNode['id'];
|
|
347
|
+
/** Set Document title
|
|
348
|
+
* @param title - document title
|
|
349
|
+
* @returns document builder based on title provided (and ID). See {@link DocumentBuilder}
|
|
350
|
+
*/
|
|
351
|
+
title(title: string): DocumentBuilder;
|
|
352
|
+
/** Get Document title
|
|
353
|
+
* @returns document title. See {@link PartialDocumentNode}
|
|
354
|
+
*/
|
|
355
|
+
getTitle(): PartialDocumentNode['title'];
|
|
356
|
+
/** Set the i18n key and namespace used to populate the localized title.
|
|
357
|
+
* @param i18n - the key and namespaced used to populate the localized title.
|
|
358
|
+
* @returns component builder based on i18n key and ns provided
|
|
359
|
+
*/
|
|
360
|
+
i18n(i18n: I18nTextRecord$1<'title'>): DocumentBuilder;
|
|
361
|
+
/** Get i18n key and namespace used to populate the localized title
|
|
362
|
+
* @returns the i18n key and namespace used to populate the localized title
|
|
363
|
+
*/
|
|
364
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
365
|
+
/** Set Document child
|
|
366
|
+
* @param child - document child
|
|
367
|
+
* @returns document builder based on child provided. See {@link DocumentBuilder}
|
|
368
|
+
*/
|
|
369
|
+
child(child: Child): DocumentBuilder;
|
|
370
|
+
/** Get Document child
|
|
371
|
+
* @returns document child. See {@link PartialDocumentNode}
|
|
372
|
+
*/
|
|
373
|
+
getChild(): PartialDocumentNode['child'];
|
|
374
|
+
/** Set Document ID
|
|
375
|
+
* @param documentId - document ID
|
|
376
|
+
* @returns document builder with document based on ID provided. See {@link DocumentBuilder}
|
|
377
|
+
*/
|
|
378
|
+
documentId(documentId: string): DocumentBuilder;
|
|
379
|
+
/** Get Document ID
|
|
380
|
+
* @returns document ID. See {@link DocumentOptions}
|
|
381
|
+
*/
|
|
382
|
+
getDocumentId(): Partial<DocumentOptions>['id'];
|
|
383
|
+
/** Set Document Type
|
|
384
|
+
* @param documentType - document type
|
|
385
|
+
* @returns document builder with document based on type provided. See {@link DocumentBuilder}
|
|
386
|
+
*/
|
|
387
|
+
schemaType(documentType: SchemaType | string): DocumentBuilder;
|
|
388
|
+
/** Get Document Type
|
|
389
|
+
* @returns document type. See {@link DocumentOptions}
|
|
390
|
+
*/
|
|
391
|
+
getSchemaType(): Partial<DocumentOptions>['type'];
|
|
392
|
+
/** Set Document Template
|
|
393
|
+
* @param templateId - document template ID
|
|
394
|
+
* @param parameters - document template parameters
|
|
395
|
+
* @returns document builder with document based on template provided. See {@link DocumentBuilder}
|
|
396
|
+
*/
|
|
397
|
+
initialValueTemplate(templateId: string, parameters?: Record<string, unknown>): DocumentBuilder;
|
|
398
|
+
/** Get Document Template
|
|
399
|
+
* @returns document template. See {@link DocumentOptions}
|
|
400
|
+
*/
|
|
401
|
+
getInitialValueTemplate(): Partial<DocumentOptions>['template'];
|
|
402
|
+
/** Get Document's initial value Template parameters
|
|
403
|
+
* @returns document template parameters. See {@link DocumentOptions}
|
|
404
|
+
*/
|
|
405
|
+
getInitialValueTemplateParameters(): Partial<DocumentOptions>['templateParameters'];
|
|
406
|
+
/** Set Document views
|
|
407
|
+
* @param views - document views. See {@link ViewBuilder} and {@link View}
|
|
408
|
+
* @returns document builder with document based on views provided. See {@link DocumentBuilder}
|
|
409
|
+
*/
|
|
410
|
+
views(views: (View | ViewBuilder)[]): DocumentBuilder;
|
|
411
|
+
/** Get Document views
|
|
412
|
+
* @returns document views. See {@link ViewBuilder} and {@link View}
|
|
413
|
+
*/
|
|
414
|
+
getViews(): (View | ViewBuilder)[];
|
|
415
|
+
/**
|
|
416
|
+
* Set the view IDs to open as split panes by default when the document is opened.
|
|
417
|
+
* Pass an array of view IDs that match the IDs defined in `views()`.
|
|
418
|
+
* If specified with 2+ valid view IDs, the document will open in split-pane mode.
|
|
419
|
+
*
|
|
420
|
+
* @param viewIds - Array of view IDs to open as split panes
|
|
421
|
+
* @returns document builder with defaultPanes config. See {@link DocumentBuilder}
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* S.document()
|
|
426
|
+
* .schemaType('article')
|
|
427
|
+
* .views([
|
|
428
|
+
* S.view.form().id('editor'),
|
|
429
|
+
* S.view.component(PreviewPane).id('preview').title('Preview')
|
|
430
|
+
* ])
|
|
431
|
+
* .defaultPanes(['editor', 'preview']) // Opens both as split panes
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
defaultPanes(viewIds: string[]): DocumentBuilder;
|
|
435
|
+
/** Serialize Document builder
|
|
436
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
437
|
+
* @returns document node based on path, index and hint provided in options. See {@link DocumentNode}
|
|
438
|
+
*/
|
|
439
|
+
serialize({
|
|
440
|
+
path,
|
|
441
|
+
index,
|
|
442
|
+
hint
|
|
443
|
+
}?: SerializeOptions): DocumentNode;
|
|
444
|
+
/** Clone Document builder
|
|
445
|
+
* @param withSpec - partial document node specification used to extend the cloned builder. See {@link PartialDocumentNode}
|
|
446
|
+
* @returns document builder based on context and spec provided. See {@link DocumentBuilder}
|
|
447
|
+
*/
|
|
448
|
+
clone(withSpec?: PartialDocumentNode): DocumentBuilder;
|
|
449
|
+
}
|
|
450
|
+
/** @internal */
|
|
451
|
+
declare function documentFromEditor(context: StructureContext, spec?: EditorNode): DocumentBuilder;
|
|
452
|
+
/** @internal */
|
|
453
|
+
declare function documentFromEditorWithInitialValue({
|
|
454
|
+
resolveDocumentNode,
|
|
455
|
+
templates
|
|
456
|
+
}: StructureContext, templateId: string, parameters?: Record<string, unknown>): DocumentBuilder;
|
|
457
|
+
/**
|
|
458
|
+
* A `InitialValueTemplateItemBuilder` is used to build a document node with an initial value set.
|
|
459
|
+
*
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
declare class InitialValueTemplateItemBuilder implements Serializable<InitialValueTemplateItem> {
|
|
463
|
+
/** Initial Value template item option object. See {@link InitialValueTemplateItem} */
|
|
464
|
+
protected spec: Partial<InitialValueTemplateItem>;
|
|
465
|
+
protected _context: StructureContext;
|
|
466
|
+
constructor(
|
|
467
|
+
/**
|
|
468
|
+
* Structure context. See {@link StructureContext}
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
_context: StructureContext, spec?: Partial<InitialValueTemplateItem>);
|
|
472
|
+
/** Set initial value template item builder ID
|
|
473
|
+
* @param id - initial value template item ID
|
|
474
|
+
* @returns initial value template item based on ID provided. See {@link InitialValueTemplateItemBuilder}
|
|
475
|
+
*/
|
|
476
|
+
id(id: string): InitialValueTemplateItemBuilder;
|
|
477
|
+
/** Get initial value template item builder ID
|
|
478
|
+
* @returns initial value template item ID. See {@link InitialValueTemplateItem}
|
|
479
|
+
*/
|
|
480
|
+
getId(): Partial<InitialValueTemplateItem>['id'];
|
|
481
|
+
/** Set initial value template item title
|
|
482
|
+
* @param title - initial value template item title
|
|
483
|
+
* @returns initial value template item based on title provided. See {@link InitialValueTemplateItemBuilder}
|
|
484
|
+
*/
|
|
485
|
+
title(title: string): InitialValueTemplateItemBuilder;
|
|
486
|
+
/** Get initial value template item title
|
|
487
|
+
* @returns initial value template item title. See {@link InitialValueTemplateItem}
|
|
488
|
+
*/
|
|
489
|
+
getTitle(): Partial<InitialValueTemplateItem>['title'];
|
|
490
|
+
/** Set initial value template item description
|
|
491
|
+
* @param description - initial value template item description
|
|
492
|
+
* @returns initial value template item builder based on description provided. See {@link InitialValueTemplateItemBuilder}
|
|
493
|
+
*/
|
|
494
|
+
description(description: string): InitialValueTemplateItemBuilder;
|
|
495
|
+
/** Get initial value template item description
|
|
496
|
+
* @returns initial value template item description. See {@link InitialValueTemplateItem}
|
|
497
|
+
*/
|
|
498
|
+
getDescription(): Partial<InitialValueTemplateItem>['description'];
|
|
499
|
+
/** Set initial value template ID
|
|
500
|
+
* @param templateId - initial value template item template ID
|
|
501
|
+
* @returns initial value template item based builder on template ID provided. See {@link InitialValueTemplateItemBuilder}
|
|
502
|
+
*/
|
|
503
|
+
templateId(templateId: string): InitialValueTemplateItemBuilder;
|
|
504
|
+
/** Get initial value template item template ID
|
|
505
|
+
* @returns initial value template item ID. See {@link InitialValueTemplateItem}
|
|
506
|
+
*/
|
|
507
|
+
getTemplateId(): Partial<InitialValueTemplateItem>['templateId'];
|
|
508
|
+
/** Get initial value template item template parameters
|
|
509
|
+
* @param parameters - initial value template item parameters
|
|
510
|
+
* @returns initial value template item builder based on parameters provided. See {@link InitialValueTemplateItemBuilder}
|
|
511
|
+
*/
|
|
512
|
+
parameters(parameters: {
|
|
513
|
+
[key: string]: any;
|
|
514
|
+
}): InitialValueTemplateItemBuilder;
|
|
515
|
+
/** Get initial value template item template parameters
|
|
516
|
+
* @returns initial value template item parameters. See {@link InitialValueTemplateItem}
|
|
517
|
+
*/
|
|
518
|
+
getParameters(): Partial<InitialValueTemplateItem>['parameters'];
|
|
519
|
+
/** Serialize initial value template item
|
|
520
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
521
|
+
* @returns initial value template item object based on the path, index and hint provided in options. See {@link InitialValueTemplateItem}
|
|
522
|
+
*/
|
|
523
|
+
serialize({
|
|
524
|
+
path,
|
|
525
|
+
index,
|
|
526
|
+
hint
|
|
527
|
+
}?: SerializeOptions): InitialValueTemplateItem;
|
|
528
|
+
/** Clone generic view builder (allows for options overriding)
|
|
529
|
+
* @param withSpec - initial value template item builder options. See {@link InitialValueTemplateItemBuilder}
|
|
530
|
+
* @returns initial value template item builder based on the context and options provided. See {@link InitialValueTemplateItemBuilder}
|
|
531
|
+
*/
|
|
532
|
+
clone(withSpec?: Partial<InitialValueTemplateItem>): InitialValueTemplateItemBuilder;
|
|
533
|
+
}
|
|
534
|
+
/** @internal */
|
|
535
|
+
declare function defaultInitialValueTemplateItems(context: StructureContext): InitialValueTemplateItemBuilder[];
|
|
536
|
+
/** @internal */
|
|
537
|
+
declare function maybeSerializeInitialValueTemplateItem(item: InitialValueTemplateItem | InitialValueTemplateItemBuilder, index: number, path: SerializePath): InitialValueTemplateItem;
|
|
538
|
+
/** @internal */
|
|
539
|
+
declare function menuItemsFromInitialValueTemplateItems(context: StructureContext, templateItems: InitialValueTemplateItem[]): MenuItem[];
|
|
540
|
+
/** @internal */
|
|
541
|
+
declare function maybeSerializeMenuItemGroup(item: MenuItemGroup | MenuItemGroupBuilder, index: number, path: SerializePath): MenuItemGroup;
|
|
542
|
+
/**
|
|
543
|
+
* Interface for menu item groups
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
interface MenuItemGroup {
|
|
547
|
+
/** Menu group Id */
|
|
548
|
+
id: string;
|
|
549
|
+
/** Menu group title */
|
|
550
|
+
title: string;
|
|
551
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Class for building menu item groups.
|
|
555
|
+
*
|
|
556
|
+
* @public
|
|
557
|
+
*/
|
|
558
|
+
declare class MenuItemGroupBuilder implements Serializable<MenuItemGroup> {
|
|
559
|
+
/** Menu item group ID */
|
|
560
|
+
protected _id: string;
|
|
561
|
+
/** Menu item group title */
|
|
562
|
+
protected _title: string;
|
|
563
|
+
protected _i18n?: I18nTextRecord$1<'title'>;
|
|
564
|
+
protected _context: StructureContext;
|
|
565
|
+
constructor(
|
|
566
|
+
/**
|
|
567
|
+
* Structure context. See {@link StructureContext}
|
|
568
|
+
*/
|
|
569
|
+
|
|
570
|
+
_context: StructureContext, spec?: MenuItemGroup);
|
|
571
|
+
/**
|
|
572
|
+
* Set menu item group ID
|
|
573
|
+
* @param id - menu item group ID
|
|
574
|
+
* @returns menu item group builder based on ID provided. See {@link MenuItemGroupBuilder}
|
|
575
|
+
*/
|
|
576
|
+
id(id: string): MenuItemGroupBuilder;
|
|
577
|
+
/**
|
|
578
|
+
* Get menu item group ID
|
|
579
|
+
* @returns menu item group ID
|
|
580
|
+
*/
|
|
581
|
+
getId(): string;
|
|
582
|
+
/**
|
|
583
|
+
* Set menu item group title
|
|
584
|
+
* @param title - menu item group title
|
|
585
|
+
* @returns menu item group builder based on title provided. See {@link MenuItemGroupBuilder}
|
|
586
|
+
*/
|
|
587
|
+
title(title: string): MenuItemGroupBuilder;
|
|
588
|
+
/**
|
|
589
|
+
* Get menu item group title
|
|
590
|
+
* @returns menu item group title
|
|
591
|
+
*/
|
|
592
|
+
getTitle(): string;
|
|
593
|
+
/**
|
|
594
|
+
* Set the i18n key and namespace used to populate the localized title.
|
|
595
|
+
* @param i18n - object with i18n key and related namespace
|
|
596
|
+
* @returns menu item group builder based on i18n info provided. See {@link MenuItemGroupBuilder}
|
|
597
|
+
*/
|
|
598
|
+
i18n(i18n: I18nTextRecord$1<'title'>): MenuItemGroupBuilder;
|
|
599
|
+
/**
|
|
600
|
+
* Get the i18n key and namespace used to populate the localized title.
|
|
601
|
+
* @returns the i18n key and namespace used to populate the localized title.
|
|
602
|
+
*/
|
|
603
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
604
|
+
/**
|
|
605
|
+
* Serialize menu item group builder
|
|
606
|
+
* @param options - serialization options (path). See {@link SerializeOptions}
|
|
607
|
+
* @returns menu item group based on path provided in options. See {@link MenuItemGroup}
|
|
608
|
+
*/
|
|
609
|
+
serialize(options?: SerializeOptions): MenuItemGroup;
|
|
610
|
+
}
|
|
611
|
+
/** @internal */
|
|
612
|
+
declare const shallowIntentChecker: IntentChecker;
|
|
613
|
+
/**
|
|
614
|
+
* Interface for list display options
|
|
615
|
+
*
|
|
616
|
+
* @public */
|
|
617
|
+
interface ListDisplayOptions {
|
|
618
|
+
/** Check if list display should show icons */
|
|
619
|
+
showIcons?: boolean;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Interface for base generic list
|
|
623
|
+
*
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
interface BaseGenericList extends StructureNode {
|
|
627
|
+
/** List layout key. */
|
|
628
|
+
defaultLayout?: PreviewLayoutKey;
|
|
629
|
+
/** Can handle intent. See {@link IntentChecker} */
|
|
630
|
+
canHandleIntent?: IntentChecker;
|
|
631
|
+
/** List display options. See {@link ListDisplayOptions} */
|
|
632
|
+
displayOptions?: ListDisplayOptions;
|
|
633
|
+
/** List child. See {@link Child} */
|
|
634
|
+
child: Child;
|
|
635
|
+
/** List initial values array. See {@link InitialValueTemplateItem} and {@link InitialValueTemplateItemBuilder} */
|
|
636
|
+
initialValueTemplates?: (InitialValueTemplateItem | InitialValueTemplateItemBuilder)[];
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Interface for generic list
|
|
640
|
+
*
|
|
641
|
+
* @public
|
|
642
|
+
*/
|
|
643
|
+
interface GenericList extends BaseGenericList {
|
|
644
|
+
/** List type */
|
|
645
|
+
type: string;
|
|
646
|
+
/** List menu items array. See {@link MenuItem} */
|
|
647
|
+
menuItems: MenuItem[];
|
|
648
|
+
/** List menu item groups array. See {@link MenuItemGroup} */
|
|
649
|
+
menuItemGroups: MenuItemGroup[];
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Interface for buildable generic list
|
|
653
|
+
*
|
|
654
|
+
* @public
|
|
655
|
+
*/
|
|
656
|
+
interface BuildableGenericList extends Partial<BaseGenericList> {
|
|
657
|
+
/** List menu items array. See {@link MenuItem} and {@link MenuItemBuilder} */
|
|
658
|
+
menuItems?: (MenuItem | MenuItemBuilder)[];
|
|
659
|
+
/** List menu items groups array. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
|
|
660
|
+
menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[];
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Interface for generic list input
|
|
664
|
+
* Allows builders and only requires things not inferrable
|
|
665
|
+
*
|
|
666
|
+
* @public */
|
|
667
|
+
interface GenericListInput extends StructureNode {
|
|
668
|
+
/** Input id */
|
|
669
|
+
id: string;
|
|
670
|
+
/** Input title */
|
|
671
|
+
title: string;
|
|
672
|
+
/** Input menu items groups. See {@link MenuItem} and {@link MenuItemBuilder} */
|
|
673
|
+
menuItems?: (MenuItem | MenuItemBuilder)[];
|
|
674
|
+
/** Input menu items groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
|
|
675
|
+
menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[];
|
|
676
|
+
/** Input initial value array. See {@link InitialValueTemplateItem} and {@link InitialValueTemplateItemBuilder} */
|
|
677
|
+
initialValueTemplates?: (InitialValueTemplateItem | InitialValueTemplateItemBuilder)[];
|
|
678
|
+
/** Input default layout. */
|
|
679
|
+
defaultLayout?: PreviewLayoutKey;
|
|
680
|
+
/** If input can handle intent. See {@link IntentChecker} */
|
|
681
|
+
canHandleIntent?: IntentChecker;
|
|
682
|
+
/** Input child of type {@link Child} */
|
|
683
|
+
child?: Child;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Class for building generic lists
|
|
687
|
+
*
|
|
688
|
+
* @public
|
|
689
|
+
*/
|
|
690
|
+
declare abstract class GenericListBuilder<TList extends BuildableGenericList, ConcreteImpl> implements Serializable<GenericList> {
|
|
691
|
+
/** Check if initial value templates are set */
|
|
692
|
+
protected initialValueTemplatesSpecified: boolean;
|
|
693
|
+
/** Generic list option object */
|
|
694
|
+
protected spec: TList;
|
|
695
|
+
/** Set generic list ID
|
|
696
|
+
* @param id - generic list ID
|
|
697
|
+
* @returns generic list builder based on ID provided.
|
|
698
|
+
*/
|
|
699
|
+
id(id: string): ConcreteImpl;
|
|
700
|
+
/** Get generic list ID
|
|
701
|
+
* @returns generic list ID
|
|
702
|
+
*/
|
|
703
|
+
getId(): TList['id'];
|
|
704
|
+
/** Set generic list title
|
|
705
|
+
* @param title - generic list title
|
|
706
|
+
* @returns generic list builder based on title and ID provided.
|
|
707
|
+
*/
|
|
708
|
+
title(title: string): ConcreteImpl;
|
|
709
|
+
/** Get generic list title
|
|
710
|
+
* @returns generic list title
|
|
711
|
+
*/
|
|
712
|
+
getTitle(): TList['title'];
|
|
713
|
+
/** Set the i18n key and namespace used to populate the localized title.
|
|
714
|
+
* @param i18n - the key and namespaced used to populate the localized title.
|
|
715
|
+
* @returns component builder based on i18n key and ns provided
|
|
716
|
+
*/
|
|
717
|
+
i18n(i18n: I18nTextRecord$1<'title'>): ConcreteImpl;
|
|
718
|
+
/** Get i18n key and namespace used to populate the localized title
|
|
719
|
+
* @returns the i18n key and namespace used to populate the localized title
|
|
720
|
+
*/
|
|
721
|
+
getI18n(): TList['i18n'];
|
|
722
|
+
/** Set generic list layout
|
|
723
|
+
* @param defaultLayout - generic list layout key.
|
|
724
|
+
* @returns generic list builder based on layout provided.
|
|
725
|
+
*/
|
|
726
|
+
defaultLayout(defaultLayout: PreviewLayoutKey): ConcreteImpl;
|
|
727
|
+
/** Get generic list layout
|
|
728
|
+
* @returns generic list layout
|
|
729
|
+
*/
|
|
730
|
+
getDefaultLayout(): TList['defaultLayout'];
|
|
731
|
+
/** Set generic list menu items
|
|
732
|
+
* @param menuItems - generic list menu items. See {@link MenuItem} and {@link MenuItemBuilder}
|
|
733
|
+
* @returns generic list builder based on menu items provided.
|
|
734
|
+
*/
|
|
735
|
+
menuItems(menuItems: (MenuItem | MenuItemBuilder)[] | undefined): ConcreteImpl;
|
|
736
|
+
/** Get generic list menu items
|
|
737
|
+
* @returns generic list menu items
|
|
738
|
+
*/
|
|
739
|
+
getMenuItems(): TList['menuItems'];
|
|
740
|
+
/** Set generic list menu item groups
|
|
741
|
+
* @param menuItemGroups - generic list menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder}
|
|
742
|
+
* @returns generic list builder based on menu item groups provided.
|
|
743
|
+
*/
|
|
744
|
+
menuItemGroups(menuItemGroups: (MenuItemGroup | MenuItemGroupBuilder)[]): ConcreteImpl;
|
|
745
|
+
/** Get generic list menu item groups
|
|
746
|
+
* @returns generic list menu item groups
|
|
747
|
+
*/
|
|
748
|
+
getMenuItemGroups(): TList['menuItemGroups'];
|
|
749
|
+
/** Set generic list child
|
|
750
|
+
* @param child - generic list child. See {@link Child}
|
|
751
|
+
* @returns generic list builder based on child provided (clone).
|
|
752
|
+
*/
|
|
753
|
+
child(child: Child): ConcreteImpl;
|
|
754
|
+
/** Get generic list child
|
|
755
|
+
* @returns generic list child
|
|
756
|
+
*/
|
|
757
|
+
getChild(): TList['child'];
|
|
758
|
+
/** Set generic list can handle intent
|
|
759
|
+
* @param canHandleIntent - generic list intent checker. See {@link IntentChecker}
|
|
760
|
+
* @returns generic list builder based on can handle intent provided.
|
|
761
|
+
*/
|
|
762
|
+
canHandleIntent(canHandleIntent?: IntentChecker): ConcreteImpl;
|
|
763
|
+
/** Get generic list can handle intent
|
|
764
|
+
* @returns generic list can handle intent
|
|
765
|
+
*/
|
|
766
|
+
getCanHandleIntent(): TList['canHandleIntent'];
|
|
767
|
+
/** Set generic list display options
|
|
768
|
+
* @param enabled - allow / disallow for showing icons
|
|
769
|
+
* @returns generic list builder based on display options (showIcons) provided.
|
|
770
|
+
*/
|
|
771
|
+
showIcons(enabled?: boolean): ConcreteImpl;
|
|
772
|
+
/** Get generic list display options
|
|
773
|
+
* @returns generic list display options (specifically showIcons)
|
|
774
|
+
*/
|
|
775
|
+
getShowIcons(): boolean | undefined;
|
|
776
|
+
/** Set generic list initial value templates
|
|
777
|
+
* @param templates - generic list initial value templates. See {@link InitialValueTemplateItemBuilder}
|
|
778
|
+
* @returns generic list builder based on templates provided.
|
|
779
|
+
*/
|
|
780
|
+
initialValueTemplates(templates: InitialValueTemplateItem | InitialValueTemplateItemBuilder | Array<InitialValueTemplateItem | InitialValueTemplateItemBuilder>): ConcreteImpl;
|
|
781
|
+
/** Get generic list initial value templates
|
|
782
|
+
* @returns generic list initial value templates
|
|
783
|
+
*/
|
|
784
|
+
getInitialValueTemplates(): TList['initialValueTemplates'];
|
|
785
|
+
/** Serialize generic list
|
|
786
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
787
|
+
* @returns generic list object based on path provided in options. See {@link GenericList}
|
|
788
|
+
*/
|
|
789
|
+
serialize(options?: SerializeOptions): GenericList;
|
|
790
|
+
/** Clone generic list builder (allows for options overriding)
|
|
791
|
+
* @param _withSpec - generic list options.
|
|
792
|
+
* @returns generic list builder.
|
|
793
|
+
*/
|
|
794
|
+
abstract clone(_withSpec?: object): ConcreteImpl;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Partial document list
|
|
798
|
+
*
|
|
799
|
+
* @public
|
|
800
|
+
*/
|
|
801
|
+
interface PartialDocumentList extends BuildableGenericList {
|
|
802
|
+
/** Document list options. See {@link DocumentListOptions} */
|
|
803
|
+
options?: DocumentListOptions;
|
|
804
|
+
/** Schema type name */
|
|
805
|
+
schemaTypeName?: string;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Interface for document list input
|
|
809
|
+
*
|
|
810
|
+
* @public
|
|
811
|
+
*/
|
|
812
|
+
interface DocumentListInput extends GenericListInput {
|
|
813
|
+
/** Document list options. See {@link DocumentListOptions} */
|
|
814
|
+
options: DocumentListOptions;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Interface for document list
|
|
818
|
+
*
|
|
819
|
+
* @public
|
|
820
|
+
*/
|
|
821
|
+
interface DocumentList extends GenericList {
|
|
822
|
+
type: 'documentList';
|
|
823
|
+
/** Document list options. See {@link DocumentListOptions} */
|
|
824
|
+
options: DocumentListOptions;
|
|
825
|
+
/** Document list child. See {@link Child} */
|
|
826
|
+
child: Child;
|
|
827
|
+
/** Document schema type name */
|
|
828
|
+
schemaTypeName?: string;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Interface for document List options
|
|
832
|
+
*
|
|
833
|
+
* @public
|
|
834
|
+
*/
|
|
835
|
+
interface DocumentListOptions {
|
|
836
|
+
/** Document list filter */
|
|
837
|
+
filter: string;
|
|
838
|
+
/** Document list parameters */
|
|
839
|
+
params?: Record<string, unknown>;
|
|
840
|
+
/** Document list API version */
|
|
841
|
+
apiVersion?: string;
|
|
842
|
+
/** Document list API default ordering array. */
|
|
843
|
+
defaultOrdering?: SortOrderingItem[];
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Class for building document list
|
|
847
|
+
*
|
|
848
|
+
* @public
|
|
849
|
+
*/
|
|
850
|
+
declare class DocumentListBuilder extends GenericListBuilder<PartialDocumentList, DocumentListBuilder> {
|
|
851
|
+
/** Document list options. See {@link PartialDocumentList} */
|
|
852
|
+
protected spec: PartialDocumentList;
|
|
853
|
+
protected _context: StructureContext;
|
|
854
|
+
constructor(
|
|
855
|
+
/**
|
|
856
|
+
* Structure context. See {@link StructureContext}
|
|
857
|
+
*/
|
|
858
|
+
|
|
859
|
+
_context: StructureContext, spec?: DocumentListInput);
|
|
860
|
+
/** Set API version
|
|
861
|
+
* @param apiVersion - API version
|
|
862
|
+
* @returns document list builder based on the options and API version provided. See {@link DocumentListBuilder}
|
|
863
|
+
*/
|
|
864
|
+
apiVersion(apiVersion: string): DocumentListBuilder;
|
|
865
|
+
/** Get API version
|
|
866
|
+
* @returns API version
|
|
867
|
+
*/
|
|
868
|
+
getApiVersion(): string | undefined;
|
|
869
|
+
/** Set Document list filter
|
|
870
|
+
* @param filter - GROQ-filter used to determine which documents to display. Do not support joins, since they operate on individual documents, and will ignore order-clauses and projections. See {@link https://www.sanity.io/docs/realtime-updates}
|
|
871
|
+
* @returns document list builder based on the options and filter provided. See {@link DocumentListBuilder}
|
|
872
|
+
*/
|
|
873
|
+
filter(filter: string): DocumentListBuilder;
|
|
874
|
+
/** Get Document list filter
|
|
875
|
+
* @returns filter
|
|
876
|
+
*/
|
|
877
|
+
getFilter(): string | undefined;
|
|
878
|
+
/** Set Document list schema type name
|
|
879
|
+
* @param type - schema type name.
|
|
880
|
+
* @returns document list builder based on the schema type name provided. See {@link DocumentListBuilder}
|
|
881
|
+
*/
|
|
882
|
+
schemaType(type: SchemaType | string): DocumentListBuilder;
|
|
883
|
+
/** Get Document list schema type name
|
|
884
|
+
* @returns schema type name
|
|
885
|
+
*/
|
|
886
|
+
getSchemaType(): string | undefined;
|
|
887
|
+
/** Set Document list options' parameters
|
|
888
|
+
* @param params - parameters
|
|
889
|
+
* @returns document list builder based on the options provided. See {@link DocumentListBuilder}
|
|
890
|
+
*/
|
|
891
|
+
params(params: Record<string, unknown>): DocumentListBuilder;
|
|
892
|
+
/** Get Document list options' parameters
|
|
893
|
+
* @returns options
|
|
894
|
+
*/
|
|
895
|
+
getParams(): Record<string, unknown> | undefined;
|
|
896
|
+
/** Set Document list default ordering
|
|
897
|
+
* @param ordering - default sort ordering array. See {@link SortOrderingItem}
|
|
898
|
+
* @returns document list builder based on ordering provided. See {@link DocumentListBuilder}
|
|
899
|
+
*/
|
|
900
|
+
defaultOrdering(ordering: SortOrderingItem[]): DocumentListBuilder;
|
|
901
|
+
/** Get Document list default ordering
|
|
902
|
+
* @returns default ordering. See {@link SortOrderingItem}
|
|
903
|
+
*/
|
|
904
|
+
getDefaultOrdering(): SortOrderingItem[] | undefined;
|
|
905
|
+
/** Serialize Document list
|
|
906
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
907
|
+
* @returns document list object based on path provided in options. See {@link DocumentList}
|
|
908
|
+
*/
|
|
909
|
+
serialize(options?: SerializeOptions): DocumentList;
|
|
910
|
+
/** Clone Document list builder (allows for options overriding)
|
|
911
|
+
* @param withSpec - override document list spec. See {@link PartialDocumentList}
|
|
912
|
+
* @returns document list builder. See {@link DocumentListBuilder}
|
|
913
|
+
*/
|
|
914
|
+
clone(withSpec?: PartialDocumentList): DocumentListBuilder;
|
|
915
|
+
/** Get Document list spec
|
|
916
|
+
* @returns document list spec. See {@link PartialDocumentList}
|
|
917
|
+
*/
|
|
918
|
+
getSpec(): PartialDocumentList;
|
|
919
|
+
}
|
|
920
|
+
/** @internal */
|
|
921
|
+
declare function getTypeNamesFromFilter(filter: string, params?: Record<string, unknown>): string[];
|
|
922
|
+
/**
|
|
923
|
+
* Unserialized list item child.
|
|
924
|
+
* See {@link Collection}, {@link CollectionBuilder}, {@link ChildResolver} and {@link ItemChild}
|
|
925
|
+
*
|
|
926
|
+
* @public
|
|
927
|
+
*/
|
|
928
|
+
type UnserializedListItemChild = Collection | CollectionBuilder | ChildResolver | Observable<ItemChild>;
|
|
929
|
+
/**
|
|
930
|
+
* Child of List Item
|
|
931
|
+
* See {@link Collection}, {@link ChildResolver}, {@link ItemChild}
|
|
932
|
+
* @public
|
|
933
|
+
*/
|
|
934
|
+
type ListItemChild = Collection | ChildResolver | Observable<ItemChild> | undefined;
|
|
935
|
+
/**
|
|
936
|
+
* Interface for serialize list item options
|
|
937
|
+
*
|
|
938
|
+
* @public
|
|
939
|
+
*/
|
|
940
|
+
interface ListItemSerializeOptions extends SerializeOptions {
|
|
941
|
+
/** Check if list item title is optional */
|
|
942
|
+
titleIsOptional?: boolean;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Interface for ist item display options
|
|
946
|
+
*
|
|
947
|
+
* @public */
|
|
948
|
+
interface ListItemDisplayOptions {
|
|
949
|
+
/** Check if list item display should show icon */
|
|
950
|
+
showIcon?: boolean;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* interface for list item input
|
|
954
|
+
*
|
|
955
|
+
* @public */
|
|
956
|
+
interface ListItemInput {
|
|
957
|
+
/** List item id */
|
|
958
|
+
id: string;
|
|
959
|
+
/** List item title */
|
|
960
|
+
title?: string;
|
|
961
|
+
/** List item icon */
|
|
962
|
+
icon?: React.ComponentType | React.ReactNode;
|
|
963
|
+
/** List item child. See {@link ListItemChild} */
|
|
964
|
+
child?: ListItemChild;
|
|
965
|
+
/** List item display options. See {@link ListItemDisplayOptions} */
|
|
966
|
+
displayOptions?: ListItemDisplayOptions;
|
|
967
|
+
/** List item schema type. See {@link SchemaType} */
|
|
968
|
+
schemaType?: SchemaType | string;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Interface for List Item
|
|
972
|
+
*
|
|
973
|
+
* @public */
|
|
974
|
+
interface ListItem {
|
|
975
|
+
/** List item id */
|
|
976
|
+
id: string;
|
|
977
|
+
/** List item type */
|
|
978
|
+
type: string;
|
|
979
|
+
/**
|
|
980
|
+
* The i18n key and namespace used to populate the localized title. This is
|
|
981
|
+
* the recommend way to set the title if you are localizing your studio.
|
|
982
|
+
*/
|
|
983
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
984
|
+
/** List item title. Note that the `i18n` key and namespace will take precedence. */
|
|
985
|
+
title?: string;
|
|
986
|
+
/** List item icon */
|
|
987
|
+
icon?: React.ComponentType | React.ReactNode;
|
|
988
|
+
/** List item child. See {@link ListItemChild} */
|
|
989
|
+
child?: ListItemChild;
|
|
990
|
+
/** List item display options. See {@link ListItemDisplayOptions} */
|
|
991
|
+
displayOptions?: ListItemDisplayOptions;
|
|
992
|
+
/** List item schema type. See {@link SchemaType} */
|
|
993
|
+
schemaType?: SchemaType;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Interface for unserialized list items.
|
|
997
|
+
*
|
|
998
|
+
* @public
|
|
999
|
+
*/
|
|
1000
|
+
interface UnserializedListItem {
|
|
1001
|
+
/** List item ID */
|
|
1002
|
+
id: string;
|
|
1003
|
+
/** List item title */
|
|
1004
|
+
title: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* The i18n key and namespace used to populate the localized title. This is
|
|
1007
|
+
* the recommend way to set the title if you are localizing your studio.
|
|
1008
|
+
*/
|
|
1009
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
1010
|
+
/** List item icon */
|
|
1011
|
+
icon?: React.ComponentType | React.ReactNode;
|
|
1012
|
+
/** List item child. See {@link UnserializedListItemChild} */
|
|
1013
|
+
child?: UnserializedListItemChild;
|
|
1014
|
+
/** List item display options. See {@link ListItemDisplayOptions} */
|
|
1015
|
+
displayOptions?: ListItemDisplayOptions;
|
|
1016
|
+
/** List item schema. See {@link SchemaType} */
|
|
1017
|
+
schemaType?: SchemaType | string;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Partial list item. See {@link UnserializedListItem}
|
|
1021
|
+
*
|
|
1022
|
+
* @public */
|
|
1023
|
+
type PartialListItem = Partial<UnserializedListItem>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Class for building list items
|
|
1026
|
+
*
|
|
1027
|
+
* @public */
|
|
1028
|
+
declare class ListItemBuilder implements Serializable<ListItem> {
|
|
1029
|
+
/** List item option object. See {@link PartialListItem} */
|
|
1030
|
+
protected spec: PartialListItem;
|
|
1031
|
+
protected _context: StructureContext;
|
|
1032
|
+
constructor(
|
|
1033
|
+
/**
|
|
1034
|
+
* Structure context. See {@link StructureContext}
|
|
1035
|
+
*/
|
|
1036
|
+
|
|
1037
|
+
_context: StructureContext, spec?: ListItemInput);
|
|
1038
|
+
/**
|
|
1039
|
+
* Set list item ID
|
|
1040
|
+
* @returns list item builder based on ID provided. See {@link ListItemBuilder}
|
|
1041
|
+
*/
|
|
1042
|
+
id(id: string): ListItemBuilder;
|
|
1043
|
+
/**
|
|
1044
|
+
* Get list item ID
|
|
1045
|
+
* @returns list item ID. See {@link PartialListItem}
|
|
1046
|
+
*/
|
|
1047
|
+
getId(): PartialListItem['id'];
|
|
1048
|
+
/**
|
|
1049
|
+
* Set list item title
|
|
1050
|
+
* @returns list item builder based on title provided. See {@link ListItemBuilder}
|
|
1051
|
+
*/
|
|
1052
|
+
title(title: string): ListItemBuilder;
|
|
1053
|
+
/**
|
|
1054
|
+
* Get list item title
|
|
1055
|
+
* @returns list item title. See {@link PartialListItem}
|
|
1056
|
+
*/
|
|
1057
|
+
getTitle(): PartialListItem['title'];
|
|
1058
|
+
/** Set the i18n key and namespace used to populate the localized title.
|
|
1059
|
+
* @param i18n - the key and namespaced used to populate the localized title.
|
|
1060
|
+
* @returns component builder based on i18n key and ns provided
|
|
1061
|
+
*/
|
|
1062
|
+
i18n(i18n: I18nTextRecord$1<'title'>): ListItemBuilder;
|
|
1063
|
+
/** Get i18n key and namespace used to populate the localized title
|
|
1064
|
+
* @returns the i18n key and namespace used to populate the localized title
|
|
1065
|
+
*/
|
|
1066
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
1067
|
+
/**
|
|
1068
|
+
* Set list item icon
|
|
1069
|
+
* @returns list item builder based on icon provided. See {@link ListItemBuilder}
|
|
1070
|
+
*/
|
|
1071
|
+
icon(icon: React.ComponentType | React.ReactNode): ListItemBuilder;
|
|
1072
|
+
/**
|
|
1073
|
+
* Set if list item should show icon
|
|
1074
|
+
* @returns list item builder based on showIcon provided. See {@link ListItemBuilder}
|
|
1075
|
+
*/
|
|
1076
|
+
showIcon(enabled?: boolean): ListItemBuilder;
|
|
1077
|
+
/**
|
|
1078
|
+
* Check if list item should show icon
|
|
1079
|
+
* @returns true if it should show the icon, false if not, undefined if not set
|
|
1080
|
+
*/
|
|
1081
|
+
getShowIcon(): boolean | undefined;
|
|
1082
|
+
/**
|
|
1083
|
+
*Get list item icon
|
|
1084
|
+
* @returns list item icon. See {@link PartialListItem}
|
|
1085
|
+
*/
|
|
1086
|
+
getIcon(): PartialListItem['icon'];
|
|
1087
|
+
/**
|
|
1088
|
+
* Set list item child
|
|
1089
|
+
* @param child - list item child. See {@link UnserializedListItemChild}
|
|
1090
|
+
* @returns list item builder based on child provided. See {@link ListItemBuilder}
|
|
1091
|
+
*/
|
|
1092
|
+
child(child: UnserializedListItemChild): ListItemBuilder;
|
|
1093
|
+
/**
|
|
1094
|
+
* Get list item child
|
|
1095
|
+
* @returns list item child. See {@link PartialListItem}
|
|
1096
|
+
*/
|
|
1097
|
+
getChild(): PartialListItem['child'];
|
|
1098
|
+
/**
|
|
1099
|
+
* Set list item schema type
|
|
1100
|
+
* @param schemaType - list item schema type. See {@link SchemaType}
|
|
1101
|
+
* @returns list item builder based on schema type provided. See {@link ListItemBuilder}
|
|
1102
|
+
*/
|
|
1103
|
+
schemaType(schemaType: SchemaType | string): ListItemBuilder;
|
|
1104
|
+
/**
|
|
1105
|
+
* Get list item schema type
|
|
1106
|
+
* @returns list item schema type. See {@link PartialListItem}
|
|
1107
|
+
*/
|
|
1108
|
+
getSchemaType(): PartialListItem['schemaType'];
|
|
1109
|
+
/** Serialize list item builder
|
|
1110
|
+
* @param options - serialization options. See {@link ListItemSerializeOptions}
|
|
1111
|
+
* @returns list item node based on path provided in options. See {@link ListItem}
|
|
1112
|
+
*/
|
|
1113
|
+
serialize(options?: ListItemSerializeOptions): ListItem;
|
|
1114
|
+
/** Clone list item builder
|
|
1115
|
+
* @param withSpec - partial list item options. See {@link PartialListItem}
|
|
1116
|
+
* @returns list item builder based on context and spec provided. See {@link ListItemBuilder}
|
|
1117
|
+
*/
|
|
1118
|
+
clone(withSpec?: PartialListItem): ListItemBuilder;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Interface for document list item input
|
|
1122
|
+
*
|
|
1123
|
+
* @public
|
|
1124
|
+
*/
|
|
1125
|
+
interface DocumentListItemInput extends ListItemInput {
|
|
1126
|
+
/** Document list item input schema type. See {@link SchemaType} */
|
|
1127
|
+
schemaType: SchemaType | string;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Interface for document list item
|
|
1131
|
+
*
|
|
1132
|
+
* @public
|
|
1133
|
+
*/
|
|
1134
|
+
interface DocumentListItem extends ListItem {
|
|
1135
|
+
/** Document schema type. See {@link SchemaType} */
|
|
1136
|
+
schemaType: SchemaType;
|
|
1137
|
+
/** Document ID */
|
|
1138
|
+
_id: string;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Partial document list item
|
|
1142
|
+
*
|
|
1143
|
+
* @public
|
|
1144
|
+
*/
|
|
1145
|
+
type PartialDocumentListItem = Partial<UnserializedListItem>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Class for building a document list item
|
|
1148
|
+
*
|
|
1149
|
+
* @public
|
|
1150
|
+
*/
|
|
1151
|
+
declare class DocumentListItemBuilder extends ListItemBuilder {
|
|
1152
|
+
/** Document list options. See {@link PartialDocumentListItem} */
|
|
1153
|
+
protected spec: PartialDocumentListItem;
|
|
1154
|
+
protected _context: StructureContext;
|
|
1155
|
+
constructor(
|
|
1156
|
+
/**
|
|
1157
|
+
* Structure context. See {@link StructureContext}
|
|
1158
|
+
*/
|
|
1159
|
+
|
|
1160
|
+
_context: StructureContext, spec?: DocumentListItemInput);
|
|
1161
|
+
/**
|
|
1162
|
+
* Serialize document list item
|
|
1163
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
1164
|
+
* @returns document list item object based on path provided in options. See {@link DocumentListItem}
|
|
1165
|
+
*/
|
|
1166
|
+
serialize(options?: SerializeOptions): DocumentListItem;
|
|
1167
|
+
/** Clone Document list item builder (allows for options overriding)
|
|
1168
|
+
* @param withSpec - Document list item builder options. See {@link PartialDocumentListItem}
|
|
1169
|
+
* @returns document list item builder. See {@link DocumentListItemBuilder}
|
|
1170
|
+
*/
|
|
1171
|
+
clone(withSpec?: PartialDocumentListItem): DocumentListItemBuilder;
|
|
1172
|
+
}
|
|
1173
|
+
/** @internal */
|
|
1174
|
+
declare function isDocumentListItem(item: unknown): item is DocumentListItem;
|
|
1175
|
+
/**
|
|
1176
|
+
* Interface for document type list input
|
|
1177
|
+
*
|
|
1178
|
+
* @public
|
|
1179
|
+
*/
|
|
1180
|
+
interface DocumentTypeListInput extends Partial<GenericListInput> {
|
|
1181
|
+
/** Document type list input schema type. See {@link SchemaType} */
|
|
1182
|
+
schemaType: SchemaType | string;
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Class for building a document type list
|
|
1186
|
+
*
|
|
1187
|
+
* @public
|
|
1188
|
+
*/
|
|
1189
|
+
declare class DocumentTypeListBuilder extends DocumentListBuilder {
|
|
1190
|
+
/** Document list options. See {@link PartialDocumentList} */
|
|
1191
|
+
protected spec: PartialDocumentList;
|
|
1192
|
+
protected _context: StructureContext;
|
|
1193
|
+
constructor(
|
|
1194
|
+
/**
|
|
1195
|
+
* Structure context. See {@link StructureContext}
|
|
1196
|
+
*/
|
|
1197
|
+
|
|
1198
|
+
_context: StructureContext, spec?: DocumentListInput);
|
|
1199
|
+
/**
|
|
1200
|
+
* Set Document type list child
|
|
1201
|
+
* @param child - Child component. See {@link Child}
|
|
1202
|
+
* @returns document type list builder based on child component provided without default intent handler. See {@link DocumentTypeListBuilder}
|
|
1203
|
+
*/
|
|
1204
|
+
child(child: Child): DocumentTypeListBuilder;
|
|
1205
|
+
/** Clone Document type list builder (allows for options overriding)
|
|
1206
|
+
* @param withSpec - Document type list builder options. See {@link PartialDocumentList}
|
|
1207
|
+
* @returns document type list builder. See {@link DocumentTypeListBuilder}
|
|
1208
|
+
*/
|
|
1209
|
+
clone(withSpec?: PartialDocumentList): DocumentTypeListBuilder;
|
|
1210
|
+
/** Clone Document type list builder (allows for options overriding) and remove default intent handler
|
|
1211
|
+
* @param withSpec - Document type list builder options. See {@link PartialDocumentList}
|
|
1212
|
+
* @returns document type list builder without default intent handler. See {@link DocumentTypeListBuilder}
|
|
1213
|
+
*/
|
|
1214
|
+
cloneWithoutDefaultIntentHandler(withSpec?: PartialDocumentList): DocumentTypeListBuilder;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Interface for List
|
|
1218
|
+
*
|
|
1219
|
+
* @public
|
|
1220
|
+
*/
|
|
1221
|
+
interface List extends GenericList {
|
|
1222
|
+
type: 'list';
|
|
1223
|
+
/** List items. See {@link ListItem} and {@link Divider} */
|
|
1224
|
+
items: (ListItem | Divider)[];
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Interface for list input
|
|
1228
|
+
*
|
|
1229
|
+
* @public
|
|
1230
|
+
*/
|
|
1231
|
+
interface ListInput extends GenericListInput {
|
|
1232
|
+
/** List input items array. See {@link ListItem}, {@link ListItemBuilder} and {@link Divider} */
|
|
1233
|
+
items?: (ListItem | ListItemBuilder | Divider | DividerBuilder)[];
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Interface for buildable list
|
|
1237
|
+
*
|
|
1238
|
+
* @public
|
|
1239
|
+
*/
|
|
1240
|
+
interface BuildableList extends BuildableGenericList {
|
|
1241
|
+
/** List items. See {@link ListItem}, {@link ListItemBuilder} and {@link Divider} */
|
|
1242
|
+
items?: (ListItem | ListItemBuilder | Divider | DividerBuilder)[];
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* A `ListBuilder` is used to build a list of items in the structure tool.
|
|
1246
|
+
*
|
|
1247
|
+
* @public */
|
|
1248
|
+
declare class ListBuilder extends GenericListBuilder<BuildableList, ListBuilder> {
|
|
1249
|
+
/** buildable list option object. See {@link BuildableList} */
|
|
1250
|
+
protected spec: BuildableList;
|
|
1251
|
+
protected _context: StructureContext;
|
|
1252
|
+
constructor(
|
|
1253
|
+
/**
|
|
1254
|
+
* Structure context. See {@link StructureContext}
|
|
1255
|
+
*/
|
|
1256
|
+
|
|
1257
|
+
_context: StructureContext, spec?: ListInput);
|
|
1258
|
+
/**
|
|
1259
|
+
* Set list builder based on items provided
|
|
1260
|
+
* @param items - list items. See {@link ListItemBuilder}, {@link ListItem} and {@link Divider}
|
|
1261
|
+
* @returns list builder based on items provided. See {@link ListBuilder}
|
|
1262
|
+
*/
|
|
1263
|
+
items(items: (ListItemBuilder | ListItem | Divider | DividerBuilder)[]): ListBuilder;
|
|
1264
|
+
/** Get list builder items
|
|
1265
|
+
* @returns list items. See {@link BuildableList}
|
|
1266
|
+
*/
|
|
1267
|
+
getItems(): BuildableList['items'];
|
|
1268
|
+
/** Serialize list builder
|
|
1269
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
1270
|
+
* @returns list based on path in options. See {@link List}
|
|
1271
|
+
*/
|
|
1272
|
+
serialize(options?: SerializeOptions): List;
|
|
1273
|
+
/**
|
|
1274
|
+
* Clone list builder and return new list builder based on context and spec provided
|
|
1275
|
+
* @param withSpec - list options. See {@link BuildableList}
|
|
1276
|
+
* @returns new list builder based on context and spec provided. See {@link ListBuilder}
|
|
1277
|
+
*/
|
|
1278
|
+
clone(withSpec?: BuildableList): ListBuilder;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* View. See {@link FormView} and {@link ComponentView}
|
|
1282
|
+
*
|
|
1283
|
+
* @public
|
|
1284
|
+
*/
|
|
1285
|
+
type View = FormView | ComponentView;
|
|
1286
|
+
/**
|
|
1287
|
+
* User view component
|
|
1288
|
+
*
|
|
1289
|
+
* @public */
|
|
1290
|
+
type UserViewComponent<TOptions = Record<string, any>> = React.ComponentType<{
|
|
1291
|
+
document: {
|
|
1292
|
+
draft: SanityDocument | null;
|
|
1293
|
+
displayed: Partial<SanityDocument>;
|
|
1294
|
+
historical: Partial<SanityDocument> | null;
|
|
1295
|
+
published: SanityDocument | null;
|
|
1296
|
+
};
|
|
1297
|
+
documentId: string;
|
|
1298
|
+
options: TOptions;
|
|
1299
|
+
schemaType: SchemaType;
|
|
1300
|
+
}>;
|
|
1301
|
+
/**
|
|
1302
|
+
* User defined component
|
|
1303
|
+
*
|
|
1304
|
+
* @public
|
|
1305
|
+
*/
|
|
1306
|
+
type UserComponent = React.ComponentType<{
|
|
1307
|
+
/** Component child. See {@link ComponentBuilder} */child?: ComponentBuilder; /** Component child item ID */
|
|
1308
|
+
childItemId?: string; /** Component ID */
|
|
1309
|
+
id: string; /** Is component active */
|
|
1310
|
+
isActive?: boolean; /** Is component selected */
|
|
1311
|
+
isSelected?: boolean; /** item ID */
|
|
1312
|
+
itemId: string; /** Component options */
|
|
1313
|
+
options?: Record<string, unknown>; /** Pane key */
|
|
1314
|
+
paneKey: string; /** URL parameters */
|
|
1315
|
+
urlParams: Record<string, string | undefined> | undefined;
|
|
1316
|
+
}>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Interface for the structure builder context.
|
|
1319
|
+
*
|
|
1320
|
+
* @public
|
|
1321
|
+
*/
|
|
1322
|
+
interface StructureContext extends Source {
|
|
1323
|
+
/** Resolve document method
|
|
1324
|
+
* @returns a document node builder, or null/undefined if no document node should be returned.
|
|
1325
|
+
* See {@link DocumentBuilder}
|
|
1326
|
+
*/
|
|
1327
|
+
resolveDocumentNode: (/** an object holding the documentId and schemaType for the document node being resolved. */
|
|
1328
|
+
|
|
1329
|
+
options: {
|
|
1330
|
+
documentId?: string;
|
|
1331
|
+
schemaType: string;
|
|
1332
|
+
}) => DocumentBuilder;
|
|
1333
|
+
/** Get structure builder
|
|
1334
|
+
* @returns a structure builder. See {@link StructureBuilder}
|
|
1335
|
+
*/
|
|
1336
|
+
getStructureBuilder: () => StructureBuilder;
|
|
1337
|
+
/**
|
|
1338
|
+
* The stacked array of perspective ids ordered chronologically to represent the state of documents at the given point in time.
|
|
1339
|
+
* It can be used as the perspective param in the client to get the correct view of the documents.
|
|
1340
|
+
* ["published"] | ["drafts"] | ["releaseId2", "releaseId1", "drafts"]
|
|
1341
|
+
* See {@link PerspectiveStack}
|
|
1342
|
+
*/
|
|
1343
|
+
perspectiveStack: PerspectiveStack;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* An object holding the documentId and schemaType for the document node being resolved.
|
|
1347
|
+
*
|
|
1348
|
+
* @public
|
|
1349
|
+
*/
|
|
1350
|
+
interface DefaultDocumentNodeContext extends ConfigContext {
|
|
1351
|
+
/**
|
|
1352
|
+
* The id of the sanity document
|
|
1353
|
+
*/
|
|
1354
|
+
documentId?: string;
|
|
1355
|
+
/**
|
|
1356
|
+
* the schema of the sanity document
|
|
1357
|
+
*/
|
|
1358
|
+
schemaType: string;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* A resolver function used to return the default document node used when editing documents.
|
|
1362
|
+
*
|
|
1363
|
+
* @public
|
|
1364
|
+
*
|
|
1365
|
+
* @returns a document node builder, or null/undefined if no document node should be returned.
|
|
1366
|
+
*
|
|
1367
|
+
*/
|
|
1368
|
+
type DefaultDocumentNodeResolver = (
|
|
1369
|
+
/**
|
|
1370
|
+
* S - an instance of the structure builder, that can be used to build the lists/items/panes for the structure tool
|
|
1371
|
+
* context - an object holding various context that may be used to customize the structure, for instance the current user.
|
|
1372
|
+
* Defaults to
|
|
1373
|
+
* ```ts
|
|
1374
|
+
* (S) => S.defaults()
|
|
1375
|
+
* ```
|
|
1376
|
+
* See {@link StructureBuilder}
|
|
1377
|
+
*/
|
|
1378
|
+
|
|
1379
|
+
S: StructureBuilder,
|
|
1380
|
+
/**
|
|
1381
|
+
* An object holding the documentId and schemaType for the document node being resolved.
|
|
1382
|
+
* See {@link DefaultDocumentNodeContext}
|
|
1383
|
+
*/
|
|
1384
|
+
|
|
1385
|
+
options: DefaultDocumentNodeContext) => DocumentBuilder | null | undefined;
|
|
1386
|
+
/**
|
|
1387
|
+
* Interface for the structure builder.
|
|
1388
|
+
*
|
|
1389
|
+
* @public
|
|
1390
|
+
*/
|
|
1391
|
+
interface StructureBuilder {
|
|
1392
|
+
/**
|
|
1393
|
+
* @internal
|
|
1394
|
+
*/
|
|
1395
|
+
component: (spec?: ComponentInput | UserComponent) => ComponentBuilder;
|
|
1396
|
+
/** By giving an object of options with documentID and its schema type receive the the respective Document builder
|
|
1397
|
+
* @param options - an object holding the documentId and schemaType for the document node being resolved.
|
|
1398
|
+
* @returns a Document builder. See {@link DocumentBuilder}
|
|
1399
|
+
*/
|
|
1400
|
+
defaultDocument: (options: {
|
|
1401
|
+
documentId?: string;
|
|
1402
|
+
schemaType: string;
|
|
1403
|
+
}) => DocumentBuilder;
|
|
1404
|
+
/** Get an array of Item builders that take Initial Value template into consideration
|
|
1405
|
+
* @returns an array of initial value template item builders. See {@link ListItemBuilder}
|
|
1406
|
+
*/
|
|
1407
|
+
defaultInitialValueTemplateItems: () => InitialValueTemplateItemBuilder[];
|
|
1408
|
+
/** Get the default List builder
|
|
1409
|
+
* @returns a List builder. See {@link ListBuilder}
|
|
1410
|
+
*/
|
|
1411
|
+
defaults: () => ListBuilder;
|
|
1412
|
+
/** Get a structure Divider
|
|
1413
|
+
* @returns a DividerBuilder. See {@link DividerBuilder}
|
|
1414
|
+
*/
|
|
1415
|
+
divider: (spec?: Divider) => DividerBuilder;
|
|
1416
|
+
/** By giving a partial Document Node receive the respective Document Builder
|
|
1417
|
+
* @param spec - a partial document node. See {@link PartialDocumentNode}
|
|
1418
|
+
* @returns a Document builder. See {@link DocumentBuilder}
|
|
1419
|
+
*/
|
|
1420
|
+
document: (spec?: PartialDocumentNode) => DocumentBuilder;
|
|
1421
|
+
/** By giving a Document List Input receive the respective Document List Builder
|
|
1422
|
+
* @param spec - a document list input. See {@link DocumentListInput}
|
|
1423
|
+
* @returns a Document List builder. See {@link DocumentListBuilder}
|
|
1424
|
+
*/
|
|
1425
|
+
documentList: (spec?: DocumentListInput) => DocumentListBuilder;
|
|
1426
|
+
/** By giving a Document List Item Input receive the respective Document List Item builder
|
|
1427
|
+
* @param spec - a document list item input. See {@link DocumentListItemInput}
|
|
1428
|
+
* @returns a Document List Item builder. See {@link DocumentListItemBuilder}
|
|
1429
|
+
*/
|
|
1430
|
+
documentListItem: (spec?: DocumentListItemInput) => DocumentListItemBuilder;
|
|
1431
|
+
/** By giving a type name or Document Type List Input receive the respective Document List Builder
|
|
1432
|
+
* @param typeNameOrSpec - a type name or a document type list input. See {@link DocumentTypeListInput}
|
|
1433
|
+
* @returns a Document List builder. See {@link DocumentListBuilder}
|
|
1434
|
+
*/
|
|
1435
|
+
documentTypeList: (typeNameOrSpec: string | DocumentTypeListInput) => DocumentListBuilder;
|
|
1436
|
+
/** By providing a type name receive a List Item builder
|
|
1437
|
+
* @param typeName - a type name
|
|
1438
|
+
* @returns a List Item builder. See {@link ListItemBuilder}
|
|
1439
|
+
*/
|
|
1440
|
+
documentTypeListItem: (typeName: string) => ListItemBuilder;
|
|
1441
|
+
/** Get an array of List Item builders
|
|
1442
|
+
* @returns an array of list item builders. See {@link ListItemBuilder}
|
|
1443
|
+
*/
|
|
1444
|
+
documentTypeListItems: () => ListItemBuilder[];
|
|
1445
|
+
/** By giving a templateID and a set of parameters receive a Document builder that takes InitialValueTemplate into account
|
|
1446
|
+
* @param templateId - a template ID
|
|
1447
|
+
* @param parameters - an object of parameters
|
|
1448
|
+
* @returns a Document builder. See {@link DocumentBuilder}
|
|
1449
|
+
*/
|
|
1450
|
+
documentWithInitialValueTemplate: (templateId: string, parameters?: Record<string, unknown>) => DocumentBuilder;
|
|
1451
|
+
/** By giving a Editor Node receive the respective Document Builder
|
|
1452
|
+
* @param spec - an editor node. See {@link EditorNode}
|
|
1453
|
+
* @returns a Document builder. See {@link DocumentBuilder}
|
|
1454
|
+
*/
|
|
1455
|
+
editor: (spec?: EditorNode) => DocumentBuilder;
|
|
1456
|
+
/** By giving a templateID and a set of parameters receive an Item Builder that takes InitialValueTemplate into account
|
|
1457
|
+
* @param templateId - a template ID
|
|
1458
|
+
* @param parameters - an object of parameters
|
|
1459
|
+
* @returns an Item builder. See {@link ListItemBuilder}
|
|
1460
|
+
*/
|
|
1461
|
+
initialValueTemplateItem: (templateId: string, parameters?: Record<string, any>) => InitialValueTemplateItemBuilder;
|
|
1462
|
+
/** By giving a List Input receive the respective Builder, otherwise return default ListBuilder builder
|
|
1463
|
+
* @param spec - a list input. See {@link ListInput}
|
|
1464
|
+
* @returns a List builder. See {@link ListBuilder}
|
|
1465
|
+
*/
|
|
1466
|
+
list: (spec?: ListInput) => ListBuilder;
|
|
1467
|
+
/** By giving a List Item Input receive the respective Builder, otherwise return default ListItem builder
|
|
1468
|
+
* @param spec - a list item input. See {@link ListItemInput}
|
|
1469
|
+
* @returns a List Item builder. See {@link ListItemBuilder}
|
|
1470
|
+
*/
|
|
1471
|
+
listItem: (spec?: ListItemInput) => ListItemBuilder;
|
|
1472
|
+
/** By giving a Menu Item receive the respective Builder, otherwise return default MenuItem builder
|
|
1473
|
+
* @param spec - a menu item. See {@link MenuItem}
|
|
1474
|
+
* @returns a Menu Item builder. See {@link MenuItemBuilder}
|
|
1475
|
+
*/
|
|
1476
|
+
menuItem: (spec?: MenuItem) => MenuItemBuilder;
|
|
1477
|
+
/** By giving a Menu Item Group receive the respective Builder
|
|
1478
|
+
* @param spec - a menu item group. See {@link MenuItemGroup}
|
|
1479
|
+
* @returns a Menu Item Group builder. See {@link MenuItemGroupBuilder}
|
|
1480
|
+
*/
|
|
1481
|
+
menuItemGroup: (spec?: MenuItemGroup) => MenuItemGroupBuilder;
|
|
1482
|
+
/** By giving an array of initial value template receive an array of Menu Items, otherwise return default MenuItem builder
|
|
1483
|
+
* @param templateItems - an array of initial value template items. See {@link InitialValueTemplateItem}
|
|
1484
|
+
* @returns an array of Menu Items. See {@link MenuItem}
|
|
1485
|
+
*/
|
|
1486
|
+
menuItemsFromInitialValueTemplateItems: (templateItems: InitialValueTemplateItem[]) => MenuItem[];
|
|
1487
|
+
/** By giving a sort ordering object receive a Menu Item Builder
|
|
1488
|
+
* @param ordering - a sort ordering object. See {@link SortOrdering}
|
|
1489
|
+
* @returns a Menu Item builder. See {@link MenuItemBuilder}
|
|
1490
|
+
*/
|
|
1491
|
+
orderingMenuItem: (ordering: SortOrdering) => MenuItemBuilder;
|
|
1492
|
+
/** By giving a type receive a list of Menu Items ordered by it
|
|
1493
|
+
* @param type - a type
|
|
1494
|
+
* @returns an array of Menu Items. See {@link MenuItem}
|
|
1495
|
+
*/
|
|
1496
|
+
orderingMenuItemsForType: (type: string) => MenuItemBuilder[];
|
|
1497
|
+
/** View for structure */
|
|
1498
|
+
view: {
|
|
1499
|
+
/** form for view
|
|
1500
|
+
* @param spec - a partial form view. See {@link FormView}
|
|
1501
|
+
* @returns a Form View builder. See {@link FormViewBuilder}
|
|
1502
|
+
*/
|
|
1503
|
+
form: (spec?: Partial<FormView>) => FormViewBuilder;
|
|
1504
|
+
/** component for view
|
|
1505
|
+
* @param componentOrSpec - a partial component view or a React component. See {@link ComponentView}
|
|
1506
|
+
* @returns a Component View builder. See {@link ComponentViewBuilder}
|
|
1507
|
+
*/
|
|
1508
|
+
component: (componentOrSpec?: Partial<ComponentView> | React.ComponentType<any>) => ComponentViewBuilder;
|
|
1509
|
+
};
|
|
1510
|
+
/** Context for the structure builder. See {@link StructureContext} */
|
|
1511
|
+
context: StructureContext;
|
|
1512
|
+
}
|
|
1513
|
+
/** @internal */
|
|
1514
|
+
declare function maybeSerializeMenuItem(item: MenuItem | MenuItemBuilder, index: number, path: SerializePath): MenuItem;
|
|
1515
|
+
/**
|
|
1516
|
+
* Menu item action type
|
|
1517
|
+
* @public */
|
|
1518
|
+
type MenuItemActionType = string | ((params: Record<string, unknown> | undefined, scope?: unknown) => void);
|
|
1519
|
+
/**
|
|
1520
|
+
* Known menu item parameters that control built-in behavior.
|
|
1521
|
+
* These properties have specific meanings in the structure builder.
|
|
1522
|
+
*
|
|
1523
|
+
* @public */
|
|
1524
|
+
interface KnownMenuItemParams {
|
|
1525
|
+
/**
|
|
1526
|
+
* When true, hides all visual indicators showing this menu item is selected.
|
|
1527
|
+
* This includes both the checkmark icon and the pressed/selected styling.
|
|
1528
|
+
* The item can still be selected - this only affects the visual feedback.
|
|
1529
|
+
* Useful when you want the menu item to perform an action without showing a selection state.
|
|
1530
|
+
*/
|
|
1531
|
+
hideSelectionIndicator?: boolean;
|
|
1532
|
+
/**
|
|
1533
|
+
* The value to associate with this menu item for tracking selected state.
|
|
1534
|
+
* Used with the 'setMenuItemState' action for custom toggle behavior.
|
|
1535
|
+
* When a menu item is clicked, this value is stored against the menu item's `id`.
|
|
1536
|
+
* Defaults to `true` if not specified.
|
|
1537
|
+
*/
|
|
1538
|
+
value?: unknown;
|
|
1539
|
+
/**
|
|
1540
|
+
* Layout key for layout switching menu items.
|
|
1541
|
+
* Used with the 'setLayout' action.
|
|
1542
|
+
*/
|
|
1543
|
+
layout?: string;
|
|
1544
|
+
/**
|
|
1545
|
+
* Sort ordering configuration for sort menu items.
|
|
1546
|
+
* Used with the 'setSortOrder' action.
|
|
1547
|
+
*/
|
|
1548
|
+
by?: SortOrderingItem[];
|
|
1549
|
+
/**
|
|
1550
|
+
* Extended projection string for sort ordering.
|
|
1551
|
+
* Used internally for sort menu items.
|
|
1552
|
+
*/
|
|
1553
|
+
extendedProjection?: string;
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Menu items parameters.
|
|
1557
|
+
* Includes known parameters that control built-in behavior,
|
|
1558
|
+
* plus allows additional custom parameters.
|
|
1559
|
+
*
|
|
1560
|
+
* @public */
|
|
1561
|
+
type MenuItemParamsType = KnownMenuItemParams & Record<string, unknown>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Interface for menu items
|
|
1564
|
+
*
|
|
1565
|
+
* @public */
|
|
1566
|
+
interface MenuItem {
|
|
1567
|
+
/**
|
|
1568
|
+
* Unique identifier for the menu item.
|
|
1569
|
+
* Used for tracking selected state of custom menu items.
|
|
1570
|
+
* Menu items with the same id will share selected state (like radio buttons).
|
|
1571
|
+
*/
|
|
1572
|
+
id?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* The i18n key and namespace used to populate the localized title. This is
|
|
1575
|
+
* the recommend way to set the title if you are localizing your studio.
|
|
1576
|
+
*/
|
|
1577
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
1578
|
+
/**
|
|
1579
|
+
* Menu Item title. Note that the `i18n` configuration will take
|
|
1580
|
+
* precedence and this title is left here as a fallback if no i18n key is
|
|
1581
|
+
* provided and compatibility with older plugins
|
|
1582
|
+
*/
|
|
1583
|
+
title: string;
|
|
1584
|
+
/** Menu Item action */
|
|
1585
|
+
action?: MenuItemActionType;
|
|
1586
|
+
/** Menu Item intent */
|
|
1587
|
+
intent?: Intent;
|
|
1588
|
+
/** Menu Item group */
|
|
1589
|
+
group?: string;
|
|
1590
|
+
/** Menu Item icon */
|
|
1591
|
+
icon?: React.ComponentType | React.ReactNode;
|
|
1592
|
+
/** Menu Item parameters. See {@link MenuItemParamsType} */
|
|
1593
|
+
params?: MenuItemParamsType;
|
|
1594
|
+
/** Determine if it will show the MenuItem as action */
|
|
1595
|
+
showAsAction?: boolean;
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Partial menu items
|
|
1599
|
+
* @public
|
|
1600
|
+
*/
|
|
1601
|
+
type PartialMenuItem = Partial<MenuItem>;
|
|
1602
|
+
/**
|
|
1603
|
+
* Class for building menu items.
|
|
1604
|
+
*
|
|
1605
|
+
* @public */
|
|
1606
|
+
declare class MenuItemBuilder implements Serializable<MenuItem> {
|
|
1607
|
+
/** menu item option object. See {@link PartialMenuItem} */
|
|
1608
|
+
protected spec: PartialMenuItem;
|
|
1609
|
+
protected _context: StructureContext;
|
|
1610
|
+
constructor(
|
|
1611
|
+
/**
|
|
1612
|
+
* Structure context. See {@link StructureContext}
|
|
1613
|
+
*/
|
|
1614
|
+
|
|
1615
|
+
_context: StructureContext, spec?: MenuItem);
|
|
1616
|
+
/**
|
|
1617
|
+
* Set menu item id for tracking selected state.
|
|
1618
|
+
* Menu items with the same id will share selected state (like radio buttons).
|
|
1619
|
+
* Use with action 'setMenuItemState' to enable automatic selected state tracking.
|
|
1620
|
+
* @param id - unique identifier for the menu item
|
|
1621
|
+
* @returns menu item builder based on id provided. See {@link MenuItemBuilder}
|
|
1622
|
+
*/
|
|
1623
|
+
id(id: string): MenuItemBuilder;
|
|
1624
|
+
/**
|
|
1625
|
+
* Get menu item id
|
|
1626
|
+
* @returns menu item id. See {@link PartialMenuItem}
|
|
1627
|
+
*/
|
|
1628
|
+
getId(): PartialMenuItem['id'];
|
|
1629
|
+
/**
|
|
1630
|
+
* Set menu item action
|
|
1631
|
+
* @param action - menu item action. See {@link MenuItemActionType}
|
|
1632
|
+
* @returns menu item builder based on action provided. See {@link MenuItemBuilder}
|
|
1633
|
+
*/
|
|
1634
|
+
action(action: MenuItemActionType): MenuItemBuilder;
|
|
1635
|
+
/**
|
|
1636
|
+
* Get menu item action
|
|
1637
|
+
* @returns menu item builder action. See {@link PartialMenuItem}
|
|
1638
|
+
*/
|
|
1639
|
+
getAction(): PartialMenuItem['action'];
|
|
1640
|
+
/**
|
|
1641
|
+
* Set menu item intent
|
|
1642
|
+
* @param intent - menu item intent. See {@link Intent}
|
|
1643
|
+
* @returns menu item builder based on intent provided. See {@link MenuItemBuilder}
|
|
1644
|
+
*/
|
|
1645
|
+
intent(intent: Intent): MenuItemBuilder;
|
|
1646
|
+
/**
|
|
1647
|
+
* Get menu item intent
|
|
1648
|
+
* @returns menu item intent. See {@link PartialMenuItem}
|
|
1649
|
+
*/
|
|
1650
|
+
getIntent(): PartialMenuItem['intent'];
|
|
1651
|
+
/**
|
|
1652
|
+
* Set menu item title
|
|
1653
|
+
* @param title - menu item title
|
|
1654
|
+
* @returns menu item builder based on title provided. See {@link MenuItemBuilder}
|
|
1655
|
+
*/
|
|
1656
|
+
title(title: string): MenuItemBuilder;
|
|
1657
|
+
/**
|
|
1658
|
+
* Get menu item title. Note that the `i18n` configuration will take
|
|
1659
|
+
* precedence and this title is left here for compatibility.
|
|
1660
|
+
* @returns menu item title
|
|
1661
|
+
*/
|
|
1662
|
+
getTitle(): string | undefined;
|
|
1663
|
+
/**
|
|
1664
|
+
* Set the i18n key and namespace used to populate the localized title.
|
|
1665
|
+
* @param i18n - object with i18n key and related namespace
|
|
1666
|
+
* @returns menu item builder based on i18n config provided. See {@link MenuItemBuilder}
|
|
1667
|
+
*/
|
|
1668
|
+
i18n(i18n: I18nTextRecord$1<'title'>): MenuItemBuilder;
|
|
1669
|
+
/**
|
|
1670
|
+
* Get the i18n key and namespace used to populate the localized title.
|
|
1671
|
+
* @returns the i18n key and namespace used to populate the localized title.
|
|
1672
|
+
*/
|
|
1673
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
1674
|
+
/**
|
|
1675
|
+
* Set menu item group
|
|
1676
|
+
* @param group - menu item group
|
|
1677
|
+
* @returns menu item builder based on group provided. See {@link MenuItemBuilder}
|
|
1678
|
+
*/
|
|
1679
|
+
group(group: string): MenuItemBuilder;
|
|
1680
|
+
/**
|
|
1681
|
+
* Get menu item group
|
|
1682
|
+
* @returns menu item group. See {@link PartialMenuItem}
|
|
1683
|
+
*/
|
|
1684
|
+
getGroup(): PartialMenuItem['group'];
|
|
1685
|
+
/**
|
|
1686
|
+
* Set menu item icon
|
|
1687
|
+
* @param icon - menu item icon
|
|
1688
|
+
* @returns menu item builder based on icon provided. See {@link MenuItemBuilder}
|
|
1689
|
+
*/
|
|
1690
|
+
icon(icon: React.ComponentType | React.ReactNode): MenuItemBuilder;
|
|
1691
|
+
/**
|
|
1692
|
+
* Get menu item icon
|
|
1693
|
+
* @returns menu item icon. See {@link PartialMenuItem}
|
|
1694
|
+
*/
|
|
1695
|
+
getIcon(): PartialMenuItem['icon'];
|
|
1696
|
+
/**
|
|
1697
|
+
* Set menu item parameters
|
|
1698
|
+
* @param params - menu item parameters. See {@link MenuItemParamsType}
|
|
1699
|
+
* @returns menu item builder based on parameters provided. See {@link MenuItemBuilder}
|
|
1700
|
+
*/
|
|
1701
|
+
params(params: MenuItemParamsType): MenuItemBuilder;
|
|
1702
|
+
/**
|
|
1703
|
+
* Get meny item parameters
|
|
1704
|
+
* @returns menu item parameters. See {@link PartialMenuItem}
|
|
1705
|
+
*/
|
|
1706
|
+
getParams(): PartialMenuItem['params'];
|
|
1707
|
+
/**
|
|
1708
|
+
* Set menu item to show as action
|
|
1709
|
+
* @param showAsAction - determine if menu item should show as action
|
|
1710
|
+
* @returns menu item builder based on if it should show as action. See {@link MenuItemBuilder}
|
|
1711
|
+
*/
|
|
1712
|
+
showAsAction(showAsAction?: boolean): MenuItemBuilder;
|
|
1713
|
+
/**
|
|
1714
|
+
* Check if menu item should show as action
|
|
1715
|
+
* @returns true if menu item should show as action, false if not. See {@link PartialMenuItem}
|
|
1716
|
+
*/
|
|
1717
|
+
getShowAsAction(): PartialMenuItem['showAsAction'];
|
|
1718
|
+
/** Serialize menu item builder
|
|
1719
|
+
* @param options - serialization options. See {@link SerializeOptions}
|
|
1720
|
+
* @returns menu item node based on path provided in options. See {@link MenuItem}
|
|
1721
|
+
*/
|
|
1722
|
+
serialize(options?: SerializeOptions): MenuItem;
|
|
1723
|
+
/** Clone menu item builder
|
|
1724
|
+
* @param withSpec - menu item options. See {@link PartialMenuItem}
|
|
1725
|
+
* @returns menu item builder based on context and spec provided. See {@link MenuItemBuilder}
|
|
1726
|
+
*/
|
|
1727
|
+
clone(withSpec?: PartialMenuItem): MenuItemBuilder;
|
|
1728
|
+
}
|
|
1729
|
+
/** @internal */
|
|
1730
|
+
interface SortMenuItem extends MenuItem {
|
|
1731
|
+
params: {
|
|
1732
|
+
by: SortOrderingItem[];
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
/** @internal */
|
|
1736
|
+
declare function getOrderingMenuItem(context: StructureContext, {
|
|
1737
|
+
by,
|
|
1738
|
+
title,
|
|
1739
|
+
i18n
|
|
1740
|
+
}: SortOrdering, extendedProjection?: string): MenuItemBuilder;
|
|
1741
|
+
/** @internal */
|
|
1742
|
+
declare function getOrderingMenuItemsForSchemaType(context: StructureContext, typeName: SchemaType | string): MenuItemBuilder[];
|
|
1743
|
+
/**
|
|
1744
|
+
* Interface for component
|
|
1745
|
+
*
|
|
1746
|
+
* @public
|
|
1747
|
+
*/
|
|
1748
|
+
interface Component$1 extends StructureNode {
|
|
1749
|
+
/** Component of type {@link UserComponent} */
|
|
1750
|
+
component: UserComponent;
|
|
1751
|
+
/** Component child of type {@link Child} */
|
|
1752
|
+
child?: Child;
|
|
1753
|
+
/** Component menu items, array of type {@link MenuItem} */
|
|
1754
|
+
menuItems: MenuItem[];
|
|
1755
|
+
/** Component menu item group, array of type {@link MenuItemGroup} */
|
|
1756
|
+
menuItemGroups: MenuItemGroup[];
|
|
1757
|
+
/** Component options */
|
|
1758
|
+
options: {
|
|
1759
|
+
[key: string]: unknown;
|
|
1760
|
+
};
|
|
1761
|
+
canHandleIntent?: IntentChecker;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Interface for component input
|
|
1765
|
+
*
|
|
1766
|
+
* @public
|
|
1767
|
+
*/
|
|
1768
|
+
interface ComponentInput extends StructureNode {
|
|
1769
|
+
/** Component of type {@link UserComponent} */
|
|
1770
|
+
component: UserComponent;
|
|
1771
|
+
/** Component child of type {@link Child} */
|
|
1772
|
+
child?: Child;
|
|
1773
|
+
/** Component options */
|
|
1774
|
+
options?: {
|
|
1775
|
+
[key: string]: unknown;
|
|
1776
|
+
};
|
|
1777
|
+
/** Component menu items. See {@link MenuItem} and {@link MenuItemBuilder} */
|
|
1778
|
+
menuItems?: (MenuItem | MenuItemBuilder)[];
|
|
1779
|
+
/** Component menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
|
|
1780
|
+
menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[];
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Interface for buildable component
|
|
1784
|
+
*
|
|
1785
|
+
* @public
|
|
1786
|
+
*/
|
|
1787
|
+
interface BuildableComponent extends Partial<StructureNode> {
|
|
1788
|
+
/** Component of type {@link UserComponent} */
|
|
1789
|
+
component?: UserComponent;
|
|
1790
|
+
/** Component child of type {@link Child} */
|
|
1791
|
+
child?: Child;
|
|
1792
|
+
/** Component options */
|
|
1793
|
+
options?: {
|
|
1794
|
+
[key: string]: unknown;
|
|
1795
|
+
};
|
|
1796
|
+
/** Component menu items. See {@link MenuItem} and {@link MenuItemBuilder} */
|
|
1797
|
+
menuItems?: (MenuItem | MenuItemBuilder)[];
|
|
1798
|
+
/** Component menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
|
|
1799
|
+
menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[];
|
|
1800
|
+
canHandleIntent?: IntentChecker;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Class for building components
|
|
1804
|
+
*
|
|
1805
|
+
* @public
|
|
1806
|
+
*/
|
|
1807
|
+
declare class ComponentBuilder implements Serializable<Component$1> {
|
|
1808
|
+
/** component builder option object */
|
|
1809
|
+
protected spec: BuildableComponent;
|
|
1810
|
+
constructor(spec?: ComponentInput);
|
|
1811
|
+
/** Set Component ID
|
|
1812
|
+
* @param id - component ID
|
|
1813
|
+
* @returns component builder based on ID provided
|
|
1814
|
+
*/
|
|
1815
|
+
id(id: string): ComponentBuilder;
|
|
1816
|
+
/** Get ID
|
|
1817
|
+
* @returns ID
|
|
1818
|
+
*/
|
|
1819
|
+
getId(): BuildableComponent['id'];
|
|
1820
|
+
/** Set Component title
|
|
1821
|
+
* @param title - component title
|
|
1822
|
+
* @returns component builder based on title provided (and ID)
|
|
1823
|
+
*/
|
|
1824
|
+
title(title: string): ComponentBuilder;
|
|
1825
|
+
/** Get Component title
|
|
1826
|
+
* @returns title
|
|
1827
|
+
*/
|
|
1828
|
+
getTitle(): BuildableComponent['title'];
|
|
1829
|
+
/** Set the i18n key and namespace used to populate the localized title.
|
|
1830
|
+
* @param i18n - the key and namespaced used to populate the localized title.
|
|
1831
|
+
* @returns component builder based on i18n key and ns provided
|
|
1832
|
+
*/
|
|
1833
|
+
i18n(i18n: I18nTextRecord$1<'title'>): ComponentBuilder;
|
|
1834
|
+
/** Get i18n key and namespace used to populate the localized title
|
|
1835
|
+
* @returns the i18n key and namespace used to populate the localized title
|
|
1836
|
+
*/
|
|
1837
|
+
getI18n(): I18nTextRecord$1<'title'> | undefined;
|
|
1838
|
+
/** Set Component child
|
|
1839
|
+
* @param child - child component
|
|
1840
|
+
* @returns component builder based on child component provided
|
|
1841
|
+
*/
|
|
1842
|
+
child(child: Child): ComponentBuilder;
|
|
1843
|
+
/** Get Component child
|
|
1844
|
+
* @returns child component
|
|
1845
|
+
*/
|
|
1846
|
+
getChild(): BuildableComponent['child'];
|
|
1847
|
+
/** Set component
|
|
1848
|
+
* @param component - user built component
|
|
1849
|
+
* @returns component builder based on component provided
|
|
1850
|
+
*/
|
|
1851
|
+
component(component: UserComponent): ComponentBuilder;
|
|
1852
|
+
/** Get Component
|
|
1853
|
+
* @returns component
|
|
1854
|
+
*/
|
|
1855
|
+
getComponent(): BuildableComponent['component'];
|
|
1856
|
+
/** Set Component options
|
|
1857
|
+
* @param options - component options
|
|
1858
|
+
* @returns component builder based on options provided
|
|
1859
|
+
*/
|
|
1860
|
+
options(options: {
|
|
1861
|
+
[key: string]: unknown;
|
|
1862
|
+
}): ComponentBuilder;
|
|
1863
|
+
/** Get Component options
|
|
1864
|
+
* @returns component options
|
|
1865
|
+
*/
|
|
1866
|
+
getOptions(): NonNullable<BuildableComponent['options']>;
|
|
1867
|
+
/** Set Component menu items
|
|
1868
|
+
* @param menuItems - component menu items
|
|
1869
|
+
* @returns component builder based on menuItems provided
|
|
1870
|
+
*/
|
|
1871
|
+
menuItems(menuItems: (MenuItem | MenuItemBuilder)[]): ComponentBuilder;
|
|
1872
|
+
/** Get Component menu items
|
|
1873
|
+
* @returns menu items
|
|
1874
|
+
*/
|
|
1875
|
+
getMenuItems(): BuildableComponent['menuItems'];
|
|
1876
|
+
/** Set Component menu item groups
|
|
1877
|
+
* @param menuItemGroups - component menu item groups
|
|
1878
|
+
* @returns component builder based on menuItemGroups provided
|
|
1879
|
+
*/
|
|
1880
|
+
menuItemGroups(menuItemGroups: (MenuItemGroup | MenuItemGroupBuilder)[]): ComponentBuilder;
|
|
1881
|
+
/** Get Component menu item groups
|
|
1882
|
+
* @returns menu item groups
|
|
1883
|
+
*/
|
|
1884
|
+
getMenuItemGroups(): BuildableComponent['menuItemGroups'];
|
|
1885
|
+
canHandleIntent(canHandleIntent: IntentChecker): ComponentBuilder;
|
|
1886
|
+
/** Serialize component
|
|
1887
|
+
* @param options - serialization options
|
|
1888
|
+
* @returns component object based on path provided in options
|
|
1889
|
+
*
|
|
1890
|
+
*/
|
|
1891
|
+
serialize(options?: SerializeOptions): Component$1;
|
|
1892
|
+
/** Clone component builder (allows for options overriding)
|
|
1893
|
+
* @param withSpec - component builder options
|
|
1894
|
+
* @returns cloned builder
|
|
1895
|
+
*/
|
|
1896
|
+
clone(withSpec?: BuildableComponent): ComponentBuilder;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Interface for the structure builder node.
|
|
1900
|
+
*
|
|
1901
|
+
* @public
|
|
1902
|
+
*/
|
|
1903
|
+
interface StructureNode {
|
|
1904
|
+
/** Node ID */
|
|
1905
|
+
id: string;
|
|
1906
|
+
/** Node ID */
|
|
1907
|
+
title?: string;
|
|
1908
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
1909
|
+
/** Node type */
|
|
1910
|
+
type?: string;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Interface for the document list builder (focused on the document pane)
|
|
1914
|
+
*
|
|
1915
|
+
* @public */
|
|
1916
|
+
interface DocumentNode extends StructureNode {
|
|
1917
|
+
/**
|
|
1918
|
+
* Document children. See {@link Child}
|
|
1919
|
+
*/
|
|
1920
|
+
child?: Child;
|
|
1921
|
+
/**
|
|
1922
|
+
* Options for the document pane
|
|
1923
|
+
*/
|
|
1924
|
+
options: {
|
|
1925
|
+
/** Document Id */id: string; /** Document Type */
|
|
1926
|
+
type?: string; /** Document Template */
|
|
1927
|
+
template?: string; /** Template parameters */
|
|
1928
|
+
templateParameters?: {
|
|
1929
|
+
[key: string]: any;
|
|
1930
|
+
};
|
|
1931
|
+
};
|
|
1932
|
+
/**
|
|
1933
|
+
* View array for the document pane. See {@link View}
|
|
1934
|
+
*/
|
|
1935
|
+
views: View[];
|
|
1936
|
+
/**
|
|
1937
|
+
* View IDs to open as split panes by default when the document is opened.
|
|
1938
|
+
* Only populated if 2+ valid view IDs are configured.
|
|
1939
|
+
*/
|
|
1940
|
+
defaultPanes?: string[];
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Interface for Editor node
|
|
1944
|
+
*
|
|
1945
|
+
* @public */
|
|
1946
|
+
interface EditorNode extends StructureNode {
|
|
1947
|
+
/** Editor child. See {@link Child} */
|
|
1948
|
+
child?: Child;
|
|
1949
|
+
/** Editor options */
|
|
1950
|
+
options: {
|
|
1951
|
+
/** Editor ID */id: string; /** Editor type */
|
|
1952
|
+
type?: string; /** Editor template */
|
|
1953
|
+
template?: string; /** Template parameters */
|
|
1954
|
+
templateParameters?: {
|
|
1955
|
+
[key: string]: any;
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* A `Divider` is a visual separator in the structure tree.
|
|
1961
|
+
*
|
|
1962
|
+
* @public
|
|
1963
|
+
*/
|
|
1964
|
+
interface Divider {
|
|
1965
|
+
/**
|
|
1966
|
+
* The divider's ID
|
|
1967
|
+
*/
|
|
1968
|
+
id: string;
|
|
1969
|
+
type: 'divider';
|
|
1970
|
+
/**
|
|
1971
|
+
* The divider's title
|
|
1972
|
+
*/
|
|
1973
|
+
title?: string;
|
|
1974
|
+
/**
|
|
1975
|
+
* The i18n key and namespace used to populate the localized title
|
|
1976
|
+
*/
|
|
1977
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Path of a serialized structure node
|
|
1981
|
+
*
|
|
1982
|
+
* @public
|
|
1983
|
+
*/
|
|
1984
|
+
type SerializePath = (string | number)[];
|
|
1985
|
+
/**
|
|
1986
|
+
* Interface for seraializing a structure node
|
|
1987
|
+
* @public */
|
|
1988
|
+
interface SerializeOptions {
|
|
1989
|
+
/** path. See {@link SerializePath} */
|
|
1990
|
+
path: SerializePath;
|
|
1991
|
+
/** index */
|
|
1992
|
+
index?: number;
|
|
1993
|
+
/** hint */
|
|
1994
|
+
hint?: string;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* A interface for serializing a structure node to a plain JavaScript object.
|
|
1998
|
+
*
|
|
1999
|
+
* @public
|
|
2000
|
+
*/
|
|
2001
|
+
interface Serializable<T> {
|
|
2002
|
+
serialize(options: SerializeOptions): T;
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Collection
|
|
2006
|
+
* See {@link List}, {@link DocumentList}, {@link EditorNode}, {@link DocumentNode} and {@link Component}
|
|
2007
|
+
*
|
|
2008
|
+
* @public
|
|
2009
|
+
*/
|
|
2010
|
+
type Collection = List | DocumentList | EditorNode | DocumentNode | Component$1;
|
|
2011
|
+
/**
|
|
2012
|
+
* Collection builder
|
|
2013
|
+
* See {@link ListBuilder}, {@link DocumentListBuilder}, {@link DocumentTypeListBuilder}, {@link DocumentBuilder} and {@link ComponentBuilder}
|
|
2014
|
+
*
|
|
2015
|
+
* @public
|
|
2016
|
+
*/
|
|
2017
|
+
type CollectionBuilder = ListBuilder | DocumentListBuilder | DocumentTypeListBuilder | DocumentBuilder | ComponentBuilder;
|
|
2018
|
+
/**
|
|
2019
|
+
* Child of a structure node
|
|
2020
|
+
* See {@link Collection}, {@link CollectionBuilder} and {@link ChildResolver}
|
|
2021
|
+
*
|
|
2022
|
+
* @public
|
|
2023
|
+
*/
|
|
2024
|
+
type Child = Collection | CollectionBuilder | ChildResolver;
|
|
2025
|
+
/** @internal */
|
|
2026
|
+
type Builder = CollectionBuilder | ComponentBuilder | DocumentBuilder | DocumentListBuilder | DocumentListItemBuilder | ListItemBuilder | MenuItemBuilder | MenuItemGroupBuilder | InitialValueTemplateItemBuilder;
|
|
2027
|
+
/**
|
|
2028
|
+
* Interface for child resolver options
|
|
2029
|
+
*
|
|
2030
|
+
* @public
|
|
2031
|
+
*/
|
|
2032
|
+
interface ChildResolverOptions {
|
|
2033
|
+
/** Child parent */
|
|
2034
|
+
parent: unknown;
|
|
2035
|
+
/** Child index */
|
|
2036
|
+
index: number;
|
|
2037
|
+
splitIndex: number;
|
|
2038
|
+
/** Child path */
|
|
2039
|
+
path: string[];
|
|
2040
|
+
/** Child parameters */
|
|
2041
|
+
params: Record<string, string | undefined>;
|
|
2042
|
+
/** Structure context. See {@link StructureContext} */
|
|
2043
|
+
structureContext: StructureContext;
|
|
2044
|
+
/** Serialize options. See {@link SerializeOptions} */
|
|
2045
|
+
serializeOptions?: SerializeOptions;
|
|
2046
|
+
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Item Child. See {@link CollectionBuilder} and {@link Collection}
|
|
2049
|
+
*
|
|
2050
|
+
* @public
|
|
2051
|
+
*/
|
|
2052
|
+
type ItemChild = CollectionBuilder | Collection | undefined;
|
|
2053
|
+
/**
|
|
2054
|
+
* Interface for child observable
|
|
2055
|
+
*
|
|
2056
|
+
* @public
|
|
2057
|
+
*/
|
|
2058
|
+
interface ChildObservable {
|
|
2059
|
+
/** Subscribes to the child observable. See {@link ItemChild} */
|
|
2060
|
+
subscribe: (child: ItemChild | Promise<ItemChild>) => Record<string, unknown>;
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Interface for child resolver
|
|
2064
|
+
*
|
|
2065
|
+
* @public */
|
|
2066
|
+
interface ChildResolver {
|
|
2067
|
+
(itemId: string, options: ChildResolverOptions): ItemChild | Promise<ItemChild> | ChildObservable | Observable<ItemChild> | undefined;
|
|
2068
|
+
}
|
|
2069
|
+
/** @internal */
|
|
2070
|
+
interface StructureBuilderOptions {
|
|
2071
|
+
source: Source;
|
|
2072
|
+
defaultDocumentNode?: DefaultDocumentNodeResolver;
|
|
2073
|
+
perspectiveStack: PerspectiveStack;
|
|
2074
|
+
}
|
|
2075
|
+
/** @internal */
|
|
2076
|
+
declare function createStructureBuilder({
|
|
2077
|
+
defaultDocumentNode,
|
|
2078
|
+
source,
|
|
2079
|
+
perspectiveStack
|
|
2080
|
+
}: StructureBuilderOptions): StructureBuilder;
|
|
2081
|
+
/** @internal */
|
|
2082
|
+
declare class SerializeError extends Error {
|
|
2083
|
+
readonly path: SerializePath;
|
|
2084
|
+
helpId?: (typeof HELP_URL)[keyof typeof HELP_URL];
|
|
2085
|
+
constructor(message: string, parentPath: SerializePath, pathSegment: string | number | undefined, hint?: string);
|
|
2086
|
+
withHelpUrl(id: (typeof HELP_URL)[keyof typeof HELP_URL]): SerializeError;
|
|
2087
|
+
}
|
|
2088
|
+
/** @internal */
|
|
2089
|
+
declare const HELP_URL: {
|
|
2090
|
+
ID_REQUIRED: "structure-node-id-required";
|
|
2091
|
+
TITLE_REQUIRED: "structure-title-required";
|
|
2092
|
+
FILTER_REQUIRED: "structure-filter-required";
|
|
2093
|
+
INVALID_LIST_ITEM: "structure-invalid-list-item";
|
|
2094
|
+
COMPONENT_REQUIRED: "structure-view-component-required";
|
|
2095
|
+
DOCUMENT_ID_REQUIRED: "structure-document-id-required";
|
|
2096
|
+
DOCUMENT_TYPE_REQUIRED: "structure-document-type-required";
|
|
2097
|
+
SCHEMA_TYPE_REQUIRED: "structure-schema-type-required";
|
|
2098
|
+
SCHEMA_TYPE_NOT_FOUND: "structure-schema-type-not-found";
|
|
2099
|
+
LIST_ITEMS_MUST_BE_ARRAY: "structure-list-items-must-be-array";
|
|
2100
|
+
QUERY_PROVIDED_FOR_FILTER: "structure-query-provided-for-filter";
|
|
2101
|
+
ACTION_OR_INTENT_REQUIRED: "structure-action-or-intent-required";
|
|
2102
|
+
LIST_ITEM_IDS_MUST_BE_UNIQUE: "structure-list-item-ids-must-be-unique";
|
|
2103
|
+
ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE: "structure-action-and-intent-mutually-exclusive";
|
|
2104
|
+
API_VERSION_REQUIRED_FOR_CUSTOM_FILTER: "structure-api-version-required-for-custom-filter";
|
|
2105
|
+
};
|
|
2106
|
+
/** @internal */
|
|
2107
|
+
declare const form: (spec?: Partial<FormView> | undefined) => FormViewBuilder;
|
|
2108
|
+
/** @internal */
|
|
2109
|
+
declare const component: (componentOrSpec?: Partial<ComponentView<Record<string, any>>> | UserViewComponent | undefined) => ComponentViewBuilder;
|
|
2110
|
+
/**
|
|
2111
|
+
* @internal
|
|
2112
|
+
*/
|
|
2113
|
+
interface PaneData {
|
|
2114
|
+
maximized: boolean;
|
|
2115
|
+
element: HTMLElement;
|
|
2116
|
+
collapsed: boolean;
|
|
2117
|
+
currentMinWidth?: number;
|
|
2118
|
+
currentMaxWidth?: number;
|
|
2119
|
+
flex: number;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
*
|
|
2123
|
+
* @hidden
|
|
2124
|
+
* @beta
|
|
2125
|
+
*/
|
|
2126
|
+
interface PaneContextValue {
|
|
2127
|
+
collapse: () => void;
|
|
2128
|
+
collapsed: boolean;
|
|
2129
|
+
expand: () => void;
|
|
2130
|
+
index?: number;
|
|
2131
|
+
isLast: boolean;
|
|
2132
|
+
rootElement: HTMLDivElement | null;
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* @internal
|
|
2136
|
+
*/
|
|
2137
|
+
interface PaneConfigOpts {
|
|
2138
|
+
currentMinWidth?: number;
|
|
2139
|
+
currentMaxWidth?: number;
|
|
2140
|
+
flex: number;
|
|
2141
|
+
id: string;
|
|
2142
|
+
minWidth?: number;
|
|
2143
|
+
maxWidth?: number;
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
*
|
|
2147
|
+
* @hidden
|
|
2148
|
+
* @beta
|
|
2149
|
+
*/
|
|
2150
|
+
interface PaneLayoutContextValue {
|
|
2151
|
+
collapse: (element: HTMLElement) => void;
|
|
2152
|
+
collapsed?: boolean;
|
|
2153
|
+
expand: (element: HTMLElement) => void;
|
|
2154
|
+
expandedElement: HTMLElement | null;
|
|
2155
|
+
mount: (element: HTMLElement, opts: PaneConfigOpts) => () => void;
|
|
2156
|
+
resize: (type: 'start' | 'move' | 'end', element: HTMLElement, deltaX: number) => void;
|
|
2157
|
+
resizing: boolean;
|
|
2158
|
+
panes: PaneData[];
|
|
2159
|
+
}
|
|
2160
|
+
interface _PaneMenuItem {
|
|
2161
|
+
type: 'item';
|
|
2162
|
+
key: string;
|
|
2163
|
+
disabled?: boolean | {
|
|
2164
|
+
reason: ReactNode;
|
|
2165
|
+
};
|
|
2166
|
+
/** When true, hides all icon indicators showing this menu item is selected. */
|
|
2167
|
+
hideSelectionIndicator?: boolean;
|
|
2168
|
+
hotkey?: string;
|
|
2169
|
+
icon: ComponentType | ReactNode;
|
|
2170
|
+
iconRight?: ComponentType | ReactNode;
|
|
2171
|
+
intent?: Intent;
|
|
2172
|
+
onAction: () => void;
|
|
2173
|
+
renderAsButton: boolean;
|
|
2174
|
+
selected?: boolean;
|
|
2175
|
+
title?: string;
|
|
2176
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
2177
|
+
tone?: 'primary' | 'critical' | 'caution' | 'positive';
|
|
2178
|
+
}
|
|
2179
|
+
/** @internal */
|
|
2180
|
+
interface StructureToolFeatures {
|
|
2181
|
+
/**
|
|
2182
|
+
* @hidden
|
|
2183
|
+
* @beta
|
|
2184
|
+
*/
|
|
2185
|
+
backButton: boolean;
|
|
2186
|
+
resizablePanes: boolean;
|
|
2187
|
+
reviewChanges: boolean;
|
|
2188
|
+
splitPanes: boolean;
|
|
2189
|
+
splitViews: boolean;
|
|
2190
|
+
}
|
|
2191
|
+
/** @internal */
|
|
2192
|
+
interface StructureToolContextValue {
|
|
2193
|
+
features: StructureToolFeatures;
|
|
2194
|
+
layoutCollapsed: boolean;
|
|
2195
|
+
setLayoutCollapsed: (layoutCollapsed: boolean) => void;
|
|
2196
|
+
rootPaneNode: UnresolvedPaneNode;
|
|
2197
|
+
structureContext: StructureContext;
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Structure tool context. Extends from {@link ConfigContext}.
|
|
2201
|
+
* @hidden
|
|
2202
|
+
* @public
|
|
2203
|
+
*/
|
|
2204
|
+
interface StructureResolverContext extends ConfigContext {
|
|
2205
|
+
/**
|
|
2206
|
+
* This can be replaced by a different API in the future.
|
|
2207
|
+
* It is provided as-is to support common structure patterns found in V2 in V3.
|
|
2208
|
+
* @alpha
|
|
2209
|
+
* */
|
|
2210
|
+
documentStore: DocumentStore;
|
|
2211
|
+
/** @alpha */
|
|
2212
|
+
i18n: LocaleSource;
|
|
2213
|
+
/**
|
|
2214
|
+
* The stacked array of perspective ids ordered chronologically to represent the state of documents at the given point in time.
|
|
2215
|
+
* It can be used as the perspective param in the client to get the correct view of the documents.
|
|
2216
|
+
* ["published"] | ["drafts"] | ["releaseId2", "releaseId1", "drafts"]
|
|
2217
|
+
* See {@link PerspectiveStack}
|
|
2218
|
+
*/
|
|
2219
|
+
perspectiveStack: PerspectiveStack;
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Lets you configure how lists, documents, views, menus, and initial value templates are organized in the Sanity Studio’s structure-tool.
|
|
2223
|
+
*
|
|
2224
|
+
* @public
|
|
2225
|
+
*
|
|
2226
|
+
* @returns A structure builder, or null/undefined if no structure should be returned. See {@link StructureBuilder}
|
|
2227
|
+
* @example Configuring structure
|
|
2228
|
+
* ```ts
|
|
2229
|
+
* // sanity.config.js
|
|
2230
|
+
*
|
|
2231
|
+
* import {defineConfig} from 'sanity'
|
|
2232
|
+
* import {structureTool} from 'sanity/structure'
|
|
2233
|
+
* import {schemaTypes} from './schema'
|
|
2234
|
+
*
|
|
2235
|
+
* export default defineConfig({
|
|
2236
|
+
* name: 'default',
|
|
2237
|
+
* title: 'My Cool Project',
|
|
2238
|
+
* projectId: 'my-project-id',
|
|
2239
|
+
* dataset: 'production',
|
|
2240
|
+
* plugins: [
|
|
2241
|
+
* structureTool({
|
|
2242
|
+
* structure: (S, context) => {
|
|
2243
|
+
* console.log(context) // returns { currentUser, dataset, projectId, schema, getClient, documentStore }
|
|
2244
|
+
* return S.documentTypeList('post')
|
|
2245
|
+
* },
|
|
2246
|
+
* })
|
|
2247
|
+
* ],
|
|
2248
|
+
* schema: schemaTypes
|
|
2249
|
+
* })
|
|
2250
|
+
* ```
|
|
2251
|
+
*
|
|
2252
|
+
*/
|
|
2253
|
+
type StructureResolver = (
|
|
2254
|
+
/**
|
|
2255
|
+
* S - An instance of the structure builder, that can be used to build the lists/items/panes for the structure tool
|
|
2256
|
+
* context - an object holding various context that may be used to customize the structure, for instance the current user.
|
|
2257
|
+
* Defaults to
|
|
2258
|
+
* ```ts
|
|
2259
|
+
* (S) => S.defaults()
|
|
2260
|
+
* ```
|
|
2261
|
+
* See {@link StructureBuilder}
|
|
2262
|
+
*/
|
|
2263
|
+
|
|
2264
|
+
S: StructureBuilder,
|
|
2265
|
+
/**
|
|
2266
|
+
* An object containing pane and index information for the current structure tool.
|
|
2267
|
+
* See {@link StructureResolverContext}
|
|
2268
|
+
*/
|
|
2269
|
+
|
|
2270
|
+
context: StructureResolverContext) => unknown;
|
|
2271
|
+
/** @internal */
|
|
2272
|
+
type StructureToolPaneActionHandler = (params: any, scope?: unknown) => void;
|
|
2273
|
+
/**
|
|
2274
|
+
* The params for the `structureTool` api. See {@link structureTool}
|
|
2275
|
+
*
|
|
2276
|
+
* @public */
|
|
2277
|
+
interface StructureToolOptions {
|
|
2278
|
+
icon?: React.ComponentType;
|
|
2279
|
+
name?: string;
|
|
2280
|
+
/**
|
|
2281
|
+
* A workspace can have different "sources". These sources were meant to allow using multiple datasets within the same workspace, for instance.
|
|
2282
|
+
* This is not supported yet, but the API is still here.
|
|
2283
|
+
*
|
|
2284
|
+
@hidden
|
|
2285
|
+
@alpha
|
|
2286
|
+
*/
|
|
2287
|
+
source?: string;
|
|
2288
|
+
/**
|
|
2289
|
+
* A structure resolver function. See {@link StructureResolver}
|
|
2290
|
+
*/
|
|
2291
|
+
structure?: StructureResolver;
|
|
2292
|
+
/**
|
|
2293
|
+
* A resolver function used to return the default document node used when editing documents. See {@link DefaultDocumentNodeResolver}
|
|
2294
|
+
*/
|
|
2295
|
+
defaultDocumentNode?: DefaultDocumentNodeResolver;
|
|
2296
|
+
/**
|
|
2297
|
+
* The title that will be displayed for the tool. Defaults to Structure
|
|
2298
|
+
*/
|
|
2299
|
+
title?: string;
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Represents the state of the `panes` inside the structure-tool router
|
|
2303
|
+
*
|
|
2304
|
+
* - The structure tool stores the state of the current panes inside of the router.
|
|
2305
|
+
* - The panes are stored in groups delimited in the URL by `;`.
|
|
2306
|
+
* - In each group, there can be one or more sibling (aka split) panes delimited
|
|
2307
|
+
* by `|`.
|
|
2308
|
+
* - Each item pane can contain it's own parameters and payloads
|
|
2309
|
+
* - Per item pane in each group, if not specified separately, the ID, params,
|
|
2310
|
+
* and payload will be inherited from the first item pane in the pane group
|
|
2311
|
+
* (unless it's an `exclusiveParam`)
|
|
2312
|
+
*
|
|
2313
|
+
* E.g. `/structure/books;book-123|,view=preview` will parse to:
|
|
2314
|
+
*
|
|
2315
|
+
* ```js
|
|
2316
|
+
* [
|
|
2317
|
+
* // first pane group
|
|
2318
|
+
* [{id: 'book'}],
|
|
2319
|
+
*
|
|
2320
|
+
* // second pane group
|
|
2321
|
+
* [
|
|
2322
|
+
* [
|
|
2323
|
+
* // first pane item
|
|
2324
|
+
* {id: 'book-123'},
|
|
2325
|
+
* // second pane item
|
|
2326
|
+
* {id: 'book-123', params: {view: 'preview'}},
|
|
2327
|
+
* ],
|
|
2328
|
+
* ],
|
|
2329
|
+
* ]
|
|
2330
|
+
* ```
|
|
2331
|
+
*
|
|
2332
|
+
* @hidden
|
|
2333
|
+
* @beta
|
|
2334
|
+
*/
|
|
2335
|
+
type RouterPanes = RouterPaneGroup[];
|
|
2336
|
+
/**
|
|
2337
|
+
* Represents a "pane group" in the router.
|
|
2338
|
+
*
|
|
2339
|
+
* @see RouterPanes
|
|
2340
|
+
*
|
|
2341
|
+
*
|
|
2342
|
+
* @hidden
|
|
2343
|
+
* @beta
|
|
2344
|
+
*/
|
|
2345
|
+
type RouterPaneGroup = RouterPaneSibling[];
|
|
2346
|
+
/**
|
|
2347
|
+
* Represents a "sibling pane" or "split pane" in the router.
|
|
2348
|
+
*
|
|
2349
|
+
* @see RouterPanes
|
|
2350
|
+
*
|
|
2351
|
+
*
|
|
2352
|
+
* @hidden
|
|
2353
|
+
* @beta
|
|
2354
|
+
*/
|
|
2355
|
+
interface RouterPaneSibling {
|
|
2356
|
+
id: string;
|
|
2357
|
+
params?: Record<string, string | undefined>;
|
|
2358
|
+
payload?: unknown;
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Passed as the second argument to the item of resolving pane children
|
|
2362
|
+
*
|
|
2363
|
+
* @see RouterPanes
|
|
2364
|
+
*
|
|
2365
|
+
* @internal
|
|
2366
|
+
*/
|
|
2367
|
+
interface RouterPaneSiblingContext {
|
|
2368
|
+
id: string;
|
|
2369
|
+
parent: PaneNode | null;
|
|
2370
|
+
index: number;
|
|
2371
|
+
splitIndex: number;
|
|
2372
|
+
path: string[];
|
|
2373
|
+
params: Record<string, string | undefined>;
|
|
2374
|
+
payload: unknown;
|
|
2375
|
+
structureContext: StructureContext;
|
|
2376
|
+
serializeOptions?: {
|
|
2377
|
+
path: (string | number)[];
|
|
2378
|
+
index?: number;
|
|
2379
|
+
hint?: string;
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Represents what can be passed into `menuItems` inside of structure-tool panes
|
|
2384
|
+
*
|
|
2385
|
+
* @see BaseResolvedPaneNode
|
|
2386
|
+
*
|
|
2387
|
+
* @internal
|
|
2388
|
+
*/
|
|
2389
|
+
interface PaneMenuItem extends MenuItem {
|
|
2390
|
+
disabled?: _PaneMenuItem['disabled'];
|
|
2391
|
+
shortcut?: string;
|
|
2392
|
+
selected?: boolean;
|
|
2393
|
+
tone?: 'primary' | 'positive' | 'caution' | 'critical';
|
|
2394
|
+
}
|
|
2395
|
+
/** @internal */
|
|
2396
|
+
interface PaneMenuItemGroup {
|
|
2397
|
+
id: string;
|
|
2398
|
+
title?: string;
|
|
2399
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
2400
|
+
}
|
|
2401
|
+
/** @internal */
|
|
2402
|
+
interface BaseResolvedPaneNode<T extends PaneNode['type']> {
|
|
2403
|
+
id: string;
|
|
2404
|
+
type: T;
|
|
2405
|
+
title: string;
|
|
2406
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
2407
|
+
menuItems?: PaneMenuItem[];
|
|
2408
|
+
menuItemGroups?: PaneMenuItemGroup[];
|
|
2409
|
+
canHandleIntent?: (intentName: string, params: Record<string, string | undefined>, options: {
|
|
2410
|
+
pane: PaneNode;
|
|
2411
|
+
index: number;
|
|
2412
|
+
}) => boolean;
|
|
2413
|
+
child?: UnresolvedPaneNode;
|
|
2414
|
+
}
|
|
2415
|
+
/** @internal */
|
|
2416
|
+
interface CustomComponentPaneNode extends BaseResolvedPaneNode<'component'> {
|
|
2417
|
+
component: UserComponent;
|
|
2418
|
+
options?: Record<string, unknown>;
|
|
2419
|
+
}
|
|
2420
|
+
/** @internal */
|
|
2421
|
+
interface DocumentPaneNode extends BaseResolvedPaneNode<'document'> {
|
|
2422
|
+
options: {
|
|
2423
|
+
id: string;
|
|
2424
|
+
type: string;
|
|
2425
|
+
template?: string;
|
|
2426
|
+
templateParameters?: Record<string, unknown>;
|
|
2427
|
+
};
|
|
2428
|
+
source?: string;
|
|
2429
|
+
views?: View[];
|
|
2430
|
+
/**
|
|
2431
|
+
* View IDs to open as split panes by default when the document is opened.
|
|
2432
|
+
* Only populated if 2+ valid view IDs are configured.
|
|
2433
|
+
*/
|
|
2434
|
+
defaultPanes?: string[];
|
|
2435
|
+
}
|
|
2436
|
+
/** @internal */
|
|
2437
|
+
interface DocumentListPaneNode extends BaseResolvedPaneNode<'documentList'> {
|
|
2438
|
+
defaultLayout?: GeneralPreviewLayoutKey;
|
|
2439
|
+
displayOptions?: {
|
|
2440
|
+
showIcons?: boolean;
|
|
2441
|
+
};
|
|
2442
|
+
initialValueTemplates?: InitialValueTemplateItem[];
|
|
2443
|
+
options: {
|
|
2444
|
+
filter: string;
|
|
2445
|
+
defaultOrdering?: Array<{
|
|
2446
|
+
field: string;
|
|
2447
|
+
direction: 'asc' | 'desc';
|
|
2448
|
+
}>;
|
|
2449
|
+
params?: Record<string, unknown>;
|
|
2450
|
+
apiVersion?: string;
|
|
2451
|
+
};
|
|
2452
|
+
schemaTypeName: string;
|
|
2453
|
+
source?: string;
|
|
2454
|
+
}
|
|
2455
|
+
/** @internal */
|
|
2456
|
+
interface PaneListItem<TParams = unknown> {
|
|
2457
|
+
type: 'listItem';
|
|
2458
|
+
id: string;
|
|
2459
|
+
_id?: string;
|
|
2460
|
+
schemaType?: SchemaType;
|
|
2461
|
+
title: string;
|
|
2462
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
2463
|
+
icon?: React.ComponentType | false;
|
|
2464
|
+
displayOptions?: {
|
|
2465
|
+
showIcon?: boolean;
|
|
2466
|
+
};
|
|
2467
|
+
action?: (t: TParams) => unknown;
|
|
2468
|
+
params?: TParams;
|
|
2469
|
+
}
|
|
2470
|
+
/** @internal */
|
|
2471
|
+
interface PaneListItemDivider {
|
|
2472
|
+
type: 'divider';
|
|
2473
|
+
/**
|
|
2474
|
+
* The title of the divider.
|
|
2475
|
+
*/
|
|
2476
|
+
title?: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* The i18n key and namespace used to populate the localized title
|
|
2479
|
+
*/
|
|
2480
|
+
i18n?: I18nTextRecord$1<'title'>;
|
|
2481
|
+
}
|
|
2482
|
+
/** @internal */
|
|
2483
|
+
interface ListPaneNode extends BaseResolvedPaneNode<'list'> {
|
|
2484
|
+
defaultLayout?: GeneralPreviewLayoutKey;
|
|
2485
|
+
displayOptions?: {
|
|
2486
|
+
showIcons?: boolean;
|
|
2487
|
+
};
|
|
2488
|
+
items?: Array<PaneListItem | PaneListItemDivider>;
|
|
2489
|
+
source?: string;
|
|
2490
|
+
}
|
|
2491
|
+
/** @internal */
|
|
2492
|
+
type PaneNode = CustomComponentPaneNode | DocumentPaneNode | DocumentListPaneNode | ListPaneNode;
|
|
2493
|
+
/** @internal */
|
|
2494
|
+
type SerializablePaneNode = {
|
|
2495
|
+
serialize(context: RouterPaneSiblingContext): UnresolvedPaneNode;
|
|
2496
|
+
};
|
|
2497
|
+
/** @internal */
|
|
2498
|
+
type PaneNodeResolver = (id: string, context: RouterPaneSiblingContext) => UnresolvedPaneNode;
|
|
2499
|
+
/** @internal */
|
|
2500
|
+
type UnresolvedPaneNode = PaneNodeResolver | SerializablePaneNode | Observable<UnresolvedPaneNode> | PromiseLike<UnresolvedPaneNode> | PaneNode;
|
|
2501
|
+
/**
|
|
2502
|
+
* @hidden
|
|
2503
|
+
* @beta */
|
|
2504
|
+
type DocumentFieldMenuActionNode = DocumentFieldActionNode & {
|
|
2505
|
+
intent?: Intent;
|
|
2506
|
+
};
|
|
2507
|
+
/**
|
|
2508
|
+
* @internal
|
|
2509
|
+
*/
|
|
2510
|
+
interface StrictVersionLayeringOptions$1 {
|
|
2511
|
+
/**
|
|
2512
|
+
* By default, version layering includes all document versions, regardless of their expected
|
|
2513
|
+
* publication time—or lack thereof. For example, it includes all ASAP and undecided versions,
|
|
2514
|
+
* despite ASAP and undecided versions having no fixed chronology. There is no way to determine
|
|
2515
|
+
* which ASAP or undecided version is expected to be published before another.
|
|
2516
|
+
*
|
|
2517
|
+
* It also includes any existing draft, which has no fixed chronology, either.
|
|
2518
|
+
*
|
|
2519
|
+
* This functionality is useful for listing all document versions in a deterministic order, but
|
|
2520
|
+
* doesn't accurately portray the upstream and downstream versions based on expected publication
|
|
2521
|
+
* time.
|
|
2522
|
+
*
|
|
2523
|
+
* In strict mode, version layering instead only includes versions that have a fixed chronology.
|
|
2524
|
+
* **Cross-version layering is only effective for scheduled versions, with all other
|
|
2525
|
+
* versions being layered directly onto the published version (if it exists).**
|
|
2526
|
+
*/
|
|
2527
|
+
strict?: boolean;
|
|
2528
|
+
}
|
|
2529
|
+
/** @internal */
|
|
2530
|
+
interface DocumentPaneContextValue extends Pick<NodeChronologyProps, 'hasUpstreamVersion'> {
|
|
2531
|
+
actions: DocumentActionComponent[] | null;
|
|
2532
|
+
activeViewId: string | null;
|
|
2533
|
+
badges: DocumentBadgeComponent[] | null;
|
|
2534
|
+
changesOpen: boolean;
|
|
2535
|
+
closeInspector: (inspectorName?: string) => void;
|
|
2536
|
+
collapsedFieldSets: StateTree<boolean> | undefined;
|
|
2537
|
+
collapsedPaths: StateTree<boolean> | undefined;
|
|
2538
|
+
compareValue: SanityDocument | null;
|
|
2539
|
+
connectionState: 'connecting' | 'reconnecting' | 'connected';
|
|
2540
|
+
displayed: Partial<SanityDocument> | null;
|
|
2541
|
+
displayInlineChanges?: boolean;
|
|
2542
|
+
documentId: string;
|
|
2543
|
+
documentIdRaw: string;
|
|
2544
|
+
documentType: string;
|
|
2545
|
+
editState: EditStateFor | null;
|
|
2546
|
+
fieldActions: DocumentFieldAction[];
|
|
2547
|
+
focusPath: Path;
|
|
2548
|
+
index: number;
|
|
2549
|
+
inspectOpen: boolean;
|
|
2550
|
+
inspector: DocumentInspector | null;
|
|
2551
|
+
inspectors: DocumentInspector[];
|
|
2552
|
+
menuItemGroups: PaneMenuItemGroup[];
|
|
2553
|
+
onBlur: (blurredPath: Path) => void;
|
|
2554
|
+
onChange: (event: PatchEvent) => void;
|
|
2555
|
+
onFocus: (pathOrEvent: Path) => void;
|
|
2556
|
+
onHistoryClose: () => void;
|
|
2557
|
+
onHistoryOpen: () => void;
|
|
2558
|
+
onInspectClose: () => void;
|
|
2559
|
+
onMenuAction: (item: PaneMenuItem) => void;
|
|
2560
|
+
onPaneClose: () => void;
|
|
2561
|
+
onPaneSplit?: () => void;
|
|
2562
|
+
onPathOpen: (path: Path) => void;
|
|
2563
|
+
onSetActiveFieldGroup: (path: Path, groupName: string) => void;
|
|
2564
|
+
onSetCollapsedPath: (path: Path, expanded: boolean) => void;
|
|
2565
|
+
onSetCollapsedFieldSet: (path: Path, expanded: boolean) => void;
|
|
2566
|
+
onSetMaximizedPane?: () => void;
|
|
2567
|
+
maximized: boolean;
|
|
2568
|
+
openInspector: (inspectorName: string, paneParams?: Record<string, string>) => void;
|
|
2569
|
+
openPath: Path;
|
|
2570
|
+
paneKey: string;
|
|
2571
|
+
previewUrl?: string | null;
|
|
2572
|
+
ready: boolean;
|
|
2573
|
+
schemaType: ObjectSchemaType;
|
|
2574
|
+
/**
|
|
2575
|
+
* @deprecated not used anymore
|
|
2576
|
+
* */
|
|
2577
|
+
setTimelineMode?: undefined;
|
|
2578
|
+
/**
|
|
2579
|
+
* @deprecated not used anymore
|
|
2580
|
+
* */
|
|
2581
|
+
timelineMode?: undefined;
|
|
2582
|
+
setTimelineRange(since: string | null, rev: string | null): void;
|
|
2583
|
+
setIsDeleting: (state: boolean) => void;
|
|
2584
|
+
timelineError: Error | null;
|
|
2585
|
+
/**
|
|
2586
|
+
* Soon to be deprecated with the upcoming `releases` changes.
|
|
2587
|
+
*/
|
|
2588
|
+
timelineStore?: TimelineStore;
|
|
2589
|
+
title: string | null;
|
|
2590
|
+
validation: ValidationMarker[];
|
|
2591
|
+
value: SanityDocumentLike;
|
|
2592
|
+
views: View[];
|
|
2593
|
+
formState: DocumentFormNode | null;
|
|
2594
|
+
/**
|
|
2595
|
+
* TODO: COREL - Remove this after updating sanity-assist to use <PerspectiveProvider>
|
|
2596
|
+
*
|
|
2597
|
+
* @deprecated use `usePerspective()` instead
|
|
2598
|
+
*/
|
|
2599
|
+
selectedReleaseId: ReleaseId | undefined;
|
|
2600
|
+
permissions?: PermissionCheckResult | null;
|
|
2601
|
+
isDeleting: boolean;
|
|
2602
|
+
isDeleted: boolean;
|
|
2603
|
+
isPermissionsLoading: boolean;
|
|
2604
|
+
isInitialValueLoading?: boolean;
|
|
2605
|
+
unstable_languageFilter: DocumentLanguageFilterComponent[];
|
|
2606
|
+
revisionId: string | null;
|
|
2607
|
+
revisionNotFound: boolean;
|
|
2608
|
+
lastNonDeletedRevId: string | null;
|
|
2609
|
+
lastRevisionDocument: SanityDocument | null;
|
|
2610
|
+
}
|
|
2611
|
+
/** @internal */
|
|
2612
|
+
type DocumentPaneInfoContextValue = Pick<DocumentPaneContextValue, 'actions' | 'badges' | 'documentId' | 'documentIdRaw' | 'documentType' | 'fieldActions' | 'index' | 'menuItemGroups' | 'maximized' | 'onPaneClose' | 'onPaneSplit' | 'onSetMaximizedPane' | 'paneKey' | 'schemaType' | 'title' | 'views' | 'unstable_languageFilter'>;
|
|
2613
|
+
/**
|
|
2614
|
+
* @hidden
|
|
2615
|
+
* @beta */
|
|
2616
|
+
interface ChildLinkProps {
|
|
2617
|
+
childId: string;
|
|
2618
|
+
childParameters?: Record<string, string>;
|
|
2619
|
+
childPayload?: unknown;
|
|
2620
|
+
children?: ReactNode;
|
|
2621
|
+
}
|
|
2622
|
+
/**
|
|
2623
|
+
* @hidden
|
|
2624
|
+
* @beta */
|
|
2625
|
+
interface BackLinkProps {
|
|
2626
|
+
children?: ReactNode;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* @hidden
|
|
2630
|
+
* @beta */
|
|
2631
|
+
interface ReferenceChildLinkProps {
|
|
2632
|
+
documentId: string;
|
|
2633
|
+
documentType: string;
|
|
2634
|
+
parentRefPath: Path;
|
|
2635
|
+
template?: {
|
|
2636
|
+
id: string;
|
|
2637
|
+
params?: Record<string, string | number | boolean>;
|
|
2638
|
+
};
|
|
2639
|
+
children: ReactNode;
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* @hidden
|
|
2643
|
+
* @beta */
|
|
2644
|
+
interface ParameterizedLinkProps {
|
|
2645
|
+
params?: Record<string, string>;
|
|
2646
|
+
payload?: unknown;
|
|
2647
|
+
}
|
|
2648
|
+
/**
|
|
2649
|
+
* @hidden
|
|
2650
|
+
* @beta */
|
|
2651
|
+
interface EditReferenceOptions {
|
|
2652
|
+
parentRefPath: Path;
|
|
2653
|
+
id: string;
|
|
2654
|
+
type: string;
|
|
2655
|
+
version?: ReleaseId;
|
|
2656
|
+
template: {
|
|
2657
|
+
id: string;
|
|
2658
|
+
params?: Record<string, string | number | boolean>;
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* @hidden
|
|
2663
|
+
* @beta */
|
|
2664
|
+
interface PaneRouterContextValue {
|
|
2665
|
+
/**
|
|
2666
|
+
* Zero-based index (position) of pane, visually
|
|
2667
|
+
*/
|
|
2668
|
+
index: number;
|
|
2669
|
+
/**
|
|
2670
|
+
* Zero-based index of pane group (within URL structure)
|
|
2671
|
+
*/
|
|
2672
|
+
groupIndex: number;
|
|
2673
|
+
/**
|
|
2674
|
+
* Zero-based index of pane within sibling group
|
|
2675
|
+
*/
|
|
2676
|
+
siblingIndex: number;
|
|
2677
|
+
/**
|
|
2678
|
+
* Payload of the current pane
|
|
2679
|
+
*/
|
|
2680
|
+
payload?: unknown;
|
|
2681
|
+
/**
|
|
2682
|
+
* Params of the current pane
|
|
2683
|
+
*/
|
|
2684
|
+
params?: RouterPaneSibling['params'];
|
|
2685
|
+
/**
|
|
2686
|
+
* Whether or not the pane has any siblings (within the same group)
|
|
2687
|
+
*/
|
|
2688
|
+
hasGroupSiblings: boolean;
|
|
2689
|
+
/**
|
|
2690
|
+
* The length of the current group
|
|
2691
|
+
*/
|
|
2692
|
+
groupLength: number;
|
|
2693
|
+
/**
|
|
2694
|
+
* Current router state for the "panes" property
|
|
2695
|
+
*/
|
|
2696
|
+
routerPanesState: RouterPanes;
|
|
2697
|
+
/**
|
|
2698
|
+
* Curried StateLink that passes the correct state automatically
|
|
2699
|
+
*/
|
|
2700
|
+
ChildLink: ComponentType<ChildLinkProps>;
|
|
2701
|
+
/**
|
|
2702
|
+
* Curried StateLink that pops off the last pane group
|
|
2703
|
+
*/
|
|
2704
|
+
BackLink?: ComponentType<BackLinkProps>;
|
|
2705
|
+
/**
|
|
2706
|
+
* A specialized `ChildLink` that takes in the needed props to open a
|
|
2707
|
+
* referenced document to the right
|
|
2708
|
+
*/
|
|
2709
|
+
ReferenceChildLink: ComponentType<ReferenceChildLinkProps>;
|
|
2710
|
+
/**
|
|
2711
|
+
* Similar to `ReferenceChildLink` expect without the wrapping component
|
|
2712
|
+
*/
|
|
2713
|
+
handleEditReference: (options: EditReferenceOptions) => void;
|
|
2714
|
+
/**
|
|
2715
|
+
* Curried StateLink that passed the correct state, but merges params/payload
|
|
2716
|
+
*/
|
|
2717
|
+
ParameterizedLink: ComponentType<ParameterizedLinkProps>;
|
|
2718
|
+
/**
|
|
2719
|
+
* Replaces the current pane with a new one
|
|
2720
|
+
*/
|
|
2721
|
+
replaceCurrent: (pane: {
|
|
2722
|
+
id?: string;
|
|
2723
|
+
payload?: unknown;
|
|
2724
|
+
params?: Record<string, string>;
|
|
2725
|
+
}) => void;
|
|
2726
|
+
/**
|
|
2727
|
+
* Removes the current pane from the group
|
|
2728
|
+
*/
|
|
2729
|
+
closeCurrent: () => void;
|
|
2730
|
+
/**
|
|
2731
|
+
* Removes all panes to the right including current pane
|
|
2732
|
+
*/
|
|
2733
|
+
closeCurrentAndAfter: (expandLast?: boolean) => void;
|
|
2734
|
+
/**
|
|
2735
|
+
* Duplicate the current pane, with optional overrides for item ID and parameters
|
|
2736
|
+
*/
|
|
2737
|
+
duplicateCurrent: (pane?: {
|
|
2738
|
+
payload?: unknown;
|
|
2739
|
+
params?: Record<string, string>;
|
|
2740
|
+
}) => void;
|
|
2741
|
+
/**
|
|
2742
|
+
* Set the current "view" for the pane
|
|
2743
|
+
*/
|
|
2744
|
+
setView: (viewId: string | null) => void;
|
|
2745
|
+
/**
|
|
2746
|
+
* Set the parameters for the current pane
|
|
2747
|
+
*/
|
|
2748
|
+
setParams: (params: Record<string, string | undefined>, stickyParams?: Record<string, string>) => void;
|
|
2749
|
+
/**
|
|
2750
|
+
* Set the payload for the current pane
|
|
2751
|
+
*/
|
|
2752
|
+
setPayload: (payload: unknown) => void;
|
|
2753
|
+
/**
|
|
2754
|
+
* A function that creates a path with the given parameters without navigating to it.
|
|
2755
|
+
* Useful for creating links that can be e.g. copied to clipboard and shared.
|
|
2756
|
+
*/
|
|
2757
|
+
createPathWithParams: (params: Record<string, string | undefined>) => string;
|
|
2758
|
+
/**
|
|
2759
|
+
* Proxied navigation to a given intent. Consider just exposing `router` instead?
|
|
2760
|
+
*/
|
|
2761
|
+
navigateIntent: (intentName: string, params: Record<string, string>, options?: {
|
|
2762
|
+
replace?: boolean;
|
|
2763
|
+
}) => void;
|
|
2764
|
+
}
|
|
2765
|
+
export { Serializable as $, GenericListBuilder as $t, StructureToolFeatures as A, DocumentListItem as At, StructureBuilderOptions as B, ListItemSerializeOptions as Bt, RouterPaneSiblingContext as C, BaseIntentParams as Cn, View as Ct, StructureResolver as D, IntentJsonParams as Dn, ListInput as Dt, StrictVersionLayeringOptions$1 as E, IntentChecker as En, ListBuilder as Et, PaneLayoutContextValue as F, ListItem as Ft, ItemChild as G, DocumentListBuilder as Gt, ChildObservable as H, UnserializedListItem as Ht, component as I, ListItemBuilder as It, Collection as J, PartialDocumentList as Jt, Builder as K, DocumentListInput as Kt, form as L, ListItemChild as Lt, StructureToolPaneActionHandler as M, DocumentListItemInput as Mt, UnresolvedPaneNode as N, PartialDocumentListItem as Nt, StructureResolverContext as O, IntentParams as On, DocumentTypeListBuilder as Ot, PaneContextValue as P, isDocumentListItem as Pt, EditorNode as Q, GenericList as Qt, HELP_URL as R, ListItemDisplayOptions as Rt, RouterPaneSibling as S, ComponentViewBuilder as Sn, UserViewComponent as St, SerializablePaneNode as T, Intent as Tn, List as Tt, ChildResolver as U, UnserializedListItemChild as Ut, createStructureBuilder as V, PartialListItem as Vt, ChildResolverOptions as W, DocumentList as Wt, Divider as X, BaseGenericList as Xt, CollectionBuilder as Y, getTypeNamesFromFilter as Yt, DocumentNode as Z, BuildableGenericList as Zt, PaneMenuItem as _, ViewBuilder as _n, DefaultDocumentNodeContext as _t, ParameterizedLinkProps as a, maybeSerializeMenuItemGroup as an, ComponentBuilder as at, PaneNodeResolver as b, FormViewBuilder as bn, StructureContext as bt, DocumentPaneInfoContextValue as c, maybeSerializeInitialValueTemplateItem as cn, MenuItem as ct, DocumentFieldMenuActionNode as d, DocumentOptions as dn, MenuItemParamsType as dt, GenericListInput as en, SerializeOptions as et, DocumentListPaneNode as f, PartialDocumentNode as fn, PartialMenuItem as ft, PaneListItemDivider as g, GenericViewBuilder as gn, maybeSerializeMenuItem as gt, PaneListItem as h, BaseView as hn, getOrderingMenuItemsForSchemaType as ht, PaneRouterContextValue as i, MenuItemGroupBuilder as in, Component$1 as it, StructureToolOptions as j, DocumentListItemBuilder as jt, StructureToolContextValue as k, defaultIntentChecker as kn, DocumentTypeListInput as kt, BaseResolvedPaneNode as l, menuItemsFromInitialValueTemplateItems as ln, MenuItemActionType as lt, ListPaneNode as m, documentFromEditorWithInitialValue as mn, getOrderingMenuItem as mt, ChildLinkProps as n, shallowIntentChecker as nn, StructureNode as nt, ReferenceChildLinkProps as o, InitialValueTemplateItemBuilder as on, ComponentInput as ot, DocumentPaneNode as p, documentFromEditor as pn, SortMenuItem as pt, Child as q, DocumentListOptions as qt, EditReferenceOptions as r, MenuItemGroup as rn, BuildableComponent as rt, DocumentPaneContextValue as s, defaultInitialValueTemplateItems as sn, KnownMenuItemParams as st, BackLinkProps as t, ListDisplayOptions as tn, SerializePath as tt, CustomComponentPaneNode as u, DocumentBuilder as un, MenuItemBuilder as ut, PaneMenuItemGroup as v, maybeSerializeView as vn, DefaultDocumentNodeResolver as vt, RouterPanes as w, DEFAULT_INTENT_HANDLER as wn, BuildableList as wt, RouterPaneGroup as x, ComponentView as xn, UserComponent as xt, PaneNode as y, FormView as yn, StructureBuilder as yt, SerializeError as z, ListItemInput as zt };
|