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

mj-context-menu

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mj-context-menu - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

cjs/abstract_entry.d.ts

2

dist/ContextMenu.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContextMenu=e():t.ContextMenu=e()}(this,(function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=15)}([function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HtmlAttrs=e.HtmlClasses=void 0;function n(t){return"CtxtMenu_"+t}function r(t){return n(t)}function i(t){return n(t)}e.HtmlClasses={ATTACHED:r("Attached"),CONTEXTMENU:r("ContextMenu"),MENU:r("Menu"),MENUARROW:r("MenuArrow"),MENUACTIVE:r("MenuActive"),MENUCHECK:r("MenuCheck"),MENUCLOSE:r("MenuClose"),MENUCOMBOBOX:r("MenuComboBox"),MENUDISABLED:r("MenuDisabled"),MENUFRAME:r("MenuFrame"),MENUITEM:r("MenuItem"),MENULABEL:r("MenuLabel"),MENURADIOCHECK:r("MenuRadioCheck"),MENUINPUTBOX:r("MenuInputBox"),MENURULE:r("MenuRule"),MENUSLIDER:r("MenuSlider"),MOUSEPOST:r("MousePost"),RTL:r("RTL"),INFO:r("Info"),INFOCLOSE:r("InfoClose"),INFOCONTENT:r("InfoContent"),INFOSIGNATURE:r("InfoSignature"),INFOTITLE:r("InfoTitle"),SLIDERVALUE:r("SliderValue"),SLIDERBAR:r("SliderBar"),SELECTION:r("Selection"),SELECTIONBOX:r("SelectionBox"),SELECTIONMENU:r("SelectionMenu"),SELECTIONDIVIDER:r("SelectionDivider"),SELECTIONITEM:r("SelectionItem")},e.HtmlAttrs={COUNTER:i("Counter"),KEYDOWNFUNC:i("keydownFunc"),CONTEXTMENUFUNC:i("contextmenuFunc"),OLDTAB:i("Oldtabindex"),TOUCHFUNC:i("TouchFunc")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MenuUtil=void 0,function(t){t.close=function(t){var e=t.menu;e.baseMenu?e.baseMenu.unpost():e.unpost()},t.getActiveElement=function(t){var e=t.menu;return(e.baseMenu?e.baseMenu:e).store.active},t.error=function(t,e){console.error("ContextMenu Error: "+e)},t.counter=function(){return e++};var e=0}(e.MenuUtil||(e.MenuUtil={}))},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],n=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractItem=void 0;var s=o(9),a=o(1),u=o(0),c=function(t){function e(e,o,n,r){var i=t.call(this,e,o)||this;return i._content=n,i.disabled=!1,i.callbacks=[],i._id=r||n,i}return r(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.press=function(){this.disabled||(this.executeAction(),this.executeCallbacks_())},e.prototype.executeAction=function(){},e.prototype.registerCallback=function(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)},e.prototype.unregisterCallback=function(t){var e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)},e.prototype.mousedown=function(t){this.press(),this.stop(t)},e.prototype.mouseover=function(t){this.focus(),this.stop(t)},e.prototype.mouseout=function(t){this.deactivate(),this.stop(t)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.setAttribute("aria-disabled","false"),e.textContent=this.content},e.prototype.activate=function(){this.disabled||this.html.classList.add(u.HtmlClasses.MENUACTIVE)},e.prototype.deactivate=function(){this.html.classList.remove(u.HtmlClasses.MENUACTIVE)},e.prototype.focus=function(){this.menu.focused=this,t.prototype.focus.call(this),this.activate()},e.prototype.unfocus=function(){this.deactivate(),t.prototype.unfocus.call(this)},e.prototype.escape=function(t){a.MenuUtil.close(this)},e.prototype.up=function(t){this.menu.up(t)},e.prototype.down=function(t){this.menu.down(t)},e.prototype.left=function(t){this.menu.left(t)},e.prototype.right=function(t){this.menu.right(t)},e.prototype.space=function(t){this.press()},e.prototype.disable=function(){this.disabled=!0;var t=this.html;t.classList.add(u.HtmlClasses.MENUDISABLED),t.setAttribute("aria-disabled","true")},e.prototype.enable=function(){this.disabled=!1;var t=this.html;t.classList.remove(u.HtmlClasses.MENUDISABLED),t.removeAttribute("aria-disabled")},e.prototype.executeCallbacks_=function(){var t,e;try{for(var o=i(this.callbacks),n=o.next();!n.done;n=o.next()){var r=n.value;try{r(this)}catch(t){a.MenuUtil.error(t,"Callback for menu entry "+this.id+" failed.")}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},e}(s.AbstractEntry);e.AbstractItem=c},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractPostable=void 0;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.posted=!1,e}return r(e,t),e.prototype.isPosted=function(){return this.posted},e.prototype.post=function(t,e){this.posted||(void 0!==t&&void 0!==e&&this.html.setAttribute("style","left: "+t+"px; top: "+e+"px;"),this.display(),this.posted=!0)},e.prototype.unpost=function(){if(this.posted){var t=this.html;t.parentNode&&t.parentNode.removeChild(t),this.posted=!1}},e}(o(8).MenuElement);e.AbstractPostable=i},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KEY=void 0,function(t){t[t.RETURN=13]="RETURN",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"}(e.KEY||(e.KEY={}))},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractVariableItem=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;this.span||this.generateSpan(),e.appendChild(this.span),this.update()},e.prototype.register=function(){this.variable.register(this)},e.prototype.unregister=function(){this.variable.unregister(this)},e.prototype.update=function(){this.updateAria(),this.span&&this.updateSpan()},e}(o(2).AbstractItem);e.AbstractVariableItem=i},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],n=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMenu=void 0;var s=o(3),a=o(2),u=o(0),c=o(10),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.className=u.HtmlClasses.CONTEXTMENU,e.role="menu",e._items=[],e._baseMenu=null,e}return r(e,t),Object.defineProperty(e.prototype,"baseMenu",{get:function(){return this._baseMenu},set:function(t){this._baseMenu=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},set:function(t){this._items=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pool",{get:function(){return this.variablePool},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focused",{get:function(){return this._focused},set:function(t){if(this._focused!==t){this._focused||this.unfocus();var e=this._focused;this._focused=t,e&&e.unfocus()}},enumerable:!1,configurable:!0}),e.prototype.up=function(t){var e=this.items.filter((function(t){return t instanceof a.AbstractItem&&!t.isHidden()}));if(0!==e.length)if(this.focused){var o=e.indexOf(this.focused);-1!==o&&e[o=o?--o:e.length-1].focus()}else e[e.length-1].focus()},e.prototype.down=function(t){var e=this.items.filter((function(t){return t instanceof a.AbstractItem&&!t.isHidden()}));if(0!==e.length)if(this.focused){var o=e.indexOf(this.focused);-1!==o&&e[o=++o===e.length?0:o].focus()}else e[0].focus()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.generateMenu()},e.prototype.generateMenu=function(){var t,e,o=this.html;o.classList.add(u.HtmlClasses.MENU);try{for(var n=i(this.items),r=n.next();!r.done;r=n.next()){var s=r.value;if(s.isHidden()){var a=s.html;a.parentNode&&a.parentNode.removeChild(a)}else o.appendChild(s.html)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.post=function(e,o){this.variablePool.update(),t.prototype.post.call(this,e,o)},e.prototype.unpostSubmenus=function(){var t,e,o=this.items.filter((function(t){return t instanceof c.Submenu}));try{for(var n=i(o),r=n.next();!r.done;r=n.next()){var s=r.value;s.submenu.unpost(),s!==this.focused&&s.unfocus()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.unpostSubmenus(),this.focused=null},e.prototype.find=function(t){var e,o;try{for(var n=i(this.items),r=n.next();!r.done;r=n.next()){var s=r.value;if("rule"!==s.type){if(s.id===t)return s;if("submenu"===s.type){var a=s.submenu.find(t);if(a)return a}}}}catch(t){e={error:t}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}return null},e}(s.AbstractPostable);e.AbstractMenu=p},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.ContextMenu=void 0;var i=o(6),s=o(0),a=o(18),u=o(19),c=function(t){function e(e){var o=t.call(this)||this;return o.factory=e,o.id="",o.moving=!1,o._store=new a.MenuStore(o),o.widgets=[],o.variablePool=new u.VariablePool,o}return r(e,t),e.fromJson=function(t,e){var o=e.pool,n=e.items,r=e.id,i=void 0===r?"":r,s=new this(t);s.id=i;var a=t.get("variable");o.forEach((function(e){return a(t,e,s.pool)}));var u=t.get("items")(t,n,s);return s.items=u,s},e.prototype.generateHtml=function(){this.isPosted()&&this.unpost(),t.prototype.generateHtml.call(this),this._frame=document.createElement("div"),this._frame.classList.add(s.HtmlClasses.MENUFRAME);var e="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;";this._frame.setAttribute("style","position: absolute; "+e);var o=document.createElement("div");o.setAttribute("style","position: fixed; "+e),this._frame.appendChild(o),o.addEventListener("mousedown",function(t){this.unpost(),this.unpostWidgets(),this.stop(t)}.bind(this))},e.prototype.display=function(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()},e.prototype.escape=function(t){this.unpost(),this.unpostWidgets()},e.prototype.unpost=function(){if(t.prototype.unpost.call(this),!(this.widgets.length>0)){this.frame.parentNode.removeChild(this.frame);var e=this.store;this.moving||e.insertTaborder(),e.active.focus()}},e.prototype.left=function(t){this.move_(this.store.previous())},e.prototype.right=function(t){this.move_(this.store.next())},Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.post=function(e,o){if(void 0!==o)return this.moving||this.store.removeTaborder(),void t.prototype.post.call(this,e,o);var n,r,i,s=e;if(s instanceof Event?(n=s.target,this.stop(s)):n=s,s instanceof MouseEvent&&(r=s.pageX,i=s.pageY,r||i||!s.clientX||(r=s.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i=s.clientY+document.body.scrollTop+document.documentElement.scrollTop)),!r&&!i&&n){var a=window.pageXOffset||document.documentElement.scrollLeft,u=window.pageYOffset||document.documentElement.scrollTop,c=n.getBoundingClientRect();r=(c.right+c.left)/2+a,i=(c.bottom+c.top)/2+u}this.store.active=n,this.anchor=this.store.active;var p=this.html;r+p.offsetWidth>document.body.offsetWidth-5&&(r=document.body.offsetWidth-p.offsetWidth-5),this.post(r,i)},e.prototype.registerWidget=function(t){this.widgets.push(t)},e.prototype.unregisterWidget=function(t){var e=this.widgets.indexOf(t);e>-1&&this.widgets.splice(e,1),0===this.widgets.length&&this.unpost()},e.prototype.unpostWidgets=function(){this.widgets.forEach((function(t){return t.unpost()}))},e.prototype.toJson=function(){return{type:""}},e.prototype.move_=function(t){this.anchor&&t!==this.anchor&&(this.moving=!0,this.unpost(),this.post(t),this.moving=!1)},e}(i.AbstractMenu);e.ContextMenu=c},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.MenuElement=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addAttributes=function(t){for(var e in t)this.html.setAttribute(e,t[e])},Object.defineProperty(e.prototype,"html",{get:function(){return this._html||this.generateHtml(),this._html},set:function(t){this._html=t,this.addEvents(t)},enumerable:!1,configurable:!0}),e.prototype.generateHtml=function(){var t=document.createElement("div");t.classList.add(this.className),t.setAttribute("role",this.role),this.html=t},e.prototype.focus=function(){var t=this.html;t.setAttribute("tabindex","0"),t.focus()},e.prototype.unfocus=function(){var t=this.html;t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1");try{t.blur()}catch(t){}t.blur()},e}(o(16).AbstractNavigatable);e.MenuElement=i},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEntry=void 0;var i=o(8),s=o(0),a=function(t){function e(e,o){var n=t.call(this)||this;return n._menu=e,n._type=o,n.className=s.HtmlClasses.MENUITEM,n.role="menuitem",n.hidden=!1,n}return r(e,t),Object.defineProperty(e.prototype,"menu",{get:function(){return this._menu},set:function(t){this._menu=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),e.prototype.hide=function(){this.hidden=!0,this.menu.generateMenu()},e.prototype.show=function(){this.hidden=!1,this.menu.generateMenu()},e.prototype.isHidden=function(){return this.hidden},e}(i.MenuElement);e.AbstractEntry=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Submenu=void 0;var i=o(2),s=o(0),a=function(t){function e(e,o,n){var r=t.call(this,e,"submenu",o,n)||this;return r._submenu=null,r}return r(e,t),e.fromJson=function(t,e,o){var n=e.content,r=e.menu,i=new this(o,n,e.id),s=t.get("subMenu")(t,r,i);return i.submenu=s,i},Object.defineProperty(e.prototype,"submenu",{get:function(){return this._submenu},set:function(t){this._submenu=t},enumerable:!1,configurable:!0}),e.prototype.mouseover=function(t){this.focus(),this.stop(t)},e.prototype.mouseout=function(t){this.stop(t)},e.prototype.unfocus=function(){if(this.submenu.isPosted()){if(this.menu.focused!==this)return t.prototype.unfocus.call(this),void this.menu.unpostSubmenus();this.html.setAttribute("tabindex","-1"),this.html.blur()}else t.prototype.unfocus.call(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.submenu.isPosted()||this.disabled||this.submenu.post()},e.prototype.executeAction=function(){this.submenu.isPosted()?this.submenu.unpost():this.submenu.post()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;this.span=document.createElement("span"),this.span.textContent="\u25ba",this.span.classList.add(s.HtmlClasses.MENUARROW),e.appendChild(this.span),e.setAttribute("aria-haspopup","true")},e.prototype.left=function(e){this.submenu.isPosted()?this.submenu.unpost():t.prototype.left.call(this,e)},e.prototype.right=function(t){this.submenu.isPosted()?this.submenu.down(t):this.submenu.post()},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Submenu=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Info=void 0;var i=o(21),s=o(0),a=function(t){function e(e,o,n){var r=t.call(this)||this;return r.title=e,r.signature=n,r.className=s.HtmlClasses.INFO,r.role="dialog",r.contentDiv=r.generateContent(),r.close=r.generateClose(),r.content=o||function(){return""},r}return r(e,t),e.prototype.attachMenu=function(t){this.menu=t},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.appendChild(this.generateTitle()),e.appendChild(this.contentDiv),e.appendChild(this.generateSignature()),e.appendChild(this.close.html),e.setAttribute("tabindex","0")},e.prototype.post=function(){t.prototype.post.call(this);var e=document.documentElement,o=this.html,n=window.innerHeight||e.clientHeight||e.scrollHeight||0,r=Math.floor(-o.offsetWidth/2),i=Math.floor((n-o.offsetHeight)/3);o.setAttribute("style","margin-left: "+r+"px; top: "+i+"px;"),window.event instanceof MouseEvent&&o.classList.add(s.HtmlClasses.MOUSEPOST),o.focus()},e.prototype.display=function(){this.menu.registerWidget(this),this.contentDiv.innerHTML=this.content();var t=this.menu.html;t.parentNode&&t.parentNode.removeChild(t),this.menu.frame.appendChild(this.html)},e.prototype.click=function(t){},e.prototype.keydown=function(e){this.bubbleKey(),t.prototype.keydown.call(this,e)},e.prototype.escape=function(t){this.unpost()},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.html.classList.remove(s.HtmlClasses.MOUSEPOST),this.menu.unregisterWidget(this)},e.prototype.generateClose=function(){var t=new i.CloseButton(this),e=t.html;return e.classList.add(s.HtmlClasses.INFOCLOSE),e.setAttribute("aria-label","Close Dialog Box"),t},e.prototype.generateTitle=function(){var t=document.createElement("span");return t.innerHTML=this.title,t.classList.add(s.HtmlClasses.INFOTITLE),t},e.prototype.generateContent=function(){var t=document.createElement("div");return t.classList.add(s.HtmlClasses.INFOCONTENT),t.setAttribute("tabindex","0"),t},e.prototype.generateSignature=function(){var t=document.createElement("span");return t.innerHTML=this.signature,t.classList.add(s.HtmlClasses.INFOSIGNATURE),t},e.prototype.toJson=function(){return{type:""}},e}(o(3).AbstractPostable);e.Info=a},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Variable=void 0;var n=o(1),r=function(){function t(t,e,o){this._name=t,this.getter=e,this.setter=o,this.items=[]}return t.fromJson=function(t,e,o){var n=new this(e.name,e.getter,e.setter);o.insert(n)},Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t.prototype.getValue=function(t){try{return this.getter(t)}catch(t){return n.MenuUtil.error(t,"Command of variable "+this.name+" failed."),null}},t.prototype.setValue=function(t,e){try{this.setter(t,e)}catch(t){n.MenuUtil.error(t,"Command of variable "+this.name+" failed.")}this.update()},t.prototype.register=function(t){-1===this.items.indexOf(t)&&this.items.push(t)},t.prototype.unregister=function(t){var e=this.items.indexOf(t);-1!==e&&this.items.splice(e,1)},t.prototype.update=function(){this.items.forEach((function(t){return t.update()}))},t.prototype.registerCallback=function(t){this.items.forEach((function(e){return e.registerCallback(t)}))},t.prototype.unregisterCallback=function(t){this.items.forEach((function(e){return e.unregisterCallback(t)}))},t.prototype.toJson=function(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}},t}();e.Variable=r},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),i=this&&this.__read||function(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var n,r,i=o.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return s};Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionBox=e.SelectionMenu=void 0;var s=o(1),a=o(0),u=o(6),c=o(11),p=function(t){function e(e){var o=t.call(this)||this;return o.anchor=e,o.className=a.HtmlClasses.SELECTIONMENU,o.variablePool=o.anchor.menu.pool,o.baseMenu=o.anchor.menu,o}return r(e,t),e.fromJson=function(t,e,o){var n=e.title,r=e.values,i=e.variable,s=new this(o),a=t.get("label")(t,{content:n||"",id:n||"id"},s),u=t.get("rule")(t,{},s),c=r.map((function(e){return t.get("radio")(t,{content:e,variable:i,id:e},s)})),p=[a,u].concat(c);return s.items=p,s},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.items.forEach((function(t){return t.html.classList.add(a.HtmlClasses.SELECTIONITEM)}))},e.prototype.display=function(){},e.prototype.right=function(t){this.anchor.right(t)},e.prototype.left=function(t){this.anchor.left(t)},e}(u.AbstractMenu);e.SelectionMenu=p;var l=function(t){function e(e,o,n,r){void 0===n&&(n="none"),void 0===r&&(r="vertical");var i=t.call(this,e,null,o)||this;return i.style=n,i.grid=r,i._selections=[],i.prefix="ctxt-selection",i._balanced=!0,i}return r(e,t),e.fromJson=function(t,e,o){var n=e.title,r=e.signature,i=e.selections,s=new this(n,r,e.order,e.grid);s.attachMenu(o);var a=i.map((function(e){return t.get("selectionMenu")(t,e,s)}));return s.selections=a,s},e.prototype.attachMenu=function(t){this.menu=t},Object.defineProperty(e.prototype,"selections",{get:function(){return this._selections},set:function(t){var e=this;this._selections=[],t.forEach((function(t){return e.addSelection(t)}))},enumerable:!1,configurable:!0}),e.prototype.addSelection=function(t){t.anchor=this,this._selections.push(t)},e.prototype.rowDiv=function(t){var e=this,o=document.createElement("div");this.contentDiv.appendChild(o);var n=t.map((function(t){return o.appendChild(t.html),t.html.id||(t.html.id=e.prefix+s.MenuUtil.counter()),t.html.getBoundingClientRect()})),r=n.map((function(t){return t.width})),i=r.reduce((function(t,e){return t+e}),0),u=n.reduce((function(t,e){return Math.max(t,e.height)}),0);return o.classList.add(a.HtmlClasses.SELECTIONDIVIDER),o.setAttribute("style","height: "+u+"px;"),[o,i,u,r]},e.prototype.display=function(){if(t.prototype.display.call(this),this.order(),this.selections.length){for(var e=[],o=0,n=[],r=this.getChunkSize(this.selections.length),s=function(t){var s=a.selections.slice(t,t+r),u=i(a.rowDiv(s),4),c=u[0],p=u[1],l=u[2],h=u[3];e.push(c),o=Math.max(o,p),s.forEach((function(t){return t.html.style.height=l+"px"})),n=a.combineColumn(n,h)},a=this,u=0;u<this.selections.length;u+=r)s(u);this._balanced&&(this.balanceColumn(e,n),o=n.reduce((function(t,e){return t+e}),20)),e.forEach((function(t){return t.style.width=o+"px"}))}},e.prototype.getChunkSize=function(t){switch(this.grid){case"square":return Math.floor(Math.sqrt(t));case"horizontal":return Math.floor(t/e.chunkSize);case"vertical":default:return e.chunkSize}},e.prototype.balanceColumn=function(t,e){t.forEach((function(t){for(var o=Array.from(t.children),n=0,r=void 0;r=o[n];n++)r.style.width=e[n]+"px"}))},e.prototype.combineColumn=function(t,e){for(var o=[],n=0;t[n]||e[n];){if(!t[n]){o=o.concat(e.slice(n));break}if(!e[n]){o=o.concat(t.slice(n));break}o.push(Math.max(t[n],e[n])),n++}return o},e.prototype.left=function(t){var e=this;this.move(t,(function(t){return(0===t?e.selections.length:t)-1}))},e.prototype.right=function(t){var e=this;this.move(t,(function(t){return t===e.selections.length-1?0:t+1}))},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(a.HtmlClasses.SELECTION)},e.prototype.generateContent=function(){var e=t.prototype.generateContent.call(this);return e.classList.add(a.HtmlClasses.SELECTIONBOX),e.removeAttribute("tabindex"),e},e.prototype.findSelection=function(t){var e=t.target,o=null;if(e.id&&(o=this.selections.find((function(t){return t.html.id===e.id}))),!o){var n=e.parentElement.id;o=this.selections.find((function(t){return t.html.id===n}))}return o},e.prototype.move=function(t,e){var o=this.findSelection(t);o.focused&&o.focused.unfocus();var n=e(this.selections.indexOf(o));this.selections[n].focus()},e.prototype.order=function(){this.selections.sort(e.orderMethod.get(this.style))},e.prototype.toJson=function(){return{type:""}},e.chunkSize=4,e.orderMethod=new Map([["alphabetical",function(t,e){return t.items[0].content.localeCompare(e.items[0].content)}],["none",function(t,e){return 1}],["decreasing",function(t,e){var o=t.items.length,n=e.items.length;return o<n?1:n<o?-1:0}],["increasing",function(t,e){var o=t.items.length,n=e.items.length;return o<n?-1:n<o?1:0}]]),e}(c.Info);e.SelectionBox=l},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParserFactory=void 0;var n=function(){function t(t){this._parser=new Map(t)}return t.prototype.get=function(t){return this._parser.get(t)},t.prototype.add=function(t,e){this._parser.set(t,e)},t}();e.ParserFactory=n},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParserFactory=e.Variable=e.SelectionBox=e.version=e.Parser=e.Popup=e.Info=e.CssStyles=e.ContextMenu=void 0;var n=o(7),r=o(20),i=o(11),s=o(22),a=o(23),u=o(13),c=o(12),p=o(14);e.ContextMenu=n.ContextMenu,e.CssStyles=r.CssStyles,e.Info=i.Info,e.Popup=s.Popup,e.Parser=a.Parser,e.version="0.4.2",e.SelectionBox=u.SelectionBox,e.Variable=c.Variable,e.ParserFactory=p.ParserFactory},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNavigatable=void 0;var n=o(4),r=o(17),i=function(){function t(){this.bubble=!1}return t.prototype.bubbleKey=function(){this.bubble=!0},t.prototype.keydown=function(t){switch(t.keyCode){case n.KEY.ESCAPE:this.escape(t);break;case n.KEY.RIGHT:this.right(t);break;case n.KEY.LEFT:this.left(t);break;case n.KEY.UP:this.up(t);break;case n.KEY.DOWN:this.down(t);break;case n.KEY.RETURN:case n.KEY.SPACE:this.space(t);break;default:return}this.bubble?this.bubble=!1:this.stop(t)},t.prototype.escape=function(t){},t.prototype.space=function(t){},t.prototype.left=function(t){},t.prototype.right=function(t){},t.prototype.up=function(t){},t.prototype.down=function(t){},t.prototype.stop=function(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)},t.prototype.mousedown=function(t){return this.stop(t)},t.prototype.mouseup=function(t){return this.stop(t)},t.prototype.mouseover=function(t){return this.stop(t)},t.prototype.mouseout=function(t){return this.stop(t)},t.prototype.click=function(t){return this.stop(t)},t.prototype.addEvents=function(t){t.addEventListener(r.MOUSE.DOWN,this.mousedown.bind(this)),t.addEventListener(r.MOUSE.UP,this.mouseup.bind(this)),t.addEventListener(r.MOUSE.OVER,this.mouseover.bind(this)),t.addEventListener(r.MOUSE.OUT,this.mouseout.bind(this)),t.addEventListener(r.MOUSE.CLICK,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(r.MOUSE.SELECTSTART,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(r.MOUSE.DBLCLICK,this.stop.bind(this))},t}();e.AbstractNavigatable=i},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MOUSE=void 0,e.MOUSE={CLICK:"click",DBLCLICK:"dblclick",DOWN:"mousedown",UP:"mouseup",OVER:"mouseover",OUT:"mouseout",MOVE:"mousemove",SELECTEND:"selectend",SELECTSTART:"selectstart"}},function(t,e,o){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],n=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MenuStore=void 0;var r=o(1),i=o(0),s=o(4),a=function(){function t(t){this.menu=t,this.store=[],this._active=null,this.counter=0,this.attachedClass=i.HtmlClasses.ATTACHED+"_"+r.MenuUtil.counter(),this.taborder=!0,this.attrMap={}}return Object.defineProperty(t.prototype,"active",{get:function(){return this._active},set:function(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}t=t.parentNode}while(t)},enumerable:!1,configurable:!0}),t.prototype.next=function(){var t=this.store.length;if(0===t)return this.active=null,null;var e=this.store.indexOf(this.active);return e=-1===e?0:e<t-1?e+1:0,this.active=this.store[e],this.active},t.prototype.previous=function(){var t=this.store.length;if(0===t)return this.active=null,null;var e=t-1,o=this.store.indexOf(this.active);return o=-1===o||0===o?e:o-1,this.active=this.store[o],this.active},t.prototype.clear=function(){this.remove(this.store)},t.prototype.insert=function(t){var e,o,r=t instanceof HTMLElement?[t]:t;try{for(var i=n(r),s=i.next();!s.done;s=i.next()){var a=s.value;this.insertElement(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(e)throw e.error}}this.sort()},t.prototype.remove=function(t){var e,o,r=t instanceof HTMLElement?[t]:t;try{for(var i=n(r),s=i.next();!s.done;s=i.next()){var a=s.value;this.removeElement(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(e)throw e.error}}this.sort()},t.prototype.inTaborder=function(t){this.taborder&&!t&&this.removeTaborder(),!this.taborder&&t&&this.insertTaborder(),this.taborder=t},t.prototype.insertTaborder=function(){this.taborder&&this.insertTaborder_()},t.prototype.removeTaborder=function(){this.taborder&&this.removeTaborder_()},t.prototype.insertElement=function(t){t.classList.contains(this.attachedClass)||(t.classList.add(this.attachedClass),this.taborder&&this.addTabindex(t),this.addEvents(t))},t.prototype.removeElement=function(t){t.classList.contains(this.attachedClass)&&(t.classList.remove(this.attachedClass),this.taborder&&this.removeTabindex(t),this.removeEvents(t))},t.prototype.sort=function(){var t=document.getElementsByClassName(this.attachedClass);this.store=[].slice.call(t)},t.prototype.insertTaborder_=function(){this.store.forEach((function(t){return t.setAttribute("tabindex","0")}))},t.prototype.removeTaborder_=function(){this.store.forEach((function(t){return t.setAttribute("tabindex","-1")}))},t.prototype.addTabindex=function(t){t.hasAttribute("tabindex")&&t.setAttribute(i.HtmlAttrs.OLDTAB,t.getAttribute("tabindex")),t.setAttribute("tabindex","0")},t.prototype.removeTabindex=function(t){t.hasAttribute(i.HtmlAttrs.OLDTAB)?(t.setAttribute("tabindex",t.getAttribute(i.HtmlAttrs.OLDTAB)),t.removeAttribute(i.HtmlAttrs.OLDTAB)):t.removeAttribute("tabindex")},t.prototype.addEvents=function(t){t.hasAttribute(i.HtmlAttrs.COUNTER)||(this.addEvent(t,"contextmenu",this.menu.post.bind(this.menu)),this.addEvent(t,"keydown",this.keydown.bind(this)),t.setAttribute(i.HtmlAttrs.COUNTER,this.counter.toString()),this.counter++)},t.prototype.addEvent=function(t,e,o){var n=i.HtmlAttrs[e.toUpperCase()+"FUNC"];this.attrMap[n+this.counter]=o,t.addEventListener(e,o)},t.prototype.removeEvents=function(t){if(t.hasAttribute(i.HtmlAttrs.COUNTER)){var e=t.getAttribute(i.HtmlAttrs.COUNTER);this.removeEvent(t,"contextmenu",e),this.removeEvent(t,"keydown",e),t.removeAttribute(i.HtmlAttrs.COUNTER)}},t.prototype.removeEvent=function(t,e,o){var n=i.HtmlAttrs[e.toUpperCase()+"FUNC"],r=this.attrMap[n+o];t.removeEventListener(e,r)},t.prototype.keydown=function(t){t.keyCode===s.KEY.SPACE&&(this.menu.post(t),t.preventDefault(),t.stopImmediatePropagation())},t}();e.MenuStore=a},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VariablePool=void 0;var n=function(){function t(){this.pool={}}return t.prototype.insert=function(t){this.pool[t.name]=t},t.prototype.lookup=function(t){return this.pool[t]},t.prototype.remove=function(t){delete this.pool[t]},t.prototype.update=function(){for(var t in this.pool)this.pool[t].update()},t}();e.VariablePool=n},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CssStyles=void 0;var n=o(0);!function(t){function e(t){return"."+(n.HtmlClasses[t]||t)}var o={};o[e("INFOCLOSE")]="{ top:.2em; right:.2em;}",o[e("INFOCONTENT")]="{ overflow:auto; text-align:left; font-size:80%; padding:.4em .6em; border:1px inset; margin:1em 0px; max-height:20em; max-width:30em; background-color:#EEEEEE; white-space:normal;}",o[e("INFO")+e("MOUSEPOST")]="{outline:none;}",o[e("INFO")]='{ position:fixed; left:50%; width:auto; text-align:center; border:3px outset; padding:1em 2em; background-color:#DDDDDD; color:black; cursor:default; font-family:message-box; font-size:120%; font-style:normal; text-indent:0; text-transform:none; line-height:normal; letter-spacing:normal; word-spacing:normal; word-wrap:normal; white-space:nowrap; float:none; z-index:201; border-radius: 15px; /* Opera 10.5 and IE9 */ -webkit-border-radius:15px; /* Safari and Chrome */ -moz-border-radius:15px; /* Firefox */ -khtml-border-radius:15px; /* Konqueror */ box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */ -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */ -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */ -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */ filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color="gray", Positive="true"); /* IE */}';var r={};r[e("MENU")]="{ position:absolute; background-color:white; color:black; width:auto; padding:5px 0px; border:1px solid #CCCCCC; margin:0; cursor:default; font: menu; text-align:left; text-indent:0; text-transform:none; line-height:normal; letter-spacing:normal; word-spacing:normal; word-wrap:normal; white-space:nowrap; float:none; z-index:201; border-radius: 5px; /* Opera 10.5 and IE9 */ -webkit-border-radius: 5px; /* Safari and Chrome */ -moz-border-radius: 5px; /* Firefox */ -khtml-border-radius: 5px; /* Konqueror */ box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */ -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */ -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */ -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */}",r[e("MENUITEM")]="{ padding: 1px 2em; background:transparent;}",r[e("MENUARROW")]="{ position:absolute; right:.5em; padding-top:.25em; color:#666666; font-family: null; font-size: .75em}",r[e("MENUACTIVE")+" "+e("MENUARROW")]="{color:white}",r[e("MENUARROW")+e("RTL")]="{left:.5em; right:auto}",r[e("MENUCHECK")]="{ position:absolute; left:.7em; font-family: null}",r[e("MENUCHECK")+e("RTL")]="{ right:.7em; left:auto }",r[e("MENURADIOCHECK")]="{ position:absolute; left: .7em;}",r[e("MENURADIOCHECK")+e("RTL")]="{ right: .7em; left:auto}",r[e("MENUINPUTBOX")]="{ padding-left: 1em; right:.5em; color:#666666; font-family: null;}",r[e("MENUINPUTBOX")+e("RTL")]="{ left: .1em;}",r[e("MENUCOMBOBOX")]="{ left:.1em; padding-bottom:.5em;}",r[e("MENUSLIDER")]="{ left: .1em;}",r[e("SLIDERVALUE")]="{ position:absolute; right:.1em; padding-top:.25em; color:#333333; font-size: .75em}",r[e("SLIDERBAR")]="{ outline: none; background: #d3d3d3}",r[e("MENULABEL")]="{ padding: 1px 2em 3px 1.33em; font-style:italic}",r[e("MENURULE")]="{ border-top: 1px solid #DDDDDD; margin: 4px 3px;}",r[e("MENUDISABLED")]="{ color:GrayText}",r[e("MENUACTIVE")]="{ background-color: #606872; color: white;}",r[e("MENUDISABLED")+":focus"]="{ background-color: #E8E8E8}",r[e("MENULABEL")+":focus"]="{ background-color: #E8E8E8}",r[e("CONTEXTMENU")+":focus"]="{ outline:none}",r[e("CONTEXTMENU")+" "+e("MENUITEM")+":focus"]="{ outline:none}",r[e("SELECTIONMENU")]="{ position:relative; float:left; border-bottom: none; -webkit-box-shadow:none; -webkit-border-radius:0px; }",r[e("SELECTIONITEM")]="{ padding-right: 1em;}",r[e("SELECTION")]="{ right: 40%; width:50%; }",r[e("SELECTIONBOX")]="{ padding: 0em; max-height:20em; max-width: none; background-color:#FFFFFF;}",r[e("SELECTIONDIVIDER")]="{ clear: both; border-top: 2px solid #000000;}",r[e("MENU")+" "+e("MENUCLOSE")]="{ top:-10px; left:-10px}";var i={};i[e("MENUCLOSE")]='{ position:absolute; cursor:pointer; display:inline-block; border:2px solid #AAA; border-radius:18px; -webkit-border-radius: 18px; /* Safari and Chrome */ -moz-border-radius: 18px; /* Firefox */ -khtml-border-radius: 18px; /* Konqueror */ font-family: "Courier New", Courier; font-size:24px; color:#F0F0F0}',i[e("MENUCLOSE")+" span"]="{ display:block; background-color:#AAA; border:1.5px solid; border-radius:18px; -webkit-border-radius: 18px; /* Safari and Chrome */ -moz-border-radius: 18px; /* Firefox */ -khtml-border-radius: 18px; /* Konqueror */ line-height:0; padding:8px 0 6px /* may need to be browser-specific */}",i[e("MENUCLOSE")+":hover"]="{ color:white!important; border:2px solid #CCC!important}",i[e("MENUCLOSE")+":hover span"]="{ background-color:#CCC!important}",i[e("MENUCLOSE")+":hover:focus"]="{ outline:none}";var s=!1,a=!1,u=!1;function c(t){u||(p(i,t),u=!0)}function p(t,e){var o=e||document,n=o.createElement("style");n.type="text/css";var r="";for(var i in t)r+=i,r+=" ",r+=t[i],r+="\n";n.innerHTML=r,o.head.appendChild(n)}t.addMenuStyles=function(t){a||(p(r,t),a=!0,c(t))},t.addInfoStyles=function(t){s||(p(o,t),s=!0,c(t))}}(e.CssStyles||(e.CssStyles={}))},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.CloseButton=void 0;var i=o(3),s=o(0),a=function(t){function e(e){var o=t.call(this)||this;return o.element=e,o.className=s.HtmlClasses.MENUCLOSE,o.role="button",o}return r(e,t),e.prototype.generateHtml=function(){var t=document.createElement("span");t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0");var e=document.createElement("span");e.textContent="\xd7",t.appendChild(e),this.html=t},e.prototype.display=function(){},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.element.unpost()},e.prototype.keydown=function(e){this.bubbleKey(),t.prototype.keydown.call(this,e)},e.prototype.space=function(t){this.unpost(),this.stop(t)},e.prototype.mousedown=function(t){this.unpost(),this.stop(t)},e}(i.AbstractPostable);e.CloseButton=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Popup=void 0;var i=function(t){function e(e,o){var n=t.call(this)||this;return n.title=e,n.window=null,n.localSettings={left:Math.round((screen.width-400)/2),top:Math.round((screen.height-300)/3)},n.windowList=[],n.mobileFlag=!1,n.active=null,n.content=o||function(){return""},n}return r(e,t),e.fromJson=function(){},e.prototype.attachMenu=function(t){this.menu=t},e.prototype.post=function(){this.display()},e.prototype.display=function(){this.active=this.menu.store.active;var t=[];for(var o in e.popupSettings)t.push(o+"="+e.popupSettings[o]);for(var o in this.localSettings)t.push(o+"="+this.localSettings[o]);this.window=window.open("","_blank",t.join(",")),this.windowList.push(this.window);var n=this.window.document;this.mobileFlag?(n.open(),n.write('<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>'+this.title+'</title></head><body style="font-size:85%">'),n.write("<pre>"+this.generateContent()+"</pre>"),n.write('<hr><input type="button" value="Close" onclick="window.close()" />'),n.write("</body></html>"),n.close()):(n.open(),n.write("<html><head><title>"+this.title+'</title></head><body style="font-size:85%">'),n.write("<table><tr><td><pre>"+this.generateContent()+"</pre></td></tr></table>"),n.write("</body></html>"),n.close(),setTimeout(this.resize.bind(this),50))},e.prototype.unpost=function(){this.windowList.forEach((function(t){return t.close()})),this.window=null},e.prototype.generateContent=function(){return this.content(this.active)},e.prototype.resize=function(){var t=this.window.document.body.firstChild,e=this.window.outerHeight-this.window.innerHeight||30,o=this.window.outerWidth-this.window.innerWidth||30;o=Math.max(140,Math.min(Math.floor(.5*this.window.screen.width),t.offsetWidth+o+25)),e=Math.max(40,Math.min(Math.floor(.5*this.window.screen.height),t.offsetHeight+e+25)),this.window.resizeTo(o,e);var n=this.active.getBoundingClientRect();if(n){var r=Math.max(0,Math.min(n.right-Math.floor(o/2),this.window.screen.width-o-20)),i=Math.max(0,Math.min(n.bottom-Math.floor(e/2),this.window.screen.height-e-20));this.window.moveTo(r,i)}this.active=null},e.prototype.toJson=function(){return{type:""}},e.popupSettings={status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:400,height:300},e}(o(3).AbstractPostable);e.Popup=i},function(t,e,o){"use strict";var n=this&&this.__rest||function(t,e){var o={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(o[n[r]]=t[n[r]])}return o},r=this&&this.__read||function(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var n,r,i=o.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return s},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],n=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0;var a=o(24),u=o(7),c=o(12),p=o(25),l=o(26),h=o(27),f=o(28),d=o(10),m=o(29),y=o(30),b=o(31),v=o(13),E=o(14),_=function(){function t(t){var e=this;void 0===t&&(t=[]),this._initList=[["command",a.Command.fromJson.bind(a.Command)],["checkbox",p.Checkbox.fromJson.bind(p.Checkbox)],["combo",l.Combo.fromJson.bind(l.Combo)],["slider",y.Slider.fromJson.bind(y.Slider)],["label",h.Label.fromJson.bind(h.Label)],["radio",f.Radio.fromJson.bind(f.Radio)],["rule",m.Rule.fromJson.bind(m.Rule)],["submenu",d.Submenu.fromJson.bind(d.Submenu)],["contextMenu",u.ContextMenu.fromJson.bind(u.ContextMenu)],["subMenu",b.SubMenu.fromJson.bind(b.SubMenu)],["variable",c.Variable.fromJson.bind(c.Variable)],["items",this.items.bind(this)],["selectionMenu",v.SelectionMenu.fromJson.bind(v.SelectionMenu)],["selectionBox",v.SelectionBox.fromJson.bind(v.SelectionBox)]],this._factory=new E.ParserFactory(this._initList),t.forEach((function(t){var o=r(t,2),n=o[0],i=o[1];return e.factory.add(n,i)}))}return Object.defineProperty(t.prototype,"factory",{get:function(){return this._factory},enumerable:!1,configurable:!0}),t.prototype.items=function(t,e,o){var n,r,s=[];try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value,p=this.parse(c,o);p&&(o.items.push(p),c.disabled&&p.disable(),c.hidden&&s.push(p))}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return s.forEach((function(t){return t.hide()})),o.items},t.prototype.parse=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];var r=t.type,i=n(t,["type"]),a=this.factory.get(r);return a?a.apply(void 0,s([this.factory,i],e)):null},t}();e.Parser=_},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Command=void 0;var i=o(2),s=o(1),a=function(t){function e(e,o,n,r){var i=t.call(this,e,"command",o,r)||this;return i.command=n,i}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.action,e.id)},e.prototype.executeAction=function(){try{this.command(s.MenuUtil.getActiveElement(this))}catch(t){s.MenuUtil.error(t,"Illegal command callback.")}s.MenuUtil.close(this)},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Command=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Checkbox=void 0;var i=o(5),s=o(1),a=o(0),u=function(t){function e(e,o,n,r){var i=t.call(this,e,"checkbox",o,r)||this;return i.role="menuitemcheckbox",i.variable=e.pool.lookup(n),i.register(),i}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(!this.variable.getValue()),s.MenuUtil.close(this)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(a.HtmlClasses.MENUCHECK)},e.prototype.updateAria=function(){this.html.setAttribute("aria-checked",this.variable.getValue()?"true":"false")},e.prototype.updateSpan=function(){this.span.style.display=this.variable.getValue()?"":"none"},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Checkbox=u},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Combo=void 0;var i=o(5),s=o(1),a=o(0),u=o(4),c=function(t){function e(e,o,n,r){var i=t.call(this,e,"combobox",o,r)||this;return i.role="combobox",i.inputEvent=!1,i.variable=e.pool.lookup(n),i.register(),i}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.input.value,s.MenuUtil.getActiveElement(this))},e.prototype.space=function(e){t.prototype.space.call(this,e),s.MenuUtil.close(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.input.focus()},e.prototype.unfocus=function(){t.prototype.unfocus.call(this),this.updateSpan()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(a.HtmlClasses.MENUCOMBOBOX)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.classList.add(a.HtmlClasses.MENUINPUTBOX),this.input=document.createElement("input"),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.setAttribute("size","10em"),this.input.setAttribute("type","text"),this.input.setAttribute("tabindex","-1"),this.span.appendChild(this.input)},e.prototype.inputKey=function(t){this.bubbleKey(),this.inputEvent=!0},e.prototype.keydown=function(e){if(this.inputEvent&&e.keyCode!==u.KEY.ESCAPE&&e.keyCode!==u.KEY.RETURN)return this.inputEvent=!1,void e.stopPropagation();t.prototype.keydown.call(this,e),e.stopPropagation()},e.prototype.updateAria=function(){},e.prototype.updateSpan=function(){var t;try{t=this.variable.getValue(s.MenuUtil.getActiveElement(this))}catch(e){t=""}this.input.value=t},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Combo=c},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Label=void 0;var i=o(2),s=o(0),a=function(t){function e(e,o,n){return t.call(this,e,"label",o,n)||this}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.id)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(s.HtmlClasses.MENULABEL)},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Label=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Radio=void 0;var i=o(5),s=o(1),a=o(0),u=function(t){function e(e,o,n,r){var i=t.call(this,e,"radio",o,r)||this;return i.role="menuitemradio",i.variable=e.pool.lookup(n),i.register(),i}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.id),s.MenuUtil.close(this)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(a.HtmlClasses.MENURADIOCHECK)},e.prototype.updateAria=function(){this.html.setAttribute("aria-checked",this.variable.getValue()===this.id?"true":"false")},e.prototype.updateSpan=function(){this.span.style.display=this.variable.getValue()===this.id?"":"none"},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Radio=u},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Rule=void 0;var i=o(9),s=o(0),a=function(t){function e(e){var o=t.call(this,e,"rule")||this;return o.className=s.HtmlClasses.MENUITEM,o.role="separator",o}return r(e,t),e.fromJson=function(t,e,o){return new this(o)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.classList.add(s.HtmlClasses.MENURULE),e.setAttribute("aria-orientation","vertical")},e.prototype.addEvents=function(t){},e.prototype.toJson=function(){return{type:"rule"}},e}(i.AbstractEntry);e.Rule=a},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.Slider=void 0;var i=o(5),s=o(1),a=o(0),u=o(4),c=function(t){function e(e,o,n,r){var i=t.call(this,e,"slider",o,r)||this;return i.role="slider",i.labelId="ctx_slideLabel"+s.MenuUtil.counter(),i.valueId="ctx_slideValue"+s.MenuUtil.counter(),i.inputEvent=!1,i.variable=e.pool.lookup(n),i.register(),i}return r(e,t),e.fromJson=function(t,e,o){return new this(o,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.input.value,s.MenuUtil.getActiveElement(this)),this.update()},e.prototype.space=function(e){t.prototype.space.call(this,e),s.MenuUtil.close(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.input.focus()},e.prototype.unfocus=function(){t.prototype.unfocus.call(this),this.updateSpan()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(a.HtmlClasses.MENUSLIDER),this.valueSpan=document.createElement("span"),this.valueSpan.setAttribute("id",this.valueId),this.valueSpan.classList.add(a.HtmlClasses.SLIDERVALUE),this.html.appendChild(this.valueSpan)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.labelSpan=document.createElement("span"),this.labelSpan.setAttribute("id",this.labelId),this.labelSpan.appendChild(this.html.childNodes[0]),this.html.appendChild(this.labelSpan),this.input=document.createElement("input"),this.input.setAttribute("type","range"),this.input.setAttribute("min","0"),this.input.setAttribute("max","100"),this.input.setAttribute("aria-valuemin","0"),this.input.setAttribute("aria-valuemax","100"),this.input.setAttribute("aria-labelledby",this.labelId),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.addEventListener("input",this.executeAction.bind(this)),this.input.classList.add(a.HtmlClasses.SLIDERBAR),this.span.appendChild(this.input)},e.prototype.inputKey=function(t){this.inputEvent=!0},e.prototype.mousedown=function(t){t.stopPropagation()},e.prototype.mouseup=function(t){event.stopPropagation()},e.prototype.keydown=function(e){var o=e.keyCode;return o===u.KEY.UP||o===u.KEY.DOWN?(e.preventDefault(),void t.prototype.keydown.call(this,e)):this.inputEvent&&o!==u.KEY.ESCAPE&&o!==u.KEY.RETURN?(this.inputEvent=!1,void e.stopPropagation()):(t.prototype.keydown.call(this,e),void e.stopPropagation())},e.prototype.updateAria=function(){var t=this.variable.getValue();t&&this.input&&(this.input.setAttribute("aria-valuenow",t),this.input.setAttribute("aria-valuetext",t+"%"))},e.prototype.updateSpan=function(){var t;try{t=this.variable.getValue(s.MenuUtil.getActiveElement(this)),this.valueSpan.innerHTML=t+"%"}catch(e){t=""}this.input.value=t},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Slider=c},function(t,e,o){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},function(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.SubMenu=void 0;var i=function(t){function e(e){var o=t.call(this)||this;return o._anchor=e,o.variablePool=o.anchor.menu.pool,o.setBaseMenu(),o}return r(e,t),e.fromJson=function(t,e,o){var n=e.items,r=new this(o),i=t.get("items")(t,n,r);return r.items=i,r},Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},enumerable:!1,configurable:!0}),e.prototype.post=function(){if(this.anchor.menu.isPosted()){for(var e=this.anchor.html,o=this.html,n=this.baseMenu.frame,r=e.offsetWidth,i=r-2,s=0;e&&e!==n;)i+=e.offsetLeft,s+=e.offsetTop,e=e.parentNode;i+o.offsetWidth>document.body.offsetWidth-5&&(i=Math.max(5,i-r-o.offsetWidth+6)),t.prototype.post.call(this,i,s)}},e.prototype.display=function(){this.baseMenu.frame.appendChild(this.html)},e.prototype.setBaseMenu=function(){var t=this;do{t=t.anchor.menu}while(t instanceof e);this.baseMenu=t},e.prototype.left=function(t){this.focused=null,this.anchor.focus()},e.prototype.toJson=function(){return{type:""}},e}(o(6).AbstractMenu);e.SubMenu=i}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContextMenu=e():t.ContextMenu=e()}(this,(()=>(()=>{"use strict";var t,e={d:(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{ContextMenu:()=>K,CssStyles:()=>X,Info:()=>j,Parser:()=>G,ParserFactory:()=>$,Popup:()=>q,SelectionBox:()=>Q,Variable:()=>Z,version:()=>Y}),function(t){t[t.RETURN=13]="RETURN",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"}(t||(t={}));const i="click",n="dblclick",o="mousedown",r="mouseup",a="mouseover",h="mouseout",l="selectstart";class u{constructor(){this.bubble=!1}bubbleKey(){this.bubble=!0}keydown(e){switch(e.keyCode){case t.ESCAPE:this.escape(e);break;case t.RIGHT:this.right(e);break;case t.LEFT:this.left(e);break;case t.UP:this.up(e);break;case t.DOWN:this.down(e);break;case t.RETURN:case t.SPACE:this.space(e);break;default:return}this.bubble?this.bubble=!1:this.stop(e)}escape(t){}space(t){}left(t){}right(t){}up(t){}down(t){}stop(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)}mousedown(t){return this.stop(t)}mouseup(t){return this.stop(t)}mouseover(t){return this.stop(t)}mouseout(t){return this.stop(t)}click(t){return this.stop(t)}addEvents(t){t.addEventListener(o,this.mousedown.bind(this)),t.addEventListener(r,this.mouseup.bind(this)),t.addEventListener(a,this.mouseover.bind(this)),t.addEventListener(h,this.mouseout.bind(this)),t.addEventListener(i,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(l,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(n,this.stop.bind(this))}}class d extends u{addAttributes(t){for(let e in t)this.html.setAttribute(e,t[e])}get html(){return this._html||this.generateHtml(),this._html}set html(t){this._html=t,this.addEvents(t)}generateHtml(){let t=document.createElement("div");t.classList.add(this.className),t.setAttribute("role",this.role),this.html=t}focus(){let t=this.html;t.setAttribute("tabindex","0"),t.focus()}unfocus(){let t=this.html;t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1");try{t.blur()}catch(t){}t.blur()}}class c extends d{constructor(){super(...arguments),this.posted=!1}isPosted(){return this.posted}post(t,e){this.posted||(void 0!==t&&void 0!==e&&this.html.setAttribute("style","left: "+t+"px; top: "+e+"px;"),this.display(),this.posted=!0)}unpost(){if(!this.posted)return;let t=this.html;t.parentNode&&t.parentNode.removeChild(t),this.posted=!1}}const p="CtxtMenu";function m(t){return p+"_"+t}function b(t){return m(t)}function f(t){return m(t)}const E={ATTACHED:b("Attached"),CONTEXTMENU:b("ContextMenu"),MENU:b("Menu"),MENUARROW:b("MenuArrow"),MENUACTIVE:b("MenuActive"),MENUCHECK:b("MenuCheck"),MENUCLOSE:b("MenuClose"),MENUCOMBOBOX:b("MenuComboBox"),MENUDISABLED:b("MenuDisabled"),MENUFRAME:b("MenuFrame"),MENUITEM:b("MenuItem"),MENULABEL:b("MenuLabel"),MENURADIOCHECK:b("MenuRadioCheck"),MENUINPUTBOX:b("MenuInputBox"),MENURULE:b("MenuRule"),MENUSLIDER:b("MenuSlider"),MOUSEPOST:b("MousePost"),RTL:b("RTL"),INFO:b("Info"),INFOCLOSE:b("InfoClose"),INFOCONTENT:b("InfoContent"),INFOSIGNATURE:b("InfoSignature"),INFOTITLE:b("InfoTitle"),SLIDERVALUE:b("SliderValue"),SLIDERBAR:b("SliderBar"),SELECTION:b("Selection"),SELECTIONBOX:b("SelectionBox"),SELECTIONMENU:b("SelectionMenu"),SELECTIONDIVIDER:b("SelectionDivider"),SELECTIONITEM:b("SelectionItem")},g={COUNTER:f("Counter"),KEYDOWNFUNC:f("keydownFunc"),CONTEXTMENUFUNC:f("contextmenuFunc"),OLDTAB:f("Oldtabindex"),TOUCHFUNC:f("TouchFunc")};class v extends d{constructor(t,e){super(),this._menu=t,this._type=e,this.className=E.MENUITEM,this.role="menuitem",this.hidden=!1}get menu(){return this._menu}set menu(t){this._menu=t}get type(){return this._type}hide(){this.hidden=!0,this.menu.generateMenu()}show(){this.hidden=!1,this.menu.generateMenu()}isHidden(){return this.hidden}}var x,C;!function(t){t.close=function(t){let e=t.menu;e.baseMenu?e.baseMenu.unpost():e.unpost()},t.getActiveElement=function(t){let e=t.menu;return(e.baseMenu?e.baseMenu:e).store.active},t.error=function(t,e){console.error("ContextMenu Error: "+e)},t.counter=function(){return e++};let e=0}(x||(x={}));class w extends v{constructor(t,e,s,i){super(t,e),this._content=s,this.disabled=!1,this.callbacks=[],this._id=i||s}get content(){return this._content}set content(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()}get id(){return this._id}press(){this.disabled||(this.executeAction(),this.executeCallbacks_())}executeAction(){}registerCallback(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)}unregisterCallback(t){let e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)}mousedown(t){this.press(),this.stop(t)}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.deactivate(),this.stop(t)}generateHtml(){super.generateHtml();let t=this.html;t.setAttribute("aria-disabled","false"),t.textContent=this.content}activate(){this.disabled||this.html.classList.add(E.MENUACTIVE)}deactivate(){this.html.classList.remove(E.MENUACTIVE)}focus(){this.menu.focused=this,super.focus(),this.activate()}unfocus(){this.deactivate(),super.unfocus()}escape(t){x.close(this)}up(t){this.menu.up(t)}down(t){this.menu.down(t)}left(t){this.menu.left(t)}right(t){this.menu.right(t)}space(t){this.press()}disable(){this.disabled=!0;let t=this.html;t.classList.add(E.MENUDISABLED),t.setAttribute("aria-disabled","true")}enable(){this.disabled=!1;let t=this.html;t.classList.remove(E.MENUDISABLED),t.removeAttribute("aria-disabled")}executeCallbacks_(){for(let t of this.callbacks)try{t(this)}catch(t){x.error(t,"Callback for menu entry "+this.id+" failed.")}}}class M extends w{static fromJson(t,{content:e,menu:s,id:i},n){const o=new this(n,e,i),r=t.get("subMenu")(t,s,o);return o.submenu=r,o}constructor(t,e,s){super(t,"submenu",e,s),this._submenu=null}set submenu(t){this._submenu=t}get submenu(){return this._submenu}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.stop(t)}unfocus(){if(this.submenu.isPosted()){if(this.menu.focused!==this)return super.unfocus(),void this.menu.unpostSubmenus();this.html.setAttribute("tabindex","-1"),this.html.blur()}else super.unfocus()}focus(){super.focus(),this.submenu.isPosted()||this.disabled||this.submenu.post()}executeAction(){this.submenu.isPosted()?this.submenu.unpost():this.submenu.post()}generateHtml(){super.generateHtml();let t=this.html;this.span=document.createElement("span"),this.span.textContent="\u25ba",this.span.classList.add(E.MENUARROW),t.appendChild(this.span),t.setAttribute("aria-haspopup","true")}left(t){this.submenu.isPosted()?this.submenu.unpost():super.left(t)}right(t){this.submenu.isPosted()?this.submenu.down(t):this.submenu.post()}toJson(){return{type:""}}}class N extends c{constructor(){super(...arguments),this.className=E.CONTEXTMENU,this.role="menu",this._items=[],this._baseMenu=null}set baseMenu(t){this._baseMenu=t}get baseMenu(){return this._baseMenu}get items(){return this._items}set items(t){this._items=t}get pool(){return this.variablePool}get focused(){return this._focused}set focused(t){if(this._focused===t)return;this._focused||this.unfocus();let e=this._focused;this._focused=t,e&&e.unfocus()}up(t){let e=this.items.filter((t=>t instanceof w&&!t.isHidden()));if(0===e.length)return;if(!this.focused)return void e[e.length-1].focus();let s=e.indexOf(this.focused);-1!==s&&(s=s?--s:e.length-1,e[s].focus())}down(t){let e=this.items.filter((t=>t instanceof w&&!t.isHidden()));if(0===e.length)return;if(!this.focused)return void e[0].focus();let s=e.indexOf(this.focused);-1!==s&&(s++,s=s===e.length?0:s,e[s].focus())}generateHtml(){super.generateHtml(),this.generateMenu()}generateMenu(){let t=this.html;t.classList.add(E.MENU);for(let e of this.items){if(!e.isHidden()){t.appendChild(e.html);continue}let s=e.html;s.parentNode&&s.parentNode.removeChild(s)}}post(t,e){this.variablePool.update(),super.post(t,e)}unpostSubmenus(){let t=this.items.filter((t=>t instanceof M));for(let e of t)e.submenu.unpost(),e!==this.focused&&e.unfocus()}unpost(){super.unpost(),this.unpostSubmenus(),this.focused=null}find(t){for(let e of this.items)if("rule"!==e.type){if(e.id===t)return e;if("submenu"===e.type){let s=e.submenu.find(t);if(s)return s}}return null}}class y{constructor(t){this.menu=t,this.store=[],this._active=null,this.counter=0,this.attachedClass=E.ATTACHED+"_"+x.counter(),this.taborder=!0,this.attrMap={}}set active(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}t=t.parentNode}while(t)}get active(){return this._active}next(){let t=this.store.length;if(0===t)return this.active=null,null;let e=this.store.indexOf(this.active);return e=-1===e?0:e<t-1?e+1:0,this.active=this.store[e],this.active}previous(){let t=this.store.length;if(0===t)return this.active=null,null;let e=t-1,s=this.store.indexOf(this.active);return s=-1===s||0===s?e:s-1,this.active=this.store[s],this.active}clear(){this.remove(this.store)}insert(t){let e=t instanceof HTMLElement?[t]:t;for(let t of e)this.insertElement(t);this.sort()}remove(t){let e=t instanceof HTMLElement?[t]:t;for(let t of e)this.removeElement(t);this.sort()}inTaborder(t){this.taborder&&!t&&this.removeTaborder(),!this.taborder&&t&&this.insertTaborder(),this.taborder=t}insertTaborder(){this.taborder&&this.insertTaborder_()}removeTaborder(){this.taborder&&this.removeTaborder_()}insertElement(t){t.classList.contains(this.attachedClass)||(t.classList.add(this.attachedClass),this.taborder&&this.addTabindex(t),this.addEvents(t))}removeElement(t){t.classList.contains(this.attachedClass)&&(t.classList.remove(this.attachedClass),this.taborder&&this.removeTabindex(t),this.removeEvents(t))}sort(){let t=document.getElementsByClassName(this.attachedClass);this.store=[].slice.call(t)}insertTaborder_(){this.store.forEach((t=>t.setAttribute("tabindex","0")))}removeTaborder_(){this.store.forEach((t=>t.setAttribute("tabindex","-1")))}addTabindex(t){t.hasAttribute("tabindex")&&t.setAttribute(g.OLDTAB,t.getAttribute("tabindex")),t.setAttribute("tabindex","0")}removeTabindex(t){t.hasAttribute(g.OLDTAB)?(t.setAttribute("tabindex",t.getAttribute(g.OLDTAB)),t.removeAttribute(g.OLDTAB)):t.removeAttribute("tabindex")}addEvents(t){t.hasAttribute(g.COUNTER)||(this.addEvent(t,"contextmenu",this.menu.post.bind(this.menu)),this.addEvent(t,"keydown",this.keydown.bind(this)),t.setAttribute(g.COUNTER,this.counter.toString()),this.counter++)}addEvent(t,e,s){let i=g[e.toUpperCase()+"FUNC"];this.attrMap[i+this.counter]=s,t.addEventListener(e,s)}removeEvents(t){if(!t.hasAttribute(g.COUNTER))return;let e=t.getAttribute(g.COUNTER);this.removeEvent(t,"contextmenu",e),this.removeEvent(t,"keydown",e),t.removeAttribute(g.COUNTER)}removeEvent(t,e,s){let i=g[e.toUpperCase()+"FUNC"],n=this.attrMap[i+s];t.removeEventListener(e,n)}keydown(e){e.keyCode===t.SPACE&&(this.menu.post(e),e.preventDefault(),e.stopImmediatePropagation())}}class L{constructor(){this.pool={}}insert(t){this.pool[t.name]=t}lookup(t){return this.pool[t]}remove(t){delete this.pool[t]}update(){for(let t in this.pool)this.pool[t].update()}}class A extends N{static fromJson(t,{pool:e,items:s,id:i=""}){const n=new this(t);n.id=i;let o=t.get("variable");e.forEach((e=>o(t,e,n.pool)));const r=t.get("items")(t,s,n);return n.items=r,n}constructor(t){super(),this.factory=t,this.id="",this.moving=!1,this._store=new y(this),this.widgets=[],this.variablePool=new L}generateHtml(){this.isPosted()&&this.unpost(),super.generateHtml(),this._frame=document.createElement("div"),this._frame.classList.add(E.MENUFRAME);let t="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;";this._frame.setAttribute("style","position: absolute; "+t);let e=document.createElement("div");e.setAttribute("style","position: fixed; "+t),this._frame.appendChild(e),e.addEventListener("mousedown",function(t){this.unpost(),this.unpostWidgets(),this.stop(t)}.bind(this))}display(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()}escape(t){this.unpost(),this.unpostWidgets()}unpost(){if(super.unpost(),this.widgets.length>0)return;this.frame.parentNode.removeChild(this.frame);let t=this.store;this.moving||t.insertTaborder(),t.active.focus()}left(t){this.move_(this.store.previous())}right(t){this.move_(this.store.next())}get frame(){return this._frame}get store(){return this._store}post(t,e){if(void 0!==e)return this.moving||this.store.removeTaborder(),void super.post(t,e);let s,i,n,o=t;if(o instanceof Event?(s=o.target,this.stop(o)):s=o,o instanceof MouseEvent&&(i=o.pageX,n=o.pageY,i||n||!o.clientX||(i=o.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=o.clientY+document.body.scrollTop+document.documentElement.scrollTop)),!i&&!n&&s){let t=window.pageXOffset||document.documentElement.scrollLeft,e=window.pageYOffset||document.documentElement.scrollTop,o=s.getBoundingClientRect();i=(o.right+o.left)/2+t,n=(o.bottom+o.top)/2+e}this.store.active=s,this.anchor=this.store.active;let r=this.html;i+r.offsetWidth>document.body.offsetWidth-5&&(i=document.body.offsetWidth-r.offsetWidth-5),this.post(i,n)}registerWidget(t){this.widgets.push(t)}unregisterWidget(t){let e=this.widgets.indexOf(t);e>-1&&this.widgets.splice(e,1),0===this.widgets.length&&this.unpost()}unpostWidgets(){this.widgets.forEach((t=>t.unpost()))}toJson(){return{type:""}}move_(t){this.anchor&&t!==this.anchor&&(this.moving=!0,this.unpost(),this.post(t),this.moving=!1)}}!function(t){function e(t){return"."+(E[t]||t)}let s={};s[e("INFOCLOSE")]="{ top:.2em; right:.2em;}",s[e("INFOCONTENT")]="{ overflow:auto; text-align:left; font-size:80%; padding:.4em .6em; border:1px inset; margin:1em 0px; max-height:20em; max-width:30em; background-color:#EEEEEE; white-space:normal;}",s[e("INFO")+e("MOUSEPOST")]="{outline:none;}",s[e("INFO")]='{ position:fixed; left:50%; width:auto; text-align:center; border:3px outset; padding:1em 2em; background-color:#DDDDDD; color:black; cursor:default; font-family:message-box; font-size:120%; font-style:normal; text-indent:0; text-transform:none; line-height:normal; letter-spacing:normal; word-spacing:normal; word-wrap:normal; white-space:nowrap; float:none; z-index:201; border-radius: 15px; /* Opera 10.5 and IE9 */ -webkit-border-radius:15px; /* Safari and Chrome */ -moz-border-radius:15px; /* Firefox */ -khtml-border-radius:15px; /* Konqueror */ box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */ -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */ -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */ -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */ filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color="gray", Positive="true"); /* IE */}';let i={};i[e("MENU")]="{ position:absolute; background-color:white; color:black; width:auto; padding:5px 0px; border:1px solid #CCCCCC; margin:0; cursor:default; font: menu; text-align:left; text-indent:0; text-transform:none; line-height:normal; letter-spacing:normal; word-spacing:normal; word-wrap:normal; white-space:nowrap; float:none; z-index:201; border-radius: 5px; /* Opera 10.5 and IE9 */ -webkit-border-radius: 5px; /* Safari and Chrome */ -moz-border-radius: 5px; /* Firefox */ -khtml-border-radius: 5px; /* Konqueror */ box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */ -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */ -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */ -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */}",i[e("MENUITEM")]="{ padding: 1px 2em; background:transparent;}",i[e("MENUARROW")]="{ position:absolute; right:.5em; padding-top:.25em; color:#666666; font-family: null; font-size: .75em}",i[e("MENUACTIVE")+" "+e("MENUARROW")]="{color:white}",i[e("MENUARROW")+e("RTL")]="{left:.5em; right:auto}",i[e("MENUCHECK")]="{ position:absolute; left:.7em; font-family: null}",i[e("MENUCHECK")+e("RTL")]="{ right:.7em; left:auto }",i[e("MENURADIOCHECK")]="{ position:absolute; left: .7em;}",i[e("MENURADIOCHECK")+e("RTL")]="{ right: .7em; left:auto}",i[e("MENUINPUTBOX")]="{ padding-left: 1em; right:.5em; color:#666666; font-family: null;}",i[e("MENUINPUTBOX")+e("RTL")]="{ left: .1em;}",i[e("MENUCOMBOBOX")]="{ left:.1em; padding-bottom:.5em;}",i[e("MENUSLIDER")]="{ left: .1em;}",i[e("SLIDERVALUE")]="{ position:absolute; right:.1em; padding-top:.25em; color:#333333; font-size: .75em}",i[e("SLIDERBAR")]="{ outline: none; background: #d3d3d3}",i[e("MENULABEL")]="{ padding: 1px 2em 3px 1.33em; font-style:italic}",i[e("MENURULE")]="{ border-top: 1px solid #DDDDDD; margin: 4px 3px;}",i[e("MENUDISABLED")]="{ color:GrayText}",i[e("MENUACTIVE")]="{ background-color: #606872; color: white;}",i[e("MENUDISABLED")+":focus"]="{ background-color: #E8E8E8}",i[e("MENULABEL")+":focus"]="{ background-color: #E8E8E8}",i[e("CONTEXTMENU")+":focus"]="{ outline:none}",i[e("CONTEXTMENU")+" "+e("MENUITEM")+":focus"]="{ outline:none}",i[e("SELECTIONMENU")]="{ position:relative; float:left; border-bottom: none; -webkit-box-shadow:none; -webkit-border-radius:0px; }",i[e("SELECTIONITEM")]="{ padding-right: 1em;}",i[e("SELECTION")]="{ right: 40%; width:50%; }",i[e("SELECTIONBOX")]="{ padding: 0em; max-height:20em; max-width: none; background-color:#FFFFFF;}",i[e("SELECTIONDIVIDER")]="{ clear: both; border-top: 2px solid #000000;}",i[e("MENU")+" "+e("MENUCLOSE")]="{ top:-10px; left:-10px}";let n={};n[e("MENUCLOSE")]='{ position:absolute; cursor:pointer; display:inline-block; border:2px solid #AAA; border-radius:18px; -webkit-border-radius: 18px; /* Safari and Chrome */ -moz-border-radius: 18px; /* Firefox */ -khtml-border-radius: 18px; /* Konqueror */ font-family: "Courier New", Courier; font-size:24px; color:#F0F0F0}',n[e("MENUCLOSE")+" span"]="{ display:block; background-color:#AAA; border:1.5px solid; border-radius:18px; -webkit-border-radius: 18px; /* Safari and Chrome */ -moz-border-radius: 18px; /* Firefox */ -khtml-border-radius: 18px; /* Konqueror */ line-height:0; padding:8px 0 6px /* may need to be browser-specific */}",n[e("MENUCLOSE")+":hover"]="{ color:white!important; border:2px solid #CCC!important}",n[e("MENUCLOSE")+":hover span"]="{ background-color:#CCC!important}",n[e("MENUCLOSE")+":hover:focus"]="{ outline:none}";let o=!1,r=!1,a=!1;function h(t){a||(l(n,t),a=!0)}function l(t,e){let s=e||document,i=s.createElement("style");i.type="text/css";let n="";for(let e in t)n+=e,n+=" ",n+=t[e],n+="\n";i.innerHTML=n,s.head.appendChild(i)}t.addMenuStyles=function(t){r||(l(i,t),r=!0,h(t))},t.addInfoStyles=function(t){o||(l(s,t),o=!0,h(t))}}(C||(C={}));class O extends c{constructor(t){super(),this.element=t,this.className=E.MENUCLOSE,this.role="button"}generateHtml(){let t=document.createElement("span");t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0");let e=document.createElement("span");e.textContent="\xd7",t.appendChild(e),this.html=t}display(){}unpost(){super.unpost(),this.element.unpost()}keydown(t){this.bubbleKey(),super.keydown(t)}space(t){this.unpost(),this.stop(t)}mousedown(t){this.unpost(),this.stop(t)}}class S extends c{constructor(t,e,s){super(),this.title=t,this.signature=s,this.className=E.INFO,this.role="dialog",this.contentDiv=this.generateContent(),this.close=this.generateClose(),this.content=e||function(){return""}}attachMenu(t){this.menu=t}generateHtml(){super.generateHtml();let t=this.html;t.appendChild(this.generateTitle()),t.appendChild(this.contentDiv),t.appendChild(this.generateSignature()),t.appendChild(this.close.html),t.setAttribute("tabindex","0")}post(){super.post();let t=document.documentElement,e=this.html,s=window.innerHeight||t.clientHeight||t.scrollHeight||0,i=Math.floor(-e.offsetWidth/2),n=Math.floor((s-e.offsetHeight)/3);e.setAttribute("style","margin-left: "+i+"px; top: "+n+"px;"),window.event instanceof MouseEvent&&e.classList.add(E.MOUSEPOST),e.focus()}display(){this.menu.registerWidget(this),this.contentDiv.innerHTML=this.content();let t=this.menu.html;t.parentNode&&t.parentNode.removeChild(t),this.menu.frame.appendChild(this.html)}click(t){}keydown(t){this.bubbleKey(),super.keydown(t)}escape(t){this.unpost()}unpost(){super.unpost(),this.html.classList.remove(E.MOUSEPOST),this.menu.unregisterWidget(this)}generateClose(){let t=new O(this),e=t.html;return e.classList.add(E.INFOCLOSE),e.setAttribute("aria-label","Close Dialog Box"),t}generateTitle(){let t=document.createElement("span");return t.innerHTML=this.title,t.classList.add(E.INFOTITLE),t}generateContent(){let t=document.createElement("div");return t.classList.add(E.INFOCONTENT),t.setAttribute("tabindex","0"),t}generateSignature(){let t=document.createElement("span");return t.innerHTML=this.signature,t.classList.add(E.INFOSIGNATURE),t}toJson(){return{type:""}}}class T extends c{static fromJson(){}constructor(t,e){super(),this.title=t,this.window=null,this.localSettings={left:Math.round((screen.width-400)/2),top:Math.round((screen.height-300)/3)},this.windowList=[],this.mobileFlag=!1,this.active=null,this.content=e||function(){return""}}attachMenu(t){this.menu=t}post(){this.display()}display(){this.active=this.menu.store.active;let t=[];for(let e in T.popupSettings)t.push(e+"="+T.popupSettings[e]);for(let e in this.localSettings)t.push(e+"="+this.localSettings[e]);this.window=window.open("","_blank",t.join(",")),this.windowList.push(this.window);let e=this.window.document;this.mobileFlag?(e.open(),e.write('<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>'+this.title+'</title></head><body style="font-size:85%">'),e.write("<pre>"+this.generateContent()+"</pre>"),e.write('<hr><input type="button" value="Close" onclick="window.close()" />'),e.write("</body></html>"),e.close()):(e.open(),e.write("<html><head><title>"+this.title+'</title></head><body style="font-size:85%">'),e.write("<table><tr><td><pre>"+this.generateContent()+"</pre></td></tr></table>"),e.write("</body></html>"),e.close(),setTimeout(this.resize.bind(this),50))}unpost(){this.windowList.forEach((t=>t.close())),this.window=null}generateContent(){return this.content(this.active)}resize(){let t=this.window.document.body.firstChild,e=this.window.outerHeight-this.window.innerHeight||30,s=this.window.outerWidth-this.window.innerWidth||30;s=Math.max(140,Math.min(Math.floor(.5*this.window.screen.width),t.offsetWidth+s+25)),e=Math.max(40,Math.min(Math.floor(.5*this.window.screen.height),t.offsetHeight+e+25)),this.window.resizeTo(s,e);let i=this.active.getBoundingClientRect();if(i){let t=Math.max(0,Math.min(i.right-Math.floor(s/2),this.window.screen.width-s-20)),n=Math.max(0,Math.min(i.bottom-Math.floor(e/2),this.window.screen.height-e-20));this.window.moveTo(t,n)}this.active=null}toJson(){return{type:""}}}T.popupSettings={status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:400,height:300};class U extends w{static fromJson(t,{content:e,action:s,id:i},n){return new this(n,e,s,i)}constructor(t,e,s,i){super(t,"command",e,i),this.command=s}executeAction(){try{this.command(x.getActiveElement(this))}catch(t){x.error(t,"Illegal command callback.")}x.close(this)}toJson(){return{type:""}}}class k{static fromJson(t,{name:e,getter:s,setter:i},n){const o=new this(e,s,i);n.insert(o)}constructor(t,e,s){this._name=t,this.getter=e,this.setter=s,this.items=[]}get name(){return this._name}getValue(t){try{return this.getter(t)}catch(t){return x.error(t,"Command of variable "+this.name+" failed."),null}}setValue(t,e){try{this.setter(t,e)}catch(t){x.error(t,"Command of variable "+this.name+" failed.")}this.update()}register(t){-1===this.items.indexOf(t)&&this.items.push(t)}unregister(t){let e=this.items.indexOf(t);-1!==e&&this.items.splice(e,1)}update(){this.items.forEach((t=>t.update()))}registerCallback(t){this.items.forEach((e=>e.registerCallback(t)))}unregisterCallback(t){this.items.forEach((e=>e.unregisterCallback(t)))}toJson(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}}}class I extends w{generateHtml(){super.generateHtml();let t=this.html;this.span||this.generateSpan(),t.appendChild(this.span),this.update()}register(){this.variable.register(this)}unregister(){this.variable.unregister(this)}update(){this.updateAria(),this.span&&this.updateSpan()}}class _ extends I{static fromJson(t,{content:e,variable:s,id:i},n){return new this(n,e,s,i)}constructor(t,e,s,i){super(t,"checkbox",e,i),this.role="menuitemcheckbox",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(!this.variable.getValue()),x.close(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(E.MENUCHECK)}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()?"":"none"}toJson(){return{type:""}}}class D extends I{static fromJson(t,{content:e,variable:s,id:i},n){return new this(n,e,s,i)}constructor(t,e,s,i){super(t,"combobox",e,i),this.role="combobox",this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,x.getActiveElement(this))}space(t){super.space(t),x.close(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml(),this.html.classList.add(E.MENUCOMBOBOX)}generateSpan(){this.span=document.createElement("span"),this.span.classList.add(E.MENUINPUTBOX),this.input=document.createElement("input"),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.setAttribute("size","10em"),this.input.setAttribute("type","text"),this.input.setAttribute("tabindex","-1"),this.span.appendChild(this.input)}inputKey(t){this.bubbleKey(),this.inputEvent=!0}keydown(e){if(this.inputEvent&&e.keyCode!==t.ESCAPE&&e.keyCode!==t.RETURN)return this.inputEvent=!1,void e.stopPropagation();super.keydown(e),e.stopPropagation()}updateAria(){}updateSpan(){let t;try{t=this.variable.getValue(x.getActiveElement(this))}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class R extends w{static fromJson(t,{content:e,id:s},i){return new this(i,e,s)}constructor(t,e,s){super(t,"label",e,s)}generateHtml(){super.generateHtml(),this.html.classList.add(E.MENULABEL)}toJson(){return{type:""}}}class H extends I{static fromJson(t,{content:e,variable:s,id:i},n){return new this(n,e,s,i)}constructor(t,e,s,i){super(t,"radio",e,i),this.role="menuitemradio",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.id),x.close(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(E.MENURADIOCHECK)}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()===this.id?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()===this.id?"":"none"}toJson(){return{type:""}}}class P extends v{static fromJson(t,{},e){return new this(e)}constructor(t){super(t,"rule"),this.className=E.MENUITEM,this.role="separator"}generateHtml(){super.generateHtml();let t=this.html;t.classList.add(E.MENURULE),t.setAttribute("aria-orientation","vertical")}addEvents(t){}toJson(){return{type:"rule"}}}class F extends I{static fromJson(t,{content:e,variable:s,id:i},n){return new this(n,e,s,i)}constructor(t,e,s,i){super(t,"slider",e,i),this.role="slider",this.labelId="ctx_slideLabel"+x.counter(),this.valueId="ctx_slideValue"+x.counter(),this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,x.getActiveElement(this)),this.update()}space(t){super.space(t),x.close(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml(),this.html.classList.add(E.MENUSLIDER),this.valueSpan=document.createElement("span"),this.valueSpan.setAttribute("id",this.valueId),this.valueSpan.classList.add(E.SLIDERVALUE),this.html.appendChild(this.valueSpan)}generateSpan(){this.span=document.createElement("span"),this.labelSpan=document.createElement("span"),this.labelSpan.setAttribute("id",this.labelId),this.labelSpan.appendChild(this.html.childNodes[0]),this.html.appendChild(this.labelSpan),this.input=document.createElement("input"),this.input.setAttribute("type","range"),this.input.setAttribute("min","0"),this.input.setAttribute("max","100"),this.input.setAttribute("aria-valuemin","0"),this.input.setAttribute("aria-valuemax","100"),this.input.setAttribute("aria-labelledby",this.labelId),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.addEventListener("input",this.executeAction.bind(this)),this.input.classList.add(E.SLIDERBAR),this.span.appendChild(this.input)}inputKey(t){this.inputEvent=!0}mousedown(t){t.stopPropagation()}mouseup(t){event.stopPropagation()}keydown(e){let s=e.keyCode;return s===t.UP||s===t.DOWN?(e.preventDefault(),void super.keydown(e)):this.inputEvent&&s!==t.ESCAPE&&s!==t.RETURN?(this.inputEvent=!1,void e.stopPropagation()):(super.keydown(e),void e.stopPropagation())}updateAria(){let t=this.variable.getValue();t&&this.input&&(this.input.setAttribute("aria-valuenow",t),this.input.setAttribute("aria-valuetext",t+"%"))}updateSpan(){let t;try{t=this.variable.getValue(x.getActiveElement(this)),this.valueSpan.innerHTML=t+"%"}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class B extends N{static fromJson(t,{items:e},s){const i=new this(s),n=t.get("items")(t,e,i);return i.items=n,i}constructor(t){super(),this._anchor=t,this.variablePool=this.anchor.menu.pool,this.setBaseMenu()}get anchor(){return this._anchor}post(){if(!this.anchor.menu.isPosted())return;let t=this.anchor.html,e=this.html,s=this.baseMenu.frame,i=t.offsetWidth,n=i-2,o=0;for(;t&&t!==s;)n+=t.offsetLeft,o+=t.offsetTop,t=t.parentNode;n+e.offsetWidth>document.body.offsetWidth-5&&(n=Math.max(5,n-i-e.offsetWidth+6)),super.post(n,o)}display(){this.baseMenu.frame.appendChild(this.html)}setBaseMenu(){let t=this;do{t=t.anchor.menu}while(t instanceof B);this.baseMenu=t}left(t){this.focused=null,this.anchor.focus()}toJson(){return{type:""}}}class J extends N{static fromJson(t,{title:e,values:s,variable:i},n){let o=new this(n),r=t.get("label")(t,{content:e||"",id:e||"id"},o),a=t.get("rule")(t,{},o),h=s.map((e=>t.get("radio")(t,{content:e,variable:i,id:e},o))),l=[r,a].concat(h);return o.items=l,o}constructor(t){super(),this.anchor=t,this.className=E.SELECTIONMENU,this.variablePool=this.anchor.menu.pool,this.baseMenu=this.anchor.menu}generateHtml(){super.generateHtml(),this.items.forEach((t=>t.html.classList.add(E.SELECTIONITEM)))}display(){}right(t){this.anchor.right(t)}left(t){this.anchor.left(t)}}class W extends S{static fromJson(t,{title:e,signature:s,selections:i,order:n,grid:o},r){let a=new this(e,s,n,o);a.attachMenu(r);let h=i.map((e=>t.get("selectionMenu")(t,e,a)));return a.selections=h,a}constructor(t,e,s="none",i="vertical"){super(t,null,e),this.style=s,this.grid=i,this._selections=[],this.prefix="ctxt-selection",this._balanced=!0}attachMenu(t){this.menu=t}get selections(){return this._selections}set selections(t){this._selections=[],t.forEach((t=>this.addSelection(t)))}addSelection(t){t.anchor=this,this._selections.push(t)}rowDiv(t){let e=document.createElement("div");this.contentDiv.appendChild(e);let s=t.map((t=>(e.appendChild(t.html),t.html.id||(t.html.id=this.prefix+x.counter()),t.html.getBoundingClientRect()))),i=s.map((t=>t.width)),n=i.reduce(((t,e)=>t+e),0),o=s.reduce(((t,e)=>Math.max(t,e.height)),0);return e.classList.add(E.SELECTIONDIVIDER),e.setAttribute("style","height: "+o+"px;"),[e,n,o,i]}display(){if(super.display(),this.order(),!this.selections.length)return;let t=[],e=0,s=[],i=this.getChunkSize(this.selections.length);for(let n=0;n<this.selections.length;n+=i){let o=this.selections.slice(n,n+i),[r,a,h,l]=this.rowDiv(o);t.push(r),e=Math.max(e,a),o.forEach((t=>t.html.style.height=h+"px")),s=this.combineColumn(s,l)}this._balanced&&(this.balanceColumn(t,s),e=s.reduce(((t,e)=>t+e),20)),t.forEach((t=>t.style.width=e+"px"))}getChunkSize(t){switch(this.grid){case"square":return Math.floor(Math.sqrt(t));case"horizontal":return Math.floor(t/W.chunkSize);default:return W.chunkSize}}balanceColumn(t,e){t.forEach((t=>{let s=Array.from(t.children);for(let t,i=0;t=s[i];i++)t.style.width=e[i]+"px"}))}combineColumn(t,e){let s=[],i=0;for(;t[i]||e[i];){if(!t[i]){s=s.concat(e.slice(i));break}if(!e[i]){s=s.concat(t.slice(i));break}s.push(Math.max(t[i],e[i])),i++}return s}left(t){this.move(t,(t=>(0===t?this.selections.length:t)-1))}right(t){this.move(t,(t=>t===this.selections.length-1?0:t+1))}generateHtml(){super.generateHtml(),this.html.classList.add(E.SELECTION)}generateContent(){let t=super.generateContent();return t.classList.add(E.SELECTIONBOX),t.removeAttribute("tabindex"),t}findSelection(t){let e=t.target,s=null;if(e.id&&(s=this.selections.find((t=>t.html.id===e.id))),!s){let t=e.parentElement.id;s=this.selections.find((e=>e.html.id===t))}return s}move(t,e){let s=this.findSelection(t);s.focused&&s.focused.unfocus();let i=e(this.selections.indexOf(s));this.selections[i].focus()}order(){this.selections.sort(W.orderMethod.get(this.style))}toJson(){return{type:""}}}W.chunkSize=4,W.orderMethod=new Map([["alphabetical",(t,e)=>t.items[0].content.localeCompare(e.items[0].content)],["none",(t,e)=>1],["decreasing",(t,e)=>{let s=t.items.length,i=e.items.length;return s<i?1:i<s?-1:0}],["increasing",(t,e)=>{let s=t.items.length,i=e.items.length;return s<i?-1:i<s?1:0}]]);class V{constructor(t){this._parser=new Map(t)}get(t){return this._parser.get(t)}add(t,e){this._parser.set(t,e)}}var z=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(s[i[n]]=t[i[n]])}return s};let K=A,X=C,j=S,q=T,G=class{constructor(t=[]){this._initList=[["command",U.fromJson.bind(U)],["checkbox",_.fromJson.bind(_)],["combo",D.fromJson.bind(D)],["slider",F.fromJson.bind(F)],["label",R.fromJson.bind(R)],["radio",H.fromJson.bind(H)],["rule",P.fromJson.bind(P)],["submenu",M.fromJson.bind(M)],["contextMenu",A.fromJson.bind(A)],["subMenu",B.fromJson.bind(B)],["variable",k.fromJson.bind(k)],["items",this.items.bind(this)],["selectionMenu",J.fromJson.bind(J)],["selectionBox",W.fromJson.bind(W)]],this._factory=new V(this._initList),t.forEach((([t,e])=>this.factory.add(t,e)))}get factory(){return this._factory}items(t,e,s){let i=[];for(let t of e){let e=this.parse(t,s);e&&(s.items.push(e),t.disabled&&e.disable(),t.hidden&&i.push(e))}return i.forEach((t=>t.hide())),s.items}parse(t,...e){var{type:s}=t,i=z(t,["type"]);let n=this.factory.get(s);return n?n(this.factory,i,...e):null}},Y="0.4.2",Q=W,Z=k,$=V;return s})()));

@@ -1,61 +0,33 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractEntry = void 0;
var menu_element_js_1 = require("./menu_element.js");
var html_classes_js_1 = require("./html_classes.js");
var AbstractEntry = (function (_super) {
__extends(AbstractEntry, _super);
function AbstractEntry(_menu, _type) {
var _this = _super.call(this) || this;
_this._menu = _menu;
_this._type = _type;
_this.className = html_classes_js_1.HtmlClasses['MENUITEM'];
_this.role = 'menuitem';
_this.hidden = false;
return _this;
import { MenuElement } from './menu_element.js';
import { HtmlClasses } from './html_classes.js';
export class AbstractEntry extends MenuElement {
constructor(_menu, _type) {
super();
this._menu = _menu;
this._type = _type;
this.className = HtmlClasses['MENUITEM'];
this.role = 'menuitem';
this.hidden = false;
}
Object.defineProperty(AbstractEntry.prototype, "menu", {
get: function () {
return this._menu;
},
set: function (menu) {
this._menu = menu;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractEntry.prototype, "type", {
get: function () {
return this._type;
},
enumerable: false,
configurable: true
});
AbstractEntry.prototype.hide = function () {
get menu() {
return this._menu;
}
set menu(menu) {
this._menu = menu;
}
get type() {
return this._type;
}
hide() {
this.hidden = true;
this.menu.generateMenu();
};
AbstractEntry.prototype.show = function () {
}
show() {
this.hidden = false;
this.menu.generateMenu();
};
AbstractEntry.prototype.isHidden = function () {
}
isHidden() {
return this.hidden;
};
return AbstractEntry;
}(menu_element_js_1.MenuElement));
exports.AbstractEntry = AbstractEntry;
}
}
//# sourceMappingURL=abstract_entry.js.map

@@ -1,63 +0,26 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
import { AbstractEntry } from './abstract_entry.js';
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
export class AbstractItem extends AbstractEntry {
constructor(menu, type, _content, id) {
super(menu, type);
this._content = _content;
this.disabled = false;
this.callbacks = [];
this._id = id ? id : _content;
}
get content() {
return this._content;
}
set content(content) {
this._content = content;
this.generateHtml();
if (this.menu) {
this.menu.generateHtml();
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractItem = void 0;
var abstract_entry_js_1 = require("./abstract_entry.js");
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var AbstractItem = (function (_super) {
__extends(AbstractItem, _super);
function AbstractItem(menu, type, _content, id) {
var _this = _super.call(this, menu, type) || this;
_this._content = _content;
_this.disabled = false;
_this.callbacks = [];
_this._id = id ? id : _content;
return _this;
}
Object.defineProperty(AbstractItem.prototype, "content", {
get: function () {
return this._content;
},
set: function (content) {
this._content = content;
this.generateHtml();
if (this.menu) {
this.menu.generateHtml();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractItem.prototype, "id", {
get: function () {
return this._id;
},
enumerable: false,
configurable: true
});
AbstractItem.prototype.press = function () {
get id() {
return this._id;
}
press() {
if (!this.disabled) {

@@ -67,105 +30,92 @@ this.executeAction();

}
};
AbstractItem.prototype.executeAction = function () { };
AbstractItem.prototype.registerCallback = function (func) {
}
executeAction() { }
registerCallback(func) {
if (this.callbacks.indexOf(func) === -1) {
this.callbacks.push(func);
}
};
AbstractItem.prototype.unregisterCallback = function (func) {
var index = this.callbacks.indexOf(func);
}
unregisterCallback(func) {
let index = this.callbacks.indexOf(func);
if (index !== -1) {
this.callbacks.splice(index, 1);
}
};
AbstractItem.prototype.mousedown = function (event) {
}
mousedown(event) {
this.press();
this.stop(event);
};
AbstractItem.prototype.mouseover = function (event) {
}
mouseover(event) {
this.focus();
this.stop(event);
};
AbstractItem.prototype.mouseout = function (event) {
}
mouseout(event) {
this.deactivate();
this.stop(event);
};
AbstractItem.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.setAttribute('aria-disabled', 'false');
html.textContent = this.content;
};
AbstractItem.prototype.activate = function () {
}
activate() {
if (!this.disabled) {
this.html.classList.add(html_classes_js_1.HtmlClasses['MENUACTIVE']);
this.html.classList.add(HtmlClasses['MENUACTIVE']);
}
};
AbstractItem.prototype.deactivate = function () {
this.html.classList.remove(html_classes_js_1.HtmlClasses['MENUACTIVE']);
};
AbstractItem.prototype.focus = function () {
}
deactivate() {
this.html.classList.remove(HtmlClasses['MENUACTIVE']);
}
focus() {
this.menu.focused = this;
_super.prototype.focus.call(this);
super.focus();
this.activate();
};
AbstractItem.prototype.unfocus = function () {
}
unfocus() {
this.deactivate();
_super.prototype.unfocus.call(this);
};
AbstractItem.prototype.escape = function (_event) {
menu_util_js_1.MenuUtil.close(this);
};
AbstractItem.prototype.up = function (event) {
super.unfocus();
}
escape(_event) {
MenuUtil.close(this);
}
up(event) {
this.menu.up(event);
};
AbstractItem.prototype.down = function (event) {
}
down(event) {
this.menu.down(event);
};
AbstractItem.prototype.left = function (event) {
}
left(event) {
this.menu.left(event);
};
AbstractItem.prototype.right = function (event) {
}
right(event) {
this.menu.right(event);
};
AbstractItem.prototype.space = function (_event) {
}
space(_event) {
this.press();
};
AbstractItem.prototype.disable = function () {
}
disable() {
this.disabled = true;
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENUDISABLED']);
let html = this.html;
html.classList.add(HtmlClasses['MENUDISABLED']);
html.setAttribute('aria-disabled', 'true');
};
AbstractItem.prototype.enable = function () {
}
enable() {
this.disabled = false;
var html = this.html;
html.classList.remove(html_classes_js_1.HtmlClasses['MENUDISABLED']);
let html = this.html;
html.classList.remove(HtmlClasses['MENUDISABLED']);
html.removeAttribute('aria-disabled');
};
AbstractItem.prototype.executeCallbacks_ = function () {
var e_1, _a;
try {
for (var _b = __values(this.callbacks), _c = _b.next(); !_c.done; _c = _b.next()) {
var func = _c.value;
try {
func(this);
}
catch (e) {
menu_util_js_1.MenuUtil.error(e, 'Callback for menu entry ' + this.id +
' failed.');
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
}
executeCallbacks_() {
for (let func of this.callbacks) {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
func(this);
}
finally { if (e_1) throw e_1.error; }
catch (e) {
MenuUtil.error(e, 'Callback for menu entry ' + this.id +
' failed.');
}
}
};
return AbstractItem;
}(abstract_entry_js_1.AbstractEntry));
exports.AbstractItem = AbstractItem;
}
}
//# sourceMappingURL=abstract_item.js.map

@@ -1,91 +0,46 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
import { AbstractPostable } from './abstract_postable.js';
import { AbstractItem } from './abstract_item.js';
import { HtmlClasses } from './html_classes.js';
import { Submenu } from './item_submenu.js';
export class AbstractMenu extends AbstractPostable {
constructor() {
super(...arguments);
this.className = HtmlClasses['CONTEXTMENU'];
this.role = 'menu';
this._items = [];
this._baseMenu = null;
}
set baseMenu(menu) {
this._baseMenu = menu;
}
get baseMenu() {
return this._baseMenu;
}
get items() {
return this._items;
}
set items(items) {
this._items = items;
}
get pool() {
return this.variablePool;
}
get focused() {
return this._focused;
}
set focused(item) {
if (this._focused === item) {
return;
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractMenu = void 0;
var abstract_postable_js_1 = require("./abstract_postable.js");
var abstract_item_js_1 = require("./abstract_item.js");
var html_classes_js_1 = require("./html_classes.js");
var item_submenu_js_1 = require("./item_submenu.js");
var AbstractMenu = (function (_super) {
__extends(AbstractMenu, _super);
function AbstractMenu() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.className = html_classes_js_1.HtmlClasses['CONTEXTMENU'];
_this.role = 'menu';
_this._items = [];
_this._baseMenu = null;
return _this;
if (!this._focused) {
this.unfocus();
}
let old = this._focused;
this._focused = item;
if (old) {
old.unfocus();
}
}
Object.defineProperty(AbstractMenu.prototype, "baseMenu", {
get: function () {
return this._baseMenu;
},
set: function (menu) {
this._baseMenu = menu;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractMenu.prototype, "items", {
get: function () {
return this._items;
},
set: function (items) {
this._items = items;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractMenu.prototype, "pool", {
get: function () {
return this.variablePool;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractMenu.prototype, "focused", {
get: function () {
return this._focused;
},
set: function (item) {
if (this._focused === item) {
return;
}
if (!this._focused) {
this.unfocus();
}
var old = this._focused;
this._focused = item;
if (old) {
old.unfocus();
}
},
enumerable: false,
configurable: true
});
AbstractMenu.prototype.up = function (_event) {
var items = this.items.filter(function (x) { return (x instanceof abstract_item_js_1.AbstractItem) && (!x.isHidden()); });
up(_event) {
let items = this.items.filter(x => (x instanceof AbstractItem) && (!x.isHidden()));
if (items.length === 0) {

@@ -98,3 +53,3 @@ return;

}
var index = items.indexOf(this.focused);
let index = items.indexOf(this.focused);
if (index === -1) {

@@ -105,5 +60,5 @@ return;

items[index].focus();
};
AbstractMenu.prototype.down = function (_event) {
var items = this.items.filter(function (x) { return (x instanceof abstract_item_js_1.AbstractItem) && (!x.isHidden()); });
}
down(_event) {
let items = this.items.filter(x => (x instanceof AbstractItem) && (!x.isHidden()));
if (items.length === 0) {

@@ -116,3 +71,3 @@ return;

}
var index = items.indexOf(this.focused);
let index = items.indexOf(this.focused);
if (index === -1) {

@@ -124,92 +79,57 @@ return;

items[index].focus();
};
AbstractMenu.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
}
generateHtml() {
super.generateHtml();
this.generateMenu();
};
AbstractMenu.prototype.generateMenu = function () {
var e_1, _a;
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENU']);
try {
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
if (!item.isHidden()) {
html.appendChild(item.html);
continue;
}
var itemHtml = item.html;
if (itemHtml.parentNode) {
itemHtml.parentNode.removeChild(itemHtml);
}
}
generateMenu() {
let html = this.html;
html.classList.add(HtmlClasses['MENU']);
for (let item of this.items) {
if (!item.isHidden()) {
html.appendChild(item.html);
continue;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
let itemHtml = item.html;
if (itemHtml.parentNode) {
itemHtml.parentNode.removeChild(itemHtml);
}
finally { if (e_1) throw e_1.error; }
}
};
AbstractMenu.prototype.post = function (x, y) {
}
post(x, y) {
this.variablePool.update();
_super.prototype.post.call(this, x, y);
};
AbstractMenu.prototype.unpostSubmenus = function () {
var e_2, _a;
var submenus = this.items.filter(function (x) { return x instanceof item_submenu_js_1.Submenu; });
try {
for (var submenus_1 = __values(submenus), submenus_1_1 = submenus_1.next(); !submenus_1_1.done; submenus_1_1 = submenus_1.next()) {
var submenu = submenus_1_1.value;
submenu.submenu.unpost();
if (submenu !== this.focused) {
submenu.unfocus();
}
super.post(x, y);
}
unpostSubmenus() {
let submenus = this.items.filter(x => x instanceof Submenu);
for (let submenu of submenus) {
submenu.submenu.unpost();
if (submenu !== this.focused) {
submenu.unfocus();
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (submenus_1_1 && !submenus_1_1.done && (_a = submenus_1.return)) _a.call(submenus_1);
}
finally { if (e_2) throw e_2.error; }
}
};
AbstractMenu.prototype.unpost = function () {
_super.prototype.unpost.call(this);
}
unpost() {
super.unpost();
this.unpostSubmenus();
this.focused = null;
};
AbstractMenu.prototype.find = function (id) {
var e_3, _a;
try {
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
if (item.type === 'rule') {
continue;
}
find(id) {
for (let item of this.items) {
if (item.type === 'rule') {
continue;
}
if (item.id === id) {
return item;
}
if (item.type === 'submenu') {
let result = item.submenu.find(id);
if (result) {
return result;
}
if (item.id === id) {
return item;
}
if (item.type === 'submenu') {
var result = item.submenu.find(id);
if (result) {
return result;
}
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return null;
};
return AbstractMenu;
}(abstract_postable_js_1.AbstractPostable));
exports.AbstractMenu = AbstractMenu;
}
}
//# sourceMappingURL=abstract_menu.js.map

@@ -1,32 +0,29 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractNavigatable = void 0;
var key_navigatable_js_1 = require("./key_navigatable.js");
var mouse_navigatable_js_1 = require("./mouse_navigatable.js");
var AbstractNavigatable = (function () {
function AbstractNavigatable() {
import { KEY } from './key_navigatable.js';
import { MOUSE } from './mouse_navigatable.js';
export class AbstractNavigatable {
constructor() {
this.bubble = false;
}
AbstractNavigatable.prototype.bubbleKey = function () {
bubbleKey() {
this.bubble = true;
};
AbstractNavigatable.prototype.keydown = function (event) {
}
keydown(event) {
switch (event.keyCode) {
case key_navigatable_js_1.KEY.ESCAPE:
case KEY.ESCAPE:
this.escape(event);
break;
case key_navigatable_js_1.KEY.RIGHT:
case KEY.RIGHT:
this.right(event);
break;
case key_navigatable_js_1.KEY.LEFT:
case KEY.LEFT:
this.left(event);
break;
case key_navigatable_js_1.KEY.UP:
case KEY.UP:
this.up(event);
break;
case key_navigatable_js_1.KEY.DOWN:
case KEY.DOWN:
this.down(event);
break;
case key_navigatable_js_1.KEY.RETURN:
case key_navigatable_js_1.KEY.SPACE:
case KEY.RETURN:
case KEY.SPACE:
this.space(event);

@@ -38,10 +35,10 @@ break;

this.bubble ? this.bubble = false : this.stop(event);
};
AbstractNavigatable.prototype.escape = function (_event) { };
AbstractNavigatable.prototype.space = function (_event) { };
AbstractNavigatable.prototype.left = function (_event) { };
AbstractNavigatable.prototype.right = function (_event) { };
AbstractNavigatable.prototype.up = function (_event) { };
AbstractNavigatable.prototype.down = function (_event) { };
AbstractNavigatable.prototype.stop = function (event) {
}
escape(_event) { }
space(_event) { }
left(_event) { }
right(_event) { }
up(_event) { }
down(_event) { }
stop(event) {
if (event) {

@@ -52,33 +49,31 @@ event.stopPropagation();

}
};
AbstractNavigatable.prototype.mousedown = function (event) {
}
mousedown(event) {
return this.stop(event);
};
AbstractNavigatable.prototype.mouseup = function (event) {
}
mouseup(event) {
return this.stop(event);
};
AbstractNavigatable.prototype.mouseover = function (event) {
}
mouseover(event) {
return this.stop(event);
};
AbstractNavigatable.prototype.mouseout = function (event) {
}
mouseout(event) {
return this.stop(event);
};
AbstractNavigatable.prototype.click = function (event) {
}
click(event) {
return this.stop(event);
};
AbstractNavigatable.prototype.addEvents = function (element) {
element.addEventListener(mouse_navigatable_js_1.MOUSE.DOWN, this.mousedown.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.UP, this.mouseup.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.OVER, this.mouseover.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.OUT, this.mouseout.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.CLICK, this.click.bind(this));
}
addEvents(element) {
element.addEventListener(MOUSE.DOWN, this.mousedown.bind(this));
element.addEventListener(MOUSE.UP, this.mouseup.bind(this));
element.addEventListener(MOUSE.OVER, this.mouseover.bind(this));
element.addEventListener(MOUSE.OUT, this.mouseout.bind(this));
element.addEventListener(MOUSE.CLICK, this.click.bind(this));
element.addEventListener('keydown', this.keydown.bind(this));
element.addEventListener('dragstart', this.stop.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.SELECTSTART, this.stop.bind(this));
element.addEventListener(MOUSE.SELECTSTART, this.stop.bind(this));
element.addEventListener('contextmenu', this.stop.bind(this));
element.addEventListener(mouse_navigatable_js_1.MOUSE.DBLCLICK, this.stop.bind(this));
};
return AbstractNavigatable;
}());
exports.AbstractNavigatable = AbstractNavigatable;
element.addEventListener(MOUSE.DBLCLICK, this.stop.bind(this));
}
}
//# sourceMappingURL=abstract_navigatable.js.map

@@ -1,29 +0,11 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractPostable = void 0;
var menu_element_js_1 = require("./menu_element.js");
var AbstractPostable = (function (_super) {
__extends(AbstractPostable, _super);
function AbstractPostable() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.posted = false;
return _this;
import { MenuElement } from './menu_element.js';
export class AbstractPostable extends MenuElement {
constructor() {
super(...arguments);
this.posted = false;
}
AbstractPostable.prototype.isPosted = function () {
isPosted() {
return this.posted;
};
AbstractPostable.prototype.post = function (x, y) {
}
post(x, y) {
if (this.posted) {

@@ -37,8 +19,8 @@ return;

this.posted = true;
};
AbstractPostable.prototype.unpost = function () {
}
unpost() {
if (!this.posted) {
return;
}
var html = this.html;
let html = this.html;
if (html.parentNode) {

@@ -48,6 +30,4 @@ html.parentNode.removeChild(html);

this.posted = false;
};
return AbstractPostable;
}(menu_element_js_1.MenuElement));
exports.AbstractPostable = AbstractPostable;
}
}
//# sourceMappingURL=abstract_postable.js.map

@@ -1,26 +0,6 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractVariableItem = void 0;
var abstract_item_js_1 = require("./abstract_item.js");
var AbstractVariableItem = (function (_super) {
__extends(AbstractVariableItem, _super);
function AbstractVariableItem() {
return _super !== null && _super.apply(this, arguments) || this;
}
AbstractVariableItem.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
import { AbstractItem } from './abstract_item.js';
export class AbstractVariableItem extends AbstractItem {
generateHtml() {
super.generateHtml();
let html = this.html;
if (!this.span) {

@@ -31,10 +11,10 @@ this.generateSpan();

this.update();
};
AbstractVariableItem.prototype.register = function () {
}
register() {
this.variable.register(this);
};
AbstractVariableItem.prototype.unregister = function () {
}
unregister() {
this.variable.unregister(this);
};
AbstractVariableItem.prototype.update = function () {
}
update() {
this.updateAria();

@@ -44,6 +24,4 @@ if (this.span) {

}
};
return AbstractVariableItem;
}(abstract_item_js_1.AbstractItem));
exports.AbstractVariableItem = AbstractVariableItem;
}
}
//# sourceMappingURL=abstract_variable_item.js.map

@@ -1,58 +0,38 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloseButton = void 0;
var abstract_postable_js_1 = require("./abstract_postable.js");
var html_classes_js_1 = require("./html_classes.js");
var CloseButton = (function (_super) {
__extends(CloseButton, _super);
function CloseButton(element) {
var _this = _super.call(this) || this;
_this.element = element;
_this.className = html_classes_js_1.HtmlClasses['MENUCLOSE'];
_this.role = 'button';
return _this;
import { AbstractPostable } from './abstract_postable.js';
import { HtmlClasses } from './html_classes.js';
export class CloseButton extends AbstractPostable {
constructor(element) {
super();
this.element = element;
this.className = HtmlClasses['MENUCLOSE'];
this.role = 'button';
}
CloseButton.prototype.generateHtml = function () {
var html = document.createElement('span');
generateHtml() {
let html = document.createElement('span');
html.classList.add(this.className);
html.setAttribute('role', this.role);
html.setAttribute('tabindex', '0');
var content = document.createElement('span');
let content = document.createElement('span');
content.textContent = '\u00D7';
html.appendChild(content);
this.html = html;
};
CloseButton.prototype.display = function () { };
CloseButton.prototype.unpost = function () {
_super.prototype.unpost.call(this);
}
display() { }
unpost() {
super.unpost();
this.element.unpost();
};
CloseButton.prototype.keydown = function (event) {
}
keydown(event) {
this.bubbleKey();
_super.prototype.keydown.call(this, event);
};
CloseButton.prototype.space = function (event) {
super.keydown(event);
}
space(event) {
this.unpost();
this.stop(event);
};
CloseButton.prototype.mousedown = function (event) {
}
mousedown(event) {
this.unpost();
this.stop(event);
};
return CloseButton;
}(abstract_postable_js_1.AbstractPostable));
exports.CloseButton = CloseButton;
}
}
//# sourceMappingURL=close_button.js.map

@@ -1,54 +0,35 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextMenu = void 0;
var abstract_menu_js_1 = require("./abstract_menu.js");
var html_classes_js_1 = require("./html_classes.js");
var menu_store_js_1 = require("./menu_store.js");
var variable_pool_js_1 = require("./variable_pool.js");
var ContextMenu = (function (_super) {
__extends(ContextMenu, _super);
function ContextMenu(factory) {
var _this = _super.call(this) || this;
_this.factory = factory;
_this.id = '';
_this.moving = false;
_this._store = new menu_store_js_1.MenuStore(_this);
_this.widgets = [];
_this.variablePool = new variable_pool_js_1.VariablePool();
return _this;
}
ContextMenu.fromJson = function (factory, _a) {
var pool = _a.pool, items = _a.items, _b = _a.id, id = _b === void 0 ? '' : _b;
var ctxtMenu = new this(factory);
import { AbstractMenu } from './abstract_menu.js';
import { HtmlClasses } from './html_classes.js';
import { MenuStore } from './menu_store.js';
import { VariablePool } from './variable_pool.js';
export class ContextMenu extends AbstractMenu {
static fromJson(factory, { pool: pool, items: items, id: id = '' }) {
const ctxtMenu = new this(factory);
ctxtMenu.id = id;
var varParser = factory.get('variable');
pool.forEach(function (x) { return varParser(factory, x, ctxtMenu.pool); });
var itemList = factory.get('items')(factory, items, ctxtMenu);
let varParser = factory.get('variable');
pool.forEach(x => varParser(factory, x, ctxtMenu.pool));
const itemList = factory.get('items')(factory, items, ctxtMenu);
ctxtMenu.items = itemList;
return ctxtMenu;
};
ContextMenu.prototype.generateHtml = function () {
}
constructor(factory) {
super();
this.factory = factory;
this.id = '';
this.moving = false;
this._store = new MenuStore(this);
this.widgets = [];
this.variablePool = new VariablePool();
}
generateHtml() {
if (this.isPosted()) {
this.unpost();
}
_super.prototype.generateHtml.call(this);
super.generateHtml();
this._frame = document.createElement('div');
this._frame.classList.add(html_classes_js_1.HtmlClasses['MENUFRAME']);
var styleString = 'left: 0px; top: 0px; z-index: 200; width: 100%; ' +
this._frame.classList.add(HtmlClasses['MENUFRAME']);
let styleString = 'left: 0px; top: 0px; z-index: 200; width: 100%; ' +
'height: 100%; border: 0px; padding: 0px; margin: 0px;';
this._frame.setAttribute('style', 'position: absolute; ' + styleString);
var innerDiv = document.createElement('div');
let innerDiv = document.createElement('div');
innerDiv.setAttribute('style', 'position: fixed; ' + styleString);

@@ -61,14 +42,14 @@ this._frame.appendChild(innerDiv);

}.bind(this));
};
ContextMenu.prototype.display = function () {
}
display() {
document.body.appendChild(this.frame);
this.frame.appendChild(this.html);
this.focus();
};
ContextMenu.prototype.escape = function (_event) {
}
escape(_event) {
this.unpost();
this.unpostWidgets();
};
ContextMenu.prototype.unpost = function () {
_super.prototype.unpost.call(this);
}
unpost() {
super.unpost();
if (this.widgets.length > 0) {

@@ -78,3 +59,3 @@ return;

this.frame.parentNode.removeChild(this.frame);
var store = this.store;
let store = this.store;
if (!this.moving) {

@@ -84,24 +65,16 @@ store.insertTaborder();

store.active.focus();
};
ContextMenu.prototype.left = function (_event) {
}
left(_event) {
this.move_(this.store.previous());
};
ContextMenu.prototype.right = function (_event) {
}
right(_event) {
this.move_(this.store.next());
};
Object.defineProperty(ContextMenu.prototype, "frame", {
get: function () {
return this._frame;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ContextMenu.prototype, "store", {
get: function () {
return this._store;
},
enumerable: false,
configurable: true
});
ContextMenu.prototype.post = function (numberOrEvent, isY) {
}
get frame() {
return this._frame;
}
get store() {
return this._store;
}
post(numberOrEvent, isY) {
if (typeof (isY) !== 'undefined') {

@@ -111,7 +84,7 @@ if (!this.moving) {

}
_super.prototype.post.call(this, numberOrEvent, isY);
super.post(numberOrEvent, isY);
return;
}
var event = numberOrEvent;
var node;
let event = numberOrEvent;
let node;
if (event instanceof Event) {

@@ -124,4 +97,4 @@ node = event.target;

}
var x;
var y;
let x;
let y;
if (event instanceof MouseEvent) {

@@ -137,5 +110,5 @@ x = event.pageX, y = event.pageY;

if (!x && !y && node) {
var offsetX = window.pageXOffset || document.documentElement.scrollLeft;
var offsetY = window.pageYOffset || document.documentElement.scrollTop;
var rect = node.getBoundingClientRect();
let offsetX = window.pageXOffset || document.documentElement.scrollLeft;
let offsetY = window.pageYOffset || document.documentElement.scrollTop;
let rect = node.getBoundingClientRect();
x = (rect.right + rect.left) / 2 + offsetX;

@@ -146,4 +119,4 @@ y = (rect.bottom + rect.top) / 2 + offsetY;

this.anchor = this.store.active;
var menu = this.html;
var margin = 5;
let menu = this.html;
let margin = 5;
if (x + menu.offsetWidth > document.body.offsetWidth - margin) {

@@ -153,8 +126,8 @@ x = document.body.offsetWidth - menu.offsetWidth - margin;

this.post(x, y);
};
ContextMenu.prototype.registerWidget = function (widget) {
}
registerWidget(widget) {
this.widgets.push(widget);
};
ContextMenu.prototype.unregisterWidget = function (widget) {
var index = this.widgets.indexOf(widget);
}
unregisterWidget(widget) {
let index = this.widgets.indexOf(widget);
if (index > -1) {

@@ -166,10 +139,10 @@ this.widgets.splice(index, 1);

}
};
ContextMenu.prototype.unpostWidgets = function () {
this.widgets.forEach(function (x) { return x.unpost(); });
};
ContextMenu.prototype.toJson = function () {
}
unpostWidgets() {
this.widgets.forEach(x => x.unpost());
}
toJson() {
return { type: '' };
};
ContextMenu.prototype.move_ = function (next) {
}
move_(next) {
if (this.anchor && next !== this.anchor) {

@@ -181,6 +154,4 @@ this.moving = true;

}
};
return ContextMenu;
}(abstract_menu_js_1.AbstractMenu));
exports.ContextMenu = ContextMenu;
}
}
//# sourceMappingURL=context_menu.js.map

@@ -1,11 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CssStyles = void 0;
var html_classes_js_1 = require("./html_classes.js");
var CssStyles;
import { HtmlClasses } from './html_classes.js';
export var CssStyles;
(function (CssStyles) {
function makeClass_(name) {
return '.' + (html_classes_js_1.HtmlClasses[name] || name);
return '.' + (HtmlClasses[name] || name);
}
var INFO_STYLES = {};
let INFO_STYLES = {};
INFO_STYLES[makeClass_('INFOCLOSE')] = '{' +

@@ -42,3 +39,3 @@ ' top:.2em; right:.2em;' +

'}';
var MENU_STYLES = {};
let MENU_STYLES = {};
MENU_STYLES[makeClass_('MENU')] = '{' +

@@ -156,3 +153,3 @@ ' position:absolute;' +

'}';
var CLOSE_ICON_STYLES = {};
let CLOSE_ICON_STYLES = {};
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE')] = '{' +

@@ -190,5 +187,5 @@ ' position:absolute;' +

'}';
var INFO_ADDED = false;
var MENU_ADDED = false;
var CLOSE_ICON_ADDED = false;
let INFO_ADDED = false;
let MENU_ADDED = false;
let CLOSE_ICON_ADDED = false;
function addMenuStyles(opt_document) {

@@ -220,7 +217,7 @@ if (MENU_ADDED) {

function addStyles_(styles, opt_document) {
var doc = opt_document || document;
var element = doc.createElement('style');
let doc = opt_document || document;
let element = doc.createElement('style');
element.type = 'text/css';
var inner = '';
for (var style in styles) {
let inner = '';
for (let style in styles) {
inner += style;

@@ -234,3 +231,3 @@ inner += ' ';

}
})(CssStyles = exports.CssStyles || (exports.CssStyles = {}));
})(CssStyles || (CssStyles = {}));
//# sourceMappingURL=css_util.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=element.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=entry.js.map
export declare const HtmlClasses: {
[id: string]: HtmlClass;
};
export declare type HtmlClass = 'CtxtMenu_ContextMenu' | 'CtxtMenu_Menu' | 'CtxtMenu_MenuArrow' | 'CtxtMenu_MenuActive' | 'CtxtMenu_MenuCheck' | 'CtxtMenu_MenuClose' | 'CtxtMenu_MenuDisabled' | 'CtxtMenu_MenuItem' | 'CtxtMenu_MenuLabel' | 'CtxtMenu_MenuRadioCheck' | 'CtxtMenu_MenuRule' | 'CtxtMenu_MousePost' | 'CtxtMenu_RTL' | 'CtxtMenu_Attached' | 'CtxtMenu_Info' | 'CtxtMenu_InfoClose' | 'CtxtMenu_InfoContent' | 'CtxtMenu_InfoSignature' | 'CtxtMenu_InfoTitle' | 'CtxtMenu_MenuFrame' | 'CtxtMenu_MenuInputBox' | 'CtxtMenu_MenuSlider' | 'CtxtMenu_Selection' | 'CtxtMenu_SelectionBox' | 'CtxtMenu_SelectionItem' | 'CtxtMenu_SelectionDivider' | 'CtxtMenu_SelectionMenu';
export type HtmlClass = 'CtxtMenu_ContextMenu' | 'CtxtMenu_Menu' | 'CtxtMenu_MenuArrow' | 'CtxtMenu_MenuActive' | 'CtxtMenu_MenuCheck' | 'CtxtMenu_MenuClose' | 'CtxtMenu_MenuDisabled' | 'CtxtMenu_MenuItem' | 'CtxtMenu_MenuLabel' | 'CtxtMenu_MenuRadioCheck' | 'CtxtMenu_MenuRule' | 'CtxtMenu_MousePost' | 'CtxtMenu_RTL' | 'CtxtMenu_Attached' | 'CtxtMenu_Info' | 'CtxtMenu_InfoClose' | 'CtxtMenu_InfoContent' | 'CtxtMenu_InfoSignature' | 'CtxtMenu_InfoTitle' | 'CtxtMenu_MenuFrame' | 'CtxtMenu_MenuInputBox' | 'CtxtMenu_MenuSlider' | 'CtxtMenu_Selection' | 'CtxtMenu_SelectionBox' | 'CtxtMenu_SelectionItem' | 'CtxtMenu_SelectionDivider' | 'CtxtMenu_SelectionMenu';
export declare const HtmlAttrs: {
[id: string]: HtmlAttr;
};
export declare type HtmlAttr = 'CtxtMenu_Counter' | 'CtxtMenu_keydownFunc' | 'CtxtMenu_contextmenuFunc' | 'CtxtMenu_touchstartFunc' | 'CtxtMenu_Oldtabindex';
export type HtmlAttr = 'CtxtMenu_Counter' | 'CtxtMenu_keydownFunc' | 'CtxtMenu_contextmenuFunc' | 'CtxtMenu_touchstartFunc' | 'CtxtMenu_Oldtabindex';

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HtmlAttrs = exports.HtmlClasses = void 0;
var PREFIX = 'CtxtMenu';
const PREFIX = 'CtxtMenu';
function prefix_(name) {

@@ -14,3 +11,3 @@ return PREFIX + '_' + name;

}
exports.HtmlClasses = {
export const HtmlClasses = {
ATTACHED: prefixClass_('Attached'),

@@ -47,3 +44,3 @@ CONTEXTMENU: prefixClass_('ContextMenu'),

};
exports.HtmlAttrs = {
export const HtmlAttrs = {
COUNTER: prefixAttr_('Counter'),

@@ -50,0 +47,0 @@ KEYDOWNFUNC: prefixAttr_('keydownFunc'),

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

import { ContextMenu as obj0 } from './context_menu';
import { CssStyles as obj1 } from './css_util';
import { Info as obj2 } from './info';
import { Popup as obj3 } from './popup';
import { Parser as obj4 } from './parse';
import { SelectionBox as obj5 } from './selection_box';
import { Variable as obj6 } from './variable';
import { ParserFactory as obj7 } from './parser_factory';
import { ContextMenu as obj0 } from './context_menu.js';
import { CssStyles as obj1 } from './css_util.js';
import { Info as obj2 } from './info.js';
import { Popup as obj3 } from './popup.js';
import { Parser as obj4 } from './parse.js';
import { SelectionBox as obj5 } from './selection_box.js';
import { Variable as obj6 } from './variable.js';
import { ParserFactory as obj7 } from './parser_factory.js';
export declare let ContextMenu: typeof obj0;

@@ -10,0 +10,0 @@ export declare let CssStyles: typeof obj1;

@@ -1,21 +0,18 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserFactory = exports.Variable = exports.SelectionBox = exports.version = exports.Parser = exports.Popup = exports.Info = exports.CssStyles = exports.ContextMenu = void 0;
var context_menu_1 = require("./context_menu");
var css_util_1 = require("./css_util");
var info_1 = require("./info");
var popup_1 = require("./popup");
var parse_1 = require("./parse");
var selection_box_1 = require("./selection_box");
var variable_1 = require("./variable");
var parser_factory_1 = require("./parser_factory");
exports.ContextMenu = context_menu_1.ContextMenu;
exports.CssStyles = css_util_1.CssStyles;
exports.Info = info_1.Info;
exports.Popup = popup_1.Popup;
exports.Parser = parse_1.Parser;
exports.version = '0.4.2';
exports.SelectionBox = selection_box_1.SelectionBox;
exports.Variable = variable_1.Variable;
exports.ParserFactory = parser_factory_1.ParserFactory;
import { ContextMenu as obj0 } from './context_menu.js';
import { CssStyles as obj1 } from './css_util.js';
import { Info as obj2 } from './info.js';
import { Popup as obj3 } from './popup.js';
import { Parser as obj4 } from './parse.js';
import { SelectionBox as obj5 } from './selection_box.js';
import { Variable as obj6 } from './variable.js';
import { ParserFactory as obj7 } from './parser_factory.js';
export let ContextMenu = obj0;
export let CssStyles = obj1;
export let Info = obj2;
export let Popup = obj3;
export let Parser = obj4;
export let version = '0.4.2';
export let SelectionBox = obj5;
export let Variable = obj6;
export let ParserFactory = obj7;
//# sourceMappingURL=index.js.map

@@ -1,39 +0,21 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Info = void 0;
var close_button_js_1 = require("./close_button.js");
var html_classes_js_1 = require("./html_classes.js");
var abstract_postable_js_1 = require("./abstract_postable.js");
var Info = (function (_super) {
__extends(Info, _super);
function Info(title, content, signature) {
var _this = _super.call(this) || this;
_this.title = title;
_this.signature = signature;
_this.className = html_classes_js_1.HtmlClasses['INFO'];
_this.role = 'dialog';
_this.contentDiv = _this.generateContent();
_this.close = _this.generateClose();
_this.content = content || function () { return ''; };
return _this;
import { CloseButton } from './close_button.js';
import { HtmlClasses } from './html_classes.js';
import { AbstractPostable } from './abstract_postable.js';
export class Info extends AbstractPostable {
constructor(title, content, signature) {
super();
this.title = title;
this.signature = signature;
this.className = HtmlClasses['INFO'];
this.role = 'dialog';
this.contentDiv = this.generateContent();
this.close = this.generateClose();
this.content = content || function () { return ''; };
}
Info.prototype.attachMenu = function (menu) {
attachMenu(menu) {
this.menu = menu;
};
Info.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.appendChild(this.generateTitle());

@@ -44,20 +26,20 @@ html.appendChild(this.contentDiv);

html.setAttribute('tabindex', '0');
};
Info.prototype.post = function () {
_super.prototype.post.call(this);
var doc = document.documentElement;
var html = this.html;
var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0;
var x = Math.floor((-html.offsetWidth) / 2);
var y = Math.floor((H - html.offsetHeight) / 3);
}
post() {
super.post();
let doc = document.documentElement;
let html = this.html;
let H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0;
let x = Math.floor((-html.offsetWidth) / 2);
let y = Math.floor((H - html.offsetHeight) / 3);
html.setAttribute('style', 'margin-left: ' + x + 'px; top: ' + y + 'px;');
if (window.event instanceof MouseEvent) {
html.classList.add(html_classes_js_1.HtmlClasses['MOUSEPOST']);
html.classList.add(HtmlClasses['MOUSEPOST']);
}
html.focus();
};
Info.prototype.display = function () {
}
display() {
this.menu.registerWidget(this);
this.contentDiv.innerHTML = this.content();
var html = this.menu.html;
let html = this.menu.html;
if (html.parentNode) {

@@ -67,48 +49,46 @@ html.parentNode.removeChild(html);

this.menu.frame.appendChild(this.html);
};
Info.prototype.click = function (_event) { };
Info.prototype.keydown = function (event) {
}
click(_event) { }
keydown(event) {
this.bubbleKey();
_super.prototype.keydown.call(this, event);
};
Info.prototype.escape = function (_event) {
super.keydown(event);
}
escape(_event) {
this.unpost();
};
Info.prototype.unpost = function () {
_super.prototype.unpost.call(this);
this.html.classList.remove(html_classes_js_1.HtmlClasses['MOUSEPOST']);
}
unpost() {
super.unpost();
this.html.classList.remove(HtmlClasses['MOUSEPOST']);
this.menu.unregisterWidget(this);
};
Info.prototype.generateClose = function () {
var close = new close_button_js_1.CloseButton(this);
var html = close.html;
html.classList.add(html_classes_js_1.HtmlClasses['INFOCLOSE']);
}
generateClose() {
let close = new CloseButton(this);
let html = close.html;
html.classList.add(HtmlClasses['INFOCLOSE']);
html.setAttribute('aria-label', 'Close Dialog Box');
return close;
};
Info.prototype.generateTitle = function () {
var span = document.createElement('span');
}
generateTitle() {
let span = document.createElement('span');
span.innerHTML = this.title;
span.classList.add(html_classes_js_1.HtmlClasses['INFOTITLE']);
span.classList.add(HtmlClasses['INFOTITLE']);
return span;
};
Info.prototype.generateContent = function () {
var div = document.createElement('div');
div.classList.add(html_classes_js_1.HtmlClasses['INFOCONTENT']);
}
generateContent() {
let div = document.createElement('div');
div.classList.add(HtmlClasses['INFOCONTENT']);
div.setAttribute('tabindex', '0');
return div;
};
Info.prototype.generateSignature = function () {
var span = document.createElement('span');
}
generateSignature() {
let span = document.createElement('span');
span.innerHTML = this.signature;
span.classList.add(html_classes_js_1.HtmlClasses['INFOSIGNATURE']);
span.classList.add(HtmlClasses['INFOSIGNATURE']);
return span;
};
Info.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Info;
}(abstract_postable_js_1.AbstractPostable));
exports.Info = Info;
}
}
//# sourceMappingURL=info.js.map

@@ -1,55 +0,34 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Checkbox = void 0;
var abstract_variable_item_js_1 = require("./abstract_variable_item.js");
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var Checkbox = (function (_super) {
__extends(Checkbox, _super);
function Checkbox(menu, content, variable, id) {
var _this = _super.call(this, menu, 'checkbox', content, id) || this;
_this.role = 'menuitemcheckbox';
_this.variable = menu.pool.lookup(variable);
_this.register();
return _this;
import { AbstractVariableItem } from './abstract_variable_item.js';
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
export class Checkbox extends AbstractVariableItem {
static fromJson(_factory, { content: content, variable: variable, id: id }, menu) {
return new this(menu, content, variable, id);
}
Checkbox.fromJson = function (_factory, _a, menu) {
var content = _a.content, variable = _a.variable, id = _a.id;
return new this(menu, content, variable, id);
};
Checkbox.prototype.executeAction = function () {
constructor(menu, content, variable, id) {
super(menu, 'checkbox', content, id);
this.role = 'menuitemcheckbox';
this.variable = menu.pool.lookup(variable);
this.register();
}
executeAction() {
this.variable.setValue(!this.variable.getValue());
menu_util_js_1.MenuUtil.close(this);
};
Checkbox.prototype.generateSpan = function () {
MenuUtil.close(this);
}
generateSpan() {
this.span = document.createElement('span');
this.span.textContent = '\u2713';
this.span.classList.add(html_classes_js_1.HtmlClasses['MENUCHECK']);
};
Checkbox.prototype.updateAria = function () {
this.span.classList.add(HtmlClasses['MENUCHECK']);
}
updateAria() {
this.html.setAttribute('aria-checked', this.variable.getValue() ? 'true' : 'false');
};
Checkbox.prototype.updateSpan = function () {
}
updateSpan() {
this.span.style.display = this.variable.getValue() ? '' : 'none';
};
Checkbox.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Checkbox;
}(abstract_variable_item_js_1.AbstractVariableItem));
exports.Checkbox = Checkbox;
}
}
//# sourceMappingURL=item_checkbox.js.map

@@ -1,58 +0,39 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Combo = void 0;
var abstract_variable_item_js_1 = require("./abstract_variable_item.js");
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var key_navigatable_js_1 = require("./key_navigatable.js");
var Combo = (function (_super) {
__extends(Combo, _super);
function Combo(menu, content, variable, id) {
var _this = _super.call(this, menu, 'combobox', content, id) || this;
_this.role = 'combobox';
_this.inputEvent = false;
_this.variable = menu.pool.lookup(variable);
_this.register();
return _this;
import { AbstractVariableItem } from './abstract_variable_item.js';
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
import { KEY } from './key_navigatable.js';
export class Combo extends AbstractVariableItem {
static fromJson(_factory, { content: content, variable: variable, id: id }, menu) {
return new this(menu, content, variable, id);
}
Combo.fromJson = function (_factory, _a, menu) {
var content = _a.content, variable = _a.variable, id = _a.id;
return new this(menu, content, variable, id);
};
Combo.prototype.executeAction = function () {
this.variable.setValue(this.input.value, menu_util_js_1.MenuUtil.getActiveElement(this));
};
Combo.prototype.space = function (event) {
_super.prototype.space.call(this, event);
menu_util_js_1.MenuUtil.close(this);
};
Combo.prototype.focus = function () {
_super.prototype.focus.call(this);
constructor(menu, content, variable, id) {
super(menu, 'combobox', content, id);
this.role = 'combobox';
this.inputEvent = false;
this.variable = menu.pool.lookup(variable);
this.register();
}
executeAction() {
this.variable.setValue(this.input.value, MenuUtil.getActiveElement(this));
}
space(event) {
super.space(event);
MenuUtil.close(this);
}
focus() {
super.focus();
this.input.focus();
};
Combo.prototype.unfocus = function () {
_super.prototype.unfocus.call(this);
}
unfocus() {
super.unfocus();
this.updateSpan();
};
Combo.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENUCOMBOBOX']);
};
Combo.prototype.generateSpan = function () {
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.classList.add(HtmlClasses['MENUCOMBOBOX']);
}
generateSpan() {
this.span = document.createElement('span');
this.span.classList.add(html_classes_js_1.HtmlClasses['MENUINPUTBOX']);
this.span.classList.add(HtmlClasses['MENUINPUTBOX']);
this.input = document.createElement('input');

@@ -64,11 +45,11 @@ this.input.addEventListener('keydown', this.inputKey.bind(this));

this.span.appendChild(this.input);
};
Combo.prototype.inputKey = function (_event) {
}
inputKey(_event) {
this.bubbleKey();
this.inputEvent = true;
};
Combo.prototype.keydown = function (event) {
}
keydown(event) {
if (this.inputEvent &&
event.keyCode !== key_navigatable_js_1.KEY.ESCAPE &&
event.keyCode !== key_navigatable_js_1.KEY.RETURN) {
event.keyCode !== KEY.ESCAPE &&
event.keyCode !== KEY.RETURN) {
this.inputEvent = false;

@@ -78,10 +59,10 @@ event.stopPropagation();

}
_super.prototype.keydown.call(this, event);
super.keydown(event);
event.stopPropagation();
};
Combo.prototype.updateAria = function () { };
Combo.prototype.updateSpan = function () {
var initValue;
}
updateAria() { }
updateSpan() {
let initValue;
try {
initValue = this.variable.getValue(menu_util_js_1.MenuUtil.getActiveElement(this));
initValue = this.variable.getValue(MenuUtil.getActiveElement(this));
}

@@ -92,10 +73,8 @@ catch (e) {

this.input.value = initValue;
};
Combo.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Combo;
}(abstract_variable_item_js_1.AbstractVariableItem));
exports.Combo = Combo;
}
}
//# sourceMappingURL=item_combo.js.map

@@ -1,46 +0,25 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
var abstract_item_js_1 = require("./abstract_item.js");
var menu_util_js_1 = require("./menu_util.js");
var Command = (function (_super) {
__extends(Command, _super);
function Command(menu, content, command, id) {
var _this = _super.call(this, menu, 'command', content, id) || this;
_this.command = command;
return _this;
import { AbstractItem } from './abstract_item.js';
import { MenuUtil } from './menu_util.js';
export class Command extends AbstractItem {
static fromJson(_factory, { content: content, action: action, id: id }, menu) {
return new this(menu, content, action, id);
}
Command.fromJson = function (_factory, _a, menu) {
var content = _a.content, action = _a.action, id = _a.id;
return new this(menu, content, action, id);
};
Command.prototype.executeAction = function () {
constructor(menu, content, command, id) {
super(menu, 'command', content, id);
this.command = command;
}
executeAction() {
try {
this.command(menu_util_js_1.MenuUtil.getActiveElement(this));
this.command(MenuUtil.getActiveElement(this));
}
catch (e) {
menu_util_js_1.MenuUtil.error(e, 'Illegal command callback.');
MenuUtil.error(e, 'Illegal command callback.');
}
menu_util_js_1.MenuUtil.close(this);
};
Command.prototype.toJson = function () {
MenuUtil.close(this);
}
toJson() {
return { type: ''
};
};
return Command;
}(abstract_item_js_1.AbstractItem));
exports.Command = Command;
}
}
//# sourceMappingURL=item_command.js.map

@@ -1,40 +0,20 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Label = void 0;
var abstract_item_js_1 = require("./abstract_item.js");
var html_classes_js_1 = require("./html_classes.js");
var Label = (function (_super) {
__extends(Label, _super);
function Label(menu, content, id) {
return _super.call(this, menu, 'label', content, id) || this;
import { AbstractItem } from './abstract_item.js';
import { HtmlClasses } from './html_classes.js';
export class Label extends AbstractItem {
static fromJson(_factory, { content: content, id: id }, menu) {
return new this(menu, content, id);
}
Label.fromJson = function (_factory, _a, menu) {
var content = _a.content, id = _a.id;
return new this(menu, content, id);
};
Label.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENULABEL']);
};
Label.prototype.toJson = function () {
constructor(menu, content, id) {
super(menu, 'label', content, id);
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.classList.add(HtmlClasses['MENULABEL']);
}
toJson() {
return { type: ''
};
};
return Label;
}(abstract_item_js_1.AbstractItem));
exports.Label = Label;
}
}
//# sourceMappingURL=item_label.js.map

@@ -1,56 +0,35 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Radio = void 0;
var abstract_variable_item_js_1 = require("./abstract_variable_item.js");
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var Radio = (function (_super) {
__extends(Radio, _super);
function Radio(menu, content, variable, id) {
var _this = _super.call(this, menu, 'radio', content, id) || this;
_this.role = 'menuitemradio';
_this.variable = menu.pool.lookup(variable);
_this.register();
return _this;
import { AbstractVariableItem } from './abstract_variable_item.js';
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
export class Radio extends AbstractVariableItem {
static fromJson(_factory, { content: content, variable: variable, id: id }, menu) {
return new this(menu, content, variable, id);
}
Radio.fromJson = function (_factory, _a, menu) {
var content = _a.content, variable = _a.variable, id = _a.id;
return new this(menu, content, variable, id);
};
Radio.prototype.executeAction = function () {
constructor(menu, content, variable, id) {
super(menu, 'radio', content, id);
this.role = 'menuitemradio';
this.variable = menu.pool.lookup(variable);
this.register();
}
executeAction() {
this.variable.setValue(this.id);
menu_util_js_1.MenuUtil.close(this);
};
Radio.prototype.generateSpan = function () {
MenuUtil.close(this);
}
generateSpan() {
this.span = document.createElement('span');
this.span.textContent = '\u2713';
this.span.classList.add(html_classes_js_1.HtmlClasses['MENURADIOCHECK']);
};
Radio.prototype.updateAria = function () {
this.span.classList.add(HtmlClasses['MENURADIOCHECK']);
}
updateAria() {
this.html.setAttribute('aria-checked', this.variable.getValue() === this.id ? 'true' : 'false');
};
Radio.prototype.updateSpan = function () {
}
updateSpan() {
this.span.style.display =
this.variable.getValue() === this.id ? '' : 'none';
};
Radio.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Radio;
}(abstract_variable_item_js_1.AbstractVariableItem));
exports.Radio = Radio;
}
}
//# sourceMappingURL=item_radio.js.map

@@ -1,43 +0,23 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rule = void 0;
var abstract_entry_js_1 = require("./abstract_entry.js");
var html_classes_js_1 = require("./html_classes.js");
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule(menu) {
var _this = _super.call(this, menu, 'rule') || this;
_this.className = html_classes_js_1.HtmlClasses['MENUITEM'];
_this.role = 'separator';
return _this;
import { AbstractEntry } from './abstract_entry.js';
import { HtmlClasses } from './html_classes.js';
export class Rule extends AbstractEntry {
static fromJson(_factory, {}, menu) {
return new this(menu);
}
Rule.fromJson = function (_factory, _a, menu) {
return new this(menu);
};
Rule.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENURULE']);
constructor(menu) {
super(menu, 'rule');
this.className = HtmlClasses['MENUITEM'];
this.role = 'separator';
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.classList.add(HtmlClasses['MENURULE']);
html.setAttribute('aria-orientation', 'vertical');
};
Rule.prototype.addEvents = function (_element) { };
Rule.prototype.toJson = function () {
}
addEvents(_element) { }
toJson() {
return { type: 'rule' };
};
return Rule;
}(abstract_entry_js_1.AbstractEntry));
exports.Rule = Rule;
}
}
//# sourceMappingURL=item_rule.js.map

@@ -1,63 +0,44 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Slider = void 0;
var abstract_variable_item_js_1 = require("./abstract_variable_item.js");
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var key_navigatable_js_1 = require("./key_navigatable.js");
var Slider = (function (_super) {
__extends(Slider, _super);
function Slider(menu, content, variable, id) {
var _this = _super.call(this, menu, 'slider', content, id) || this;
_this.role = 'slider';
_this.labelId = 'ctx_slideLabel' + menu_util_js_1.MenuUtil.counter();
_this.valueId = 'ctx_slideValue' + menu_util_js_1.MenuUtil.counter();
_this.inputEvent = false;
_this.variable = menu.pool.lookup(variable);
_this.register();
return _this;
import { AbstractVariableItem } from './abstract_variable_item.js';
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
import { KEY } from './key_navigatable.js';
export class Slider extends AbstractVariableItem {
static fromJson(_factory, { content: content, variable: variable, id: id }, menu) {
return new this(menu, content, variable, id);
}
Slider.fromJson = function (_factory, _a, menu) {
var content = _a.content, variable = _a.variable, id = _a.id;
return new this(menu, content, variable, id);
};
Slider.prototype.executeAction = function () {
this.variable.setValue(this.input.value, menu_util_js_1.MenuUtil.getActiveElement(this));
constructor(menu, content, variable, id) {
super(menu, 'slider', content, id);
this.role = 'slider';
this.labelId = 'ctx_slideLabel' + MenuUtil.counter();
this.valueId = 'ctx_slideValue' + MenuUtil.counter();
this.inputEvent = false;
this.variable = menu.pool.lookup(variable);
this.register();
}
executeAction() {
this.variable.setValue(this.input.value, MenuUtil.getActiveElement(this));
this.update();
};
Slider.prototype.space = function (event) {
_super.prototype.space.call(this, event);
menu_util_js_1.MenuUtil.close(this);
};
Slider.prototype.focus = function () {
_super.prototype.focus.call(this);
}
space(event) {
super.space(event);
MenuUtil.close(this);
}
focus() {
super.focus();
this.input.focus();
};
Slider.prototype.unfocus = function () {
_super.prototype.unfocus.call(this);
}
unfocus() {
super.unfocus();
this.updateSpan();
};
Slider.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
html.classList.add(html_classes_js_1.HtmlClasses['MENUSLIDER']);
}
generateHtml() {
super.generateHtml();
let html = this.html;
html.classList.add(HtmlClasses['MENUSLIDER']);
this.valueSpan = document.createElement('span');
this.valueSpan.setAttribute('id', this.valueId);
this.valueSpan.classList.add(html_classes_js_1.HtmlClasses['SLIDERVALUE']);
this.valueSpan.classList.add(HtmlClasses['SLIDERVALUE']);
this.html.appendChild(this.valueSpan);
};
Slider.prototype.generateSpan = function () {
}
generateSpan() {
this.span = document.createElement('span');

@@ -77,23 +58,23 @@ this.labelSpan = document.createElement('span');

this.input.addEventListener('input', this.executeAction.bind(this));
this.input.classList.add(html_classes_js_1.HtmlClasses['SLIDERBAR']);
this.input.classList.add(HtmlClasses['SLIDERBAR']);
this.span.appendChild(this.input);
};
Slider.prototype.inputKey = function (_event) {
}
inputKey(_event) {
this.inputEvent = true;
};
Slider.prototype.mousedown = function (event) {
}
mousedown(event) {
event.stopPropagation();
};
Slider.prototype.mouseup = function (_event) {
}
mouseup(_event) {
event.stopPropagation();
};
Slider.prototype.keydown = function (event) {
var code = event.keyCode;
if (code === key_navigatable_js_1.KEY.UP || code === key_navigatable_js_1.KEY.DOWN) {
}
keydown(event) {
let code = event.keyCode;
if (code === KEY.UP || code === KEY.DOWN) {
event.preventDefault();
_super.prototype.keydown.call(this, event);
super.keydown(event);
return;
}
if (this.inputEvent &&
code !== key_navigatable_js_1.KEY.ESCAPE && code !== key_navigatable_js_1.KEY.RETURN) {
code !== KEY.ESCAPE && code !== KEY.RETURN) {
this.inputEvent = false;

@@ -103,7 +84,7 @@ event.stopPropagation();

}
_super.prototype.keydown.call(this, event);
super.keydown(event);
event.stopPropagation();
};
Slider.prototype.updateAria = function () {
var value = this.variable.getValue();
}
updateAria() {
let value = this.variable.getValue();
if (value && this.input) {

@@ -113,7 +94,7 @@ this.input.setAttribute('aria-valuenow', value);

}
};
Slider.prototype.updateSpan = function () {
var initValue;
}
updateSpan() {
let initValue;
try {
initValue = this.variable.getValue(menu_util_js_1.MenuUtil.getActiveElement(this));
initValue = this.variable.getValue(MenuUtil.getActiveElement(this));
this.valueSpan.innerHTML = initValue + '%';

@@ -125,10 +106,8 @@ }

this.input.value = initValue;
};
Slider.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Slider;
}(abstract_variable_item_js_1.AbstractVariableItem));
exports.Slider = Slider;
}
}
//# sourceMappingURL=item_slider.js.map

@@ -1,57 +0,34 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Submenu = void 0;
var abstract_item_js_1 = require("./abstract_item.js");
var html_classes_js_1 = require("./html_classes.js");
var Submenu = (function (_super) {
__extends(Submenu, _super);
function Submenu(menu, content, id) {
var _this = _super.call(this, menu, 'submenu', content, id) || this;
_this._submenu = null;
return _this;
}
Submenu.fromJson = function (factory, _a, menu) {
var content = _a.content, submenu = _a.menu, id = _a.id;
var item = new this(menu, content, id);
var sm = factory.get('subMenu')(factory, submenu, item);
import { AbstractItem } from './abstract_item.js';
import { HtmlClasses } from './html_classes.js';
export class Submenu extends AbstractItem {
static fromJson(factory, { content: content, menu: submenu, id: id }, menu) {
const item = new this(menu, content, id);
const sm = factory.get('subMenu')(factory, submenu, item);
item.submenu = sm;
return item;
};
Object.defineProperty(Submenu.prototype, "submenu", {
get: function () {
return this._submenu;
},
set: function (menu) {
this._submenu = menu;
},
enumerable: false,
configurable: true
});
Submenu.prototype.mouseover = function (event) {
}
constructor(menu, content, id) {
super(menu, 'submenu', content, id);
this._submenu = null;
}
set submenu(menu) {
this._submenu = menu;
}
get submenu() {
return this._submenu;
}
mouseover(event) {
this.focus();
this.stop(event);
};
Submenu.prototype.mouseout = function (event) {
}
mouseout(event) {
this.stop(event);
};
Submenu.prototype.unfocus = function () {
}
unfocus() {
if (!this.submenu.isPosted()) {
_super.prototype.unfocus.call(this);
super.unfocus();
return;
}
if (this.menu.focused !== this) {
_super.prototype.unfocus.call(this);
super.unfocus();
this.menu.unpostSubmenus();

@@ -62,22 +39,22 @@ return;

this.html.blur();
};
Submenu.prototype.focus = function () {
_super.prototype.focus.call(this);
}
focus() {
super.focus();
if (!this.submenu.isPosted() && !this.disabled) {
this.submenu.post();
}
};
Submenu.prototype.executeAction = function () {
}
executeAction() {
this.submenu.isPosted() ? this.submenu.unpost() : this.submenu.post();
};
Submenu.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
var html = this.html;
}
generateHtml() {
super.generateHtml();
let html = this.html;
this.span = document.createElement('span');
this.span.textContent = '\u25BA';
this.span.classList.add(html_classes_js_1.HtmlClasses['MENUARROW']);
this.span.classList.add(HtmlClasses['MENUARROW']);
html.appendChild(this.span);
html.setAttribute('aria-haspopup', 'true');
};
Submenu.prototype.left = function (event) {
}
left(event) {
if (this.submenu.isPosted()) {

@@ -87,6 +64,6 @@ this.submenu.unpost();

else {
_super.prototype.left.call(this, event);
super.left(event);
}
};
Submenu.prototype.right = function (event) {
}
right(event) {
if (!this.submenu.isPosted()) {

@@ -98,10 +75,8 @@ this.submenu.post();

}
};
Submenu.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return Submenu;
}(abstract_item_js_1.AbstractItem));
exports.Submenu = Submenu;
}
}
//# sourceMappingURL=item_submenu.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=item.js.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KEY = void 0;
var KEY;
export var KEY;
(function (KEY) {

@@ -13,3 +10,3 @@ KEY[KEY["RETURN"] = 13] = "RETURN";

KEY[KEY["DOWN"] = 40] = "DOWN";
})(KEY = exports.KEY || (exports.KEY = {}));
})(KEY || (KEY = {}));
//# sourceMappingURL=key_navigatable.js.map

@@ -1,55 +0,31 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuElement = void 0;
var abstract_navigatable_js_1 = require("./abstract_navigatable.js");
var MenuElement = (function (_super) {
__extends(MenuElement, _super);
function MenuElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
MenuElement.prototype.addAttributes = function (attributes) {
for (var attr in attributes) {
import { AbstractNavigatable } from './abstract_navigatable.js';
export class MenuElement extends AbstractNavigatable {
addAttributes(attributes) {
for (let attr in attributes) {
this.html.setAttribute(attr, attributes[attr]);
}
};
Object.defineProperty(MenuElement.prototype, "html", {
get: function () {
if (!this._html) {
this.generateHtml();
}
return this._html;
},
set: function (html) {
this._html = html;
this.addEvents(html);
},
enumerable: false,
configurable: true
});
MenuElement.prototype.generateHtml = function () {
var html = document.createElement('div');
}
get html() {
if (!this._html) {
this.generateHtml();
}
return this._html;
}
set html(html) {
this._html = html;
this.addEvents(html);
}
generateHtml() {
let html = document.createElement('div');
html.classList.add(this.className);
html.setAttribute('role', this.role);
this.html = html;
};
MenuElement.prototype.focus = function () {
var html = this.html;
}
focus() {
let html = this.html;
html.setAttribute('tabindex', '0');
html.focus();
};
MenuElement.prototype.unfocus = function () {
var html = this.html;
}
unfocus() {
let html = this.html;
if (html.hasAttribute('tabindex')) {

@@ -64,6 +40,4 @@ html.setAttribute('tabindex', '-1');

html.blur();
};
return MenuElement;
}(abstract_navigatable_js_1.AbstractNavigatable));
exports.MenuElement = MenuElement;
}
}
//# sourceMappingURL=menu_element.js.map

@@ -1,20 +0,6 @@

"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuStore = void 0;
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var key_navigatable_js_1 = require("./key_navigatable.js");
var MenuStore = (function () {
function MenuStore(menu) {
import { MenuUtil } from './menu_util.js';
import { HtmlClasses, HtmlAttrs } from './html_classes.js';
import { KEY } from './key_navigatable.js';
export class MenuStore {
constructor(menu) {
this.menu = menu;

@@ -24,25 +10,21 @@ this.store = [];

this.counter = 0;
this.attachedClass = html_classes_js_1.HtmlClasses['ATTACHED'] + '_' +
menu_util_js_1.MenuUtil.counter();
this.attachedClass = HtmlClasses['ATTACHED'] + '_' +
MenuUtil.counter();
this.taborder = true;
this.attrMap = {};
}
Object.defineProperty(MenuStore.prototype, "active", {
get: function () {
return this._active;
},
set: function (element) {
do {
if (this.store.indexOf(element) !== -1) {
this._active = element;
break;
}
element = element.parentNode;
} while (element);
},
enumerable: false,
configurable: true
});
MenuStore.prototype.next = function () {
var length = this.store.length;
set active(element) {
do {
if (this.store.indexOf(element) !== -1) {
this._active = element;
break;
}
element = element.parentNode;
} while (element);
}
get active() {
return this._active;
}
next() {
let length = this.store.length;
if (length === 0) {

@@ -52,9 +34,9 @@ this.active = null;

}
var index = this.store.indexOf(this.active);
let index = this.store.indexOf(this.active);
index = index === -1 ? 0 : (index < length - 1 ? index + 1 : 0);
this.active = this.store[index];
return this.active;
};
MenuStore.prototype.previous = function () {
var length = this.store.length;
}
previous() {
let length = this.store.length;
if (length === 0) {

@@ -64,50 +46,28 @@ this.active = null;

}
var last = length - 1;
var index = this.store.indexOf(this.active);
let last = length - 1;
let index = this.store.indexOf(this.active);
index = index === -1 ? last : (index === 0 ? last : index - 1);
this.active = this.store[index];
return this.active;
};
MenuStore.prototype.clear = function () {
}
clear() {
this.remove(this.store);
};
MenuStore.prototype.insert = function (elementOrList) {
var e_1, _a;
var elements = elementOrList instanceof HTMLElement ?
}
insert(elementOrList) {
let elements = elementOrList instanceof HTMLElement ?
[elementOrList] : elementOrList;
try {
for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
var element = elements_1_1.value;
this.insertElement(element);
}
for (let element of elements) {
this.insertElement(element);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
}
finally { if (e_1) throw e_1.error; }
}
this.sort();
};
MenuStore.prototype.remove = function (elementOrList) {
var e_2, _a;
var elements = elementOrList instanceof HTMLElement ?
}
remove(elementOrList) {
let elements = elementOrList instanceof HTMLElement ?
[elementOrList] : elementOrList;
try {
for (var elements_2 = __values(elements), elements_2_1 = elements_2.next(); !elements_2_1.done; elements_2_1 = elements_2.next()) {
var element = elements_2_1.value;
this.removeElement(element);
}
for (let element of elements) {
this.removeElement(element);
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (elements_2_1 && !elements_2_1.done && (_a = elements_2.return)) _a.call(elements_2);
}
finally { if (e_2) throw e_2.error; }
}
this.sort();
};
MenuStore.prototype.inTaborder = function (flag) {
}
inTaborder(flag) {
if (this.taborder && !flag) {

@@ -120,14 +80,14 @@ this.removeTaborder();

this.taborder = flag;
};
MenuStore.prototype.insertTaborder = function () {
}
insertTaborder() {
if (this.taborder) {
this.insertTaborder_();
}
};
MenuStore.prototype.removeTaborder = function () {
}
removeTaborder() {
if (this.taborder) {
this.removeTaborder_();
}
};
MenuStore.prototype.insertElement = function (element) {
}
insertElement(element) {
if (element.classList.contains(this.attachedClass)) {

@@ -141,4 +101,4 @@ return;

this.addEvents(element);
};
MenuStore.prototype.removeElement = function (element) {
}
removeElement(element) {
if (!element.classList.contains(this.attachedClass)) {

@@ -152,23 +112,23 @@ return;

this.removeEvents(element);
};
MenuStore.prototype.sort = function () {
var nodes = document.getElementsByClassName(this.attachedClass);
}
sort() {
let nodes = document.getElementsByClassName(this.attachedClass);
this.store = [].slice.call(nodes);
};
MenuStore.prototype.insertTaborder_ = function () {
this.store.forEach(function (x) { return x.setAttribute('tabindex', '0'); });
};
MenuStore.prototype.removeTaborder_ = function () {
this.store.forEach(function (x) { return x.setAttribute('tabindex', '-1'); });
};
MenuStore.prototype.addTabindex = function (element) {
}
insertTaborder_() {
this.store.forEach(x => x.setAttribute('tabindex', '0'));
}
removeTaborder_() {
this.store.forEach(x => x.setAttribute('tabindex', '-1'));
}
addTabindex(element) {
if (element.hasAttribute('tabindex')) {
element.setAttribute(html_classes_js_1.HtmlAttrs['OLDTAB'], element.getAttribute('tabindex'));
element.setAttribute(HtmlAttrs['OLDTAB'], element.getAttribute('tabindex'));
}
element.setAttribute('tabindex', '0');
};
MenuStore.prototype.removeTabindex = function (element) {
if (element.hasAttribute(html_classes_js_1.HtmlAttrs['OLDTAB'])) {
element.setAttribute('tabindex', element.getAttribute(html_classes_js_1.HtmlAttrs['OLDTAB']));
element.removeAttribute(html_classes_js_1.HtmlAttrs['OLDTAB']);
}
removeTabindex(element) {
if (element.hasAttribute(HtmlAttrs['OLDTAB'])) {
element.setAttribute('tabindex', element.getAttribute(HtmlAttrs['OLDTAB']));
element.removeAttribute(HtmlAttrs['OLDTAB']);
}

@@ -178,5 +138,5 @@ else {

}
};
MenuStore.prototype.addEvents = function (element) {
if (element.hasAttribute(html_classes_js_1.HtmlAttrs['COUNTER'])) {
}
addEvents(element) {
if (element.hasAttribute(HtmlAttrs['COUNTER'])) {
return;

@@ -186,26 +146,26 @@ }

this.addEvent(element, 'keydown', this.keydown.bind(this));
element.setAttribute(html_classes_js_1.HtmlAttrs['COUNTER'], this.counter.toString());
element.setAttribute(HtmlAttrs['COUNTER'], this.counter.toString());
this.counter++;
};
MenuStore.prototype.addEvent = function (element, name, func) {
var attrName = html_classes_js_1.HtmlAttrs[name.toUpperCase() + 'FUNC'];
}
addEvent(element, name, func) {
let attrName = HtmlAttrs[name.toUpperCase() + 'FUNC'];
this.attrMap[attrName + this.counter] = func;
element.addEventListener(name, func);
};
MenuStore.prototype.removeEvents = function (element) {
if (!element.hasAttribute(html_classes_js_1.HtmlAttrs['COUNTER'])) {
}
removeEvents(element) {
if (!element.hasAttribute(HtmlAttrs['COUNTER'])) {
return;
}
var counter = element.getAttribute(html_classes_js_1.HtmlAttrs['COUNTER']);
let counter = element.getAttribute(HtmlAttrs['COUNTER']);
this.removeEvent(element, 'contextmenu', counter);
this.removeEvent(element, 'keydown', counter);
element.removeAttribute(html_classes_js_1.HtmlAttrs['COUNTER']);
};
MenuStore.prototype.removeEvent = function (element, name, counter) {
var attrName = html_classes_js_1.HtmlAttrs[name.toUpperCase() + 'FUNC'];
var menuFunc = this.attrMap[attrName + counter];
element.removeAttribute(HtmlAttrs['COUNTER']);
}
removeEvent(element, name, counter) {
let attrName = HtmlAttrs[name.toUpperCase() + 'FUNC'];
let menuFunc = this.attrMap[attrName + counter];
element.removeEventListener(name, menuFunc);
};
MenuStore.prototype.keydown = function (event) {
if (event.keyCode === key_navigatable_js_1.KEY.SPACE) {
}
keydown(event) {
if (event.keyCode === KEY.SPACE) {
this.menu.post(event);

@@ -215,6 +175,4 @@ event.preventDefault();

}
};
return MenuStore;
}());
exports.MenuStore = MenuStore;
}
}
//# sourceMappingURL=menu_store.js.map

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuUtil = void 0;
var MenuUtil;
export var MenuUtil;
(function (MenuUtil) {
function close(item) {
var menu = item.menu;
let menu = item.menu;
if (menu.baseMenu) {

@@ -17,4 +14,4 @@ menu.baseMenu.unpost();

function getActiveElement(item) {
var menu = item.menu;
var baseMenu = (menu.baseMenu ? menu.baseMenu : menu);
let menu = item.menu;
let baseMenu = (menu.baseMenu ? menu.baseMenu : menu);
return baseMenu.store.active;

@@ -31,4 +28,4 @@ }

MenuUtil.counter = counter;
var count = 0;
})(MenuUtil = exports.MenuUtil || (exports.MenuUtil = {}));
let count = 0;
})(MenuUtil || (MenuUtil = {}));
//# sourceMappingURL=menu_util.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=menu.js.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MOUSE = void 0;
exports.MOUSE = {
export const MOUSE = {
CLICK: 'click',

@@ -6,0 +3,0 @@ DBLCLICK: 'dblclick',

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

"use strict";
var __rest = (this && this.__rest) || function (s, e) {

@@ -13,122 +12,63 @@ var t = {};

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parser = void 0;
var item_command_js_1 = require("./item_command.js");
var context_menu_js_1 = require("./context_menu.js");
var variable_js_1 = require("./variable.js");
var item_checkbox_js_1 = require("./item_checkbox.js");
var item_combo_js_1 = require("./item_combo.js");
var item_label_js_1 = require("./item_label.js");
var item_radio_js_1 = require("./item_radio.js");
var item_submenu_js_1 = require("./item_submenu.js");
var item_rule_js_1 = require("./item_rule.js");
var item_slider_js_1 = require("./item_slider.js");
var sub_menu_js_1 = require("./sub_menu.js");
var selection_box_js_1 = require("./selection_box.js");
var parser_factory_js_1 = require("./parser_factory.js");
var Parser = (function () {
function Parser(init) {
var _this = this;
if (init === void 0) { init = []; }
import { Command } from './item_command.js';
import { ContextMenu } from './context_menu.js';
import { Variable } from './variable.js';
import { Checkbox } from './item_checkbox.js';
import { Combo } from './item_combo.js';
import { Label } from './item_label.js';
import { Radio } from './item_radio.js';
import { Submenu } from './item_submenu.js';
import { Rule } from './item_rule.js';
import { Slider } from './item_slider.js';
import { SubMenu } from './sub_menu.js';
import { SelectionMenu, SelectionBox } from './selection_box.js';
import { ParserFactory } from './parser_factory.js';
export class Parser {
constructor(init = []) {
this._initList = [
['command', item_command_js_1.Command.fromJson.bind(item_command_js_1.Command)],
['checkbox', item_checkbox_js_1.Checkbox.fromJson.bind(item_checkbox_js_1.Checkbox)],
['combo', item_combo_js_1.Combo.fromJson.bind(item_combo_js_1.Combo)],
['slider', item_slider_js_1.Slider.fromJson.bind(item_slider_js_1.Slider)],
['label', item_label_js_1.Label.fromJson.bind(item_label_js_1.Label)],
['radio', item_radio_js_1.Radio.fromJson.bind(item_radio_js_1.Radio)],
['rule', item_rule_js_1.Rule.fromJson.bind(item_rule_js_1.Rule)],
['submenu', item_submenu_js_1.Submenu.fromJson.bind(item_submenu_js_1.Submenu)],
['contextMenu', context_menu_js_1.ContextMenu.fromJson.bind(context_menu_js_1.ContextMenu)],
['subMenu', sub_menu_js_1.SubMenu.fromJson.bind(sub_menu_js_1.SubMenu)],
['variable', variable_js_1.Variable.fromJson.bind(variable_js_1.Variable)],
['command', Command.fromJson.bind(Command)],
['checkbox', Checkbox.fromJson.bind(Checkbox)],
['combo', Combo.fromJson.bind(Combo)],
['slider', Slider.fromJson.bind(Slider)],
['label', Label.fromJson.bind(Label)],
['radio', Radio.fromJson.bind(Radio)],
['rule', Rule.fromJson.bind(Rule)],
['submenu', Submenu.fromJson.bind(Submenu)],
['contextMenu', ContextMenu.fromJson.bind(ContextMenu)],
['subMenu', SubMenu.fromJson.bind(SubMenu)],
['variable', Variable.fromJson.bind(Variable)],
['items', this.items.bind(this)],
['selectionMenu', selection_box_js_1.SelectionMenu.fromJson.bind(selection_box_js_1.SelectionMenu)],
['selectionBox', selection_box_js_1.SelectionBox.fromJson.bind(selection_box_js_1.SelectionBox)]
['selectionMenu', SelectionMenu.fromJson.bind(SelectionMenu)],
['selectionBox', SelectionBox.fromJson.bind(SelectionBox)]
];
this._factory = new parser_factory_js_1.ParserFactory(this._initList);
init.forEach(function (_a) {
var _b = __read(_a, 2), x = _b[0], y = _b[1];
return _this.factory.add(x, y);
});
this._factory = new ParserFactory(this._initList);
init.forEach(([x, y]) => this.factory.add(x, y));
}
Object.defineProperty(Parser.prototype, "factory", {
get: function () {
return this._factory;
},
enumerable: false,
configurable: true
});
Parser.prototype.items = function (_factory, its, ctxt) {
var e_1, _a;
var hidden = [];
try {
for (var its_1 = __values(its), its_1_1 = its_1.next(); !its_1_1.done; its_1_1 = its_1.next()) {
var item = its_1_1.value;
var entry = this.parse(item, ctxt);
if (!entry) {
continue;
}
ctxt.items.push(entry);
if (item.disabled) {
entry.disable();
}
if (item.hidden) {
hidden.push(entry);
}
get factory() {
return this._factory;
}
items(_factory, its, ctxt) {
let hidden = [];
for (let item of its) {
let entry = this.parse(item, ctxt);
if (!entry) {
continue;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (its_1_1 && !its_1_1.done && (_a = its_1.return)) _a.call(its_1);
ctxt.items.push(entry);
if (item.disabled) {
entry.disable();
}
finally { if (e_1) throw e_1.error; }
if (item.hidden) {
hidden.push(entry);
}
}
hidden.forEach(function (x) { return x.hide(); });
hidden.forEach(x => x.hide());
return ctxt.items;
};
Parser.prototype.parse = function (_a) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
var kind = _a.type, json = __rest(_a, ["type"]);
var func = this.factory.get(kind);
return func ? func.apply(void 0, __spread([this.factory, json], rest)) : null;
};
return Parser;
}());
exports.Parser = Parser;
}
parse(_a, ...rest) {
var { type: kind } = _a, json = __rest(_a, ["type"]);
let func = this.factory.get(kind);
return func ? func(this.factory, json, ...rest) : null;
}
}
//# sourceMappingURL=parse.js.map

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

export declare type ParseMethod = (factory: ParserFactory, json: any, ...aux: any[]) => any;
export type ParseMethod = (factory: ParserFactory, json: any, ...aux: any[]) => any;
export declare class ParserFactory {

@@ -3,0 +3,0 @@ private _parser;

@@ -1,17 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserFactory = void 0;
var ParserFactory = (function () {
function ParserFactory(init) {
export class ParserFactory {
constructor(init) {
this._parser = new Map(init);
}
ParserFactory.prototype.get = function (name) {
get(name) {
return this._parser.get(name);
};
ParserFactory.prototype.add = function (name, method) {
}
add(name, method) {
this._parser.set(name, method);
};
return ParserFactory;
}());
exports.ParserFactory = ParserFactory;
}
}
//# sourceMappingURL=parser_factory.js.map

@@ -1,49 +0,31 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Popup = void 0;
var abstract_postable_js_1 = require("./abstract_postable.js");
var Popup = (function (_super) {
__extends(Popup, _super);
function Popup(title, content) {
var _this = _super.call(this) || this;
_this.title = title;
_this.window = null;
_this.localSettings = {
import { AbstractPostable } from './abstract_postable.js';
class Popup extends AbstractPostable {
static fromJson() {
}
constructor(title, content) {
super();
this.title = title;
this.window = null;
this.localSettings = {
left: Math.round((screen.width - 400) / 2),
top: Math.round((screen.height - 300) / 3)
};
_this.windowList = [];
_this.mobileFlag = false;
_this.active = null;
_this.content = content || function () { return ''; };
return _this;
this.windowList = [];
this.mobileFlag = false;
this.active = null;
this.content = content || function () { return ''; };
}
Popup.fromJson = function () {
};
Popup.prototype.attachMenu = function (menu) {
attachMenu(menu) {
this.menu = menu;
};
Popup.prototype.post = function () {
}
post() {
this.display();
};
Popup.prototype.display = function () {
}
display() {
this.active = this.menu.store.active;
var settings = [];
for (var setting in Popup.popupSettings) {
let settings = [];
for (let setting in Popup.popupSettings) {
settings.push(setting + '=' + Popup.popupSettings[setting]);
}
for (var setting in this.localSettings) {
for (let setting in this.localSettings) {
settings.push(setting + '=' + this.localSettings[setting]);

@@ -53,3 +35,3 @@ }

this.windowList.push(this.window);
var doc = this.window.document;
let doc = this.window.document;
if (this.mobileFlag) {

@@ -77,44 +59,43 @@ doc.open();

}
};
Popup.prototype.unpost = function () {
this.windowList.forEach(function (x) { return x.close(); });
}
unpost() {
this.windowList.forEach(x => x.close());
this.window = null;
};
Popup.prototype.generateContent = function () {
}
generateContent() {
return this.content(this.active);
};
Popup.prototype.resize = function () {
var table = this.window.document.body.firstChild;
var H = (this.window.outerHeight - this.window.innerHeight) || 30;
var W = (this.window.outerWidth - this.window.innerWidth) || 30;
}
resize() {
let table = this.window.document.body.firstChild;
let H = (this.window.outerHeight - this.window.innerHeight) || 30;
let W = (this.window.outerWidth - this.window.innerWidth) || 30;
W = Math.max(140, Math.min(Math.floor(.5 * this.window.screen.width), table.offsetWidth + W + 25));
H = Math.max(40, Math.min(Math.floor(.5 * this.window.screen.height), table.offsetHeight + H + 25));
this.window.resizeTo(W, H);
var bb = this.active.getBoundingClientRect();
let bb = this.active.getBoundingClientRect();
if (bb) {
var x = Math.max(0, Math.min(bb.right - Math.floor(W / 2), this.window.screen.width - W - 20));
var y = Math.max(0, Math.min(bb.bottom - Math.floor(H / 2), this.window.screen.height - H - 20));
let x = Math.max(0, Math.min(bb.right - Math.floor(W / 2), this.window.screen.width - W - 20));
let y = Math.max(0, Math.min(bb.bottom - Math.floor(H / 2), this.window.screen.height - H - 20));
this.window.moveTo(x, y);
}
this.active = null;
};
Popup.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
Popup.popupSettings = {
status: 'no',
toolbar: 'no',
locationbar: 'no',
menubar: 'no',
directories: 'no',
personalbar: 'no',
resizable: 'yes',
scrollbars: 'yes',
width: 400,
height: 300,
};
return Popup;
}(abstract_postable_js_1.AbstractPostable));
exports.Popup = Popup;
}
}
Popup.popupSettings = {
status: 'no',
toolbar: 'no',
locationbar: 'no',
menubar: 'no',
directories: 'no',
personalbar: 'no',
resizable: 'yes',
scrollbars: 'yes',
width: 400,
height: 300,
};
export { Popup };
//# sourceMappingURL=popup.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=postable.js.map

@@ -1,131 +0,83 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
import { MenuUtil } from './menu_util.js';
import { HtmlClasses } from './html_classes.js';
import { AbstractMenu } from './abstract_menu.js';
import { Info } from './info.js';
export class SelectionMenu extends AbstractMenu {
static fromJson(factory, { title: title, values: values, variable: variable }, sb) {
let selection = new this(sb);
let tit = factory.get('label')(factory, { content: title || '', id: title || 'id' }, selection);
let rul = factory.get('rule')(factory, {}, selection);
let radios = values.map(x => factory.get('radio')(factory, { content: x, variable: variable, id: x }, selection));
let items = [tit, rul].concat(radios);
selection.items = items;
return selection;
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
constructor(anchor) {
super();
this.anchor = anchor;
this.className = HtmlClasses['SELECTIONMENU'];
this.variablePool = this.anchor.menu.pool;
this.baseMenu = this.anchor.menu;
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectionBox = exports.SelectionMenu = void 0;
var menu_util_js_1 = require("./menu_util.js");
var html_classes_js_1 = require("./html_classes.js");
var abstract_menu_js_1 = require("./abstract_menu.js");
var info_js_1 = require("./info.js");
var SelectionMenu = (function (_super) {
__extends(SelectionMenu, _super);
function SelectionMenu(anchor) {
var _this = _super.call(this) || this;
_this.anchor = anchor;
_this.className = html_classes_js_1.HtmlClasses['SELECTIONMENU'];
_this.variablePool = _this.anchor.menu.pool;
_this.baseMenu = _this.anchor.menu;
return _this;
generateHtml() {
super.generateHtml();
this.items.forEach(item => item.html.classList.add(HtmlClasses['SELECTIONITEM']));
}
SelectionMenu.fromJson = function (factory, _a, sb) {
var title = _a.title, values = _a.values, variable = _a.variable;
var selection = new this(sb);
var tit = factory.get('label')(factory, { content: title || '', id: title || 'id' }, selection);
var rul = factory.get('rule')(factory, {}, selection);
var radios = values.map(function (x) { return factory.get('radio')(factory, { content: x, variable: variable, id: x }, selection); });
var items = [tit, rul].concat(radios);
selection.items = items;
return selection;
};
SelectionMenu.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
this.items.forEach(function (item) { return item.html.classList.add(html_classes_js_1.HtmlClasses['SELECTIONITEM']); });
};
SelectionMenu.prototype.display = function () { };
SelectionMenu.prototype.right = function (event) {
display() { }
right(event) {
this.anchor.right(event);
};
SelectionMenu.prototype.left = function (event) {
}
left(event) {
this.anchor.left(event);
};
return SelectionMenu;
}(abstract_menu_js_1.AbstractMenu));
exports.SelectionMenu = SelectionMenu;
var SelectionBox = (function (_super) {
__extends(SelectionBox, _super);
function SelectionBox(title, signature, style, grid) {
if (style === void 0) { style = "none"; }
if (grid === void 0) { grid = "vertical"; }
var _this = _super.call(this, title, null, signature) || this;
_this.style = style;
_this.grid = grid;
_this._selections = [];
_this.prefix = 'ctxt-selection';
_this._balanced = true;
return _this;
}
SelectionBox.fromJson = function (factory, _a, ctxt) {
var title = _a.title, signature = _a.signature, selections = _a.selections, order = _a.order, grid = _a.grid;
var sb = new this(title, signature, order, grid);
}
class SelectionBox extends Info {
static fromJson(factory, { title: title, signature: signature, selections: selections, order: order, grid: grid }, ctxt) {
let sb = new this(title, signature, order, grid);
sb.attachMenu(ctxt);
var sels = selections.map(function (x) { return factory.get('selectionMenu')(factory, x, sb); });
let sels = selections.map(x => factory.get('selectionMenu')(factory, x, sb));
sb.selections = sels;
return sb;
};
SelectionBox.prototype.attachMenu = function (menu) {
}
constructor(title, signature, style = "none", grid = "vertical") {
super(title, null, signature);
this.style = style;
this.grid = grid;
this._selections = [];
this.prefix = 'ctxt-selection';
this._balanced = true;
}
attachMenu(menu) {
this.menu = menu;
};
Object.defineProperty(SelectionBox.prototype, "selections", {
get: function () {
return this._selections;
},
set: function (selections) {
var _this = this;
this._selections = [];
selections.forEach(function (x) { return _this.addSelection(x); });
},
enumerable: false,
configurable: true
});
SelectionBox.prototype.addSelection = function (selection) {
}
get selections() {
return this._selections;
}
set selections(selections) {
this._selections = [];
selections.forEach(x => this.addSelection(x));
}
addSelection(selection) {
selection.anchor = this;
this._selections.push(selection);
};
SelectionBox.prototype.rowDiv = function (sels) {
var _this = this;
var div = document.createElement('div');
}
rowDiv(sels) {
let div = document.createElement('div');
this.contentDiv.appendChild(div);
var rects = sels.map(function (sel) {
let rects = sels.map(sel => {
div.appendChild(sel.html);
if (!sel.html.id) {
sel.html.id = _this.prefix + menu_util_js_1.MenuUtil.counter();
sel.html.id = this.prefix + MenuUtil.counter();
}
return sel.html.getBoundingClientRect();
});
var column = rects.map(function (x) { return x.width; });
var width = column.reduce(function (x, y) { return x + y; }, 0);
var height = rects.reduce(function (x, y) { return Math.max(x, y.height); }, 0);
div.classList.add(html_classes_js_1.HtmlClasses['SELECTIONDIVIDER']);
let column = rects.map(x => x.width);
let width = column.reduce((x, y) => x + y, 0);
let height = rects.reduce((x, y) => Math.max(x, y.height), 0);
div.classList.add(HtmlClasses['SELECTIONDIVIDER']);
div.setAttribute('style', 'height: ' + height + 'px;');
return [div, width, height, column];
};
SelectionBox.prototype.display = function () {
_super.prototype.display.call(this);
}
display() {
super.display();
this.order();

@@ -135,25 +87,21 @@ if (!this.selections.length) {

}
var outerDivs = [];
var maxWidth = 0;
var balancedColumn = [];
var chunks = this.getChunkSize(this.selections.length);
var _loop_1 = function (i) {
var sels = this_1.selections.slice(i, i + chunks);
var _a = __read(this_1.rowDiv(sels), 4), div = _a[0], width = _a[1], height = _a[2], column = _a[3];
let outerDivs = [];
let maxWidth = 0;
let balancedColumn = [];
let chunks = this.getChunkSize(this.selections.length);
for (let i = 0; i < this.selections.length; i += chunks) {
let sels = this.selections.slice(i, i + chunks);
let [div, width, height, column] = this.rowDiv(sels);
outerDivs.push(div);
maxWidth = Math.max(maxWidth, width);
sels.forEach(function (sel) { return sel.html.style.height = height + 'px'; });
balancedColumn = this_1.combineColumn(balancedColumn, column);
};
var this_1 = this;
for (var i = 0; i < this.selections.length; i += chunks) {
_loop_1(i);
sels.forEach(sel => sel.html.style.height = height + 'px');
balancedColumn = this.combineColumn(balancedColumn, column);
}
if (this._balanced) {
this.balanceColumn(outerDivs, balancedColumn);
maxWidth = balancedColumn.reduce(function (x, y) { return x + y; }, 20);
maxWidth = balancedColumn.reduce((x, y) => x + y, 20);
}
outerDivs.forEach(function (div) { return div.style.width = maxWidth + 'px'; });
};
SelectionBox.prototype.getChunkSize = function (size) {
outerDivs.forEach(div => div.style.width = maxWidth + 'px');
}
getChunkSize(size) {
switch (this.grid) {

@@ -168,14 +116,14 @@ case "square":

}
};
SelectionBox.prototype.balanceColumn = function (divs, column) {
divs.forEach(function (div) {
var children = Array.from(div.children);
for (var i = 0, child = void 0; child = children[i]; i++) {
}
balanceColumn(divs, column) {
divs.forEach(div => {
let children = Array.from(div.children);
for (let i = 0, child; child = children[i]; i++) {
child.style.width = column[i] + 'px';
}
});
};
SelectionBox.prototype.combineColumn = function (col1, col2) {
var result = [];
var i = 0;
}
combineColumn(col1, col2) {
let result = [];
let i = 0;
while (col1[i] || col2[i]) {

@@ -195,71 +143,64 @@ if (!col1[i]) {

return result;
};
SelectionBox.prototype.left = function (event) {
var _this = this;
this.move(event, function (index) {
return (index === 0 ? _this.selections.length : index) - 1;
});
};
SelectionBox.prototype.right = function (event) {
var _this = this;
this.move(event, function (index) {
return index === _this.selections.length - 1 ? 0 : index + 1;
});
};
SelectionBox.prototype.generateHtml = function () {
_super.prototype.generateHtml.call(this);
this.html.classList.add(html_classes_js_1.HtmlClasses['SELECTION']);
};
SelectionBox.prototype.generateContent = function () {
var div = _super.prototype.generateContent.call(this);
div.classList.add(html_classes_js_1.HtmlClasses['SELECTIONBOX']);
}
left(event) {
this.move(event, (index) => (index === 0 ? this.selections.length : index) - 1);
}
right(event) {
this.move(event, (index) => index === this.selections.length - 1 ? 0 : index + 1);
}
generateHtml() {
super.generateHtml();
this.html.classList.add(HtmlClasses['SELECTION']);
}
generateContent() {
let div = super.generateContent();
div.classList.add(HtmlClasses['SELECTIONBOX']);
div.removeAttribute('tabindex');
return div;
};
SelectionBox.prototype.findSelection = function (event) {
var target = event.target;
var selection = null;
}
findSelection(event) {
let target = event.target;
let selection = null;
if (target.id) {
selection = this.selections.find(function (x) { return x.html.id === target.id; });
selection = this.selections.find(x => x.html.id === target.id);
}
if (!selection) {
var id_1 = target.parentElement.id;
selection = this.selections.find(function (x) { return x.html.id === id_1; });
let id = target.parentElement.id;
selection = this.selections.find(x => x.html.id === id);
}
return selection;
};
SelectionBox.prototype.move = function (event, isNext) {
var selection = this.findSelection(event);
}
move(event, isNext) {
let selection = this.findSelection(event);
if (selection.focused) {
selection.focused.unfocus();
}
var index = this.selections.indexOf(selection);
var next = isNext(index);
let index = this.selections.indexOf(selection);
let next = isNext(index);
this.selections[next].focus();
};
SelectionBox.prototype.order = function () {
}
order() {
this.selections.sort(SelectionBox.orderMethod.get(this.style));
};
SelectionBox.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
SelectionBox.chunkSize = 4;
SelectionBox.orderMethod = new Map([
["alphabetical", function (x, y) { return x.items[0].content.localeCompare(y.items[0].content); }],
["none", function (_x, _y) { return 1; }],
["decreasing", function (x, y) {
var xl = x.items.length;
var yl = y.items.length;
return (xl < yl) ? 1 : ((yl < xl) ? -1 : 0);
}],
["increasing", function (x, y) {
var xl = x.items.length;
var yl = y.items.length;
return (xl < yl) ? -1 : ((yl < xl) ? 1 : 0);
}],
]);
return SelectionBox;
}(info_js_1.Info));
exports.SelectionBox = SelectionBox;
}
}
SelectionBox.chunkSize = 4;
SelectionBox.orderMethod = new Map([
["alphabetical", (x, y) => x.items[0].content.localeCompare(y.items[0].content)],
["none", (_x, _y) => 1],
["decreasing", (x, y) => {
let xl = x.items.length;
let yl = y.items.length;
return (xl < yl) ? 1 : ((yl < xl) ? -1 : 0);
}],
["increasing", (x, y) => {
let xl = x.items.length;
let yl = y.items.length;
return (xl < yl) ? -1 : ((yl < xl) ? 1 : 0);
}],
]);
export { SelectionBox };
//# sourceMappingURL=selection_box.js.map

@@ -1,54 +0,31 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubMenu = void 0;
var abstract_menu_js_1 = require("./abstract_menu.js");
var SubMenu = (function (_super) {
__extends(SubMenu, _super);
function SubMenu(_anchor) {
var _this = _super.call(this) || this;
_this._anchor = _anchor;
_this.variablePool = _this.anchor.menu.pool;
_this.setBaseMenu();
return _this;
}
SubMenu.fromJson = function (factory, _a, anchor) {
var its = _a.items;
var submenu = new this(anchor);
var itemList = factory.get('items')(factory, its, submenu);
import { AbstractMenu } from './abstract_menu.js';
export class SubMenu extends AbstractMenu {
static fromJson(factory, { items: its }, anchor) {
const submenu = new this(anchor);
const itemList = factory.get('items')(factory, its, submenu);
submenu.items = itemList;
return submenu;
};
Object.defineProperty(SubMenu.prototype, "anchor", {
get: function () {
return this._anchor;
},
enumerable: false,
configurable: true
});
SubMenu.prototype.post = function () {
}
constructor(_anchor) {
super();
this._anchor = _anchor;
this.variablePool = this.anchor.menu.pool;
this.setBaseMenu();
}
get anchor() {
return this._anchor;
}
post() {
if (!this.anchor.menu.isPosted()) {
return;
}
var mobileFlag = false;
var rtlFlag = false;
var margin = 5;
var parent = this.anchor.html;
var menu = this.html;
var base = this.baseMenu.frame;
var mw = parent.offsetWidth;
var x = (mobileFlag ? 30 : mw - 2);
var y = 0;
let mobileFlag = false;
let rtlFlag = false;
let margin = 5;
let parent = this.anchor.html;
let menu = this.html;
let base = this.baseMenu.frame;
let mw = parent.offsetWidth;
let x = (mobileFlag ? 30 : mw - 2);
let y = 0;
while (parent && parent !== base) {

@@ -66,9 +43,9 @@ x += parent.offsetLeft;

}
_super.prototype.post.call(this, x, y);
};
SubMenu.prototype.display = function () {
super.post(x, y);
}
display() {
this.baseMenu.frame.appendChild(this.html);
};
SubMenu.prototype.setBaseMenu = function () {
var menu = this;
}
setBaseMenu() {
let menu = this;
do {

@@ -78,14 +55,12 @@ menu = menu.anchor.menu;

this.baseMenu = menu;
};
SubMenu.prototype.left = function (_event) {
}
left(_event) {
this.focused = null;
this.anchor.focus();
};
SubMenu.prototype.toJson = function () {
}
toJson() {
return { type: ''
};
};
return SubMenu;
}(abstract_menu_js_1.AbstractMenu));
exports.SubMenu = SubMenu;
}
}
//# sourceMappingURL=sub_menu.js.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TOUCH = void 0;
exports.TOUCH = {
export const TOUCH = {
START: 'touchstart',

@@ -6,0 +3,0 @@ MOVE: 'touchmove',

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=variable_item.js.map

@@ -1,25 +0,20 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariablePool = void 0;
var VariablePool = (function () {
function VariablePool() {
export class VariablePool {
constructor() {
this.pool = {};
}
VariablePool.prototype.insert = function (variable) {
insert(variable) {
this.pool[variable.name] = variable;
};
VariablePool.prototype.lookup = function (name) {
}
lookup(name) {
return this.pool[name];
};
VariablePool.prototype.remove = function (name) {
}
remove(name) {
delete this.pool[name];
};
VariablePool.prototype.update = function () {
for (var variable in this.pool) {
}
update() {
for (let variable in this.pool) {
this.pool[variable].update();
}
};
return VariablePool;
}());
exports.VariablePool = VariablePool;
}
}
//# sourceMappingURL=variable_pool.js.map

@@ -1,7 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Variable = void 0;
var menu_util_js_1 = require("./menu_util.js");
var Variable = (function () {
function Variable(_name, getter, setter) {
import { MenuUtil } from './menu_util.js';
export class Variable {
static fromJson(_factory, { name: name, getter: getter, setter: setter }, pool) {
const variable = new this(name, getter, setter);
pool.insert(variable);
}
constructor(_name, getter, setter) {
this._name = _name;

@@ -12,15 +13,6 @@ this.getter = getter;

}
Variable.fromJson = function (_factory, _a, pool) {
var name = _a.name, getter = _a.getter, setter = _a.setter;
var variable = new this(name, getter, setter);
pool.insert(variable);
};
Object.defineProperty(Variable.prototype, "name", {
get: function () {
return this._name;
},
enumerable: false,
configurable: true
});
Variable.prototype.getValue = function (node) {
get name() {
return this._name;
}
getValue(node) {
try {

@@ -30,7 +22,7 @@ return this.getter(node);

catch (e) {
menu_util_js_1.MenuUtil.error(e, 'Command of variable ' + this.name + ' failed.');
MenuUtil.error(e, 'Command of variable ' + this.name + ' failed.');
return null;
}
};
Variable.prototype.setValue = function (value, node) {
}
setValue(value, node) {
try {

@@ -40,27 +32,27 @@ this.setter(value, node);

catch (e) {
menu_util_js_1.MenuUtil.error(e, 'Command of variable ' + this.name + ' failed.');
MenuUtil.error(e, 'Command of variable ' + this.name + ' failed.');
}
this.update();
};
Variable.prototype.register = function (item) {
}
register(item) {
if (this.items.indexOf(item) === -1) {
this.items.push(item);
}
};
Variable.prototype.unregister = function (item) {
var index = this.items.indexOf(item);
}
unregister(item) {
let index = this.items.indexOf(item);
if (index !== -1) {
this.items.splice(index, 1);
}
};
Variable.prototype.update = function () {
this.items.forEach(function (x) { return x.update(); });
};
Variable.prototype.registerCallback = function (func) {
this.items.forEach(function (x) { return x.registerCallback(func); });
};
Variable.prototype.unregisterCallback = function (func) {
this.items.forEach(function (x) { return x.unregisterCallback(func); });
};
Variable.prototype.toJson = function () {
}
update() {
this.items.forEach(x => x.update());
}
registerCallback(func) {
this.items.forEach(x => x.registerCallback(func));
}
unregisterCallback(func) {
this.items.forEach(x => x.unregisterCallback(func));
}
toJson() {
return { type: 'variable',

@@ -70,6 +62,4 @@ name: this.name,

setter: this.setter.toString() };
};
return Variable;
}());
exports.Variable = Variable;
}
}
//# sourceMappingURL=variable.js.map
{
"name": "mj-context-menu",
"version": "0.6.1",
"version": "0.7.0",
"description": "A generic context menu",
"main": "dist/ContextMenu.js",
"scripts": {
"build": "./node_modules/.bin/tsc; ./node_modules/.bin/webpack",
"prepare": "npx rimraf js; npx rimraf dist; ./node_modules/.bin/tsc; ./node_modules/.bin/webpack"
"es5": "./node_modules/.bin/tsc --module commonjs --outDir cjs",
"es6": "./node_modules/.bin/tsc --module es6 --outDir js",
"build": "npm run es5; npm run es6; ./node_modules/.bin/webpack",
"clean": "npx rimraf cjs; npx rimraf js; npx rimraf dist",
"prepare": "npm run clean; npm run build"
},

@@ -28,12 +31,12 @@ "maintainers": [

"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"babel-loader": "^8.1.0",
"terser-webpack-plugin": "^4.1.0",
"@babel/core": "^7.21.8",
"@babel/preset-env": "^7.21.5",
"babel-loader": "^9.1.2",
"terser-webpack-plugin": "^5.3.8",
"tslint": "^6.1.3",
"tslint-jsdoc-rules": "^0.2.0",
"tslint-unix-formatter": "^0.2.0",
"typescript": "^3.*",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
"typescript": "^5.*",
"webpack": "^5.82.0",
"webpack-cli": "^5.1.1"
},

@@ -44,4 +47,6 @@ "files": [

"js",
"cjs",
"dist"
]
],
"type": "module"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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