@eox/drawtools
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -1,4 +0,1 @@ | ||
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 p = (r, t, e) => ($t(r, typeof t != "symbol" ? t + "" : t, e), e); | ||
/** | ||
@@ -9,6 +6,6 @@ * @license | ||
*/ | ||
const k = window, Q = k.ShadowRoot && (k.ShadyCSS === void 0 || k.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), X = /* @__PURE__ */ new WeakMap(); | ||
let vt = class { | ||
const T = window, J = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, at = Symbol(), Q = /* @__PURE__ */ new WeakMap(); | ||
let ut = class { | ||
constructor(t, e, i) { | ||
if (this._$cssResult$ = !0, i !== ht) | ||
if (this._$cssResult$ = !0, i !== at) | ||
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
@@ -20,5 +17,5 @@ this.cssText = t, this.t = e; | ||
const e = this.t; | ||
if (Q && t === void 0) { | ||
if (J && 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)); | ||
i && (t = Q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Q.set(e, t)); | ||
} | ||
@@ -31,12 +28,12 @@ return t; | ||
}; | ||
const yt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, ht), ft = (r, t) => { | ||
Q ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => { | ||
const i = document.createElement("style"), s = k.litNonce; | ||
const _t = (r) => new ut(typeof r == "string" ? r : r + "", void 0, at), $t = (r, t) => { | ||
J ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => { | ||
const i = document.createElement("style"), s = T.litNonce; | ||
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i); | ||
}); | ||
}, G = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
}, X = J ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
let e = ""; | ||
for (const i of t.cssRules) | ||
e += i.cssText; | ||
return yt(e); | ||
return _t(e); | ||
})(r) : r; | ||
@@ -48,7 +45,7 @@ /** | ||
*/ | ||
var j; | ||
const R = window, Y = R.trustedTypes, gt = Y ? Y.emptyScript : "", tt = R.reactiveElementPolyfillSupport, K = { toAttribute(r, t) { | ||
var I; | ||
const D = window, G = D.trustedTypes, vt = G ? G.emptyScript : "", Y = D.reactiveElementPolyfillSupport, W = { toAttribute(r, t) { | ||
switch (t) { | ||
case Boolean: | ||
r = r ? gt : null; | ||
r = r ? vt : null; | ||
break; | ||
@@ -78,4 +75,4 @@ case Object: | ||
return e; | ||
} }, dt = (r, t) => t !== r && (t == t || r == r), z = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged: dt }, J = "finalized"; | ||
let w = class extends HTMLElement { | ||
} }, ht = (r, t) => t !== r && (t == t || r == r), B = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: ht }, K = "finalized"; | ||
let A = class extends HTMLElement { | ||
constructor() { | ||
@@ -96,3 +93,3 @@ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u(); | ||
} | ||
static createProperty(t, e = z) { | ||
static createProperty(t, e = B) { | ||
if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) { | ||
@@ -107,13 +104,13 @@ const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e); | ||
}, set(s) { | ||
const o = this[t]; | ||
this[e] = s, this.requestUpdate(t, o, i); | ||
const n = this[t]; | ||
this[e] = s, this.requestUpdate(t, n, i); | ||
}, configurable: !0, enumerable: !0 }; | ||
} | ||
static getPropertyOptions(t) { | ||
return this.elementProperties.get(t) || z; | ||
return this.elementProperties.get(t) || B; | ||
} | ||
static finalize() { | ||
if (this.hasOwnProperty(J)) | ||
if (this.hasOwnProperty(K)) | ||
return !1; | ||
this[J] = !0; | ||
this[K] = !0; | ||
const t = Object.getPrototypeOf(this); | ||
@@ -132,5 +129,5 @@ 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")) { | ||
for (const s of i) | ||
e.unshift(G(s)); | ||
e.unshift(X(s)); | ||
} else | ||
t !== void 0 && e.push(G(t)); | ||
t !== void 0 && e.push(X(t)); | ||
return e; | ||
@@ -162,3 +159,3 @@ } | ||
const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions); | ||
return ft(e, this.constructor.elementStyles), e; | ||
return $t(e, this.constructor.elementStyles), e; | ||
} | ||
@@ -184,8 +181,8 @@ connectedCallback() { | ||
} | ||
_$EO(t, e, i = z) { | ||
_$EO(t, e, i = B) { | ||
var s; | ||
const o = this.constructor._$Ep(t, i); | ||
if (o !== void 0 && i.reflect === !0) { | ||
const n = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : K).toAttribute(e, i.type); | ||
this._$El = t, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$El = null; | ||
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 : W).toAttribute(e, i.type); | ||
this._$El = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$El = null; | ||
} | ||
@@ -195,6 +192,6 @@ } | ||
var i; | ||
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; | ||
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 : W; | ||
this._$El = n, this[n] = d.fromAttribute(e, o.type), this._$El = null; | ||
} | ||
@@ -204,3 +201,3 @@ } | ||
let s = !0; | ||
t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || dt)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej()); | ||
t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || ht)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej()); | ||
} | ||
@@ -224,3 +221,3 @@ async _$Ej() { | ||
return; | ||
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0); | ||
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, n) => this[n] = s), this._$Ei = void 0); | ||
let e = !1; | ||
@@ -230,4 +227,4 @@ const i = this._$AL; | ||
e = this.shouldUpdate(i), e ? (this.willUpdate(i), (t = this._$ES) === null || t === void 0 || t.forEach((s) => { | ||
var o; | ||
return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s); | ||
var n; | ||
return (n = s.hostUpdate) === null || n === void 0 ? void 0 : n.call(s); | ||
}), this.update(i)) : this._$Ek(); | ||
@@ -268,3 +265,3 @@ } catch (s) { | ||
}; | ||
w[J] = !0, w.elementProperties = /* @__PURE__ */ new Map(), w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, tt == null || tt({ ReactiveElement: w }), ((j = R.reactiveElementVersions) !== null && j !== void 0 ? j : R.reactiveElementVersions = []).push("1.6.2"); | ||
A[K] = !0, A.elementProperties = /* @__PURE__ */ new Map(), A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, Y == null || Y({ ReactiveElement: A }), ((I = D.reactiveElementVersions) !== null && I !== void 0 ? I : D.reactiveElementVersions = []).push("1.6.2"); | ||
/** | ||
@@ -275,32 +272,32 @@ * @license | ||
*/ | ||
var B; | ||
const I = window, E = I.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) => { | ||
var z; | ||
const L = window, b = L.trustedTypes, tt = b ? b.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", y = `lit$${(Math.random() + "").slice(9)}$`, dt = "?" + y, yt = `<${dt}>`, m = document, P = () => m.createComment(""), H = (r) => r === null || typeof r != "object" && typeof r != "function", ct = Array.isArray, ft = (r) => ct(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", V = `[ | ||
\f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, it = />/g, f = RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^ | ||
\f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, rt = /"/g, pt = /^(?:script|style|textarea|title)$/i, gt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), mt = gt(1), w = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), g = m.createTreeWalker(m, 129, null, !1), At = (r, t) => { | ||
const e = r.length - 1, i = []; | ||
let s, o = t === 2 ? "<svg>" : "", n = x; | ||
let s, n = t === 2 ? "<svg>" : "", o = S; | ||
for (let l = 0; l < e; l++) { | ||
const a = r[l]; | ||
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 T = 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 + T) : a + f + (c === -2 ? (i.push(void 0), l) : T); | ||
let v, h, c = -1, _ = 0; | ||
for (; _ < a.length && (o.lastIndex = _, h = o.exec(a), h !== null); ) | ||
_ = 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); | ||
const k = o === f && r[l + 1].startsWith("/>") ? " " : ""; | ||
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); | ||
} | ||
const d = o + (r[e] || "<?>") + (t === 2 ? "</svg>" : ""); | ||
const d = n + (r[e] || "<?>") + (t === 2 ? "</svg>" : ""); | ||
if (!Array.isArray(r) || !r.hasOwnProperty("raw")) | ||
throw Error("invalid template strings array"); | ||
return [et !== void 0 ? et.createHTML(d) : d, i]; | ||
return [tt !== void 0 ? tt.createHTML(d) : d, i]; | ||
}; | ||
class H { | ||
class U { | ||
constructor({ strings: t, _$litType$: e }, i) { | ||
let s; | ||
this.parts = []; | ||
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), A.currentNode = this.el.content, e === 2) { | ||
let n = 0, o = 0; | ||
const d = t.length - 1, l = this.parts, [a, v] = At(t, e); | ||
if (this.el = U.createElement(a, i), g.currentNode = this.el.content, e === 2) { | ||
const h = this.el.content, c = h.firstChild; | ||
c.remove(), h.append(...c.childNodes); | ||
} | ||
for (; (s = A.nextNode()) !== null && l.length < d; ) { | ||
for (; (s = g.nextNode()) !== null && l.length < d; ) { | ||
if (s.nodeType === 1) { | ||
@@ -310,9 +307,9 @@ if (s.hasAttributes()) { | ||
for (const c of s.getAttributeNames()) | ||
if (c.endsWith(Z) || c.startsWith(f)) { | ||
const $ = y[n++]; | ||
if (h.push(c), $ !== void 0) { | ||
const T = s.getAttribute($.toLowerCase() + Z).split(f), D = /([.?@])?(.*)/.exec($); | ||
l.push({ type: 1, index: o, name: D[2], strings: T, ctor: D[1] === "." ? Ct : D[1] === "?" ? Pt : D[1] === "@" ? Ut : L }); | ||
if (c.endsWith(Z) || c.startsWith(y)) { | ||
const _ = v[o++]; | ||
if (h.push(c), _ !== void 0) { | ||
const k = s.getAttribute(_.toLowerCase() + Z).split(y), N = /([.?@])?(.*)/.exec(_); | ||
l.push({ type: 1, index: n, name: N[2], strings: k, ctor: N[1] === "." ? wt : N[1] === "?" ? xt : N[1] === "@" ? St : R }); | ||
} else | ||
l.push({ type: 6, index: o }); | ||
l.push({ type: 6, index: n }); | ||
} | ||
@@ -323,19 +320,19 @@ for (const c of h) | ||
if (pt.test(s.tagName)) { | ||
const h = s.textContent.split(f), c = h.length - 1; | ||
const h = s.textContent.split(y), c = h.length - 1; | ||
if (c > 0) { | ||
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()); | ||
s.textContent = b ? b.emptyScript : ""; | ||
for (let _ = 0; _ < c; _++) | ||
s.append(h[_], P()), g.nextNode(), l.push({ type: 2, index: ++n }); | ||
s.append(h[c], P()); | ||
} | ||
} | ||
} else if (s.nodeType === 8) | ||
if (s.data === ct) | ||
l.push({ type: 2, index: o }); | ||
if (s.data === dt) | ||
l.push({ type: 2, index: n }); | ||
else { | ||
let h = -1; | ||
for (; (h = s.data.indexOf(f, h + 1)) !== -1; ) | ||
l.push({ type: 7, index: o }), h += f.length - 1; | ||
for (; (h = s.data.indexOf(y, h + 1)) !== -1; ) | ||
l.push({ type: 7, index: n }), h += y.length - 1; | ||
} | ||
o++; | ||
n++; | ||
} | ||
@@ -348,9 +345,9 @@ } | ||
} | ||
function b(r, t, e = r, i) { | ||
var s, o, n, d; | ||
if (t === S) | ||
function E(r, t, e = r, i) { | ||
var s, n, o, d; | ||
if (t === w) | ||
return t; | ||
let l = i !== void 0 ? (s = e._$Co) === null || s === void 0 ? void 0 : s[i] : e._$Cl; | ||
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; | ||
const a = H(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 = E(r, l._$AS(r, t.values), l, i)), t; | ||
} | ||
@@ -369,13 +366,13 @@ class bt { | ||
var e; | ||
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]; | ||
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); | ||
g.currentNode = n; | ||
let o = g.nextNode(), d = 0, l = 0, a = s[0]; | ||
for (; a !== void 0; ) { | ||
if (d === a.index) { | ||
let y; | ||
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]; | ||
let v; | ||
a.type === 2 ? v = new M(o, o.nextSibling, this, t) : a.type === 1 ? v = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (v = new Ct(o, this, t)), this._$AV.push(v), a = s[++l]; | ||
} | ||
d !== (a == null ? void 0 : a.index) && (n = A.nextNode(), d++); | ||
d !== (a == null ? void 0 : a.index) && (o = g.nextNode(), d++); | ||
} | ||
return A.currentNode = m, o; | ||
return g.currentNode = m, n; | ||
} | ||
@@ -388,6 +385,6 @@ v(t) { | ||
} | ||
class N { | ||
class M { | ||
constructor(t, e, i, s) { | ||
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; | ||
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; | ||
} | ||
@@ -410,3 +407,3 @@ get _$AU() { | ||
_$AI(t, e = this) { | ||
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); | ||
t = E(this, t, e), H(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== w && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : ft(t) ? this.T(t) : this._(t); | ||
} | ||
@@ -420,12 +417,12 @@ k(t) { | ||
_(t) { | ||
this._$AH !== u && M(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t; | ||
this._$AH !== p && H(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t; | ||
} | ||
g(t) { | ||
var e; | ||
const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = H.createElement(s.h, this.options)), s); | ||
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o) | ||
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); | ||
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === n) | ||
this._$AH.v(i); | ||
else { | ||
const n = new bt(o, this), d = n.u(this.options); | ||
n.v(i), this.$(d), this._$AH = n; | ||
const o = new bt(n, this), d = o.u(this.options); | ||
o.v(i), this.$(d), this._$AH = o; | ||
} | ||
@@ -435,10 +432,10 @@ } | ||
let e = ot.get(t.strings); | ||
return e === void 0 && ot.set(t.strings, e = new H(t)), e; | ||
return e === void 0 && ot.set(t.strings, e = new U(t)), e; | ||
} | ||
T(t) { | ||
ut(this._$AH) || (this._$AH = [], this._$AR()); | ||
ct(this._$AH) || (this._$AH = [], this._$AR()); | ||
const e = this._$AH; | ||
let i, s = 0; | ||
for (const o of t) | ||
s === e.length ? e.push(i = new N(this.k(U()), this.k(U()), this, this.options)) : i = e[s], i._$AI(o), s++; | ||
for (const n of t) | ||
s === e.length ? e.push(i = new M(this.k(P()), this.k(P()), this, this.options)) : i = e[s], i._$AI(n), s++; | ||
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s); | ||
@@ -458,5 +455,5 @@ } | ||
} | ||
class L { | ||
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; | ||
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; | ||
} | ||
@@ -470,19 +467,19 @@ get tagName() { | ||
_$AI(t, e = this, i, s) { | ||
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); | ||
const n = this.strings; | ||
let o = !1; | ||
if (n === void 0) | ||
t = E(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== w, o && (this._$AH = t); | ||
else { | ||
const d = t; | ||
let 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; | ||
for (t = n[0], l = 0; l < n.length - 1; l++) | ||
a = E(this, d[i + l], e, l), a === w && (a = this._$AH[l]), o || (o = !H(a) || a !== this._$AH[l]), a === p ? t = p : t !== p && (t += (a ?? "") + n[l + 1]), this._$AH[l] = a; | ||
} | ||
n && !s && this.j(t); | ||
o && !s && this.j(t); | ||
} | ||
j(t) { | ||
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); | ||
t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); | ||
} | ||
} | ||
class Ct extends L { | ||
class wt extends R { | ||
constructor() { | ||
@@ -492,7 +489,7 @@ super(...arguments), this.type = 3; | ||
j(t) { | ||
this.element[this.name] = t === u ? void 0 : t; | ||
this.element[this.name] = t === p ? void 0 : t; | ||
} | ||
} | ||
const xt = E ? E.emptyScript : ""; | ||
class Pt extends L { | ||
const Et = b ? b.emptyScript : ""; | ||
class xt extends R { | ||
constructor() { | ||
@@ -502,15 +499,15 @@ super(...arguments), this.type = 4; | ||
j(t) { | ||
t && t !== u ? this.element.setAttribute(this.name, xt) : this.element.removeAttribute(this.name); | ||
t && t !== p ? this.element.setAttribute(this.name, Et) : this.element.removeAttribute(this.name); | ||
} | ||
} | ||
class Ut extends L { | ||
constructor(t, e, i, s, o) { | ||
super(t, e, i, s, o), this.type = 5; | ||
class St 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 = b(this, t, e, 0)) !== null && i !== void 0 ? i : u) === S) | ||
if ((t = (i = E(this, t, e, 0)) !== null && i !== void 0 ? i : p) === w) | ||
return; | ||
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; | ||
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; | ||
} | ||
@@ -522,3 +519,3 @@ handleEvent(t) { | ||
} | ||
class Mt { | ||
class Ct { | ||
constructor(t, e, i) { | ||
@@ -531,16 +528,16 @@ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i; | ||
_$AI(t) { | ||
b(this, t); | ||
E(this, t); | ||
} | ||
} | ||
const lt = I.litHtmlPolyfillSupport; | ||
lt == null || lt(H, N), ((B = I.litHtmlVersions) !== null && B !== void 0 ? B : I.litHtmlVersions = []).push("2.7.4"); | ||
const Ht = (r, t, e) => { | ||
const nt = L.litHtmlPolyfillSupport; | ||
nt == null || nt(U, M), ((z = L.litHtmlVersions) !== null && z !== void 0 ? z : L.litHtmlVersions = []).push("2.7.4"); | ||
const Pt = (r, t, e) => { | ||
var i, s; | ||
const o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t; | ||
let n = o._$litPart$; | ||
if (n === void 0) { | ||
const n = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t; | ||
let o = n._$litPart$; | ||
if (o === void 0) { | ||
const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null; | ||
o._$litPart$ = n = new N(t.insertBefore(U(), d), d, void 0, e ?? {}); | ||
n._$litPart$ = o = new M(t.insertBefore(P(), d), d, void 0, e ?? {}); | ||
} | ||
return n._$AI(r), n; | ||
return o._$AI(r), o; | ||
}; | ||
@@ -552,4 +549,4 @@ /** | ||
*/ | ||
var q, V; | ||
class P extends w { | ||
var j, F; | ||
class C extends A { | ||
constructor() { | ||
@@ -565,3 +562,3 @@ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; | ||
const e = this.render(); | ||
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ht(e, this.renderRoot, this.renderOptions); | ||
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Pt(e, this.renderRoot, this.renderOptions); | ||
} | ||
@@ -577,9 +574,9 @@ connectedCallback() { | ||
render() { | ||
return S; | ||
return w; | ||
} | ||
} | ||
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: P }); | ||
((V = globalThis.litElementVersions) !== null && V !== void 0 ? V : globalThis.litElementVersions = []).push("3.3.2"); | ||
C.finalized = !0, C._$litElement$ = !0, (j = globalThis.litElementHydrateSupport) === null || j === void 0 || j.call(globalThis, { LitElement: C }); | ||
const lt = globalThis.litElementPolyfillSupport; | ||
lt == null || lt({ LitElement: C }); | ||
((F = globalThis.litElementVersions) !== null && F !== void 0 ? F : globalThis.litElementVersions = []).push("3.3.2"); | ||
/** | ||
@@ -590,6 +587,6 @@ * @license | ||
*/ | ||
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); | ||
const Ht = (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); | ||
} }; | ||
@@ -602,3 +599,3 @@ })(r, t); | ||
*/ | ||
const Ot = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) { | ||
const Ut = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) { | ||
e.createProperty(t.key, r); | ||
@@ -609,7 +606,7 @@ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() { | ||
e.createProperty(t.key, r); | ||
} }, Tt = (r, t, e) => { | ||
} }, Mt = (r, t, e) => { | ||
t.constructor.createProperty(e, r); | ||
}; | ||
function O(r) { | ||
return (t, e) => e !== void 0 ? Tt(r, t, e) : Ot(r, t); | ||
return (t, e) => e !== void 0 ? Mt(r, t, e) : Ut(r, t); | ||
} | ||
@@ -621,3 +618,3 @@ /** | ||
*/ | ||
function C(r) { | ||
function x(r) { | ||
return O({ ...r, state: !0 }); | ||
@@ -630,5 +627,5 @@ } | ||
*/ | ||
var W; | ||
((W = window.HTMLSlotElement) === null || W === void 0 ? void 0 : W.prototype.assignedElements) != null; | ||
const Dt = ` | ||
var q; | ||
((q = window.HTMLSlotElement) === null || q === void 0 ? void 0 : q.prototype.assignedElements) != null; | ||
const Ot = ` | ||
:host { | ||
@@ -638,23 +635,100 @@ display: block; | ||
`, kt = ` | ||
button { | ||
/* TODO: why does this only work here and not from :root? */ | ||
--primary-color: #004170; | ||
--primary-color-hover: #004170CC; | ||
--error-color: #FF5252; | ||
display: inline-flex; | ||
align-items: center; | ||
color: #fff; | ||
border-width: 0; | ||
outline: none; | ||
border-radius: 4px; | ||
padding: 16px; | ||
height: 36px; | ||
cursor: pointer; | ||
font-family: inherit; | ||
font-size: 0.875rem; | ||
text-transform: uppercase; | ||
letter-spacing: 1.25px; | ||
font-weight: 500; | ||
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); | ||
transition-property: box-shadow, transform, opacity, background; | ||
transition-duration: 0.28s; | ||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
} | ||
button:hover { | ||
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); | ||
background: var(--primary-color-hover); | ||
} | ||
button, button:active { | ||
background: var(--primary-color); | ||
} | ||
button.outline { | ||
background: transparent; | ||
box-shadow: none; | ||
color: var(--primary-color); | ||
outline: 1px solid var(--primary-color); | ||
} | ||
button.outline:hover { | ||
background: transparent; | ||
} | ||
button.icon { | ||
background: transparent; | ||
border: none; | ||
box-shadow: none; | ||
padding: 0; | ||
border-radius: 50%; | ||
width: 24px; | ||
} | ||
button.icon-text { | ||
text-indent: 26px; | ||
} | ||
button.icon:before, button.icon-text:before { | ||
position: absolute; | ||
text-indent: 0; | ||
line-height: initial; | ||
} | ||
button.icon:before { | ||
width: 24px; | ||
height: 24px; | ||
margin-right: 0; | ||
} | ||
button.icon-text:before { | ||
width: 18px; | ||
height: 18px; | ||
} | ||
`, Nt = ` | ||
* { | ||
font-family: Roboto, sans-serif; | ||
} | ||
${kt} | ||
button.discard { | ||
background: var(--error-color); | ||
} | ||
button.polygon:before { | ||
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"); | ||
} | ||
`; | ||
var Rt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, v = (r, t, e, i) => { | ||
for (var s = i > 1 ? void 0 : i ? It(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 && Rt(t, e, s), s; | ||
var Tt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, $ = (r, t, e, i) => { | ||
for (var s = i > 1 ? void 0 : i ? Dt(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 && Tt(t, e, s), s; | ||
}; | ||
let _ = class extends P { | ||
let u = class extends C { | ||
constructor() { | ||
super(...arguments); | ||
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, "unstyled"); | ||
p(this, "_draw"); | ||
p(this, "_modify"); | ||
super(...arguments), this._drawnFeatures = []; | ||
} | ||
@@ -665,3 +739,3 @@ _startDrawing() { | ||
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", (r) => this._onDrawEnd(r)), this._modify.on("modifyend", (r) => this._onModifyEnd(r)), this._currentlyDrawing = !0, this.requestUpdate(); | ||
} | ||
@@ -671,7 +745,7 @@ _discardDrawing() { | ||
} | ||
_onDrawEnd(t) { | ||
console.log(t), this._emitDrawnFeatures(), this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate(); | ||
_onDrawEnd(r) { | ||
console.log(r), this._emitDrawnFeatures(), this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate(); | ||
} | ||
_onModifyEnd(t) { | ||
console.log(t), this._emitDrawnFeatures(); | ||
_onModifyEnd(r) { | ||
console.log(r), this._emitDrawnFeatures(); | ||
} | ||
@@ -681,14 +755,14 @@ _emitDrawnFeatures() { | ||
this._drawnFeatures = this._drawLayer.getSource().getFeatures(), this.requestUpdate(); | ||
const t = new CustomEvent("drawupdate", { | ||
const r = new CustomEvent("drawupdate", { | ||
detail: this._drawnFeatures | ||
}); | ||
this.dispatchEvent(t); | ||
this.dispatchEvent(r); | ||
}, 0); | ||
} | ||
render() { | ||
const t = document.querySelector(this.for); | ||
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` | ||
const r = document.querySelector(this.for); | ||
return this._eoxMap = r, this._olMap = r.map, this._layerId = this.layer, this._drawLayer = this._olMap.getLayers().getArray().find((t) => t.get("id") === this._layerId), this.requestUpdate(), mt` | ||
<style> | ||
${Dt} | ||
${!this.unstyled && kt} | ||
${Ot} | ||
${!this.unstyled && Nt} | ||
</style> | ||
@@ -698,3 +772,5 @@ <div> | ||
<button | ||
disabled="${!this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || u}" | ||
data-cy="drawBtn" | ||
class="icon-text polygon" | ||
disabled="${!this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || p}" | ||
@click="${() => this._startDrawing()}" | ||
@@ -705,3 +781,5 @@ > | ||
<button | ||
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || u}" | ||
data-cy="discardBtn" | ||
class="discard" | ||
disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || p}" | ||
@click="${() => this._discardDrawing()}" | ||
@@ -715,37 +793,37 @@ > | ||
}; | ||
v([ | ||
C() | ||
], _.prototype, "_layerId", 2); | ||
v([ | ||
C() | ||
], _.prototype, "_eoxMap", 2); | ||
v([ | ||
C() | ||
], _.prototype, "_olMap", 2); | ||
v([ | ||
C() | ||
], _.prototype, "_drawLayer", 2); | ||
v([ | ||
C() | ||
], _.prototype, "_drawnFeatures", 2); | ||
v([ | ||
C() | ||
], _.prototype, "_currentlyDrawing", 2); | ||
v([ | ||
$([ | ||
x() | ||
], u.prototype, "_layerId", 2); | ||
$([ | ||
x() | ||
], u.prototype, "_eoxMap", 2); | ||
$([ | ||
x() | ||
], u.prototype, "_olMap", 2); | ||
$([ | ||
x() | ||
], u.prototype, "_drawLayer", 2); | ||
$([ | ||
x() | ||
], u.prototype, "_drawnFeatures", 2); | ||
$([ | ||
x() | ||
], u.prototype, "_currentlyDrawing", 2); | ||
$([ | ||
O({ type: Boolean }) | ||
], _.prototype, "multipleFeatures", 2); | ||
v([ | ||
], u.prototype, "multipleFeatures", 2); | ||
$([ | ||
O() | ||
], _.prototype, "for", 2); | ||
v([ | ||
], u.prototype, "for", 2); | ||
$([ | ||
O() | ||
], _.prototype, "layer", 2); | ||
v([ | ||
], u.prototype, "layer", 2); | ||
$([ | ||
O({ type: Boolean }) | ||
], _.prototype, "unstyled", 2); | ||
_ = v([ | ||
Nt("eox-drawtools") | ||
], _); | ||
], u.prototype, "unstyled", 2); | ||
u = $([ | ||
Ht("eox-drawtools") | ||
], u); | ||
export { | ||
_ as EOxDrawTools | ||
u as EOxDrawTools | ||
}; |
{ | ||
"name": "@eox/drawtools", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1049
52562
6