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

react-analog-clock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-analog-clock - npm Package Compare versions

Comparing version 1.4.1 to 1.6.0

22

dist/react-analog-clock.js

@@ -200,7 +200,7 @@ (function webpackUniversalModuleDefinition(root, factory) {

var date = new Date();
var date = _this.initializeTime(props.gmtOffset);
_this.state = {
seconds: date.getSeconds(),
minutes: date.getMinutes(),
hour: date.getHours()
seconds: date[2],
minutes: date[1],
hour: date[0]
};

@@ -232,2 +232,13 @@

}, {
key: 'initializeTime',
value: function initializeTime(gmtOffset) {
var now = new Date();
if (gmtOffset && gmtOffset !== 'undefined') {
var offsetNow = new Date(now.valueOf() + parseFloat(gmtOffset) * 1000 * 60 * 60);
return [offsetNow.getUTCHours(), offsetNow.getUTCMinutes(), offsetNow.getUTCSeconds()];
} else {
return [now.getHours(), now.getMinutes(), now.getSeconds()];
}
}
}, {
key: 'render',

@@ -255,3 +266,4 @@ value: function render() {

}),
width: _react.PropTypes.number
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
};

@@ -258,0 +270,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactSexyClock=t(require("react")):e.ReactSexyClock=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Themes=void 0;var i=r(3),u=o(i),s=r(1),c=n(s);t.Themes=c;t.default=u.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.light={background:"#fff",border:"#ececec",center:"#000",seconds:"#f56c6c",minutes:"#ccc",hour:"#000",tick:"#000"},t.dark={background:"#000",border:"#000",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.aqua={background:"#eaeaea",border:"#3dd4c1",center:"#000",seconds:"#f56c6c",minutes:"#9c9c9c",hour:"#000",tick:"#000"},t.lime={background:"#a4f181",border:"#fff",center:"#ccc",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.sherbert={background:"linear-gradient(to left, #fee , #ddefbb)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.navy={background:"linear-gradient(#2a70a0,#102d42)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"}},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),f=n(a),d=r(4),l=n(d),p=r(5),h=n(p),b=r(6),m=r(1),y=function(e){function t(e){o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this)),n=new Date;return r.state={seconds:n.getSeconds(),minutes:n.getMinutes(),hour:n.getHours()},r.styles=(0,b.cssTransform)(h.default,e),r}return u(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this;this.interval=setInterval(function(){e.setState((0,b.updateTime)(e.state))},1e3)}},{key:"componentWillReceiveProps",value:function(e){this.styles=(0,b.cssTransform)(h.default,e)}},{key:"componentWillUnmount",value:function(){clearInterval(this.interval)}},{key:"render",value:function(){return f.default.createElement(l.default,s({},this.state,{styles:this.styles}))}}]),t}(a.Component);t.default=y,y.propTypes={theme:a.PropTypes.shape({background:a.PropTypes.string.isRequired,border:a.PropTypes.string.isRequired,center:a.PropTypes.string.isRequired,seconds:a.PropTypes.string.isRequired,minutes:a.PropTypes.string.isRequired,hour:a.PropTypes.string.isRequired,tick:a.PropTypes.string.isRequired}),width:a.PropTypes.number},y.defaultProps={theme:m.dark,width:400}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e.smallTick,r=e.largeTick,n=[],o=0;60>o;o++){var i=Object.assign({},o%5===0?r:t,{transform:"translateX(-50%) translateY(-100%) rotate("+6*o+"deg)"});n.push(s.default.createElement("span",{key:o,style:i}))}return n}function i(e){var t=e.hour,r=e.minutes,n=e.seconds,i=e.styles,u=Object.assign({},i.second,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*n+1)+"deg)"}),c=Object.assign({},i.minute,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*r+1)+"deg)"}),a=Object.assign({},i.hour,{transform:"translateX(-50%) translateY(-100%) rotate("+(30*t+1.5)+"deg)"});return s.default.createElement("div",{style:i.base},s.default.createElement("div",{"data-testid":"seconds",style:u}),s.default.createElement("div",{"data-testid":"minutes",style:c}),s.default.createElement("div",{"data-testid":"hour",style:a}),s.default.createElement("div",{style:i.center}),o(i))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var u=r(2),s=n(u);i.propTypes={hour:u.PropTypes.number.isRequired,minutes:u.PropTypes.number.isRequired,seconds:u.PropTypes.number.isRequired,styles:u.PropTypes.shape({second:u.PropTypes.object.isRequired,minute:u.PropTypes.object.isRequired,hour:u.PropTypes.object.isRequired}).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={background:function(e){return e.theme.background},backgroundSize:"cover",backgroundPosition:"center",borderRadius:"100%",border:function(e){return e.width/20+"px solid "+e.theme.border},height:function(e){return e.width},position:"relative",width:function(e){return e.width}},n={background:function(e){return e.theme.center},borderRadius:"100%",height:"12px",left:"50%",position:"absolute",top:"50%",transform:"translateX(-50%) translateY(-50%)",width:"12px"},o={left:"50%",position:"absolute",top:"50%",transformOrigin:"50% 100%"},i=Object.assign({},o,{background:function(e){return e.theme.seconds},height:function(e){return Math.floor(.425*e.width)},width:3}),u=Object.assign({},o,{background:function(e){return e.theme.minutes},height:function(e){return Math.floor(.35*e.width)},width:6}),s=Object.assign({},o,{background:function(e){return e.theme.hour},height:function(e){return Math.floor(.2*e.width)},width:8}),c={background:function(e){return e.theme.tick},height:6,left:"50%",position:"absolute",top:6,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:2},a={background:function(e){return e.theme.tick},height:10,left:function(e){return Math.ceil(e.width/2)+2},position:"absolute",top:10,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:4};t.default={base:r,center:n,second:i,minute:u,hour:s,smallTick:c,largeTick:a}},function(e,t){"use strict";function r(e,t){return Object.keys(e).reduce(function(r,n){var o=e[n];return r[n]=Object.keys(o).reduce(function(e,r){return e[r]="function"==typeof o[r]?o[r](t):o[r],e},{}),r},{})}function n(e){var t=e.seconds,r=e.minutes,n=e.hour;return t+=1,60===t&&(t=0,r+=1),60===r&&(r=0,n+=1),12===n&&(n=0),{seconds:t,minutes:r,hour:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.cssTransform=r,t.updateTime=n}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactSexyClock=t(require("react")):e.ReactSexyClock=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Themes=void 0;var i=r(3),u=o(i),s=r(1),c=n(s);t.Themes=c;t.default=u.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.light={background:"#fff",border:"#ececec",center:"#000",seconds:"#f56c6c",minutes:"#ccc",hour:"#000",tick:"#000"},t.dark={background:"#000",border:"#000",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.aqua={background:"#eaeaea",border:"#3dd4c1",center:"#000",seconds:"#f56c6c",minutes:"#9c9c9c",hour:"#000",tick:"#000"},t.lime={background:"#a4f181",border:"#fff",center:"#ccc",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.sherbert={background:"linear-gradient(to left, #fee , #ddefbb)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.navy={background:"linear-gradient(#2a70a0,#102d42)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"}},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),f=n(a),d=r(4),l=n(d),p=r(5),h=n(p),b=r(6),m=r(1),y=function(e){function t(e){o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this)),n=r.initializeTime(e.gmtOffset);return r.state={seconds:n[2],minutes:n[1],hour:n[0]},r.styles=(0,b.cssTransform)(h.default,e),r}return u(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this;this.interval=setInterval(function(){e.setState((0,b.updateTime)(e.state))},1e3)}},{key:"componentWillReceiveProps",value:function(e){this.styles=(0,b.cssTransform)(h.default,e)}},{key:"componentWillUnmount",value:function(){clearInterval(this.interval)}},{key:"initializeTime",value:function(e){var t=new Date;if(e&&"undefined"!==e){var r=new Date(t.valueOf()+1e3*parseFloat(e)*60*60);return[r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds()]}return[t.getHours(),t.getMinutes(),t.getSeconds()]}},{key:"render",value:function(){return f.default.createElement(l.default,s({},this.state,{styles:this.styles}))}}]),t}(a.Component);t.default=y,y.propTypes={theme:a.PropTypes.shape({background:a.PropTypes.string.isRequired,border:a.PropTypes.string.isRequired,center:a.PropTypes.string.isRequired,seconds:a.PropTypes.string.isRequired,minutes:a.PropTypes.string.isRequired,hour:a.PropTypes.string.isRequired,tick:a.PropTypes.string.isRequired}),width:a.PropTypes.number,gmtOffset:a.PropTypes.string},y.defaultProps={theme:m.dark,width:400}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e.smallTick,r=e.largeTick,n=[],o=0;60>o;o++){var i=Object.assign({},o%5===0?r:t,{transform:"translateX(-50%) translateY(-100%) rotate("+6*o+"deg)"});n.push(s.default.createElement("span",{key:o,style:i}))}return n}function i(e){var t=e.hour,r=e.minutes,n=e.seconds,i=e.styles,u=Object.assign({},i.second,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*n+1)+"deg)"}),c=Object.assign({},i.minute,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*r+1)+"deg)"}),a=Object.assign({},i.hour,{transform:"translateX(-50%) translateY(-100%) rotate("+(30*t+1.5)+"deg)"});return s.default.createElement("div",{style:i.base},s.default.createElement("div",{"data-testid":"seconds",style:u}),s.default.createElement("div",{"data-testid":"minutes",style:c}),s.default.createElement("div",{"data-testid":"hour",style:a}),s.default.createElement("div",{style:i.center}),o(i))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var u=r(2),s=n(u);i.propTypes={hour:u.PropTypes.number.isRequired,minutes:u.PropTypes.number.isRequired,seconds:u.PropTypes.number.isRequired,styles:u.PropTypes.shape({second:u.PropTypes.object.isRequired,minute:u.PropTypes.object.isRequired,hour:u.PropTypes.object.isRequired}).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={background:function(e){return e.theme.background},backgroundSize:"cover",backgroundPosition:"center",borderRadius:"100%",border:function(e){return e.width/20+"px solid "+e.theme.border},height:function(e){return e.width},position:"relative",width:function(e){return e.width}},n={background:function(e){return e.theme.center},borderRadius:"100%",height:"12px",left:"50%",position:"absolute",top:"50%",transform:"translateX(-50%) translateY(-50%)",width:"12px"},o={left:"50%",position:"absolute",top:"50%",transformOrigin:"50% 100%"},i=Object.assign({},o,{background:function(e){return e.theme.seconds},height:function(e){return Math.floor(.425*e.width)},width:3}),u=Object.assign({},o,{background:function(e){return e.theme.minutes},height:function(e){return Math.floor(.35*e.width)},width:6}),s=Object.assign({},o,{background:function(e){return e.theme.hour},height:function(e){return Math.floor(.2*e.width)},width:8}),c={background:function(e){return e.theme.tick},height:6,left:"50%",position:"absolute",top:6,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:2},a={background:function(e){return e.theme.tick},height:10,left:function(e){return Math.ceil(e.width/2)+2},position:"absolute",top:10,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:4};t.default={base:r,center:n,second:i,minute:u,hour:s,smallTick:c,largeTick:a}},function(e,t){"use strict";function r(e,t){return Object.keys(e).reduce(function(r,n){var o=e[n];return r[n]=Object.keys(o).reduce(function(e,r){return e[r]="function"==typeof o[r]?o[r](t):o[r],e},{}),r},{})}function n(e){var t=e.seconds,r=e.minutes,n=e.hour;return t+=1,60===t&&(t=0,r+=1),60===r&&(r=0,n+=1),12===n&&(n=0),{seconds:t,minutes:r,hour:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.cssTransform=r,t.updateTime=n}])});

@@ -43,7 +43,7 @@ 'use strict';

var date = new Date();
var date = _this.initializeTime(props.gmtOffset);
_this.state = {
seconds: date.getSeconds(),
minutes: date.getMinutes(),
hour: date.getHours()
seconds: date[2],
minutes: date[1],
hour: date[0]
};

@@ -75,2 +75,13 @@

}, {
key: 'initializeTime',
value: function initializeTime(gmtOffset) {
var now = new Date();
if (gmtOffset && gmtOffset !== 'undefined') {
var offsetNow = new Date(now.valueOf() + parseFloat(gmtOffset) * 1000 * 60 * 60);
return [offsetNow.getUTCHours(), offsetNow.getUTCMinutes(), offsetNow.getUTCSeconds()];
} else {
return [now.getHours(), now.getMinutes(), now.getSeconds()];
}
}
}, {
key: 'render',

@@ -98,3 +109,4 @@ value: function render() {

}),
width: _react.PropTypes.number
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
};

@@ -101,0 +113,0 @@

@@ -43,7 +43,7 @@ 'use strict';

var date = new Date();
var date = _this.initializeTime(props.gmtOffset);
_this.state = {
seconds: date.getSeconds(),
minutes: date.getMinutes(),
hour: date.getHours()
seconds: date[2],
minutes: date[1],
hour: date[0]
};

@@ -75,2 +75,13 @@

}, {
key: 'initializeTime',
value: function initializeTime(gmtOffset) {
var now = new Date();
if (gmtOffset && gmtOffset !== 'undefined') {
var offsetNow = new Date(now.valueOf() + parseFloat(gmtOffset) * 1000 * 60 * 60);
return [offsetNow.getUTCHours(), offsetNow.getUTCMinutes(), offsetNow.getUTCSeconds()];
} else {
return [now.getHours(), now.getMinutes(), now.getSeconds()];
}
}
}, {
key: 'render',

@@ -98,3 +109,4 @@ value: function render() {

}),
width: _react.PropTypes.number
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
};

@@ -101,0 +113,0 @@

{
"name": "react-analog-clock",
"version": "1.4.1",
"version": "1.6.0",
"description": "A themable analog clock component",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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