@eox/drawtools 0.4.2 → 0.6.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,31 +1,39 @@
1
- var vt=(p,d,f)=>{if(!d.has(p))throw TypeError("Cannot "+f)};var m=(p,d,f)=>(vt(p,d,"read from private field"),f?f.call(p):d.get(p)),K=(p,d,f)=>{if(d.has(p))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(p):d.set(p,f)},Q=(p,d,f,H)=>(vt(p,d,"write to private field"),H?H.call(p,f):d.set(p,f),f);(function(p,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(p=typeof globalThis<"u"?globalThis:p||self,d(p["eox-drawtools"]={}))})(this,function(p){var g,k;"use strict";/**
1
+ (function(h,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(h=typeof globalThis<"u"?globalThis:h||self,l(h["eox-drawtools"]={}))})(this,function(h){"use strict";var zt=Object.defineProperty;var qt=(h,l,u)=>l in h?zt(h,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):h[l]=u;var M=(h,l,u)=>(qt(h,typeof l!="symbol"?l+"":l,u),u),ft=(h,l,u)=>{if(!l.has(h))throw TypeError("Cannot "+u)};var g=(h,l,u)=>(ft(h,l,"read from private field"),u?u.call(h):l.get(h)),J=(h,l,u)=>{if(l.has(h))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(h):l.set(h,u)},K=(h,l,u,U)=>(ft(h,l,"write to private field"),U?U.call(h,u):l.set(h,u),u);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const d=window,f=d.ShadowRoot&&(d.ShadyCSS===void 0||d.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H=Symbol(),X=new WeakMap;let ft=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==H)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 gt=r=>new ft(typeof r=="string"?r:r+"",void 0,H),yt=(r,t)=>{f?r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=d.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)})},G=f?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return gt(e)})(r):r;/**
5
+ */var yt,f,k;const l=globalThis,u=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),G=new WeakMap;let gt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==U)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(u&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=G.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&G.set(e,t))}return t}toString(){return this.cssText}};const mt=r=>new gt(typeof r=="string"?r:r+"",void 0,U),_t=(r,t)=>{if(u)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),s=l.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)}},Q=u?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return mt(e)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */var B;const N=window,Y=N.trustedTypes,_t=Y?Y.emptyScript:"",tt=N.reactiveElementPolyfillSupport,I={toAttribute(r,t){switch(t){case Boolean:r=r?_t: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}},et=(r,t)=>t!==r&&(t==t||r==r),F={attribute:!0,type:String,converter:I,reflect:!1,hasChanged:et},j="finalized";let x=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 n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||F}static finalize(){if(this.hasOwnProperty(j))return!1;this[j]=!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 yt(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 n=this.constructor._$Ep(t,i);if(n!==void 0&&i.reflect===!0){const o=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:I).toAttribute(e,i.type);this._$El=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),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 o=s.getPropertyOptions(n),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:I;this._$El=n,this[n]=h.fromAttribute(e,o.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){}};x[j]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:x}),((B=N.reactiveElementVersions)!==null&&B!==void 0?B:N.reactiveElementVersions=[]).push("1.6.2");/**
9
+ */const{is:wt,defineProperty:bt,getOwnPropertyDescriptor:At,getOwnPropertyNames:vt,getOwnPropertySymbols:xt,getPrototypeOf:Et}=Object,_=globalThis,X=_.trustedTypes,St=X?X.emptyScript:"",z=_.reactiveElementPolyfillSupport,P=(r,t)=>r,q={toAttribute(r,t){switch(t){case Boolean:r=r?St: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}},Y=(r,t)=>!wt(r,t),tt={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:Y};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class E extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&bt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=At(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const p=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,p,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Et(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){const e=this.properties,i=[...vt(e),...xt(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}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(Q(s))}else t!==void 0&&e.push(Q(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){var n;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:q).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=i.getPropertyOptions(s),p=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:q;this._$Em=s,this[s]=p.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i,s=!1,n){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Y)(s?n:this[t],e))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$ES)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(e)):this._$ET()}catch(s){throw t=!1,this._$ET(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[P("elementProperties")]=new Map,E[P("finalized")]=new Map,z==null||z({ReactiveElement:E}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.1");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */var z;const V=window,E=V.trustedTypes,it=E?E.createPolicy("lit-html",{createHTML:r=>r}):void 0,q="$lit$",_=`lit$${(Math.random()+"").slice(9)}$`,st="?"+_,mt=`<${st}>`,A=document,U=()=>A.createComment(""),P=r=>r===null||typeof r!="object"&&typeof r!="function",rt=Array.isArray,At=r=>rt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",W=`[
14
- \f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,ot=/>/g,b=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),lt=/'/g,at=/"/g,ht=/^(?:script|style|textarea|title)$/i,bt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),wt=bt(1),S=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),dt=new WeakMap,w=A.createTreeWalker(A,129,null,!1);function ct(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return it!==void 0?it.createHTML(t):t}const xt=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=M;for(let h=0;h<e;h++){const l=r[h];let a,c,u=-1,v=0;for(;v<l.length&&(o.lastIndex=v,c=o.exec(l),c!==null);)v=o.lastIndex,o===M?c[1]==="!--"?o=nt:c[1]!==void 0?o=ot:c[2]!==void 0?(ht.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=b):c[3]!==void 0&&(o=b):o===b?c[0]===">"?(o=s??M,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,a=c[1],o=c[3]===void 0?b:c[3]==='"'?at:lt):o===at||o===lt?o=b:o===nt||o===ot?o=M:(o=b,s=void 0);const y=o===b&&r[h+1].startsWith("/>")?" ":"";n+=o===M?l+mt:u>=0?(i.push(a),l.slice(0,u)+q+l.slice(u)+_+y):l+_+(u===-2?(i.push(void 0),h):y)}return[ct(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class T{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const h=t.length-1,l=this.parts,[a,c]=xt(t,e);if(this.el=T.createElement(a,i),w.currentNode=this.el.content,e===2){const u=this.el.content,v=u.firstChild;v.remove(),u.append(...v.childNodes)}for(;(s=w.nextNode())!==null&&l.length<h;){if(s.nodeType===1){if(s.hasAttributes()){const u=[];for(const v of s.getAttributeNames())if(v.endsWith(q)||v.startsWith(_)){const y=c[o++];if(u.push(v),y!==void 0){const Dt=s.getAttribute(y.toLowerCase()+q).split(_),R=/([.?@])?(.*)/.exec(y);l.push({type:1,index:n,name:R[2],strings:Dt,ctor:R[1]==="."?St:R[1]==="?"?Ht:R[1]==="@"?Ut:L})}else l.push({type:6,index:n})}for(const v of u)s.removeAttribute(v)}if(ht.test(s.tagName)){const u=s.textContent.split(_),v=u.length-1;if(v>0){s.textContent=E?E.emptyScript:"";for(let y=0;y<v;y++)s.append(u[y],U()),w.nextNode(),l.push({type:2,index:++n});s.append(u[v],U())}}}else if(s.nodeType===8)if(s.data===st)l.push({type:2,index:n});else{let u=-1;for(;(u=s.data.indexOf(_,u+1))!==-1;)l.push({type:7,index:n}),u+=_.length-1}n++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function C(r,t,e=r,i){var s,n,o,h;if(t===S)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&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),a===void 0?l=void 0:(l=new a(r),l._$AT(r,e,i)),i!==void 0?((o=(h=e)._$Co)!==null&&o!==void 0?o:h._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=C(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,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:A).importNode(i,!0);w.currentNode=n;let o=w.nextNode(),h=0,l=0,a=s[0];for(;a!==void 0;){if(h===a.index){let c;a.type===2?c=new O(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new Pt(o,this,t)),this._$AV.push(c),a=s[++l]}h!==(a==null?void 0:a.index)&&(o=w.nextNode(),h++)}return w.currentNode=A,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 O{constructor(t,e,i,s){var n;this.type=2,this._$AH=$,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=C(this,t,e),P(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):At(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!==$&&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,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=T.createElement(ct(s.h,s.h[0]),this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.v(i);else{const o=new Et(n,this),h=o.u(this.options);o.v(i),this.$(h),this._$AH=o}}_$AC(t){let e=dt.get(t.strings);return e===void 0&&dt.set(t.strings,e=new T(t)),e}T(t){rt(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 O(this.k(U()),this.k(U()),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 L{constructor(t,e,i,s,n){this.type=1,this._$AH=$,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=$}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(n===void 0)t=C(this,t,e,0),o=!P(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const h=t;let l,a;for(t=n[0],l=0;l<n.length-1;l++)a=C(this,h[i+l],e,l),a===S&&(a=this._$AH[l]),o||(o=!P(a)||a!==this._$AH[l]),a===$?t=$:t!==$&&(t+=(a??"")+n[l+1]),this._$AH[l]=a}o&&!s&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class St extends L{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}}const Ct=E?E.emptyScript:"";class Ht extends L{constructor(){super(...arguments),this.type=4}j(t){t&&t!==$?this.element.setAttribute(this.name,Ct):this.element.removeAttribute(this.name)}}class Ut extends L{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=(i=C(this,t,e,0))!==null&&i!==void 0?i:$)===S)return;const s=this._$AH,n=t===$&&s!==$||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==$&&(s===$||n);n&&this.element.removeEventListener(this.name,this,s),o&&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 Pt{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){C(this,t)}}const ut=V.litHtmlPolyfillSupport;ut==null||ut(T,O),((z=V.litHtmlVersions)!==null&&z!==void 0?z:V.litHtmlVersions=[]).push("2.8.0");const Mt=(r,t,e)=>{var i,s;const n=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let o=n._$litPart$;if(o===void 0){const h=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;n._$litPart$=o=new O(t.insertBefore(U(),h),h,void 0,e??{})}return o._$AI(r),o};/**
13
+ */const I=globalThis,N=I.trustedTypes,et=N?N.createPolicy("lit-html",{createHTML:r=>r}):void 0,it="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,st="?"+w,Ct=`<${st}>`,A=document,L=()=>A.createComment(""),T=r=>r===null||typeof r!="object"&&typeof r!="function",rt=Array.isArray,Ht=r=>rt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",j=`[
14
+ \f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,nt=/>/g,v=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,lt=/"/g,ht=/^(?:script|style|textarea|title)$/i,kt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),V=kt(1),S=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),dt=new WeakMap,x=A.createTreeWalker(A,129);function ct(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const Mt=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=D;for(let p=0;p<e;p++){const a=r[p];let $,y,c=-1,m=0;for(;m<a.length&&(o.lastIndex=m,y=o.exec(a),y!==null);)m=o.lastIndex,o===D?y[1]==="!--"?o=ot:y[1]!==void 0?o=nt:y[2]!==void 0?(ht.test(y[2])&&(s=RegExp("</"+y[2],"g")),o=v):y[3]!==void 0&&(o=v):o===v?y[0]===">"?(o=s??D,c=-1):y[1]===void 0?c=-2:(c=o.lastIndex-y[2].length,$=y[1],o=y[3]===void 0?v:y[3]==='"'?lt:at):o===lt||o===at?o=v:o===ot||o===nt?o=D:(o=v,s=void 0);const b=o===v&&r[p+1].startsWith("/>")?" ":"";n+=o===D?a+Ct:c>=0?(i.push($),a.slice(0,c)+it+a.slice(c)+w+b):a+w+(c===-2?p:b)}return[ct(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class O{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const p=t.length-1,a=this.parts,[$,y]=Mt(t,e);if(this.el=O.createElement($,i),x.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=x.nextNode())!==null&&a.length<p;){if(s.nodeType===1){if(s.hasAttributes())for(const c of s.getAttributeNames())if(c.endsWith(it)){const m=y[o++],b=s.getAttribute(c).split(w),B=/([.?@])?(.*)/.exec(m);a.push({type:1,index:n,name:B[2],strings:b,ctor:B[1]==="."?Pt:B[1]==="?"?It:B[1]==="@"?Lt:R}),s.removeAttribute(c)}else c.startsWith(w)&&(a.push({type:6,index:n}),s.removeAttribute(c));if(ht.test(s.tagName)){const c=s.textContent.split(w),m=c.length-1;if(m>0){s.textContent=N?N.emptyScript:"";for(let b=0;b<m;b++)s.append(c[b],L()),x.nextNode(),a.push({type:2,index:++n});s.append(c[m],L())}}}else if(s.nodeType===8)if(s.data===st)a.push({type:2,index:n});else{let c=-1;for(;(c=s.data.indexOf(w,c+1))!==-1;)a.push({type:7,index:n}),c+=w.length-1}n++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function C(r,t,e=r,i){var o,p;if(t===S)return t;let s=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=T(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((p=s==null?void 0:s._$AO)==null||p.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=s:e._$Cl=s),s!==void 0&&(t=C(r,s._$AS(r,t.values),s,i)),t}class Ut{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){const{el:{content:e},parts:i}=this._$AD,s=((t==null?void 0:t.creationScope)??A).importNode(e,!0);x.currentNode=s;let n=x.nextNode(),o=0,p=0,a=i[0];for(;a!==void 0;){if(o===a.index){let $;a.type===2?$=new F(n,n.nextSibling,this,t):a.type===1?$=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&($=new Tt(n,this,t)),this._$AV.push($),a=i[++p]}o!==(a==null?void 0:a.index)&&(n=x.nextNode(),o++)}return x.currentNode=A,s}p(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 F{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}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=C(this,t,e),T(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ht(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&&T(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var n;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=O.createElement(ct(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{const o=new Ut(s,this),p=o.u(this.options);o.p(e),this.$(p),this._$AH=o}}_$AC(t){let e=dt.get(t.strings);return e===void 0&&dt.set(t.strings,e=new O(t)),e}T(t){rt(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 F(this.k(L()),this.k(L()),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?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._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}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}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(n===void 0)t=C(this,t,e,0),o=!T(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const p=t;let a,$;for(t=n[0],a=0;a<n.length-1;a++)$=C(this,p[i+a],e,a),$===S&&($=this._$AH[a]),o||(o=!T($)||$!==this._$AH[a]),$===d?t=d:t!==d&&(t+=($??"")+n[a+1]),this._$AH[a]=$}o&&!s&&this.O(t)}O(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends R{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===d?void 0:t}}class It extends R{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Lt extends R{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=C(this,t,e,0)??d)===S)return;const i=this._$AH,s=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??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){C(this,t)}}const W=I.litHtmlPolyfillSupport;W==null||W(O,F),(I.litHtmlVersions??(I.litHtmlVersions=[])).push("3.1.0");const Dt=(r,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new F(t.insertBefore(L(),n),n,void 0,e??{})}return s._$AI(r),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */var Z,J;class D extends x{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=Mt(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 S}}D.finalized=!0,D._$litElement$=!0,(Z=globalThis.litElementHydrateSupport)===null||Z===void 0||Z.call(globalThis,{LitElement:D});const pt=globalThis.litElementPolyfillSupport;pt==null||pt({LitElement:D}),((J=globalThis.litElementVersions)!==null&&J!==void 0?J:globalThis.litElementVersions=[]).push("3.3.2");const Tt=`
20
- :host {
21
- display: block;
22
- }
23
- `,Ot=`
24
- * {
25
- font-family: Roboto, sans-serif;
26
- }
27
-
19
+ */class H extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Dt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return S}}H._$litElement$=!0,H.finalized=!0,(yt=globalThis.litElementHydrateSupport)==null||yt.call(globalThis,{LitElement:H});const Z=globalThis.litElementPolyfillSupport;Z==null||Z({LitElement:H}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ */const Ot=r=>(...t)=>({_$litDirective$:r,values:t});let Ft=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
24
+ * @license
25
+ * Copyright 2020 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */const Nt={},Vt=(r,t=Nt)=>r._$AH=t;/**
28
+ * @license
29
+ * Copyright 2021 Google LLC
30
+ * SPDX-License-Identifier: BSD-3-Clause
31
+ */const Rt=Ot(class extends Ft{constructor(){super(...arguments),this.key=d}render(r,t){return this.key=r,t}update(r,[t,e]){return t!==this.key&&(Vt(r),this.key=t),e}}),pt=`
32
+ * {
33
+ font-family: Roboto, sans-serif;
34
+ }
28
35
 
36
+
29
37
  button {
30
38
  /* TODO: why does this only work here and not from :root? */
31
39
  --primary-color: #004170;
@@ -116,24 +124,120 @@ button.small {
116
124
  }
117
125
 
118
126
 
119
- button.discard:before {
120
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
121
- }
127
+ button.discard:before {
128
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
129
+ }
130
+
131
+ button.polygon:before {
132
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
133
+ }
134
+ ul {
135
+ padding: 0;
136
+ }
137
+ ul ul {
138
+ padding-left: 48px;
139
+ }
140
+ li:hover {
141
+ background: #f0f5f9;
142
+ }
143
+ li.selected {
144
+ background: #f0f5f9;
145
+ }
146
+ li {
147
+ list-style: none;
148
+ padding: 4px;
149
+ }
150
+ li {
151
+ border-bottom: 1px solid #0041703a;
152
+ }
153
+ li:first-child {
154
+ border-top: 1px solid #0041703a;
155
+ }
156
+ li.sortable-chosen {
157
+ background: #eeea;
158
+ }
159
+ li.sortable-drag {
160
+ opacity: 0;
161
+ }
162
+ li.sortable-ghost {
163
+ }
164
+ button.small.icon, button.small.icon::before {
165
+ height: 16px;
166
+ width: 16px;
167
+ padding: 0px;
168
+ }
169
+ button.discard.icon {
170
+ opacity: .7;
171
+ }
172
+ button.discard.icon:hover {
173
+ opacity: 1;
174
+ }
175
+ eox-drawtools-list {
176
+ width: 100%;
177
+ }
178
+ .list {
179
+ width: 100%;
180
+ align-items: center;
181
+ justify-content: space-between;
182
+ display: flex;
183
+ align-items: center;
184
+ cursor: pointer;
185
+ font-size: small;
186
+ gap: 10px;
122
187
 
123
- button.polygon:before {
124
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
188
+ }
189
+ label {
190
+ gap: 10px;
191
+ }
192
+ label, span {
193
+ display: flex;
194
+ align-items: center;
195
+ cursor: pointer;
196
+ font-size: small;
197
+ flex-grow: 1;
198
+ }
199
+ `;class ut extends H{constructor(){super();M(this,"hoverInteraction");M(this,"clickInteraction");M(this,"hoverId");M(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.layer="draw",this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){e.stopPropagation();const i=e.target.getAttribute("index"),s=this.drawnFeatures[i];this.drawLayer.getSource().removeFeature(s),this.drawnFeatures.splice(i,1),this.requestUpdate()}_handleFeatureSelectAndDeselect(e){const i=e.get("id");if(this.clickId===i){const s=this.drawLayer.getSource().getExtent();this.olMap.getView().fit(s,{duration:750}),this.clickInteraction.highlightById([])}else this.clickInteraction.highlightById([i]),this.olMap.getView().fit(e.getGeometry().getExtent(),{duration:750});this.requestUpdate()}firstUpdated(){this.hoverInteraction=this.eoxMap.selectInteractions.selectHover,this.clickInteraction=this.eoxMap.selectInteractions.selectClick,this.hoverInteraction.selectStyleLayer.on("change",()=>this.requestUpdate()),this.clickInteraction.selectStyleLayer.on("change",()=>this.requestUpdate())}render(){var e,i;return this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(i=this.clickInteraction)==null?void 0:i.selectedFids[0],V`
200
+ <style>
201
+ ${!this.unstyled&&pt}
202
+ </style>
203
+ <ul>
204
+ ${this.drawnFeatures.map((s,n)=>{const o=s.get("id"),p=this.hoverId===o||this.clickId===o;return Rt(n+1,V`
205
+ <li
206
+ class="${p?"selected":d}"
207
+ @mouseover=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([o])}}
208
+ @mouseout=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([])}}
209
+ >
210
+ <div
211
+ class="list"
212
+ @click="${()=>this._handleFeatureSelectAndDeselect(s)}"
213
+ >
214
+ <span class="title">Feature #${n+1}</span>
215
+ <button
216
+ index=${n}
217
+ class="icon small discard"
218
+ @click="${this._handleDelete}"
219
+ >
220
+ ${this.unstyled?"x":d}
221
+ </button>
222
+ </div>
223
+ </li>
224
+ `)})}
225
+ </ul>
226
+ `}}M(ut,"properties",{eoxMap:{attribute:!1,state:!0},olMap:{attribute:!1,state:!0},draw:{attribute:!1,state:!0},layer:{type:String},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-list",ut);const Bt=`
227
+ :host {
228
+ display: block;
125
229
  }
126
- `;class $t extends D{constructor(){super();K(this,g,void 0);K(this,k,void 0);this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.layer="draw",this.modify=null,this.multipleFeatures=!1,this.unstyled=!1}static get properties(){return{for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},layer:{type:String},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},unstyled:{type:Boolean}}}startDrawing(){var e,i;m(this,g).addDraw(this.layer,{id:"drawInteraction",type:"Polygon",stopClick:!0}),this.draw=m(this,g).interactions.drawInteraction,this.modify=m(this,g).interactions.drawInteractionmodify,(e=this.draw)==null||e.on("drawend",s=>this.onDrawEnd(s)),(i=this.modify)==null||i.on("modifyend",s=>this.onModifyEnd(s)),this.currentlyDrawing=!0,this.requestUpdate()}discardDrawing(){this.drawnFeatures=[],m(this,g).removeInteraction("drawInteraction"),this.drawLayer.getSource().clear(),this.emitDrawnFeatures(),this.currentlyDrawing=!1,this.requestUpdate()}onDrawEnd(){this.emitDrawnFeatures(),m(this,g).removeInteraction("drawInteraction"),this.currentlyDrawing=!1,this.requestUpdate()}onModifyEnd(){this.emitDrawnFeatures()}emitDrawnFeatures(){setTimeout(()=>{this.drawnFeatures=this.drawLayer.getSource().getFeatures(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))},0)}render(){var i,s;const e=document.querySelector(this.for);return Q(this,g,e),Q(this,k,m(this,g).map),this.drawLayer=m(this,k).getLayers().getArray().find(n=>n.get("id")===this.layer),this.requestUpdate(),wt`
230
+ `;class $t extends H{constructor(){super();J(this,f,void 0);J(this,k,void 0);this.allowModify=!1,this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.multipleFeatures=!1,this.showList=!1,this.type="Polygon",this.unstyled=!1}static get properties(){return{allowModify:{attribute:"allow-modify",type:Boolean},for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},showList:{attribute:"show-list",type:Boolean},type:{type:String},unstyled:{type:Boolean}}}initDrawLayer(){var i,s;const e=document.querySelector(this.for);K(this,f,e),K(this,k,g(this,f).map),this.drawLayer=g(this,f).addOrUpdateLayer({type:"Vector",properties:{id:"drawLayer",layerControlHide:!0},source:{type:"Vector"},...g(this,f).interactions.drawInteraction?{}:{interactions:[{type:"draw",options:{active:!1,id:"drawInteraction",type:this.type,modify:this.allowModify,stopClick:!0}},{type:"select",options:{id:"selectHover",condition:"pointermove",style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}},{type:"select",options:{id:"selectClick",condition:"click",panIn:!0,style:{"fill-color":"rgba(51, 153, 204,0.5)","stroke-color":"#3399CC","stroke-width":2.5}}}]}}),this.draw=g(this,f).interactions.drawInteraction,this.modify=g(this,f).interactions.drawInteractionmodify,(i=this.draw)==null||i.on("drawend",()=>this.onDrawEnd()),(s=this.modify)==null||s.on("modifyend",()=>this.onModifyEnd())}startDrawing(){this.initDrawLayer(),this.draw.setActive(!0),this.currentlyDrawing=!0,this.requestUpdate()}discardDrawing(){this.drawnFeatures=[],this.draw.setActive(!1),this.drawLayer.getSource().clear(),g(this,f).removeInteraction("drawInteraction"),g(this,k).removeLayer(this.drawLayer),this.emitDrawnFeatures(),this.currentlyDrawing=!1,this.requestUpdate()}onDrawEnd(){this.emitDrawnFeatures(),this.draw.setActive(!1),this.currentlyDrawing=!1,this.requestUpdate()}onModifyEnd(){this.emitDrawnFeatures()}emitDrawnFeatures(){setTimeout(()=>{this.drawnFeatures=this.drawLayer.getSource().getFeatures(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))},0)}render(){var e,i,s;return V`
127
231
  <style>
128
- ${Tt}
129
- ${!this.unstyled&&Ot}
232
+ ${Bt}
233
+ ${!this.unstyled&&pt}
130
234
  </style>
131
235
  <div>
132
236
  <slot></slot>
133
237
  <button
134
238
  data-cy="drawBtn"
135
239
  class="polygon icon"
136
- disabled="${!this.multipleFeatures&&((i=this.drawnFeatures)==null?void 0:i.length)>0||this.currentlyDrawing||$}"
240
+ disabled="${!this.multipleFeatures&&((e=this.drawnFeatures)==null?void 0:e.length)>0||this.currentlyDrawing||d}"
137
241
  @click="${()=>this.startDrawing()}"
138
242
  >
139
243
  ${this.currentlyDrawing?"drawing":"draw"}
@@ -141,10 +245,22 @@ button.polygon:before {
141
245
  <button
142
246
  data-cy="discardBtn"
143
247
  class="discard icon"
144
- disabled="${!((s=this.drawnFeatures)!=null&&s.length)&&!this.currentlyDrawing||$}"
248
+ disabled="${!((i=this.drawnFeatures)!=null&&i.length)&&!this.currentlyDrawing||d}"
145
249
  @click="${()=>this.discardDrawing()}"
146
250
  >
147
251
  discard
148
252
  </button>
149
253
  </div>
150
- `}}g=new WeakMap,k=new WeakMap,customElements.define("eox-drawtools",$t),p.EOxDrawTools=$t,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
254
+ ${this.showList&&((s=this.drawnFeatures)!=null&&s.length)?V`<eox-drawtools-list
255
+ .eoxMap=${g(this,f)}
256
+ .olMap=${g(this,k)}
257
+ .draw=${this.draw}
258
+ .layer=${this.layer}
259
+ .drawLayer=${this.drawLayer}
260
+ .drawnFeatures=${this.drawnFeatures}
261
+ .modify=${this.modify}
262
+ .unstyled=${this.unstyled}
263
+ @changed=${()=>this.requestUpdate()}
264
+ >
265
+ </eox-drawtools-list>`:d}
266
+ `}}f=new WeakMap,k=new WeakMap,customElements.define("eox-drawtools",$t),h.EOxDrawTools=$t,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@eox/eslint-config": "^1.0.0",
7
7
  "@typescript-eslint/eslint-plugin": "^6.8.0",
8
- "@typescript-eslint/parser": "^5.50.0",
8
+ "@typescript-eslint/parser": "^6.8.0",
9
9
  "eslint-plugin-typescript": "^0.14.0",
10
10
  "ol": "^8.1.0",
11
11
  "typescript": "^5.2.2",
12
- "vite": "^4.0.0"
12
+ "vite": "^5.0.2"
13
13
  },
