@eox/drawtools 0.10.1-dev.1729494244.0 → 0.11.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
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var tt = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var b = (i, t, e) =>
|
|
7
|
-
var y = (i, t, e) => (
|
|
5
|
+
var Ht = (i, t, e) => t in i ? Et(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
6
|
+
var b = (i, t, e) => Ht(i, typeof t != "symbol" ? t + "" : t, e), et = (i, t, e) => t.has(i) || tt("Cannot " + e);
|
|
7
|
+
var y = (i, t, e) => (et(i, t, "read from private field"), e ? e.call(i) : t.get(i)), $ = (i, t, e) => t.has(i) ? tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), g = (i, t, e, r) => (et(i, t, "write to private field"), r ? r.call(i, e) : t.set(i, e), e);
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2019 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
12
|
*/
|
|
13
|
-
const J = globalThis, Y = J.ShadowRoot && (J.ShadyCSS === void 0 || J.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
14
|
-
let
|
|
13
|
+
const J = globalThis, Y = J.ShadowRoot && (J.ShadyCSS === void 0 || J.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, vt = Symbol(), it = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
let kt = class {
|
|
15
15
|
constructor(t, e, r) {
|
|
16
|
-
if (this._$cssResult$ = !0, r !==
|
|
16
|
+
if (this._$cssResult$ = !0, r !== vt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
17
17
|
this.cssText = t, this.t = e;
|
|
18
18
|
}
|
|
19
19
|
get styleSheet() {
|
|
@@ -21,7 +21,7 @@ let Mt = class {
|
|
|
21
21
|
const e = this.t;
|
|
22
22
|
if (Y && t === void 0) {
|
|
23
23
|
const r = e !== void 0 && e.length === 1;
|
|
24
|
-
r && (t =
|
|
24
|
+
r && (t = it.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && it.set(e, t));
|
|
25
25
|
}
|
|
26
26
|
return t;
|
|
27
27
|
}
|
|
@@ -29,26 +29,26 @@ let Mt = class {
|
|
|
29
29
|
return this.cssText;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const Mt = (i) => new kt(typeof i == "string" ? i : i + "", void 0, vt), Ft = (i, t) => {
|
|
33
33
|
if (Y) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
34
|
else for (const e of t) {
|
|
35
35
|
const r = document.createElement("style"), s = J.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = e.cssText, i.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, rt = Y ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let e = "";
|
|
40
40
|
for (const r of t.cssRules) e += r.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Mt(e);
|
|
42
42
|
})(i) : i;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: It, defineProperty: Lt, getOwnPropertyDescriptor: Ut, getOwnPropertyNames: Ot, getOwnPropertySymbols: Pt, getPrototypeOf: Nt } = Object, v = globalThis, st = v.trustedTypes, Vt = st ? st.emptyScript : "", G = v.reactiveElementPolyfillSupport, L = (i, t) => i, Q = { toAttribute(i, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
i = i ?
|
|
51
|
+
i = i ? Vt : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,7 +73,7 @@ const { is: Lt, defineProperty: Ut, getOwnPropertyDescriptor: Ot, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return e;
|
|
76
|
-
} },
|
|
76
|
+
} }, bt = (i, t) => !It(i, t), nt = { attribute: !0, type: String, converter: Q, reflect: !1, hasChanged: bt };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), v.litPropertyMetadata ?? (v.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
class C extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
@@ -82,14 +82,14 @@ class C extends HTMLElement {
|
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(t, e =
|
|
85
|
+
static createProperty(t, e = nt) {
|
|
86
86
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
87
87
|
const r = Symbol(), s = this.getPropertyDescriptor(t, r, e);
|
|
88
|
-
s !== void 0 &&
|
|
88
|
+
s !== void 0 && Lt(this.prototype, t, s);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, e, r) {
|
|
92
|
-
const { get: s, set: n } =
|
|
92
|
+
const { get: s, set: n } = Ut(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[e];
|
|
94
94
|
}, set(o) {
|
|
95
95
|
this[e] = o;
|
|
@@ -102,7 +102,7 @@ class C extends HTMLElement {
|
|
|
102
102
|
}, configurable: !0, enumerable: !0 };
|
|
103
103
|
}
|
|
104
104
|
static getPropertyOptions(t) {
|
|
105
|
-
return this.elementProperties.get(t) ??
|
|
105
|
+
return this.elementProperties.get(t) ?? nt;
|
|
106
106
|
}
|
|
107
107
|
static _$Ei() {
|
|
108
108
|
if (this.hasOwnProperty(L("elementProperties"))) return;
|
|
@@ -112,7 +112,7 @@ class C extends HTMLElement {
|
|
|
112
112
|
static finalize() {
|
|
113
113
|
if (this.hasOwnProperty(L("finalized"))) return;
|
|
114
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(L("properties"))) {
|
|
115
|
-
const e = this.properties, r = [...
|
|
115
|
+
const e = this.properties, r = [...Ot(e), ...Pt(e)];
|
|
116
116
|
for (const s of r) this.createProperty(s, e[s]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -131,8 +131,8 @@ class C extends HTMLElement {
|
|
|
131
131
|
const e = [];
|
|
132
132
|
if (Array.isArray(t)) {
|
|
133
133
|
const r = new Set(t.flat(1 / 0).reverse());
|
|
134
|
-
for (const s of r) e.unshift(
|
|
135
|
-
} else t !== void 0 && e.push(
|
|
134
|
+
for (const s of r) e.unshift(rt(s));
|
|
135
|
+
} else t !== void 0 && e.push(rt(t));
|
|
136
136
|
return e;
|
|
137
137
|
}
|
|
138
138
|
static _$Eu(t, e) {
|
|
@@ -161,7 +161,7 @@ class C extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Ft(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -200,7 +200,7 @@ class C extends HTMLElement {
|
|
|
200
200
|
}
|
|
201
201
|
requestUpdate(t, e, r) {
|
|
202
202
|
if (t !== void 0) {
|
|
203
|
-
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ??
|
|
203
|
+
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ?? bt)(this[t], e)) return;
|
|
204
204
|
this.P(t, e, r);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -279,42 +279,42 @@ C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[L("elementProper
|
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const U = globalThis, q = U.trustedTypes,
|
|
283
|
-
\f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
285
|
-
function
|
|
282
|
+
const U = globalThis, q = U.trustedTypes, ot = q ? q.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, $t = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, wt = "?" + m, Bt = `<${wt}>`, S = document, O = () => S.createComment(""), P = (i) => i === null || typeof i != "object" && typeof i != "function", T = Array.isArray, Rt = (i) => T(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", W = `[
|
|
283
|
+
\f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, at = /-->/g, lt = />/g, w = RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ct = /'/g, dt = /"/g, _t = /^(?:script|style|textarea|title)$/i, zt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), x = zt(1), M = Symbol.for("lit-noChange"), h = Symbol.for("lit-nothing"), ht = /* @__PURE__ */ new WeakMap(), _ = S.createTreeWalker(S, 129);
|
|
285
|
+
function xt(i, t) {
|
|
286
286
|
if (!T(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
-
return
|
|
287
|
+
return ot !== void 0 ? ot.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const jt = (i, t) => {
|
|
290
290
|
const e = i.length - 1, r = [];
|
|
291
291
|
let s, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = I;
|
|
292
292
|
for (let l = 0; l < e; l++) {
|
|
293
293
|
const a = i[l];
|
|
294
|
-
let
|
|
295
|
-
for (; u < a.length && (o.lastIndex = u, p = o.exec(a), p !== null); ) u = o.lastIndex, o === I ? p[1] === "!--" ? o =
|
|
294
|
+
let d, p, c = -1, u = 0;
|
|
295
|
+
for (; u < a.length && (o.lastIndex = u, p = o.exec(a), p !== null); ) u = o.lastIndex, o === I ? p[1] === "!--" ? o = at : p[1] !== void 0 ? o = lt : p[2] !== void 0 ? (_t.test(p[2]) && (s = RegExp("</" + p[2], "g")), o = w) : p[3] !== void 0 && (o = w) : o === w ? p[0] === ">" ? (o = s ?? I, c = -1) : p[1] === void 0 ? c = -2 : (c = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? w : p[3] === '"' ? dt : ct) : o === dt || o === ct ? o = w : o === at || o === lt ? o = I : (o = w, s = void 0);
|
|
296
296
|
const f = o === w && i[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
-
n += o === I ? a +
|
|
297
|
+
n += o === I ? a + Bt : c >= 0 ? (r.push(d), a.slice(0, c) + $t + a.slice(c) + m + f) : a + m + (c === -2 ? l : f);
|
|
298
298
|
}
|
|
299
|
-
return [
|
|
299
|
+
return [xt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
301
|
-
class
|
|
301
|
+
class N {
|
|
302
302
|
constructor({ strings: t, _$litType$: e }, r) {
|
|
303
303
|
let s;
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let n = 0, o = 0;
|
|
306
|
-
const l = t.length - 1, a = this.parts, [
|
|
307
|
-
if (this.el =
|
|
306
|
+
const l = t.length - 1, a = this.parts, [d, p] = jt(t, e);
|
|
307
|
+
if (this.el = N.createElement(d, r), _.currentNode = this.el.content, e === 2 || e === 3) {
|
|
308
308
|
const c = this.el.content.firstChild;
|
|
309
309
|
c.replaceWith(...c.childNodes);
|
|
310
310
|
}
|
|
311
311
|
for (; (s = _.nextNode()) !== null && a.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const c of s.getAttributeNames()) if (c.endsWith(
|
|
313
|
+
if (s.hasAttributes()) for (const c of s.getAttributeNames()) if (c.endsWith($t)) {
|
|
314
314
|
const u = p[o++], f = s.getAttribute(c).split(m), j = /([.?@])?(.*)/.exec(u);
|
|
315
|
-
a.push({ type: 1, index: n, name: j[2], strings: f, ctor: j[1] === "." ?
|
|
315
|
+
a.push({ type: 1, index: n, name: j[2], strings: f, ctor: j[1] === "." ? qt : j[1] === "?" ? Dt : j[1] === "@" ? Gt : D }), s.removeAttribute(c);
|
|
316
316
|
} else c.startsWith(m) && (a.push({ type: 6, index: n }), s.removeAttribute(c));
|
|
317
|
-
if (
|
|
317
|
+
if (_t.test(s.tagName)) {
|
|
318
318
|
const c = s.textContent.split(m), u = c.length - 1;
|
|
319
319
|
if (u > 0) {
|
|
320
320
|
s.textContent = q ? q.emptyScript : "";
|
|
@@ -322,7 +322,7 @@ class V {
|
|
|
322
322
|
s.append(c[u], O());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === wt) a.push({ type: 2, index: n });
|
|
326
326
|
else {
|
|
327
327
|
let c = -1;
|
|
328
328
|
for (; (c = s.data.indexOf(m, c + 1)) !== -1; ) a.push({ type: 7, index: n }), c += m.length - 1;
|
|
@@ -342,7 +342,7 @@ function F(i, t, e = i, r) {
|
|
|
342
342
|
const n = P(t) ? void 0 : t._$litDirective$;
|
|
343
343
|
return (s == null ? void 0 : s.constructor) !== n && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), n === void 0 ? s = void 0 : (s = new n(i), s._$AT(i, e, r)), r !== void 0 ? (e._$Co ?? (e._$Co = []))[r] = s : e._$Cl = s), s !== void 0 && (t = F(i, s._$AS(i, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
|
-
class
|
|
345
|
+
class Jt {
|
|
346
346
|
constructor(t, e) {
|
|
347
347
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
348
348
|
}
|
|
@@ -358,8 +358,8 @@ class qt {
|
|
|
358
358
|
let n = _.nextNode(), o = 0, l = 0, a = r[0];
|
|
359
359
|
for (; a !== void 0; ) {
|
|
360
360
|
if (o === a.index) {
|
|
361
|
-
let
|
|
362
|
-
a.type === 2 ?
|
|
361
|
+
let d;
|
|
362
|
+
a.type === 2 ? d = new z(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Wt(n, this, t)), this._$AV.push(d), a = r[++l];
|
|
363
363
|
}
|
|
364
364
|
o !== (a == null ? void 0 : a.index) && (n = _.nextNode(), o++);
|
|
365
365
|
}
|
|
@@ -376,7 +376,7 @@ class z {
|
|
|
376
376
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
377
377
|
}
|
|
378
378
|
constructor(t, e, r, s) {
|
|
379
|
-
this.type = 2, this._$AH =
|
|
379
|
+
this.type = 2, this._$AH = h, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = r, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
|
|
380
380
|
}
|
|
381
381
|
get parentNode() {
|
|
382
382
|
let t = this._$AA.parentNode;
|
|
@@ -390,7 +390,7 @@ class z {
|
|
|
390
390
|
return this._$AB;
|
|
391
391
|
}
|
|
392
392
|
_$AI(t, e = this) {
|
|
393
|
-
t = F(this, t, e), P(t) ? t ===
|
|
393
|
+
t = F(this, t, e), P(t) ? t === h || t == null || t === "" ? (this._$AH !== h && this._$AR(), this._$AH = h) : t !== this._$AH && t !== M && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Rt(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,20 +399,20 @@ class z {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !==
|
|
402
|
+
this._$AH !== h && P(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var n;
|
|
406
|
-
const { values: e, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el =
|
|
406
|
+
const { values: e, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = N.createElement(xt(r.h, r.h[0]), this.options)), r);
|
|
407
407
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === s) this._$AH.p(e);
|
|
408
408
|
else {
|
|
409
|
-
const o = new
|
|
409
|
+
const o = new Jt(s, this), l = o.u(this.options);
|
|
410
410
|
o.p(e), this.T(l), this._$AH = o;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
_$AC(t) {
|
|
414
|
-
let e =
|
|
415
|
-
return e === void 0 &&
|
|
414
|
+
let e = ht.get(t.strings);
|
|
415
|
+
return e === void 0 && ht.set(t.strings, e = new N(t)), e;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
418
|
T(this._$AH) || (this._$AH = [], this._$AR());
|
|
@@ -441,7 +441,7 @@ class D {
|
|
|
441
441
|
return this._$AM._$AU;
|
|
442
442
|
}
|
|
443
443
|
constructor(t, e, r, s, n) {
|
|
444
|
-
this.type = 1, this._$AH =
|
|
444
|
+
this.type = 1, this._$AH = h, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = n, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = h;
|
|
445
445
|
}
|
|
446
446
|
_$AI(t, e = this, r, s) {
|
|
447
447
|
const n = this.strings;
|
|
@@ -449,38 +449,38 @@ class D {
|
|
|
449
449
|
if (n === void 0) t = F(this, t, e, 0), o = !P(t) || t !== this._$AH && t !== M, o && (this._$AH = t);
|
|
450
450
|
else {
|
|
451
451
|
const l = t;
|
|
452
|
-
let a,
|
|
453
|
-
for (t = n[0], a = 0; a < n.length - 1; a++)
|
|
452
|
+
let a, d;
|
|
453
|
+
for (t = n[0], a = 0; a < n.length - 1; a++) d = F(this, l[r + a], e, a), d === M && (d = this._$AH[a]), o || (o = !P(d) || d !== this._$AH[a]), d === h ? t = h : t !== h && (t += (d ?? "") + n[a + 1]), this._$AH[a] = d;
|
|
454
454
|
}
|
|
455
455
|
o && !s && this.j(t);
|
|
456
456
|
}
|
|
457
457
|
j(t) {
|
|
458
|
-
t ===
|
|
458
|
+
t === h ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
class
|
|
461
|
+
class qt extends D {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 3;
|
|
464
464
|
}
|
|
465
465
|
j(t) {
|
|
466
|
-
this.element[this.name] = t ===
|
|
466
|
+
this.element[this.name] = t === h ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
class
|
|
469
|
+
class Dt extends D {
|
|
470
470
|
constructor() {
|
|
471
471
|
super(...arguments), this.type = 4;
|
|
472
472
|
}
|
|
473
473
|
j(t) {
|
|
474
|
-
this.element.toggleAttribute(this.name, !!t && t !==
|
|
474
|
+
this.element.toggleAttribute(this.name, !!t && t !== h);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class Gt extends D {
|
|
478
478
|
constructor(t, e, r, s, n) {
|
|
479
479
|
super(t, e, r, s, n), this.type = 5;
|
|
480
480
|
}
|
|
481
481
|
_$AI(t, e = this) {
|
|
482
|
-
if ((t = F(this, t, e, 0) ??
|
|
483
|
-
const r = this._$AH, s = t ===
|
|
482
|
+
if ((t = F(this, t, e, 0) ?? h) === M) return;
|
|
483
|
+
const r = this._$AH, s = t === h && r !== h || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, n = t !== h && (r === h || s);
|
|
484
484
|
s && this.element.removeEventListener(this.name, this, r), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
485
|
}
|
|
486
486
|
handleEvent(t) {
|
|
@@ -488,7 +488,7 @@ class Wt extends D {
|
|
|
488
488
|
typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
class
|
|
491
|
+
class Wt {
|
|
492
492
|
constructor(t, e, r) {
|
|
493
493
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = r;
|
|
494
494
|
}
|
|
@@ -500,8 +500,8 @@ class Zt {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
const Z = U.litHtmlPolyfillSupport;
|
|
503
|
-
Z == null || Z(
|
|
504
|
-
const
|
|
503
|
+
Z == null || Z(N, z), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const Zt = (i, t, e) => {
|
|
505
505
|
const r = (e == null ? void 0 : e.renderBefore) ?? t;
|
|
506
506
|
let s = r._$litPart$;
|
|
507
507
|
if (s === void 0) {
|
|
@@ -526,7 +526,7 @@ class A extends C {
|
|
|
526
526
|
}
|
|
527
527
|
update(t) {
|
|
528
528
|
const e = this.render();
|
|
529
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
529
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Zt(e, this.renderRoot, this.renderOptions);
|
|
530
530
|
}
|
|
531
531
|
connectedCallback() {
|
|
532
532
|
var t;
|
|
@@ -540,8 +540,8 @@ class A extends C {
|
|
|
540
540
|
return M;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
var
|
|
544
|
-
A._$litElement$ = !0, A.finalized = !0, (
|
|
543
|
+
var mt;
|
|
544
|
+
A._$litElement$ = !0, A.finalized = !0, (mt = globalThis.litElementHydrateSupport) == null || mt.call(globalThis, { LitElement: A });
|
|
545
545
|
const K = globalThis.litElementPolyfillSupport;
|
|
546
546
|
K == null || K({ LitElement: A });
|
|
547
547
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
@@ -550,8 +550,8 @@ K == null || K({ LitElement: A });
|
|
|
550
550
|
* Copyright 2017 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
554
|
-
let
|
|
553
|
+
const Kt = (i) => (...t) => ({ _$litDirective$: i, values: t });
|
|
554
|
+
let Qt = class {
|
|
555
555
|
constructor(t) {
|
|
556
556
|
}
|
|
557
557
|
get _$AU() {
|
|
@@ -572,23 +572,23 @@ let Xt = class {
|
|
|
572
572
|
* Copyright 2020 Google LLC
|
|
573
573
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
574
574
|
*/
|
|
575
|
-
const
|
|
575
|
+
const Xt = {}, Yt = (i, t = Xt) => i._$AH = t;
|
|
576
576
|
/**
|
|
577
577
|
* @license
|
|
578
578
|
* Copyright 2021 Google LLC
|
|
579
579
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
580
580
|
*/
|
|
581
|
-
const
|
|
581
|
+
const Tt = Kt(class extends Qt {
|
|
582
582
|
constructor() {
|
|
583
|
-
super(...arguments), this.key =
|
|
583
|
+
super(...arguments), this.key = h;
|
|
584
584
|
}
|
|
585
585
|
render(i, t) {
|
|
586
586
|
return this.key = i, t;
|
|
587
587
|
}
|
|
588
588
|
update(i, [t, e]) {
|
|
589
|
-
return t !== this.key && (
|
|
589
|
+
return t !== this.key && (Yt(i), this.key = t), e;
|
|
590
590
|
}
|
|
591
|
-
}),
|
|
591
|
+
}), te = (i) => {
|
|
592
592
|
i.hoverInteraction = i.eoxMap.selectInteractions.selectHover, i.clickInteraction = i.eoxMap.selectInteractions.selectClick;
|
|
593
593
|
const t = () => {
|
|
594
594
|
i.requestUpdate();
|
|
@@ -600,29 +600,29 @@ const te = Qt(class extends Xt {
|
|
|
600
600
|
"change",
|
|
601
601
|
t
|
|
602
602
|
);
|
|
603
|
-
},
|
|
603
|
+
}, ee = (i, t, e) => {
|
|
604
604
|
if (i.clickId === t) return;
|
|
605
605
|
const r = e ? [] : [t];
|
|
606
606
|
i.hoverInteraction.highlightById(r);
|
|
607
|
-
},
|
|
607
|
+
}, ie = (i, t) => {
|
|
608
608
|
i.stopPropagation();
|
|
609
609
|
const e = Number(i.target.getAttribute("index")), r = t.drawnFeatures[e];
|
|
610
610
|
t.drawLayer.getSource().removeFeature(r), t.drawnFeatures.splice(e, 1), t.requestUpdate();
|
|
611
|
-
},
|
|
611
|
+
}, pt = { duration: 750 }, ut = {
|
|
612
612
|
type: "FeatureCollection",
|
|
613
613
|
features: []
|
|
614
|
-
},
|
|
614
|
+
}, re = (i, t) => {
|
|
615
615
|
const e = i.getId(), { clickId: r, drawLayer: s, olMap: n, clickInteraction: o } = t, l = r === e, a = i.getGeometry();
|
|
616
616
|
if (l) {
|
|
617
|
-
const
|
|
618
|
-
n.getView().fit(
|
|
617
|
+
const d = s.getSource().getExtent();
|
|
618
|
+
n.getView().fit(d, pt), o.highlightById([]);
|
|
619
619
|
} else {
|
|
620
|
-
const
|
|
621
|
-
o.highlightById([e]), n.getView().fit(
|
|
620
|
+
const d = a.getExtent();
|
|
621
|
+
o.highlightById([e]), n.getView().fit(d, pt);
|
|
622
622
|
}
|
|
623
623
|
t.requestUpdate();
|
|
624
|
-
},
|
|
625
|
-
class
|
|
624
|
+
}, se = "ul.list-wrap { padding: 0;}ul.list-wrap li:hover,ul.list-wrap li.selected { background: var(--secondary-bg-color-hover);}ul.list-wrap li { list-style: none; padding: 4px;}ul.list-wrap li { border-bottom: 1.2px solid var(--secondary-color);}ul.list-wrap li:first-child { border-top: 1.2px solid var(--secondary-color);}ul.list-wrap li .list { width: 100%; align-items: center; justify-content: space-between; display: flex; align-items: center; cursor: pointer; font-size: small; gap: 10px;}ul.list-wrap li .list span { display: flex; align-items: center; cursor: pointer; font-size: small; flex-grow: 1;}";
|
|
625
|
+
class At extends A {
|
|
626
626
|
constructor() {
|
|
627
627
|
super();
|
|
628
628
|
/**
|
|
@@ -649,7 +649,7 @@ class St extends A {
|
|
|
649
649
|
* @param {Event & { target: HTMLButtonElement }} evt - Event object containing button target.
|
|
650
650
|
*/
|
|
651
651
|
_handleDelete(e) {
|
|
652
|
-
|
|
652
|
+
ie(e, this), this.dispatchEvent(new CustomEvent("changed", { bubbles: !0 }));
|
|
653
653
|
}
|
|
654
654
|
/**
|
|
655
655
|
* Handles the selection and deselection of a feature from the list.
|
|
@@ -657,7 +657,7 @@ class St extends A {
|
|
|
657
657
|
* @param {import("ol").Feature} feature - The selected feature.
|
|
658
658
|
*/
|
|
659
659
|
_handleFeatureSelectAndDeselect(e) {
|
|
660
|
-
|
|
660
|
+
re(e, this);
|
|
661
661
|
}
|
|
662
662
|
/**
|
|
663
663
|
*
|
|
@@ -665,13 +665,13 @@ class St extends A {
|
|
|
665
665
|
* @param {Boolean} mouseOut - Flag indicating mouse out event.
|
|
666
666
|
*/
|
|
667
667
|
_handleHoverFeature(e, r = !1) {
|
|
668
|
-
|
|
668
|
+
ee(this, e, r);
|
|
669
669
|
}
|
|
670
670
|
/**
|
|
671
671
|
* Initiates initial settings and event triggers upon the component's first update.
|
|
672
672
|
*/
|
|
673
673
|
firstUpdated() {
|
|
674
|
-
|
|
674
|
+
te(this);
|
|
675
675
|
}
|
|
676
676
|
/**
|
|
677
677
|
* Overrides createRenderRoot to handle shadow DOM.
|
|
@@ -683,16 +683,16 @@ class St extends A {
|
|
|
683
683
|
var e, r;
|
|
684
684
|
return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (r = this.clickInteraction) == null ? void 0 : r.selectedFids[0], x`
|
|
685
685
|
<style>
|
|
686
|
-
${!this.unstyled &&
|
|
686
|
+
${!this.unstyled && se}
|
|
687
687
|
</style>
|
|
688
688
|
<ul class="list-wrap">
|
|
689
689
|
${this.drawnFeatures.map((s, n) => {
|
|
690
|
-
const o = n + 1, l = s.getId(), a = this.hoverId === l,
|
|
691
|
-
return
|
|
690
|
+
const o = n + 1, l = s.getId(), a = this.hoverId === l, d = this.clickId === l;
|
|
691
|
+
return Tt(
|
|
692
692
|
o,
|
|
693
693
|
x`
|
|
694
694
|
<li
|
|
695
|
-
class="${a ||
|
|
695
|
+
class="${a || d ? "selected" : h}"
|
|
696
696
|
@mouseover=${() => this._handleHoverFeature(l)}
|
|
697
697
|
@mouseout=${() => this._handleHoverFeature(l, !0)}
|
|
698
698
|
>
|
|
@@ -717,7 +717,7 @@ class St extends A {
|
|
|
717
717
|
`;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
b(
|
|
720
|
+
b(At, "properties", {
|
|
721
721
|
eoxMap: { attribute: !1, state: !0 },
|
|
722
722
|
olMap: { attribute: !1, state: !0 },
|
|
723
723
|
draw: { attribute: !1, state: !0 },
|
|
@@ -726,12 +726,12 @@ b(St, "properties", {
|
|
|
726
726
|
modify: { attribute: !1, state: !0 },
|
|
727
727
|
unstyled: { type: Boolean }
|
|
728
728
|
});
|
|
729
|
-
customElements.define("eox-drawtools-list",
|
|
730
|
-
const
|
|
729
|
+
customElements.define("eox-drawtools-list", At);
|
|
730
|
+
const ne = (i) => {
|
|
731
731
|
const { multipleFeatures: t, drawnFeatures: e, currentlyDrawing: r } = i, s = !t && (e == null ? void 0 : e.length) > 0 || r, n = !(e != null && e.length) && !r;
|
|
732
732
|
return { drawDisabled: s, discardDisabled: n };
|
|
733
|
-
},
|
|
734
|
-
function
|
|
733
|
+
}, oe = 'button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon):not(.json-editor-btntype-*),.button:hover:not([disabled]):not(.icon) { box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.block,.button.block { display: block;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon,button[class*="json-editor-btntype-"] { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon-text.block,.button.icon-text.block { text-indent: 20px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon-text.block:before,.button.icon-text.block:before { text-indent: -54px;}button.icon:before,.button.icon:before,button[class*="json-editor-btntype-"]::before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0;}', ae = 'textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}input[type="text"],input[type="url"],input[type="email"],input[type="password"],input[type="text"],input[type="number"],input[type="search"],input[type="tel"],select { box-sizing: border-box; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; padding: 5px 7px; border-radius: 4px; border: 1px solid #0004;}';
|
|
734
|
+
function le(i) {
|
|
735
735
|
navigator.clipboard.writeText(i).then(
|
|
736
736
|
function() {
|
|
737
737
|
},
|
|
@@ -745,17 +745,17 @@ function ce(i) {
|
|
|
745
745
|
* Copyright 2021 Google LLC
|
|
746
746
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
747
747
|
*/
|
|
748
|
-
function
|
|
748
|
+
function yt(i, t, e) {
|
|
749
749
|
return i ? t(i) : e == null ? void 0 : e(i);
|
|
750
750
|
}
|
|
751
|
-
var
|
|
752
|
-
class
|
|
751
|
+
var V, B;
|
|
752
|
+
class St extends A {
|
|
753
753
|
constructor() {
|
|
754
754
|
super();
|
|
755
755
|
/**
|
|
756
756
|
* @type boolean | import("lit").nothing
|
|
757
757
|
*/
|
|
758
|
-
$(this,
|
|
758
|
+
$(this, V, !0);
|
|
759
759
|
/**
|
|
760
760
|
* @type boolean | import("lit").nothing
|
|
761
761
|
*/
|
|
@@ -766,8 +766,8 @@ class Ct extends A {
|
|
|
766
766
|
* Updates button states based on conditions
|
|
767
767
|
*/
|
|
768
768
|
updateButtonStates() {
|
|
769
|
-
const { drawDisabled: e, discardDisabled: r } =
|
|
770
|
-
g(this,
|
|
769
|
+
const { drawDisabled: e, discardDisabled: r } = ne(this);
|
|
770
|
+
g(this, V, e), g(this, B, r);
|
|
771
771
|
}
|
|
772
772
|
/**
|
|
773
773
|
* Overrides createRenderRoot to handle shadow DOM
|
|
@@ -780,8 +780,8 @@ class Ct extends A {
|
|
|
780
780
|
const e = this.currentlyDrawing ? "drawing" : "draw";
|
|
781
781
|
return x`
|
|
782
782
|
<style>
|
|
783
|
+
${!this.unstyled && oe}
|
|
783
784
|
${!this.unstyled && ae}
|
|
784
|
-
${!this.unstyled && le}
|
|
785
785
|
</style>
|
|
786
786
|
<div class="wrap-btn">
|
|
787
787
|
<slot></slot>
|
|
@@ -790,7 +790,7 @@ class Ct extends A {
|
|
|
790
790
|
<button
|
|
791
791
|
data-cy="drawBtn"
|
|
792
792
|
class="${this.select ? "pointer" : "polygon"} icon"
|
|
793
|
-
?disabled="${y(this,
|
|
793
|
+
?disabled="${y(this, V) || h}"
|
|
794
794
|
@click="${() => this.drawFunc.start()}"
|
|
795
795
|
>
|
|
796
796
|
${e}
|
|
@@ -800,7 +800,7 @@ class Ct extends A {
|
|
|
800
800
|
<button
|
|
801
801
|
data-cy="discardBtn"
|
|
802
802
|
class="discard icon"
|
|
803
|
-
?disabled="${y(this, B) ||
|
|
803
|
+
?disabled="${y(this, B) || h}"
|
|
804
804
|
@click="${() => this.drawFunc.discard()}"
|
|
805
805
|
>
|
|
806
806
|
discard
|
|
@@ -808,7 +808,7 @@ class Ct extends A {
|
|
|
808
808
|
</div>
|
|
809
809
|
|
|
810
810
|
<!-- Import Button -->
|
|
811
|
-
${
|
|
811
|
+
${yt(
|
|
812
812
|
this.importFeatures,
|
|
813
813
|
() => x`
|
|
814
814
|
<!-- Import Input Field : Hidden -->
|
|
@@ -832,7 +832,7 @@ class Ct extends A {
|
|
|
832
832
|
</div>
|
|
833
833
|
|
|
834
834
|
<!-- Geo JSON Wrapper -->
|
|
835
|
-
${
|
|
835
|
+
${yt(
|
|
836
836
|
this.showEditor,
|
|
837
837
|
() => x`
|
|
838
838
|
<div class="json-wrapper">
|
|
@@ -847,9 +847,9 @@ class Ct extends A {
|
|
|
847
847
|
<button
|
|
848
848
|
data-cy="copyBtn"
|
|
849
849
|
class="icon-copy"
|
|
850
|
-
@click=${() =>
|
|
850
|
+
@click=${() => le(this.geoJSON)}
|
|
851
851
|
>
|
|
852
|
-
${this.unstyled ? "copy" :
|
|
852
|
+
${this.unstyled ? "copy" : h}
|
|
853
853
|
</button>
|
|
854
854
|
</div>
|
|
855
855
|
`
|
|
@@ -857,8 +857,8 @@ class Ct extends A {
|
|
|
857
857
|
`;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
|
-
|
|
861
|
-
b(
|
|
860
|
+
V = new WeakMap(), B = new WeakMap(), // Define properties with default values and types
|
|
861
|
+
b(St, "properties", {
|
|
862
862
|
multipleFeatures: { attribute: !1, type: Boolean },
|
|
863
863
|
drawnFeatures: { attribute: !1, state: !0, type: Array },
|
|
864
864
|
currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
|
|
@@ -869,8 +869,8 @@ b(Ct, "properties", {
|
|
|
869
869
|
geoJSON: { attribute: "geo-json", type: String },
|
|
870
870
|
unstyled: { type: Boolean }
|
|
871
871
|
});
|
|
872
|
-
customElements.define("eox-drawtools-controller",
|
|
873
|
-
const
|
|
872
|
+
customElements.define("eox-drawtools-controller", St);
|
|
873
|
+
const ce = `
|
|
874
874
|
button.discard:before {
|
|
875
875
|
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")
|
|
876
876
|
}
|
|
@@ -919,31 +919,20 @@ const he = `
|
|
|
919
919
|
(() => {
|
|
920
920
|
i.emitDrawnFeatures(), i.multipleFeatures || (i.draw.setActive(!1), i.selectionEvents.removeSelectionEvent(), i.currentlyDrawing = !1);
|
|
921
921
|
})(), i.requestUpdate();
|
|
922
|
-
},
|
|
922
|
+
}, he = (i) => {
|
|
923
923
|
const t = () => {
|
|
924
924
|
i.drawLayer.set("isDrawingEnabled", !0), i.draw.setActive(!0), i.selectionEvents.addSelectionEvent();
|
|
925
925
|
}, e = () => {
|
|
926
926
|
i.currentlyDrawing = !0, i.requestUpdate();
|
|
927
927
|
};
|
|
928
928
|
t(), e();
|
|
929
|
-
},
|
|
929
|
+
}, pe = (i) => {
|
|
930
930
|
let t;
|
|
931
931
|
return typeof i == "string" ? t = /** @type {HTMLElement} */
|
|
932
932
|
document.querySelector(i) : t = i, t;
|
|
933
|
-
},
|
|
934
|
-
for (const e of i) {
|
|
935
|
-
if (e.type === "Group") {
|
|
936
|
-
const r = tt(e.layers, t);
|
|
937
|
-
if (!r)
|
|
938
|
-
continue;
|
|
939
|
-
return r;
|
|
940
|
-
}
|
|
941
|
-
if (e.properties.id === t)
|
|
942
|
-
return e;
|
|
943
|
-
}
|
|
944
|
-
}, gt = (i, t) => {
|
|
933
|
+
}, ft = (i, t) => {
|
|
945
934
|
var n;
|
|
946
|
-
const r =
|
|
935
|
+
const r = pe(i.for), s = r.map;
|
|
947
936
|
return i.drawLayer = r.addOrUpdateLayer({
|
|
948
937
|
type: "Vector",
|
|
949
938
|
properties: {
|
|
@@ -1000,7 +989,7 @@ const he = `
|
|
|
1000
989
|
r.interactions.drawInteraction, i.modify = /** @type {import("ol/interaction").Modify} */
|
|
1001
990
|
/** @type {unknown} */
|
|
1002
991
|
r.interactions.drawInteractionmodify, X(i, r, i.layerId), (n = i.modify) == null || n.on("modifyend", () => i.onModifyEnd()), r.addEventListener("addfeatures", () => de(i)), { EoxMap: r, OlMap: s };
|
|
1003
|
-
},
|
|
992
|
+
}, ue = (i) => {
|
|
1004
993
|
const t = () => {
|
|
1005
994
|
i.drawnFeatures = [], setTimeout(() => {
|
|
1006
995
|
i.draw.setActive(!1), i.selectionEvents.removeSelectionEvent();
|
|
@@ -1009,11 +998,11 @@ const he = `
|
|
|
1009
998
|
i.emitDrawnFeatures(), i.currentlyDrawing = !1, i.requestUpdate();
|
|
1010
999
|
};
|
|
1011
1000
|
t(), e();
|
|
1012
|
-
},
|
|
1001
|
+
}, ye = (i, t) => {
|
|
1013
1002
|
setTimeout(() => {
|
|
1014
1003
|
i.drawnFeatures = i.drawLayer.getSource().getFeatures(), i.updateGeoJSON(), i.requestUpdate(), t();
|
|
1015
1004
|
}, 0);
|
|
1016
|
-
},
|
|
1005
|
+
}, fe = (i) => {
|
|
1017
1006
|
const t = (s) => {
|
|
1018
1007
|
(s == null ? void 0 : s.detail.id) !== "SelectLayerClickInteraction" || !s.detail.feature || (i.drawLayer.getSource().addFeature(s.detail.feature), i.eoxMap.dispatchEvent(
|
|
1019
1008
|
new CustomEvent("addfeatures", { detail: s.detail })
|
|
@@ -1029,7 +1018,12 @@ const he = `
|
|
|
1029
1018
|
}, X = (i, t, e) => {
|
|
1030
1019
|
if (!e || !t)
|
|
1031
1020
|
return;
|
|
1032
|
-
const r =
|
|
1021
|
+
const r = JSON.parse(
|
|
1022
|
+
JSON.stringify(
|
|
1023
|
+
/** @type {import("../../../../map/src/main").EoxLayer} */
|
|
1024
|
+
t.getLayerById(e).get("_jsonDefinition")
|
|
1025
|
+
)
|
|
1026
|
+
) || null;
|
|
1033
1027
|
if (!r) {
|
|
1034
1028
|
console.error(`Layer with id ${e} not found`);
|
|
1035
1029
|
return;
|
|
@@ -1068,27 +1062,24 @@ const he = `
|
|
|
1068
1062
|
i.draw = t.selectInteractions.SelectLayerClickInteraction, setTimeout(() => {
|
|
1069
1063
|
o.setActive(!1), t.selectInteractions.SelectLayerClickInteraction.setActive(!1), t.selectInteractions.SelectLayerHoverInteraction.setActive(!1);
|
|
1070
1064
|
}, 200);
|
|
1071
|
-
},
|
|
1065
|
+
}, ge = (i, t, e, r) => {
|
|
1072
1066
|
if (t) {
|
|
1073
1067
|
if (e) {
|
|
1074
|
-
r && e !== r &&
|
|
1068
|
+
r && e !== r && gt(i, t), X(i, t, e);
|
|
1075
1069
|
return;
|
|
1076
1070
|
}
|
|
1077
1071
|
if (!e && r) {
|
|
1078
|
-
|
|
1072
|
+
gt(i, t);
|
|
1079
1073
|
return;
|
|
1080
1074
|
}
|
|
1081
1075
|
}
|
|
1082
1076
|
};
|
|
1083
|
-
function
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
const r = tt(t.layers, e) || null;
|
|
1087
|
-
i.draw = /** @type {import("ol/interaction").Draw} */
|
|
1088
|
-
t.interactions.drawInteraction, r && (delete r.interactions, t.addOrUpdateLayer(r));
|
|
1077
|
+
function gt(i, t) {
|
|
1078
|
+
t && (i.discardDrawing(), i.selectionEvents.removeSelectionEvent(), i.draw = /** @type {import("ol/interaction").Draw} */
|
|
1079
|
+
t.interactions.drawInteraction, t.selectInteractions.SelectLayerClickInteraction.remove(), t.selectInteractions.SelectLayerHoverInteraction.remove());
|
|
1089
1080
|
}
|
|
1090
|
-
const
|
|
1091
|
-
function
|
|
1081
|
+
const me = ':root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-size: normal; font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { --font-size: 1rem; font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem; font-size: var(--font-size);}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}';
|
|
1082
|
+
function ve(i, t) {
|
|
1092
1083
|
function e(n) {
|
|
1093
1084
|
n.preventDefault(), n.stopPropagation();
|
|
1094
1085
|
}
|
|
@@ -1100,24 +1091,24 @@ function be(i, t) {
|
|
|
1100
1091
|
}
|
|
1101
1092
|
["dragenter", "dragover", "dragleave", "drop"].forEach((n) => {
|
|
1102
1093
|
t.addEventListener(n, e, !1), ["dragenter", "dragover"].includes(n) ? t.addEventListener(n, r, !1) : t.addEventListener(n, s, !1);
|
|
1103
|
-
}), t.addEventListener("drop", (n) =>
|
|
1094
|
+
}), t.addEventListener("drop", (n) => Ct(n, i), !1);
|
|
1104
1095
|
}
|
|
1105
|
-
function
|
|
1096
|
+
function be(i) {
|
|
1106
1097
|
i.preventDefault(), i.stopPropagation();
|
|
1107
1098
|
}
|
|
1108
|
-
function
|
|
1109
|
-
|
|
1099
|
+
function Ct(i, t) {
|
|
1100
|
+
be(i);
|
|
1110
1101
|
const e = i.dataTransfer ? i.dataTransfer.files : i.target.files;
|
|
1111
|
-
Array.from(e).forEach((r) =>
|
|
1102
|
+
Array.from(e).forEach((r) => $e(r, t));
|
|
1112
1103
|
}
|
|
1113
|
-
function
|
|
1104
|
+
function $e(i, t) {
|
|
1114
1105
|
const e = new FileReader();
|
|
1115
1106
|
e.readAsText(i), e.onloadend = function() {
|
|
1116
1107
|
typeof e.result == "string" && t.handleFeatureChange(e.result);
|
|
1117
1108
|
};
|
|
1118
1109
|
}
|
|
1119
1110
|
var E, H, R, k;
|
|
1120
|
-
class
|
|
1111
|
+
class we extends A {
|
|
1121
1112
|
constructor() {
|
|
1122
1113
|
super();
|
|
1123
1114
|
/**
|
|
@@ -1164,7 +1155,7 @@ class _e extends A {
|
|
|
1164
1155
|
* @type {string}
|
|
1165
1156
|
*/
|
|
1166
1157
|
set layerId(e) {
|
|
1167
|
-
|
|
1158
|
+
ge(this, this.eoxMap, e, y(this, k)), g(this, k, e);
|
|
1168
1159
|
}
|
|
1169
1160
|
get layerId() {
|
|
1170
1161
|
return y(this, k);
|
|
@@ -1173,14 +1164,14 @@ class _e extends A {
|
|
|
1173
1164
|
* @onClick Event handler triggered to start drawing on the map.
|
|
1174
1165
|
*/
|
|
1175
1166
|
startDrawing() {
|
|
1176
|
-
|
|
1167
|
+
he(this);
|
|
1177
1168
|
}
|
|
1178
1169
|
/**
|
|
1179
1170
|
* @onClick Event handler triggered to discard/stop drawing
|
|
1180
1171
|
* on the map and delete the drawn shapes.
|
|
1181
1172
|
*/
|
|
1182
1173
|
discardDrawing() {
|
|
1183
|
-
|
|
1174
|
+
ue(this);
|
|
1184
1175
|
}
|
|
1185
1176
|
/**
|
|
1186
1177
|
* @param {string} text - The string representation of the features to be parsed.
|
|
@@ -1188,7 +1179,7 @@ class _e extends A {
|
|
|
1188
1179
|
*/
|
|
1189
1180
|
handleFeatureChange(e, r = !1) {
|
|
1190
1181
|
this.eoxMap.parseTextToFeature(
|
|
1191
|
-
e || JSON.stringify(
|
|
1182
|
+
e || JSON.stringify(ut),
|
|
1192
1183
|
this.drawLayer,
|
|
1193
1184
|
this.eoxMap,
|
|
1194
1185
|
r
|
|
@@ -1198,7 +1189,7 @@ class _e extends A {
|
|
|
1198
1189
|
* @param {DragEvent | Event} evt - The event object from the file input interaction.
|
|
1199
1190
|
*/
|
|
1200
1191
|
handleFilesChange(e) {
|
|
1201
|
-
|
|
1192
|
+
Ct(e, this);
|
|
1202
1193
|
}
|
|
1203
1194
|
/**
|
|
1204
1195
|
* @event onModifyEnd triggered when the modification of a shape is completed.
|
|
@@ -1211,7 +1202,7 @@ class _e extends A {
|
|
|
1211
1202
|
*/
|
|
1212
1203
|
updateGeoJSON() {
|
|
1213
1204
|
g(this, R, JSON.stringify(
|
|
1214
|
-
this.eoxMap.parseFeature(this.drawnFeatures) ||
|
|
1205
|
+
this.eoxMap.parseFeature(this.drawnFeatures) || ut,
|
|
1215
1206
|
void 0,
|
|
1216
1207
|
2
|
|
1217
1208
|
));
|
|
@@ -1220,7 +1211,7 @@ class _e extends A {
|
|
|
1220
1211
|
* Triggers different events when the drawing of a shape is completed.
|
|
1221
1212
|
*/
|
|
1222
1213
|
emitDrawnFeatures() {
|
|
1223
|
-
|
|
1214
|
+
ye(this, () => {
|
|
1224
1215
|
this.dispatchEvent(
|
|
1225
1216
|
new CustomEvent("drawupdate", { detail: this.drawnFeatures })
|
|
1226
1217
|
);
|
|
@@ -1238,12 +1229,12 @@ class _e extends A {
|
|
|
1238
1229
|
* It then calls requestUpdate to trigger a re-render.
|
|
1239
1230
|
*/
|
|
1240
1231
|
firstUpdated() {
|
|
1241
|
-
const { EoxMap: e, OlMap: r } =
|
|
1242
|
-
this.eoxMap = e, g(this, H, r), this.selectionEvents =
|
|
1232
|
+
const { EoxMap: e, OlMap: r } = ft(this, this.multipleFeatures);
|
|
1233
|
+
this.eoxMap = e, g(this, H, r), this.selectionEvents = fe(this), this.importFeatures && ve(this, this.eoxMap), this.updateGeoJSON(), this.requestUpdate();
|
|
1243
1234
|
}
|
|
1244
1235
|
updated(e) {
|
|
1245
1236
|
if (e.has("for")) {
|
|
1246
|
-
const { EoxMap: r, OlMap: s } =
|
|
1237
|
+
const { EoxMap: r, OlMap: s } = ft(this, this.multipleFeatures);
|
|
1247
1238
|
this.eoxMap = r, g(this, H, s);
|
|
1248
1239
|
}
|
|
1249
1240
|
}
|
|
@@ -1260,8 +1251,8 @@ class _e extends A {
|
|
|
1260
1251
|
return x`
|
|
1261
1252
|
<style>
|
|
1262
1253
|
:host { display: block; }
|
|
1263
|
-
${!this.unstyled &&
|
|
1264
|
-
${!this.unstyled &&
|
|
1254
|
+
${!this.unstyled && me}
|
|
1255
|
+
${!this.unstyled && ce}
|
|
1265
1256
|
</style>
|
|
1266
1257
|
|
|
1267
1258
|
<!-- Controller Component -->
|
|
@@ -1294,12 +1285,12 @@ class _e extends A {
|
|
|
1294
1285
|
@changed=${() => {
|
|
1295
1286
|
this.updateGeoJSON(), this.requestUpdate();
|
|
1296
1287
|
}}
|
|
1297
|
-
></eox-drawtools-list>` :
|
|
1288
|
+
></eox-drawtools-list>` : h}
|
|
1298
1289
|
`;
|
|
1299
1290
|
}
|
|
1300
1291
|
}
|
|
1301
1292
|
E = new WeakMap(), H = new WeakMap(), R = new WeakMap(), k = new WeakMap();
|
|
1302
|
-
customElements.define("eox-drawtools",
|
|
1293
|
+
customElements.define("eox-drawtools", we);
|
|
1303
1294
|
export {
|
|
1304
|
-
|
|
1295
|
+
we as EOxDrawTools
|
|
1305
1296
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
(function(c,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis<"u"?globalThis:c||self,l(c["eox-drawtools"]={}))})(this,function(c){"use strict";var
|
|
1
|
+
(function(c,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis<"u"?globalThis:c||self,l(c["eox-drawtools"]={}))})(this,function(c){"use strict";var we=Object.defineProperty;var Et=c=>{throw TypeError(c)};var _e=(c,l,y)=>l in c?we(c,l,{enumerable:!0,configurable:!0,writable:!0,value:y}):c[l]=y;var E=(c,l,y)=>_e(c,typeof l!="symbol"?l+"":l,y),Ht=(c,l,y)=>l.has(c)||Et("Cannot "+y);var m=(c,l,y)=>(Ht(c,l,"read from private field"),y?y.call(c):l.get(c)),H=(c,l,y)=>l.has(c)?Et("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(c):l.set(c,y),w=(c,l,y,O)=>(Ht(c,l,"write to private field"),O?O.call(c,y):l.set(c,y),y);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var
|
|
5
|
+
*/var Ct,J,q,I,L,D,U;const l=globalThis,y=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,O=Symbol(),it=new WeakMap;let kt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==O)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(y&&t===void 0){const r=e!==void 0&&e.length===1;r&&(t=it.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&it.set(e,t))}return t}toString(){return this.cssText}};const Mt=i=>new kt(typeof i=="string"?i:i+"",void 0,O),Ft=(i,t)=>{if(y)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const r=document.createElement("style"),s=l.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},rt=y?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return Mt(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:It,defineProperty:Lt,getOwnPropertyDescriptor:Ut,getOwnPropertyNames:Ot,getOwnPropertySymbols:Pt,getPrototypeOf:Nt}=Object,v=globalThis,st=v.trustedTypes,Vt=st?st.emptyScript:"",K=v.reactiveElementPolyfillSupport,P=(i,t)=>i,Q={toAttribute(i,t){switch(t){case Boolean:i=i?Vt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},nt=(i,t)=>!It(i,t),ot={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:nt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);class k 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=ot){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Lt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){const{get:s,set:n}=Ut(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 d=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ot}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Nt(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,r=[...Ot(e),...Pt(e)];for(const s of r)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const s of r)e.unshift(rt(s))}else t!==void 0&&e.push(rt(t));return e}static _$Eu(t,e){const r=e.attribute;return r===!1?void 0:typeof r=="string"?r: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._$ES=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._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ft(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostConnected)==null?void 0:r.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var n;const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){const o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Q).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;const r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=r.getPropertyOptions(s),d=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]=d.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??nt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),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.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(r=this._$EO)==null||r.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[P("elementProperties")]=new Map,k[P("finalized")]=new Map,K==null||K({ReactiveElement:k}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const N=globalThis,G=N.trustedTypes,at=G?G.createPolicy("lit-html",{createHTML:i=>i}):void 0,lt="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,ct="?"+b,Bt=`<${ct}>`,_=document,V=()=>_.createComment(""),B=i=>i===null||typeof i!="object"&&typeof i!="function",T=Array.isArray,Rt=i=>T(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",X=`[
|
|
14
|
+
\f\r]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,dt=/-->/g,ht=/>/g,x=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,ut=/"/g,yt=/^(?:script|style|textarea|title)$/i,zt=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),A=zt(1),M=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ft=new WeakMap,S=_.createTreeWalker(_,129);function gt(i,t){if(!T(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return at!==void 0?at.createHTML(t):t}const jt=(i,t)=>{const e=i.length-1,r=[];let s,n=t===2?"<svg>":t===3?"<math>":"",o=R;for(let d=0;d<e;d++){const a=i[d];let u,f,h=-1,g=0;for(;g<a.length&&(o.lastIndex=g,f=o.exec(a),f!==null);)g=o.lastIndex,o===R?f[1]==="!--"?o=dt:f[1]!==void 0?o=ht:f[2]!==void 0?(yt.test(f[2])&&(s=RegExp("</"+f[2],"g")),o=x):f[3]!==void 0&&(o=x):o===x?f[0]===">"?(o=s??R,h=-1):f[1]===void 0?h=-2:(h=o.lastIndex-f[2].length,u=f[1],o=f[3]===void 0?x:f[3]==='"'?ut:pt):o===ut||o===pt?o=x:o===dt||o===ht?o=R:(o=x,s=void 0);const $=o===x&&i[d+1].startsWith("/>")?" ":"";n+=o===R?a+Bt:h>=0?(r.push(u),a.slice(0,h)+lt+a.slice(h)+b+$):a+b+(h===-2?d:$)}return[gt(i,n+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class z{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0;const d=t.length-1,a=this.parts,[u,f]=jt(t,e);if(this.el=z.createElement(u,r),S.currentNode=this.el.content,e===2||e===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=S.nextNode())!==null&&a.length<d;){if(s.nodeType===1){if(s.hasAttributes())for(const h of s.getAttributeNames())if(h.endsWith(lt)){const g=f[o++],$=s.getAttribute(h).split(b),Z=/([.?@])?(.*)/.exec(g);a.push({type:1,index:n,name:Z[2],strings:$,ctor:Z[1]==="."?qt:Z[1]==="?"?Dt:Z[1]==="@"?Gt:W}),s.removeAttribute(h)}else h.startsWith(b)&&(a.push({type:6,index:n}),s.removeAttribute(h));if(yt.test(s.tagName)){const h=s.textContent.split(b),g=h.length-1;if(g>0){s.textContent=G?G.emptyScript:"";for(let $=0;$<g;$++)s.append(h[$],V()),S.nextNode(),a.push({type:2,index:++n});s.append(h[g],V())}}}else if(s.nodeType===8)if(s.data===ct)a.push({type:2,index:n});else{let h=-1;for(;(h=s.data.indexOf(b,h+1))!==-1;)a.push({type:7,index:n}),h+=b.length-1}n++}}static createElement(t,e){const r=_.createElement("template");return r.innerHTML=t,r}}function F(i,t,e=i,r){var o,d;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const n=B(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((d=s==null?void 0:s._$AO)==null||d.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=s:e._$Cl=s),s!==void 0&&(t=F(i,s._$AS(i,t.values),s,r)),t}class Jt{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:r}=this._$AD,s=((t==null?void 0:t.creationScope)??_).importNode(e,!0);S.currentNode=s;let n=S.nextNode(),o=0,d=0,a=r[0];for(;a!==void 0;){if(o===a.index){let u;a.type===2?u=new j(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Wt(n,this,t)),this._$AV.push(u),a=r[++d]}o!==(a==null?void 0:a.index)&&(n=S.nextNode(),o++)}return S.currentNode=_,s}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class j{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,s){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,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=F(this,t,e),B(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Rt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&B(this._$AH)?this._$AA.nextSibling.data=t:this.T(_.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=z.createElement(gt(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{const o=new Jt(s,this),d=o.u(this.options);o.p(e),this.T(d),this._$AH=o}}_$AC(t){let e=ft.get(t.strings);return e===void 0&&ft.set(t.strings,e=new z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,s=0;for(const n of t)s===e.length?e.push(r=new j(this.O(V()),this.O(V()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.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 W{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,s){const n=this.strings;let o=!1;if(n===void 0)t=F(this,t,e,0),o=!B(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{const d=t;let a,u;for(t=n[0],a=0;a<n.length-1;a++)u=F(this,d[r+a],e,a),u===M&&(u=this._$AH[a]),o||(o=!B(u)||u!==this._$AH[a]),u===p?t=p:t!==p&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}o&&!s&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class qt extends W{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class Dt extends W{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class Gt extends W{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){if((t=F(this,t,e,0)??p)===M)return;const r=this._$AH,s=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==p&&(r===p||s);s&&this.element.removeEventListener(this.name,this,r),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 Wt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const Y=N.litHtmlPolyfillSupport;Y==null||Y(z,j),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.2.1");const Zt=(i,t,e)=>{const r=(e==null?void 0:e.renderBefore)??t;let s=r._$litPart$;if(s===void 0){const n=(e==null?void 0:e.renderBefore)??null;r._$litPart$=s=new j(t.insertBefore(V(),n),n,void 0,e??{})}return s._$AI(i),s};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/class C extends k{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=
|
|
19
|
+
*/class C extends k{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=Zt(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 M}}C._$litElement$=!0,C.finalized=!0,(Ct=globalThis.litElementHydrateSupport)==null||Ct.call(globalThis,{LitElement:C});const tt=globalThis.litElementPolyfillSupport;tt==null||tt({LitElement:C}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const Kt=
|
|
23
|
+
*/const Kt=i=>(...t)=>({_$litDirective$:i,values:t});let Qt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$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 Tt={},Xt=(i,t=Tt)=>i._$AH=t;/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2021 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/const
|
|
31
|
+
*/const Yt=Kt(class extends Qt{constructor(){super(...arguments),this.key=p}render(i,t){return this.key=i,t}update(i,[t,e]){return t!==this.key&&(Xt(i),this.key=t),e}}),te=i=>{i.hoverInteraction=i.eoxMap.selectInteractions.selectHover,i.clickInteraction=i.eoxMap.selectInteractions.selectClick;const t=()=>{i.requestUpdate()};i.hoverInteraction.selectStyleLayer.on("change",t),i.clickInteraction.selectStyleLayer.on("change",t)},ee=(i,t,e)=>{if(i.clickId===t)return;const r=e?[]:[t];i.hoverInteraction.highlightById(r)},ie=(i,t)=>{i.stopPropagation();const e=Number(i.target.getAttribute("index")),r=t.drawnFeatures[e];t.drawLayer.getSource().removeFeature(r),t.drawnFeatures.splice(e,1),t.requestUpdate()},mt={duration:750},vt={type:"FeatureCollection",features:[]},re=(i,t)=>{const e=i.getId(),{clickId:r,drawLayer:s,olMap:n,clickInteraction:o}=t,d=r===e,a=i.getGeometry();if(d){const u=s.getSource().getExtent();n.getView().fit(u,mt),o.highlightById([])}else{const u=a.getExtent();o.highlightById([e]),n.getView().fit(u,mt)}t.requestUpdate()},se="ul.list-wrap { padding: 0;}ul.list-wrap li:hover,ul.list-wrap li.selected { background: var(--secondary-bg-color-hover);}ul.list-wrap li { list-style: none; padding: 4px;}ul.list-wrap li { border-bottom: 1.2px solid var(--secondary-color);}ul.list-wrap li:first-child { border-top: 1.2px solid var(--secondary-color);}ul.list-wrap li .list { width: 100%; align-items: center; justify-content: space-between; display: flex; align-items: center; cursor: pointer; font-size: small; gap: 10px;}ul.list-wrap li .list span { display: flex; align-items: center; cursor: pointer; font-size: small; flex-grow: 1;}";class bt extends C{constructor(){super();E(this,"hoverInteraction");E(this,"clickInteraction");E(this,"hoverId");E(this,"clickId");this.eoxMap=null,this.olMap=null,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.modify=null,this.unstyled=!1}_handleDelete(e){ie(e,this),this.dispatchEvent(new CustomEvent("changed",{bubbles:!0}))}_handleFeatureSelectAndDeselect(e){re(e,this)}_handleHoverFeature(e,r=!1){ee(this,e,r)}firstUpdated(){te(this)}createRenderRoot(){return this}render(){var e,r;return this.hoverId=(e=this.hoverInteraction)==null?void 0:e.selectedFids[0],this.clickId=(r=this.clickInteraction)==null?void 0:r.selectedFids[0],A`
|
|
32
32
|
<style>
|
|
33
|
-
${!this.unstyled&&
|
|
33
|
+
${!this.unstyled&&se}
|
|
34
34
|
</style>
|
|
35
35
|
<ul class="list-wrap">
|
|
36
|
-
${this.drawnFeatures.map((s,n)=>{const o=n+1,d=s.getId(),a=this.hoverId===d,u=this.clickId===d;return
|
|
36
|
+
${this.drawnFeatures.map((s,n)=>{const o=n+1,d=s.getId(),a=this.hoverId===d,u=this.clickId===d;return Yt(o,A`
|
|
37
37
|
<li
|
|
38
38
|
class="${a||u?"selected":p}"
|
|
39
39
|
@mouseover=${()=>this._handleHoverFeature(d)}
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
</li>
|
|
56
56
|
`)})}
|
|
57
57
|
</ul>
|
|
58
|
-
`}}E(
|
|
58
|
+
`}}E(bt,"properties",{eoxMap:{attribute:!1,state:!0},olMap:{attribute:!1,state:!0},draw:{attribute:!1,state:!0},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",bt);const ne=i=>{const{multipleFeatures:t,drawnFeatures:e,currentlyDrawing:r}=i,s=!t&&(e==null?void 0:e.length)>0||r,n=!(e!=null&&e.length)&&!r;return{drawDisabled:s,discardDisabled:n}},oe='button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon):not(.json-editor-btntype-*),.button:hover:not([disabled]):not(.icon) { box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.block,.button.block { display: block;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon,button[class*="json-editor-btntype-"] { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon-text.block,.button.icon-text.block { text-indent: 20px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon-text.block:before,.button.icon-text.block:before { text-indent: -54px;}button.icon:before,.button.icon:before,button[class*="json-editor-btntype-"]::before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0;}',ae='textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}input[type="text"],input[type="url"],input[type="email"],input[type="password"],input[type="text"],input[type="number"],input[type="search"],input[type="tel"],select { box-sizing: border-box; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; padding: 5px 7px; border-radius: 4px; border: 1px solid #0004;}';function le(i){navigator.clipboard.writeText(i).then(function(){},function(t){console.error("Could not copy text: ",t)})}/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright 2021 Google LLC
|
|
61
61
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
-
*/function
|
|
62
|
+
*/function $t(i,t,e){return i?t(i):e==null?void 0:e(i)}class wt extends C{constructor(){super();H(this,J,!0);H(this,q,!0);this.multipleFeatures=!1,this.drawnFeatures=[],this.importFeatures=!1,this.showEditor=!1,this.currentlyDrawing=!1,this.drawFunc=null,this.geoJSON="",this.unstyled=!1,this.select=!1}updateButtonStates(){const{drawDisabled:e,discardDisabled:r}=ne(this);w(this,J,e),w(this,q,r)}createRenderRoot(){return this}render(){this.updateButtonStates();const e=this.currentlyDrawing?"drawing":"draw";return A`
|
|
63
63
|
<style>
|
|
64
|
+
${!this.unstyled&&oe}
|
|
64
65
|
${!this.unstyled&&ae}
|
|
65
|
-
${!this.unstyled&&le}
|
|
66
66
|
</style>
|
|
67
67
|
<div class="wrap-btn">
|
|
68
68
|
<slot></slot>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
<!-- Import Button -->
|
|
92
|
-
${
|
|
92
|
+
${$t(this.importFeatures,()=>A`
|
|
93
93
|
<!-- Import Input Field : Hidden -->
|
|
94
94
|
<input
|
|
95
95
|
type="file"
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
</div>
|
|
111
111
|
|
|
112
112
|
<!-- Geo JSON Wrapper -->
|
|
113
|
-
${
|
|
113
|
+
${$t(this.showEditor,()=>A`
|
|
114
114
|
<div class="json-wrapper">
|
|
115
115
|
<!-- Geo JSON Editor -->
|
|
116
116
|
<textarea
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
<button
|
|
124
124
|
data-cy="copyBtn"
|
|
125
125
|
class="icon-copy"
|
|
126
|
-
@click=${()=>
|
|
126
|
+
@click=${()=>le(this.geoJSON)}
|
|
127
127
|
>
|
|
128
128
|
${this.unstyled?"copy":p}
|
|
129
129
|
</button>
|
|
130
130
|
</div>
|
|
131
131
|
`)}
|
|
132
|
-
`}}J=new WeakMap,q=new WeakMap,E(
|
|
132
|
+
`}}J=new WeakMap,q=new WeakMap,E(wt,"properties",{multipleFeatures:{attribute:!1,type:Boolean},drawnFeatures:{attribute:!1,state:!0,type:Array},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},drawFunc:{attribute:!1,type:Object},select:{type:Boolean},importFeatures:{attribute:"import-features",type:Boolean},showEditor:{attribute:"show-editor",type:Boolean},geoJSON:{attribute:"geo-json",type:String},unstyled:{type:Boolean}}),customElements.define("eox-drawtools-controller",wt);const ce=`
|
|
133
133
|
button.discard:before {
|
|
134
134
|
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")
|
|
135
135
|
}
|
|
@@ -174,16 +174,16 @@
|
|
|
174
174
|
color: white;
|
|
175
175
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Econtent-copy%3C/title%3E%3Cpath d='M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z' fill='white' /%3E%3C/svg%3E")
|
|
176
176
|
}
|
|
177
|
-
`,
|
|
177
|
+
`,de=i=>{(()=>{i.emitDrawnFeatures(),i.multipleFeatures||(i.draw.setActive(!1),i.selectionEvents.removeSelectionEvent(),i.currentlyDrawing=!1)})(),i.requestUpdate()},he=i=>{const t=()=>{i.drawLayer.set("isDrawingEnabled",!0),i.draw.setActive(!0),i.selectionEvents.addSelectionEvent()},e=()=>{i.currentlyDrawing=!0,i.requestUpdate()};t(),e()},pe=i=>{let t;return typeof i=="string"?t=document.querySelector(i):t=i,t},_t=(i,t)=>{var n;const r=pe(i.for),s=r.map;return i.drawLayer=r.addOrUpdateLayer({type:"Vector",properties:{id:"drawLayer",layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:"Vector"},interactions:[{type:"draw",options:{active:!1,id:"drawInteraction",type:i.type,modify:i.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}}}]}),i.draw=r.interactions.drawInteraction,i.modify=r.interactions.drawInteractionmodify,et(i,r,i.layerId),(n=i.modify)==null||n.on("modifyend",()=>i.onModifyEnd()),r.addEventListener("addfeatures",()=>de(i)),{EoxMap:r,OlMap:s}},ue=i=>{const t=()=>{i.drawnFeatures=[],setTimeout(()=>{i.draw.setActive(!1),i.selectionEvents.removeSelectionEvent()},200),i.drawLayer.getSource().clear(),i.geoJSON=null},e=()=>{i.emitDrawnFeatures(),i.currentlyDrawing=!1,i.requestUpdate()};t(),e()},ye=(i,t)=>{setTimeout(()=>{i.drawnFeatures=i.drawLayer.getSource().getFeatures(),i.updateGeoJSON(),i.requestUpdate(),t()},0)},fe=i=>{const t=s=>{(s==null?void 0:s.detail.id)!=="SelectLayerClickInteraction"||!s.detail.feature||(i.drawLayer.getSource().addFeature(s.detail.feature),i.eoxMap.dispatchEvent(new CustomEvent("addfeatures",{detail:s.detail})))};return{addSelectionEvent:()=>{i.layerId&&(i.eoxMap.selectInteractions.SelectLayerHoverInteraction.setActive(!0),i.eoxMap.addEventListener("select",t))},removeSelectionEvent:()=>{var n;const s=(n=i.eoxMap.selectInteractions)==null?void 0:n.SelectLayerHoverInteraction;s&&(s.selectedFids=[],s.setActive(!1)),i.eoxMap.removeEventListener("select",t)}}},et=(i,t,e)=>{if(!e||!t)return;const r=JSON.parse(JSON.stringify(t.getLayerById(e).get("_jsonDefinition")))||null;if(!r){console.error(`Layer with id ${e} not found`);return}const s={type:"select",active:!1,options:{id:"SelectLayerHoverInteraction",condition:"pointermove",active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"#3399CC","stroke-width":2.5}}},n={type:"select",options:{id:"SelectLayerClickInteraction",condition:"click",multi:i.multipleFeatures,modify:i.allowModify,active:!1,style:{"fill-color":"rgba(0, 0, 0,0.0)","stroke-color":"rgba(0, 0, 0,0.0)"}}};r.interactions=[s,n],t.addOrUpdateLayer(r);const o=i.draw;i.draw=t.selectInteractions.SelectLayerClickInteraction,setTimeout(()=>{o.setActive(!1),t.selectInteractions.SelectLayerClickInteraction.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction.setActive(!1)},200)},ge=(i,t,e,r)=>{if(t){if(e){r&&e!==r&&xt(i,t),et(i,t,e);return}if(!e&&r){xt(i,t);return}}};function xt(i,t){t&&(i.discardDrawing(),i.selectionEvents.removeSelectionEvent(),i.draw=t.interactions.drawInteraction,t.selectInteractions.SelectLayerClickInteraction.remove(),t.selectInteractions.SelectLayerHoverInteraction.remove())}const me=':root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-size: normal; font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { --font-size: 1rem; font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem; font-size: var(--font-size);}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}';function ve(i,t){function e(n){n.preventDefault(),n.stopPropagation()}function r(n){n.srcElement.style.opacity="0.4"}function s(n){n.srcElement.style.opacity="1"}["dragenter","dragover","dragleave","drop"].forEach(n=>{t.addEventListener(n,e,!1),["dragenter","dragover"].includes(n)?t.addEventListener(n,r,!1):t.addEventListener(n,s,!1)}),t.addEventListener("drop",n=>At(n,i),!1)}function be(i){i.preventDefault(),i.stopPropagation()}function At(i,t){be(i);const e=i.dataTransfer?i.dataTransfer.files:i.target.files;Array.from(e).forEach(r=>$e(r,t))}function $e(i,t){const e=new FileReader;e.readAsText(i),e.onloadend=function(){typeof e.result=="string"&&t.handleFeatureChange(e.result)}}class St extends C{constructor(){super();H(this,I);H(this,L);H(this,D);H(this,U);this.allowModify=!1,this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.layerId="",this.drawnFeatures=[],this.modify=null,this.multipleFeatures=!1,this.importFeatures=!1,this.showEditor=!1,this.showList=!1,this.type="Polygon",this.unstyled=!1,this.noShadow=!1,this.selectionEvents=null}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},layerId:{attribute:"layer-id",type:String},drawnFeatures:{attribute:!1,state:!0,type:Array},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},importFeatures:{attribute:"import-features",type:Boolean},showEditor:{attribute:"show-editor",type:Boolean},showList:{attribute:"show-list",type:Boolean},noShadow:{type:Boolean},type:{type:String},unstyled:{type:Boolean}}}set layerId(e){ge(this,this.eoxMap,e,m(this,U)),w(this,U,e)}get layerId(){return m(this,U)}startDrawing(){he(this)}discardDrawing(){ue(this)}handleFeatureChange(e,r=!1){this.eoxMap.parseTextToFeature(e||JSON.stringify(vt),this.drawLayer,this.eoxMap,r)}handleFilesChange(e){At(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){w(this,D,JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||vt,void 0,2))}emitDrawnFeatures(){ye(this,()=>{this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}firstUpdated(){const{EoxMap:e,OlMap:r}=_t(this,this.multipleFeatures);this.eoxMap=e,w(this,L,r),this.selectionEvents=fe(this),this.importFeatures&&ve(this,this.eoxMap),this.updateGeoJSON(),this.requestUpdate()}updated(e){if(e.has("for")){const{EoxMap:r,OlMap:s}=_t(this,this.multipleFeatures);this.eoxMap=r,w(this,L,s)}}get eoxMap(){return m(this,I)}set eoxMap(e){const r=m(this,I);w(this,I,e),this.requestUpdate("eoxMap",r)}render(){var e;return A`
|
|
178
178
|
<style>
|
|
179
179
|
:host { display: block; }
|
|
180
|
-
${!this.unstyled&&
|
|
181
|
-
${!this.unstyled&&
|
|
180
|
+
${!this.unstyled&&me}
|
|
181
|
+
${!this.unstyled&&ce}
|
|
182
182
|
</style>
|
|
183
183
|
|
|
184
184
|
<!-- Controller Component -->
|
|
185
185
|
<eox-drawtools-controller
|
|
186
|
-
.drawFunc=${{start:()=>this.startDrawing(),discard:()=>this.discardDrawing(),editor:
|
|
186
|
+
.drawFunc=${{start:()=>this.startDrawing(),discard:()=>this.discardDrawing(),editor:r=>this.handleFeatureChange(r.target.value,!0),import:r=>this.handleFilesChange(r)}}
|
|
187
187
|
?select=${!!this.layerId}
|
|
188
188
|
.unstyled=${this.unstyled}
|
|
189
189
|
.drawnFeatures=${this.drawnFeatures}
|
|
@@ -205,4 +205,4 @@
|
|
|
205
205
|
.unstyled=${this.unstyled}
|
|
206
206
|
@changed=${()=>{this.updateGeoJSON(),this.requestUpdate()}}
|
|
207
207
|
></eox-drawtools-list>`:p}
|
|
208
|
-
`}}I=new WeakMap,L=new WeakMap,D=new WeakMap,U=new WeakMap,customElements.define("eox-drawtools",
|
|
208
|
+
`}}I=new WeakMap,L=new WeakMap,D=new WeakMap,U=new WeakMap,customElements.define("eox-drawtools",St),c.EOxDrawTools=St,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getJsonLayer } from "../../../../../utils";
|
|
2
1
|
import { initSelection } from ".";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -17,7 +16,7 @@ const handleLayerId = (EoxDrawTool, EoxMap, updatedLayerId, oldLayerId) => {
|
|
|
17
16
|
|
|
18
17
|
if (updatedLayerId) {
|
|
19
18
|
if (oldLayerId && updatedLayerId !== oldLayerId) {
|
|
20
|
-
exitSelection(EoxDrawTool, EoxMap
|
|
19
|
+
exitSelection(EoxDrawTool, EoxMap);
|
|
21
20
|
initSelection(EoxDrawTool, EoxMap, updatedLayerId);
|
|
22
21
|
} else {
|
|
23
22
|
initSelection(EoxDrawTool, EoxMap, updatedLayerId);
|
|
@@ -26,7 +25,7 @@ const handleLayerId = (EoxDrawTool, EoxMap, updatedLayerId, oldLayerId) => {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
if (!updatedLayerId && oldLayerId) {
|
|
29
|
-
exitSelection(EoxDrawTool, EoxMap
|
|
28
|
+
exitSelection(EoxDrawTool, EoxMap);
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
31
|
};
|
|
@@ -38,18 +37,16 @@ export default handleLayerId;
|
|
|
38
37
|
*
|
|
39
38
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool
|
|
40
39
|
* @param {import("@eox/map").EOxMap} EoxMap
|
|
41
|
-
* @param {string} oldLayerId
|
|
42
40
|
*/
|
|
43
|
-
function exitSelection(EoxDrawTool, EoxMap
|
|
41
|
+
function exitSelection(EoxDrawTool, EoxMap) {
|
|
44
42
|
if (!EoxMap) {
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
|
-
|
|
45
|
+
EoxDrawTool.discardDrawing();
|
|
46
|
+
EoxDrawTool.selectionEvents.removeSelectionEvent();
|
|
48
47
|
EoxDrawTool.draw = /** @type {import("ol/interaction").Draw} */ (
|
|
49
48
|
EoxMap.interactions["drawInteraction"]
|
|
50
49
|
);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
EoxMap.addOrUpdateLayer(selectionLayer);
|
|
54
|
-
}
|
|
50
|
+
EoxMap.selectInteractions["SelectLayerClickInteraction"].remove();
|
|
51
|
+
EoxMap.selectInteractions["SelectLayerHoverInteraction"].remove();
|
|
55
52
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getJsonLayer } from "../../../../../utils";
|
|
2
1
|
/**
|
|
3
2
|
* Initializes the selection interactions for the given layer ID to the DrawTool.
|
|
4
3
|
*
|
|
@@ -10,7 +9,14 @@ const initSelection = (EoxDrawTool, EoxMap, updatedLayerId) => {
|
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const selectionLayer =
|
|
12
|
+
const selectionLayer =
|
|
13
|
+
JSON.parse(
|
|
14
|
+
JSON.stringify(
|
|
15
|
+
/** @type {import("../../../../map/src/main").EoxLayer} */ (
|
|
16
|
+
EoxMap.getLayerById(updatedLayerId).get("_jsonDefinition")
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
) || null;
|
|
14
20
|
if (!selectionLayer) {
|
|
15
21
|
console.error(`Layer with id ${updatedLayerId} not found`);
|
|
16
22
|
return;
|