datocms-plugin-sdk 1.1.1 → 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.
- package/dist/cjs/connect.js +75 -214
- package/dist/cjs/connect.js.map +1 -1
- package/dist/cjs/{types.js → ctx/base.js} +1 -1
- package/dist/cjs/ctx/base.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/field.js +3 -0
- package/dist/cjs/ctx/commonExtras/field.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/itemForm.js +3 -0
- package/dist/cjs/ctx/commonExtras/itemForm.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/sizing.js +3 -0
- package/dist/cjs/ctx/commonExtras/sizing.js.map +1 -0
- package/dist/cjs/ctx/pluginFrame.js +3 -0
- package/dist/cjs/ctx/pluginFrame.js.map +1 -0
- package/dist/cjs/hooks/assetSources.js +3 -0
- package/dist/cjs/hooks/assetSources.js.map +1 -0
- package/dist/cjs/hooks/buildItemPresentationInfo.js +3 -0
- package/dist/cjs/hooks/buildItemPresentationInfo.js.map +1 -0
- package/dist/cjs/hooks/contentAreaSidebarItems.js +3 -0
- package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -0
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js +3 -0
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
- package/dist/cjs/hooks/customMarksForStructuredTextField.js +3 -0
- package/dist/cjs/hooks/customMarksForStructuredTextField.js.map +1 -0
- package/dist/cjs/hooks/executeFieldDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeFieldDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeItemFormDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeItemFormDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeItemsDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeItemsDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeUploadsDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeUploadsDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/fieldDropdownActions.js +3 -0
- package/dist/cjs/hooks/fieldDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js +3 -0
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js.map +1 -0
- package/dist/cjs/hooks/itemCollectionOutlets.js +3 -0
- package/dist/cjs/hooks/itemCollectionOutlets.js.map +1 -0
- package/dist/cjs/hooks/itemFormDropdownActions.js +3 -0
- package/dist/cjs/hooks/itemFormDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/itemFormOutlets.js +3 -0
- package/dist/cjs/hooks/itemFormOutlets.js.map +1 -0
- package/dist/cjs/hooks/itemFormSidebarPanels.js +3 -0
- package/dist/cjs/hooks/itemFormSidebarPanels.js.map +1 -0
- package/dist/cjs/hooks/itemFormSidebars.js +3 -0
- package/dist/cjs/hooks/itemFormSidebars.js.map +1 -0
- package/dist/cjs/hooks/itemsDropdownActions.js +3 -0
- package/dist/cjs/hooks/itemsDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/mainNavigationTabs.js +3 -0
- package/dist/cjs/hooks/mainNavigationTabs.js.map +1 -0
- package/dist/cjs/hooks/manualFieldExtensions.js +3 -0
- package/dist/cjs/hooks/manualFieldExtensions.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemUpsert.js +3 -0
- package/dist/cjs/hooks/onBeforeItemUpsert.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsDestroy.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsDestroy.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsPublish.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsPublish.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsUnpublish.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsUnpublish.js.map +1 -0
- package/dist/cjs/hooks/onBoot.js +3 -0
- package/dist/cjs/hooks/onBoot.js.map +1 -0
- package/dist/cjs/hooks/overrideFieldExtensions.js +3 -0
- package/dist/cjs/hooks/overrideFieldExtensions.js.map +1 -0
- package/dist/cjs/hooks/renderAssetSource.js +11 -0
- package/dist/cjs/hooks/renderAssetSource.js.map +1 -0
- package/dist/cjs/hooks/renderConfigScreen.js +11 -0
- package/dist/cjs/hooks/renderConfigScreen.js.map +1 -0
- package/dist/cjs/hooks/renderFieldExtension.js +11 -0
- package/dist/cjs/hooks/renderFieldExtension.js.map +1 -0
- package/dist/cjs/hooks/renderItemCollectionOutlet.js +11 -0
- package/dist/cjs/hooks/renderItemCollectionOutlet.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormOutlet.js +11 -0
- package/dist/cjs/hooks/renderItemFormOutlet.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormSidebar.js +11 -0
- package/dist/cjs/hooks/renderItemFormSidebar.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormSidebarPanel.js +11 -0
- package/dist/cjs/hooks/renderItemFormSidebarPanel.js.map +1 -0
- package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js +11 -0
- package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
- package/dist/cjs/hooks/renderModal.js +11 -0
- package/dist/cjs/hooks/renderModal.js.map +1 -0
- package/dist/cjs/hooks/renderPage.js +11 -0
- package/dist/cjs/hooks/renderPage.js.map +1 -0
- package/dist/cjs/hooks/renderUploadSidebar.js +11 -0
- package/dist/cjs/hooks/renderUploadSidebar.js.map +1 -0
- package/dist/cjs/hooks/renderUploadSidebarPanel.js +11 -0
- package/dist/cjs/hooks/renderUploadSidebarPanel.js.map +1 -0
- package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js +3 -0
- package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
- package/dist/cjs/hooks/uploadSidebarPanels.js +3 -0
- package/dist/cjs/hooks/uploadSidebarPanels.js.map +1 -0
- package/dist/cjs/hooks/uploadSidebars.js +3 -0
- package/dist/cjs/hooks/uploadSidebars.js.map +1 -0
- package/dist/cjs/hooks/uploadsDropdownActions.js +3 -0
- package/dist/cjs/hooks/uploadsDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js +3 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js.map +1 -0
- package/dist/cjs/icon.js +3 -0
- package/dist/cjs/icon.js.map +1 -0
- package/dist/cjs/index.js +46 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/manifest.js +2909 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/manifestTypes.js +3 -0
- package/dist/cjs/manifestTypes.js.map +1 -0
- package/dist/cjs/shared.js +3 -0
- package/dist/cjs/shared.js.map +1 -0
- package/dist/cjs/utils.js +136 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/connect.d.ts +44 -244
- package/dist/esm/connect.js +74 -212
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/ctx/base.d.ts +670 -0
- package/dist/esm/ctx/base.js +2 -0
- package/dist/esm/ctx/base.js.map +1 -0
- package/dist/esm/ctx/commonExtras/field.d.ts +29 -0
- package/dist/esm/ctx/commonExtras/field.js +2 -0
- package/dist/esm/ctx/commonExtras/field.js.map +1 -0
- package/dist/esm/ctx/commonExtras/itemForm.d.ts +148 -0
- package/dist/esm/ctx/commonExtras/itemForm.js +2 -0
- package/dist/esm/ctx/commonExtras/itemForm.js.map +1 -0
- package/dist/esm/ctx/commonExtras/sizing.d.ts +23 -0
- package/dist/esm/ctx/commonExtras/sizing.js +2 -0
- package/dist/esm/ctx/commonExtras/sizing.js.map +1 -0
- package/dist/esm/ctx/pluginFrame.d.ts +12 -0
- package/dist/esm/ctx/pluginFrame.js +2 -0
- package/dist/esm/ctx/pluginFrame.js.map +1 -0
- package/dist/esm/hooks/assetSources.d.ts +41 -0
- package/dist/esm/hooks/assetSources.js +2 -0
- package/dist/esm/hooks/assetSources.js.map +1 -0
- package/dist/esm/hooks/buildItemPresentationInfo.d.ts +28 -0
- package/dist/esm/hooks/buildItemPresentationInfo.js +2 -0
- package/dist/esm/hooks/buildItemPresentationInfo.js.map +1 -0
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +39 -0
- package/dist/esm/hooks/contentAreaSidebarItems.js +2 -0
- package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js +2 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +57 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.js +2 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.js.map +1 -0
- package/dist/esm/hooks/executeFieldDropdownAction.d.ts +9 -0
- package/dist/esm/hooks/executeFieldDropdownAction.js +2 -0
- package/dist/esm/hooks/executeFieldDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.d.ts +8 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.js +2 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeItemsDropdownAction.d.ts +10 -0
- package/dist/esm/hooks/executeItemsDropdownAction.js +2 -0
- package/dist/esm/hooks/executeItemsDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.d.ts +10 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.js +2 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.js.map +1 -0
- package/dist/esm/hooks/fieldDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/fieldDropdownActions.js +2 -0
- package/dist/esm/hooks/fieldDropdownActions.js.map +1 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js +2 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js.map +1 -0
- package/dist/esm/hooks/itemCollectionOutlets.d.ts +24 -0
- package/dist/esm/hooks/itemCollectionOutlets.js +2 -0
- package/dist/esm/hooks/itemCollectionOutlets.js.map +1 -0
- package/dist/esm/hooks/itemFormDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/itemFormDropdownActions.js +2 -0
- package/dist/esm/hooks/itemFormDropdownActions.js.map +1 -0
- package/dist/esm/hooks/itemFormOutlets.d.ts +29 -0
- package/dist/esm/hooks/itemFormOutlets.js +2 -0
- package/dist/esm/hooks/itemFormOutlets.js.map +1 -0
- package/dist/esm/hooks/itemFormSidebarPanels.d.ts +47 -0
- package/dist/esm/hooks/itemFormSidebarPanels.js +2 -0
- package/dist/esm/hooks/itemFormSidebarPanels.js.map +1 -0
- package/dist/esm/hooks/itemFormSidebars.d.ts +37 -0
- package/dist/esm/hooks/itemFormSidebars.js +2 -0
- package/dist/esm/hooks/itemFormSidebars.js.map +1 -0
- package/dist/esm/hooks/itemsDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/itemsDropdownActions.js +2 -0
- package/dist/esm/hooks/itemsDropdownActions.js.map +1 -0
- package/dist/esm/hooks/mainNavigationTabs.d.ts +43 -0
- package/dist/esm/hooks/mainNavigationTabs.js +2 -0
- package/dist/esm/hooks/mainNavigationTabs.js.map +1 -0
- package/dist/esm/hooks/manualFieldExtensions.d.ts +58 -0
- package/dist/esm/hooks/manualFieldExtensions.js +2 -0
- package/dist/esm/hooks/manualFieldExtensions.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemUpsert.d.ts +15 -0
- package/dist/esm/hooks/onBeforeItemUpsert.js +2 -0
- package/dist/esm/hooks/onBeforeItemUpsert.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.js +2 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsPublish.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsPublish.js +2 -0
- package/dist/esm/hooks/onBeforeItemsPublish.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.js +2 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.js.map +1 -0
- package/dist/esm/hooks/onBoot.d.ts +11 -0
- package/dist/esm/hooks/onBoot.js +2 -0
- package/dist/esm/hooks/onBoot.js.map +1 -0
- package/dist/esm/hooks/overrideFieldExtensions.d.ts +88 -0
- package/dist/esm/hooks/overrideFieldExtensions.js +2 -0
- package/dist/esm/hooks/overrideFieldExtensions.js.map +1 -0
- package/dist/esm/hooks/renderAssetSource.d.ts +98 -0
- package/dist/esm/hooks/renderAssetSource.js +8 -0
- package/dist/esm/hooks/renderAssetSource.js.map +1 -0
- package/dist/esm/hooks/renderConfigScreen.d.ts +12 -0
- package/dist/esm/hooks/renderConfigScreen.js +8 -0
- package/dist/esm/hooks/renderConfigScreen.js.map +1 -0
- package/dist/esm/hooks/renderFieldExtension.d.ts +20 -0
- package/dist/esm/hooks/renderFieldExtension.js +8 -0
- package/dist/esm/hooks/renderFieldExtension.js.map +1 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.d.ts +9 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.js +8 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.js.map +1 -0
- package/dist/esm/hooks/renderItemFormOutlet.d.ts +16 -0
- package/dist/esm/hooks/renderItemFormOutlet.js +8 -0
- package/dist/esm/hooks/renderItemFormOutlet.js.map +1 -0
- package/dist/esm/hooks/renderItemFormSidebar.d.ts +21 -0
- package/dist/esm/hooks/renderItemFormSidebar.js +8 -0
- package/dist/esm/hooks/renderItemFormSidebar.js.map +1 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.d.ts +21 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.js +8 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.js.map +1 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js +8 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
- package/dist/esm/hooks/renderModal.d.ts +37 -0
- package/dist/esm/hooks/renderModal.js +8 -0
- package/dist/esm/hooks/renderModal.js.map +1 -0
- package/dist/esm/hooks/renderPage.d.ts +16 -0
- package/dist/esm/hooks/renderPage.js +8 -0
- package/dist/esm/hooks/renderPage.js.map +1 -0
- package/dist/esm/hooks/renderUploadSidebar.d.ts +25 -0
- package/dist/esm/hooks/renderUploadSidebar.js +8 -0
- package/dist/esm/hooks/renderUploadSidebar.js.map +1 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.d.ts +25 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.js +8 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.js.map +1 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.js +2 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
- package/dist/esm/hooks/uploadSidebarPanels.d.ts +47 -0
- package/dist/esm/hooks/uploadSidebarPanels.js +2 -0
- package/dist/esm/hooks/uploadSidebarPanels.js.map +1 -0
- package/dist/esm/hooks/uploadSidebars.d.ts +34 -0
- package/dist/esm/hooks/uploadSidebars.js +2 -0
- package/dist/esm/hooks/uploadSidebars.js.map +1 -0
- package/dist/esm/hooks/uploadsDropdownActions.d.ts +5 -0
- package/dist/esm/hooks/uploadsDropdownActions.js +2 -0
- package/dist/esm/hooks/uploadsDropdownActions.js.map +1 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js +2 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js.map +1 -0
- package/dist/esm/icon.d.ts +6 -0
- package/dist/esm/icon.js +2 -0
- package/dist/esm/icon.js.map +1 -0
- package/dist/esm/index.d.ts +57 -12
- package/dist/esm/index.js +46 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/manifest.d.ts +2 -0
- package/dist/esm/manifest.js +2906 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/manifestTypes.d.ts +51 -0
- package/dist/esm/manifestTypes.js +2 -0
- package/dist/esm/manifestTypes.js.map +1 -0
- package/dist/esm/shared.d.ts +56 -0
- package/dist/esm/shared.js +2 -0
- package/dist/esm/shared.js.map +1 -0
- package/dist/esm/utils.d.ts +31 -0
- package/dist/esm/utils.js +129 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/connect.d.ts +44 -244
- package/dist/types/ctx/base.d.ts +670 -0
- package/dist/types/ctx/commonExtras/field.d.ts +29 -0
- package/dist/types/ctx/commonExtras/itemForm.d.ts +148 -0
- package/dist/types/ctx/commonExtras/sizing.d.ts +23 -0
- package/dist/types/ctx/pluginFrame.d.ts +12 -0
- package/dist/types/hooks/assetSources.d.ts +41 -0
- package/dist/types/hooks/buildItemPresentationInfo.d.ts +28 -0
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +39 -0
- package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
- package/dist/types/hooks/customMarksForStructuredTextField.d.ts +57 -0
- package/dist/types/hooks/executeFieldDropdownAction.d.ts +9 -0
- package/dist/types/hooks/executeItemFormDropdownAction.d.ts +8 -0
- package/dist/types/hooks/executeItemsDropdownAction.d.ts +10 -0
- package/dist/types/hooks/executeUploadsDropdownAction.d.ts +10 -0
- package/dist/types/hooks/fieldDropdownActions.d.ts +11 -0
- package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
- package/dist/types/hooks/itemCollectionOutlets.d.ts +24 -0
- package/dist/types/hooks/itemFormDropdownActions.d.ts +11 -0
- package/dist/types/hooks/itemFormOutlets.d.ts +29 -0
- package/dist/types/hooks/itemFormSidebarPanels.d.ts +47 -0
- package/dist/types/hooks/itemFormSidebars.d.ts +37 -0
- package/dist/types/hooks/itemsDropdownActions.d.ts +11 -0
- package/dist/types/hooks/mainNavigationTabs.d.ts +43 -0
- package/dist/types/hooks/manualFieldExtensions.d.ts +58 -0
- package/dist/types/hooks/onBeforeItemUpsert.d.ts +15 -0
- package/dist/types/hooks/onBeforeItemsDestroy.d.ts +14 -0
- package/dist/types/hooks/onBeforeItemsPublish.d.ts +14 -0
- package/dist/types/hooks/onBeforeItemsUnpublish.d.ts +14 -0
- package/dist/types/hooks/onBoot.d.ts +11 -0
- package/dist/types/hooks/overrideFieldExtensions.d.ts +88 -0
- package/dist/types/hooks/renderAssetSource.d.ts +98 -0
- package/dist/types/hooks/renderConfigScreen.d.ts +12 -0
- package/dist/types/hooks/renderFieldExtension.d.ts +20 -0
- package/dist/types/hooks/renderItemCollectionOutlet.d.ts +9 -0
- package/dist/types/hooks/renderItemFormOutlet.d.ts +16 -0
- package/dist/types/hooks/renderItemFormSidebar.d.ts +21 -0
- package/dist/types/hooks/renderItemFormSidebarPanel.d.ts +21 -0
- package/dist/types/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
- package/dist/types/hooks/renderModal.d.ts +37 -0
- package/dist/types/hooks/renderPage.d.ts +16 -0
- package/dist/types/hooks/renderUploadSidebar.d.ts +25 -0
- package/dist/types/hooks/renderUploadSidebarPanel.d.ts +25 -0
- package/dist/types/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
- package/dist/types/hooks/uploadSidebarPanels.d.ts +47 -0
- package/dist/types/hooks/uploadSidebars.d.ts +34 -0
- package/dist/types/hooks/uploadsDropdownActions.d.ts +5 -0
- package/dist/types/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
- package/dist/types/icon.d.ts +6 -0
- package/dist/types/index.d.ts +57 -12
- package/dist/types/manifest.d.ts +2 -0
- package/dist/types/manifestTypes.d.ts +51 -0
- package/dist/types/shared.d.ts +56 -0
- package/dist/types/utils.d.ts +31 -0
- package/manifest.json +2905 -0
- package/package.json +7 -6
- package/src/connect.ts +207 -709
- package/src/ctx/base.ts +714 -0
- package/src/ctx/commonExtras/field.ts +27 -0
- package/src/ctx/commonExtras/itemForm.ts +155 -0
- package/src/ctx/commonExtras/sizing.ts +27 -0
- package/src/ctx/pluginFrame.ts +39 -0
- package/src/hooks/assetSources.ts +43 -0
- package/src/hooks/buildItemPresentationInfo.ts +33 -0
- package/src/hooks/contentAreaSidebarItems.ts +41 -0
- package/src/hooks/customBlockStylesForStructuredTextField.ts +42 -0
- package/src/hooks/customMarksForStructuredTextField.ts +64 -0
- package/src/hooks/executeFieldDropdownAction.ts +21 -0
- package/src/hooks/executeItemFormDropdownAction.ts +19 -0
- package/src/hooks/executeItemsDropdownAction.ts +16 -0
- package/src/hooks/executeUploadsDropdownAction.ts +15 -0
- package/src/hooks/fieldDropdownActions.ts +18 -0
- package/src/hooks/initialLocationQueryForItemSelector.ts +33 -0
- package/src/hooks/itemCollectionOutlets.ts +29 -0
- package/src/hooks/itemFormDropdownActions.ts +18 -0
- package/src/hooks/itemFormOutlets.ts +31 -0
- package/src/hooks/itemFormSidebarPanels.ts +52 -0
- package/src/hooks/itemFormSidebars.ts +39 -0
- package/src/hooks/itemsDropdownActions.ts +16 -0
- package/src/hooks/mainNavigationTabs.ts +45 -0
- package/src/hooks/manualFieldExtensions.ts +78 -0
- package/src/hooks/onBeforeItemUpsert.ts +19 -0
- package/src/hooks/onBeforeItemsDestroy.ts +15 -0
- package/src/hooks/onBeforeItemsPublish.ts +15 -0
- package/src/hooks/onBeforeItemsUnpublish.ts +15 -0
- package/src/hooks/onBoot.ts +13 -0
- package/src/hooks/overrideFieldExtensions.ts +95 -0
- package/src/hooks/renderAssetSource.ts +119 -0
- package/src/hooks/renderConfigScreen.ts +27 -0
- package/src/hooks/renderFieldExtension.ts +46 -0
- package/src/hooks/renderItemCollectionOutlet.ts +29 -0
- package/src/hooks/renderItemFormOutlet.ts +40 -0
- package/src/hooks/renderItemFormSidebar.ts +45 -0
- package/src/hooks/renderItemFormSidebarPanel.ts +46 -0
- package/src/hooks/renderManualFieldExtensionConfigScreen.ts +83 -0
- package/src/hooks/renderModal.ts +54 -0
- package/src/hooks/renderPage.ts +33 -0
- package/src/hooks/renderUploadSidebar.ts +44 -0
- package/src/hooks/renderUploadSidebarPanel.ts +47 -0
- package/src/hooks/settingsAreaSidebarItemGroups.ts +55 -0
- package/src/hooks/uploadSidebarPanels.ts +57 -0
- package/src/hooks/uploadSidebars.ts +36 -0
- package/src/hooks/uploadsDropdownActions.ts +8 -0
- package/src/hooks/validateManualFieldExtensionParameters.ts +12 -0
- package/src/{types.ts → icon.ts} +0 -1739
- package/src/index.ts +49 -4
- package/src/manifest.ts +3062 -0
- package/src/manifestTypes.ts +56 -0
- package/src/shared.ts +67 -0
- package/src/utils.ts +253 -0
- package/dist/cjs/guards.js +0 -19
- package/dist/cjs/guards.js.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/guards.d.ts +0 -37
- package/dist/esm/guards.js +0 -16
- package/dist/esm/guards.js.map +0 -1
- package/dist/esm/types.d.ts +0 -1569
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/types/guards.d.ts +0 -37
- package/dist/types/types.d.ts +0 -1569
- package/src/guards.ts +0 -51
- package/types.json +0 -37437
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
|
|
3
|
+
type Field = SchemaTypes.Field;
|
|
4
|
+
type ItemType = SchemaTypes.ItemType;
|
|
5
|
+
|
|
6
|
+
export type FieldAdditionalProperties = {
|
|
7
|
+
/** Whether the field is currently disabled or not */
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The path in the `formValues` object where to find the current value for the
|
|
11
|
+
* field
|
|
12
|
+
*/
|
|
13
|
+
fieldPath: string;
|
|
14
|
+
/** The field where the field extension is installed to */
|
|
15
|
+
field: Field;
|
|
16
|
+
/**
|
|
17
|
+
* If the field extension is installed in a field of a block, returns the top
|
|
18
|
+
* level Modular Content/Structured Text field containing the block itself
|
|
19
|
+
*/
|
|
20
|
+
parentField: Field | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* If the field extension is installed in a field of a block, returns the ID
|
|
23
|
+
* of the block — or `undefined` if the block is still not persisted — and the
|
|
24
|
+
* block model.
|
|
25
|
+
*/
|
|
26
|
+
block: undefined | { id: string | undefined; blockModel: ItemType };
|
|
27
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
|
|
3
|
+
type Item = SchemaTypes.Item;
|
|
4
|
+
type ItemType = SchemaTypes.ItemType;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* These information describe the current state of the form that's being shown
|
|
8
|
+
* to the end-user to edit a record
|
|
9
|
+
*/
|
|
10
|
+
export type ItemFormAdditionalProperties = {
|
|
11
|
+
/** The currently active locale for the record */
|
|
12
|
+
locale: string;
|
|
13
|
+
/**
|
|
14
|
+
* If an already persisted record is being edited, returns the full record
|
|
15
|
+
* entity
|
|
16
|
+
*/
|
|
17
|
+
item: Item | null;
|
|
18
|
+
/** The model for the record being edited */
|
|
19
|
+
itemType: ItemType;
|
|
20
|
+
/** The complete internal form state */
|
|
21
|
+
formValues: Record<string, unknown>;
|
|
22
|
+
/** The current status of the record being edited */
|
|
23
|
+
itemStatus: 'new' | 'draft' | 'updated' | 'published';
|
|
24
|
+
/** Whether the form is currently submitting itself or not */
|
|
25
|
+
isSubmitting: boolean;
|
|
26
|
+
/** Whether the form has some non-persisted changes or not */
|
|
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;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* These methods can be used to interact with the form that's being shown to the
|
|
45
|
+
* end-user to edit a record
|
|
46
|
+
*/
|
|
47
|
+
export type ItemFormAdditionalMethods = {
|
|
48
|
+
/**
|
|
49
|
+
* Hides/shows a specific field in the form. Please be aware that when a field
|
|
50
|
+
* is hidden, the field editor for that field will be removed from the DOM
|
|
51
|
+
* itself, including any associated plugins. When it is shown again, its
|
|
52
|
+
* plugins will be reinitialized.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
*
|
|
56
|
+
* ```js
|
|
57
|
+
* const fieldPath = prompt(
|
|
58
|
+
* 'Please insert the path of a field in the form',
|
|
59
|
+
* ctx.fieldPath,
|
|
60
|
+
* );
|
|
61
|
+
*
|
|
62
|
+
* await ctx.toggleField(fieldPath, true);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
toggleField: (path: string, show: boolean) => Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Disables/re-enables a specific field in the form
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
*
|
|
71
|
+
* ```js
|
|
72
|
+
* const fieldPath = prompt(
|
|
73
|
+
* 'Please insert the path of a field in the form',
|
|
74
|
+
* ctx.fieldPath,
|
|
75
|
+
* );
|
|
76
|
+
*
|
|
77
|
+
* await ctx.disableField(fieldPath, true);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
disableField: (path: string, disable: boolean) => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Smoothly navigates to a specific field in the form. If the field is
|
|
83
|
+
* localized it will switch language tab and then navigate to the chosen
|
|
84
|
+
* field.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
*
|
|
88
|
+
* ```js
|
|
89
|
+
* const fieldPath = prompt(
|
|
90
|
+
* 'Please insert the path of a field in the form',
|
|
91
|
+
* ctx.fieldPath,
|
|
92
|
+
* );
|
|
93
|
+
*
|
|
94
|
+
* await ctx.scrollToField(fieldPath);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
scrollToField: (path: string, locale?: string) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Changes a specific path of the `formValues` object
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
*
|
|
103
|
+
* ```js
|
|
104
|
+
* const fieldPath = prompt(
|
|
105
|
+
* 'Please insert the path of a field in the form',
|
|
106
|
+
* ctx.fieldPath,
|
|
107
|
+
* );
|
|
108
|
+
*
|
|
109
|
+
* await ctx.setFieldValue(fieldPath, 'new value');
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
setFieldValue: (path: string, value: unknown) => Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Takes the internal form state, and transforms it into an Item entity
|
|
115
|
+
* compatible with DatoCMS API.
|
|
116
|
+
*
|
|
117
|
+
* When `skipUnchangedFields`, only the fields that changed value will be
|
|
118
|
+
* serialized.
|
|
119
|
+
*
|
|
120
|
+
* If the required nested blocks are still not loaded, this method will return
|
|
121
|
+
* `undefined`.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
*
|
|
125
|
+
* ```js
|
|
126
|
+
* await ctx.formValuesToItem(ctx.formValues, false);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
formValuesToItem: (
|
|
130
|
+
formValues: Record<string, unknown>,
|
|
131
|
+
skipUnchangedFields?: boolean,
|
|
132
|
+
) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
|
|
133
|
+
/**
|
|
134
|
+
* Takes an Item entity, and converts it into the internal form state
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
*
|
|
138
|
+
* ```js
|
|
139
|
+
* await ctx.itemToFormValues(ctx.item);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
itemToFormValues: (
|
|
143
|
+
item: Omit<Item, 'id' | 'meta'>,
|
|
144
|
+
) => Promise<Record<string, unknown>>;
|
|
145
|
+
/**
|
|
146
|
+
* Triggers a submit form for current record
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
*
|
|
150
|
+
* ```js
|
|
151
|
+
* await ctx.saveCurrentItem();
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
saveCurrentItem: (showToast?: boolean) => Promise<void>;
|
|
155
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
9
|
+
/** Stops resizing the iframe automatically */
|
|
10
|
+
stopAutoResizer: () => void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Triggers a change in the size of the iframe. If you don't explicitely pass
|
|
14
|
+
* a `newHeight` it will be automatically calculated using the iframe content
|
|
15
|
+
* at the moment
|
|
16
|
+
*/
|
|
17
|
+
updateHeight: (newHeight?: number) => void;
|
|
18
|
+
|
|
19
|
+
/** Wheter the auto-resizer is currently active or not */
|
|
20
|
+
isAutoResizerActive(): boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** These methods can be used to set various properties of the containing iframe */
|
|
24
|
+
export type IframeMethods = {
|
|
25
|
+
/** Sets the height for the iframe */
|
|
26
|
+
setHeight: (number: number) => Promise<void>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FullConnectParameters } from '../connect';
|
|
2
|
+
import { BaseMethods, BaseProperties } from './base';
|
|
3
|
+
import { IframeMethods, SizingUtilities } from './commonExtras/sizing';
|
|
4
|
+
|
|
5
|
+
export type ImposedSizePluginFrameCtx<
|
|
6
|
+
Mode extends keyof FullConnectParameters,
|
|
7
|
+
AdditionalProperties extends Record<string, unknown> = Record<string, never>,
|
|
8
|
+
AdditionalMethods extends Record<string, unknown> = Record<string, never>,
|
|
9
|
+
> = BaseProperties &
|
|
10
|
+
PluginFrameAdditionalProperties<Mode> &
|
|
11
|
+
AdditionalProperties &
|
|
12
|
+
BaseMethods &
|
|
13
|
+
PluginFrameAdditionalMethods<
|
|
14
|
+
BaseProperties &
|
|
15
|
+
PluginFrameAdditionalProperties<Mode> &
|
|
16
|
+
AdditionalProperties
|
|
17
|
+
> &
|
|
18
|
+
AdditionalMethods;
|
|
19
|
+
|
|
20
|
+
export type SelfResizingPluginFrameCtx<
|
|
21
|
+
Mode extends keyof FullConnectParameters,
|
|
22
|
+
AdditionalProperties extends Record<string, unknown> = Record<string, never>,
|
|
23
|
+
AdditionalMethods extends Record<string, unknown> = Record<string, never>,
|
|
24
|
+
> = ImposedSizePluginFrameCtx<Mode, AdditionalProperties, AdditionalMethods> &
|
|
25
|
+
SizingUtilities &
|
|
26
|
+
IframeMethods;
|
|
27
|
+
|
|
28
|
+
export type PluginFrameAdditionalProperties<
|
|
29
|
+
Mode extends keyof FullConnectParameters,
|
|
30
|
+
> = {
|
|
31
|
+
mode: Mode;
|
|
32
|
+
bodyPadding: [number, number, number, number];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type PluginFrameAdditionalMethods<
|
|
36
|
+
Properties extends Record<string, unknown>,
|
|
37
|
+
> = {
|
|
38
|
+
getSettings: () => Promise<Properties>;
|
|
39
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
|
|
4
|
+
export type AssetSourcesHook = {
|
|
5
|
+
/**
|
|
6
|
+
* Use this function to declare additional sources to be shown when users want
|
|
7
|
+
* to upload new assets
|
|
8
|
+
*
|
|
9
|
+
* @tag assetSources
|
|
10
|
+
*/
|
|
11
|
+
assetSources: (ctx: Ctx) => AssetSource[] | undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** An additional asset source */
|
|
15
|
+
export type AssetSource = {
|
|
16
|
+
/**
|
|
17
|
+
* ID of the asset source. Will be the first argument for the
|
|
18
|
+
* `renderAssetSource` function
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/** Name of the asset that will be shown to the user */
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Icon to be shown alongside the name. Can be a FontAwesome icon name (ie.
|
|
25
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
26
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
27
|
+
* whenever possible.
|
|
28
|
+
*/
|
|
29
|
+
icon: Icon;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration options for the modal that will be opened to select a media
|
|
32
|
+
* file from this source
|
|
33
|
+
*/
|
|
34
|
+
modal?: {
|
|
35
|
+
/** Width of the modal. Can be a number, or one of the predefined sizes */
|
|
36
|
+
width?: 's' | 'm' | 'l' | 'xl' | number;
|
|
37
|
+
/**
|
|
38
|
+
* The initial height to set for the iframe that will render the modal
|
|
39
|
+
* content
|
|
40
|
+
*/
|
|
41
|
+
initialHeight?: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import type { MaybePromise } from '../utils';
|
|
4
|
+
|
|
5
|
+
type Item = SchemaTypes.Item;
|
|
6
|
+
|
|
7
|
+
export type BuildItemPresentationInfoHook = {
|
|
8
|
+
/**
|
|
9
|
+
* Use this function to customize the presentation of a record in records
|
|
10
|
+
* collections and "Single link" or "Multiple links" field
|
|
11
|
+
*
|
|
12
|
+
* @tag presentation
|
|
13
|
+
*/
|
|
14
|
+
buildItemPresentationInfo: (
|
|
15
|
+
item: Item,
|
|
16
|
+
ctx: Ctx,
|
|
17
|
+
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ItemPresentationInfo = {
|
|
21
|
+
/** The title to present the record */
|
|
22
|
+
title: string;
|
|
23
|
+
/** An image representative of the record */
|
|
24
|
+
imageUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
27
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
28
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
29
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
30
|
+
* might clash with the one of another plugin!
|
|
31
|
+
*/
|
|
32
|
+
rank?: number;
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
|
|
4
|
+
export type ContentAreaSidebarItemsHook = {
|
|
5
|
+
/**
|
|
6
|
+
* Use this function to declare new items in the content area sidebar
|
|
7
|
+
*
|
|
8
|
+
* @tag sidebarItems
|
|
9
|
+
*/
|
|
10
|
+
contentAreaSidebarItems: (ctx: Ctx) => ContentAreaSidebarItem[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ContentAreaSidebarItem = {
|
|
14
|
+
/** Label to be shown. Must be unique. */
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
18
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
19
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
20
|
+
* whenever possible.
|
|
21
|
+
*/
|
|
22
|
+
icon: Icon;
|
|
23
|
+
/** ID of the page linked to the item */
|
|
24
|
+
pointsTo: {
|
|
25
|
+
pageId: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Expresses where you want the item to be placed inside the sidebar. If not
|
|
29
|
+
* specified, the item will be placed after the standard items provided by
|
|
30
|
+
* DatoCMS itself.
|
|
31
|
+
*/
|
|
32
|
+
placement?: ['before' | 'after', 'menuItems' | 'seoPreferences'];
|
|
33
|
+
/**
|
|
34
|
+
* If different plugins specify the same `placement` for their panels, they
|
|
35
|
+
* will be displayed by ascending `rank`. If you want to specify an explicit
|
|
36
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
37
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
38
|
+
* might clash with the one of another plugin!
|
|
39
|
+
*/
|
|
40
|
+
rank?: number;
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { BlockNodeTypeWithCustomStyle } from 'datocms-structured-text-utils';
|
|
3
|
+
import { Ctx } from '../ctx/base';
|
|
4
|
+
|
|
5
|
+
type Field = SchemaTypes.Field;
|
|
6
|
+
type ItemType = SchemaTypes.ItemType;
|
|
7
|
+
|
|
8
|
+
export type CustomBlockStylesForStructuredTextFieldHook = {
|
|
9
|
+
/**
|
|
10
|
+
* Use this function to define a number of custom block styles for a specific
|
|
11
|
+
* Structured Text field
|
|
12
|
+
*
|
|
13
|
+
* @tag structuredText
|
|
14
|
+
*/
|
|
15
|
+
customBlockStylesForStructuredTextField: (
|
|
16
|
+
field: Field,
|
|
17
|
+
ctx: CustomBlockStylesForStructuredTextFieldHookCtx,
|
|
18
|
+
) => StructuredTextCustomBlockStyle[] | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CustomBlockStylesForStructuredTextFieldHookCtx = Ctx<{
|
|
22
|
+
itemType: ItemType;
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
/** An object expressing a custom block style for a Structured Text field */
|
|
26
|
+
export type StructuredTextCustomBlockStyle = {
|
|
27
|
+
/** ID of custom block style */
|
|
28
|
+
id: string;
|
|
29
|
+
/** The block node that can apply this style */
|
|
30
|
+
node: BlockNodeTypeWithCustomStyle;
|
|
31
|
+
/** ID of custom block style */
|
|
32
|
+
label: string;
|
|
33
|
+
/** How the block will be styled inside the editor to represent the style */
|
|
34
|
+
appliedStyle: React.CSSProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Custom styles for a block node will be sorted by ascending `rank`. If you
|
|
37
|
+
* want to specify an explicit value for `rank`, make sure to offer a way for
|
|
38
|
+
* final users to customize it inside the plugin's settings form, otherwise
|
|
39
|
+
* the hardcoded value you choose might clash with the one of another plugin!
|
|
40
|
+
*/
|
|
41
|
+
rank?: number;
|
|
42
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { Icon } from '../icon';
|
|
4
|
+
|
|
5
|
+
type Field = SchemaTypes.Field;
|
|
6
|
+
type ItemType = SchemaTypes.ItemType;
|
|
7
|
+
|
|
8
|
+
export type CustomMarksForStructuredTextFieldHook = {
|
|
9
|
+
/**
|
|
10
|
+
* Use this function to define a number of custom marks for a specific
|
|
11
|
+
* Structured Text field
|
|
12
|
+
*
|
|
13
|
+
* @tag structuredText
|
|
14
|
+
*/
|
|
15
|
+
customMarksForStructuredTextField: (
|
|
16
|
+
field: Field,
|
|
17
|
+
ctx: CustomMarksForStructuredTextFieldHookCtx,
|
|
18
|
+
) => StructuredTextCustomMark[] | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CustomMarksForStructuredTextFieldHookCtx = Ctx<{
|
|
22
|
+
itemType: ItemType;
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
26
|
+
export type StructuredTextCustomMark = {
|
|
27
|
+
/** ID of mark */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Label representing the custom mark */
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
33
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
34
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
35
|
+
* whenever possible
|
|
36
|
+
*/
|
|
37
|
+
icon: Icon;
|
|
38
|
+
/**
|
|
39
|
+
* Expresses where you want the custom mark button to be placed inside the
|
|
40
|
+
* toolbar. If not specified, the item will be placed after the standard marks
|
|
41
|
+
* provided by DatoCMS itself.
|
|
42
|
+
*/
|
|
43
|
+
placement?: StructuredTextCustomMarkPlacement;
|
|
44
|
+
/**
|
|
45
|
+
* If multiple custom marks specify the same `placement` for their toolbar
|
|
46
|
+
* button, they will be sorted by ascending `rank`. If you want to specify an
|
|
47
|
+
* explicit value for `rank`, make sure to offer a way for final users to
|
|
48
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
49
|
+
* value you choose might clash with the one of another plugin!
|
|
50
|
+
*/
|
|
51
|
+
rank?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Keyboard shortcut associated with the custom mark, expressed using the
|
|
54
|
+
* https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
|
|
55
|
+
*/
|
|
56
|
+
keyboardShortcut?: string;
|
|
57
|
+
/** How the custom mark will be styled inside the editor */
|
|
58
|
+
appliedStyle: React.CSSProperties;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type StructuredTextCustomMarkPlacement = [
|
|
62
|
+
'before' | 'after',
|
|
63
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough',
|
|
64
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
import type { FieldAdditionalProperties } from '../ctx/commonExtras/field';
|
|
3
|
+
import type {
|
|
4
|
+
ItemFormAdditionalMethods,
|
|
5
|
+
ItemFormAdditionalProperties,
|
|
6
|
+
} from '../ctx/commonExtras/itemForm';
|
|
7
|
+
|
|
8
|
+
export type ExecuteFieldDropdownActionHook = {
|
|
9
|
+
executeFieldDropdownAction: (
|
|
10
|
+
actionId: string,
|
|
11
|
+
ctx: ExecuteFieldDropdownActionCtx,
|
|
12
|
+
) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ExecuteFieldDropdownActionCtx = Ctx<
|
|
16
|
+
ItemFormAdditionalProperties &
|
|
17
|
+
FieldAdditionalProperties & {
|
|
18
|
+
parameters: Record<string, unknown> | undefined;
|
|
19
|
+
},
|
|
20
|
+
ItemFormAdditionalMethods
|
|
21
|
+
>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
import type {
|
|
3
|
+
ItemFormAdditionalMethods,
|
|
4
|
+
ItemFormAdditionalProperties,
|
|
5
|
+
} from '../ctx/commonExtras/itemForm';
|
|
6
|
+
|
|
7
|
+
export type ExecuteItemFormDropdownActionHook = {
|
|
8
|
+
executeItemFormDropdownAction: (
|
|
9
|
+
actionId: string,
|
|
10
|
+
ctx: ExecuteItemFormDropdownActionCtx,
|
|
11
|
+
) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ExecuteItemFormDropdownActionCtx = Ctx<
|
|
15
|
+
ItemFormAdditionalProperties & {
|
|
16
|
+
parameters: Record<string, unknown> | undefined;
|
|
17
|
+
},
|
|
18
|
+
ItemFormAdditionalMethods
|
|
19
|
+
>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
|
|
4
|
+
type Item = SchemaTypes.Item;
|
|
5
|
+
|
|
6
|
+
export type ExecuteItemsDropdownActionHook = {
|
|
7
|
+
executeItemsDropdownAction: (
|
|
8
|
+
actionId: string,
|
|
9
|
+
items: Item[],
|
|
10
|
+
ctx: ExecuteItemsDropdownActionCtx,
|
|
11
|
+
) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ExecuteItemsDropdownActionCtx = Ctx<{
|
|
15
|
+
parameters: Record<string, unknown> | undefined;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
|
|
4
|
+
type Upload = SchemaTypes.Upload;
|
|
5
|
+
|
|
6
|
+
export type ExecuteUploadsDropdownActionHook = {
|
|
7
|
+
executeUploadsDropdownAction: (
|
|
8
|
+
actionId: string,
|
|
9
|
+
uploads: Upload[],
|
|
10
|
+
ctx: ExecuteUploadsDropdownActionCtx,
|
|
11
|
+
) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type ExecuteUploadsDropdownActionCtx = Ctx<{
|
|
14
|
+
parameters: Record<string, unknown> | undefined;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
7
|
+
type Field = SchemaTypes.Field;
|
|
8
|
+
|
|
9
|
+
export type FieldDropdownActionsHook = {
|
|
10
|
+
fieldDropdownActions: (
|
|
11
|
+
field: Field,
|
|
12
|
+
ctx: FieldDropdownActionsCtx,
|
|
13
|
+
) => Array<DropdownAction | DropdownActionGroup>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type FieldDropdownActionsCtx = Ctx<
|
|
17
|
+
ItemFormAdditionalProperties & FieldAdditionalProperties
|
|
18
|
+
>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx, ItemListLocationQuery } from '../ctx/base';
|
|
3
|
+
|
|
4
|
+
import { MaybePromise } from '../utils';
|
|
5
|
+
|
|
6
|
+
type Field = SchemaTypes.Field;
|
|
7
|
+
type ItemType = SchemaTypes.ItemType;
|
|
8
|
+
|
|
9
|
+
export type InitialLocationQueryForItemSelectorHook = {
|
|
10
|
+
/**
|
|
11
|
+
* Use this function to customize the initial filters when opening a record
|
|
12
|
+
* selector via a "Single link" or "Multiple links" field
|
|
13
|
+
*
|
|
14
|
+
* @tag locationQuery
|
|
15
|
+
*/
|
|
16
|
+
initialLocationQueryForItemSelector: (
|
|
17
|
+
openerField: Field,
|
|
18
|
+
itemType: ItemType,
|
|
19
|
+
ctx: Ctx,
|
|
20
|
+
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type InitialLocationQueryForItemSelector = {
|
|
24
|
+
locationQuery: ItemListLocationQuery;
|
|
25
|
+
/**
|
|
26
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
27
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
28
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
29
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
30
|
+
* value you choose might clash with the one of another plugin!
|
|
31
|
+
*/
|
|
32
|
+
rank?: number;
|
|
33
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
|
|
4
|
+
type ItemType = SchemaTypes.ItemType;
|
|
5
|
+
|
|
6
|
+
export type ItemCollectionOutletsHook = {
|
|
7
|
+
itemCollectionOutlets: (
|
|
8
|
+
itemType: ItemType,
|
|
9
|
+
ctx: Ctx,
|
|
10
|
+
) => ItemCollectionOutlet[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** An outlet to be shown at the top of a record's collection page */
|
|
14
|
+
export type ItemCollectionOutlet = {
|
|
15
|
+
/**
|
|
16
|
+
* ID of the outlet. Will be the first argument for the `renderItemCollectionOutlet`
|
|
17
|
+
* function
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* Multiple outlets will be sorted by ascending `rank`. If you want to specify
|
|
22
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
23
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
24
|
+
* value you choose might clash with the one of another plugin!
|
|
25
|
+
*/
|
|
26
|
+
rank?: number;
|
|
27
|
+
/** The initial height to set for the iframe that will render the outlet */
|
|
28
|
+
initialHeight?: number;
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
6
|
+
type ItemType = SchemaTypes.ItemType;
|
|
7
|
+
|
|
8
|
+
export type ItemFormDropdownActionsHook = {
|
|
9
|
+
itemFormDropdownActions: (
|
|
10
|
+
itemType: ItemType,
|
|
11
|
+
ctx: ItemFormDropdownActionsCtx,
|
|
12
|
+
) => Array<DropdownAction | DropdownActionGroup>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ItemFormDropdownActionsCtx = ItemFormDropdownActionsProperties;
|
|
16
|
+
|
|
17
|
+
export type ItemFormDropdownActionsProperties =
|
|
18
|
+
Ctx<ItemFormAdditionalProperties>;
|