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

basicrotate

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

basicrotate - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

6

CHANGELOG.md

@@ -7,2 +7,8 @@ # Changelog

## [1.1.0] - 2019-08-10
### Added
- Touch support
## [1.0.0] - 2019-08-10

@@ -9,0 +15,0 @@

2

dist/basicRotate.min.js

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).basicRotate=e()}}(function(){return function(){return function e(n,t,r){function o(u,f){if(!t[u]){if(!n[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var d=t[u]={exports:{}};n[u][0].call(d.exports,function(e){return o(n[u][1][e]||e)},d,d.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}}()({1:[function(e,n,t){"use strict";n.exports=function(e,n,t){var r=n-e+1,o=t-e;return function(n){return(o=(o+(n=n||0))%r)>=0&&(o=0+o),o<0&&(o=r+o),e+o}}},{}],2:[function(e,n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=t.DIRECTION_Y=t.DIRECTION_X=void 0;var r,o=(r=e("count-between"))&&r.__esModule?r:{default:r};t.DIRECTION_X="x";t.DIRECTION_Y="y";var i=function(e){return{x:e.pageX,y:e.pageY}},u=function(e,n){e.forEach(function(e){return e.classList.remove("active")}),e[n].classList.add("active")},f=function(e,n,t,r){if(u(n,t.current()),!1!==r.draggable){var o,f;e.onmousedown=function(e){o=t.current(),f=i(e)},document.addEventListener("mousemove",function(e){if(!1!=(null!=o&&null!=f)){var n,u,c,a=i(e),d=(n=f,u=a,c=r.direction,n[c]-u[c]),l=Math.round(d/r.tolerance);t.goto(o+l)}}),document.addEventListener("mouseup",function(){o=void 0,f=void 0})}};t.create=function(e,n){n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=Object.assign({},e),!1===Number.isFinite(e.index)&&(e.index=0),!1===Number.isFinite(e.tolerance)&&(e.tolerance=10),!1!==e.draggable&&(e.draggable=!0),"y"!==e.direction&&(e.direction="x"),"function"!=typeof e.beforeChange&&(e.beforeChange=function(){}),"function"!=typeof e.afterChange&&(e.afterChange=function(){}),e}(n);var t=e.querySelectorAll("img"),r=(0,o.default)(0,t.length-1,n.index),i=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r();if(!1===n.beforeChange(c,e,i))return!1;r=(0,o.default)(0,t.length-1,e),u(t,r()),n.afterChange(c,e,i)},c={current:function(){return r()},goto:i,prev:function(){var e=r(),n=r(-1);i(n,e)},next:function(){var e=r(),n=r(1);i(n,e)}};return f(e,t,c,n),c}},{"count-between":1}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).basicRotate=e()}}(function(){return function(){return function e(n,t,o){function r(u,f){if(!t[u]){if(!n[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var d=t[u]={exports:{}};n[u][0].call(d.exports,function(e){return r(n[u][1][e]||e)},d,d.exports,e,n,t,o)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<o.length;u++)r(o[u]);return r}}()({1:[function(e,n,t){"use strict";n.exports=function(e,n,t){var o=n-e+1,r=t-e;return function(n){return(r=(r+(n=n||0))%o)>=0&&(r=0+r),r<0&&(r=o+r),e+r}}},{}],2:[function(e,n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=t.DIRECTION_Y=t.DIRECTION_X=void 0;var o,r=(o=e("count-between"))&&o.__esModule?o:{default:o};t.DIRECTION_X="x";t.DIRECTION_Y="y";var i=function(e){return{x:e.pageX||e.touches[0].pageX,y:e.pageY||e.touches[0].pageY}},u=function(e,n){e.forEach(function(e){return e.classList.remove("active")}),e[n].classList.add("active")},f=function(e,n,t,o){if(u(n,t.current()),!1!==o.draggable){var r,f,c=function(e){r=t.current(),f=i(e)},a=function(e){if(!1!=(null!=r&&null!=f)){var n,u,c,a=i(e),d=(n=f,u=a,c=o.direction,n[c]-u[c]),l=Math.round(d/o.tolerance);t.goto(r+l)}},d=function(){r=void 0,f=void 0};e.ontouchstart=c,e.onmousedown=c,document.addEventListener("touchmove",a),document.addEventListener("mousemove",a),document.addEventListener("touchend",d),document.addEventListener("mouseup",d)}};t.create=function(e,n){n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=Object.assign({},e),!1===Number.isFinite(e.index)&&(e.index=0),!1===Number.isFinite(e.tolerance)&&(e.tolerance=10),!1!==e.draggable&&(e.draggable=!0),"y"!==e.direction&&(e.direction="x"),"function"!=typeof e.beforeChange&&(e.beforeChange=function(){}),"function"!=typeof e.afterChange&&(e.afterChange=function(){}),e}(n);var t=e.querySelectorAll("img"),o=(0,r.default)(0,t.length-1,n.index),i=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o();if(!1===n.beforeChange(c,e,i))return!1;o=(0,r.default)(0,t.length-1,e),u(t,o()),n.afterChange(c,e,i)},c={current:function(){return o()},goto:i,prev:function(){var e=o(),n=o(-1);i(n,e)},next:function(){var e=o(),n=o(1);i(n,e)}};return f(e,t,c,n),c}},{"count-between":1}]},{},[2])(2)});
{
"name": "basicrotate",
"version": "1.0.0",
"version": "1.1.0",
"authors": [

@@ -5,0 +5,0 @@ "Tobias Reich <tobias@electerious.com>"

@@ -22,3 +22,3 @@ # basicRotate

|:-----------|:------------|:------------|
| Default | Includes most features. | [Try it on CodePen](http://codepen.io/electerious/pen/GjpXRX) |
| Default | Includes most features. | [Try it on CodePen](https://codepen.io/electerious/pen/wVYoYK) |

@@ -25,0 +25,0 @@ ## Features

@@ -26,4 +26,4 @@ import counter from 'count-between'

return {
x: e.pageX,
y: e.pageY
x: e.pageX || e.touches[0].pageX,
y: e.pageY || e.touches[0].pageY
}

@@ -63,3 +63,3 @@

elem.onmousedown = (e) => {
const start = (e) => {

@@ -71,3 +71,3 @@ startIndex = instance.current()

document.addEventListener('mousemove', (e) => {
const move = (e) => {

@@ -82,5 +82,5 @@ if (isDragging() === false) return

})
}
document.addEventListener('mouseup', () => {
const end = () => {

@@ -90,4 +90,13 @@ startIndex = undefined

})
}
elem.ontouchstart = start
elem.onmousedown = start
document.addEventListener('touchmove', move)
document.addEventListener('mousemove', move)
document.addEventListener('touchend', end)
document.addEventListener('mouseup', end)
}

@@ -94,0 +103,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