@martinomagnifico/tablechart 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.3] - 2026-10-26
4
+
5
+ ### Changed
6
+
7
+ - Fixes charts that should be shown directly. Labels and annotations now also show immediately.
8
+ - Trend and bracket lines stop at their badge from the start. Before, they ran through it until the chart was built.
9
+ - Gridlines leave a gap for a badge, as they do for text. The gap appears with the badge.
10
+ - Badge backgrounds no longer fade in. A fading background showed as a grey box over the marks.
11
+ - The mask under a badge goes on when the marks under it are done. Before, it waited for the whole chart.
12
+
13
+ ### Added
14
+
15
+ - `atOnce` in `setShown(state, shown, atOnce)` from `@martinomagnifico/tablechart/core`. It shows or hides a chart without transitions, with `AT_ONCE_CLASS`.
16
+ - `numbers: false` for a chart type without numbers on the chart, such as a scatter. Its numbers then stay out of the layout.
17
+
18
+ ### Fixed
19
+
20
+ - Legend keys no longer fade in when printing or when a chart is shown at once.
21
+ - Removed a layout for hidden scatter plot labels to increase performance.
22
+
23
+
24
+
3
25
  ## [1.1.2] - 2026-10-24
4
26
 
5
27
  ### Changed
@@ -1 +1 @@
1
- !function(t){var e=["circle","triangle","square","diamond"],o=["right","left","above","below","right","left","right","left"],n=t=>{const e=t.flatMap((t,e)=>t.group?[]:[e]);return{x:e[0],y:e[1],size:e[2],group:t.findIndex(t=>t.group)}},r=(t,e)=>e<0?[]:[...new Set(t.map(t=>t.cells[e]?.raw??""))],a=(t,e,o)=>t.cells[e]?.missing||t.cells[o]?.missing?null:`${t.cells[e]?.value} ${t.cells[o]?.value}`,s={aspect:.62,categories:"beside",columns:!0,axes:!0,text({figure:o,plot:s,rows:c,series:i,config:l}){const{x:u,y:f,size:h,group:d}=n(i),g=s.querySelector(":scope > .tablechart-categories")?.children??[],p=new Map;c.forEach((t,e)=>{const o=a(t,u,f);o&&(p.get(o)?.push(e)??p.set(o,[e]))});const M=t=>void 0===h?0:Math.abs(c[t].cells[h]?.value??0);for(const t of p.values()){if(t.length<2)continue;const e=t.reduce((t,e)=>M(e)>M(t)?e:t);for(const o of t){const n=g[o];o===e?n?.setAttribute("data-more",String(t.length-1)):n?.setAttribute("data-same","")}}const b=r(c,d);if(b.length<2&&void 0===h)return;const m=document.createElement("div");m.className=t.LEGEND_CLASS,m.setAttribute("aria-hidden","true"),m.inert=!0;const v=Array.from(o.querySelectorAll(`tbody tr > td:nth-of-type(${d+1})`)),x=(e,o)=>{const n=(0,t.htmlEl)(t.NAME_CLASS,m);return n.dataset.place="legend",n.dataset.line="none",n.textContent=e,o&&l.langattribute&&n.setAttribute(l.langattribute,o),n};b.length>1&&b.forEach((t,o)=>{const n=l.langattribute?v.find(e=>e.textContent?.trim()===t)?.getAttribute(l.langattribute):null,r=x(t,n);r.dataset.marker=e[o%e.length],r.style.setProperty("--n",String(o)),r.style.setProperty("--palette",`var(--tablechart-color-${o+1})`)}),void 0!==h&&(x(i[h].name,i[h].key).dataset.marker="size"),o.appendChild(m)},draw(a){const{rows:s,series:c,x:i,y:l,frame:u,unit:f,svg:h,categories:d,seriesValues:g,height:p,config:M,plot:b}=a;if(!i||!u)return;const m=n(c),v=r(s,m.group),x=v.length>1;for(const t of g.flat())t.dataset.place="none";const w=(a.length("--tablechart-marker-size","10px")??10*f)/2,y=(a.length("--tablechart-bubble-max","24px")??24*f)/2,$=t=>void 0===m.size?void 0:t.cells[m.size],S=(0,t.largest)(s.map(t=>Math.abs($(t)?.value??0))),z=s.flatMap((t,e)=>{const o=t.cells[m.x],n=t.cells[m.y];if(!o||!n||o.missing||n.missing)return[];const r=$(t),a=r&&!r.missing&&S>0?Math.max(.6*w,Math.sqrt(Math.abs(r.value)/S)*y):w,s=x?v.indexOf(t.cells[m.group]?.raw??""):-1;return[{i:e,px:i(o.value),py:l(n.value),r:a,g:s}]}),k=Math.min(z.length-1,6);b.style.setProperty("--count",String(k+1));const q=new Map([...z].sort((t,e)=>t.px-e.px||t.i-e.i).map((e,o)=>[e.i,k?(0,t.short)(o*k/(z.length-1)):0])),A=[...z].sort((t,e)=>e.r-t.r||t.i-e.i);for(const o of A){const n=x?e[o.g%e.length]:"circle";h.appendChild((0,t.markerEl)(n,o.px,o.py,o.r,{class:t.POINT_CLASS,"data-row":o.i+1,"data-marker":n,style:`--i:${q.get(o.i)}; ${x?`--n:${o.g}; --palette:var(--tablechart-color-${o.g+1})`:""}`}))}const T=b.parentElement?.getAttribute("data-chart-names"),V=null==T?M.names:"false"!==T,j=4*f,B=[u[0]+1.5*j,u[1],u[2]-1.5*j,u[3]-1.5*j],[C,D,E,F]=B,G=A.map(({i:e,px:o,py:n,r:r})=>{if(d[e].hasAttribute("data-same"))return[];const{width:a,height:s}=(0,t.sizeOf)(d[e]),c=a*f,i=s*f,l=.1*i,u=.7*r+j/2,h=(t,e)=>[Math.max(C,Math.min(t,C+E-c)),Math.max(D,Math.min(e,D+F-i))+l,c,i-2*l];return[h(o+r+j,n-i/2),h(o-r-j-c,n-i/2),h(o-c/2,n-r-j-i),h(o-c/2,n+r+j),h(o+u,n-u-i),h(o-u-c,n-u-i),h(o+u,n+u),h(o-u-c,n+u)]}),H=V?(0,t.avoidCollisions)(G,z.map(({px:t,py:e,r:o})=>[t-o,e-o,2*o,2*o]),B):A.map(()=>null);for(const t of d)t.hidden=!0,t.dataset.missing="";A.forEach((e,n)=>{const r=d[e.i],a=H[n];if(r.hidden=!1,delete r.dataset.missing,r.style.setProperty("--i",String(q.get(e.i))),r.toggleAttribute("data-left-out",null===a),null===a)return;r.dataset.side=o[a];const[s,c,,i]=G[n][a];(0,t.placeAt)(r,s,c-((0,t.sizeOf)(r).height*f-i)/2,t.VIEWBOX_WIDTH,p)}),a.rowAt=(t,e)=>{let o=null,n=6*f;for(const r of z){const a=Math.max(Math.hypot(r.px-t*f,r.py-e*f)-r.r,0);(a<n||a===n&&o&&r.r<o.r)&&(n=a,o=r)}return o?o.i:null}},tooltip(t,e){const{x:o,y:r}=n(t.series),s=a(t.rows[e],o,r),c=t.rows.flatMap((t,n)=>n===e||null!==s&&a(t,o,r)===s?[n]:[]),i=c.filter(e=>t.categories[e]?.hasAttribute("data-more"));return[...i,...c.filter(t=>!i.includes(t))].map(e=>({name:t.categories[e]?.textContent??"",value:""}))}};window.Tablechart.addType("scatter",s)}(Tablechart.kit);
1
+ !function(t){var e=["circle","triangle","square","diamond"],r=["right","left","above","below","right","left","right","left"],n=t=>{const e=t.flatMap((t,e)=>t.group?[]:[e]);return{x:e[0],y:e[1],size:e[2],group:t.findIndex(t=>t.group)}},o=(t,e)=>e<0?[]:[...new Set(t.map(t=>t.cells[e]?.raw??""))],a=(t,e,r)=>t.cells[e]?.missing||t.cells[r]?.missing?null:`${t.cells[e]?.value} ${t.cells[r]?.value}`,s={aspect:.62,categories:"beside",columns:!0,axes:!0,numbers:!1,text({figure:r,plot:s,rows:c,series:i,config:l}){const{x:u,y:h,size:d,group:f}=n(i),g=s.querySelector(":scope > .tablechart-categories")?.children??[],p=new Map;c.forEach((t,e)=>{const r=a(t,u,h);r&&(p.get(r)?.push(e)??p.set(r,[e]))});const b=t=>void 0===d?0:Math.abs(c[t].cells[d]?.value??0);for(const t of p.values()){if(t.length<2)continue;const e=t.reduce((t,e)=>b(e)>b(t)?e:t);for(const r of t){const n=g[r];r===e?n?.setAttribute("data-more",String(t.length-1)):n?.setAttribute("data-same","")}}const m=o(c,f);if(m.length<2&&void 0===d)return;const M=document.createElement("div");M.className=t.LEGEND_CLASS,M.setAttribute("aria-hidden","true"),M.inert=!0;const v=Array.from(r.querySelectorAll(`tbody tr > td:nth-of-type(${f+1})`)),x=(e,r)=>{const n=(0,t.htmlEl)(t.NAME_CLASS,M);return n.dataset.place="legend",n.dataset.line="none",n.textContent=e,r&&l.langattribute&&n.setAttribute(l.langattribute,r),n};m.length>1&&m.forEach((t,r)=>{const n=l.langattribute?v.find(e=>e.textContent?.trim()===t)?.getAttribute(l.langattribute):null,o=x(t,n);o.dataset.marker=e[r%e.length],o.style.setProperty("--n",String(r)),o.style.setProperty("--palette",`var(--tablechart-color-${r+1})`)}),void 0!==d&&(x(i[d].name,i[d].key).dataset.marker="size"),r.appendChild(M)},draw(a){const{rows:s,series:c,x:i,y:l,frame:u,unit:h,svg:d,categories:f,height:g,config:p,plot:b}=a;if(!i||!u)return;const m=n(c),M=o(s,m.group),v=M.length>1,x=(a.length("--tablechart-marker-size","10px")??10*h)/2,w=(a.length("--tablechart-bubble-max","24px")??24*h)/2,y=t=>void 0===m.size?void 0:t.cells[m.size],$=(0,t.largest)(s.map(t=>Math.abs(y(t)?.value??0))),S=s.flatMap((t,e)=>{const r=t.cells[m.x],n=t.cells[m.y];if(!r||!n||r.missing||n.missing)return[];const o=y(t),a=o&&!o.missing&&$>0?Math.max(.6*x,Math.sqrt(Math.abs(o.value)/$)*w):x,s=v?M.indexOf(t.cells[m.group]?.raw??""):-1;return[{i:e,px:i(r.value),py:l(n.value),r:a,g:s}]}),z=Math.min(S.length-1,6);b.style.setProperty("--count",String(z+1));const k=new Map([...S].sort((t,e)=>t.px-e.px||t.i-e.i).map((e,r)=>[e.i,z?(0,t.short)(r*z/(S.length-1)):0])),q=[...S].sort((t,e)=>e.r-t.r||t.i-e.i);for(const r of q){const n=v?e[r.g%e.length]:"circle";d.appendChild((0,t.markerEl)(n,r.px,r.py,r.r,{class:t.POINT_CLASS,"data-row":r.i+1,"data-marker":n,style:`--i:${k.get(r.i)}; ${v?`--n:${r.g}; --palette:var(--tablechart-color-${r.g+1})`:""}`}))}const A=b.parentElement?.getAttribute("data-chart-names"),T=null==A?p.names:"false"!==A,j=4*h,B=[u[0]+1.5*j,u[1],u[2]-1.5*j,u[3]-1.5*j],[C,D,E,F]=B,G=q.map(({i:e,px:r,py:n,r:o})=>{if(f[e].hasAttribute("data-same"))return[];const{width:a,height:s}=(0,t.sizeOf)(f[e]),c=a*h,i=s*h,l=.1*i,u=.7*o+j/2,d=(t,e)=>[Math.max(C,Math.min(t,C+E-c)),Math.max(D,Math.min(e,D+F-i))+l,c,i-2*l];return[d(r+o+j,n-i/2),d(r-o-j-c,n-i/2),d(r-c/2,n-o-j-i),d(r-c/2,n+o+j),d(r+u,n-u-i),d(r-u-c,n-u-i),d(r+u,n+u),d(r-u-c,n+u)]}),H=T?(0,t.avoidCollisions)(G,S.map(({px:t,py:e,r:r})=>[t-r,e-r,2*r,2*r]),B):q.map(()=>null);for(const t of f)t.hidden=!0,t.dataset.missing="";q.forEach((e,n)=>{const o=f[e.i],a=H[n];if(o.hidden=!1,delete o.dataset.missing,o.style.setProperty("--i",String(k.get(e.i))),o.toggleAttribute("data-left-out",null===a),null===a)return;o.dataset.side=r[a];const[s,c,,i]=G[n][a];(0,t.placeAt)(o,s,c-((0,t.sizeOf)(o).height*h-i)/2,t.VIEWBOX_WIDTH,g)}),a.rowAt=(t,e)=>{let r=null,n=6*h;for(const o of S){const a=Math.max(Math.hypot(o.px-t*h,o.py-e*h)-o.r,0);(a<n||a===n&&r&&o.r<r.r)&&(n=a,r=o)}return r?r.i:null}},tooltip(t,e){const{x:r,y:o}=n(t.series),s=a(t.rows[e],r,o),c=t.rows.flatMap((t,n)=>n===e||null!==s&&a(t,r,o)===s?[n]:[]),i=c.filter(e=>t.categories[e]?.hasAttribute("data-more"));return[...i,...c.filter(t=>!i.includes(t))].map(e=>({name:t.categories[e]?.textContent??"",value:""}))}};window.Tablechart.addType("scatter",s)}(Tablechart.kit);
@@ -1,5 +1,5 @@
1
- import { C as e, D as t, S as n, _ as r, b as i, g as a, j as o, v as s, w as c, x as l, y as u } from "./tablechart-shared.mjs";
2
- //#region src/js/charts/scatter.ts
1
+ import { M as e, O as t, S as n, T as r, _ as i, b as a, g as o, v as s, w as c, x as l, y as u } from "./tablechart-shared.mjs";
2
+ // src/js/charts/scatter.ts
3
3
  var d = [
4
4
  "circle",
5
5
  "triangle",
@@ -27,13 +27,14 @@ var d = [
27
27
  categories: "beside",
28
28
  columns: !0,
29
29
  axes: !0,
30
- text({ figure: t, plot: n, rows: r, series: a, config: o }) {
31
- let { x: s, y: l, size: u, group: f } = p(a), g = n.querySelector(":scope > .tablechart-categories")?.children ?? [], _ = /* @__PURE__ */ new Map();
32
- r.forEach((e, t) => {
30
+ numbers: !1,
31
+ text({ figure: e, plot: t, rows: n, series: i, config: o }) {
32
+ let { x: s, y: l, size: u, group: f } = p(i), g = t.querySelector(":scope > .tablechart-categories")?.children ?? [], _ = /* @__PURE__ */ new Map();
33
+ n.forEach((e, t) => {
33
34
  let n = h(e, s, l);
34
35
  n && (_.get(n)?.push(t) ?? _.set(n, [t]));
35
36
  });
36
- let v = (e) => u === void 0 ? 0 : Math.abs(r[e].cells[u]?.value ?? 0);
37
+ let v = (e) => u === void 0 ? 0 : Math.abs(n[e].cells[u]?.value ?? 0);
37
38
  for (let e of _.values()) {
38
39
  if (e.length < 2) continue;
39
40
  let t = e.reduce((e, t) => v(t) > v(e) ? t : e);
@@ -42,28 +43,26 @@ var d = [
42
43
  n === t ? r?.setAttribute("data-more", String(e.length - 1)) : r?.setAttribute("data-same", "");
43
44
  }
44
45
  }
45
- let y = m(r, f);
46
+ let y = m(n, f);
46
47
  if (y.length < 2 && u === void 0) return;
47
48
  let b = document.createElement("div");
48
- b.className = e, b.setAttribute("aria-hidden", "true"), b.inert = !0;
49
- let x = Array.from(t.querySelectorAll(`tbody tr > td:nth-of-type(${f + 1})`)), S = (e, t) => {
50
- let n = i(c, b);
49
+ b.className = c, b.setAttribute("aria-hidden", "true"), b.inert = !0;
50
+ let x = Array.from(e.querySelectorAll(`tbody tr > td:nth-of-type(${f + 1})`)), S = (e, t) => {
51
+ let n = a(r, b);
51
52
  return n.dataset.place = "legend", n.dataset.line = "none", n.textContent = e, t && o.langattribute && n.setAttribute(o.langattribute, t), n;
52
53
  };
53
54
  y.length > 1 && y.forEach((e, t) => {
54
55
  let n = o.langattribute ? x.find((t) => t.textContent?.trim() === e)?.getAttribute(o.langattribute) : null, r = S(e, n);
55
56
  r.dataset.marker = d[t % d.length], r.style.setProperty("--n", String(t)), r.style.setProperty("--palette", `var(--tablechart-color-${t + 1})`);
56
- }), u !== void 0 && (S(a[u].name, a[u].key).dataset.marker = "size"), t.appendChild(b);
57
+ }), u !== void 0 && (S(i[u].name, i[u].key).dataset.marker = "size"), e.appendChild(b);
57
58
  },
58
- draw(e) {
59
- let { rows: i, series: c, x: h, y: g, frame: _, unit: v, svg: y, categories: b, seriesValues: x, height: S, config: C, plot: w } = e;
59
+ draw(r) {
60
+ let { rows: a, series: c, x: h, y: g, frame: _, unit: v, svg: y, categories: b, height: x, config: S, plot: C } = r;
60
61
  if (!h || !_) return;
61
- let T = p(c), E = m(i, T.group), D = E.length > 1;
62
- for (let e of x.flat()) e.dataset.place = "none";
63
- let O = (e.length("--tablechart-marker-size", "10px") ?? 10 * v) / 2, k = (e.length("--tablechart-bubble-max", "24px") ?? 24 * v) / 2, A = (e) => T.size === void 0 ? void 0 : e.cells[T.size], j = u(i.map((e) => Math.abs(A(e)?.value ?? 0))), M = i.flatMap((e, t) => {
64
- let n = e.cells[T.x], r = e.cells[T.y];
62
+ let w = p(c), T = m(a, w.group), E = T.length > 1, D = (r.length("--tablechart-marker-size", "10px") ?? 10 * v) / 2, O = (r.length("--tablechart-bubble-max", "24px") ?? 24 * v) / 2, k = (e) => w.size === void 0 ? void 0 : e.cells[w.size], A = u(a.map((e) => Math.abs(k(e)?.value ?? 0))), j = a.flatMap((e, t) => {
63
+ let n = e.cells[w.x], r = e.cells[w.y];
65
64
  if (!n || !r || n.missing || r.missing) return [];
66
- let i = A(e), a = i && !i.missing && j > 0 ? Math.max(O * .6, Math.sqrt(Math.abs(i.value) / j) * k) : O, o = D ? E.indexOf(e.cells[T.group]?.raw ?? "") : -1;
65
+ let i = k(e), a = i && !i.missing && A > 0 ? Math.max(D * .6, Math.sqrt(Math.abs(i.value) / A) * O) : D, o = E ? T.indexOf(e.cells[w.group]?.raw ?? "") : -1;
67
66
  return [{
68
67
  i: t,
69
68
  px: h(n.value),
@@ -71,57 +70,57 @@ var d = [
71
70
  r: a,
72
71
  g: o
73
72
  }];
74
- }), N = Math.min(M.length - 1, 6);
75
- w.style.setProperty("--count", String(N + 1));
76
- let P = new Map([...M].sort((e, t) => e.px - t.px || e.i - t.i).map((e, t) => [e.i, N ? n(t * N / (M.length - 1)) : 0])), F = [...M].sort((e, t) => t.r - e.r || e.i - t.i);
77
- for (let e of F) {
78
- let n = D ? d[e.g % d.length] : "circle";
79
- y.appendChild(a(n, e.px, e.py, e.r, {
73
+ }), M = Math.min(j.length - 1, 6);
74
+ C.style.setProperty("--count", String(M + 1));
75
+ let N = new Map([...j].sort((e, t) => e.px - t.px || e.i - t.i).map((e, t) => [e.i, M ? n(t * M / (j.length - 1)) : 0])), P = [...j].sort((e, t) => t.r - e.r || e.i - t.i);
76
+ for (let e of P) {
77
+ let n = E ? d[e.g % d.length] : "circle";
78
+ y.appendChild(o(n, e.px, e.py, e.r, {
80
79
  class: t,
81
80
  "data-row": e.i + 1,
82
81
  "data-marker": n,
83
- style: `--i:${P.get(e.i)}; ${D ? `--n:${e.g}; --palette:var(--tablechart-color-${e.g + 1})` : ""}`
82
+ style: `--i:${N.get(e.i)}; ${E ? `--n:${e.g}; --palette:var(--tablechart-color-${e.g + 1})` : ""}`
84
83
  }));
85
84
  }
86
- let I = w.parentElement?.getAttribute("data-chart-names"), L = I == null ? C.names : I !== "false", R = 4 * v, z = [
87
- _[0] + 1.5 * R,
85
+ let F = C.parentElement?.getAttribute("data-chart-names"), I = F == null ? S.names : F !== "false", L = 4 * v, R = [
86
+ _[0] + 1.5 * L,
88
87
  _[1],
89
- _[2] - 1.5 * R,
90
- _[3] - 1.5 * R
91
- ], [B, V, H, U] = z, W = F.map(({ i: e, px: t, py: n, r: i }) => {
88
+ _[2] - 1.5 * L,
89
+ _[3] - 1.5 * L
90
+ ], [z, B, V, H] = R, U = P.map(({ i: e, px: t, py: n, r }) => {
92
91
  if (b[e].hasAttribute("data-same")) return [];
93
- let { width: a, height: o } = r(b[e]), s = a * v, c = o * v, l = c * .1, u = i * .7 + R / 2, d = (e, t) => [
94
- Math.max(B, Math.min(e, B + H - s)),
95
- Math.max(V, Math.min(t, V + U - c)) + l,
92
+ let { width: a, height: o } = i(b[e]), s = a * v, c = o * v, l = c * .1, u = r * .7 + L / 2, d = (e, t) => [
93
+ Math.max(z, Math.min(e, z + V - s)),
94
+ Math.max(B, Math.min(t, B + H - c)) + l,
96
95
  s,
97
96
  c - 2 * l
98
97
  ];
99
98
  return [
100
- d(t + i + R, n - c / 2),
101
- d(t - i - R - s, n - c / 2),
102
- d(t - s / 2, n - i - R - c),
103
- d(t - s / 2, n + i + R),
99
+ d(t + r + L, n - c / 2),
100
+ d(t - r - L - s, n - c / 2),
101
+ d(t - s / 2, n - r - L - c),
102
+ d(t - s / 2, n + r + L),
104
103
  d(t + u, n - u - c),
105
104
  d(t - u - s, n - u - c),
106
105
  d(t + u, n + u),
107
106
  d(t - u - s, n + u)
108
107
  ];
109
- }), G = L ? s(W, M.map(({ px: e, py: t, r: n }) => [
108
+ }), W = I ? s(U, j.map(({ px: e, py: t, r: n }) => [
110
109
  e - n,
111
110
  t - n,
112
111
  2 * n,
113
112
  2 * n
114
- ]), z) : F.map(() => null);
113
+ ]), R) : P.map(() => null);
115
114
  for (let e of b) e.hidden = !0, e.dataset.missing = "";
116
- F.forEach((e, t) => {
117
- let n = b[e.i], i = G[t];
118
- if (n.hidden = !1, delete n.dataset.missing, n.style.setProperty("--i", String(P.get(e.i))), n.toggleAttribute("data-left-out", i === null), i === null) return;
119
- n.dataset.side = f[i];
120
- let [a, s, , c] = W[t][i];
121
- l(n, a, s - (r(n).height * v - c) / 2, o, S);
122
- }), e.rowAt = (e, t) => {
115
+ P.forEach((t, n) => {
116
+ let r = b[t.i], a = W[n];
117
+ if (r.hidden = !1, delete r.dataset.missing, r.style.setProperty("--i", String(N.get(t.i))), r.toggleAttribute("data-left-out", a === null), a === null) return;
118
+ r.dataset.side = f[a];
119
+ let [o, s, , c] = U[n][a];
120
+ l(r, o, s - (i(r).height * v - c) / 2, e, x);
121
+ }), r.rowAt = (e, t) => {
123
122
  let n = null, r = 6 * v;
124
- for (let i of M) {
123
+ for (let i of j) {
125
124
  let a = Math.max(Math.hypot(i.px - e * v, i.py - t * v) - i.r, 0);
126
125
  (a < r || a === r && n && i.r < n.r) && (r = a, n = i);
127
126
  }
@@ -136,5 +135,4 @@ var d = [
136
135
  }));
137
136
  }
138
137
  };
139
- //#endregion
140
138
  export { g as scatter };
@@ -1,2 +1,2 @@
1
- import { A as defaultConfig, C as stepTo, D as PRINTING_CLASS, E as PLOT_CLASS, O as QUEUED_CLASS, S as StepPlan, T as PLACED_CLASS, b as Row, c as entranceOf, d as addType, f as build, g as unbuild, h as setShown, i as readMarkdownRows, k as SHOWN_CLASS, m as relabel, n as adoptTables, p as layout, r as loadSources, t as assignKeys, u as prepare, v as ChartState, w as Config, x as Series, y as ChartType } from "./tablechart-shared.mjs";
2
- export { type ChartState, type ChartType, type Config, PLACED_CLASS, PLOT_CLASS, PRINTING_CLASS, QUEUED_CLASS, type Row, SHOWN_CLASS, type Series, type StepPlan, addType, adoptTables, assignKeys, build, defaultConfig, entranceOf, layout, loadSources, prepare, readMarkdownRows, relabel, setShown, stepTo, unbuild };
1
+ import { A as SHOWN_CLASS, C as stepTo, D as PLOT_CLASS, E as PLACED_CLASS, O as PRINTING_CLASS, S as StepPlan, T as Config, b as Row, c as entranceOf, d as addType, f as build, g as unbuild, h as setShown, i as readMarkdownRows, j as defaultConfig, k as QUEUED_CLASS, m as relabel, n as adoptTables, p as layout, r as loadSources, t as assignKeys, u as prepare, v as ChartState, w as AT_ONCE_CLASS, x as Series, y as ChartType } from "./tablechart-shared.mjs";
2
+ export { AT_ONCE_CLASS, type ChartState, type ChartType, type Config, PLACED_CLASS, PLOT_CLASS, PRINTING_CLASS, QUEUED_CLASS, type Row, SHOWN_CLASS, type Series, type StepPlan, addType, adoptTables, assignKeys, build, defaultConfig, entranceOf, layout, loadSources, prepare, readMarkdownRows, relabel, setShown, stepTo, unbuild };
@@ -1 +1 @@
1
- export { T as PLACED_CLASS, E as PLOT_CLASS, O as PRINTING_CLASS, k as QUEUED_CLASS, A as SHOWN_CLASS, c as addType, a as adoptTables, h as assignKeys, l as build, M as defaultConfig, n as entranceOf, u as layout, o as loadSources, i as prepare, s as readMarkdownRows, d as relabel, f as setShown, m as stepTo, p as unbuild } from "./tablechart-shared.mjs";
1
+ export { C as AT_ONCE_CLASS, E as PLACED_CLASS, D as PLOT_CLASS, k as PRINTING_CLASS, A as QUEUED_CLASS, j as SHOWN_CLASS, c as addType, a as adoptTables, h as assignKeys, l as build, N as defaultConfig, n as entranceOf, u as layout, o as loadSources, i as prepare, s as readMarkdownRows, d as relabel, f as setShown, m as stepTo, p as unbuild } from "./tablechart-shared.mjs";
@@ -1,8 +1,8 @@
1
- //#region src/js/config.d.ts
2
1
  declare const PLOT_CLASS = "tablechart-plot";
3
2
  declare const PLACED_CLASS = "is-placed";
4
3
  declare const SHOWN_CLASS = "is-shown";
5
4
  declare const PRINTING_CLASS = "is-printing";
5
+ declare const AT_ONCE_CLASS = "is-at-once";
6
6
  declare const QUEUED_CLASS = "tablechart-queued";
7
7
  interface Config {
8
8
  /** Which elements Tablechart turns into charts. */
@@ -57,8 +57,6 @@ interface Config {
57
57
  debug?: boolean;
58
58
  }
59
59
  declare const defaultConfig: Config;
60
- //#endregion
61
- //#region src/js/functions/scale.d.ts
62
60
  /** A break in the scale: values from `lo` to `hi` get `share` of the length, and the cut is at `gap`. */
63
61
  interface Squeeze {
64
62
  lo: number;
@@ -66,8 +64,6 @@ interface Squeeze {
66
64
  gap: number;
67
65
  share: number;
68
66
  }
69
- //#endregion
70
- //#region src/js/steps.d.ts
71
67
  /** The steps of one chart: which step shows each row, column and annotation, and how many steps there are. */
72
68
  interface StepPlan {
73
69
  rows: {
@@ -95,8 +91,6 @@ interface StepPlan {
95
91
  * Says so with a `tablechart:step` event on the figure, unless `quietly`.
96
92
  */
97
93
  declare const stepTo: (state: ChartState, step: number, quietly?: boolean) => void;
98
- //#endregion
99
- //#region src/js/types.d.ts
100
94
  /** How a line or an area runs from one point to the next. */
101
95
  type Shape = "straight" | "step" | "smooth";
102
96
  /** How a chart builds: each element grows from zero, or the chart is revealed in one movement. */
@@ -221,6 +215,8 @@ interface ChartType {
221
215
  columns?: boolean;
222
216
  /** An axis across and an axis up, from the first two value columns, with their headers as titles. */
223
217
  axes?: boolean;
218
+ /** False: no numbers on the chart. They stay out of the layout, which costs a lot with many rows. */
219
+ numbers?: false;
224
220
  /** Text of its own, made with the rest of the text so a translation script finds it, such as a legend. */
225
221
  text?: (input: {
226
222
  figure: HTMLElement;
@@ -319,12 +315,8 @@ interface ChartState {
319
315
  controls: HTMLElement | null;
320
316
  checks: Check[];
321
317
  }
322
- //#endregion
323
- //#region src/js/charts/scatter.d.ts
324
318
  /** One marker per row, across by its first value and up by its second; a third value makes it a bubble. */
325
319
  declare const scatter: ChartType;
326
- //#endregion
327
- //#region src/js/core.d.ts
328
320
  /** Adds a chart type for `data-chart="name"`, such as one from `@martinomagnifico/tablechart/additional-types`, before `init()`. */
329
321
  declare const addType: (name: string, type: ChartType) => void;
330
322
  /** Pass 2: everything a reader will read, before a translation script looks. */
@@ -335,10 +327,11 @@ declare const layout: (state: ChartState, config: Config) => boolean;
335
327
  declare const relabel: (state: ChartState, config: Config) => void;
336
328
  /** Removes what `build` added, so the chart can be built again. */
337
329
  declare const unbuild: (state: ChartState) => void;
338
- /** One class, `is-shown`, starts the whole build. */
339
- declare const setShown: (state: ChartState, shown: boolean) => void;
340
- //#endregion
341
- //#region src/js/init.d.ts
330
+ /**
331
+ * One class, `is-shown`, starts the whole build. `atOnce` skips it: the chart lands at its end, or back at its start,
332
+ * without transitions, such as a chart in view when the page opens, or one hidden where nobody sees it.
333
+ */
334
+ declare const setShown: (state: ChartState, shown: boolean, atOnce?: boolean) => void;
342
335
  interface TablechartChart {
343
336
  figure: HTMLElement;
344
337
  /** Lays the chart out again, for example after a script has changed its text. */
@@ -376,17 +369,12 @@ declare const prepare: (found: HTMLElement[], config: Config) => Promise<HTMLEle
376
369
  declare const create: (element: HTMLElement, options?: Partial<Config>) => Promise<TablechartChart | null>;
377
370
  /** Makes a chart of every figure in `root` that matches the selector, skipping existing charts. */
378
371
  declare const init: (options?: Partial<Config>, root?: ParentNode) => Promise<TablechartInstance>;
379
- //#endregion
380
- //#region src/js/functions/sources.d.ts
381
372
  /** A Markdown table, or a caption with chart attributes, is wrapped in a figure with the caption and annotations beside it. */
382
373
  declare const adoptTables: (figures: HTMLElement[]) => HTMLElement[];
383
374
  /** `data-chart-src` fills the figure's table with the rows of a JSON file, keeping a header row the author wrote; a file that fails is reported. */
384
375
  declare const loadSources: (figures: HTMLElement[]) => Promise<void>;
385
376
  /** In a Markdown table, a bold label makes the row a total, and a bold header puts that series in focus. */
386
377
  declare const readMarkdownRows: (figures: HTMLElement[]) => void;
387
- //#endregion
388
- //#region src/js/functions/read-table.d.ts
389
378
  /** Writes translation keys such as `harvest-row1` onto a figure with `data-chart-keys`; a duplicate prefix gets a number. */
390
379
  declare const assignKeys: (figures: HTMLElement[], langattribute: string | false) => void;
391
- //#endregion
392
- export { defaultConfig as A, stepTo as C, PRINTING_CLASS as D, PLOT_CLASS as E, QUEUED_CLASS as O, StepPlan as S, PLACED_CLASS as T, scatter as _, TablechartChart as a, Row as b, entranceOf as c, addType as d, build as f, unbuild as g, setShown as h, readMarkdownRows as i, SHOWN_CLASS as k, init as l, relabel as m, adoptTables as n, TablechartInstance as o, layout as p, loadSources as r, create as s, assignKeys as t, prepare as u, ChartState as v, Config as w, Series as x, ChartType as y };
380
+ export { SHOWN_CLASS as A, stepTo as C, PLOT_CLASS as D, PLACED_CLASS as E, PRINTING_CLASS as O, StepPlan as S, Config as T, scatter as _, TablechartChart as a, Row as b, entranceOf as c, addType as d, build as f, unbuild as g, setShown as h, readMarkdownRows as i, defaultConfig as j, QUEUED_CLASS as k, init as l, relabel as m, adoptTables as n, TablechartInstance as o, layout as p, loadSources as r, create as s, assignKeys as t, prepare as u, ChartState as v, AT_ONCE_CLASS as w, Series as x, ChartType as y };