import React from 'react' import { PluginStackInjectProps, PluginStackWrapperProps } from '@ui-schema/ui-schema/PluginStack' import { WidgetProps } from '@ui-schema/ui-schema/Widget' import { UIMetaContext } from '@ui-schema/ui-schema/UIMeta' import { StoreKeys, WithValue } from '@ui-schema/ui-schema/UIStore' import { StoreSchemaType } from '@ui-schema/ui-schema/CommonTypings' export type PluginStackRootOrNestedProps = { isRoot: true } | { isRoot?: false // all indices of the current widget, must be set for nested plugins storeKeys: StoreKeys // `parentSchema` will only be `undefined` in the root level of a schema // todo: should this be typed differently between "props/passing-down" and "consuming/usages"? parentSchema: StoreSchemaType | undefined } // todo: add also generic widgets here? export type AppliedPluginStackProps = Omit & Partial & Partial> & PluginStackRootOrNestedProps export function applyPluginStack( CustomWidget: React.ComponentType ): (props: AppliedPluginStackProps & PPlugin) => React.ReactElement export function injectPluginStack( Wrapper: React.ComponentType, CustomWidget?: React.ComponentType, ): (props: AppliedPluginStackProps & PPlugin) => React.ReactElement