From f267398575c64167967155989b6876edcad6733c Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Mon, 4 Sep 2023 13:25:28 +0200 Subject: [PATCH] 1.5.1 --- index.d.ts | 2 +- index.js | 2 +- index.min.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/ctxmenu.ts | 2 +- standalone/ctxmenu.js | 2 +- standalone/ctxmenu.min.js | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/index.d.ts b/index.d.ts index c8e2864..c5c6cc4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -101,7 +101,7 @@ interface CTXMenuSingleton { hide(): void; } -/*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ +/*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ declare const ctxmenu: CTXMenuSingleton; diff --git a/index.js b/index.js index f7057dc..8c16b4c 100644 --- a/index.js +++ b/index.js @@ -224,7 +224,7 @@ function getScale() { var styles = 'html{min-height:100%}.ctxmenu{position:fixed;border:1px solid #999;padding:2px 0;box-shadow:#aaa 3px 3px 3px;background:#fff;margin:0;z-index:9999;overflow-y:auto;font:15px Verdana, sans-serif;box-sizing:border-box}.ctxmenu li{margin:1px 0;display:block;position:relative;user-select:none}.ctxmenu li.heading{font-weight:bold;margin-left:-5px}.ctxmenu li span{display:block;padding:2px 20px;cursor:default}.ctxmenu li a{color:inherit;text-decoration:none}.ctxmenu li.icon{padding-left:15px}.ctxmenu img.icon{position:absolute;width:18px;left:10px;top:2px}.ctxmenu li.disabled{color:#ccc}.ctxmenu li.divider{border-bottom:1px solid #aaa;margin:5px 0}.ctxmenu li.interactive:hover{background:rgba(0, 0, 0, .1)}.ctxmenu li.submenu::after{content:"";position:absolute;display:block;top:0;bottom:0;right:.4em;margin:auto .1rem auto auto;border-right:1px solid #000;border-top:1px solid #000;transform:rotate(45deg);width:.3rem;height:.3rem}.ctxmenu li.submenu.disabled::after{border-color:#ccc}'; -/*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ var ContextMenu = function() { +/*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ var ContextMenu = function() { function ContextMenu() { var _this = this; this.cache = {}; diff --git a/index.min.js b/index.min.js index 31de6ee..d9ad078 100644 --- a/index.min.js +++ b/index.min.js @@ -1,2 +1,2 @@ "use strict";function e(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i".concat(t(e.text),""),r=t(e.element);r?n.append(r):n.innerHTML=o||i,n.title=t(e.tooltip)||"",e.style&&n.setAttribute("style",t(e.style));e.icon&&(n.classList.add("icon"),n.innerHTML+=''))}(e,a),!n(e))return a.classList.add("heading"),a;if(d(e))return a.classList.add("disabled"),r(e)&&a.classList.add("submenu"),a;if(a.classList.add("interactive"),i(e)){var c=document.createElement("a");return c.append.apply(c,Array.from(a.childNodes)),c.href=t(e.href),e.hasOwnProperty("download")&&(c.download=t(e.download)),e.hasOwnProperty("target")&&(c.target=t(e.target)),a.append(c),a}return o(e)?(a.addEventListener("click",e.action),a):(a.classList.add("submenu"),a)}Object.defineProperty(exports,"__esModule",{value:!0}),"function"==typeof SuppressedError&&SuppressedError;var s="r",u="d";function l(e,t){var n=f(),o=window.visualViewport,i=o.width,r=o.height;Object.assign(e.style,{maxHeight:r/n.y+"px",maxWidth:i/n.x+"px"});var a=function(e){var t=e.cloneNode(!0);t.style.visibility="hidden",document.body.appendChild(t);var n=p(t);return document.body.removeChild(t),n}(e);a.width=Math.trunc(a.width)+1,a.height=Math.trunc(a.height)+1;var d={x:0,y:0};if(t instanceof Element){var c=p(t),l=c.x,m=c.width,v=c.y;d={x:"r"===s?l+m:l-a.width,y:v},t.className.includes("submenu")&&(d.y+="d"===u?4:-12);var y=h(a,d);d.x!==y.x&&(s="r"===s?"l":"r",d.x="r"===s?l+m:l-a.width),d.y!==y.y&&(u="u"===u?"d":"u",d.y=y.y),d=h(a,d)}else{var x=""!==document.body.style.transform?document.body.getBoundingClientRect():{x:0,y:0};d=h(a,{x:(t.clientX-x.x)/n.x,y:(t.clientY-x.y)/n.y})}Object.assign(e.style,{left:d.x+"px",top:d.y+"px",width:a.width+"px",height:a.height+"px"})}function h(e,t){var n=window.visualViewport,o=n.width,i=n.height,r=""!==document.body.style.transform?document.body.getBoundingClientRect():{left:0,top:0},a=r.left,d=r.top,c=f(),l=-a/c.x,h=-d/c.y,p=(o-a)/c.x,m=(i-d)/c.y;return{x:"r"===s?t.x+e.width>p?p-e.width:t.x:t.xm?m-e.height:t.y:t.y ul");i&&i.parentElement!==n&&this.hide(i),n.appendChild(this.generateDOM(t,n))},o.addStylesToDom=function(){var e=function(){if("loading"===document.readyState)return document.addEventListener("readystatechange",e);var t=document.createElement("style");t.innerHTML='html{min-height:100%}.ctxmenu{position:fixed;border:1px solid #999;padding:2px 0;box-shadow:#aaa 3px 3px 3px;background:#fff;margin:0;z-index:9999;overflow-y:auto;font:15px Verdana, sans-serif;box-sizing:border-box}.ctxmenu li{margin:1px 0;display:block;position:relative;user-select:none}.ctxmenu li.heading{font-weight:bold;margin-left:-5px}.ctxmenu li span{display:block;padding:2px 20px;cursor:default}.ctxmenu li a{color:inherit;text-decoration:none}.ctxmenu li.icon{padding-left:15px}.ctxmenu img.icon{position:absolute;width:18px;left:10px;top:2px}.ctxmenu li.disabled{color:#ccc}.ctxmenu li.divider{border-bottom:1px solid #aaa;margin:5px 0}.ctxmenu li.interactive:hover{background:rgba(0, 0, 0, .1)}.ctxmenu li.submenu::after{content:"";position:absolute;display:block;top:0;bottom:0;right:.4em;margin:auto .1rem auto auto;border-right:1px solid #000;border-top:1px solid #000;transform:rotate(45deg);width:.3rem;height:.3rem}.ctxmenu li.submenu.disabled::after{border-color:#ccc}',document.head.insertBefore(t,document.head.childNodes[0]),e=function(){}};e()},o}().getInstance(); -/*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/exports.ctxmenu=m; +/*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/exports.ctxmenu=m; diff --git a/package-lock.json b/package-lock.json index 6ea9eed..6ac768f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ctxmenu", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ctxmenu", - "version": "1.5.0", + "version": "1.5.1", "license": "MIT", "devDependencies": { "@rollup/plugin-typescript": "^11.1.3", diff --git a/package.json b/package.json index a4469c8..5d7dfd1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ctxmenu", - "version": "1.5.0", + "version": "1.5.1", "description": "", "main": "index.js", "types": "index.d.ts", diff --git a/src/ctxmenu.ts b/src/ctxmenu.ts index c104695..858adf7 100644 --- a/src/ctxmenu.ts +++ b/src/ctxmenu.ts @@ -1,4 +1,4 @@ -/*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ +/*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ import { generateMenuItem, isDisabled, onHoverDebounced } from "./elementFactory"; import type { BeforeRenderFN, CTXMenu, CTXMenuSingleton } from "./interfaces"; diff --git a/standalone/ctxmenu.js b/standalone/ctxmenu.js index f44d7b3..0c0a1db 100644 --- a/standalone/ctxmenu.js +++ b/standalone/ctxmenu.js @@ -198,7 +198,7 @@ }; } var styles = 'html{min-height:100%}.ctxmenu{position:fixed;border:1px solid #999;padding:2px 0;box-shadow:#aaa 3px 3px 3px;background:#fff;margin:0;z-index:9999;overflow-y:auto;font:15px Verdana, sans-serif;box-sizing:border-box}.ctxmenu li{margin:1px 0;display:block;position:relative;user-select:none}.ctxmenu li.heading{font-weight:bold;margin-left:-5px}.ctxmenu li span{display:block;padding:2px 20px;cursor:default}.ctxmenu li a{color:inherit;text-decoration:none}.ctxmenu li.icon{padding-left:15px}.ctxmenu img.icon{position:absolute;width:18px;left:10px;top:2px}.ctxmenu li.disabled{color:#ccc}.ctxmenu li.divider{border-bottom:1px solid #aaa;margin:5px 0}.ctxmenu li.interactive:hover{background:rgba(0, 0, 0, .1)}.ctxmenu li.submenu::after{content:"";position:absolute;display:block;top:0;bottom:0;right:.4em;margin:auto .1rem auto auto;border-right:1px solid #000;border-top:1px solid #000;transform:rotate(45deg);width:.3rem;height:.3rem}.ctxmenu li.submenu.disabled::after{border-color:#ccc}'; - /*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ var ContextMenu = function() { + /*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/ var ContextMenu = function() { function ContextMenu() { var _this = this; this.cache = {}; diff --git a/standalone/ctxmenu.min.js b/standalone/ctxmenu.min.js index 2840629..8c5912c 100644 --- a/standalone/ctxmenu.min.js +++ b/standalone/ctxmenu.min.js @@ -1,2 +1,2 @@ !function(){"use strict";function e(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o".concat(t(e.text),""),r=t(e.element);r?n.append(r):n.innerHTML=i||o,n.title=t(e.tooltip)||"",e.style&&n.setAttribute("style",t(e.style));e.icon&&(n.classList.add("icon"),n.innerHTML+=''))}(e,a),!n(e))return a.classList.add("heading"),a;if(d(e))return a.classList.add("disabled"),r(e)&&a.classList.add("submenu"),a;if(a.classList.add("interactive"),o(e)){var c=document.createElement("a");return c.append.apply(c,Array.from(a.childNodes)),c.href=t(e.href),e.hasOwnProperty("download")&&(c.download=t(e.download)),e.hasOwnProperty("target")&&(c.target=t(e.target)),a.append(c),a}return i(e)?(a.addEventListener("click",e.action),a):(a.classList.add("submenu"),a)}"function"==typeof SuppressedError&&SuppressedError;var s="r",u="d";function l(e,t){var n=f(),i=window.visualViewport,o=i.width,r=i.height;Object.assign(e.style,{maxHeight:r/n.y+"px",maxWidth:o/n.x+"px"});var a=function(e){var t=e.cloneNode(!0);t.style.visibility="hidden",document.body.appendChild(t);var n=p(t);return document.body.removeChild(t),n}(e);a.width=Math.trunc(a.width)+1,a.height=Math.trunc(a.height)+1;var d={x:0,y:0};if(t instanceof Element){var c=p(t),l=c.x,m=c.width,v=c.y;d={x:"r"===s?l+m:l-a.width,y:v},t.className.includes("submenu")&&(d.y+="d"===u?4:-12);var y=h(a,d);d.x!==y.x&&(s="r"===s?"l":"r",d.x="r"===s?l+m:l-a.width),d.y!==y.y&&(u="u"===u?"d":"u",d.y=y.y),d=h(a,d)}else{var x=""!==document.body.style.transform?document.body.getBoundingClientRect():{x:0,y:0};d=h(a,{x:(t.clientX-x.x)/n.x,y:(t.clientY-x.y)/n.y})}Object.assign(e.style,{left:d.x+"px",top:d.y+"px",width:a.width+"px",height:a.height+"px"})}function h(e,t){var n=window.visualViewport,i=n.width,o=n.height,r=""!==document.body.style.transform?document.body.getBoundingClientRect():{left:0,top:0},a=r.left,d=r.top,c=f(),l=-a/c.x,h=-d/c.y,p=(i-a)/c.x,m=(o-d)/c.y;return{x:"r"===s?t.x+e.width>p?p-e.width:t.x:t.xm?m-e.height:t.y:t.y ul");o&&o.parentElement!==n&&this.hide(o),n.appendChild(this.generateDOM(t,n))},i.addStylesToDom=function(){var e=function(){if("loading"===document.readyState)return document.addEventListener("readystatechange",e);var t=document.createElement("style");t.innerHTML='html{min-height:100%}.ctxmenu{position:fixed;border:1px solid #999;padding:2px 0;box-shadow:#aaa 3px 3px 3px;background:#fff;margin:0;z-index:9999;overflow-y:auto;font:15px Verdana, sans-serif;box-sizing:border-box}.ctxmenu li{margin:1px 0;display:block;position:relative;user-select:none}.ctxmenu li.heading{font-weight:bold;margin-left:-5px}.ctxmenu li span{display:block;padding:2px 20px;cursor:default}.ctxmenu li a{color:inherit;text-decoration:none}.ctxmenu li.icon{padding-left:15px}.ctxmenu img.icon{position:absolute;width:18px;left:10px;top:2px}.ctxmenu li.disabled{color:#ccc}.ctxmenu li.divider{border-bottom:1px solid #aaa;margin:5px 0}.ctxmenu li.interactive:hover{background:rgba(0, 0, 0, .1)}.ctxmenu li.submenu::after{content:"";position:absolute;display:block;top:0;bottom:0;right:.4em;margin:auto .1rem auto auto;border-right:1px solid #000;border-top:1px solid #000;transform:rotate(45deg);width:.3rem;height:.3rem}.ctxmenu li.submenu.disabled::after{border-color:#ccc}',document.head.insertBefore(t,document.head.childNodes[0]),e=function(){}};e()},i}().getInstance(); -/*! ctxMenu v1.5.0 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/window.ctxmenu=m}(); +/*! ctxMenu v1.5.1 | (c) Nikolaj Kappler | https://github.com/nkappler/ctxmenu/blob/master/LICENSE !*/window.ctxmenu=m}();