@eox/drawtools 0.2.0 → 0.3.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 +162 -182
- package/dist/eox-drawtools.umd.cjs +15 -15
- package/package.json +1 -1
package/dist/eox-drawtools.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var _t = Object.defineProperty;
|
|
2
2
|
var $t = (r, t, e) => t in r ? _t(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
-
var
|
|
3
|
+
var p = (r, t, e) => ($t(r, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2019 Google LLC
|
|
7
7
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const D = window, Q = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), G = /* @__PURE__ */ new WeakMap();
|
|
10
10
|
let vt = class {
|
|
11
11
|
constructor(t, e, i) {
|
|
12
12
|
if (this._$cssResult$ = !0, i !== ht)
|
|
@@ -16,9 +16,9 @@ let vt = class {
|
|
|
16
16
|
get styleSheet() {
|
|
17
17
|
let t = this.o;
|
|
18
18
|
const e = this.t;
|
|
19
|
-
if (
|
|
19
|
+
if (Q && t === void 0) {
|
|
20
20
|
const i = e !== void 0 && e.length === 1;
|
|
21
|
-
i && (t =
|
|
21
|
+
i && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && G.set(e, t));
|
|
22
22
|
}
|
|
23
23
|
return t;
|
|
24
24
|
}
|
|
@@ -27,11 +27,11 @@ let vt = class {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const yt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, ht), ft = (r, t) => {
|
|
30
|
-
|
|
31
|
-
const i = document.createElement("style"), s =
|
|
30
|
+
Q ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
|
|
31
|
+
const i = document.createElement("style"), s = D.litNonce;
|
|
32
32
|
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
|
|
33
33
|
});
|
|
34
|
-
}, X =
|
|
34
|
+
}, X = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
|
35
35
|
let e = "";
|
|
36
36
|
for (const i of t.cssRules)
|
|
37
37
|
e += i.cssText;
|
|
@@ -43,7 +43,7 @@ const yt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, ht), ft = (r
|
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
44
|
*/
|
|
45
45
|
var j;
|
|
46
|
-
const
|
|
46
|
+
const k = window, Y = k.trustedTypes, gt = Y ? Y.emptyScript : "", tt = k.reactiveElementPolyfillSupport, K = { toAttribute(r, t) {
|
|
47
47
|
switch (t) {
|
|
48
48
|
case Boolean:
|
|
49
49
|
r = r ? gt : null;
|
|
@@ -72,7 +72,7 @@ const I = window, Y = I.trustedTypes, gt = Y ? Y.emptyScript : "", tt = I.reacti
|
|
|
72
72
|
}
|
|
73
73
|
return e;
|
|
74
74
|
} }, dt = (r, t) => t !== r && (t == t || r == r), z = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged: dt }, J = "finalized";
|
|
75
|
-
let
|
|
75
|
+
let w = class extends HTMLElement {
|
|
76
76
|
constructor() {
|
|
77
77
|
super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
|
|
78
78
|
}
|
|
@@ -98,8 +98,8 @@ let E = class extends HTMLElement {
|
|
|
98
98
|
return { get() {
|
|
99
99
|
return this[e];
|
|
100
100
|
}, set(s) {
|
|
101
|
-
const
|
|
102
|
-
this[e] = s, this.requestUpdate(t,
|
|
101
|
+
const o = this[t];
|
|
102
|
+
this[e] = s, this.requestUpdate(t, o, i);
|
|
103
103
|
}, configurable: !0, enumerable: !0 };
|
|
104
104
|
}
|
|
105
105
|
static getPropertyOptions(t) {
|
|
@@ -174,18 +174,18 @@ let E = class extends HTMLElement {
|
|
|
174
174
|
}
|
|
175
175
|
_$EO(t, e, i = z) {
|
|
176
176
|
var s;
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
this._$El = t,
|
|
177
|
+
const o = this.constructor._$Ep(t, i);
|
|
178
|
+
if (o !== void 0 && i.reflect === !0) {
|
|
179
|
+
const n = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : K).toAttribute(e, i.type);
|
|
180
|
+
this._$El = t, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$El = null;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
_$AK(t, e) {
|
|
184
184
|
var i;
|
|
185
|
-
const s = this.constructor,
|
|
186
|
-
if (
|
|
187
|
-
const
|
|
188
|
-
this._$El =
|
|
185
|
+
const s = this.constructor, o = s._$Ev.get(t);
|
|
186
|
+
if (o !== void 0 && this._$El !== o) {
|
|
187
|
+
const n = s.getPropertyOptions(o), d = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? n.converter : K;
|
|
188
|
+
this._$El = o, this[o] = d.fromAttribute(e, n.type), this._$El = null;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
requestUpdate(t, e, i) {
|
|
@@ -209,13 +209,13 @@ let E = class extends HTMLElement {
|
|
|
209
209
|
var t;
|
|
210
210
|
if (!this.isUpdatePending)
|
|
211
211
|
return;
|
|
212
|
-
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s,
|
|
212
|
+
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0);
|
|
213
213
|
let e = !1;
|
|
214
214
|
const i = this._$AL;
|
|
215
215
|
try {
|
|
216
216
|
e = this.shouldUpdate(i), e ? (this.willUpdate(i), (t = this._$ES) === null || t === void 0 || t.forEach((s) => {
|
|
217
|
-
var
|
|
218
|
-
return (
|
|
217
|
+
var o;
|
|
218
|
+
return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s);
|
|
219
219
|
}), this.update(i)) : this._$Ek();
|
|
220
220
|
} catch (s) {
|
|
221
221
|
throw e = !1, this._$Ek(), s;
|
|
@@ -251,27 +251,27 @@ let E = class extends HTMLElement {
|
|
|
251
251
|
firstUpdated(t) {
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
|
-
|
|
254
|
+
w[J] = !0, w.elementProperties = /* @__PURE__ */ new Map(), w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, tt == null || tt({ ReactiveElement: w }), ((j = k.reactiveElementVersions) !== null && j !== void 0 ? j : k.reactiveElementVersions = []).push("1.6.2");
|
|
255
255
|
/**
|
|
256
256
|
* @license
|
|
257
257
|
* Copyright 2017 Google LLC
|
|
258
258
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
259
259
|
*/
|
|
260
260
|
var B;
|
|
261
|
-
const
|
|
262
|
-
\f\r]`,
|
|
263
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g,
|
|
261
|
+
const R = window, E = R.trustedTypes, et = E ? E.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, ct = "?" + f, At = `<${ct}>`, m = document, U = () => m.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", ut = Array.isArray, mt = (r) => ut(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", F = `[
|
|
262
|
+
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, st = />/g, g = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^
|
|
263
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, nt = /"/g, pt = /^(?:script|style|textarea|title)$/i, wt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Et = wt(1), S = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), A = m.createTreeWalker(m, 129, null, !1), St = (r, t) => {
|
|
264
264
|
const e = r.length - 1, i = [];
|
|
265
|
-
let s,
|
|
265
|
+
let s, o = t === 2 ? "<svg>" : "", n = x;
|
|
266
266
|
for (let l = 0; l < e; l++) {
|
|
267
267
|
const a = r[l];
|
|
268
|
-
let y, h, c = -1,
|
|
269
|
-
for (;
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
|
|
268
|
+
let y, h, c = -1, _ = 0;
|
|
269
|
+
for (; _ < a.length && (n.lastIndex = _, h = n.exec(a), h !== null); )
|
|
270
|
+
_ = n.lastIndex, n === x ? h[1] === "!--" ? n = it : h[1] !== void 0 ? n = st : h[2] !== void 0 ? (pt.test(h[2]) && (s = RegExp("</" + h[2], "g")), n = g) : h[3] !== void 0 && (n = g) : n === g ? h[0] === ">" ? (n = s ?? x, c = -1) : h[1] === void 0 ? c = -2 : (c = n.lastIndex - h[2].length, y = h[1], n = h[3] === void 0 ? g : h[3] === '"' ? nt : rt) : n === nt || n === rt ? n = g : n === it || n === st ? n = x : (n = g, s = void 0);
|
|
271
|
+
const O = n === g && r[l + 1].startsWith("/>") ? " " : "";
|
|
272
|
+
o += n === x ? a + At : c >= 0 ? (i.push(y), a.slice(0, c) + Z + a.slice(c) + f + O) : a + f + (c === -2 ? (i.push(void 0), l) : O);
|
|
273
273
|
}
|
|
274
|
-
const d =
|
|
274
|
+
const d = o + (r[e] || "<?>") + (t === 2 ? "</svg>" : "");
|
|
275
275
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
|
276
276
|
throw Error("invalid template strings array");
|
|
277
277
|
return [et !== void 0 ? et.createHTML(d) : d, i];
|
|
@@ -280,60 +280,60 @@ class H {
|
|
|
280
280
|
constructor({ strings: t, _$litType$: e }, i) {
|
|
281
281
|
let s;
|
|
282
282
|
this.parts = [];
|
|
283
|
-
let
|
|
283
|
+
let o = 0, n = 0;
|
|
284
284
|
const d = t.length - 1, l = this.parts, [a, y] = St(t, e);
|
|
285
|
-
if (this.el = H.createElement(a, i),
|
|
285
|
+
if (this.el = H.createElement(a, i), A.currentNode = this.el.content, e === 2) {
|
|
286
286
|
const h = this.el.content, c = h.firstChild;
|
|
287
287
|
c.remove(), h.append(...c.childNodes);
|
|
288
288
|
}
|
|
289
|
-
for (; (s =
|
|
289
|
+
for (; (s = A.nextNode()) !== null && l.length < d; ) {
|
|
290
290
|
if (s.nodeType === 1) {
|
|
291
291
|
if (s.hasAttributes()) {
|
|
292
292
|
const h = [];
|
|
293
293
|
for (const c of s.getAttributeNames())
|
|
294
294
|
if (c.endsWith(Z) || c.startsWith(f)) {
|
|
295
|
-
const
|
|
296
|
-
if (h.push(c),
|
|
297
|
-
const
|
|
298
|
-
l.push({ type: 1, index:
|
|
295
|
+
const _ = y[n++];
|
|
296
|
+
if (h.push(c), _ !== void 0) {
|
|
297
|
+
const O = s.getAttribute(_.toLowerCase() + Z).split(f), T = /([.?@])?(.*)/.exec(_);
|
|
298
|
+
l.push({ type: 1, index: o, name: T[2], strings: O, ctor: T[1] === "." ? Ct : T[1] === "?" ? Pt : T[1] === "@" ? Ut : I });
|
|
299
299
|
} else
|
|
300
|
-
l.push({ type: 6, index:
|
|
300
|
+
l.push({ type: 6, index: o });
|
|
301
301
|
}
|
|
302
302
|
for (const c of h)
|
|
303
303
|
s.removeAttribute(c);
|
|
304
304
|
}
|
|
305
|
-
if (
|
|
305
|
+
if (pt.test(s.tagName)) {
|
|
306
306
|
const h = s.textContent.split(f), c = h.length - 1;
|
|
307
307
|
if (c > 0) {
|
|
308
|
-
s.textContent =
|
|
309
|
-
for (let
|
|
310
|
-
s.append(h[
|
|
311
|
-
s.append(h[c],
|
|
308
|
+
s.textContent = E ? E.emptyScript : "";
|
|
309
|
+
for (let _ = 0; _ < c; _++)
|
|
310
|
+
s.append(h[_], U()), A.nextNode(), l.push({ type: 2, index: ++o });
|
|
311
|
+
s.append(h[c], U());
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
} else if (s.nodeType === 8)
|
|
315
315
|
if (s.data === ct)
|
|
316
|
-
l.push({ type: 2, index:
|
|
316
|
+
l.push({ type: 2, index: o });
|
|
317
317
|
else {
|
|
318
318
|
let h = -1;
|
|
319
319
|
for (; (h = s.data.indexOf(f, h + 1)) !== -1; )
|
|
320
|
-
l.push({ type: 7, index:
|
|
320
|
+
l.push({ type: 7, index: o }), h += f.length - 1;
|
|
321
321
|
}
|
|
322
|
-
|
|
322
|
+
o++;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
static createElement(t, e) {
|
|
326
|
-
const i =
|
|
326
|
+
const i = m.createElement("template");
|
|
327
327
|
return i.innerHTML = t, i;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
var s,
|
|
332
|
-
if (t ===
|
|
330
|
+
function b(r, t, e = r, i) {
|
|
331
|
+
var s, o, n, d;
|
|
332
|
+
if (t === S)
|
|
333
333
|
return t;
|
|
334
334
|
let l = i !== void 0 ? (s = e._$Co) === null || s === void 0 ? void 0 : s[i] : e._$Cl;
|
|
335
|
-
const a =
|
|
336
|
-
return (l == null ? void 0 : l.constructor) !== a && ((
|
|
335
|
+
const a = M(t) ? void 0 : t._$litDirective$;
|
|
336
|
+
return (l == null ? void 0 : l.constructor) !== a && ((o = l == null ? void 0 : l._$AO) === null || o === void 0 || o.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((n = (d = e)._$Co) !== null && n !== void 0 ? n : d._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = b(r, l._$AS(r, t.values), l, i)), t;
|
|
337
337
|
}
|
|
338
338
|
class bt {
|
|
339
339
|
constructor(t, e) {
|
|
@@ -347,17 +347,17 @@ class bt {
|
|
|
347
347
|
}
|
|
348
348
|
u(t) {
|
|
349
349
|
var e;
|
|
350
|
-
const { el: { content: i }, parts: s } = this._$AD,
|
|
351
|
-
|
|
352
|
-
let
|
|
350
|
+
const { el: { content: i }, parts: s } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : m).importNode(i, !0);
|
|
351
|
+
A.currentNode = o;
|
|
352
|
+
let n = A.nextNode(), d = 0, l = 0, a = s[0];
|
|
353
353
|
for (; a !== void 0; ) {
|
|
354
354
|
if (d === a.index) {
|
|
355
355
|
let y;
|
|
356
|
-
a.type === 2 ? y = new
|
|
356
|
+
a.type === 2 ? y = new N(n, n.nextSibling, this, t) : a.type === 1 ? y = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (y = new Mt(n, this, t)), this._$AV.push(y), a = s[++l];
|
|
357
357
|
}
|
|
358
|
-
d !== (a == null ? void 0 : a.index) && (
|
|
358
|
+
d !== (a == null ? void 0 : a.index) && (n = A.nextNode(), d++);
|
|
359
359
|
}
|
|
360
|
-
return
|
|
360
|
+
return A.currentNode = m, o;
|
|
361
361
|
}
|
|
362
362
|
v(t) {
|
|
363
363
|
let e = 0;
|
|
@@ -365,10 +365,10 @@ class bt {
|
|
|
365
365
|
i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
class
|
|
368
|
+
class N {
|
|
369
369
|
constructor(t, e, i, s) {
|
|
370
|
-
var
|
|
371
|
-
this.type = 2, this._$AH =
|
|
370
|
+
var o;
|
|
371
|
+
this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cp = (o = s == null ? void 0 : s.isConnected) === null || o === void 0 || o;
|
|
372
372
|
}
|
|
373
373
|
get _$AU() {
|
|
374
374
|
var t, e;
|
|
@@ -386,7 +386,7 @@ class D {
|
|
|
386
386
|
return this._$AB;
|
|
387
387
|
}
|
|
388
388
|
_$AI(t, e = this) {
|
|
389
|
-
t =
|
|
389
|
+
t = b(this, t, e), M(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : mt(t) ? this.T(t) : this._(t);
|
|
390
390
|
}
|
|
391
391
|
k(t) {
|
|
392
392
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -395,28 +395,28 @@ class D {
|
|
|
395
395
|
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
|
|
396
396
|
}
|
|
397
397
|
_(t) {
|
|
398
|
-
this._$AH !==
|
|
398
|
+
this._$AH !== u && M(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t;
|
|
399
399
|
}
|
|
400
400
|
g(t) {
|
|
401
401
|
var e;
|
|
402
|
-
const { values: i, _$litType$: s } = t,
|
|
403
|
-
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) ===
|
|
402
|
+
const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = H.createElement(s.h, this.options)), s);
|
|
403
|
+
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o)
|
|
404
404
|
this._$AH.v(i);
|
|
405
405
|
else {
|
|
406
|
-
const
|
|
407
|
-
|
|
406
|
+
const n = new bt(o, this), d = n.u(this.options);
|
|
407
|
+
n.v(i), this.$(d), this._$AH = n;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
_$AC(t) {
|
|
411
|
-
let e =
|
|
412
|
-
return e === void 0 &&
|
|
411
|
+
let e = ot.get(t.strings);
|
|
412
|
+
return e === void 0 && ot.set(t.strings, e = new H(t)), e;
|
|
413
413
|
}
|
|
414
414
|
T(t) {
|
|
415
|
-
|
|
415
|
+
ut(this._$AH) || (this._$AH = [], this._$AR());
|
|
416
416
|
const e = this._$AH;
|
|
417
417
|
let i, s = 0;
|
|
418
|
-
for (const
|
|
419
|
-
s === e.length ? e.push(i = new
|
|
418
|
+
for (const o of t)
|
|
419
|
+
s === e.length ? e.push(i = new N(this.k(U()), this.k(U()), this, this.options)) : i = e[s], i._$AI(o), s++;
|
|
420
420
|
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
|
|
421
421
|
}
|
|
422
422
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -431,9 +431,9 @@ class D {
|
|
|
431
431
|
this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
class
|
|
435
|
-
constructor(t, e, i, s,
|
|
436
|
-
this.type = 1, this._$AH =
|
|
434
|
+
class I {
|
|
435
|
+
constructor(t, e, i, s, o) {
|
|
436
|
+
this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
|
|
437
437
|
}
|
|
438
438
|
get tagName() {
|
|
439
439
|
return this.element.tagName;
|
|
@@ -442,56 +442,56 @@ class R {
|
|
|
442
442
|
return this._$AM._$AU;
|
|
443
443
|
}
|
|
444
444
|
_$AI(t, e = this, i, s) {
|
|
445
|
-
const
|
|
446
|
-
let
|
|
447
|
-
if (
|
|
448
|
-
t =
|
|
445
|
+
const o = this.strings;
|
|
446
|
+
let n = !1;
|
|
447
|
+
if (o === void 0)
|
|
448
|
+
t = b(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== S, n && (this._$AH = t);
|
|
449
449
|
else {
|
|
450
450
|
const d = t;
|
|
451
451
|
let l, a;
|
|
452
|
-
for (t =
|
|
453
|
-
a =
|
|
452
|
+
for (t = o[0], l = 0; l < o.length - 1; l++)
|
|
453
|
+
a = b(this, d[i + l], e, l), a === S && (a = this._$AH[l]), n || (n = !M(a) || a !== this._$AH[l]), a === u ? t = u : t !== u && (t += (a ?? "") + o[l + 1]), this._$AH[l] = a;
|
|
454
454
|
}
|
|
455
|
-
|
|
455
|
+
n && !s && this.j(t);
|
|
456
456
|
}
|
|
457
457
|
j(t) {
|
|
458
|
-
t ===
|
|
458
|
+
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
class Ct extends
|
|
461
|
+
class Ct extends I {
|
|
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 === u ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
const
|
|
470
|
-
class
|
|
469
|
+
const xt = E ? E.emptyScript : "";
|
|
470
|
+
class Pt extends I {
|
|
471
471
|
constructor() {
|
|
472
472
|
super(...arguments), this.type = 4;
|
|
473
473
|
}
|
|
474
474
|
j(t) {
|
|
475
|
-
t && t !==
|
|
475
|
+
t && t !== u ? this.element.setAttribute(this.name, xt) : this.element.removeAttribute(this.name);
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
class
|
|
479
|
-
constructor(t, e, i, s,
|
|
480
|
-
super(t, e, i, s,
|
|
478
|
+
class Ut extends I {
|
|
479
|
+
constructor(t, e, i, s, o) {
|
|
480
|
+
super(t, e, i, s, o), this.type = 5;
|
|
481
481
|
}
|
|
482
482
|
_$AI(t, e = this) {
|
|
483
483
|
var i;
|
|
484
|
-
if ((t = (i =
|
|
484
|
+
if ((t = (i = b(this, t, e, 0)) !== null && i !== void 0 ? i : u) === S)
|
|
485
485
|
return;
|
|
486
|
-
const s = this._$AH,
|
|
487
|
-
|
|
486
|
+
const s = this._$AH, o = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== u && (s === u || o);
|
|
487
|
+
o && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
488
488
|
}
|
|
489
489
|
handleEvent(t) {
|
|
490
490
|
var e, i;
|
|
491
491
|
typeof this._$AH == "function" ? this._$AH.call((i = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && i !== void 0 ? i : this.element, t) : this._$AH.handleEvent(t);
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
class
|
|
494
|
+
class Mt {
|
|
495
495
|
constructor(t, e, i) {
|
|
496
496
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
|
|
497
497
|
}
|
|
@@ -499,20 +499,20 @@ class Ut {
|
|
|
499
499
|
return this._$AM._$AU;
|
|
500
500
|
}
|
|
501
501
|
_$AI(t) {
|
|
502
|
-
|
|
502
|
+
b(this, t);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
const lt =
|
|
506
|
-
lt == null || lt(H,
|
|
505
|
+
const lt = R.litHtmlPolyfillSupport;
|
|
506
|
+
lt == null || lt(H, N), ((B = R.litHtmlVersions) !== null && B !== void 0 ? B : R.litHtmlVersions = []).push("2.7.4");
|
|
507
507
|
const Ht = (r, t, e) => {
|
|
508
508
|
var i, s;
|
|
509
|
-
const
|
|
510
|
-
let
|
|
511
|
-
if (
|
|
509
|
+
const o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
|
|
510
|
+
let n = o._$litPart$;
|
|
511
|
+
if (n === void 0) {
|
|
512
512
|
const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
|
|
513
|
-
|
|
513
|
+
o._$litPart$ = n = new N(t.insertBefore(U(), d), d, void 0, e ?? {});
|
|
514
514
|
}
|
|
515
|
-
return
|
|
515
|
+
return n._$AI(r), n;
|
|
516
516
|
};
|
|
517
517
|
/**
|
|
518
518
|
* @license
|
|
@@ -520,7 +520,7 @@ const Ht = (r, t, e) => {
|
|
|
520
520
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
521
521
|
*/
|
|
522
522
|
var q, V;
|
|
523
|
-
class
|
|
523
|
+
class P extends w {
|
|
524
524
|
constructor() {
|
|
525
525
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
526
526
|
}
|
|
@@ -542,22 +542,22 @@ class x extends E {
|
|
|
542
542
|
super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
|
|
543
543
|
}
|
|
544
544
|
render() {
|
|
545
|
-
return
|
|
545
|
+
return S;
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
|
|
548
|
+
P.finalized = !0, P._$litElement$ = !0, (q = globalThis.litElementHydrateSupport) === null || q === void 0 || q.call(globalThis, { LitElement: P });
|
|
549
549
|
const at = globalThis.litElementPolyfillSupport;
|
|
550
|
-
at == null || at({ LitElement:
|
|
550
|
+
at == null || at({ LitElement: P });
|
|
551
551
|
((V = globalThis.litElementVersions) !== null && V !== void 0 ? V : globalThis.litElementVersions = []).push("3.3.2");
|
|
552
552
|
/**
|
|
553
553
|
* @license
|
|
554
554
|
* Copyright 2017 Google LLC
|
|
555
555
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
556
556
|
*/
|
|
557
|
-
const
|
|
558
|
-
const { kind: s, elements:
|
|
559
|
-
return { kind: s, elements:
|
|
560
|
-
customElements.define(e,
|
|
557
|
+
const Nt = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(r, t) : ((e, i) => {
|
|
558
|
+
const { kind: s, elements: o } = i;
|
|
559
|
+
return { kind: s, elements: o, finisher(n) {
|
|
560
|
+
customElements.define(e, n);
|
|
561
561
|
} };
|
|
562
562
|
})(r, t);
|
|
563
563
|
/**
|
|
@@ -565,24 +565,24 @@ const Dt = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.def
|
|
|
565
565
|
* Copyright 2017 Google LLC
|
|
566
566
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
567
567
|
*/
|
|
568
|
-
const
|
|
568
|
+
const Ot = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
|
|
569
569
|
e.createProperty(t.key, r);
|
|
570
570
|
} } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
|
|
571
571
|
typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
|
|
572
572
|
}, finisher(e) {
|
|
573
573
|
e.createProperty(t.key, r);
|
|
574
|
-
} },
|
|
574
|
+
} }, Tt = (r, t, e) => {
|
|
575
575
|
t.constructor.createProperty(e, r);
|
|
576
576
|
};
|
|
577
577
|
function L(r) {
|
|
578
|
-
return (t, e) => e !== void 0 ?
|
|
578
|
+
return (t, e) => e !== void 0 ? Tt(r, t, e) : Ot(r, t);
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
581
|
* @license
|
|
582
582
|
* Copyright 2017 Google LLC
|
|
583
583
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
584
584
|
*/
|
|
585
|
-
function
|
|
585
|
+
function C(r) {
|
|
586
586
|
return L({ ...r, state: !0 });
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
@@ -592,53 +592,42 @@ function w(r) {
|
|
|
592
592
|
*/
|
|
593
593
|
var W;
|
|
594
594
|
((W = window.HTMLSlotElement) === null || W === void 0 ? void 0 : W.prototype.assignedElements) != null;
|
|
595
|
-
const
|
|
595
|
+
const Dt = `
|
|
596
596
|
:host {
|
|
597
597
|
display: block;
|
|
598
598
|
}
|
|
599
599
|
`;
|
|
600
|
-
var
|
|
601
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
602
|
-
(
|
|
603
|
-
return i && s &&
|
|
600
|
+
var kt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, v = (r, t, e, i) => {
|
|
601
|
+
for (var s = i > 1 ? void 0 : i ? Rt(t, e) : t, o = r.length - 1, n; o >= 0; o--)
|
|
602
|
+
(n = r[o]) && (s = (i ? n(t, e, s) : n(s)) || s);
|
|
603
|
+
return i && s && kt(t, e, s), s;
|
|
604
604
|
};
|
|
605
|
-
let
|
|
605
|
+
let $ = class extends P {
|
|
606
606
|
constructor() {
|
|
607
607
|
super(...arguments);
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
u(this, "_modify");
|
|
620
|
-
}
|
|
621
|
-
async _dynamicImport() {
|
|
622
|
-
const t = this._drawLayer.getSource(), { Draw: e, Modify: i } = await import(
|
|
623
|
-
// @ts-ignore
|
|
624
|
-
"https://cdn.skypack.dev/ol/interaction.js"
|
|
625
|
-
);
|
|
626
|
-
this._draw = new e({
|
|
627
|
-
source: t,
|
|
628
|
-
type: "Polygon"
|
|
629
|
-
}), this._modify = new i({ source: t }), this.requestUpdate();
|
|
608
|
+
p(this, "_layerId");
|
|
609
|
+
p(this, "_eoxMap");
|
|
610
|
+
p(this, "_olMap");
|
|
611
|
+
p(this, "_drawLayer");
|
|
612
|
+
p(this, "_drawnFeatures", []);
|
|
613
|
+
p(this, "_currentlyDrawing");
|
|
614
|
+
p(this, "multipleFeatures");
|
|
615
|
+
p(this, "for");
|
|
616
|
+
p(this, "layer");
|
|
617
|
+
p(this, "_draw");
|
|
618
|
+
p(this, "_modify");
|
|
630
619
|
}
|
|
631
620
|
_startDrawing() {
|
|
632
|
-
this.
|
|
621
|
+
this._eoxMap.addDraw(this._layerId, {
|
|
633
622
|
id: "drawInteraction",
|
|
634
623
|
type: "Polygon"
|
|
635
|
-
}), this._draw = this._eoxMap.interactions.drawInteraction, this._modify = this._eoxMap.interactions.drawInteraction_modify
|
|
624
|
+
}), this._draw = this._eoxMap.interactions.drawInteraction, this._modify = this._eoxMap.interactions.drawInteraction_modify, this._draw.on("drawend", (t) => this._onDrawEnd(t)), this._modify.on("modifyend", (t) => this._onModifyEnd(t)), this._currentlyDrawing = !0, this.requestUpdate();
|
|
636
625
|
}
|
|
637
626
|
_discardDrawing() {
|
|
638
|
-
this._drawnFeatures = [], this.
|
|
627
|
+
this._drawnFeatures = [], this._eoxMap.removeInteraction("drawInteraction"), this._drawLayer.getSource().clear(), this._currentlyDrawing = !1, this.requestUpdate();
|
|
639
628
|
}
|
|
640
629
|
_onDrawEnd(t) {
|
|
641
|
-
console.log(t), this._emitDrawnFeatures(), this.
|
|
630
|
+
console.log(t), this._emitDrawnFeatures(), this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate();
|
|
642
631
|
}
|
|
643
632
|
_onModifyEnd(t) {
|
|
644
633
|
console.log(t), this._emitDrawnFeatures();
|
|
@@ -654,26 +643,20 @@ let _ = class extends x {
|
|
|
654
643
|
}
|
|
655
644
|
render() {
|
|
656
645
|
const t = document.querySelector(this.for);
|
|
657
|
-
this.
|
|
658
|
-
let e;
|
|
659
|
-
return e = this._olMap.getLayers().getArray(), this._drawLayer = e.find(
|
|
660
|
-
(i) => i.get("id") === this._layerId
|
|
661
|
-
) || e.filter((i) => i.get("mapbox-layers")).find(
|
|
662
|
-
(i) => i.get("mapbox-layers").includes(this._layerId)
|
|
663
|
-
), this._legacyMode && this._dynamicImport(), this.requestUpdate(), Et`
|
|
646
|
+
return this._eoxMap = t, this._olMap = t.map, this._layerId = this.layer, this._drawLayer = this._olMap.getLayers().getArray().find((e) => e.get("id") === this._layerId), this.requestUpdate(), Et`
|
|
664
647
|
<style>
|
|
665
|
-
${
|
|
648
|
+
${Dt}
|
|
666
649
|
</style>
|
|
667
650
|
<div>
|
|
668
651
|
<slot></slot>
|
|
669
652
|
<button
|
|
670
|
-
disabled="${
|
|
653
|
+
disabled="${!this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || u}"
|
|
671
654
|
@click="${() => this._startDrawing()}"
|
|
672
655
|
>
|
|
673
656
|
${this._currentlyDrawing ? "drawing" : "draw"}
|
|
674
657
|
</button>
|
|
675
658
|
<button
|
|
676
|
-
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing ||
|
|
659
|
+
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || u}"
|
|
677
660
|
@click="${() => this._discardDrawing()}"
|
|
678
661
|
>
|
|
679
662
|
discard
|
|
@@ -683,38 +666,35 @@ let _ = class extends x {
|
|
|
683
666
|
}
|
|
684
667
|
};
|
|
685
668
|
v([
|
|
686
|
-
|
|
687
|
-
],
|
|
688
|
-
v([
|
|
689
|
-
w()
|
|
690
|
-
], _.prototype, "_layerId", 2);
|
|
669
|
+
C()
|
|
670
|
+
], $.prototype, "_layerId", 2);
|
|
691
671
|
v([
|
|
692
|
-
|
|
693
|
-
],
|
|
672
|
+
C()
|
|
673
|
+
], $.prototype, "_eoxMap", 2);
|
|
694
674
|
v([
|
|
695
|
-
|
|
696
|
-
],
|
|
675
|
+
C()
|
|
676
|
+
], $.prototype, "_olMap", 2);
|
|
697
677
|
v([
|
|
698
|
-
|
|
699
|
-
],
|
|
678
|
+
C()
|
|
679
|
+
], $.prototype, "_drawLayer", 2);
|
|
700
680
|
v([
|
|
701
|
-
|
|
702
|
-
],
|
|
681
|
+
C()
|
|
682
|
+
], $.prototype, "_drawnFeatures", 2);
|
|
703
683
|
v([
|
|
704
|
-
|
|
705
|
-
],
|
|
684
|
+
C()
|
|
685
|
+
], $.prototype, "_currentlyDrawing", 2);
|
|
706
686
|
v([
|
|
707
687
|
L({ type: Boolean })
|
|
708
|
-
],
|
|
688
|
+
], $.prototype, "multipleFeatures", 2);
|
|
709
689
|
v([
|
|
710
690
|
L()
|
|
711
|
-
],
|
|
691
|
+
], $.prototype, "for", 2);
|
|
712
692
|
v([
|
|
713
693
|
L()
|
|
714
|
-
],
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
],
|
|
694
|
+
], $.prototype, "layer", 2);
|
|
695
|
+
$ = v([
|
|
696
|
+
Nt("eox-drawtools")
|
|
697
|
+
], $);
|
|
718
698
|
export {
|
|
719
|
-
|
|
699
|
+
$ as EOxDrawTools
|
|
720
700
|
};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
(function(d,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(d=typeof globalThis<"u"?globalThis:d||self,_(d["eox-drawtools"]={}))})(this,function(d){"use strict";var
|
|
1
|
+
(function(d,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(d=typeof globalThis<"u"?globalThis:d||self,_(d["eox-drawtools"]={}))})(this,function(d){"use strict";var kt=Object.defineProperty;var Rt=(d,_,f)=>_ in d?kt(d,_,{enumerable:!0,configurable:!0,writable:!0,value:f}):d[_]=f;var $=(d,_,f)=>(Rt(d,typeof _!="symbol"?_+"":_,f),f);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const _=window,f=_.ShadowRoot&&(_.ShadyCSS===void 0||_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,
|
|
5
|
+
*/const _=window,f=_.ShadowRoot&&(_.ShadyCSS===void 0||_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),X=new WeakMap;let _t=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==G)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(f&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=X.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&X.set(e,t))}return t}toString(){return this.cssText}};const $t=r=>new _t(typeof r=="string"?r:r+"",void 0,G),vt=(r,t)=>{f?r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=_.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)})},Y=f?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return $t(e)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var z;const N=window,tt=N.trustedTypes,yt=tt?tt.emptyScript:"",et=N.reactiveElementPolyfillSupport,B={toAttribute(r,t){switch(t){case Boolean:r=r?yt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},it=(r,t)=>t!==r&&(t==t||r==r),F={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it},q="finalized";let
|
|
9
|
+
*/var z;const N=window,tt=N.trustedTypes,yt=tt?tt.emptyScript:"",et=N.reactiveElementPolyfillSupport,B={toAttribute(r,t){switch(t){case Boolean:r=r?yt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},it=(r,t)=>t!==r&&(t==t||r==r),F={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it},q="finalized";let S=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Ep(i,e);s!==void 0&&(this._$Ev.set(s,i),t.push(s))}),t}static createProperty(t,e=F){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||F}static finalize(){if(this.hasOwnProperty(q))return!1;this[q]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(Y(s))}else t!==void 0&&e.push(Y(t));return e}static _$Ep(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return vt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=F){var s;const o=this.constructor._$Ep(t,i);if(o!==void 0&&i.reflect===!0){const n=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:B).toAttribute(e,i.type);this._$El=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(o!==void 0&&this._$El!==o){const n=s.getPropertyOptions(o),u=typeof n.converter=="function"?{fromAttribute:n.converter}:((i=n.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?n.converter:B;this._$El=o,this[o]=u.fromAttribute(e,n.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||it)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,o)=>this[o]=s),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(s=>{var o;return(o=s.hostUpdate)===null||o===void 0?void 0:o.call(s)}),this.update(i)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};S[q]=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},et==null||et({ReactiveElement:S}),((z=N.reactiveElementVersions)!==null&&z!==void 0?z:N.reactiveElementVersions=[]).push("1.6.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/var V;const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,ht=/"/g,dt=/^(?:script|style|textarea|title)$/i,mt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),At=mt(1),
|
|
13
|
+
*/var V;const k=window,b=k.trustedTypes,st=b?b.createPolicy("lit-html",{createHTML:r=>r}):void 0,W="$lit$",m=`lit$${(Math.random()+"").slice(9)}$`,rt="?"+m,ft=`<${rt}>`,A=document,O=()=>A.createComment(""),P=r=>r===null||typeof r!="object"&&typeof r!="function",nt=Array.isArray,gt=r=>nt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",K=`[
|
|
14
|
+
\f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,lt=/>/g,w=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,ht=/"/g,dt=/^(?:script|style|textarea|title)$/i,mt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),At=mt(1),C=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ct=new WeakMap,E=A.createTreeWalker(A,129,null,!1),wt=(r,t)=>{const e=r.length-1,i=[];let s,o=t===2?"<svg>":"",n=D;for(let l=0;l<e;l++){const a=r[l];let g,h,p=-1,v=0;for(;v<a.length&&(n.lastIndex=v,h=n.exec(a),h!==null);)v=n.lastIndex,n===D?h[1]==="!--"?n=ot:h[1]!==void 0?n=lt:h[2]!==void 0?(dt.test(h[2])&&(s=RegExp("</"+h[2],"g")),n=w):h[3]!==void 0&&(n=w):n===w?h[0]===">"?(n=s??D,p=-1):h[1]===void 0?p=-2:(p=n.lastIndex-h[2].length,g=h[1],n=h[3]===void 0?w:h[3]==='"'?ht:at):n===ht||n===at?n=w:n===ot||n===lt?n=D:(n=w,s=void 0);const L=n===w&&r[l+1].startsWith("/>")?" ":"";o+=n===D?a+ft:p>=0?(i.push(g),a.slice(0,p)+W+a.slice(p)+m+L):a+m+(p===-2?(i.push(void 0),l):L)}const u=o+(r[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[st!==void 0?st.createHTML(u):u,i]};class U{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const u=t.length-1,l=this.parts,[a,g]=wt(t,e);if(this.el=U.createElement(a,i),E.currentNode=this.el.content,e===2){const h=this.el.content,p=h.firstChild;p.remove(),h.append(...p.childNodes)}for(;(s=E.nextNode())!==null&&l.length<u;){if(s.nodeType===1){if(s.hasAttributes()){const h=[];for(const p of s.getAttributeNames())if(p.endsWith(W)||p.startsWith(m)){const v=g[n++];if(h.push(p),v!==void 0){const L=s.getAttribute(v.toLowerCase()+W).split(m),j=/([.?@])?(.*)/.exec(v);l.push({type:1,index:o,name:j[2],strings:L,ctor:j[1]==="."?St:j[1]==="?"?Ct:j[1]==="@"?xt:R})}else l.push({type:6,index:o})}for(const p of h)s.removeAttribute(p)}if(dt.test(s.tagName)){const h=s.textContent.split(m),p=h.length-1;if(p>0){s.textContent=b?b.emptyScript:"";for(let v=0;v<p;v++)s.append(h[v],O()),E.nextNode(),l.push({type:2,index:++o});s.append(h[p],O())}}}else if(s.nodeType===8)if(s.data===rt)l.push({type:2,index:o});else{let h=-1;for(;(h=s.data.indexOf(m,h+1))!==-1;)l.push({type:7,index:o}),h+=m.length-1}o++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function x(r,t,e=r,i){var s,o,n,u;if(t===C)return t;let l=i!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[i]:e._$Cl;const a=P(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((o=l==null?void 0:l._$AO)===null||o===void 0||o.call(l,!1),a===void 0?l=void 0:(l=new a(r),l._$AT(r,e,i)),i!==void 0?((n=(u=e)._$Co)!==null&&n!==void 0?n:u._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=x(r,l._$AS(r,t.values),l,i)),t}class Et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:A).importNode(i,!0);E.currentNode=o;let n=E.nextNode(),u=0,l=0,a=s[0];for(;a!==void 0;){if(u===a.index){let g;a.type===2?g=new M(n,n.nextSibling,this,t):a.type===1?g=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(g=new Tt(n,this,t)),this._$AV.push(g),a=s[++l]}u!==(a==null?void 0:a.index)&&(n=E.nextNode(),u++)}return E.currentNode=A,o}v(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class M{constructor(t,e,i,s){var o;this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=(o=s==null?void 0:s.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),P(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==C&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):gt(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==c&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=U.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.v(i);else{const n=new Et(o,this),u=n.u(this.options);n.v(i),this.$(u),this._$AH=n}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new U(t)),e}T(t){nt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new M(this.k(O()),this.k(O()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class R{constructor(t,e,i,s,o){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(o===void 0)t=x(this,t,e,0),n=!P(t)||t!==this._$AH&&t!==C,n&&(this._$AH=t);else{const u=t;let l,a;for(t=o[0],l=0;l<o.length-1;l++)a=x(this,u[i+l],e,l),a===C&&(a=this._$AH[l]),n||(n=!P(a)||a!==this._$AH[l]),a===c?t=c:t!==c&&(t+=(a??"")+o[l+1]),this._$AH[l]=a}n&&!s&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class St extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}}const bt=b?b.emptyScript:"";class Ct extends R{constructor(){super(...arguments),this.type=4}j(t){t&&t!==c?this.element.setAttribute(this.name,bt):this.element.removeAttribute(this.name)}}class xt extends R{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=(i=x(this,t,e,0))!==null&&i!==void 0?i:c)===C)return;const s=this._$AH,o=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==c&&(s===c||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){x(this,t)}}const ut=k.litHtmlPolyfillSupport;ut==null||ut(U,M),((V=k.litHtmlVersions)!==null&&V!==void 0?V:k.litHtmlVersions=[]).push("2.7.4");const Ot=(r,t,e)=>{var i,s;const o=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let n=o._$litPart$;if(n===void 0){const u=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;o._$litPart$=n=new M(t.insertBefore(O(),u),u,void 0,e??{})}return n._$AI(r),n};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/var J,Z;class H extends
|
|
19
|
+
*/var J,Z;class H extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return C}}H.finalized=!0,H._$litElement$=!0,(J=globalThis.litElementHydrateSupport)===null||J===void 0||J.call(globalThis,{LitElement:H});const pt=globalThis.litElementPolyfillSupport;pt==null||pt({LitElement:H}),((Z=globalThis.litElementVersions)!==null&&Z!==void 0?Z:globalThis.litElementVersions=[]).push("3.3.2");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Pt=r=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(r,t):((e,i)=>{const{kind:s,elements:o}=i;return{kind:s,elements:o,finisher(n){customElements.define(e,n)}}})(r,t);/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const Dt=(r,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,r)}},Ut=(r,t,e)=>{t.constructor.createProperty(e,r)};function I(r){return(t,e)=>e!==void 0?Ut(r,t,e):Dt(r,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function T(r){return I({...r,state:!0})}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2021 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/var
|
|
35
|
+
*/var Q;((Q=window.HTMLSlotElement)===null||Q===void 0?void 0:Q.prototype.assignedElements)!=null;const Mt=`
|
|
36
36
|
:host {
|
|
37
37
|
display: block;
|
|
38
38
|
}
|
|
39
|
-
`;var Ht=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,
|
|
39
|
+
`;var Ht=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,y=(r,t,e,i)=>{for(var s=i>1?void 0:i?Nt(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&Ht(t,e,s),s};d.EOxDrawTools=class extends H{constructor(){super(...arguments);$(this,"_layerId");$(this,"_eoxMap");$(this,"_olMap");$(this,"_drawLayer");$(this,"_drawnFeatures",[]);$(this,"_currentlyDrawing");$(this,"multipleFeatures");$(this,"for");$(this,"layer");$(this,"_draw");$(this,"_modify")}_startDrawing(){this._eoxMap.addDraw(this._layerId,{id:"drawInteraction",type:"Polygon"}),this._draw=this._eoxMap.interactions.drawInteraction,this._modify=this._eoxMap.interactions.drawInteraction_modify,this._draw.on("drawend",e=>this._onDrawEnd(e)),this._modify.on("modifyend",e=>this._onModifyEnd(e)),this._currentlyDrawing=!0,this.requestUpdate()}_discardDrawing(){this._drawnFeatures=[],this._eoxMap.removeInteraction("drawInteraction"),this._drawLayer.getSource().clear(),this._currentlyDrawing=!1,this.requestUpdate()}_onDrawEnd(e){console.log(e),this._emitDrawnFeatures(),this._eoxMap.removeInteraction("drawInteraction"),this._currentlyDrawing=!1,this.requestUpdate()}_onModifyEnd(e){console.log(e),this._emitDrawnFeatures()}_emitDrawnFeatures(){setTimeout(()=>{this._drawnFeatures=this._drawLayer.getSource().getFeatures(),this.requestUpdate();const e=new CustomEvent("drawupdate",{detail:this._drawnFeatures});this.dispatchEvent(e)},0)}render(){const e=document.querySelector(this.for);return this._eoxMap=e,this._olMap=e.map,this._layerId=this.layer,this._drawLayer=this._olMap.getLayers().getArray().find(i=>i.get("id")===this._layerId),this.requestUpdate(),At`
|
|
40
40
|
<style>
|
|
41
|
-
${
|
|
41
|
+
${Mt}
|
|
42
42
|
</style>
|
|
43
43
|
<div>
|
|
44
44
|
<slot></slot>
|
|
45
45
|
<button
|
|
46
|
-
disabled="${this.
|
|
46
|
+
disabled="${!this.multipleFeatures&&this._drawnFeatures.length||this._currentlyDrawing||c}"
|
|
47
47
|
@click="${()=>this._startDrawing()}"
|
|
48
48
|
>
|
|
49
49
|
${this._currentlyDrawing?"drawing":"draw"}
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
discard
|
|
56
56
|
</button>
|
|
57
57
|
</div>
|
|
58
|
-
`}},
|
|
58
|
+
`}},y([T()],d.EOxDrawTools.prototype,"_layerId",2),y([T()],d.EOxDrawTools.prototype,"_eoxMap",2),y([T()],d.EOxDrawTools.prototype,"_olMap",2),y([T()],d.EOxDrawTools.prototype,"_drawLayer",2),y([T()],d.EOxDrawTools.prototype,"_drawnFeatures",2),y([T()],d.EOxDrawTools.prototype,"_currentlyDrawing",2),y([I({type:Boolean})],d.EOxDrawTools.prototype,"multipleFeatures",2),y([I()],d.EOxDrawTools.prototype,"for",2),y([I()],d.EOxDrawTools.prototype,"layer",2),d.EOxDrawTools=y([Pt("eox-drawtools")],d.EOxDrawTools),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|