datocms-plugin-sdk 2.0.0 → 2.0.2

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 (114) hide show
  1. package/dist/cjs/hooks/renderItemCollectionOutlet.js.map +1 -1
  2. package/dist/cjs/manifest.js +2446 -2111
  3. package/dist/cjs/manifest.js.map +1 -1
  4. package/dist/esm/ctx/base.d.ts +43 -29
  5. package/dist/esm/ctx/commonExtras/field.d.ts +4 -0
  6. package/dist/esm/ctx/commonExtras/itemForm.d.ts +14 -12
  7. package/dist/esm/ctx/commonExtras/sizing.d.ts +1 -0
  8. package/dist/esm/hooks/assetSources.d.ts +2 -1
  9. package/dist/esm/hooks/buildItemPresentationInfo.d.ts +2 -1
  10. package/dist/esm/hooks/contentAreaSidebarItems.d.ts +2 -1
  11. package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +2 -2
  12. package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +2 -2
  13. package/dist/esm/hooks/executeFieldDropdownAction.d.ts +9 -1
  14. package/dist/esm/hooks/executeItemFormDropdownAction.d.ts +9 -1
  15. package/dist/esm/hooks/executeItemsDropdownAction.d.ts +11 -1
  16. package/dist/esm/hooks/executeUploadsDropdownAction.d.ts +11 -1
  17. package/dist/esm/hooks/fieldDropdownActions.d.ts +9 -0
  18. package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +2 -1
  19. package/dist/esm/hooks/itemCollectionOutlets.d.ts +8 -1
  20. package/dist/esm/hooks/itemFormDropdownActions.d.ts +9 -0
  21. package/dist/esm/hooks/itemFormOutlets.d.ts +3 -2
  22. package/dist/esm/hooks/itemFormSidebarPanels.d.ts +2 -1
  23. package/dist/esm/hooks/itemFormSidebars.d.ts +2 -1
  24. package/dist/esm/hooks/itemsDropdownActions.d.ts +12 -0
  25. package/dist/esm/hooks/mainNavigationTabs.d.ts +2 -1
  26. package/dist/esm/hooks/manualFieldExtensions.d.ts +2 -1
  27. package/dist/esm/hooks/onBeforeItemUpsert.d.ts +2 -1
  28. package/dist/esm/hooks/onBeforeItemsDestroy.d.ts +2 -1
  29. package/dist/esm/hooks/onBeforeItemsPublish.d.ts +2 -1
  30. package/dist/esm/hooks/onBeforeItemsUnpublish.d.ts +2 -1
  31. package/dist/esm/hooks/overrideFieldExtensions.d.ts +2 -2
  32. package/dist/esm/hooks/renderItemCollectionOutlet.d.ts +6 -0
  33. package/dist/esm/hooks/renderItemCollectionOutlet.js.map +1 -1
  34. package/dist/esm/hooks/renderItemFormOutlet.d.ts +3 -3
  35. package/dist/esm/hooks/settingsAreaSidebarItemGroups.d.ts +2 -1
  36. package/dist/esm/hooks/uploadSidebarPanels.d.ts +2 -1
  37. package/dist/esm/hooks/uploadSidebars.d.ts +2 -1
  38. package/dist/esm/hooks/uploadsDropdownActions.d.ts +15 -1
  39. package/dist/esm/manifest.js +2446 -2111
  40. package/dist/esm/manifest.js.map +1 -1
  41. package/dist/esm/manifestTypes.d.ts +117 -22
  42. package/dist/types/ctx/base.d.ts +43 -29
  43. package/dist/types/ctx/commonExtras/field.d.ts +4 -0
  44. package/dist/types/ctx/commonExtras/itemForm.d.ts +14 -12
  45. package/dist/types/ctx/commonExtras/sizing.d.ts +1 -0
  46. package/dist/types/hooks/assetSources.d.ts +2 -1
  47. package/dist/types/hooks/buildItemPresentationInfo.d.ts +2 -1
  48. package/dist/types/hooks/contentAreaSidebarItems.d.ts +2 -1
  49. package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +2 -2
  50. package/dist/types/hooks/customMarksForStructuredTextField.d.ts +2 -2
  51. package/dist/types/hooks/executeFieldDropdownAction.d.ts +9 -1
  52. package/dist/types/hooks/executeItemFormDropdownAction.d.ts +9 -1
  53. package/dist/types/hooks/executeItemsDropdownAction.d.ts +11 -1
  54. package/dist/types/hooks/executeUploadsDropdownAction.d.ts +11 -1
  55. package/dist/types/hooks/fieldDropdownActions.d.ts +9 -0
  56. package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +2 -1
  57. package/dist/types/hooks/itemCollectionOutlets.d.ts +8 -1
  58. package/dist/types/hooks/itemFormDropdownActions.d.ts +9 -0
  59. package/dist/types/hooks/itemFormOutlets.d.ts +3 -2
  60. package/dist/types/hooks/itemFormSidebarPanels.d.ts +2 -1
  61. package/dist/types/hooks/itemFormSidebars.d.ts +2 -1
  62. package/dist/types/hooks/itemsDropdownActions.d.ts +12 -0
  63. package/dist/types/hooks/mainNavigationTabs.d.ts +2 -1
  64. package/dist/types/hooks/manualFieldExtensions.d.ts +2 -1
  65. package/dist/types/hooks/onBeforeItemUpsert.d.ts +2 -1
  66. package/dist/types/hooks/onBeforeItemsDestroy.d.ts +2 -1
  67. package/dist/types/hooks/onBeforeItemsPublish.d.ts +2 -1
  68. package/dist/types/hooks/onBeforeItemsUnpublish.d.ts +2 -1
  69. package/dist/types/hooks/overrideFieldExtensions.d.ts +2 -2
  70. package/dist/types/hooks/renderItemCollectionOutlet.d.ts +6 -0
  71. package/dist/types/hooks/renderItemFormOutlet.d.ts +3 -3
  72. package/dist/types/hooks/settingsAreaSidebarItemGroups.d.ts +2 -1
  73. package/dist/types/hooks/uploadSidebarPanels.d.ts +2 -1
  74. package/dist/types/hooks/uploadSidebars.d.ts +2 -1
  75. package/dist/types/hooks/uploadsDropdownActions.d.ts +15 -1
  76. package/dist/types/manifestTypes.d.ts +117 -22
  77. package/manifest.json +2354 -2019
  78. package/package.json +4 -4
  79. package/src/ctx/base.ts +62 -30
  80. package/src/ctx/commonExtras/field.ts +4 -0
  81. package/src/ctx/commonExtras/itemForm.ts +15 -12
  82. package/src/ctx/commonExtras/sizing.ts +1 -0
  83. package/src/hooks/assetSources.ts +3 -1
  84. package/src/hooks/buildItemPresentationInfo.ts +3 -1
  85. package/src/hooks/contentAreaSidebarItems.ts +5 -1
  86. package/src/hooks/customBlockStylesForStructuredTextField.ts +2 -2
  87. package/src/hooks/customMarksForStructuredTextField.ts +2 -2
  88. package/src/hooks/executeFieldDropdownAction.ts +7 -0
  89. package/src/hooks/executeItemFormDropdownAction.ts +7 -0
  90. package/src/hooks/executeItemsDropdownAction.ts +8 -0
  91. package/src/hooks/executeUploadsDropdownAction.ts +9 -0
  92. package/src/hooks/fieldDropdownActions.ts +9 -0
  93. package/src/hooks/initialLocationQueryForItemSelector.ts +3 -1
  94. package/src/hooks/itemCollectionOutlets.ts +9 -1
  95. package/src/hooks/itemFormDropdownActions.ts +9 -0
  96. package/src/hooks/itemFormOutlets.ts +7 -2
  97. package/src/hooks/itemFormSidebarPanels.ts +3 -1
  98. package/src/hooks/itemFormSidebars.ts +6 -1
  99. package/src/hooks/itemsDropdownActions.ts +12 -0
  100. package/src/hooks/mainNavigationTabs.ts +3 -1
  101. package/src/hooks/manualFieldExtensions.ts +5 -1
  102. package/src/hooks/onBeforeItemUpsert.ts +3 -1
  103. package/src/hooks/onBeforeItemsDestroy.ts +6 -1
  104. package/src/hooks/onBeforeItemsPublish.ts +6 -1
  105. package/src/hooks/onBeforeItemsUnpublish.ts +6 -1
  106. package/src/hooks/overrideFieldExtensions.ts +2 -2
  107. package/src/hooks/renderItemCollectionOutlet.ts +6 -0
  108. package/src/hooks/renderItemFormOutlet.ts +3 -3
  109. package/src/hooks/settingsAreaSidebarItemGroups.ts +5 -1
  110. package/src/hooks/uploadSidebarPanels.ts +3 -1
  111. package/src/hooks/uploadSidebars.ts +3 -1
  112. package/src/hooks/uploadsDropdownActions.ts +15 -1
  113. package/src/manifest.ts +2562 -2151
  114. package/src/manifestTypes.ts +125 -28
