datocms-plugin-sdk 0.7.9 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/connect.js +20 -8
- package/dist/cjs/connect.js.map +1 -1
- package/dist/cjs/guards.js +2 -1
- package/dist/cjs/guards.js.map +1 -1
- package/dist/esm/connect.d.ts +16 -1
- package/dist/esm/connect.js +21 -9
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/guards.d.ts +4 -1
- package/dist/esm/guards.js +1 -0
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/types.d.ts +42 -0
- package/dist/types/connect.d.ts +16 -1
- package/dist/types/guards.d.ts +4 -1
- package/dist/types/types.d.ts +42 -0
- package/package.json +2 -2
- package/src/connect.ts +47 -0
- package/src/guards.ts +5 -0
- package/src/types.ts +51 -0
- package/types.json +3256 -2426
package/src/guards.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
RenderSidebarPanelMethods,
|
|
9
9
|
RenderModalMethods,
|
|
10
10
|
RenderAssetSourceMethods,
|
|
11
|
+
RenderSidebarMethods,
|
|
11
12
|
} from './types';
|
|
12
13
|
|
|
13
14
|
export type Parent = { getSettings: () => Promise<{ mode: string }> };
|
|
@@ -31,6 +32,10 @@ export const isRenderSidebarPanelParent = buildGuard<RenderSidebarPanelMethods>(
|
|
|
31
32
|
'renderItemFormSidebarPanel',
|
|
32
33
|
);
|
|
33
34
|
|
|
35
|
+
export const isRenderSidebarParent = buildGuard<RenderSidebarMethods>(
|
|
36
|
+
'renderItemFormSidebar',
|
|
37
|
+
);
|
|
38
|
+
|
|
34
39
|
export const isRenderItemFormOutletParent =
|
|
35
40
|
buildGuard<RenderItemFormOutletMethods>('renderItemFormOutlet');
|
|
36
41
|
|
package/src/types.ts
CHANGED
|
@@ -284,6 +284,32 @@ export type ItemFormSidebarPanel = {
|
|
|
284
284
|
initialHeight?: number;
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
+
/** A sidebar to be shown inside the record's editing page */
|
|
288
|
+
export type ItemFormSidebar = {
|
|
289
|
+
/**
|
|
290
|
+
* ID of the sidebar. Will be the first argument for the
|
|
291
|
+
* `renderItemFormSidebar` function
|
|
292
|
+
*/
|
|
293
|
+
id: string;
|
|
294
|
+
/** Label to be shown on the collapsible sidebar handle */
|
|
295
|
+
label: string;
|
|
296
|
+
/**
|
|
297
|
+
* An arbitrary configuration object that will be passed as the `parameters`
|
|
298
|
+
* property of the second argument of the `renderItemFormSidebar` function
|
|
299
|
+
*/
|
|
300
|
+
parameters?: Record<string, unknown>;
|
|
301
|
+
/**
|
|
302
|
+
* If multiple sidebars specify the same `placement`, they will be sorted by
|
|
303
|
+
* ascending `rank`. If you want to specify an explicit value for `rank`, make
|
|
304
|
+
* sure to offer a way for final users to customize it inside the plugin's
|
|
305
|
+
* settings form, otherwise the hardcoded value you choose might clash with
|
|
306
|
+
* the one of another plugin!
|
|
307
|
+
*/
|
|
308
|
+
rank?: number;
|
|
309
|
+
/** The preferred width for the sidebar */
|
|
310
|
+
preferredWidth?: number;
|
|
311
|
+
};
|
|
312
|
+
|
|
287
313
|
/** An outlet to be shown at the top of a record's editing page */
|
|
288
314
|
export type ItemFormOutlet = {
|
|
289
315
|
/**
|
|
@@ -1325,6 +1351,31 @@ export type RenderSidebarPanelMethods = ItemFormMethods &
|
|
|
1325
1351
|
export type RenderSidebarPanelPropertiesAndMethods = RenderSidebarPanelMethods &
|
|
1326
1352
|
RenderSidebarPanelProperties;
|
|
1327
1353
|
|
|
1354
|
+
/** Information regarding the specific sidebar panel that you need to render */
|
|
1355
|
+
export type RenderSidebarAdditionalProperties = {
|
|
1356
|
+
mode: 'renderItemFormSidebar';
|
|
1357
|
+
/** The ID of the sidebar that needs to be rendered */
|
|
1358
|
+
sidebarId: string;
|
|
1359
|
+
/**
|
|
1360
|
+
* The arbitrary `parameters` of the declared in the `itemFormSidebars`
|
|
1361
|
+
* function
|
|
1362
|
+
*/
|
|
1363
|
+
parameters: Record<string, unknown>;
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
export type RenderSidebarProperties = ItemFormProperties &
|
|
1367
|
+
RenderSidebarAdditionalProperties;
|
|
1368
|
+
|
|
1369
|
+
export type RenderSidebarAdditionalMethods = {
|
|
1370
|
+
getSettings: () => Promise<RenderSidebarProperties>;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
export type RenderSidebarMethods = ItemFormMethods &
|
|
1374
|
+
RenderSidebarAdditionalMethods;
|
|
1375
|
+
|
|
1376
|
+
export type RenderSidebarPropertiesAndMethods = RenderSidebarMethods &
|
|
1377
|
+
RenderSidebarProperties;
|
|
1378
|
+
|
|
1328
1379
|
/** Information regarding the specific outlet that you need to render */
|
|
1329
1380
|
export type RenderItemFormOutletAdditionalProperties = {
|
|
1330
1381
|
mode: 'renderItemFormOutlet';
|