datocms-plugin-sdk 1.1.0 → 2.0.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.
Files changed (394) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/connect.js +75 -208
  3. package/dist/cjs/connect.js.map +1 -1
  4. package/dist/cjs/{types.js → ctx/base.js} +1 -1
  5. package/dist/cjs/ctx/base.js.map +1 -0
  6. package/dist/cjs/ctx/commonExtras/field.js +3 -0
  7. package/dist/cjs/ctx/commonExtras/field.js.map +1 -0
  8. package/dist/cjs/ctx/commonExtras/itemForm.js +3 -0
  9. package/dist/cjs/ctx/commonExtras/itemForm.js.map +1 -0
  10. package/dist/cjs/ctx/commonExtras/sizing.js +3 -0
  11. package/dist/cjs/ctx/commonExtras/sizing.js.map +1 -0
  12. package/dist/cjs/ctx/pluginFrame.js +3 -0
  13. package/dist/cjs/ctx/pluginFrame.js.map +1 -0
  14. package/dist/cjs/hooks/assetSources.js +3 -0
  15. package/dist/cjs/hooks/assetSources.js.map +1 -0
  16. package/dist/cjs/hooks/buildItemPresentationInfo.js +3 -0
  17. package/dist/cjs/hooks/buildItemPresentationInfo.js.map +1 -0
  18. package/dist/cjs/hooks/contentAreaSidebarItems.js +3 -0
  19. package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -0
  20. package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js +3 -0
  21. package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
  22. package/dist/cjs/hooks/customMarksForStructuredTextField.js +3 -0
  23. package/dist/cjs/hooks/customMarksForStructuredTextField.js.map +1 -0
  24. package/dist/cjs/hooks/executeFieldDropdownAction.js +3 -0
  25. package/dist/cjs/hooks/executeFieldDropdownAction.js.map +1 -0
  26. package/dist/cjs/hooks/executeItemFormDropdownAction.js +3 -0
  27. package/dist/cjs/hooks/executeItemFormDropdownAction.js.map +1 -0
  28. package/dist/cjs/hooks/executeItemsDropdownAction.js +3 -0
  29. package/dist/cjs/hooks/executeItemsDropdownAction.js.map +1 -0
  30. package/dist/cjs/hooks/executeUploadsDropdownAction.js +3 -0
  31. package/dist/cjs/hooks/executeUploadsDropdownAction.js.map +1 -0
  32. package/dist/cjs/hooks/fieldDropdownActions.js +3 -0
  33. package/dist/cjs/hooks/fieldDropdownActions.js.map +1 -0
  34. package/dist/cjs/hooks/initialLocationQueryForItemSelector.js +3 -0
  35. package/dist/cjs/hooks/initialLocationQueryForItemSelector.js.map +1 -0
  36. package/dist/cjs/hooks/itemCollectionOutlets.js +3 -0
  37. package/dist/cjs/hooks/itemCollectionOutlets.js.map +1 -0
  38. package/dist/cjs/hooks/itemFormDropdownActions.js +3 -0
  39. package/dist/cjs/hooks/itemFormDropdownActions.js.map +1 -0
  40. package/dist/cjs/hooks/itemFormOutlets.js +3 -0
  41. package/dist/cjs/hooks/itemFormOutlets.js.map +1 -0
  42. package/dist/cjs/hooks/itemFormSidebarPanels.js +3 -0
  43. package/dist/cjs/hooks/itemFormSidebarPanels.js.map +1 -0
  44. package/dist/cjs/hooks/itemFormSidebars.js +3 -0
  45. package/dist/cjs/hooks/itemFormSidebars.js.map +1 -0
  46. package/dist/cjs/hooks/itemsDropdownActions.js +3 -0
  47. package/dist/cjs/hooks/itemsDropdownActions.js.map +1 -0
  48. package/dist/cjs/hooks/mainNavigationTabs.js +3 -0
  49. package/dist/cjs/hooks/mainNavigationTabs.js.map +1 -0
  50. package/dist/cjs/hooks/manualFieldExtensions.js +3 -0
  51. package/dist/cjs/hooks/manualFieldExtensions.js.map +1 -0
  52. package/dist/cjs/hooks/onBeforeItemUpsert.js +3 -0
  53. package/dist/cjs/hooks/onBeforeItemUpsert.js.map +1 -0
  54. package/dist/cjs/hooks/onBeforeItemsDestroy.js +3 -0
  55. package/dist/cjs/hooks/onBeforeItemsDestroy.js.map +1 -0
  56. package/dist/cjs/hooks/onBeforeItemsPublish.js +3 -0
  57. package/dist/cjs/hooks/onBeforeItemsPublish.js.map +1 -0
  58. package/dist/cjs/hooks/onBeforeItemsUnpublish.js +3 -0
  59. package/dist/cjs/hooks/onBeforeItemsUnpublish.js.map +1 -0
  60. package/dist/cjs/hooks/onBoot.js +3 -0
  61. package/dist/cjs/hooks/onBoot.js.map +1 -0
  62. package/dist/cjs/hooks/overrideFieldExtensions.js +3 -0
  63. package/dist/cjs/hooks/overrideFieldExtensions.js.map +1 -0
  64. package/dist/cjs/hooks/renderAssetSource.js +11 -0
  65. package/dist/cjs/hooks/renderAssetSource.js.map +1 -0
  66. package/dist/cjs/hooks/renderConfigScreen.js +11 -0
  67. package/dist/cjs/hooks/renderConfigScreen.js.map +1 -0
  68. package/dist/cjs/hooks/renderFieldExtension.js +11 -0
  69. package/dist/cjs/hooks/renderFieldExtension.js.map +1 -0
  70. package/dist/cjs/hooks/renderItemCollectionOutlet.js +11 -0
  71. package/dist/cjs/hooks/renderItemCollectionOutlet.js.map +1 -0
  72. package/dist/cjs/hooks/renderItemFormOutlet.js +11 -0
  73. package/dist/cjs/hooks/renderItemFormOutlet.js.map +1 -0
  74. package/dist/cjs/hooks/renderItemFormSidebar.js +11 -0
  75. package/dist/cjs/hooks/renderItemFormSidebar.js.map +1 -0
  76. package/dist/cjs/hooks/renderItemFormSidebarPanel.js +11 -0
  77. package/dist/cjs/hooks/renderItemFormSidebarPanel.js.map +1 -0
  78. package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js +11 -0
  79. package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
  80. package/dist/cjs/hooks/renderModal.js +11 -0
  81. package/dist/cjs/hooks/renderModal.js.map +1 -0
  82. package/dist/cjs/hooks/renderPage.js +11 -0
  83. package/dist/cjs/hooks/renderPage.js.map +1 -0
  84. package/dist/cjs/hooks/renderUploadSidebar.js +11 -0
  85. package/dist/cjs/hooks/renderUploadSidebar.js.map +1 -0
  86. package/dist/cjs/hooks/renderUploadSidebarPanel.js +11 -0
  87. package/dist/cjs/hooks/renderUploadSidebarPanel.js.map +1 -0
  88. package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js +3 -0
  89. package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
  90. package/dist/cjs/hooks/uploadSidebarPanels.js +3 -0
  91. package/dist/cjs/hooks/uploadSidebarPanels.js.map +1 -0
  92. package/dist/cjs/hooks/uploadSidebars.js +3 -0
  93. package/dist/cjs/hooks/uploadSidebars.js.map +1 -0
  94. package/dist/cjs/hooks/uploadsDropdownActions.js +3 -0
  95. package/dist/cjs/hooks/uploadsDropdownActions.js.map +1 -0
  96. package/dist/cjs/hooks/validateManualFieldExtensionParameters.js +3 -0
  97. package/dist/cjs/hooks/validateManualFieldExtensionParameters.js.map +1 -0
  98. package/dist/cjs/icon.js +3 -0
  99. package/dist/cjs/icon.js.map +1 -0
  100. package/dist/cjs/index.js +46 -1
  101. package/dist/cjs/index.js.map +1 -1
  102. package/dist/cjs/manifest.js +2909 -0
  103. package/dist/cjs/manifest.js.map +1 -0
  104. package/dist/cjs/manifestTypes.js +3 -0
  105. package/dist/cjs/manifestTypes.js.map +1 -0
  106. package/dist/cjs/shared.js +3 -0
  107. package/dist/cjs/shared.js.map +1 -0
  108. package/dist/cjs/utils.js +136 -0
  109. package/dist/cjs/utils.js.map +1 -0
  110. package/dist/esm/connect.d.ts +44 -242
  111. package/dist/esm/connect.js +74 -206
  112. package/dist/esm/connect.js.map +1 -1
  113. package/dist/esm/ctx/base.d.ts +670 -0
  114. package/dist/esm/ctx/base.js +2 -0
  115. package/dist/esm/ctx/base.js.map +1 -0
  116. package/dist/esm/ctx/commonExtras/field.d.ts +29 -0
  117. package/dist/esm/ctx/commonExtras/field.js +2 -0
  118. package/dist/esm/ctx/commonExtras/field.js.map +1 -0
  119. package/dist/esm/ctx/commonExtras/itemForm.d.ts +148 -0
  120. package/dist/esm/ctx/commonExtras/itemForm.js +2 -0
  121. package/dist/esm/ctx/commonExtras/itemForm.js.map +1 -0
  122. package/dist/esm/ctx/commonExtras/sizing.d.ts +23 -0
  123. package/dist/esm/ctx/commonExtras/sizing.js +2 -0
  124. package/dist/esm/ctx/commonExtras/sizing.js.map +1 -0
  125. package/dist/esm/ctx/pluginFrame.d.ts +12 -0
  126. package/dist/esm/ctx/pluginFrame.js +2 -0
  127. package/dist/esm/ctx/pluginFrame.js.map +1 -0
  128. package/dist/esm/hooks/assetSources.d.ts +41 -0
  129. package/dist/esm/hooks/assetSources.js +2 -0
  130. package/dist/esm/hooks/assetSources.js.map +1 -0
  131. package/dist/esm/hooks/buildItemPresentationInfo.d.ts +28 -0
  132. package/dist/esm/hooks/buildItemPresentationInfo.js +2 -0
  133. package/dist/esm/hooks/buildItemPresentationInfo.js.map +1 -0
  134. package/dist/esm/hooks/contentAreaSidebarItems.d.ts +39 -0
  135. package/dist/esm/hooks/contentAreaSidebarItems.js +2 -0
  136. package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -0
  137. package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
  138. package/dist/esm/hooks/customBlockStylesForStructuredTextField.js +2 -0
  139. package/dist/esm/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
  140. package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +57 -0
  141. package/dist/esm/hooks/customMarksForStructuredTextField.js +2 -0
  142. package/dist/esm/hooks/customMarksForStructuredTextField.js.map +1 -0
  143. package/dist/esm/hooks/executeFieldDropdownAction.d.ts +9 -0
  144. package/dist/esm/hooks/executeFieldDropdownAction.js +2 -0
  145. package/dist/esm/hooks/executeFieldDropdownAction.js.map +1 -0
  146. package/dist/esm/hooks/executeItemFormDropdownAction.d.ts +8 -0
  147. package/dist/esm/hooks/executeItemFormDropdownAction.js +2 -0
  148. package/dist/esm/hooks/executeItemFormDropdownAction.js.map +1 -0
  149. package/dist/esm/hooks/executeItemsDropdownAction.d.ts +10 -0
  150. package/dist/esm/hooks/executeItemsDropdownAction.js +2 -0
  151. package/dist/esm/hooks/executeItemsDropdownAction.js.map +1 -0
  152. package/dist/esm/hooks/executeUploadsDropdownAction.d.ts +10 -0
  153. package/dist/esm/hooks/executeUploadsDropdownAction.js +2 -0
  154. package/dist/esm/hooks/executeUploadsDropdownAction.js.map +1 -0
  155. package/dist/esm/hooks/fieldDropdownActions.d.ts +11 -0
  156. package/dist/esm/hooks/fieldDropdownActions.js +2 -0
  157. package/dist/esm/hooks/fieldDropdownActions.js.map +1 -0
  158. package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
  159. package/dist/esm/hooks/initialLocationQueryForItemSelector.js +2 -0
  160. package/dist/esm/hooks/initialLocationQueryForItemSelector.js.map +1 -0
  161. package/dist/esm/hooks/itemCollectionOutlets.d.ts +24 -0
  162. package/dist/esm/hooks/itemCollectionOutlets.js +2 -0
  163. package/dist/esm/hooks/itemCollectionOutlets.js.map +1 -0
  164. package/dist/esm/hooks/itemFormDropdownActions.d.ts +11 -0
  165. package/dist/esm/hooks/itemFormDropdownActions.js +2 -0
  166. package/dist/esm/hooks/itemFormDropdownActions.js.map +1 -0
  167. package/dist/esm/hooks/itemFormOutlets.d.ts +29 -0
  168. package/dist/esm/hooks/itemFormOutlets.js +2 -0
  169. package/dist/esm/hooks/itemFormOutlets.js.map +1 -0
  170. package/dist/esm/hooks/itemFormSidebarPanels.d.ts +47 -0
  171. package/dist/esm/hooks/itemFormSidebarPanels.js +2 -0
  172. package/dist/esm/hooks/itemFormSidebarPanels.js.map +1 -0
  173. package/dist/esm/hooks/itemFormSidebars.d.ts +37 -0
  174. package/dist/esm/hooks/itemFormSidebars.js +2 -0
  175. package/dist/esm/hooks/itemFormSidebars.js.map +1 -0
  176. package/dist/esm/hooks/itemsDropdownActions.d.ts +11 -0
  177. package/dist/esm/hooks/itemsDropdownActions.js +2 -0
  178. package/dist/esm/hooks/itemsDropdownActions.js.map +1 -0
  179. package/dist/esm/hooks/mainNavigationTabs.d.ts +43 -0
  180. package/dist/esm/hooks/mainNavigationTabs.js +2 -0
  181. package/dist/esm/hooks/mainNavigationTabs.js.map +1 -0
  182. package/dist/esm/hooks/manualFieldExtensions.d.ts +58 -0
  183. package/dist/esm/hooks/manualFieldExtensions.js +2 -0
  184. package/dist/esm/hooks/manualFieldExtensions.js.map +1 -0
  185. package/dist/esm/hooks/onBeforeItemUpsert.d.ts +15 -0
  186. package/dist/esm/hooks/onBeforeItemUpsert.js +2 -0
  187. package/dist/esm/hooks/onBeforeItemUpsert.js.map +1 -0
  188. package/dist/esm/hooks/onBeforeItemsDestroy.d.ts +14 -0
  189. package/dist/esm/hooks/onBeforeItemsDestroy.js +2 -0
  190. package/dist/esm/hooks/onBeforeItemsDestroy.js.map +1 -0
  191. package/dist/esm/hooks/onBeforeItemsPublish.d.ts +14 -0
  192. package/dist/esm/hooks/onBeforeItemsPublish.js +2 -0
  193. package/dist/esm/hooks/onBeforeItemsPublish.js.map +1 -0
  194. package/dist/esm/hooks/onBeforeItemsUnpublish.d.ts +14 -0
  195. package/dist/esm/hooks/onBeforeItemsUnpublish.js +2 -0
  196. package/dist/esm/hooks/onBeforeItemsUnpublish.js.map +1 -0
  197. package/dist/esm/hooks/onBoot.d.ts +11 -0
  198. package/dist/esm/hooks/onBoot.js +2 -0
  199. package/dist/esm/hooks/onBoot.js.map +1 -0
  200. package/dist/esm/hooks/overrideFieldExtensions.d.ts +88 -0
  201. package/dist/esm/hooks/overrideFieldExtensions.js +2 -0
  202. package/dist/esm/hooks/overrideFieldExtensions.js.map +1 -0
  203. package/dist/esm/hooks/renderAssetSource.d.ts +98 -0
  204. package/dist/esm/hooks/renderAssetSource.js +8 -0
  205. package/dist/esm/hooks/renderAssetSource.js.map +1 -0
  206. package/dist/esm/hooks/renderConfigScreen.d.ts +12 -0
  207. package/dist/esm/hooks/renderConfigScreen.js +8 -0
  208. package/dist/esm/hooks/renderConfigScreen.js.map +1 -0
  209. package/dist/esm/hooks/renderFieldExtension.d.ts +20 -0
  210. package/dist/esm/hooks/renderFieldExtension.js +8 -0
  211. package/dist/esm/hooks/renderFieldExtension.js.map +1 -0
  212. package/dist/esm/hooks/renderItemCollectionOutlet.d.ts +9 -0
  213. package/dist/esm/hooks/renderItemCollectionOutlet.js +8 -0
  214. package/dist/esm/hooks/renderItemCollectionOutlet.js.map +1 -0
  215. package/dist/esm/hooks/renderItemFormOutlet.d.ts +16 -0
  216. package/dist/esm/hooks/renderItemFormOutlet.js +8 -0
  217. package/dist/esm/hooks/renderItemFormOutlet.js.map +1 -0
  218. package/dist/esm/hooks/renderItemFormSidebar.d.ts +21 -0
  219. package/dist/esm/hooks/renderItemFormSidebar.js +8 -0
  220. package/dist/esm/hooks/renderItemFormSidebar.js.map +1 -0
  221. package/dist/esm/hooks/renderItemFormSidebarPanel.d.ts +21 -0
  222. package/dist/esm/hooks/renderItemFormSidebarPanel.js +8 -0
  223. package/dist/esm/hooks/renderItemFormSidebarPanel.js.map +1 -0
  224. package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
  225. package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js +8 -0
  226. package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
  227. package/dist/esm/hooks/renderModal.d.ts +37 -0
  228. package/dist/esm/hooks/renderModal.js +8 -0
  229. package/dist/esm/hooks/renderModal.js.map +1 -0
  230. package/dist/esm/hooks/renderPage.d.ts +16 -0
  231. package/dist/esm/hooks/renderPage.js +8 -0
  232. package/dist/esm/hooks/renderPage.js.map +1 -0
  233. package/dist/esm/hooks/renderUploadSidebar.d.ts +25 -0
  234. package/dist/esm/hooks/renderUploadSidebar.js +8 -0
  235. package/dist/esm/hooks/renderUploadSidebar.js.map +1 -0
  236. package/dist/esm/hooks/renderUploadSidebarPanel.d.ts +25 -0
  237. package/dist/esm/hooks/renderUploadSidebarPanel.js +8 -0
  238. package/dist/esm/hooks/renderUploadSidebarPanel.js.map +1 -0
  239. package/dist/esm/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
  240. package/dist/esm/hooks/settingsAreaSidebarItemGroups.js +2 -0
  241. package/dist/esm/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
  242. package/dist/esm/hooks/uploadSidebarPanels.d.ts +47 -0
  243. package/dist/esm/hooks/uploadSidebarPanels.js +2 -0
  244. package/dist/esm/hooks/uploadSidebarPanels.js.map +1 -0
  245. package/dist/esm/hooks/uploadSidebars.d.ts +34 -0
  246. package/dist/esm/hooks/uploadSidebars.js +2 -0
  247. package/dist/esm/hooks/uploadSidebars.js.map +1 -0
  248. package/dist/esm/hooks/uploadsDropdownActions.d.ts +5 -0
  249. package/dist/esm/hooks/uploadsDropdownActions.js +2 -0
  250. package/dist/esm/hooks/uploadsDropdownActions.js.map +1 -0
  251. package/dist/esm/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
  252. package/dist/esm/hooks/validateManualFieldExtensionParameters.js +2 -0
  253. package/dist/esm/hooks/validateManualFieldExtensionParameters.js.map +1 -0
  254. package/dist/esm/icon.d.ts +6 -0
  255. package/dist/esm/icon.js +2 -0
  256. package/dist/esm/icon.js.map +1 -0
  257. package/dist/esm/index.d.ts +57 -12
  258. package/dist/esm/index.js +46 -1
  259. package/dist/esm/index.js.map +1 -1
  260. package/dist/esm/manifest.d.ts +2 -0
  261. package/dist/esm/manifest.js +2906 -0
  262. package/dist/esm/manifest.js.map +1 -0
  263. package/dist/esm/manifestTypes.d.ts +51 -0
  264. package/dist/esm/manifestTypes.js +2 -0
  265. package/dist/esm/manifestTypes.js.map +1 -0
  266. package/dist/esm/shared.d.ts +56 -0
  267. package/dist/esm/shared.js +2 -0
  268. package/dist/esm/shared.js.map +1 -0
  269. package/dist/esm/utils.d.ts +31 -0
  270. package/dist/esm/utils.js +129 -0
  271. package/dist/esm/utils.js.map +1 -0
  272. package/dist/types/connect.d.ts +44 -242
  273. package/dist/types/ctx/base.d.ts +670 -0
  274. package/dist/types/ctx/commonExtras/field.d.ts +29 -0
  275. package/dist/types/ctx/commonExtras/itemForm.d.ts +148 -0
  276. package/dist/types/ctx/commonExtras/sizing.d.ts +23 -0
  277. package/dist/types/ctx/pluginFrame.d.ts +12 -0
  278. package/dist/types/hooks/assetSources.d.ts +41 -0
  279. package/dist/types/hooks/buildItemPresentationInfo.d.ts +28 -0
  280. package/dist/types/hooks/contentAreaSidebarItems.d.ts +39 -0
  281. package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
  282. package/dist/types/hooks/customMarksForStructuredTextField.d.ts +57 -0
  283. package/dist/types/hooks/executeFieldDropdownAction.d.ts +9 -0
  284. package/dist/types/hooks/executeItemFormDropdownAction.d.ts +8 -0
  285. package/dist/types/hooks/executeItemsDropdownAction.d.ts +10 -0
  286. package/dist/types/hooks/executeUploadsDropdownAction.d.ts +10 -0
  287. package/dist/types/hooks/fieldDropdownActions.d.ts +11 -0
  288. package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
  289. package/dist/types/hooks/itemCollectionOutlets.d.ts +24 -0
  290. package/dist/types/hooks/itemFormDropdownActions.d.ts +11 -0
  291. package/dist/types/hooks/itemFormOutlets.d.ts +29 -0
  292. package/dist/types/hooks/itemFormSidebarPanels.d.ts +47 -0
  293. package/dist/types/hooks/itemFormSidebars.d.ts +37 -0
  294. package/dist/types/hooks/itemsDropdownActions.d.ts +11 -0
  295. package/dist/types/hooks/mainNavigationTabs.d.ts +43 -0
  296. package/dist/types/hooks/manualFieldExtensions.d.ts +58 -0
  297. package/dist/types/hooks/onBeforeItemUpsert.d.ts +15 -0
  298. package/dist/types/hooks/onBeforeItemsDestroy.d.ts +14 -0
  299. package/dist/types/hooks/onBeforeItemsPublish.d.ts +14 -0
  300. package/dist/types/hooks/onBeforeItemsUnpublish.d.ts +14 -0
  301. package/dist/types/hooks/onBoot.d.ts +11 -0
  302. package/dist/types/hooks/overrideFieldExtensions.d.ts +88 -0
  303. package/dist/types/hooks/renderAssetSource.d.ts +98 -0
  304. package/dist/types/hooks/renderConfigScreen.d.ts +12 -0
  305. package/dist/types/hooks/renderFieldExtension.d.ts +20 -0
  306. package/dist/types/hooks/renderItemCollectionOutlet.d.ts +9 -0
  307. package/dist/types/hooks/renderItemFormOutlet.d.ts +16 -0
  308. package/dist/types/hooks/renderItemFormSidebar.d.ts +21 -0
  309. package/dist/types/hooks/renderItemFormSidebarPanel.d.ts +21 -0
  310. package/dist/types/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
  311. package/dist/types/hooks/renderModal.d.ts +37 -0
  312. package/dist/types/hooks/renderPage.d.ts +16 -0
  313. package/dist/types/hooks/renderUploadSidebar.d.ts +25 -0
  314. package/dist/types/hooks/renderUploadSidebarPanel.d.ts +25 -0
  315. package/dist/types/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
  316. package/dist/types/hooks/uploadSidebarPanels.d.ts +47 -0
  317. package/dist/types/hooks/uploadSidebars.d.ts +34 -0
  318. package/dist/types/hooks/uploadsDropdownActions.d.ts +5 -0
  319. package/dist/types/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
  320. package/dist/types/icon.d.ts +6 -0
  321. package/dist/types/index.d.ts +57 -12
  322. package/dist/types/manifest.d.ts +2 -0
  323. package/dist/types/manifestTypes.d.ts +51 -0
  324. package/dist/types/shared.d.ts +56 -0
  325. package/dist/types/utils.d.ts +31 -0
  326. package/manifest.json +2905 -0
  327. package/package.json +7 -6
  328. package/src/connect.ts +207 -698
  329. package/src/ctx/base.ts +714 -0
  330. package/src/ctx/commonExtras/field.ts +27 -0
  331. package/src/ctx/commonExtras/itemForm.ts +155 -0
  332. package/src/ctx/commonExtras/sizing.ts +27 -0
  333. package/src/ctx/pluginFrame.ts +39 -0
  334. package/src/hooks/assetSources.ts +43 -0
  335. package/src/hooks/buildItemPresentationInfo.ts +33 -0
  336. package/src/hooks/contentAreaSidebarItems.ts +41 -0
  337. package/src/hooks/customBlockStylesForStructuredTextField.ts +42 -0
  338. package/src/hooks/customMarksForStructuredTextField.ts +64 -0
  339. package/src/hooks/executeFieldDropdownAction.ts +21 -0
  340. package/src/hooks/executeItemFormDropdownAction.ts +19 -0
  341. package/src/hooks/executeItemsDropdownAction.ts +16 -0
  342. package/src/hooks/executeUploadsDropdownAction.ts +15 -0
  343. package/src/hooks/fieldDropdownActions.ts +18 -0
  344. package/src/hooks/initialLocationQueryForItemSelector.ts +33 -0
  345. package/src/hooks/itemCollectionOutlets.ts +29 -0
  346. package/src/hooks/itemFormDropdownActions.ts +18 -0
  347. package/src/hooks/itemFormOutlets.ts +31 -0
  348. package/src/hooks/itemFormSidebarPanels.ts +52 -0
  349. package/src/hooks/itemFormSidebars.ts +39 -0
  350. package/src/hooks/itemsDropdownActions.ts +16 -0
  351. package/src/hooks/mainNavigationTabs.ts +45 -0
  352. package/src/hooks/manualFieldExtensions.ts +78 -0
  353. package/src/hooks/onBeforeItemUpsert.ts +19 -0
  354. package/src/hooks/onBeforeItemsDestroy.ts +15 -0
  355. package/src/hooks/onBeforeItemsPublish.ts +15 -0
  356. package/src/hooks/onBeforeItemsUnpublish.ts +15 -0
  357. package/src/hooks/onBoot.ts +13 -0
  358. package/src/hooks/overrideFieldExtensions.ts +95 -0
  359. package/src/hooks/renderAssetSource.ts +119 -0
  360. package/src/hooks/renderConfigScreen.ts +27 -0
  361. package/src/hooks/renderFieldExtension.ts +46 -0
  362. package/src/hooks/renderItemCollectionOutlet.ts +29 -0
  363. package/src/hooks/renderItemFormOutlet.ts +40 -0
  364. package/src/hooks/renderItemFormSidebar.ts +45 -0
  365. package/src/hooks/renderItemFormSidebarPanel.ts +46 -0
  366. package/src/hooks/renderManualFieldExtensionConfigScreen.ts +83 -0
  367. package/src/hooks/renderModal.ts +54 -0
  368. package/src/hooks/renderPage.ts +33 -0
  369. package/src/hooks/renderUploadSidebar.ts +44 -0
  370. package/src/hooks/renderUploadSidebarPanel.ts +47 -0
  371. package/src/hooks/settingsAreaSidebarItemGroups.ts +55 -0
  372. package/src/hooks/uploadSidebarPanels.ts +57 -0
  373. package/src/hooks/uploadSidebars.ts +36 -0
  374. package/src/hooks/uploadsDropdownActions.ts +8 -0
  375. package/src/hooks/validateManualFieldExtensionParameters.ts +12 -0
  376. package/src/{types.ts → icon.ts} +0 -1739
  377. package/src/index.ts +49 -4
  378. package/src/manifest.ts +3062 -0
  379. package/src/manifestTypes.ts +56 -0
  380. package/src/shared.ts +67 -0
  381. package/src/utils.ts +253 -0
  382. package/dist/cjs/guards.js +0 -19
  383. package/dist/cjs/guards.js.map +0 -1
  384. package/dist/cjs/types.js.map +0 -1
  385. package/dist/esm/guards.d.ts +0 -37
  386. package/dist/esm/guards.js +0 -16
  387. package/dist/esm/guards.js.map +0 -1
  388. package/dist/esm/types.d.ts +0 -1569
  389. package/dist/esm/types.js +0 -2
  390. package/dist/esm/types.js.map +0 -1
  391. package/dist/types/guards.d.ts +0 -37
  392. package/dist/types/types.d.ts +0 -1569
  393. package/src/guards.ts +0 -51
  394. package/types.json +0 -37395
