@carto/ps-react-ui 5.5.0 → 5.6.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.
Files changed (51) hide show
  1. package/dist/actions-5-dVhroJ.js +1289 -0
  2. package/dist/actions-5-dVhroJ.js.map +1 -0
  3. package/dist/{category-C6myUFUJ.js → category-DBUD2ZBo.js} +267 -250
  4. package/dist/category-DBUD2ZBo.js.map +1 -0
  5. package/dist/scale-0elCv3tk.js +29 -0
  6. package/dist/scale-0elCv3tk.js.map +1 -0
  7. package/dist/types/widgets-v2/actions/index.d.ts +1 -1
  8. package/dist/types/widgets-v2/actions/relative-data/index.d.ts +1 -0
  9. package/dist/types/widgets-v2/actions/relative-data/labels.d.ts +3 -0
  10. package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +16 -2
  11. package/dist/types/widgets-v2/actions/relative-data/scale.d.ts +26 -0
  12. package/dist/types/widgets-v2/actions/relative-data/style.d.ts +12 -0
  13. package/dist/types/widgets-v2/category/category.d.ts +2 -1
  14. package/dist/types/widgets-v2/index.d.ts +1 -1
  15. package/dist/types/widgets-v2/wrapper/collapsed-context.d.ts +7 -0
  16. package/dist/widgets-v2/actions.js +1 -1
  17. package/dist/widgets-v2/bar.js +84 -83
  18. package/dist/widgets-v2/bar.js.map +1 -1
  19. package/dist/widgets-v2/category.js +1 -1
  20. package/dist/widgets-v2/histogram.js +108 -107
  21. package/dist/widgets-v2/histogram.js.map +1 -1
  22. package/dist/widgets-v2/scatterplot.js +120 -119
  23. package/dist/widgets-v2/scatterplot.js.map +1 -1
  24. package/dist/widgets-v2/timeseries.js +90 -89
  25. package/dist/widgets-v2/timeseries.js.map +1 -1
  26. package/dist/widgets-v2.js +223 -217
  27. package/dist/widgets-v2.js.map +1 -1
  28. package/package.json +3 -3
  29. package/src/widgets-v2/actions/index.ts +1 -0
  30. package/src/widgets-v2/actions/relative-data/index.ts +1 -0
  31. package/src/widgets-v2/actions/relative-data/labels.ts +6 -0
  32. package/src/widgets-v2/actions/relative-data/relative-data.test.tsx +78 -1
  33. package/src/widgets-v2/actions/relative-data/relative-data.tsx +137 -20
  34. package/src/widgets-v2/actions/relative-data/scale.ts +48 -0
  35. package/src/widgets-v2/actions/relative-data/style.ts +10 -0
  36. package/src/widgets-v2/bar/options.test.ts +16 -0
  37. package/src/widgets-v2/bar/options.ts +6 -2
  38. package/src/widgets-v2/category/category.relative-data.test.tsx +51 -63
  39. package/src/widgets-v2/category/category.tsx +25 -11
  40. package/src/widgets-v2/histogram/options.ts +6 -2
  41. package/src/widgets-v2/index.ts +1 -0
  42. package/src/widgets-v2/scatterplot/options.test.ts +12 -0
  43. package/src/widgets-v2/scatterplot/options.ts +18 -4
  44. package/src/widgets-v2/timeseries/options.ts +6 -2
  45. package/src/widgets-v2/toolbox/toolbox.test.tsx +28 -0
  46. package/src/widgets-v2/toolbox/toolbox.tsx +9 -0
  47. package/src/widgets-v2/wrapper/collapsed-context.ts +12 -0
  48. package/src/widgets-v2/wrapper/widget-wrapper.tsx +6 -1
  49. package/dist/actions-CwjqEm8Y.js +0 -1177
  50. package/dist/actions-CwjqEm8Y.js.map +0 -1
  51. package/dist/category-C6myUFUJ.js.map +0 -1
@@ -1,44 +1,45 @@
1
1
  import { r as e } from "../zoom-toggle-IsF8BnAp.js";
2
- import { n as t, t as n } from "../download-DGgFOaXj.js";
3
- import { r, t as i } from "../utils-Dr6gf3vD.js";
4
- import { a, d as o, f as s, i as c, s as l, u } from "../chart-config-B_fdIcD3.js";
5
- import { t as d } from "../item-color-ZYxH3NM5.js";
6
- import { c as f } from "react/compiler-runtime";
7
- import { Box as p, Skeleton as m } from "@mui/material";
8
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
9
- import * as _ from "echarts";
2
+ import { n as t } from "../scale-0elCv3tk.js";
3
+ import { n, t as r } from "../download-DGgFOaXj.js";
4
+ import { r as i, t as a } from "../utils-Dr6gf3vD.js";
5
+ import { a as o, d as s, f as c, i as l, s as u, u as d } from "../chart-config-B_fdIcD3.js";
6
+ import { t as f } from "../item-color-ZYxH3NM5.js";
7
+ import { c as p } from "react/compiler-runtime";
8
+ import { Box as m, Skeleton as h } from "@mui/material";
9
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ import * as v from "echarts";
10
11
  //#region src/widgets-v2/scatterplot/points.ts
11
- function v(e) {
12
- return x(e) ? e : [e.x, e.y];
13
- }
14
12
  function y(e) {
15
- if (Array.isArray(e)) return e.length === 2 && S(e[0]) && S(e[1]);
13
+ return S(e) ? e : [e.x, e.y];
14
+ }
15
+ function b(e) {
16
+ if (Array.isArray(e)) return e.length === 2 && C(e[0]) && C(e[1]);
16
17
  if (typeof e != "object" || !e) return !1;
17
18
  let { x: t, y: n } = e;
18
- return S(t) && S(n);
19
+ return C(t) && C(n);
19
20
  }
