{ "version": 3, "sources": ["../../Features/Shared/StaticFiles/Icons/animated-svg.ts"], "sourcesContent": ["/*\r\n Finds animatable SVG elements within an element with class \"animate-svg\",\r\n and triggers animation on hover/focus.\r\n\r\n Requirements:\r\n - The hover/focus target should have class \"animate-svg\"\r\n - It needs to contain at least one SVG element, which in turn has a\r\n nested element (path, etc) with class \"svg-animated-element\"\r\n - The SVG itself should contain CSS animations using keyframes\r\n - Note: It's a good idea to set a limited amount of iterations on the animations\r\n*/\r\n\r\ndocument.querySelectorAll(\".animate-svg\").forEach(element => {\r\n let animations: Animation[] = [];\r\n\r\n element.querySelectorAll(\".svg-animated-element\").forEach(animatedNode => {\r\n animations = [...animations, ...animatedNode.getAnimations()];\r\n });\r\n\r\n // Make sure all animations reset after playing\r\n for (const animation of animations) {\r\n animation.addEventListener(\"finish\", () => animation.cancel());\r\n }\r\n\r\n const triggerAnimation = (e: Event) => {\r\n animations.forEach(\r\n animation => animation.playState !== \"running\" && animation.play()\r\n );\r\n };\r\n\r\n element.addEventListener(\"mouseenter\", triggerAnimation);\r\n element.addEventListener(\"focus\", triggerAnimation);\r\n});\r\n"], "mappings": "mBAYA,SAAS,iBAAiB,cAAc,EAAE,QAAQA,GAAW,CAC3D,IAAIC,EAA0B,CAAC,EAE/BD,EAAQ,iBAAiB,uBAAuB,EAAE,QAAQE,GAAgB,CACxED,EAAa,CAAC,GAAGA,EAAY,GAAGC,EAAa,cAAc,CAAC,CAC9D,CAAC,EAGD,QAAWC,KAAaF,EACtBE,EAAU,iBAAiB,SAAU,IAAMA,EAAU,OAAO,CAAC,EAG/D,IAAMC,EAAoB,GAAa,CACrCH,EAAW,QACTE,GAAaA,EAAU,YAAc,WAAaA,EAAU,KAAK,CACnE,CACF,EAEAH,EAAQ,iBAAiB,aAAcI,CAAgB,EACvDJ,EAAQ,iBAAiB,QAASI,CAAgB,CACpD,CAAC", "names": ["element", "animations", "animatedNode", "animation", "triggerAnimation"] }