datocms-plugin-sdk 2.0.1 → 2.0.3
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/manifest.js +376 -303
- package/dist/cjs/manifest.js.map +1 -1
- package/dist/esm/ctx/base.d.ts +1 -1
- package/dist/esm/ctx/commonExtras/field.d.ts +4 -0
- package/dist/esm/ctx/commonExtras/itemForm.d.ts +14 -12
- package/dist/esm/ctx/commonExtras/sizing.d.ts +1 -0
- package/dist/esm/hooks/renderItemFormSidebar.d.ts +1 -1
- package/dist/esm/hooks/renderItemFormSidebarPanel.d.ts +1 -1
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.d.ts +2 -2
- package/dist/esm/hooks/renderModal.d.ts +1 -1
- package/dist/esm/hooks/renderUploadSidebar.d.ts +1 -1
- package/dist/esm/hooks/renderUploadSidebarPanel.d.ts +1 -1
- package/dist/esm/manifest.js +376 -303
- package/dist/esm/manifest.js.map +1 -1
- package/dist/esm/manifestTypes.d.ts +39 -91
- package/dist/types/ctx/base.d.ts +1 -1
- package/dist/types/ctx/commonExtras/field.d.ts +4 -0
- package/dist/types/ctx/commonExtras/itemForm.d.ts +14 -12
- package/dist/types/ctx/commonExtras/sizing.d.ts +1 -0
- package/dist/types/hooks/renderItemFormSidebar.d.ts +1 -1
- package/dist/types/hooks/renderItemFormSidebarPanel.d.ts +1 -1
- package/dist/types/hooks/renderManualFieldExtensionConfigScreen.d.ts +2 -2
- package/dist/types/hooks/renderModal.d.ts +1 -1
- package/dist/types/hooks/renderUploadSidebar.d.ts +1 -1
- package/dist/types/hooks/renderUploadSidebarPanel.d.ts +1 -1
- package/dist/types/manifestTypes.d.ts +39 -91
- package/manifest.json +376 -303
- package/package.json +2 -2
- package/src/ctx/base.ts +1 -1
- package/src/ctx/commonExtras/field.ts +4 -0
- package/src/ctx/commonExtras/itemForm.ts +15 -12
- package/src/ctx/commonExtras/sizing.ts +1 -0
- package/src/hooks/renderItemFormSidebar.ts +1 -1
- package/src/hooks/renderItemFormSidebarPanel.ts +1 -1
- package/src/hooks/renderManualFieldExtensionConfigScreen.ts +2 -2
- package/src/hooks/renderModal.ts +1 -1
- package/src/hooks/renderUploadSidebar.ts +1 -1
- package/src/hooks/renderUploadSidebarPanel.ts +1 -1
- package/src/manifest.ts +533 -401
- package/src/manifestTypes.ts +39 -91
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"glob": "^11.0.0",
|
|
46
46
|
"typescript": "^5.6.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b505f6681411e687cd6908661d73670ecaf8a584"
|
|
49
49
|
}
|
package/src/ctx/base.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { SchemaTypes } from '@datocms/cma-client';
|
|
|
3
3
|
type Field = SchemaTypes.Field;
|
|
4
4
|
type ItemType = SchemaTypes.ItemType;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* These information describe the current state of the field where this plugin
|
|
8
|
+
* is applied to.
|
|
9
|
+
*/
|
|
6
10
|
export type FieldAdditionalProperties = {
|
|
7
11
|
/** Whether the field is currently disabled or not */
|
|
8
12
|
disabled: boolean;
|
|
@@ -25,19 +25,22 @@ export type ItemFormAdditionalProperties = {
|
|
|
25
25
|
isSubmitting: boolean;
|
|
26
26
|
/** Whether the form has some non-persisted changes or not */
|
|
27
27
|
isFormDirty: boolean;
|
|
28
|
-
/**
|
|
29
|
-
blocksAnalysis:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
/** Provides information on how many blocks are currently present in the form */
|
|
29
|
+
blocksAnalysis: BlocksAnalysis;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Current number of blocks present in form state */
|
|
33
|
+
export type BlocksAnalysis = {
|
|
34
|
+
usage: {
|
|
35
|
+
/** Total number of blocks present in form state */
|
|
36
|
+
total: number;
|
|
37
|
+
/** Total number of blocks present in non-localized fields */
|
|
38
|
+
nonLocalized: number;
|
|
39
|
+
/** Total number of blocks present in localized fields, per locale */
|
|
40
|
+
perLocale: Record<string, number>;
|
|
40
41
|
};
|
|
42
|
+
/** Maximum number of blocks per item */
|
|
43
|
+
maximumPerItem: number;
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -8,7 +8,7 @@ import { fullScreenRenderModeBootstrapper } from '../utils';
|
|
|
8
8
|
export type RenderItemFormSidebarHook = {
|
|
9
9
|
/**
|
|
10
10
|
* This function will be called when the plugin needs to render a sidebar (see
|
|
11
|
-
* the `itemFormSidebars`
|
|
11
|
+
* the `itemFormSidebars` hook)
|
|
12
12
|
*
|
|
13
13
|
* @tag sidebarPanels
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@ import { containedRenderModeBootstrapper } from '../utils';
|
|
|
8
8
|
export type RenderItemFormSidebarPanelHook = {
|
|
9
9
|
/**
|
|
10
10
|
* This function will be called when the plugin needs to render a sidebar panel
|
|
11
|
-
* (see the `itemFormSidebarPanels`
|
|
11
|
+
* (see the `itemFormSidebarPanels` hook)
|
|
12
12
|
*
|
|
13
13
|
* @tag sidebarPanels
|
|
14
14
|
*/
|
|
@@ -23,12 +23,12 @@ export type RenderManualFieldExtensionConfigScreenCtx =
|
|
|
23
23
|
fieldExtensionId: string;
|
|
24
24
|
/**
|
|
25
25
|
* The current value of the parameters (you can change the value with the
|
|
26
|
-
* `setParameters`
|
|
26
|
+
* `setParameters` hook)
|
|
27
27
|
*/
|
|
28
28
|
parameters: Record<string, unknown>;
|
|
29
29
|
/**
|
|
30
30
|
* The current validation errors for the parameters (you can set them
|
|
31
|
-
* implementing the `validateManualFieldExtensionParameters`
|
|
31
|
+
* implementing the `validateManualFieldExtensionParameters` hook)
|
|
32
32
|
*/
|
|
33
33
|
errors: Record<string, unknown>;
|
|
34
34
|
|
package/src/hooks/renderModal.ts
CHANGED
|
@@ -7,7 +7,7 @@ type Upload = SchemaTypes.Upload;
|
|
|
7
7
|
export type RenderUploadSidebarPanelHook = {
|
|
8
8
|
/**
|
|
9
9
|
* This function will be called when the plugin needs to render a sidebar panel
|
|
10
|
-
* (see the `uploadSidebarPanels`
|
|
10
|
+
* (see the `uploadSidebarPanels` hook)
|
|
11
11
|
*
|
|
12
12
|
* @tag sidebarPanels
|
|
13
13
|
*/
|