@@ -9,8 +9,9 @@ export type ItemFormSidebarPanelsHook = {
9
9
  *
10
10
  * @tag sidebarPanels
11
11
  */
12
- itemFormSidebarPanels: (itemType: ItemType, ctx: Ctx) => ItemFormSidebarPanel[];
12
+ itemFormSidebarPanels: (itemType: ItemType, ctx: ItemFormSidebarPanelsCtx) => ItemFormSidebarPanel[];
13
13
  };
14
+ export type ItemFormSidebarPanelsCtx = Ctx;
14
15
  export type ItemFormSidebarPanel = {
15
16
  /**
16
17
  * ID of the panel. Will be the first argument for the
@@ -8,8 +8,9 @@ export type ItemFormSidebarsHook = {
8
8
  *
9
9
  * @tag sidebarPanels
10
10
  */
11
- itemFormSidebars: (itemType: ItemType, ctx: Ctx) => ItemFormSidebar[];
11
+ itemFormSidebars: (itemType: ItemType, ctx: ItemFormSidebarsCtx) => ItemFormSidebar[];
12
12
  };
13
+ export type ItemFormSidebarsCtx = Ctx;
13
14
  export type ItemFormSidebar = {
14
15
  /**
15
16
  * ID of the sidebar. Will be the first argument for the
@@ -3,6 +3,18 @@ import { Ctx } from '../ctx/base';
3
3
  import { DropdownAction, DropdownActionGroup } from '../shared';
4
4
  type ItemType = SchemaTypes.ItemType;
5
5
  export type ItemsDropdownActionsHook = {
6
+ /**
7
+ * This function lets you set up custom actions (or groups of actions) that
8
+ * show up when the user:
9
+ *
10
+ * * selects multiple records in the collection view for batch operations, or
11
+ * * starts editing a specific record.
12
+ *
13
+ * The `executeItemsDropdownAction()` hook will be triggered once the user
14
+ * clicks on one of the defined actions.
15
+ *
16
+ * @tag dropdownActions
17
+ */
6
18
  itemsDropdownActions: (itemType: ItemType, ctx: ItemDropdownActionsCtx) => Array<DropdownAction | DropdownActionGroup>;
7
19
  };
