react-use-presentation
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.3.1](https://github.com/olavoparno/react-use-presentation/compare/v1.3.0...v1.3.1) (2021-02-26) | ||
### Bug Fixes | ||
* **project:** test if callback is function ([10ea1a6](https://github.com/olavoparno/react-use-presentation/commit/10ea1a6a68284b280e966d8c858ce4f14822e93e)) | ||
## [1.3.0](https://github.com/olavoparno/react-use-presentation/compare/v1.2.0...v1.3.0) (2021-02-26) | ||
@@ -7,0 +14,0 @@ |
@@ -1,2 +0,2 @@ | ||
import{useState as n,useRef as e,useCallback as t,useEffect as r,cloneElement as o,useMemo as u}from"react"; | ||
import{useState as n,useRef as t,useCallback as e,useEffect as r,cloneElement as o,useMemo as i}from"react"; | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var i=function(){return(i=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function a(n,e,t,r){return new(t||(t=Promise))((function(o,u){function i(n){try{c(r.next(n))}catch(n){u(n)}}function a(n){try{c(r.throw(n))}catch(n){u(n)}}function c(n){var e;n.done?o(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(i,a)}c((r=r.apply(n,e||[])).next())}))}function c(n,e){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=e.call(n,i)}catch(n){u=[6,n],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}export default function(l){var s=this,f=l.framesOptions,v=l.startTrigger,p=void 0!==v&&v,h=l.startDelay,d=void 0===h?void 0:h,b=l.isLoop,y=void 0!==b&&b,m=l.callback,w=void 0===m?void 0:m,g=n(null),x=g[0],k=g[1],O=(null==f?void 0:f.length)||0,P=e(f),T=e(w),F=t((function(n){return a(s,void 0,void 0,(function(){var e,t,r,o;return c(this,(function(u){switch(u.label){case 0:return e=n[0],t=n.slice(1),r=(null===(o=P.current)||void 0===o?void 0:o.indexOf(e))+1,k(i(i({},e),{currentFrame:r})),[4,new Promise((function(n){return setTimeout(n,e.time)}))];case 1:return u.sent(),t.length?[4,F(t)]:[3,3];case 2:u.sent(),u.label=3;case 3:return T.current&&T.current(),[2]}}))}))}),[]),j=t((function(){return a(s,void 0,void 0,(function(){var n;return c(this,(function(e){switch(e.label){case 0:return n=P.current,d?[4,new Promise((function(n){return setTimeout(n,d)}))]:[3,2];case 1:e.sent(),e.label=2;case 2:return[4,F(n)];case 3:return e.sent(),y&&j(),[2]}}))}))}),[d,y,F]);r((function(){O>0&&p&&j()}),[O,p,j]);var S=t((function(n){var e=n.children,t=(null==x?void 0:x.component)||null;return e?t?o(t,void 0,e):null:t}),[x]);return u((function(){var n=(null!=x?x:{currentFrame:0}).currentFrame;return[S,n,O]}),[S,x,O])} | ||
***************************************************************************** */var u=function(){return(u=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function a(n,t,e,r){return new(e||(e=Promise))((function(o,i){function u(n){try{c(r.next(n))}catch(n){i(n)}}function a(n){try{c(r.throw(n))}catch(n){i(n)}}function c(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(u,a)}c((r=r.apply(n,t||[])).next())}))}function c(n,t){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(n,u)}catch(n){i=[6,n],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}export default function(l){var s=this,f=l.framesOptions,v=l.startTrigger,p=void 0!==v&&v,h=l.startDelay,d=void 0===h?void 0:h,b=l.isLoop,y=void 0!==b&&b,m=l.callback,w=void 0===m?void 0:m,g=n(null),x=g[0],k=g[1],O=(null==f?void 0:f.length)||0,P=t(f),T=e((function(){w&&"function"==typeof w&&w()}),[w]),F=e((function(n){return a(s,void 0,void 0,(function(){var t,e,r,o;return c(this,(function(i){switch(i.label){case 0:return t=n[0],e=n.slice(1),r=(null===(o=P.current)||void 0===o?void 0:o.indexOf(t))+1,k(u(u({},t),{currentFrame:r})),[4,new Promise((function(n){return setTimeout(n,t.time)}))];case 1:return i.sent(),e.length?[4,F(e)]:[3,3];case 2:i.sent(),i.label=3;case 3:return w&&T(),[2]}}))}))}),[w,T]),j=e((function(){return a(s,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n=P.current,d?[4,new Promise((function(n){return setTimeout(n,d)}))]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,F(n)];case 3:return t.sent(),y&&j(),[2]}}))}))}),[d,y,F]);r((function(){O>0&&p&&j()}),[O,p,j]);var S=e((function(n){var t=n.children,e=(null==x?void 0:x.component)||null;return t?e?o(e,void 0,t):null:e}),[x]);return i((function(){var n=(null!=x?x:{currentFrame:0}).currentFrame;return[S,n,O]}),[S,x,O])} |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(){return(n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var u in n=arguments[t])Object.prototype.hasOwnProperty.call(n,u)&&(e[u]=n[u]);return e}).apply(this,arguments)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(){return(n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)}; | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function t(e,n,t,r){return new(t||(t=Promise))((function(u,o){function i(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?u(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,a)}c((r=r.apply(e,n||[])).next())}))}function r(e,n){var t,r,u,o,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(u=2&o[0]?r.return:o[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,o[1])).done)return u;switch(r=0,u&&(o=[2&o[0],u.value]),o[0]){case 0:case 1:u=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(u=i.trys,(u=u.length>0&&u[u.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!u||o[1]>u[0]&&o[1]<u[3])){i.label=o[1];break}if(6===o[0]&&i.label<u[1]){i.label=u[1],u=o;break}if(u&&i.label<u[2]){i.label=u[2],i.ops.push(o);break}u[2]&&i.ops.pop(),i.trys.pop();continue}o=n.call(e,i)}catch(e){o=[6,e],r=0}finally{t=u=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}exports.default=function(u){var o=this,i=u.framesOptions,a=u.startTrigger,c=void 0!==a&&a,l=u.startDelay,s=void 0===l?void 0:l,f=u.isLoop,v=void 0!==f&&f,p=u.callback,d=void 0===p?void 0:p,h=e.useState(null),b=h[0],y=h[1],m=(null==i?void 0:i.length)||0,w=e.useRef(i),g=e.useRef(d),k=e.useCallback((function(e){return t(o,void 0,void 0,(function(){var t,u,o,i;return r(this,(function(r){switch(r.label){case 0:return t=e[0],u=e.slice(1),o=(null===(i=w.current)||void 0===i?void 0:i.indexOf(t))+1,y(n(n({},t),{currentFrame:o})),[4,new Promise((function(e){return setTimeout(e,t.time)}))];case 1:return r.sent(),u.length?[4,k(u)]:[3,3];case 2:r.sent(),r.label=3;case 3:return g.current&&g.current(),[2]}}))}))}),[]),x=e.useCallback((function(){return t(o,void 0,void 0,(function(){var e;return r(this,(function(n){switch(n.label){case 0:return e=w.current,s?[4,new Promise((function(e){return setTimeout(e,s)}))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,k(e)];case 3:return n.sent(),v&&x(),[2]}}))}))}),[s,v,k]);e.useEffect((function(){m>0&&c&&x()}),[m,c,x]);var O=e.useCallback((function(n){var t=n.children,r=(null==b?void 0:b.component)||null;return t?r?e.cloneElement(r,void 0,t):null:r}),[b]);return e.useMemo((function(){var e=(null!=b?b:{currentFrame:0}).currentFrame;return[O,e,m]}),[O,b,m])}; | ||
***************************************************************************** */function t(e,n,t,r){return new(t||(t=Promise))((function(o,u){function i(e){try{c(r.next(e))}catch(e){u(e)}}function a(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,a)}c((r=r.apply(e,n||[])).next())}))}function r(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}exports.default=function(o){var u=this,i=o.framesOptions,a=o.startTrigger,c=void 0!==a&&a,l=o.startDelay,s=void 0===l?void 0:l,f=o.isLoop,v=void 0!==f&&f,p=o.callback,d=void 0===p?void 0:p,b=e.useState(null),h=b[0],y=b[1],m=(null==i?void 0:i.length)||0,w=e.useRef(i),g=e.useCallback((function(){d&&"function"==typeof d&&d()}),[d]),k=e.useCallback((function(e){return t(u,void 0,void 0,(function(){var t,o,u,i;return r(this,(function(r){switch(r.label){case 0:return t=e[0],o=e.slice(1),u=(null===(i=w.current)||void 0===i?void 0:i.indexOf(t))+1,y(n(n({},t),{currentFrame:u})),[4,new Promise((function(e){return setTimeout(e,t.time)}))];case 1:return r.sent(),o.length?[4,k(o)]:[3,3];case 2:r.sent(),r.label=3;case 3:return d&&g(),[2]}}))}))}),[d,g]),x=e.useCallback((function(){return t(u,void 0,void 0,(function(){var e;return r(this,(function(n){switch(n.label){case 0:return e=w.current,s?[4,new Promise((function(e){return setTimeout(e,s)}))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,k(e)];case 3:return n.sent(),v&&x(),[2]}}))}))}),[s,v,k]);e.useEffect((function(){m>0&&c&&x()}),[m,c,x]);var O=e.useCallback((function(n){var t=n.children,r=(null==h?void 0:h.component)||null;return t?r?e.cloneElement(r,void 0,t):null:r}),[h]);return e.useMemo((function(){var e=(null!=h?h:{currentFrame:0}).currentFrame;return[O,e,m]}),[O,h,m])}; |
{ | ||
"name": "react-use-presentation", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Create pure HTML (React enriched if you will) presentations.", | ||
@@ -5,0 +5,0 @@ "author": "Olavo Parno", |
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
17973