svelte-drag-drop-touch
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -1,2 +0,343 @@ | ||
var t;!function(e){var n=function(){function t(){this._dropEffect="move",this._effectAllowed="all",this._data={}}return Object.defineProperty(t.prototype,"dropEffect",{enumerable:!0,configurable:!0,get:function(){return this._dropEffect},set:function(t){this._dropEffect=t}}),Object.defineProperty(t.prototype,"effectAllowed",{enumerable:!0,configurable:!0,get:function(){return this._effectAllowed},set:function(t){this._effectAllowed=t}}),Object.defineProperty(t.prototype,"types",{enumerable:!0,configurable:!0,get:function(){return Object.keys(this._data)}}),t.prototype.clearData=function(t){null==t?this._data={}:delete this._data[t.toLowerCase()]},t.prototype.getData=function(t){return this._data[t.toLowerCase()]||""},t.prototype.setData=function(t,e){this._data[t.toLowerCase()]=e},t.prototype.setDragImage=function(t,e,n){var o=i._instance;o._imgCustom=t,o._imgOffset={x:e,y:n}},t}();e.DataTransfer=n;var i=function(){function t(){if(this._lastClick=0,null!=i&&null!=i._instance)throw new Error("DragDropTouch instance already created.");var t=!1;if(document.addEventListener("test",(function(){}),{get passive(){return t=!0,!0}}),navigator.maxTouchPoints>0){var e=this._touchstart.bind(this),n=this._touchmove.bind(this),o=this._touchend.bind(this),s=!!t&&{passive:!1,capture:!1};document.addEventListener("touchstart",e,s),document.addEventListener("touchmove",n,s),document.addEventListener("touchend",o),document.addEventListener("touchcancel",o)}}t.getInstance=function(){return i._instance},t.prototype._touchstart=function(t){var e=this;if(this._shouldHandle(t)){if(Date.now()-this._lastClick<i._DBLCLICK&&this._dispatchEvent(t,"dblclick",t.target))return t.preventDefault(),void this._reset();this._reset();var n=this._closestDraggable(t.target);null!=n&&(this._dispatchEvent(t,"mousemove",t.target)||this._dispatchEvent(t,"mousedown",t.target)||(this._dragSource=n,this._ptDown=this._getPoint(t),this._lastTouch=t,t.preventDefault(),setTimeout((function(){e._dragSource===n&&null==e._img&&e._dispatchEvent(t,"contextmenu",n)&&e._reset()}),i._CTXMENU),i._ISPRESSHOLDMODE&&(this._pressHoldInterval=setTimeout((function(){e._isDragEnabled=!0,e._touchmove(t)}),i._PRESSHOLDAWAIT))))}},t.prototype._touchmove=function(t){if(this._shouldCancelPressHoldMove(t))this._reset();else if(this._shouldHandleMove(t)||this._shouldHandlePressHoldMove(t)){var e=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",e))return this._lastTouch=t,void t.preventDefault();var n=this._getPoint(this._lastTouch,!0),i=this._getPoint(t,!0);this._lastMovementX=i.x-n.x,this._lastMovementY=i.y-n.y;var o={movementX:this._lastMovementX,movementY:this._lastMovementY};this._dragSource&&null==this._img&&this._shouldStartDragging(t)&&(this._dispatchEvent(t,"dragstart",this._dragSource,o),this._createImage(t),this._dispatchEvent(t,"dragenter",e,o)),null!=this._img&&(this._lastTouch=t,t.preventDefault(),this._dispatchEvent(t,"drag",this._dragSource,o),e!=this._lastTarget&&(this._dispatchEvent(this._lastTouch,"dragleave",this._lastTarget,o),this._dispatchEvent(t,"dragenter",e,o),this._lastTarget=e),this._moveImage(t),this._isDropZone=this._dispatchEvent(t,"dragover",e,o))}},t.prototype._touchend=function(t){if(this._shouldHandle(t)){if(this._dispatchEvent(this._lastTouch,"mouseup",t.target))return void t.preventDefault();if(null==this._img&&(this._dragSource=null,this._dispatchEvent(this._lastTouch,"click",t.target),this._lastClick=Date.now()),this._destroyImage(),this._dragSource){var e={movementX:this._lastMovementX,movementY:this._lastMovementY};t.type.indexOf("cancel")<0&&this._isDropZone&&this._dispatchEvent(this._lastTouch,"drop",this._lastTarget,e),this._dispatchEvent(this._lastTouch,"dragend",this._dragSource,e),this._reset()}}},t.prototype._shouldHandle=function(t){return null!=t&&!t.defaultPrevented&&null!=t.touches&&t.touches.length<2},t.prototype._shouldHandleMove=function(t){return!i._ISPRESSHOLDMODE&&this._shouldHandle(t)},t.prototype._shouldHandlePressHoldMove=function(t){return i._ISPRESSHOLDMODE&&this._isDragEnabled&&null!=t&&null!=t.touches&&t.touches.length>0},t.prototype._shouldCancelPressHoldMove=function(t){return i._ISPRESSHOLDMODE&&!this._isDragEnabled&&this._getDelta(t)>i._PRESSHOLDMARGIN},t.prototype._shouldStartDragging=function(t){var e=this._getDelta(t);return e>i._THRESHOLD||i._ISPRESSHOLDMODE&&e>=i._PRESSHOLDTHRESHOLD},t.prototype._reset=function(){this._destroyImage(),this._dragSource=null,this._lastTouch=null,this._lastTarget=null,this._ptDown=null,this._isDragEnabled=!1,this._isDropZone=!1,this._dataTransfer=new n,this._lastMovementX=0,this._lastMovementY=0,clearInterval(this._pressHoldInterval)},t.prototype._getPoint=function(t,e){if(null!=t&&null!=t.touches&&t.touches.length>0){var n=t.touches[0];return{x:e?n.pageX:n.clientX,y:e?n.pageY:n.clientY}}var i=t;return{x:e?i.pageX:i.clientX,y:e?i.pageY:i.clientY}},t.prototype._getDelta=function(t){if(i._ISPRESSHOLDMODE&&!this._ptDown)return 0;var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)},t.prototype._getTarget=function(t){for(var e=this._getPoint(t),n=document.elementFromPoint(e.x,e.y);null!=n&&"none"==getComputedStyle(n).pointerEvents;)n=n.parentElement;return n},t.prototype._createImage=function(t){null!=this._img&&this._destroyImage();var e=this._imgCustom||this._dragSource;if(this._img=e.cloneNode(!0),this._copyStyle(e,this._img),this._img.style.top=this._img.style.left="-9999px",null==this._imgCustom){var n=e.getBoundingClientRect(),o=this._getPoint(t);this._imgOffset={x:o.x-n.left,y:o.y-n.top},this._img.style.opacity=i._OPACITY.toString()}this._moveImage(t),document.body.appendChild(this._img)},t.prototype._destroyImage=function(){null!=this._img&&null!=this._img.parentElement&&this._img.parentElement.removeChild(this._img),this._img=null,this._imgCustom=null},t.prototype._moveImage=function(t){var e=this;requestAnimationFrame((function(){if(null!=e._img){var n=e._getPoint(t,!0),i=e._img.style;i.position="absolute",i.pointerEvents="none",i.zIndex="999999",i.left=Math.round(n.x-e._imgOffset.x)+"px",i.top=Math.round(n.y-e._imgOffset.y)+"px"}}))},t.prototype._copyProps=function(t,e,n){for(var i=0;i<n.length;i++){var o=n[i];t[o]=e[o]}},t.prototype._copyStyle=function(t,e){if(i._rmvAtts.forEach((function(t){e.removeAttribute(t)})),t instanceof HTMLCanvasElement){var n=t,o=e;o.width=n.width,o.height=n.height,o.getContext("2d").drawImage(n,0,0)}for(var s=getComputedStyle(t),r=0;r<s.length;r++){var a=s[r];a.indexOf("transition")<0&&(e.style[a]=s[a])}for(e.style.pointerEvents="none",r=0;r<t.children.length;r++)this._copyStyle(t.children[r],e.children[r])},t.prototype._dispatchEvent=function(t,e,n,o){if(null!=t&&null!=n){var s=document.createEvent("Event"),r=null!=t.touches?t.touches[0]:t;return s.initEvent(e,!0,!0),s.button=0,s.which=s.buttons=1,this._copyProps(s,t,i._kbdProps),this._copyProps(s,r,i._ptProps),s.dataTransfer=this._dataTransfer,null!=o&&(s.movementX=o.movementX,s.movementY=o.movementY),n.dispatchEvent(s),s.defaultPrevented}return!1},t.prototype._closestDraggable=function(t){for(;t;t=t.parentElement)if(t.hasAttribute("draggable")&&t.getAttribute("draggable"))return t;return null};var e=new t;return e._instance=e,e}();e.DragDropTouch=i;var o=t.DragDropTouch;o._THRESHOLD=5,o._OPACITY=.5,o._DBLCLICK=500,o._CTXMENU=900,o._ISPRESSHOLDMODE=!1,o._PRESSHOLDAWAIT=400,o._PRESSHOLDMARGIN=25,o._PRESSHOLDTHRESHOLD=0,o._rmvAtts="id,class,style,draggable".split(","),o._kbdProps="altKey,ctrlKey,metaKey,shiftKey".split(","),o._ptProps="pageX,pageY,clientX,clientY,screenX,screenY,offsetX,offsetY".split(",")}(t||(t={}));var e=t.DragDropTouch;export default e; | ||
var DragDropTouch; | ||
(function (DragDropTouchExport) { | ||
var DataTransfer = (function () { | ||
function DataTransfer() { | ||
this._dropEffect = 'move'; | ||
this._effectAllowed = 'all'; | ||
this._data = {}; | ||
} | ||
Object.defineProperty(DataTransfer.prototype, "dropEffect", { | ||
enumerable: true, configurable: true, | ||
get: function () { return this._dropEffect; }, | ||
set: function (value) { this._dropEffect = value; }, | ||
}); | ||
Object.defineProperty(DataTransfer.prototype, "effectAllowed", { | ||
enumerable: true, configurable: true, | ||
get: function () { return this._effectAllowed; }, | ||
set: function (value) { this._effectAllowed = value; }, | ||
}); | ||
Object.defineProperty(DataTransfer.prototype, "types", { | ||
enumerable: true, configurable: true, | ||
get: function () { return Object.keys(this._data); }, | ||
}); | ||
DataTransfer.prototype.clearData = function (type) { | ||
if (type == null) { | ||
this._data = {}; | ||
} | ||
else { | ||
delete this._data[type.toLowerCase()]; | ||
} | ||
}; | ||
DataTransfer.prototype.getData = function (type) { | ||
return this._data[type.toLowerCase()] || ''; | ||
}; | ||
DataTransfer.prototype.setData = function (type, value) { | ||
this._data[type.toLowerCase()] = value; | ||
}; | ||
DataTransfer.prototype.setDragImage = function (img, offsetX, offsetY) { | ||
var ddt = DragDropTouchSingleton._instance; | ||
ddt._imgCustom = img; | ||
ddt._imgOffset = { x: offsetX, y: offsetY }; | ||
}; | ||
return DataTransfer; | ||
}()); | ||
DragDropTouchExport.DataTransfer = DataTransfer; | ||
var DragDropTouchSingleton = (function () { | ||
function DragDropTouch() { | ||
this._lastClick = 0; | ||
if ((DragDropTouchSingleton != null) && | ||
(DragDropTouchSingleton._instance != null)) { | ||
throw new Error('DragDropTouch instance already created.'); | ||
} | ||
// https://github.com/Modernizr/Modernizr/issues/1894 | ||
var supportsPassive = false; | ||
document.addEventListener('test', function () { }, { | ||
get passive() { supportsPassive = true; return true; } | ||
}); | ||
if (navigator.maxTouchPoints > 0) { | ||
var touchstart = this._touchstart.bind(this); | ||
var touchmove = this._touchmove.bind(this); | ||
var touchend = this._touchend.bind(this); | ||
var Options = (supportsPassive ? { passive: false, capture: false } : false); | ||
document.addEventListener('touchstart', touchstart, Options); | ||
document.addEventListener('touchmove', touchmove, Options); | ||
document.addEventListener('touchend', touchend); | ||
document.addEventListener('touchcancel', touchend); | ||
} | ||
} | ||
DragDropTouch.getInstance = function () { | ||
return DragDropTouchSingleton._instance; | ||
}; | ||
/**** Event Handlers ****/ | ||
DragDropTouch.prototype._touchstart = function (e) { | ||
var _this = this; | ||
if (this._shouldHandle(e)) { | ||
if (Date.now() - this._lastClick < DragDropTouchSingleton._DBLCLICK) { | ||
if (this._dispatchEvent(e, 'dblclick', e.target)) { | ||
e.preventDefault(); | ||
this._reset(); | ||
return; | ||
} | ||
} | ||
this._reset(); | ||
var src_1 = this._closestDraggable(e.target); | ||
if (src_1 != null) { | ||
if (!this._dispatchEvent(e, 'mousemove', e.target) && | ||
!this._dispatchEvent(e, 'mousedown', e.target)) { | ||
this._dragSource = src_1; | ||
this._ptDown = this._getPoint(e); | ||
this._lastTouch = e; | ||
e.preventDefault(); | ||
setTimeout(function () { | ||
if ((_this._dragSource === src_1) && (_this._img == null)) { | ||
if (_this._dispatchEvent(e, 'contextmenu', src_1)) { | ||
_this._reset(); | ||
} | ||
} | ||
}, DragDropTouchSingleton._CTXMENU); | ||
if (DragDropTouchSingleton._ISPRESSHOLDMODE) { | ||
this._pressHoldInterval = setTimeout(function () { | ||
_this._isDragEnabled = true; | ||
_this._touchmove(e); | ||
}, DragDropTouchSingleton._PRESSHOLDAWAIT); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
DragDropTouch.prototype._touchmove = function (e) { | ||
if (this._shouldCancelPressHoldMove(e)) { | ||
this._reset(); | ||
return; | ||
} | ||
if (this._shouldHandleMove(e) || this._shouldHandlePressHoldMove(e)) { | ||
var target = this._getTarget(e); | ||
if (this._dispatchEvent(e, 'mousemove', target)) { | ||
this._lastTouch = e; | ||
e.preventDefault(); | ||
return; | ||
} | ||
var lastPointOnPage = this._getPoint(this._lastTouch, true); | ||
var curPointOnPage = this._getPoint(e, true); | ||
this._lastMovementX = curPointOnPage.x - lastPointOnPage.x; | ||
this._lastMovementY = curPointOnPage.y - lastPointOnPage.y; | ||
var Extras = { movementX: this._lastMovementX, movementY: this._lastMovementY }; | ||
if (this._dragSource && (this._img == null) && this._shouldStartDragging(e)) { | ||
this._dispatchEvent(e, 'dragstart', this._dragSource, Extras); | ||
this._createImage(e); | ||
this._dispatchEvent(e, 'dragenter', target, Extras); | ||
} | ||
if (this._img != null) { | ||
this._lastTouch = e; | ||
e.preventDefault(); | ||
this._dispatchEvent(e, 'drag', this._dragSource, Extras); | ||
if (target != this._lastTarget) { | ||
this._dispatchEvent(this._lastTouch, 'dragleave', this._lastTarget, Extras); | ||
this._dispatchEvent(e, 'dragenter', target, Extras); | ||
this._lastTarget = target; | ||
} | ||
this._moveImage(e); | ||
this._isDropZone = this._dispatchEvent(e, 'dragover', target, Extras); | ||
} | ||
} | ||
}; | ||
DragDropTouch.prototype._touchend = function (e) { | ||
if (this._shouldHandle(e)) { | ||
if (this._dispatchEvent(this._lastTouch, 'mouseup', e.target)) { | ||
e.preventDefault(); | ||
return; | ||
} | ||
if (this._img == null) { | ||
this._dragSource = null; | ||
this._dispatchEvent(this._lastTouch, 'click', e.target); | ||
this._lastClick = Date.now(); | ||
} | ||
this._destroyImage(); | ||
if (this._dragSource) { | ||
var Extras = { movementX: this._lastMovementX, movementY: this._lastMovementY }; | ||
if (e.type.indexOf('cancel') < 0 && this._isDropZone) { | ||
this._dispatchEvent(this._lastTouch, 'drop', this._lastTarget, Extras); | ||
} | ||
this._dispatchEvent(this._lastTouch, 'dragend', this._dragSource, Extras); | ||
this._reset(); | ||
} | ||
} | ||
}; | ||
/**** Utility Functions ****/ | ||
DragDropTouch.prototype._shouldHandle = function (e) { | ||
return ((e != null) && !e.defaultPrevented && | ||
(e.touches != null) && (e.touches.length < 2)); | ||
}; | ||
DragDropTouch.prototype._shouldHandleMove = function (e) { | ||
return !DragDropTouchSingleton._ISPRESSHOLDMODE && this._shouldHandle(e); | ||
}; | ||
DragDropTouch.prototype._shouldHandlePressHoldMove = function (e) { | ||
return (DragDropTouchSingleton._ISPRESSHOLDMODE && this._isDragEnabled && | ||
(e != null) && (e.touches != null) && (e.touches.length > 0)); | ||
}; | ||
DragDropTouch.prototype._shouldCancelPressHoldMove = function (e) { | ||
return (DragDropTouchSingleton._ISPRESSHOLDMODE && !this._isDragEnabled && | ||
(this._getDelta(e) > DragDropTouchSingleton._PRESSHOLDMARGIN)); | ||
}; | ||
DragDropTouch.prototype._shouldStartDragging = function (e) { | ||
var delta = this._getDelta(e); | ||
return ((delta > DragDropTouchSingleton._THRESHOLD) || | ||
DragDropTouchSingleton._ISPRESSHOLDMODE && (delta >= DragDropTouchSingleton._PRESSHOLDTHRESHOLD)); | ||
}; | ||
DragDropTouch.prototype._reset = function () { | ||
this._destroyImage(); | ||
this._dragSource = null; | ||
this._lastTouch = null; | ||
this._lastTarget = null; | ||
this._ptDown = null; | ||
this._isDragEnabled = false; | ||
this._isDropZone = false; | ||
this._dataTransfer = new DataTransfer(); | ||
this._lastMovementX = 0; | ||
this._lastMovementY = 0; | ||
clearInterval(this._pressHoldInterval); | ||
}; | ||
DragDropTouch.prototype._getPoint = function (e, page) { | ||
if ((e != null) && (e.touches != null) && | ||
(e.touches.length > 0)) { | ||
var Touch_1 = e.touches[0]; | ||
return { x: page ? Touch_1.pageX : Touch_1.clientX, y: page ? Touch_1.pageY : Touch_1.clientY }; | ||
} | ||
else { | ||
var Event_1 = e; | ||
return { x: page ? Event_1.pageX : Event_1.clientX, y: page ? Event_1.pageY : Event_1.clientY }; | ||
} | ||
}; | ||
DragDropTouch.prototype._getDelta = function (e) { | ||
if (DragDropTouchSingleton._ISPRESSHOLDMODE && !this._ptDown) { | ||
return 0; | ||
} | ||
var p = this._getPoint(e); | ||
return Math.abs(p.x - this._ptDown.x) + Math.abs(p.y - this._ptDown.y); | ||
}; | ||
DragDropTouch.prototype._getTarget = function (e) { | ||
var pt = this._getPoint(e); | ||
var el = document.elementFromPoint(pt.x, pt.y); | ||
while ((el != null) && (getComputedStyle(el).pointerEvents == 'none')) { | ||
el = el.parentElement; | ||
} | ||
return el; | ||
}; | ||
DragDropTouch.prototype._createImage = function (e) { | ||
if (this._img != null) { | ||
this._destroyImage(); | ||
} | ||
var src = this._imgCustom || this._dragSource; | ||
this._img = src.cloneNode(true); | ||
this._copyStyle(src, this._img); | ||
this._img.style.top = this._img.style.left = '-9999px'; | ||
if (this._imgCustom == null) { | ||
var rc = src.getBoundingClientRect(); | ||
var pt = this._getPoint(e); | ||
this._imgOffset = { x: pt.x - rc.left, y: pt.y - rc.top }; | ||
this._img.style.opacity = DragDropTouchSingleton._OPACITY.toString(); | ||
} | ||
this._moveImage(e); | ||
document.body.appendChild(this._img); | ||
}; | ||
DragDropTouch.prototype._destroyImage = function () { | ||
if ((this._img != null) && (this._img.parentElement != null)) { | ||
this._img.parentElement.removeChild(this._img); | ||
} | ||
this._img = null; | ||
this._imgCustom = null; | ||
}; | ||
DragDropTouch.prototype._moveImage = function (e) { | ||
var _this = this; | ||
requestAnimationFrame(function () { | ||
if (_this._img != null) { | ||
var pt = _this._getPoint(e, true), s = _this._img.style; | ||
s.position = 'absolute'; | ||
s.pointerEvents = 'none'; | ||
s.zIndex = '999999'; | ||
s.left = Math.round(pt.x - _this._imgOffset.x) + 'px'; | ||
s.top = Math.round(pt.y - _this._imgOffset.y) + 'px'; | ||
} | ||
}); | ||
}; | ||
DragDropTouch.prototype._copyProps = function (dst, src, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var p = props[i]; | ||
dst[p] = src[p]; | ||
} | ||
}; | ||
DragDropTouch.prototype._copyStyle = function (src, dst) { | ||
DragDropTouchSingleton._rmvAtts.forEach(function (att) { | ||
dst.removeAttribute(att); | ||
}); | ||
if (src instanceof HTMLCanvasElement) { | ||
var cSrc = src, cDst = dst; | ||
cDst.width = cSrc.width; | ||
cDst.height = cSrc.height; | ||
cDst.getContext('2d').drawImage(cSrc, 0, 0); | ||
} | ||
var cs = getComputedStyle(src); // poor trick to satisfy compiler | ||
for (var i = 0; i < cs.length; i++) { | ||
var key = cs[i]; | ||
if (key.indexOf('transition') < 0) { | ||
dst.style[key] = cs[key]; | ||
} | ||
} | ||
dst.style.pointerEvents = 'none'; | ||
for (var i = 0; i < src.children.length; i++) { | ||
this._copyStyle(src.children[i], dst.children[i]); | ||
} | ||
}; | ||
DragDropTouch.prototype._dispatchEvent = function (e /* poor TypeScript trick */, type, target, Extras) { | ||
if ((e != null) && (target != null)) { | ||
var evt = document.createEvent('Event'); // poor trick to satisfy compiler | ||
var t = (e['touches'] != null) ? e['touches'][0] : e; | ||
evt.initEvent(type, true, true); | ||
evt['button'] = 0; | ||
evt['which'] = evt['buttons'] = 1; | ||
this._copyProps(evt, e, DragDropTouchSingleton._kbdProps); | ||
this._copyProps(evt, t, DragDropTouchSingleton._ptProps); | ||
evt['dataTransfer'] = this._dataTransfer; | ||
if (Extras != null) { | ||
evt['movementX'] = Extras.movementX; | ||
evt['movementY'] = Extras.movementY; | ||
} | ||
target.dispatchEvent(evt); | ||
return evt.defaultPrevented; | ||
} | ||
return false; | ||
}; | ||
DragDropTouch.prototype._closestDraggable = function (e) { | ||
for (; e; e = e.parentElement) { | ||
if (e.hasAttribute('draggable') && e.getAttribute('draggable')) { | ||
return e; | ||
} | ||
} | ||
return null; | ||
}; | ||
// @ts-ignore | ||
var Singleton = new DragDropTouch(); | ||
Singleton._instance = Singleton; | ||
return Singleton; | ||
}()); | ||
DragDropTouchExport.DragDropTouch = DragDropTouchSingleton; | ||
var Singleton = DragDropTouch.DragDropTouch; | ||
Singleton._THRESHOLD = 5; // pixels to move before drag starts | ||
Singleton._OPACITY = 0.5; // drag image opacity | ||
Singleton._DBLCLICK = 500; // max ms between clicks in a double click | ||
Singleton._CTXMENU = 900; // ms to hold before raising 'contextmenu' event | ||
Singleton._ISPRESSHOLDMODE = false; // decides of press & hold mode presence | ||
Singleton._PRESSHOLDAWAIT = 400; // ms to wait before press & hold is detected | ||
Singleton._PRESSHOLDMARGIN = 25; // pixels that finger might shiver while pressing | ||
Singleton._PRESSHOLDTHRESHOLD = 0; // pixels to move before drag starts | ||
Singleton._rmvAtts = 'id,class,style,draggable'.split(','); | ||
Singleton._kbdProps = 'altKey,ctrlKey,metaKey,shiftKey'.split(','); | ||
Singleton._ptProps = 'pageX,pageY,clientX,clientY,screenX,screenY,offsetX,offsetY'.split(','); | ||
})(DragDropTouch || (DragDropTouch = {})); | ||
var DragDropTouch$1 = DragDropTouch; | ||
//----------------------------------------------------------------------------// | ||
var svelteDragDropTouch = DragDropTouch$1.DragDropTouch; | ||
export default svelteDragDropTouch; | ||
//# sourceMappingURL=svelte-drag-drop-touch.esm.js.map |
{ | ||
"name": "svelte-drag-drop-touch", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "HTML5 Drag-and-Drop support for mobile devices", | ||
"type": "module", | ||
"browser": "./dist/svelte-drag-drop-touch.bundled.js", | ||
"module": "./dist/svelte-drag-drop-touch.esm.js", | ||
"svelte": "./dist/svelte-drag-drop-touch.svelte.js", | ||
"svelte": "./dist/svelte-drag-drop-touch.esm.js", | ||
"types": "./dist/svelte-drag-drop-touch.d.ts", | ||
"exports": { | ||
"import": "./dist/svelte-drag-drop-touch.esm.js" | ||
".": { | ||
"require": "./dist/velte-drag-drop-touch.js", | ||
"import": "./dist/velte-drag-drop-touch.esm.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"types": "./dist/svelte-drag-drop-touch.d.ts", | ||
"scripts": { | ||
"build": "rimraf dist && tsc && rollup -c rollup.config.js && mv src/*.d.ts dist && mv src/*.js ./dist/svelte-drag-drop-touch.svelte.js", | ||
"build": "rimraf dist && rollup -c rollup.config.js && rollup -c rollup-bundling.config.js && tsc && mv src/*.d.ts dist && rm src/*.js*", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -43,4 +48,4 @@ }, | ||
"dependencies": { | ||
"dragdroptouch-bug-fixed": "file:../dragdroptouch-bug-fixed" | ||
"dragdroptouch-bug-fixed": "^1.0.8" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
// see https://remarkablemark.org/blog/2019/07/12/rollup-commonjs-umd/ | ||
// see https://github.com/rozek/build-configuration-study | ||
@@ -10,11 +10,20 @@ import commonjs from '@rollup/plugin-commonjs' | ||
input: './src/svelte-drag-drop-touch.ts', | ||
output: { | ||
file: './dist/svelte-drag-drop-touch.esm.js', | ||
format: 'esm', | ||
sourcemap:true | ||
}, | ||
output: [ | ||
{ | ||
file: './dist/svelte-drag-drop-touch.js', | ||
format: 'umd', // builds for both Node.js and Browser | ||
name: 'DragDropTouch', // required for UMD modules | ||
noConflict:true, | ||
sourcemap: true, | ||
exports: 'default', | ||
plugins: [terser({ format:{ comments:false, safari10:true } })], | ||
},{ | ||
file: './dist/svelte-drag-drop-touch.esm.js', | ||
format: 'esm', | ||
sourcemap:true | ||
} | ||
], | ||
plugins: [ | ||
resolve(), commonjs(), typescript(), | ||
terser({ format:{ comments:false, safari10:true } }) | ||
resolve(), commonjs(), typescript() | ||
], | ||
}; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
133714
15
524
1
+ Addeddragdroptouch-bug-fixed@1.0.8(transitive)