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

d3-drag

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-drag - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

rollup.config.js

8

build/d3-drag.js

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

// https://d3js.org/d3-drag/ Version 1.1.0. Copyright 2017 Mike Bostock.
// https://d3js.org/d3-drag/ Version 1.1.1. Copyright 2017 Mike Bostock.
(function (global, factory) {

@@ -80,2 +80,6 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-selection')) :

function touchable() {
return "ontouchstart" in this;
}
var drag = function() {

@@ -97,5 +101,7 @@ var filter = defaultFilter,

.on("mousedown.drag", mousedowned)
.filter(touchable)
.on("touchstart.drag", touchstarted)
.on("touchmove.drag", touchmoved)
.on("touchend.drag touchcancel.drag", touchended)
.style("touch-action", "none")
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");

@@ -102,0 +108,0 @@ }

4

build/d3-drag.min.js

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

// https://d3js.org/d3-drag/ Version 1.1.0. Copyright 2017 Mike Bostock.
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-dispatch"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-selection"],t):t(e.d3=e.d3||{},e.d3,e.d3)}(this,function(e,t,n){"use strict";function o(){n.event.stopImmediatePropagation()}function i(e,t){var o=e.document.documentElement,i=n.select(e).on("dragstart.drag",null);t&&(i.on("click.drag",a,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function r(e,t,n,o,i,r,c,u,s,a){this.target=e,this.type=t,this.subject=n,this.identifier=o,this.active=i,this.x=r,this.y=c,this.dx=u,this.dy=s,this._=a}function c(){return!n.event.button}function u(){return this.parentNode}function s(e){return null==e?{x:n.event.x,y:n.event.y}:e}var a=function(){n.event.preventDefault(),n.event.stopImmediatePropagation()},l=function(e){var t=e.document.documentElement,o=n.select(e).on("dragstart.drag",a,!0);"onselectstart"in t?o.on("selectstart.drag",a,!0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")},d=function(e){return function(){return e}};r.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var f=function(){function e(e){e.on("mousedown.drag",f).on("touchstart.drag",p).on("touchmove.drag",g).on("touchend.drag touchcancel.drag",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!x&&T.apply(this,arguments)){var e=y("mouse",j.apply(this,arguments),n.mouse,this,arguments);e&&(n.select(n.event.view).on("mousemove.drag",h,!0).on("mouseup.drag",v,!0),l(n.event.view),o(),w=!1,b=n.event.clientX,_=n.event.clientY,e("start"))}}function h(){if(a(),!w){var e=n.event.clientX-b,t=n.event.clientY-_;w=e*e+t*t>z}E.mouse("drag")}function v(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),i(n.event.view,w),a(),E.mouse("end")}function p(){if(T.apply(this,arguments)){var e,t,i=n.event.changedTouches,r=j.apply(this,arguments),c=i.length;for(e=0;e<c;++e)(t=y(i[e].identifier,r,n.touch,this,arguments))&&(o(),t("start"))}}function g(){var e,t,o=n.event.changedTouches,i=o.length;for(e=0;e<i;++e)(t=E[o[e].identifier])&&(a(),t("drag"))}function m(){var e,t,i=n.event.changedTouches,r=i.length;for(x&&clearTimeout(x),x=setTimeout(function(){x=null},500),e=0;e<r;++e)(t=E[i[e].identifier])&&(o(),t("end"))}function y(t,o,i,c,u){var s,a,l,d=i(o,t),f=M.copy();if(n.customEvent(new r(e,"beforestart",s,t,q,d[0],d[1],0,0,f),function(){return null!=(n.event.subject=s=k.apply(c,u))&&(a=s.x-d[0]||0,l=s.y-d[1]||0,!0)}))return function h(v){var p,g=d;switch(v){case"start":E[t]=h,p=q++;break;case"end":delete E[t],--q;case"drag":d=i(o,t),p=q}n.customEvent(new r(e,v,s,t,p,d[0]+a,d[1]+l,d[0]-g[0],d[1]-g[1],f),f.apply,f,[v,c,u])}}var b,_,w,x,T=c,j=u,k=s,E={},M=t.dispatch("start","drag","end"),q=0,z=0;return e.filter=function(t){return arguments.length?(T="function"==typeof t?t:d(!!t),e):T},e.container=function(t){return arguments.length?(j="function"==typeof t?t:d(t),e):j},e.subject=function(t){return arguments.length?(k="function"==typeof t?t:d(t),e):k},e.on=function(){var t=M.on.apply(M,arguments);return t===M?e:t},e.clickDistance=function(t){return arguments.length?(z=(t=+t)*t,e):Math.sqrt(z)},e};e.drag=f,e.dragDisable=l,e.dragEnable=i,Object.defineProperty(e,"__esModule",{value:!0})});
// https://d3js.org/d3-drag/ Version 1.1.1. Copyright 2017 Mike Bostock.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dispatch"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-selection"],e):e(t.d3=t.d3||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function o(){n.event.stopImmediatePropagation()}function i(t,e){var o=t.document.documentElement,i=n.select(t).on("dragstart.drag",null);e&&(i.on("click.drag",l,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function r(t,e,n,o,i,r,c,u,s,a){this.target=t,this.type=e,this.subject=n,this.identifier=o,this.active=i,this.x=r,this.y=c,this.dx=u,this.dy=s,this._=a}function c(){return!n.event.button}function u(){return this.parentNode}function s(t){return null==t?{x:n.event.x,y:n.event.y}:t}function a(){return"ontouchstart"in this}var l=function(){n.event.preventDefault(),n.event.stopImmediatePropagation()},d=function(t){var e=t.document.documentElement,o=n.select(t).on("dragstart.drag",l,!0);"onselectstart"in e?o.on("selectstart.drag",l,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")},f=function(t){return function(){return t}};r.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};t.drag=function(){function t(t){t.on("mousedown.drag",h).filter(a).on("touchstart.drag",g).on("touchmove.drag",m).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(){if(!T&&j.apply(this,arguments)){var t=b("mouse",k.apply(this,arguments),n.mouse,this,arguments);t&&(n.select(n.event.view).on("mousemove.drag",v,!0).on("mouseup.drag",p,!0),d(n.event.view),o(),x=!1,_=n.event.clientX,w=n.event.clientY,t("start"))}}function v(){if(l(),!x){var t=n.event.clientX-_,e=n.event.clientY-w;x=t*t+e*e>D}M.mouse("drag")}function p(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),i(n.event.view,x),l(),M.mouse("end")}function g(){if(j.apply(this,arguments)){var t,e,i=n.event.changedTouches,r=k.apply(this,arguments),c=i.length;for(t=0;t<c;++t)(e=b(i[t].identifier,r,n.touch,this,arguments))&&(o(),e("start"))}}function m(){var t,e,o=n.event.changedTouches,i=o.length;for(t=0;t<i;++t)(e=M[o[t].identifier])&&(l(),e("drag"))}function y(){var t,e,i=n.event.changedTouches,r=i.length;for(T&&clearTimeout(T),T=setTimeout(function(){T=null},500),t=0;t<r;++t)(e=M[i[t].identifier])&&(o(),e("end"))}function b(e,o,i,c,u){var s,a,l,d=i(o,e),f=q.copy();if(n.customEvent(new r(t,"beforestart",s,e,z,d[0],d[1],0,0,f),function(){return null!=(n.event.subject=s=E.apply(c,u))&&(a=s.x-d[0]||0,l=s.y-d[1]||0,!0)}))return function h(v){var p,g=d;switch(v){case"start":M[e]=h,p=z++;break;case"end":delete M[e],--z;case"drag":d=i(o,e),p=z}n.customEvent(new r(t,v,s,e,p,d[0]+a,d[1]+l,d[0]-g[0],d[1]-g[1],f),f.apply,f,[v,c,u])}}var _,w,x,T,j=c,k=u,E=s,M={},q=e.dispatch("start","drag","end"),z=0,D=0;return t.filter=function(e){return arguments.length?(j="function"==typeof e?e:f(!!e),t):j},t.container=function(e){return arguments.length?(k="function"==typeof e?e:f(e),t):k},t.subject=function(e){return arguments.length?(E="function"==typeof e?e:f(e),t):E},t.on=function(){var e=q.on.apply(q,arguments);return e===q?t:e},t.clickDistance=function(e){return arguments.length?(D=(e=+e)*e,t):Math.sqrt(D)},t},t.dragDisable=d,t.dragEnable=i,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-drag",
"version": "1.1.0",
"version": "1.1.1",
"description": "Drag and drop SVG, HTML or Canvas using mouse or touch input.",

@@ -26,5 +26,5 @@ "keywords": [

"scripts": {
"pretest": "rm -rf build && mkdir build && rollup --banner \"$(preamble)\" -g d3-dispatch:d3,d3-selection:d3 -f umd -n d3 -o build/d3-drag.js -- index.js",
"pretest": "rm -rf build && mkdir build && rollup -c --banner \"$(preamble)\" -g d3-dispatch:d3,d3-selection:d3 -o build/d3-drag.js",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-drag.js -c -m -o build/d3-drag.min.js",
"prepublish": "npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-drag.js -c -m -o build/d3-drag.min.js",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-drag/build/d3-drag.js d3-drag.v1.js && cp ../d3-drag/build/d3-drag.min.js d3-drag.v1.min.js && git add d3-drag.v1.js d3-drag.v1.min.js && git commit -m \"d3-drag ${npm_package_version}\" && git push && cd - && zip -j build/d3-drag.zip -- LICENSE README.md build/d3-drag.js build/d3-drag.min.js"

@@ -37,8 +37,8 @@ },

"devDependencies": {
"eslint": "3",
"eslint": "4",
"package-preamble": "0.1",
"rollup": "0.41",
"rollup": "0.45",
"tape": "4",
"uglify-js": "^2.8.11"
"uglify-js": "3"
}
}

@@ -21,2 +21,6 @@ import {dispatch} from "d3-dispatch";

function touchable() {
return "ontouchstart" in this;
}
export default function() {

@@ -38,5 +42,7 @@ var filter = defaultFilter,

.on("mousedown.drag", mousedowned)
.filter(touchable)
.on("touchstart.drag", touchstarted)
.on("touchmove.drag", touchmoved)
.on("touchend.drag touchcancel.drag", touchended)
.style("touch-action", "none")
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");

@@ -43,0 +49,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