import { onMounted, nextTick } from 'vue';
import type { MyHTMLElement } from '../types';

export const useGetEls = (dateEditorId: string, popperId: string) => {
  const elDateEditorEl: { value: MyHTMLElement } = { value: null };
  const elPopperEl: { value: MyHTMLElement } = { value: null };
  onMounted(async () => {
    await nextTick();
    elDateEditorEl.value = document.querySelector(
      `.${dateEditorId}`
    ) as MyHTMLElement;
    elPopperEl.value = document.querySelector(`.${popperId}`) as MyHTMLElement;
  });
  return { elDateEditorEl, elPopperEl };
};
