@rive-app/react-canvas-lite
Advanced tools
Comparing version 4.13.8 to 4.13.9
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@rive-app/canvas-lite");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(e),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((i=i.apply(e,t||[])).next())})}function s(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function u(){var e="undefined"!=typeof window&&"number"==typeof window.devicePixelRatio?window.devicePixelRatio:1;return Math.min(Math.max(1,e),3)}"function"==typeof SuppressedError&&SuppressedError;var c=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}();var l=globalThis.ResizeObserver||c,f=void 0!==globalThis.ResizeObserver,d=!f;function v(t,n){void 0===n&&(n=!0);var i=e.useState({width:0,height:0}),r=i[0],o=i[1];e.useEffect(function(){if("undefined"!=typeof window&&n){var e=function(){o({width:window.innerWidth,height:window.innerHeight})};return d&&(e(),window.addEventListener("resize",e)),function(){return window.removeEventListener("resize",e)}}},[]);var a,s,u,c=e.useRef(new l((a=function(e){f&&o({width:e[e.length-1].contentRect.width,height:e[e.length-1].contentRect.height})},s=0,u=0,function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];clearTimeout(u),u=window.setTimeout(function(){return a.apply(e,t)},s)})));return e.useEffect(function(){var e=c.current;if(n){var i=t.current;return t.current&&f&&e.observe(t.current),function(){e.disconnect(),i&&f&&e.unobserve(i)}}e.disconnect()},[t,c]),r}var h={useDevicePixelRatio:!0,fitCanvasToArtboardHeight:!1,useOffscreenRenderer:!0,shouldResizeCanvasToContainer:!0};function p(e){return Object.assign({},h,e)}function b(t){var n=t.riveLoaded,i=void 0!==n&&n,r=t.canvasElem,o=t.containerRef,a=t.options,s=void 0===a?{}:a,c=t.onCanvasHasResized,l=t.artboardBounds,f=p(s),d=e.useState({height:0,width:0}),h=d[0],b=h.height,w=h.width,y=d[1],g=e.useState({height:0,width:0}),m=g[0],R=m.height,C=m.width,E=g[1],O=e.useState(!0),x=O[0],T=O[1],P=f.fitCanvasToArtboardHeight,L=f.shouldResizeCanvasToContainer,S=f.useDevicePixelRatio,k=f.customDevicePixelRatio,M=v(o,L),z=function(t){var n=t||u(),i=e.useState(n),r=i[0],o=i[1];return e.useEffect(function(){if("undefined"!=typeof window&&"matchMedia"in window){var e=function(){var e=t||u();o(e)},n=window.matchMedia("screen and (resolution: ".concat(r,"dppx)"));return n.hasOwnProperty("addEventListener")?n.addEventListener("change",e):n.addListener(e),function(){n.hasOwnProperty("removeEventListener")?n.removeEventListener("change",e):n.removeListener(e)}}},[r,t]),r}(k),H=null!=l?l:{},j=H.maxX,I=H.maxY,D=e.useCallback(function(){var e,t,n,i,r=null!==(t=null===(e=o.current)||void 0===e?void 0:e.clientWidth)&&void 0!==t?t:0,a=null!==(i=null===(n=o.current)||void 0===n?void 0:n.clientHeight)&&void 0!==i?i:0;return P&&l?{width:r,height:r*(l.maxY/l.maxX)}:{width:r,height:a}},[o,P,j,I]);e.useEffect(function(){if(L&&o.current&&i){var e=D(),t=e.width,n=e.height,a=!1;if(r){var s=t!==w||n!==b;if(f.fitCanvasToArtboardHeight&&s&&(o.current.style.height=n+"px",a=!0),f.useDevicePixelRatio){if(s||(t*z!==C||n*z!==R)){var u=z*t,l=z*n;r.width=u,r.height=l,r.style.width=t+"px",r.style.height=n+"px",E({width:u,height:l}),a=!0}}else s&&(r.width=t,r.height=n,E({width:t,height:n}),a=!0);y({width:t,height:n})}c&&(x||a)&&c&&c(),x&&T(!1)}},[r,o,M,z,D,x,T,R,C,b,w,c,L,P,S,i]),e.useEffect(function(){E({width:0,height:0})},[r])}var w,y=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}(),g=globalThis.IntersectionObserver||y,m=function(){function e(){var e=this;this.elementsMap=new Map,this.onObserved=function(t){t.forEach(function(t){var n=e.elementsMap.get(t.target);n&&n(t)})},this.observer=new g(this.onObserved)}return e.prototype.registerCallback=function(e,t){this.observer.observe(e),this.elementsMap.set(e,t)},e.prototype.removeCallback=function(e){this.observer.unobserve(e),this.elementsMap.delete(e)},e}(),R=function(){return w||(w=new m),w};function C(e){var t=e.setContainerRef,n=e.setCanvasRef,a=e.className,s=void 0===a?"":a,u=e.style,c=e.children,l=o(e,["setContainerRef","setCanvasRef","className","style","children"]),f=r({width:"100%",height:"100%"},u);return i.default.createElement("div",r({ref:t,className:s},!s&&{style:f}),i.default.createElement("canvas",r({ref:n,style:{verticalAlign:"top",width:0,height:0}},l),c))}function E(n,o){void 0===o&&(o={});var a=e.useState(null),s=a[0],u=a[1],c=e.useRef(null),l=e.useState(null),f=l[0],d=l[1],v=Boolean(n),h=p(o),w=e.useCallback(function(){f&&(f.startRendering(),f.resizeToCanvas())},[f]);b({riveLoaded:!!f,canvasElem:s,containerRef:c,options:h,onCanvasHasResized:w,artboardBounds:null==f?void 0:f.bounds});var y=e.useCallback(function(e){null===e&&s&&(s.height=0,s.width=0),u(e)},[]);e.useEffect(function(){if(s&&n&&null==f){var e=h.useOffscreenRenderer,i=new t.Rive(r(r({useOffscreenRenderer:e},n),{canvas:s}));i.on(t.EventType.Load,function(){s?d(i):i.cleanup()})}},[s,v,f]);var g=e.useCallback(function(e){c.current=e},[]),m={observe:e.useCallback(function(e,t){R().registerCallback(e,t)},[]),unobserve:e.useCallback(function(e){R().removeCallback(e)},[])},E=m.observe,O=m.unobserve;e.useEffect(function(){var e,t=!1,n=function(){if(s&&t){var e=s.getBoundingClientRect();e.width>0&&e.height>0&&e.top<(window.innerHeight||document.documentElement.clientHeight)&&e.bottom>0&&e.left<(window.innerWidth||document.documentElement.clientWidth)&&e.right>0&&(null==f||f.startRendering(),t=!1)}};return s&&!1!==h.shouldUseIntersectionObserver&&E(s,function(i){i.isIntersecting?f&&f.startRendering():f&&f.stopRendering(),t=!i.isIntersecting,clearTimeout(e),i.isIntersecting||0!==i.boundingClientRect.width||(e=setTimeout(n,10))}),function(){s&&O(s)}},[E,O,f,s,h.shouldUseIntersectionObserver]),e.useEffect(function(){return function(){f&&(f.cleanup(),d(null))}},[f,s]);var x=null==n?void 0:n.animations;e.useEffect(function(){f&&x&&(f.isPlaying?(f.stop(f.animationNames),f.play(x)):f.isPaused&&(f.stop(f.animationNames),f.pause(x)))},[x,f]);var T=e.useCallback(function(e){return i.default.createElement(C,r({setContainerRef:g,setCanvasRef:y},e))},[y,g]);return{canvas:s,container:c.current,setCanvasRef:y,setContainerRef:g,rive:f,RiveComponent:T}}exports.default=function(e){var t=e.src,n=e.artboard,a=e.animations,s=e.stateMachines,u=e.layout,c=e.useOffscreenRenderer,l=void 0===c||c,f=e.shouldDisableRiveListeners,d=void 0!==f&&f,v=e.shouldResizeCanvasToContainer,h=void 0===v||v,p=e.automaticallyHandleEvents,b=void 0!==p&&p,w=e.children,y=o(e,["src","artboard","animations","stateMachines","layout","useOffscreenRenderer","shouldDisableRiveListeners","shouldResizeCanvasToContainer","automaticallyHandleEvents","children"]),g=E({src:t,artboard:n,animations:a,layout:u,stateMachines:s,autoplay:!0,shouldDisableRiveListeners:d,automaticallyHandleEvents:b},{useOffscreenRenderer:l,shouldResizeCanvasToContainer:h}).RiveComponent;return i.default.createElement(g,r({},y),w)},exports.useResizeCanvas=b,exports.useRive=E,exports.useRiveFile=function(n){var i=this,r=e.useState(null),o=r[0],u=r[1],c=e.useState("idle"),l=c[0],f=c[1];return e.useEffect(function(){var e=null;return a(i,void 0,void 0,function(){return s(this,function(i){try{f("loading"),(e=new t.RiveFile(n)).init(),e.on(t.EventType.Load,function(){null==e||e.getInstance(),u(e),f("success")}),e.on(t.EventType.LoadError,function(){f("failed")}),u(e)}catch(e){console.error(e),f("failed")}return[2]})}),function(){null==e||e.cleanup()}},[n.src,n.buffer]),{riveFile:o,status:l}},exports.useStateMachineInput=function(n,i,r,o){var a=e.useState(null),s=a[0],u=a[1];return e.useEffect(function(){function e(){if(n&&i&&r||u(null),n&&i&&r){var e=n.stateMachineInputs(i);if(e){var t=e.find(function(e){return e.name===r});void 0!==o&&t&&(t.value=o),u(t||null)}}else u(null)}e(),n&&n.on(t.EventType.Load,function(){e()})},[n]),s},Object.keys(t).forEach(function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}); | ||
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@rive-app/canvas-lite");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(e),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((i=i.apply(e,t||[])).next())})}function s(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function u(){var e="undefined"!=typeof window&&"number"==typeof window.devicePixelRatio?window.devicePixelRatio:1;return Math.min(Math.max(1,e),3)}"function"==typeof SuppressedError&&SuppressedError;var c=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}();var l=globalThis.ResizeObserver||c,f=void 0!==globalThis.ResizeObserver,d=!f;function v(t,n){void 0===n&&(n=!0);var i=e.useState({width:0,height:0}),r=i[0],o=i[1];e.useEffect(function(){if("undefined"!=typeof window&&n){var e=function(){o({width:window.innerWidth,height:window.innerHeight})};return d&&(e(),window.addEventListener("resize",e)),function(){return window.removeEventListener("resize",e)}}},[]);var a,s,u,c=e.useRef(new l((a=function(e){f&&o({width:e[e.length-1].contentRect.width,height:e[e.length-1].contentRect.height})},s=0,u=0,function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];clearTimeout(u),u=window.setTimeout(function(){return a.apply(e,t)},s)})));return e.useEffect(function(){var e=c.current;if(n){var i=t.current;return t.current&&f&&e.observe(t.current),function(){e.disconnect(),i&&f&&e.unobserve(i)}}e.disconnect()},[t,c]),r}var h={useDevicePixelRatio:!0,fitCanvasToArtboardHeight:!1,useOffscreenRenderer:!0,shouldResizeCanvasToContainer:!0};function p(e){return Object.assign({},h,e)}function b(t){var n=t.riveLoaded,i=void 0!==n&&n,r=t.canvasElem,o=t.containerRef,a=t.options,s=void 0===a?{}:a,c=t.onCanvasHasResized,l=t.artboardBounds,f=p(s),d=e.useState({height:0,width:0}),h=d[0],b=h.height,w=h.width,y=d[1],g=e.useState({height:0,width:0}),m=g[0],R=m.height,C=m.width,E=g[1],O=e.useState(!0),x=O[0],T=O[1],P=f.fitCanvasToArtboardHeight,L=f.shouldResizeCanvasToContainer,S=f.useDevicePixelRatio,k=f.customDevicePixelRatio,M=v(o,L),j=function(t){var n=t||u(),i=e.useState(n),r=i[0],o=i[1];return e.useEffect(function(){if("undefined"!=typeof window&&"matchMedia"in window){var e=function(){var e=t||u();o(e)},n=window.matchMedia("screen and (resolution: ".concat(r,"dppx)"));return n.hasOwnProperty("addEventListener")?n.addEventListener("change",e):n.addListener(e),function(){n.hasOwnProperty("removeEventListener")?n.removeEventListener("change",e):n.removeListener(e)}}},[r,t]),r}(k),z=null!=l?l:{},H=z.maxX,I=z.maxY,D=e.useCallback(function(){var e,t,n,i,r=null!==(t=null===(e=o.current)||void 0===e?void 0:e.clientWidth)&&void 0!==t?t:0,a=null!==(i=null===(n=o.current)||void 0===n?void 0:n.clientHeight)&&void 0!==i?i:0;return P&&l?{width:r,height:r*(l.maxY/l.maxX)}:{width:r,height:a}},[o,P,H,I]);e.useEffect(function(){if(L&&o.current&&i){var e=D(),t=e.width,n=e.height,a=!1;if(r){var s=t!==w||n!==b;if(f.fitCanvasToArtboardHeight&&s&&(o.current.style.height=n+"px",a=!0),f.useDevicePixelRatio){if(s||(t*j!==C||n*j!==R)){var u=j*t,l=j*n;r.width=u,r.height=l,r.style.width=t+"px",r.style.height=n+"px",E({width:u,height:l}),a=!0}}else s&&(r.width=t,r.height=n,E({width:t,height:n}),a=!0);y({width:t,height:n})}c&&(x||a)&&c&&c(),x&&T(!1)}},[r,o,M,j,D,x,T,R,C,b,w,c,L,P,S,i]),e.useEffect(function(){E({width:0,height:0})},[r])}var w,y=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}(),g=globalThis.IntersectionObserver||y,m=function(){function e(){var e=this;this.elementsMap=new Map,this.onObserved=function(t){t.forEach(function(t){var n=e.elementsMap.get(t.target);n&&n(t)})},this.observer=new g(this.onObserved)}return e.prototype.registerCallback=function(e,t){this.observer.observe(e),this.elementsMap.set(e,t)},e.prototype.removeCallback=function(e){this.observer.unobserve(e),this.elementsMap.delete(e)},e}(),R=function(){return w||(w=new m),w};function C(e){var t=e.setContainerRef,n=e.setCanvasRef,a=e.className,s=void 0===a?"":a,u=e.style,c=e.children,l=o(e,["setContainerRef","setCanvasRef","className","style","children"]),f=r({width:"100%",height:"100%"},u);return i.default.createElement("div",r({ref:t,className:s},!s&&{style:f}),i.default.createElement("canvas",r({ref:n,style:{verticalAlign:"top",width:0,height:0}},l),c))}function E(n,o){void 0===o&&(o={});var a=e.useState(null),s=a[0],u=a[1],c=e.useRef(null),l=e.useState(null),f=l[0],d=l[1],v=Boolean(n),h=p(o),w=e.useCallback(function(){f&&(f.startRendering(),f.resizeToCanvas())},[f]);b({riveLoaded:!!f,canvasElem:s,containerRef:c,options:h,onCanvasHasResized:w,artboardBounds:null==f?void 0:f.bounds});var y=e.useCallback(function(e){null===e&&s&&(s.height=0,s.width=0),u(e)},[]);e.useEffect(function(){if(s&&n&&null==f){var e=h.useOffscreenRenderer,i=new t.Rive(r(r({useOffscreenRenderer:e},n),{canvas:s}));i.on(t.EventType.Load,function(){s?d(i):i.cleanup()})}},[s,v,f]);var g=e.useCallback(function(e){c.current=e},[]),m={observe:e.useCallback(function(e,t){R().registerCallback(e,t)},[]),unobserve:e.useCallback(function(e){R().removeCallback(e)},[])},E=m.observe,O=m.unobserve;e.useEffect(function(){var e,t=!1,n=function(){if(s&&t){var e=s.getBoundingClientRect();e.width>0&&e.height>0&&e.top<(window.innerHeight||document.documentElement.clientHeight)&&e.bottom>0&&e.left<(window.innerWidth||document.documentElement.clientWidth)&&e.right>0&&(null==f||f.startRendering(),t=!1)}};return s&&!1!==h.shouldUseIntersectionObserver&&E(s,function(i){i.isIntersecting?f&&f.startRendering():f&&f.stopRendering(),t=!i.isIntersecting,clearTimeout(e),i.isIntersecting||0!==i.boundingClientRect.width||(e=setTimeout(n,10))}),function(){s&&O(s)}},[E,O,f,s,h.shouldUseIntersectionObserver]),e.useEffect(function(){return function(){f&&(f.cleanup(),d(null))}},[f,s]);var x=null==n?void 0:n.animations;e.useEffect(function(){f&&x&&(f.isPlaying?(f.stop(f.animationNames),f.play(x)):f.isPaused&&(f.stop(f.animationNames),f.pause(x)))},[x,f]);var T=e.useCallback(function(e){return i.default.createElement(C,r({setContainerRef:g,setCanvasRef:y},e))},[y,g]);return{canvas:s,container:c.current,setCanvasRef:y,setContainerRef:g,rive:f,RiveComponent:T}}exports.default=function(e){var t=e.src,n=e.artboard,a=e.animations,s=e.stateMachines,u=e.layout,c=e.useOffscreenRenderer,l=void 0===c||c,f=e.shouldDisableRiveListeners,d=void 0!==f&&f,v=e.shouldResizeCanvasToContainer,h=void 0===v||v,p=e.automaticallyHandleEvents,b=void 0!==p&&p,w=e.children,y=o(e,["src","artboard","animations","stateMachines","layout","useOffscreenRenderer","shouldDisableRiveListeners","shouldResizeCanvasToContainer","automaticallyHandleEvents","children"]),g=E({src:t,artboard:n,animations:a,layout:u,stateMachines:s,autoplay:!0,shouldDisableRiveListeners:d,automaticallyHandleEvents:b},{useOffscreenRenderer:l,shouldResizeCanvasToContainer:h}).RiveComponent;return i.default.createElement(g,r({},y),w)},exports.useResizeCanvas=b,exports.useRive=E,exports.useRiveFile=function(n){var i=this,r=e.useState(null),o=r[0],u=r[1],c=e.useState("idle"),l=c[0],f=c[1];return e.useEffect(function(){var e=null;return a(i,void 0,void 0,function(){return s(this,function(i){try{f("loading"),(e=new t.RiveFile(n)).init(),e.on(t.EventType.Load,function(){null==e||e.getInstance(),u(e),f("success")}),e.on(t.EventType.LoadError,function(){f("failed")}),u(e)}catch(e){console.error(e),f("failed")}return[2]})}),function(){null==e||e.cleanup()}},[n.src,n.buffer]),{riveFile:o,status:l}},exports.useStateMachineInput=function(n,i,r,o){var a=e.useState(null),s=a[0],u=a[1];return e.useEffect(function(){function e(){if(n&&i&&r||u(null),n&&i&&r){var e=n.stateMachineInputs(i);if(e){var t=e.find(function(e){return e.name===r});void 0!==o&&t&&(t.value=o),u(t||null)}}else u(null)}e(),n&&n.on(t.EventType.Load,function(){e()})},[n]),s},Object.keys(t).forEach(function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}); |
@@ -22,3 +22,3 @@ import { Layout } from '@rive-app/canvas-lite'; | ||
/** | ||
* Specify a starting Layout object to set Fill and Alignment for the drawing surface. See docs at https://help.rive.app/runtimes/layout for more on layout configuration. | ||
* Specify a starting Layout object to set Fill and Alignment for the drawing surface. See docs at https://rive.app/community/doc/layout/docBl81zd1GB for more on layout configuration. | ||
*/ | ||
@@ -25,0 +25,0 @@ layout?: Layout; |
{ | ||
"name": "@rive-app/react-canvas-lite", | ||
"version": "4.13.8", | ||
"version": "4.13.9", | ||
"description": "React wrapper around the @rive-app/canvas-lite library", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@rive-app/canvas-lite": "2.20.0" | ||
"@rive-app/canvas-lite": "2.20.1" | ||
}, | ||
@@ -24,0 +24,0 @@ "peerDependencies": { |
@@ -9,2 +9,2 @@ # @rive-app/react-canvas-lite | ||
At this time, this lite version of `@rive-app/react-canvas-lite` will not render [Rive Text](https://help.rive.app/editor/text) onto the canvas. Note however, that even if your Rive file may include Rive Text components when using this package, the canvas will still render the graphic without the Rive Text components. | ||
At this time, this lite version of `@rive-app/react-canvas-lite` will not render Rive Text onto the canvas or play Rive Audio. Note however, that even if your Rive file may include Rive Text components, rendering the graphic should not cause any app errors, or cease to render. The same is true for playing audio. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22045
+ Added@rive-app/canvas-lite@2.20.1(transitive)
- Removed@rive-app/canvas-lite@2.20.0(transitive)
Updated@rive-app/canvas-lite@2.20.1