directional-hover
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -1,1 +0,1 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"Direction",(function(){return s}));n(1);function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=-1,s=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,"initClass",(function(){return n.$els.map((function(t){return t.classList.add("__direction_item")}))})),i(this,"updateDir",(function(t){var e=n.getDir(t);n.dir!==e&&(n.dir=e,n.updateClass(t),n.onUpdate&&n.onUpdate(t))})),i(this,"out",(function(t){n.dir=a,n.removeClass(t)})),this.classes=["__top","__right","__bottom","__left"],this.onUpdate="function"==typeof e.onUpdate?e.onUpdate:null,this.$els=r(e.$els),this.dir=a,this.initClass(),this.bindEvent()}var e,n,s;return e=t,(n=[{key:"bindEvent",value:function(){var t=this;this.$els.map((function(e){e.addEventListener("mouseleave",t.out),e.addEventListener("mousemove",t.updateDir)}))}},{key:"unbindEvent",value:function(){var t=this;this.$els.map((function(e){e.removeEventListener("mouseleave",t.out),e.removeEventListener("mousemove",t.updateDir)}))}},{key:"getDir",value:function(t){var e=t.currentTarget.getBoundingClientRect(),n=e.left+e.width/2,r=e.top+e.height/2,o=(t.pageX-n)*(e.width>e.height?e.height/e.width:1),i=-(t.pageY-r)*(e.height>e.width?e.width/e.height:1);return Math.round((Math.atan2(o,i)+Math.PI)/(Math.PI/2)+2)%4}},{key:"updateClass",value:function(t){this.removeClass(t),this.currentClass&&t.currentTarget.classList.add(this.currentClass)}},{key:"removeClass",value:function(t){this.classes.forEach((function(e){return t.currentTarget.classList.remove(e)}))}},{key:"currentClass",get:function(){return this.classes[this.dir]}}])&&o(e.prototype,n),s&&o(e,s),t}();e.default=s},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={insert:"head",singleton:!1};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".__direction_item{box-shadow:0px 0px 10px 0px rgba(0,0,0,0.7);perspective:2000px;perspective-origin:50% 50%;transition:.5s box-shadow}.__direction_item>*{transition:.5s transform;transform:scale(1) rotateX(0deg) rotateY(0deg)}.__direction_item.__top{box-shadow:0px 25px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__top>*{transform:scale(1.1) rotateX(10deg) rotateY(0deg)}.__direction_item.__bottom{box-shadow:0px -25px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__bottom>*{transform:scale(1.1) rotateX(-10deg) rotateY(0deg)}.__direction_item.__right{box-shadow:-25px 0px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__right>*{transform:scale(1.1) rotateX(0deg) rotateY(10deg)}.__direction_item.__left{box-shadow:25px 0px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__left>*{transform:scale(1.1) rotateX(0deg) rotateY(-10deg)}\n",""])},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(u," */")),i=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot).concat(t," */")}));return[n].concat(i).concat([o]).join("\n")}var a,s,u;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(n,"}"):n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(r[i]=!0)}for(var a=0;a<t.length;a++){var s=t[a];null!=s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="(".concat(s[2],") and (").concat(n,")")),e.push(s))}},e}},function(t,e,n){"use strict";var r,o={},i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}();function s(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function u(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id],a=0;if(i){for(i.refs++;a<i.parts.length;a++)i.parts[a](r.parts[a]);for(;a<r.parts.length;a++)i.parts.push(m(r.parts[a],e))}else{for(var s=[];a<r.parts.length;a++)s.push(m(r.parts[a],e));o[r.id]={id:r.id,refs:1,parts:s}}}}function c(t){var e=document.createElement("style");if(void 0===t.attributes.nonce){var r=n.nc;r&&(t.attributes.nonce=r)}if(Object.keys(t.attributes).forEach((function(n){e.setAttribute(n,t.attributes[n])})),"function"==typeof t.insert)t.insert(e);else{var o=a(t.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(e)}return e}var l,f=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=f(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function p(t,e,n){var r=n.css,o=n.media,i=n.sourceMap;if(o&&t.setAttribute("media",o),i&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var h=null,v=0;function m(t,e){var n,r,o;if(e.singleton){var i=v++;n=h||(h=c(e)),r=d.bind(null,n,i,!1),o=d.bind(null,n,i,!0)}else n=c(e),r=p.bind(null,n,e),o=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){(e=e||{}).attributes="object"==typeof e.attributes?e.attributes:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=i());var n=s(t,e);return u(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var a=n[i],c=o[a.id];c&&(c.refs--,r.push(c))}t&&u(s(t,e),e);for(var l=0;l<r.length;l++){var f=r[l];if(0===f.refs){for(var d=0;d<f.parts.length;d++)f.parts[d]();delete o[f.id]}}}}}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"Direction",(function(){return c}));n(1);function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"initClass",(function(){return n.$els.map((function(e){return e.classList.add("__direction_item")}))})),a(this,"updateDir",(function(e){var t=n.getDir(e);n.dir!==t&&(n.dir=t,n.updateClass(e),n.onUpdate&&n.onUpdate(e))})),a(this,"out",(function(e){n.dir=-1,n.removeClass(e)})),this.classes=["__top","__right","__bottom","__left"],this.onUpdate="function"==typeof t.onUpdate?t.onUpdate:null,this.$els=r(t.$els),this.dir=-1,this.initClass(),this.bindEvent()}var t,n,o;return t=e,(n=[{key:"bindEvent",value:function(){var e=this;this.$els.map((function(t){t.addEventListener("mouseleave",e.out),t.addEventListener("mousemove",e.updateDir)}))}},{key:"unbindEvent",value:function(){var e=this;this.$els.map((function(t){t.removeEventListener("mouseleave",e.out),t.removeEventListener("mousemove",e.updateDir)}))}},{key:"getDir",value:function(e){var t=e.currentTarget.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,o=(e.pageX-n)*(t.width>t.height?t.height/t.width:1),i=-(e.pageY-r)*(t.height>t.width?t.width/t.height:1);return Math.round((Math.atan2(o,i)+Math.PI)/(Math.PI/2)+2)%4}},{key:"updateClass",value:function(e){this.removeClass(e),this.currentClass&&e.currentTarget.classList.add(this.currentClass)}},{key:"removeClass",value:function(e){this.classes.forEach((function(t){return e.currentTarget.classList.remove(t)}))}},{key:"currentClass",get:function(){return this.classes[this.dir]}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=c},function(e,t,n){var r=n(2),o=n(3);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};r(o,i);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function c(e){for(var t=-1,n=0;n<a.length;n++)if(a[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},r=[],o=0;o<e.length;o++){var i=e[o],s=t.base?i[0]+t.base:i[0],u=n[s]||0,f="".concat(s," ").concat(u);n[s]=u+1;var l=c(f),d={css:i[1],media:i[2],sourceMap:i[3]};-1!==l?(a[l].references++,a[l].updater(d)):a.push({identifier:f,updater:m(d,t),references:1}),r.push(f)}return r}function u(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var o=n.nc;o&&(r.nonce=o)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var a=i(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var f,l=(f=[],function(e,t){return f[e]=t,f.filter(Boolean).join("\n")});function d(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=l(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function p(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,v=0;function m(e,t){var n,r,o;if(t.singleton){var i=v++;n=h||(h=u(t)),r=d.bind(null,n,i,!1),o=d.bind(null,n,i,!0)}else n=u(t),r=p.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=c(n[r]);a[o].references--}for(var i=s(e,t),u=0;u<n.length;u++){var f=c(n[u]);0===a[f].references&&(a[f].updater(),a.splice(f,1))}n=i}}}},function(e,t,n){(t=n(4)(!1)).push([e.i,".__direction_item{box-shadow:0px 0px 10px 0px rgba(0,0,0,0.7);perspective:2000px;perspective-origin:50% 50%;transition:.5s box-shadow}.__direction_item>*{transition:.5s transform;transform:scale(1) rotateX(0deg) rotateY(0deg)}.__direction_item.__top{box-shadow:0px 25px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__top>*{transform:scale(1.1) rotateX(10deg) rotateY(0deg)}.__direction_item.__bottom{box-shadow:0px -25px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__bottom>*{transform:scale(1.1) rotateX(-10deg) rotateY(0deg)}.__direction_item.__right{box-shadow:-25px 0px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__right>*{transform:scale(1.1) rotateX(0deg) rotateY(10deg)}.__direction_item.__left{box-shadow:25px 0px 15px 2px rgba(0,0,0,0.7)}.__direction_item.__left>*{transform:scale(1.1) rotateX(0deg) rotateY(-10deg)}\n",""]),e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(a=r,c=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(c),"/*# ".concat(s," */")),i=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(i).concat([o]).join("\n")}var a,c,s;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var c=0;c<e.length;c++){var s=[].concat(e[c]);r&&o[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}}])})); |
@@ -20,6 +20,6 @@ { | ||
"type": "git", | ||
"url": "https://github.com/Julien-Amblard/pixel.git" | ||
"url": "https://github.com/sl-julienamblard/directional-hover.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Julien-Amblard/pixel/issues" | ||
"url": "https://github.com/sl-julienamblard/directional-hover/issues" | ||
}, | ||
@@ -57,3 +57,3 @@ "author": "Julien Amblard <amblard.julien@gmail.com>", | ||
"dependencies": {}, | ||
"version": "0.1.3" | ||
"version": "0.1.4" | ||
} |
# Directional Hover Effect | ||
[![CircleCI Status](https://circleci.com/gh/Julien-Amblard/directional-hover.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/Julien-Amblard/directional-hover) | ||
[![CircleCI Status](https://circleci.com/gh/sl-julienamblard/directional-hover.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/sl-julienamblard/directional-hover) | ||
[![npm](https://img.shields.io/npm/dt/directional-hover.svg?style=flat-square)](https://www.npmjs.com/package/directional-hover) | ||
[![npm](https://img.shields.io/npm/v/directional-hover.svg?style=flat-square)](https://www.npmjs.com/package/directional-hover) | ||
[![npm](https://img.shields.io/npm/l/directional-hover.svg?style=flat-square)](https://github.com/Julien-Amblard/directional-hover/blob/master/LICENSE) | ||
[![npm](https://img.shields.io/npm/l/directional-hover.svg?style=flat-square)](https://github.com/sl-julienamblard/directional-hover/blob/master/LICENSE) | ||
@@ -8,0 +8,0 @@ <br /> |
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
12477