UNPKG

@hscmap/vue-menu

Version:

Vue component for menu & contextmenu

1 lines 36.2 kB
(()=>{"use strict";var t={902:(t,e,n)=>{n.d(e,{Z:()=>u});var o=n(81),r=n.n(o),i=n(645),a=n.n(i)()(r());a.push([t.id,".menu[data-v-7fd2e88a]{font-family:sans-serif;border-radius:4pt;cursor:default;user-select:none;overflow:auto}.fixed[data-v-7fd2e88a]{position:fixed;top:0;left:0}.fade-leave-active[data-v-7fd2e88a]{transition:opacity .2s ease}.fade-leave-to[data-v-7fd2e88a]{opacity:0}",""]);const u=a},236:(t,e,n)=>{n.d(e,{Z:()=>u});var o=n(81),r=n.n(o),i=n(645),a=n.n(i)()(r());a.push([t.id,".menubar[data-v-56fd8264]{display:table;font-family:sans-serif;padding:0 .5em;user-select:none;cursor:default}",""]);const u=a},439:(t,e,n)=>{n.d(e,{Z:()=>u});var o=n(81),r=n.n(o),i=n(645),a=n.n(i)()(r());a.push([t.id,".menubaritem[data-v-72252ca1]{display:table-cell;padding:6pt .5em 4pt .5em}",""]);const u=a},248:(t,e,n)=>{n.d(e,{Z:()=>u});var o=n(81),r=n.n(o),i=n(645),a=n.n(i)()(r());a.push([t.id,".menuitem[data-v-717f89e4]{display:flex;align-items:baseline;padding:2px 8pt 2px 4pt;white-space:nowrap}.label[data-v-717f89e4]{flex-grow:1}",""]);const u=a},857:(t,e,n)=>{n.d(e,{Z:()=>u});var o=n(81),r=n.n(o),i=n(645),a=n.n(i)()(r());a.push([t.id,".separator[data-v-469f5cdc]{height:1pt;margin:4pt 0}",""]);const u=a},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,o,r,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(o)for(var u=0;u<this.length;u++){var c=this[u][0];null!=c&&(a[c]=!0)}for(var s=0;s<t.length;s++){var l=[].concat(t[s]);o&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),e.push(l))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var i={},a=[],u=0;u<t.length;u++){var c=t[u],s=o.base?c[0]+o.base:c[0],l=i[s]||0,p="".concat(s," ").concat(l);i[s]=l+1;var f=n(p),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)e[f].references++,e[f].updater(d);else{var h=r(d,o);o.byIndex=u,e.splice(u,0,{identifier:p,updater:h,references:1})}a.push(p)}return a}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var i=o(t=t||[],r=r||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var u=n(i[a]);e[u].references--}for(var c=o(t,r),s=0;s<i.length;s++){var l=n(i[s]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=c}}},569:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},118:(t,e,n)=>{n.r(e),n.d(e,{Buttonmenu:()=>St,Contextmenu:()=>_t,Menu:()=>z,MenuType:()=>X,Menubar:()=>q,MenubarType:()=>_,Menubaritem:()=>lt,Menuitem:()=>Vt,MenuitemType:()=>Dt,Separator:()=>zt,StyleBlack:()=>h,StyleFactory:()=>p,StyleMetal:()=>v,StyleWhite:()=>y,install:()=>Jt});var o=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"menubar",style:t.menuStyle.menubar,on:{mousedown:function(e){return e.preventDefault(),t.mousedown.apply(null,arguments)}}},[t._t("default")],2)};o._withStripped=!0;const r=require("vue-property-decorator");var i=function(){function t(t){this.menuitem=t}return t.type="menuitemactivate",t}(),a=function(){function t(t){void 0===t&&(t=!1),this.fromChild=t}return t.type="menuclose",t}(),u=function(){function t(t){this.menubaritem=t}return t.type="menubaritemactivate",t}(),c=function(){function t(){}return t.type="menubardeactivate",t}();function s(t,e,n){var o=function(t){n(t),r()},r=function(){t.removeEventListener(e,o)};return t.addEventListener(e,o),r}var l="@hscmap/vue-menu/menuStyle";function p(t){return{provide:function(){var e;return null==t.animation&&(t.animation=!0),(e={})[l]=t,e},render:function(t){return t("div",this.$slots.default)}}}var f,d,h=p({menu:f={backgroundColor:"rgba(31, 31, 31, 0.9)",color:"white",boxShadow:"0 0 4pt rgba(255, 255, 255, 0.25)"},menubar:f,separator:{backgroundColor:"rgba(127, 127, 127, 0.5)"},active:{backgroundColor:"rgba(127, 127, 127, 0.75)"},disabled:{opacity:"0.5"},animation:!0}),y=p(function(){var t={backgroundColor:"rgba(255, 255, 255, 0.9)",color:"black",boxShadow:"0 2pt 6pt rgba(0, 0, 0, 0.5)"};return{menu:t,menubar:t,separator:{backgroundColor:"rgba(127, 127, 127, 0.5)"},active:{backgroundColor:"rgba(127, 127, 127, 0.75)",color:"#fff"},disabled:{opacity:"0.5"},animation:!0}}()),v=p({menu:{backgroundColor:"rgb(215, 215, 215)",color:"black",boxShadow:"0 2pt 6pt rgba(0, 0, 0, 0.5)"},menubar:{background:"linear-gradient(to bottom, rgb(215, 215, 215), rgb(191, 191, 191))",color:"black",boxShadow:"0 2pt 6pt rgba(0, 0, 0, 0.5)"},separator:{backgroundColor:"rgba(127, 127, 127, 0.5)"},active:{backgroundColor:"rgba(127, 127, 127, 0.75)",color:"#fff"},disabled:{opacity:"0.5"},animation:!0}),m=(d=function(t,e){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},d(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),b=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},g="@hscmap/vue-menu/menubar",_=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.active=!1,e}return m(e,t),e.prototype.deactivate=function(){this.active=!1,this.$emit(c.type,new c),this.clearCancellers()},e.prototype.beforeDestroy=function(){this.clearCancellers()},e.prototype.mousedown=function(t){var e=this;if(this.active)return this.deactivate();this.active=!0,this.clearCancellers(),this.cancelMouseup=s(document,"mouseup",(function(n){e.cancelMouseup=void 0,n.timeStamp-t.timeStamp>=500?e.deactivate():e.cancelMousedown=s(document,"mousedown",(function(){e.cancelMousedown=void 0,e.deactivate()}))}))},e.prototype.clearCancellers=function(){this.cancelMouseup&&this.cancelMouseup(),this.cancelMousedown&&this.cancelMousedown()},b([(0,r.Inject)(l)],e.prototype,"menuStyle",void 0),b([(0,r.Prop)({default:0})],e.prototype,"paddingTop",void 0),b([(0,r.Component)({provide:function(){var t;return(t={})[g]=this,t}})],e)}(r.Vue);const w=_;var O=n(379),x=n.n(O),M=n(795),P=n.n(M),S=n(569),j=n.n(S),C=n(565),k=n.n(C),T=n(216),$=n.n(T),E=n(589),R=n.n(E),Z=n(236),A={};function I(t,e,n,o,r,i,a,u){var c,s="function"==typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),o&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},s._ssrRegister=c):r&&(c=u?function(){r.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(s.functional){s._injectStyles=c;var l=s.render;s.render=function(t,e){return c.call(e),l(t,e)}}else{var p=s.beforeCreate;s.beforeCreate=p?[].concat(p,c):[c]}return{exports:t,options:s}}A.styleTagTransform=R(),A.setAttributes=k(),A.insert=j().bind(null,"head"),A.domAPI=P(),A.insertStyleElement=$(),x()(Z.Z,A),Z.Z&&Z.Z.locals&&Z.Z.locals;var D=I(w,o,[],!1,null,"56fd8264",null);D.options.__file="src/menubar/index.vue";const q=D.exports;var B=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"menubaritem",style:t.style,on:{mousedown:t.mousedown,mouseenter:t.mouseenter,mouseleave:t.mouseleave}},[n("div",{style:{paddingTop:t.paddingTop}}),t._v("\n "+t._s(t.label)+"\n "),n("x-menu",{ref:"menu"},[t._t("default")],2)],1)};B._withStripped=!0;var H=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"fixed"},[n("div",{ref:"wrapper",staticStyle:{position:"absolute"}},[n("transition",{attrs:{name:t.fade}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.isOpen,expression:"isOpen"}],ref:"menu",staticClass:"menu",style:t.style,on:{mousedown:function(t){t.stopPropagation(),t.preventDefault()},mouseup:function(t){t.stopPropagation()}}},[t._t("default")],2)])],1)])};H._withStripped=!0;var F=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),L=function(){return L=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},L.apply(this,arguments)},N=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},V="@hscmap/vue-menu/parentMenu",X=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isOpen=!1,e.fade="none",e.submenuDirection="right",e}return F(e,t),e.prototype.open=function(t,e,n){void 0===n&&(n="right"),this.setPosition(t,e,n),this.isOpen=!0},e.prototype.close=function(t,e){void 0===e&&(e=!1),this.isOpen&&(this.fade=t&&this.menuStyle.animation?"fade":"none",this.isOpen=!1,t||(this.menuElement().style.display="none"),this.$emit(a.type,new a(e))),e&&this.parentMenuitem&&this.parentMenuitem.parentMenu.close(t,!0)},e.prototype.setPosition=function(t,e,n){var o,r,i,a=this;t=Math.floor(t),e=Math.floor(e),o=[this.menuElement(),this.wrapperElement()],r=function(o){var r=o[0],i=o[1],u=r.getBoundingClientRect();r.style.maxHeight="".concat(window.innerHeight-8,"px"),i.style.left="".concat("right"==n?t:t-u.width+1,"px"),i.style.top="".concat(e,"px"),(u=r.getBoundingClientRect()).bottom>window.innerHeight&&(i.style.top="".concat(window.innerHeight-u.height,"px")),a.submenuDirection=n,u.right>window.innerWidth&&(a.submenuDirection="left",i.style.left="".concat(t-u.width-(a.parentMenuitem?a.parentMenuitem.$el.clientWidth:0),"px")),u.left<0&&(a.submenuDirection="right",i.style.left="".concat(t+(a.parentMenuitem?a.parentMenuitem.$el.clientWidth:0),"px"))},i=o.map((function(t){var e=t.style,n=e.display,o=e.visibility;return t.style.display="block",t.style.visibility="visible",{display:n,visibility:o}})),r(o),o.forEach((function(t,e){var n=i[e],o=n.display,r=n.visibility;t.style.display=o,t.style.visibility=r}))},e.prototype.menuElement=function(){return this.$refs.menu},e.prototype.wrapperElement=function(){return this.$refs.wrapper},Object.defineProperty(e.prototype,"style",{get:function(){return L(L({},this.menuStyle.menu),{padding:"".concat(4,"px 0")})},enumerable:!1,configurable:!0}),N([(0,r.Prop)()],e.prototype,"parentMenuitem",void 0),N([(0,r.Inject)(l)],e.prototype,"menuStyle",void 0),N([(0,r.Component)({provide:function(){var t;return(t={})[V]=this,t}})],e)}(r.Vue);const U=X;var W=n(902),G={};G.styleTagTransform=R(),G.setAttributes=k(),G.insert=j().bind(null,"head"),G.domAPI=P(),G.insertStyleElement=$(),x()(W.Z,G),W.Z&&W.Z.locals&&W.Z.locals;var K=I(U,H,[],!1,null,"7fd2e88a",null);K.options.__file="src/menu/index.vue";const z=K.exports;var J=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}))},Y=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},Q=new(function(){function t(){this.q=[],this.open=!0}return t.prototype.lock=function(t){return J(this,void 0,void 0,(function(){return Y(this,(function(e){switch(e.label){case 0:return this.q.push(t),[4,this.challenge()];case 1:return e.sent(),[2]}}))}))},t.prototype.challenge=function(){return J(this,void 0,void 0,(function(){return Y(this,(function(t){switch(t.label){case 0:if(!this.open)return[3,4];this.open=!1,t.label=1;case 1:return this.q.length>0?[4,this.q.shift()()]:[3,3];case 2:return t.sent(),[3,1];case 3:this.open=!0,t.label=4;case 4:return[2]}}))}))},t}()),tt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),et=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},nt=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}))},ot=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},rt="@hscmap/vue-menu/menubaritem",it=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hover=!1,e.isOpen=!1,e}return tt(e,t),e.prototype.mounted=function(){var t=this;this.menu().$on(a.type,(function(e){t.isOpen=!1,e.fromChild&&t.menubar.deactivate()})),this.menubar.$on(u.type,(function(e){if(t!=e.menubaritem){var n=t.menu();n&&n.close(!1)}})),this.menubar.$on(c.type,(function(e){var n=t.menu();n&&n.close(!0)}))},e.prototype.onMenuiatemFired=function(){var t=this;setTimeout((function(){t.hover=!1}),200)},Object.defineProperty(e.prototype,"style",{get:function(){return this.active?this.menuStyle.active:{}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddingTop",{get:function(){return"".concat(this.menubar.paddingTop,"px")},enumerable:!1,configurable:!0}),e.prototype.menu=function(){return this.$refs.menu},e.prototype.activate=function(){var t=this.$el.getBoundingClientRect();this.menu().open(t.left,t.bottom),this.menubar.$emit(u.type,new u(this)),this.isOpen=!0},e.prototype.mousedown=function(){var t=this;Q.lock((function(){return nt(t,void 0,void 0,(function(){return ot(this,(function(t){return this.activate(),[2]}))}))}))},e.prototype.mouseenter=function(){var t=this;Q.lock((function(){return nt(t,void 0,void 0,(function(){return ot(this,(function(t){return this.hover=!0,this.menubar.active&&this.activate(),[2]}))}))}))},e.prototype.mouseleave=function(){var t=this;Q.lock((function(){return nt(t,void 0,void 0,(function(){return ot(this,(function(t){return this.hover=!1,[2]}))}))}))},Object.defineProperty(e.prototype,"active",{get:function(){return this.hover||this.isOpen},enumerable:!1,configurable:!0}),et([(0,r.Prop)({type:String,required:!0})],e.prototype,"label",void 0),et([(0,r.Inject)(g)],e.prototype,"menubar",void 0),et([(0,r.Inject)(l)],e.prototype,"menuStyle",void 0),et([(0,r.Component)({components:{XMenu:z},provide:function(){var t;return(t={})[rt]=this,t}})],e)}(r.Vue);const at=it;var ut=n(439),ct={};ct.styleTagTransform=R(),ct.setAttributes=k(),ct.insert=j().bind(null,"head"),ct.domAPI=P(),ct.insertStyleElement=$(),x()(ut.Z,ct),ut.Z&&ut.Z.locals&&ut.Z.locals;var st=I(at,B,[],!1,null,"72252ca1",null);st.options.__file="src/menubaritem/index.vue";const lt=st.exports;var pt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{display:"inline-block"},on:{contextmenu:t.openMenu}},[t._t("default"),t._v(" "),n("x-menu",{ref:"menu",style:t.menuStyle},[t._t("contextmenu")],2)],2)};pt._withStripped=!0;var ft=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},ht=[],yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ft(e,t),Object.defineProperty(e.prototype,"menuStyle",{get:function(){return null==this.menuZIndex?{}:{zIndex:String(this.menuZIndex)}},enumerable:!1,configurable:!0}),e.prototype.menu=function(){return this.$refs.menu},e.prototype.beforeDestroy=function(){this.clearCancellers()},e.prototype.openMenu=function(t){var e=this;if(t.preventDefault(),function(){for(;ht.length>0;)ht.pop().close()}(),ht.push(this),this.clearCancellers(),this.menu().isOpen)return this.close();this.cancelMouseup=s(document,"mouseup",(function(n){e.cancelMouseup=void 0,n.timeStamp-t.timeStamp>=500?e.close():e.cancelMousedown=s(document,"mousedown",(function(t){e.cancelMousedown=void 0,function(t){return 2==t.button||t.ctrlKey}(t)||e.close()}))}));var n=this.position(t);this.menu().open(n.x,n.y,n.direction)},e.prototype.close=function(){this.clearCancellers();var t=this.menu();t&&t.close(!0)},e.prototype.clearCancellers=function(){this.cancelMouseup&&this.cancelMouseup(),this.cancelMousedown&&this.cancelMousedown()},e.prototype.mounted=function(){var t=this;this.$watch((function(){return t.menu().isOpen}),(function(e){t.$emit(e?"open":"close")}))},dt([(0,r.Prop)({type:Function})],e.prototype,"position",void 0),dt([(0,r.Prop)({type:Number})],e.prototype,"menuZIndex",void 0),dt([(0,r.Component)({components:{XMenu:z},provide:function(){var t;return(t={})[rt]=void 0,t}})],e)}(r.Vue),vt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),mt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};function bt(t){return{x:t.clientX,y:t.clientY,direction:"right"}}var gt=I(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return vt(e,t),mt([(0,r.Prop)({type:Function,default:bt})],e.prototype,"position",void 0),mt([r.Component],e)}(yt),pt,[],!1,null,null,null);gt.options.__file="src/contextmenu.vue";const _t=gt.exports;var wt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{display:"inline-block"}},[n("div",{on:{mousedown:t.openMenu}},[t._t("default")],2),t._v(" "),n("x-menu",{ref:"menu",style:t.menuStyle},[t._t("contextmenu")],2)],1)};wt._withStripped=!0;var Ot=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};function Mt(t){var e=t.currentTarget.children.item(0).getBoundingClientRect();return{x:e.left,y:e.bottom,direction:"right"}}var Pt=I(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ot(e,t),xt([(0,r.Prop)({type:Function,default:Mt})],e.prototype,"position",void 0),xt([r.Component],e)}(yt),wt,[],!1,null,null,null);Pt.options.__file="src/buttonmenu.vue";const St=Pt.exports;var jt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.keybind?n("x-keybinder",{attrs:{source:t.keybind,enabled:!t.disabled},on:{keybindmatch:t.fire}}):t._e(),t._v(" "),n("div",{staticClass:"menuitem",style:t.style,on:{mouseenter:function(e){return e.stopPropagation(),t.mouseenter.apply(null,arguments)},mouseleave:t.mouseleave,mouseup:t.mouseup,mousedown:function(t){t.stopPropagation(),t.preventDefault()}}},[n("div",{staticStyle:{padding:"0 0.3em"},style:{visibility:t.showCheckmark?"visible":"hidden"}},[t._v("✓")]),t._v(" "),n("div",{staticClass:"label"},[t.$slots.body?t._t("body"):n("div",{domProps:{innerHTML:t._s(t.label)}})],2),t._v(" "),n("div",{staticStyle:{"padding-left":"1em"}},[t.$slots.default?n("span",[t._v("▸")]):t._e(),t._v(" "),n("span",{domProps:{innerHTML:t._s(t.keybindHTML)}})]),t._v(" "),t.$slots.default?n("div",[n("x-menu",{ref:"childMenu",attrs:{parentMenuitem:this}},[t._t("default")],2)],1):t._e()])],1)};jt._withStripped=!0;const Ct=require("@hscmap/keybind");var kt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Tt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},$t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return kt(e,t),e.prototype.created=function(){var t=this;this.off=Ct.on(this.source,(function(e){t.enabled&&t.$emit("keybindmatch")}))},e.prototype.updated=function(){console.warn("Changing keybind dynamically is not supported.")},e.prototype.beforeDestroy=function(){this.off()},e.prototype.render=function(t){},Tt([(0,r.Prop)({required:!0,type:String})],e.prototype,"source",void 0),Tt([(0,r.Prop)({type:Boolean,default:!0})],e.prototype,"enabled",void 0),Tt([r.Component],e)}(r.Vue),Et=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Rt=function(){return Rt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Rt.apply(this,arguments)},Zt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},At=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}))},It=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},Dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hover=!1,e}return Et(e,t),e.prototype.created=function(){void 0!==this.vModel&&(Bt(["radio","checkbox"].indexOf(this.type)>=0,'prop :type must be one of "radio" or "checkbox"'),"checkbox"==this.type?Bt(Array.isArray(this.vModel)||"boolean"==typeof this.vModel,"v-model must be an array or boolean"):"radio"==this.type&&Bt(void 0!==this.value,"v-model must be set"))},Object.defineProperty(e.prototype,"keybindHTML",{get:function(){return this.keybind&&Ct.html(this.keybind)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){var t=this.menuStyle,e=t.active,n=t.disabled;return Rt(Rt({},this.active?e:{}),this.disabled?n:{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showCheckmark",{get:function(){return"radio"==this.type?this.vModel==this.value:"checkbox"==this.type&&void 0!==this.vModel?Array.isArray(this.vModel)?this.vModel.indexOf(this.value)>=0:this.vModel:this.checked},enumerable:!1,configurable:!0}),e.prototype.mounted=function(){var t=this;this.parentMenu.$on(i.type,(function(e){e.menuitem!=t&&t.deactivate()})),this.parentMenu.$on(a.type,(function(e){t.hover=!1;var n=t.childMenu();n&&n.close(!0)}))},Object.defineProperty(e.prototype,"active",{get:function(){var t=this.childMenu();return this.hover||t&&t.isOpen},enumerable:!1,configurable:!0}),e.prototype.activate=function(){this.parentMenu.$emit(i.type,new i(this));var t=this.childMenu();if(t){var e=this.$el.getBoundingClientRect(),n=this.parentMenu.submenuDirection;t.open(e[n],e.top-4,n)}},e.prototype.deactivate=function(){var t=this.childMenu();t&&t.close(!1)},e.prototype.fire=function(){if(this.$emit("click"),"radio"==this.type)this.$emit("input",this.value);else if("checkbox"==this.type&&void 0!==this.vModel)if(Array.isArray(this.vModel)){var t=this.vModel.indexOf(this.value),e=this.vModel.slice();t>=0?e.splice(t,1):e.push(this.value),this.$emit("input",e)}else this.$emit("input",!this.vModel);this.menubaritem&&this.menubaritem.onMenuiatemFired()},e.prototype.flash=function(){return At(this,void 0,void 0,(function(){var t,e;return It(this,(function(n){switch(n.label){case 0:if(!this.menuStyle.animation)return[3,5];t=50,e=0,n.label=1;case 1:return e<3?(this.hover=!1,[4,qt(t)]):[3,5];case 2:return n.sent(),this.hover=!0,[4,qt(t)];case 3:n.sent(),n.label=4;case 4:return++e,[3,1];case 5:return this.hover=!1,[2]}}))}))},e.prototype.childMenu=function(){return this.$refs.childMenu||void 0},e.prototype.mouseenter=function(t){var e=this;this.disabled||Q.lock((function(){return At(e,void 0,void 0,(function(){return It(this,(function(t){return this.parentMenu.isOpen&&(this.hover=!0,this.activate()),[2]}))}))}))},e.prototype.mouseleave=function(t){var e=this;Q.lock((function(){return At(e,void 0,void 0,(function(){return It(this,(function(t){return this.parentMenu.isOpen&&(this.hover=!1),[2]}))}))}))},e.prototype.mouseup=function(t){var e=this;this.$slots.body||this.hover&&Q.lock((function(){return At(e,void 0,void 0,(function(){var e=this;return It(this,(function(n){return this.parentMenu.isOpen&&!this.$slots.default&&Q.lock((function(){return At(e,void 0,void 0,(function(){return It(this,(function(e){switch(e.label){case 0:return this.sync?[3,2]:[4,this.flash()];case 1:e.sent(),e.label=2;case 2:return this.fire(),t.shiftKey||this.parentMenu.close(!0,!0),[2]}}))}))})),[2]}))}))}))},Zt([(0,r.Inject)(V)],e.prototype,"parentMenu",void 0),Zt([(0,r.Inject)(l)],e.prototype,"menuStyle",void 0),Zt([(0,r.Inject)(rt)],e.prototype,"menubaritem",void 0),Zt([(0,r.Prop)({type:String,default:""})],e.prototype,"label",void 0),Zt([(0,r.Prop)({type:Boolean,default:!1})],e.prototype,"checked",void 0),Zt([(0,r.Prop)({type:Boolean,default:!1})],e.prototype,"disabled",void 0),Zt([(0,r.Prop)({type:String})],e.prototype,"keybind",void 0),Zt([(0,r.Prop)({default:!1})],e.prototype,"sync",void 0),Zt([(0,r.Prop)({default:"checkbox"})],e.prototype,"type",void 0),Zt([(0,r.Prop)()],e.prototype,"vModel",void 0),Zt([(0,r.Prop)()],e.prototype,"value",void 0),Zt([(0,r.Component)({components:{XMenu:z,XKeybinder:$t},model:{prop:"vModel"}})],e)}(r.Vue);function qt(t){return new Promise((function(e){return setTimeout(e,t)}))}function Bt(t,e){if(!t)throw new Error(e)}const Ht=Dt;var Ft=n(248),Lt={};Lt.styleTagTransform=R(),Lt.setAttributes=k(),Lt.insert=j().bind(null,"head"),Lt.domAPI=P(),Lt.insertStyleElement=$(),x()(Ft.Z,Lt),Ft.Z&&Ft.Z.locals&&Ft.Z.locals;var Nt=I(Ht,jt,[],!1,null,"717f89e4",null);Nt.options.__file="src/menuitem/index.vue";const Vt=Nt.exports;var Xt=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"separator",style:t.menuStyle.separator})};Xt._withStripped=!0;const Ut={inject:{menuStyle:l}};var Wt=n(857),Gt={};Gt.styleTagTransform=R(),Gt.setAttributes=k(),Gt.insert=j().bind(null,"head"),Gt.domAPI=P(),Gt.insertStyleElement=$(),x()(Wt.Z,Gt),Wt.Z&&Wt.Z.locals&&Wt.Z.locals;var Kt=I(Ut,Xt,[],!1,null,"469f5cdc",null);Kt.options.__file="src/separator.vue";const zt=Kt.exports;function Jt(t,e){void 0===e&&(e={prefix:"hsc-menu"});var n=e.prefix;t.component("".concat(n,"-bar"),q),t.component("".concat(n,"-bar-item"),lt),t.component("".concat(n,"-context-menu"),_t),t.component("".concat(n,"-button-menu"),St),t.component("".concat(n,"-item"),Vt),t.component("".concat(n,"-separator"),zt),t.component("".concat(n,"-style-black"),h),t.component("".concat(n,"-style-white"),y),t.component("".concat(n,"-style-metal"),v)}},158:t=>{t.exports=require("es6-promise/auto")}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={id:o,exports:{}};return t[o](i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(158);var o=n(118),r=exports;for(var i in o)r[i]=o[i];o.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();