svg-path-commander 2.0.9 → 2.0.10

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.
@@ -1,6 +1,6 @@
1
1
  var te = Object.defineProperty;
2
2
  var ee = (e, t, n) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var N = (e, t, n) => (ee(e, typeof t != "symbol" ? t + "" : t, n), n);
3
+ var N = (e, t, n) => ee(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  const mt = {
5
5
  origin: [0, 0, 0],
6
6
  round: 4
@@ -166,7 +166,7 @@ const _ = (e) => Array.isArray(e) && e.every((t) => {
166
166
  r = s, s = e[n], i += r[1] * s[0] - r[0] * s[1];
167
167
  return i / 2;
168
168
  }, W = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), ae = (e) => e.reduce((t, n, r) => r ? t + W(e[r - 1], n) : 0, 0);
169
- var me = Object.defineProperty, he = (e, t, n) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (he(e, typeof t != "symbol" ? t + "" : t, n), n);
169
+ var me = Object.defineProperty, he = (e, t, n) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => he(e, typeof t != "symbol" ? t + "" : t, n);
170
170
  const ue = {
171
171
  a: 1,
172
172
  b: 0,
@@ -233,8 +233,7 @@ const ue = {
233
233
  const r = `CSSMatrix: invalid transform string "${e}"`;
234
234
  return t.split(")").filter((s) => s).forEach((s) => {
235
235
  const [i, o] = s.split("(");
236
- if (!o)
237
- throw TypeError(r);
236
+ if (!o) throw TypeError(r);
238
237
  const a = o.split(",").map((f) => f.includes("rad") ? parseFloat(f) * (180 / Math.PI) : parseFloat(f)), [l, c, m, u] = a, y = [l, c, m], g = [l, c, m, u];
239
238
  if (i === "perspective" && l && [c, m].every((f) => f === void 0))
240
239
  n.m34 = -1 / l;
@@ -1044,8 +1043,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = {
1044
1043
  return a === "circle" ? m = ke(c) : a === "ellipse" ? m = Se(c) : ["polyline", "polygon"].includes(a) ? m = Le(c) : a === "rect" ? m = $e(c) : a === "line" ? m = Te(c) : ["glyph", "path"].includes(a) && (m = Z(i ? e.getAttribute("d") || "" : e.d || "")), _(m) && m.length ? m : !1;
1045
1044
  }, at = (e, t) => {
1046
1045
  let { round: n } = mt;
1047
- if (t === "off" || n === "off")
1048
- return [...e];
1046
+ if (t === "off" || n === "off") return [...e];
1049
1047
  n = typeof t == "number" && t >= 0 ? t : n;
1050
1048
  const r = typeof n == "number" && n >= 1 ? 10 ** n : 1;
1051
1049
  return e.map((s) => {
@@ -1055,10 +1053,8 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = {
1055
1053
  }, At = (e, t) => at(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), qe = (e, t, n) => {
1056
1054
  const r = n || document, s = r.defaultView || /* istanbul ignore next */
1057
1055
  window, i = Object.keys(lt), o = e instanceof s.SVGElement, a = o ? e.tagName : null;
1058
- if (a === "path")
1059
- throw TypeError(`${k}: "${a}" is already SVGPathElement`);
1060
- if (a && i.every((h) => a !== h))
1061
- throw TypeError(`${k}: "${a}" is not SVGElement`);
1056
+ if (a === "path") throw TypeError(`${k}: "${a}" is already SVGPathElement`);
1057
+ if (a && i.every((h) => a !== h)) throw TypeError(`${k}: "${a}" is not SVGElement`);
1062
1058
  const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = o ? a : e.type, m = lt[c], u = { type: c }, y = mt.round, g = Wt(e, r), f = g && g.length ? At(g, y) : "";
1063
1059
  return o ? (m.forEach((h) => {
1064
1060
  u[h] = e.getAttribute(h);
@@ -1224,8 +1220,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = {
1224
1220
  }, Et = (e, t) => {
1225
1221
  let n = 0, r = 0, s, i, o, a, l, c;
1226
1222
  const m = Q(e), u = t && Object.keys(t);
1227
- if (!t || u && !u.length)
1228
- return [...m];
1223
+ if (!t || u && !u.length) return [...m];
1229
1224
  const y = z(m);
1230
1225
  if (!t.origin) {
1231
1226
  const { origin: M } = mt;
@@ -1278,8 +1273,7 @@ class w {
1278
1273
  if (u === "auto") {
1279
1274
  const h = `${Math.floor(Math.max(o, a))}`.length;
1280
1275
  g = h >= 4 ? 0 : 4 - h;
1281
- } else
1282
- Number.isInteger(u) || u === "off" ? g = u : g = mt.round;
1276
+ } else Number.isInteger(u) || u === "off" ? g = u : g = mt.round;
1283
1277
  let f;
1284
1278
  if (Array.isArray(y) && y.length >= 2) {
1285
1279
  const [h, x, p] = y.map(Number);