8
20
  export type ItemDropdownActionsCtx = Ctx<{
@@ -7,8 +7,9 @@ export type MainNavigationTabsHook = {
7
7
  *
8
8
  * @tag pages
9
9
  */
10
- mainNavigationTabs: (ctx: Ctx) => MainNavigationTab[];
10
+ mainNavigationTabs: (ctx: MainNavigationTabsCtx) => MainNavigationTab[];
11
11
  };
12
+ export type MainNavigationTabsCtx = Ctx;
12
13
  /** A tab to be displayed in the top-bar of the UI */
13
14
  export type MainNavigationTab = {
14
15
  /** Label to be shown. Must be unique. */
@@ -6,8 +6,9 @@ export type ManualFieldExtensionsHook = {
6
6
  *
7
7
  * @tag manualFieldExtensions
8
8
  */
9
- manualFieldExtensions: (ctx: Ctx) => ManualFieldExtension[];
9
+ manualFieldExtensions: (ctx: ManualFieldExtensionsCtx) => ManualFieldExtension[];
10
10
  };
11
+ export type ManualFieldExtensionsCtx = Ctx;
11
12
  export type ManualFieldExtension = {
12
13
  /**
13
14
  * ID of field extension. Will be the first argument for the
@@ -10,6 +10,7 @@ export type OnBeforeItemUpsertHook = {
10
10
  *
11
11
  * @tag beforeHooks
12
12
  */
13
- onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: Ctx) => MaybePromise<boolean>;
13
+ onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: OnBeforeItemUpsertCtx) => MaybePromise<boolean>;
14
14
  };
