datocms-plugin-sdk 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/connect.js +75 -208
- 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 -242
- package/dist/esm/connect.js +74 -206
- 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 -242
- 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 -698
- 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 -37395
package/src/connect.ts
CHANGED
|
@@ -1,494 +1,159 @@
|
|
|
1
|
-
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
1
|
import connectToParent from 'penpal/lib/connectToParent';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '
|
|
2
|
+
import type { AssetSourcesHook } from './hooks/assetSources';
|
|
3
|
+
import type { BuildItemPresentationInfoHook } from './hooks/buildItemPresentationInfo';
|
|
4
|
+
import type { ContentAreaSidebarItemsHook } from './hooks/contentAreaSidebarItems';
|
|
5
|
+
import type { CustomBlockStylesForStructuredTextFieldHook } from './hooks/customBlockStylesForStructuredTextField';
|
|
6
|
+
import type { CustomMarksForStructuredTextFieldHook } from './hooks/customMarksForStructuredTextField';
|
|
7
|
+
import type { ExecuteFieldDropdownActionHook } from './hooks/executeFieldDropdownAction';
|
|
8
|
+
import type { ExecuteItemFormDropdownActionHook } from './hooks/executeItemFormDropdownAction';
|
|
9
|
+
import type { ExecuteItemsDropdownActionHook } from './hooks/executeItemsDropdownAction';
|
|
10
|
+
import type { ExecuteUploadsDropdownActionHook } from './hooks/executeUploadsDropdownAction';
|
|
11
|
+
import type { FieldDropdownActionsHook } from './hooks/fieldDropdownActions';
|
|
12
|
+
import type { InitialLocationQueryForItemSelectorHook } from './hooks/initialLocationQueryForItemSelector';
|
|
13
|
+
import type { ItemCollectionOutletsHook } from './hooks/itemCollectionOutlets';
|
|
14
|
+
import type { ItemFormDropdownActionsHook } from './hooks/itemFormDropdownActions';
|
|
15
|
+
import type { ItemFormOutletsHook } from './hooks/itemFormOutlets';
|
|
16
|
+
import type { ItemFormSidebarPanelsHook } from './hooks/itemFormSidebarPanels';
|
|
17
|
+
import type { ItemFormSidebarsHook } from './hooks/itemFormSidebars';
|
|
18
|
+
import type { ItemsDropdownActionsHook } from './hooks/itemsDropdownActions';
|
|
19
|
+
import type { MainNavigationTabsHook } from './hooks/mainNavigationTabs';
|
|
20
|
+
import type { ManualFieldExtensionsHook } from './hooks/manualFieldExtensions';
|
|
21
|
+
import type { OnBeforeItemUpsertHook } from './hooks/onBeforeItemUpsert';
|
|
22
|
+
import type { OnBeforeItemsDestroyHook } from './hooks/onBeforeItemsDestroy';
|
|
23
|
+
import type { OnBeforeItemsPublishHook } from './hooks/onBeforeItemsPublish';
|
|
24
|
+
import type { OnBeforeItemsUnpublishHook } from './hooks/onBeforeItemsUnpublish';
|
|
25
|
+
import type { OnBootHook } from './hooks/onBoot';
|
|
26
|
+
import type { OverrideFieldExtensionsHook } from './hooks/overrideFieldExtensions';
|
|
10
27
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from './
|
|
54
|
-
|
|
55
|
-
type
|
|
56
|
-
type
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
64
|
-
* a change. If you're using `datocms-react-ui` package, the `<Canvas />`
|
|
65
|
-
* component already takes care of calling this method for you.
|
|
66
|
-
*/
|
|
67
|
-
startAutoResizer: () => void;
|
|
68
|
-
/** Stops resizing the iframe automatically */
|
|
69
|
-
stopAutoResizer: () => void;
|
|
70
|
-
/**
|
|
71
|
-
* Triggers a change in the size of the iframe. If you don't explicitely pass
|
|
72
|
-
* a `newHeight` it will be automatically calculated using the iframe content
|
|
73
|
-
* at the moment
|
|
74
|
-
*/
|
|
75
|
-
updateHeight: (newHeight?: number) => void;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export type { Field, ItemType };
|
|
79
|
-
|
|
80
|
-
export type IntentCtx = InitPropertiesAndMethods;
|
|
81
|
-
export type OnBootCtx = OnBootPropertiesAndMethods;
|
|
82
|
-
export type FieldIntentCtx = InitPropertiesAndMethods & {
|
|
83
|
-
itemType: ItemType;
|
|
84
|
-
};
|
|
85
|
-
export type RenderPageCtx = RenderPagePropertiesAndMethods;
|
|
86
|
-
export type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
|
|
87
|
-
export type RenderAssetSourceCtx = RenderAssetSourcePropertiesAndMethods &
|
|
88
|
-
SizingUtilities;
|
|
89
|
-
export type RenderItemFormSidebarPanelCtx =
|
|
90
|
-
RenderSidebarPanelPropertiesAndMethods & SizingUtilities;
|
|
91
|
-
export type RenderItemFormSidebarCtx = RenderSidebarPropertiesAndMethods &
|
|
92
|
-
SizingUtilities;
|
|
93
|
-
export type RenderItemFormOutletCtx = RenderItemFormOutletPropertiesAndMethods &
|
|
94
|
-
SizingUtilities;
|
|
95
|
-
export type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods &
|
|
96
|
-
SizingUtilities;
|
|
97
|
-
export type RenderManualFieldExtensionConfigScreenCtx =
|
|
98
|
-
RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
|
|
99
|
-
export type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMethods &
|
|
100
|
-
SizingUtilities;
|
|
101
|
-
|
|
102
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
28
|
+
RenderAssetSourceHook,
|
|
29
|
+
renderAssetSourceBootstrapper,
|
|
30
|
+
} from './hooks/renderAssetSource';
|
|
31
|
+
import {
|
|
32
|
+
RenderConfigScreenHook,
|
|
33
|
+
renderConfigScreenBootstrapper,
|
|
34
|
+
} from './hooks/renderConfigScreen';
|
|
35
|
+
import {
|
|
36
|
+
RenderFieldExtensionHook,
|
|
37
|
+
renderFieldExtensionBootstrapper,
|
|
38
|
+
} from './hooks/renderFieldExtension';
|
|
39
|
+
import {
|
|
40
|
+
RenderItemCollectionOutletHook,
|
|
41
|
+
renderItemCollectionOutletBootstrapper,
|
|
42
|
+
} from './hooks/renderItemCollectionOutlet';
|
|
43
|
+
import {
|
|
44
|
+
RenderItemFormOutletHook,
|
|
45
|
+
renderItemFormOutletBootstrapper,
|
|
46
|
+
} from './hooks/renderItemFormOutlet';
|
|
47
|
+
import {
|
|
48
|
+
RenderItemFormSidebarHook,
|
|
49
|
+
renderItemFormSidebarBootstrapper,
|
|
50
|
+
} from './hooks/renderItemFormSidebar';
|
|
51
|
+
import {
|
|
52
|
+
RenderItemFormSidebarPanelHook,
|
|
53
|
+
renderItemFormSidebarPanelBootstrapper,
|
|
54
|
+
} from './hooks/renderItemFormSidebarPanel';
|
|
55
|
+
import {
|
|
56
|
+
RenderManualFieldExtensionConfigScreenHook,
|
|
57
|
+
renderManualFieldExtensionConfigScreenBootstrapper,
|
|
58
|
+
} from './hooks/renderManualFieldExtensionConfigScreen';
|
|
59
|
+
import { RenderModalHook, renderModalBootstrapper } from './hooks/renderModal';
|
|
60
|
+
import { RenderPageHook, renderPageBootstrapper } from './hooks/renderPage';
|
|
61
|
+
import {
|
|
62
|
+
RenderUploadSidebarHook,
|
|
63
|
+
renderUploadSidebarBootstrapper,
|
|
64
|
+
} from './hooks/renderUploadSidebar';
|
|
65
|
+
import {
|
|
66
|
+
RenderUploadSidebarPanelHook,
|
|
67
|
+
renderUploadSidebarPanelBootstrapper,
|
|
68
|
+
} from './hooks/renderUploadSidebarPanel';
|
|
69
|
+
import type { SettingsAreaSidebarItemGroupsHook } from './hooks/settingsAreaSidebarItemGroups';
|
|
70
|
+
import { UploadSidebarPanelsHook } from './hooks/uploadSidebarPanels';
|
|
71
|
+
import { UploadSidebarsHook } from './hooks/uploadSidebars';
|
|
72
|
+
import type { UploadsDropdownActionsHook } from './hooks/uploadsDropdownActions';
|
|
73
|
+
import type { ValidateManualFieldExtensionParametersHook } from './hooks/validateManualFieldExtensionParameters';
|
|
74
|
+
import {
|
|
75
|
+
Bootstrapper,
|
|
76
|
+
ExtractRenderHooks,
|
|
77
|
+
fromOneFieldIntoMultipleAndResultsById,
|
|
78
|
+
omit,
|
|
79
|
+
} from './utils';
|
|
103
80
|
|
|
104
81
|
/** The full options you can pass to the `connect` function */
|
|
105
|
-
export type FullConnectParameters =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* This function will be called before saving a new version of a record. You
|
|
149
|
-
* can stop the action by returning `false`
|
|
150
|
-
*
|
|
151
|
-
* @tag beforeHooks
|
|
152
|
-
*/
|
|
153
|
-
onBeforeItemUpsert: (
|
|
154
|
-
createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema,
|
|
155
|
-
ctx: OnBootCtx,
|
|
156
|
-
) => MaybePromise<boolean>;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Use this function to customize the presentation of a record in records
|
|
160
|
-
* collections and "Single link" or "Multiple links" field
|
|
161
|
-
*
|
|
162
|
-
* @tag presentation
|
|
163
|
-
*/
|
|
164
|
-
buildItemPresentationInfo: (
|
|
165
|
-
item: Item,
|
|
166
|
-
ctx: OnBootCtx,
|
|
167
|
-
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Use this function to customize the initial filters when opening an record
|
|
171
|
-
* selector via a "Single link" or "Multiple links" field
|
|
172
|
-
*
|
|
173
|
-
* @tag locationQuery
|
|
174
|
-
*/
|
|
175
|
-
initialLocationQueryForItemSelector: (
|
|
176
|
-
openerfield: Item,
|
|
177
|
-
itemType: ItemType,
|
|
178
|
-
ctx: OnBootCtx,
|
|
179
|
-
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
183
|
-
* UI
|
|
184
|
-
*
|
|
185
|
-
* @tag pages
|
|
186
|
-
*/
|
|
187
|
-
mainNavigationTabs: (ctx: IntentCtx) => MainNavigationTab[];
|
|
188
|
-
/**
|
|
189
|
-
* Use this function to declare new navigation sections in the Settings Area
|
|
190
|
-
* sidebar
|
|
191
|
-
*
|
|
192
|
-
* @tag pages
|
|
193
|
-
*/
|
|
194
|
-
settingsAreaSidebarItemGroups: (
|
|
195
|
-
ctx: IntentCtx,
|
|
196
|
-
) => SettingsAreaSidebarItemGroup[];
|
|
197
|
-
/**
|
|
198
|
-
* Use this function to declare new navigation items in the Content Area
|
|
199
|
-
* sidebar
|
|
200
|
-
*
|
|
201
|
-
* @tag pages
|
|
202
|
-
*/
|
|
203
|
-
contentAreaSidebarItems: (ctx: IntentCtx) => ContentAreaSidebarItem[];
|
|
204
|
-
/**
|
|
205
|
-
* Use this function to declare new field extensions that users will be able
|
|
206
|
-
* to install manually in some field
|
|
207
|
-
*
|
|
208
|
-
* @tag manualFieldExtensions
|
|
209
|
-
*/
|
|
210
|
-
manualFieldExtensions: (ctx: IntentCtx) => ManualFieldExtension[];
|
|
211
|
-
/**
|
|
212
|
-
* Use this function to declare additional sources to be shown when users want
|
|
213
|
-
* to upload new assets
|
|
214
|
-
*
|
|
215
|
-
* @tag assetSources
|
|
216
|
-
*/
|
|
217
|
-
assetSources: (ctx: IntentCtx) => AssetSource[] | undefined;
|
|
218
|
-
/**
|
|
219
|
-
* Use this function to declare new sidebar panels to be shown when the user
|
|
220
|
-
* edits records of a particular model
|
|
221
|
-
*
|
|
222
|
-
* @tag sidebarPanels
|
|
223
|
-
*/
|
|
224
|
-
itemFormSidebarPanels: (
|
|
225
|
-
itemType: ItemType,
|
|
226
|
-
ctx: IntentCtx,
|
|
227
|
-
) => ItemFormSidebarPanel[];
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Use this function to declare new sidebar to be shown when the user edits
|
|
231
|
-
* records of a particular model
|
|
232
|
-
*
|
|
233
|
-
* @tag sidebarPanels
|
|
234
|
-
*/
|
|
235
|
-
itemFormSidebars: (itemType: ItemType, ctx: IntentCtx) => ItemFormSidebar[];
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Use this function to declare custom outlets to be shown at the top of the
|
|
239
|
-
* record's editing page
|
|
240
|
-
*
|
|
241
|
-
* @tag itemFormOutlets
|
|
242
|
-
*/
|
|
243
|
-
itemFormOutlets: (itemType: ItemType, ctx: IntentCtx) => ItemFormOutlet[];
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Use this function to automatically force one or more field extensions to a
|
|
247
|
-
* particular field
|
|
248
|
-
*
|
|
249
|
-
* @tag forcedFieldExtensions
|
|
250
|
-
*/
|
|
251
|
-
overrideFieldExtensions: (
|
|
252
|
-
field: Field,
|
|
253
|
-
ctx: FieldIntentCtx,
|
|
254
|
-
) => FieldExtensionOverride | undefined;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Use this function to define a number of custom marks for a specific
|
|
258
|
-
* Structured Text field
|
|
259
|
-
*
|
|
260
|
-
* @tag structuredText
|
|
261
|
-
*/
|
|
262
|
-
customMarksForStructuredTextField: (
|
|
263
|
-
field: Field,
|
|
264
|
-
ctx: FieldIntentCtx,
|
|
265
|
-
) => StructuredTextCustomMark[] | undefined;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Use this function to define a number of custom block styles for a specific
|
|
269
|
-
* Structured Text field
|
|
270
|
-
*
|
|
271
|
-
* @tag structuredText
|
|
272
|
-
*/
|
|
273
|
-
customBlockStylesForStructuredTextField: (
|
|
274
|
-
field: Field,
|
|
275
|
-
ctx: FieldIntentCtx,
|
|
276
|
-
) => StructuredTextCustomBlockStyle[] | undefined;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* This function will be called when the plugin needs to render the plugin's
|
|
280
|
-
* configuration form
|
|
281
|
-
*
|
|
282
|
-
* @tag configScreen
|
|
283
|
-
*/
|
|
284
|
-
renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
|
|
285
|
-
/**
|
|
286
|
-
* This function will be called when the plugin needs to render a specific
|
|
287
|
-
* page (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
|
|
288
|
-
* `contentAreaSidebarItems` functions)
|
|
289
|
-
*
|
|
290
|
-
* @tag pages
|
|
291
|
-
*/
|
|
292
|
-
renderPage: (pageId: string, ctx: RenderPageCtx) => void;
|
|
293
|
-
/**
|
|
294
|
-
* This function will be called when the plugin requested to open a modal (see
|
|
295
|
-
* the `openModal` function)
|
|
296
|
-
*
|
|
297
|
-
* @tag modals
|
|
298
|
-
*/
|
|
299
|
-
renderModal: (modalId: string, ctx: RenderModalCtx) => void;
|
|
300
|
-
/**
|
|
301
|
-
* This function will be called when the plugin needs to render a sidebar
|
|
302
|
-
* panel (see the `itemFormSidebarPanels` function)
|
|
303
|
-
*
|
|
304
|
-
* @tag sidebarPanels
|
|
305
|
-
*/
|
|
306
|
-
renderItemFormSidebarPanel: (
|
|
307
|
-
sidebarPaneId: string,
|
|
308
|
-
ctx: RenderItemFormSidebarPanelCtx,
|
|
309
|
-
) => void;
|
|
310
|
-
/**
|
|
311
|
-
* This function will be called when the plugin needs to render a sidebar (see
|
|
312
|
-
* the `itemFormSidebars` function)
|
|
313
|
-
*
|
|
314
|
-
* @tag sidebarPanels
|
|
315
|
-
*/
|
|
316
|
-
renderItemFormSidebar: (
|
|
317
|
-
sidebarId: string,
|
|
318
|
-
ctx: RenderItemFormSidebarCtx,
|
|
319
|
-
) => void;
|
|
320
|
-
/**
|
|
321
|
-
* This function will be called when the plugin needs to render an outlet (see
|
|
322
|
-
* the `itemFormOutlets` function)
|
|
323
|
-
*
|
|
324
|
-
* @tag itemFormOutlets
|
|
325
|
-
*/
|
|
326
|
-
renderItemFormOutlet: (
|
|
327
|
-
itemFormOutletId: string,
|
|
328
|
-
ctx: RenderItemFormOutletCtx,
|
|
329
|
-
) => void;
|
|
330
|
-
/**
|
|
331
|
-
* This function will be called when the user selects one of the plugin's
|
|
332
|
-
* asset sources to upload a new media file.
|
|
333
|
-
*
|
|
334
|
-
* @tag assetSources
|
|
335
|
-
*/
|
|
336
|
-
renderAssetSource: (assetSourceId: string, ctx: RenderAssetSourceCtx) => void;
|
|
337
|
-
/**
|
|
338
|
-
* This function will be called when the plugin needs to render a field
|
|
339
|
-
* extension (see the `manualFieldExtensions` and `overrideFieldExtensions`
|
|
340
|
-
* functions)
|
|
341
|
-
*
|
|
342
|
-
* @tag forcedFieldExtensions
|
|
343
|
-
*/
|
|
344
|
-
renderFieldExtension: (
|
|
345
|
-
fieldExtensionId: string,
|
|
346
|
-
ctx: RenderFieldExtensionCtx,
|
|
347
|
-
) => void;
|
|
348
|
-
/**
|
|
349
|
-
* This function will be called when the plugin needs to render the
|
|
350
|
-
* configuration form for installing a field extension inside a particular
|
|
351
|
-
* field
|
|
352
|
-
*
|
|
353
|
-
* @tag manualFieldExtensions
|
|
354
|
-
*/
|
|
355
|
-
renderManualFieldExtensionConfigScreen: (
|
|
356
|
-
fieldExtensionId: string,
|
|
357
|
-
ctx: RenderManualFieldExtensionConfigScreenCtx,
|
|
358
|
-
) => void;
|
|
359
|
-
/**
|
|
360
|
-
* This function will be called each time the configuration object changes. It
|
|
361
|
-
* must return an object containing possible validation errors
|
|
362
|
-
*
|
|
363
|
-
* @tag manualFieldExtensions
|
|
364
|
-
*/
|
|
365
|
-
validateManualFieldExtensionParameters: (
|
|
366
|
-
fieldExtensionId: string,
|
|
367
|
-
parameters: Record<string, unknown>,
|
|
368
|
-
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
function toMultifield<Result>(
|
|
372
|
-
fn: ((field: Field, ctx: FieldIntentCtx) => Result) | undefined,
|
|
373
|
-
) {
|
|
374
|
-
return (
|
|
375
|
-
fields: Field[],
|
|
376
|
-
ctx: InitPropertiesAndMethods,
|
|
377
|
-
): Record<string, Result> => {
|
|
378
|
-
if (!fn) {
|
|
379
|
-
return {};
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
const result: Record<string, Result> = {};
|
|
383
|
-
|
|
384
|
-
for (const field of fields) {
|
|
385
|
-
const itemType = ctx.itemTypes[
|
|
386
|
-
field.relationships.item_type.data.id
|
|
387
|
-
] as ItemType;
|
|
388
|
-
result[field.id] = fn(field, { ...ctx, itemType });
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return result;
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
type AwaitedReturnType<T extends (...args: any) => any> = Awaited<
|
|
396
|
-
ReturnType<T>
|
|
397
|
-
>;
|
|
398
|
-
|
|
399
|
-
function getMaxScrollHeight() {
|
|
400
|
-
const elements = document.querySelectorAll('body *');
|
|
401
|
-
let maxVal = 0;
|
|
402
|
-
for (let i = 0; i < elements.length; i++) {
|
|
403
|
-
maxVal = Math.max(elements[i].getBoundingClientRect().bottom, maxVal);
|
|
404
|
-
}
|
|
405
|
-
return maxVal;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const buildRenderUtils = (parent: { setHeight: (number: number) => void }) => {
|
|
409
|
-
let oldHeight: null | number = null;
|
|
410
|
-
|
|
411
|
-
const updateHeight = (height?: number) => {
|
|
412
|
-
const realHeight =
|
|
413
|
-
height === undefined
|
|
414
|
-
? Math.max(
|
|
415
|
-
document.body.scrollHeight,
|
|
416
|
-
document.body.offsetHeight,
|
|
417
|
-
document.documentElement.getBoundingClientRect().height,
|
|
418
|
-
getMaxScrollHeight(),
|
|
419
|
-
)
|
|
420
|
-
: height;
|
|
421
|
-
|
|
422
|
-
if (realHeight !== oldHeight) {
|
|
423
|
-
parent.setHeight(realHeight);
|
|
424
|
-
oldHeight = realHeight;
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
let resizeObserver: ResizeObserver | null = null;
|
|
429
|
-
let mutationObserver: MutationObserver | null = null;
|
|
430
|
-
const onMutation = () => updateHeight();
|
|
431
|
-
|
|
432
|
-
const startAutoResizer = () => {
|
|
433
|
-
updateHeight();
|
|
434
|
-
|
|
435
|
-
if (!resizeObserver) {
|
|
436
|
-
resizeObserver = new ResizeObserver(onMutation);
|
|
437
|
-
resizeObserver.observe(document.documentElement);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if (!mutationObserver) {
|
|
441
|
-
mutationObserver = new MutationObserver(onMutation);
|
|
442
|
-
|
|
443
|
-
mutationObserver.observe(window.document.body, {
|
|
444
|
-
attributes: true,
|
|
445
|
-
childList: true,
|
|
446
|
-
subtree: true,
|
|
447
|
-
characterData: true,
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
const stopAutoResizer = () => {
|
|
453
|
-
if (resizeObserver) {
|
|
454
|
-
resizeObserver.disconnect();
|
|
455
|
-
resizeObserver = null;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (mutationObserver) {
|
|
459
|
-
mutationObserver.disconnect();
|
|
460
|
-
mutationObserver = null;
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
return { updateHeight, startAutoResizer, stopAutoResizer };
|
|
465
|
-
};
|
|
82
|
+
export type FullConnectParameters = AssetSourcesHook &
|
|
83
|
+
BuildItemPresentationInfoHook &
|
|
84
|
+
ContentAreaSidebarItemsHook &
|
|
85
|
+
CustomBlockStylesForStructuredTextFieldHook &
|
|
86
|
+
CustomMarksForStructuredTextFieldHook &
|
|
87
|
+
ExecuteFieldDropdownActionHook &
|
|
88
|
+
ExecuteItemFormDropdownActionHook &
|
|
89
|
+
ExecuteItemsDropdownActionHook &
|
|
90
|
+
ExecuteUploadsDropdownActionHook &
|
|
91
|
+
FieldDropdownActionsHook &
|
|
92
|
+
InitialLocationQueryForItemSelectorHook &
|
|
93
|
+
ItemCollectionOutletsHook &
|
|
94
|
+
ItemFormDropdownActionsHook &
|
|
95
|
+
ItemFormOutletsHook &
|
|
96
|
+
ItemFormSidebarPanelsHook &
|
|
97
|
+
ItemFormSidebarsHook &
|
|
98
|
+
ItemsDropdownActionsHook &
|
|
99
|
+
MainNavigationTabsHook &
|
|
100
|
+
ManualFieldExtensionsHook &
|
|
101
|
+
OnBeforeItemsDestroyHook &
|
|
102
|
+
OnBeforeItemsPublishHook &
|
|
103
|
+
OnBeforeItemsUnpublishHook &
|
|
104
|
+
OnBeforeItemUpsertHook &
|
|
105
|
+
OnBootHook &
|
|
106
|
+
OverrideFieldExtensionsHook &
|
|
107
|
+
RenderAssetSourceHook &
|
|
108
|
+
RenderConfigScreenHook &
|
|
109
|
+
RenderFieldExtensionHook &
|
|
110
|
+
RenderItemCollectionOutletHook &
|
|
111
|
+
RenderItemFormOutletHook &
|
|
112
|
+
RenderItemFormSidebarHook &
|
|
113
|
+
RenderItemFormSidebarPanelHook &
|
|
114
|
+
RenderManualFieldExtensionConfigScreenHook &
|
|
115
|
+
RenderModalHook &
|
|
116
|
+
RenderPageHook &
|
|
117
|
+
RenderUploadSidebarHook &
|
|
118
|
+
RenderUploadSidebarPanelHook &
|
|
119
|
+
SettingsAreaSidebarItemGroupsHook &
|
|
120
|
+
UploadsDropdownActionsHook &
|
|
121
|
+
UploadSidebarPanelsHook &
|
|
122
|
+
UploadSidebarsHook &
|
|
123
|
+
ValidateManualFieldExtensionParametersHook;
|
|
466
124
|
|
|
467
125
|
export async function connect(
|
|
468
|
-
|
|
126
|
+
rawConfiguration: Partial<FullConnectParameters> = {},
|
|
469
127
|
): Promise<void> {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
mainNavigationTabs,
|
|
473
|
-
settingsAreaSidebarItemGroups,
|
|
474
|
-
contentAreaSidebarItems,
|
|
475
|
-
manualFieldExtensions,
|
|
476
|
-
itemFormSidebarPanels,
|
|
477
|
-
itemFormSidebars,
|
|
478
|
-
itemFormOutlets,
|
|
479
|
-
} = configuration;
|
|
480
|
-
let listener: ((newSettings: any) => void) | null = null;
|
|
128
|
+
let onChangeListener: ((newSettings: any) => void) | null = null;
|
|
129
|
+
|
|
481
130
|
let callMethodMergingBootCtxExecutor:
|
|
482
131
|
| ((
|
|
483
132
|
methodName: string,
|
|
484
133
|
methodArgs: unknown[],
|
|
485
|
-
|
|
134
|
+
extraCtxProperties: Record<string, unknown>,
|
|
135
|
+
extraCtxMethodKeys: string[],
|
|
136
|
+
methodCallId: string,
|
|
486
137
|
) => void)
|
|
487
138
|
| null = null;
|
|
488
139
|
|
|
140
|
+
const configuration = {
|
|
141
|
+
...rawConfiguration,
|
|
142
|
+
overrideFieldExtensions: fromOneFieldIntoMultipleAndResultsById(
|
|
143
|
+
rawConfiguration.overrideFieldExtensions,
|
|
144
|
+
),
|
|
145
|
+
customMarksForStructuredTextField: fromOneFieldIntoMultipleAndResultsById(
|
|
146
|
+
rawConfiguration.customMarksForStructuredTextField,
|
|
147
|
+
),
|
|
148
|
+
customBlockStylesForStructuredTextField:
|
|
149
|
+
fromOneFieldIntoMultipleAndResultsById(
|
|
150
|
+
rawConfiguration.customBlockStylesForStructuredTextField,
|
|
151
|
+
),
|
|
152
|
+
};
|
|
153
|
+
|
|
489
154
|
const penpalConnection = connectToParent({
|
|
490
155
|
methods: {
|
|
491
|
-
sdkVersion: () => '0.
|
|
156
|
+
sdkVersion: () => '0.3.0',
|
|
492
157
|
implementedHooks: () =>
|
|
493
158
|
Object.fromEntries(
|
|
494
159
|
Object.entries(configuration).map(([key, value]) => {
|
|
@@ -499,32 +164,27 @@ export async function connect(
|
|
|
499
164
|
return [key, value];
|
|
500
165
|
}),
|
|
501
166
|
),
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
configuration.overrideFieldExtensions,
|
|
512
|
-
),
|
|
513
|
-
customMarksForStructuredTextField: toMultifield(
|
|
514
|
-
configuration.customMarksForStructuredTextField,
|
|
515
|
-
),
|
|
516
|
-
customBlockStylesForStructuredTextField: toMultifield(
|
|
517
|
-
configuration.customBlockStylesForStructuredTextField,
|
|
167
|
+
// What hooks should we expose via penpal as direct callable methods by CMS?
|
|
168
|
+
// * all renderXXX hooks will be called via onChange() -> bootstrapper, so not needed
|
|
169
|
+
// * all non-render hooks ending with ctx will be called via callMethodMergingBootCtx(), so not needed
|
|
170
|
+
// * only the non-render hooks NOT ending with ctx need to be directly called by the CMS!
|
|
171
|
+
// In the following lines we're exposing more than needed (all non-render hooks).. but it's OK.
|
|
172
|
+
...Object.fromEntries(
|
|
173
|
+
Object.entries(configuration).filter(
|
|
174
|
+
([key]) => !key.startsWith('render'),
|
|
175
|
+
),
|
|
518
176
|
),
|
|
519
177
|
onChange(newSettings: unknown) {
|
|
520
|
-
if (
|
|
521
|
-
|
|
178
|
+
if (onChangeListener) {
|
|
179
|
+
onChangeListener(newSettings);
|
|
522
180
|
}
|
|
523
181
|
},
|
|
524
182
|
callMethodMergingBootCtx(
|
|
525
183
|
methodName: string,
|
|
526
184
|
methodArgs: unknown[],
|
|
527
|
-
|
|
185
|
+
extraCtxProperties: Record<string, unknown>,
|
|
186
|
+
extraCtxMethodKeys: string[],
|
|
187
|
+
methodCallId: string,
|
|
528
188
|
) {
|
|
529
189
|
if (!callMethodMergingBootCtxExecutor) {
|
|
530
190
|
return null;
|
|
@@ -532,239 +192,88 @@ export async function connect(
|
|
|
532
192
|
return callMethodMergingBootCtxExecutor(
|
|
533
193
|
methodName,
|
|
534
194
|
methodArgs,
|
|
535
|
-
|
|
195
|
+
extraCtxProperties,
|
|
196
|
+
extraCtxMethodKeys,
|
|
197
|
+
methodCallId,
|
|
536
198
|
);
|
|
537
199
|
},
|
|
538
200
|
},
|
|
539
201
|
});
|
|
540
202
|
|
|
541
|
-
const
|
|
542
|
-
const
|
|
203
|
+
const methods = await penpalConnection.promise;
|
|
204
|
+
const initialProperties = await methods.getSettings();
|
|
543
205
|
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
let currentSettings = initialSettings as Settings;
|
|
206
|
+
if (initialProperties.mode === 'onBoot') {
|
|
207
|
+
let currentProperties = initialProperties;
|
|
547
208
|
|
|
548
|
-
|
|
549
|
-
|
|
209
|
+
onChangeListener = (newProperties) => {
|
|
210
|
+
currentProperties = newProperties;
|
|
550
211
|
};
|
|
551
212
|
|
|
552
213
|
callMethodMergingBootCtxExecutor = (
|
|
553
214
|
methodName: string,
|
|
554
215
|
methodArgs: unknown[],
|
|
555
|
-
|
|
216
|
+
extraCtxProperties: Record<string, unknown>,
|
|
217
|
+
extraCtxMethodKeys: string[],
|
|
218
|
+
methodCallId: string,
|
|
556
219
|
) => {
|
|
557
220
|
if (!(methodName in configuration)) {
|
|
558
221
|
return undefined;
|
|
559
222
|
}
|
|
560
223
|
|
|
561
224
|
return (configuration as any)[methodName](...methodArgs, {
|
|
562
|
-
...
|
|
563
|
-
...
|
|
564
|
-
...
|
|
225
|
+
...omit(methods, ['getSettings', 'setHeight']),
|
|
226
|
+
...omit(currentProperties, ['mode', 'bodyPadding']),
|
|
227
|
+
...Object.fromEntries(
|
|
228
|
+
extraCtxMethodKeys.map((methodName) => [
|
|
229
|
+
methodName,
|
|
230
|
+
function createAdditionalMethodProxy(...args: any[]) {
|
|
231
|
+
return (methods as any).callAdditionalCtxMethod(
|
|
232
|
+
methodCallId,
|
|
233
|
+
methodName,
|
|
234
|
+
args,
|
|
235
|
+
);
|
|
236
|
+
},
|
|
237
|
+
]),
|
|
238
|
+
),
|
|
239
|
+
...extraCtxProperties,
|
|
565
240
|
});
|
|
566
241
|
};
|
|
567
242
|
|
|
568
243
|
if (configuration.onBoot) {
|
|
569
244
|
configuration.onBoot({
|
|
570
|
-
...
|
|
571
|
-
...
|
|
245
|
+
...methods,
|
|
246
|
+
...currentProperties,
|
|
572
247
|
});
|
|
573
248
|
}
|
|
574
249
|
}
|
|
575
250
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
const render = (settings: Settings) => {
|
|
580
|
-
if (!configuration.renderPage) {
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
configuration.renderPage(settings.pageId, {
|
|
585
|
-
...parent,
|
|
586
|
-
...settings,
|
|
587
|
-
});
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
listener = render;
|
|
591
|
-
render(initialSettings as Settings);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (isRenderConfigScreenParent(parent, initialSettings)) {
|
|
595
|
-
type Settings = AwaitedReturnType<RenderConfigScreenMethods['getSettings']>;
|
|
596
|
-
|
|
597
|
-
const renderUtils = buildRenderUtils(parent);
|
|
598
|
-
|
|
599
|
-
const render = (settings: Settings) => {
|
|
600
|
-
if (!configuration.renderConfigScreen) {
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
configuration.renderConfigScreen({
|
|
605
|
-
...parent,
|
|
606
|
-
...settings,
|
|
607
|
-
...renderUtils,
|
|
608
|
-
});
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
listener = render;
|
|
612
|
-
render(initialSettings as Settings);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
if (isRenderModalParent(parent, initialSettings)) {
|
|
616
|
-
type Settings = AwaitedReturnType<RenderModalMethods['getSettings']>;
|
|
617
|
-
|
|
618
|
-
const renderUtils = buildRenderUtils(parent);
|
|
619
|
-
|
|
620
|
-
const render = (settings: Settings) => {
|
|
621
|
-
if (!configuration.renderModal) {
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
configuration.renderModal(settings.modalId, {
|
|
626
|
-
...parent,
|
|
627
|
-
...settings,
|
|
628
|
-
...renderUtils,
|
|
629
|
-
});
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
listener = render;
|
|
633
|
-
render(initialSettings as Settings);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
if (isRenderAssetSourceParent(parent, initialSettings)) {
|
|
637
|
-
type Settings = AwaitedReturnType<RenderAssetSourceMethods['getSettings']>;
|
|
638
|
-
|
|
639
|
-
const renderUtils = buildRenderUtils(parent);
|
|
640
|
-
|
|
641
|
-
const render = (settings: Settings) => {
|
|
642
|
-
if (!configuration.renderAssetSource) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
configuration.renderAssetSource(settings.assetSourceId, {
|
|
647
|
-
...parent,
|
|
648
|
-
...settings,
|
|
649
|
-
...renderUtils,
|
|
650
|
-
});
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
listener = render;
|
|
654
|
-
render(initialSettings as Settings);
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
if (isRenderSidebarPanelParent(parent, initialSettings)) {
|
|
658
|
-
type Settings = AwaitedReturnType<RenderSidebarPanelMethods['getSettings']>;
|
|
659
|
-
|
|
660
|
-
const renderUtils = buildRenderUtils(parent);
|
|
661
|
-
|
|
662
|
-
const render = (settings: Settings) => {
|
|
663
|
-
if (!configuration.renderItemFormSidebarPanel) {
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, {
|
|
668
|
-
...parent,
|
|
669
|
-
...settings,
|
|
670
|
-
...renderUtils,
|
|
671
|
-
});
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
listener = render;
|
|
675
|
-
render(initialSettings as Settings);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
if (isRenderSidebarParent(parent, initialSettings)) {
|
|
679
|
-
type Settings = AwaitedReturnType<RenderSidebarMethods['getSettings']>;
|
|
680
|
-
|
|
681
|
-
const renderUtils = buildRenderUtils(parent);
|
|
682
|
-
|
|
683
|
-
const render = (settings: Settings) => {
|
|
684
|
-
if (!configuration.renderItemFormSidebar) {
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
configuration.renderItemFormSidebar(settings.sidebarId, {
|
|
689
|
-
...parent,
|
|
690
|
-
...settings,
|
|
691
|
-
...renderUtils,
|
|
692
|
-
});
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
listener = render;
|
|
696
|
-
render(initialSettings as Settings);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
if (isRenderItemFormOutletParent(parent, initialSettings)) {
|
|
700
|
-
type Settings = AwaitedReturnType<
|
|
701
|
-
RenderItemFormOutletMethods['getSettings']
|
|
702
|
-
>;
|
|
703
|
-
|
|
704
|
-
const renderUtils = buildRenderUtils(parent);
|
|
705
|
-
|
|
706
|
-
const render = (settings: Settings) => {
|
|
707
|
-
if (!configuration.renderItemFormOutlet) {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
configuration.renderItemFormOutlet(settings.itemFormOutletId, {
|
|
712
|
-
...parent,
|
|
713
|
-
...settings,
|
|
714
|
-
...renderUtils,
|
|
715
|
-
});
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
listener = render;
|
|
719
|
-
render(initialSettings as Settings);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
if (isRenderFieldExtensionParent(parent, initialSettings)) {
|
|
723
|
-
type Settings = AwaitedReturnType<
|
|
724
|
-
RenderFieldExtensionMethods['getSettings']
|
|
725
|
-
>;
|
|
726
|
-
|
|
727
|
-
const renderUtils = buildRenderUtils(parent);
|
|
728
|
-
|
|
729
|
-
const render = (settings: Settings) => {
|
|
730
|
-
if (!configuration.renderFieldExtension) {
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
configuration.renderFieldExtension(settings.fieldExtensionId, {
|
|
735
|
-
...parent,
|
|
736
|
-
...settings,
|
|
737
|
-
...renderUtils,
|
|
738
|
-
});
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
listener = render;
|
|
742
|
-
render(initialSettings as Settings);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
if (isRenderManualFieldExtensionConfigScreenParent(parent, initialSettings)) {
|
|
746
|
-
type Settings = AwaitedReturnType<
|
|
747
|
-
RenderManualFieldExtensionConfigScreenMethods['getSettings']
|
|
748
|
-
>;
|
|
749
|
-
|
|
750
|
-
const renderUtils = buildRenderUtils(parent);
|
|
251
|
+
type EnsureAllBootstrappers = {
|
|
252
|
+
[K in keyof ExtractRenderHooks<FullConnectParameters>]: Bootstrapper<K>;
|
|
253
|
+
};
|
|
751
254
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
255
|
+
const availableBootstrappers: EnsureAllBootstrappers = {
|
|
256
|
+
renderAssetSource: renderAssetSourceBootstrapper,
|
|
257
|
+
renderConfigScreen: renderConfigScreenBootstrapper,
|
|
258
|
+
renderFieldExtension: renderFieldExtensionBootstrapper,
|
|
259
|
+
renderItemCollectionOutlet: renderItemCollectionOutletBootstrapper,
|
|
260
|
+
renderItemFormOutlet: renderItemFormOutletBootstrapper,
|
|
261
|
+
renderItemFormSidebar: renderItemFormSidebarBootstrapper,
|
|
262
|
+
renderItemFormSidebarPanel: renderItemFormSidebarPanelBootstrapper,
|
|
263
|
+
renderManualFieldExtensionConfigScreen:
|
|
264
|
+
renderManualFieldExtensionConfigScreenBootstrapper,
|
|
265
|
+
renderModal: renderModalBootstrapper,
|
|
266
|
+
renderPage: renderPageBootstrapper,
|
|
267
|
+
renderUploadSidebar: renderUploadSidebarBootstrapper,
|
|
268
|
+
renderUploadSidebarPanel: renderUploadSidebarPanelBootstrapper,
|
|
269
|
+
};
|
|
756
270
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
{
|
|
760
|
-
...parent,
|
|
761
|
-
...settings,
|
|
762
|
-
...renderUtils,
|
|
763
|
-
},
|
|
764
|
-
);
|
|
765
|
-
};
|
|
271
|
+
for (const bootstrapper of Object.values(availableBootstrappers)) {
|
|
272
|
+
const result = bootstrapper(configuration, methods, initialProperties);
|
|
766
273
|
|
|
767
|
-
|
|
768
|
-
|
|
274
|
+
if (result) {
|
|
275
|
+
onChangeListener = result;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
769
278
|
}
|
|
770
279
|
}
|