Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-lottie

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-lottie - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

15

dist/vue3-lottie.es.js

@@ -193,10 +193,11 @@ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, normalizeStyle } from "vue";

};
watch(() => props, () => {
if ((props.pauseOnHover || props.playOnHover) && !props.pauseAnimation) {
console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover or playOnHover");
watch(() => props.pauseAnimation, () => {
if ((props.pauseOnHover || props.playOnHover) && props.pauseAnimation) {
console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover and playOnHover");
return;
}
if (!props.pauseOnHover && !props.playOnHover) {
if (props.pauseAnimation && lottieAnimation) {
if (lottieAnimation) {
if (props.pauseAnimation) {
lottieAnimation.pause();
} else if (lottieAnimation && !props.pauseAnimation) {
} else {
lottieAnimation.play();

@@ -336,5 +337,5 @@ }

const plugin = {
version: "2.2.2",
version: "2.2.3",
install
};
export { Vue3Lottie, plugin as default, install };

@@ -1,1 +0,1 @@

(function(r,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue"),require("lottie-web")):typeof define=="function"&&define.amd?define(["exports","vue","lottie-web"],i):(r=typeof globalThis!="undefined"?globalThis:r||self,i(r["vue3-lottie"]={},r.Vue,r.Lottie))})(this,function(r,i,h){"use strict";function g(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var p=g(h),F="",S=(e,o)=>{const t=e.__vccOpts||e;for(const[s,d]of o)t[s]=d;return t};const O=i.defineComponent({props:{animationData:{type:Object,default:()=>({})},animationLink:{type:String,default:""},loop:{type:[Boolean,Number],default:!0},autoPlay:{type:Boolean,default:!0},width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},speed:{type:Number,default:1},delay:{type:Number,default:0},direction:{type:String,default:"forward"},pauseOnHover:{type:Boolean,default:!1},playOnHover:{type:Boolean,default:!1},backgroundColor:{type:String,default:"transparent"},pauseAnimation:{type:Boolean,default:!1}},emits:{onComplete:null,onLoopComplete:null,onEnterFrame:null,onSegmentStart:null,onAnimationLoaded:null},setup(e,{emit:o}){let t=i.ref(null);const s=i.ref("");let d=1;const v=n=>document.querySelector(`[data-id="${n}" ]`)!==null,f=async n=>{let a=e.autoPlay;e.playOnHover&&(a=!1);let l={};if(e.animationData!=={}&&(l=JSON.parse(JSON.stringify(e.animationData))),e.animationLink!="")try{l=await(await fetch(e.animationLink)).json()}catch(c){console.error(c);return}let u=e.loop;typeof u=="number"&&u>0&&(u=u-1),e.delay>0&&(a=!1),t=p.default.loadAnimation({container:n,renderer:"svg",loop:u,autoplay:a,animationData:l}),setTimeout(()=>{a=e.autoPlay,e.playOnHover?t.pause():t.play(),o("onAnimationLoaded")},e.delay),t.setSpeed(e.speed),e.direction==="reverse"&&t.setDirection(-1),e.direction==="normal"&&t.setDirection(1),(e.pauseAnimation||e.playOnHover)&&t.pause(),t.addEventListener("loopComplete",()=>{e.direction==="alternate"&&(t.stop(),d=d*-1,t.setDirection(d),t.play()),o("onLoopComplete")}),t.addEventListener("complete",()=>{o("onComplete")}),t.addEventListener("enterFrame",()=>{o("onEnterFrame")}),t.addEventListener("segmentStart",()=>{o("onSegmentStart")})},H=i.computed(()=>{let n=e.width,a=e.height;return typeof e.width=="number"&&(n=`${e.width}px`),typeof e.height=="number"&&(a=`${e.height}px`),{"--lottie-animation-container-width":n,"--lottie-animation-container-height":a,"--lottie-animation-container-background-color":e.backgroundColor}}),A=()=>{t&&e.pauseOnHover&&t.pause(),t&&e.playOnHover&&t.play()},D=()=>{t&&e.pauseOnHover&&t.play(),t&&e.playOnHover&&t.pause()};i.watch(()=>e,()=>{(e.pauseOnHover||e.playOnHover)&&!e.pauseAnimation&&console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover or playOnHover"),!e.pauseOnHover&&!e.playOnHover&&(e.pauseAnimation&&t?t.pause():t&&!e.pauseAnimation&&t.play())});const E=()=>{t&&t.play()},k=()=>{t&&t.pause()},_=()=>{t&&(console.log(t),t.stop())},C=()=>{t&&t.destroy()},j=(n=1)=>{if(n<=0)throw new Error("Speed must be greater than 0");t&&t.setSpeed(n)},T=n=>{t&&(n==="forward"?t.setDirection(1):n==="reverse"&&t.setDirection(-1))},V=(n,a=!0)=>{t&&t.goToAndStop(n,a)},$=(n,a=!0)=>{t&&t.goToAndPlay(n,a)},B=(n,a=!1)=>{t&&t.playSegments(n,a)},M=(n=!0)=>{t&&t.setSubframe(n)},N=(n=!0)=>{if(t)return t.getDuration(n)},P=n=>{for(var a="",l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",u=l.length,c=0;c<n;c++)a+=l.charAt(Math.floor(Math.random()*u));return a},q=n=>{if(e.pauseOnHover&&e.playOnHover)throw new Error("You cannot set pauseOnHover and playOnHover for Vue3-Lottie at the same time.");if(e.animationLink===""&&e.animationData==={})throw new Error("You must provide either animationLink or animationData");const a=setInterval(()=>{if(v(n)){clearInterval(a);const l=document.querySelector(`[data-id="${n}" ]`);l&&f(l)}},0)};return i.onMounted(async()=>{s.value=P(20),q(s.value)}),{elementid:s,hoverEnded:D,hoverStarted:A,getCurrentStyle:H,play:E,pause:k,stop:_,destroy:C,setSpeed:j,setDirection:T,goToAndStop:V,goToAndPlay:$,playSegments:B,setSubFrame:M,getDuration:N}}}),L=["data-id"];function b(e,o,t,s,d,v){return i.openBlock(),i.createElementBlock("div",{"data-id":e.elementid,class:"lottie-animation-container",style:i.normalizeStyle(e.getCurrentStyle),onMouseenter:o[0]||(o[0]=(...f)=>e.hoverStarted&&e.hoverStarted(...f)),onMouseleave:o[1]||(o[1]=(...f)=>e.hoverEnded&&e.hoverEnded(...f))},null,44,L)}var m=S(O,[["render",b]]);function y(e,o){const t=Object.assign({},{name:"Vue3Lottie"},o);e.component(`${t.name}`,m)}const w={version:"2.2.2",install:y};r.Vue3Lottie=m,r.default=w,r.install=y,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
(function(r,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue"),require("lottie-web")):typeof define=="function"&&define.amd?define(["exports","vue","lottie-web"],i):(r=typeof globalThis!="undefined"?globalThis:r||self,i(r["vue3-lottie"]={},r.Vue,r.Lottie))})(this,function(r,i,h){"use strict";function p(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var g=p(h),F="",S=(t,o)=>{const e=t.__vccOpts||t;for(const[s,d]of o)e[s]=d;return e};const L=i.defineComponent({props:{animationData:{type:Object,default:()=>({})},animationLink:{type:String,default:""},loop:{type:[Boolean,Number],default:!0},autoPlay:{type:Boolean,default:!0},width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},speed:{type:Number,default:1},delay:{type:Number,default:0},direction:{type:String,default:"forward"},pauseOnHover:{type:Boolean,default:!1},playOnHover:{type:Boolean,default:!1},backgroundColor:{type:String,default:"transparent"},pauseAnimation:{type:Boolean,default:!1}},emits:{onComplete:null,onLoopComplete:null,onEnterFrame:null,onSegmentStart:null,onAnimationLoaded:null},setup(t,{emit:o}){let e=i.ref(null);const s=i.ref("");let d=1;const v=n=>document.querySelector(`[data-id="${n}" ]`)!==null,f=async n=>{let a=t.autoPlay;t.playOnHover&&(a=!1);let l={};if(t.animationData!=={}&&(l=JSON.parse(JSON.stringify(t.animationData))),t.animationLink!="")try{l=await(await fetch(t.animationLink)).json()}catch(c){console.error(c);return}let u=t.loop;typeof u=="number"&&u>0&&(u=u-1),t.delay>0&&(a=!1),e=g.default.loadAnimation({container:n,renderer:"svg",loop:u,autoplay:a,animationData:l}),setTimeout(()=>{a=t.autoPlay,t.playOnHover?e.pause():e.play(),o("onAnimationLoaded")},t.delay),e.setSpeed(t.speed),t.direction==="reverse"&&e.setDirection(-1),t.direction==="normal"&&e.setDirection(1),(t.pauseAnimation||t.playOnHover)&&e.pause(),e.addEventListener("loopComplete",()=>{t.direction==="alternate"&&(e.stop(),d=d*-1,e.setDirection(d),e.play()),o("onLoopComplete")}),e.addEventListener("complete",()=>{o("onComplete")}),e.addEventListener("enterFrame",()=>{o("onEnterFrame")}),e.addEventListener("segmentStart",()=>{o("onSegmentStart")})},H=i.computed(()=>{let n=t.width,a=t.height;return typeof t.width=="number"&&(n=`${t.width}px`),typeof t.height=="number"&&(a=`${t.height}px`),{"--lottie-animation-container-width":n,"--lottie-animation-container-height":a,"--lottie-animation-container-background-color":t.backgroundColor}}),A=()=>{e&&t.pauseOnHover&&e.pause(),e&&t.playOnHover&&e.play()},D=()=>{e&&t.pauseOnHover&&e.play(),e&&t.playOnHover&&e.pause()};i.watch(()=>t.pauseAnimation,()=>{if((t.pauseOnHover||t.playOnHover)&&t.pauseAnimation){console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover and playOnHover");return}e&&(t.pauseAnimation?e.pause():e.play())});const E=()=>{e&&e.play()},k=()=>{e&&e.pause()},_=()=>{e&&(console.log(e),e.stop())},C=()=>{e&&e.destroy()},j=(n=1)=>{if(n<=0)throw new Error("Speed must be greater than 0");e&&e.setSpeed(n)},T=n=>{e&&(n==="forward"?e.setDirection(1):n==="reverse"&&e.setDirection(-1))},V=(n,a=!0)=>{e&&e.goToAndStop(n,a)},$=(n,a=!0)=>{e&&e.goToAndPlay(n,a)},B=(n,a=!1)=>{e&&e.playSegments(n,a)},M=(n=!0)=>{e&&e.setSubframe(n)},N=(n=!0)=>{if(e)return e.getDuration(n)},P=n=>{for(var a="",l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",u=l.length,c=0;c<n;c++)a+=l.charAt(Math.floor(Math.random()*u));return a},q=n=>{if(t.pauseOnHover&&t.playOnHover)throw new Error("You cannot set pauseOnHover and playOnHover for Vue3-Lottie at the same time.");if(t.animationLink===""&&t.animationData==={})throw new Error("You must provide either animationLink or animationData");const a=setInterval(()=>{if(v(n)){clearInterval(a);const l=document.querySelector(`[data-id="${n}" ]`);l&&f(l)}},0)};return i.onMounted(async()=>{s.value=P(20),q(s.value)}),{elementid:s,hoverEnded:D,hoverStarted:A,getCurrentStyle:H,play:E,pause:k,stop:_,destroy:C,setSpeed:j,setDirection:T,goToAndStop:V,goToAndPlay:$,playSegments:B,setSubFrame:M,getDuration:N}}}),O=["data-id"];function b(t,o,e,s,d,v){return i.openBlock(),i.createElementBlock("div",{"data-id":t.elementid,class:"lottie-animation-container",style:i.normalizeStyle(t.getCurrentStyle),onMouseenter:o[0]||(o[0]=(...f)=>t.hoverStarted&&t.hoverStarted(...f)),onMouseleave:o[1]||(o[1]=(...f)=>t.hoverEnded&&t.hoverEnded(...f))},null,44,O)}var m=S(L,[["render",b]]);function y(t,o){const e=Object.assign({},{name:"Vue3Lottie"},o);t.component(`${e.name}`,m)}const w={version:"2.2.3",install:y};r.Vue3Lottie=m,r.default=w,r.install=y,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
{
"name": "vue3-lottie",
"version": "2.2.2",
"version": "2.2.3",
"license": "MIT",

@@ -41,3 +41,3 @@ "author": "Sanjay Soundarajan <info@sanjaysoundarajan.dev> (https://sanjaysoundarajan.dev)",

"vue": "3.2.31",
"vue-tsc": "0.31.4",
"vue-tsc": "0.35.2",
"vue-typegen": "0.2.0"

@@ -44,0 +44,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc