UNPKG

gov-gui

Version:

Gov UI Component Library Demo ready Build

33 lines (32 loc) 1.08 kB
// animation-helpers.ts export const injectAnimationCSS = (shadowRoot) => { const href = '/assets/animate.min.css'; const linkEl = document.createElement('link'); linkEl.rel = 'stylesheet'; linkEl.href = href; if (shadowRoot) { if (!shadowRoot.querySelector(`link[href="${href}"]`)) { shadowRoot.appendChild(linkEl); } } else { if (!document.head.querySelector(`link[href="${href}"]`)) { document.head.appendChild(linkEl); } } }; export const getAnimationClasses = ({ animation, animationSpeed, animationDelay }) => { const classes = []; if (animation) { // animate.css typically requires the base class 'animate__animated' plus the specific animation classes.push('animate__animated', `animate__${animation}`); } if (animationSpeed) { classes.push(`animate__${animationSpeed}`); } if (animationDelay) { classes.push(`animate__delay-${animationDelay}`); } return classes.join(' '); }; //# sourceMappingURL=animation-helpers.js.map