import type { IModalOptions } from "../types";
import { waitForElement, parseElementOptions, addEventListenerToSelector, addEscapeListener } from "../utils";
const defaults = {
closeButton: "fixed right-0 top-0 z-50 text-white px-5 close",
};
// if (element.getAttribute('aria-label')) {
// return
// }
// element.setAttribute('aria-label', 'modal')
const Modal = async (element: HTMLElement) => {
const options: IModalOptions = {
id: "v-modal",
size: undefined,
beforeShown: undefined,
imgSrc: undefined,
iframeSrc: undefined,
...parseElementOptions(element),
};
const { size, beforeShown, id, imgSrc, iframeSrc } = options;
let content = element.dataset.html || "";
if (imgSrc) {
content = ``;
}
if (iframeSrc) {
content = ``;
}
const modalHTML = `