@eox/layercontrol 0.7.1 → 0.8.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.
- package/dist/eox-layercontrol.js +4 -1
- package/dist/eox-layercontrol.umd.cjs +14 -11
- package/package.json +2 -2
- package/test/general.cy.js +18 -0
package/dist/eox-layercontrol.js
CHANGED
|
@@ -2534,7 +2534,10 @@ class Ji extends z {
|
|
|
2534
2534
|
() => {
|
|
2535
2535
|
var s;
|
|
2536
2536
|
return _`
|
|
2537
|
-
<details
|
|
2537
|
+
<details
|
|
2538
|
+
class="tools"
|
|
2539
|
+
open=${this.layer.get("layerControlToolsExpand") || $}
|
|
2540
|
+
>
|
|
2538
2541
|
<summary>
|
|
2539
2542
|
<button
|
|
2540
2543
|
class="icon ${this.tools.length === 1 ? `${this.tools[0]}-icon` : ""}"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var oo=Object.defineProperty;var ro=(S
|
|
1
|
+
var oo=Object.defineProperty;var ro=(S,x,O)=>x in S?oo(S,x,{enumerable:!0,configurable:!0,writable:!0,value:O}):S[x]=O;var X=(S,x,O)=>(ro(S,typeof x!="symbol"?x+"":x,O),O),so=(S,x,O)=>{if(!x.has(S))throw TypeError("Cannot "+O)};var I=(S,x,O)=>(so(S,x,"read from private field"),O?O.call(S):x.get(S)),V=(S,x,O)=>{if(x.has(S))throw TypeError("Cannot add the same private member more than once");x instanceof WeakSet?x.add(S):x.set(S,O)};(function(S,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(S=typeof globalThis<"u"?globalThis:S||self,x(S["eox-layercontrol"]={}))})(this,function(S){var ve,ye,be,Ee,we,_e,$e,xe,Ae,Ce,Se,Te,De,Pe;"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const x=window,O=x.ShadowRoot&&(x.ShadyCSS===void 0||x.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,di=Symbol(),ui=new WeakMap;let sn=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==di)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(O&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=ui.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&ui.set(e,t))}return t}toString(){return this.cssText}};const an=n=>new sn(typeof n=="string"?n:n+"",void 0,di),ln=(n,t)=>{O?n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),o=x.litNonce;o!==void 0&&i.setAttribute("nonce",o),i.textContent=e.cssText,n.appendChild(i)})},ci=O?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return an(e)})(n):n;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -12,7 +12,7 @@ var oo=Object.defineProperty;var ro=(S,$,O)=>$ in S?oo(S,$,{enumerable:!0,config
|
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
13
|
*/var Ie;const Qt=window,xt=Qt.trustedTypes,gi=xt?xt.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ve="$lit$",at=`lit$${(Math.random()+"").slice(9)}$`,mi="?"+at,un=`<${mi}>`,pt=document,Ot=()=>pt.createComment(""),Mt=n=>n===null||typeof n!="object"&&typeof n!="function",vi=Array.isArray,cn=n=>vi(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Le=`[
|
|
14
14
|
\f\r]`,Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yi=/-->/g,bi=/>/g,ft=RegExp(`>|${Le}(?:([^\\s"'>=/]+)(${Le}*=${Le}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ei=/'/g,wi=/"/g,_i=/^(?:script|style|textarea|title)$/i,hn=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),_=hn(1),q=Symbol.for("lit-noChange")
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ei=/'/g,wi=/"/g,_i=/^(?:script|style|textarea|title)$/i,hn=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),_=hn(1),q=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),$i=new WeakMap,gt=pt.createTreeWalker(pt,129,null,!1);function xi(n,t){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return gi!==void 0?gi.createHTML(t):t}const pn=(n,t)=>{const e=n.length-1,i=[];let o,r=t===2?"<svg>":"",s=Nt;for(let l=0;l<e;l++){const a=n[l];let d,h,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,h=s.exec(a),h!==null);)p=s.lastIndex,s===Nt?h[1]==="!--"?s=yi:h[1]!==void 0?s=bi:h[2]!==void 0?(_i.test(h[2])&&(o=RegExp("</"+h[2],"g")),s=ft):h[3]!==void 0&&(s=ft):s===ft?h[0]===">"?(s=o??Nt,u=-1):h[1]===void 0?u=-2:(u=s.lastIndex-h[2].length,d=h[1],s=h[3]===void 0?ft:h[3]==='"'?wi:Ei):s===wi||s===Ei?s=ft:s===yi||s===bi?s=Nt:(s=ft,o=void 0);const v=s===ft&&n[l+1].startsWith("/>")?" ":"";r+=s===Nt?a+un:u>=0?(i.push(d),a.slice(0,u)+Ve+a.slice(u)+at+v):a+at+(u===-2?(i.push(void 0),l):v)}return[xi(n,r+(n[e]||"<?>")+(t===2?"</svg>":"")),i]};class kt{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const l=t.length-1,a=this.parts,[d,h]=pn(t,e);if(this.el=kt.createElement(d,i),gt.currentNode=this.el.content,e===2){const u=this.el.content,p=u.firstChild;p.remove(),u.append(...p.childNodes)}for(;(o=gt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes()){const u=[];for(const p of o.getAttributeNames())if(p.endsWith(Ve)||p.startsWith(at)){const v=h[s++];if(u.push(p),v!==void 0){const y=o.getAttribute(v.toLowerCase()+Ve).split(at),b=/([.?@])?(.*)/.exec(v);a.push({type:1,index:r,name:b[2],strings:y,ctor:b[1]==="."?gn:b[1]==="?"?vn:b[1]==="@"?yn:te})}else a.push({type:6,index:r})}for(const p of u)o.removeAttribute(p)}if(_i.test(o.tagName)){const u=o.textContent.split(at),p=u.length-1;if(p>0){o.textContent=xt?xt.emptyScript:"";for(let v=0;v<p;v++)o.append(u[v],Ot()),gt.nextNode(),a.push({type:2,index:++r});o.append(u[p],Ot())}}}else if(o.nodeType===8)if(o.data===mi)a.push({type:2,index:r});else{let u=-1;for(;(u=o.data.indexOf(at,u+1))!==-1;)a.push({type:7,index:r}),u+=at.length-1}r++}}static createElement(t,e){const i=pt.createElement("template");return i.innerHTML=t,i}}function At(n,t,e=n,i){var o,r,s,l;if(t===q)return t;let a=i!==void 0?(o=e._$Co)===null||o===void 0?void 0:o[i]:e._$Cl;const d=Mt(t)?void 0:t._$litDirective$;return(a==null?void 0:a.constructor)!==d&&((r=a==null?void 0:a._$AO)===null||r===void 0||r.call(a,!1),d===void 0?a=void 0:(a=new d(n),a._$AT(n,e,i)),i!==void 0?((s=(l=e)._$Co)!==null&&s!==void 0?s:l._$Co=[])[i]=a:e._$Cl=a),a!==void 0&&(t=At(n,a._$AS(n,t.values),a,i)),t}class fn{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:o}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:pt).importNode(i,!0);gt.currentNode=r;let s=gt.nextNode(),l=0,a=0,d=o[0];for(;d!==void 0;){if(l===d.index){let h;d.type===2?h=new It(s,s.nextSibling,this,t):d.type===1?h=new d.ctor(s,d.name,d.strings,this,t):d.type===6&&(h=new bn(s,this,t)),this._$AV.push(h),d=o[++a]}l!==(d==null?void 0:d.index)&&(s=gt.nextNode(),l++)}return gt.currentNode=pt,r}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 It{constructor(t,e,i,o){var r;this.type=2,this._$AH=$,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cp=(r=o==null?void 0:o.isConnected)===null||r===void 0||r}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=At(this,t,e),Mt(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==q&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):cn(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!==$&&Mt(this._$AH)?this._$AA.nextSibling.data=t:this.$(pt.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:o}=t,r=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=kt.createElement(xi(o.h,o.h[0]),this.options)),o);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(i);else{const s=new fn(r,this),l=s.u(this.options);s.v(i),this.$(l),this._$AH=s}}_$AC(t){let e=$i.get(t.strings);return e===void 0&&$i.set(t.strings,e=new kt(t)),e}T(t){vi(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new It(this.k(Ot()),this.k(Ot()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$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 o=t.nextSibling;t.remove(),t=o}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class te{constructor(t,e,i,o,r){this.type=1,this._$AH=$,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,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,o){const r=this.strings;let s=!1;if(r===void 0)t=At(this,t,e,0),s=!Mt(t)||t!==this._$AH&&t!==q,s&&(this._$AH=t);else{const l=t;let a,d;for(t=r[0],a=0;a<r.length-1;a++)d=At(this,l[i+a],e,a),d===q&&(d=this._$AH[a]),s||(s=!Mt(d)||d!==this._$AH[a]),d===$?t=$:t!==$&&(t+=(d??"")+r[a+1]),this._$AH[a]=d}s&&!o&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class gn extends te{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}}const mn=xt?xt.emptyScript:"";class vn extends te{constructor(){super(...arguments),this.type=4}j(t){t&&t!==$?this.element.setAttribute(this.name,mn):this.element.removeAttribute(this.name)}}class yn extends te{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=(i=At(this,t,e,0))!==null&&i!==void 0?i:$)===q)return;const o=this._$AH,r=t===$&&o!==$||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==$&&(o===$||r);r&&this.element.removeEventListener(this.name,this,o),s&&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 bn{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){At(this,t)}}const Ai=Qt.litHtmlPolyfillSupport;Ai==null||Ai(kt,It),((Ie=Qt.litHtmlVersions)!==null&&Ie!==void 0?Ie:Qt.litHtmlVersions=[]).push("2.8.0");const En=(n,t,e)=>{var i,o;const r=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let s=r._$litPart$;if(s===void 0){const l=(o=e==null?void 0:e.renderBefore)!==null&&o!==void 0?o:null;r._$litPart$=s=new It(t.insertBefore(Ot(),l),l,void 0,e??{})}return s._$AI(n),s};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -32,7 +32,7 @@ var oo=Object.defineProperty;var ro=(S,$,O)=>$ in S?oo(S,$,{enumerable:!0,config
|
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2021 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/const $n=Ue(class extends Fe{constructor(){super(...arguments),this.key
|
|
35
|
+
*/const $n=Ue(class extends Fe{constructor(){super(...arguments),this.key=$}render(n,t){return this.key=n,t}update(n,[t,e]){return t!==this.key&&(Si(n),this.key=t),e}});/**!
|
|
36
36
|
* Sortable 1.15.0
|
|
37
37
|
* @author RubaXa <trash@rubaxa.org>
|
|
38
38
|
* @author owenm <owen23355@gmail.com>
|
|
@@ -41,11 +41,11 @@ var oo=Object.defineProperty;var ro=(S,$,O)=>$ in S?oo(S,$,{enumerable:!0,config
|
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2020 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/const si=Ue(class extends Fe{constructor(n){if(super(n),n.type!==mt.PROPERTY&&n.type!==mt.ATTRIBUTE&&n.type!==mt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!wn(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===q||t
|
|
44
|
+
*/const si=Ue(class extends Fe{constructor(n){if(super(n),n.type!==mt.PROPERTY&&n.type!==mt.ATTRIBUTE&&n.type!==mt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!wn(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===q||t===$)return t;const e=n.element,i=n.name;if(n.type===mt.PROPERTY){if(t===e[i])return q}else if(n.type===mt.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(i))return q}else if(n.type===mt.ATTRIBUTE&&e.getAttribute(i)===t+"")return q;return Si(n),t}});/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
|
-
*/class ai extends Fe{constructor(t){if(super(t),this.et
|
|
48
|
+
*/class ai extends Fe{constructor(t){if(super(t),this.et=$,t.type!==mt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===$||t==null)return this.ft=void 0,this.et=t;if(t===q)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}ai.directiveName="unsafeHTML",ai.resultType=1;const Jn=Ue(ai);/**
|
|
49
49
|
* @license
|
|
50
50
|
* Copyright 2021 Google LLC
|
|
51
51
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -365,11 +365,11 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
365
365
|
class="remove-icon icon"
|
|
366
366
|
@click=${()=>{var e,i;(e=this.layer)==null||e.set("layerControlOptional",!0),(i=this.layer)==null||i.setVisible(!1),this.dispatchEvent(new CustomEvent("changed",{detail:this.layer,bubbles:!0}))}}
|
|
367
367
|
>
|
|
368
|
-
${this.unstyled?"x"
|
|
368
|
+
${this.unstyled?"x":$}
|
|
369
369
|
</button>
|
|
370
370
|
`);X(this,"_sortButton",_`
|
|
371
371
|
<button class="sort-icon icon drag-handle">
|
|
372
|
-
${this.unstyled?"sort"
|
|
372
|
+
${this.unstyled?"sort":$}
|
|
373
373
|
</button>
|
|
374
374
|
`);V(this,we,"");V(this,_e,`
|
|
375
375
|
${Qn}
|
|
@@ -478,7 +478,10 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
478
478
|
</div>
|
|
479
479
|
</div>
|
|
480
480
|
`,()=>{var s;return _`
|
|
481
|
-
<details
|
|
481
|
+
<details
|
|
482
|
+
class="tools"
|
|
483
|
+
open=${this.layer.get("layerControlToolsExpand")||$}
|
|
484
|
+
>
|
|
482
485
|
<summary>
|
|
483
486
|
<button
|
|
484
487
|
class="icon ${this.tools.length===1?`${this.tools[0]}-icon`:""}"
|
|
@@ -493,7 +496,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
493
496
|
>
|
|
494
497
|
${me(this._parseTools(this.tools),l=>_`
|
|
495
498
|
<button slot="${l}-icon" class="icon">
|
|
496
|
-
${this.unstyled?l
|
|
499
|
+
${this.unstyled?l:$}
|
|
497
500
|
</button>
|
|
498
501
|
`)}
|
|
499
502
|
|
|
@@ -612,7 +615,7 @@ input::-moz-focus-inner, input::-moz-focus-outer {
|
|
|
612
615
|
${!this.unstyled&&I(this,Ce)}
|
|
613
616
|
</style>
|
|
614
617
|
${et(this.group,()=>_`
|
|
615
|
-
<details open=${this.group.get("layerControlExpand")
|
|
618
|
+
<details open=${this.group.get("layerControlExpand")||$}>
|
|
616
619
|
<summary>
|
|
617
620
|
<eox-layercontrol-layer
|
|
618
621
|
.layer=${this.group}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/layercontrol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
7
7
|
"@types/sortablejs": "^1.15.1",
|
|
8
8
|
"@typescript-eslint/eslint-plugin": "^6.8.0",
|
|
9
|
-
"@typescript-eslint/parser": "^
|
|
9
|
+
"@typescript-eslint/parser": "^6.8.0",
|
|
10
10
|
"eslint-plugin-typescript": "^0.14.0",
|
|
11
11
|
"ol": "^8.1.0",
|
|
12
12
|
"sortablejs": "^1.15.0",
|
package/test/general.cy.js
CHANGED
|
@@ -112,4 +112,22 @@ describe("LayerControl", () => {
|
|
|
112
112
|
cy.get("details[open]").should("exist");
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
+
|
|
116
|
+
it("pre-opens layer tools section if layerControlToolsExpand is present", () => {
|
|
117
|
+
cy.get("mock-map").and(($el) => {
|
|
118
|
+
$el /**MockMap*/[0]
|
|
119
|
+
.setLayers([
|
|
120
|
+
{ visible: true },
|
|
121
|
+
{
|
|
122
|
+
properties: { layerControlToolsExpand: true },
|
|
123
|
+
layers: [{ visible: true }],
|
|
124
|
+
},
|
|
125
|
+
]);
|
|
126
|
+
});
|
|
127
|
+
cy.get("eox-layercontrol")
|
|
128
|
+
.shadow()
|
|
129
|
+
.within(() => {
|
|
130
|
+
cy.get("details[open].tools").should("be.visible");
|
|
131
|
+
});
|
|
132
|
+
});
|
|
115
133
|
});
|