14
14
  "engines": {
15
15
  "npm": ">=8.0.0",
@@ -29,6 +29,6 @@
29
29
  "typecheck": "tsc"
30
30
  },
31
31
  "dependencies": {
32
- "lit": "^2.7.4"
32
+ "lit": "^3.0.2"
33
33
  }
34
34
  }
package/test/_mockMap.js CHANGED
@@ -2,7 +2,7 @@ export class MockMap extends HTMLElement {
2
2
  constructor() {
3
3
  super();
4
4
  }
5
- features = [{}];
5
+ features = [];
6
6
  map = {
7
7
  getLayers: () => ({
8
8
  getArray: () => [
@@ -17,11 +17,13 @@ export class MockMap extends HTMLElement {
17
17
  },
18
18
  ],
19
19
  }),
20
+ removeLayer() {},
20
21
  };
21
- addDraw() {}
22
+ addOrUpdateLayer = () => this.map.getLayers().getArray()[0];
22
23
  interactions = {
23
24
  drawInteraction: {
24
25
  on: (event, fun) => fun(event),
26
+ setActive() {},
25
27
  },
26
28
  drawInteraction_modify: {
27
29
  on() {},
@@ -6,7 +6,7 @@ describe("Drawtools", () => {
6
6
  cy.mount("<mock-map></mock-map>").as("mock-map");
7
7
  cy.mount(
8
8
  `
9
- <eox-drawtools for="mock-map" layer="draw"></eox-drawtools>`
9
+ <eox-drawtools for="mock-map"></eox-drawtools>`
10
10
  ).as("eox-drawtools");
11
11
  });
12
12
 
@@ -23,9 +23,7 @@ describe("Drawtools", () => {
23
23
  cy.get("[data-cy='drawBtn']").click();
24
24
  cy.get("[data-cy='drawBtn']").contains("drawing");
25
25
  });
26
- cy.get("eox-drawtools").and(($el) => {
27
- expect($el[0].drawnFeatures).to.have.length(1);
28
- });
26
+ // TODO simulate drawing and add drawn features
29
27
  });
30
28
 
31
29
  it("clicks the discard button and clears drawn features", () => {