@dflex/draggable
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -1,2 +0,2 @@ | ||
var t=function t(e){var r=e.element,n=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,["element"]);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element=r,Object.assign(this,n)},e=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.registry={}}var e;return(e=[{key:"register",value:function(t,e){var r=t.id;this.registry[r]="function"==typeof e?new e(t):t}},{key:"getElmById",value:function(t){return this.registry[t]}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=new(function(r){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(p,e);var c,f,l,s=(f=p,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=u(f);if(l){var r=u(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return a(this,t)});function p(){return n(this,p),s.apply(this,arguments)}return(c=[{key:"register",value:function(e){o(u(p.prototype),"register",this).call(this,Object.assign(e,{translateY:0,translateX:0}),t)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(p.prototype,c),p}());function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(e,r){var n=r.x,o=r.y,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(this,t);var a=i.isTransitionEnabled;this.draggedElm=e;var u=this.draggedElm,c=u.translateX,l=u.translateY,s=u.element.style;this.draggedStyle=s,this.outerOffsetX=-n+c,this.outerOffsetY=-o+l,this.tempTranslate={x:0,y:0},this.draggedStyleProps=a?[{prop:"zIndex",value:"99"},{prop:"pointerEvents",value:"none"},{prop:"transition",value:"opacity 0.2s cubic-bezier(0.2, 0, 0, 1) 0s"}]:[{prop:"zIndex",value:"99"}],this.setDragged(!0)}var e;return(e=[{key:"setDragged",value:function(t){var e=this;t?this.draggedStyleProps.forEach(function(t){var r=t.prop,n=t.value;e.draggedStyle[r]=n}):this.draggedStyleProps.forEach(function(t){var r=t.prop;e.draggedStyle[r]=null})}},{key:"translate",value:function(t,e){this.tempTranslate.x=t+this.outerOffsetX,this.tempTranslate.y=e+this.outerOffsetY,this.draggedStyle.transform="translate(".concat(this.tempTranslate.x,"px,").concat(this.tempTranslate.y,"px)")}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function y(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(i,l);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=h(r);if(n){var o=h(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return y(this,t)});function i(t,e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var n=c.getElmById(t);return o.call(this,n,e,r)}return(e=[{key:"dragAt",value:function(t,e){this.translate(t,e),this.draggedElm.translateX=this.tempTranslate.x,this.draggedElm.translateY=this.tempTranslate.y}},{key:"endDragging",value:function(){this.setDragged(!1)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(i.prototype,e),i}();exports.Draggable=b,exports.store=c; | ||
var t=function t(e){var r=e.element,n=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,["element"]);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element=r,Object.assign(this,n)},e=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.registry={}}var e;return(e=[{key:"register",value:function(t,e){var r=t.id;this.registry[r]="function"==typeof e?new e(t):t}},{key:"getElmById",value:function(t){return this.registry[t]}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=new(function(r){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(p,e);var u,f,l,s=(f=p,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=c(f);if(l){var r=c(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return a(this,t)});function p(){return n(this,p),s.apply(this,arguments)}return(u=[{key:"register",value:function(e){o(c(p.prototype),"register",this).call(this,Object.assign(e,{translateY:0,translateX:0}),t)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(p.prototype,u),p}()),f=function(){function t(e,r){var n=r.x,o=r.y;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.draggedElm=e;var i=this.draggedElm,a=i.translateX,c=i.translateY,u=i.element.style;this.draggedStyle=u,this.outerOffsetX=-n+a,this.outerOffsetY=-o+c,this.tempTranslate={x:0,y:0},this.draggedStyleProps=[{prop:"zIndex",value:"99"}],this.setDragged(!0)}var e;return(e=[{key:"setDragged",value:function(t){var e=this;t?this.draggedStyleProps.forEach(function(t){var r=t.prop,n=t.value;e.draggedStyle[r]=n}):this.draggedStyleProps.forEach(function(t){var r=t.prop;e.draggedStyle[r]=null})}},{key:"translate",value:function(t,e){this.tempTranslate.x=t+this.outerOffsetX,this.tempTranslate.y=e+this.outerOffsetY,this.draggedStyle.transform="translate(".concat(this.tempTranslate.x,"px,").concat(this.tempTranslate.y,"px)")}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(i,f);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=y(r);if(n){var o=y(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return p(this,t)});function i(t,e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var n=u.getElmById(t);return o.call(this,n,e,r)}return(e=[{key:"dragAt",value:function(t,e){this.translate(t,e),this.draggedElm.translateX=this.tempTranslate.x,this.draggedElm.translateY=this.tempTranslate.y}},{key:"endDragging",value:function(){this.setDragged(!1)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(i.prototype,e),i}();exports.Draggable=h,exports.store=u; | ||
//# sourceMappingURL=dflexDraggable.min.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).dflexDraggable={})}(this,function(t){var e=function t(e){var n=e.element,r=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(e,["element"]);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element=n,Object.assign(this,r)};function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=new(function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var n,c,f,l=(c=s,f=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=u(c);if(f){var n=u(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return a(this,t)});function s(){return r(this,s),l.apply(this,arguments)}return(n=[{key:"register",value:function(t){o(u(s.prototype),"register",this).call(this,Object.assign(t,{translateY:0,translateX:0}),e)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(s.prototype,n),s}(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.registry={}}var e;return(e=[{key:"register",value:function(t,e){var n=t.id;this.registry[n]="function"==typeof e?new e(t):t}},{key:"getElmById",value:function(t){return this.registry[t]}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,e),t}()));function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(i,t);var e,n,r,o=(n=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=y(n);if(r){var o=y(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return p(this,t)});function i(t,e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var r=c.getElmById(t);return o.call(this,r,e,n)}return(e=[{key:"dragAt",value:function(t,e){this.translate(t,e),this.draggedElm.translateX=this.tempTranslate.x,this.draggedElm.translateY=this.tempTranslate.y}},{key:"endDragging",value:function(){this.setDragged(!1)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(i.prototype,e),i}(function(){function t(e,n){var r=n.x,o=n.y,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(this,t);var a=i.isTransitionEnabled;this.draggedElm=e;var u=this.draggedElm,c=u.translateX,l=u.translateY,s=u.element.style;this.draggedStyle=s,this.outerOffsetX=-r+c,this.outerOffsetY=-o+l,this.tempTranslate={x:0,y:0},this.draggedStyleProps=a?[{prop:"zIndex",value:"99"},{prop:"pointerEvents",value:"none"},{prop:"transition",value:"opacity 0.2s cubic-bezier(0.2, 0, 0, 1) 0s"}]:[{prop:"zIndex",value:"99"}],this.setDragged(!0)}var e;return(e=[{key:"setDragged",value:function(t){var e=this;t?this.draggedStyleProps.forEach(function(t){var n=t.prop,r=t.value;e.draggedStyle[n]=r}):this.draggedStyleProps.forEach(function(t){var n=t.prop;e.draggedStyle[n]=null})}},{key:"translate",value:function(t,e){this.tempTranslate.x=t+this.outerOffsetX,this.tempTranslate.y=e+this.outerOffsetY,this.draggedStyle.transform="translate(".concat(this.tempTranslate.x,"px,").concat(this.tempTranslate.y,"px)")}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,e),t}());t.Draggable=h,t.store=c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).dflexDraggable={})}(this,function(t){var e=function t(e){var n=e.element,r=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(e,["element"]);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element=n,Object.assign(this,r)};function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=new(function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var n,c,f,l=(c=s,f=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=u(c);if(f){var n=u(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return a(this,t)});function s(){return r(this,s),l.apply(this,arguments)}return(n=[{key:"register",value:function(t){o(u(s.prototype),"register",this).call(this,Object.assign(t,{translateY:0,translateX:0}),e)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(s.prototype,n),s}(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.registry={}}var e;return(e=[{key:"register",value:function(t,e){var n=t.id;this.registry[n]="function"==typeof e?new e(t):t}},{key:"getElmById",value:function(t){return this.registry[t]}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,e),t}()));function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(i,t);var e,n,r,o=(n=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=p(n);if(r){var o=p(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return s(this,t)});function i(t,e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var r=c.getElmById(t);return o.call(this,r,e,n)}return(e=[{key:"dragAt",value:function(t,e){this.translate(t,e),this.draggedElm.translateX=this.tempTranslate.x,this.draggedElm.translateY=this.tempTranslate.y}},{key:"endDragging",value:function(){this.setDragged(!1)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(i.prototype,e),i}(function(){function t(e,n){var r=n.x,o=n.y;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.draggedElm=e;var i=this.draggedElm,a=i.translateX,u=i.translateY,c=i.element.style;this.draggedStyle=c,this.outerOffsetX=-r+a,this.outerOffsetY=-o+u,this.tempTranslate={x:0,y:0},this.draggedStyleProps=[{prop:"zIndex",value:"99"}],this.setDragged(!0)}var e;return(e=[{key:"setDragged",value:function(t){var e=this;t?this.draggedStyleProps.forEach(function(t){var n=t.prop,r=t.value;e.draggedStyle[n]=r}):this.draggedStyleProps.forEach(function(t){var n=t.prop;e.draggedStyle[n]=null})}},{key:"translate",value:function(t,e){this.tempTranslate.x=t+this.outerOffsetX,this.tempTranslate.y=e+this.outerOffsetY,this.draggedStyle.transform="translate(".concat(this.tempTranslate.x,"px,").concat(this.tempTranslate.y,"px)")}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,e),t}());t.Draggable=y,t.store=c}); | ||
//# sourceMappingURL=dflexDraggable.min.umd.js.map |
{ | ||
"name": "@dflex/draggable", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"main": "dist/dflexDraggable.min.cjs.js", | ||
@@ -11,3 +11,4 @@ "umd:main": "dist/dflexDraggable.min.umd", | ||
}, | ||
"repository": "https://github.com/jalal246/dflex/tree/master/packages/draggable", | ||
"homepage": "https://github.com/jalal246/dflex/tree/master/packages/draggable", | ||
"repository": "https://github.com/jalal246/dflex", | ||
"license": "GPL-3.0", | ||
@@ -41,3 +42,3 @@ "files": [ | ||
}, | ||
"gitHead": "46d08c798de6c6e1899889c5f0df1d2b32fd225c" | ||
"gitHead": "10574eb2aa2169be0d40a122ca5d43ae5bad54a6" | ||
} |
# @dflex/draggable | ||
> Draggable is a native component written in pure JS works for Web and Mobile | ||
> Draggable is a native utility written in pure JS works for Web and Mobile | ||
@@ -10,9 +10,11 @@ ```bash | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/jalal246/dflex/master/packages/draggable/img/draggable.gif" alt="show how dragabble works" /> | ||
<img | ||
src="https://raw.githubusercontent.com/jalal246/dflex/master/packages/draggable/img/draggable.gif" | ||
alt="show how draggable works" /> | ||
</p> | ||
DFlex draggable is the simplest solution to create JavaScript draggable | ||
elements. No need for special tutorial and thinking about implementation | ||
elements. No need for a special tutorial and thinking about implementation | ||
complexity or even migration to different technologies for different frameworks. | ||
It can be used with any JavaScript frameworks React, Vue, Angular. | ||
It can be used with any app you have whether it is React, Vue, Angular or Svelte.s | ||
@@ -59,4 +61,2 @@ ## API | ||
Contributes feel free to apply PR for another frameworks. | ||
## Test | ||
@@ -71,1 +71,9 @@ | ||
This package is licensed under the [GPL-3.0 License](https://github.com/jalal246/dflex/tree/master/packages/draggable/LICENSE) | ||
## Contribution | ||
If you like this project, you can support it by contributing. If you find a bug, | ||
please let me know, applying a pull request is welcome. This project needs your | ||
support. You can fix typos, add new examples, or build with me new features. | ||
> Support this project by giving it a Star ⭐ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
77
71001
208