@eox/drawtools
Advanced tools
Comparing version 0.2.0 to 0.3.0
var _t = Object.defineProperty; | ||
var $t = (r, t, e) => t in r ? _t(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e; | ||
var u = (r, t, e) => ($t(r, typeof t != "symbol" ? t + "" : t, e), e); | ||
var p = (r, t, e) => ($t(r, typeof t != "symbol" ? t + "" : t, e), e); | ||
/** | ||
@@ -9,3 +9,3 @@ * @license | ||
*/ | ||
const T = window, G = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), Q = /* @__PURE__ */ new WeakMap(); | ||
const D = window, Q = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), G = /* @__PURE__ */ new WeakMap(); | ||
let vt = class { | ||
@@ -20,5 +20,5 @@ constructor(t, e, i) { | ||
const e = this.t; | ||
if (G && t === void 0) { | ||
if (Q && t === void 0) { | ||
const i = e !== void 0 && e.length === 1; | ||
i && (t = Q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Q.set(e, t)); | ||
i && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && G.set(e, t)); | ||
} | ||
@@ -32,7 +32,7 @@ return t; | ||
const yt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, ht), ft = (r, t) => { | ||
G ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => { | ||
const i = document.createElement("style"), s = T.litNonce; | ||
Q ? 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); | ||
}); | ||
}, X = G ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
}, X = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
let e = ""; | ||
@@ -49,3 +49,3 @@ for (const i of t.cssRules) | ||
var j; | ||
const I = window, Y = I.trustedTypes, gt = Y ? Y.emptyScript : "", tt = I.reactiveElementPolyfillSupport, K = { toAttribute(r, t) { | ||
const k = window, Y = k.trustedTypes, gt = Y ? Y.emptyScript : "", tt = k.reactiveElementPolyfillSupport, K = { toAttribute(r, t) { | ||
switch (t) { | ||
@@ -79,3 +79,3 @@ case Boolean: | ||
} }, dt = (r, t) => t !== r && (t == t || r == r), z = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged: dt }, J = "finalized"; | ||
let E = class extends HTMLElement { | ||
let w = class extends HTMLElement { | ||
constructor() { | ||
@@ -106,4 +106,4 @@ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u(); | ||
}, set(s) { | ||
const n = this[t]; | ||
this[e] = s, this.requestUpdate(t, n, i); | ||
const o = this[t]; | ||
this[e] = s, this.requestUpdate(t, o, i); | ||
}, configurable: !0, enumerable: !0 }; | ||
@@ -183,6 +183,6 @@ } | ||
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 : K).toAttribute(e, i.type); | ||
this._$El = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$El = null; | ||
const o = this.constructor._$Ep(t, i); | ||
if (o !== void 0 && i.reflect === !0) { | ||
const n = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : K).toAttribute(e, i.type); | ||
this._$El = t, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$El = null; | ||
} | ||
@@ -192,6 +192,6 @@ } | ||
var i; | ||
const s = this.constructor, n = s._$Ev.get(t); | ||
if (n !== void 0 && this._$El !== n) { | ||
const o = s.getPropertyOptions(n), d = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((i = o.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? o.converter : K; | ||
this._$El = n, this[n] = d.fromAttribute(e, o.type), this._$El = null; | ||
const s = this.constructor, o = s._$Ev.get(t); | ||
if (o !== void 0 && this._$El !== o) { | ||
const n = s.getPropertyOptions(o), d = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? n.converter : K; | ||
this._$El = o, this[o] = d.fromAttribute(e, n.type), this._$El = null; | ||
} | ||
@@ -220,3 +220,3 @@ } | ||
return; | ||
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, n) => this[n] = s), this._$Ei = void 0); | ||
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0); | ||
let e = !1; | ||
@@ -226,4 +226,4 @@ const i = this._$AL; | ||
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); | ||
var o; | ||
return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s); | ||
}), this.update(i)) : this._$Ek(); | ||
@@ -264,3 +264,3 @@ } catch (s) { | ||
}; | ||
E[J] = !0, E.elementProperties = /* @__PURE__ */ new Map(), E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, tt == null || tt({ ReactiveElement: E }), ((j = I.reactiveElementVersions) !== null && j !== void 0 ? j : I.reactiveElementVersions = []).push("1.6.2"); | ||
w[J] = !0, w.elementProperties = /* @__PURE__ */ new Map(), w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, tt == null || tt({ ReactiveElement: w }), ((j = k.reactiveElementVersions) !== null && j !== void 0 ? j : k.reactiveElementVersions = []).push("1.6.2"); | ||
/** | ||
@@ -272,16 +272,16 @@ * @license | ||
var B; | ||
const k = window, S = k.trustedTypes, et = S ? S.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, ct = "?" + f, mt = `<${ct}>`, A = document, P = () => A.createComment(""), U = (r) => r === null || typeof r != "object" && typeof r != "function", pt = Array.isArray, At = (r) => pt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", F = `[ | ||
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, st = />/g, g = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ | ||
\f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, ot = /"/g, ut = /^(?:script|style|textarea|title)$/i, wt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Et = wt(1), b = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), m = A.createTreeWalker(A, 129, null, !1), St = (r, t) => { | ||
const R = window, E = R.trustedTypes, et = E ? E.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, ct = "?" + f, At = `<${ct}>`, m = document, U = () => m.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", ut = Array.isArray, mt = (r) => ut(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", F = `[ | ||
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, st = />/g, g = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ | ||
\f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, nt = /"/g, pt = /^(?:script|style|textarea|title)$/i, wt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Et = wt(1), S = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), A = m.createTreeWalker(m, 129, null, !1), St = (r, t) => { | ||
const e = r.length - 1, i = []; | ||
let s, n = t === 2 ? "<svg>" : "", o = M; | ||
let s, o = t === 2 ? "<svg>" : "", n = x; | ||
for (let l = 0; l < e; l++) { | ||
const a = r[l]; | ||
let y, h, c = -1, $ = 0; | ||
for (; $ < a.length && (o.lastIndex = $, h = o.exec(a), h !== null); ) | ||
$ = o.lastIndex, o === M ? h[1] === "!--" ? o = it : h[1] !== void 0 ? o = st : h[2] !== void 0 ? (ut.test(h[2]) && (s = RegExp("</" + h[2], "g")), o = g) : h[3] !== void 0 && (o = g) : o === g ? h[0] === ">" ? (o = s ?? M, c = -1) : h[1] === void 0 ? c = -2 : (c = o.lastIndex - h[2].length, y = h[1], o = h[3] === void 0 ? g : h[3] === '"' ? ot : rt) : o === ot || o === rt ? o = g : o === it || o === st ? o = M : (o = g, s = void 0); | ||
const N = o === g && r[l + 1].startsWith("/>") ? " " : ""; | ||
n += o === M ? a + mt : c >= 0 ? (i.push(y), a.slice(0, c) + Z + a.slice(c) + f + N) : a + f + (c === -2 ? (i.push(void 0), l) : N); | ||
let y, h, c = -1, _ = 0; | ||
for (; _ < a.length && (n.lastIndex = _, h = n.exec(a), h !== null); ) | ||
_ = n.lastIndex, n === x ? h[1] === "!--" ? n = it : h[1] !== void 0 ? n = st : h[2] !== void 0 ? (pt.test(h[2]) && (s = RegExp("</" + h[2], "g")), n = g) : h[3] !== void 0 && (n = g) : n === g ? h[0] === ">" ? (n = s ?? x, c = -1) : h[1] === void 0 ? c = -2 : (c = n.lastIndex - h[2].length, y = h[1], n = h[3] === void 0 ? g : h[3] === '"' ? nt : rt) : n === nt || n === rt ? n = g : n === it || n === st ? n = x : (n = g, s = void 0); | ||
const O = n === g && r[l + 1].startsWith("/>") ? " " : ""; | ||
o += n === x ? a + At : c >= 0 ? (i.push(y), a.slice(0, c) + Z + a.slice(c) + f + O) : a + f + (c === -2 ? (i.push(void 0), l) : O); | ||
} | ||
const d = n + (r[e] || "<?>") + (t === 2 ? "</svg>" : ""); | ||
const d = o + (r[e] || "<?>") + (t === 2 ? "</svg>" : ""); | ||
if (!Array.isArray(r) || !r.hasOwnProperty("raw")) | ||
@@ -295,9 +295,9 @@ throw Error("invalid template strings array"); | ||
this.parts = []; | ||
let n = 0, o = 0; | ||
let o = 0, n = 0; | ||
const d = t.length - 1, l = this.parts, [a, y] = St(t, e); | ||
if (this.el = H.createElement(a, i), m.currentNode = this.el.content, e === 2) { | ||
if (this.el = H.createElement(a, i), A.currentNode = this.el.content, e === 2) { | ||
const h = this.el.content, c = h.firstChild; | ||
c.remove(), h.append(...c.childNodes); | ||
} | ||
for (; (s = m.nextNode()) !== null && l.length < d; ) { | ||
for (; (s = A.nextNode()) !== null && l.length < d; ) { | ||
if (s.nodeType === 1) { | ||
@@ -308,8 +308,8 @@ if (s.hasAttributes()) { | ||
if (c.endsWith(Z) || c.startsWith(f)) { | ||
const $ = y[o++]; | ||
if (h.push(c), $ !== void 0) { | ||
const N = s.getAttribute($.toLowerCase() + Z).split(f), O = /([.?@])?(.*)/.exec($); | ||
l.push({ type: 1, index: n, name: O[2], strings: N, ctor: O[1] === "." ? Ct : O[1] === "?" ? xt : O[1] === "@" ? Pt : R }); | ||
const _ = y[n++]; | ||
if (h.push(c), _ !== void 0) { | ||
const O = s.getAttribute(_.toLowerCase() + Z).split(f), T = /([.?@])?(.*)/.exec(_); | ||
l.push({ type: 1, index: o, name: T[2], strings: O, ctor: T[1] === "." ? Ct : T[1] === "?" ? Pt : T[1] === "@" ? Ut : I }); | ||
} else | ||
l.push({ type: 6, index: n }); | ||
l.push({ type: 6, index: o }); | ||
} | ||
@@ -319,9 +319,9 @@ for (const c of h) | ||
} | ||
if (ut.test(s.tagName)) { | ||
if (pt.test(s.tagName)) { | ||
const h = s.textContent.split(f), c = h.length - 1; | ||
if (c > 0) { | ||
s.textContent = S ? S.emptyScript : ""; | ||
for (let $ = 0; $ < c; $++) | ||
s.append(h[$], P()), m.nextNode(), l.push({ type: 2, index: ++n }); | ||
s.append(h[c], P()); | ||
s.textContent = E ? E.emptyScript : ""; | ||
for (let _ = 0; _ < c; _++) | ||
s.append(h[_], U()), A.nextNode(), l.push({ type: 2, index: ++o }); | ||
s.append(h[c], U()); | ||
} | ||
@@ -331,23 +331,23 @@ } | ||
if (s.data === ct) | ||
l.push({ type: 2, index: n }); | ||
l.push({ type: 2, index: o }); | ||
else { | ||
let h = -1; | ||
for (; (h = s.data.indexOf(f, h + 1)) !== -1; ) | ||
l.push({ type: 7, index: n }), h += f.length - 1; | ||
l.push({ type: 7, index: o }), h += f.length - 1; | ||
} | ||
n++; | ||
o++; | ||
} | ||
} | ||
static createElement(t, e) { | ||
const i = A.createElement("template"); | ||
const i = m.createElement("template"); | ||
return i.innerHTML = t, i; | ||
} | ||
} | ||
function C(r, t, e = r, i) { | ||
var s, n, o, d; | ||
if (t === b) | ||
function b(r, t, e = r, i) { | ||
var s, o, n, d; | ||
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 = U(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 = (d = e)._$Co) !== null && o !== void 0 ? o : d._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = C(r, l._$AS(r, t.values), l, i)), t; | ||
const a = M(t) ? void 0 : t._$litDirective$; | ||
return (l == null ? void 0 : l.constructor) !== a && ((o = l == null ? void 0 : l._$AO) === null || o === void 0 || o.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((n = (d = e)._$Co) !== null && n !== void 0 ? n : d._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = b(r, l._$AS(r, t.values), l, i)), t; | ||
} | ||
@@ -366,13 +366,13 @@ class bt { | ||
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); | ||
m.currentNode = n; | ||
let o = m.nextNode(), d = 0, l = 0, a = s[0]; | ||
const { el: { content: i }, parts: s } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : m).importNode(i, !0); | ||
A.currentNode = o; | ||
let n = A.nextNode(), d = 0, l = 0, a = s[0]; | ||
for (; a !== void 0; ) { | ||
if (d === a.index) { | ||
let y; | ||
a.type === 2 ? y = new D(o, o.nextSibling, this, t) : a.type === 1 ? y = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (y = new Ut(o, this, t)), this._$AV.push(y), a = s[++l]; | ||
a.type === 2 ? y = new N(n, n.nextSibling, this, t) : a.type === 1 ? y = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (y = new Mt(n, this, t)), this._$AV.push(y), a = s[++l]; | ||
} | ||
d !== (a == null ? void 0 : a.index) && (o = m.nextNode(), d++); | ||
d !== (a == null ? void 0 : a.index) && (n = A.nextNode(), d++); | ||
} | ||
return m.currentNode = A, n; | ||
return A.currentNode = m, o; | ||
} | ||
@@ -385,6 +385,6 @@ v(t) { | ||
} | ||
class D { | ||
class N { | ||
constructor(t, e, i, s) { | ||
var n; | ||
this.type = 2, this._$AH = p, 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; | ||
var o; | ||
this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cp = (o = s == null ? void 0 : s.isConnected) === null || o === void 0 || o; | ||
} | ||
@@ -407,3 +407,3 @@ get _$AU() { | ||
_$AI(t, e = this) { | ||
t = C(this, t, e), U(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== b && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : At(t) ? this.T(t) : this._(t); | ||
t = b(this, t, e), M(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : mt(t) ? this.T(t) : this._(t); | ||
} | ||
@@ -417,24 +417,24 @@ k(t) { | ||
_(t) { | ||
this._$AH !== p && U(this._$AH) ? this._$AA.nextSibling.data = t : this.$(A.createTextNode(t)), this._$AH = t; | ||
this._$AH !== u && M(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.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 = H.createElement(s.h, this.options)), s); | ||
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === n) | ||
const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = H.createElement(s.h, this.options)), s); | ||
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o) | ||
this._$AH.v(i); | ||
else { | ||
const o = new bt(n, this), d = o.u(this.options); | ||
o.v(i), this.$(d), this._$AH = o; | ||
const n = new bt(o, this), d = n.u(this.options); | ||
n.v(i), this.$(d), this._$AH = n; | ||
} | ||
} | ||
_$AC(t) { | ||
let e = nt.get(t.strings); | ||
return e === void 0 && nt.set(t.strings, e = new H(t)), e; | ||
let e = ot.get(t.strings); | ||
return e === void 0 && ot.set(t.strings, e = new H(t)), e; | ||
} | ||
T(t) { | ||
pt(this._$AH) || (this._$AH = [], this._$AR()); | ||
ut(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 D(this.k(P()), this.k(P()), this, this.options)) : i = e[s], i._$AI(n), s++; | ||
for (const o of t) | ||
s === e.length ? e.push(i = new N(this.k(U()), this.k(U()), this, this.options)) : i = e[s], i._$AI(o), s++; | ||
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s); | ||
@@ -454,5 +454,5 @@ } | ||
} | ||
class R { | ||
constructor(t, e, i, s, n) { | ||
this.type = 1, this._$AH = p, 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 = p; | ||
class I { | ||
constructor(t, e, i, s, o) { | ||
this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u; | ||
} | ||
@@ -466,19 +466,19 @@ get tagName() { | ||
_$AI(t, e = this, i, s) { | ||
const n = this.strings; | ||
let o = !1; | ||
if (n === void 0) | ||
t = C(this, t, e, 0), o = !U(t) || t !== this._$AH && t !== b, o && (this._$AH = t); | ||
const o = this.strings; | ||
let n = !1; | ||
if (o === void 0) | ||
t = b(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== S, n && (this._$AH = t); | ||
else { | ||
const d = t; | ||
let l, a; | ||
for (t = n[0], l = 0; l < n.length - 1; l++) | ||
a = C(this, d[i + l], e, l), a === b && (a = this._$AH[l]), o || (o = !U(a) || a !== this._$AH[l]), a === p ? t = p : t !== p && (t += (a ?? "") + n[l + 1]), this._$AH[l] = a; | ||
for (t = o[0], l = 0; l < o.length - 1; l++) | ||
a = b(this, d[i + l], e, l), a === S && (a = this._$AH[l]), n || (n = !M(a) || a !== this._$AH[l]), a === u ? t = u : t !== u && (t += (a ?? "") + o[l + 1]), this._$AH[l] = a; | ||
} | ||
o && !s && this.j(t); | ||
n && !s && this.j(t); | ||
} | ||
j(t) { | ||
t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); | ||
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); | ||
} | ||
} | ||
class Ct extends R { | ||
class Ct extends I { | ||
constructor() { | ||
@@ -488,7 +488,7 @@ super(...arguments), this.type = 3; | ||
j(t) { | ||
this.element[this.name] = t === p ? void 0 : t; | ||
this.element[this.name] = t === u ? void 0 : t; | ||
} | ||
} | ||
const Mt = S ? S.emptyScript : ""; | ||
class xt extends R { | ||
const xt = E ? E.emptyScript : ""; | ||
class Pt extends I { | ||
constructor() { | ||
@@ -498,15 +498,15 @@ super(...arguments), this.type = 4; | ||
j(t) { | ||
t && t !== p ? this.element.setAttribute(this.name, Mt) : this.element.removeAttribute(this.name); | ||
t && t !== u ? this.element.setAttribute(this.name, xt) : this.element.removeAttribute(this.name); | ||
} | ||
} | ||
class Pt extends R { | ||
constructor(t, e, i, s, n) { | ||
super(t, e, i, s, n), this.type = 5; | ||
class Ut extends I { | ||
constructor(t, e, i, s, o) { | ||
super(t, e, i, s, o), this.type = 5; | ||
} | ||
_$AI(t, e = this) { | ||
var i; | ||
if ((t = (i = C(this, t, e, 0)) !== null && i !== void 0 ? i : p) === b) | ||
if ((t = (i = b(this, t, e, 0)) !== null && i !== void 0 ? i : u) === S) | ||
return; | ||
const s = this._$AH, n = t === p && s !== p || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== p && (s === p || n); | ||
n && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
const s = this._$AH, o = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== u && (s === u || o); | ||
o && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
} | ||
@@ -518,3 +518,3 @@ handleEvent(t) { | ||
} | ||
class Ut { | ||
class Mt { | ||
constructor(t, e, i) { | ||
@@ -527,16 +527,16 @@ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i; | ||
_$AI(t) { | ||
C(this, t); | ||
b(this, t); | ||
} | ||
} | ||
const lt = k.litHtmlPolyfillSupport; | ||
lt == null || lt(H, D), ((B = k.litHtmlVersions) !== null && B !== void 0 ? B : k.litHtmlVersions = []).push("2.7.4"); | ||
const lt = R.litHtmlPolyfillSupport; | ||
lt == null || lt(H, N), ((B = R.litHtmlVersions) !== null && B !== void 0 ? B : R.litHtmlVersions = []).push("2.7.4"); | ||
const Ht = (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 o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t; | ||
let n = o._$litPart$; | ||
if (n === void 0) { | ||
const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null; | ||
n._$litPart$ = o = new D(t.insertBefore(P(), d), d, void 0, e ?? {}); | ||
o._$litPart$ = n = new N(t.insertBefore(U(), d), d, void 0, e ?? {}); | ||
} | ||
return o._$AI(r), o; | ||
return n._$AI(r), n; | ||
}; | ||
@@ -549,3 +549,3 @@ /** | ||
var q, V; | ||
class x extends E { | ||
class P extends w { | ||
constructor() { | ||
@@ -572,8 +572,8 @@ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; | ||
render() { | ||
return b; | ||
return S; | ||
} | ||
} | ||
x.finalized = !0, x._$litElement$ = !0, (q = globalThis.litElementHydrateSupport) === null || q === void 0 || q.call(globalThis, { LitElement: x }); | ||
P.finalized = !0, P._$litElement$ = !0, (q = globalThis.litElementHydrateSupport) === null || q === void 0 || q.call(globalThis, { LitElement: P }); | ||
const at = globalThis.litElementPolyfillSupport; | ||
at == null || at({ LitElement: x }); | ||
at == null || at({ LitElement: P }); | ||
((V = globalThis.litElementVersions) !== null && V !== void 0 ? V : globalThis.litElementVersions = []).push("3.3.2"); | ||
@@ -585,6 +585,6 @@ /** | ||
*/ | ||
const Dt = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(r, t) : ((e, i) => { | ||
const { kind: s, elements: n } = i; | ||
return { kind: s, elements: n, finisher(o) { | ||
customElements.define(e, o); | ||
const Nt = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(r, t) : ((e, i) => { | ||
const { kind: s, elements: o } = i; | ||
return { kind: s, elements: o, finisher(n) { | ||
customElements.define(e, n); | ||
} }; | ||
@@ -597,3 +597,3 @@ })(r, t); | ||
*/ | ||
const Nt = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) { | ||
const Ot = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) { | ||
e.createProperty(t.key, r); | ||
@@ -604,7 +604,7 @@ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() { | ||
e.createProperty(t.key, r); | ||
} }, Ot = (r, t, e) => { | ||
} }, Tt = (r, t, e) => { | ||
t.constructor.createProperty(e, r); | ||
}; | ||
function L(r) { | ||
return (t, e) => e !== void 0 ? Ot(r, t, e) : Nt(r, t); | ||
return (t, e) => e !== void 0 ? Tt(r, t, e) : Ot(r, t); | ||
} | ||
@@ -616,3 +616,3 @@ /** | ||
*/ | ||
function w(r) { | ||
function C(r) { | ||
return L({ ...r, state: !0 }); | ||
@@ -627,3 +627,3 @@ } | ||
((W = window.HTMLSlotElement) === null || W === void 0 ? void 0 : W.prototype.assignedElements) != null; | ||
const Tt = ` | ||
const Dt = ` | ||
:host { | ||
@@ -633,44 +633,33 @@ display: block; | ||
`; | ||
var It = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, v = (r, t, e, i) => { | ||
for (var s = i > 1 ? void 0 : i ? kt(t, e) : t, n = r.length - 1, o; n >= 0; n--) | ||
(o = r[n]) && (s = (i ? o(t, e, s) : o(s)) || s); | ||
return i && s && It(t, e, s), s; | ||
var kt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, v = (r, t, e, i) => { | ||
for (var s = i > 1 ? void 0 : i ? Rt(t, e) : t, o = r.length - 1, n; o >= 0; o--) | ||
(n = r[o]) && (s = (i ? n(t, e, s) : n(s)) || s); | ||
return i && s && kt(t, e, s), s; | ||
}; | ||
let _ = class extends x { | ||
let $ = class extends P { | ||
constructor() { | ||
super(...arguments); | ||
u(this, "_legacyMode"); | ||
u(this, "_layerId"); | ||
u(this, "_eoxMap"); | ||
u(this, "_olMap"); | ||
u(this, "_drawLayer"); | ||
u(this, "_drawnFeatures", []); | ||
u(this, "_currentlyDrawing"); | ||
u(this, "multipleFeatures"); | ||
u(this, "for"); | ||
u(this, "layer"); | ||
u(this, "_draw"); | ||
u(this, "_modify"); | ||
p(this, "_layerId"); | ||
p(this, "_eoxMap"); | ||
p(this, "_olMap"); | ||
p(this, "_drawLayer"); | ||
p(this, "_drawnFeatures", []); | ||
p(this, "_currentlyDrawing"); | ||
p(this, "multipleFeatures"); | ||
p(this, "for"); | ||
p(this, "layer"); | ||
p(this, "_draw"); | ||
p(this, "_modify"); | ||
} | ||
async _dynamicImport() { | ||
const t = this._drawLayer.getSource(), { Draw: e, Modify: i } = await import( | ||
// @ts-ignore | ||
"https://cdn.skypack.dev/ol/interaction.js" | ||
); | ||
this._draw = new e({ | ||
source: t, | ||
type: "Polygon" | ||
}), this._modify = new i({ source: t }), this.requestUpdate(); | ||
} | ||
_startDrawing() { | ||
this._legacyMode ? (this._olMap.addInteraction(this._draw), this._olMap.addInteraction(this._modify)) : (this._eoxMap.addDraw(this._layerId, { | ||
this._eoxMap.addDraw(this._layerId, { | ||
id: "drawInteraction", | ||
type: "Polygon" | ||
}), this._draw = this._eoxMap.interactions.drawInteraction, this._modify = this._eoxMap.interactions.drawInteraction_modify), this._draw.on("drawend", (t) => this._onDrawEnd(t)), this._modify.on("modifyend", (t) => this._onModifyEnd(t)), this._currentlyDrawing = !0, this.requestUpdate(); | ||
}), this._draw = this._eoxMap.interactions.drawInteraction, this._modify = this._eoxMap.interactions.drawInteraction_modify, this._draw.on("drawend", (t) => this._onDrawEnd(t)), this._modify.on("modifyend", (t) => this._onModifyEnd(t)), this._currentlyDrawing = !0, this.requestUpdate(); | ||
} | ||
_discardDrawing() { | ||
this._drawnFeatures = [], this._legacyMode ? this._olMap.removeInteraction(this._draw) : this._eoxMap.removeInteraction("drawInteraction"), this._drawLayer.getSource().clear(), this._currentlyDrawing = !1, this.requestUpdate(); | ||
this._drawnFeatures = [], this._eoxMap.removeInteraction("drawInteraction"), this._drawLayer.getSource().clear(), this._currentlyDrawing = !1, this.requestUpdate(); | ||
} | ||
_onDrawEnd(t) { | ||
console.log(t), this._emitDrawnFeatures(), this._legacyMode ? this._olMap.removeInteraction(this._draw) : this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate(); | ||
console.log(t), this._emitDrawnFeatures(), this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate(); | ||
} | ||
@@ -691,11 +680,5 @@ _onModifyEnd(t) { | ||
const t = document.querySelector(this.for); | ||
this._layerId = this.layer, t.addDraw ? (this._eoxMap = t, this._olMap = t.map) : (this._legacyMode = !0, this._olMap = t); | ||
let e; | ||
return e = this._olMap.getLayers().getArray(), this._drawLayer = e.find( | ||
(i) => i.get("id") === this._layerId | ||
) || e.filter((i) => i.get("mapbox-layers")).find( | ||
(i) => i.get("mapbox-layers").includes(this._layerId) | ||
), this._legacyMode && this._dynamicImport(), this.requestUpdate(), Et` | ||
return this._eoxMap = t, this._olMap = t.map, this._layerId = this.layer, this._drawLayer = this._olMap.getLayers().getArray().find((e) => e.get("id") === this._layerId), this.requestUpdate(), Et` | ||
<style> | ||
${Tt} | ||
${Dt} | ||
</style> | ||
@@ -705,3 +688,3 @@ <div> | ||
<button | ||
disabled="${this._legacyMode && !this._draw || !this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || p}" | ||
disabled="${!this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || u}" | ||
@click="${() => this._startDrawing()}" | ||
@@ -712,3 +695,3 @@ > | ||
<button | ||
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || p}" | ||
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || u}" | ||
@click="${() => this._discardDrawing()}" | ||
@@ -723,36 +706,33 @@ > | ||
v([ | ||
w() | ||
], _.prototype, "_legacyMode", 2); | ||
C() | ||
], $.prototype, "_layerId", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_layerId", 2); | ||
C() | ||
], $.prototype, "_eoxMap", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_eoxMap", 2); | ||
C() | ||
], $.prototype, "_olMap", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_olMap", 2); | ||
C() | ||
], $.prototype, "_drawLayer", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_drawLayer", 2); | ||
C() | ||
], $.prototype, "_drawnFeatures", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_drawnFeatures", 2); | ||
C() | ||
], $.prototype, "_currentlyDrawing", 2); | ||
v([ | ||
w() | ||
], _.prototype, "_currentlyDrawing", 2); | ||
v([ | ||
L({ type: Boolean }) | ||
], _.prototype, "multipleFeatures", 2); | ||
], $.prototype, "multipleFeatures", 2); | ||
v([ | ||
L() | ||
], _.prototype, "for", 2); | ||
], $.prototype, "for", 2); | ||
v([ | ||
L() | ||
], _.prototype, "layer", 2); | ||
_ = v([ | ||
Dt("eox-drawtools") | ||
], _); | ||
], $.prototype, "layer", 2); | ||
$ = v([ | ||
Nt("eox-drawtools") | ||
], $); | ||
export { | ||
_ as EOxDrawTools | ||
$ as EOxDrawTools | ||
}; |
{ | ||
"name": "@eox/drawtools", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
52610
934