@animated-color-icons/lucide-wc
Version:
Animated Lucide icons as Web Components — CSS-only hover animations with two-tone color support. 1,933 icons.
72 lines (61 loc) • 9.64 kB
JavaScript
/**
* <animated-lucide-unlink> Web Component
* Usage: <animated-lucide-unlink size="24" color="#0d9488"></animated-lucide-unlink>
*/
class UnlinkIcon extends HTMLElement {
static get observedAttributes() {
return ['size', 'color', 'primary-color', 'secondary-color', 'stroke-width', 'label'];
}
constructor() {
super();
this.attachShadow({ mode: 'open' });
this._render();
}
attributeChangedCallback() {
this._render();
}
_render() {
const size = this.getAttribute('size') || '24';
const color = this.getAttribute('color') || 'currentColor';
const primaryColor = this.getAttribute('primary-color') || color;
const secondaryColor = this.getAttribute('secondary-color') || color;
const strokeWidth = this.getAttribute('stroke-width') || '2';
const iconLabel = this.getAttribute('label') || 'unlink';
// Build SVG using DOM APIs for safe rendering
const style = document.createElement('style');
style.textContent = ':host { display: inline-flex; } ' + "\n .al-delay-0 { --al-delay: 0ms; }\n .al-delay-1 { --al-delay: 80ms; }\n .al-delay-2 { --al-delay: 160ms; }\n .al-delay-3 { --al-delay: 240ms; }\n .al-delay-4 { --al-delay: 320ms; }\n .al-delay-5 { --al-delay: 400ms; }\n .al-delay-6 { --al-delay: 480ms; }\n .al-delay-7 { --al-delay: 560ms; }\n\n .al-primary { stroke: var(--animated-lucide-primary, var(--al-primary, currentColor)); }\n .al-secondary { stroke: var(--animated-lucide-secondary, var(--al-secondary, currentColor)); }\n\n .al-anim-fill {\n fill: currentColor;\n fill-opacity: 0;\n transition: fill-opacity 500ms ease var(--al-delay, 0ms);\n }\n .animated-lucide-icon:hover .al-anim-fill,\n .al-icon-wrapper:hover .al-anim-fill { fill-opacity: 0.18; }\n\n .al-anim-draw { }\n .animated-lucide-icon:hover .al-anim-draw,\n .al-icon-wrapper:hover .al-anim-draw { animation: al-draw-in 600ms ease var(--al-delay, 0ms) both; }\n @keyframes al-draw-in { 0% { stroke-dashoffset: var(--al-dash-len, 50); } 100% { stroke-dashoffset: 0; } }\n\n .al-anim-draw-line { }\n .animated-lucide-icon:hover .al-anim-draw-line,\n .al-icon-wrapper:hover .al-anim-draw-line { animation: al-draw-line 500ms ease var(--al-delay, 0ms) both; }\n @keyframes al-draw-line { 0% { stroke-dashoffset: var(--al-dash-len, 20); } 100% { stroke-dashoffset: 0; } }\n\n .al-anim-fade { }\n .animated-lucide-icon:hover .al-anim-fade,\n .al-icon-wrapper:hover .al-anim-fade { animation: al-fade-pop 500ms ease var(--al-delay, 0ms) both; }\n @keyframes al-fade-pop { 0% { opacity: 0.3; transform: scale(0.92); } 60% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }\n\n .al-anim-dot-appear { }\n .animated-lucide-icon:hover .al-anim-dot-appear,\n .al-icon-wrapper:hover .al-anim-dot-appear { animation: al-dot-pop 500ms ease 200ms both; }\n @keyframes al-dot-pop { 0% { transform: scale(1); } 40% { transform: scale(0.3); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }\n\n .al-anim-bar { transform-origin: center bottom; }\n .animated-lucide-icon:hover .al-anim-bar,\n .al-icon-wrapper:hover .al-anim-bar { animation: al-bar-grow 600ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--al-delay, 0ms) both; }\n @keyframes al-bar-grow { 0% { transform: scaleY(0.2); } 60% { transform: scaleY(1.08); } 100% { transform: scaleY(1); } }\n\n .al-anim-scale-pop { transform-origin: center; }\n .animated-lucide-icon:hover .al-anim-scale-pop,\n .al-icon-wrapper:hover .al-anim-scale-pop { animation: al-scale-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--al-delay, 0ms) both; }\n @keyframes al-scale-pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }\n\n .al-anim-pulse-element { }\n .animated-lucide-icon:hover .al-anim-pulse-element,\n .al-icon-wrapper:hover .al-anim-pulse-element { animation: al-pulse 0.7s ease-in-out; }\n @keyframes al-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }\n\n .al-anim-gear { transform-origin: 12px 12px; transition: transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-gear,\n .al-icon-wrapper:hover .al-anim-gear { transform: rotate(var(--al-rotation, 90deg)); }\n\n .al-anim-nudge { transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-nudge,\n .al-icon-wrapper:hover .al-anim-nudge { transform: translate(var(--al-tx, 0px), var(--al-ty, 0px)); }\n\n .al-anim-bell-ring { transform-origin: 12px 3px; }\n .animated-lucide-icon:hover .al-anim-bell-ring,\n .al-icon-wrapper:hover .al-anim-bell-ring { animation: al-bell-ring 0.7s ease; }\n @keyframes al-bell-ring { 0% { transform: rotate(0deg); } 12% { transform: rotate(14deg); } 24% { transform: rotate(-12deg); } 36% { transform: rotate(8deg); } 48% { transform: rotate(-5deg); } 60% { transform: rotate(2deg); } 100% { transform: rotate(0deg); } }\n\n .al-anim-heart-beat { transform-origin: 12px 13px; }\n .animated-lucide-icon:hover .al-anim-heart-beat,\n .al-icon-wrapper:hover .al-anim-heart-beat { animation: al-heart-beat 0.8s ease; }\n @keyframes al-heart-beat { 0% { transform: scale(1); } 15% { transform: scale(1.2); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } 60% { transform: scale(1); } }\n\n .al-anim-rocket-lift { transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-rocket-lift,\n .al-icon-wrapper:hover .al-anim-rocket-lift { transform: translate(1px, -1.5px); }\n\n .al-anim-handle-lift { transition: transform 500ms ease var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-handle-lift,\n .al-icon-wrapper:hover .al-anim-handle-lift { transform: translateY(-1.5px); }\n\n .al-anim-page-turn { transform-origin: left center; transition: transform 500ms ease var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-page-turn,\n .al-icon-wrapper:hover .al-anim-page-turn { transform: rotateY(-12deg); }\n\n .al-anim-menu-line { transform-origin: left center; transition: transform 400ms ease var(--al-delay, 0ms); }\n .animated-lucide-icon:hover .al-anim-menu-line,\n .al-icon-wrapper:hover .al-anim-menu-line { transform: scaleX(var(--al-scale-x, 0.7)); }\n\n .al-anim-mail-flap { transform-origin: center top; }\n .animated-lucide-icon:hover .al-anim-mail-flap,\n .al-icon-wrapper:hover .al-anim-mail-flap { animation: al-mail-flap 700ms ease var(--al-delay, 0ms) both; }\n @keyframes al-mail-flap { 0% { transform: rotateX(0deg); } 40% { transform: rotateX(-30deg); } 70% { transform: rotateX(5deg); } 100% { transform: rotateX(0deg); } }\n\n .al-anim-shake { transform-origin: center; }\n .animated-lucide-icon:hover .al-anim-shake,\n .al-icon-wrapper:hover .al-anim-shake { animation: al-shake 600ms ease var(--al-delay, 0ms) both; }\n @keyframes al-shake { 0% { transform: translateX(0) rotate(0deg); } 15% { transform: translateX(-1.5px) rotate(-3deg); } 30% { transform: translateX(1.5px) rotate(3deg); } 45% { transform: translateX(-1px) rotate(-2deg); } 60% { transform: translateX(1px) rotate(2deg); } 75% { transform: translateX(-0.5px) rotate(-1deg); } 100% { transform: translateX(0) rotate(0deg); } }\n\n .al-anim-spin { transform-origin: 12px 12px; }\n .animated-lucide-icon:hover .al-anim-spin,\n .al-icon-wrapper:hover .al-anim-spin { animation: al-spin 700ms cubic-bezier(0.4, 0, 0.2, 1) var(--al-delay, 0ms) both; }\n @keyframes al-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }\n";
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
svg.setAttribute('width', size);
svg.setAttribute('height', size);
svg.setAttribute('viewBox', '0 0 24 24');
svg.setAttribute('fill', 'none');
svg.setAttribute('stroke', color);
svg.setAttribute('stroke-width', strokeWidth);
svg.setAttribute('stroke-linecap', 'round');
svg.setAttribute('stroke-linejoin', 'round');
svg.setAttribute('class', 'animated-lucide-icon animated-lucide-icon-unlink');
svg.setAttribute('style', '--al-primary: ' + primaryColor + '; --al-secondary: ' + secondaryColor);
svg.setAttribute('role', 'img');
svg.setAttribute('aria-label', iconLabel);
const title = document.createElementNS('http://www.w3.org/2000/svg', 'title');
title.textContent = iconLabel;
svg.appendChild(title);
// Static SVG elements from build output — trusted content
const template = document.createElement('template');
template.innerHTML = ` <path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" class="al-primary al-anim-scale-pop al-delay-0" />
<path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" class="al-secondary al-anim-scale-pop al-delay-1" />
<line x1="8" x2="8" y1="2" y2="5" class="al-secondary al-anim-scale-pop al-delay-2" />
<line x1="2" x2="5" y1="8" y2="8" class="al-secondary al-anim-scale-pop al-delay-3" />
<line x1="16" x2="16" y1="19" y2="22" class="al-secondary al-anim-scale-pop al-delay-4" />
<line x1="19" x2="22" y1="16" y2="16" class="al-secondary al-anim-scale-pop al-delay-5" />
`;
svg.appendChild(template.content);
this.shadowRoot.replaceChildren(style, svg);
}
}
if (!customElements.get('animated-lucide-unlink')) {
customElements.define('animated-lucide-unlink', UnlinkIcon);
}
export { UnlinkIcon };
export default UnlinkIcon;