import { type ClassValue, clsx } from 'clsx' import { twMerge } from 'tailwind-merge' import { camelize, getCurrentInstance, toHandlerKey } from 'vue' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } export function useEmitAsProps( emit: (name: Name, ...args: any[]) => void, ) { const vm = getCurrentInstance() const events = vm?.type.emits as Name[] const result: Record = {} if (!events?.length) { console.warn( `No emitted event found. Please check component: ${vm?.type.__name}`, ) } events?.forEach((ev) => { result[toHandlerKey(camelize(ev))] = (...arg: any) => emit(ev, ...arg) }) return result }