@@ -0,0 +1,148 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ type Item = SchemaTypes.Item;
3
+ type ItemType = SchemaTypes.ItemType;
4
+ /**
5
+ * These information describe the current state of the form that's being shown
6
+ * to the end-user to edit a record
7
+ */
8
+ export type ItemFormAdditionalProperties = {
9
+ /** The currently active locale for the record */
10
+ locale: string;
11
+ /**
12
+ * If an already persisted record is being edited, returns the full record
13
+ * entity
14
+ */
15
+ item: Item | null;
16
+ /** The model for the record being edited */
17
+ itemType: ItemType;
18
+ /** The complete internal form state */
19
+ formValues: Record<string, unknown>;
20
+ /** The current status of the record being edited */
21
+ itemStatus: 'new' | 'draft' | 'updated' | 'published';
22
+ /** Whether the form is currently submitting itself or not */
23
+ isSubmitting: boolean;
24
+ /** Whether the form has some non-persisted changes or not */
25
+ isFormDirty: boolean;
26
+ /** Current number of blocks present in form state */
27
+ blocksAnalysis: {
28
+ usage: {
29
+ /** Total number of blocks present in form state */
30
+ total: number;
31
+ /** Total number of blocks present in non-localized fields */
32
+ nonLocalized: number;
33
+ /** Total number of blocks present in localized fields, per locale */
34
+ perLocale: Record<string, number>;
35
+ };
36
+ /** Maximum number of blocks per item */
37
+ maximumPerItem: number;
38
+ };
39
+ };
40
+ /**
41
+ * These methods can be used to interact with the form that's being shown to the
42
+ * end-user to edit a record
43
+ */
44
+ export type ItemFormAdditionalMethods = {
45
+ /**
46
+ * Hides/shows a specific field in the form. Please be aware that when a field
47
+ * is hidden, the field editor for that field will be removed from the DOM
48
+ * itself, including any associated plugins. When it is shown again, its
49
+ * plugins will be reinitialized.
50
+ *
51
+ * @example
52
+ *
53
+ * ```js
54
+ * const fieldPath = prompt(
55
+ * 'Please insert the path of a field in the form',
56
+ * ctx.fieldPath,
57
+ * );
58
+ *
59
+ * await ctx.toggleField(fieldPath, true);
60
+ * ```
61
+ */
62
+ toggleField: (path: string, show: boolean) => Promise<void>;
63
+ /**
64
+ * Disables/re-enables a specific field in the form
65
+ *
66
+ * @example
67
+ *
68
+ * ```js
69
+ * const fieldPath = prompt(
70
+ * 'Please insert the path of a field in the form',
71
+ * ctx.fieldPath,
72
+ * );
73
+ *
74
+ * await ctx.disableField(fieldPath, true);
75
+ * ```
76
+ */
77
+ disableField: (path: string, disable: boolean) => Promise<void>;
78
+ /**
79
+ * Smoothly navigates to a specific field in the form. If the field is
80
+ * localized it will switch language tab and then navigate to the chosen
81
+ * field.
82
+ *
83
+ * @example
84
+ *
85
+ * ```js
86
+ * const fieldPath = prompt(
87
+ * 'Please insert the path of a field in the form',
88
+ * ctx.fieldPath,
89
+ * );
90
+ *
91
+ * await ctx.scrollToField(fieldPath);
92
+ * ```
93
+ */
94
+ scrollToField: (path: string, locale?: string) => Promise<void>;
95
+ /**
96
+ * Changes a specific path of the `formValues` object
97
+ *
98
+ * @example
99
+ *
100
+ * ```js
101
+ * const fieldPath = prompt(
102
+ * 'Please insert the path of a field in the form',
103
+ * ctx.fieldPath,
104
+ * );
105
+ *
106
+ * await ctx.setFieldValue(fieldPath, 'new value');
107
+ * ```
108
+ */
109
+ setFieldValue: (path: string, value: unknown) => Promise<void>;
110
+ /**
111
+ * Takes the internal form state, and transforms it into an Item entity
112
+ * compatible with DatoCMS API.
113
+ *
114
+ * When `skipUnchangedFields`, only the fields that changed value will be
115
+ * serialized.
116
+ *
117
+ * If the required nested blocks are still not loaded, this method will return
118
+ * `undefined`.
119
+ *
120
+ * @example
121
+ *
122
+ * ```js
123
+ * await ctx.formValuesToItem(ctx.formValues, false);
124
+ * ```
125
+ */
126
+ formValuesToItem: (formValues: Record<string, unknown>, skipUnchangedFields?: boolean) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
127
+ /**
128
+ * Takes an Item entity, and converts it into the internal form state
129
+ *
130
+ * @example
131
+ *
132
+ * ```js
133
+ * await ctx.itemToFormValues(ctx.item);
134
+ * ```
135
+ */
136
+ itemToFormValues: (item: Omit<Item, 'id' | 'meta'>) => Promise<Record<string, unknown>>;
137
+ /**
138
+ * Triggers a submit form for current record
139
+ *
140
+ * @example
141
+ *
142
+ * ```js
143
+ * await ctx.saveCurrentItem();
144
+ * ```
145
+ */
146
+ saveCurrentItem: (showToast?: boolean) => Promise<void>;
147
+ };
148
+ export {};
@@ -0,0 +1,23 @@
1
+ export type SizingUtilities = {
2
+ /**
3
+ * Listens for DOM changes and automatically calls `setHeight` when it detects
4
+ * a change. If you're using `datocms-react-ui` package, the `<Canvas />`
5
+ * component already takes care of calling this method for you.
6
+ */
7
+ startAutoResizer: () => void;
8
+ /** Stops resizing the iframe automatically */
9
+ stopAutoResizer: () => void;
10
+ /**
11
+ * Triggers a change in the size of the iframe. If you don't explicitely pass
12
+ * a `newHeight` it will be automatically calculated using the iframe content
13
+ * at the moment
14
+ */
15
+ updateHeight: (newHeight?: number) => void;
16
+ /** Wheter the auto-resizer is currently active or not */
17
+ isAutoResizerActive(): boolean;
18
+ };
19
+ /** These methods can be used to set various properties of the containing iframe */
20
+ export type IframeMethods = {
21
+ /** Sets the height for the iframe */
22
+ setHeight: (number: number) => Promise<void>;
23
+ };
@@ -0,0 +1,12 @@
1
+ import { FullConnectParameters } from '../connect';
2
+ import { BaseMethods, BaseProperties } from './base';
3
+ import { IframeMethods, SizingUtilities } from './commonExtras/sizing';
4
+ export type ImposedSizePluginFrameCtx<Mode extends keyof FullConnectParameters, AdditionalProperties extends Record<string, unknown> = Record<string, never>, AdditionalMethods extends Record<string, unknown> = Record<string, never>> = BaseProperties & PluginFrameAdditionalProperties<Mode> & AdditionalProperties & BaseMethods & PluginFrameAdditionalMethods<BaseProperties & PluginFrameAdditionalProperties<Mode> & AdditionalProperties> & AdditionalMethods;
5
+ export type SelfResizingPluginFrameCtx<Mode extends keyof FullConnectParameters, AdditionalProperties extends Record<string, unknown> = Record<string, never>, AdditionalMethods extends Record<string, unknown> = Record<string, never>> = ImposedSizePluginFrameCtx<Mode, AdditionalProperties, AdditionalMethods> & SizingUtilities & IframeMethods;
6
+ export type PluginFrameAdditionalProperties<Mode extends keyof FullConnectParameters> = {
7
+ mode: Mode;
8
+ bodyPadding: [number, number, number, number];
9
+ };
10
+ export type PluginFrameAdditionalMethods<Properties extends Record<string, unknown>> = {
11
+ getSettings: () => Promise<Properties>;
12
+ };
@@ -0,0 +1,41 @@
1
+ import { Ctx } from '../ctx/base';
2
+ import { Icon } from '../icon';
3
+ export type AssetSourcesHook = {
4
+ /**
5
+ * Use this function to declare additional sources to be shown when users want
6
+ * to upload new assets
7
+ *
8
+ * @tag assetSources
9
+ */
10
+ assetSources: (ctx: Ctx) => AssetSource[] | undefined;
11
+ };
12
+ /** An additional asset source */
13
+ export type AssetSource = {
14
+ /**
15
+ * ID of the asset source. Will be the first argument for the
16
+ * `renderAssetSource` function
17
+ */
18
+ id: string;
19
+ /** Name of the asset that will be shown to the user */
20
+ name: string;
21
+ /**
22
+ * Icon to be shown alongside the name. Can be a FontAwesome icon name (ie.
23
+ * `"address-book"`) or a custom SVG definition. To maintain visual
24
+ * consistency with the rest of the interface, try to use FontAwesome icons
25
+ * whenever possible.
26
+ */
27
+ icon: Icon;
28
+ /**
29
+ * Configuration options for the modal that will be opened to select a media
30
+ * file from this source
31
+ */
32
+ modal?: {
33
+ /** Width of the modal. Can be a number, or one of the predefined sizes */
34
+ width?: 's' | 'm' | 'l' | 'xl' | number;
35
+ /**
36
+ * The initial height to set for the iframe that will render the modal
37
+ * content
38
+ */
39
+ initialHeight?: number;
40
+ };
41
+ };
@@ -0,0 +1,28 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import type { MaybePromise } from '../utils';
4
+ type Item = SchemaTypes.Item;
5
+ export type BuildItemPresentationInfoHook = {
6
+ /**
7
+ * Use this function to customize the presentation of a record in records
8
+ * collections and "Single link" or "Multiple links" field
9
+ *
10
+ * @tag presentation
11
+ */
12
+ buildItemPresentationInfo: (item: Item, ctx: Ctx) => MaybePromise<ItemPresentationInfo | undefined>;
13
+ };
14
+ export type ItemPresentationInfo = {
15
+ /** The title to present the record */
16
+ title: string;
17
+ /** An image representative of the record */
18
+ imageUrl?: string;
19
+ /**
20
+ * If different plugins implement the `buildItemPresentationInfo` hook, the
21
+ * one with the lowest `rank` will be used. If you want to specify an explicit
22
+ * value for `rank`, make sure to offer a way for final users to customize it
23
+ * inside the plugin's settings form, otherwise the hardcoded value you choose
24
+ * might clash with the one of another plugin!
25
+ */
26
+ rank?: number;
27
+ };
28
+ export {};
@@ -0,0 +1,39 @@
1
+ import { Ctx } from '../ctx/base';
2
+ import { Icon } from '../icon';
3
+ export type ContentAreaSidebarItemsHook = {
4
+ /**
5
+ * Use this function to declare new items in the content area sidebar
6
+ *
7
+ * @tag sidebarItems
8
+ */
9
+ contentAreaSidebarItems: (ctx: Ctx) => ContentAreaSidebarItem[];
10
+ };
11
+ export type ContentAreaSidebarItem = {
12
+ /** Label to be shown. Must be unique. */
13
+ label: string;
14
+ /**
15
+ * Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
16
+ * `"address-book"`) or a custom SVG definition. To maintain visual
17
+ * consistency with the rest of the interface, try to use FontAwesome icons
18
+ * whenever possible.
19
+ */
20
+ icon: Icon;
21
+ /** ID of the page linked to the item */
22
+ pointsTo: {
23
+ pageId: string;
24
+ };
25
+ /**
26
+ * Expresses where you want the item to be placed inside the sidebar. If not
27
+ * specified, the item will be placed after the standard items provided by
28
+ * DatoCMS itself.
29
+ */
30
+ placement?: ['before' | 'after', 'menuItems' | 'seoPreferences'];
31
+ /**
32
+ * If different plugins specify the same `placement` for their panels, they
33
+ * will be displayed by ascending `rank`. If you want to specify an explicit
34
+ * value for `rank`, make sure to offer a way for final users to customize it
35
+ * inside the plugin's settings form, otherwise the hardcoded value you choose
36
+ * might clash with the one of another plugin!
37
+ */
38
+ rank?: number;
39
+ };
@@ -0,0 +1,36 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { BlockNodeTypeWithCustomStyle } from 'datocms-structured-text-utils';
3
+ import { Ctx } from '../ctx/base';
4
+ type Field = SchemaTypes.Field;
5
+ type ItemType = SchemaTypes.ItemType;
6
+ export type CustomBlockStylesForStructuredTextFieldHook = {
7
+ /**
8
+ * Use this function to define a number of custom block styles for a specific
9
+ * Structured Text field
10
+ *
11
+ * @tag structuredText
12
+ */
13
+ customBlockStylesForStructuredTextField: (field: Field, ctx: CustomBlockStylesForStructuredTextFieldHookCtx) => StructuredTextCustomBlockStyle[] | undefined;
14
+ };
15
+ export type CustomBlockStylesForStructuredTextFieldHookCtx = Ctx<{
16
+ itemType: ItemType;
17
+ }>;
18
+ /** An object expressing a custom block style for a Structured Text field */
19
+ export type StructuredTextCustomBlockStyle = {
20
+ /** ID of custom block style */
21
+ id: string;
22
+ /** The block node that can apply this style */
23
+ node: BlockNodeTypeWithCustomStyle;
24
+ /** ID of custom block style */
25
+ label: string;
26
+ /** How the block will be styled inside the editor to represent the style */
27
+ appliedStyle: React.CSSProperties;
28
+ /**
29
+ * Custom styles for a block node will be sorted by ascending `rank`. If you
30
+ * want to specify an explicit value for `rank`, make sure to offer a way for
31
+ * final users to customize it inside the plugin's settings form, otherwise
32
+ * the hardcoded value you choose might clash with the one of another plugin!
33
+ */
34
+ rank?: number;
35
+ };
36
+ export {};
@@ -0,0 +1,57 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import { Icon } from '../icon';
4
+ type Field = SchemaTypes.Field;
5
+ type ItemType = SchemaTypes.ItemType;
6
+ export type CustomMarksForStructuredTextFieldHook = {
7
+ /**
8
+ * Use this function to define a number of custom marks for a specific
9
+ * Structured Text field
10
+ *
11
+ * @tag structuredText
12
+ */
13
+ customMarksForStructuredTextField: (field: Field, ctx: CustomMarksForStructuredTextFieldHookCtx) => StructuredTextCustomMark[] | undefined;
14
+ };
15
+ export type CustomMarksForStructuredTextFieldHookCtx = Ctx<{
16
+ itemType: ItemType;
17
+ }>;
18
+ /** An object expressing a custom mark for a Structured Text field */
19
+ export type StructuredTextCustomMark = {
20
+ /** ID of mark */
21
+ id: string;
22
+ /** Label representing the custom mark */
23
+ label: string;
24
+ /**
25
+ * Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
26
+ * `"address-book"`) or a custom SVG definition. To maintain visual
27
+ * consistency with the rest of the interface, try to use FontAwesome icons
28
+ * whenever possible
29
+ */
30
+ icon: Icon;
31
+ /**
32
+ * Expresses where you want the custom mark button to be placed inside the
33
+ * toolbar. If not specified, the item will be placed after the standard marks
34
+ * provided by DatoCMS itself.
35
+ */
36
+ placement?: StructuredTextCustomMarkPlacement;
37
+ /**
38
+ * If multiple custom marks specify the same `placement` for their toolbar
39
+ * button, they will be sorted by ascending `rank`. If you want to specify an
40
+ * explicit value for `rank`, make sure to offer a way for final users to
41
+ * customize it inside the plugin's settings form, otherwise the hardcoded
42
+ * value you choose might clash with the one of another plugin!
43
+ */
44
+ rank?: number;
45
+ /**
46
+ * Keyboard shortcut associated with the custom mark, expressed using the
47
+ * https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
48
+ */
49
+ keyboardShortcut?: string;
50
+ /** How the custom mark will be styled inside the editor */
51
+ appliedStyle: React.CSSProperties;
52
+ };
53
+ export type StructuredTextCustomMarkPlacement = [
54
+ 'before' | 'after',
55
+ 'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough'
56
+ ];
57
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Ctx } from '../ctx/base';
2
+ import type { FieldAdditionalProperties } from '../ctx/commonExtras/field';
3
+ import type { ItemFormAdditionalMethods, ItemFormAdditionalProperties } from '../ctx/commonExtras/itemForm';
4
+ export type ExecuteFieldDropdownActionHook = {
5
+ executeFieldDropdownAction: (actionId: string, ctx: ExecuteFieldDropdownActionCtx) => Promise<void>;
6
+ };
7
+ export type ExecuteFieldDropdownActionCtx = Ctx<ItemFormAdditionalProperties & FieldAdditionalProperties & {
8
+ parameters: Record<string, unknown> | undefined;
9
+ }, ItemFormAdditionalMethods>;
@@ -0,0 +1,8 @@
1
+ import { Ctx } from '../ctx/base';
2
+ import type { ItemFormAdditionalMethods, ItemFormAdditionalProperties } from '../ctx/commonExtras/itemForm';
3
+ export type ExecuteItemFormDropdownActionHook = {
4
+ executeItemFormDropdownAction: (actionId: string, ctx: ExecuteItemFormDropdownActionCtx) => Promise<void>;
5
+ };
6
+ export type ExecuteItemFormDropdownActionCtx = Ctx<ItemFormAdditionalProperties & {
7
+ parameters: Record<string, unknown> | undefined;
8
+ }, ItemFormAdditionalMethods>;
@@ -0,0 +1,10 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ type Item = SchemaTypes.Item;
4
+ export type ExecuteItemsDropdownActionHook = {
5
+ executeItemsDropdownAction: (actionId: string, items: Item[], ctx: ExecuteItemsDropdownActionCtx) => Promise<void>;
6
+ };
7
+ export type ExecuteItemsDropdownActionCtx = Ctx<{
8
+ parameters: Record<string, unknown> | undefined;
9
+ }>;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ type Upload = SchemaTypes.Upload;
4
+ export type ExecuteUploadsDropdownActionHook = {
5
+ executeUploadsDropdownAction: (actionId: string, uploads: Upload[], ctx: ExecuteUploadsDropdownActionCtx) => Promise<void>;
6
+ };
7
+ export type ExecuteUploadsDropdownActionCtx = Ctx<{
8
+ parameters: Record<string, unknown> | undefined;
9
+ }>;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import { FieldAdditionalProperties } from '../ctx/commonExtras/field';
4
+ import { ItemFormAdditionalProperties } from '../ctx/commonExtras/itemForm';
5
+ import { DropdownAction, DropdownActionGroup } from '../shared';
6
+ type Field = SchemaTypes.Field;
7
+ export type FieldDropdownActionsHook = {
8
+ fieldDropdownActions: (field: Field, ctx: FieldDropdownActionsCtx) => Array<DropdownAction | DropdownActionGroup>;
9
+ };
10
+ export type FieldDropdownActionsCtx = Ctx<ItemFormAdditionalProperties & FieldAdditionalProperties>;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx, ItemListLocationQuery } from '../ctx/base';
3
+ import { MaybePromise } from '../utils';
4
+ type Field = SchemaTypes.Field;
5
+ type ItemType = SchemaTypes.ItemType;
6
+ export type InitialLocationQueryForItemSelectorHook = {
7
+ /**
8
+ * Use this function to customize the initial filters when opening a record
9
+ * selector via a "Single link" or "Multiple links" field
10
+ *
11
+ * @tag locationQuery
12
+ */
13
+ initialLocationQueryForItemSelector: (openerField: Field, itemType: ItemType, ctx: Ctx) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
14
+ };
15
+ export type InitialLocationQueryForItemSelector = {
16
+ locationQuery: ItemListLocationQuery;
17
+ /**
18
+ * If different plugins implement the `initialLocationQueryForItemSelector`
19
+ * hook, the one with the lowest `rank` will be used. If you want to specify
20
+ * an explicit value for `rank`, make sure to offer a way for final users to
21
+ * customize it inside the plugin's settings form, otherwise the hardcoded
22
+ * value you choose might clash with the one of another plugin!
23
+ */
24
+ rank?: number;
25
+ };
26
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ type ItemType = SchemaTypes.ItemType;
4
+ export type ItemCollectionOutletsHook = {
5
+ itemCollectionOutlets: (itemType: ItemType, ctx: Ctx) => ItemCollectionOutlet[];
6
+ };
7
+ /** An outlet to be shown at the top of a record's collection page */
8
+ export type ItemCollectionOutlet = {
9
+ /**
10
+ * ID of the outlet. Will be the first argument for the `renderItemCollectionOutlet`
11
+ * function
12
+ */
13
+ id: string;
14
+ /**
15
+ * Multiple outlets will be sorted by ascending `rank`. If you want to specify
16
+ * an explicit value for `rank`, make sure to offer a way for final users to
17
+ * customize it inside the plugin's settings form, otherwise the hardcoded
18
+ * value you choose might clash with the one of another plugin!
19
+ */
20
+ rank?: number;
21
+ /** The initial height to set for the iframe that will render the outlet */
22
+ initialHeight?: number;
23
+ };
24
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import { ItemFormAdditionalProperties } from '../ctx/commonExtras/itemForm';
4
+ import { DropdownAction, DropdownActionGroup } from '../shared';
5
+ type ItemType = SchemaTypes.ItemType;
6
+ export type ItemFormDropdownActionsHook = {
7
+ itemFormDropdownActions: (itemType: ItemType, ctx: ItemFormDropdownActionsCtx) => Array<DropdownAction | DropdownActionGroup>;
8
+ };
9
+ export type ItemFormDropdownActionsCtx = ItemFormDropdownActionsProperties;
10
+ export type ItemFormDropdownActionsProperties = Ctx<ItemFormAdditionalProperties>;
11
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ type ItemType = SchemaTypes.ItemType;
4
+ export type ItemFormOutletsHook = {
5
+ /**
6
+ * Use this function to declare custom outlets to be shown at the top of the
7
+ * record's editing page
8
+ *
9
+ * @tag itemFormOutlets
10
+ */
11
+ itemFormOutlets: (itemType: ItemType, ctx: Ctx) => ItemFormOutlet[];
12
+ };
13
+ export type ItemFormOutlet = {
14
+ /**
15
+ * ID of the outlet. Will be the first argument for the `renderItemFormOutlet`
16
+ * function
17
+ */
18
+ id: string;
19
+ /**
20
+ * Multiple outlets will be sorted by ascending `rank`. If you want to specify
21
+ * an explicit value for `rank`, make sure to offer a way for final users to
22
+ * customize it inside the plugin's settings form, otherwise the hardcoded
23
+ * value you choose might clash with the one of another plugin!
24
+ */
25
+ rank?: number;
26
+ /** The initial height to set for the iframe that will render the outlet */
27
+ initialHeight?: number;
28
+ };
29
+ export {};
@@ -0,0 +1,47 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import { ItemFormSidebarPanelPlacement } from '../shared';
4
+ type ItemType = SchemaTypes.ItemType;
5
+ export type ItemFormSidebarPanelsHook = {
6
+ /**
7
+ * Use this function to declare new sidebar panels to be shown when the user
8
+ * edits records of a particular model
9
+ *
10
+ * @tag sidebarPanels
11
+ */
12
+ itemFormSidebarPanels: (itemType: ItemType, ctx: Ctx) => ItemFormSidebarPanel[];
13
+ };
14
+ export type ItemFormSidebarPanel = {
15
+ /**
16
+ * ID of the panel. Will be the first argument for the
17
+ * `renderItemFormSidebarPanel` function
18
+ */
19
+ id: string;
20
+ /** Label to be shown on the collapsible sidebar panel handle */
21
+ label: string;
22
+ /**
23
+ * An arbitrary configuration object that will be passed as the `parameters`
24
+ * property of the second argument of the `renderItemFormSidebarPanel`
25
+ * function
26
+ */
27
+ parameters?: Record<string, unknown>;
28
+ /** Whether the sidebar panel will start open or collapsed */
29
+ startOpen?: boolean;
30
+ /**
31
+ * Expresses where you want the item to be placed inside the sidebar. If not
32
+ * specified, the item will be placed after the standard panels provided by
33
+ * DatoCMS itself.
34
+ */
35
+ placement?: ItemFormSidebarPanelPlacement;
36
+ /**
37
+ * If multiple sidebar panels specify the same `placement`, they will be
38
+ * sorted by ascending `rank`. If you want to specify an explicit value for
39
+ * `rank`, make sure to offer a way for final users to customize it inside the
40
+ * plugin's settings form, otherwise the hardcoded value you choose might
41
+ * clash with the one of another plugin!
42
+ */
43
+ rank?: number;
44
+ /** The initial height to set for the iframe that will render the sidebar panel */
45
+ initialHeight?: number;
46
+ };
47
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ type ItemType = SchemaTypes.ItemType;
4
+ export type ItemFormSidebarsHook = {
5
+ /**
6
+ * Use this function to declare new sidebar to be shown when the user edits
7
+ * records of a particular model
8
+ *
9
+ * @tag sidebarPanels
10
+ */
11
+ itemFormSidebars: (itemType: ItemType, ctx: Ctx) => ItemFormSidebar[];
12
+ };
13
+ export type ItemFormSidebar = {
14
+ /**
15
+ * ID of the sidebar. Will be the first argument for the
16
+ * `renderItemFormSidebar` function
17
+ */
18
+ id: string;
19
+ /** Label to be shown on the collapsible sidebar handle */
20
+ label: string;
21
+ /**
22
+ * An arbitrary configuration object that will be passed as the `parameters`
23
+ * property of the second argument of the `renderItemFormSidebar` function
24
+ */
25
+ parameters?: Record<string, unknown>;
26
+ /**
27
+ * If multiple sidebars specify the same `placement`, they will be sorted by
28
+ * ascending `rank`. If you want to specify an explicit value for `rank`, make
29
+ * sure to offer a way for final users to customize it inside the plugin's
30
+ * settings form, otherwise the hardcoded value you choose might clash with
31
+ * the one of another plugin!
32
+ */
33
+ rank?: number;
34
+ /** The preferred width for the sidebar */
35
+ preferredWidth?: number;
36
+ };
37
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { SchemaTypes } from '@datocms/cma-client';
2
+ import { Ctx } from '../ctx/base';
3
+ import { DropdownAction, DropdownActionGroup } from '../shared';
4
+ type ItemType = SchemaTypes.ItemType;
5
+ export type ItemsDropdownActionsHook = {
6
+ itemsDropdownActions: (itemType: ItemType, ctx: ItemDropdownActionsCtx) => Array<DropdownAction | DropdownActionGroup>;
7
+ };
8
+ export type ItemDropdownActionsCtx = Ctx<{
9
+ itemType: ItemType;
10
+ }>;
11
+ export {};