diff --git a/web/vue/src/composables/unrefElement/index.ts b/web/vue/src/composables/unrefElement/index.ts index d750541..3089e63 100644 --- a/web/vue/src/composables/unrefElement/index.ts +++ b/web/vue/src/composables/unrefElement/index.ts @@ -9,6 +9,24 @@ export type MaybeComputedElementRef = Ma export type UnRefElementReturn = T extends VueInstance ? Exclude : T | undefined; +/** + * @name unrefElement + * @category Components + * @description Unwraps a Vue element reference to get the underlying instance or DOM element. + * + * @param {MaybeComputedElementRef} elRef - The element reference to unwrap. + * @returns {UnRefElementReturn} - The unwrapped element or undefined. + * + * @example + * const element = useTemplateRef('element'); + * const result = unrefElement(element); // result is the element instance + * + * @example + * const component = useTemplateRef('component'); + * const result = unrefElement(component); // result is the component instance + * + * @since 0.0.11 + */ export function unrefElement(elRef: MaybeComputedElementRef): UnRefElementReturn { const plain = toValue(elRef); return (plain as VueInstance)?.$el ?? plain;