@eox/drawtools 0.4.1 → 0.4.2
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 +54 -53
- package/dist/eox-drawtools.umd.cjs +19 -18
- package/package.json +1 -1
- package/test/_mockMap.js +5 -2
package/dist/eox-drawtools.js
CHANGED
|
@@ -2,17 +2,17 @@ var K = (r, t, e) => {
|
|
|
2
2
|
if (!t.has(r))
|
|
3
3
|
throw TypeError("Cannot " + e);
|
|
4
4
|
};
|
|
5
|
-
var g = (r, t, e) => (K(r, t, "read from private field"), e ? e.call(r) : t.get(r)),
|
|
5
|
+
var g = (r, t, e) => (K(r, t, "read from private field"), e ? e.call(r) : t.get(r)), V = (r, t, e) => {
|
|
6
6
|
if (t.has(r))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(r) : t.set(r, e);
|
|
9
|
-
},
|
|
9
|
+
}, L = (r, t, e, i) => (K(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
12
12
|
* Copyright 2019 Google LLC
|
|
13
13
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
15
|
+
const O = window, J = O.ShadowRoot && (O.ShadyCSS === void 0 || O.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, at = Symbol(), Q = /* @__PURE__ */ new WeakMap();
|
|
16
16
|
let vt = class {
|
|
17
17
|
constructor(t, e, i) {
|
|
18
18
|
if (this._$cssResult$ = !0, i !== at)
|
|
@@ -34,7 +34,7 @@ let vt = class {
|
|
|
34
34
|
};
|
|
35
35
|
const gt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, at), yt = (r, t) => {
|
|
36
36
|
J ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
|
|
37
|
-
const i = document.createElement("style"), s =
|
|
37
|
+
const i = document.createElement("style"), s = O.litNonce;
|
|
38
38
|
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
|
|
39
39
|
});
|
|
40
40
|
}, X = J ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
|
@@ -48,8 +48,8 @@ const gt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, at), yt = (r
|
|
|
48
48
|
* Copyright 2017 Google LLC
|
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
50
|
*/
|
|
51
|
-
var
|
|
52
|
-
const
|
|
51
|
+
var R;
|
|
52
|
+
const k = window, G = k.trustedTypes, _t = G ? G.emptyScript : "", Y = k.reactiveElementPolyfillSupport, q = { toAttribute(r, t) {
|
|
53
53
|
switch (t) {
|
|
54
54
|
case Boolean:
|
|
55
55
|
r = r ? _t : null;
|
|
@@ -77,7 +77,7 @@ const T = window, G = T.trustedTypes, _t = G ? G.emptyScript : "", Y = T.reactiv
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
return e;
|
|
80
|
-
} }, ht = (r, t) => t !== r && (t == t || r == r),
|
|
80
|
+
} }, ht = (r, t) => t !== r && (t == t || r == r), B = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged: ht }, W = "finalized";
|
|
81
81
|
let A = class extends HTMLElement {
|
|
82
82
|
constructor() {
|
|
83
83
|
super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
|
|
@@ -94,7 +94,7 @@ let A = class extends HTMLElement {
|
|
|
94
94
|
s !== void 0 && (this._$Ev.set(s, i), t.push(s));
|
|
95
95
|
}), t;
|
|
96
96
|
}
|
|
97
|
-
static createProperty(t, e =
|
|
97
|
+
static createProperty(t, e = B) {
|
|
98
98
|
if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
|
|
99
99
|
const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e);
|
|
100
100
|
s !== void 0 && Object.defineProperty(this.prototype, t, s);
|
|
@@ -109,7 +109,7 @@ let A = class extends HTMLElement {
|
|
|
109
109
|
}, configurable: !0, enumerable: !0 };
|
|
110
110
|
}
|
|
111
111
|
static getPropertyOptions(t) {
|
|
112
|
-
return this.elementProperties.get(t) ||
|
|
112
|
+
return this.elementProperties.get(t) || B;
|
|
113
113
|
}
|
|
114
114
|
static finalize() {
|
|
115
115
|
if (this.hasOwnProperty(W))
|
|
@@ -178,7 +178,7 @@ let A = class extends HTMLElement {
|
|
|
178
178
|
attributeChangedCallback(t, e, i) {
|
|
179
179
|
this._$AK(t, i);
|
|
180
180
|
}
|
|
181
|
-
_$EO(t, e, i =
|
|
181
|
+
_$EO(t, e, i = B) {
|
|
182
182
|
var s;
|
|
183
183
|
const n = this.constructor._$Ep(t, i);
|
|
184
184
|
if (n !== void 0 && i.reflect === !0) {
|
|
@@ -257,15 +257,15 @@ let A = class extends HTMLElement {
|
|
|
257
257
|
firstUpdated(t) {
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
A[W] = !0, A.elementProperties = /* @__PURE__ */ new Map(), A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, Y == null || Y({ ReactiveElement: A }), ((
|
|
260
|
+
A[W] = !0, A.elementProperties = /* @__PURE__ */ new Map(), A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, Y == null || Y({ ReactiveElement: A }), ((R = k.reactiveElementVersions) !== null && R !== void 0 ? R : k.reactiveElementVersions = []).push("1.6.2");
|
|
261
261
|
/**
|
|
262
262
|
* @license
|
|
263
263
|
* Copyright 2017 Google LLC
|
|
264
264
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
265
265
|
*/
|
|
266
|
-
var
|
|
267
|
-
const
|
|
268
|
-
\f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, it = />/g, _ = RegExp(`>|${
|
|
266
|
+
var I;
|
|
267
|
+
const T = window, b = T.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", F = `[
|
|
268
|
+
\f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, it = />/g, _ = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^
|
|
269
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
270
|
function pt(r, t) {
|
|
271
271
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
|
@@ -303,8 +303,8 @@ class U {
|
|
|
303
303
|
if (p.endsWith(Z) || p.startsWith(y)) {
|
|
304
304
|
const $ = d[o++];
|
|
305
305
|
if (c.push(p), $ !== void 0) {
|
|
306
|
-
const $t = s.getAttribute($.toLowerCase() + Z).split(y),
|
|
307
|
-
l.push({ type: 1, index: n, name:
|
|
306
|
+
const $t = s.getAttribute($.toLowerCase() + Z).split(y), D = /([.?@])?(.*)/.exec($);
|
|
307
|
+
l.push({ type: 1, index: n, name: D[2], strings: $t, ctor: D[1] === "." ? Et : D[1] === "?" ? Ct : D[1] === "@" ? Ht : N });
|
|
308
308
|
} else
|
|
309
309
|
l.push({ type: 6, index: n });
|
|
310
310
|
}
|
|
@@ -362,7 +362,7 @@ class xt {
|
|
|
362
362
|
for (; a !== void 0; ) {
|
|
363
363
|
if (h === a.index) {
|
|
364
364
|
let d;
|
|
365
|
-
a.type === 2 ? d = new
|
|
365
|
+
a.type === 2 ? d = new M(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];
|
|
366
366
|
}
|
|
367
367
|
h !== (a == null ? void 0 : a.index) && (o = f.nextNode(), h++);
|
|
368
368
|
}
|
|
@@ -374,7 +374,7 @@ class xt {
|
|
|
374
374
|
i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
class
|
|
377
|
+
class M {
|
|
378
378
|
constructor(t, e, i, s) {
|
|
379
379
|
var n;
|
|
380
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;
|
|
@@ -425,7 +425,7 @@ class k {
|
|
|
425
425
|
const e = this._$AH;
|
|
426
426
|
let i, s = 0;
|
|
427
427
|
for (const n of t)
|
|
428
|
-
s === e.length ? e.push(i = new
|
|
428
|
+
s === e.length ? e.push(i = new M(this.k(C()), this.k(C()), this, this.options)) : i = e[s], i._$AI(n), s++;
|
|
429
429
|
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
|
|
430
430
|
}
|
|
431
431
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -511,15 +511,15 @@ class Ut {
|
|
|
511
511
|
x(this, t);
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
const ot =
|
|
515
|
-
ot == null || ot(U,
|
|
514
|
+
const ot = T.litHtmlPolyfillSupport;
|
|
515
|
+
ot == null || ot(U, M), ((I = T.litHtmlVersions) !== null && I !== void 0 ? I : T.litHtmlVersions = []).push("2.8.0");
|
|
516
516
|
const Pt = (r, t, e) => {
|
|
517
517
|
var i, s;
|
|
518
518
|
const n = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
|
|
519
519
|
let o = n._$litPart$;
|
|
520
520
|
if (o === void 0) {
|
|
521
521
|
const h = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
|
|
522
|
-
n._$litPart$ = o = new
|
|
522
|
+
n._$litPart$ = o = new M(t.insertBefore(C(), h), h, void 0, e ?? {});
|
|
523
523
|
}
|
|
524
524
|
return o._$AI(r), o;
|
|
525
525
|
};
|
|
@@ -528,7 +528,7 @@ const Pt = (r, t, e) => {
|
|
|
528
528
|
* Copyright 2017 Google LLC
|
|
529
529
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
530
530
|
*/
|
|
531
|
-
var
|
|
531
|
+
var z, j;
|
|
532
532
|
class S extends A {
|
|
533
533
|
constructor() {
|
|
534
534
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
@@ -554,15 +554,15 @@ class S extends A {
|
|
|
554
554
|
return w;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
S.finalized = !0, S._$litElement$ = !0, (
|
|
557
|
+
S.finalized = !0, S._$litElement$ = !0, (z = globalThis.litElementHydrateSupport) === null || z === void 0 || z.call(globalThis, { LitElement: S });
|
|
558
558
|
const lt = globalThis.litElementPolyfillSupport;
|
|
559
559
|
lt == null || lt({ LitElement: S });
|
|
560
560
|
((j = globalThis.litElementVersions) !== null && j !== void 0 ? j : globalThis.litElementVersions = []).push("3.3.2");
|
|
561
|
-
const
|
|
561
|
+
const Mt = `
|
|
562
562
|
:host {
|
|
563
563
|
display: block;
|
|
564
564
|
}
|
|
565
|
-
`,
|
|
565
|
+
`, Dt = `
|
|
566
566
|
button {
|
|
567
567
|
/* TODO: why does this only work here and not from :root? */
|
|
568
568
|
--primary-color: #004170;
|
|
@@ -590,7 +590,7 @@ button {
|
|
|
590
590
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
button:hover:not([disabled]) {
|
|
593
|
+
button:hover:not([disabled]):not(.icon) {
|
|
594
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);
|
|
595
595
|
background: var(--primary-color-hover);
|
|
596
596
|
}
|
|
@@ -621,6 +621,7 @@ button.icon {
|
|
|
621
621
|
padding: 0;
|
|
622
622
|
border-radius: 50%;
|
|
623
623
|
width: 24px;
|
|
624
|
+
height: 24px;
|
|
624
625
|
text-indent: -9999px;
|
|
625
626
|
}
|
|
626
627
|
|
|
@@ -650,33 +651,33 @@ button.small {
|
|
|
650
651
|
padding: 12.4px;
|
|
651
652
|
font-size: .75rem;
|
|
652
653
|
}
|
|
653
|
-
`,
|
|
654
|
+
`, Ot = `
|
|
654
655
|
* {
|
|
655
656
|
font-family: Roboto, sans-serif;
|
|
656
657
|
}
|
|
657
658
|
|
|
658
|
-
${
|
|
659
|
+
${Dt}
|
|
659
660
|
|
|
660
|
-
button.discard {
|
|
661
|
-
|
|
661
|
+
button.discard:before {
|
|
662
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
|
|
662
663
|
}
|
|
663
664
|
|
|
664
665
|
button.polygon:before {
|
|
665
|
-
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%
|
|
666
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
|
|
666
667
|
}
|
|
667
668
|
`;
|
|
668
669
|
var v, P;
|
|
669
|
-
class
|
|
670
|
+
class kt extends S {
|
|
670
671
|
constructor() {
|
|
671
672
|
super();
|
|
672
673
|
/**
|
|
673
674
|
* @type import("../../map/main").EOxMap
|
|
674
675
|
*/
|
|
675
|
-
|
|
676
|
+
V(this, v, void 0);
|
|
676
677
|
/**
|
|
677
678
|
* @type import("ol").Map
|
|
678
679
|
*/
|
|
679
|
-
|
|
680
|
+
V(this, P, void 0);
|
|
680
681
|
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
|
}
|
|
682
683
|
static get properties() {
|
|
@@ -705,40 +706,40 @@ class Tt extends S {
|
|
|
705
706
|
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
|
}
|
|
707
708
|
discardDrawing() {
|
|
708
|
-
this.drawnFeatures = [], g(this, v).removeInteraction("drawInteraction"), this.drawLayer.getSource().clear(), this.currentlyDrawing = !1, this.requestUpdate();
|
|
709
|
+
this.drawnFeatures = [], g(this, v).removeInteraction("drawInteraction"), this.drawLayer.getSource().clear(), this.emitDrawnFeatures(), this.currentlyDrawing = !1, this.requestUpdate();
|
|
709
710
|
}
|
|
710
711
|
/**
|
|
711
712
|
*
|
|
712
713
|
* @param {import("ol/interaction/Draw").DrawEvent} evt
|
|
713
714
|
*/
|
|
714
|
-
onDrawEnd(
|
|
715
|
-
|
|
715
|
+
onDrawEnd() {
|
|
716
|
+
this.emitDrawnFeatures(), g(this, v).removeInteraction("drawInteraction"), this.currentlyDrawing = !1, this.requestUpdate();
|
|
716
717
|
}
|
|
717
718
|
/**
|
|
718
719
|
*
|
|
719
720
|
* @param {import("ol/interaction/Modify").ModifyEvent} evt
|
|
720
721
|
*/
|
|
721
|
-
onModifyEnd(
|
|
722
|
-
|
|
722
|
+
onModifyEnd() {
|
|
723
|
+
this.emitDrawnFeatures();
|
|
723
724
|
}
|
|
724
725
|
emitDrawnFeatures() {
|
|
725
726
|
setTimeout(() => {
|
|
726
|
-
this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate()
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
727
|
+
this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate(), this.dispatchEvent(
|
|
728
|
+
new CustomEvent("drawupdate", {
|
|
729
|
+
detail: this.drawnFeatures
|
|
730
|
+
})
|
|
731
|
+
);
|
|
731
732
|
}, 0);
|
|
732
733
|
}
|
|
733
734
|
render() {
|
|
734
735
|
var i, s;
|
|
735
736
|
const e = document.querySelector(this.for);
|
|
736
|
-
return
|
|
737
|
+
return L(
|
|
737
738
|
this,
|
|
738
739
|
v,
|
|
739
740
|
/** @type {import("@eox/map/main").EOxMap} */
|
|
740
741
|
e
|
|
741
|
-
),
|
|
742
|
+
), L(
|
|
742
743
|
this,
|
|
743
744
|
P,
|
|
744
745
|
/** @type {import("ol").Map} */
|
|
@@ -746,14 +747,14 @@ class Tt extends S {
|
|
|
746
747
|
), this.drawLayer = /** @type {import("ol/layer").Vector<import("ol/source").Vector>} */
|
|
747
748
|
g(this, P).getLayers().getArray().find((n) => n.get("id") === this.layer), this.requestUpdate(), bt`
|
|
748
749
|
<style>
|
|
749
|
-
${
|
|
750
|
-
${!this.unstyled &&
|
|
750
|
+
${Mt}
|
|
751
|
+
${!this.unstyled && Ot}
|
|
751
752
|
</style>
|
|
752
753
|
<div>
|
|
753
754
|
<slot></slot>
|
|
754
755
|
<button
|
|
755
756
|
data-cy="drawBtn"
|
|
756
|
-
class="icon
|
|
757
|
+
class="polygon icon"
|
|
757
758
|
disabled="${!this.multipleFeatures && ((i = this.drawnFeatures) == null ? void 0 : i.length) > 0 || this.currentlyDrawing || u}"
|
|
758
759
|
@click="${() => this.startDrawing()}"
|
|
759
760
|
>
|
|
@@ -761,7 +762,7 @@ class Tt extends S {
|
|
|
761
762
|
</button>
|
|
762
763
|
<button
|
|
763
764
|
data-cy="discardBtn"
|
|
764
|
-
class="discard"
|
|
765
|
+
class="discard icon"
|
|
765
766
|
disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || u}"
|
|
766
767
|
@click="${() => this.discardDrawing()}"
|
|
767
768
|
>
|
|
@@ -772,7 +773,7 @@ class Tt extends S {
|
|
|
772
773
|
}
|
|
773
774
|
}
|
|
774
775
|
v = new WeakMap(), P = new WeakMap();
|
|
775
|
-
customElements.define("eox-drawtools",
|
|
776
|
+
customElements.define("eox-drawtools", kt);
|
|
776
777
|
export {
|
|
777
|
-
|
|
778
|
+
kt as EOxDrawTools
|
|
778
779
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
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
|
|
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 g,k;"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
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
|
|
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 gt=r=>new ft(typeof r=="string"?r:r+"",void 0,H),yt=(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 gt(e)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var
|
|
9
|
+
*/var B;const N=window,Y=N.trustedTypes,_t=Y?Y.emptyScript:"",tt=N.reactiveElementPolyfillSupport,I={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),F={attribute:!0,type:String,converter:I,reflect:!1,hasChanged:et},j="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=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 n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||F}static finalize(){if(this.hasOwnProperty(j))return!1;this[j]=!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 yt(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 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:I).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:I;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[j]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:x}),((B=N.reactiveElementVersions)!==null&&B!==void 0?B: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
|
|
14
|
-
\f\r]`,
|
|
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=
|
|
13
|
+
*/var z;const V=window,E=V.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]`,M=/<(?:(!--|\/[^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=M;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===M?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??M,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=M:(o=b,s=void 0);const y=o===b&&r[h+1].startsWith("/>")?" ":"";n+=o===M?l+mt:u>=0?(i.push(a),l.slice(0,u)+q+l.slice(u)+_+y):l+_+(u===-2?(i.push(void 0),h):y)}return[ct(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class T{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=T.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 y=c[o++];if(u.push(v),y!==void 0){const Dt=s.getAttribute(y.toLowerCase()+q).split(_),R=/([.?@])?(.*)/.exec(y);l.push({type:1,index:n,name:R[2],strings:Dt,ctor:R[1]==="."?St:R[1]==="?"?Ht:R[1]==="@"?Ut:L})}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 y=0;y<v;y++)s.append(u[y],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 O(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 O{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=T.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 T(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 O(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 L{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 L{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}}const Ct=E?E.emptyScript:"";class Ht extends L{constructor(){super(...arguments),this.type=4}j(t){t&&t!==$?this.element.setAttribute(this.name,Ct):this.element.removeAttribute(this.name)}}class Ut extends L{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=V.litHtmlPolyfillSupport;ut==null||ut(T,O),((z=V.litHtmlVersions)!==null&&z!==void 0?z:V.litHtmlVersions=[]).push("2.8.0");const Mt=(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 O(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 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=
|
|
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=Mt(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 Tt=`
|
|
20
20
|
:host {
|
|
21
21
|
display: block;
|
|
22
22
|
}
|
|
23
|
-
`,
|
|
23
|
+
`,Ot=`
|
|
24
24
|
* {
|
|
25
25
|
font-family: Roboto, sans-serif;
|
|
26
26
|
}
|
|
@@ -53,7 +53,7 @@ button {
|
|
|
53
53
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
button:hover:not([disabled]) {
|
|
56
|
+
button:hover:not([disabled]):not(.icon) {
|
|
57
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);
|
|
58
58
|
background: var(--primary-color-hover);
|
|
59
59
|
}
|
|
@@ -84,6 +84,7 @@ button.icon {
|
|
|
84
84
|
padding: 0;
|
|
85
85
|
border-radius: 50%;
|
|
86
86
|
width: 24px;
|
|
87
|
+
height: 24px;
|
|
87
88
|
text-indent: -9999px;
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -115,23 +116,23 @@ button.small {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
|
|
118
|
-
button.discard {
|
|
119
|
-
|
|
119
|
+
button.discard:before {
|
|
120
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
button.polygon:before {
|
|
123
|
-
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%
|
|
124
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
|
|
124
125
|
}
|
|
125
|
-
`;class $t extends D{constructor(){super();K(this,
|
|
126
|
+
`;class $t extends D{constructor(){super();K(this,g,void 0);K(this,k,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,g).addDraw(this.layer,{id:"drawInteraction",type:"Polygon",stopClick:!0}),this.draw=m(this,g).interactions.drawInteraction,this.modify=m(this,g).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,g).removeInteraction("drawInteraction"),this.drawLayer.getSource().clear(),this.emitDrawnFeatures(),this.currentlyDrawing=!1,this.requestUpdate()}onDrawEnd(){this.emitDrawnFeatures(),m(this,g).removeInteraction("drawInteraction"),this.currentlyDrawing=!1,this.requestUpdate()}onModifyEnd(){this.emitDrawnFeatures()}emitDrawnFeatures(){setTimeout(()=>{this.drawnFeatures=this.drawLayer.getSource().getFeatures(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("drawupdate",{detail:this.drawnFeatures}))},0)}render(){var i,s;const e=document.querySelector(this.for);return Q(this,g,e),Q(this,k,m(this,g).map),this.drawLayer=m(this,k).getLayers().getArray().find(n=>n.get("id")===this.layer),this.requestUpdate(),wt`
|
|
126
127
|
<style>
|
|
127
|
-
${
|
|
128
|
-
${!this.unstyled&&
|
|
128
|
+
${Tt}
|
|
129
|
+
${!this.unstyled&&Ot}
|
|
129
130
|
</style>
|
|
130
131
|
<div>
|
|
131
132
|
<slot></slot>
|
|
132
133
|
<button
|
|
133
134
|
data-cy="drawBtn"
|
|
134
|
-
class="icon
|
|
135
|
+
class="polygon icon"
|
|
135
136
|
disabled="${!this.multipleFeatures&&((i=this.drawnFeatures)==null?void 0:i.length)>0||this.currentlyDrawing||$}"
|
|
136
137
|
@click="${()=>this.startDrawing()}"
|
|
137
138
|
>
|
|
@@ -139,11 +140,11 @@ button.polygon:before {
|
|
|
139
140
|
</button>
|
|
140
141
|
<button
|
|
141
142
|
data-cy="discardBtn"
|
|
142
|
-
class="discard"
|
|
143
|
+
class="discard icon"
|
|
143
144
|
disabled="${!((s=this.drawnFeatures)!=null&&s.length)&&!this.currentlyDrawing||$}"
|
|
144
145
|
@click="${()=>this.discardDrawing()}"
|
|
145
146
|
>
|
|
146
147
|
discard
|
|
147
148
|
</button>
|
|
148
149
|
</div>
|
|
149
|
-
`}}
|
|
150
|
+
`}}g=new WeakMap,k=new WeakMap,customElements.define("eox-drawtools",$t),p.EOxDrawTools=$t,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/test/_mockMap.js
CHANGED
|
@@ -2,14 +2,17 @@ export class MockMap extends HTMLElement {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
super();
|
|
4
4
|
}
|
|
5
|
+
features = [{}];
|
|
5
6
|
map = {
|
|
6
7
|
getLayers: () => ({
|
|
7
8
|
getArray: () => [
|
|
8
9
|
{
|
|
9
10
|
get: () => "draw",
|
|
10
11
|
getSource: () => ({
|
|
11
|
-
clear: () =>
|
|
12
|
-
|
|
12
|
+
clear: () => {
|
|
13
|
+
this.features = [];
|
|
14
|
+
},
|
|
15
|
+
getFeatures: () => this.features,
|
|
13
16
|
}),
|
|
14
17
|
},
|
|
15
18
|
],
|