@eox/drawtools 0.4.0 → 0.4.1
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/README.md +4 -0
- package/dist/eox-drawtools.js +217 -223
- package/dist/eox-drawtools.umd.cjs +30 -34
- package/package.json +8 -8
- package/test/{_mockMap.ts → _mockMap.js} +1 -1
- package/test/{general.cy.ts → general.cy.js} +2 -2
package/README.md
CHANGED
package/dist/eox-drawtools.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
var K = (r, t, e) => {
|
|
2
|
+
if (!t.has(r))
|
|
3
|
+
throw TypeError("Cannot " + e);
|
|
4
|
+
};
|
|
5
|
+
var g = (r, t, e) => (K(r, t, "read from private field"), e ? e.call(r) : t.get(r)), L = (r, t, e) => {
|
|
6
|
+
if (t.has(r))
|
|
7
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
+
t instanceof WeakSet ? t.add(r) : t.set(r, e);
|
|
9
|
+
}, R = (r, t, e, i) => (K(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
|
|
1
10
|
/**
|
|
2
11
|
* @license
|
|
3
12
|
* Copyright 2019 Google LLC
|
|
4
13
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
14
|
*/
|
|
6
|
-
const
|
|
7
|
-
let
|
|
15
|
+
const D = window, J = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, at = Symbol(), Q = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
let vt = class {
|
|
8
17
|
constructor(t, e, i) {
|
|
9
18
|
if (this._$cssResult$ = !0, i !== at)
|
|
10
19
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -23,27 +32,27 @@ let ut = class {
|
|
|
23
32
|
return this.cssText;
|
|
24
33
|
}
|
|
25
34
|
};
|
|
26
|
-
const
|
|
35
|
+
const gt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, at), yt = (r, t) => {
|
|
27
36
|
J ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
|
|
28
|
-
const i = document.createElement("style"), s =
|
|
37
|
+
const i = document.createElement("style"), s = D.litNonce;
|
|
29
38
|
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
|
|
30
39
|
});
|
|
31
40
|
}, X = J ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
|
32
41
|
let e = "";
|
|
33
42
|
for (const i of t.cssRules)
|
|
34
43
|
e += i.cssText;
|
|
35
|
-
return
|
|
44
|
+
return gt(e);
|
|
36
45
|
})(r) : r;
|
|
37
46
|
/**
|
|
38
47
|
* @license
|
|
39
48
|
* Copyright 2017 Google LLC
|
|
40
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
50
|
*/
|
|
42
|
-
var
|
|
43
|
-
const
|
|
51
|
+
var B;
|
|
52
|
+
const T = window, G = T.trustedTypes, _t = G ? G.emptyScript : "", Y = T.reactiveElementPolyfillSupport, q = { toAttribute(r, t) {
|
|
44
53
|
switch (t) {
|
|
45
54
|
case Boolean:
|
|
46
|
-
r = r ?
|
|
55
|
+
r = r ? _t : null;
|
|
47
56
|
break;
|
|
48
57
|
case Object:
|
|
49
58
|
case Array:
|
|
@@ -68,7 +77,7 @@ const D = window, G = D.trustedTypes, vt = G ? G.emptyScript : "", Y = D.reactiv
|
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
return e;
|
|
71
|
-
} }, ht = (r, t) => t !== r && (t == t || r == r),
|
|
80
|
+
} }, ht = (r, t) => t !== r && (t == t || r == r), I = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged: ht }, W = "finalized";
|
|
72
81
|
let A = class extends HTMLElement {
|
|
73
82
|
constructor() {
|
|
74
83
|
super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
|
|
@@ -85,7 +94,7 @@ let A = class extends HTMLElement {
|
|
|
85
94
|
s !== void 0 && (this._$Ev.set(s, i), t.push(s));
|
|
86
95
|
}), t;
|
|
87
96
|
}
|
|
88
|
-
static createProperty(t, e =
|
|
97
|
+
static createProperty(t, e = I) {
|
|
89
98
|
if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
|
|
90
99
|
const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e);
|
|
91
100
|
s !== void 0 && Object.defineProperty(this.prototype, t, s);
|
|
@@ -100,12 +109,12 @@ let A = class extends HTMLElement {
|
|
|
100
109
|
}, configurable: !0, enumerable: !0 };
|
|
101
110
|
}
|
|
102
111
|
static getPropertyOptions(t) {
|
|
103
|
-
return this.elementProperties.get(t) ||
|
|
112
|
+
return this.elementProperties.get(t) || I;
|
|
104
113
|
}
|
|
105
114
|
static finalize() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
115
|
+
if (this.hasOwnProperty(W))
|
|
107
116
|
return !1;
|
|
108
|
-
this[
|
|
117
|
+
this[W] = !0;
|
|
109
118
|
const t = Object.getPrototypeOf(this);
|
|
110
119
|
if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
|
|
111
120
|
const e = this.properties, i = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
|
|
@@ -148,7 +157,7 @@ let A = class extends HTMLElement {
|
|
|
148
157
|
createRenderRoot() {
|
|
149
158
|
var t;
|
|
150
159
|
const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
|
|
151
|
-
return
|
|
160
|
+
return yt(e, this.constructor.elementStyles), e;
|
|
152
161
|
}
|
|
153
162
|
connectedCallback() {
|
|
154
163
|
var t;
|
|
@@ -169,11 +178,11 @@ let A = class extends HTMLElement {
|
|
|
169
178
|
attributeChangedCallback(t, e, i) {
|
|
170
179
|
this._$AK(t, i);
|
|
171
180
|
}
|
|
172
|
-
_$EO(t, e, i =
|
|
181
|
+
_$EO(t, e, i = I) {
|
|
173
182
|
var s;
|
|
174
183
|
const n = this.constructor._$Ep(t, i);
|
|
175
184
|
if (n !== void 0 && i.reflect === !0) {
|
|
176
|
-
const o = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter :
|
|
185
|
+
const o = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : q).toAttribute(e, i.type);
|
|
177
186
|
this._$El = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$El = null;
|
|
178
187
|
}
|
|
179
188
|
}
|
|
@@ -181,8 +190,8 @@ let A = class extends HTMLElement {
|
|
|
181
190
|
var i;
|
|
182
191
|
const s = this.constructor, n = s._$Ev.get(t);
|
|
183
192
|
if (n !== void 0 && this._$El !== n) {
|
|
184
|
-
const o = s.getPropertyOptions(n),
|
|
185
|
-
this._$El = n, this[n] =
|
|
193
|
+
const o = s.getPropertyOptions(n), h = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((i = o.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? o.converter : q;
|
|
194
|
+
this._$El = n, this[n] = h.fromAttribute(e, o.type), this._$El = null;
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
197
|
requestUpdate(t, e, i) {
|
|
@@ -248,73 +257,76 @@ let A = class extends HTMLElement {
|
|
|
248
257
|
firstUpdated(t) {
|
|
249
258
|
}
|
|
250
259
|
};
|
|
251
|
-
A[
|
|
260
|
+
A[W] = !0, A.elementProperties = /* @__PURE__ */ new Map(), A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, Y == null || Y({ ReactiveElement: A }), ((B = T.reactiveElementVersions) !== null && B !== void 0 ? B : T.reactiveElementVersions = []).push("1.6.2");
|
|
252
261
|
/**
|
|
253
262
|
* @license
|
|
254
263
|
* Copyright 2017 Google LLC
|
|
255
264
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
256
265
|
*/
|
|
257
|
-
var
|
|
258
|
-
const
|
|
259
|
-
\f\r]`,
|
|
260
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, rt = /"/g,
|
|
261
|
-
|
|
262
|
-
let s, n = t === 2 ? "<svg>" : "", o = S;
|
|
263
|
-
for (let l = 0; l < e; l++) {
|
|
264
|
-
const a = r[l];
|
|
265
|
-
let v, h, c = -1, _ = 0;
|
|
266
|
-
for (; _ < a.length && (o.lastIndex = _, h = o.exec(a), h !== null); )
|
|
267
|
-
_ = o.lastIndex, o === S ? h[1] === "!--" ? o = et : h[1] !== void 0 ? o = it : h[2] !== void 0 ? (pt.test(h[2]) && (s = RegExp("</" + h[2], "g")), o = f) : h[3] !== void 0 && (o = f) : o === f ? h[0] === ">" ? (o = s ?? S, c = -1) : h[1] === void 0 ? c = -2 : (c = o.lastIndex - h[2].length, v = h[1], o = h[3] === void 0 ? f : h[3] === '"' ? rt : st) : o === rt || o === st ? o = f : o === et || o === it ? o = S : (o = f, s = void 0);
|
|
268
|
-
const k = o === f && r[l + 1].startsWith("/>") ? " " : "";
|
|
269
|
-
n += o === S ? a + yt : c >= 0 ? (i.push(v), a.slice(0, c) + Z + a.slice(c) + y + k) : a + y + (c === -2 ? (i.push(void 0), l) : k);
|
|
270
|
-
}
|
|
271
|
-
const d = n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "");
|
|
266
|
+
var V;
|
|
267
|
+
const M = window, b = M.trustedTypes, tt = b ? b.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", y = `lit$${(Math.random() + "").slice(9)}$`, dt = "?" + y, ft = `<${dt}>`, m = document, C = () => m.createComment(""), H = (r) => r === null || typeof r != "object" && typeof r != "function", ct = Array.isArray, mt = (r) => ct(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", z = `[
|
|
268
|
+
\f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, it = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
|
|
269
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, rt = /"/g, ut = /^(?:script|style|textarea|title)$/i, At = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), bt = At(1), w = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), f = m.createTreeWalker(m, 129, null, !1);
|
|
270
|
+
function pt(r, t) {
|
|
272
271
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
|
273
272
|
throw Error("invalid template strings array");
|
|
274
|
-
return
|
|
273
|
+
return tt !== void 0 ? tt.createHTML(t) : t;
|
|
274
|
+
}
|
|
275
|
+
const wt = (r, t) => {
|
|
276
|
+
const e = r.length - 1, i = [];
|
|
277
|
+
let s, n = t === 2 ? "<svg>" : "", o = E;
|
|
278
|
+
for (let h = 0; h < e; h++) {
|
|
279
|
+
const l = r[h];
|
|
280
|
+
let a, d, c = -1, p = 0;
|
|
281
|
+
for (; p < l.length && (o.lastIndex = p, d = o.exec(l), d !== null); )
|
|
282
|
+
p = o.lastIndex, o === E ? d[1] === "!--" ? o = et : d[1] !== void 0 ? o = it : d[2] !== void 0 ? (ut.test(d[2]) && (s = RegExp("</" + d[2], "g")), o = _) : d[3] !== void 0 && (o = _) : o === _ ? d[0] === ">" ? (o = s ?? E, c = -1) : d[1] === void 0 ? c = -2 : (c = o.lastIndex - d[2].length, a = d[1], o = d[3] === void 0 ? _ : d[3] === '"' ? rt : st) : o === rt || o === st ? o = _ : o === et || o === it ? o = E : (o = _, s = void 0);
|
|
283
|
+
const $ = o === _ && r[h + 1].startsWith("/>") ? " " : "";
|
|
284
|
+
n += o === E ? l + ft : c >= 0 ? (i.push(a), l.slice(0, c) + Z + l.slice(c) + y + $) : l + y + (c === -2 ? (i.push(void 0), h) : $);
|
|
285
|
+
}
|
|
286
|
+
return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
|
|
275
287
|
};
|
|
276
288
|
class U {
|
|
277
289
|
constructor({ strings: t, _$litType$: e }, i) {
|
|
278
290
|
let s;
|
|
279
291
|
this.parts = [];
|
|
280
292
|
let n = 0, o = 0;
|
|
281
|
-
const
|
|
282
|
-
if (this.el = U.createElement(a, i),
|
|
283
|
-
const
|
|
284
|
-
|
|
293
|
+
const h = t.length - 1, l = this.parts, [a, d] = wt(t, e);
|
|
294
|
+
if (this.el = U.createElement(a, i), f.currentNode = this.el.content, e === 2) {
|
|
295
|
+
const c = this.el.content, p = c.firstChild;
|
|
296
|
+
p.remove(), c.append(...p.childNodes);
|
|
285
297
|
}
|
|
286
|
-
for (; (s =
|
|
298
|
+
for (; (s = f.nextNode()) !== null && l.length < h; ) {
|
|
287
299
|
if (s.nodeType === 1) {
|
|
288
300
|
if (s.hasAttributes()) {
|
|
289
|
-
const
|
|
290
|
-
for (const
|
|
291
|
-
if (
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
l.push({ type: 1, index: n, name:
|
|
301
|
+
const c = [];
|
|
302
|
+
for (const p of s.getAttributeNames())
|
|
303
|
+
if (p.endsWith(Z) || p.startsWith(y)) {
|
|
304
|
+
const $ = d[o++];
|
|
305
|
+
if (c.push(p), $ !== void 0) {
|
|
306
|
+
const $t = s.getAttribute($.toLowerCase() + Z).split(y), O = /([.?@])?(.*)/.exec($);
|
|
307
|
+
l.push({ type: 1, index: n, name: O[2], strings: $t, ctor: O[1] === "." ? Et : O[1] === "?" ? Ct : O[1] === "@" ? Ht : N });
|
|
296
308
|
} else
|
|
297
309
|
l.push({ type: 6, index: n });
|
|
298
310
|
}
|
|
299
|
-
for (const
|
|
300
|
-
s.removeAttribute(
|
|
311
|
+
for (const p of c)
|
|
312
|
+
s.removeAttribute(p);
|
|
301
313
|
}
|
|
302
|
-
if (
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
314
|
+
if (ut.test(s.tagName)) {
|
|
315
|
+
const c = s.textContent.split(y), p = c.length - 1;
|
|
316
|
+
if (p > 0) {
|
|
305
317
|
s.textContent = b ? b.emptyScript : "";
|
|
306
|
-
for (let
|
|
307
|
-
s.append(
|
|
308
|
-
s.append(
|
|
318
|
+
for (let $ = 0; $ < p; $++)
|
|
319
|
+
s.append(c[$], C()), f.nextNode(), l.push({ type: 2, index: ++n });
|
|
320
|
+
s.append(c[p], C());
|
|
309
321
|
}
|
|
310
322
|
}
|
|
311
323
|
} else if (s.nodeType === 8)
|
|
312
324
|
if (s.data === dt)
|
|
313
325
|
l.push({ type: 2, index: n });
|
|
314
326
|
else {
|
|
315
|
-
let
|
|
316
|
-
for (; (
|
|
317
|
-
l.push({ type: 7, index: n }),
|
|
327
|
+
let c = -1;
|
|
328
|
+
for (; (c = s.data.indexOf(y, c + 1)) !== -1; )
|
|
329
|
+
l.push({ type: 7, index: n }), c += y.length - 1;
|
|
318
330
|
}
|
|
319
331
|
n++;
|
|
320
332
|
}
|
|
@@ -324,15 +336,15 @@ class U {
|
|
|
324
336
|
return i.innerHTML = t, i;
|
|
325
337
|
}
|
|
326
338
|
}
|
|
327
|
-
function
|
|
328
|
-
var s, n, o,
|
|
339
|
+
function x(r, t, e = r, i) {
|
|
340
|
+
var s, n, o, h;
|
|
329
341
|
if (t === w)
|
|
330
342
|
return t;
|
|
331
343
|
let l = i !== void 0 ? (s = e._$Co) === null || s === void 0 ? void 0 : s[i] : e._$Cl;
|
|
332
344
|
const a = H(t) ? void 0 : t._$litDirective$;
|
|
333
|
-
return (l == null ? void 0 : l.constructor) !== a && ((n = l == null ? void 0 : l._$AO) === null || n === void 0 || n.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((o = (
|
|
345
|
+
return (l == null ? void 0 : l.constructor) !== a && ((n = l == null ? void 0 : l._$AO) === null || n === void 0 || n.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((o = (h = e)._$Co) !== null && o !== void 0 ? o : h._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = x(r, l._$AS(r, t.values), l, i)), t;
|
|
334
346
|
}
|
|
335
|
-
class
|
|
347
|
+
class xt {
|
|
336
348
|
constructor(t, e) {
|
|
337
349
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
338
350
|
}
|
|
@@ -345,16 +357,16 @@ class bt {
|
|
|
345
357
|
u(t) {
|
|
346
358
|
var e;
|
|
347
359
|
const { el: { content: i }, parts: s } = this._$AD, n = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : m).importNode(i, !0);
|
|
348
|
-
|
|
349
|
-
let o =
|
|
360
|
+
f.currentNode = n;
|
|
361
|
+
let o = f.nextNode(), h = 0, l = 0, a = s[0];
|
|
350
362
|
for (; a !== void 0; ) {
|
|
351
|
-
if (
|
|
352
|
-
let
|
|
353
|
-
a.type === 2 ?
|
|
363
|
+
if (h === a.index) {
|
|
364
|
+
let d;
|
|
365
|
+
a.type === 2 ? d = new k(o, o.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (d = new Ut(o, this, t)), this._$AV.push(d), a = s[++l];
|
|
354
366
|
}
|
|
355
|
-
|
|
367
|
+
h !== (a == null ? void 0 : a.index) && (o = f.nextNode(), h++);
|
|
356
368
|
}
|
|
357
|
-
return
|
|
369
|
+
return f.currentNode = m, n;
|
|
358
370
|
}
|
|
359
371
|
v(t) {
|
|
360
372
|
let e = 0;
|
|
@@ -362,10 +374,10 @@ class bt {
|
|
|
362
374
|
i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
363
375
|
}
|
|
364
376
|
}
|
|
365
|
-
class
|
|
377
|
+
class k {
|
|
366
378
|
constructor(t, e, i, s) {
|
|
367
379
|
var n;
|
|
368
|
-
this.type = 2, this._$AH =
|
|
380
|
+
this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cp = (n = s == null ? void 0 : s.isConnected) === null || n === void 0 || n;
|
|
369
381
|
}
|
|
370
382
|
get _$AU() {
|
|
371
383
|
var t, e;
|
|
@@ -383,7 +395,7 @@ class M {
|
|
|
383
395
|
return this._$AB;
|
|
384
396
|
}
|
|
385
397
|
_$AI(t, e = this) {
|
|
386
|
-
t =
|
|
398
|
+
t = x(this, t, e), H(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== w && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : mt(t) ? this.T(t) : this._(t);
|
|
387
399
|
}
|
|
388
400
|
k(t) {
|
|
389
401
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -392,28 +404,28 @@ class M {
|
|
|
392
404
|
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
|
|
393
405
|
}
|
|
394
406
|
_(t) {
|
|
395
|
-
this._$AH !==
|
|
407
|
+
this._$AH !== u && H(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t;
|
|
396
408
|
}
|
|
397
409
|
g(t) {
|
|
398
410
|
var e;
|
|
399
|
-
const { values: i, _$litType$: s } = t, n = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = U.createElement(s.h, this.options)), s);
|
|
411
|
+
const { values: i, _$litType$: s } = t, n = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = U.createElement(pt(s.h, s.h[0]), this.options)), s);
|
|
400
412
|
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === n)
|
|
401
413
|
this._$AH.v(i);
|
|
402
414
|
else {
|
|
403
|
-
const o = new
|
|
404
|
-
o.v(i), this.$(
|
|
415
|
+
const o = new xt(n, this), h = o.u(this.options);
|
|
416
|
+
o.v(i), this.$(h), this._$AH = o;
|
|
405
417
|
}
|
|
406
418
|
}
|
|
407
419
|
_$AC(t) {
|
|
408
|
-
let e =
|
|
409
|
-
return e === void 0 &&
|
|
420
|
+
let e = nt.get(t.strings);
|
|
421
|
+
return e === void 0 && nt.set(t.strings, e = new U(t)), e;
|
|
410
422
|
}
|
|
411
423
|
T(t) {
|
|
412
424
|
ct(this._$AH) || (this._$AH = [], this._$AR());
|
|
413
425
|
const e = this._$AH;
|
|
414
426
|
let i, s = 0;
|
|
415
427
|
for (const n of t)
|
|
416
|
-
s === e.length ? e.push(i = new
|
|
428
|
+
s === e.length ? e.push(i = new k(this.k(C()), this.k(C()), this, this.options)) : i = e[s], i._$AI(n), s++;
|
|
417
429
|
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
|
|
418
430
|
}
|
|
419
431
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -428,9 +440,9 @@ class M {
|
|
|
428
440
|
this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
|
|
429
441
|
}
|
|
430
442
|
}
|
|
431
|
-
class
|
|
443
|
+
class N {
|
|
432
444
|
constructor(t, e, i, s, n) {
|
|
433
|
-
this.type = 1, this._$AH =
|
|
445
|
+
this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
|
|
434
446
|
}
|
|
435
447
|
get tagName() {
|
|
436
448
|
return this.element.tagName;
|
|
@@ -442,45 +454,45 @@ class R {
|
|
|
442
454
|
const n = this.strings;
|
|
443
455
|
let o = !1;
|
|
444
456
|
if (n === void 0)
|
|
445
|
-
t =
|
|
457
|
+
t = x(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== w, o && (this._$AH = t);
|
|
446
458
|
else {
|
|
447
|
-
const
|
|
459
|
+
const h = t;
|
|
448
460
|
let l, a;
|
|
449
461
|
for (t = n[0], l = 0; l < n.length - 1; l++)
|
|
450
|
-
a =
|
|
462
|
+
a = x(this, h[i + l], e, l), a === w && (a = this._$AH[l]), o || (o = !H(a) || a !== this._$AH[l]), a === u ? t = u : t !== u && (t += (a ?? "") + n[l + 1]), this._$AH[l] = a;
|
|
451
463
|
}
|
|
452
464
|
o && !s && this.j(t);
|
|
453
465
|
}
|
|
454
466
|
j(t) {
|
|
455
|
-
t ===
|
|
467
|
+
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
456
468
|
}
|
|
457
469
|
}
|
|
458
|
-
class
|
|
470
|
+
class Et extends N {
|
|
459
471
|
constructor() {
|
|
460
472
|
super(...arguments), this.type = 3;
|
|
461
473
|
}
|
|
462
474
|
j(t) {
|
|
463
|
-
this.element[this.name] = t ===
|
|
475
|
+
this.element[this.name] = t === u ? void 0 : t;
|
|
464
476
|
}
|
|
465
477
|
}
|
|
466
|
-
const
|
|
467
|
-
class
|
|
478
|
+
const St = b ? b.emptyScript : "";
|
|
479
|
+
class Ct extends N {
|
|
468
480
|
constructor() {
|
|
469
481
|
super(...arguments), this.type = 4;
|
|
470
482
|
}
|
|
471
483
|
j(t) {
|
|
472
|
-
t && t !==
|
|
484
|
+
t && t !== u ? this.element.setAttribute(this.name, St) : this.element.removeAttribute(this.name);
|
|
473
485
|
}
|
|
474
486
|
}
|
|
475
|
-
class
|
|
487
|
+
class Ht extends N {
|
|
476
488
|
constructor(t, e, i, s, n) {
|
|
477
489
|
super(t, e, i, s, n), this.type = 5;
|
|
478
490
|
}
|
|
479
491
|
_$AI(t, e = this) {
|
|
480
492
|
var i;
|
|
481
|
-
if ((t = (i =
|
|
493
|
+
if ((t = (i = x(this, t, e, 0)) !== null && i !== void 0 ? i : u) === w)
|
|
482
494
|
return;
|
|
483
|
-
const s = this._$AH, n = t ===
|
|
495
|
+
const s = this._$AH, n = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== u && (s === u || n);
|
|
484
496
|
n && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
497
|
}
|
|
486
498
|
handleEvent(t) {
|
|
@@ -488,7 +500,7 @@ class St extends R {
|
|
|
488
500
|
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);
|
|
489
501
|
}
|
|
490
502
|
}
|
|
491
|
-
class
|
|
503
|
+
class Ut {
|
|
492
504
|
constructor(t, e, i) {
|
|
493
505
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
|
|
494
506
|
}
|
|
@@ -496,18 +508,18 @@ class Ct {
|
|
|
496
508
|
return this._$AM._$AU;
|
|
497
509
|
}
|
|
498
510
|
_$AI(t) {
|
|
499
|
-
|
|
511
|
+
x(this, t);
|
|
500
512
|
}
|
|
501
513
|
}
|
|
502
|
-
const
|
|
503
|
-
|
|
514
|
+
const ot = M.litHtmlPolyfillSupport;
|
|
515
|
+
ot == null || ot(U, k), ((V = M.litHtmlVersions) !== null && V !== void 0 ? V : M.litHtmlVersions = []).push("2.8.0");
|
|
504
516
|
const Pt = (r, t, e) => {
|
|
505
517
|
var i, s;
|
|
506
518
|
const n = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
|
|
507
519
|
let o = n._$litPart$;
|
|
508
520
|
if (o === void 0) {
|
|
509
|
-
const
|
|
510
|
-
n._$litPart$ = o = new
|
|
521
|
+
const h = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
|
|
522
|
+
n._$litPart$ = o = new k(t.insertBefore(C(), h), h, void 0, e ?? {});
|
|
511
523
|
}
|
|
512
524
|
return o._$AI(r), o;
|
|
513
525
|
};
|
|
@@ -516,8 +528,8 @@ const Pt = (r, t, e) => {
|
|
|
516
528
|
* Copyright 2017 Google LLC
|
|
517
529
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
518
530
|
*/
|
|
519
|
-
var
|
|
520
|
-
class
|
|
531
|
+
var F, j;
|
|
532
|
+
class S extends A {
|
|
521
533
|
constructor() {
|
|
522
534
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
523
535
|
}
|
|
@@ -542,58 +554,15 @@ class C extends A {
|
|
|
542
554
|
return w;
|
|
543
555
|
}
|
|
544
556
|
}
|
|
545
|
-
|
|
557
|
+
S.finalized = !0, S._$litElement$ = !0, (F = globalThis.litElementHydrateSupport) === null || F === void 0 || F.call(globalThis, { LitElement: S });
|
|
546
558
|
const lt = globalThis.litElementPolyfillSupport;
|
|
547
|
-
lt == null || lt({ LitElement:
|
|
548
|
-
((
|
|
549
|
-
|
|
550
|
-
* @license
|
|
551
|
-
* Copyright 2017 Google LLC
|
|
552
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
553
|
-
*/
|
|
554
|
-
const Ht = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(r, t) : ((e, i) => {
|
|
555
|
-
const { kind: s, elements: n } = i;
|
|
556
|
-
return { kind: s, elements: n, finisher(o) {
|
|
557
|
-
customElements.define(e, o);
|
|
558
|
-
} };
|
|
559
|
-
})(r, t);
|
|
560
|
-
/**
|
|
561
|
-
* @license
|
|
562
|
-
* Copyright 2017 Google LLC
|
|
563
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
564
|
-
*/
|
|
565
|
-
const Ut = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
|
|
566
|
-
e.createProperty(t.key, r);
|
|
567
|
-
} } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
|
|
568
|
-
typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
|
|
569
|
-
}, finisher(e) {
|
|
570
|
-
e.createProperty(t.key, r);
|
|
571
|
-
} }, Mt = (r, t, e) => {
|
|
572
|
-
t.constructor.createProperty(e, r);
|
|
573
|
-
};
|
|
574
|
-
function O(r) {
|
|
575
|
-
return (t, e) => e !== void 0 ? Mt(r, t, e) : Ut(r, t);
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* @license
|
|
579
|
-
* Copyright 2017 Google LLC
|
|
580
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
581
|
-
*/
|
|
582
|
-
function x(r) {
|
|
583
|
-
return O({ ...r, state: !0 });
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* @license
|
|
587
|
-
* Copyright 2021 Google LLC
|
|
588
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
589
|
-
*/
|
|
590
|
-
var q;
|
|
591
|
-
((q = window.HTMLSlotElement) === null || q === void 0 ? void 0 : q.prototype.assignedElements) != null;
|
|
592
|
-
const Ot = `
|
|
559
|
+
lt == null || lt({ LitElement: S });
|
|
560
|
+
((j = globalThis.litElementVersions) !== null && j !== void 0 ? j : globalThis.litElementVersions = []).push("3.3.2");
|
|
561
|
+
const kt = `
|
|
593
562
|
:host {
|
|
594
563
|
display: block;
|
|
595
564
|
}
|
|
596
|
-
`,
|
|
565
|
+
`, Ot = `
|
|
597
566
|
button {
|
|
598
567
|
/* TODO: why does this only work here and not from :root? */
|
|
599
568
|
--primary-color: #004170;
|
|
@@ -601,6 +570,7 @@ button {
|
|
|
601
570
|
--error-color: #FF5252;
|
|
602
571
|
|
|
603
572
|
display: inline-flex;
|
|
573
|
+
position: relative;
|
|
604
574
|
align-items: center;
|
|
605
575
|
color: #fff;
|
|
606
576
|
border-width: 0;
|
|
@@ -620,7 +590,7 @@ button {
|
|
|
620
590
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
621
591
|
}
|
|
622
592
|
|
|
623
|
-
button:hover {
|
|
593
|
+
button:hover:not([disabled]) {
|
|
624
594
|
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);
|
|
625
595
|
background: var(--primary-color-hover);
|
|
626
596
|
}
|
|
@@ -629,6 +599,10 @@ button, button:active {
|
|
|
629
599
|
background: var(--primary-color);
|
|
630
600
|
}
|
|
631
601
|
|
|
602
|
+
button[disabled] {
|
|
603
|
+
opacity: 0.5;
|
|
604
|
+
}
|
|
605
|
+
|
|
632
606
|
button.outline {
|
|
633
607
|
background: transparent;
|
|
634
608
|
box-shadow: none;
|
|
@@ -647,6 +621,7 @@ button.icon {
|
|
|
647
621
|
padding: 0;
|
|
648
622
|
border-radius: 50%;
|
|
649
623
|
width: 24px;
|
|
624
|
+
text-indent: -9999px;
|
|
650
625
|
}
|
|
651
626
|
|
|
652
627
|
button.icon-text {
|
|
@@ -669,12 +644,18 @@ button.icon-text:before {
|
|
|
669
644
|
width: 18px;
|
|
670
645
|
height: 18px;
|
|
671
646
|
}
|
|
672
|
-
|
|
647
|
+
|
|
648
|
+
button.small {
|
|
649
|
+
height: 28px;
|
|
650
|
+
padding: 12.4px;
|
|
651
|
+
font-size: .75rem;
|
|
652
|
+
}
|
|
653
|
+
`, Dt = `
|
|
673
654
|
* {
|
|
674
655
|
font-family: Roboto, sans-serif;
|
|
675
656
|
}
|
|
676
657
|
|
|
677
|
-
${
|
|
658
|
+
${Ot}
|
|
678
659
|
|
|
679
660
|
button.discard {
|
|
680
661
|
background: var(--error-color);
|
|
@@ -684,101 +665,114 @@ button.polygon:before {
|
|
|
684
665
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
|
|
685
666
|
}
|
|
686
667
|
`;
|
|
687
|
-
var
|
|
688
|
-
|
|
689
|
-
(o = r[n]) && (s = (i ? o(t, e, s) : o(s)) || s);
|
|
690
|
-
return i && s && Tt(t, e, s), s;
|
|
691
|
-
};
|
|
692
|
-
let u = class extends C {
|
|
668
|
+
var v, P;
|
|
669
|
+
class Tt extends S {
|
|
693
670
|
constructor() {
|
|
694
|
-
super(
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
671
|
+
super();
|
|
672
|
+
/**
|
|
673
|
+
* @type import("../../map/main").EOxMap
|
|
674
|
+
*/
|
|
675
|
+
L(this, v, void 0);
|
|
676
|
+
/**
|
|
677
|
+
* @type import("ol").Map
|
|
678
|
+
*/
|
|
679
|
+
L(this, P, void 0);
|
|
680
|
+
this.for = "eox-map", this.currentlyDrawing = !1, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.layer = "draw", this.modify = null, this.multipleFeatures = !1, this.unstyled = !1;
|
|
681
|
+
}
|
|
682
|
+
static get properties() {
|
|
683
|
+
return {
|
|
684
|
+
for: { type: String },
|
|
685
|
+
currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
|
|
686
|
+
draw: { attribute: !1, state: !0 },
|
|
687
|
+
drawLayer: { attribute: !1, state: !0 },
|
|
688
|
+
drawnFeatures: { attribute: !1, state: !0, type: Array },
|
|
689
|
+
layer: { type: String },
|
|
690
|
+
modify: { attribute: !1, state: !0 },
|
|
691
|
+
multipleFeatures: { attribute: "multiple-features", type: Boolean },
|
|
692
|
+
unstyled: { type: Boolean }
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
startDrawing() {
|
|
696
|
+
var e, i;
|
|
697
|
+
g(this, v).addDraw(this.layer, {
|
|
698
698
|
id: "drawInteraction",
|
|
699
|
-
type: "Polygon"
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
699
|
+
type: "Polygon",
|
|
700
|
+
stopClick: !0
|
|
701
|
+
}), this.draw = /** @type {import("ol/interaction").Draw} */
|
|
702
|
+
/** @type {unknown} */
|
|
703
|
+
g(this, v).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
|
|
704
|
+
/** @type {unknown} */
|
|
705
|
+
g(this, v).interactions.drawInteractionmodify, (e = this.draw) == null || e.on("drawend", (s) => this.onDrawEnd(s)), (i = this.modify) == null || i.on("modifyend", (s) => this.onModifyEnd(s)), this.currentlyDrawing = !0, this.requestUpdate();
|
|
706
|
+
}
|
|
707
|
+
discardDrawing() {
|
|
708
|
+
this.drawnFeatures = [], g(this, v).removeInteraction("drawInteraction"), this.drawLayer.getSource().clear(), this.currentlyDrawing = !1, this.requestUpdate();
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
*
|
|
712
|
+
* @param {import("ol/interaction/Draw").DrawEvent} evt
|
|
713
|
+
*/
|
|
714
|
+
onDrawEnd(e) {
|
|
715
|
+
console.log(e.target), this.emitDrawnFeatures(), g(this, v).removeInteraction("drawInteraction"), this.currentlyDrawing = !1, this.requestUpdate();
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
*
|
|
719
|
+
* @param {import("ol/interaction/Modify").ModifyEvent} evt
|
|
720
|
+
*/
|
|
721
|
+
onModifyEnd(e) {
|
|
722
|
+
console.log(e), this.emitDrawnFeatures();
|
|
723
|
+
}
|
|
724
|
+
emitDrawnFeatures() {
|
|
712
725
|
setTimeout(() => {
|
|
713
|
-
this.
|
|
714
|
-
const
|
|
715
|
-
detail: this.
|
|
726
|
+
this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate();
|
|
727
|
+
const e = new CustomEvent("drawupdate", {
|
|
728
|
+
detail: this.drawnFeatures
|
|
716
729
|
});
|
|
717
|
-
this.dispatchEvent(
|
|
730
|
+
this.dispatchEvent(e);
|
|
718
731
|
}, 0);
|
|
719
732
|
}
|
|
720
733
|
render() {
|
|
721
|
-
|
|
722
|
-
|
|
734
|
+
var i, s;
|
|
735
|
+
const e = document.querySelector(this.for);
|
|
736
|
+
return R(
|
|
737
|
+
this,
|
|
738
|
+
v,
|
|
739
|
+
/** @type {import("@eox/map/main").EOxMap} */
|
|
740
|
+
e
|
|
741
|
+
), R(
|
|
742
|
+
this,
|
|
743
|
+
P,
|
|
744
|
+
/** @type {import("ol").Map} */
|
|
745
|
+
g(this, v).map
|
|
746
|
+
), this.drawLayer = /** @type {import("ol/layer").Vector<import("ol/source").Vector>} */
|
|
747
|
+
g(this, P).getLayers().getArray().find((n) => n.get("id") === this.layer), this.requestUpdate(), bt`
|
|
723
748
|
<style>
|
|
724
|
-
${
|
|
725
|
-
${!this.unstyled &&
|
|
749
|
+
${kt}
|
|
750
|
+
${!this.unstyled && Dt}
|
|
726
751
|
</style>
|
|
727
752
|
<div>
|
|
728
753
|
<slot></slot>
|
|
729
754
|
<button
|
|
730
755
|
data-cy="drawBtn"
|
|
731
756
|
class="icon-text polygon"
|
|
732
|
-
disabled="${!this.multipleFeatures && this.
|
|
733
|
-
@click="${() => this.
|
|
757
|
+
disabled="${!this.multipleFeatures && ((i = this.drawnFeatures) == null ? void 0 : i.length) > 0 || this.currentlyDrawing || u}"
|
|
758
|
+
@click="${() => this.startDrawing()}"
|
|
734
759
|
>
|
|
735
|
-
${this.
|
|
760
|
+
${this.currentlyDrawing ? "drawing" : "draw"}
|
|
736
761
|
</button>
|
|
737
762
|
<button
|
|
738
763
|
data-cy="discardBtn"
|
|
739
764
|
class="discard"
|
|
740
|
-
disabled="${!this.
|
|
741
|
-
@click="${() => this.
|
|
765
|
+
disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || u}"
|
|
766
|
+
@click="${() => this.discardDrawing()}"
|
|
742
767
|
>
|
|
743
768
|
discard
|
|
744
769
|
</button>
|
|
745
770
|
</div>
|
|
746
771
|
`;
|
|
747
772
|
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
], u.prototype, "_layerId", 2);
|
|
752
|
-
$([
|
|
753
|
-
x()
|
|
754
|
-
], u.prototype, "_eoxMap", 2);
|
|
755
|
-
$([
|
|
756
|
-
x()
|
|
757
|
-
], u.prototype, "_olMap", 2);
|
|
758
|
-
$([
|
|
759
|
-
x()
|
|
760
|
-
], u.prototype, "_drawLayer", 2);
|
|
761
|
-
$([
|
|
762
|
-
x()
|
|
763
|
-
], u.prototype, "_drawnFeatures", 2);
|
|
764
|
-
$([
|
|
765
|
-
x()
|
|
766
|
-
], u.prototype, "_currentlyDrawing", 2);
|
|
767
|
-
$([
|
|
768
|
-
O({ type: Boolean })
|
|
769
|
-
], u.prototype, "multipleFeatures", 2);
|
|
770
|
-
$([
|
|
771
|
-
O()
|
|
772
|
-
], u.prototype, "for", 2);
|
|
773
|
-
$([
|
|
774
|
-
O()
|
|
775
|
-
], u.prototype, "layer", 2);
|
|
776
|
-
$([
|
|
777
|
-
O({ type: Boolean })
|
|
778
|
-
], u.prototype, "unstyled", 2);
|
|
779
|
-
u = $([
|
|
780
|
-
Ht("eox-drawtools")
|
|
781
|
-
], u);
|
|
773
|
+
}
|
|
774
|
+
v = new WeakMap(), P = new WeakMap();
|
|
775
|
+
customElements.define("eox-drawtools", Tt);
|
|
782
776
|
export {
|
|
783
|
-
|
|
777
|
+
Tt as EOxDrawTools
|
|
784
778
|
};
|
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
(function(p,
|
|
1
|
+
var vt=(p,d,f)=>{if(!d.has(p))throw TypeError("Cannot "+f)};var m=(p,d,f)=>(vt(p,d,"read from private field"),f?f.call(p):d.get(p)),K=(p,d,f)=>{if(d.has(p))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(p):d.set(p,f)},Q=(p,d,f,H)=>(vt(p,d,"write to private field"),H?H.call(p,f):d.set(p,f),f);(function(p,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(p=typeof globalThis<"u"?globalThis:p||self,d(p["eox-drawtools"]={}))})(this,function(p){var y,M;"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const d=window,f=d.ShadowRoot&&(d.ShadyCSS===void 0||d.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H=Symbol(),X=new WeakMap;let ft=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==H)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(f&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=X.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&X.set(e,t))}return t}toString(){return this.cssText}};const yt=r=>new ft(typeof r=="string"?r:r+"",void 0,H),gt=(r,t)=>{f?r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=d.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)})},G=f?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return yt(e)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var
|
|
9
|
+
*/var I;const N=window,Y=N.trustedTypes,_t=Y?Y.emptyScript:"",tt=N.reactiveElementPolyfillSupport,V={toAttribute(r,t){switch(t){case Boolean:r=r?_t:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},et=(r,t)=>t!==r&&(t==t||r==r),j={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:et},z="finalized";let x=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Ep(i,e);s!==void 0&&(this._$Ev.set(s,i),t.push(s))}),t}static createProperty(t,e=j){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||j}static finalize(){if(this.hasOwnProperty(z))return!1;this[z]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(G(s))}else t!==void 0&&e.push(G(t));return e}static _$Ep(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return gt(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=j){var s;const n=this.constructor._$Ep(t,i);if(n!==void 0&&i.reflect===!0){const o=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:V).toAttribute(e,i.type);this._$El=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(n!==void 0&&this._$El!==n){const o=s.getPropertyOptions(n),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:V;this._$El=n,this[n]=h.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||et)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,n)=>this[n]=s),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(s=>{var n;return(n=s.hostUpdate)===null||n===void 0?void 0:n.call(s)}),this.update(i)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};x[z]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:x}),((I=N.reactiveElementVersions)!==null&&I!==void 0?I: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 F;const
|
|
14
|
-
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),lt=/'/g,at=/"/g,ht=/^(?:script|style|textarea|title)$/i,
|
|
13
|
+
*/var F;const L=window,E=L.trustedTypes,it=E?E.createPolicy("lit-html",{createHTML:r=>r}):void 0,q="$lit$",_=`lit$${(Math.random()+"").slice(9)}$`,st="?"+_,mt=`<${st}>`,A=document,U=()=>A.createComment(""),P=r=>r===null||typeof r!="object"&&typeof r!="function",rt=Array.isArray,At=r=>rt(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",W=`[
|
|
14
|
+
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,ot=/>/g,b=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),lt=/'/g,at=/"/g,ht=/^(?:script|style|textarea|title)$/i,bt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),wt=bt(1),S=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),dt=new WeakMap,w=A.createTreeWalker(A,129,null,!1);function ct(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return it!==void 0?it.createHTML(t):t}const xt=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=T;for(let h=0;h<e;h++){const l=r[h];let a,c,u=-1,v=0;for(;v<l.length&&(o.lastIndex=v,c=o.exec(l),c!==null);)v=o.lastIndex,o===T?c[1]==="!--"?o=nt:c[1]!==void 0?o=ot:c[2]!==void 0?(ht.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=b):c[3]!==void 0&&(o=b):o===b?c[0]===">"?(o=s??T,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,a=c[1],o=c[3]===void 0?b:c[3]==='"'?at:lt):o===at||o===lt?o=b:o===nt||o===ot?o=T:(o=b,s=void 0);const g=o===b&&r[h+1].startsWith("/>")?" ":"";n+=o===T?l+mt:u>=0?(i.push(a),l.slice(0,u)+q+l.slice(u)+_+g):l+_+(u===-2?(i.push(void 0),h):g)}return[ct(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class O{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const h=t.length-1,l=this.parts,[a,c]=xt(t,e);if(this.el=O.createElement(a,i),w.currentNode=this.el.content,e===2){const u=this.el.content,v=u.firstChild;v.remove(),u.append(...v.childNodes)}for(;(s=w.nextNode())!==null&&l.length<h;){if(s.nodeType===1){if(s.hasAttributes()){const u=[];for(const v of s.getAttributeNames())if(v.endsWith(q)||v.startsWith(_)){const g=c[o++];if(u.push(v),g!==void 0){const Dt=s.getAttribute(g.toLowerCase()+q).split(_),B=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:B[2],strings:Dt,ctor:B[1]==="."?St:B[1]==="?"?Ht:B[1]==="@"?Ut:R})}else l.push({type:6,index:n})}for(const v of u)s.removeAttribute(v)}if(ht.test(s.tagName)){const u=s.textContent.split(_),v=u.length-1;if(v>0){s.textContent=E?E.emptyScript:"";for(let g=0;g<v;g++)s.append(u[g],U()),w.nextNode(),l.push({type:2,index:++n});s.append(u[v],U())}}}else if(s.nodeType===8)if(s.data===st)l.push({type:2,index:n});else{let u=-1;for(;(u=s.data.indexOf(_,u+1))!==-1;)l.push({type:7,index:n}),u+=_.length-1}n++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function C(r,t,e=r,i){var s,n,o,h;if(t===S)return t;let l=i!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[i]:e._$Cl;const a=P(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),a===void 0?l=void 0:(l=new a(r),l._$AT(r,e,i)),i!==void 0?((o=(h=e)._$Co)!==null&&o!==void 0?o:h._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=C(r,l._$AS(r,t.values),l,i)),t}class Et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:A).importNode(i,!0);w.currentNode=n;let o=w.nextNode(),h=0,l=0,a=s[0];for(;a!==void 0;){if(h===a.index){let c;a.type===2?c=new k(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new Pt(o,this,t)),this._$AV.push(c),a=s[++l]}h!==(a==null?void 0:a.index)&&(o=w.nextNode(),h++)}return w.currentNode=A,n}v(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class k{constructor(t,e,i,s){var n;this.type=2,this._$AH=$,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=(n=s==null?void 0:s.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=C(this,t,e),P(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):At(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==$&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=O.createElement(ct(s.h,s.h[0]),this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.v(i);else{const o=new Et(n,this),h=o.u(this.options);o.v(i),this.$(h),this._$AH=o}}_$AC(t){let e=dt.get(t.strings);return e===void 0&&dt.set(t.strings,e=new O(t)),e}T(t){rt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new k(this.k(U()),this.k(U()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class R{constructor(t,e,i,s,n){this.type=1,this._$AH=$,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=$}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(n===void 0)t=C(this,t,e,0),o=!P(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const h=t;let l,a;for(t=n[0],l=0;l<n.length-1;l++)a=C(this,h[i+l],e,l),a===S&&(a=this._$AH[l]),o||(o=!P(a)||a!==this._$AH[l]),a===$?t=$:t!==$&&(t+=(a??"")+n[l+1]),this._$AH[l]=a}o&&!s&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class St extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}}const Ct=E?E.emptyScript:"";class Ht extends R{constructor(){super(...arguments),this.type=4}j(t){t&&t!==$?this.element.setAttribute(this.name,Ct):this.element.removeAttribute(this.name)}}class Ut extends R{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=(i=C(this,t,e,0))!==null&&i!==void 0?i:$)===S)return;const s=this._$AH,n=t===$&&s!==$||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==$&&(s===$||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Pt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){C(this,t)}}const ut=L.litHtmlPolyfillSupport;ut==null||ut(O,k),((F=L.litHtmlVersions)!==null&&F!==void 0?F:L.litHtmlVersions=[]).push("2.8.0");const Tt=(r,t,e)=>{var i,s;const n=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let o=n._$litPart$;if(o===void 0){const h=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;n._$litPart$=o=new k(t.insertBefore(U(),h),h,void 0,e??{})}return o._$AI(r),o};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/var
|
|
20
|
-
* @license
|
|
21
|
-
* Copyright 2017 Google LLC
|
|
22
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const Tt=o=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(o,t):((e,i)=>{const{kind:s,elements:n}=i;return{kind:s,elements:n,finisher(r){customElements.define(e,r)}}})(o,t);/**
|
|
24
|
-
* @license
|
|
25
|
-
* Copyright 2017 Google LLC
|
|
26
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const Pt=(o,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,o)}}:{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,o)}},Dt=(o,t,e)=>{t.constructor.createProperty(e,o)};function U(o){return(t,e)=>e!==void 0?Dt(o,t,e):Pt(o,t)}/**
|
|
28
|
-
* @license
|
|
29
|
-
* Copyright 2017 Google LLC
|
|
30
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function S(o){return U({...o,state:!0})}/**
|
|
32
|
-
* @license
|
|
33
|
-
* Copyright 2021 Google LLC
|
|
34
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/var J;((J=window.HTMLSlotElement)===null||J===void 0?void 0:J.prototype.assignedElements)!=null;const Ht=`
|
|
19
|
+
*/var Z,J;class D extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Tt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return S}}D.finalized=!0,D._$litElement$=!0,(Z=globalThis.litElementHydrateSupport)===null||Z===void 0||Z.call(globalThis,{LitElement:D});const pt=globalThis.litElementPolyfillSupport;pt==null||pt({LitElement:D}),((J=globalThis.litElementVersions)!==null&&J!==void 0?J:globalThis.litElementVersions=[]).push("3.3.2");const Ot=`
|
|
36
20
|
:host {
|
|
37
21
|
display: block;
|
|
38
22
|
}
|
|
39
|
-
`,
|
|
23
|
+
`,kt=`
|
|
40
24
|
* {
|
|
41
25
|
font-family: Roboto, sans-serif;
|
|
42
26
|
}
|
|
@@ -49,6 +33,7 @@ button {
|
|
|
49
33
|
--error-color: #FF5252;
|
|
50
34
|
|
|
51
35
|
display: inline-flex;
|
|
36
|
+
position: relative;
|
|
52
37
|
align-items: center;
|
|
53
38
|
color: #fff;
|
|
54
39
|
border-width: 0;
|
|
@@ -68,7 +53,7 @@ button {
|
|
|
68
53
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
69
54
|
}
|
|
70
55
|
|
|
71
|
-
button:hover {
|
|
56
|
+
button:hover:not([disabled]) {
|
|
72
57
|
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);
|
|
73
58
|
background: var(--primary-color-hover);
|
|
74
59
|
}
|
|
@@ -77,6 +62,10 @@ button, button:active {
|
|
|
77
62
|
background: var(--primary-color);
|
|
78
63
|
}
|
|
79
64
|
|
|
65
|
+
button[disabled] {
|
|
66
|
+
opacity: 0.5;
|
|
67
|
+
}
|
|
68
|
+
|
|
80
69
|
button.outline {
|
|
81
70
|
background: transparent;
|
|
82
71
|
box-shadow: none;
|
|
@@ -95,6 +84,7 @@ button.icon {
|
|
|
95
84
|
padding: 0;
|
|
96
85
|
border-radius: 50%;
|
|
97
86
|
width: 24px;
|
|
87
|
+
text-indent: -9999px;
|
|
98
88
|
}
|
|
99
89
|
|
|
100
90
|
button.icon-text {
|
|
@@ -118,6 +108,12 @@ button.icon-text:before {
|
|
|
118
108
|
height: 18px;
|
|
119
109
|
}
|
|
120
110
|
|
|
111
|
+
button.small {
|
|
112
|
+
height: 28px;
|
|
113
|
+
padding: 12.4px;
|
|
114
|
+
font-size: .75rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
121
117
|
|
|
122
118
|
button.discard {
|
|
123
119
|
background: var(--error-color);
|
|
@@ -126,28 +122,28 @@ button.discard {
|
|
|
126
122
|
button.polygon:before {
|
|
127
123
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
|
|
128
124
|
}
|
|
129
|
-
`;
|
|
125
|
+
`;class $t extends D{constructor(){super();K(this,y,void 0);K(this,M,void 0);this.for="eox-map",this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.drawnFeatures=[],this.layer="draw",this.modify=null,this.multipleFeatures=!1,this.unstyled=!1}static get properties(){return{for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},layer:{type:String},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:"multiple-features",type:Boolean},unstyled:{type:Boolean}}}startDrawing(){var e,i;m(this,y).addDraw(this.layer,{id:"drawInteraction",type:"Polygon",stopClick:!0}),this.draw=m(this,y).interactions.drawInteraction,this.modify=m(this,y).interactions.drawInteractionmodify,(e=this.draw)==null||e.on("drawend",s=>this.onDrawEnd(s)),(i=this.modify)==null||i.on("modifyend",s=>this.onModifyEnd(s)),this.currentlyDrawing=!0,this.requestUpdate()}discardDrawing(){this.drawnFeatures=[],m(this,y).removeInteraction("drawInteraction"),this.drawLayer.getSource().clear(),this.currentlyDrawing=!1,this.requestUpdate()}onDrawEnd(e){console.log(e.target),this.emitDrawnFeatures(),m(this,y).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(){var i,s;const e=document.querySelector(this.for);return Q(this,y,e),Q(this,M,m(this,y).map),this.drawLayer=m(this,M).getLayers().getArray().find(n=>n.get("id")===this.layer),this.requestUpdate(),wt`
|
|
130
126
|
<style>
|
|
131
|
-
${
|
|
132
|
-
${!this.unstyled&&
|
|
127
|
+
${Ot}
|
|
128
|
+
${!this.unstyled&&kt}
|
|
133
129
|
</style>
|
|
134
130
|
<div>
|
|
135
131
|
<slot></slot>
|
|
136
132
|
<button
|
|
137
133
|
data-cy="drawBtn"
|
|
138
134
|
class="icon-text polygon"
|
|
139
|
-
disabled="${!this.multipleFeatures&&this.
|
|
140
|
-
@click="${()=>this.
|
|
135
|
+
disabled="${!this.multipleFeatures&&((i=this.drawnFeatures)==null?void 0:i.length)>0||this.currentlyDrawing||$}"
|
|
136
|
+
@click="${()=>this.startDrawing()}"
|
|
141
137
|
>
|
|
142
|
-
${this.
|
|
138
|
+
${this.currentlyDrawing?"drawing":"draw"}
|
|
143
139
|
</button>
|
|
144
140
|
<button
|
|
145
141
|
data-cy="discardBtn"
|
|
146
142
|
class="discard"
|
|
147
|
-
disabled="${!this.
|
|
148
|
-
@click="${()=>this.
|
|
143
|
+
disabled="${!((s=this.drawnFeatures)!=null&&s.length)&&!this.currentlyDrawing||$}"
|
|
144
|
+
@click="${()=>this.discardDrawing()}"
|
|
149
145
|
>
|
|
150
146
|
discard
|
|
151
147
|
</button>
|
|
152
148
|
</div>
|
|
153
|
-
`}},
|
|
149
|
+
`}}y=new WeakMap,M=new WeakMap,customElements.define("eox-drawtools",$t),p.EOxDrawTools=$t,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/drawtools",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
7
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
7
|
+
"@typescript-eslint/eslint-plugin": "^6.8.0",
|
|
8
8
|
"@typescript-eslint/parser": "^5.50.0",
|
|
9
9
|
"eslint-plugin-typescript": "^0.14.0",
|
|
10
|
-
"ol": "^
|
|
11
|
-
"typescript": "^
|
|
10
|
+
"ol": "^8.1.0",
|
|
11
|
+
"typescript": "^5.2.2",
|
|
12
12
|
"vite": "^4.0.0"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
],
|
|
22
22
|
"main": "./dist/eox-drawtools.js",
|
|
23
23
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"watch": "tsc && vite build --watch",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"watch": "vite build --watch",
|
|
27
26
|
"format": "prettier --write .",
|
|
28
27
|
"lint": "eslint --ext .js,.ts .",
|
|
29
|
-
"lint:fix": "eslint --ext .js,.ts . --fix"
|
|
28
|
+
"lint:fix": "eslint --ext .js,.ts . --fix",
|
|
29
|
+
"typecheck": "tsc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"lit": "^2.7.4"
|
|
@@ -24,7 +24,7 @@ describe("Drawtools", () => {
|
|
|
24
24
|
cy.get("[data-cy='drawBtn']").contains("drawing");
|
|
25
25
|
});
|
|
26
26
|
cy.get("eox-drawtools").and(($el) => {
|
|
27
|
-
expect(
|
|
27
|
+
expect($el[0].drawnFeatures).to.have.length(1);
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@ describe("Drawtools", () => {
|
|
|
38
38
|
cy.get("[data-cy='drawBtn']").should("not.contain", "drawing");
|
|
39
39
|
});
|
|
40
40
|
cy.get("eox-drawtools").should(($el) => {
|
|
41
|
-
expect(
|
|
41
|
+
expect($el[0].drawnFeatures).to.have.length(0);
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
});
|