@martinomagnifico/tablechart 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,134 +0,0 @@
1
- //#region src/js/config.ts
2
- var e = "tablechart", t = "tablechart-plot", n = "tablechart-categories", r = "tablechart-value", i = "tablechart-bar", a = "tablechart-piece", o = "tablechart-rule", s = "tablechart-connector", c = "tablechart-line", l = "tablechart-reference", u = "tablechart-head", d = "tablechart-badge", f = "tablechart-caption", ee = "tablechart-slice", p = "tablechart-divide", m = "tablechart-series", h = "tablechart-area", g = "tablechart-area-fill", _ = "tablechart-name", v = "tablechart-legend", y = "tablechart-point", b = "tablechart-hole", x = "tablechart-centre", S = "tablechart-leader", C = "tablechart-break", w = "is-placed", T = "tablechart-sr", E = "tablechart-minus", D = "is-shown", O = "is-printing", k = "tablechart-queued", A = "tablechart-controls", j = "tablechart-axis", M = "tablechart-tick", te = "tablechart-grid", N = 1e3, P = {
3
- selector: "[data-chart]",
4
- aspect: .38,
5
- barfill: .58,
6
- ringfill: .42,
7
- animate: !0,
8
- entrance: .5,
9
- labels: "outside",
10
- shape: "straight",
11
- legend: !1,
12
- axis: !1,
13
- grid: !1,
14
- names: !0,
15
- tooltip: "auto",
16
- tooltipparent: null,
17
- table: "never",
18
- totallabel: "Total",
19
- controls: !0,
20
- previouslabel: "Previous",
21
- nextlabel: "Next",
22
- stephint: "step of the chart",
23
- threshold: .5,
24
- replay: !1,
25
- langattribute: "data-i18n"
26
- }, F = "http://www.w3.org/2000/svg", I = (e) => Math.round(e * 100) / 100, L = (e, t = {}) => {
27
- let n = document.createElementNS(F, e);
28
- for (let e in t) {
29
- let r = t[e];
30
- n.setAttribute(e, String(typeof r == "number" ? I(r) : r));
31
- }
32
- return n;
33
- }, R = (e, t) => [e, ...t.classes].join(" "), z = (e, t) => {
34
- let n = document.createElement("span");
35
- return n.className = e, n.inert = !0, t.appendChild(n), n;
36
- }, B = (e, t, n, r, i) => {
37
- e.style.left = `${t / r * 100}%`, e.style.top = `${n / i * 100}%`;
38
- }, V = 0, H = (e, t, n, r, i) => {
39
- if (!t.length) return;
40
- let a = `tablechart-cut-${++V}`, o = L("mask", {
41
- id: a,
42
- maskUnits: "userSpaceOnUse"
43
- });
44
- o.appendChild(L("rect", {
45
- x: -n,
46
- y: -r,
47
- width: n * 3,
48
- height: r * 3,
49
- fill: "white"
50
- }));
51
- for (let e of t) e.setAttribute("fill", "black"), o.appendChild(e);
52
- let s = e.querySelector(":scope > defs");
53
- if (s || (s = L("defs"), e.prepend(s)), s.appendChild(o), i) return i.setAttribute("mask", `url(#${a})`);
54
- let c = L("g", { mask: `url(#${a})` });
55
- for (let t of Array.from(e.childNodes)) t !== s && c.appendChild(t);
56
- e.appendChild(c);
57
- }, U = (e) => {
58
- let t = -Infinity;
59
- for (let n of e) t = Math.max(t, n);
60
- return t;
61
- }, W = (e) => (e.split(/[.,]/)[1] || "").length, G = (e, t) => new Intl.NumberFormat(t || document.documentElement.lang || void 0, {
62
- minimumFractionDigits: e,
63
- maximumFractionDigits: e
64
- }), K = (e, t, n) => {
65
- let r = G(t, n).formatToParts(e), i = r[0]?.type === "minusSign" ? r[0].value : "";
66
- return [i, r.slice(+!!i).map((e) => e.value).join("")];
67
- }, q = (e) => Number.parseFloat((e.match(/-?[\d.,]+/) || ["NaN"])[0].replace(",", ".")), J = (e, t) => e[0] < t[0] + t[2] && t[0] < e[0] + e[2] && e[1] < t[1] + t[3] && t[1] < e[1] + e[3], Y = (e, t) => e[0] >= t[0] && e[1] >= t[1] && e[0] + e[2] <= t[0] + t[2] && e[1] + e[3] <= t[1] + t[3], X = (e, t, n) => {
68
- if (e.length > 400) return e.map(() => null);
69
- let r = 1;
70
- for (let t of e) for (let [, , e, n] of t) r = Math.max(r, e, n);
71
- let i = /* @__PURE__ */ new Map(), a = ([e, t, n, i]) => {
72
- let a = [];
73
- for (let o = Math.floor(e / r); o <= Math.floor((e + n) / r); o++) for (let e = Math.floor(t / r); e <= Math.floor((t + i) / r); e++) a.push(`${o} ${e}`);
74
- return a;
75
- }, o = (e) => {
76
- for (let t of a(e)) i.get(t)?.push(e) ?? i.set(t, [e]);
77
- }, s = (e) => Y(e, n) && a(e).every((t) => !i.get(t)?.some((t) => J(e, t)));
78
- return t.forEach(o), e.map((e) => {
79
- let t = e.findIndex(s);
80
- return t < 0 ? null : (o(e[t]), t);
81
- });
82
- }, Z = /* @__PURE__ */ new WeakMap(), Q = (e) => {
83
- let t = [...e].filter((e) => !!e), n = t.map((e) => ({
84
- width: e.offsetWidth,
85
- height: e.offsetHeight
86
- }));
87
- t.forEach((e, t) => Z.set(e, n[t]));
88
- }, ne = (e) => Z.get(e) ?? {
89
- width: e.offsetWidth,
90
- height: e.offsetHeight
91
- }, $ = [
92
- "circle",
93
- "square",
94
- "diamond"
95
- ], re = (e, t) => {
96
- let n = e[t]?.marker?.toLowerCase().split(/\s+/) ?? [], r = $.find((e) => n.includes(e));
97
- return {
98
- shape: r ?? $[Math.floor(t / 2) % $.length],
99
- open: n.includes("open") || !n.includes("filled") && !r && t % 2 == 1
100
- };
101
- }, ie = (e, t, n, r, i = {}) => {
102
- if (e === "square") {
103
- let e = r * .88;
104
- return L("rect", {
105
- x: t - e,
106
- y: n - e,
107
- width: e * 2,
108
- height: e * 2,
109
- ...i
110
- });
111
- }
112
- if (e === "diamond") {
113
- let e = r * 1.2;
114
- return L("polygon", {
115
- points: `${t},${n - e} ${t + e},${n} ${t},${n + e} ${t - e},${n}`,
116
- ...i
117
- });
118
- }
119
- if (e === "triangle") {
120
- let e = r * 1.3;
121
- return L("polygon", {
122
- points: `${t},${n - e} ${t + e * .87},${n + e / 2} ${t - e * .87},${n + e / 2}`,
123
- ...i
124
- });
125
- }
126
- return L("circle", {
127
- cx: t,
128
- cy: n,
129
- r,
130
- ...i
131
- });
132
- };
133
- //#endregion
134
- export { b as A, y as B, n as C, p as D, A as E, E as F, m as G, k as H, _ as I, T as J, D as K, a as L, v as M, e as N, te as O, c as P, P as Q, w as R, C as S, s as T, l as U, O as V, o as W, r as X, M as Y, N as Z, g as _, X as a, d as b, q as c, z as d, B as f, h as g, R as h, ne as i, S as j, u as k, K as l, L as m, re as n, W as o, I as p, ee as q, Q as r, U as s, ie as t, H as u, j as v, x as w, i as x, f as y, t as z };