Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-touch-hammer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-touch-hammer - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

dist/hammer-ssr.js
export default function Hammer() {
console.log(`[vue-touch] Your should never see this message.
When you do, your code tried to call 'new Hammer(), but your app has included a stub for HammerJS, provided by vue-touch, instead of the actual HammerJS library.
`)
`);
}

@@ -8,8 +8,8 @@ import Hammer from 'hammerjs';

default: function () {
return {}
}
}
return {};
},
};
}
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
return str.charAt(0).toUpperCase() + str.slice(1);
}

@@ -27,3 +27,3 @@ var directions = ['up', 'down', 'left', 'right', 'horizontal', 'vertical', 'all'];

}
return options
return options;
}

@@ -61,3 +61,3 @@

swipedown: 'swipe',
tap: 'tap'
tap: 'tap',
};

@@ -68,3 +68,3 @@ var normalizeGesture = function (name) { return gestureMap[name]; };

var events = {};
var customEvents = function (name) { return name === undefined ? events : events[name]; };
var customEvents = function (name) { return (name === undefined ? events : events[name]); };
var register = function (event, options) {

@@ -95,3 +95,4 @@ if ( options === void 0 ) options = {};

requireFailure: {
type: Object, default: function () { return ({}); },
type: Object,
default: function () { return ({}); },
validate: objectHasArrayValues,

@@ -102,5 +103,14 @@ },

type: [Boolean, Object],
}
},
},
mounted: function mounted() {
this._events = Object.keys(this.$attrs)
.map(function (el, id) {
if (el.startsWith('on')) {
return el.replace(/(^on)/gi, '').toLowerCase();
}
})
.filter(function (element) {
return element !== undefined;
});
if (!this.$isServer) {

@@ -127,9 +137,9 @@ this.hammer = new Hammer.Manager(this.$el, this.options);

var ref;
}
}
},
},
},
methods: {
setupRecognizers: function setupRecognizers() {
setupRecognizers: function setupRecognizers() {
var this$1 = this;
for (var i = 0, list = Object.keys(this$1._events); i < list.length; i += 1) {
for (var i = 0, list = this$1._events; i < list.length; i += 1) {
var gesture = list[i];

@@ -146,3 +156,3 @@ if (normalizeGesture(gesture)) {

} else {
throw new Error(("Unknown gesture: " + gesture))
throw new Error(("Unknown gesture: " + gesture));
}

@@ -228,8 +238,7 @@ }

isEnabled: function isEnabled(gesture) {
return this.recognizers[gesture] && this.recognizers[gesture].options.enable
}
return this.recognizers[gesture] && this.recognizers[gesture].options.enable;
},
},
render: function render(){
console.log('r', this.tag, this.$slots.default, this.$slots);
h(this.tag, this.$slots.default());
render: function render() {
return h(this.tag, {}, this.$slots.default());
},

@@ -240,3 +249,3 @@ };

if ( options === void 0 ) options = {};
if (install.installed === true) { return }
if (install.installed === true) { return; }
install.installed = true;

@@ -250,3 +259,3 @@ Component.config = install.config;

console.warn(("\n [vue-touch]: Custom Event '" + event + "' couldn't be added to vue-touch.\n Custom Events have to be registered before installing the plugin.\n "));
return
return;
}

@@ -257,5 +266,5 @@ register(event, options);

install: install,
registerCustomEvent: registerCustomEvent
registerCustomEvent: registerCustomEvent,
};
export { Component as VTouch, customEvents };export default plugin;

@@ -13,8 +13,8 @@ (function (global, factory) {

default: function () {
return {}
}
}
return {};
},
};
}
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
return str.charAt(0).toUpperCase() + str.slice(1);
}

@@ -32,3 +32,3 @@ var directions = ['up', 'down', 'left', 'right', 'horizontal', 'vertical', 'all'];

}
return options
return options;
}

@@ -66,3 +66,3 @@

swipedown: 'swipe',
tap: 'tap'
tap: 'tap',
};

@@ -73,3 +73,3 @@ var normalizeGesture = function (name) { return gestureMap[name]; };

var events = {};
var customEvents = function (name) { return name === undefined ? events : events[name]; };
var customEvents = function (name) { return (name === undefined ? events : events[name]); };
var register = function (event, options) {

@@ -100,3 +100,4 @@ if ( options === void 0 ) options = {};

requireFailure: {
type: Object, default: function () { return ({}); },
type: Object,
default: function () { return ({}); },
validate: objectHasArrayValues,

@@ -107,5 +108,14 @@ },

type: [Boolean, Object],
}
},
},
mounted: function mounted() {
this._events = Object.keys(this.$attrs)
.map(function (el, id) {
if (el.startsWith('on')) {
return el.replace(/(^on)/gi, '').toLowerCase();
}
})
.filter(function (element) {
return element !== undefined;
});
if (!this.$isServer) {

@@ -132,9 +142,9 @@ this.hammer = new Hammer.Manager(this.$el, this.options);

var ref;
}
}
},
},
},
methods: {
setupRecognizers: function setupRecognizers() {
setupRecognizers: function setupRecognizers() {
var this$1 = this;
for (var i = 0, list = Object.keys(this$1._events); i < list.length; i += 1) {
for (var i = 0, list = this$1._events; i < list.length; i += 1) {
var gesture = list[i];

@@ -151,3 +161,3 @@ if (normalizeGesture(gesture)) {

} else {
throw new Error(("Unknown gesture: " + gesture))
throw new Error(("Unknown gesture: " + gesture));
}

@@ -233,8 +243,7 @@ }

isEnabled: function isEnabled(gesture) {
return this.recognizers[gesture] && this.recognizers[gesture].options.enable
}
return this.recognizers[gesture] && this.recognizers[gesture].options.enable;
},
},
render: function render(){
console.log('r', this.tag, this.$slots.default, this.$slots);
vue.h(this.tag, this.$slots.default());
render: function render() {
return vue.h(this.tag, {}, this.$slots.default());
},

@@ -245,3 +254,3 @@ };

if ( options === void 0 ) options = {};
if (install.installed === true) { return }
if (install.installed === true) { return; }
install.installed = true;

@@ -255,3 +264,3 @@ Component.config = install.config;

console.warn(("\n [vue-touch]: Custom Event '" + event + "' couldn't be added to vue-touch.\n Custom Events have to be registered before installing the plugin.\n "));
return
return;
}

@@ -262,3 +271,3 @@ register(event, options);

install: install,
registerCustomEvent: registerCustomEvent
registerCustomEvent: registerCustomEvent,
};

@@ -265,0 +274,0 @@

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("hammerjs"),require("vue")):"function"==typeof define&&define.amd?define(["exports","hammerjs","vue"],n):n(e.VueTouch=e.VueTouch||{},e.Hammer,e.vue)}(this,function(e,n,t){"use strict";function i(){return{type:Object,default:function(){return{}}}}function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}function o(e){var t=e.direction;if("string"==typeof t){var i="DIRECTION_"+t.toUpperCase();s.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 s=["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"},c=function(e){return a[e]},u=function(e){return"object"==typeof e&&Object.values(e).every(function(e){return Array.isArray(e)})},p={},l=function(e){return void 0===e?p:p[e]},h=function(e,n){void 0===n&&(n={}),n.event=e,p[e]=n,e in d.props||(d.props[e]=i())},d={props:{options:i(),tap:i(),pan:i(),pinch:i(),press:i(),rotate:i(),swipe:i(),tag:{type:String,default:"div"},recognizeWith:{type:Object,default:function(){return{}},validate:u},requireFailure:{type:Object,default:function(){return{}},validate:u},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(c(i)){e.addEvent(i),i=c(i);var r=Object.assign({},e.$options.config[i]||{},e[i]);e.addRecognizer(i,r)}else{if(!l(i))throw new Error("Unknown gesture: "+i);e.addEvent(i);var o=Object.assign({},l(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 s=0,a=Object.entries(e.requireFailure);s<a.length;s+=1){var c=a[s],u=c[0],p=c[1];e.recognizers[u]&&e.recognizers[u].requireFailure(p.map(function(n){return e.recognizers[n]}))}},addRecognizer:function(e,t,i){void 0===i&&(i={});var s=i.mainGesture;this.recognizers[e]||(this.recognizers[e]=new(n[r(s||e)])(o(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],s=o[0],a=o[1];t.recognizers[s]&&a?t.enable(s):t.disable(s)}},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(){console.log("r",this.tag,this.$slots.default,this.$slots),t.h(this.tag,this.$slots.default())}},f=function(e,n){void 0===n&&(n={}),f.installed!==!0&&(f.installed=!0,d.config=f.config,e.component(n.name||"v-touch",d))};f.config={};var v=function(e,n){return f.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 h(e,n)},g={install:f,registerCustomEvent:v};e.default=g,e.VTouch=d,e.customEvents=l,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("hammerjs"),require("vue")):"function"==typeof define&&define.amd?define(["exports","hammerjs","vue"],n):n(e.VueTouch=e.VueTouch||{},e.Hammer,e.vue)}(this,function(e,n,t){"use strict";function i(){return{type:Object,default:function(){return{}}}}function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}function o(e){var t=e.direction;if("string"==typeof t){var i="DIRECTION_"+t.toUpperCase();s.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 s=["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"},c=function(e){return a[e]},u=function(e){return"object"==typeof e&&Object.values(e).every(function(e){return Array.isArray(e)})},p={},l=function(e){return void 0===e?p:p[e]},h=function(e,n){void 0===n&&(n={}),n.event=e,p[e]=n,e in d.props||(d.props[e]=i())},d={props:{options:i(),tap:i(),pan:i(),pinch:i(),press:i(),rotate:i(),swipe:i(),tag:{type:String,default:"div"},recognizeWith:{type:Object,default:function(){return{}},validate:u},requireFailure:{type:Object,default:function(){return{}},validate:u},enabled:{default:!0,type:[Boolean,Object]}},mounted:function(){this._events=Object.keys(this.$attrs).map(function(e,n){if(e.startsWith("on"))return e.replace(/(^on)/gi,"").toLowerCase()}).filter(function(e){return void 0!==e}),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=e._events;n<t.length;n+=1){var i=t[n];if(c(i)){e.addEvent(i),i=c(i);var r=Object.assign({},e.$options.config[i]||{},e[i]);e.addRecognizer(i,r)}else{if(!l(i))throw new Error("Unknown gesture: "+i);e.addEvent(i);var o=Object.assign({},l(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 s=0,a=Object.entries(e.requireFailure);s<a.length;s+=1){var c=a[s],u=c[0],p=c[1];e.recognizers[u]&&e.recognizers[u].requireFailure(p.map(function(n){return e.recognizers[n]}))}},addRecognizer:function(e,t,i){void 0===i&&(i={});var s=i.mainGesture;this.recognizers[e]||(this.recognizers[e]=new(n[r(s||e)])(o(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(!0===e)this.enableAll();else if(!1===e)this.disableAll();else if("object"==typeof e)for(var i=0,r=Object.entries(e);i<r.length;i+=1){var o=r[i],s=o[0],a=o[1];t.recognizers[s]&&a?t.enable(s):t.disable(s)}},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(){return t.h(this.tag,{},this.$slots.default())}},f=function(e,n){void 0===n&&(n={}),!0!==f.installed&&(f.installed=!0,d.config=f.config,e.component(n.name||"v-touch",d))};f.config={};var v=function(e,n){if(f.installed)return 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 ");h(e,n)},g={install:f,registerCustomEvent:v};e.default=g,e.VTouch=d,e.customEvents=l,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vue3-touch-hammer",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/vue-touch.js",

@@ -22,3 +22,4 @@ "jsnext:main": "dist/vue-touch.esm.js",

"devDependencies": {
"ava": "^0.17.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.21.4",
"babel-preset-es2015-node6": "^0.4.0",

@@ -32,4 +33,9 @@ "babel-preset-stage-2": "^6.18.0",

"hammerjs": "^2.0.8",
"import-sort-style-module": "^6.0.0",
"prettier": "^2.8.7",
"prettier-plugin-import-sort": "^0.0.7",
"prettier-plugin-organize-imports": "^3.2.2",
"rollup": "^0.37.0",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-vue": "^6.0.0",
"sinon": "^1.17.6",

@@ -36,0 +42,0 @@ "style-loader": "^0.13.1",

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