vue-simple-context-menu
Advanced tools
Comparing version 3.1.4 to 3.1.5
@@ -23,7 +23,3 @@ import vue from 'rollup-plugin-vue'; | ||
commonjs(), | ||
resolve({ | ||
jsnext: true, | ||
main: true, | ||
browser: true, | ||
}), | ||
resolve(), | ||
vue({ | ||
@@ -30,0 +26,0 @@ css: false, |
@@ -1,1 +0,1 @@ | ||
var VueSimpleContextMenu=function(e,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t,i=(function(e,n){e.exports=function(){var e="undefined"!=typeof window&&("ontouchstart"in window||navigator.msMaxTouchPoints>0)?["touchstart","click"]:["click"],n=[];function t(n){var t="function"==typeof n;if(!t&&"object"!=typeof n)throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:t?n:n.handler,middleware:n.middleware||function(e){return e},events:n.events||e}}function i(e){var n=e.el,t=e.event,i=e.handler,o=e.middleware;t.target!==n&&!n.contains(t.target)&&o(t,n)&&i(t,n)}var o={bind:function(e,o){var r=t(o.value),d=r.handler,u=r.middleware,s={el:e,eventHandlers:r.events.map(function(n){return{event:n,handler:function(n){return i({event:n,el:e,handler:d,middleware:u})}}})};s.eventHandlers.forEach(function(e){return document.addEventListener(e.event,e.handler)}),n.push(s)},update:function(e,o){var r=t(o.value),d=r.handler,u=r.middleware,s=r.events,l=n.find(function(n){return n.el===e});l.eventHandlers.forEach(function(e){return document.removeEventListener(e.event,e.handler)}),l.eventHandlers=s.map(function(n){return{event:n,handler:function(n){return i({event:n,el:e,handler:d,middleware:u})}}}),l.eventHandlers.forEach(function(e){return document.addEventListener(e.event,e.handler)})},unbind:function(e){n.find(function(n){return n.el===e}).eventHandlers.forEach(function(e){return document.removeEventListener(e.event,e.handler)})},instances:n};return{install:function(e){e.directive("click-outside",o)},directive:o}}()}(t={exports:{}},t.exports),t.exports);n.use(i);var o=function(e,n,t,i,o,r,d,u,s,l){"boolean"!=typeof d&&(s=u,u=d,d=!1);var a,c="function"==typeof t?t.options:t;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,o&&(c.functional=!0)),i&&(c._scopeId=i),r?(a=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,s(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},c._ssrRegister=a):n&&(a=d?function(){n.call(this,l(this.$root.$options.shadowRoot))}:function(e){n.call(this,u(e))}),a)if(c.functional){var f=c.render;c.render=function(e,n){return a.call(n),f(e,n)}}else{var v=c.beforeCreate;c.beforeCreate=v?[].concat(v,a):[a]}return t},r={name:"VueSimpleContextMenu",props:{elementId:{type:String,required:!0},options:{type:Array,required:!0}},data:function(){return{item:null,menuWidth:null,menuHeight:null}},methods:{showMenu:function(e,n){this.item=n;var t=document.getElementById(this.elementId);t&&(this.menuWidth&&this.menuHeight||(t.style.visibility="hidden",t.style.display="block",this.menuWidth=t.offsetWidth,this.menuHeight=t.offsetHeight,t.removeAttribute("style")),this.menuWidth+e.pageX>=window.innerWidth?t.style.left=e.pageX-this.menuWidth+2+"px":t.style.left=e.pageX-2+"px",this.menuHeight+e.pageY>=window.innerHeight?t.style.top=e.pageY-this.menuHeight+2+"px":t.style.top=e.pageY-2+"px",t.classList.add("vue-simple-context-menu--active"))},hideContextMenu:function(){var e=document.getElementById(this.elementId);e&&e.classList.remove("vue-simple-context-menu--active")},onClickOutside:function(){this.hideContextMenu()},optionClicked:function(e){this.hideContextMenu(),this.$emit("option-clicked",{item:this.item,option:e})}}},d=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",[t("ul",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.onClickOutside,expression:"onClickOutside"}],staticClass:"vue-simple-context-menu",attrs:{id:e.elementId}},e._l(e.options,function(n,i){return t("li",{key:i,staticClass:"vue-simple-context-menu__item",on:{click:function(t){return e.optionClicked(n)}}},[e._v("\n "+e._s(n.name)+"\n ")])}),0)])};d._withStripped=!0;var u=o({render:d,staticRenderFns:[]},void 0,r,void 0,!1,void 0,void 0,void 0);function s(e){s.installed||(s.installed=!0,e.component("VueSimpleContextMenu",u))}var l={install:s},a=null;return"undefined"!=typeof window?a=window.Vue:"undefined"!=typeof global&&(a=global.Vue),a&&a.use(l),e.install=s,e.default=u,e}({},Vue); | ||
var VueSimpleContextMenu=function(e,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t,i=(function(e,n){e.exports=function(){var e="undefined"!=typeof window,n="undefined"!=typeof navigator,t=e&&("ontouchstart"in window||n&&navigator.msMaxTouchPoints>0)?["touchstart","click"]:["click"],i=function(e){return e},r={instances:[]};function o(e){var n="function"==typeof e;if(!n&&"object"!=typeof e)throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:n?e:e.handler,middleware:e.middleware||i,events:e.events||t,isActive:!(!1===e.isActive)}}function s(e){var n=e.el,t=e.event,i=e.handler,r=e.middleware;t.target!==n&&!n.contains(t.target)&&r(t,n)&&i(t,n)}function d(e){var n=e.el,t=e.handler,i=e.middleware;return{el:n,eventHandlers:e.events.map(function(e){return{event:e,handler:function(e){return s({event:e,el:n,handler:t,middleware:i})}}})}}function a(e){var n=r.instances.findIndex(function(n){return n.el===e});-1!==n&&(r.instances[n].eventHandlers.forEach(function(e){return document.removeEventListener(e.event,e.handler)}),r.instances.splice(n,1))}return r.bind=function(e,n){var t=o(n.value);if(t.isActive){var i=d({el:e,events:t.events,handler:t.handler,middleware:t.middleware});i.eventHandlers.forEach(function(e){var n=e.event,t=e.handler;return setTimeout(function(){return document.addEventListener(n,t)},0)}),r.instances.push(i)}},r.update=function(e,n){var t=n.value,i=n.oldValue;if(JSON.stringify(t)!==JSON.stringify(i)){var u=o(t),l=u.events,c=u.handler,f=u.middleware;if(u.isActive){var v=r.instances.find(function(n){return n.el===e});v?(v.eventHandlers.forEach(function(e){return document.removeEventListener(e.event,e.handler)}),v.eventHandlers=l.map(function(n){return{event:n,handler:function(n){return s({event:n,el:e,handler:c,middleware:f})}}})):(v=d({el:e,events:l,handler:c,middleware:f}),r.instances.push(v)),v.eventHandlers.forEach(function(e){var n=e.event,t=e.handler;return setTimeout(function(){return document.addEventListener(n,t)},0)})}else a(e)}},r.unbind=a,{install:function(e){e.directive("click-outside",r)},directive:r}}()}(t={exports:{}},t.exports),t.exports);n.use(i);var r=function(e,n,t,i,r,o,s,d,a,u){"boolean"!=typeof s&&(a=d,d=s,s=!1);var l,c="function"==typeof t?t.options:t;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),i&&(c._scopeId=i),o?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=l):n&&(l=s?function(){n.call(this,u(this.$root.$options.shadowRoot))}:function(e){n.call(this,d(e))}),l)if(c.functional){var f=c.render;c.render=function(e,n){return l.call(n),f(e,n)}}else{var v=c.beforeCreate;c.beforeCreate=v?[].concat(v,l):[l]}return t},o={name:"VueSimpleContextMenu",props:{elementId:{type:String,required:!0},options:{type:Array,required:!0}},data:function(){return{item:null,menuWidth:null,menuHeight:null}},methods:{showMenu:function(e,n){this.item=n;var t=document.getElementById(this.elementId);t&&(this.menuWidth&&this.menuHeight||(t.style.visibility="hidden",t.style.display="block",this.menuWidth=t.offsetWidth,this.menuHeight=t.offsetHeight,t.removeAttribute("style")),this.menuWidth+e.pageX>=window.innerWidth?t.style.left=e.pageX-this.menuWidth+2+"px":t.style.left=e.pageX-2+"px",this.menuHeight+e.pageY>=window.innerHeight?t.style.top=e.pageY-this.menuHeight+2+"px":t.style.top=e.pageY-2+"px",t.classList.add("vue-simple-context-menu--active"))},hideContextMenu:function(){var e=document.getElementById(this.elementId);e&&e.classList.remove("vue-simple-context-menu--active")},onClickOutside:function(){this.hideContextMenu()},optionClicked:function(e){this.hideContextMenu(),this.$emit("option-clicked",{item:this.item,option:e})}}},s=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",[t("ul",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.onClickOutside,expression:"onClickOutside"}],staticClass:"vue-simple-context-menu",attrs:{id:e.elementId}},e._l(e.options,function(n,i){return t("li",{key:i,staticClass:"vue-simple-context-menu__item",on:{click:function(t){return e.optionClicked(n)}}},[e._v("\n "+e._s(n.name)+"\n ")])}),0)])};s._withStripped=!0;var d=r({render:s,staticRenderFns:[]},void 0,o,void 0,!1,void 0,void 0,void 0);function a(e){a.installed||(a.installed=!0,e.component("VueSimpleContextMenu",d))}var u={install:a},l=null;return"undefined"!=typeof window?l=window.Vue:"undefined"!=typeof global&&(l=global.Vue),l&&l.use(u),e.default=d,e.install=a,e}({},Vue); |
@@ -265,4 +265,4 @@ (function (global, factory) { | ||
exports.default = component; | ||
exports.install = install; | ||
exports.default = component; | ||
@@ -269,0 +269,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "vue-simple-context-menu", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"description": "Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.", | ||
@@ -34,42 +34,42 @@ "author": "John Datserakis <johndatserakis@gmail.com>", | ||
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/vue-simple-context-menu.min.js", | ||
"build:library": "rm -rf ./dist npm run build:unpkg & npm run build:es & npm run build:umd & npm run build:unpkg", | ||
"build:example": "rm -rf ./docs && cross-env NODE_ENV=production webpack --progress --hide-modules", | ||
"build:library": "rm -rf ./dist npm run build:umd & npm run build:es & npm run build:umd & npm run build:unpkg", | ||
"build:example": "rm -rf ./docs && cross-env NODE_ENV=production webpack --progress --hide-modules --mode production", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"v-click-outside": "^2.0.2" | ||
"v-click-outside": "^2.1.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-env": "^7.3.1", | ||
"@vue/test-utils": "^1.0.0-beta.28", | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5", | ||
"@vue/test-utils": "^1.0.0-beta.29", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^23.6.0", | ||
"babel-loader": "^8.0.5", | ||
"babel-jest": "^24.8.0", | ||
"babel-loader": "^8.0.6", | ||
"cross-env": "^5.2.0", | ||
"css-loader": "^2.1.0", | ||
"file-loader": "^3.0.1", | ||
"css-loader": "^3.0.0", | ||
"file-loader": "^4.0.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"jest": "^24.0.0", | ||
"jest": "^24.8.0", | ||
"jest-serializer-vue": "^2.0.2", | ||
"minimist": "^1.2.0", | ||
"node-sass": "^4.11.0", | ||
"regenerator-runtime": "^0.13.1", | ||
"rollup": "^1.1.2", | ||
"node-sass": "^4.12.0", | ||
"regenerator-runtime": "^0.13.2", | ||
"rollup": "^1.15.6", | ||
"rollup-plugin-buble": "^0.19.6", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-css-only": "^1.0.0", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"rollup-plugin-terser": "^4.0.3", | ||
"rollup-plugin-vue": "^4.6.2", | ||
"rollup-plugin-node-resolve": "^5.0.3", | ||
"rollup-plugin-terser": "^5.0.0", | ||
"rollup-plugin-vue": "^5.0.0", | ||
"sass-loader": "^7.1.0", | ||
"uglifyjs-webpack-plugin": "^2.1.1", | ||
"vue": "^2.5.22", | ||
"vue-jest": "^3.0.2", | ||
"vue-loader": "^15.6.2", | ||
"vue-template-compiler": "^2.5.22", | ||
"webpack": "^4.29.0", | ||
"webpack-cli": "^3.2.1", | ||
"webpack-dev-server": "^3.1.14" | ||
"terser-webpack-plugin": "^1.3.0", | ||
"vue": "^2.6.10", | ||
"vue-jest": "^3.0.4", | ||
"vue-loader": "^15.7.0", | ||
"vue-template-compiler": "^2.6.10", | ||
"webpack": "^4.34.0", | ||
"webpack-cli": "^3.3.4", | ||
"webpack-dev-server": "^3.7.2" | ||
}, | ||
@@ -76,0 +76,0 @@ "jest": { |
@@ -134,16 +134,16 @@ # vue-simple-context-menu | ||
# run tests | ||
npm run test | ||
# serve with hot reload | ||
npm run watch | ||
# run the tests | ||
npm run test | ||
# build demo page | ||
npm run build:example | ||
# build | ||
# build library | ||
npm run build:library | ||
# build everything and run tests | ||
npm run build | ||
# publish to npm | ||
npm publish | ||
``` | ||
@@ -150,0 +150,0 @@ |
const path = require('path') | ||
const webpack = require('webpack') | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
@@ -91,6 +91,5 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin'); | ||
minimizer: [ | ||
new UglifyJsPlugin({ | ||
sourceMap: true, | ||
new TerserPlugin({ | ||
parallel: 4, | ||
uglifyOptions: { | ||
terserOptions: { | ||
warnings: false, | ||
@@ -97,0 +96,0 @@ compress: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
169039
20
810
Updatedv-click-outside@^2.1.3