ol-contextmenu 5.2.0 → 5.2.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.
package/README.md CHANGED
@@ -21,7 +21,8 @@ A `contextmenu` extension for [OpenLayers](http://openlayers.org/). **Requires**
21
21
 
22
22
  ## Demo
23
23
 
24
- [JSFiddle](https://jsfiddle.net/jonataswalker/ooxs1w5d/).
24
+ [JSFiddle](https://jsfiddle.net/jonataswalker/ooxs1w5d/)
25
+ [CodeSandbox](https://codesandbox.io/s/openlayers-custom-context-menu-5s99kb?file=/src/index.js)
25
26
 
26
27
  ## How to use it?
27
28
 
@@ -1,5 +1,18 @@
1
+ import { TinyEmitter } from 'tiny-emitter';
1
2
  import { Item } from '../types';
2
3
  export declare function createFragment(html: string): DocumentFragment;
3
4
  export declare function getLineHeight(container: HTMLDivElement): number;
4
- export declare function addMenuEntry(parentNode: HTMLUListElement, item: Item, isSubmenu?: boolean, isInsideSubmenu?: boolean): HTMLLIElement;
5
- export declare function addMenuEntries(container: HTMLUListElement, items: Item[], menuWidth: number, isInsideSubmenu?: boolean): void;
5
+ export declare function addMenuEntry({ parentNode, item, isSubmenu, isInsideSubmenu, emitter, }: {
6
+ parentNode: HTMLUListElement;
7
+ item: Item;
8
+ isSubmenu: boolean;
9
+ isInsideSubmenu?: boolean;
10
+ emitter: TinyEmitter;
11
+ }): HTMLLIElement;
12
+ export declare function addMenuEntries({ container, items, menuWidth, isInsideSubmenu, emitter, }: {
13
+ container: HTMLUListElement;
14
+ items: Item[];
15
+ menuWidth: number;
16
+ isInsideSubmenu?: boolean;
17
+ emitter: TinyEmitter;
18
+ }): void;
package/dist/main.d.ts CHANGED
@@ -1,15 +1,17 @@
1
- import type { Pixel } from 'ol/pixel';
2
- import type { Coordinate } from 'ol/coordinate';
3
1
  import OlMap from 'ol/Map';
4
- import Control from 'ol/control/Control';
5
- import BaseEvent from 'ol/events/Event';
2
+ import type { Pixel } from 'ol/pixel';
6
3
  import { EventsKey } from 'ol/events';
4
+ import BaseEvent from 'ol/events/Event';
5
+ import { ObjectEvent } from 'ol/Object';
6
+ import Control from 'ol/control/Control';
7
+ import { TinyEmitter } from 'tiny-emitter';
8
+ import type { Coordinate } from 'ol/coordinate';
7
9
  import { Types as ObjectEventTypes } from 'ol/ObjectEventType';
8
10
  import { CombinedOnSignature, EventTypes as OlEventTypes, OnSignature } from 'ol/Observable';
9
- import { ObjectEvent } from 'ol/Object';
10
11
  import { ContextMenuEvent, CustomEventTypes, Item, MenuEntry, Options } from './types';
11
12
  export default class ContextMenu extends Control {
12
13
  protected map: OlMap;
14
+ protected emitter: TinyEmitter;
13
15
  protected container: HTMLDivElement;
14
16
  protected coordinate: Coordinate;
15
17
  protected pixel: Pixel;
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.2.0
3
+ * ol-contextmenu - v5.2.1
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Mon Mar 13 2023 13:25:53 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Fri Mar 31 2023 20:27:32 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
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,rgba(0,0,0,0),rgba(0,0,0,.75),rgba(0,0,0,0))}.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,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.2.0
3
+ * ol-contextmenu - v5.2.1
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Mon Mar 13 2023 13:25:53 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Fri Mar 31 2023 20:27:32 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- var ContextMenu=function(){"use strict";var pe=Object.defineProperty;var fe=(v,u,g)=>u in v?pe(v,u,{enumerable:!0,configurable:!0,writable:!0,value:g}):v[u]=g;var l=(v,u,g)=>(fe(v,typeof u!="symbol"?u+"":u,g),g);class v{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const u=v,g={PROPERTYCHANGE:"propertychange"};class K{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const U=K;function M(){}function S(s){for(const e in s)delete s[e]}function z(s){let e;for(e in s)return!1;return!e}class B extends U{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),i=n[e]||(n[e]=[]);i.includes(t)||i.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,i=this.listeners_&&this.listeners_[n];if(!i)return;const r=t?new u(e):e;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),d=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,d[n]=0),++o[n];let p;for(let c=0,y=i.length;c<y;++c)if("handleEvent"in i[c]?p=i[c].handleEvent(r):p=i[c].call(this,r),p===!1||r.propagationStopped){p=!1;break}if(--o[n]===0){let c=d[n];for(delete d[n];c--;)this.removeEventListener(n,M);delete o[n]}return p}disposeInternal(){this.listeners_&&S(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const n=this.listeners_&&this.listeners_[e];if(n){const i=n.indexOf(t);i!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[i]=M,++this.pendingRemovals_[e]):(n.splice(i,1),n.length===0&&delete this.listeners_[e]))}}}const F=B,V={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function _(s,e,t,n,i){if(n&&n!==s&&(t=t.bind(n)),i){const o=t;t=function(){s.removeEventListener(e,t),o.apply(this,arguments)}}const r={target:s,type:e,listener:t};return s.addEventListener(e,t),r}function D(s,e,t,n){return _(s,e,t,n,!0)}function C(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),S(s))}class L extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(V.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,i=new Array(n);for(let r=0;r<n;++r)i[r]=_(this,e[r],t);return i}return _(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const i=e.length;n=new Array(i);for(let r=0;r<i;++r)n[r]=D(this,e[r],t)}else n=D(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)j(n);else if(Array.isArray(e))for(let i=0,r=e.length;i<r;++i)this.removeEventListener(e[i],t);else this.removeEventListener(e,t)}}L.prototype.on,L.prototype.once,L.prototype.un;function j(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)C(s[e]);else C(s)}const Y=L;let G=0;function Z(s){return s.ol_uid||(s.ol_uid=String(++G))}class R extends u{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class X extends Y{constructor(e){super(),this.on,this.once,this.un,Z(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new R(n,e,t)),n=g.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new R(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const i=this.values_||(this.values_={});if(n)i[e]=t;else{const r=i[e];i[e]=t,r!==t&&this.notify(e,r)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],z(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}const W=X,q={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};function P(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}class J extends W{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){P(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&P(this.element);for(let t=0,n=this.listenerKeys.length;t<n;++t)C(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==M&&this.listenerKeys.push(_(e,q.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}const Q=J;class ee extends u{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}const te=ee;class ne extends te{constructor(e,t,n,i,r,o){super(e,t,r),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=i!==void 0?i:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const se=ne;var O=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(O||{}),m=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(m||{});class $ extends se{constructor(e){super(e.type,e.map,e.originalEvent)}}const ie={width:150,scrollAt:4,eventType:O.CONTEXTMENU,defaultItems:!0,items:[]},E="ol-ctx-menu",a={namespace:E,container:`${E}-container`,separator:`${E}-separator`,submenu:`${E}-submenu`,hidden:`${E}-hidden`,icon:`${E}-icon`,zoomIn:`${E}-zoom-in`,zoomOut:`${E}-zoom-out`,unselectable:"ol-unselectable"},I=[{text:"Zoom In",classname:`${a.zoomIn} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${a.zoomOut} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())-1,duration:700,center:s.coordinate})}}];var w={},re={get exports(){return w},set exports(s){w=s}};function A(){}A.prototype={on:function(s,e,t){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:e,ctx:t}),this},once:function(s,e,t){var n=this;function i(){n.off(s,i),e.apply(t,arguments)}return i._=e,this.on(s,i,t)},emit:function(s){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[s]||[]).slice(),n=0,i=t.length;for(n;n<i;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(s,e){var t=this.e||(this.e={}),n=t[s],i=[];if(n&&e)for(var r=0,o=n.length;r<o;r++)n[r].fn!==e&&n[r].fn._!==e&&i.push(n[r]);return i.length?t[s]=i:delete t[s],this}},re.exports=A;var oe=w.TinyEmitter=A;const b=new oe;function x(s){const e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=s;t.firstChild;)e.append(t.firstChild);return e}function ae(s){const e=document.importNode(s),t=s.offsetWidth;e.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${t}px`;const n=x("<span>Foo</span>"),i=x("<span>Foo</span>"),r=document.createElement("li"),o=document.createElement("li");r.append(n),o.append(i),e.append(r),e.append(o),s.parentNode?.append(e);const d=e.offsetHeight/2;return s.parentNode?.removeChild(e),d}function k(s,e,t=!1,n=!1){const i=`_${Math.random().toString(36).slice(2,11)}`;if(typeof e!="string"&&"text"in e){const c=`<span>${e.text}</span>`,y=x(c),h=document.createElement("li");e.classname=e.classname||"",e.icon&&(e.classname===""?e.classname=a.icon:e.classname.includes(a.icon)===!1&&(e.classname+=` ${a.icon}`),h.setAttribute("style",`background-image:url(${e.icon})`)),h.id=i,h.className=e.classname,h.append(y),s.append(h);const H={id:i,isSubmenu:t,isInsideSubmenu:n,isSeparator:!1,callback:"callback"in e?e.callback:null,data:"data"in e?e.data:null};return b.emit(m.ADD_MENU_ENTRY,H,h),h}const r=`<li id="${i}" class="${a.separator}"><hr></li>`,o=x(r);s.append(o);const d=s.lastChild,p={id:i,isSubmenu:!1,isInsideSubmenu:!1,isSeparator:!0,callback:null,data:null};return b.emit(m.ADD_MENU_ENTRY,p,d),d}function N(s,e,t,n){e.forEach(i=>{if(typeof i!="string"&&"items"in i&&Array.isArray(i.items)){const r=k(s,i,!0);r.classList.add(a.submenu);const o=document.createElement("ul");o.classList.add(a.container),o.style.width=`${t}px`,r.append(o),N(o,i.items,t,!0)}else k(s,i,!1,n)})}const me="";function T(s,e){if(!s)throw new Error(e)}class le extends Q{constructor(t={}){T(typeof t=="object","@param `opts` should be object type!");const n=document.createElement("div");super({element:n});l(this,"map");l(this,"container");l(this,"coordinate",[]);l(this,"pixel",[]);l(this,"contextMenuEventListener");l(this,"entryCallbackEventListener");l(this,"mapMoveListener");l(this,"lineHeight",0);l(this,"disabled");l(this,"opened");l(this,"items",[]);l(this,"menuEntries",new Map);l(this,"options");this.options={...ie,...t};const i=document.createElement("ul");n.append(i),n.style.width=`${this.options.width}px`,n.classList.add(a.container,a.unselectable,a.hidden),this.container=n,this.contextMenuEventListener=r=>{this.handleContextMenu(r)},this.entryCallbackEventListener=r=>{this.handleEntryCallback(r)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1,window.addEventListener("beforeunload",()=>{this.removeListeners()},{once:!0})}clear(){for(const t of this.menuEntries.keys())this.removeMenuEntry(t);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return I}countItems(){return this.menuEntries.size}extend(t){T(Array.isArray(t),"@param `items` should be an Array."),N(this.container.firstElementChild,t,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(a.hidden),this.dispatchEvent(m.CLOSE)}isOpen(){return this.opened}updatePosition(t){T(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=t,this.positionContainer())}pop(){const t=Array.from(this.menuEntries.keys()).pop();t&&this.removeMenuEntry(t)}shift(){const t=Array.from(this.menuEntries.keys()).shift();t&&this.removeMenuEntry(t)}push(t){t&&this.extend([t])}setMap(t){if(super.setMap(t),t){this.map=t,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),b.on(m.ADD_MENU_ENTRY,(i,r)=>{this.handleAddMenuEntry(i,r)},this),this.items=this.options.defaultItems?this.options.items.concat(I):this.options.items,N(this.container.firstElementChild,this.items,this.options.width);const n=this.getMenuEntriesLength();this.lineHeight=n>0?this.container.offsetHeight/n:ae(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),b.off(m.ADD_MENU_ENTRY)}removeMenuEntry(t){const n=document.getElementById(t);n?.remove(),n?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(t)}handleContextMenu(t){this.coordinate=this.map.getEventCoordinate(t),this.pixel=this.map.getEventPixel(t),this.dispatchEvent(new $({type:m.BEFOREOPEN,map:this.map,originalEvent:t})),!this.disabled&&(this.options.eventType===O.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),setTimeout(()=>{this.openMenu(t)}),t.target?.addEventListener("pointerdown",n=>{this.opened&&(n.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(t){this.opened=!0,this.positionContainer(),this.container.classList.remove(a.hidden),this.dispatchEvent(new $({type:m.OPEN,map:this.map,originalEvent:t}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,t])=>t.isSeparator===!1&&t.isSubmenu===!1&&t.isInsideSubmenu===!1).length}positionContainer(){const t=this.map.getSize()||[0,0],n={w:t[0]-this.pixel[0],h:t[1]-this.pixel[1]},i=this.getMenuEntriesLength(),r={w:this.container.offsetWidth,h:Math.round(this.lineHeight*i)},o=n.w>=r.w?this.pixel[0]+5:this.pixel[0]-r.w;this.container.style.left=`${o}px`,this.container.style.top=n.h>=r.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-r.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",n.w-=r.w;const d=y=>Array.from(y.children).filter(h=>h.tagName==="LI"&&h.classList.contains(a.submenu));let p=0;const c=(y,h)=>{p+=1,d(y).forEach(he=>{const ce=h>=r.w?r.w-8:(r.w+8)*-1,f=he.querySelector(`ul.${a.container}`),ue=Math.round(this.lineHeight*Array.from(f.children).filter(de=>de.tagName==="LI").length);f.style.left=`${ce}px`,f.style.right="auto",f.style.top=n.h>=ue+r.h?"0":`-${f.offsetHeight-25}px`,f.style.bottom="auto",f.style.zIndex=String(p),d(f).length>0&&c(f,h-r.w)})};c(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(t){t.preventDefault(),t.stopPropagation();const n=t.currentTarget,i=this.menuEntries.get(n.id);if(!i)return;const r={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(r,this.map)}handleAddMenuEntry(t,n){this.menuEntries.set(t.id,t),this.positionContainer(),"callback"in t&&typeof t.callback=="function"&&n.addEventListener("click",this.entryCallbackEventListener,!1)}}return le}();
8
+ var ContextMenu=function(){"use strict";var de=Object.defineProperty;var pe=(v,u,g)=>u in v?de(v,u,{enumerable:!0,configurable:!0,writable:!0,value:g}):v[u]=g;var h=(v,u,g)=>(pe(v,typeof u!="symbol"?u+"":u,g),g);class v{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const u=v,g={PROPERTYCHANGE:"propertychange"};class K{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const U=K;function M(){}function D(s){for(const e in s)delete s[e]}function z(s){let e;for(e in s)return!1;return!e}class B extends U{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const i=t?new u(e):e;i.target||(i.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),l=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,l[n]=0),++o[n];let d;for(let c=0,_=r.length;c<_;++c)if("handleEvent"in r[c]?d=r[c].handleEvent(i):d=r[c].call(this,i),d===!1||i.propagationStopped){d=!1;break}if(--o[n]===0){let c=l[n];for(delete l[n];c--;)this.removeEventListener(n,M);delete o[n]}return d}disposeInternal(){this.listeners_&&D(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const n=this.listeners_&&this.listeners_[e];if(n){const r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=M,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}}}const F=B,V={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function b(s,e,t,n,r){if(n&&n!==s&&(t=t.bind(n)),r){const o=t;t=function(){s.removeEventListener(e,t),o.apply(this,arguments)}}const i={target:s,type:e,listener:t};return s.addEventListener(e,t),i}function R(s,e,t,n){return b(s,e,t,n,!0)}function C(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),D(s))}class L extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(V.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=b(this,e[i],t);return r}return b(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const r=e.length;n=new Array(r);for(let i=0;i<r;++i)n[i]=R(this,e[i],t)}else n=R(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)j(n);else if(Array.isArray(e))for(let r=0,i=e.length;r<i;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}L.prototype.on,L.prototype.once,L.prototype.un;function j(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)C(s[e]);else C(s)}const Y=L;let G=0;function Z(s){return s.ol_uid||(s.ol_uid=String(++G))}class P extends u{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class W extends Y{constructor(e){super(),this.on,this.once,this.un,Z(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new P(n,e,t)),n=g.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new P(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const r=this.values_||(this.values_={});if(n)r[e]=t;else{const i=r[e];r[e]=t,i!==t&&this.notify(e,i)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],z(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}const X=W,q={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};function $(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}class J extends X{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){$(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&$(this.element);for(let t=0,n=this.listenerKeys.length;t<n;++t)C(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==M&&this.listenerKeys.push(b(e,q.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}const Q=J;var O={},ee={get exports(){return O},set exports(s){O=s}};function w(){}w.prototype={on:function(s,e,t){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:e,ctx:t}),this},once:function(s,e,t){var n=this;function r(){n.off(s,r),e.apply(t,arguments)}return r._=e,this.on(s,r,t)},emit:function(s){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[s]||[]).slice(),n=0,r=t.length;for(n;n<r;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(s,e){var t=this.e||(this.e={}),n=t[s],r=[];if(n&&e)for(var i=0,o=n.length;i<o;i++)n[i].fn!==e&&n[i].fn._!==e&&r.push(n[i]);return r.length?t[s]=r:delete t[s],this}},ee.exports=w;var te=O.TinyEmitter=w;class ne extends u{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}const se=ne;class ie extends se{constructor(e,t,n,r,i,o){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const re=ie;var A=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(A||{}),f=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(f||{});class I extends re{constructor(e){super(e.type,e.map,e.originalEvent)}}const oe={width:150,scrollAt:4,eventType:A.CONTEXTMENU,defaultItems:!0,items:[]},m="ol-ctx-menu",a={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"},H=[{text:"Zoom In",classname:`${a.zoomIn} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${a.zoomOut} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())-1,duration:700,center:s.coordinate})}}];function x(s){const e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=s;t.firstChild;)e.append(t.firstChild);return e}function ae(s){const e=document.importNode(s),t=s.offsetWidth;e.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${t}px`;const n=x("<span>Foo</span>"),r=x("<span>Foo</span>"),i=document.createElement("li"),o=document.createElement("li");i.append(n),o.append(r),e.append(i),e.append(o),s.parentNode?.append(e);const l=e.offsetHeight/2;return s.parentNode?.removeChild(e),l}function k({parentNode:s,item:e,isSubmenu:t=!1,isInsideSubmenu:n=!1,emitter:r}){const i=`_${Math.random().toString(36).slice(2,11)}`;if(typeof e!="string"&&"text"in e){const _=`<span>${e.text}</span>`,y=x(_),E=document.createElement("li");e.classname=e.classname||"",e.icon&&(e.classname===""?e.classname=a.icon:e.classname.includes(a.icon)===!1&&(e.classname+=` ${a.icon}`),E.setAttribute("style",`background-image:url(${e.icon})`)),E.id=i,E.className=e.classname,E.append(y),s.append(E);const T={id:i,isSubmenu:t,isInsideSubmenu:n,isSeparator:!1,callback:"callback"in e?e.callback:null,data:"data"in e?e.data:null};return r.emit(f.ADD_MENU_ENTRY,T,E),E}const o=`<li id="${i}" class="${a.separator}"><hr></li>`,l=x(o);s.append(l);const d=s.lastChild,c={id:i,isSubmenu:!1,isInsideSubmenu:!1,isSeparator:!0,callback:null,data:null};return r.emit(f.ADD_MENU_ENTRY,c,d),d}function N({container:s,items:e,menuWidth:t,isInsideSubmenu:n,emitter:r}){e.forEach(i=>{if(typeof i!="string"&&"items"in i&&Array.isArray(i.items)){const o=k({parentNode:s,item:i,isSubmenu:!0,emitter:r});o.classList.add(a.submenu);const l=document.createElement("ul");l.classList.add(a.container),l.style.width=`${t}px`,o.append(l),N({emitter:r,menuWidth:t,container:l,items:i.items,isInsideSubmenu:!0})}else k({parentNode:s,item:i,isSubmenu:!1,isInsideSubmenu:n,emitter:r})})}const fe="";function S(s,e){if(!s)throw new Error(e)}class le extends Q{constructor(t={}){S(typeof t=="object","@param `opts` should be object type!");const n=document.createElement("div");super({element:n});h(this,"map");h(this,"emitter",new te);h(this,"container");h(this,"coordinate",[]);h(this,"pixel",[]);h(this,"contextMenuEventListener");h(this,"entryCallbackEventListener");h(this,"mapMoveListener");h(this,"lineHeight",0);h(this,"disabled");h(this,"opened");h(this,"items",[]);h(this,"menuEntries",new Map);h(this,"options");this.options={...oe,...t};const r=document.createElement("ul");n.append(r),n.style.width=`${this.options.width}px`,n.classList.add(a.container,a.unselectable,a.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 t of this.menuEntries.keys())this.removeMenuEntry(t);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return H}countItems(){return this.menuEntries.size}extend(t){S(Array.isArray(t),"@param `items` should be an Array."),N({items:t,emitter:this.emitter,menuWidth:this.options.width,container:this.container.firstElementChild})}closeMenu(){this.opened=!1,this.container.classList.add(a.hidden),this.dispatchEvent(f.CLOSE)}isOpen(){return this.opened}updatePosition(t){S(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=t,this.positionContainer())}pop(){const t=Array.from(this.menuEntries.keys()).pop();t&&this.removeMenuEntry(t)}shift(){const t=Array.from(this.menuEntries.keys()).shift();t&&this.removeMenuEntry(t)}push(t){t&&this.extend([t])}setMap(t){if(super.setMap(t),t){this.map=t,t.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),t.on("movestart",()=>{this.handleMapMove()}),this.emitter.on(f.ADD_MENU_ENTRY,(r,i)=>{this.handleAddMenuEntry(r,i)},this),this.items=this.options.defaultItems?this.options.items.concat(H):this.options.items,N({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:ae(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.emitter.off(f.ADD_MENU_ENTRY)}removeMenuEntry(t){let n=document.getElementById(t);n?.remove(),n=null,this.menuEntries.delete(t)}handleContextMenu(t){this.coordinate=this.map.getEventCoordinate(t),this.pixel=this.map.getEventPixel(t),this.dispatchEvent(new I({map:this.map,originalEvent:t,type:f.BEFOREOPEN})),!this.disabled&&(this.options.eventType===A.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),setTimeout(()=>{this.openMenu(t)}),t.target?.addEventListener("pointerdown",n=>{this.opened&&(n.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(t){this.opened=!0,this.positionContainer(),this.container.classList.remove(a.hidden),this.dispatchEvent(new I({map:this.map,originalEvent:t,type:f.OPEN}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,t])=>t.isSeparator===!1&&t.isSubmenu===!1&&t.isInsideSubmenu===!1).length}positionContainer(){const t=this.map.getSize()||[0,0],n={w:t[0]-this.pixel[0],h:t[1]-this.pixel[1]},r=this.getMenuEntriesLength(),i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*r)},o=n.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}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 l=_=>Array.from(_.children).filter(y=>y.tagName==="LI"&&y.classList.contains(a.submenu));let d=0;const c=(_,y)=>{d+=1,l(_).forEach(T=>{const he=y>=i.w?i.w-8:(i.w+8)*-1,p=T.querySelector(`ul.${a.container}`),ce=Math.round(this.lineHeight*Array.from(p.children).filter(ue=>ue.tagName==="LI").length);p.style.left=`${he}px`,p.style.right="auto",p.style.top=n.h>=ce+i.h?"0":`-${p.offsetHeight-25}px`,p.style.bottom="auto",p.style.zIndex=String(d),l(p).length>0&&c(p,y-i.w)})};c(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(t){t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r=this.menuEntries.get(n.id);if(!r)return;const i={data:r.data,coordinate:this.coordinate};this.closeMenu(),r.callback?.(i,this.map)}handleAddMenuEntry(t,n){this.menuEntries.set(t.id,t),this.positionContainer(),"callback"in t&&typeof t.callback=="function"&&n.addEventListener("click",this.entryCallbackEventListener,!1)}}return le}();
@@ -1,14 +1,14 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.2.0
3
+ * ol-contextmenu - v5.2.1
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Mon Mar 13 2023 13:25:53 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Fri Mar 31 2023 20:27:32 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- var z = Object.defineProperty;
9
- var B = (s, e, t) => e in s ? z(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
10
- var l = (s, e, t) => (B(s, typeof e != "symbol" ? e + "" : e, t), t);
11
- class F {
8
+ var U = Object.defineProperty;
9
+ var z = (s, e, t) => e in s ? U(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
10
+ var h = (s, e, t) => (z(s, typeof e != "symbol" ? e + "" : e, t), t);
11
+ class B {
12
12
  /**
13
13
  * @param {string} type Type.
14
14
  */
@@ -31,7 +31,7 @@ class F {
31
31
  this.propagationStopped = !0;
32
32
  }
33
33
  }
34
- const O = F, V = {
34
+ const w = B, F = {
35
35
  /**
36
36
  * Triggered when a property is changed.
37
37
  * @event module:ol/Object.ObjectEvent#propertychange
@@ -39,7 +39,7 @@ const O = F, V = {
39
39
  */
40
40
  PROPERTYCHANGE: "propertychange"
41
41
  };
42
- class j {
42
+ class V {
43
43
  constructor() {
44
44
  this.disposed = !1;
45
45
  }
@@ -56,20 +56,20 @@ class j {
56
56
  disposeInternal() {
57
57
  }
58
58
  }
59
- const Y = j;
60
- function b() {
59
+ const j = V;
60
+ function x() {
61
61
  }
62
62
  function I(s) {
63
63
  for (const e in s)
64
64
  delete s[e];
65
65
  }
66
- function G(s) {
66
+ function Y(s) {
67
67
  let e;
68
68
  for (e in s)
69
69
  return !1;
70
70
  return !e;
71
71
  }
72
- class Z extends Y {
72
+ class G extends j {
73
73
  /**
74
74
  * @param {*} [target] Default event target for dispatched events.
75
75
  */
@@ -83,8 +83,8 @@ class Z extends Y {
83
83
  addEventListener(e, t) {
84
84
  if (!e || !t)
85
85
  return;
86
- const n = this.listeners_ || (this.listeners_ = {}), i = n[e] || (n[e] = []);
87
- i.includes(t) || i.push(t);
86
+ const n = this.listeners_ || (this.listeners_ = {}), r = n[e] || (n[e] = []);
87
+ r.includes(t) || r.push(t);
88
88
  }
89
89
  /**
90
90
  * Dispatches an event and calls all listeners listening for events
@@ -97,31 +97,31 @@ class Z extends Y {
97
97
  * @api
98
98
  */
99
99
  dispatchEvent(e) {
100
- const t = typeof e == "string", n = t ? e : e.type, i = this.listeners_ && this.listeners_[n];
101
- if (!i)
100
+ const t = typeof e == "string", n = t ? e : e.type, r = this.listeners_ && this.listeners_[n];
101
+ if (!r)
102
102
  return;
103
- const r = t ? new O(e) : (
103
+ const i = t ? new w(e) : (
104
104
  /** @type {Event} */
105
105
  e
106
106
  );
107
- r.target || (r.target = this.eventTarget_ || this);
108
- const o = this.dispatching_ || (this.dispatching_ = {}), u = this.pendingRemovals_ || (this.pendingRemovals_ = {});
109
- n in o || (o[n] = 0, u[n] = 0), ++o[n];
110
- let d;
111
- for (let c = 0, E = i.length; c < E; ++c)
112
- if ("handleEvent" in i[c] ? d = /** @type {import("../events.js").ListenerObject} */
113
- i[c].handleEvent(r) : d = /** @type {import("../events.js").ListenerFunction} */
114
- i[c].call(this, r), d === !1 || r.propagationStopped) {
115
- d = !1;
107
+ i.target || (i.target = this.eventTarget_ || this);
108
+ const o = this.dispatching_ || (this.dispatching_ = {}), l = this.pendingRemovals_ || (this.pendingRemovals_ = {});
109
+ n in o || (o[n] = 0, l[n] = 0), ++o[n];
110
+ let u;
111
+ for (let c = 0, E = r.length; c < E; ++c)
112
+ if ("handleEvent" in r[c] ? u = /** @type {import("../events.js").ListenerObject} */
113
+ r[c].handleEvent(i) : u = /** @type {import("../events.js").ListenerFunction} */
114
+ r[c].call(this, i), u === !1 || i.propagationStopped) {
115
+ u = !1;
116
116
  break;
117
117
  }
118
118
  if (--o[n] === 0) {
119
- let c = u[n];
120
- for (delete u[n]; c--; )
121
- this.removeEventListener(n, b);
119
+ let c = l[n];
120
+ for (delete l[n]; c--; )
121
+ this.removeEventListener(n, x);
122
122
  delete o[n];
123
123
  }
124
- return d;
124
+ return u;
125
125
  }
126
126
  /**
127
127
  * Clean up.
@@ -154,12 +154,12 @@ class Z extends Y {
154
154
  removeEventListener(e, t) {
155
155
  const n = this.listeners_ && this.listeners_[e];
156
156
  if (n) {
157
- const i = n.indexOf(t);
158
- i !== -1 && (this.pendingRemovals_ && e in this.pendingRemovals_ ? (n[i] = b, ++this.pendingRemovals_[e]) : (n.splice(i, 1), n.length === 0 && delete this.listeners_[e]));
157
+ const r = n.indexOf(t);
158
+ r !== -1 && (this.pendingRemovals_ && e in this.pendingRemovals_ ? (n[r] = x, ++this.pendingRemovals_[e]) : (n.splice(r, 1), n.length === 0 && delete this.listeners_[e]));
159
159
  }
160
160
  }
161
161
  }
162
- const X = Z, W = {
162
+ const Z = G, W = {
163
163
  /**
164
164
  * Generic change event. Triggered when the revision counter is increased.
165
165
  * @event module:ol/events/Event~BaseEvent#change
@@ -188,27 +188,27 @@ const X = Z, W = {
188
188
  TOUCHMOVE: "touchmove",
189
189
  WHEEL: "wheel"
190
190
  };
191
- function v(s, e, t, n, i) {
192
- if (n && n !== s && (t = t.bind(n)), i) {
191
+ function g(s, e, t, n, r) {
192
+ if (n && n !== s && (t = t.bind(n)), r) {
193
193
  const o = t;
194
194
  t = function() {
195
195
  s.removeEventListener(e, t), o.apply(this, arguments);
196
196
  };
197
197
  }
198
- const r = {
198
+ const i = {
199
199
  target: s,
200
200
  type: e,
201
201
  listener: t
202
202
  };
203
- return s.addEventListener(e, t), r;
203
+ return s.addEventListener(e, t), i;
204
204
  }
205
- function T(s, e, t, n) {
206
- return v(s, e, t, n, !0);
205
+ function S(s, e, t, n) {
206
+ return g(s, e, t, n, !0);
207
207
  }
208
- function x(s) {
208
+ function M(s) {
209
209
  s && s.target && (s.target.removeEventListener(s.type, s.listener), I(s));
210
210
  }
211
- class _ extends X {
211
+ class y extends Z {
212
212
  constructor() {
213
213
  super(), this.on = /** @type {ObservableOnSignature<import("./events").EventsKey>} */
214
214
  this.onInternal, this.once = /** @type {ObservableOnSignature<import("./events").EventsKey>} */
@@ -239,12 +239,12 @@ class _ extends X {
239
239
  */
240
240
  onInternal(e, t) {
241
241
  if (Array.isArray(e)) {
242
- const n = e.length, i = new Array(n);
243
- for (let r = 0; r < n; ++r)
244
- i[r] = v(this, e[r], t);
245
- return i;
242
+ const n = e.length, r = new Array(n);
243
+ for (let i = 0; i < n; ++i)
244
+ r[i] = g(this, e[i], t);
245
+ return r;
246
246
  }
247
- return v(
247
+ return g(
248
248
  this,
249
249
  /** @type {string} */
250
250
  e,
@@ -260,12 +260,12 @@ class _ extends X {
260
260
  onceInternal(e, t) {
261
261
  let n;
262
262
  if (Array.isArray(e)) {
263
- const i = e.length;
264
- n = new Array(i);
265
- for (let r = 0; r < i; ++r)
266
- n[r] = T(this, e[r], t);
263
+ const r = e.length;
264
+ n = new Array(r);
265
+ for (let i = 0; i < r; ++i)
266
+ n[i] = S(this, e[i], t);
267
267
  } else
268
- n = T(
268
+ n = S(
269
269
  this,
270
270
  /** @type {string} */
271
271
  e,
@@ -285,33 +285,33 @@ class _ extends X {
285
285
  t.ol_key
286
286
  );
287
287
  if (n)
288
- q(n);
288
+ X(n);
289
289
  else if (Array.isArray(e))
290
- for (let i = 0, r = e.length; i < r; ++i)
291
- this.removeEventListener(e[i], t);
290
+ for (let r = 0, i = e.length; r < i; ++r)
291
+ this.removeEventListener(e[r], t);
292
292
  else
293
293
  this.removeEventListener(e, t);
294
294
  }
295
295
  }
296
- _.prototype.on;
297
- _.prototype.once;
298
- _.prototype.un;
299
- function q(s) {
296
+ y.prototype.on;
297
+ y.prototype.once;
298
+ y.prototype.un;
299
+ function X(s) {
300
300
  if (Array.isArray(s))
301
301
  for (let e = 0, t = s.length; e < t; ++e)
302
- x(s[e]);
302
+ M(s[e]);
303
303
  else
304
- x(
304
+ M(
305
305
  /** @type {import("./events.js").EventsKey} */
306
306
  s
307
307
  );
308
308
  }
309
- const J = _;
310
- let Q = 0;
311
- function ee(s) {
312
- return s.ol_uid || (s.ol_uid = String(++Q));
309
+ const q = y;
310
+ let J = 0;
311
+ function Q(s) {
312
+ return s.ol_uid || (s.ol_uid = String(++J));
313
313
  }
314
- class S extends O {
314
+ class T extends w {
315
315
  /**
316
316
  * @param {string} type The event type.
317
317
  * @param {string} key The property name.
@@ -321,12 +321,12 @@ class S extends O {
321
321
  super(e), this.key = t, this.oldValue = n;
322
322
  }
323
323
  }
324
- class te extends J {
324
+ class ee extends q {
325
325
  /**
326
326
  * @param {Object<string, *>} [values] An object with key-value pairs.
327
327
  */
328
328
  constructor(e) {
329
- super(), this.on, this.once, this.un, ee(this), this.values_ = null, e !== void 0 && this.setProperties(e);
329
+ super(), this.on, this.once, this.un, Q(this), this.values_ = null, e !== void 0 && this.setProperties(e);
330
330
  }
331
331
  /**
332
332
  * Gets a value.
@@ -366,7 +366,7 @@ class te extends J {
366
366
  */
367
367
  notify(e, t) {
368
368
  let n;
369
- n = `change:${e}`, this.hasListener(n) && this.dispatchEvent(new S(n, e, t)), n = V.PROPERTYCHANGE, this.hasListener(n) && this.dispatchEvent(new S(n, e, t));
369
+ n = `change:${e}`, this.hasListener(n) && this.dispatchEvent(new T(n, e, t)), n = F.PROPERTYCHANGE, this.hasListener(n) && this.dispatchEvent(new T(n, e, t));
370
370
  }
371
371
  /**
372
372
  * @param {string} key Key name.
@@ -390,12 +390,12 @@ class te extends J {
390
390
  * @api
391
391
  */
392
392
  set(e, t, n) {
393
- const i = this.values_ || (this.values_ = {});
393
+ const r = this.values_ || (this.values_ = {});
394
394
  if (n)
395
- i[e] = t;
395
+ r[e] = t;
396
396
  else {
397
- const r = i[e];
398
- i[e] = t, r !== t && this.notify(e, r);
397
+ const i = r[e];
398
+ r[e] = t, i !== t && this.notify(e, i);
399
399
  }
400
400
  }
401
401
  /**
@@ -426,11 +426,11 @@ class te extends J {
426
426
  unset(e, t) {
427
427
  if (this.values_ && e in this.values_) {
428
428
  const n = this.values_[e];
429
- delete this.values_[e], G(this.values_) && (this.values_ = null), t || this.notify(e, n);
429
+ delete this.values_[e], Y(this.values_) && (this.values_ = null), t || this.notify(e, n);
430
430
  }
431
431
  }
432
432
  }
433
- const ne = te, se = {
433
+ const te = ee, ne = {
434
434
  /**
435
435
  * Triggered after a map frame is rendered.
436
436
  * @event module:ol/MapEvent~MapEvent#postrender
@@ -465,7 +465,7 @@ const ne = te, se = {
465
465
  function D(s) {
466
466
  return s && s.parentNode ? s.parentNode.removeChild(s) : null;
467
467
  }
468
- class ie extends ne {
468
+ class se extends te {
469
469
  /**
470
470
  * @param {Options} options Control options.
471
471
  */
@@ -499,9 +499,9 @@ class ie extends ne {
499
499
  setMap(e) {
500
500
  this.map_ && D(this.element);
501
501
  for (let t = 0, n = this.listenerKeys.length; t < n; ++t)
502
- x(this.listenerKeys[t]);
503
- this.listenerKeys.length = 0, this.map_ = e, e && ((this.target_ ? this.target_ : e.getOverlayContainerStopEvent()).appendChild(this.element), this.render !== b && this.listenerKeys.push(
504
- v(e, se.POSTRENDER, this.render, this)
502
+ M(this.listenerKeys[t]);
503
+ this.listenerKeys.length = 0, this.map_ = e, e && ((this.target_ ? this.target_ : e.getOverlayContainerStopEvent()).appendChild(this.element), this.render !== x && this.listenerKeys.push(
504
+ g(e, ne.POSTRENDER, this.render, this)
505
505
  ), e.render());
506
506
  }
507
507
  /**
@@ -524,8 +524,49 @@ class ie extends ne {
524
524
  this.target_ = typeof e == "string" ? document.getElementById(e) : e;
525
525
  }
526
526
  }
527
- const re = ie;
528
- class oe extends O {
527
+ const ie = se;
528
+ var C = {}, re = {
529
+ get exports() {
530
+ return C;
531
+ },
532
+ set exports(s) {
533
+ C = s;
534
+ }
535
+ };
536
+ function A() {
537
+ }
538
+ A.prototype = {
539
+ on: function(s, e, t) {
540
+ var n = this.e || (this.e = {});
541
+ return (n[s] || (n[s] = [])).push({
542
+ fn: e,
543
+ ctx: t
544
+ }), this;
545
+ },
546
+ once: function(s, e, t) {
547
+ var n = this;
548
+ function r() {
549
+ n.off(s, r), e.apply(t, arguments);
550
+ }
551
+ return r._ = e, this.on(s, r, t);
552
+ },
553
+ emit: function(s) {
554
+ var e = [].slice.call(arguments, 1), t = ((this.e || (this.e = {}))[s] || []).slice(), n = 0, r = t.length;
555
+ for (n; n < r; n++)
556
+ t[n].fn.apply(t[n].ctx, e);
557
+ return this;
558
+ },
559
+ off: function(s, e) {
560
+ var t = this.e || (this.e = {}), n = t[s], r = [];
561
+ if (n && e)
562
+ for (var i = 0, o = n.length; i < o; i++)
563
+ n[i].fn !== e && n[i].fn._ !== e && r.push(n[i]);
564
+ return r.length ? t[s] = r : delete t[s], this;
565
+ }
566
+ };
567
+ re.exports = A;
568
+ var oe = C.TinyEmitter = A;
569
+ class ae extends w {
529
570
  /**
530
571
  * @param {string} type Event type.
531
572
  * @param {import("./Map.js").default} map Map.
@@ -535,8 +576,8 @@ class oe extends O {
535
576
  super(e), this.map = t, this.frameState = n !== void 0 ? n : null;
536
577
  }
537
578
  }
538
- const ae = oe;
539
- class le extends ae {
579
+ const le = ae;
580
+ class he extends le {
540
581
  /**
541
582
  * @param {string} type Event type.
542
583
  * @param {import("./Map.js").default} map Map.
@@ -545,8 +586,8 @@ class le extends ae {
545
586
  * @param {import("./Map.js").FrameState} [frameState] Frame state.
546
587
  * @param {Array<PointerEvent>} [activePointers] Active pointers.
547
588
  */
548
- constructor(e, t, n, i, r, o) {
549
- super(e, t, r), this.originalEvent = n, this.pixel_ = null, this.coordinate_ = null, this.dragging = i !== void 0 ? i : !1, this.activePointers = o;
589
+ constructor(e, t, n, r, i, o) {
590
+ super(e, t, i), this.originalEvent = n, this.pixel_ = null, this.coordinate_ = null, this.dragging = r !== void 0 ? r : !1, this.activePointers = o;
550
591
  }
551
592
  /**
552
593
  * The map pixel relative to the viewport corresponding to the original event.
@@ -588,17 +629,17 @@ class le extends ae {
588
629
  super.stopPropagation(), "stopPropagation" in this.originalEvent && this.originalEvent.stopPropagation();
589
630
  }
590
631
  }
591
- const he = le;
592
- var w = /* @__PURE__ */ ((s) => (s.CONTEXTMENU = "contextmenu", s.CLICK = "click", s.DBLCLICK = "dblclick", s))(w || {}), m = /* @__PURE__ */ ((s) => (s.BEFOREOPEN = "beforeopen", s.OPEN = "open", s.CLOSE = "close", s.ADD_MENU_ENTRY = "add-menu-entry", s))(m || {});
593
- class R extends he {
632
+ const ce = he;
633
+ var N = /* @__PURE__ */ ((s) => (s.CONTEXTMENU = "contextmenu", s.CLICK = "click", s.DBLCLICK = "dblclick", s))(N || {}), m = /* @__PURE__ */ ((s) => (s.BEFOREOPEN = "beforeopen", s.OPEN = "open", s.CLOSE = "close", s.ADD_MENU_ENTRY = "add-menu-entry", s))(m || {});
634
+ class R extends ce {
594
635
  constructor(e) {
595
636
  super(e.type, e.map, e.originalEvent);
596
637
  }
597
638
  }
598
- const ce = {
639
+ const ue = {
599
640
  width: 150,
600
641
  scrollAt: 4,
601
- eventType: w.CONTEXTMENU,
642
+ eventType: N.CONTEXTMENU,
602
643
  defaultItems: !0,
603
644
  items: []
604
645
  }, f = "ol-ctx-menu", a = {
@@ -637,68 +678,32 @@ const ce = {
637
678
  }
638
679
  }
639
680
  ];
640
- var M = {}, ue = {
641
- get exports() {
642
- return M;
643
- },
644
- set exports(s) {
645
- M = s;
646
- }
647
- };
648
- function A() {
649
- }
650
- A.prototype = {
651
- on: function(s, e, t) {
652
- var n = this.e || (this.e = {});
653
- return (n[s] || (n[s] = [])).push({
654
- fn: e,
655
- ctx: t
656
- }), this;
657
- },
658
- once: function(s, e, t) {
659
- var n = this;
660
- function i() {
661
- n.off(s, i), e.apply(t, arguments);
662
- }
663
- return i._ = e, this.on(s, i, t);
664
- },
665
- emit: function(s) {
666
- var e = [].slice.call(arguments, 1), t = ((this.e || (this.e = {}))[s] || []).slice(), n = 0, i = t.length;
667
- for (n; n < i; n++)
668
- t[n].fn.apply(t[n].ctx, e);
669
- return this;
670
- },
671
- off: function(s, e) {
672
- var t = this.e || (this.e = {}), n = t[s], i = [];
673
- if (n && e)
674
- for (var r = 0, o = n.length; r < o; r++)
675
- n[r].fn !== e && n[r].fn._ !== e && i.push(n[r]);
676
- return i.length ? t[s] = i : delete t[s], this;
677
- }
678
- };
679
- ue.exports = A;
680
- var de = M.TinyEmitter = A;
681
- const g = new de();
682
- function y(s) {
681
+ function _(s) {
683
682
  const e = document.createDocumentFragment(), t = document.createElement("div");
684
683
  for (t.innerHTML = s; t.firstChild; )
685
684
  e.append(t.firstChild);
686
685
  return e;
687
686
  }
688
- function pe(s) {
687
+ function de(s) {
689
688
  const e = document.importNode(s), t = s.offsetWidth;
690
689
  e.style.cssText = `position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${t}px`;
691
- const n = y("<span>Foo</span>"), i = y("<span>Foo</span>"), r = document.createElement("li"), o = document.createElement("li");
692
- r.append(n), o.append(i), e.append(r), e.append(o), s.parentNode?.append(e);
693
- const u = e.offsetHeight / 2;
694
- return s.parentNode?.removeChild(e), u;
690
+ const n = _("<span>Foo</span>"), r = _("<span>Foo</span>"), i = document.createElement("li"), o = document.createElement("li");
691
+ i.append(n), o.append(r), e.append(i), e.append(o), s.parentNode?.append(e);
692
+ const l = e.offsetHeight / 2;
693
+ return s.parentNode?.removeChild(e), l;
695
694
  }
696
- function $(s, e, t = !1, n = !1) {
695
+ function $({
696
+ parentNode: s,
697
+ item: e,
698
+ isSubmenu: t = !1,
699
+ isInsideSubmenu: n = !1,
700
+ emitter: r
701
+ }) {
697
702
  const i = `_${Math.random().toString(36).slice(2, 11)}`;
698
703
  if (typeof e != "string" && "text" in e) {
699
- const c = `<span>${e.text}</span>`, E = y(c), h = document.createElement("li");
700
- e.classname = e.classname || "", e.icon && (e.classname === "" ? e.classname = a.icon : e.classname.includes(a.icon) === !1 && (e.classname += ` ${a.icon}`), h.setAttribute("style", `background-image:url(${e.icon})`)), h.id = i, h.className = e.classname, h.append(E), s.append(h);
701
- const N = {
704
+ const E = `<span>${e.text}</span>`, v = _(E), p = document.createElement("li");
705
+ e.classname = e.classname || "", e.icon && (e.classname === "" ? e.classname = a.icon : e.classname.includes(a.icon) === !1 && (e.classname += ` ${a.icon}`), p.setAttribute("style", `background-image:url(${e.icon})`)), p.id = i, p.className = e.classname, p.append(v), s.append(p);
706
+ const b = {
702
707
  id: i,
703
708
  isSubmenu: t,
704
709
  isInsideSubmenu: n,
@@ -706,11 +711,11 @@ function $(s, e, t = !1, n = !1) {
706
711
  callback: "callback" in e ? e.callback : null,
707
712
  data: "data" in e ? e.data : null
708
713
  };
709
- return g.emit(m.ADD_MENU_ENTRY, N, h), h;
714
+ return r.emit(m.ADD_MENU_ENTRY, b, p), p;
710
715
  }
711
- const r = `<li id="${i}" class="${a.separator}"><hr></li>`, o = y(r);
712
- s.append(o);
713
- const u = s.lastChild, d = {
716
+ const o = `<li id="${i}" class="${a.separator}"><hr></li>`, l = _(o);
717
+ s.append(l);
718
+ const u = s.lastChild, c = {
714
719
  id: i,
715
720
  isSubmenu: !1,
716
721
  isInsideSubmenu: !1,
@@ -718,51 +723,70 @@ function $(s, e, t = !1, n = !1) {
718
723
  callback: null,
719
724
  data: null
720
725
  };
721
- return g.emit(m.ADD_MENU_ENTRY, d, u), u;
726
+ return r.emit(m.ADD_MENU_ENTRY, c, u), u;
722
727
  }
723
- function C(s, e, t, n) {
728
+ function O({
729
+ container: s,
730
+ items: e,
731
+ menuWidth: t,
732
+ isInsideSubmenu: n,
733
+ emitter: r
734
+ }) {
724
735
  e.forEach((i) => {
725
736
  if (typeof i != "string" && "items" in i && Array.isArray(i.items)) {
726
- const r = $(s, i, !0);
727
- r.classList.add(a.submenu);
728
- const o = document.createElement("ul");
729
- o.classList.add(a.container), o.style.width = `${t}px`, r.append(o), C(o, i.items, t, !0);
737
+ const o = $({ parentNode: s, item: i, isSubmenu: !0, emitter: r });
738
+ o.classList.add(a.submenu);
739
+ const l = document.createElement("ul");
740
+ l.classList.add(a.container), l.style.width = `${t}px`, o.append(l), O({
741
+ emitter: r,
742
+ menuWidth: t,
743
+ container: l,
744
+ items: i.items,
745
+ isInsideSubmenu: !0
746
+ });
730
747
  } else
731
- $(s, i, !1, n);
748
+ $({
749
+ parentNode: s,
750
+ item: i,
751
+ isSubmenu: !1,
752
+ isInsideSubmenu: n,
753
+ emitter: r
754
+ });
732
755
  });
733
756
  }
734
757
  function L(s, e) {
735
758
  if (!s)
736
759
  throw new Error(e);
737
760
  }
738
- class me extends re {
761
+ class fe extends ie {
739
762
  constructor(t = {}) {
740
763
  L(typeof t == "object", "@param `opts` should be object type!");
741
764
  const n = document.createElement("div");
742
765
  super({ element: n });
743
- l(this, "map");
744
- l(this, "container");
745
- l(this, "coordinate", []);
746
- l(this, "pixel", []);
747
- l(this, "contextMenuEventListener");
748
- l(this, "entryCallbackEventListener");
749
- l(this, "mapMoveListener");
750
- l(this, "lineHeight", 0);
751
- l(this, "disabled");
752
- l(this, "opened");
753
- l(this, "items", []);
754
- l(this, "menuEntries", /* @__PURE__ */ new Map());
755
- l(this, "options");
756
- this.options = { ...ce, ...t };
757
- const i = document.createElement("ul");
758
- n.append(i), n.style.width = `${this.options.width}px`, n.classList.add(
766
+ h(this, "map");
767
+ h(this, "emitter", new oe());
768
+ h(this, "container");
769
+ h(this, "coordinate", []);
770
+ h(this, "pixel", []);
771
+ h(this, "contextMenuEventListener");
772
+ h(this, "entryCallbackEventListener");
773
+ h(this, "mapMoveListener");
774
+ h(this, "lineHeight", 0);
775
+ h(this, "disabled");
776
+ h(this, "opened");
777
+ h(this, "items", []);
778
+ h(this, "menuEntries", /* @__PURE__ */ new Map());
779
+ h(this, "options");
780
+ this.options = { ...ue, ...t };
781
+ const r = document.createElement("ul");
782
+ n.append(r), n.style.width = `${this.options.width}px`, n.classList.add(
759
783
  a.container,
760
784
  a.unselectable,
761
785
  a.hidden
762
- ), this.container = n, this.contextMenuEventListener = (r) => {
763
- this.handleContextMenu(r);
764
- }, this.entryCallbackEventListener = (r) => {
765
- this.handleEntryCallback(r);
786
+ ), this.container = n, this.contextMenuEventListener = (i) => {
787
+ this.handleContextMenu(i);
788
+ }, this.entryCallbackEventListener = (i) => {
789
+ this.handleEntryCallback(i);
766
790
  }, this.mapMoveListener = () => {
767
791
  this.handleMapMove();
768
792
  }, this.disabled = !1, this.opened = !1, window.addEventListener(
@@ -791,11 +815,12 @@ class me extends re {
791
815
  return this.menuEntries.size;
792
816
  }
793
817
  extend(t) {
794
- L(Array.isArray(t), "@param `items` should be an Array."), C(
795
- this.container.firstElementChild,
796
- t,
797
- this.options.width
798
- );
818
+ L(Array.isArray(t), "@param `items` should be an Array."), O({
819
+ items: t,
820
+ emitter: this.emitter,
821
+ menuWidth: this.options.width,
822
+ container: this.container.firstElementChild
823
+ });
799
824
  }
800
825
  closeMenu() {
801
826
  this.opened = !1, this.container.classList.add(a.hidden), this.dispatchEvent(m.CLOSE);
@@ -819,39 +844,44 @@ class me extends re {
819
844
  }
820
845
  setMap(t) {
821
846
  if (super.setMap(t), t) {
822
- this.map = t, this.map.getViewport().addEventListener(this.options.eventType, this.contextMenuEventListener, !1), this.map.on("movestart", () => {
847
+ this.map = t, t.getViewport().addEventListener(
848
+ this.options.eventType,
849
+ this.contextMenuEventListener,
850
+ !1
851
+ ), t.on("movestart", () => {
823
852
  this.handleMapMove();
824
- }), g.on(
853
+ }), this.emitter.on(
825
854
  m.ADD_MENU_ENTRY,
826
- (i, r) => {
827
- this.handleAddMenuEntry(i, r);
855
+ (r, i) => {
856
+ this.handleAddMenuEntry(r, i);
828
857
  },
829
858
  this
830
- ), this.items = this.options.defaultItems ? this.options.items.concat(P) : this.options.items, C(
831
- this.container.firstElementChild,
832
- this.items,
833
- this.options.width
834
- );
859
+ ), this.items = this.options.defaultItems ? this.options.items.concat(P) : this.options.items, O({
860
+ items: this.items,
861
+ emitter: this.emitter,
862
+ menuWidth: this.options.width,
863
+ container: this.container.firstElementChild
864
+ });
835
865
  const n = this.getMenuEntriesLength();
836
- this.lineHeight = n > 0 ? this.container.offsetHeight / n : pe(this.container);
866
+ this.lineHeight = n > 0 ? this.container.offsetHeight / n : de(this.container);
837
867
  } else
838
868
  this.removeListeners(), this.clear();
839
869
  }
840
870
  removeListeners() {
841
- this.map.getViewport().removeEventListener(this.options.eventType, this.contextMenuEventListener, !1), g.off(m.ADD_MENU_ENTRY);
871
+ this.map.getViewport().removeEventListener(this.options.eventType, this.contextMenuEventListener, !1), this.emitter.off(m.ADD_MENU_ENTRY);
842
872
  }
843
873
  removeMenuEntry(t) {
844
- const n = document.getElementById(t);
845
- n?.remove(), n?.removeEventListener("click", this.entryCallbackEventListener), this.menuEntries.delete(t);
874
+ let n = document.getElementById(t);
875
+ n?.remove(), n = null, this.menuEntries.delete(t);
846
876
  }
847
877
  handleContextMenu(t) {
848
878
  this.coordinate = this.map.getEventCoordinate(t), this.pixel = this.map.getEventPixel(t), this.dispatchEvent(
849
879
  new R({
850
- type: m.BEFOREOPEN,
851
880
  map: this.map,
852
- originalEvent: t
881
+ originalEvent: t,
882
+ type: m.BEFOREOPEN
853
883
  })
854
- ), !this.disabled && (this.options.eventType === w.CONTEXTMENU && (t.stopPropagation(), t.preventDefault()), setTimeout(() => {
884
+ ), !this.disabled && (this.options.eventType === N.CONTEXTMENU && (t.stopPropagation(), t.preventDefault()), setTimeout(() => {
855
885
  this.openMenu(t);
856
886
  }), t.target?.addEventListener(
857
887
  "pointerdown",
@@ -864,9 +894,9 @@ class me extends re {
864
894
  openMenu(t) {
865
895
  this.opened = !0, this.positionContainer(), this.container.classList.remove(a.hidden), this.dispatchEvent(
866
896
  new R({
867
- type: m.OPEN,
868
897
  map: this.map,
869
- originalEvent: t
898
+ originalEvent: t,
899
+ type: m.OPEN
870
900
  })
871
901
  );
872
902
  }
@@ -879,25 +909,25 @@ class me extends re {
879
909
  const t = this.map.getSize() || [0, 0], n = {
880
910
  w: t[0] - this.pixel[0],
881
911
  h: t[1] - this.pixel[1]
882
- }, i = this.getMenuEntriesLength(), r = {
912
+ }, r = this.getMenuEntriesLength(), i = {
883
913
  w: this.container.offsetWidth,
884
914
  // a cheap way to recalculate container height
885
915
  // since offsetHeight is like cached
886
- h: Math.round(this.lineHeight * i)
887
- }, o = n.w >= r.w ? this.pixel[0] + 5 : this.pixel[0] - r.w;
888
- this.container.style.left = `${o}px`, this.container.style.top = n.h >= r.h ? `${this.pixel[1] - 10}px` : `${this.pixel[1] - r.h}px`, this.container.style.right = "auto", this.container.style.bottom = "auto", n.w -= r.w;
889
- const u = (E) => Array.from(E.children).filter(
890
- (h) => h.tagName === "LI" && h.classList.contains(a.submenu)
916
+ h: Math.round(this.lineHeight * r)
917
+ }, o = n.w >= i.w ? this.pixel[0] + 5 : this.pixel[0] - i.w;
918
+ this.container.style.left = `${o}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;
919
+ const l = (E) => Array.from(E.children).filter(
920
+ (v) => v.tagName === "LI" && v.classList.contains(a.submenu)
891
921
  );
892
- let d = 0;
893
- const c = (E, h) => {
894
- d += 1, u(E).forEach((k) => {
895
- const H = h >= r.w ? r.w - 8 : (r.w + 8) * -1, p = k.querySelector(
922
+ let u = 0;
923
+ const c = (E, v) => {
924
+ u += 1, l(E).forEach((b) => {
925
+ const H = v >= i.w ? i.w - 8 : (i.w + 8) * -1, d = b.querySelector(
896
926
  `ul.${a.container}`
897
- ), K = Math.round(
898
- this.lineHeight * Array.from(p.children).filter((U) => U.tagName === "LI").length
927
+ ), k = Math.round(
928
+ this.lineHeight * Array.from(d.children).filter((K) => K.tagName === "LI").length
899
929
  );
900
- p.style.left = `${H}px`, p.style.right = "auto", p.style.top = n.h >= K + r.h ? "0" : `-${p.offsetHeight - 25}px`, p.style.bottom = "auto", p.style.zIndex = String(d), u(p).length > 0 && c(p, h - r.w);
930
+ d.style.left = `${H}px`, d.style.right = "auto", d.style.top = n.h >= k + i.h ? "0" : `-${d.offsetHeight - 25}px`, d.style.bottom = "auto", d.style.zIndex = String(u), l(d).length > 0 && c(d, v - i.w);
901
931
  });
902
932
  };
903
933
  c(this.container.firstElementChild, n.w);
@@ -907,19 +937,19 @@ class me extends re {
907
937
  }
908
938
  handleEntryCallback(t) {
909
939
  t.preventDefault(), t.stopPropagation();
910
- const n = t.currentTarget, i = this.menuEntries.get(n.id);
911
- if (!i)
940
+ const n = t.currentTarget, r = this.menuEntries.get(n.id);
941
+ if (!r)
912
942
  return;
913
- const r = {
914
- coordinate: this.coordinate,
915
- data: i.data
943
+ const i = {
944
+ data: r.data,
945
+ coordinate: this.coordinate
916
946
  };
917
- this.closeMenu(), i.callback?.(r, this.map);
947
+ this.closeMenu(), r.callback?.(i, this.map);
918
948
  }
919
949
  handleAddMenuEntry(t, n) {
920
950
  this.menuEntries.set(t.id, t), this.positionContainer(), "callback" in t && typeof t.callback == "function" && n.addEventListener("click", this.entryCallbackEventListener, !1);
921
951
  }
922
952
  }
923
953
  export {
924
- me as default
954
+ fe as default
925
955
  };
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.2.0
3
+ * ol-contextmenu - v5.2.1
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Mon Mar 13 2023 13:25:53 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Fri Mar 31 2023 20:27:32 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- (function(d,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(d=typeof globalThis<"u"?globalThis:d||self,d.ContextMenu=l())})(this,function(){"use strict";var pe=Object.defineProperty;var fe=(d,l,g)=>l in d?pe(d,l,{enumerable:!0,configurable:!0,writable:!0,value:g}):d[l]=g;var h=(d,l,g)=>(fe(d,typeof l!="symbol"?l+"":l,g),g);class d{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const l=d,g={PROPERTYCHANGE:"propertychange"};class K{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const U=K;function M(){}function S(s){for(const e in s)delete s[e]}function z(s){let e;for(e in s)return!1;return!e}class B extends U{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),i=n[e]||(n[e]=[]);i.includes(t)||i.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,i=this.listeners_&&this.listeners_[n];if(!i)return;const r=t?new l(e):e;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),p=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,p[n]=0),++o[n];let f;for(let u=0,y=i.length;u<y;++u)if("handleEvent"in i[u]?f=i[u].handleEvent(r):f=i[u].call(this,r),f===!1||r.propagationStopped){f=!1;break}if(--o[n]===0){let u=p[n];for(delete p[n];u--;)this.removeEventListener(n,M);delete o[n]}return f}disposeInternal(){this.listeners_&&S(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const n=this.listeners_&&this.listeners_[e];if(n){const i=n.indexOf(t);i!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[i]=M,++this.pendingRemovals_[e]):(n.splice(i,1),n.length===0&&delete this.listeners_[e]))}}}const F=B,V={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function _(s,e,t,n,i){if(n&&n!==s&&(t=t.bind(n)),i){const o=t;t=function(){s.removeEventListener(e,t),o.apply(this,arguments)}}const r={target:s,type:e,listener:t};return s.addEventListener(e,t),r}function D(s,e,t,n){return _(s,e,t,n,!0)}function C(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),S(s))}class L extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(V.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,i=new Array(n);for(let r=0;r<n;++r)i[r]=_(this,e[r],t);return i}return _(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const i=e.length;n=new Array(i);for(let r=0;r<i;++r)n[r]=D(this,e[r],t)}else n=D(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)j(n);else if(Array.isArray(e))for(let i=0,r=e.length;i<r;++i)this.removeEventListener(e[i],t);else this.removeEventListener(e,t)}}L.prototype.on,L.prototype.once,L.prototype.un;function j(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)C(s[e]);else C(s)}const Y=L;let G=0;function Z(s){return s.ol_uid||(s.ol_uid=String(++G))}class R extends l{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class X extends Y{constructor(e){super(),this.on,this.once,this.un,Z(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new R(n,e,t)),n=g.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new R(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const i=this.values_||(this.values_={});if(n)i[e]=t;else{const r=i[e];i[e]=t,r!==t&&this.notify(e,r)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],z(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}const W=X,q={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};function P(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}class J extends W{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){P(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&P(this.element);for(let t=0,n=this.listenerKeys.length;t<n;++t)C(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==M&&this.listenerKeys.push(_(e,q.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}const Q=J;class ee extends l{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}const te=ee;class ne extends te{constructor(e,t,n,i,r,o){super(e,t,r),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=i!==void 0?i:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const se=ne;var O=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(O||{}),E=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(E||{});class $ extends se{constructor(e){super(e.type,e.map,e.originalEvent)}}const ie={width:150,scrollAt:4,eventType:O.CONTEXTMENU,defaultItems:!0,items:[]},v="ol-ctx-menu",a={namespace:v,container:`${v}-container`,separator:`${v}-separator`,submenu:`${v}-submenu`,hidden:`${v}-hidden`,icon:`${v}-icon`,zoomIn:`${v}-zoom-in`,zoomOut:`${v}-zoom-out`,unselectable:"ol-unselectable"},I=[{text:"Zoom In",classname:`${a.zoomIn} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${a.zoomOut} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())-1,duration:700,center:s.coordinate})}}];var w={},re={get exports(){return w},set exports(s){w=s}};function A(){}A.prototype={on:function(s,e,t){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:e,ctx:t}),this},once:function(s,e,t){var n=this;function i(){n.off(s,i),e.apply(t,arguments)}return i._=e,this.on(s,i,t)},emit:function(s){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[s]||[]).slice(),n=0,i=t.length;for(n;n<i;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(s,e){var t=this.e||(this.e={}),n=t[s],i=[];if(n&&e)for(var r=0,o=n.length;r<o;r++)n[r].fn!==e&&n[r].fn._!==e&&i.push(n[r]);return i.length?t[s]=i:delete t[s],this}},re.exports=A;var oe=w.TinyEmitter=A;const b=new oe;function x(s){const e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=s;t.firstChild;)e.append(t.firstChild);return e}function ae(s){const e=document.importNode(s),t=s.offsetWidth;e.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${t}px`;const n=x("<span>Foo</span>"),i=x("<span>Foo</span>"),r=document.createElement("li"),o=document.createElement("li");r.append(n),o.append(i),e.append(r),e.append(o),s.parentNode?.append(e);const p=e.offsetHeight/2;return s.parentNode?.removeChild(e),p}function k(s,e,t=!1,n=!1){const i=`_${Math.random().toString(36).slice(2,11)}`;if(typeof e!="string"&&"text"in e){const u=`<span>${e.text}</span>`,y=x(u),c=document.createElement("li");e.classname=e.classname||"",e.icon&&(e.classname===""?e.classname=a.icon:e.classname.includes(a.icon)===!1&&(e.classname+=` ${a.icon}`),c.setAttribute("style",`background-image:url(${e.icon})`)),c.id=i,c.className=e.classname,c.append(y),s.append(c);const H={id:i,isSubmenu:t,isInsideSubmenu:n,isSeparator:!1,callback:"callback"in e?e.callback:null,data:"data"in e?e.data:null};return b.emit(E.ADD_MENU_ENTRY,H,c),c}const r=`<li id="${i}" class="${a.separator}"><hr></li>`,o=x(r);s.append(o);const p=s.lastChild,f={id:i,isSubmenu:!1,isInsideSubmenu:!1,isSeparator:!0,callback:null,data:null};return b.emit(E.ADD_MENU_ENTRY,f,p),p}function T(s,e,t,n){e.forEach(i=>{if(typeof i!="string"&&"items"in i&&Array.isArray(i.items)){const r=k(s,i,!0);r.classList.add(a.submenu);const o=document.createElement("ul");o.classList.add(a.container),o.style.width=`${t}px`,r.append(o),T(o,i.items,t,!0)}else k(s,i,!1,n)})}const me="";function N(s,e){if(!s)throw new Error(e)}class le extends Q{constructor(t={}){N(typeof t=="object","@param `opts` should be object type!");const n=document.createElement("div");super({element:n});h(this,"map");h(this,"container");h(this,"coordinate",[]);h(this,"pixel",[]);h(this,"contextMenuEventListener");h(this,"entryCallbackEventListener");h(this,"mapMoveListener");h(this,"lineHeight",0);h(this,"disabled");h(this,"opened");h(this,"items",[]);h(this,"menuEntries",new Map);h(this,"options");this.options={...ie,...t};const i=document.createElement("ul");n.append(i),n.style.width=`${this.options.width}px`,n.classList.add(a.container,a.unselectable,a.hidden),this.container=n,this.contextMenuEventListener=r=>{this.handleContextMenu(r)},this.entryCallbackEventListener=r=>{this.handleEntryCallback(r)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1,window.addEventListener("beforeunload",()=>{this.removeListeners()},{once:!0})}clear(){for(const t of this.menuEntries.keys())this.removeMenuEntry(t);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return I}countItems(){return this.menuEntries.size}extend(t){N(Array.isArray(t),"@param `items` should be an Array."),T(this.container.firstElementChild,t,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(a.hidden),this.dispatchEvent(E.CLOSE)}isOpen(){return this.opened}updatePosition(t){N(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=t,this.positionContainer())}pop(){const t=Array.from(this.menuEntries.keys()).pop();t&&this.removeMenuEntry(t)}shift(){const t=Array.from(this.menuEntries.keys()).shift();t&&this.removeMenuEntry(t)}push(t){t&&this.extend([t])}setMap(t){if(super.setMap(t),t){this.map=t,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),b.on(E.ADD_MENU_ENTRY,(i,r)=>{this.handleAddMenuEntry(i,r)},this),this.items=this.options.defaultItems?this.options.items.concat(I):this.options.items,T(this.container.firstElementChild,this.items,this.options.width);const n=this.getMenuEntriesLength();this.lineHeight=n>0?this.container.offsetHeight/n:ae(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),b.off(E.ADD_MENU_ENTRY)}removeMenuEntry(t){const n=document.getElementById(t);n?.remove(),n?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(t)}handleContextMenu(t){this.coordinate=this.map.getEventCoordinate(t),this.pixel=this.map.getEventPixel(t),this.dispatchEvent(new $({type:E.BEFOREOPEN,map:this.map,originalEvent:t})),!this.disabled&&(this.options.eventType===O.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),setTimeout(()=>{this.openMenu(t)}),t.target?.addEventListener("pointerdown",n=>{this.opened&&(n.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(t){this.opened=!0,this.positionContainer(),this.container.classList.remove(a.hidden),this.dispatchEvent(new $({type:E.OPEN,map:this.map,originalEvent:t}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,t])=>t.isSeparator===!1&&t.isSubmenu===!1&&t.isInsideSubmenu===!1).length}positionContainer(){const t=this.map.getSize()||[0,0],n={w:t[0]-this.pixel[0],h:t[1]-this.pixel[1]},i=this.getMenuEntriesLength(),r={w:this.container.offsetWidth,h:Math.round(this.lineHeight*i)},o=n.w>=r.w?this.pixel[0]+5:this.pixel[0]-r.w;this.container.style.left=`${o}px`,this.container.style.top=n.h>=r.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-r.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",n.w-=r.w;const p=y=>Array.from(y.children).filter(c=>c.tagName==="LI"&&c.classList.contains(a.submenu));let f=0;const u=(y,c)=>{f+=1,p(y).forEach(he=>{const ce=c>=r.w?r.w-8:(r.w+8)*-1,m=he.querySelector(`ul.${a.container}`),ue=Math.round(this.lineHeight*Array.from(m.children).filter(de=>de.tagName==="LI").length);m.style.left=`${ce}px`,m.style.right="auto",m.style.top=n.h>=ue+r.h?"0":`-${m.offsetHeight-25}px`,m.style.bottom="auto",m.style.zIndex=String(f),p(m).length>0&&u(m,c-r.w)})};u(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(t){t.preventDefault(),t.stopPropagation();const n=t.currentTarget,i=this.menuEntries.get(n.id);if(!i)return;const r={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(r,this.map)}handleAddMenuEntry(t,n){this.menuEntries.set(t.id,t),this.positionContainer(),"callback"in t&&typeof t.callback=="function"&&n.addEventListener("click",this.entryCallbackEventListener,!1)}}return le});
8
+ (function(d,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(d=typeof globalThis<"u"?globalThis:d||self,d.ContextMenu=l())})(this,function(){"use strict";var de=Object.defineProperty;var pe=(d,l,g)=>l in d?de(d,l,{enumerable:!0,configurable:!0,writable:!0,value:g}):d[l]=g;var c=(d,l,g)=>(pe(d,typeof l!="symbol"?l+"":l,g),g);class d{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const l=d,g={PROPERTYCHANGE:"propertychange"};class K{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const U=K;function M(){}function D(s){for(const e in s)delete s[e]}function z(s){let e;for(e in s)return!1;return!e}class B extends U{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const i=t?new l(e):e;i.target||(i.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),h=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,h[n]=0),++o[n];let p;for(let u=0,y=r.length;u<y;++u)if("handleEvent"in r[u]?p=r[u].handleEvent(i):p=r[u].call(this,i),p===!1||i.propagationStopped){p=!1;break}if(--o[n]===0){let u=h[n];for(delete h[n];u--;)this.removeEventListener(n,M);delete o[n]}return p}disposeInternal(){this.listeners_&&D(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const n=this.listeners_&&this.listeners_[e];if(n){const r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=M,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}}}const F=B,V={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function b(s,e,t,n,r){if(n&&n!==s&&(t=t.bind(n)),r){const o=t;t=function(){s.removeEventListener(e,t),o.apply(this,arguments)}}const i={target:s,type:e,listener:t};return s.addEventListener(e,t),i}function R(s,e,t,n){return b(s,e,t,n,!0)}function C(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),D(s))}class x extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(V.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=b(this,e[i],t);return r}return b(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const r=e.length;n=new Array(r);for(let i=0;i<r;++i)n[i]=R(this,e[i],t)}else n=R(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)j(n);else if(Array.isArray(e))for(let r=0,i=e.length;r<i;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}x.prototype.on,x.prototype.once,x.prototype.un;function j(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)C(s[e]);else C(s)}const Y=x;let G=0;function Z(s){return s.ol_uid||(s.ol_uid=String(++G))}class P extends l{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class W extends Y{constructor(e){super(),this.on,this.once,this.un,Z(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new P(n,e,t)),n=g.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new P(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const r=this.values_||(this.values_={});if(n)r[e]=t;else{const i=r[e];r[e]=t,i!==t&&this.notify(e,i)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],z(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}const X=W,q={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};function $(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}class J extends X{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){$(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&$(this.element);for(let t=0,n=this.listenerKeys.length;t<n;++t)C(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==M&&this.listenerKeys.push(b(e,q.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}const Q=J;var O={},ee={get exports(){return O},set exports(s){O=s}};function w(){}w.prototype={on:function(s,e,t){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:e,ctx:t}),this},once:function(s,e,t){var n=this;function r(){n.off(s,r),e.apply(t,arguments)}return r._=e,this.on(s,r,t)},emit:function(s){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[s]||[]).slice(),n=0,r=t.length;for(n;n<r;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(s,e){var t=this.e||(this.e={}),n=t[s],r=[];if(n&&e)for(var i=0,o=n.length;i<o;i++)n[i].fn!==e&&n[i].fn._!==e&&r.push(n[i]);return r.length?t[s]=r:delete t[s],this}},ee.exports=w;var te=O.TinyEmitter=w;class ne extends l{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}const se=ne;class ie extends se{constructor(e,t,n,r,i,o){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const re=ie;var A=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(A||{}),m=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(m||{});class I extends re{constructor(e){super(e.type,e.map,e.originalEvent)}}const oe={width:150,scrollAt:4,eventType:A.CONTEXTMENU,defaultItems:!0,items:[]},E="ol-ctx-menu",a={namespace:E,container:`${E}-container`,separator:`${E}-separator`,submenu:`${E}-submenu`,hidden:`${E}-hidden`,icon:`${E}-icon`,zoomIn:`${E}-zoom-in`,zoomOut:`${E}-zoom-out`,unselectable:"ol-unselectable"},H=[{text:"Zoom In",classname:`${a.zoomIn} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${a.zoomOut} ${a.icon}`,callback:(s,e)=>{const t=e.getView();t.animate({zoom:Number(t.getZoom())-1,duration:700,center:s.coordinate})}}];function L(s){const e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=s;t.firstChild;)e.append(t.firstChild);return e}function ae(s){const e=document.importNode(s),t=s.offsetWidth;e.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${t}px`;const n=L("<span>Foo</span>"),r=L("<span>Foo</span>"),i=document.createElement("li"),o=document.createElement("li");i.append(n),o.append(r),e.append(i),e.append(o),s.parentNode?.append(e);const h=e.offsetHeight/2;return s.parentNode?.removeChild(e),h}function k({parentNode:s,item:e,isSubmenu:t=!1,isInsideSubmenu:n=!1,emitter:r}){const i=`_${Math.random().toString(36).slice(2,11)}`;if(typeof e!="string"&&"text"in e){const y=`<span>${e.text}</span>`,_=L(y),v=document.createElement("li");e.classname=e.classname||"",e.icon&&(e.classname===""?e.classname=a.icon:e.classname.includes(a.icon)===!1&&(e.classname+=` ${a.icon}`),v.setAttribute("style",`background-image:url(${e.icon})`)),v.id=i,v.className=e.classname,v.append(_),s.append(v);const S={id:i,isSubmenu:t,isInsideSubmenu:n,isSeparator:!1,callback:"callback"in e?e.callback:null,data:"data"in e?e.data:null};return r.emit(m.ADD_MENU_ENTRY,S,v),v}const o=`<li id="${i}" class="${a.separator}"><hr></li>`,h=L(o);s.append(h);const p=s.lastChild,u={id:i,isSubmenu:!1,isInsideSubmenu:!1,isSeparator:!0,callback:null,data:null};return r.emit(m.ADD_MENU_ENTRY,u,p),p}function N({container:s,items:e,menuWidth:t,isInsideSubmenu:n,emitter:r}){e.forEach(i=>{if(typeof i!="string"&&"items"in i&&Array.isArray(i.items)){const o=k({parentNode:s,item:i,isSubmenu:!0,emitter:r});o.classList.add(a.submenu);const h=document.createElement("ul");h.classList.add(a.container),h.style.width=`${t}px`,o.append(h),N({emitter:r,menuWidth:t,container:h,items:i.items,isInsideSubmenu:!0})}else k({parentNode:s,item:i,isSubmenu:!1,isInsideSubmenu:n,emitter:r})})}const fe="";function T(s,e){if(!s)throw new Error(e)}class le extends Q{constructor(t={}){T(typeof t=="object","@param `opts` should be object type!");const n=document.createElement("div");super({element:n});c(this,"map");c(this,"emitter",new te);c(this,"container");c(this,"coordinate",[]);c(this,"pixel",[]);c(this,"contextMenuEventListener");c(this,"entryCallbackEventListener");c(this,"mapMoveListener");c(this,"lineHeight",0);c(this,"disabled");c(this,"opened");c(this,"items",[]);c(this,"menuEntries",new Map);c(this,"options");this.options={...oe,...t};const r=document.createElement("ul");n.append(r),n.style.width=`${this.options.width}px`,n.classList.add(a.container,a.unselectable,a.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 t of this.menuEntries.keys())this.removeMenuEntry(t);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return H}countItems(){return this.menuEntries.size}extend(t){T(Array.isArray(t),"@param `items` should be an Array."),N({items:t,emitter:this.emitter,menuWidth:this.options.width,container:this.container.firstElementChild})}closeMenu(){this.opened=!1,this.container.classList.add(a.hidden),this.dispatchEvent(m.CLOSE)}isOpen(){return this.opened}updatePosition(t){T(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=t,this.positionContainer())}pop(){const t=Array.from(this.menuEntries.keys()).pop();t&&this.removeMenuEntry(t)}shift(){const t=Array.from(this.menuEntries.keys()).shift();t&&this.removeMenuEntry(t)}push(t){t&&this.extend([t])}setMap(t){if(super.setMap(t),t){this.map=t,t.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),t.on("movestart",()=>{this.handleMapMove()}),this.emitter.on(m.ADD_MENU_ENTRY,(r,i)=>{this.handleAddMenuEntry(r,i)},this),this.items=this.options.defaultItems?this.options.items.concat(H):this.options.items,N({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:ae(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.emitter.off(m.ADD_MENU_ENTRY)}removeMenuEntry(t){let n=document.getElementById(t);n?.remove(),n=null,this.menuEntries.delete(t)}handleContextMenu(t){this.coordinate=this.map.getEventCoordinate(t),this.pixel=this.map.getEventPixel(t),this.dispatchEvent(new I({map:this.map,originalEvent:t,type:m.BEFOREOPEN})),!this.disabled&&(this.options.eventType===A.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),setTimeout(()=>{this.openMenu(t)}),t.target?.addEventListener("pointerdown",n=>{this.opened&&(n.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(t){this.opened=!0,this.positionContainer(),this.container.classList.remove(a.hidden),this.dispatchEvent(new I({map:this.map,originalEvent:t,type:m.OPEN}))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,t])=>t.isSeparator===!1&&t.isSubmenu===!1&&t.isInsideSubmenu===!1).length}positionContainer(){const t=this.map.getSize()||[0,0],n={w:t[0]-this.pixel[0],h:t[1]-this.pixel[1]},r=this.getMenuEntriesLength(),i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*r)},o=n.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}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 h=y=>Array.from(y.children).filter(_=>_.tagName==="LI"&&_.classList.contains(a.submenu));let p=0;const u=(y,_)=>{p+=1,h(y).forEach(S=>{const he=_>=i.w?i.w-8:(i.w+8)*-1,f=S.querySelector(`ul.${a.container}`),ce=Math.round(this.lineHeight*Array.from(f.children).filter(ue=>ue.tagName==="LI").length);f.style.left=`${he}px`,f.style.right="auto",f.style.top=n.h>=ce+i.h?"0":`-${f.offsetHeight-25}px`,f.style.bottom="auto",f.style.zIndex=String(p),h(f).length>0&&u(f,_-i.w)})};u(this.container.firstElementChild,n.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(t){t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r=this.menuEntries.get(n.id);if(!r)return;const i={data:r.data,coordinate:this.coordinate};this.closeMenu(),r.callback?.(i,this.map)}handleAddMenuEntry(t,n){this.menuEntries.set(t.id,t),this.positionContainer(),"callback"in t&&typeof t.callback=="function"&&n.addEventListener("click",this.entryCallbackEventListener,!1)}}return le});
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Coordinate } from 'ol/coordinate';
2
1
  import OlMap from 'ol/Map';
2
+ import type { Coordinate } from 'ol/coordinate';
3
3
  import MapBrowserEvent from 'ol/MapBrowserEvent';
4
4
  export declare enum EventTypes {
5
5
  CONTEXTMENU = "contextmenu",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-contextmenu",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "Custom Context Menu for Openlayers",
5
5
  "type": "module",
6
6
  "main": "./dist/ol-contextmenu.umd.cjs",
@@ -47,12 +47,12 @@
47
47
  "prepare": "husky install"
48
48
  },
49
49
  "devDependencies": {
50
- "@swc/core": "^1.3.40",
50
+ "@swc/core": "^1.3.44",
51
51
  "@swc/jest": "^0.2.24",
52
- "@types/jest": "^29.4.0",
53
- "eslint": "^8.36.0",
54
- "eslint-config-jwalker": "^8.0.0",
55
- "eslint-config-prettier": "^8.7.0",
52
+ "@types/jest": "^29.5.0",
53
+ "eslint": "^8.37.0",
54
+ "eslint-config-jwalker": "^8.1.0",
55
+ "eslint-config-prettier": "^8.8.0",
56
56
  "eslint-plugin-jest": "^27.2.1",
57
57
  "eslint-plugin-prettier": "^4.2.1",
58
58
  "husky": "^8.0.3",
@@ -60,11 +60,11 @@
60
60
  "jest": "^29.5.0",
61
61
  "jest-environment-jsdom": "^29.5.0",
62
62
  "ol": "^7.3.0",
63
- "prettier": "^2.8.4",
64
- "rimraf": "^4.4.0",
65
- "sass": "^1.59.2",
66
- "typescript": "^4.9.5",
67
- "vite": "^4.1.4",
63
+ "prettier": "^2.8.7",
64
+ "rimraf": "^4.4.1",
65
+ "sass": "^1.60.0",
66
+ "typescript": "^5.0.3",
67
+ "vite": "^4.2.1",
68
68
  "vite-plugin-banner": "^0.7.0",
69
69
  "vite-plugin-dts": "^2.1.0"
70
70
  },
package/dist/emitter.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { TinyEmitter } from 'tiny-emitter';
2
- declare const emitter: TinyEmitter;
3
- export default emitter;