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,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 @@
|
|
|
1
|
+
{"version":3,"file":"itemFormOutlets.js","sourceRoot":"","sources":["../../../src/hooks/itemFormOutlets.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"itemFormSidebarPanels.js","sourceRoot":"","sources":["../../../src/hooks/itemFormSidebarPanels.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"itemFormSidebars.js","sourceRoot":"","sources":["../../../src/hooks/itemFormSidebars.ts"],"names":[],"mappings":""}
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemsDropdownActions.js","sourceRoot":"","sources":["../../../src/hooks/itemsDropdownActions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
export type MainNavigationTabsHook = {
|
|
4
|
+
/**
|
|
5
|
+
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
6
|
+
* UI
|
|
7
|
+
*
|
|
8
|
+
* @tag pages
|
|
9
|
+
*/
|
|
10
|
+
mainNavigationTabs: (ctx: Ctx) => MainNavigationTab[];
|
|
11
|
+
};
|
|
12
|
+
/** A tab to be displayed in the top-bar of the UI */
|
|
13
|
+
export type MainNavigationTab = {
|
|
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 tab */
|
|
24
|
+
pointsTo: {
|
|
25
|
+
pageId: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Expresses where you want to place the tab in the top-bar. If not specified,
|
|
29
|
+
* the tab will be placed after the standard tabs provided by DatoCMS itself.
|
|
30
|
+
*/
|
|
31
|
+
placement?: [
|
|
32
|
+
'before' | 'after',
|
|
33
|
+
'content' | 'media' | 'schema' | 'configuration' | 'cdaPlayground'
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* If different plugins specify the same `placement` for their tabs, they will
|
|
37
|
+
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
38
|
+
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
39
|
+
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
40
|
+
* clash with the one of another plugin!
|
|
41
|
+
*/
|
|
42
|
+
rank?: number;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainNavigationTabs.js","sourceRoot":"","sources":["../../../src/hooks/mainNavigationTabs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Ctx } from '../ctx/base';
|
|
2
|
+
export type ManualFieldExtensionsHook = {
|
|
3
|
+
/**
|
|
4
|
+
* Use this function to declare new field extensions that users will be able
|
|
5
|
+
* to install manually in some field
|
|
6
|
+
*
|
|
7
|
+
* @tag manualFieldExtensions
|
|
8
|
+
*/
|
|
9
|
+
manualFieldExtensions: (ctx: Ctx) => ManualFieldExtension[];
|
|
10
|
+
};
|
|
11
|
+
export type ManualFieldExtension = {
|
|
12
|
+
/**
|
|
13
|
+
* ID of field extension. Will be the first argument for the
|
|
14
|
+
* `renderFieldExtension` function
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/** Name to be shown when editing fields */
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Type of field extension. An `editor` extension replaces the default field
|
|
21
|
+
* editor that DatoCMS provides, while an `addon` extension is placed
|
|
22
|
+
* underneath the field editor to provide additional info/behaviour. You can
|
|
23
|
+
* setup multiple field addons for every field.
|
|
24
|
+
*/
|
|
25
|
+
type: FieldExtensionType;
|
|
26
|
+
/**
|
|
27
|
+
* For `editor` extensions: moves the field to the sidebar of the record
|
|
28
|
+
* editing page, mimicking a sidebar panel
|
|
29
|
+
*/
|
|
30
|
+
asSidebarPanel?: boolean | {
|
|
31
|
+
startOpen: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
35
|
+
* the shortcut `all` to target all types of fields
|
|
36
|
+
*/
|
|
37
|
+
fieldTypes: 'all' | FieldType[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether this field extension needs some configuration options before being
|
|
40
|
+
* installed in a field or not. Will trigger the
|
|
41
|
+
* `renderManualFieldExtensionConfigScreen` and
|
|
42
|
+
* `validateManualFieldExtensionParameters` methods
|
|
43
|
+
*/
|
|
44
|
+
configurable?: boolean | {
|
|
45
|
+
initialHeight: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The initial height to set for the iframe that will render the field
|
|
49
|
+
* extension
|
|
50
|
+
*/
|
|
51
|
+
initialHeight?: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The sidebar in the Content Area presents a number of user-defined menu-items.
|
|
55
|
+
* This object represents a new item to be added in the sidebar.
|
|
56
|
+
*/
|
|
57
|
+
export type FieldExtensionType = 'editor' | 'addon';
|
|
58
|
+
export type FieldType = 'boolean' | 'color' | 'date_time' | 'date' | 'file' | 'float' | 'gallery' | 'integer' | 'json' | 'lat_lon' | 'link' | 'links' | 'rich_text' | 'seo' | 'slug' | 'string' | 'structured_text' | 'text' | 'video';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualFieldExtensions.js","sourceRoot":"","sources":["../../../src/hooks/manualFieldExtensions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { MaybePromise } from '../utils';
|
|
4
|
+
type ItemUpdateSchema = SchemaTypes.ItemUpdateSchema;
|
|
5
|
+
type ItemCreateSchema = SchemaTypes.ItemCreateSchema;
|
|
6
|
+
export type OnBeforeItemUpsertHook = {
|
|
7
|
+
/**
|
|
8
|
+
* This function will be called before saving a new version of a record. You
|
|
9
|
+
* can stop the action by returning `false`
|
|
10
|
+
*
|
|
11
|
+
* @tag beforeHooks
|
|
12
|
+
*/
|
|
13
|
+
onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: Ctx) => MaybePromise<boolean>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onBeforeItemUpsert.js","sourceRoot":"","sources":["../../../src/hooks/onBeforeItemUpsert.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { MaybePromise } from '../utils';
|
|
4
|
+
type Item = SchemaTypes.Item;
|
|
5
|
+
export type OnBeforeItemsDestroyHook = {
|
|
6
|
+
/**
|
|
7
|
+
* This function will be called before destroying records. You can stop the
|
|
8
|
+
* action by returning `false`
|
|
9
|
+
*
|
|
10
|
+
* @tag beforeHooks
|
|
11
|
+
*/
|
|
12
|
+
onBeforeItemsDestroy: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onBeforeItemsDestroy.js","sourceRoot":"","sources":["../../../src/hooks/onBeforeItemsDestroy.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { MaybePromise } from '../utils';
|
|
4
|
+
type Item = SchemaTypes.Item;
|
|
5
|
+
export type OnBeforeItemsPublishHook = {
|
|
6
|
+
/**
|
|
7
|
+
* This function will be called before publishing records. You can stop the
|
|
8
|
+
* action by returning `false`
|
|
9
|
+
*
|
|
10
|
+
* @tag beforeHooks
|
|
11
|
+
*/
|
|
12
|
+
onBeforeItemsPublish: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onBeforeItemsPublish.js","sourceRoot":"","sources":["../../../src/hooks/onBeforeItemsPublish.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { MaybePromise } from '../utils';
|
|
4
|
+
type Item = SchemaTypes.Item;
|
|
5
|
+
export type OnBeforeItemsUnpublishHook = {
|
|
6
|
+
/**
|
|
7
|
+
* This function will be called before unpublishing records. You can stop the
|
|
8
|
+
* action by returning `false`
|
|
9
|
+
*
|
|
10
|
+
* @tag beforeHooks
|
|
11
|
+
*/
|
|
12
|
+
onBeforeItemsUnpublish: (items: Item[], ctx: Ctx) => MaybePromise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onBeforeItemsUnpublish.js","sourceRoot":"","sources":["../../../src/hooks/onBeforeItemsUnpublish.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImposedSizePluginFrameCtx } from '../ctx/pluginFrame';
|
|
2
|
+
export type OnBootHook = {
|
|
3
|
+
/**
|
|
4
|
+
* This function will be called once at boot time and can be used to perform
|
|
5
|
+
* ie. some initial integrity checks on the configuration.
|
|
6
|
+
*
|
|
7
|
+
* @tag boot
|
|
8
|
+
*/
|
|
9
|
+
onBoot: (ctx: OnBootCtx) => void;
|
|
10
|
+
};
|
|
11
|
+
export type OnBootCtx = ImposedSizePluginFrameCtx<'onBoot'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onBoot.js","sourceRoot":"","sources":["../../../src/hooks/onBoot.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
|
+
import { Ctx } from '../ctx/base';
|
|
3
|
+
import { ItemFormSidebarPanelPlacement } from '../shared';
|
|
4
|
+
type Field = SchemaTypes.Field;
|
|
5
|
+
type ItemType = SchemaTypes.ItemType;
|
|
6
|
+
export type OverrideFieldExtensionsHook = {
|
|
7
|
+
/**
|
|
8
|
+
* Use this function to automatically force one or more field extensions to a
|
|
9
|
+
* particular field
|
|
10
|
+
*
|
|
11
|
+
* @tag forcedFieldExtensions
|
|
12
|
+
*/
|
|
13
|
+
overrideFieldExtensions: (field: Field, ctx: OverrideFieldExtensionsHookCtx) => FieldExtensionOverride | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type OverrideFieldExtensionsHookCtx = Ctx<{
|
|
16
|
+
itemType: ItemType;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* An object expressing some field extensions you want to force on a particular
|
|
20
|
+
* field
|
|
21
|
+
*/
|
|
22
|
+
export type FieldExtensionOverride = {
|
|
23
|
+
/** Force a field editor/sidebar extension on a field */
|
|
24
|
+
editor?: EditorOverride;
|
|
25
|
+
/** One or more field sidebar extensions to forcefully add to a field */
|
|
26
|
+
addons?: AddonOverride[];
|
|
27
|
+
};
|
|
28
|
+
/** A field editor/sidebar forced on a field */
|
|
29
|
+
export type EditorOverride = {
|
|
30
|
+
/**
|
|
31
|
+
* ID of field extension. Will be the first argument for the
|
|
32
|
+
* `renderFieldExtension` function
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Moves the field to the sidebar of the record editing page, mimicking a
|
|
37
|
+
* sidebar panel
|
|
38
|
+
*/
|
|
39
|
+
asSidebarPanel?: boolean | {
|
|
40
|
+
startOpen?: boolean;
|
|
41
|
+
placement?: ItemFormSidebarPanelPlacement;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* An arbitrary configuration object that will be passed as the `parameters`
|
|
45
|
+
* property of the second argument of the `renderFieldExtension` function
|
|
46
|
+
*/
|
|
47
|
+
parameters?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
50
|
+
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
51
|
+
* offer a way for final users to customize it inside the plugin's settings
|
|
52
|
+
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
53
|
+
* another plugin!
|
|
54
|
+
*/
|
|
55
|
+
rank?: number;
|
|
56
|
+
/**
|
|
57
|
+
* The initial height to set for the iframe that will render the field
|
|
58
|
+
* extension
|
|
59
|
+
*/
|
|
60
|
+
initialHeight?: number;
|
|
61
|
+
};
|
|
62
|
+
/** A field addon extension forced on a field */
|
|
63
|
+
export type AddonOverride = {
|
|
64
|
+
/**
|
|
65
|
+
* ID of field extension. Will be the first argument for the
|
|
66
|
+
* `renderFieldExtension` function
|
|
67
|
+
*/
|
|
68
|
+
id: string;
|
|
69
|
+
/**
|
|
70
|
+
* An arbitrary configuration object that will be passed as the `parameters`
|
|
71
|
+
* property of the second argument of the `renderFieldExtension` function
|
|
72
|
+
*/
|
|
73
|
+
parameters?: Record<string, unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* If multiple addons are present for a field, they will be sorted by
|
|
76
|
+
* ascending `rank`. If you want to specify an explicit value for `rank`, make
|
|
77
|
+
* sure to offer a way for final users to customize it inside the plugin's
|
|
78
|
+
* settings form, otherwise the hardcoded value you choose might clash with
|
|
79
|
+
* the one of another plugin!
|
|
80
|
+
*/
|
|
81
|
+
rank?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The initial height to set for the iframe that will render the field
|
|
84
|
+
* extension
|
|
85
|
+
*/
|
|
86
|
+
initialHeight?: number;
|
|
87
|
+
};
|
|
88
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrideFieldExtensions.js","sourceRoot":"","sources":["../../../src/hooks/overrideFieldExtensions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
|
|
2
|
+
export type RenderAssetSourceHook = {
|
|
3
|
+
/**
|
|
4
|
+
* This function will be called when the user selects one of the plugin's
|
|
5
|
+
* asset sources to upload a new media file.
|
|
6
|
+
*
|
|
7
|
+
* @tag assetSources
|
|
8
|
+
*/
|
|
9
|
+
renderAssetSource: (assetSourceId: string, ctx: RenderAssetSourceCtx) => void;
|
|
10
|
+
};
|
|
11
|
+
export type RenderAssetSourceCtx = SelfResizingPluginFrameCtx<'renderAssetSource', {
|
|
12
|
+
/** The ID of the assetSource that needs to be rendered */
|
|
13
|
+
assetSourceId: string;
|
|
14
|
+
}, {
|
|
15
|
+
/**
|
|
16
|
+
* Function to be called when the user selects the asset: it will trigger the
|
|
17
|
+
* creation of a new `Upload` that will be added in the Media Area.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* ```js
|
|
22
|
+
* await ctx.select({
|
|
23
|
+
* resource: {
|
|
24
|
+
* url: 'https://images.unsplash.com/photo-1416339306562-f3d12fefd36f',
|
|
25
|
+
* filename: 'man-drinking-coffee.jpg',
|
|
26
|
+
* },
|
|
27
|
+
* copyright: 'Royalty free (Unsplash)',
|
|
28
|
+
* author: 'Jeff Sheldon',
|
|
29
|
+
* notes: 'A man drinking a coffee',
|
|
30
|
+
* tags: ['man', 'coffee'],
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
select: (newUpload: NewUpload) => void;
|
|
35
|
+
}>;
|
|
36
|
+
export type NewUploadResourceAsUrl = {
|
|
37
|
+
/**
|
|
38
|
+
* URL for the resource. The URL must respond with a
|
|
39
|
+
* `Access-Control-Allow-Origin` header — for instance `*`, which will allow
|
|
40
|
+
* all hosts — allowing the image to be read by DatoCMS
|
|
41
|
+
*/
|
|
42
|
+
url: string;
|
|
43
|
+
/** Any additional headers to pass when making the request to the URL */
|
|
44
|
+
headers?: Record<string, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Optional filename to be used to generate the final DatoCMS URL. If not
|
|
47
|
+
* passed, the URL will be used
|
|
48
|
+
*/
|
|
49
|
+
filename?: string;
|
|
50
|
+
};
|
|
51
|
+
export type NewUploadResourceAsBase64 = {
|
|
52
|
+
/**
|
|
53
|
+
* Base64 encoded data URI for the resource.
|
|
54
|
+
*
|
|
55
|
+
* Format:
|
|
56
|
+
*
|
|
57
|
+
* `data:[<mime type>][;charset=<charset>];base64,<encoded data>`
|
|
58
|
+
*/
|
|
59
|
+
base64: string;
|
|
60
|
+
/** Filename to be used to generate the final DatoCMS URL */
|
|
61
|
+
filename: string;
|
|
62
|
+
};
|
|
63
|
+
export type NewUpload = {
|
|
64
|
+
/** The actual resource that will be uploaded */
|
|
65
|
+
resource: NewUploadResourceAsUrl | NewUploadResourceAsBase64;
|
|
66
|
+
/** Copyright to apply to the asset */
|
|
67
|
+
copyright?: string;
|
|
68
|
+
/** Author to apply to the asset */
|
|
69
|
+
author?: string;
|
|
70
|
+
/** Notes to apply to the asset */
|
|
71
|
+
notes?: string;
|
|
72
|
+
/** Tags to apply to the asset */
|
|
73
|
+
tags?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* An hash containing, for each locale of the project, the default metadata to
|
|
76
|
+
* apply to the asset
|
|
77
|
+
*/
|
|
78
|
+
default_field_metadata?: {
|
|
79
|
+
[k: string]: {
|
|
80
|
+
/** Alternate text for the asset */
|
|
81
|
+
alt: string | null;
|
|
82
|
+
/** Title for the asset */
|
|
83
|
+
title: string | null;
|
|
84
|
+
/** Object with arbitrary metadata */
|
|
85
|
+
custom_data: {
|
|
86
|
+
[k: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
/** Focal point (only for image assets) */
|
|
89
|
+
focal_point?: {
|
|
90
|
+
/** Horizontal position expressed as float between 0 and 1 */
|
|
91
|
+
x: number;
|
|
92
|
+
/** Vertical position expressed as float between 0 and 1 */
|
|
93
|
+
y: number;
|
|
94
|
+
} | null;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export declare const renderAssetSourceBootstrapper: import("../utils").Bootstrapper<"renderAssetSource">;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { containedRenderModeBootstrapper } from '../utils';
|
|
2
|
+
export var renderAssetSourceBootstrapper = containedRenderModeBootstrapper('renderAssetSource', function (configuration, ctx) {
|
|
3
|
+
if (!configuration.renderAssetSource) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
configuration.renderAssetSource(ctx.assetSourceId, ctx);
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=renderAssetSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderAssetSource.js","sourceRoot":"","sources":["../../../src/hooks/renderAssetSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AA2G3D,MAAM,CAAC,IAAM,6BAA6B,GACxC,+BAA+B,CAC7B,mBAAmB,EACnB,UAAC,aAAa,EAAE,GAAG;IACjB,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,aAAa,CAAC,iBAAiB,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAC1D,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
|
|
2
|
+
export type RenderConfigScreenHook = {
|
|
3
|
+
/**
|
|
4
|
+
* This function will be called when the plugin needs to render the plugin's
|
|
5
|
+
* configuration form
|
|
6
|
+
*
|
|
7
|
+
* @tag configScreen
|
|
8
|
+
*/
|
|
9
|
+
renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
|
|
10
|
+
};
|
|
11
|
+
export type RenderConfigScreenCtx = SelfResizingPluginFrameCtx<'renderConfigScreen'>;
|
|
12
|
+
export declare const renderConfigScreenBootstrapper: import("../utils").Bootstrapper<"renderConfigScreen">;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { containedRenderModeBootstrapper } from '../utils';
|
|
2
|
+
export var renderConfigScreenBootstrapper = containedRenderModeBootstrapper('renderConfigScreen', function (configuration, ctx) {
|
|
3
|
+
if (!configuration.renderConfigScreen) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
configuration.renderConfigScreen(ctx);
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=renderConfigScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderConfigScreen.js","sourceRoot":"","sources":["../../../src/hooks/renderConfigScreen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAe3D,MAAM,CAAC,IAAM,8BAA8B,GACzC,+BAA+B,CAC7B,oBAAoB,EACpB,UAAC,aAAa,EAAE,GAAG;IACjB,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC;QACtC,OAAO;IACT,CAAC;IAED,aAAa,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldAdditionalProperties } from '../ctx/commonExtras/field';
|
|
2
|
+
import { ItemFormAdditionalMethods, ItemFormAdditionalProperties } from '../ctx/commonExtras/itemForm';
|
|
3
|
+
import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
|
|
4
|
+
export type RenderFieldExtensionHook = {
|
|
5
|
+
/**
|
|
6
|
+
* This function will be called when the plugin needs to render a field
|
|
7
|
+
* extension (see the `manualFieldExtensions` and `overrideFieldExtensions`
|
|
8
|
+
* functions)
|
|
9
|
+
*
|
|
10
|
+
* @tag forcedFieldExtensions
|
|
11
|
+
*/
|
|
12
|
+
renderFieldExtension: (fieldExtensionId: string, ctx: RenderFieldExtensionCtx) => void;
|
|
13
|
+
};
|
|
14
|
+
export type RenderFieldExtensionCtx = SelfResizingPluginFrameCtx<'renderFieldExtension', ItemFormAdditionalProperties & FieldAdditionalProperties & {
|
|
15
|
+
/** The ID of the field extension that needs to be rendered */
|
|
16
|
+
fieldExtensionId: string;
|
|
17
|
+
/** The arbitrary `parameters` of the field extension */
|
|
18
|
+
parameters: Record<string, unknown>;
|
|
19
|
+
}, ItemFormAdditionalMethods>;
|
|
20
|
+
export declare const renderFieldExtensionBootstrapper: import("../utils").Bootstrapper<"renderFieldExtension">;
|