20
- function b(e, t, n) {
21
- return x(e) ? [t, n] : {
21
+ function x(e, t, n) {
22
+ return S(e) ? [t, n] : {
22
23
  ...e,
23
24
  x: t,
24
25
  y: n
25
26
  };
26
27
  }
27
- function x(e) {
28
+ function S(e) {
28
29
  return Array.isArray(e);
29
30
  }
30
- function S(e) {
31
+ function C(e) {
31
32
  return typeof e == "number" && Number.isFinite(e);
32
33
  }
33
34
  //#endregion
34
35
  //#region src/widgets-v2/scatterplot/options.ts
35
- function C({ theme: e, xFormatter: t, yFormatter: n }) {
36
+ function w({ theme: e, xFormatter: t, yFormatter: n }) {
36
37
  return {
37
38
  grid: {
38
39
  left: parseInt(e.spacing(1)),
39
40
  top: parseInt(e.spacing(3)),
40
41
  right: parseInt(e.spacing(1)),
41
- ...a(!1, e),
42
+ ...o(!1, e),
42
43
  containLabel: !0
43
44
  },
44
45
  tooltip: {
@@ -51,10 +52,10 @@ function C({ theme: e, xFormatter: t, yFormatter: n }) {
51
52
  fontSize: 11,
52
53
  fontFamily: e.typography.caption.fontFamily
53
54
  },
54
- position: o(e),
55
- formatter: D(t, n)
55
+ position: s(e),
56
+ formatter: O(t, n)
56
57
  },
57
- legend: { ...l({
58
+ legend: { ...u({
58
59
  hasLegend: !1,
59
60
  labelFormatter: void 0
60
61
  }) },
@@ -65,7 +66,7 @@ function C({ theme: e, xFormatter: t, yFormatter: n }) {
65
66
  axisLine: { show: !1 },
66
67
  axisTick: { show: !1 },
67
68
  axisLabel: {
68
- ...c(e),
69
+ ...l(e),
69
70
  margin: parseInt(e.spacing(1)),
70
71
  hideOverlap: !0,
71
72
  showMinLabel: !0,
@@ -82,7 +83,7 @@ function C({ theme: e, xFormatter: t, yFormatter: n }) {
82
83
  axisLine: { show: !1 },
83
84
  axisTick: { show: !1 },
84
85
  axisLabel: {
85
- ...c(e),
86
+ ...l(e),
86
87
  margin: parseInt(e.spacing(1)),
87
88
  hideOverlap: !0,
88
89
  showMinLabel: !0,
@@ -96,88 +97,88 @@ function C({ theme: e, xFormatter: t, yFormatter: n }) {
96
97
  }
97
98
  };
98
99
  }
99
- function w(t) {
100
- let { theme: n, xFormatter: a, yFormatter: o, optionsOverride: s } = t, c = t.series, l = t.symbolSize ?? 8, u = t.selection, f = u && u.length > 0 ? new Set(u) : null;
101
- return (t, u, p) => {
102
- if (t == null) {
103
- let e = C({
104
- theme: n,
105
- xFormatter: a,
106
- yFormatter: o
100
+ function T(n) {
101
+ let { theme: r, xFormatter: o, yFormatter: s, optionsOverride: c } = n, l = n.series, u = n.symbolSize ?? 8, d = n.selection, p = d && d.length > 0 ? new Set(d) : null;
102
+ return (n, d, m) => {
103
+ if (n == null) {
104
+ let e = w({
105
+ theme: r,
106
+ xFormatter: o,
107
+ yFormatter: s
107
108
  });
108
- return s ? r(e, s) : e;
109
+ return c ? i(e, c) : e;
109
110
  }
110
- let m = Array.isArray(u) ? u : [];
111
- if (m.length === 0) return {
112
- ...t,
111
+ let h = Array.isArray(d) ? d : [];
112
+ if (h.length === 0) return {
113
+ ...n,
113
114
  dataset: [],
114
115
  series: []
115
116
  };
116
- let h = m.length > 1, g = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, y = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, b = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, x = typeof t.xAxis == "object" && !Array.isArray(t.xAxis) ? t.xAxis : {}, S = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, w = p?.formatter, { niceMinX: D, niceMaxX: k, niceMinY: A, niceMaxY: j } = O(m), M = Array.isArray(t.series) ? t.series : [], N = (e, t) => {
117
- let r = d({
118
- theme: n,
117
+ let g = h.length > 1, _ = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, b = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, x = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, S = typeof n.xAxis == "object" && !Array.isArray(n.xAxis) ? n.xAxis : {}, C = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, T = m?.formatter, { niceMinX: O, niceMaxX: A, niceMinY: j, niceMaxY: M } = k(h, t(C)), N = Array.isArray(n.series) ? n.series : [], P = (e, t) => {
118
+ let n = f({
119
+ theme: r,
119
120
  datums: t,
120
- template: M[e] ?? M[0],
121
+ template: N[e] ?? N[0],
121
122
  fallback: (e) => e.color
122
123
  });
123
124
  return (t) => {
124
- let n = r(t);
125
- if (!f) return n;
125
+ let r = n(t);
126
+ if (!p) return r;
126
127
  let i = `${e}:${t.dataIndex}`;
127
- return f.has(i) ? n : _.color.modifyAlpha(n, .15);
128
+ return p.has(i) ? r : v.color.modifyAlpha(r, .15);
128
129
  };
129
- }, P = T(t.dataZoom, h), F = P?.hasXSlider ?? !1, I = P?.hasYSlider ?? !1, L = typeof y.bottom == "number" ? y.bottom : 24, R = h ? 56 : L, z = F ? R + e.sliderHeight + e.sliderGap : R, B = typeof y.right == "number" ? y.right : 8, V = I ? B + e.sliderHeight + e.sliderGap : B;
130
+ }, F = E(n.dataZoom, g), I = F?.hasXSlider ?? !1, L = F?.hasYSlider ?? !1, R = typeof b.bottom == "number" ? b.bottom : 24, z = g ? 56 : R, B = I ? z + e.sliderHeight + e.sliderGap : z, V = typeof b.right == "number" ? b.right : 8, H = L ? V + e.sliderHeight + e.sliderGap : V;
130
131
  return {
131
- ...t,
132
- dataset: m.map((e) => ({ source: e.every(Array.isArray) ? e : e.map(v) })),
133
- series: m.map((e, t) => {
134
- let r = i(n, c?.[t]?.color);
132
+ ...n,
133
+ dataset: h.map((e) => ({ source: e.every(Array.isArray) ? e : e.map(y) })),
134
+ series: h.map((e, t) => {
135
+ let n = a(r, l?.[t]?.color);
135
136
  return {
136
137
  type: "scatter",
137
138
  datasetIndex: t,
138
- name: c?.[t]?.name ?? `Series ${t + 1}`,
139
+ name: l?.[t]?.name ?? `Series ${t + 1}`,
139
140
  encode: {
140
141
  x: 0,
141
142
  y: 1
142
143
  },
143
- symbolSize: l,
144
+ symbolSize: u,
144
145
  emphasis: { focus: "series" },
145
- itemStyle: { color: N(t, e) },
146
- ...r ? { color: r } : {}
146
+ itemStyle: { color: P(t, e) },
147
+ ...n ? { color: n } : {}
147
148
  };
148
149
  }),
149
150
  legend: {
150
- ...g,
151
- show: h
151
+ ..._,
152
+ show: g
152
153
  },
153
154
  grid: {
154
- ...y,
155
- bottom: z,
156
- right: V
155
+ ...b,
156
+ bottom: B,
157
+ right: H
157
158
  },
158
- ...P ? { dataZoom: P.entries } : {},
159
+ ...F ? { dataZoom: F.entries } : {},
159
160
  xAxis: {
160
- ...x,
161
- min: D,
162
- max: k
161
+ ...S,
162
+ min: O,
163
+ max: A
163
164
  },
164
165
  yAxis: {
165
- ...S,
166
- min: A,
167
- max: j,
166
+ ...C,
167
+ min: j,
168
+ max: M,
168
169
  axisLabel: {
169
- ...S.axisLabel ?? {},
170
- ...w ? { formatter: w } : {}
170
+ ...C.axisLabel ?? {},
171
+ ...T ? { formatter: T } : {}
171
172
  }
172
173
  },
173
174
  tooltip: {
174
- ...b,
175
- formatter: E(b.formatter, w, a)
175
+ ...x,
176
+ formatter: D(x.formatter, T, o)
176
177
  }
177
178
  };
178
179
  };
179
180
  }
180
- function T(t, n) {
181
+ function E(t, n) {
181
182
  if (!Array.isArray(t) || t.length === 0) return null;
182
183
  let r = !1, i = !1;
183
184
  return {
@@ -193,8 +194,8 @@ function T(t, n) {
193
194
  hasYSlider: i
194
195
  };
195
196
  }
196
- function E(e, t, n) {
197
- return t ? u((e) => {
197
+ function D(e, t, n) {
198
+ return t ? d((e) => {
198
199
  let r = e.value, i = r?.[0], a = r?.[1], o = typeof i == "number" ? n ? n(i) : String(i) : "", s = typeof a == "number" ? t(a) : String(a ?? ""), c = typeof e.marker == "string" ? e.marker : "", l = e.seriesName ? `${e.seriesName}: ` : "";
199
200
  return {
200
201
  name: `(${o}, ${s})`,
@@ -204,8 +205,8 @@ function E(e, t, n) {
204
205
  };
205
206
  }) : e;
206
207
  }
207
- function D(e, t) {
208
- return u((n) => {
208
+ function O(e, t) {
209
+ return d((n) => {
209
210
  let r = n.value, i = r?.[0], a = r?.[1], o = typeof i == "number" ? e ? e(i) : String(i) : "", s = typeof a == "number" ? t ? t(a) : String(a) : "", c = typeof n.marker == "string" ? n.marker : "", l = n.seriesName ? `${n.seriesName}: ` : "";
210
211
  return {
211
212
  name: `(${o}, ${s})`,
@@ -215,24 +216,24 @@ function D(e, t) {
215
216
  };
216
217
  });
217
218
  }
218
- function O(e) {
219
- let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
220
- for (let a of e) for (let e of a) {
219
+ function k(e, t = {}) {
220
+ let n = Infinity, r = -Infinity, i = Infinity, a = -Infinity;
221
+ for (let t of e) for (let e of t) {
221
222
  if (e == null) continue;
222
- let [a, o] = v(e);
223
- typeof a == "number" && Number.isFinite(a) && (a < t && (t = a), a > n && (n = a)), typeof o == "number" && Number.isFinite(o) && (o < r && (r = o), o > i && (i = o));
223
+ let [t, o] = y(e);
224
+ typeof t == "number" && Number.isFinite(t) && (t < n && (n = t), t > r && (r = t)), typeof o == "number" && Number.isFinite(o) && (o < i && (i = o), o > a && (a = o));
224
225
  }
225
- let a = Number.isFinite(n) ? n <= 0 ? 1 : s(n) : 1, o = Number.isFinite(i) ? i <= 0 ? 1 : s(i) : 1;
226
+ let o = Number.isFinite(r) ? r <= 0 ? 1 : c(r) : 1, s = Number.isFinite(a) ? a <= 0 ? 1 : t.max ?? c(a) : 1;
226
227
  return {
227
- niceMinX: Number.isFinite(t) && t < 0 ? s(t) : 0,
228
- niceMaxX: a,
229
- niceMinY: Number.isFinite(r) && r < 0 ? s(r) : 0,
230
- niceMaxY: o
228
+ niceMinX: Number.isFinite(n) && n < 0 ? c(n) : 0,
229
+ niceMaxX: o,
230
+ niceMinY: Number.isFinite(i) && i < 0 ? t.min ?? c(i) : 0,
231
+ niceMaxY: s
231
232
  };
232
233
  }
233
234
  //#endregion
234
235
  //#region src/widgets-v2/scatterplot/skeleton.tsx
235
- var k = {
236
+ var A = {
236
237
  container: {
237
238
  display: "flex",
238
239
  alignItems: "center",
@@ -257,7 +258,7 @@ var k = {
257
258
  alignItems: "center",
258
259
  gap: ({ spacing: e }) => e(1.5)
259
260
  }
260
- }, A = (e, t, n) => ({
261
+ }, j = (e, t, n) => ({
261
262
  position: "absolute",
262
263
  top: e,
263
264
  left: t,
@@ -265,48 +266,48 @@ var k = {
265
266
  height: n,
266
267
  borderRadius: "50%"
267
268
  });
268
- function j(e) {
269
- let t = f(15), { count: n } = e, r = n === void 0 ? 24 : n, i, a, o, s, c;
269
+ function M(e) {
270
+ let t = p(15), { count: n } = e, r = n === void 0 ? 24 : n, i, a, o, s, c;
270
271
  if (t[0] !== r) {
271
- let e = Array.from({ length: r }, P);
272
- a = p, c = k.container, i = p, o = k.grid, s = e.map(N), t[0] = r, t[1] = i, t[2] = a, t[3] = o, t[4] = s, t[5] = c;
272
+ let e = Array.from({ length: r }, F);
273
+ a = m, c = A.container, i = m, o = A.grid, s = e.map(P), t[0] = r, t[1] = i, t[2] = a, t[3] = o, t[4] = s, t[5] = c;
273
274
  } else i = t[1], a = t[2], o = t[3], s = t[4], c = t[5];
274
275
  let l;
275
- t[6] !== i || t[7] !== o || t[8] !== s ? (l = /* @__PURE__ */ h(i, {
276
+ t[6] !== i || t[7] !== o || t[8] !== s ? (l = /* @__PURE__ */ g(i, {
276
277
  sx: o,
277
278
  children: s
278
279
  }), t[6] = i, t[7] = o, t[8] = s, t[9] = l) : l = t[9];
279
280
  let u;
280
- t[10] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ h(p, {
281
- sx: k.legend,
282
- children: [0, 1].map(M)
281
+ t[10] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ g(m, {
282
+ sx: A.legend,
283
+ children: [0, 1].map(N)
283
284
  }), t[10] = u) : u = t[10];
284
285
  let d;
285
- return t[11] !== a || t[12] !== c || t[13] !== l ? (d = /* @__PURE__ */ g(a, {
286
+ return t[11] !== a || t[12] !== c || t[13] !== l ? (d = /* @__PURE__ */ _(a, {
286
287
  sx: c,
287
288
  children: [l, u]
288
289
  }), t[11] = a, t[12] = c, t[13] = l, t[14] = d) : d = t[14], d;
289
290
  }
290
- function M(e) {
291
- return /* @__PURE__ */ g(p, {
292
- sx: k.legendItem,
293
- children: [/* @__PURE__ */ h(m, {
291
+ function N(e) {
292
+ return /* @__PURE__ */ _(m, {
293
+ sx: A.legendItem,
294
+ children: [/* @__PURE__ */ g(h, {
294
295
  variant: "circular",
295
296
  width: 8,
296
297
  height: 8
297
- }), /* @__PURE__ */ h(m, {
298
+ }), /* @__PURE__ */ g(h, {
298
299
  width: 48,
299
300
  height: 8
300
301
  })]
301
302
  }, `legend-${e}`);
302
303
  }
303
- function N(e, t) {
304
- return /* @__PURE__ */ h(m, {
304
+ function P(e, t) {
305
+ return /* @__PURE__ */ g(h, {
305
306
  variant: "circular",
306
- sx: A(e.top, e.left, e.size)
307
+ sx: j(e.top, e.left, e.size)
307
308
  }, `dot-${t}`);
308
309
  }
309
- function P(e, t) {
310
+ function F(e, t) {
310
311
  let n = 10 + t * 37 % 80, r = 5 + t * 53 % 90, i = 8 + t * 7 % 6;
311
312
  return {
312
313
  top: `${n}%`,
@@ -316,14 +317,14 @@ function P(e, t) {
316
317
  }
317
318
  //#endregion
318
319
  //#region src/widgets-v2/scatterplot/download.ts
319
- function F(e) {
320
- let r = [];
321
- return e.getCaptureEl && r.push(t({
320
+ function I(e) {
321
+ let t = [];
322
+ return e.getCaptureEl && t.push(n({
322
323
  filename: e.filename,
323
324
  getCaptureEl: e.getCaptureEl,
324
325
  pixelRatio: e.pngPixelRatio,
325
326
  backgroundColor: e.pngBackgroundColor
326
- })), r.push(n({
327
+ })), t.push(r({
327
328
  filename: e.filename,
328
329
  getRows: (t) => {
329
330
  let n = e.getData(t), r = [[
@@ -334,7 +335,7 @@ function F(e) {
334
335
  for (let [t, i] of n.entries()) {
335
336
  let n = e.seriesNames?.[t] ?? `series_${t + 1}`;
336
337
  for (let e of i) {
337
- let [t, i] = v(e);
338
+ let [t, i] = y(e);
338
339
  r.push([
339
340
  n,
340
341
  t,
@@ -344,27 +345,27 @@ function F(e) {
344
345
  }
345
346
  return r;
346
347
  }
347
- })), r;
348
+ })), t;
348
349
  }
349
350
  //#endregion
350
351
  //#region src/widgets-v2/scatterplot/transforms.ts
351
- var I = (e) => Array.isArray(e) ? e.map((e) => {
352
- if (!L(e)) return e;
353
- let t = e.reduce((e, t) => e + Math.abs(v(t)[1]), 0);
352
+ var L = (e) => Array.isArray(e) ? e.map((e) => {
353
+ if (!R(e)) return e;
354
+ let t = e.reduce((e, t) => e + Math.abs(y(t)[1]), 0);
354
355
  return t <= 0 ? e : e.map((e) => {
355
- let [n, r] = v(e);
356
- return b(e, n, r / t * 100);
356
+ let [n, r] = y(e);
357
+ return x(e, n, r / t * 100);
357
358
  });
358
359
  }) : e;
359
- function L(e) {
360
- return Array.isArray(e) && e.every(y);
360
+ function R(e) {
361
+ return Array.isArray(e) && e.every(b);
361
362
  }
362
- function R(e, t) {
363
+ function z(e, t) {
363
364
  if (t.length === 0 || !Array.isArray(e)) return e;
364
365
  let n = new Set(t.map(String));
365
- return e.map((e, t) => L(e) ? e.filter((e, r) => n.has(`${t}:${r}`)) : e);
366
+ return e.map((e, t) => R(e) ? e.filter((e, r) => n.has(`${t}:${r}`)) : e);
366
367
  }
367
368
  //#endregion
368
- export { j as ScatterplotSkeleton, F as createScatterplotDownloadConfig, w as createScatterplotOptionFactory, R as filterScatterplotByLockedPoints, v as getScatterplotXY, C as scatterplotOptions, I as toRelativeScatterplotData };
369
+ export { M as ScatterplotSkeleton, I as createScatterplotDownloadConfig, T as createScatterplotOptionFactory, z as filterScatterplotByLockedPoints, y as getScatterplotXY, w as scatterplotOptions, L as toRelativeScatterplotData };
369
370
 
370
371
  //# sourceMappingURL=scatterplot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scatterplot.js","names":["{ count = 24 }: ScatterplotSkeletonProps","count = 24","Box","styles.grid","dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))","styles.container","(_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n }","(d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n )","<Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>","<Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>","(i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n )","<Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>","i"],"sources":["../../src/widgets-v2/scatterplot/points.ts","../../src/widgets-v2/scatterplot/options.ts","../../src/widgets-v2/scatterplot/skeleton.tsx","../../src/widgets-v2/scatterplot/download.ts","../../src/widgets-v2/scatterplot/transforms.ts"],"sourcesContent":["import type { ScatterplotItem } from './types'\n\n/** `[x, y]` of a {@link ScatterplotItem}, whichever form it takes. */\nexport function getScatterplotXY(\n point: ScatterplotItem,\n): readonly [number, number] {\n return isTuple(point) ? point : [point.x, point.y]\n}\n\n/** Whether `v` is a valid {@link ScatterplotItem} with finite coordinates. */\nexport function isScatterplotDatum(v: unknown): v is ScatterplotItem {\n if (Array.isArray(v)) {\n return v.length === 2 && isFiniteNumber(v[0]) && isFiniteNumber(v[1])\n }\n if (v == null || typeof v !== 'object') return false\n const { x, y } = v as { x?: unknown; y?: unknown }\n return isFiniteNumber(x) && isFiniteNumber(y)\n}\n\n/** Same point with new coordinates; keeps the object form (and `color`). */\nexport function withScatterplotXY(\n point: ScatterplotItem,\n x: number,\n y: number,\n): ScatterplotItem {\n return isTuple(point) ? [x, y] : { ...point, x, y }\n}\n\nfunction isTuple(point: ScatterplotItem): point is readonly [number, number] {\n return Array.isArray(point)\n}\n\nfunction isFiniteNumber(v: unknown): v is number {\n return typeof v === 'number' && Number.isFinite(v)\n}\n","import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { createItemColorResolver } from '../utils/item-color'\nimport { getScatterplotXY } from './points'\nimport type {\n ScatterplotEChartsOption,\n ScatterplotOptionFactoryInput,\n ScatterplotOptionsInput,\n ScatterplotItem,\n ScatterplotWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a scatterplot widget — both\n * axes `type: 'value'` (not category, unlike Bar/Histogram), grid, tooltip\n * triggered per-item rather than per-axis. Intentionally data-agnostic: no\n * series, no dataset, no `legend.show` (those depend on data and are added\n * by {@link createScatterplotOptionFactory}).\n *\n * Styling parity with v1: dark themed tooltip via `createTooltipFormatter`\n * + `createTooltipPositioner`, `buildGridConfig`-based grid, polished\n * axisLine/Tick/splitLine, `overlineDelicate` axis labels, structural\n * legend wired via `buildLegendConfig` (toggled by the merger), and the\n * CARTO `qualitative.bold + secondary` palette — same pattern bar /\n * histogram / pie already use. {@link createScatterplotOptionFactory}\n * wraps this builder in its structural-phase branch.\n */\nexport function scatterplotOptions({\n theme,\n xFormatter,\n yFormatter,\n}: ScatterplotOptionsInput): ScatterplotEChartsOption {\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps `bottom` when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n // Per-point trigger — different from Bar's 'axis' trigger because\n // points don't share an x-coordinate.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildScatterTooltipFormatter(xFormatter, yFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter: undefined }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(xFormatter && { formatter: xFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n yAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(yFormatter && { formatter: yFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n } as ScatterplotEChartsOption\n}\n\n/**\n * Returns the scatterplot widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link scatterplotOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`ScatterplotWidgetData`) into the option via the dataset API. Each\n * series's `[x, y]` tuples land in `dataset[i].source` as 2-column\n * rows; the series uses positional encoding (`encode: { x: 0, y: 1 }`)\n * and `type: 'scatter'`. niceMin/niceMax are computed over both axes\n * so the chart frames data on rounded extents and numeric jitters\n * don't shift gridlines per render. Reactive `ctx.formatter` (driven\n * by RelativeData) re-derives the y-axis label and tooltip at fusion\n * time; `xFormatter` stays baked at structural-build time (relative\n * is a values-axis concept; x is coordinate-space).\n *\n * When `ZoomToggle` installs a `dataZoom` slider, grid bottom is\n * extended and the slider is positioned above the legend row (if any) —\n * same layout dance bar / histogram / timeseries do.\n */\nexport function createScatterplotOptionFactory(\n options: ScatterplotOptionFactoryInput,\n): OptionFactory {\n const { theme, xFormatter, yFormatter, optionsOverride } = options\n const series = options.series\n const symbolSize = options.symbolSize ?? 8\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0 ? new Set<string>(selection) : null\n return (option, data, ctx) => {\n if (option == null) {\n const structural = scatterplotOptions({ theme, xFormatter, yFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data)\n ? (data as ScatterplotWidgetData<ScatterplotItem>)\n : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseXAxis =\n typeof option.xAxis === 'object' && !Array.isArray(option.xAxis)\n ? option.xAxis\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const reactiveFormatter = ctx?.formatter\n\n const { niceMinX, niceMaxX, niceMinY, niceMaxY } =\n computeScatterBounds(seriesArr)\n\n // Dim non-selected points via `series.itemStyle.color`. The selection\n // key is `${seriesIndex}:${dataIndex}`; we read those off the params\n // ECharts hands to the callback per-data.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and items would stay dimmed forever after an external clear.\n // Keeping the key always-present means a plain setOption merge swaps\n // the callback in place, no `replaceMerge` and no entry-animation\n // flash on selection on/off.\n //\n // The base colour is the point's own `color` (object points), else the\n // template's `itemStyle.color`, else the series colour / palette.\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const makeDimColor = (seriesIdx: number, datums: readonly unknown[]) => {\n const baseColor = createItemColorResolver({\n theme,\n datums,\n template: seriesTemplates[seriesIdx] ?? seriesTemplates[0],\n fallback: (params) => params.color as string,\n })\n return (params: CallbackDataParams) => {\n const base = baseColor(params)\n if (!selectionSet) return base\n const key = `${seriesIdx}:${params.dataIndex}`\n return selectionSet.has(key)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n }\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`,\n // reserve grid space and lift any x-slider above the legend (if\n // present). Scatter supports 2D zoom via `axes: ['x', 'y']` — in\n // that case there's also a vertical y-slider on the right edge, so\n // we reserve `grid.right` separately. Inside-only dataZoom entries\n // (no `type: 'slider'`) take no grid space.\n const dataZoomLayout = layoutDataZoomForScatter(option.dataZoom, hasLegend)\n const hasXSlider = dataZoomLayout?.hasXSlider ?? false\n const hasYSlider = dataZoomLayout?.hasYSlider ?? false\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = hasXSlider\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n const fallbackRight =\n typeof baseGrid.right === 'number' ? baseGrid.right : 8\n const gridRight = hasYSlider\n ? fallbackRight + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : fallbackRight\n\n return {\n ...option,\n // ECharts dataset.source wants a mutable [number, number][] shape; we\n // hold readonly tuples internally, so cast at the boundary. Object\n // points are flattened to `[x, y]` so the positional encode and the\n // tooltip keep reading tuples.\n dataset: seriesArr.map((s) => ({\n source: (s.every(Array.isArray)\n ? s\n : s.map(getScatterplotXY)) as unknown as number[][],\n })),\n series: seriesArr.map((s, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n type: 'scatter' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 0, y: 1 },\n symbolSize,\n emphasis: { focus: 'series' },\n itemStyle: { color: makeDimColor(i, s) },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom, right: gridRight },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout.entries } : {}),\n xAxis: {\n ...baseXAxis,\n min: niceMinX,\n max: niceMaxX,\n } as EChartsOption['xAxis'],\n yAxis: {\n ...baseYAxis,\n min: niceMinY,\n max: niceMaxY,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n // Re-derive the y-axis formatter at fusion time so RelativeData's\n // percent formatter (written to `state.formatter`) flows through\n // without rebuilding the structural option. Falls back to the\n // structural `yFormatter` already baked in `baseYAxis.axisLabel`\n // (which `String(value)` if neither is set).\n ...(reactiveFormatter ? { formatter: reactiveFormatter } : {}),\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n // Rebuild the tooltip formatter so the live y-axis formatter is\n // applied to the y-coordinate in the (x, y) label. xFormatter is\n // structural — relative is a values-axis concept, so xFormatter\n // doesn't change under RelativeData.\n formatter: buildReactiveScatterTooltipFormatter(\n (baseTooltip as { formatter?: unknown }).formatter,\n reactiveFormatter,\n xFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Lay out the `dataZoom` array for the scatter chart:\n * - Detect whether any horizontal (x-axis) slider is present — if so\n * lift it above the legend row when a legend is shown.\n * - Detect whether any vertical (y-axis) slider is present — the\n * caller reserves `grid.right` so the slider doesn't overlap the\n * plot area.\n *\n * Returns `null` when there's no `dataZoom` so callers can skip the\n * layout adjustment entirely. An entry is considered an \"x-slider\" if\n * it has `xAxisIndex` set (or no axis index — defaults to x in ECharts).\n * A \"y-slider\" has `yAxisIndex` set.\n */\nfunction layoutDataZoomForScatter(\n dataZoom: unknown,\n hasLegend: boolean,\n): { entries: unknown[]; hasXSlider: boolean; hasYSlider: boolean } | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n let hasXSlider = false\n let hasYSlider = false\n const entries = dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as {\n type?: string\n xAxisIndex?: unknown\n yAxisIndex?: unknown\n bottom?: number\n }\n if (dz.type !== 'slider') return dz\n const targetsY = dz.yAxisIndex !== undefined\n if (targetsY) {\n hasYSlider = true\n return dz\n }\n // Either explicit x or defaulted (ECharts defaults sliders to xAxis\n // when no axis index is provided).\n hasXSlider = true\n if (hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n return { entries, hasXSlider, hasYSlider }\n}\n\n/**\n * If a reactive (store-driven) y formatter is provided, re-build the\n * scatter tooltip formatter using it. Otherwise, return the structural\n * formatter unchanged so the original `xFormatter` / `yFormatter`\n * baked into `scatterplotOptions` still applies. The structural\n * formatter has stable identity per `scatterplotOptions` call, so this\n * path doesn't churn ECharts on every render.\n */\nfunction buildReactiveScatterTooltipFormatter(\n structuralFormatter: unknown,\n reactiveYFormatter: ((value: number) => string) | undefined,\n xFormatter: ((value: number) => string) | undefined,\n) {\n if (!reactiveYFormatter) return structuralFormatter\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? reactiveYFormatter(y) : String(y ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction buildScatterTooltipFormatter(\n xFormatter: ((value: number) => string) | undefined,\n yFormatter: ((value: number) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? (yFormatter ? yFormatter(y) : String(y)) : ''\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction computeScatterBounds(\n seriesArr: ScatterplotWidgetData<ScatterplotItem>,\n): {\n niceMinX: number\n niceMaxX: number\n niceMinY: number\n niceMaxY: number\n} {\n let minX = Infinity\n let maxX = -Infinity\n let minY = Infinity\n let maxY = -Infinity\n for (const series of seriesArr) {\n for (const point of series) {\n if (point == null) continue\n const [x, y] = getScatterplotXY(point)\n if (typeof x === 'number' && Number.isFinite(x)) {\n if (x < minX) minX = x\n if (x > maxX) maxX = x\n }\n if (typeof y === 'number' && Number.isFinite(y)) {\n if (y < minY) minY = y\n if (y > maxY) maxY = y\n }\n }\n }\n // Mirror bar's `computeNiceBounds`: clamp min to 0 when data is\n // non-negative (gridline reads cleanly from zero), apply `niceNum` to\n // negative mins, and floor max=0 to 1 so the chart always has range.\n // Scatter can have free coordinates so we apply this per-axis.\n const niceMaxX = Number.isFinite(maxX) ? (maxX <= 0 ? 1 : niceNum(maxX)) : 1\n const niceMaxY = Number.isFinite(maxY) ? (maxY <= 0 ? 1 : niceNum(maxY)) : 1\n const niceMinX = Number.isFinite(minX) ? (minX < 0 ? niceNum(minX) : 0) : 0\n const niceMinY = Number.isFinite(minY) ? (minY < 0 ? niceNum(minY) : 0) : 0\n return { niceMinX, niceMaxX, niceMinY, niceMaxY }\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n// `sx` callback that needs runtime args — extracted at module scope so the\n// `styles` object can satisfy `Record<string, SxProps<Theme>>` cleanly\n// (function `sx`-with-args isn't assignable to plain `SxProps<Theme>`).\nconst dotSx = (top: string, left: string, size: number): SxProps<Theme> => ({\n position: 'absolute',\n top,\n left,\n width: size,\n height: size,\n borderRadius: '50%',\n})\n\nexport interface ScatterplotSkeletonProps {\n /** Number of dots to render. */\n count?: number\n}\n\n/**\n * Loading state for the Scatterplot widget. Mirrors a scatter chart's\n * silhouette — a deterministic spread of small circular dots in the plot\n * area plus a legend stub — so the skeleton reads as \"a scatter chart\"\n * rather than a generic list. Matches bar/histogram/pie skeleton structure\n * (grid stub + legend stub in a flex column).\n */\nexport function ScatterplotSkeleton({ count = 24 }: ScatterplotSkeletonProps) {\n // Deterministic pseudo-scatter positions so the skeleton doesn't flicker.\n const dots = Array.from({ length: count }, (_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n })\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport { getScatterplotXY } from './points'\nimport type { ScatterplotItem, ScatterplotWidgetData } from './types'\n\n/**\n * Download menu items for the Scatterplot widget. Always includes a CSV\n * item with `series, x, y` columns (one row per point). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createScatterplotDownloadConfig(args: {\n filename: string\n getData: (ctx: DownloadContext) => ScatterplotWidgetData<ScatterplotItem>\n seriesNames?: readonly string[]\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = [['series', 'x', 'y']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const point of series) {\n const [x, y] = getScatterplotXY(point)\n rows.push([seriesName, x, y])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n","import {\n getScatterplotXY,\n isScatterplotDatum,\n withScatterplotXY,\n} from './points'\nimport type { ScatterplotItem } from './types'\n\n/**\n * Scatterplot-specific `RelativeData` transform. Scatter data is\n * `ScatterplotItem[][]` — each series is a list of `[x, y]` tuples or\n * `{ x, y, color? }` points (whose shape is kept).\n * Relative is a values-axis concept, so this rewrites `y` to its\n * share of the series's total `y` (0–100) and leaves `x` raw — x is\n * coordinate space, not part of the cohort total.\n *\n * Pass to `<Widget.RelativeData transform={toRelativeScatterplotData} />`.\n *\n * The denominator is the sum of |y| across the series so mixed-sign\n * y values produce sane signed shares-of-magnitude. A series whose\n * total y-magnitude is zero (all-zero or empty input) is returned\n * unchanged so a stalled or empty data set doesn't show misleading 0%\n * values. Inputs whose shape isn't `ScatterplotItem[]` fall through\n * untouched.\n */\nexport const toRelativeScatterplotData = (input: unknown): unknown => {\n if (!Array.isArray(input)) return input\n return input.map((series: unknown): unknown => {\n if (!isPointArray(series)) return series\n const total = series.reduce(\n (acc, p) => acc + Math.abs(getScatterplotXY(p)[1]),\n 0,\n )\n if (total <= 0) return series\n return series.map((p) => {\n const [x, y] = getScatterplotXY(p)\n return withScatterplotXY(p, x, (y / total) * 100)\n })\n })\n}\n\nfunction isPointArray(v: unknown): v is ScatterplotItem[] {\n return Array.isArray(v) && v.every(isScatterplotDatum)\n}\n\n/**\n * `LockSelection` filter for Scatterplot. Data is `ScatterplotItem[][]` —\n * points have no `name`, so selection (and locking) is keyed on a synthetic\n * `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s\n * `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,\n * a point's position carries no external meaning (no `ticks` to desync from),\n * so non-locked points are removed outright rather than zeroed.\n */\nexport function filterScatterplotByLockedPoints(\n input: unknown,\n lockedItems: readonly (string | number)[],\n): unknown {\n if (lockedItems.length === 0) return input\n if (!Array.isArray(input)) return input\n const locked = new Set<string>(lockedItems.map(String))\n return input.map((series: unknown, seriesIndex: number): unknown => {\n if (!isPointArray(series)) return series\n return series.filter((_, dataIndex) =>\n locked.has(`${seriesIndex}:${dataIndex}`),\n )\n })\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,EACd,GAC2B;CAC3B,OAAO,EAAQ,CAAK,IAAI,IAAQ,CAAC,EAAM,GAAG,EAAM,CAAC;AACnD;AAGA,SAAgB,EAAmB,GAAkC;CACnE,IAAI,MAAM,QAAQ,CAAC,GACjB,OAAO,EAAE,WAAW,KAAK,EAAe,EAAE,EAAE,KAAK,EAAe,EAAE,EAAE;CAEtE,IAAi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IAAY,EAAY,IAAI,MAAM,CAAC;CACtD,OAAO,EAAM,KAAK,GAAiB,MAC5B,EAAa,CAAM,IACjB,EAAO,QAAQ,GAAG,MACvB,EAAO,IAAI,GAAG,EAAY,GAAG,GAAW,CAC1C,IAHkC,CAInC;AACH"}
1
+ {"version":3,"file":"scatterplot.js","names":["{ count = 24 }: ScatterplotSkeletonProps","count = 24","Box","styles.grid","dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))","styles.container","(_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n }","(d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n )","<Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>","<Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>","(i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n )","<Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>","i"],"sources":["../../src/widgets-v2/scatterplot/points.ts","../../src/widgets-v2/scatterplot/options.ts","../../src/widgets-v2/scatterplot/skeleton.tsx","../../src/widgets-v2/scatterplot/download.ts","../../src/widgets-v2/scatterplot/transforms.ts"],"sourcesContent":["import type { ScatterplotItem } from './types'\n\n/** `[x, y]` of a {@link ScatterplotItem}, whichever form it takes. */\nexport function getScatterplotXY(\n point: ScatterplotItem,\n): readonly [number, number] {\n return isTuple(point) ? point : [point.x, point.y]\n}\n\n/** Whether `v` is a valid {@link ScatterplotItem} with finite coordinates. */\nexport function isScatterplotDatum(v: unknown): v is ScatterplotItem {\n if (Array.isArray(v)) {\n return v.length === 2 && isFiniteNumber(v[0]) && isFiniteNumber(v[1])\n }\n if (v == null || typeof v !== 'object') return false\n const { x, y } = v as { x?: unknown; y?: unknown }\n return isFiniteNumber(x) && isFiniteNumber(y)\n}\n\n/** Same point with new coordinates; keeps the object form (and `color`). */\nexport function withScatterplotXY(\n point: ScatterplotItem,\n x: number,\n y: number,\n): ScatterplotItem {\n return isTuple(point) ? [x, y] : { ...point, x, y }\n}\n\nfunction isTuple(point: ScatterplotItem): point is readonly [number, number] {\n return Array.isArray(point)\n}\n\nfunction isFiniteNumber(v: unknown): v is number {\n return typeof v === 'number' && Number.isFinite(v)\n}\n","import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { createItemColorResolver } from '../utils/item-color'\nimport { getScatterplotXY } from './points'\nimport type {\n ScatterplotEChartsOption,\n ScatterplotOptionFactoryInput,\n ScatterplotOptionsInput,\n ScatterplotItem,\n ScatterplotWidgetData,\n} from './types'\nimport { fixedAxisBounds } from '../actions/relative-data/scale'\n\n/**\n * Builds the **structural** ECharts option for a scatterplot widget — both\n * axes `type: 'value'` (not category, unlike Bar/Histogram), grid, tooltip\n * triggered per-item rather than per-axis. Intentionally data-agnostic: no\n * series, no dataset, no `legend.show` (those depend on data and are added\n * by {@link createScatterplotOptionFactory}).\n *\n * Styling parity with v1: dark themed tooltip via `createTooltipFormatter`\n * + `createTooltipPositioner`, `buildGridConfig`-based grid, polished\n * axisLine/Tick/splitLine, `overlineDelicate` axis labels, structural\n * legend wired via `buildLegendConfig` (toggled by the merger), and the\n * CARTO `qualitative.bold + secondary` palette — same pattern bar /\n * histogram / pie already use. {@link createScatterplotOptionFactory}\n * wraps this builder in its structural-phase branch.\n */\nexport function scatterplotOptions({\n theme,\n xFormatter,\n yFormatter,\n}: ScatterplotOptionsInput): ScatterplotEChartsOption {\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps `bottom` when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n // Per-point trigger — different from Bar's 'axis' trigger because\n // points don't share an x-coordinate.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildScatterTooltipFormatter(xFormatter, yFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter: undefined }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(xFormatter && { formatter: xFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n yAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(yFormatter && { formatter: yFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n } as ScatterplotEChartsOption\n}\n\n/**\n * Returns the scatterplot widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link scatterplotOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`ScatterplotWidgetData`) into the option via the dataset API. Each\n * series's `[x, y]` tuples land in `dataset[i].source` as 2-column\n * rows; the series uses positional encoding (`encode: { x: 0, y: 1 }`)\n * and `type: 'scatter'`. niceMin/niceMax are computed over both axes\n * so the chart frames data on rounded extents and numeric jitters\n * don't shift gridlines per render. Reactive `ctx.formatter` (driven\n * by RelativeData) re-derives the y-axis label and tooltip at fusion\n * time; `xFormatter` stays baked at structural-build time (relative\n * is a values-axis concept; x is coordinate-space).\n *\n * When `ZoomToggle` installs a `dataZoom` slider, grid bottom is\n * extended and the slider is positioned above the legend row (if any) —\n * same layout dance bar / histogram / timeseries do.\n */\nexport function createScatterplotOptionFactory(\n options: ScatterplotOptionFactoryInput,\n): OptionFactory {\n const { theme, xFormatter, yFormatter, optionsOverride } = options\n const series = options.series\n const symbolSize = options.symbolSize ?? 8\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0 ? new Set<string>(selection) : null\n return (option, data, ctx) => {\n if (option == null) {\n const structural = scatterplotOptions({ theme, xFormatter, yFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data)\n ? (data as ScatterplotWidgetData<ScatterplotItem>)\n : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseXAxis =\n typeof option.xAxis === 'object' && !Array.isArray(option.xAxis)\n ? option.xAxis\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const reactiveFormatter = ctx?.formatter\n\n const { niceMinX, niceMaxX, niceMinY, niceMaxY } = computeScatterBounds(\n seriesArr,\n // A config transform (RelativeData's `'total'` scale) may pin the\n // y ends; each applies only on the side the data reaches.\n fixedAxisBounds(baseYAxis),\n )\n\n // Dim non-selected points via `series.itemStyle.color`. The selection\n // key is `${seriesIndex}:${dataIndex}`; we read those off the params\n // ECharts hands to the callback per-data.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and items would stay dimmed forever after an external clear.\n // Keeping the key always-present means a plain setOption merge swaps\n // the callback in place, no `replaceMerge` and no entry-animation\n // flash on selection on/off.\n //\n // The base colour is the point's own `color` (object points), else the\n // template's `itemStyle.color`, else the series colour / palette.\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const makeDimColor = (seriesIdx: number, datums: readonly unknown[]) => {\n const baseColor = createItemColorResolver({\n theme,\n datums,\n template: seriesTemplates[seriesIdx] ?? seriesTemplates[0],\n fallback: (params) => params.color as string,\n })\n return (params: CallbackDataParams) => {\n const base = baseColor(params)\n if (!selectionSet) return base\n const key = `${seriesIdx}:${params.dataIndex}`\n return selectionSet.has(key)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n }\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`,\n // reserve grid space and lift any x-slider above the legend (if\n // present). Scatter supports 2D zoom via `axes: ['x', 'y']` — in\n // that case there's also a vertical y-slider on the right edge, so\n // we reserve `grid.right` separately. Inside-only dataZoom entries\n // (no `type: 'slider'`) take no grid space.\n const dataZoomLayout = layoutDataZoomForScatter(option.dataZoom, hasLegend)\n const hasXSlider = dataZoomLayout?.hasXSlider ?? false\n const hasYSlider = dataZoomLayout?.hasYSlider ?? false\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = hasXSlider\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n const fallbackRight =\n typeof baseGrid.right === 'number' ? baseGrid.right : 8\n const gridRight = hasYSlider\n ? fallbackRight + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : fallbackRight\n\n return {\n ...option,\n // ECharts dataset.source wants a mutable [number, number][] shape; we\n // hold readonly tuples internally, so cast at the boundary. Object\n // points are flattened to `[x, y]` so the positional encode and the\n // tooltip keep reading tuples.\n dataset: seriesArr.map((s) => ({\n source: (s.every(Array.isArray)\n ? s\n : s.map(getScatterplotXY)) as unknown as number[][],\n })),\n series: seriesArr.map((s, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n type: 'scatter' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 0, y: 1 },\n symbolSize,\n emphasis: { focus: 'series' },\n itemStyle: { color: makeDimColor(i, s) },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom, right: gridRight },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout.entries } : {}),\n xAxis: {\n ...baseXAxis,\n min: niceMinX,\n max: niceMaxX,\n } as EChartsOption['xAxis'],\n yAxis: {\n ...baseYAxis,\n min: niceMinY,\n max: niceMaxY,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n // Re-derive the y-axis formatter at fusion time so RelativeData's\n // percent formatter (written to `state.formatter`) flows through\n // without rebuilding the structural option. Falls back to the\n // structural `yFormatter` already baked in `baseYAxis.axisLabel`\n // (which `String(value)` if neither is set).\n ...(reactiveFormatter ? { formatter: reactiveFormatter } : {}),\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n // Rebuild the tooltip formatter so the live y-axis formatter is\n // applied to the y-coordinate in the (x, y) label. xFormatter is\n // structural — relative is a values-axis concept, so xFormatter\n // doesn't change under RelativeData.\n formatter: buildReactiveScatterTooltipFormatter(\n (baseTooltip as { formatter?: unknown }).formatter,\n reactiveFormatter,\n xFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Lay out the `dataZoom` array for the scatter chart:\n * - Detect whether any horizontal (x-axis) slider is present — if so\n * lift it above the legend row when a legend is shown.\n * - Detect whether any vertical (y-axis) slider is present — the\n * caller reserves `grid.right` so the slider doesn't overlap the\n * plot area.\n *\n * Returns `null` when there's no `dataZoom` so callers can skip the\n * layout adjustment entirely. An entry is considered an \"x-slider\" if\n * it has `xAxisIndex` set (or no axis index — defaults to x in ECharts).\n * A \"y-slider\" has `yAxisIndex` set.\n */\nfunction layoutDataZoomForScatter(\n dataZoom: unknown,\n hasLegend: boolean,\n): { entries: unknown[]; hasXSlider: boolean; hasYSlider: boolean } | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n let hasXSlider = false\n let hasYSlider = false\n const entries = dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as {\n type?: string\n xAxisIndex?: unknown\n yAxisIndex?: unknown\n bottom?: number\n }\n if (dz.type !== 'slider') return dz\n const targetsY = dz.yAxisIndex !== undefined\n if (targetsY) {\n hasYSlider = true\n return dz\n }\n // Either explicit x or defaulted (ECharts defaults sliders to xAxis\n // when no axis index is provided).\n hasXSlider = true\n if (hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n return { entries, hasXSlider, hasYSlider }\n}\n\n/**\n * If a reactive (store-driven) y formatter is provided, re-build the\n * scatter tooltip formatter using it. Otherwise, return the structural\n * formatter unchanged so the original `xFormatter` / `yFormatter`\n * baked into `scatterplotOptions` still applies. The structural\n * formatter has stable identity per `scatterplotOptions` call, so this\n * path doesn't churn ECharts on every render.\n */\nfunction buildReactiveScatterTooltipFormatter(\n structuralFormatter: unknown,\n reactiveYFormatter: ((value: number) => string) | undefined,\n xFormatter: ((value: number) => string) | undefined,\n) {\n if (!reactiveYFormatter) return structuralFormatter\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? reactiveYFormatter(y) : String(y ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction buildScatterTooltipFormatter(\n xFormatter: ((value: number) => string) | undefined,\n yFormatter: ((value: number) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? (yFormatter ? yFormatter(y) : String(y)) : ''\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction computeScatterBounds(\n seriesArr: ScatterplotWidgetData<ScatterplotItem>,\n fixedY: { min?: number; max?: number } = {},\n): {\n niceMinX: number\n niceMaxX: number\n niceMinY: number\n niceMaxY: number\n} {\n let minX = Infinity\n let maxX = -Infinity\n let minY = Infinity\n let maxY = -Infinity\n for (const series of seriesArr) {\n for (const point of series) {\n if (point == null) continue\n const [x, y] = getScatterplotXY(point)\n if (typeof x === 'number' && Number.isFinite(x)) {\n if (x < minX) minX = x\n if (x > maxX) maxX = x\n }\n if (typeof y === 'number' && Number.isFinite(y)) {\n if (y < minY) minY = y\n if (y > maxY) maxY = y\n }\n }\n }\n // Mirror bar's `computeNiceBounds`: clamp min to 0 when data is\n // non-negative (gridline reads cleanly from zero), apply `niceNum` to\n // negative mins, and floor max=0 to 1 so the chart always has range.\n // Scatter can have free coordinates so we apply this per-axis.\n const niceMaxX = Number.isFinite(maxX) ? (maxX <= 0 ? 1 : niceNum(maxX)) : 1\n const niceMaxY = Number.isFinite(maxY)\n ? maxY <= 0\n ? 1\n : (fixedY.max ?? niceNum(maxY))\n : 1\n const niceMinX = Number.isFinite(minX) ? (minX < 0 ? niceNum(minX) : 0) : 0\n const niceMinY = Number.isFinite(minY)\n ? minY < 0\n ? (fixedY.min ?? niceNum(minY))\n : 0\n : 0\n return { niceMinX, niceMaxX, niceMinY, niceMaxY }\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n// `sx` callback that needs runtime args — extracted at module scope so the\n// `styles` object can satisfy `Record<string, SxProps<Theme>>` cleanly\n// (function `sx`-with-args isn't assignable to plain `SxProps<Theme>`).\nconst dotSx = (top: string, left: string, size: number): SxProps<Theme> => ({\n position: 'absolute',\n top,\n left,\n width: size,\n height: size,\n borderRadius: '50%',\n})\n\nexport interface ScatterplotSkeletonProps {\n /** Number of dots to render. */\n count?: number\n}\n\n/**\n * Loading state for the Scatterplot widget. Mirrors a scatter chart's\n * silhouette — a deterministic spread of small circular dots in the plot\n * area plus a legend stub — so the skeleton reads as \"a scatter chart\"\n * rather than a generic list. Matches bar/histogram/pie skeleton structure\n * (grid stub + legend stub in a flex column).\n */\nexport function ScatterplotSkeleton({ count = 24 }: ScatterplotSkeletonProps) {\n // Deterministic pseudo-scatter positions so the skeleton doesn't flicker.\n const dots = Array.from({ length: count }, (_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n })\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport { getScatterplotXY } from './points'\nimport type { ScatterplotItem, ScatterplotWidgetData } from './types'\n\n/**\n * Download menu items for the Scatterplot widget. Always includes a CSV\n * item with `series, x, y` columns (one row per point). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createScatterplotDownloadConfig(args: {\n filename: string\n getData: (ctx: DownloadContext) => ScatterplotWidgetData<ScatterplotItem>\n seriesNames?: readonly string[]\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = [['series', 'x', 'y']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const point of series) {\n const [x, y] = getScatterplotXY(point)\n rows.push([seriesName, x, y])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n","import {\n getScatterplotXY,\n isScatterplotDatum,\n withScatterplotXY,\n} from './points'\nimport type { ScatterplotItem } from './types'\n\n/**\n * Scatterplot-specific `RelativeData` transform. Scatter data is\n * `ScatterplotItem[][]` — each series is a list of `[x, y]` tuples or\n * `{ x, y, color? }` points (whose shape is kept).\n * Relative is a values-axis concept, so this rewrites `y` to its\n * share of the series's total `y` (0–100) and leaves `x` raw — x is\n * coordinate space, not part of the cohort total.\n *\n * Pass to `<Widget.RelativeData transform={toRelativeScatterplotData} />`.\n *\n * The denominator is the sum of |y| across the series so mixed-sign\n * y values produce sane signed shares-of-magnitude. A series whose\n * total y-magnitude is zero (all-zero or empty input) is returned\n * unchanged so a stalled or empty data set doesn't show misleading 0%\n * values. Inputs whose shape isn't `ScatterplotItem[]` fall through\n * untouched.\n */\nexport const toRelativeScatterplotData = (input: unknown): unknown => {\n if (!Array.isArray(input)) return input\n return input.map((series: unknown): unknown => {\n if (!isPointArray(series)) return series\n const total = series.reduce(\n (acc, p) => acc + Math.abs(getScatterplotXY(p)[1]),\n 0,\n )\n if (total <= 0) return series\n return series.map((p) => {\n const [x, y] = getScatterplotXY(p)\n return withScatterplotXY(p, x, (y / total) * 100)\n })\n })\n}\n\nfunction isPointArray(v: unknown): v is ScatterplotItem[] {\n return Array.isArray(v) && v.every(isScatterplotDatum)\n}\n\n/**\n * `LockSelection` filter for Scatterplot. Data is `ScatterplotItem[][]` —\n * points have no `name`, so selection (and locking) is keyed on a synthetic\n * `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s\n * `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,\n * a point's position carries no external meaning (no `ticks` to desync from),\n * so non-locked points are removed outright rather than zeroed.\n */\nexport function filterScatterplotByLockedPoints(\n input: unknown,\n lockedItems: readonly (string | number)[],\n): unknown {\n if (lockedItems.length === 0) return input\n if (!Array.isArray(input)) return input\n const locked = new Set<string>(lockedItems.map(String))\n return input.map((series: unknown, seriesIndex: number): unknown => {\n if (!isPointArray(series)) return series\n return series.filter((_, dataIndex) =>\n locked.has(`${seriesIndex}:${dataIndex}`),\n )\n })\n}\n"],"mappings":";;;;;;;;;;;AAGA,SAAgB,EACd,GAC2B;CAC3B,OAAO,EAAQ,CAAK,IAAI,IAAQ,CAAC,EAAM,GAAG,EAAM,CAAC;AACnD;AAGA,SAAgB,EAAmB,GAAkC;CACnE,IAAI,MAAM,QAAQ,CAAC,GACjB,OAAO,EAAE,WAAW,KAAK,EAAe,EAAE,EAAE,KAAK,EAAe,EAAE,EAAE;CAEtE,IAAiB,OAAO,KAAM,aAA1B,GAAoC,OAAO;CAC/C,IAAM,EAAE,MAAG,SAAM;CACjB,OAAO,EAAe,CAAC,KAAK,EAAe,CAAC;AAC9C;AAGA,SAAgB,EACd,GACA,GACA,GACiB;CACjB,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