import { ANIMATE_ATTRIBUTE, ANIMATE_DELAY_ATTRIBUTE } from "#configuration/constants/element.constants"; import type { ElementSpec, ElementTag } from "#types/element.types"; import { createElement } from "#core/factories/element.factory"; export const animated = function animated( tag: T, spec: ElementSpec, effect: string, delay = 0, ): HTMLElementTagNameMap[T] { const element = createElement(tag, spec); element.setAttribute(ANIMATE_ATTRIBUTE, effect); element.setAttribute(ANIMATE_DELAY_ATTRIBUTE, String(delay)); return element; };