@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
17 lines (16 loc) • 607 B
JavaScript
let vue = require("vue");
//#region src/utils/use-emits-as-props.ts
/**
* Attribution: Radix Vue Team
* Retrieved from: https://www.radix-vue.com/utilities/use-emit-as-props.html
*/
function useEmitAsProps(emit) {
const vm = (0, 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[(0, vue.toHandlerKey)((0, vue.camelize)(event))] = (...arg) => emit(event, ...arg);
return result;
}
//#endregion
exports.useEmitAsProps = useEmitAsProps;