15
+ export type OnBeforeItemUpsertCtx = Ctx;
15
16
  export {};
@@ -9,6 +9,7 @@ export type OnBeforeItemsDestroyHook = {
9
9
  *
10
10
  * @tag beforeHooks
11
11
  */
12
- onBeforeItemsDestroy: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
12
+ onBeforeItemsDestroy: (items: Item[], ctx: OnBeforeItemsDestroyCtx) => MaybePromise<boolean>;
13
13
  };
14
+ export type OnBeforeItemsDestroyCtx = Ctx;
14
15
  export {};
@@ -9,6 +9,7 @@ export type OnBeforeItemsPublishHook = {
9
9
  *
10
10
  * @tag beforeHooks
11
11
  */
12
- onBeforeItemsPublish: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
12
+ onBeforeItemsPublish: (items: Item[], ctx: OnBeforeItemsPublishCtx) => MaybePromise<boolean>;
13
13
  };
14
+ export type OnBeforeItemsPublishCtx = Ctx;
14
15
  export {};
@@ -9,6 +9,7 @@ export type OnBeforeItemsUnpublishHook = {
9
9
  *
10
10
  * @tag beforeHooks
11
11
  */
12
- onBeforeItemsUnpublish: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
12
+ onBeforeItemsUnpublish: (items: Item[], ctx: OnBeforeItemsUnpublishCtx) => MaybePromise<boolean>;
13
13
  };
14
+ export type OnBeforeItemsUnpublishCtx = Ctx;
14
15
  export {};
@@ -10,9 +10,9 @@ export type OverrideFieldExtensionsHook = {
10
10
  *
11
11
  * @tag forcedFieldExtensions
12
12
  */
13
- overrideFieldExtensions: (field: Field, ctx: OverrideFieldExtensionsHookCtx) => FieldExtensionOverride | undefined;
13
+ overrideFieldExtensions: (field: Field, ctx: OverrideFieldExtensionsCtx) => FieldExtensionOverride | undefined;
14
14
  };
15
- export type OverrideFieldExtensionsHookCtx = Ctx<{
15
+ export type OverrideFieldExtensionsCtx = Ctx<{
16
16
  itemType: ItemType;
17
17
  }>;
18
18
  /**
@@ -1,5 +1,11 @@
1
1
  import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
2
2
  export type RenderItemCollectionOutletHook = {
3
+ /**
4
+ * This function will be called when the plugin needs to render an outlet
5
+ * defined by the `itemFormOutlets()` hook.
6
+ *
7
+ * @tag outlets
8
+ */
3
9
  renderItemCollectionOutlet: (itemCollectionOutletId: string, ctx: RenderItemCollectionOutletCtx) => void;
4
10
  };
