@eox/drawtools 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,58 +1,153 @@
1
- (function(d,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(d=typeof globalThis<"u"?globalThis:d||self,_(d["eox-drawtools"]={}))})(this,function(d){"use strict";var kt=Object.defineProperty;var Rt=(d,_,f)=>_ in d?kt(d,_,{enumerable:!0,configurable:!0,writable:!0,value:f}):d[_]=f;var $=(d,_,f)=>(Rt(d,typeof _!="symbol"?_+"":_,f),f);/**
1
+ (function(p,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(p=typeof globalThis<"u"?globalThis:p||self,y(p["eox-drawtools"]={}))})(this,function(p){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const _=window,f=_.ShadowRoot&&(_.ShadyCSS===void 0||_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),X=new WeakMap;let _t=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==G)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(f&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=X.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&X.set(e,t))}return t}toString(){return this.cssText}};const $t=r=>new _t(typeof r=="string"?r:r+"",void 0,G),vt=(r,t)=>{f?r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=_.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)})},Y=f?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return $t(e)})(r):r;/**
5
+ */const y=window,I=y.ShadowRoot&&(y.ShadyCSS===void 0||y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),X=new WeakMap;let pt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(I&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=X.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&X.set(e,t))}return t}toString(){return this.cssText}};const _t=o=>new pt(typeof o=="string"?o:o+"",void 0,Q),$t=(o,t)=>{I?o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=y.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,o.appendChild(i)})},G=I?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return _t(e)})(o):o;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */var z;const N=window,tt=N.trustedTypes,yt=tt?tt.emptyScript:"",et=N.reactiveElementPolyfillSupport,B={toAttribute(r,t){switch(t){case Boolean:r=r?yt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},it=(r,t)=>t!==r&&(t==t||r==r),F={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it},q="finalized";let S=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Ep(i,e);s!==void 0&&(this._$Ev.set(s,i),t.push(s))}),t}static createProperty(t,e=F){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||F}static finalize(){if(this.hasOwnProperty(q))return!1;this[q]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(Y(s))}else t!==void 0&&e.push(Y(t));return e}static _$Ep(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return vt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=F){var s;const o=this.constructor._$Ep(t,i);if(o!==void 0&&i.reflect===!0){const n=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:B).toAttribute(e,i.type);this._$El=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(o!==void 0&&this._$El!==o){const n=s.getPropertyOptions(o),u=typeof n.converter=="function"?{fromAttribute:n.converter}:((i=n.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?n.converter:B;this._$El=o,this[o]=u.fromAttribute(e,n.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||it)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,o)=>this[o]=s),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(s=>{var o;return(o=s.hostUpdate)===null||o===void 0?void 0:o.call(s)}),this.update(i)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};S[q]=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},et==null||et({ReactiveElement:S}),((z=N.reactiveElementVersions)!==null&&z!==void 0?z:N.reactiveElementVersions=[]).push("1.6.2");/**
9
+ */var j;const M=window,Y=M.trustedTypes,vt=Y?Y.emptyScript:"",tt=M.reactiveElementPolyfillSupport,B={toAttribute(o,t){switch(t){case Boolean:o=o?vt:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},et=(o,t)=>t!==o&&(t==t||o==o),z={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:et},V="finalized";let w=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Ep(i,e);s!==void 0&&(this._$Ev.set(s,i),t.push(s))}),t}static createProperty(t,e=z){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||z}static finalize(){if(this.hasOwnProperty(V))return!1;this[V]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(G(s))}else t!==void 0&&e.push(G(t));return e}static _$Ep(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return $t(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=z){var s;const n=this.constructor._$Ep(t,i);if(n!==void 0&&i.reflect===!0){const r=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:B).toAttribute(e,i.type);this._$El=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(n!==void 0&&this._$El!==n){const r=s.getPropertyOptions(n),c=typeof r.converter=="function"?{fromAttribute:r.converter}:((i=r.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?r.converter:B;this._$El=n,this[n]=c.fromAttribute(e,r.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||et)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,n)=>this[n]=s),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(s=>{var n;return(n=s.hostUpdate)===null||n===void 0?void 0:n.call(s)}),this.update(i)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};w[V]=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:w}),((j=M.reactiveElementVersions)!==null&&j!==void 0?j:M.reactiveElementVersions=[]).push("1.6.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */var V;const k=window,b=k.trustedTypes,st=b?b.createPolicy("lit-html",{createHTML:r=>r}):void 0,W="$lit$",m=`lit$${(Math.random()+"").slice(9)}$`,rt="?"+m,ft=`<${rt}>`,A=document,O=()=>A.createComment(""),P=r=>r===null||typeof r!="object"&&typeof r!="function",nt=Array.isArray,gt=r=>nt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",K=`[
14
- \f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,lt=/>/g,w=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,ht=/"/g,dt=/^(?:script|style|textarea|title)$/i,mt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),At=mt(1),C=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ct=new WeakMap,E=A.createTreeWalker(A,129,null,!1),wt=(r,t)=>{const e=r.length-1,i=[];let s,o=t===2?"<svg>":"",n=D;for(let l=0;l<e;l++){const a=r[l];let g,h,p=-1,v=0;for(;v<a.length&&(n.lastIndex=v,h=n.exec(a),h!==null);)v=n.lastIndex,n===D?h[1]==="!--"?n=ot:h[1]!==void 0?n=lt:h[2]!==void 0?(dt.test(h[2])&&(s=RegExp("</"+h[2],"g")),n=w):h[3]!==void 0&&(n=w):n===w?h[0]===">"?(n=s??D,p=-1):h[1]===void 0?p=-2:(p=n.lastIndex-h[2].length,g=h[1],n=h[3]===void 0?w:h[3]==='"'?ht:at):n===ht||n===at?n=w:n===ot||n===lt?n=D:(n=w,s=void 0);const L=n===w&&r[l+1].startsWith("/>")?" ":"";o+=n===D?a+ft:p>=0?(i.push(g),a.slice(0,p)+W+a.slice(p)+m+L):a+m+(p===-2?(i.push(void 0),l):L)}const u=o+(r[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[st!==void 0?st.createHTML(u):u,i]};class U{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const u=t.length-1,l=this.parts,[a,g]=wt(t,e);if(this.el=U.createElement(a,i),E.currentNode=this.el.content,e===2){const h=this.el.content,p=h.firstChild;p.remove(),h.append(...p.childNodes)}for(;(s=E.nextNode())!==null&&l.length<u;){if(s.nodeType===1){if(s.hasAttributes()){const h=[];for(const p of s.getAttributeNames())if(p.endsWith(W)||p.startsWith(m)){const v=g[n++];if(h.push(p),v!==void 0){const L=s.getAttribute(v.toLowerCase()+W).split(m),j=/([.?@])?(.*)/.exec(v);l.push({type:1,index:o,name:j[2],strings:L,ctor:j[1]==="."?St:j[1]==="?"?Ct:j[1]==="@"?xt:R})}else l.push({type:6,index:o})}for(const p of h)s.removeAttribute(p)}if(dt.test(s.tagName)){const h=s.textContent.split(m),p=h.length-1;if(p>0){s.textContent=b?b.emptyScript:"";for(let v=0;v<p;v++)s.append(h[v],O()),E.nextNode(),l.push({type:2,index:++o});s.append(h[p],O())}}}else if(s.nodeType===8)if(s.data===rt)l.push({type:2,index:o});else{let h=-1;for(;(h=s.data.indexOf(m,h+1))!==-1;)l.push({type:7,index:o}),h+=m.length-1}o++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function x(r,t,e=r,i){var s,o,n,u;if(t===C)return t;let l=i!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[i]:e._$Cl;const a=P(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((o=l==null?void 0:l._$AO)===null||o===void 0||o.call(l,!1),a===void 0?l=void 0:(l=new a(r),l._$AT(r,e,i)),i!==void 0?((n=(u=e)._$Co)!==null&&n!==void 0?n:u._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=x(r,l._$AS(r,t.values),l,i)),t}class Et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:A).importNode(i,!0);E.currentNode=o;let n=E.nextNode(),u=0,l=0,a=s[0];for(;a!==void 0;){if(u===a.index){let g;a.type===2?g=new M(n,n.nextSibling,this,t):a.type===1?g=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(g=new Tt(n,this,t)),this._$AV.push(g),a=s[++l]}u!==(a==null?void 0:a.index)&&(n=E.nextNode(),u++)}return E.currentNode=A,o}v(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class M{constructor(t,e,i,s){var o;this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=(o=s==null?void 0:s.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),P(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==C&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):gt(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==c&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=U.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.v(i);else{const n=new Et(o,this),u=n.u(this.options);n.v(i),this.$(u),this._$AH=n}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new U(t)),e}T(t){nt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new M(this.k(O()),this.k(O()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class R{constructor(t,e,i,s,o){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(o===void 0)t=x(this,t,e,0),n=!P(t)||t!==this._$AH&&t!==C,n&&(this._$AH=t);else{const u=t;let l,a;for(t=o[0],l=0;l<o.length-1;l++)a=x(this,u[i+l],e,l),a===C&&(a=this._$AH[l]),n||(n=!P(a)||a!==this._$AH[l]),a===c?t=c:t!==c&&(t+=(a??"")+o[l+1]),this._$AH[l]=a}n&&!s&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class St extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}}const bt=b?b.emptyScript:"";class Ct extends R{constructor(){super(...arguments),this.type=4}j(t){t&&t!==c?this.element.setAttribute(this.name,bt):this.element.removeAttribute(this.name)}}class xt extends R{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=(i=x(this,t,e,0))!==null&&i!==void 0?i:c)===C)return;const s=this._$AH,o=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==c&&(s===c||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){x(this,t)}}const ut=k.litHtmlPolyfillSupport;ut==null||ut(U,M),((V=k.litHtmlVersions)!==null&&V!==void 0?V:k.litHtmlVersions=[]).push("2.7.4");const Ot=(r,t,e)=>{var i,s;const o=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let n=o._$litPart$;if(n===void 0){const u=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;o._$litPart$=n=new M(t.insertBefore(O(),u),u,void 0,e??{})}return n._$AI(r),n};/**
13
+ */var F;const k=window,b=k.trustedTypes,it=b?b.createPolicy("lit-html",{createHTML:o=>o}):void 0,q="$lit$",f=`lit$${(Math.random()+"").slice(9)}$`,st="?"+f,yt=`<${st}>`,g=document,C=()=>g.createComment(""),O=o=>o===null||typeof o!="object"&&typeof o!="function",ot=Array.isArray,ft=o=>ot(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function",W=`[
14
+ \f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rt=/-->/g,nt=/>/g,m=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),lt=/'/g,at=/"/g,ht=/^(?:script|style|textarea|title)$/i,gt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),mt=gt(1),E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),dt=new WeakMap,A=g.createTreeWalker(g,129,null,!1),At=(o,t)=>{const e=o.length-1,i=[];let s,n=t===2?"<svg>":"",r=T;for(let l=0;l<e;l++){const a=o[l];let v,h,u=-1,$=0;for(;$<a.length&&(r.lastIndex=$,h=r.exec(a),h!==null);)$=r.lastIndex,r===T?h[1]==="!--"?r=rt:h[1]!==void 0?r=nt:h[2]!==void 0?(ht.test(h[2])&&(s=RegExp("</"+h[2],"g")),r=m):h[3]!==void 0&&(r=m):r===m?h[0]===">"?(r=s??T,u=-1):h[1]===void 0?u=-2:(u=r.lastIndex-h[2].length,v=h[1],r=h[3]===void 0?m:h[3]==='"'?at:lt):r===at||r===lt?r=m:r===rt||r===nt?r=T:(r=m,s=void 0);const L=r===m&&o[l+1].startsWith("/>")?" ":"";n+=r===T?a+yt:u>=0?(i.push(v),a.slice(0,u)+q+a.slice(u)+f+L):a+f+(u===-2?(i.push(void 0),l):L)}const c=n+(o[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return[it!==void 0?it.createHTML(c):c,i]};class P{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,r=0;const c=t.length-1,l=this.parts,[a,v]=At(t,e);if(this.el=P.createElement(a,i),A.currentNode=this.el.content,e===2){const h=this.el.content,u=h.firstChild;u.remove(),h.append(...u.childNodes)}for(;(s=A.nextNode())!==null&&l.length<c;){if(s.nodeType===1){if(s.hasAttributes()){const h=[];for(const u of s.getAttributeNames())if(u.endsWith(q)||u.startsWith(f)){const $=v[r++];if(h.push(u),$!==void 0){const L=s.getAttribute($.toLowerCase()+q).split(f),R=/([.?@])?(.*)/.exec($);l.push({type:1,index:n,name:R[2],strings:L,ctor:R[1]==="."?bt:R[1]==="?"?xt:R[1]==="@"?St:N})}else l.push({type:6,index:n})}for(const u of h)s.removeAttribute(u)}if(ht.test(s.tagName)){const h=s.textContent.split(f),u=h.length-1;if(u>0){s.textContent=b?b.emptyScript:"";for(let $=0;$<u;$++)s.append(h[$],C()),A.nextNode(),l.push({type:2,index:++n});s.append(h[u],C())}}}else if(s.nodeType===8)if(s.data===st)l.push({type:2,index:n});else{let h=-1;for(;(h=s.data.indexOf(f,h+1))!==-1;)l.push({type:7,index:n}),h+=f.length-1}n++}}static createElement(t,e){const i=g.createElement("template");return i.innerHTML=t,i}}function x(o,t,e=o,i){var s,n,r,c;if(t===E)return t;let l=i!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[i]:e._$Cl;const a=O(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),a===void 0?l=void 0:(l=new a(o),l._$AT(o,e,i)),i!==void 0?((r=(c=e)._$Co)!==null&&r!==void 0?r:c._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=x(o,l._$AS(o,t.values),l,i)),t}class wt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:g).importNode(i,!0);A.currentNode=n;let r=A.nextNode(),c=0,l=0,a=s[0];for(;a!==void 0;){if(c===a.index){let v;a.type===2?v=new D(r,r.nextSibling,this,t):a.type===1?v=new a.ctor(r,a.name,a.strings,this,t):a.type===6&&(v=new Ct(r,this,t)),this._$AV.push(v),a=s[++l]}c!==(a==null?void 0:a.index)&&(r=A.nextNode(),c++)}return A.currentNode=g,n}v(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class D{constructor(t,e,i,s){var n;this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=(n=s==null?void 0:s.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),O(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):ft(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==d&&O(this._$AH)?this._$AA.nextSibling.data=t:this.$(g.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=P.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.v(i);else{const r=new wt(n,this),c=r.u(this.options);r.v(i),this.$(c),this._$AH=r}}_$AC(t){let e=dt.get(t.strings);return e===void 0&&dt.set(t.strings,e=new P(t)),e}T(t){ot(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new D(this.k(C()),this.k(C()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class N{constructor(t,e,i,s,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let r=!1;if(n===void 0)t=x(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{const c=t;let l,a;for(t=n[0],l=0;l<n.length-1;l++)a=x(this,c[i+l],e,l),a===E&&(a=this._$AH[l]),r||(r=!O(a)||a!==this._$AH[l]),a===d?t=d:t!==d&&(t+=(a??"")+n[l+1]),this._$AH[l]=a}r&&!s&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class bt extends N{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}const Et=b?b.emptyScript:"";class xt extends N{constructor(){super(...arguments),this.type=4}j(t){t&&t!==d?this.element.setAttribute(this.name,Et):this.element.removeAttribute(this.name)}}class St extends N{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=(i=x(this,t,e,0))!==null&&i!==void 0?i:d)===E)return;const s=this._$AH,n=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Ct{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){x(this,t)}}const ct=k.litHtmlPolyfillSupport;ct==null||ct(P,D),((F=k.litHtmlVersions)!==null&&F!==void 0?F:k.litHtmlVersions=[]).push("2.7.4");const Ot=(o,t,e)=>{var i,s;const n=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let r=n._$litPart$;if(r===void 0){const c=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;n._$litPart$=r=new D(t.insertBefore(C(),c),c,void 0,e??{})}return r._$AI(o),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */var J,Z;class H extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return C}}H.finalized=!0,H._$litElement$=!0,(J=globalThis.litElementHydrateSupport)===null||J===void 0||J.call(globalThis,{LitElement:H});const pt=globalThis.litElementPolyfillSupport;pt==null||pt({LitElement:H}),((Z=globalThis.litElementVersions)!==null&&Z!==void 0?Z:globalThis.litElementVersions=[]).push("3.3.2");/**
19
+ */var K,Z;class H extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return E}}H.finalized=!0,H._$litElement$=!0,(K=globalThis.litElementHydrateSupport)===null||K===void 0||K.call(globalThis,{LitElement:H});const ut=globalThis.litElementPolyfillSupport;ut==null||ut({LitElement:H}),((Z=globalThis.litElementVersions)!==null&&Z!==void 0?Z:globalThis.litElementVersions=[]).push("3.3.2");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const Pt=r=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(r,t):((e,i)=>{const{kind:s,elements:o}=i;return{kind:s,elements:o,finisher(n){customElements.define(e,n)}}})(r,t);/**
23
+ */const Tt=o=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(o,t):((e,i)=>{const{kind:s,elements:n}=i;return{kind:s,elements:n,finisher(r){customElements.define(e,r)}}})(o,t);/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Dt=(r,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,r)}},Ut=(r,t,e)=>{t.constructor.createProperty(e,r)};function I(r){return(t,e)=>e!==void 0?Ut(r,t,e):Dt(r,t)}/**
27
+ */const Pt=(o,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,o)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,o)}},Dt=(o,t,e)=>{t.constructor.createProperty(e,o)};function U(o){return(t,e)=>e!==void 0?Dt(o,t,e):Pt(o,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function T(r){return I({...r,state:!0})}/**
31
+ */function S(o){return U({...o,state:!0})}/**
32
32
  * @license
33
33
  * Copyright 2021 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */var Q;((Q=window.HTMLSlotElement)===null||Q===void 0?void 0:Q.prototype.assignedElements)!=null;const Mt=`
35
+ */var J;((J=window.HTMLSlotElement)===null||J===void 0?void 0:J.prototype.assignedElements)!=null;const Ht=`
36
36
  :host {
37
37
  display: block;
38
38
  }
39
- `;var Ht=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,y=(r,t,e,i)=>{for(var s=i>1?void 0:i?Nt(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&Ht(t,e,s),s};d.EOxDrawTools=class extends H{constructor(){super(...arguments);$(this,"_layerId");$(this,"_eoxMap");$(this,"_olMap");$(this,"_drawLayer");$(this,"_drawnFeatures",[]);$(this,"_currentlyDrawing");$(this,"multipleFeatures");$(this,"for");$(this,"layer");$(this,"_draw");$(this,"_modify")}_startDrawing(){this._eoxMap.addDraw(this._layerId,{id:"drawInteraction",type:"Polygon"}),this._draw=this._eoxMap.interactions.drawInteraction,this._modify=this._eoxMap.interactions.drawInteraction_modify,this._draw.on("drawend",e=>this._onDrawEnd(e)),this._modify.on("modifyend",e=>this._onModifyEnd(e)),this._currentlyDrawing=!0,this.requestUpdate()}_discardDrawing(){this._drawnFeatures=[],this._eoxMap.removeInteraction("drawInteraction"),this._drawLayer.getSource().clear(),this._currentlyDrawing=!1,this.requestUpdate()}_onDrawEnd(e){console.log(e),this._emitDrawnFeatures(),this._eoxMap.removeInteraction("drawInteraction"),this._currentlyDrawing=!1,this.requestUpdate()}_onModifyEnd(e){console.log(e),this._emitDrawnFeatures()}_emitDrawnFeatures(){setTimeout(()=>{this._drawnFeatures=this._drawLayer.getSource().getFeatures(),this.requestUpdate();const e=new CustomEvent("drawupdate",{detail:this._drawnFeatures});this.dispatchEvent(e)},0)}render(){const e=document.querySelector(this.for);return this._eoxMap=e,this._olMap=e.map,this._layerId=this.layer,this._drawLayer=this._olMap.getLayers().getArray().find(i=>i.get("id")===this._layerId),this.requestUpdate(),At`
39
+ `,Ut=`
40
+ * {
41
+ font-family: Roboto, sans-serif;
42
+ }
43
+
44
+
45
+ button {
46
+ /* TODO: why does this only work here and not from :root? */
47
+ --primary-color: #004170;
48
+ --primary-color-hover: #004170CC;
49
+ --error-color: #FF5252;
50
+
51
+ display: inline-flex;
52
+ align-items: center;
53
+ color: #fff;
54
+ border-width: 0;
55
+ outline: none;
56
+ border-radius: 4px;
57
+ padding: 16px;
58
+ height: 36px;
59
+ cursor: pointer;
60
+ font-family: inherit;
61
+ font-size: 0.875rem;
62
+ text-transform: uppercase;
63
+ letter-spacing: 1.25px;
64
+ font-weight: 500;
65
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
66
+ transition-property: box-shadow, transform, opacity, background;
67
+ transition-duration: 0.28s;
68
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
69
+ }
70
+
71
+ button:hover {
72
+ box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
73
+ background: var(--primary-color-hover);
74
+ }
75
+
76
+ button, button:active {
77
+ background: var(--primary-color);
78
+ }
79
+
80
+ button.outline {
81
+ background: transparent;
82
+ box-shadow: none;
83
+ color: var(--primary-color);
84
+ outline: 1px solid var(--primary-color);
85
+ }
86
+
87
+ button.outline:hover {
88
+ background: transparent;
89
+ }
90
+
91
+ button.icon {
92
+ background: transparent;
93
+ border: none;
94
+ box-shadow: none;
95
+ padding: 0;
96
+ border-radius: 50%;
97
+ width: 24px;
98
+ }
99
+
100
+ button.icon-text {
101
+ text-indent: 26px;
102
+ }
103
+
104
+ button.icon:before, button.icon-text:before {
105
+ position: absolute;
106
+ text-indent: 0;
107
+ line-height: initial;
108
+ }
109
+
110
+ button.icon:before {
111
+ width: 24px;
112
+ height: 24px;
113
+ margin-right: 0;
114
+ }
115
+
116
+ button.icon-text:before {
117
+ width: 18px;
118
+ height: 18px;
119
+ }
120
+
121
+
122
+ button.discard {
123
+ background: var(--error-color);
124
+ }
125
+
126
+ button.polygon:before {
127
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
128
+ }
129
+ `;var Mt=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,_=(o,t,e,i)=>{for(var s=i>1?void 0:i?kt(t,e):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(s=(i?r(t,e,s):r(s))||s);return i&&s&&Mt(t,e,s),s};p.EOxDrawTools=class extends H{constructor(){super(...arguments),this._drawnFeatures=[]}_startDrawing(){this._eoxMap.addDraw(this._layerId,{id:"drawInteraction",type:"Polygon"}),this._draw=this._eoxMap.interactions.drawInteraction,this._modify=this._eoxMap.interactions.drawInteraction_modify,this._draw.on("drawend",t=>this._onDrawEnd(t)),this._modify.on("modifyend",t=>this._onModifyEnd(t)),this._currentlyDrawing=!0,this.requestUpdate()}_discardDrawing(){this._drawnFeatures=[],this._eoxMap.removeInteraction("drawInteraction"),this._drawLayer.getSource().clear(),this._currentlyDrawing=!1,this.requestUpdate()}_onDrawEnd(t){console.log(t),this._emitDrawnFeatures(),this._eoxMap.removeInteraction("drawInteraction"),this._currentlyDrawing=!1,this.requestUpdate()}_onModifyEnd(t){console.log(t),this._emitDrawnFeatures()}_emitDrawnFeatures(){setTimeout(()=>{this._drawnFeatures=this._drawLayer.getSource().getFeatures(),this.requestUpdate();const t=new CustomEvent("drawupdate",{detail:this._drawnFeatures});this.dispatchEvent(t)},0)}render(){const t=document.querySelector(this.for);return this._eoxMap=t,this._olMap=t.map,this._layerId=this.layer,this._drawLayer=this._olMap.getLayers().getArray().find(e=>e.get("id")===this._layerId),this.requestUpdate(),mt`
40
130
  <style>
41
- ${Mt}
131
+ ${Ht}
132
+ ${!this.unstyled&&Ut}
42
133
  </style>
43
134
  <div>
44
135
  <slot></slot>
45
136
  <button
46
- disabled="${!this.multipleFeatures&&this._drawnFeatures.length||this._currentlyDrawing||c}"
137
+ data-cy="drawBtn"
138
+ class="icon-text polygon"
139
+ disabled="${!this.multipleFeatures&&this._drawnFeatures.length||this._currentlyDrawing||d}"
47
140
  @click="${()=>this._startDrawing()}"
48
141
  >
49
142
  ${this._currentlyDrawing?"drawing":"draw"}
50
143
  </button>
51
144
  <button
52
- disabled="${!this._drawnFeatures.length&&!this._currentlyDrawing||c}"
145
+ data-cy="discardBtn"
146
+ class="discard"
147
+ disabled="${!this._drawnFeatures.length&&!this._currentlyDrawing||d}"
53
148
  @click="${()=>this._discardDrawing()}"
54
149
  >
55
150
  discard
56
151
  </button>
57
152
  </div>
58
- `}},y([T()],d.EOxDrawTools.prototype,"_layerId",2),y([T()],d.EOxDrawTools.prototype,"_eoxMap",2),y([T()],d.EOxDrawTools.prototype,"_olMap",2),y([T()],d.EOxDrawTools.prototype,"_drawLayer",2),y([T()],d.EOxDrawTools.prototype,"_drawnFeatures",2),y([T()],d.EOxDrawTools.prototype,"_currentlyDrawing",2),y([I({type:Boolean})],d.EOxDrawTools.prototype,"multipleFeatures",2),y([I()],d.EOxDrawTools.prototype,"for",2),y([I()],d.EOxDrawTools.prototype,"layer",2),d.EOxDrawTools=y([Pt("eox-drawtools")],d.EOxDrawTools),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
153
+ `}},_([S()],p.EOxDrawTools.prototype,"_layerId",2),_([S()],p.EOxDrawTools.prototype,"_eoxMap",2),_([S()],p.EOxDrawTools.prototype,"_olMap",2),_([S()],p.EOxDrawTools.prototype,"_drawLayer",2),_([S()],p.EOxDrawTools.prototype,"_drawnFeatures",2),_([S()],p.EOxDrawTools.prototype,"_currentlyDrawing",2),_([U({type:Boolean})],p.EOxDrawTools.prototype,"multipleFeatures",2),_([U()],p.EOxDrawTools.prototype,"for",2),_([U()],p.EOxDrawTools.prototype,"layer",2),_([U({type:Boolean})],p.EOxDrawTools.prototype,"unstyled",2),p.EOxDrawTools=_([Tt("eox-drawtools")],p.EOxDrawTools),Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@eox/eslint-config": "^1.0.0",
@@ -0,0 +1,29 @@
1
+ export class MockMap extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ }
5
+ map = {
6
+ getLayers: () => ({
7
+ getArray: () => [
8
+ {
9
+ get: () => "draw",
10
+ getSource: () => ({
11
+ clear: () => ({}),
12
+ getFeatures: () => [{}],
13
+ }),
14
+ },
15
+ ],
16
+ }),
17
+ };
18
+ addDraw() {}
19
+ interactions = {
20
+ drawInteraction: {
21
+ on: (event: string, fun: Function) => fun(event),
22
+ },
23
+ drawInteraction_modify: {
24
+ on() {},
25
+ },
26
+ };
27
+ removeInteraction() {}
28
+ }
29
+ customElements.define("mock-map", MockMap);
@@ -0,0 +1,44 @@
1
+ import "../src/main";
2
+ import "./_mockMap";
3
+
4
+ describe("Drawtools", () => {
5
+ beforeEach(() => {
6
+ cy.mount("<mock-map></mock-map>").as("mock-map");
7
+ cy.mount(
8
+ `
9
+ <eox-drawtools for="mock-map" layer="draw"></eox-drawtools>`
10
+ ).as("eox-drawtools");
11
+ });
12
+
13
+ it("loads the drawtools", () => {
14
+ cy.get("eox-drawtools").shadow();
15
+ });
16
+
17
+ it("clicks the draw button", () => {
18
+ cy.get("eox-drawtools")
19
+ .shadow()
20
+ .within(() => {
21
+ cy.get("[data-cy='drawBtn']").contains("draw");
22
+ cy.get("[data-cy='drawBtn']").should("not.contain", "drawing");
23
+ cy.get("[data-cy='drawBtn']").click();
24
+ cy.get("[data-cy='drawBtn']").contains("drawing");
25
+ });
26
+ cy.get("eox-drawtools").and(($el) => {
27
+ expect((<EOxDrawTools>$el[0])._drawnFeatures).to.have.length(1);
28
+ });
29
+ });
30
+
31
+ it("clicks the discard button and clears drawn features", () => {
32
+ cy.get("eox-drawtools")
33
+ .shadow()
34
+ .within(() => {
35
+ cy.get("[data-cy='drawBtn']").click();
36
+ cy.get("[data-cy='drawBtn']").contains("drawing");
37
+ cy.get("[data-cy='discardBtn']").click();
38
+ cy.get("[data-cy='drawBtn']").should("not.contain", "drawing");
39
+ });
40
+ cy.get("eox-drawtools").should(($el) => {
41
+ expect((<EOxDrawTools>$el[0])._drawnFeatures).to.have.length(0);
42
+ });
43
+ });
44
+ });
@@ -1,9 +0,0 @@
1
- describe("Drawtools", () => {
2
- beforeEach(() => {
3
- cy.visit("/elements/drawtools/test/mapIntegration.html");
4
- });
5
-
6
- it("loads the drawtools", () => {
7
- cy.get("eox-drawtools").should("exist");
8
- });
9
- });
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <style>
5
- html,
6
- body {
7
- padding: 0;
8
- margin: 0;
9
- }
10
- eox-map {
11
- width: 100%;
12
- height: 400px;
13
- }
14
- eox-drawtools {
15
- position: absolute;
16
- top: 0;
17
- right: 0;
18
- background: white;
19
- }
20
- </style>
21
- <script type="module" defer src="../../map/dist/eox-map.js"></script>
22
- <script type="module" defer src="../dist/eox-drawtools.js"></script>
23
- </head>
24
- <body>
25
- <eox-map></eox-map>
26
- <eox-drawtools> Default slot content </eox-drawtools>
27
- <p>Drawn features: <span style="line-break: anywhere"></span></p>
28
- <script type="module">
29
- import layers from "./mapIntegration.json" assert { type: "json" };
30
- const eoxMap = document.querySelector("eox-map");
31
- const eoxDrawTools = document.querySelector("eox-drawtools");
32
- setTimeout(() => {
33
- eoxMap.setLayers(layers);
34
- eoxDrawTools.attachTo(eoxMap, "draw_layer");
35
- }, 500);
36
- eoxDrawTools.addEventListener("drawupdate", (evt) => {
37
- document.querySelector("span").innerHTML = JSON.stringify(
38
- evt.detail.map((f) => f.getGeometry().flatCoordinates)
39
- );
40
- });
41
- </script>
42
- </body>
43
- </html>
@@ -1,89 +0,0 @@
1
- {
2
- "version": 8,
3
- "name": "",
4
- "sources": {
5
- "states": {
6
- "type": "raster",
7
- "tileSize": 512,
8
- "tiles": [
9
- "https://ahocevar.com/geoserver/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=topp:states&STYLES=&WIDTH=512&HEIGHT=512&SRS=EPSG:3857&BBOX={bbox-epsg-3857}"
10
- ]
11
- },
12
- "countries": {
13
- "type": "geojson",
14
- "data": "https://openlayersbook.github.io/openlayers_book_samples/assets/data/countries.geojson"
15
- },
16
- "countriesTiles": {
17
- "type": "vector",
18
- "tiles": [
19
- "https://ahocevar.com/geoserver/gwc/service/tms/1.0.0/ne:ne_10m_admin_0_countries@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf"
20
- ]
21
- },
22
- "draw_layer": {
23
- "type": "geojson",
24
- "data": {
25
- "type": "FeatureCollection",
26
- "features": []
27
- }
28
- }
29
- },
30
- "layers": [
31
- {
32
- "id": "states",
33
- "type": "raster",
34
- "source": "states"
35
- },
36
- {
37
- "id": "countries_fill",
38
- "type": "fill",
39
- "source": "countries",
40
- "paint": {
41
- "fill-color": "rgba(255, 255, 255, 0.5)"
42
- }
43
- },
44
- {
45
- "id": "countries_outline",
46
- "type": "line",
47
- "source": "countries",
48
- "paint": {
49
- "line-color": "#219e46",
50
- "line-width": 2
51
- }
52
- },
53
- {
54
- "id": "countries_fill_tiles",
55
- "type": "fill",
56
- "source": "countriesTiles",
57
- "source-layer": "ne_10m_admin_0_countries",
58
- "paint": {
59
- "fill-color": "rgba(255, 0, 100, 0.5)"
60
- }
61
- },
62
- {
63
- "id": "countries_outline_tiles",
64
- "type": "line",
65
- "source": "countriesTiles",
66
- "source-layer": "ne_10m_admin_0_countries",
67
- "paint": {
68
- "line-color": "rgba(255, 0, 100, 1)"
69
- }
70
- },
71
- {
72
- "id": "draw_layer",
73
- "type": "line",
74
- "source": "draw_layer",
75
- "metadata": {
76
- "group": "draw_layer",
77
- "draw": {
78
- "active": true,
79
- "type": "LineString"
80
- }
81
- },
82
- "paint": {
83
- "line-color": "blue",
84
- "fill-color": "rgba(255,255,255,0.4)",
85
- "line-width": 2
86
- }
87
- }
88
- ]
89
- }
@@ -1,9 +0,0 @@
1
- describe("Drawtools", () => {
2
- beforeEach(() => {
3
- cy.visit("/elements/drawtools/test/mapIntegrationLegacy.html");
4
- });
5
-
6
- it("loads the drawtools", () => {
7
- cy.get("eox-drawtools").should("exist");
8
- });
9
- });
@@ -1,64 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <style>
5
- html,
6
- body {
7
- padding: 0;
8
- margin: 0;
9
- }
10
- #map {
11
- width: 100%;
12
- height: 400px;
13
- }
14
- eox-drawtools {
15
- position: absolute;
16
- top: 0;
17
- right: 0;
18
- background: white;
19
- }
20
- </style>
21
- <script type="module" defer src="../../map/dist/eox-map.js"></script>
22
- <script type="module" defer src="../dist/eox-drawtools.js"></script>
23
- </head>
24
- <body>
25
- <div id="map"></div>
26
- <eox-drawtools> Default slot content </eox-drawtools>
27
- <p>Drawn features: <span style="line-break: anywhere"></span></p>
28
- <script type="module">
29
- import Map from "https://cdn.skypack.dev/ol/Map.js";
30
- import OSM from "https://cdn.skypack.dev/ol/source/OSM.js";
31
- import TileLayer from "https://cdn.skypack.dev/ol/layer/Tile.js";
32
- import View from "https://cdn.skypack.dev/ol/View.js";
33
- import VectorLayer from "https://cdn.skypack.dev/ol/layer/Vector.js";
34
- import VectorSource from "https://cdn.skypack.dev/ol/source/Vector.js";
35
-
36
- const map = new Map({
37
- target: "map",
38
- layers: [
39
- new TileLayer({
40
- source: new OSM(),
41
- }),
42
- new VectorLayer({
43
- source: new VectorSource(),
44
- id: "draw_layer",
45
- }),
46
- ],
47
- view: new View({
48
- center: [0, 0],
49
- zoom: 2,
50
- }),
51
- controls: [],
52
- });
53
- const eoxDrawTools = document.querySelector("eox-drawtools");
54
- setTimeout(() => {
55
- eoxDrawTools.attachTo(map, "draw_layer");
56
- }, 500);
57
- eoxDrawTools.addEventListener("drawupdate", (evt) => {
58
- document.querySelector("span").innerHTML = JSON.stringify(
59
- evt.detail.map((f) => f.getGeometry().flatCoordinates)
60
- );
61
- });
62
- </script>
63
- </body>
64
- </html>