From d632ac6f200fc56bcb6dd587b62e784e4e1c137a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 5 Feb 2016 14:15:53 -0500 Subject: [PATCH] feature(bower) menu v1.0.1 --- bower.json | 2 +- json/modules.json | 2 +- modules/menu/.bower.json | 10 +++++----- modules/menu/ChangeLog | 6 ++++++ modules/menu/bower.json | 2 +- modules/menu/menu-io.js | 6 +++++- modules/menu/menu-io.min.js | 2 +- modules/menu/package.json | 2 +- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index 27a01963..f31706c1 100644 --- a/bower.json +++ b/bower.json @@ -40,6 +40,6 @@ "philip": "~1.3.2", "smalltalk": "~1.6.5", "promise-polyfill": "~3.1.0", - "menu": "~1.0.0" + "menu": "~1.0.1" } } diff --git a/json/modules.json b/json/modules.json index 1735428b..d155be5a 100644 --- a/json/modules.json +++ b/json/modules.json @@ -34,7 +34,7 @@ ] }, { "name": "menu", - "version": "1.0.0", + "version": "1.0.1", "local": [ "/modules/menu/menu-io.min.css", "/modules/menu/menu-io.min.js" diff --git a/modules/menu/.bower.json b/modules/menu/.bower.json index dd056906..79b5f3db 100644 --- a/modules/menu/.bower.json +++ b/modules/menu/.bower.json @@ -1,6 +1,6 @@ { "name": "menu", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/coderaiser/menu-io", "authors": [ "coderaiser " @@ -20,14 +20,14 @@ "gulpfile.js", "node_modules" ], - "_release": "1.0.0", + "_release": "1.0.1", "_resolution": { "type": "version", - "tag": "v1.0.0", - "commit": "044d5045e6849290d2a1a8c8d041a88d887bd0c2" + "tag": "v1.0.1", + "commit": "c2aa4fda3cdcfb499e7edb9d0ce6a679b38e4c81" }, "_source": "git://github.com/coderaiser/menu-io.git", - "_target": "~1.0.0", + "_target": "~1.0.1", "_originalSource": "menu", "_direct": true } \ No newline at end of file diff --git a/modules/menu/ChangeLog b/modules/menu/ChangeLog index 559eec75..be9b9594 100644 --- a/modules/menu/ChangeLog +++ b/modules/menu/ChangeLog @@ -1,3 +1,9 @@ +2016.02.05, v1.0.1 + +fix: +- (menu) menu cut on left + + 2016.02.05, v1.0.0 fix: diff --git a/modules/menu/bower.json b/modules/menu/bower.json index 00bc138c..2ecc2110 100644 --- a/modules/menu/bower.json +++ b/modules/menu/bower.json @@ -1,6 +1,6 @@ { "name": "menu", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/coderaiser/menu-io", "authors": [ "coderaiser " diff --git a/modules/menu/menu-io.js b/modules/menu/menu-io.js index 4ec06f94..b433ff1a 100644 --- a/modules/menu/menu-io.js +++ b/modules/menu/menu-io.js @@ -211,8 +211,12 @@ var MenuIO; heightInner = window.innerHeight, widthInner = window.innerWidth; - if (widthInner < widthMenu + x) + if (widthInner < widthMenu + x) { x -= widthMenu; + + if (x < 0) + x = 0; + } if (heightInner < heightMenu + y) { y -= heightMenu; diff --git a/modules/menu/menu-io.min.js b/modules/menu/menu-io.min.js index 852ce149..906c7b02 100755 --- a/modules/menu/menu-io.min.js +++ b/modules/menu/menu-io.min.js @@ -1 +1 @@ -var MenuIO;!function(e){"use strict";function t(){function e(e){var t;return e&&(t=n(e),t&&(e=e.parentElement)),e}function t(e){var t;return e&&(t=n(e),t||(e=e.querySelector("[data-menu-path]"))),e}function n(e){var t;return e&&(t=e.hasAttribute("data-menu-path")),t}function a(e){var t=r(e,"js-menu-item");return t}function u(e){var t=r(e,"js-menu");return t}function r(e,t,n){var a,u;return n||(n="data-name"),e&&(u=e.getAttribute(n),u===t&&(a=!0)),a}function i(t){var n,a,u="data-menu",i="js-submenu";return a=e(t),n=r(a,i,u)}this.getItem=e,this.getName=t,this.isName=n,this.isItem=a,this.isMenu=u,this.isSubMenu=i}function n(e){var t,n=[].slice.call(arguments,1);return"function"==typeof e&&(t=e.apply(null,n)),t}function a(e,t){var n=e;return u(e,t),Object.keys(t).forEach(function(e){for(var a="{{ "+e+" }}",u=t[e];~n.indexOf(a);)n=n.replace(a,u)}),~n.indexOf("{{")&&(n=n.replace(/{{.*?}}/g,"")),n}function u(e,t){if("string"!=typeof e)throw Error("template should be string!");if("object"!=typeof t)throw Error("data should be object!")}MenuIO=function(u,r,i){function s(){var e,t="object"==typeof i;t||(e=i,i={},i[e]=null),y=o(i),M.addEventListener("click",c),M.addEventListener("contextmenu",f)}function o(e){var t,n="",u=function(e,t){var n='data-menu="js-submenu"',r="data-key=",i="";return t?t+=".":t="",Object.keys(e).forEach(function(s){var o,m="",c="",f="",l="",d=t+s,h=e[s],b="object"==typeof h;b?(c=a(N.MAIN,{items:u(h,d)}),f=" menu-submenu",l=" "+n):E[d]=h,w.icon&&(o=s.replace(/\(|\)/g,"").replace(/\s/g,"-").toLowerCase(),f+=" icon icon-"+o),w.keys&&(m=w.keys[s],m&&(l=" "+r+m)),i+=a(N.ITEM,{name:s,subitems:c,className:f,attribute:l,path:d})}),i};return n=u(e),t=document.createElement("ul"),t.setAttribute("data-name","js-menu"),t.className="menu menu-hidden",t.innerHTML=n,g.appendChild(t),t}function m(e,t){var n,a=x.getItem(e),u=x.isName(a),r=x.isItem(a),i=x.isSubMenu(a);return u&&r||(a=document.elementFromPoint(t.x,t.y),i=x.isSubMenu(a),u=x.isName(a),r=x.isItem(a)),n={name:u,item:r,sub:i}}function c(e,t){var a,u,r=w.afterClick,i=w.beforeClick,s=w.name,o=e.target,c=t||m(o,{x:e.clientX,y:e.clientY});u=n(i,s),c.sub?e.preventDefault():(h(),u||!c.name&&!c.item||(a=b(o),n(a),n(r)))}function f(e){var t=e.target,n=e.clientX,a=e.clientY,u=m(t,{x:n,y:a});u.name||u.item||u.sub?c(e,u):(h(),d(n,a)),e.preventDefault()}function l(t,n){var a="number"==typeof t,u="number"==typeof n,r=p(),i=v(),s=e.innerHeight,o=e.innerWidth;i+t>o&&(t-=i),r+n>s&&(n-=r,0>n&&(n=0)),a&&(y.style.left=t+"px"),u&&(y.style.top=n-14+"px")}function d(e,t){var a=w.beforeShow,u=w.name,r={x:e,y:t,name:u},i=n(a,r);i||(y.classList.remove("menu-hidden"),l(r.x,r.y))}function h(){var e=n(w.beforeClose);e||y.classList.add("menu-hidden")}function b(e){var t,n;return e=x.getName(e),e&&(t=e.getAttribute("data-menu-path")),n=E[t]}function p(){var e,t;return I||(e=getComputedStyle(y),t=e.height,I=parseInt(t,10)),I}function v(){var e,t;return j||(e=getComputedStyle(y),t=e.width,j=parseInt(t,10)),j}if(!(this instanceof MenuIO))return new MenuIO(u,r,i);var y,g,I,j,M,w={},x=new t,E={},N={MAIN:'',ITEM:''};i?(g=M=u,w=r):r?(g=M=u,i=r):(g=document.body,M=e,i=u),this.show=d,this.hide=h,s()}}(window); \ No newline at end of file +var MenuIO;!function(e){"use strict";function t(){function e(e){var t;return e&&(t=n(e),t&&(e=e.parentElement)),e}function t(e){var t;return e&&(t=n(e),t||(e=e.querySelector("[data-menu-path]"))),e}function n(e){var t;return e&&(t=e.hasAttribute("data-menu-path")),t}function a(e){var t=r(e,"js-menu-item");return t}function u(e){var t=r(e,"js-menu");return t}function r(e,t,n){var a,u;return n||(n="data-name"),e&&(u=e.getAttribute(n),u===t&&(a=!0)),a}function i(t){var n,a,u="data-menu",i="js-submenu";return a=e(t),n=r(a,i,u)}this.getItem=e,this.getName=t,this.isName=n,this.isItem=a,this.isMenu=u,this.isSubMenu=i}function n(e){var t,n=[].slice.call(arguments,1);return"function"==typeof e&&(t=e.apply(null,n)),t}function a(e,t){var n=e;return u(e,t),Object.keys(t).forEach(function(e){for(var a="{{ "+e+" }}",u=t[e];~n.indexOf(a);)n=n.replace(a,u)}),~n.indexOf("{{")&&(n=n.replace(/{{.*?}}/g,"")),n}function u(e,t){if("string"!=typeof e)throw Error("template should be string!");if("object"!=typeof t)throw Error("data should be object!")}MenuIO=function(u,r,i){function s(){var e,t="object"==typeof i;t||(e=i,i={},i[e]=null),y=o(i),M.addEventListener("click",c),M.addEventListener("contextmenu",f)}function o(e){var t,n="",u=function(e,t){var n='data-menu="js-submenu"',r="data-key=",i="";return t?t+=".":t="",Object.keys(e).forEach(function(s){var o,m="",c="",f="",l="",d=t+s,h=e[s],b="object"==typeof h;b?(c=a(N.MAIN,{items:u(h,d)}),f=" menu-submenu",l=" "+n):E[d]=h,w.icon&&(o=s.replace(/\(|\)/g,"").replace(/\s/g,"-").toLowerCase(),f+=" icon icon-"+o),w.keys&&(m=w.keys[s],m&&(l=" "+r+m)),i+=a(N.ITEM,{name:s,subitems:c,className:f,attribute:l,path:d})}),i};return n=u(e),t=document.createElement("ul"),t.setAttribute("data-name","js-menu"),t.className="menu menu-hidden",t.innerHTML=n,g.appendChild(t),t}function m(e,t){var n,a=x.getItem(e),u=x.isName(a),r=x.isItem(a),i=x.isSubMenu(a);return u&&r||(a=document.elementFromPoint(t.x,t.y),i=x.isSubMenu(a),u=x.isName(a),r=x.isItem(a)),n={name:u,item:r,sub:i}}function c(e,t){var a,u,r=w.afterClick,i=w.beforeClick,s=w.name,o=e.target,c=t||m(o,{x:e.clientX,y:e.clientY});u=n(i,s),c.sub?e.preventDefault():(h(),u||!c.name&&!c.item||(a=b(o),n(a),n(r)))}function f(e){var t=e.target,n=e.clientX,a=e.clientY,u=m(t,{x:n,y:a});u.name||u.item||u.sub?c(e,u):(h(),d(n,a)),e.preventDefault()}function l(t,n){var a="number"==typeof t,u="number"==typeof n,r=p(),i=v(),s=e.innerHeight,o=e.innerWidth;i+t>o&&(t-=i,0>t&&(t=0)),r+n>s&&(n-=r,0>n&&(n=0)),a&&(y.style.left=t+"px"),u&&(y.style.top=n-14+"px")}function d(e,t){var a=w.beforeShow,u=w.name,r={x:e,y:t,name:u},i=n(a,r);i||(y.classList.remove("menu-hidden"),l(r.x,r.y))}function h(){var e=n(w.beforeClose);e||y.classList.add("menu-hidden")}function b(e){var t,n;return e=x.getName(e),e&&(t=e.getAttribute("data-menu-path")),n=E[t]}function p(){var e,t;return I||(e=getComputedStyle(y),t=e.height,I=parseInt(t,10)),I}function v(){var e,t;return j||(e=getComputedStyle(y),t=e.width,j=parseInt(t,10)),j}if(!(this instanceof MenuIO))return new MenuIO(u,r,i);var y,g,I,j,M,w={},x=new t,E={},N={MAIN:'',ITEM:''};i?(g=M=u,w=r):r?(g=M=u,i=r):(g=document.body,M=e,i=u),this.show=d,this.hide=h,s()}}(window); \ No newline at end of file diff --git a/modules/menu/package.json b/modules/menu/package.json index dc894283..83030602 100644 --- a/modules/menu/package.json +++ b/modules/menu/package.json @@ -1,6 +1,6 @@ { "name": "menu", - "version": "1.0.0", + "version": "1.0.1", "private": true, "branch": "gh-pages", "author": "coderaiser (https://github.com/coderaiser)",