5
11
  export type RenderItemCollectionOutletCtx = SelfResizingPluginFrameCtx<'renderItemCollectionOutlet', {
@@ -1 +1 @@
1
- {"version":3,"file":"renderItemCollectionOutlet.js","sourceRoot":"","sources":["../../../src/hooks/renderItemCollectionOutlet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAiB3D,MAAM,CAAC,IAAM,sCAAsC,GACjD,+BAA+B,CAC7B,4BAA4B,EAC5B,UAAC,aAAa,EAAE,GAAG;IACjB,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,aAAa,CAAC,0BAA0B,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAC5E,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"renderItemCollectionOutlet.js","sourceRoot":"","sources":["../../../src/hooks/renderItemCollectionOutlet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAuB3D,MAAM,CAAC,IAAM,sCAAsC,GACjD,+BAA+B,CAC7B,4BAA4B,EAC5B,UAAC,aAAa,EAAE,GAAG;IACjB,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,aAAa,CAAC,0BAA0B,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAC5E,CAAC,CACF,CAAC"}
@@ -2,10 +2,10 @@ import { ItemFormAdditionalMethods, ItemFormAdditionalProperties } from '../ctx/
2
2
  import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
3
3
  export type RenderItemFormOutletHook = {
4
4
  /**
5
- * This function will be called when the plugin needs to render an outlet (see
6
- * the `itemFormOutlets` function)
5
+ * This function will be called when the plugin needs to render an outlet
6
+ * defined by the `itemFormOutlets()` hook.
7
7
  *
8
- * @tag itemFormOutlets
8
+ * @tag outlets
9
9
  */
10
10
  renderItemFormOutlet: (itemFormOutletId: string, ctx: RenderItemFormOutletCtx) => void;
11
11
  };
@@ -7,8 +7,9 @@ export type SettingsAreaSidebarItemGroupsHook = {
7
7
  *
8
8
  * @tag pages
9
9
  */
10
- settingsAreaSidebarItemGroups: (ctx: Ctx) => SettingsAreaSidebarItemGroup[];
10
+ settingsAreaSidebarItemGroups: (ctx: SettingsAreaSidebarItemGroupsCtx) => SettingsAreaSidebarItemGroup[];
11
11
  };
12
+ export type SettingsAreaSidebarItemGroupsCtx = Ctx;
12
13
  /**
13
14
  * The sidebar in the Settings Area presents a number of pages grouped by topic.
14
15
  * This object represents a new group to be added in the sideebar to the
@@ -6,8 +6,9 @@ export type UploadSidebarPanelsHook = {
6
6
  *
7
7
  * @tag sidebarPanels
8
8
  */
9
- uploadSidebarPanels: (ctx: Ctx) => UploadSidebarPanel[];
9
+ uploadSidebarPanels: (ctx: UploadSidebarPanelsCtx) => UploadSidebarPanel[];
10
10
  };
11
+ export type UploadSidebarPanelsCtx = Ctx;
11
12
  export type UploadSidebarPanel = {
12
13
  /**
13
14
  * ID of the panel. Will be the first argument for the
@@ -6,8 +6,9 @@ export type UploadSidebarsHook = {
6
6
  *
7
7
  * @tag sidebarPanels
8
8
  */
9
- uploadSidebars: (ctx: Ctx) => UploadSidebar[];
9
+ uploadSidebars: (ctx: UploadSidebarsCtx) => UploadSidebar[];
10
10
  };
11
+ export type UploadSidebarsCtx = Ctx;
11
12
  export type UploadSidebar = {
12
13
  /**
13
14
  * ID of the sidebar. Will be the first argument for the
@@ -1,5 +1,19 @@
1
1
  import { Ctx } from '../ctx/base';
2
2
  import { DropdownAction, DropdownActionGroup } from '../shared';
3
3
  export type UploadsDropdownActionsHook = {
4
- uploadsDropdownActions: (ctx: Ctx) => Array<DropdownAction | DropdownActionGroup>;
4
+ /**
5
+ * This function lets you set up custom actions (or groups of actions) that
6
+ * show up when the user:
7
+ *
8
+ * * selects multiple assets in the Media Area for batch operations, or
9
+ * * opens up a specific asset from the Media Area.
10
+ *
11
+ * The `executeUploadsDropdownAction()` hook will be triggered once the user
12
+ * clicks on one of the defined actions.
13
+ *
14
+ * @tag dropdownActions
15
+ */
16
+ uploadsDropdownActions: (ctx: UploadsDropdownActionsCtx) => Array<DropdownAction | DropdownActionGroup>;
5
17
  };
18
+ type UploadsDropdownActionsCtx = Ctx;
19
+ export {};