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 0.2.2 to 0.3.0

8

build/d3-drag.js

@@ -0,9 +1,8 @@

// https://d3js.org/d3-drag/ Version 0.3.0. Copyright 2016 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-selection')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-dispatch', 'd3-selection'], factory) :
(factory((global.d3_drag = global.d3_drag || {}),global.d3_dispatch,global.d3_selection));
(factory((global.d3 = global.d3 || {}),global.d3,global.d3));
}(this, function (exports,d3Dispatch,d3Selection) { 'use strict';
var version = "0.2.2";
function nopropagation() {

@@ -206,3 +205,2 @@ d3Selection.event.stopImmediatePropagation();

exports.version = version;
exports.drag = drag;

@@ -212,2 +210,4 @@ exports.dragDisable = nodrag;

Object.defineProperty(exports, '__esModule', { value: true });
}));

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

!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_drag=t.d3_drag||{},t.d3_dispatch,t.d3_selection)}(this,function(t,e,n){"use strict";function o(){n.event.stopImmediatePropagation()}function i(){n.event.preventDefault(),n.event.stopImmediatePropagation()}function r(t){var e=t.document.documentElement,o=n.select(t).on("dragstart.drag",i,!0);"onselectstart"in e?o.on("selectstart.drag",i,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function c(t,e){var o=t.document.documentElement,r=n.select(t).on("dragstart.drag",null);e&&(r.on("click.drag",i,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in o?r.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function u(t){return function(){return t}}function s(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 a(){return!n.event.button}function d(){return this.parentNode}function l(t){return null==t?{x:n.event.x,y:n.event.y}:t}function f(){function t(t){t.on("mousedown.drag",f).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!b&&w.apply(this,arguments)){var t=y("mouse",x.apply(this,arguments),n.mouse,this,arguments);t&&(n.select(n.event.view).on("mousemove.drag",h,!0).on("mouseup.drag",p,!0),r(n.event.view),o(),_=!1,t("start"))}}function h(){i(),_=!0,E.mouse("drag")}function p(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),c(n.event.view,_),i(),E.mouse("end")}function g(){if(w.apply(this,arguments)){var t,e,i=n.event.changedTouches,r=x.apply(this,arguments),c=i.length;for(t=0;c>t;++t)(e=y(i[t].identifier,r,n.touch,this,arguments))&&(o(),e("start"))}}function v(){var t,e,o=n.event.changedTouches,r=o.length;for(t=0;r>t;++t)(e=E[o[t].identifier])&&(i(),e("drag"))}function m(){var t,e,i=n.event.changedTouches,r=i.length;for(b&&clearTimeout(b),b=setTimeout(function(){b=null},500),t=0;r>t;++t)(e=E[i[t].identifier])&&(o(),e("end"))}function y(e,o,i,r,c){var u,a,d,l=i(o,e),f=j.copy();if(n.customEvent(new s(t,"beforestart",u,e,k,l[0],l[1],0,0,f),function(){return null==(n.event.subject=u=T.apply(r,c))?!1:(a=u.x-l[0]||0,d=u.y-l[1]||0,!0)}))return function h(p){var g,v=l;switch(p){case"start":E[e]=h,g=k++;break;case"end":delete E[e],--k;case"drag":l=i(o,e),g=k}n.customEvent(new s(t,p,u,e,g,l[0]+a,l[1]+d,l[0]-v[0],l[1]-v[1],f),f.apply,f,[p,r,c])}}var _,b,w=a,x=d,T=l,E={},j=e.dispatch("start","drag","end"),k=0;return t.filter=function(e){return arguments.length?(w="function"==typeof e?e:u(!!e),t):w},t.container=function(e){return arguments.length?(x="function"==typeof e?e:u(e),t):x},t.subject=function(e){return arguments.length?(T="function"==typeof e?e:u(e),t):T},t.on=function(){var e=j.on.apply(j,arguments);return e===j?t:e},t}var h="0.2.2";s.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t},t.version=h,t.drag=f,t.dragDisable=r,t.dragEnable=c});
// https://d3js.org/d3-drag/ Version 0.3.0. Copyright 2016 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(){n.event.preventDefault(),n.event.stopImmediatePropagation()}function r(e){var t=e.document.documentElement,o=n.select(e).on("dragstart.drag",i,!0);"onselectstart"in t?o.on("selectstart.drag",i,!0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function u(e,t){var o=e.document.documentElement,r=n.select(e).on("dragstart.drag",null);t&&(r.on("click.drag",i,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in o?r.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function c(e){return function(){return e}}function s(e,t,n,o,i,r,u,c,s,a){this.target=e,this.type=t,this.subject=n,this.identifier=o,this.active=i,this.x=r,this.y=u,this.dx=c,this.dy=s,this._=a}function a(){return!n.event.button}function d(){return this.parentNode}function l(e){return null==e?{x:n.event.x,y:n.event.y}:e}function f(){function e(e){e.on("mousedown.drag",f).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!_&&w.apply(this,arguments)){var e=y("mouse",x.apply(this,arguments),n.mouse,this,arguments);e&&(n.select(n.event.view).on("mousemove.drag",h,!0).on("mouseup.drag",p,!0),r(n.event.view),o(),b=!1,e("start"))}}function h(){i(),b=!0,j.mouse("drag")}function p(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),u(n.event.view,b),i(),j.mouse("end")}function g(){if(w.apply(this,arguments)){var e,t,i=n.event.changedTouches,r=x.apply(this,arguments),u=i.length;for(e=0;u>e;++e)(t=y(i[e].identifier,r,n.touch,this,arguments))&&(o(),t("start"))}}function v(){var e,t,o=n.event.changedTouches,r=o.length;for(e=0;r>e;++e)(t=j[o[e].identifier])&&(i(),t("drag"))}function m(){var e,t,i=n.event.changedTouches,r=i.length;for(_&&clearTimeout(_),_=setTimeout(function(){_=null},500),e=0;r>e;++e)(t=j[i[e].identifier])&&(o(),t("end"))}function y(t,o,i,r,u){var c,a,d,l=i(o,t),f=E.copy();if(n.customEvent(new s(e,"beforestart",c,t,k,l[0],l[1],0,0,f),function(){return null==(n.event.subject=c=T.apply(r,u))?!1:(a=c.x-l[0]||0,d=c.y-l[1]||0,!0)}))return function h(p){var g,v=l;switch(p){case"start":j[t]=h,g=k++;break;case"end":delete j[t],--k;case"drag":l=i(o,t),g=k}n.customEvent(new s(e,p,c,t,g,l[0]+a,l[1]+d,l[0]-v[0],l[1]-v[1],f),f.apply,f,[p,r,u])}}var b,_,w=a,x=d,T=l,j={},E=t.dispatch("start","drag","end"),k=0;return e.filter=function(t){return arguments.length?(w="function"==typeof t?t:c(!!t),e):w},e.container=function(t){return arguments.length?(x="function"==typeof t?t:c(t),e):x},e.subject=function(t){return arguments.length?(T="function"==typeof t?t:c(t),e):T},e.on=function(){var t=E.on.apply(E,arguments);return t===E?e:t},e}s.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},e.drag=f,e.dragDisable=r,e.dragEnable=u,Object.defineProperty(e,"__esModule",{value:!0})});

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

export {version} from "./build/package";
export {default as drag} from "./src/drag";
export {default as dragDisable, yesdrag as dragEnable} from "./src/nodrag";
{
"name": "d3-drag",
"version": "0.2.2",
"version": "0.3.0",
"description": "Drag and drop SVG, HTML or Canvas using mouse or touch input.",

@@ -11,3 +11,3 @@ "keywords": [

],
"homepage": "https://github.com/d3/d3-drag",
"homepage": "https://d3js.org/d3-drag/",
"license": "BSD-3-Clause",

@@ -25,15 +25,15 @@ "author": {

"scripts": {
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && rollup -g d3-dispatch:d3_dispatch,d3-selection:d3_selection -f umd -n d3_drag -o build/d3-drag.js -- index.js",
"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",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"prepublish": "npm run test && uglifyjs build/d3-drag.js -c -m -o build/d3-drag.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-drag.js ../d3.github.com/d3-drag.v0.2.js && cp build/d3-drag.min.js ../d3.github.com/d3-drag.v0.2.min.js && cd ../d3.github.com && git add d3-drag.v0.2.js d3-drag.v0.2.min.js && git commit -m \"d3-drag ${VERSION}\" && git push && cd - && zip -j build/d3-drag.zip -- LICENSE README.md build/d3-drag.js build/d3-drag.min.js"
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-drag.js -c -m -o build/d3-drag.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-drag.js ../d3.github.com/d3-drag.v0.3.js && cp build/d3-drag.min.js ../d3.github.com/d3-drag.v0.3.min.js && cd ../d3.github.com && git add d3-drag.v0.3.js d3-drag.v0.3.min.js && git commit -m \"d3-drag ${VERSION}\" && git push && cd - && zip -j build/d3-drag.zip -- LICENSE README.md build/d3-drag.js build/d3-drag.min.js"
},
"dependencies": {
"d3-dispatch": "~0.4.3",
"d3-selection": "~0.7.2"
"d3-dispatch": "~0.5.0",
"d3-selection": "~0.8.0"
},
"devDependencies": {
"eslint": "2",
"json2module": "0.0",
"rollup": "0.26",
"package-preamble": "0.0",
"rollup": "0.27",
"tape": "4",

@@ -40,0 +40,0 @@ "uglify-js": "2"

@@ -19,11 +19,11 @@ # d3-drag

If you use NPM, `npm install d3-drag`. Otherwise, download the [latest release](https://github.com/d3/d3-drag/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-drag.v0.2.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_drag` global is exported:
If you use NPM, `npm install d3-drag`. Otherwise, download the [latest release](https://github.com/d3/d3-drag/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-drag.v0.3.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
<script src="https://d3js.org/d3-dispatch.v0.4.min.js"></script>
<script src="https://d3js.org/d3-selection.v0.7.min.js"></script>
<script src="https://d3js.org/d3-drag.v0.2.min.js"></script>
<script src="https://d3js.org/d3-dispatch.v0.5.min.js"></script>
<script src="https://d3js.org/d3-selection.v0.8.min.js"></script>
<script src="https://d3js.org/d3-drag.v0.3.min.js"></script>
<script>
var drag = d3_drag.drag();
var drag = d3.drag();

@@ -30,0 +30,0 @@ </script>

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