@sanity/workbench-cli 2.0.1 → 2.1.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/dist/_exports/_internal_render.d.ts +12 -0
- package/dist/_exports/_internal_render.js +3 -0
- package/dist/_exports/_internal_render.js.map +1 -0
- package/dist/_exports/build.d.ts +13 -253
- package/dist/_exports/contract-DyG11fQ7.d.ts +45 -0
- package/dist/_exports/defineApp-DSvQx8rf.d.ts +151 -0
- package/dist/_exports/deploy.d.ts +94 -427
- package/dist/_exports/dev.d.ts +26 -196
- package/dist/_exports/index.d.ts +74 -407
- package/dist/_exports/init.d.ts +5 -9
- package/dist/_exports/preview.d.ts +20 -187
- package/dist/_exports/registry-DI7hnTof.d.ts +102 -0
- package/dist/_exports/resolveWorkbenchApp-Be9eU8mu.d.ts +41 -0
- package/dist/_exports/summarizeInterfaces-DLsq6P43.d.ts +62 -0
- package/dist/_exports/undeploy.d.ts +15 -296
- package/dist/actions/build/vite/plugins/plugin-module-federation.js +7 -15
- package/dist/actions/build/vite/plugins/plugin-module-federation.js.map +1 -1
- package/dist/actions/dev/registry.js +9 -0
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +50 -3
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +15 -36
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/writeWorkbenchRuntime.js +2 -2
- package/dist/actions/dev/writeWorkbenchRuntime.js.map +1 -1
- package/dist/defineApp.js +1 -4
- package/dist/defineApp.js.map +1 -1
- package/dist/renderDashboard.js +63 -0
- package/dist/renderDashboard.js.map +1 -0
- package/dist/services/applications.js +7 -7
- package/dist/services/applications.js.map +1 -1
- package/dist/services/installations.js +4 -4
- package/dist/services/installations.js.map +1 -1
- package/package.json +13 -7
package/dist/_exports/index.d.ts
CHANGED
|
@@ -1,281 +1,54 @@
|
|
|
1
|
+
import { a as MediaLibraryField, c as unstable_defineApp, i as DockGroup, l as unstable_defineMediaLibrary, n as DefineAppResult, o as WorkbenchApp, r as DefineMediaLibraryInput, s as isWorkbenchApp, t as DefineAppInput } from "./defineApp-DSvQx8rf.js";
|
|
2
|
+
import { a as VIEW_CONTRACT_VERSION, i as TileSize, n as SERVICE_CONTRACT_VERSION, o as ViewComponent, r as ServiceType, s as ViewComponentBaseProps, t as InterfaceType } from "./contract-DyG11fQ7.js";
|
|
1
3
|
import { AssetSourceComponentProps } from "@sanity/types";
|
|
2
|
-
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* one island.
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export declare type AssetSourceComponent = keyof AssetSourceViewComponents;
|
|
10
|
-
|
|
11
|
-
/** The `asset_source` variant of an app's `views`. @public */
|
|
12
|
-
declare type AssetSourceView = Extract<
|
|
13
|
-
NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
|
|
14
|
-
{
|
|
15
|
-
type: "asset_source";
|
|
16
|
-
}
|
|
17
|
-
>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The component slots an `asset_source` view exposes — a single picker island,
|
|
21
|
-
* typed with the studio asset-source props it renders behind. The props are
|
|
22
|
-
* `@sanity/types`' `AssetSourceComponentProps` directly, so an authored picker
|
|
23
|
-
* receives exactly what a studio `AssetSource.component` does.
|
|
5
|
+
* The service's own declaration, surfaced to the callback.
|
|
24
6
|
* @public
|
|
25
7
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
interface ServiceInfo {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly type: string;
|
|
28
11
|
}
|
|
29
|
-
|
|
30
12
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* not part of the public surface (Sanity-owned apps set them via
|
|
34
|
-
* `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
|
|
35
|
-
* panel `views`, never both — but `asset_source` and `tile` views are separate
|
|
36
|
-
* kinds and may accompany either.
|
|
13
|
+
* Context every service callback receives when its worker starts. Mirrors how a
|
|
14
|
+
* view component receives its `view` — the service receives its own `service`.
|
|
37
15
|
* @public
|
|
38
16
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
> &
|
|
43
|
-
(
|
|
44
|
-
| {
|
|
45
|
-
entry?: never;
|
|
46
|
-
views?: NonNullable<z.output<typeof DefineAppInputSchema>["views"]>;
|
|
47
|
-
}
|
|
48
|
-
| {
|
|
49
|
-
entry?: string;
|
|
50
|
-
views?: (AssetSourceView | TileView)[];
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Runtime-validation schema for `unstable_defineApp`.
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
59
|
-
{
|
|
60
|
-
applicationType: z.ZodMiniOptional<
|
|
61
|
-
z.ZodMiniEnum<{
|
|
62
|
-
"media-library": "media-library";
|
|
63
|
-
coreApp: "coreApp";
|
|
64
|
-
studio: "studio";
|
|
65
|
-
canvas: "canvas";
|
|
66
|
-
dashboard: "dashboard";
|
|
67
|
-
}>
|
|
68
|
-
>;
|
|
69
|
-
config: z.ZodMiniOptional<
|
|
70
|
-
z.ZodMiniDiscriminatedUnion<
|
|
71
|
-
[
|
|
72
|
-
z.ZodMiniObject<
|
|
73
|
-
{
|
|
74
|
-
appType: z.ZodMiniLiteral<"media-library">;
|
|
75
|
-
fields: z.ZodMiniArray<
|
|
76
|
-
z.ZodMiniObject<
|
|
77
|
-
{
|
|
78
|
-
public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
79
|
-
title: z.ZodMiniString<string>;
|
|
80
|
-
name: z.ZodMiniString<string>;
|
|
81
|
-
src: z.ZodMiniString<string>;
|
|
82
|
-
},
|
|
83
|
-
z.core.$strip
|
|
84
|
-
>
|
|
85
|
-
>;
|
|
86
|
-
},
|
|
87
|
-
z.core.$strip
|
|
88
|
-
>,
|
|
89
|
-
],
|
|
90
|
-
"appType"
|
|
91
|
-
>
|
|
92
|
-
>;
|
|
93
|
-
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
94
|
-
group: z.ZodMiniOptional<
|
|
95
|
-
z.ZodMiniEnum<{
|
|
96
|
-
"dock.system": "dock.system";
|
|
97
|
-
"dock.applications": "dock.applications";
|
|
98
|
-
"dock.user": "dock.user";
|
|
99
|
-
}>
|
|
100
|
-
>;
|
|
101
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
102
|
-
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
103
|
-
organizationId: z.ZodMiniString<string>;
|
|
104
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
105
|
-
services: z.ZodMiniOptional<
|
|
106
|
-
z.ZodMiniArray<
|
|
107
|
-
z.ZodMiniDiscriminatedUnion<
|
|
108
|
-
[
|
|
109
|
-
z.ZodMiniObject<
|
|
110
|
-
{
|
|
111
|
-
title: z.ZodMiniString<string>;
|
|
112
|
-
name: z.ZodMiniString<string>;
|
|
113
|
-
src: z.ZodMiniString<string>;
|
|
114
|
-
type: z.ZodMiniLiteral<"worker">;
|
|
115
|
-
},
|
|
116
|
-
z.core.$strip
|
|
117
|
-
>,
|
|
118
|
-
],
|
|
119
|
-
"type"
|
|
120
|
-
>
|
|
121
|
-
>
|
|
122
|
-
>;
|
|
123
|
-
slug: z.ZodMiniString<string>;
|
|
124
|
-
title: z.ZodMiniString<string>;
|
|
125
|
-
views: z.ZodMiniOptional<
|
|
126
|
-
z.ZodMiniArray<
|
|
127
|
-
z.ZodMiniDiscriminatedUnion<
|
|
128
|
-
[
|
|
129
|
-
z.ZodMiniObject<
|
|
130
|
-
{
|
|
131
|
-
title: z.ZodMiniString<string>;
|
|
132
|
-
name: z.ZodMiniString<string>;
|
|
133
|
-
src: z.ZodMiniString<string>;
|
|
134
|
-
type: z.ZodMiniLiteral<"panel">;
|
|
135
|
-
},
|
|
136
|
-
z.core.$strip
|
|
137
|
-
>,
|
|
138
|
-
z.ZodMiniObject<
|
|
139
|
-
{
|
|
140
|
-
title: z.ZodMiniString<string>;
|
|
141
|
-
name: z.ZodMiniString<string>;
|
|
142
|
-
src: z.ZodMiniString<string>;
|
|
143
|
-
type: z.ZodMiniLiteral<"asset_source">;
|
|
144
|
-
},
|
|
145
|
-
z.core.$strip
|
|
146
|
-
>,
|
|
147
|
-
z.ZodMiniObject<
|
|
148
|
-
{
|
|
149
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
150
|
-
size: z.ZodMiniEnum<{
|
|
151
|
-
small: "small";
|
|
152
|
-
large: "large";
|
|
153
|
-
banner: "banner";
|
|
154
|
-
}>;
|
|
155
|
-
title: z.ZodMiniString<string>;
|
|
156
|
-
name: z.ZodMiniString<string>;
|
|
157
|
-
src: z.ZodMiniString<string>;
|
|
158
|
-
type: z.ZodMiniLiteral<"tile">;
|
|
159
|
-
},
|
|
160
|
-
z.core.$strip
|
|
161
|
-
>,
|
|
162
|
-
],
|
|
163
|
-
"type"
|
|
164
|
-
>
|
|
165
|
-
>
|
|
166
|
-
>;
|
|
167
|
-
visibility: z.ZodMiniOptional<
|
|
168
|
-
z.ZodMiniEnum<{
|
|
169
|
-
default: "default";
|
|
170
|
-
unlisted: "unlisted";
|
|
171
|
-
disabled: "disabled";
|
|
172
|
-
}>
|
|
173
|
-
>;
|
|
174
|
-
},
|
|
175
|
-
z.core.$strip
|
|
176
|
-
>;
|
|
177
|
-
|
|
17
|
+
interface ServiceContext {
|
|
18
|
+
readonly service: ServiceInfo;
|
|
19
|
+
}
|
|
178
20
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
21
|
+
* A service callback. Runs once inside the worker on start; returns an optional
|
|
22
|
+
* disposer the host calls before terminating the worker.
|
|
181
23
|
* @public
|
|
182
24
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
25
|
+
type ServiceCallback = (context: ServiceContext) => (() => void) | void;
|
|
26
|
+
/** The callback shape each service type defines, keyed by type. */
|
|
27
|
+
interface ServiceCallbacksByType {
|
|
28
|
+
worker: ServiceCallback;
|
|
29
|
+
}
|
|
187
30
|
/**
|
|
188
31
|
* The result of `unstable_defineService`: the author's callback, the service
|
|
189
32
|
* type, and the internal contract version the worker artifact targets.
|
|
190
33
|
* @public
|
|
191
34
|
*/
|
|
192
|
-
|
|
193
|
-
TType extends ServiceType = ServiceType,
|
|
194
|
-
> {
|
|
35
|
+
interface DefinedService<TType extends ServiceType = ServiceType> {
|
|
195
36
|
readonly run: ServiceCallbacksByType[TType];
|
|
196
37
|
readonly type: TType;
|
|
197
38
|
/** @internal */
|
|
198
39
|
readonly version: typeof SERVICE_CONTRACT_VERSION;
|
|
199
40
|
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* The result of `unstable_defineView`: the author's component(s), the view type,
|
|
203
|
-
* and the internal contract version the build artifact targets.
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export declare interface DefinedView<
|
|
207
|
-
TType extends InterfaceType = InterfaceType,
|
|
208
|
-
> {
|
|
209
|
-
readonly components: ViewComponentsByType[TType];
|
|
210
|
-
readonly type: TType;
|
|
211
|
-
/** @internal */
|
|
212
|
-
readonly version: typeof VIEW_CONTRACT_VERSION;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Sanity-owned singleton, so authors don't name or title the app — only `organizationId` is required.
|
|
217
|
-
* @public
|
|
218
|
-
*/
|
|
219
|
-
export declare interface DefineMediaLibraryInput {
|
|
220
|
-
/** Organization that owns the media library — the CLI runs and deploys against it. */
|
|
221
|
-
organizationId: string;
|
|
222
|
-
fields?: MediaLibraryField[];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
41
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
/** Dock groups an app can place itself into. */
|
|
234
|
-
declare const DockGroupSchema: z.ZodMiniEnum<{
|
|
235
|
-
"dock.system": "dock.system";
|
|
236
|
-
"dock.applications": "dock.applications";
|
|
237
|
-
"dock.user": "dock.user";
|
|
238
|
-
}>;
|
|
239
|
-
|
|
240
|
-
/** @public */
|
|
241
|
-
export declare type InterfaceType = keyof typeof VIEW_COMPONENTS;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Whether `app` is a branded `unstable_defineApp(...)` result — the sole
|
|
245
|
-
* workbench opt-in.
|
|
246
|
-
* @public
|
|
247
|
-
*/
|
|
248
|
-
export declare function isWorkbenchApp(app: unknown): app is WorkbenchApp;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* One custom field a media library exposes. `src` default-exports a `defineField(...)` schema type.
|
|
252
|
-
* @public
|
|
253
|
-
*/
|
|
254
|
-
export declare interface MediaLibraryField {
|
|
255
|
-
/** Unique within the media library. */
|
|
256
|
-
name: string;
|
|
257
|
-
src: string;
|
|
258
|
-
title: string;
|
|
259
|
-
/** Readable outside the owning organization. */
|
|
260
|
-
public?: boolean;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* A panel's view-component slot — the module-federation expose for one island.
|
|
265
|
-
* @public
|
|
266
|
-
*/
|
|
267
|
-
export declare type PanelComponent = keyof PanelViewComponents;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* The component slots a `panel` view exposes — each its own module-federation
|
|
271
|
-
* island, typed with the panel props.
|
|
42
|
+
* Define a Sanity Workbench background service. The first argument narrows the
|
|
43
|
+
* callback shape — `"worker"` runs the callback inside a Web Worker, where it
|
|
44
|
+
* can emit dock-badge updates and return a disposer.
|
|
45
|
+
*
|
|
46
|
+
* Identity at runtime: returns the callback tagged with its type and the contract
|
|
47
|
+
* version, for the CLI build to generate a worker artifact from. Used as the
|
|
48
|
+
* default export of a service's `src` file.
|
|
272
49
|
* @public
|
|
273
50
|
*/
|
|
274
|
-
|
|
275
|
-
panel: ViewComponent<PanelViewProps>;
|
|
276
|
-
title: ViewComponent<PanelViewProps>;
|
|
277
|
-
}
|
|
278
|
-
|
|
51
|
+
declare function unstable_defineService<TType extends ServiceType>(type: TType, run: ServiceCallbacksByType[TType]): DefinedService<TType>;
|
|
279
52
|
/**
|
|
280
53
|
* Props a panel component receives: its interface record, minus the
|
|
281
54
|
* service-assigned `id`/`deployment_id` a local dev server can't provide. Mirrors
|
|
@@ -283,90 +56,42 @@ export declare interface PanelViewComponents {
|
|
|
283
56
|
* `@sanity/workbench`); drift is guarded by the stamped contract version.
|
|
284
57
|
* @public
|
|
285
58
|
*/
|
|
286
|
-
|
|
59
|
+
type PanelViewProps = ViewComponentBaseProps<{
|
|
287
60
|
name: string;
|
|
288
61
|
src: string;
|
|
289
62
|
title: string;
|
|
290
|
-
type:
|
|
63
|
+
type: 'panel';
|
|
291
64
|
}>;
|
|
292
|
-
|
|
293
|
-
/** @internal */
|
|
294
|
-
declare const SERVICE_CONTRACT_VERSION = 1;
|
|
295
|
-
|
|
296
65
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
66
|
+
* The component slots a `panel` view exposes — each its own module-federation
|
|
67
|
+
* island, typed with the panel props.
|
|
299
68
|
* @public
|
|
300
69
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
/** The callback shape each service type defines, keyed by type. */
|
|
306
|
-
declare interface ServiceCallbacksByType {
|
|
307
|
-
worker: ServiceCallback;
|
|
70
|
+
interface PanelViewComponents {
|
|
71
|
+
panel: ViewComponent<PanelViewProps>;
|
|
72
|
+
title: ViewComponent<PanelViewProps>;
|
|
308
73
|
}
|
|
309
|
-
|
|
310
74
|
/**
|
|
311
|
-
*
|
|
312
|
-
* view component receives its `view` — the service receives its own `service`.
|
|
75
|
+
* A panel's view-component slot — the module-federation expose for one island.
|
|
313
76
|
* @public
|
|
314
77
|
*/
|
|
315
|
-
|
|
316
|
-
readonly service: ServiceInfo;
|
|
317
|
-
}
|
|
318
|
-
|
|
78
|
+
type PanelComponent = keyof PanelViewComponents;
|
|
319
79
|
/**
|
|
320
|
-
* The
|
|
80
|
+
* The component slots an `asset_source` view exposes — a single picker island,
|
|
81
|
+
* typed with the studio asset-source props it renders behind. The props are
|
|
82
|
+
* `@sanity/types`' `AssetSourceComponentProps` directly, so an authored picker
|
|
83
|
+
* receives exactly what a studio `AssetSource.component` does.
|
|
321
84
|
* @public
|
|
322
85
|
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
readonly type: string;
|
|
86
|
+
interface AssetSourceViewComponents {
|
|
87
|
+
asset_source: ViewComponent<AssetSourceComponentProps>;
|
|
326
88
|
}
|
|
327
|
-
|
|
328
|
-
/** @public */
|
|
329
|
-
export declare type ServiceType = "worker";
|
|
330
|
-
|
|
331
89
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*/
|
|
335
|
-
export declare type TileComponent = keyof TileViewComponents;
|
|
336
|
-
|
|
337
|
-
/** @public */
|
|
338
|
-
export declare type TileSize = z.infer<typeof TileSizeSchema>;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* A tile's footprint family — the shape it occupies on the dashboard. Modelled
|
|
342
|
-
* on iOS WidgetKit families, not a linear scale: `banner` is full-width and
|
|
343
|
-
* shallow, which a `small`→`large` magnitude can't express. The host maps a
|
|
344
|
-
* family to a layout slot; the component reads it to render per footprint.
|
|
345
|
-
* @public
|
|
346
|
-
*/
|
|
347
|
-
declare const TileSizeSchema: z.ZodMiniEnum<{
|
|
348
|
-
small: "small";
|
|
349
|
-
large: "large";
|
|
350
|
-
banner: "banner";
|
|
351
|
-
}>;
|
|
352
|
-
|
|
353
|
-
/** The `tile` variant of an app's `views`. @public */
|
|
354
|
-
declare type TileView = Extract<
|
|
355
|
-
NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
|
|
356
|
-
{
|
|
357
|
-
type: "tile";
|
|
358
|
-
}
|
|
359
|
-
>;
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* The component slot a `tile` view exposes — a single island, typed with the
|
|
363
|
-
* tile props.
|
|
90
|
+
* An asset source's view-component slot — the module-federation expose for its
|
|
91
|
+
* one island.
|
|
364
92
|
* @public
|
|
365
93
|
*/
|
|
366
|
-
|
|
367
|
-
tile: ViewComponent<TileViewProps>;
|
|
368
|
-
}
|
|
369
|
-
|
|
94
|
+
type AssetSourceComponent = keyof AssetSourceViewComponents;
|
|
370
95
|
/**
|
|
371
96
|
* Props a tile component receives: its own interface record (name/src/title/
|
|
372
97
|
* type) plus its footprint `size`, so it can render per family. Mirrors the
|
|
@@ -374,114 +99,56 @@ export declare interface TileViewComponents {
|
|
|
374
99
|
* contract version. Placement `priority` is host-only metadata, not surfaced here.
|
|
375
100
|
* @public
|
|
376
101
|
*/
|
|
377
|
-
|
|
102
|
+
type TileViewProps = ViewComponentBaseProps<{
|
|
378
103
|
name: string;
|
|
379
104
|
size: TileSize;
|
|
380
105
|
src: string;
|
|
381
106
|
title: string;
|
|
382
|
-
type:
|
|
107
|
+
type: 'tile';
|
|
383
108
|
}>;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Declare a Sanity Workbench application. Identity at runtime — returns the same
|
|
387
|
-
* object reference, tagged with the workbench brand. Field validation (the
|
|
388
|
-
* `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
|
|
389
|
-
* this helper stays a thin, pure identity wrapper.
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
392
|
-
export declare function unstable_defineApp(
|
|
393
|
-
input: DefineAppInput,
|
|
394
|
-
): DefineAppResult;
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its config.
|
|
398
|
-
* @public
|
|
399
|
-
*/
|
|
400
|
-
export declare function unstable_defineMediaLibrary(
|
|
401
|
-
input: DefineMediaLibraryInput,
|
|
402
|
-
): DefineAppResult;
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Define a Sanity Workbench background service. The first argument narrows the
|
|
406
|
-
* callback shape — `"worker"` runs the callback inside a Web Worker, where it
|
|
407
|
-
* can emit dock-badge updates and return a disposer.
|
|
408
|
-
*
|
|
409
|
-
* Identity at runtime: returns the callback tagged with its type and the contract
|
|
410
|
-
* version, for the CLI build to generate a worker artifact from. Used as the
|
|
411
|
-
* default export of a service's `src` file.
|
|
412
|
-
* @public
|
|
413
|
-
*/
|
|
414
|
-
export declare function unstable_defineService<TType extends ServiceType>(
|
|
415
|
-
type: TType,
|
|
416
|
-
run: ServiceCallbacksByType[TType],
|
|
417
|
-
): DefinedService<TType>;
|
|
418
|
-
|
|
419
109
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* record whose components are typed with the panel props.
|
|
423
|
-
*
|
|
424
|
-
* Returns the component(s) tagged with their type and the contract version, for
|
|
425
|
-
* the CLI build to generate render artifacts from. Used as the default export of
|
|
426
|
-
* a view's `src` file.
|
|
110
|
+
* The component slot a `tile` view exposes — a single island, typed with the
|
|
111
|
+
* tile props.
|
|
427
112
|
* @public
|
|
428
113
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
): DefinedView<TType>;
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Component slots each interface type exposes, in render order. Source of truth
|
|
436
|
-
* for {@link InterfaceType} and the build; add a type by registering it here.
|
|
437
|
-
* @internal
|
|
438
|
-
*/
|
|
439
|
-
declare const VIEW_COMPONENTS: {
|
|
440
|
-
readonly asset_source: readonly ["asset_source"];
|
|
441
|
-
readonly panel: readonly ["title", "panel"];
|
|
442
|
-
readonly tile: readonly ["tile"];
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
/** @internal */
|
|
446
|
-
declare const VIEW_CONTRACT_VERSION = 1;
|
|
447
|
-
|
|
114
|
+
interface TileViewComponents {
|
|
115
|
+
tile: ViewComponent<TileViewProps>;
|
|
116
|
+
}
|
|
448
117
|
/**
|
|
449
|
-
* A view
|
|
450
|
-
* dependency — the generated artifact renders it with the app's own React.
|
|
118
|
+
* A tile's view-component slot — the module-federation expose for its one island.
|
|
451
119
|
* @public
|
|
452
120
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
/** @public */
|
|
456
|
-
declare interface ViewComponentBaseProps<TView> {
|
|
457
|
-
view: TView;
|
|
458
|
-
}
|
|
459
|
-
|
|
121
|
+
type TileComponent = keyof TileViewComponents;
|
|
460
122
|
/**
|
|
461
123
|
* The components each interface type exposes, keyed by type.
|
|
462
124
|
* @public
|
|
463
125
|
*/
|
|
464
|
-
|
|
126
|
+
interface ViewComponentsByType {
|
|
465
127
|
asset_source: AssetSourceViewComponents;
|
|
466
128
|
panel: PanelViewComponents;
|
|
467
129
|
tile: TileViewComponents;
|
|
468
130
|
}
|
|
469
|
-
|
|
470
131
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* `Symbol.for` rather than importing it, so it stays internal to this module.
|
|
132
|
+
* The result of `unstable_defineView`: the author's component(s), the view type,
|
|
133
|
+
* and the internal contract version the build artifact targets.
|
|
134
|
+
* @public
|
|
475
135
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
136
|
+
interface DefinedView<TType extends InterfaceType = InterfaceType> {
|
|
137
|
+
readonly components: ViewComponentsByType[TType];
|
|
138
|
+
readonly type: TType;
|
|
139
|
+
/** @internal */
|
|
140
|
+
readonly version: typeof VIEW_CONTRACT_VERSION;
|
|
141
|
+
}
|
|
478
142
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
143
|
+
* Define a Sanity Workbench view. The first argument narrows the component shape
|
|
144
|
+
* and the props each component receives — `"panel"` yields a `{title, panel}`
|
|
145
|
+
* record whose components are typed with the panel props.
|
|
146
|
+
*
|
|
147
|
+
* Returns the component(s) tagged with their type and the contract version, for
|
|
148
|
+
* the CLI build to generate render artifacts from. Used as the default export of
|
|
149
|
+
* a view's `src` file.
|
|
482
150
|
* @public
|
|
483
151
|
*/
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
export {};
|
|
152
|
+
declare function unstable_defineView<TType extends InterfaceType>(type: TType, components: ViewComponentsByType[TType]): DefinedView<TType>;
|
|
153
|
+
export { type AssetSourceComponent, type AssetSourceViewComponents, type DefineAppInput, type DefineAppResult, type DefineMediaLibraryInput, type DefinedService, type DefinedView, type DockGroup, type InterfaceType, type MediaLibraryField, type PanelComponent, type PanelViewComponents, type PanelViewProps, type ServiceCallback, type ServiceContext, type ServiceInfo, type ServiceType, type TileComponent, type TileSize, type TileViewComponents, type TileViewProps, type ViewComponentsByType, type WorkbenchApp, isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary, unstable_defineService, unstable_defineView };
|
|
154
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/_exports/init.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export declare function toAppSlug(value: string): string | null;
|
|
2
|
-
|
|
3
1
|
/** App scaffold — `entry` auto-declares the navigable app view. */
|
|
4
|
-
|
|
5
|
-
"\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
|
|
6
|
-
|
|
2
|
+
declare const workbenchAppConfigTemplate = "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
|
|
7
3
|
/**
|
|
8
4
|
* Studio scaffold — brands with slug/title only, no `entry` (studio app views
|
|
9
5
|
* aren't implemented yet).
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
declare const workbenchStudioConfigTemplate = "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: unstable_defineApp({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n }),\n deployment: {\n /**\n * Enable auto-updates for studios.\n * Learn more at https://www.sanity.io/docs/studio/latest-version-of-sanity#k47faf43faf56\n */\n autoUpdates: __BOOL__autoUpdates__,\n },\n})\n";
|
|
8
|
+
declare function toAppSlug(value: string): string | null;
|
|
9
|
+
export { toAppSlug, workbenchAppConfigTemplate, workbenchStudioConfigTemplate };
|
|
10
|
+
//# sourceMappingURL=init.d.ts.map
|