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.
Files changed (40) hide show
  1. package/dist/cjs/manifest.js +376 -303
  2. package/dist/cjs/manifest.js.map +1 -1
  3. package/dist/esm/ctx/base.d.ts +1 -1
  4. package/dist/esm/ctx/commonExtras/field.d.ts +4 -0
  5. package/dist/esm/ctx/commonExtras/itemForm.d.ts +14 -12
  6. package/dist/esm/ctx/commonExtras/sizing.d.ts +1 -0
  7. package/dist/esm/hooks/renderItemFormSidebar.d.ts +1 -1
  8. package/dist/esm/hooks/renderItemFormSidebarPanel.d.ts +1 -1
  9. package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.d.ts +2 -2
  10. package/dist/esm/hooks/renderModal.d.ts +1 -1
  11. package/dist/esm/hooks/renderUploadSidebar.d.ts +1 -1
  12. package/dist/esm/hooks/renderUploadSidebarPanel.d.ts +1 -1
  13. package/dist/esm/manifest.js +376 -303
  14. package/dist/esm/manifest.js.map +1 -1
  15. package/dist/esm/manifestTypes.d.ts +39 -91
  16. package/dist/types/ctx/base.d.ts +1 -1
  17. package/dist/types/ctx/commonExtras/field.d.ts +4 -0
  18. package/dist/types/ctx/commonExtras/itemForm.d.ts +14 -12
  19. package/dist/types/ctx/commonExtras/sizing.d.ts +1 -0
  20. package/dist/types/hooks/renderItemFormSidebar.d.ts +1 -1
  21. package/dist/types/hooks/renderItemFormSidebarPanel.d.ts +1 -1
  22. package/dist/types/hooks/renderManualFieldExtensionConfigScreen.d.ts +2 -2
  23. package/dist/types/hooks/renderModal.d.ts +1 -1
  24. package/dist/types/hooks/renderUploadSidebar.d.ts +1 -1
  25. package/dist/types/hooks/renderUploadSidebarPanel.d.ts +1 -1
  26. package/dist/types/manifestTypes.d.ts +39 -91
  27. package/manifest.json +376 -303
  28. package/package.json +2 -2
  29. package/src/ctx/base.ts +1 -1
  30. package/src/ctx/commonExtras/field.ts +4 -0
  31. package/src/ctx/commonExtras/itemForm.ts +15 -12
  32. package/src/ctx/commonExtras/sizing.ts +1 -0
  33. package/src/hooks/renderItemFormSidebar.ts +1 -1
  34. package/src/hooks/renderItemFormSidebarPanel.ts +1 -1
  35. package/src/hooks/renderManualFieldExtensionConfigScreen.ts +2 -2
  36. package/src/hooks/renderModal.ts +1 -1
  37. package/src/hooks/renderUploadSidebar.ts +1 -1
  38. package/src/hooks/renderUploadSidebarPanel.ts +1 -1
  39. package/src/manifest.ts +533 -401
  40. 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.1",
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": "8db42fb5778d563908adb0e06c334f49bb207cd4"
48
+ "gitHead": "b505f6681411e687cd6908661d73670ecaf8a584"
49
49
  }
package/src/ctx/base.ts CHANGED
@@ -60,7 +60,7 @@ type ProjectProperties = {
60
60
  /** The ID of the current environment */
61
61
  environment: string;
62
62
 
63
- /** The account that is the project owner */
63
+ /** The account/organization that is the project owner */
64
64
  owner: Account | Organization;
65
65
 
66
66
  /**
@@ -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
- /** Current number of blocks present in form state */
29
- blocksAnalysis: {
30
- usage: {
31
- /** Total number of blocks present in form state */
32
- total: number;
33
- /** Total number of blocks present in non-localized fields */
34
- nonLocalized: number;
35
- /** Total number of blocks present in localized fields, per locale */
36
- perLocale: Record<string, number>;
37
- };
38
- /** Maximum number of blocks per item */
39
- maximumPerItem: number;
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
  /**
@@ -1,3 +1,4 @@
1
+ /** A number of methods that you can use to control the size of the plugin frame */
1
2
  export type SizingUtilities = {
2
3
  /**
3
4
  * Listens for DOM changes and automatically calls `setHeight` when it detects
@@ -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` function)
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` function)
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` function)
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` function)
31
+ * implementing the `validateManualFieldExtensionParameters` hook)
32
32
  */
33
33
  errors: Record<string, unknown>;
34
34
 
@@ -4,7 +4,7 @@ import { containedRenderModeBootstrapper } from '../utils';
4
4
  export type RenderModalHook = {
5
5
  /**
6
6
  * This function will be called when the plugin requested to open a modal (see
7
- * the `openModal` function)
7
+ * the `openModal` hook)
8
8
  *
9
9
  * @tag modals
10
10
  */
@@ -7,7 +7,7 @@ type Upload = SchemaTypes.Upload;
7
7
  export type RenderUploadSidebarHook = {
8
8
  /**
9
9
  * This function will be called when the plugin needs to render a sidebar (see
10
- * the `uploadSidebars` function)
10
+ * the `uploadSidebars` hook)
11
11
  *
12
12
  * @tag sidebarPanels
13
13
  */
@@ -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` function)
10
+ * (see the `uploadSidebarPanels` hook)
11
11
  *
12
12
  * @tag sidebarPanels
13
13
  */