import type { WatchConfig } from './option/watch' import type { PropsConfig } from './option/props' import type { InjectConfig } from './option/inject' import type { OptionSetupFunction } from './component' export interface OptionBuilder { name?: string // setup?: (this: void, props: Readonly, ctx: SetupContext) => Promise | any | RenderFunction | void data?: Record methods?: Record hooks?: Record computed?: Record watch?: Record props?: Record inject?: Record setup?: OptionSetupFunction beforeCreateCallbacks?: Function[] } export function applyAccessors(optionBuilder: OptionBuilder, dataFunc: (ctx: any) => Map any) | undefined, set: ((v: any) => any) | undefined }>) { optionBuilder.beforeCreateCallbacks ??= [] optionBuilder.beforeCreateCallbacks.push(function (this: any) { const ctx = this const data = dataFunc(ctx) data.forEach((v, n) => { Object.defineProperty(ctx, n, v) }) }) }