@eox/drawtools 0.5.0 → 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.
- package/dist/eox-drawtools.js +174 -159
- package/dist/eox-drawtools.umd.cjs +24 -24
- package/package.json +2 -2
- package/test/_mockMap.js +4 -2
- package/test/general.cy.js +2 -4
package/dist/eox-drawtools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (r, t, e) => (
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var gt = (r, t, e) => t in r ? yt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var A = (r, t, e) => (gt(r, typeof t != "symbol" ? t + "" : t, e), e), J = (r, t, e) => {
|
|
4
4
|
if (!t.has(r))
|
|
5
5
|
throw TypeError("Cannot " + e);
|
|
6
6
|
};
|
|
@@ -14,10 +14,10 @@ var $ = (r, t, e) => (J(r, t, "read from private field"), e ? e.call(r) : t.get(
|
|
|
14
14
|
* Copyright 2019 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const T = globalThis, Z = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
18
|
-
let
|
|
17
|
+
const T = globalThis, Z = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, nt = Symbol(), K = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
let ft = class {
|
|
19
19
|
constructor(t, e, s) {
|
|
20
|
-
if (this._$cssResult$ = !0, s !==
|
|
20
|
+
if (this._$cssResult$ = !0, s !== nt)
|
|
21
21
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
22
22
|
this.cssText = t, this.t = e;
|
|
23
23
|
}
|
|
@@ -34,7 +34,7 @@ let _t = class {
|
|
|
34
34
|
return this.cssText;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
const mt = (r) => new
|
|
37
|
+
const mt = (r) => new ft(typeof r == "string" ? r : r + "", void 0, nt), _t = (r, t) => {
|
|
38
38
|
if (Z)
|
|
39
39
|
r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
40
40
|
else
|
|
@@ -53,10 +53,10 @@ const mt = (r) => new _t(typeof r == "string" ? r : r + "", void 0, at), wt = (r
|
|
|
53
53
|
* Copyright 2017 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
55
|
*/
|
|
56
|
-
const { is:
|
|
56
|
+
const { is: wt, defineProperty: bt, getOwnPropertyDescriptor: At, getOwnPropertyNames: vt, getOwnPropertySymbols: xt, getPrototypeOf: Et } = Object, m = globalThis, Q = m.trustedTypes, St = Q ? Q.emptyScript : "", B = m.reactiveElementPolyfillSupport, k = (r, t) => r, W = { toAttribute(r, t) {
|
|
57
57
|
switch (t) {
|
|
58
58
|
case Boolean:
|
|
59
|
-
r = r ?
|
|
59
|
+
r = r ? St : null;
|
|
60
60
|
break;
|
|
61
61
|
case Object:
|
|
62
62
|
case Array:
|
|
@@ -81,8 +81,8 @@ const { is: bt, defineProperty: At, getOwnPropertyDescriptor: vt, getOwnProperty
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
return e;
|
|
84
|
-
} },
|
|
85
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
84
|
+
} }, at = (r, t) => !wt(r, t), X = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: at };
|
|
85
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
86
86
|
class v extends HTMLElement {
|
|
87
87
|
static addInitializer(t) {
|
|
88
88
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
@@ -93,11 +93,11 @@ class v extends HTMLElement {
|
|
|
93
93
|
static createProperty(t, e = X) {
|
|
94
94
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
95
95
|
const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
|
|
96
|
-
i !== void 0 &&
|
|
96
|
+
i !== void 0 && bt(this.prototype, t, i);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
static getPropertyDescriptor(t, e, s) {
|
|
100
|
-
const { get: i, set: n } =
|
|
100
|
+
const { get: i, set: n } = At(this.prototype, t) ?? { get() {
|
|
101
101
|
return this[e];
|
|
102
102
|
}, set(o) {
|
|
103
103
|
this[e] = o;
|
|
@@ -105,24 +105,24 @@ class v extends HTMLElement {
|
|
|
105
105
|
return { get() {
|
|
106
106
|
return i == null ? void 0 : i.call(this);
|
|
107
107
|
}, set(o) {
|
|
108
|
-
const
|
|
109
|
-
n.call(this, o), this.requestUpdate(t,
|
|
108
|
+
const d = i == null ? void 0 : i.call(this);
|
|
109
|
+
n.call(this, o), this.requestUpdate(t, d, s);
|
|
110
110
|
}, configurable: !0, enumerable: !0 };
|
|
111
111
|
}
|
|
112
112
|
static getPropertyOptions(t) {
|
|
113
113
|
return this.elementProperties.get(t) ?? X;
|
|
114
114
|
}
|
|
115
115
|
static _$Ei() {
|
|
116
|
-
if (this.hasOwnProperty(
|
|
116
|
+
if (this.hasOwnProperty(k("elementProperties")))
|
|
117
117
|
return;
|
|
118
|
-
const t =
|
|
118
|
+
const t = Et(this);
|
|
119
119
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
120
120
|
}
|
|
121
121
|
static finalize() {
|
|
122
|
-
if (this.hasOwnProperty(
|
|
122
|
+
if (this.hasOwnProperty(k("finalized")))
|
|
123
123
|
return;
|
|
124
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
125
|
-
const e = this.properties, s = [...
|
|
124
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(k("properties"))) {
|
|
125
|
+
const e = this.properties, s = [...vt(e), ...xt(e)];
|
|
126
126
|
for (const i of s)
|
|
127
127
|
this.createProperty(i, e[i]);
|
|
128
128
|
}
|
|
@@ -177,7 +177,7 @@ class v extends HTMLElement {
|
|
|
177
177
|
}
|
|
178
178
|
createRenderRoot() {
|
|
179
179
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
180
|
-
return
|
|
180
|
+
return _t(t, this.constructor.elementStyles), t;
|
|
181
181
|
}
|
|
182
182
|
connectedCallback() {
|
|
183
183
|
var t;
|
|
@@ -210,13 +210,13 @@ class v extends HTMLElement {
|
|
|
210
210
|
var n;
|
|
211
211
|
const s = this.constructor, i = s._$Eh.get(t);
|
|
212
212
|
if (i !== void 0 && this._$Em !== i) {
|
|
213
|
-
const o = s.getPropertyOptions(i),
|
|
214
|
-
this._$Em = i, this[i] =
|
|
213
|
+
const o = s.getPropertyOptions(i), d = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : W;
|
|
214
|
+
this._$Em = i, this[i] = d.fromAttribute(e, o.type), this._$Em = null;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
requestUpdate(t, e, s, i = !1, n) {
|
|
218
218
|
if (t !== void 0) {
|
|
219
|
-
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ??
|
|
219
|
+
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? at)(i ? n : this[t], e))
|
|
220
220
|
return;
|
|
221
221
|
this.C(t, e, s);
|
|
222
222
|
}
|
|
@@ -294,63 +294,63 @@ class v extends HTMLElement {
|
|
|
294
294
|
firstUpdated(t) {
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[
|
|
297
|
+
v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[k("elementProperties")] = /* @__PURE__ */ new Map(), v[k("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: v }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.0.1");
|
|
298
298
|
/**
|
|
299
299
|
* @license
|
|
300
300
|
* Copyright 2017 Google LLC
|
|
301
301
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
302
302
|
*/
|
|
303
|
-
const
|
|
304
|
-
\f\r]`,
|
|
305
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g,
|
|
306
|
-
function
|
|
303
|
+
const M = globalThis, O = M.trustedTypes, Y = O ? O.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ht = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, lt = "?" + f, Ct = `<${lt}>`, b = document, U = () => b.createComment(""), P = (r) => r === null || typeof r != "object" && typeof r != "function", dt = Array.isArray, Ht = (r) => dt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", z = `[
|
|
304
|
+
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
|
|
305
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, ct = /^(?:script|style|textarea|title)$/i, kt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), F = kt(1), S = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), w = b.createTreeWalker(b, 129);
|
|
306
|
+
function pt(r, t) {
|
|
307
307
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
|
308
308
|
throw Error("invalid template strings array");
|
|
309
309
|
return Y !== void 0 ? Y.createHTML(t) : t;
|
|
310
310
|
}
|
|
311
311
|
const Mt = (r, t) => {
|
|
312
312
|
const e = r.length - 1, s = [];
|
|
313
|
-
let i, n = t === 2 ? "<svg>" : "", o =
|
|
314
|
-
for (let
|
|
315
|
-
const a = r[
|
|
316
|
-
let
|
|
313
|
+
let i, n = t === 2 ? "<svg>" : "", o = H;
|
|
314
|
+
for (let d = 0; d < e; d++) {
|
|
315
|
+
const a = r[d];
|
|
316
|
+
let c, p, h = -1, y = 0;
|
|
317
317
|
for (; y < a.length && (o.lastIndex = y, p = o.exec(a), p !== null); )
|
|
318
|
-
y = o.lastIndex, o ===
|
|
319
|
-
const g = o ===
|
|
320
|
-
n += o ===
|
|
318
|
+
y = o.lastIndex, o === H ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (ct.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = _) : p[3] !== void 0 && (o = _) : o === _ ? p[0] === ">" ? (o = i ?? H, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? _ : p[3] === '"' ? it : st) : o === it || o === st ? o = _ : o === tt || o === et ? o = H : (o = _, i = void 0);
|
|
319
|
+
const g = o === _ && r[d + 1].startsWith("/>") ? " " : "";
|
|
320
|
+
n += o === H ? a + Ct : h >= 0 ? (s.push(c), a.slice(0, h) + ht + a.slice(h) + f + g) : a + f + (h === -2 ? d : g);
|
|
321
321
|
}
|
|
322
|
-
return [
|
|
322
|
+
return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
|
|
323
323
|
};
|
|
324
|
-
class
|
|
324
|
+
class I {
|
|
325
325
|
constructor({ strings: t, _$litType$: e }, s) {
|
|
326
326
|
let i;
|
|
327
327
|
this.parts = [];
|
|
328
328
|
let n = 0, o = 0;
|
|
329
|
-
const
|
|
330
|
-
if (this.el =
|
|
329
|
+
const d = t.length - 1, a = this.parts, [c, p] = Mt(t, e);
|
|
330
|
+
if (this.el = I.createElement(c, s), w.currentNode = this.el.content, e === 2) {
|
|
331
331
|
const h = this.el.content.firstChild;
|
|
332
332
|
h.replaceWith(...h.childNodes);
|
|
333
333
|
}
|
|
334
|
-
for (; (i = w.nextNode()) !== null && a.length <
|
|
334
|
+
for (; (i = w.nextNode()) !== null && a.length < d; ) {
|
|
335
335
|
if (i.nodeType === 1) {
|
|
336
336
|
if (i.hasAttributes())
|
|
337
337
|
for (const h of i.getAttributeNames())
|
|
338
|
-
if (h.endsWith(
|
|
339
|
-
const y = p[o++], g = i.getAttribute(h).split(f),
|
|
340
|
-
a.push({ type: 1, index: n, name:
|
|
338
|
+
if (h.endsWith(ht)) {
|
|
339
|
+
const y = p[o++], g = i.getAttribute(h).split(f), D = /([.?@])?(.*)/.exec(y);
|
|
340
|
+
a.push({ type: 1, index: n, name: D[2], strings: g, ctor: D[1] === "." ? Pt : D[1] === "?" ? It : D[1] === "@" ? Lt : N }), i.removeAttribute(h);
|
|
341
341
|
} else
|
|
342
342
|
h.startsWith(f) && (a.push({ type: 6, index: n }), i.removeAttribute(h));
|
|
343
|
-
if (
|
|
343
|
+
if (ct.test(i.tagName)) {
|
|
344
344
|
const h = i.textContent.split(f), y = h.length - 1;
|
|
345
345
|
if (y > 0) {
|
|
346
346
|
i.textContent = O ? O.emptyScript : "";
|
|
347
347
|
for (let g = 0; g < y; g++)
|
|
348
|
-
i.append(h[g],
|
|
349
|
-
i.append(h[y],
|
|
348
|
+
i.append(h[g], U()), w.nextNode(), a.push({ type: 2, index: ++n });
|
|
349
|
+
i.append(h[y], U());
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
} else if (i.nodeType === 8)
|
|
353
|
-
if (i.data ===
|
|
353
|
+
if (i.data === lt)
|
|
354
354
|
a.push({ type: 2, index: n });
|
|
355
355
|
else {
|
|
356
356
|
let h = -1;
|
|
@@ -366,12 +366,12 @@ class P {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
function C(r, t, e = r, s) {
|
|
369
|
-
var o,
|
|
369
|
+
var o, d;
|
|
370
370
|
if (t === S)
|
|
371
371
|
return t;
|
|
372
372
|
let i = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
|
|
373
|
-
const n =
|
|
374
|
-
return (i == null ? void 0 : i.constructor) !== n && ((
|
|
373
|
+
const n = P(t) ? void 0 : t._$litDirective$;
|
|
374
|
+
return (i == null ? void 0 : i.constructor) !== n && ((d = i == null ? void 0 : i._$AO) == null || d.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = C(r, i._$AS(r, t.values), i, s)), t;
|
|
375
375
|
}
|
|
376
376
|
class Ut {
|
|
377
377
|
constructor(t, e) {
|
|
@@ -386,11 +386,11 @@ class Ut {
|
|
|
386
386
|
u(t) {
|
|
387
387
|
const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? b).importNode(e, !0);
|
|
388
388
|
w.currentNode = i;
|
|
389
|
-
let n = w.nextNode(), o = 0,
|
|
389
|
+
let n = w.nextNode(), o = 0, d = 0, a = s[0];
|
|
390
390
|
for (; a !== void 0; ) {
|
|
391
391
|
if (o === a.index) {
|
|
392
|
-
let
|
|
393
|
-
a.type === 2 ?
|
|
392
|
+
let c;
|
|
393
|
+
a.type === 2 ? c = new L(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Dt(n, this, t)), this._$AV.push(c), a = s[++d];
|
|
394
394
|
}
|
|
395
395
|
o !== (a == null ? void 0 : a.index) && (n = w.nextNode(), o++);
|
|
396
396
|
}
|
|
@@ -402,7 +402,7 @@ class Ut {
|
|
|
402
402
|
s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
class
|
|
405
|
+
class L {
|
|
406
406
|
get _$AU() {
|
|
407
407
|
var t;
|
|
408
408
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
@@ -422,7 +422,7 @@ class D {
|
|
|
422
422
|
return this._$AB;
|
|
423
423
|
}
|
|
424
424
|
_$AI(t, e = this) {
|
|
425
|
-
t = C(this, t, e),
|
|
425
|
+
t = C(this, t, e), P(t) ? t === l || t == null || t === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : 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);
|
|
426
426
|
}
|
|
427
427
|
k(t) {
|
|
428
428
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -431,28 +431,28 @@ class D {
|
|
|
431
431
|
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
|
|
432
432
|
}
|
|
433
433
|
_(t) {
|
|
434
|
-
this._$AH !== l &&
|
|
434
|
+
this._$AH !== l && P(this._$AH) ? this._$AA.nextSibling.data = t : this.$(b.createTextNode(t)), this._$AH = t;
|
|
435
435
|
}
|
|
436
436
|
g(t) {
|
|
437
437
|
var n;
|
|
438
|
-
const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el =
|
|
438
|
+
const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = I.createElement(pt(s.h, s.h[0]), this.options)), s);
|
|
439
439
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === i)
|
|
440
440
|
this._$AH.p(e);
|
|
441
441
|
else {
|
|
442
|
-
const o = new Ut(i, this),
|
|
443
|
-
o.p(e), this.$(
|
|
442
|
+
const o = new Ut(i, this), d = o.u(this.options);
|
|
443
|
+
o.p(e), this.$(d), this._$AH = o;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
_$AC(t) {
|
|
447
447
|
let e = rt.get(t.strings);
|
|
448
|
-
return e === void 0 && rt.set(t.strings, e = new
|
|
448
|
+
return e === void 0 && rt.set(t.strings, e = new I(t)), e;
|
|
449
449
|
}
|
|
450
450
|
T(t) {
|
|
451
451
|
dt(this._$AH) || (this._$AH = [], this._$AR());
|
|
452
452
|
const e = this._$AH;
|
|
453
453
|
let s, i = 0;
|
|
454
454
|
for (const n of t)
|
|
455
|
-
i === e.length ? e.push(s = new
|
|
455
|
+
i === e.length ? e.push(s = new L(this.k(U()), this.k(U()), this, this.options)) : s = e[i], s._$AI(n), i++;
|
|
456
456
|
i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
|
|
457
457
|
}
|
|
458
458
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -481,12 +481,12 @@ class N {
|
|
|
481
481
|
const n = this.strings;
|
|
482
482
|
let o = !1;
|
|
483
483
|
if (n === void 0)
|
|
484
|
-
t = C(this, t, e, 0), o = !
|
|
484
|
+
t = C(this, t, e, 0), o = !P(t) || t !== this._$AH && t !== S, o && (this._$AH = t);
|
|
485
485
|
else {
|
|
486
|
-
const
|
|
487
|
-
let a,
|
|
486
|
+
const d = t;
|
|
487
|
+
let a, c;
|
|
488
488
|
for (t = n[0], a = 0; a < n.length - 1; a++)
|
|
489
|
-
|
|
489
|
+
c = C(this, d[s + a], e, a), c === S && (c = this._$AH[a]), o || (o = !P(c) || c !== this._$AH[a]), c === l ? t = l : t !== l && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c;
|
|
490
490
|
}
|
|
491
491
|
o && !i && this.O(t);
|
|
492
492
|
}
|
|
@@ -502,7 +502,7 @@ class Pt extends N {
|
|
|
502
502
|
this.element[this.name] = t === l ? void 0 : t;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
class
|
|
505
|
+
class It extends N {
|
|
506
506
|
constructor() {
|
|
507
507
|
super(...arguments), this.type = 4;
|
|
508
508
|
}
|
|
@@ -525,7 +525,7 @@ class Lt extends N {
|
|
|
525
525
|
typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
class
|
|
528
|
+
class Dt {
|
|
529
529
|
constructor(t, e, s) {
|
|
530
530
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
|
|
531
531
|
}
|
|
@@ -536,14 +536,14 @@ class Tt {
|
|
|
536
536
|
C(this, t);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const q =
|
|
540
|
-
q == null || q(
|
|
541
|
-
const
|
|
539
|
+
const q = M.litHtmlPolyfillSupport;
|
|
540
|
+
q == null || q(I, L), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.1.0");
|
|
541
|
+
const Tt = (r, t, e) => {
|
|
542
542
|
const s = (e == null ? void 0 : e.renderBefore) ?? t;
|
|
543
543
|
let i = s._$litPart$;
|
|
544
544
|
if (i === void 0) {
|
|
545
545
|
const n = (e == null ? void 0 : e.renderBefore) ?? null;
|
|
546
|
-
s._$litPart$ = i = new
|
|
546
|
+
s._$litPart$ = i = new L(t.insertBefore(U(), n), n, void 0, e ?? {});
|
|
547
547
|
}
|
|
548
548
|
return i._$AI(r), i;
|
|
549
549
|
};
|
|
@@ -563,7 +563,7 @@ class x extends v {
|
|
|
563
563
|
}
|
|
564
564
|
update(t) {
|
|
565
565
|
const e = this.render();
|
|
566
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
566
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Tt(e, this.renderRoot, this.renderOptions);
|
|
567
567
|
}
|
|
568
568
|
connectedCallback() {
|
|
569
569
|
var t;
|
|
@@ -587,8 +587,8 @@ j == null || j({ LitElement: x });
|
|
|
587
587
|
* Copyright 2017 Google LLC
|
|
588
588
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
589
589
|
*/
|
|
590
|
-
const
|
|
591
|
-
let
|
|
590
|
+
const Ot = (r) => (...t) => ({ _$litDirective$: r, values: t });
|
|
591
|
+
let Ft = class {
|
|
592
592
|
constructor(t) {
|
|
593
593
|
}
|
|
594
594
|
get _$AU() {
|
|
@@ -609,13 +609,13 @@ let Nt = class {
|
|
|
609
609
|
* Copyright 2020 Google LLC
|
|
610
610
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
611
611
|
*/
|
|
612
|
-
const
|
|
612
|
+
const Nt = {}, Vt = (r, t = Nt) => r._$AH = t;
|
|
613
613
|
/**
|
|
614
614
|
* @license
|
|
615
615
|
* Copyright 2021 Google LLC
|
|
616
616
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
617
617
|
*/
|
|
618
|
-
const
|
|
618
|
+
const Rt = Ot(class extends Ft {
|
|
619
619
|
constructor() {
|
|
620
620
|
super(...arguments), this.key = l;
|
|
621
621
|
}
|
|
@@ -623,9 +623,9 @@ const Bt = Ft(class extends Nt {
|
|
|
623
623
|
return this.key = r, t;
|
|
624
624
|
}
|
|
625
625
|
update(r, [t, e]) {
|
|
626
|
-
return t !== this.key && (
|
|
626
|
+
return t !== this.key && (Vt(r), this.key = t), e;
|
|
627
627
|
}
|
|
628
|
-
}),
|
|
628
|
+
}), Bt = `
|
|
629
629
|
button {
|
|
630
630
|
/* TODO: why does this only work here and not from :root? */
|
|
631
631
|
--primary-color: #004170;
|
|
@@ -714,12 +714,12 @@ button.small {
|
|
|
714
714
|
padding: 12.4px;
|
|
715
715
|
font-size: .75rem;
|
|
716
716
|
}
|
|
717
|
-
`,
|
|
717
|
+
`, ut = `
|
|
718
718
|
* {
|
|
719
719
|
font-family: Roboto, sans-serif;
|
|
720
720
|
}
|
|
721
721
|
|
|
722
|
-
${
|
|
722
|
+
${Bt}
|
|
723
723
|
|
|
724
724
|
button.discard:before {
|
|
725
725
|
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")
|
|
@@ -793,26 +793,8 @@ button.small {
|
|
|
793
793
|
font-size: small;
|
|
794
794
|
flex-grow: 1;
|
|
795
795
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
condition: t,
|
|
799
|
-
panIn: e,
|
|
800
|
-
layer: {
|
|
801
|
-
type: "Vector",
|
|
802
|
-
properties: {
|
|
803
|
-
id: "selectLayer"
|
|
804
|
-
},
|
|
805
|
-
source: {
|
|
806
|
-
type: "Vector"
|
|
807
|
-
},
|
|
808
|
-
style: {
|
|
809
|
-
"fill-color": "rgba(51, 153, 204,0.5)",
|
|
810
|
-
"stroke-color": "#3399CC",
|
|
811
|
-
"stroke-width": 2.5
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
class yt extends x {
|
|
796
|
+
`;
|
|
797
|
+
class $t extends x {
|
|
816
798
|
constructor() {
|
|
817
799
|
super();
|
|
818
800
|
/**
|
|
@@ -856,15 +838,7 @@ class yt extends x {
|
|
|
856
838
|
this.requestUpdate();
|
|
857
839
|
}
|
|
858
840
|
firstUpdated() {
|
|
859
|
-
|
|
860
|
-
const e = (i = this.eoxMap) == null ? void 0 : i.selectInteractions["draw-hover"], s = (n = this.eoxMap) == null ? void 0 : n.selectInteractions["draw-click"];
|
|
861
|
-
e || (this.hoverInteraction = this.eoxMap.addSelect(
|
|
862
|
-
this.layer,
|
|
863
|
-
nt("draw-hover", "pointermove")
|
|
864
|
-
)), s || (this.clickInteraction = this.eoxMap.addSelect(
|
|
865
|
-
this.layer,
|
|
866
|
-
nt("draw-click", "click", !0)
|
|
867
|
-
)), this.hoverInteraction.selectStyleLayer.on(
|
|
841
|
+
this.hoverInteraction = this.eoxMap.selectInteractions.selectHover, this.clickInteraction = this.eoxMap.selectInteractions.selectClick, this.hoverInteraction.selectStyleLayer.on(
|
|
868
842
|
"change",
|
|
869
843
|
() => this.requestUpdate()
|
|
870
844
|
), this.clickInteraction.selectStyleLayer.on(
|
|
@@ -874,18 +848,18 @@ class yt extends x {
|
|
|
874
848
|
}
|
|
875
849
|
render() {
|
|
876
850
|
var e, s;
|
|
877
|
-
return this.
|
|
851
|
+
return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (s = this.clickInteraction) == null ? void 0 : s.selectedFids[0], F`
|
|
878
852
|
<style>
|
|
879
|
-
${!this.unstyled &&
|
|
853
|
+
${!this.unstyled && ut}
|
|
880
854
|
</style>
|
|
881
855
|
<ul>
|
|
882
856
|
${this.drawnFeatures.map((i, n) => {
|
|
883
|
-
const o = i.get("id"),
|
|
884
|
-
return
|
|
857
|
+
const o = i.get("id"), d = this.hoverId === o || this.clickId === o;
|
|
858
|
+
return Rt(
|
|
885
859
|
n + 1,
|
|
886
860
|
F`
|
|
887
861
|
<li
|
|
888
|
-
class="${
|
|
862
|
+
class="${d ? "selected" : l}"
|
|
889
863
|
@mouseover=${() => {
|
|
890
864
|
this.clickId !== o && this.hoverInteraction.highlightById([o]);
|
|
891
865
|
}}
|
|
@@ -914,7 +888,7 @@ class yt extends x {
|
|
|
914
888
|
`;
|
|
915
889
|
}
|
|
916
890
|
}
|
|
917
|
-
A(
|
|
891
|
+
A($t, "properties", {
|
|
918
892
|
eoxMap: { attribute: !1, state: !0 },
|
|
919
893
|
olMap: { attribute: !1, state: !0 },
|
|
920
894
|
draw: { attribute: !1, state: !0 },
|
|
@@ -924,14 +898,14 @@ A(yt, "properties", {
|
|
|
924
898
|
modify: { attribute: !1, state: !0 },
|
|
925
899
|
unstyled: { type: Boolean }
|
|
926
900
|
});
|
|
927
|
-
customElements.define("eox-drawtools-list",
|
|
928
|
-
const
|
|
901
|
+
customElements.define("eox-drawtools-list", $t);
|
|
902
|
+
const zt = `
|
|
929
903
|
:host {
|
|
930
904
|
display: block;
|
|
931
905
|
}
|
|
932
906
|
`;
|
|
933
907
|
var u, E;
|
|
934
|
-
class
|
|
908
|
+
class qt extends x {
|
|
935
909
|
constructor() {
|
|
936
910
|
super();
|
|
937
911
|
/**
|
|
@@ -942,48 +916,101 @@ class jt extends x {
|
|
|
942
916
|
* @type import("ol").Map
|
|
943
917
|
*/
|
|
944
918
|
V(this, E, void 0);
|
|
945
|
-
this.for = "eox-map", this.currentlyDrawing = !1, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.
|
|
919
|
+
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;
|
|
946
920
|
}
|
|
947
921
|
static get properties() {
|
|
948
922
|
return {
|
|
923
|
+
allowModify: { attribute: "allow-modify", type: Boolean },
|
|
949
924
|
for: { type: String },
|
|
950
925
|
currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
|
|
951
926
|
draw: { attribute: !1, state: !0 },
|
|
952
927
|
drawLayer: { attribute: !1, state: !0 },
|
|
953
928
|
drawnFeatures: { attribute: !1, state: !0, type: Array },
|
|
954
|
-
layer: { type: String },
|
|
955
929
|
modify: { attribute: !1, state: !0 },
|
|
956
930
|
multipleFeatures: { attribute: "multiple-features", type: Boolean },
|
|
957
931
|
showList: { attribute: "show-list", type: Boolean },
|
|
932
|
+
type: { type: String },
|
|
958
933
|
unstyled: { type: Boolean }
|
|
959
934
|
};
|
|
960
935
|
}
|
|
961
|
-
|
|
962
|
-
var
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
936
|
+
initDrawLayer() {
|
|
937
|
+
var s, i;
|
|
938
|
+
const e = document.querySelector(this.for);
|
|
939
|
+
R(
|
|
940
|
+
this,
|
|
941
|
+
u,
|
|
942
|
+
/** @type {import("@eox/map/main").EOxMap} */
|
|
943
|
+
e
|
|
944
|
+
), R(
|
|
945
|
+
this,
|
|
946
|
+
E,
|
|
947
|
+
/** @type {import("ol").Map} */
|
|
948
|
+
$(this, u).map
|
|
949
|
+
), this.drawLayer = $(this, u).addOrUpdateLayer({
|
|
950
|
+
type: "Vector",
|
|
951
|
+
properties: {
|
|
952
|
+
id: "drawLayer",
|
|
953
|
+
layerControlHide: !0
|
|
954
|
+
},
|
|
955
|
+
source: {
|
|
956
|
+
type: "Vector"
|
|
957
|
+
},
|
|
958
|
+
// check if the drawInteraction has already been added before adding again
|
|
959
|
+
// TEMP/TODO: this should probably be done by the map in the addOrUpdateLayer method
|
|
960
|
+
...$(this, u).interactions.drawInteraction ? {} : {
|
|
961
|
+
interactions: [
|
|
962
|
+
{
|
|
963
|
+
type: "draw",
|
|
964
|
+
options: {
|
|
965
|
+
active: !1,
|
|
966
|
+
id: "drawInteraction",
|
|
967
|
+
type: this.type,
|
|
968
|
+
modify: this.allowModify,
|
|
969
|
+
stopClick: !0
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
type: "select",
|
|
974
|
+
options: {
|
|
975
|
+
id: "selectHover",
|
|
976
|
+
condition: "pointermove",
|
|
977
|
+
style: {
|
|
978
|
+
"fill-color": "rgba(51, 153, 204,0.5)",
|
|
979
|
+
"stroke-color": "#3399CC",
|
|
980
|
+
"stroke-width": 2.5
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
type: "select",
|
|
986
|
+
options: {
|
|
987
|
+
id: "selectClick",
|
|
988
|
+
condition: "click",
|
|
989
|
+
panIn: !0,
|
|
990
|
+
style: {
|
|
991
|
+
"fill-color": "rgba(51, 153, 204,0.5)",
|
|
992
|
+
"stroke-color": "#3399CC",
|
|
993
|
+
"stroke-width": 2.5
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
]
|
|
998
|
+
}
|
|
967
999
|
}), this.draw = /** @type {import("ol/interaction").Draw} */
|
|
968
1000
|
/** @type {unknown} */
|
|
969
1001
|
$(this, u).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
|
|
970
1002
|
/** @type {unknown} */
|
|
971
|
-
$(this, u).interactions.drawInteractionmodify, (
|
|
1003
|
+
$(this, u).interactions.drawInteractionmodify, (s = this.draw) == null || s.on("drawend", () => this.onDrawEnd()), (i = this.modify) == null || i.on("modifyend", () => this.onModifyEnd());
|
|
1004
|
+
}
|
|
1005
|
+
startDrawing() {
|
|
1006
|
+
this.initDrawLayer(), this.draw.setActive(!0), this.currentlyDrawing = !0, this.requestUpdate();
|
|
972
1007
|
}
|
|
973
1008
|
discardDrawing() {
|
|
974
|
-
this.drawnFeatures = [], $(this, u).removeInteraction("drawInteraction"), this.
|
|
1009
|
+
this.drawnFeatures = [], this.draw.setActive(!1), this.drawLayer.getSource().clear(), $(this, u).removeInteraction("drawInteraction"), $(this, E).removeLayer(this.drawLayer), this.emitDrawnFeatures(), this.currentlyDrawing = !1, this.requestUpdate();
|
|
975
1010
|
}
|
|
976
|
-
/**
|
|
977
|
-
*
|
|
978
|
-
* @param {import("ol/interaction/Draw").DrawEvent} evt
|
|
979
|
-
*/
|
|
980
1011
|
onDrawEnd() {
|
|
981
|
-
this.emitDrawnFeatures(),
|
|
1012
|
+
this.emitDrawnFeatures(), this.draw.setActive(!1), this.currentlyDrawing = !1, this.requestUpdate();
|
|
982
1013
|
}
|
|
983
|
-
/**
|
|
984
|
-
*
|
|
985
|
-
* @param {import("ol/interaction/Modify").ModifyEvent} evt
|
|
986
|
-
*/
|
|
987
1014
|
onModifyEnd() {
|
|
988
1015
|
this.emitDrawnFeatures();
|
|
989
1016
|
}
|
|
@@ -997,30 +1024,18 @@ class jt extends x {
|
|
|
997
1024
|
}, 0);
|
|
998
1025
|
}
|
|
999
1026
|
render() {
|
|
1000
|
-
var s, i
|
|
1001
|
-
|
|
1002
|
-
return R(
|
|
1003
|
-
this,
|
|
1004
|
-
u,
|
|
1005
|
-
/** @type {import("@eox/map/main").EOxMap} */
|
|
1006
|
-
e
|
|
1007
|
-
), R(
|
|
1008
|
-
this,
|
|
1009
|
-
E,
|
|
1010
|
-
/** @type {import("ol").Map} */
|
|
1011
|
-
$(this, u).map
|
|
1012
|
-
), this.drawLayer = /** @type {import("ol/layer").Vector<import("ol/source").Vector>} */
|
|
1013
|
-
$(this, E).getLayers().getArray().find((o) => o.get("id") === this.layer), this.requestUpdate(), F`
|
|
1027
|
+
var e, s, i;
|
|
1028
|
+
return F`
|
|
1014
1029
|
<style>
|
|
1015
|
-
${
|
|
1016
|
-
${!this.unstyled &&
|
|
1030
|
+
${zt}
|
|
1031
|
+
${!this.unstyled && ut}
|
|
1017
1032
|
</style>
|
|
1018
1033
|
<div>
|
|
1019
1034
|
<slot></slot>
|
|
1020
1035
|
<button
|
|
1021
1036
|
data-cy="drawBtn"
|
|
1022
1037
|
class="polygon icon"
|
|
1023
|
-
disabled="${!this.multipleFeatures && ((
|
|
1038
|
+
disabled="${!this.multipleFeatures && ((e = this.drawnFeatures) == null ? void 0 : e.length) > 0 || this.currentlyDrawing || l}"
|
|
1024
1039
|
@click="${() => this.startDrawing()}"
|
|
1025
1040
|
>
|
|
1026
1041
|
${this.currentlyDrawing ? "drawing" : "draw"}
|
|
@@ -1028,13 +1043,13 @@ class jt extends x {
|
|
|
1028
1043
|
<button
|
|
1029
1044
|
data-cy="discardBtn"
|
|
1030
1045
|
class="discard icon"
|
|
1031
|
-
disabled="${!((
|
|
1046
|
+
disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || l}"
|
|
1032
1047
|
@click="${() => this.discardDrawing()}"
|
|
1033
1048
|
>
|
|
1034
1049
|
discard
|
|
1035
1050
|
</button>
|
|
1036
1051
|
</div>
|
|
1037
|
-
${this.showList && ((
|
|
1052
|
+
${this.showList && ((i = this.drawnFeatures) != null && i.length) ? F`<eox-drawtools-list
|
|
1038
1053
|
.eoxMap=${$(this, u)}
|
|
1039
1054
|
.olMap=${$(this, E)}
|
|
1040
1055
|
.draw=${this.draw}
|
|
@@ -1050,7 +1065,7 @@ class jt extends x {
|
|
|
1050
1065
|
}
|
|
1051
1066
|
}
|
|
1052
1067
|
u = new WeakMap(), E = new WeakMap();
|
|
1053
|
-
customElements.define("eox-drawtools",
|
|
1068
|
+
customElements.define("eox-drawtools", qt);
|
|
1054
1069
|
export {
|
|
1055
|
-
|
|
1070
|
+
qt as EOxDrawTools
|
|
1056
1071
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
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
|
|
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
|
-
*/const{is:
|
|
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
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,
|
|
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
|
-
*/class
|
|
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
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
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
24
|
* @license
|
|
25
25
|
* Copyright 2020 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const Nt={},Vt=(r,t=Nt)=>r._$AH=t;/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2021 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/const
|
|
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
32
|
* {
|
|
33
33
|
font-family: Roboto, sans-serif;
|
|
34
34
|
}
|
|
@@ -196,20 +196,20 @@ button.small {
|
|
|
196
196
|
font-size: small;
|
|
197
197
|
flex-grow: 1;
|
|
198
198
|
}
|
|
199
|
-
|
|
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
200
|
<style>
|
|
201
201
|
${!this.unstyled&&pt}
|
|
202
202
|
</style>
|
|
203
203
|
<ul>
|
|
204
|
-
${this.drawnFeatures.map((
|
|
204
|
+
${this.drawnFeatures.map((s,n)=>{const o=s.get("id"),p=this.hoverId===o||this.clickId===o;return Rt(n+1,V`
|
|
205
205
|
<li
|
|
206
|
-
class="${p?"selected":
|
|
206
|
+
class="${p?"selected":d}"
|
|
207
207
|
@mouseover=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([o])}}
|
|
208
208
|
@mouseout=${()=>{this.clickId!==o&&this.hoverInteraction.highlightById([])}}
|
|
209
209
|
>
|
|
210
210
|
<div
|
|
211
211
|
class="list"
|
|
212
|
-
@click="${()=>this._handleFeatureSelectAndDeselect(
|
|
212
|
+
@click="${()=>this._handleFeatureSelectAndDeselect(s)}"
|
|
213
213
|
>
|
|
214
214
|
<span class="title">Feature #${n+1}</span>
|
|
215
215
|
<button
|
|
@@ -217,19 +217,19 @@ button.small {
|
|
|
217
217
|
class="icon small discard"
|
|
218
218
|
@click="${this._handleDelete}"
|
|
219
219
|
>
|
|
220
|
-
${this.unstyled?"x":
|
|
220
|
+
${this.unstyled?"x":d}
|
|
221
221
|
</button>
|
|
222
222
|
</div>
|
|
223
223
|
</li>
|
|
224
224
|
`)})}
|
|
225
225
|
</ul>
|
|
226
|
-
`}}
|
|
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
227
|
:host {
|
|
228
228
|
display: block;
|
|
229
229
|
}
|
|
230
|
-
`;class
|
|
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`
|
|
231
231
|
<style>
|
|
232
|
-
${
|
|
232
|
+
${Bt}
|
|
233
233
|
${!this.unstyled&&pt}
|
|
234
234
|
</style>
|
|
235
235
|
<div>
|
|
@@ -237,7 +237,7 @@ button.small {
|
|
|
237
237
|
<button
|
|
238
238
|
data-cy="drawBtn"
|
|
239
239
|
class="polygon icon"
|
|
240
|
-
disabled="${!this.multipleFeatures&&((
|
|
240
|
+
disabled="${!this.multipleFeatures&&((e=this.drawnFeatures)==null?void 0:e.length)>0||this.currentlyDrawing||d}"
|
|
241
241
|
@click="${()=>this.startDrawing()}"
|
|
242
242
|
>
|
|
243
243
|
${this.currentlyDrawing?"drawing":"draw"}
|
|
@@ -245,15 +245,15 @@ button.small {
|
|
|
245
245
|
<button
|
|
246
246
|
data-cy="discardBtn"
|
|
247
247
|
class="discard icon"
|
|
248
|
-
disabled="${!((i=this.drawnFeatures)!=null&&i.length)&&!this.currentlyDrawing||
|
|
248
|
+
disabled="${!((i=this.drawnFeatures)!=null&&i.length)&&!this.currentlyDrawing||d}"
|
|
249
249
|
@click="${()=>this.discardDrawing()}"
|
|
250
250
|
>
|
|
251
251
|
discard
|
|
252
252
|
</button>
|
|
253
253
|
</div>
|
|
254
|
-
${this.showList&&((
|
|
254
|
+
${this.showList&&((s=this.drawnFeatures)!=null&&s.length)?V`<eox-drawtools-list
|
|
255
255
|
.eoxMap=${g(this,f)}
|
|
256
|
-
.olMap=${g(this,
|
|
256
|
+
.olMap=${g(this,k)}
|
|
257
257
|
.draw=${this.draw}
|
|
258
258
|
.layer=${this.layer}
|
|
259
259
|
.drawLayer=${this.drawLayer}
|
|
@@ -262,5 +262,5 @@ button.small {
|
|
|
262
262
|
.unstyled=${this.unstyled}
|
|
263
263
|
@changed=${()=>this.requestUpdate()}
|
|
264
264
|
>
|
|
265
|
-
</eox-drawtools-list>`:
|
|
266
|
-
`}}f=new WeakMap,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/drawtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"eslint-plugin-typescript": "^0.14.0",
|
|
10
10
|
"ol": "^8.1.0",
|
|
11
11
|
"typescript": "^5.2.2",
|
|
12
|
-
"vite": "^
|
|
12
|
+
"vite": "^5.0.2"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"npm": ">=8.0.0",
|
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
|
-
|
|
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() {},
|
package/test/general.cy.js
CHANGED
|
@@ -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"
|
|
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
|
-
|
|
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", () => {
|