vue3-touch-hammer
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -244,4 +244,5 @@ import Hammer from 'hammerjs'; | ||
install: install, | ||
registerCustomEvent: registerCustomEvent | ||
}; | ||
export { Component as VTouch, customEvents, registerCustomEvent };export default plugin; | ||
export { Component as VTouch, customEvents };export default plugin; |
@@ -250,2 +250,3 @@ (function (global, factory) { | ||
install: install, | ||
registerCustomEvent: registerCustomEvent | ||
}; | ||
@@ -256,3 +257,2 @@ | ||
exports.customEvents = customEvents; | ||
exports.registerCustomEvent = registerCustomEvent; | ||
@@ -259,0 +259,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("hammerjs")):"function"==typeof define&&define.amd?define(["exports","hammerjs"],n):n(e.VueTouch=e.VueTouch||{},e.Hammer)}(this,function(e,n){"use strict";function t(){return{type:Object,default:function(){return{}}}}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e){var t=e.direction;if("string"==typeof t){var i="DIRECTION_"+t.toUpperCase();o.indexOf(t)>-1&&n.hasOwnProperty(i)?e.direction=n[i]:console.warn("[vue-touch] invalid direction: "+t)}return e}n="default"in n?n.default:n;var o=["up","down","left","right","horizontal","vertical","all"],a={pan:"pan",panstart:"pan",panmove:"pan",panend:"pan",pancancel:"pan",panleft:"pan",panright:"pan",panup:"pan",pandown:"pan",pinch:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",pinchin:"pinch",pinchout:"pinch",press:"press",pressup:"press",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe",tap:"tap"},s=function(e){return a[e]},c=function(e){return"object"==typeof e&&Object.values(e).every(function(e){return Array.isArray(e)})},p={},u=function(e){return void 0===e?p:p[e]},l=function(e,n){void 0===n&&(n={}),n.event=e,p[e]=n,e in d.props||(d.props[e]=t())},d={props:{options:t(),tap:t(),pan:t(),pinch:t(),press:t(),rotate:t(),swipe:t(),tag:{type:String,default:"div"},recognizeWith:{type:Object,default:function(){return{}},validate:c},requireFailure:{type:Object,default:function(){return{}},validate:c},enabled:{default:!0,type:[Boolean,Object]}},mounted:function(){this.$isServer||(this.hammer=new n.Manager(this.$el,this.options),this.recognizers={},this.setupRecognizers(),this.setupRecognizerDependencies(),this.updateEnabled(this.enabled))},destroyed:function(){this.$isServer||this.hammer.destroy()},watch:{enabled:{deep:!0,handler:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this).updateEnabled.apply(t,e);var t}}},methods:{setupRecognizers:function(){for(var e=this,n=0,t=Object.keys(e._events);n<t.length;n+=1){var i=t[n];if(s(i)){e.addEvent(i),i=s(i);var r=Object.assign({},e.$options.config[i]||{},e[i]);e.addRecognizer(i,r)}else{if(!u(i))throw new Error("Unknown gesture: "+i);e.addEvent(i);var o=Object.assign({},u(i),e[i]);e.addRecognizer(i,o,{mainGesture:o.type})}}},setupRecognizerDependencies:function(){for(var e=this,n=0,t=Object.entries(e.recognizeWith);n<t.length;n+=1){var i=t[n],r=i[0],o=i[1];e.recognizers[r]&&e.recognizers[r].recognizeWith(o.map(function(n){return e.recognizers[n]}))}for(var a=0,s=Object.entries(e.requireFailure);a<s.length;a+=1){var c=s[a],p=c[0],u=c[1];e.recognizers[p]&&e.recognizers[p].requireFailure(u.map(function(n){return e.recognizers[n]}))}},addRecognizer:function(e,t,o){void 0===o&&(o={});var a=o.mainGesture;this.recognizers[e]||(this.recognizers[e]=new(n[i(a||e)])(r(t)),this.hammer.add(this.recognizers[e]))},addEvent:function(e){var n=this;this.hammer.on(e,function(t){return n.$emit(e,t)})},updateEnabled:function(e,n){var t=this;if(e===!0)this.enableAll();else if(e===!1)this.disableAll();else if("object"==typeof e)for(var i=0,r=Object.entries(e);i<r.length;i+=1){var o=r[i],a=o[0],s=o[1];t.recognizers[a]&&s?t.enable(a):t.disable(a)}},enable:function(e){var n=this.recognizers[e];n.options.enable||n.set({enable:!0})},disable:function(e){var n=this.recognizers[e];n.options.enable&&n.set({enable:!1})},toggle:function(e){var n=this.recognizers[e];n&&(n.options.enable?this.disable(e):this.enable(e))},enableAll:function(){this.setAll({enable:!0})},disableAll:function(){this.setAll({enable:!1})},setAll:function(e){for(var n=this,t=e.enable,i=0,r=Object.values(n.recognizers);i<r.length;i+=1){var o=r[i];o.options.enable!==t&&o.set({enable:t})}},isEnabled:function(e){return this.recognizers[e]&&this.recognizers[e].options.enable}},render:function(e){return e(this.tag,{},this.$slots.default)}},h=function(e,n){void 0===n&&(n={}),h.installed!==!0&&(h.installed=!0,d.config=h.config,e.component(n.name||"v-touch",d))};h.config={};var f=function(e,n){return h.installed?void console.warn("\n [vue-touch]: Custom Event '"+e+"' couldn't be added to vue-touch.\n Custom Events have to be registered before installing the plugin.\n "):void l(e,n)},v={install:h};e.default=v,e.VTouch=d,e.customEvents=u,e.registerCustomEvent=f,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("hammerjs")):"function"==typeof define&&define.amd?define(["exports","hammerjs"],n):n(e.VueTouch=e.VueTouch||{},e.Hammer)}(this,function(e,n){"use strict";function t(){return{type:Object,default:function(){return{}}}}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e){var t=e.direction;if("string"==typeof t){var i="DIRECTION_"+t.toUpperCase();o.indexOf(t)>-1&&n.hasOwnProperty(i)?e.direction=n[i]:console.warn("[vue-touch] invalid direction: "+t)}return e}n="default"in n?n.default:n;var o=["up","down","left","right","horizontal","vertical","all"],a={pan:"pan",panstart:"pan",panmove:"pan",panend:"pan",pancancel:"pan",panleft:"pan",panright:"pan",panup:"pan",pandown:"pan",pinch:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",pinchin:"pinch",pinchout:"pinch",press:"press",pressup:"press",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe",tap:"tap"},s=function(e){return a[e]},c=function(e){return"object"==typeof e&&Object.values(e).every(function(e){return Array.isArray(e)})},p={},u=function(e){return void 0===e?p:p[e]},l=function(e,n){void 0===n&&(n={}),n.event=e,p[e]=n,e in d.props||(d.props[e]=t())},d={props:{options:t(),tap:t(),pan:t(),pinch:t(),press:t(),rotate:t(),swipe:t(),tag:{type:String,default:"div"},recognizeWith:{type:Object,default:function(){return{}},validate:c},requireFailure:{type:Object,default:function(){return{}},validate:c},enabled:{default:!0,type:[Boolean,Object]}},mounted:function(){this.$isServer||(this.hammer=new n.Manager(this.$el,this.options),this.recognizers={},this.setupRecognizers(),this.setupRecognizerDependencies(),this.updateEnabled(this.enabled))},destroyed:function(){this.$isServer||this.hammer.destroy()},watch:{enabled:{deep:!0,handler:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this).updateEnabled.apply(t,e);var t}}},methods:{setupRecognizers:function(){for(var e=this,n=0,t=Object.keys(e._events);n<t.length;n+=1){var i=t[n];if(s(i)){e.addEvent(i),i=s(i);var r=Object.assign({},e.$options.config[i]||{},e[i]);e.addRecognizer(i,r)}else{if(!u(i))throw new Error("Unknown gesture: "+i);e.addEvent(i);var o=Object.assign({},u(i),e[i]);e.addRecognizer(i,o,{mainGesture:o.type})}}},setupRecognizerDependencies:function(){for(var e=this,n=0,t=Object.entries(e.recognizeWith);n<t.length;n+=1){var i=t[n],r=i[0],o=i[1];e.recognizers[r]&&e.recognizers[r].recognizeWith(o.map(function(n){return e.recognizers[n]}))}for(var a=0,s=Object.entries(e.requireFailure);a<s.length;a+=1){var c=s[a],p=c[0],u=c[1];e.recognizers[p]&&e.recognizers[p].requireFailure(u.map(function(n){return e.recognizers[n]}))}},addRecognizer:function(e,t,o){void 0===o&&(o={});var a=o.mainGesture;this.recognizers[e]||(this.recognizers[e]=new(n[i(a||e)])(r(t)),this.hammer.add(this.recognizers[e]))},addEvent:function(e){var n=this;this.hammer.on(e,function(t){return n.$emit(e,t)})},updateEnabled:function(e,n){var t=this;if(e===!0)this.enableAll();else if(e===!1)this.disableAll();else if("object"==typeof e)for(var i=0,r=Object.entries(e);i<r.length;i+=1){var o=r[i],a=o[0],s=o[1];t.recognizers[a]&&s?t.enable(a):t.disable(a)}},enable:function(e){var n=this.recognizers[e];n.options.enable||n.set({enable:!0})},disable:function(e){var n=this.recognizers[e];n.options.enable&&n.set({enable:!1})},toggle:function(e){var n=this.recognizers[e];n&&(n.options.enable?this.disable(e):this.enable(e))},enableAll:function(){this.setAll({enable:!0})},disableAll:function(){this.setAll({enable:!1})},setAll:function(e){for(var n=this,t=e.enable,i=0,r=Object.values(n.recognizers);i<r.length;i+=1){var o=r[i];o.options.enable!==t&&o.set({enable:t})}},isEnabled:function(e){return this.recognizers[e]&&this.recognizers[e].options.enable}},render:function(e){return e(this.tag,{},this.$slots.default)}},h=function(e,n){void 0===n&&(n={}),h.installed!==!0&&(h.installed=!0,d.config=h.config,e.component(n.name||"v-touch",d))};h.config={};var f=function(e,n){return h.installed?void console.warn("\n [vue-touch]: Custom Event '"+e+"' couldn't be added to vue-touch.\n Custom Events have to be registered before installing the plugin.\n "):void l(e,n)},v={install:h,registerCustomEvent:f};e.default=v,e.VTouch=d,e.customEvents=u,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vue3-touch-hammer", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "dist/vue-touch.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "dist/vue-touch.esm.js", |
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
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
50310
512