UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

21 lines (16 loc) 542 B
'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const vue = require('vue'); function useEmitAsProps(emit) { const vm = vue.getCurrentInstance(); const events = vm?.type.emits; const result = {}; if (!events?.length) { console.warn(`No emitted event found. Please check component: ${vm?.type.__name}`); } for (const event of events) { result[vue.toHandlerKey(vue.camelize(event))] = (...arg) => emit(event, ...arg); } return result; } exports.useEmitAsProps = useEmitAsProps;