import { FieldFormatsStart } from '../../../field_formats/public' ; import { CoreSetup , CoreStart , ThemeServiceStart } from '../../../../core/public' ; import { ChartsPluginSetup } from '../../../charts/public' ; import { DataPublicPluginStart } from '../../../data/public' ; import { pieLabelsFunction , pieVisFunction } from '../common' ; import { getPieVisRenderer } from './expression_renderers' ; import { ExpressionPiePluginSetup , ExpressionPiePluginStart , SetupDeps , StartDeps } from './types' ; internal export interface VisTypePieDependencies { theme : ChartsPluginSetup [ 'theme' ] ; palettes : ChartsPluginSetup [ 'palettes' ] ; getStartDeps : ( ) => Promise < { data : DataPublicPluginStart ; fieldFormats : FieldFormatsStart ; kibanaTheme : ThemeServiceStart ; } > ; } export interface VisTypePiePluginStartDependencies { data : DataPublicPluginStart ; fieldFormats : FieldFormatsStart ; } export class ExpressionPiePlugin { public setup ( core , { expressions , charts } ) { expressions . registerFunction ( pieLabelsFunction ) ; expressions . registerFunction ( pieVisFunction ) ; const getStartDeps = async ( ) => { const [ coreStart , deps ] = await core . getStartServices ( ) ; const { data , fieldFormats } = deps ; const { theme : kibanaTheme } = coreStart ; return { data , fieldFormats , kibanaTheme } ; } ; expressions . registerRenderer ( getPieVisRenderer ( { theme : charts . theme , palettes : charts . palettes , getStartDeps } ) ) ; } public start ( core , deps ) { } public stop ( ) { } }