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
package/src/connect.ts
CHANGED
|
@@ -1,505 +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
|
-
/** Wheter the auto-resizer is currently active or not */
|
|
77
|
-
isAutoResizerActive(): boolean;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type { Field, ItemType };
|
|
81
|
-
|
|
82
|
-
export type IntentCtx = InitPropertiesAndMethods;
|
|
83
|
-
export type OnBootCtx = OnBootPropertiesAndMethods;
|
|
84
|
-
export type FieldIntentCtx = InitPropertiesAndMethods & {
|
|
85
|
-
itemType: ItemType;
|
|
86
|
-
};
|
|
87
|
-
export type RenderPageCtx = RenderPagePropertiesAndMethods;
|
|
88
|
-
export type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
|
|
89
|
-
export type RenderAssetSourceCtx = RenderAssetSourcePropertiesAndMethods &
|
|
90
|
-
SizingUtilities;
|
|
91
|
-
export type RenderItemFormSidebarPanelCtx =
|
|
92
|
-
RenderSidebarPanelPropertiesAndMethods & SizingUtilities;
|
|
93
|
-
export type RenderItemFormSidebarCtx = RenderSidebarPropertiesAndMethods &
|
|
94
|
-
SizingUtilities;
|
|
95
|
-
export type RenderItemFormOutletCtx = RenderItemFormOutletPropertiesAndMethods &
|
|
96
|
-
SizingUtilities;
|
|
97
|
-
export type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods &
|
|
98
|
-
SizingUtilities;
|
|
99
|
-
export type RenderManualFieldExtensionConfigScreenCtx =
|
|
100
|
-
RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
|
|
101
|
-
export type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMethods &
|
|
102
|
-
SizingUtilities;
|
|
103
|
-
|
|
104
|
-
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';
|
|
105
80
|
|
|
106
81
|
/** The full options you can pass to the `connect` function */
|
|
107
|
-
export type FullConnectParameters =
|
|
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
|
-
|
|
149
|
-
/**
|
|
150
|
-
* This function will be called before saving a new version of a record. You
|
|
151
|
-
* can stop the action by returning `false`
|
|
152
|
-
*
|
|
153
|
-
* @tag beforeHooks
|
|
154
|
-
*/
|
|
155
|
-
onBeforeItemUpsert: (
|
|
156
|
-
createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema,
|
|
157
|
-
ctx: OnBootCtx,
|
|
158
|
-
) => MaybePromise<boolean>;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Use this function to customize the presentation of a record in records
|
|
162
|
-
* collections and "Single link" or "Multiple links" field
|
|
163
|
-
*
|
|
164
|
-
* @tag presentation
|
|
165
|
-
*/
|
|
166
|
-
buildItemPresentationInfo: (
|
|
167
|
-
item: Item,
|
|
168
|
-
ctx: OnBootCtx,
|
|
169
|
-
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Use this function to customize the initial filters when opening an record
|
|
173
|
-
* selector via a "Single link" or "Multiple links" field
|
|
174
|
-
*
|
|
175
|
-
* @tag locationQuery
|
|
176
|
-
*/
|
|
177
|
-
initialLocationQueryForItemSelector: (
|
|
178
|
-
openerfield: Item,
|
|
179
|
-
itemType: ItemType,
|
|
180
|
-
ctx: OnBootCtx,
|
|
181
|
-
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
185
|
-
* UI
|
|
186
|
-
*
|
|
187
|
-
* @tag pages
|
|
188
|
-
*/
|
|
189
|
-
mainNavigationTabs: (ctx: IntentCtx) => MainNavigationTab[];
|
|
190
|
-
/**
|
|
191
|
-
* Use this function to declare new navigation sections in the Settings Area
|
|
192
|
-
* sidebar
|
|
193
|
-
*
|
|
194
|
-
* @tag pages
|
|
195
|
-
*/
|
|
196
|
-
settingsAreaSidebarItemGroups: (
|
|
197
|
-
ctx: IntentCtx,
|
|
198
|
-
) => SettingsAreaSidebarItemGroup[];
|
|
199
|
-
/**
|
|
200
|
-
* Use this function to declare new navigation items in the Content Area
|
|
201
|
-
* sidebar
|
|
202
|
-
*
|
|
203
|
-
* @tag pages
|
|
204
|
-
*/
|
|
205
|
-
contentAreaSidebarItems: (ctx: IntentCtx) => ContentAreaSidebarItem[];
|
|
206
|
-
/**
|
|
207
|
-
* Use this function to declare new field extensions that users will be able
|
|
208
|
-
* to install manually in some field
|
|
209
|
-
*
|
|
210
|
-
* @tag manualFieldExtensions
|
|
211
|
-
*/
|
|
212
|
-
manualFieldExtensions: (ctx: IntentCtx) => ManualFieldExtension[];
|
|
213
|
-
/**
|
|
214
|
-
* Use this function to declare additional sources to be shown when users want
|
|
215
|
-
* to upload new assets
|
|
216
|
-
*
|
|
217
|
-
* @tag assetSources
|
|
218
|
-
*/
|
|
219
|
-
assetSources: (ctx: IntentCtx) => AssetSource[] | undefined;
|
|
220
|
-
/**
|
|
221
|
-
* Use this function to declare new sidebar panels to be shown when the user
|
|
222
|
-
* edits records of a particular model
|
|
223
|
-
*
|
|
224
|
-
* @tag sidebarPanels
|
|
225
|
-
*/
|
|
226
|
-
itemFormSidebarPanels: (
|
|
227
|
-
itemType: ItemType,
|
|
228
|
-
ctx: IntentCtx,
|
|
229
|
-
) => ItemFormSidebarPanel[];
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Use this function to declare new sidebar to be shown when the user edits
|
|
233
|
-
* records of a particular model
|
|
234
|
-
*
|
|
235
|
-
* @tag sidebarPanels
|
|
236
|
-
*/
|
|
237
|
-
itemFormSidebars: (itemType: ItemType, ctx: IntentCtx) => ItemFormSidebar[];
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Use this function to declare custom outlets to be shown at the top of the
|
|
241
|
-
* record's editing page
|
|
242
|
-
*
|
|
243
|
-
* @tag itemFormOutlets
|
|
244
|
-
*/
|
|
245
|
-
itemFormOutlets: (itemType: ItemType, ctx: IntentCtx) => ItemFormOutlet[];
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Use this function to automatically force one or more field extensions to a
|
|
249
|
-
* particular field
|
|
250
|
-
*
|
|
251
|
-
* @tag forcedFieldExtensions
|
|
252
|
-
*/
|
|
253
|
-
overrideFieldExtensions: (
|
|
254
|
-
field: Field,
|
|
255
|
-
ctx: FieldIntentCtx,
|
|
256
|
-
) => FieldExtensionOverride | undefined;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Use this function to define a number of custom marks for a specific
|
|
260
|
-
* Structured Text field
|
|
261
|
-
*
|
|
262
|
-
* @tag structuredText
|
|
263
|
-
*/
|
|
264
|
-
customMarksForStructuredTextField: (
|
|
265
|
-
field: Field,
|
|
266
|
-
ctx: FieldIntentCtx,
|
|
267
|
-
) => StructuredTextCustomMark[] | undefined;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Use this function to define a number of custom block styles for a specific
|
|
271
|
-
* Structured Text field
|
|
272
|
-
*
|
|
273
|
-
* @tag structuredText
|
|
274
|
-
*/
|
|
275
|
-
customBlockStylesForStructuredTextField: (
|
|
276
|
-
field: Field,
|
|
277
|
-
ctx: FieldIntentCtx,
|
|
278
|
-
) => StructuredTextCustomBlockStyle[] | undefined;
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* This function will be called when the plugin needs to render the plugin's
|
|
282
|
-
* configuration form
|
|
283
|
-
*
|
|
284
|
-
* @tag configScreen
|
|
285
|
-
*/
|
|
286
|
-
renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
|
|
287
|
-
/**
|
|
288
|
-
* This function will be called when the plugin needs to render a specific
|
|
289
|
-
* page (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
|
|
290
|
-
* `contentAreaSidebarItems` functions)
|
|
291
|
-
*
|
|
292
|
-
* @tag pages
|
|
293
|
-
*/
|
|
294
|
-
renderPage: (pageId: string, ctx: RenderPageCtx) => void;
|
|
295
|
-
/**
|
|
296
|
-
* This function will be called when the plugin requested to open a modal (see
|
|
297
|
-
* the `openModal` function)
|
|
298
|
-
*
|
|
299
|
-
* @tag modals
|
|
300
|
-
*/
|
|
301
|
-
renderModal: (modalId: string, ctx: RenderModalCtx) => void;
|
|
302
|
-
/**
|
|
303
|
-
* This function will be called when the plugin needs to render a sidebar
|
|
304
|
-
* panel (see the `itemFormSidebarPanels` function)
|
|
305
|
-
*
|
|
306
|
-
* @tag sidebarPanels
|
|
307
|
-
*/
|
|
308
|
-
renderItemFormSidebarPanel: (
|
|
309
|
-
sidebarPaneId: string,
|
|
310
|
-
ctx: RenderItemFormSidebarPanelCtx,
|
|
311
|
-
) => void;
|
|
312
|
-
/**
|
|
313
|
-
* This function will be called when the plugin needs to render a sidebar (see
|
|
314
|
-
* the `itemFormSidebars` function)
|
|
315
|
-
*
|
|
316
|
-
* @tag sidebarPanels
|
|
317
|
-
*/
|
|
318
|
-
renderItemFormSidebar: (
|
|
319
|
-
sidebarId: string,
|
|
320
|
-
ctx: RenderItemFormSidebarCtx,
|
|
321
|
-
) => void;
|
|
322
|
-
/**
|
|
323
|
-
* This function will be called when the plugin needs to render an outlet (see
|
|
324
|
-
* the `itemFormOutlets` function)
|
|
325
|
-
*
|
|
326
|
-
* @tag itemFormOutlets
|
|
327
|
-
*/
|
|
328
|
-
renderItemFormOutlet: (
|
|
329
|
-
itemFormOutletId: string,
|
|
330
|
-
ctx: RenderItemFormOutletCtx,
|
|
331
|
-
) => void;
|
|
332
|
-
/**
|
|
333
|
-
* This function will be called when the user selects one of the plugin's
|
|
334
|
-
* asset sources to upload a new media file.
|
|
335
|
-
*
|
|
336
|
-
* @tag assetSources
|
|
337
|
-
*/
|
|
338
|
-
renderAssetSource: (assetSourceId: string, ctx: RenderAssetSourceCtx) => void;
|
|
339
|
-
/**
|
|
340
|
-
* This function will be called when the plugin needs to render a field
|
|
341
|
-
* extension (see the `manualFieldExtensions` and `overrideFieldExtensions`
|
|
342
|
-
* functions)
|
|
343
|
-
*
|
|
344
|
-
* @tag forcedFieldExtensions
|
|
345
|
-
*/
|
|
346
|
-
renderFieldExtension: (
|
|
347
|
-
fieldExtensionId: string,
|
|
348
|
-
ctx: RenderFieldExtensionCtx,
|
|
349
|
-
) => void;
|
|
350
|
-
/**
|
|
351
|
-
* This function will be called when the plugin needs to render the
|
|
352
|
-
* configuration form for installing a field extension inside a particular
|
|
353
|
-
* field
|
|
354
|
-
*
|
|
355
|
-
* @tag manualFieldExtensions
|
|
356
|
-
*/
|
|
357
|
-
renderManualFieldExtensionConfigScreen: (
|
|
358
|
-
fieldExtensionId: string,
|
|
359
|
-
ctx: RenderManualFieldExtensionConfigScreenCtx,
|
|
360
|
-
) => void;
|
|
361
|
-
/**
|
|
362
|
-
* This function will be called each time the configuration object changes. It
|
|
363
|
-
* must return an object containing possible validation errors
|
|
364
|
-
*
|
|
365
|
-
* @tag manualFieldExtensions
|
|
366
|
-
*/
|
|
367
|
-
validateManualFieldExtensionParameters: (
|
|
368
|
-
fieldExtensionId: string,
|
|
369
|
-
parameters: Record<string, unknown>,
|
|
370
|
-
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
function toMultifield<Result>(
|
|
374
|
-
fn: ((field: Field, ctx: FieldIntentCtx) => Result) | undefined,
|
|
375
|
-
) {
|
|
376
|
-
return (
|
|
377
|
-
fields: Field[],
|
|
378
|
-
ctx: InitPropertiesAndMethods,
|
|
379
|
-
): Record<string, Result> => {
|
|
380
|
-
if (!fn) {
|
|
381
|
-
return {};
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const result: Record<string, Result> = {};
|
|
385
|
-
|
|
386
|
-
for (const field of fields) {
|
|
387
|
-
const itemType = ctx.itemTypes[
|
|
388
|
-
field.relationships.item_type.data.id
|
|
389
|
-
] as ItemType;
|
|
390
|
-
result[field.id] = fn(field, { ...ctx, itemType });
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
return result;
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
type AwaitedReturnType<T extends (...args: any) => any> = Awaited<
|
|
398
|
-
ReturnType<T>
|
|
399
|
-
>;
|
|
400
|
-
|
|
401
|
-
function getMaxScrollHeight() {
|
|
402
|
-
const elements = document.querySelectorAll('body *');
|
|
403
|
-
let maxVal = 0;
|
|
404
|
-
for (let i = 0; i < elements.length; i++) {
|
|
405
|
-
maxVal = Math.max(elements[i].getBoundingClientRect().bottom, maxVal);
|
|
406
|
-
}
|
|
407
|
-
return maxVal;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const buildRenderUtils = (parent: {
|
|
411
|
-
setHeight: (number: number) => void;
|
|
412
|
-
}): SizingUtilities => {
|
|
413
|
-
let oldHeight: null | number = null;
|
|
414
|
-
|
|
415
|
-
const updateHeight = (height?: number) => {
|
|
416
|
-
const realHeight =
|
|
417
|
-
height === undefined
|
|
418
|
-
? Math.max(
|
|
419
|
-
document.body.scrollHeight,
|
|
420
|
-
document.body.offsetHeight,
|
|
421
|
-
document.documentElement.getBoundingClientRect().height,
|
|
422
|
-
getMaxScrollHeight(),
|
|
423
|
-
)
|
|
424
|
-
: height;
|
|
425
|
-
|
|
426
|
-
if (realHeight !== oldHeight) {
|
|
427
|
-
parent.setHeight(realHeight);
|
|
428
|
-
oldHeight = realHeight;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
let resizeObserver: ResizeObserver | null = null;
|
|
433
|
-
let mutationObserver: MutationObserver | null = null;
|
|
434
|
-
const onMutation = () => updateHeight();
|
|
435
|
-
|
|
436
|
-
const startAutoResizer = () => {
|
|
437
|
-
updateHeight();
|
|
438
|
-
|
|
439
|
-
if (!resizeObserver) {
|
|
440
|
-
resizeObserver = new ResizeObserver(onMutation);
|
|
441
|
-
resizeObserver.observe(document.documentElement);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (!mutationObserver) {
|
|
445
|
-
mutationObserver = new MutationObserver(onMutation);
|
|
446
|
-
|
|
447
|
-
mutationObserver.observe(window.document.body, {
|
|
448
|
-
attributes: true,
|
|
449
|
-
childList: true,
|
|
450
|
-
subtree: true,
|
|
451
|
-
characterData: true,
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
const stopAutoResizer = () => {
|
|
457
|
-
if (resizeObserver) {
|
|
458
|
-
resizeObserver.disconnect();
|
|
459
|
-
resizeObserver = null;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
if (mutationObserver) {
|
|
463
|
-
mutationObserver.disconnect();
|
|
464
|
-
mutationObserver = null;
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
const isAutoResizerActive = () => Boolean(resizeObserver);
|
|
469
|
-
|
|
470
|
-
return {
|
|
471
|
-
updateHeight,
|
|
472
|
-
startAutoResizer,
|
|
473
|
-
stopAutoResizer,
|
|
474
|
-
isAutoResizerActive,
|
|
475
|
-
};
|
|
476
|
-
};
|
|
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;
|
|
477
124
|
|
|
478
125
|
export async function connect(
|
|
479
|
-
|
|
126
|
+
rawConfiguration: Partial<FullConnectParameters> = {},
|
|
480
127
|
): Promise<void> {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
mainNavigationTabs,
|
|
484
|
-
settingsAreaSidebarItemGroups,
|
|
485
|
-
contentAreaSidebarItems,
|
|
486
|
-
manualFieldExtensions,
|
|
487
|
-
itemFormSidebarPanels,
|
|
488
|
-
itemFormSidebars,
|
|
489
|
-
itemFormOutlets,
|
|
490
|
-
} = configuration;
|
|
491
|
-
let listener: ((newSettings: any) => void) | null = null;
|
|
128
|
+
let onChangeListener: ((newSettings: any) => void) | null = null;
|
|
129
|
+
|
|
492
130
|
let callMethodMergingBootCtxExecutor:
|
|
493
131
|
| ((
|
|
494
132
|
methodName: string,
|
|
495
133
|
methodArgs: unknown[],
|
|
496
|
-
|
|
134
|
+
extraCtxProperties: Record<string, unknown>,
|
|
135
|
+
extraCtxMethodKeys: string[],
|
|
136
|
+
methodCallId: string,
|
|
497
137
|
) => void)
|
|
498
138
|
| null = null;
|
|
499
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
|
+
|
|
500
154
|
const penpalConnection = connectToParent({
|
|
501
155
|
methods: {
|
|
502
|
-
sdkVersion: () => '0.
|
|
156
|
+
sdkVersion: () => '0.3.0',
|
|
503
157
|
implementedHooks: () =>
|
|
504
158
|
Object.fromEntries(
|
|
505
159
|
Object.entries(configuration).map(([key, value]) => {
|
|
@@ -510,32 +164,27 @@ export async function connect(
|
|
|
510
164
|
return [key, value];
|
|
511
165
|
}),
|
|
512
166
|
),
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
configuration.overrideFieldExtensions,
|
|
523
|
-
),
|
|
524
|
-
customMarksForStructuredTextField: toMultifield(
|
|
525
|
-
configuration.customMarksForStructuredTextField,
|
|
526
|
-
),
|
|
527
|
-
customBlockStylesForStructuredTextField: toMultifield(
|
|
528
|
-
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
|
+
),
|
|
529
176
|
),
|
|
530
177
|
onChange(newSettings: unknown) {
|
|
531
|
-
if (
|
|
532
|
-
|
|
178
|
+
if (onChangeListener) {
|
|
179
|
+
onChangeListener(newSettings);
|
|
533
180
|
}
|
|
534
181
|
},
|
|
535
182
|
callMethodMergingBootCtx(
|
|
536
183
|
methodName: string,
|
|
537
184
|
methodArgs: unknown[],
|
|
538
|
-
|
|
185
|
+
extraCtxProperties: Record<string, unknown>,
|
|
186
|
+
extraCtxMethodKeys: string[],
|
|
187
|
+
methodCallId: string,
|
|
539
188
|
) {
|
|
540
189
|
if (!callMethodMergingBootCtxExecutor) {
|
|
541
190
|
return null;
|
|
@@ -543,239 +192,88 @@ export async function connect(
|
|
|
543
192
|
return callMethodMergingBootCtxExecutor(
|
|
544
193
|
methodName,
|
|
545
194
|
methodArgs,
|
|
546
|
-
|
|
195
|
+
extraCtxProperties,
|
|
196
|
+
extraCtxMethodKeys,
|
|
197
|
+
methodCallId,
|
|
547
198
|
);
|
|
548
199
|
},
|
|
549
200
|
},
|
|
550
201
|
});
|
|
551
202
|
|
|
552
|
-
const
|
|
553
|
-
const
|
|
203
|
+
const methods = await penpalConnection.promise;
|
|
204
|
+
const initialProperties = await methods.getSettings();
|
|
554
205
|
|
|
555
|
-
if (
|
|
556
|
-
|
|
557
|
-
let currentSettings = initialSettings as Settings;
|
|
206
|
+
if (initialProperties.mode === 'onBoot') {
|
|
207
|
+
let currentProperties = initialProperties;
|
|
558
208
|
|
|
559
|
-
|
|
560
|
-
|
|
209
|
+
onChangeListener = (newProperties) => {
|
|
210
|
+
currentProperties = newProperties;
|
|
561
211
|
};
|
|
562
212
|
|
|
563
213
|
callMethodMergingBootCtxExecutor = (
|
|
564
214
|
methodName: string,
|
|
565
215
|
methodArgs: unknown[],
|
|
566
|
-
|
|
216
|
+
extraCtxProperties: Record<string, unknown>,
|
|
217
|
+
extraCtxMethodKeys: string[],
|
|
218
|
+
methodCallId: string,
|
|
567
219
|
) => {
|
|
568
220
|
if (!(methodName in configuration)) {
|
|
569
221
|
return undefined;
|
|
570
222
|
}
|
|
571
223
|
|
|
572
224
|
return (configuration as any)[methodName](...methodArgs, {
|
|
573
|
-
...
|
|
574
|
-
...
|
|
575
|
-
...
|
|
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,
|
|
576
240
|
});
|
|
577
241
|
};
|
|
578
242
|
|
|
579
243
|
if (configuration.onBoot) {
|
|
580
244
|
configuration.onBoot({
|
|
581
|
-
...
|
|
582
|
-
...
|
|
245
|
+
...methods,
|
|
246
|
+
...currentProperties,
|
|
583
247
|
});
|
|
584
248
|
}
|
|
585
249
|
}
|
|
586
250
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
const render = (settings: Settings) => {
|
|
591
|
-
if (!configuration.renderPage) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
configuration.renderPage(settings.pageId, {
|
|
596
|
-
...parent,
|
|
597
|
-
...settings,
|
|
598
|
-
});
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
listener = render;
|
|
602
|
-
render(initialSettings as Settings);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
if (isRenderConfigScreenParent(parent, initialSettings)) {
|
|
606
|
-
type Settings = AwaitedReturnType<RenderConfigScreenMethods['getSettings']>;
|
|
607
|
-
|
|
608
|
-
const renderUtils = buildRenderUtils(parent);
|
|
609
|
-
|
|
610
|
-
const render = (settings: Settings) => {
|
|
611
|
-
if (!configuration.renderConfigScreen) {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
configuration.renderConfigScreen({
|
|
616
|
-
...parent,
|
|
617
|
-
...settings,
|
|
618
|
-
...renderUtils,
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
listener = render;
|
|
623
|
-
render(initialSettings as Settings);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
if (isRenderModalParent(parent, initialSettings)) {
|
|
627
|
-
type Settings = AwaitedReturnType<RenderModalMethods['getSettings']>;
|
|
628
|
-
|
|
629
|
-
const renderUtils = buildRenderUtils(parent);
|
|
630
|
-
|
|
631
|
-
const render = (settings: Settings) => {
|
|
632
|
-
if (!configuration.renderModal) {
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
configuration.renderModal(settings.modalId, {
|
|
637
|
-
...parent,
|
|
638
|
-
...settings,
|
|
639
|
-
...renderUtils,
|
|
640
|
-
});
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
listener = render;
|
|
644
|
-
render(initialSettings as Settings);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
if (isRenderAssetSourceParent(parent, initialSettings)) {
|
|
648
|
-
type Settings = AwaitedReturnType<RenderAssetSourceMethods['getSettings']>;
|
|
649
|
-
|
|
650
|
-
const renderUtils = buildRenderUtils(parent);
|
|
651
|
-
|
|
652
|
-
const render = (settings: Settings) => {
|
|
653
|
-
if (!configuration.renderAssetSource) {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
configuration.renderAssetSource(settings.assetSourceId, {
|
|
658
|
-
...parent,
|
|
659
|
-
...settings,
|
|
660
|
-
...renderUtils,
|
|
661
|
-
});
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
listener = render;
|
|
665
|
-
render(initialSettings as Settings);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
if (isRenderSidebarPanelParent(parent, initialSettings)) {
|
|
669
|
-
type Settings = AwaitedReturnType<RenderSidebarPanelMethods['getSettings']>;
|
|
670
|
-
|
|
671
|
-
const renderUtils = buildRenderUtils(parent);
|
|
672
|
-
|
|
673
|
-
const render = (settings: Settings) => {
|
|
674
|
-
if (!configuration.renderItemFormSidebarPanel) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, {
|
|
679
|
-
...parent,
|
|
680
|
-
...settings,
|
|
681
|
-
...renderUtils,
|
|
682
|
-
});
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
listener = render;
|
|
686
|
-
render(initialSettings as Settings);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
if (isRenderSidebarParent(parent, initialSettings)) {
|
|
690
|
-
type Settings = AwaitedReturnType<RenderSidebarMethods['getSettings']>;
|
|
691
|
-
|
|
692
|
-
const renderUtils = buildRenderUtils(parent);
|
|
693
|
-
|
|
694
|
-
const render = (settings: Settings) => {
|
|
695
|
-
if (!configuration.renderItemFormSidebar) {
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
configuration.renderItemFormSidebar(settings.sidebarId, {
|
|
700
|
-
...parent,
|
|
701
|
-
...settings,
|
|
702
|
-
...renderUtils,
|
|
703
|
-
});
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
listener = render;
|
|
707
|
-
render(initialSettings as Settings);
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (isRenderItemFormOutletParent(parent, initialSettings)) {
|
|
711
|
-
type Settings = AwaitedReturnType<
|
|
712
|
-
RenderItemFormOutletMethods['getSettings']
|
|
713
|
-
>;
|
|
714
|
-
|
|
715
|
-
const renderUtils = buildRenderUtils(parent);
|
|
716
|
-
|
|
717
|
-
const render = (settings: Settings) => {
|
|
718
|
-
if (!configuration.renderItemFormOutlet) {
|
|
719
|
-
return;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
configuration.renderItemFormOutlet(settings.itemFormOutletId, {
|
|
723
|
-
...parent,
|
|
724
|
-
...settings,
|
|
725
|
-
...renderUtils,
|
|
726
|
-
});
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
listener = render;
|
|
730
|
-
render(initialSettings as Settings);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
if (isRenderFieldExtensionParent(parent, initialSettings)) {
|
|
734
|
-
type Settings = AwaitedReturnType<
|
|
735
|
-
RenderFieldExtensionMethods['getSettings']
|
|
736
|
-
>;
|
|
737
|
-
|
|
738
|
-
const renderUtils = buildRenderUtils(parent);
|
|
739
|
-
|
|
740
|
-
const render = (settings: Settings) => {
|
|
741
|
-
if (!configuration.renderFieldExtension) {
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
configuration.renderFieldExtension(settings.fieldExtensionId, {
|
|
746
|
-
...parent,
|
|
747
|
-
...settings,
|
|
748
|
-
...renderUtils,
|
|
749
|
-
});
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
listener = render;
|
|
753
|
-
render(initialSettings as Settings);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
if (isRenderManualFieldExtensionConfigScreenParent(parent, initialSettings)) {
|
|
757
|
-
type Settings = AwaitedReturnType<
|
|
758
|
-
RenderManualFieldExtensionConfigScreenMethods['getSettings']
|
|
759
|
-
>;
|
|
760
|
-
|
|
761
|
-
const renderUtils = buildRenderUtils(parent);
|
|
251
|
+
type EnsureAllBootstrappers = {
|
|
252
|
+
[K in keyof ExtractRenderHooks<FullConnectParameters>]: Bootstrapper<K>;
|
|
253
|
+
};
|
|
762
254
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
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
|
+
};
|
|
767
270
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
{
|
|
771
|
-
...parent,
|
|
772
|
-
...settings,
|
|
773
|
-
...renderUtils,
|
|
774
|
-
},
|
|
775
|
-
);
|
|
776
|
-
};
|
|
271
|
+
for (const bootstrapper of Object.values(availableBootstrappers)) {
|
|
272
|
+
const result = bootstrapper(configuration, methods, initialProperties);
|
|
777
273
|
|
|
778
|
-
|
|
779
|
-
|
|
274
|
+
if (result) {
|
|
275
|
+
onChangeListener = result;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
780
278
|
}
|
|
781
279
|
}
|