ol-contextmenu 5.5.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.5.0
3
+ * ol-contextmenu - v6.0.1
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Wed Aug 07 2024 12:29:18 GMT+0000 (Coordinated Universal Time)
5
+ * Built: 2026-06-17T21:57:20.658Z
6
6
  */
7
7
 
8
- (function(l,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("ol/control/Control"),require("ol/MapBrowserEvent")):typeof define=="function"&&define.amd?define(["ol/control/Control","ol/MapBrowserEvent"],c):(l=typeof globalThis<"u"?globalThis:l||self,l.ContextMenu=c(l.ol.control.Control,l.ol.MapBrowserEvent))})(this,function(l,c){"use strict";var P=Object.defineProperty;var H=(l,c,E)=>c in l?P(l,c,{enumerable:!0,configurable:!0,writable:!0,value:E}):l[c]=E;var a=(l,c,E)=>H(l,typeof c!="symbol"?c+"":c,E);var E={exports:{}};function x(){}x.prototype={on:function(s,t,e){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:t,ctx:e}),this},once:function(s,t,e){var n=this;function o(){n.off(s,o),t.apply(e,arguments)}return o._=t,this.on(s,o,e)},emit:function(s){var t=[].slice.call(arguments,1),e=((this.e||(this.e={}))[s]||[]).slice(),n=0,o=e.length;for(n;n<o;n++)e[n].fn.apply(e[n].ctx,t);return this},off:function(s,t){var e=this.e||(this.e={}),n=e[s],o=[];if(n&&t)for(var i=0,h=n.length;i<h;i++)n[i].fn!==t&&n[i].fn._!==t&&o.push(n[i]);return o.length?e[s]=o:delete e[s],this}},E.exports=x;var T=E.exports.TinyEmitter=x,L=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(L||{}),p=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(p||{});class S extends c{constructor(t){super(t.type,t.map,t.originalEvent)}}const k={width:150,scrollAt:4,eventType:L.CONTEXTMENU,defaultItems:!0,items:[]},m="ol-ctx-menu",r={namespace:m,container:`${m}-container`,separator:`${m}-separator`,submenu:`${m}-submenu`,hidden:`${m}-hidden`,icon:`${m}-icon`,zoomIn:`${m}-zoom-in`,zoomOut:`${m}-zoom-out`,unselectable:"ol-unselectable"},A=[{text:"Zoom In",classname:`${r.zoomIn} ${r.icon}`,callback:(s,t)=>{const e=t.getView();e.animate({zoom:Number(e.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${r.zoomOut} ${r.icon}`,callback:(s,t)=>{const e=t.getView();e.animate({zoom:Number(e.getZoom())-1,duration:700,center:s.coordinate})}}];function M(s){const t=document.createDocumentFragment(),e=document.createElement("div");for(e.innerHTML=s;e.firstChild;)t.append(e.firstChild);return t}function I(s){const t=document.importNode(s),e=s.offsetWidth;t.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;const n=M("<span>Foo</span>"),o=M("<span>Foo</span>"),i=document.createElement("li"),h=document.createElement("li");i.append(n),h.append(o),t.append(i),t.append(h),s.parentNode?.append(t);const u=t.offsetHeight/2;return s.parentNode?.removeChild(t),u}function $({parentNode:s,item:t,isSubmenu:e=!1,isInsideSubmenu:n=!1,emitter:o}){const i=`_${Math.random().toString(36).slice(2,11)}`;if(typeof t!="string"&&"text"in t){const v=`<span>${t.text}</span>`,g=M(v),f=document.createElement("li");t.classname=t.classname||"",t.icon&&(t.classname===""?t.classname=r.icon:t.classname.includes(r.icon)===!1&&(t.classname+=` ${r.icon}`),f.setAttribute("style",`background-image:url(${t.icon})`)),f.id=i,f.className=t.classname,f.append(g),s.append(f);const N={id:i,isSubmenu:e,isInsideSubmenu:n,isSeparator:!1,callback:"callback"in t?t.callback:null,data:"data"in t?t.data:null};return o.emit(p.ADD_MENU_ENTRY,N,f),f}const h=`<li id="${i}" class="${r.separator}"><hr></li>`,u=M(h);s.append(u);const y=s.lastChild,b={id:i,isSubmenu:!1,isInsideSubmenu:!1,isSeparator:!0,callback:null,data:null};return o.emit(p.ADD_MENU_ENTRY,b,y),y}function w({container:s,items:t,menuWidth:e,isInsideSubmenu:n,emitter:o}){t.forEach(i=>{if(typeof i!="string"&&"items"in i&&Array.isArray(i.items)){const h=$({parentNode:s,item:i,isSubmenu:!0,emitter:o});h.classList.add(r.submenu);const u=document.createElement("ul");u.classList.add(r.container),u.style.width=`${e}px`,h.append(u),w({emitter:o,menuWidth:e,container:u,items:i.items,isInsideSubmenu:!0})}else $({parentNode:s,item:i,isSubmenu:!1,isInsideSubmenu:n,emitter:o})})}function C(s,t){if(!s)throw new Error(t)}class O extends l{constructor(e={}){C(typeof e=="object","@param `opts` should be object type!");const n=document.createElement("div");super({element:n});a(this,"map");a(this,"emitter",new T);a(this,"container");a(this,"coordinate",[]);a(this,"pixel",[]);a(this,"contextMenuEventListener");a(this,"entryCallbackEventListener");a(this,"mapMoveListener");a(this,"lineHeight",0);a(this,"disabled");a(this,"opened");a(this,"items",[]);a(this,"menuEntries",new Map);a(this,"options");this.options={...k,...e};const o=document.createElement("ul");n.append(o),n.style.width=`${this.options.width}px`,n.classList.add(r.container,r.unselectable,r.hidden),this.container=n,this.contextMenuEventListener=i=>{this.handleContextMenu(i)},this.entryCallbackEventListener=i=>{this.handleEntryCallback(i)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1,window.addEventListener("beforeunload",()=>{this.removeListeners()},{once:!0})}clear(){for(const e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return A}countItems(){return this.menuEntries.size}extend(e){C(Array.isArray(e),"@param `items` should be an Array."),w({items:e,emitter:this.emitter,menuWidth:this.options.width,container:this.container.firstElementChild})}closeMenu(){this.opened=!1,this.container.classList.add(r.hidden),this.dispatchEvent(p.CLOSE)}isOpen(){return this.opened}updatePosition(e){C(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){const e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){const e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,e.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),e.on("movestart",()=>{this.handleMapMove()}),this.emitter.on(p.ADD_MENU_ENTRY,(o,i)=>{this.handleAddMenuEntry(o,i)},this),this.items=this.options.defaultItems?this.options.items.concat(A):this.options.items,w({items:this.items,emitter:this.emitter,menuWidth:this.options.width,container:this.container.firstElementChild});const n=this.getMenuEntriesLength();this.lineHeight=n>0?this.container.offsetHeight/n:I(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.emitter.off(p.ADD_MENU_ENTRY)}removeMenuEntry(e){let n=document.getElementById(e);n?.remove(),n=null,this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new S({map:this.map,originalEvent:e,type:p.BEFOREOPEN})),!this.disabled&&(this.options.eventType===L.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)}),e.target?.addEventListener("pointerdown",n=>{this.opened&&(n.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.opened=!0,this.positionContainer(),this.container.classList.remove(r.hidden),this.dispatchEvent(new S({map:this.map,originalEvent:e,type:p.OPEN}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1&&e.isSubmenu===!1&&e.isInsideSubmenu===!1).length}positionContainer(){const e=this.map.getSize()||[0,0],n={w:e[0]-this.pixel[0],h:e[1]-this.pixel[1]},o=this.getMenuEntriesLength(),i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*o)},h=n.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${h}px`,this.container.style.top=n.h>=i.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-i.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",n.w-=i.w;const u=v=>Array.from(v.children).filter(g=>g.tagName==="LI"&&g.classList.contains(r.submenu));let y=0;const b=(v,g)=>{y+=1,u(v).forEach(N=>{const D=g>=i.w?i.w-8:(i.w+8)*-1,d=N.querySelector(`ul.${r.container}`),_=Math.round(this.lineHeight*Array.from(d.children).filter(z=>z.tagName==="LI").length);d.style.left=`${D}px`,d.style.right="auto",d.style.top=n.h>=_+i.h?"0":`-${d.offsetHeight-25}px`,d.style.bottom="auto",d.style.zIndex=String(y),u(d).length>0&&b(d,g-i.w)})};b(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();const n=e.currentTarget,o=this.menuEntries.get(n.id);if(!o)return;const i={data:o.data,coordinate:this.coordinate};this.closeMenu(),o.callback?.(i,this.map)}handleAddMenuEntry(e,n){this.menuEntries.set(e.id,e),this.positionContainer(),"callback"in e&&typeof e.callback=="function"&&n.addEventListener("click",this.entryCallbackEventListener,!1)}}return O});
8
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.ol-ctx-menu-container{color:#222;box-sizing:border-box;background:#fff;border-radius:5px;padding:8px;font-size:13px;position:absolute;box-shadow:3px 3px 5px #0003}.ol-ctx-menu-container div,.ol-ctx-menu-container span,.ol-ctx-menu-container a,.ol-ctx-menu-container img,.ol-ctx-menu-container ul,.ol-ctx-menu-container li{font:inherit;vertical-align:baseline;border:0;margin:0;padding:0;font-size:100%}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :before,.ol-ctx-menu-container :after{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{white-space:nowrap;padding:2px 5px;line-height:20px;position:relative}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;color:#eee;background-color:#333}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{opacity:0;visibility:hidden;border:1px solid #eee;padding:8px;transition:visibility 0s linear .3s,opacity .3s;top:0}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{content:"";border-top:.3em solid #222;border-right:.3em solid #222;width:.6em;height:.6em;display:inline-block;position:absolute;top:7px;right:10px;transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container:not(.ol-ctx-menu-hidden) li.ol-ctx-menu-submenu:hover>.ol-ctx-menu-container{opacity:1;visibility:visible;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{background-image:linear-gradient(270deg,#0000,#000000bf,#0000);border:0;height:1px}.ol-ctx-menu-icon{text-indent:20px;background-position:0;background-repeat:no-repeat;background-size:20px}.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=)}.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC)}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
9
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t(require("ol/control/Control"),require("ol/MapBrowserEvent")):typeof define==`function`&&define.amd?define([`ol/control/Control`,`ol/MapBrowserEvent`],t):(e=typeof globalThis<`u`?globalThis:e||self,e.ContextMenu=t(e.ol.control.Control,e.ol.MapBrowserEvent))})(this,function(e,t){var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));e=u(e,1),t=u(t,1);var d=c(((e,t)=>{function n(){}n.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],i=[];if(r&&t)for(var a=0,o=r.length;a<o;a++)r[a].fn!==t&&r[a].fn._!==t&&i.push(r[a]);return i.length?n[e]=i:delete n[e],this}},t.exports=n,t.exports.TinyEmitter=n}))(),f=function(e){return e.CONTEXTMENU=`contextmenu`,e.CLICK=`click`,e.DBLCLICK=`dblclick`,e}({}),p=function(e){return e.BEFOREOPEN=`beforeopen`,e.OPEN=`open`,e.CLOSE=`close`,e.ADD_MENU_ENTRY=`add-menu-entry`,e}({}),m=class extends t.default{constructor(e){super(e.type,e.map,e.originalEvent)}},h={defaultItems:!0,eventType:f.CONTEXTMENU,items:[],scrollAt:4,width:150},g=`ol-ctx-menu`,_={container:`${g}-container`,hidden:`${g}-hidden`,icon:`${g}-icon`,namespace:g,separator:`${g}-separator`,submenu:`${g}-submenu`,unselectable:`ol-unselectable`,zoomIn:`${g}-zoom-in`,zoomOut:`${g}-zoom-out`},v=[{callback:(e,t)=>{let n=t.getView();n.animate({center:e.coordinate,duration:700,zoom:Number(n.getZoom())+1})},classname:`${_.zoomIn} ${_.icon}`,text:`Zoom In`},{callback:(e,t)=>{let n=t.getView();n.animate({center:e.coordinate,duration:700,zoom:Number(n.getZoom())-1})},classname:`${_.zoomOut} ${_.icon}`,text:`Zoom Out`}];function y(e){let t=document.createDocumentFragment(),n=document.createElement(`div`);for(n.innerHTML=e;n.firstChild;)t.append(n.firstChild);return t}function b(e){let t=document.importNode(e),n=e.offsetWidth;t.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${n}px`;let r=y(`<span>Foo</span>`),i=y(`<span>Foo</span>`),a=document.createElement(`li`),o=document.createElement(`li`);a.append(r),o.append(i),t.append(a),t.append(o),e.parentNode?.append(t);let s=getComputedStyle(t),c=Number.parseInt(s.paddingTop,10),l=Number.parseInt(s.paddingBottom,10),u=(t.offsetHeight-(c+l))/2;return e.parentNode?.removeChild(t),u}function x({emitter:e,isInsideSubmenu:t=!1,isSubmenu:n=!1,item:r,parentNode:i}){let a=`_${Math.random().toString(36).slice(2,11)}`;if(typeof r!=`string`&&`text`in r){let o=y(`<span>${r.text}</span>`),s=document.createElement(`li`);r.classname=r.classname||``,r.icon&&(r.classname===``?r.classname=_.icon:r.classname.includes(_.icon)===!1&&(r.classname+=` ${_.icon}`),s.setAttribute(`style`,`background-image:url(${r.icon})`)),s.id=a,s.className=r.classname,s.append(o),i.append(s);let c={callback:`callback`in r?r.callback:null,data:`data`in r?r.data:null,id:a,isInsideSubmenu:t,isSeparator:!1,isSubmenu:n};return e.emit(p.ADD_MENU_ENTRY,c,s),s}let o=y(`<li id="${a}" class="${_.separator}"><hr></li>`);i.append(o);let s=i.lastChild,c={callback:null,data:null,id:a,isInsideSubmenu:!1,isSeparator:!0,isSubmenu:!1};return e.emit(p.ADD_MENU_ENTRY,c,s),s}function S({container:e,emitter:t,isInsideSubmenu:n,items:r,menuWidth:i}){r.forEach(r=>{if(typeof r!=`string`&&`items`in r&&Array.isArray(r.items)){let n=x({emitter:t,isSubmenu:!0,item:r,parentNode:e});n.classList.add(_.submenu);let a=document.createElement(`ul`);a.classList.add(_.container),a.style.width=`${i}px`,n.append(a),S({container:a,emitter:t,isInsideSubmenu:!0,items:r.items,menuWidth:i})}else x({emitter:t,isInsideSubmenu:n,isSubmenu:!1,item:r,parentNode:e})})}function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function E(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){if(!e)throw Error(t)}return class extends e.default{constructor(e={}){D(typeof e==`object`,"@param `opts` should be object type!");let t=document.createElement(`div`);super({element:t}),E(this,`map`,void 0),E(this,`emitter`,new d.TinyEmitter),E(this,`container`,void 0),E(this,`coordinate`,[]),E(this,`pixel`,[]),E(this,`contextMenuEventListener`,void 0),E(this,`entryCallbackEventListener`,void 0),E(this,`mapMoveListener`,void 0),E(this,`lineHeight`,0),E(this,`disabled`,void 0),E(this,`opened`,void 0),E(this,`items`,[]),E(this,`menuEntries`,new Map),E(this,`options`,void 0),this.options={...h,...e};let n=document.createElement(`ul`);t.append(n),t.style.width=`${this.options.width}px`,t.classList.add(_.container,_.unselectable,_.hidden),this.container=t,this.contextMenuEventListener=e=>{this.handleContextMenu(e)},this.entryCallbackEventListener=e=>{this.handleEntryCallback(e)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1,window.addEventListener(`beforeunload`,()=>{this.removeListeners()},{once:!0})}clear(){for(let e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement(`ul`))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return v}countItems(){return this.menuEntries.size}extend(e){D(Array.isArray(e),"@param `items` should be an Array."),S({container:this.container.firstElementChild,emitter:this.emitter,items:e,menuWidth:this.options.width})}closeMenu(){this.opened=!1,this.container.classList.add(_.hidden),this.dispatchEvent(p.CLOSE)}isOpen(){return this.opened}updatePosition(e){D(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){let e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){let e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,e.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,{capture:!1}),e.on(`movestart`,()=>{this.handleMapMove()}),this.emitter.on(p.ADD_MENU_ENTRY,(e,t)=>{this.handleAddMenuEntry(e,t)},this),this.items=this.options.defaultItems?this.options.items.concat(v):this.options.items,S({container:this.container.firstElementChild,emitter:this.emitter,items:this.items,menuWidth:this.options.width});let t=this.getMenuEntriesLength();this.lineHeight=t>0?this.container.offsetHeight/t:b(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.emitter.off(p.ADD_MENU_ENTRY)}removeMenuEntry(e){let t=document.getElementById(e);t?.remove(),t=null,this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new m({map:this.map,originalEvent:e,type:p.BEFOREOPEN})),!this.disabled&&(this.options.eventType===f.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)},0),e.target?.addEventListener(`pointerdown`,e=>{this.opened&&(e.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.opened=!0,this.positionContainer(),this.container.classList.remove(_.hidden),this.dispatchEvent(new m({map:this.map,originalEvent:e,type:p.OPEN}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1&&e.isSubmenu===!1&&e.isInsideSubmenu===!1).length}calculateMenuSize(){let e=this.getMenuEntriesLength(),t=Math.round(this.lineHeight*e)+16,n=this.container.offsetHeight,r=!this.container.classList.contains(_.hidden);return{h:n>0&&r?n:t,w:this.container.offsetWidth}}calculateVerticalPosition(e,t,n){let r;return t.h>=n.h?(r=this.pixel[1]-10,r+n.h>e[1]&&(r=Math.max(0,e[1]-n.h-2))):(r=this.pixel[1]-n.h,r<0&&(r=n.h<=e[1]?0:Math.max(0,e[1]-n.h)),r+n.h>e[1]&&(r=Math.max(0,e[1]-n.h-2))),Math.max(0,Math.min(r,e[1]-n.h-2))}adjustPositionAfterRender(e,t){if(this.container.classList.contains(_.hidden))return;let n=this.container.offsetHeight;n>0&&n!==t.h&&(Number.parseInt(this.container.style.top,10)||0)+n>e[1]&&(this.container.style.top=`${Math.max(0,e[1]-n-2)}px`)}positionContainer(){let e=this.map.getSize()||[0,0],t=[e[0]||0,e[1]||0],n={h:t[1]-this.pixel[1],w:t[0]-this.pixel[0]},r=this.calculateMenuSize(),i=n.w>=r.w?this.pixel[0]+5:this.pixel[0]-r.w;this.container.style.left=`${i}px`;let a=this.calculateVerticalPosition(t,n,r);this.container.style.top=`${a}px`,this.container.style.right=`auto`,this.container.style.bottom=`auto`,this.adjustPositionAfterRender(t,r),n.w-=r.w;let o=e=>Array.from(e.children).filter(e=>e.tagName===`LI`&&e.classList.contains(_.submenu)),s=0,c=(e,t)=>{s+=1,o(e).forEach(e=>{let i=t>=r.w?r.w-8:(r.w+8)*-1,a=e.querySelector(`ul.${_.container}`),l=Math.round(this.lineHeight*Array.from(a.children).filter(e=>e.tagName===`LI`).length);a.style.left=`${i}px`,a.style.right=`auto`,a.style.top=n.h>=l+r.h?`0`:`-${a.offsetHeight-25}px`,a.style.bottom=`auto`,a.style.zIndex=String(s),o(a).length>0&&c(a,t-r.w)})};c(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();let t=e.currentTarget,n=this.menuEntries.get(t.id);if(!n)return;let r={coordinate:this.coordinate,data:n.data};this.closeMenu(),n.callback?.(r,this.map)}handleAddMenuEntry(e,t){this.menuEntries.set(e.id,e),this.positionContainer(),`callback`in e&&typeof e.callback==`function`&&t.addEventListener(`click`,this.entryCallbackEventListener,{capture:!1})}}});
@@ -1,14 +1,18 @@
1
- import { SingleItem, Options } from './types';
1
+ import { Options, SingleItem } from './types.ts';
2
2
  export declare const DEFAULT_OPTIONS: Options;
3
3
  export declare const CSS_CLASSES: {
4
- namespace: string;
5
4
  container: string;
6
- separator: string;
7
- submenu: string;
8
5
  hidden: string;
9
6
  icon: string;
7
+ namespace: string;
8
+ separator: string;
9
+ submenu: string;
10
+ unselectable: string;
10
11
  zoomIn: string;
11
12
  zoomOut: string;
12
- unselectable: string;
13
13
  };
14
+ export declare const CONTAINER_PADDING = 8;
15
+ export declare const CONTAINER_PADDING_TOTAL: number;
16
+ export declare const MENU_POSITION_OFFSET = 10;
17
+ export declare const MENU_POSITION_BUFFER = 2;
14
18
  export declare const DEFAULT_ITEMS: SingleItem[];
@@ -1,18 +1,18 @@
1
+ import { Item } from '../types.ts';
1
2
  import { TinyEmitter } from 'tiny-emitter';
2
- import { Item } from '../types';
3
3
  export declare function createFragment(html: string): DocumentFragment;
4
4
  export declare function getLineHeight(container: HTMLDivElement): number;
5
- export declare function addMenuEntry({ parentNode, item, isSubmenu, isInsideSubmenu, emitter, }: {
6
- parentNode: HTMLUListElement;
7
- item: Item;
8
- isSubmenu: boolean;
9
- isInsideSubmenu?: boolean;
5
+ export declare function addMenuEntry({ emitter, isInsideSubmenu, isSubmenu, item, parentNode, }: {
10
6
  emitter: TinyEmitter;
7
+ isInsideSubmenu?: boolean;
8
+ isSubmenu: boolean;
9
+ item: Item;
10
+ parentNode: HTMLUListElement;
11
11
  }): HTMLLIElement;
12
- export declare function addMenuEntries({ container, items, menuWidth, isInsideSubmenu, emitter, }: {
12
+ export declare function addMenuEntries({ container, emitter, isInsideSubmenu, items, menuWidth, }: {
13
13
  container: HTMLUListElement;
14
+ emitter: TinyEmitter;
15
+ isInsideSubmenu?: boolean;
14
16
  items: Item[];
15
17
  menuWidth: number;
16
- isInsideSubmenu?: boolean;
17
- emitter: TinyEmitter;
18
18
  }): void;
@@ -1,3 +1,6 @@
1
+ import { default as Control } from 'ol/control/Control';
2
+ import { TinyEmitter } from 'tiny-emitter';
3
+ import { ContextMenuEvent, CustomEventTypes, Item, Options, MenuEntry } from './types.ts';
1
4
  import { default as OlMap } from 'ol/Map';
2
5
  import { Pixel } from 'ol/pixel';
3
6
  import { EventsKey } from 'ol/events';
@@ -5,10 +8,7 @@ import { default as BaseEvent } from 'ol/events/Event';
5
8
  import { ObjectEvent } from 'ol/Object';
6
9
  import { Coordinate } from 'ol/coordinate';
7
10
  import { Types as ObjectEventTypes } from 'ol/ObjectEventType';
8
- import { CombinedOnSignature, EventTypes as OlEventTypes, OnSignature } from 'ol/Observable';
9
- import { default as Control } from 'ol/control/Control';
10
- import { TinyEmitter } from 'tiny-emitter';
11
- import { Item, Options, MenuEntry, ContextMenuEvent, CustomEventTypes } from './types';
11
+ import { OnSignature, CombinedOnSignature, EventTypes as OlEventTypes } from 'ol/Observable';
12
12
  export default class ContextMenu extends Control {
13
13
  protected map: OlMap;
14
14
  protected emitter: TinyEmitter;
@@ -23,15 +23,15 @@ export default class ContextMenu extends Control {
23
23
  protected opened: boolean;
24
24
  protected items: Item[];
25
25
  protected menuEntries: Map<string, MenuEntry>;
26
- on: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, EventsKey> & OnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}` | ObjectEventTypes | `${CustomEventTypes.CLOSE}` | OlEventTypes, EventsKey>;
27
- once: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, EventsKey> & OnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}` | ObjectEventTypes | `${CustomEventTypes.CLOSE}` | OlEventTypes, EventsKey>;
28
- un: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, void> & OnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, void> & CombinedOnSignature<`${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}` | ObjectEventTypes | `${CustomEventTypes.CLOSE}` | OlEventTypes, void>;
26
+ on: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, EventsKey> & OnSignature<`${CustomEventTypes.OPEN}` | `${CustomEventTypes.BEFOREOPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<OlEventTypes | ObjectEventTypes | `${CustomEventTypes.OPEN}` | `${CustomEventTypes.CLOSE}` | `${CustomEventTypes.BEFOREOPEN}`, EventsKey>;
27
+ once: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, EventsKey> & OnSignature<`${CustomEventTypes.OPEN}` | `${CustomEventTypes.BEFOREOPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<OlEventTypes | ObjectEventTypes | `${CustomEventTypes.OPEN}` | `${CustomEventTypes.CLOSE}` | `${CustomEventTypes.BEFOREOPEN}`, EventsKey>;
28
+ un: OnSignature<OlEventTypes | `${CustomEventTypes.CLOSE}`, BaseEvent, void> & OnSignature<`${CustomEventTypes.OPEN}` | `${CustomEventTypes.BEFOREOPEN}`, ContextMenuEvent, EventsKey> & OnSignature<ObjectEventTypes, ObjectEvent, void> & CombinedOnSignature<OlEventTypes | ObjectEventTypes | `${CustomEventTypes.OPEN}` | `${CustomEventTypes.CLOSE}` | `${CustomEventTypes.BEFOREOPEN}`, void>;
29
29
  options: Options;
30
30
  constructor(opts?: Partial<Options>);
31
31
  clear(): void;
32
32
  enable(): void;
33
33
  disable(): void;
34
- getDefaultItems(): import('./types').SingleItem[];
34
+ getDefaultItems(): import('./types.ts').SingleItem[];
35
35
  countItems(): number;
36
36
  extend(items: Item[]): void;
37
37
  closeMenu(): void;
@@ -46,9 +46,24 @@ export default class ContextMenu extends Control {
46
46
  protected handleContextMenu(evt: MouseEvent): void;
47
47
  protected openMenu(evt: MouseEvent): void;
48
48
  protected getMenuEntriesLength(): number;
49
+ protected calculateMenuSize(): {
50
+ h: number;
51
+ w: number;
52
+ };
53
+ protected calculateVerticalPosition(mapSize: [number, number], spaceLeft: {
54
+ h: number;
55
+ w: number;
56
+ }, menuSize: {
57
+ h: number;
58
+ w: number;
59
+ }): number;
60
+ protected adjustPositionAfterRender(mapSize: [number, number], menuSize: {
61
+ h: number;
62
+ w: number;
63
+ }): void;
49
64
  protected positionContainer(): void;
50
65
  protected handleMapMove(): void;
51
66
  protected handleEntryCallback(evt: MouseEvent): void;
52
67
  protected handleAddMenuEntry(item: MenuEntry, element: HTMLLIElement): void;
53
68
  }
54
- export { type ItemSeparator, type ItemWithNested, type SingleItem, type Item, type Options, type MenuEntry, type EventTypes, type CallbackObject, type ContextMenuEvent, type CustomEventTypes, } from './types';
69
+ export { type Item, type Options, type MenuEntry, type SingleItem, type EventTypes, type ItemSeparator, type ItemWithNested, type CallbackObject, type ContextMenuEvent, type CustomEventTypes, } from './types.ts';
@@ -1,6 +1,6 @@
1
+ import { default as MapBrowserEvent } from 'ol/MapBrowserEvent';
1
2
  import { default as OlMap } from 'ol/Map';
2
3
  import { Coordinate } from 'ol/coordinate';
3
- import { default as MapBrowserEvent } from 'ol/MapBrowserEvent';
4
4
  export declare enum EventTypes {
5
5
  CONTEXTMENU = "contextmenu",
6
6
  CLICK = "click",
@@ -12,11 +12,11 @@ export declare enum CustomEventTypes {
12
12
  CLOSE = "close",
13
13
  ADD_MENU_ENTRY = "add-menu-entry"
14
14
  }
15
- export declare class ContextMenuEvent extends MapBrowserEvent<MouseEvent> {
15
+ export declare class ContextMenuEvent extends MapBrowserEvent<any> {
16
16
  constructor(options: {
17
- type: `${CustomEventTypes.BEFOREOPEN}` | `${CustomEventTypes.OPEN}`;
18
17
  map: OlMap;
19
- originalEvent: MouseEvent;
18
+ originalEvent: MouseEvent | PointerEvent;
19
+ type: `${CustomEventTypes.OPEN}` | `${CustomEventTypes.BEFOREOPEN}`;
20
20
  });
21
21
  }
22
22
  export type CallbackObject = {
@@ -25,31 +25,31 @@ export type CallbackObject = {
25
25
  };
26
26
  export type ItemSeparator = '-';
27
27
  export type SingleItem = {
28
- text: string;
29
- classname?: string;
30
- icon?: string;
31
28
  callback: (object: CallbackObject, map: OlMap) => void;
29
+ classname?: string;
32
30
  data?: unknown;
31
+ icon?: string;
32
+ text: string;
33
33
  };
34
34
  export type MenuEntry = {
35
+ callback: null | SingleItem['callback'];
36
+ data: unknown;
35
37
  id: string;
36
- isSubmenu: boolean;
37
38
  isInsideSubmenu: boolean;
38
39
  isSeparator: boolean;
39
- callback: SingleItem['callback'] | null;
40
- data: unknown;
40
+ isSubmenu: boolean;
41
41
  };
42
42
  export type ItemWithNested = {
43
- text: string;
44
43
  classname?: string;
45
44
  icon?: string;
46
45
  items: Item[];
46
+ text: string;
47
47
  };
48
48
  export type Item = SingleItem | ItemSeparator | ItemWithNested;
49
49
  export type Options = {
50
- width: number;
51
- scrollAt: number;
52
- eventType: `${EventTypes}`;
53
50
  defaultItems: boolean;
51
+ eventType: `${EventTypes}`;
54
52
  items: Item[];
53
+ scrollAt: number;
54
+ width: number;
55
55
  };
package/package.json CHANGED
@@ -1,24 +1,35 @@
1
1
  {
2
2
  "name": "ol-contextmenu",
3
- "version": "5.5.0",
3
+ "version": "6.0.1",
4
4
  "description": "Custom Context Menu for Openlayers",
5
+ "keywords": [
6
+ "openlayers",
7
+ "ol",
8
+ "contextmenu",
9
+ "context-menu",
10
+ "right-click",
11
+ "menu",
12
+ "map",
13
+ "gis",
14
+ "geospatial"
15
+ ],
5
16
  "type": "module",
6
17
  "main": "./dist/ol-contextmenu.umd.cjs",
7
18
  "jsdelivr": "./dist/ol-contextmenu.iife.js",
8
19
  "module": "./dist/ol-contextmenu.js",
20
+ "browser": "./dist/ol-contextmenu.js",
21
+ "sideEffects": [
22
+ "./dist/ol-contextmenu.js",
23
+ "./dist/ol-contextmenu.umd.cjs",
24
+ "./dist/ol-contextmenu.iife.js"
25
+ ],
9
26
  "exports": {
10
27
  ".": {
11
- "import": {
12
- "types": "./dist/ol-contextmenu.d.ts",
13
- "default": "./dist/ol-contextmenu.js"
14
- }
15
- },
16
- "./*": {
17
- "import": "./*",
18
- "require": "./*",
19
- "style": "./*"
20
- },
21
- "./ol-contextmenu.css": "./dist/ol-contextmenu.css"
28
+ "types": "./dist/ol-contextmenu.d.ts",
29
+ "import": "./dist/ol-contextmenu.js",
30
+ "require": "./dist/ol-contextmenu.umd.cjs",
31
+ "default": "./dist/ol-contextmenu.js"
32
+ }
22
33
  },
23
34
  "files": [
24
35
  "./dist"
@@ -35,46 +46,48 @@
35
46
  "url": "https://github.com/jonataswalker/ol-contextmenu/issues"
36
47
  },
37
48
  "engines": {
38
- "node": ">=16",
39
- "npm": ">=8"
49
+ "node": ">=24",
50
+ "npm": ">=11"
40
51
  },
41
52
  "scripts": {
42
53
  "dev": "vite",
43
- "build": "rimraf ./dist && vite build",
54
+ "build": "premove ./dist && vite build",
44
55
  "preview": "vite preview",
45
- "lint": "eslint .",
56
+ "lint": "eslint . --cache",
46
57
  "lint:fix": "npm run lint -- --fix",
47
- "test": "jest",
58
+ "test": "vitest run",
59
+ "test:ui": "vitest --ui",
48
60
  "prepare": "husky",
49
61
  "release": "release-it --no-npm.publish"
50
62
  },
51
63
  "devDependencies": {
52
- "@swc/core": "^1.7.6",
53
- "@swc/jest": "^0.2.36",
54
- "@types/jest": "^29.5.12",
55
- "eslint": "^8.57.0",
56
- "eslint-config-jwalker": "^8.8.0",
57
- "eslint-config-prettier": "^9.1.0",
58
- "eslint-plugin-jest": "^27.9.0",
59
- "eslint-plugin-prettier": "^5.2.1",
60
- "husky": "^9.1.4",
61
- "identity-obj-proxy": "^3.0.0",
62
- "jest": "^29.7.0",
63
- "jest-environment-jsdom": "^29.7.0",
64
- "ol": "^10.0.0",
65
- "prettier": "^3.3.3",
66
- "release-it": "^17.6.0",
67
- "rimraf": "^6.0.1",
68
- "sass": "^1.77.8",
69
- "typescript": "^5.5.4",
70
- "vite": "^5.3.5",
71
- "vite-plugin-banner": "^0.7.1",
72
- "vite-plugin-dts": "^4.0.1"
64
+ "@types/node": "^25.9.3",
65
+ "@vitest/browser-webdriverio": "^4.1.9",
66
+ "@vitest/coverage-v8": "^4.1.9",
67
+ "@vitest/ui": "^4.1.9",
68
+ "auto-changelog": "^2.6.0",
69
+ "eslint-config-jwalker": "^12.2.0",
70
+ "husky": "^9.1.7",
71
+ "jsdom": "^29.1.1",
72
+ "ol": "^10.9.0",
73
+ "premove": "^4.0.0",
74
+ "release-it": "^20.2.0",
75
+ "sass": "^1.101.0",
76
+ "typescript": "^6.0.3",
77
+ "vite": "^8.0.16",
78
+ "vite-plugin-banner": "^0.8.1",
79
+ "vite-plugin-css-injected-by-js": "^5.0.1",
80
+ "vite-plugin-dts": "^5.0.2",
81
+ "vitest": "^4.1.9",
82
+ "webdriverio": "^9.28.0"
73
83
  },
74
84
  "peerDependencies": {
75
85
  "ol": "> 7.x <= 10.x"
76
86
  },
77
87
  "dependencies": {
78
88
  "tiny-emitter": "^2.1.0"
89
+ },
90
+ "allowScripts": {
91
+ "geckodriver@6.1.0": true
79
92
  }
80
93
  }
@@ -1,8 +0,0 @@
1
-
2
- /*!
3
- * ol-contextmenu - v5.5.0
4
- * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Wed Aug 07 2024 12:29:18 GMT+0000 (Coordinated Universal Time)
6
- */
7
-
8
- .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:#0003 3px 3px 5px;box-sizing:border-box}.ol-ctx-menu-container div,.ol-ctx-menu-container span,.ol-ctx-menu-container a,.ol-ctx-menu-container img,.ol-ctx-menu-container ul,.ol-ctx-menu-container li{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container *:before,.ol-ctx-menu-container *:after{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px;white-space:nowrap}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container:not(.ol-ctx-menu-hidden) li.ol-ctx-menu-submenu:hover>.ol-ctx-menu-container{opacity:1;visibility:visible;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:linear-gradient(to left,#0000,#000000bf,#0000)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:left center}.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=)}.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC)}
@@ -1,3 +0,0 @@
1
- export * from './main'
2
- import ContextMenu from './main'
3
- export default ContextMenu