dnd-multi-backend
Advanced tools
Comparing version 5.0.0-rc02 to 5.0.0-rc03
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["dnd-multi-backend"]=e():n["dnd-multi-backend"]=e()}(window,(function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(r,o,function(e){return n[e]}.bind(null,o));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=12)}({12:function(n,e,t){"use strict";t.r(e);var r=function(n,e){return{_isMBTransition:!0,event:n,check:e}},o=r("touchstart",(function(n){return null!=n.touches})),i=r("dragstart",(function(n){return!!n.type&&(-1!==n.type.indexOf("drag")||-1!==n.type.indexOf("drop"))})),c=r("mousedown",(function(n){return!!n.type&&(-1===n.type.indexOf("touch")&&-1!==n.type.indexOf("mouse"))}));function a(n){return function(n){if(Array.isArray(n)){for(var e=0,t=new Array(n.length);e<n.length;e++)t[e]=n[e];return t}}(n)||function(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}var s=new function n(){var e=this;u(this,n),this.register=function(n){e.previews.push(n)},this.unregister=function(n){for(var t;-1!==(t=e.previews.indexOf(n));)e.previews.splice(t,1)},this.backendChanged=function(n){var t=!0,r=!1,o=void 0;try{for(var i,c=e.previews[Symbol.iterator]();!(t=(i=c.next()).done);t=!0){i.value.backendChanged(n)}}catch(n){r=!0,o=n}finally{try{t||null==c.return||c.return()}finally{if(r)throw o}}},this.previews=[]},d=function n(e,t,r){var o=this;u(this,n),this.setup=function(){if("undefined"!=typeof window){if(o.constructor.isSetUp)throw new Error("Cannot have two MultiBackends at the same time.");o.constructor.isSetUp=!0,o.addEventListeners(window),o.backends[o.current].instance.setup()}},this.teardown=function(){"undefined"!=typeof window&&(o.constructor.isSetUp=!1,o.removeEventListeners(window),o.backends[o.current].instance.teardown())},this.connectDragSource=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDragSource",e)},this.connectDragPreview=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDragPreview",e)},this.connectDropTarget=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDropTarget",e)},this.previewEnabled=function(){return o.backends[o.current].preview},this.addEventListeners=function(n){o.backends.forEach((function(e){e.transition&&n.addEventListener(e.transition.event,o.backendSwitcher,!0)}))},this.removeEventListeners=function(n){o.backends.forEach((function(e){e.transition&&n.removeEventListener(e.transition.event,o.backendSwitcher,!0)}))},this.backendSwitcher=function(n){var e=o.current,t=0;if(o.backends.some((function(e){return t!==o.current&&e.transition&&e.transition.check(n)?(o.current=t,!0):(t+=1,!1)})),o.current!==e){o.backends[e].instance.teardown(),Object.keys(o.nodes).forEach((function(n){var e=o.nodes[n];e.handler(),e.handler=o.callBackend(e.func,e.args)})),s.backendChanged(o);var r=o.backends[o.current];if(r.instance.setup(),r.skipDispatchOnTransition)return;var i=null;try{i=new n.constructor(n.type,n)}catch(e){(i=document.createEvent("Event")).initEvent(n.type,n.bubbles,n.cancelable)}n.target.dispatchEvent(i)}},this.callBackend=function(n,e){var t;return(t=o.backends[o.current].instance)[n].apply(t,a(e))},this.connectBackend=function(n,e){var t="".concat(n,"_").concat(e[0]),r=o.callBackend(n,e);return o.nodes[t]={func:n,args:e,handler:r},function(){var n,e=(n=o.nodes[t]).handler.apply(n,arguments);return delete o.nodes[t],e}};var i=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return t.forEach((function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})),n}({backends:[]},r||{});if(i.backends.length<1)throw new Error("You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)\n see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx");this.current=0,this.backends=[],i.backends.forEach((function(n){if(!n.backend)throw new Error("You must specify a 'backend' property in your Backend entry: ".concat(n));var r=n.transition;if(r&&!r._isMBTransition)throw new Error("You must specify a valid 'transition' property (either undefined or the return of 'createTransition') in your Backend entry: ".concat(n));o.backends.push({instance:n.backend(e,t,n.options),preview:n.preview||!1,transition:r,skipDispatchOnTransition:Boolean(n.skipDispatchOnTransition)})})),this.nodes={}};t.d(e,"HTML5DragTransition",(function(){return i})),t.d(e,"TouchTransition",(function(){return o})),t.d(e,"MouseTransition",(function(){return c})),t.d(e,"createTransition",(function(){return r})),t.d(e,"MultiBackend",(function(){return d})),t.d(e,"PreviewManager",(function(){return s}));e.default=function(n,e,t){return new d(n,e,t)}}})})); | ||
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["dnd-multi-backend"]=e():n["dnd-multi-backend"]=e()}(window,(function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(r,o,function(e){return n[e]}.bind(null,o));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=9)}({9:function(n,e,t){"use strict";t.r(e);var r=function(n,e){return{_isMBTransition:!0,event:n,check:e}},o=r("touchstart",(function(n){return null!=n.touches})),i=r("dragstart",(function(n){return!!n.type&&(-1!==n.type.indexOf("drag")||-1!==n.type.indexOf("drop"))})),c=r("mousedown",(function(n){return!!n.type&&(-1===n.type.indexOf("touch")&&-1!==n.type.indexOf("mouse"))}));function a(n){return function(n){if(Array.isArray(n)){for(var e=0,t=new Array(n.length);e<n.length;e++)t[e]=n[e];return t}}(n)||function(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}var s=new function n(){var e=this;u(this,n),this.register=function(n){e.previews.push(n)},this.unregister=function(n){for(var t;-1!==(t=e.previews.indexOf(n));)e.previews.splice(t,1)},this.backendChanged=function(n){var t=!0,r=!1,o=void 0;try{for(var i,c=e.previews[Symbol.iterator]();!(t=(i=c.next()).done);t=!0){i.value.backendChanged(n)}}catch(n){r=!0,o=n}finally{try{t||null==c.return||c.return()}finally{if(r)throw o}}},this.previews=[]},d=function n(e,t,r){var o=this;u(this,n),this.setup=function(){if("undefined"!=typeof window){if(o.constructor.isSetUp)throw new Error("Cannot have two MultiBackends at the same time.");o.constructor.isSetUp=!0,o.addEventListeners(window),o.backends[o.current].instance.setup()}},this.teardown=function(){"undefined"!=typeof window&&(o.constructor.isSetUp=!1,o.removeEventListeners(window),o.backends[o.current].instance.teardown())},this.connectDragSource=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDragSource",e)},this.connectDragPreview=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDragPreview",e)},this.connectDropTarget=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return o.connectBackend("connectDropTarget",e)},this.previewEnabled=function(){return o.backends[o.current].preview},this.addEventListeners=function(n){o.backends.forEach((function(e){e.transition&&n.addEventListener(e.transition.event,o.backendSwitcher,!0)}))},this.removeEventListeners=function(n){o.backends.forEach((function(e){e.transition&&n.removeEventListener(e.transition.event,o.backendSwitcher,!0)}))},this.backendSwitcher=function(n){var e=o.current,t=0;if(o.backends.some((function(e){return t!==o.current&&e.transition&&e.transition.check(n)?(o.current=t,!0):(t+=1,!1)})),o.current!==e){o.backends[e].instance.teardown(),Object.keys(o.nodes).forEach((function(n){var e=o.nodes[n];e.handler(),e.handler=o.callBackend(e.func,e.args)})),s.backendChanged(o);var r=o.backends[o.current];if(r.instance.setup(),r.skipDispatchOnTransition)return;var i=null;try{i=new n.constructor(n.type,n)}catch(e){(i=document.createEvent("Event")).initEvent(n.type,n.bubbles,n.cancelable)}n.target.dispatchEvent(i)}},this.callBackend=function(n,e){var t;return(t=o.backends[o.current].instance)[n].apply(t,a(e))},this.connectBackend=function(n,e){var t="".concat(n,"_").concat(e[0]),r=o.callBackend(n,e);return o.nodes[t]={func:n,args:e,handler:r},function(){var n,e=(n=o.nodes[t]).handler.apply(n,arguments);return delete o.nodes[t],e}};var i=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return t.forEach((function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})),n}({backends:[]},r||{});if(i.backends.length<1)throw new Error("You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)\n see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx");this.current=0,this.backends=[],i.backends.forEach((function(n){if(!n.backend)throw new Error("You must specify a 'backend' property in your Backend entry: ".concat(n));var r=n.transition;if(r&&!r._isMBTransition)throw new Error("You must specify a valid 'transition' property (either undefined or the return of 'createTransition') in your Backend entry: ".concat(n));o.backends.push({instance:n.backend(e,t,n.options),preview:n.preview||!1,transition:r,skipDispatchOnTransition:Boolean(n.skipDispatchOnTransition)})})),this.nodes={}};t.d(e,"HTML5DragTransition",(function(){return i})),t.d(e,"TouchTransition",(function(){return o})),t.d(e,"MouseTransition",(function(){return c})),t.d(e,"createTransition",(function(){return r})),t.d(e,"MultiBackend",(function(){return d})),t.d(e,"PreviewManager",(function(){return s}));e.default=function(n,e,t){return new d(n,e,t)}}})})); |
{ | ||
"name": "dnd-multi-backend", | ||
"version": "5.0.0-rc02", | ||
"version": "5.0.0-rc03", | ||
"description": "Multi Backend system compatible with DnD Core / React DnD", | ||
@@ -5,0 +5,0 @@ "author": "Louis Brunner <louis.brunner.fr@gmail.com> (https://github.com/LouisBrunner)", |
@@ -116,3 +116,3 @@ # DnD Multi Backend [![NPM Version][npm-image]][npm-url] [![dependencies Status][deps-image]][deps-url] [![devDependencies Status][deps-dev-image]][deps-dev-url] | ||
MIT, Copyright (c) 2016-2018 Louis Brunner | ||
MIT, Copyright (c) 2016-2019 Louis Brunner | ||
@@ -119,0 +119,0 @@ |
30018