@burdenoff/microfe-cosmicintersection 2026.1101.2 → 2026.1101.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/dist/cosmicintersection/components/ScienceCanvas.d.ts +17 -0
- package/dist/cosmicintersection/components/ScienceCanvas.d.ts.map +1 -0
- package/dist/cosmicintersection/components/ScienceCanvas.js +791 -0
- package/dist/cosmicintersection/components/ScienceCanvas.js.map +1 -0
- package/dist/cosmicintersection/components/index.d.ts +2 -0
- package/dist/cosmicintersection/components/index.d.ts.map +1 -1
- package/dist/cosmicintersection/components/index.js +2 -0
- package/dist/cosmicintersection/lib/visualization.d.ts +189 -0
- package/dist/cosmicintersection/lib/visualization.d.ts.map +1 -0
- package/dist/cosmicintersection/lib/visualization.js +298 -0
- package/dist/cosmicintersection/lib/visualization.js.map +1 -0
- package/dist/cosmicintersection/lib/visualizationSamples.d.ts +80 -0
- package/dist/cosmicintersection/lib/visualizationSamples.d.ts.map +1 -0
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js +11 -11
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js.map +1 -1
- package/dist/stories/ScienceCanvas.stories.d.ts +21 -0
- package/dist/stories/ScienceCanvas.stories.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
3
|
+
import { ResultsChart as n } from "./ResultsChart.js";
|
|
4
|
+
import { DEFAULT_CAMERA as r, SKY_PROJECTIONS as i, clampPitch as a, decimateSeries as o, downsample as s, extractVisualizations as c, formatTick as l, formatValue as u, nearestPoint as d, niceTicks as f, projectPoint as p, projectSky as m, sceneNormalizer as h, tabLabels as g, tickStep as _, viewKindLabel as v } from "../lib/visualization.js";
|
|
5
|
+
import { useCallback as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
6
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
7
|
+
import { Button as T, Tabs as E, TabsContent as D, TabsList as O, TabsTrigger as k } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
//#region src/cosmicintersection/components/ScienceCanvas.tsx
|
|
9
|
+
var A = [
|
|
10
|
+
1,
|
|
11
|
+
2,
|
|
12
|
+
3,
|
|
13
|
+
4,
|
|
14
|
+
5,
|
|
15
|
+
6
|
|
16
|
+
].map((e) => `var(--color-chart-${e})`), j = 2e3, M = 50, N = "cosmicintersection.scienceCanvas", P = {
|
|
17
|
+
mollweide: "Mollweide",
|
|
18
|
+
aitoff: "Aitoff",
|
|
19
|
+
equirectangular: "Equirectangular"
|
|
20
|
+
};
|
|
21
|
+
function F(e, t) {
|
|
22
|
+
return e(`${N}.projection.${t}`, P[t]);
|
|
23
|
+
}
|
|
24
|
+
function I(e, t) {
|
|
25
|
+
return e(`${N}.kind.${t}`, v(t));
|
|
26
|
+
}
|
|
27
|
+
var L = {
|
|
28
|
+
icrs: ["RA", "Dec"],
|
|
29
|
+
galactic: ["l", "b"],
|
|
30
|
+
ecliptic: ["λ", "β"]
|
|
31
|
+
};
|
|
32
|
+
function R({ children: e }) {
|
|
33
|
+
return /* @__PURE__ */ C("div", {
|
|
34
|
+
className: "rounded-card border border-border-default bg-bg-sunken p-3",
|
|
35
|
+
children: e
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function z({ items: t }) {
|
|
39
|
+
let n = e();
|
|
40
|
+
return t.length < 2 ? null : /* @__PURE__ */ C("ul", {
|
|
41
|
+
className: "flex flex-wrap gap-x-4 gap-y-1.5",
|
|
42
|
+
"aria-label": n(`${N}.legend`, "Legend"),
|
|
43
|
+
children: t.map((e, t) => /* @__PURE__ */ w("li", {
|
|
44
|
+
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
45
|
+
children: [/* @__PURE__ */ C("span", {
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
className: "inline-block size-2.5 rounded-full",
|
|
48
|
+
style: { backgroundColor: e.color }
|
|
49
|
+
}), /* @__PURE__ */ w("span", {
|
|
50
|
+
className: "truncate",
|
|
51
|
+
children: [e.name, e.hint ? /* @__PURE__ */ w("span", {
|
|
52
|
+
className: "ml-1 text-text-tertiary",
|
|
53
|
+
children: [
|
|
54
|
+
"(",
|
|
55
|
+
e.hint,
|
|
56
|
+
")"
|
|
57
|
+
]
|
|
58
|
+
}) : null]
|
|
59
|
+
})]
|
|
60
|
+
}, `${t}-${e.name}`))
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function B({ shown: t, total: n, extremaKept: r }) {
|
|
64
|
+
let i = e();
|
|
65
|
+
if (t >= n) return null;
|
|
66
|
+
let a = {
|
|
67
|
+
shown: t.toLocaleString(),
|
|
68
|
+
total: n.toLocaleString()
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ C("p", {
|
|
71
|
+
className: "text-xs text-text-tertiary",
|
|
72
|
+
"data-testid": "thinning-note",
|
|
73
|
+
children: r ? i(`${N}.thinnedExtrema`, "Showing {{shown}} of {{total}} points; each segment keeps its highest and lowest values.", a) : i(`${N}.thinned`, "Showing {{shown}} of {{total}} items.", a)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function V({ text: t }) {
|
|
77
|
+
let n = e();
|
|
78
|
+
return /* @__PURE__ */ C("p", {
|
|
79
|
+
className: "min-h-4 text-xs text-text-secondary",
|
|
80
|
+
"aria-live": "polite",
|
|
81
|
+
"data-testid": "canvas-readout",
|
|
82
|
+
children: t ?? n(`${N}.readoutHint`, "Tap or click a marker to see its values.")
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function H({ columns: t, rows: n, total: r }) {
|
|
86
|
+
let i = e();
|
|
87
|
+
return r === 0 ? null : /* @__PURE__ */ w("details", {
|
|
88
|
+
className: "text-xs text-text-secondary",
|
|
89
|
+
"data-testid": "data-table",
|
|
90
|
+
children: [/* @__PURE__ */ C("summary", {
|
|
91
|
+
className: "cursor-pointer select-none",
|
|
92
|
+
children: r > n.length ? i(`${N}.dataTablePartial`, "Data table (first {{shown}} of {{total}} rows)", {
|
|
93
|
+
shown: n.length.toLocaleString(),
|
|
94
|
+
total: r.toLocaleString()
|
|
95
|
+
}) : i(`${N}.dataTable`, "Data table ({{total}} rows)", { total: r.toLocaleString() })
|
|
96
|
+
}), /* @__PURE__ */ C("div", {
|
|
97
|
+
className: "mt-2 max-h-64 overflow-auto rounded-card border border-border-default",
|
|
98
|
+
children: /* @__PURE__ */ w("table", {
|
|
99
|
+
className: "w-full text-left",
|
|
100
|
+
children: [/* @__PURE__ */ C("thead", {
|
|
101
|
+
className: "bg-bg-elevated text-text-primary",
|
|
102
|
+
children: /* @__PURE__ */ C("tr", { children: t.map((e, t) => /* @__PURE__ */ C("th", {
|
|
103
|
+
scope: "col",
|
|
104
|
+
className: "px-2 py-1 font-medium",
|
|
105
|
+
children: e
|
|
106
|
+
}, `h-${t}`)) })
|
|
107
|
+
}), /* @__PURE__ */ C("tbody", { children: n.map((e, t) => /* @__PURE__ */ C("tr", {
|
|
108
|
+
className: "border-t border-border-default",
|
|
109
|
+
children: e.map((e, t) => /* @__PURE__ */ C("td", {
|
|
110
|
+
className: "px-2 py-1 tabular-nums",
|
|
111
|
+
children: e
|
|
112
|
+
}, `c-${t}`))
|
|
113
|
+
}, `r-${t}`)) })]
|
|
114
|
+
})
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
var U = 640, W = 340, ee = 14;
|
|
119
|
+
function G(e, t, n) {
|
|
120
|
+
let { x: r, y: i } = m(e, t, n), a = U / 2 - ee;
|
|
121
|
+
return {
|
|
122
|
+
x: U / 2 + r * a,
|
|
123
|
+
y: W / 2 - i * a
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function K(e) {
|
|
127
|
+
return e.map((e, t) => `${t === 0 ? "M" : "L"} ${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(" ");
|
|
128
|
+
}
|
|
129
|
+
function q({ view: t }) {
|
|
130
|
+
let n = e(), [r, a] = S(t.projection), [o, c] = S(null), [d, f] = L[t.frame], p = t.valueLabel ?? n(`${N}.value`, "value"), m = (e) => [
|
|
131
|
+
e.label,
|
|
132
|
+
`${d} ${e.ra.toFixed(3)}°`,
|
|
133
|
+
`${f} ${e.dec >= 0 ? "+" : ""}${e.dec.toFixed(3)}°`,
|
|
134
|
+
e.value === void 0 ? null : `${p} ${u(e.value)}`
|
|
135
|
+
].filter(Boolean).join(" · "), h = b(() => {
|
|
136
|
+
let e = [];
|
|
137
|
+
for (let t = -90; t <= 90; t += 2) e.push(G(359.999, t, r));
|
|
138
|
+
for (let t = 90; t >= -90; t -= 2) e.push(G(.001, t, r));
|
|
139
|
+
let n = [
|
|
140
|
+
60,
|
|
141
|
+
120,
|
|
142
|
+
180,
|
|
143
|
+
240,
|
|
144
|
+
300
|
|
145
|
+
].map((e) => {
|
|
146
|
+
let t = [];
|
|
147
|
+
for (let n = -90; n <= 90; n += 3) t.push(G(e, n, r));
|
|
148
|
+
return {
|
|
149
|
+
lon: e,
|
|
150
|
+
d: K(t),
|
|
151
|
+
label: G(e, 0, r)
|
|
152
|
+
};
|
|
153
|
+
}), i = [
|
|
154
|
+
-60,
|
|
155
|
+
-30,
|
|
156
|
+
0,
|
|
157
|
+
30,
|
|
158
|
+
60
|
|
159
|
+
].map((e) => {
|
|
160
|
+
let t = [];
|
|
161
|
+
for (let n = .001; n <= 359.999; n += 3) t.push(G(n, e, r));
|
|
162
|
+
return t.push(G(359.999, e, r)), {
|
|
163
|
+
lat: e,
|
|
164
|
+
d: K(t),
|
|
165
|
+
label: G(359.999, e, r)
|
|
166
|
+
};
|
|
167
|
+
}), a = t.sources.map((e) => e.value).filter((e) => e !== void 0), o = a.length ? Infinity : 0, c = a.length ? -Infinity : 0;
|
|
168
|
+
for (let e of a) o = Math.min(o, e), c = Math.max(c, e);
|
|
169
|
+
let l = (e) => e === void 0 || c === o ? .5 : (e - o) / (c - o), u = s(t.sources, j).map((e) => ({
|
|
170
|
+
...e,
|
|
171
|
+
...G(e.ra, e.dec, r),
|
|
172
|
+
t: l(e.value)
|
|
173
|
+
}));
|
|
174
|
+
return {
|
|
175
|
+
outline: `${K(e)} Z`,
|
|
176
|
+
meridians: n,
|
|
177
|
+
parallels: i,
|
|
178
|
+
sources: u,
|
|
179
|
+
vMin: o,
|
|
180
|
+
vMax: c,
|
|
181
|
+
hasValues: a.length > 0
|
|
182
|
+
};
|
|
183
|
+
}, [r, t.sources]);
|
|
184
|
+
return /* @__PURE__ */ w("div", {
|
|
185
|
+
className: "space-y-3",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ w("div", {
|
|
188
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
189
|
+
children: [/* @__PURE__ */ C("p", {
|
|
190
|
+
className: "text-xs text-text-secondary",
|
|
191
|
+
children: t.sources.length === 1 ? n(`${N}.skySummaryOne`, "1 source · {{frame}} frame", { frame: t.frame.toUpperCase() }) : n(`${N}.skySummary`, "{{count}} sources · {{frame}} frame", {
|
|
192
|
+
count: t.sources.length.toLocaleString(),
|
|
193
|
+
frame: t.frame.toUpperCase()
|
|
194
|
+
})
|
|
195
|
+
}), /* @__PURE__ */ C("div", {
|
|
196
|
+
role: "group",
|
|
197
|
+
"aria-label": n(`${N}.projectionGroup`, "Projection"),
|
|
198
|
+
className: "flex flex-wrap gap-1",
|
|
199
|
+
children: i.map((e) => /* @__PURE__ */ C(T, {
|
|
200
|
+
type: "button",
|
|
201
|
+
size: "sm",
|
|
202
|
+
variant: e === r ? "default" : "outline",
|
|
203
|
+
"aria-pressed": e === r,
|
|
204
|
+
onClick: () => a(e),
|
|
205
|
+
children: F(n, e)
|
|
206
|
+
}, e))
|
|
207
|
+
})]
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ C(R, { children: /* @__PURE__ */ w("svg", {
|
|
210
|
+
viewBox: `0 0 ${U} ${W}`,
|
|
211
|
+
className: "h-auto w-full",
|
|
212
|
+
role: "img",
|
|
213
|
+
"aria-label": n(`${N}.skyAria`, "Sky map, {{projection}} projection, {{count}} sources", {
|
|
214
|
+
projection: F(n, r),
|
|
215
|
+
count: t.sources.length
|
|
216
|
+
}),
|
|
217
|
+
"data-projection": r,
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ C("path", {
|
|
220
|
+
d: h.outline,
|
|
221
|
+
fill: "var(--color-bg-elevated)",
|
|
222
|
+
stroke: "var(--color-chart-axis)"
|
|
223
|
+
}),
|
|
224
|
+
h.parallels.map((e) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("path", {
|
|
225
|
+
d: e.d,
|
|
226
|
+
fill: "none",
|
|
227
|
+
stroke: "var(--color-chart-grid)",
|
|
228
|
+
strokeDasharray: "2 4"
|
|
229
|
+
}), /* @__PURE__ */ C("text", {
|
|
230
|
+
x: e.label.x + 4,
|
|
231
|
+
y: e.label.y,
|
|
232
|
+
fontSize: 10,
|
|
233
|
+
dominantBaseline: "central",
|
|
234
|
+
fill: "var(--color-text-tertiary)",
|
|
235
|
+
children: e.lat > 0 ? `+${e.lat}°` : `${e.lat}°`
|
|
236
|
+
})] }, `lat-${e.lat}`)),
|
|
237
|
+
h.meridians.map((e) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("path", {
|
|
238
|
+
d: e.d,
|
|
239
|
+
fill: "none",
|
|
240
|
+
stroke: "var(--color-chart-grid)",
|
|
241
|
+
strokeDasharray: "2 4"
|
|
242
|
+
}), /* @__PURE__ */ C("text", {
|
|
243
|
+
x: e.label.x,
|
|
244
|
+
y: e.label.y + 12,
|
|
245
|
+
fontSize: 10,
|
|
246
|
+
textAnchor: "middle",
|
|
247
|
+
fill: "var(--color-text-tertiary)",
|
|
248
|
+
children: t.frame === "icrs" ? `${e.lon / 15}h` : `${e.lon}°`
|
|
249
|
+
})] }, `lon-${e.lon}`)),
|
|
250
|
+
h.sources.map((e, t) => /* @__PURE__ */ C("circle", {
|
|
251
|
+
cx: e.x,
|
|
252
|
+
cy: e.y,
|
|
253
|
+
r: 2 + e.t * 4,
|
|
254
|
+
fill: "var(--color-chart-1)",
|
|
255
|
+
fillOpacity: .45 + e.t * .5,
|
|
256
|
+
stroke: "var(--color-chart-1)",
|
|
257
|
+
strokeWidth: o === t ? 2 : .6,
|
|
258
|
+
className: "cursor-pointer",
|
|
259
|
+
"data-testid": "sky-source",
|
|
260
|
+
onClick: () => c(t),
|
|
261
|
+
children: /* @__PURE__ */ C("title", { children: m(e) })
|
|
262
|
+
}, `src-${t}`))
|
|
263
|
+
]
|
|
264
|
+
}) }),
|
|
265
|
+
/* @__PURE__ */ C(V, { text: o !== null && h.sources[o] ? m(h.sources[o]) : null }),
|
|
266
|
+
h.hasValues ? /* @__PURE__ */ C("p", {
|
|
267
|
+
className: "text-xs text-text-tertiary",
|
|
268
|
+
children: n(`${N}.skyScale`, "Marker size and opacity scale with {{label}} ({{min}} – {{max}}).", {
|
|
269
|
+
label: p,
|
|
270
|
+
min: l(h.vMin),
|
|
271
|
+
max: l(h.vMax)
|
|
272
|
+
})
|
|
273
|
+
}) : null,
|
|
274
|
+
/* @__PURE__ */ C(B, {
|
|
275
|
+
shown: h.sources.length,
|
|
276
|
+
total: t.sources.length
|
|
277
|
+
}),
|
|
278
|
+
/* @__PURE__ */ C(H, {
|
|
279
|
+
columns: [
|
|
280
|
+
n(`${N}.colLabel`, "Label"),
|
|
281
|
+
d,
|
|
282
|
+
f,
|
|
283
|
+
...h.hasValues ? [p] : []
|
|
284
|
+
],
|
|
285
|
+
rows: t.sources.slice(0, M).map((e) => [
|
|
286
|
+
e.label ?? "",
|
|
287
|
+
`${e.ra.toFixed(3)}°`,
|
|
288
|
+
`${e.dec.toFixed(3)}°`,
|
|
289
|
+
...h.hasValues ? [e.value === void 0 ? "" : u(e.value)] : []
|
|
290
|
+
]),
|
|
291
|
+
total: t.sources.length
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
var J = 640, Y = 340, X = {
|
|
297
|
+
top: 22,
|
|
298
|
+
right: 20,
|
|
299
|
+
bottom: 48,
|
|
300
|
+
left: 62
|
|
301
|
+
}, Z = J - X.left - X.right, Q = Y - X.top - X.bottom, te = 14;
|
|
302
|
+
function ne({ view: t }) {
|
|
303
|
+
let n = e(), [r, i] = S(null), a = b(() => {
|
|
304
|
+
let e = t.series.map((e) => [...e.points].sort((e, t) => e.x - t.x)), n = t.series.map((t, n) => ({
|
|
305
|
+
...t,
|
|
306
|
+
color: A[n % A.length],
|
|
307
|
+
points: o(e[n], j)
|
|
308
|
+
})), r = Infinity, i = -Infinity, a = Infinity, s = -Infinity;
|
|
309
|
+
for (let t of e) for (let e of t) {
|
|
310
|
+
let t = e.err ?? 0;
|
|
311
|
+
r = Math.min(r, e.x), i = Math.max(i, e.x), a = Math.min(a, e.y - t), s = Math.max(s, e.y + t);
|
|
312
|
+
}
|
|
313
|
+
r === i && (--r, i += 1), a === s && (--a, s += 1);
|
|
314
|
+
let c = (s - a) * .08;
|
|
315
|
+
a -= c, s += c;
|
|
316
|
+
let l = t.lines.filter((e) => e.x >= r && e.x <= i), u = f(r, i, 5), d = f(a, s, 5), p = 0, m = 0;
|
|
317
|
+
for (let t = 0; t < n.length; t += 1) p += n[t].points.length, m += e[t].length;
|
|
318
|
+
return {
|
|
319
|
+
series: n,
|
|
320
|
+
shown: p,
|
|
321
|
+
total: m,
|
|
322
|
+
lines: l,
|
|
323
|
+
domainX: [r, i],
|
|
324
|
+
domainY: [a, s],
|
|
325
|
+
xTicks: u,
|
|
326
|
+
yTicks: d,
|
|
327
|
+
xStep: _(u),
|
|
328
|
+
yStep: _(d)
|
|
329
|
+
};
|
|
330
|
+
}, [t]), { domainX: s, domainY: c } = a, p = (e) => X.left + (e - s[0]) / (s[1] - s[0]) * Z, m = (e) => (e - c[0]) / (c[1] - c[0]), h = (e) => t.invertY ? X.top + m(e) * Q : X.top + Q - m(e) * Q, g = (e) => {
|
|
331
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
332
|
+
if (t.width === 0 || t.height === 0) return;
|
|
333
|
+
let n = (e.clientX - t.left) / t.width * J, r = (e.clientY - t.top) / t.height * Y, o = a.series.flatMap((e, t) => e.points.map((e, n) => ({
|
|
334
|
+
x: p(e.x),
|
|
335
|
+
y: h(e.y),
|
|
336
|
+
series: t,
|
|
337
|
+
point: n
|
|
338
|
+
}))), s = d(o, n, r, te);
|
|
339
|
+
i(s >= 0 ? {
|
|
340
|
+
series: o[s].series,
|
|
341
|
+
point: o[s].point
|
|
342
|
+
} : null);
|
|
343
|
+
}, v = r ? a.series[r.series] : void 0, y = r ? v?.points[r.point] : void 0, x = v && y ? [
|
|
344
|
+
v.name,
|
|
345
|
+
`${t.xLabel} ${u(y.x)}`,
|
|
346
|
+
`${t.yLabel} ${u(y.y)}${y.err === void 0 ? "" : ` ± ${u(y.err)}`}`
|
|
347
|
+
].join(" · ") : null, T = (e, t) => {
|
|
348
|
+
if (!t) return K(e.map((e) => ({
|
|
349
|
+
x: p(e.x),
|
|
350
|
+
y: h(e.y)
|
|
351
|
+
})));
|
|
352
|
+
let n = [];
|
|
353
|
+
return e.forEach((t, r) => {
|
|
354
|
+
r > 0 && n.push({
|
|
355
|
+
x: p(t.x),
|
|
356
|
+
y: h(e[r - 1].y)
|
|
357
|
+
}), n.push({
|
|
358
|
+
x: p(t.x),
|
|
359
|
+
y: h(t.y)
|
|
360
|
+
});
|
|
361
|
+
}), K(n);
|
|
362
|
+
};
|
|
363
|
+
return /* @__PURE__ */ w("div", {
|
|
364
|
+
className: "space-y-3",
|
|
365
|
+
children: [
|
|
366
|
+
/* @__PURE__ */ C(R, { children: /* @__PURE__ */ w("svg", {
|
|
367
|
+
viewBox: `0 0 ${J} ${Y}`,
|
|
368
|
+
role: "img",
|
|
369
|
+
"aria-label": n(t.invertY ? `${N}.plotAriaInverted` : `${N}.plotAria`, t.invertY ? "{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}} (inverted)" : "{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}}", {
|
|
370
|
+
kind: I(n, t.kind),
|
|
371
|
+
series: a.series.map((e) => e.name).join(", "),
|
|
372
|
+
x: t.xLabel,
|
|
373
|
+
y: t.yLabel
|
|
374
|
+
}),
|
|
375
|
+
"data-inverted": t.invertY ? "true" : "false",
|
|
376
|
+
className: "h-auto w-full cursor-crosshair",
|
|
377
|
+
onClick: g,
|
|
378
|
+
children: [
|
|
379
|
+
a.yTicks.map((e) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("line", {
|
|
380
|
+
x1: X.left,
|
|
381
|
+
x2: X.left + Z,
|
|
382
|
+
y1: h(e),
|
|
383
|
+
y2: h(e),
|
|
384
|
+
stroke: "var(--color-chart-grid)"
|
|
385
|
+
}), /* @__PURE__ */ C("text", {
|
|
386
|
+
x: X.left - 8,
|
|
387
|
+
y: h(e),
|
|
388
|
+
textAnchor: "end",
|
|
389
|
+
dominantBaseline: "central",
|
|
390
|
+
fontSize: 11,
|
|
391
|
+
fill: "var(--color-text-tertiary)",
|
|
392
|
+
children: l(e, a.yStep)
|
|
393
|
+
})] }, `y-${e}`)),
|
|
394
|
+
a.xTicks.map((e) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("line", {
|
|
395
|
+
x1: p(e),
|
|
396
|
+
x2: p(e),
|
|
397
|
+
y1: X.top,
|
|
398
|
+
y2: X.top + Q,
|
|
399
|
+
stroke: "var(--color-chart-grid)",
|
|
400
|
+
strokeDasharray: "2 4"
|
|
401
|
+
}), /* @__PURE__ */ C("text", {
|
|
402
|
+
x: p(e),
|
|
403
|
+
y: X.top + Q + 18,
|
|
404
|
+
textAnchor: "middle",
|
|
405
|
+
fontSize: 11,
|
|
406
|
+
fill: "var(--color-text-tertiary)",
|
|
407
|
+
children: l(e, a.xStep)
|
|
408
|
+
})] }, `x-${e}`)),
|
|
409
|
+
/* @__PURE__ */ C("rect", {
|
|
410
|
+
x: X.left,
|
|
411
|
+
y: X.top,
|
|
412
|
+
width: Z,
|
|
413
|
+
height: Q,
|
|
414
|
+
fill: "none",
|
|
415
|
+
stroke: "var(--color-chart-axis)"
|
|
416
|
+
}),
|
|
417
|
+
a.lines.map((e, t) => /* @__PURE__ */ w("g", {
|
|
418
|
+
"data-testid": "spectral-line",
|
|
419
|
+
children: [/* @__PURE__ */ C("line", {
|
|
420
|
+
x1: p(e.x),
|
|
421
|
+
x2: p(e.x),
|
|
422
|
+
y1: X.top,
|
|
423
|
+
y2: X.top + Q,
|
|
424
|
+
stroke: "var(--color-chart-negative)",
|
|
425
|
+
strokeDasharray: "4 3"
|
|
426
|
+
}), e.label ? /* @__PURE__ */ C("text", {
|
|
427
|
+
x: p(e.x) + 3,
|
|
428
|
+
y: X.top - 6,
|
|
429
|
+
fontSize: 10,
|
|
430
|
+
fill: "var(--color-text-secondary)",
|
|
431
|
+
children: e.label
|
|
432
|
+
}) : null]
|
|
433
|
+
}, `line-${t}`)),
|
|
434
|
+
v && y ? /* @__PURE__ */ C("circle", {
|
|
435
|
+
cx: p(y.x),
|
|
436
|
+
cy: h(y.y),
|
|
437
|
+
r: 5,
|
|
438
|
+
fill: "none",
|
|
439
|
+
stroke: "var(--color-text-primary)",
|
|
440
|
+
strokeWidth: 1.5,
|
|
441
|
+
pointerEvents: "none",
|
|
442
|
+
"data-testid": "plot-selection"
|
|
443
|
+
}) : null,
|
|
444
|
+
a.series.map((e, t) => /* @__PURE__ */ w("g", {
|
|
445
|
+
"data-testid": "plot-series",
|
|
446
|
+
"data-style": e.style,
|
|
447
|
+
children: [e.points.map((t, n) => t.err ? /* @__PURE__ */ C("line", {
|
|
448
|
+
x1: p(t.x),
|
|
449
|
+
x2: p(t.x),
|
|
450
|
+
y1: h(t.y - t.err),
|
|
451
|
+
y2: h(t.y + t.err),
|
|
452
|
+
stroke: e.color,
|
|
453
|
+
strokeOpacity: .5,
|
|
454
|
+
"data-testid": "error-bar"
|
|
455
|
+
}, `err-${n}`) : null), e.style === "scatter" ? e.points.map((t, n) => /* @__PURE__ */ C("circle", {
|
|
456
|
+
cx: p(t.x),
|
|
457
|
+
cy: h(t.y),
|
|
458
|
+
r: 2.4,
|
|
459
|
+
fill: e.color,
|
|
460
|
+
fillOpacity: .85
|
|
461
|
+
}, `pt-${n}`)) : /* @__PURE__ */ C("path", {
|
|
462
|
+
d: T(e.points, e.style === "step"),
|
|
463
|
+
fill: "none",
|
|
464
|
+
stroke: e.color,
|
|
465
|
+
strokeWidth: 1.8,
|
|
466
|
+
strokeLinejoin: "round"
|
|
467
|
+
})]
|
|
468
|
+
}, `series-${t}`)),
|
|
469
|
+
/* @__PURE__ */ C("text", {
|
|
470
|
+
x: X.left + Z / 2,
|
|
471
|
+
y: Y - 6,
|
|
472
|
+
textAnchor: "middle",
|
|
473
|
+
fontSize: 12,
|
|
474
|
+
fill: "var(--color-text-secondary)",
|
|
475
|
+
children: t.xLabel
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ C("text", {
|
|
478
|
+
x: 14,
|
|
479
|
+
y: X.top + Q / 2,
|
|
480
|
+
textAnchor: "middle",
|
|
481
|
+
fontSize: 12,
|
|
482
|
+
fill: "var(--color-text-secondary)",
|
|
483
|
+
transform: `rotate(-90 14 ${X.top + Q / 2})`,
|
|
484
|
+
children: t.yLabel
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
}) }),
|
|
488
|
+
/* @__PURE__ */ C(V, { text: x }),
|
|
489
|
+
/* @__PURE__ */ C(z, { items: a.series.map((e) => ({
|
|
490
|
+
name: e.name,
|
|
491
|
+
color: e.color,
|
|
492
|
+
hint: e.style
|
|
493
|
+
})) }),
|
|
494
|
+
/* @__PURE__ */ C(B, {
|
|
495
|
+
shown: a.shown,
|
|
496
|
+
total: a.total,
|
|
497
|
+
extremaKept: !0
|
|
498
|
+
}),
|
|
499
|
+
/* @__PURE__ */ C(H, {
|
|
500
|
+
columns: [
|
|
501
|
+
n(`${N}.colSeries`, "Series"),
|
|
502
|
+
t.xLabel,
|
|
503
|
+
t.yLabel,
|
|
504
|
+
n(`${N}.colErr`, "±")
|
|
505
|
+
],
|
|
506
|
+
rows: t.series.flatMap((e) => e.points.map((t) => ({
|
|
507
|
+
name: e.name,
|
|
508
|
+
p: t
|
|
509
|
+
}))).slice(0, M).map(({ name: e, p: t }) => [
|
|
510
|
+
e,
|
|
511
|
+
u(t.x),
|
|
512
|
+
u(t.y),
|
|
513
|
+
t.err === void 0 ? "" : u(t.err)
|
|
514
|
+
]),
|
|
515
|
+
total: a.total
|
|
516
|
+
})
|
|
517
|
+
]
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
var $ = 360, re = $ * .32;
|
|
521
|
+
function ie({ view: t }) {
|
|
522
|
+
let n = e(), [i, o] = S(r), [c, l] = S(null), d = x(null), f = b(() => {
|
|
523
|
+
let e = h([...t.points, ...t.paths.flatMap((e) => e.points)]), n = s(t.points, j).map((t) => ({
|
|
524
|
+
label: t.label,
|
|
525
|
+
value: t.value,
|
|
526
|
+
data: {
|
|
527
|
+
x: t.x,
|
|
528
|
+
y: t.y,
|
|
529
|
+
z: t.z
|
|
530
|
+
},
|
|
531
|
+
norm: e(t)
|
|
532
|
+
})), r = t.paths.map((t, n) => ({
|
|
533
|
+
name: t.name,
|
|
534
|
+
color: A[1 + n % (A.length - 1)],
|
|
535
|
+
norm: s(t.points, j).map((t) => e(t))
|
|
536
|
+
})), i = 0, a = 0;
|
|
537
|
+
for (let e = 0; e < t.paths.length; e += 1) i += t.paths[e].points.length, a += r[e].norm.length;
|
|
538
|
+
return {
|
|
539
|
+
points: n,
|
|
540
|
+
paths: r,
|
|
541
|
+
shown: n.length + a,
|
|
542
|
+
total: t.points.length + i
|
|
543
|
+
};
|
|
544
|
+
}, [t]), m = y((e) => {
|
|
545
|
+
let t = p(e, i);
|
|
546
|
+
return {
|
|
547
|
+
x: $ / 2 + t.x * re,
|
|
548
|
+
y: $ / 2 - t.y * re,
|
|
549
|
+
depth: t.depth
|
|
550
|
+
};
|
|
551
|
+
}, [i]), g = b(() => ({
|
|
552
|
+
points: f.points.map((e, t) => ({
|
|
553
|
+
index: t,
|
|
554
|
+
label: e.label,
|
|
555
|
+
value: e.value,
|
|
556
|
+
data: e.data,
|
|
557
|
+
...m(e.norm)
|
|
558
|
+
})).sort((e, t) => e.depth - t.depth),
|
|
559
|
+
paths: f.paths.map((e) => ({
|
|
560
|
+
name: e.name,
|
|
561
|
+
color: e.color,
|
|
562
|
+
d: K(e.norm.map((e) => m(e)))
|
|
563
|
+
})),
|
|
564
|
+
axes: [
|
|
565
|
+
"x",
|
|
566
|
+
"y",
|
|
567
|
+
"z"
|
|
568
|
+
].map((e) => {
|
|
569
|
+
let t = {
|
|
570
|
+
x: 0,
|
|
571
|
+
y: 0,
|
|
572
|
+
z: 0,
|
|
573
|
+
[e]: 1.15
|
|
574
|
+
};
|
|
575
|
+
return {
|
|
576
|
+
axis: e,
|
|
577
|
+
from: m({
|
|
578
|
+
x: 0,
|
|
579
|
+
y: 0,
|
|
580
|
+
z: 0
|
|
581
|
+
}),
|
|
582
|
+
to: m(t)
|
|
583
|
+
};
|
|
584
|
+
})
|
|
585
|
+
}), [f, m]), _ = t.points.some((e) => e.value !== void 0) || t.paths.some((e) => e.points.some((e) => e.value !== void 0)), v = (e) => [
|
|
586
|
+
e.label,
|
|
587
|
+
`(${u(e.data.x)}, ${u(e.data.y)}, ${u(e.data.z)})`,
|
|
588
|
+
e.value === void 0 ? null : `· ${u(e.value)}`
|
|
589
|
+
].filter(Boolean).join(" "), E = x(!1), D = (e) => {
|
|
590
|
+
E.current || l(e);
|
|
591
|
+
}, O = (e) => {
|
|
592
|
+
d.current = {
|
|
593
|
+
x: e.clientX,
|
|
594
|
+
y: e.clientY,
|
|
595
|
+
camera: i
|
|
596
|
+
}, E.current = !1, e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
597
|
+
}, k = () => {
|
|
598
|
+
d.current = null;
|
|
599
|
+
}, P = (e) => {
|
|
600
|
+
let t = d.current;
|
|
601
|
+
if (t) {
|
|
602
|
+
if (e.pointerType === "mouse" && e.buttons === 0) {
|
|
603
|
+
k();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
Math.hypot(e.clientX - t.x, e.clientY - t.y) > 3 && (E.current = !0), o({
|
|
607
|
+
yaw: t.camera.yaw + (e.clientX - t.x) * .5,
|
|
608
|
+
pitch: a(t.camera.pitch + (e.clientY - t.y) * .5)
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}, F = (e) => {
|
|
612
|
+
let t = {
|
|
613
|
+
ArrowLeft: {
|
|
614
|
+
...i,
|
|
615
|
+
yaw: i.yaw - 10
|
|
616
|
+
},
|
|
617
|
+
ArrowRight: {
|
|
618
|
+
...i,
|
|
619
|
+
yaw: i.yaw + 10
|
|
620
|
+
},
|
|
621
|
+
ArrowUp: {
|
|
622
|
+
...i,
|
|
623
|
+
pitch: a(i.pitch - 10)
|
|
624
|
+
},
|
|
625
|
+
ArrowDown: {
|
|
626
|
+
...i,
|
|
627
|
+
pitch: a(i.pitch + 10)
|
|
628
|
+
}
|
|
629
|
+
}[e.key];
|
|
630
|
+
t && (e.preventDefault(), o(t));
|
|
631
|
+
}, I = g.points.length ? [g.points[0].depth, g.points[g.points.length - 1].depth] : [0, 0], L = (e) => I[1] === I[0] ? 1 : (e - I[0]) / (I[1] - I[0]), U = c === null ? void 0 : f.points[c];
|
|
632
|
+
return /* @__PURE__ */ w("div", {
|
|
633
|
+
className: "space-y-3",
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ w("div", {
|
|
636
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
637
|
+
children: [/* @__PURE__ */ C("p", {
|
|
638
|
+
className: "text-xs text-text-secondary",
|
|
639
|
+
children: n(`${N}.sceneHelp`, "Drag or use the arrow keys to rotate · yaw {{yaw}}°, pitch {{pitch}}°", {
|
|
640
|
+
yaw: Math.round(i.yaw),
|
|
641
|
+
pitch: Math.round(i.pitch)
|
|
642
|
+
})
|
|
643
|
+
}), /* @__PURE__ */ C(T, {
|
|
644
|
+
type: "button",
|
|
645
|
+
size: "sm",
|
|
646
|
+
variant: "outline",
|
|
647
|
+
onClick: () => o(r),
|
|
648
|
+
children: n(`${N}.resetView`, "Reset view")
|
|
649
|
+
})]
|
|
650
|
+
}),
|
|
651
|
+
/* @__PURE__ */ C(R, { children: /* @__PURE__ */ w("svg", {
|
|
652
|
+
viewBox: `0 0 ${$} ${$}`,
|
|
653
|
+
className: "mx-auto h-auto w-full max-w-md cursor-grab touch-none select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
654
|
+
role: "application",
|
|
655
|
+
"aria-roledescription": n(`${N}.sceneRole`, "3-D scene"),
|
|
656
|
+
tabIndex: 0,
|
|
657
|
+
"aria-label": n(`${N}.sceneAria`, "3-D scene with {{points}} points and {{paths}} paths; drag or use arrow keys to rotate", {
|
|
658
|
+
points: t.points.length,
|
|
659
|
+
paths: t.paths.length
|
|
660
|
+
}),
|
|
661
|
+
"data-yaw": i.yaw,
|
|
662
|
+
"data-pitch": i.pitch,
|
|
663
|
+
onPointerDown: O,
|
|
664
|
+
onPointerMove: P,
|
|
665
|
+
onPointerUp: k,
|
|
666
|
+
onPointerCancel: k,
|
|
667
|
+
onKeyDown: F,
|
|
668
|
+
children: [
|
|
669
|
+
g.axes.map((e) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("line", {
|
|
670
|
+
x1: e.from.x,
|
|
671
|
+
y1: e.from.y,
|
|
672
|
+
x2: e.to.x,
|
|
673
|
+
y2: e.to.y,
|
|
674
|
+
stroke: "var(--color-chart-axis)"
|
|
675
|
+
}), /* @__PURE__ */ C("text", {
|
|
676
|
+
x: e.to.x,
|
|
677
|
+
y: e.to.y,
|
|
678
|
+
fontSize: 10,
|
|
679
|
+
fill: "var(--color-text-tertiary)",
|
|
680
|
+
dy: -3,
|
|
681
|
+
children: t.axes[e.axis]
|
|
682
|
+
})] }, e.axis)),
|
|
683
|
+
g.paths.map((e, t) => /* @__PURE__ */ C("path", {
|
|
684
|
+
d: e.d,
|
|
685
|
+
fill: "none",
|
|
686
|
+
stroke: e.color,
|
|
687
|
+
strokeWidth: 1.5,
|
|
688
|
+
"data-testid": "scene-path"
|
|
689
|
+
}, `path-${t}`)),
|
|
690
|
+
g.points.map((e) => {
|
|
691
|
+
let t = L(e.depth);
|
|
692
|
+
return /* @__PURE__ */ C("circle", {
|
|
693
|
+
cx: e.x,
|
|
694
|
+
cy: e.y,
|
|
695
|
+
r: 2 + t * 2,
|
|
696
|
+
fill: "var(--color-chart-1)",
|
|
697
|
+
fillOpacity: .35 + t * .6,
|
|
698
|
+
stroke: c === e.index ? "var(--color-text-primary)" : void 0,
|
|
699
|
+
className: "cursor-pointer",
|
|
700
|
+
"data-testid": "scene-point",
|
|
701
|
+
onClick: () => D(e.index),
|
|
702
|
+
children: /* @__PURE__ */ C("title", { children: v(e) })
|
|
703
|
+
}, `p-${e.index}`);
|
|
704
|
+
})
|
|
705
|
+
]
|
|
706
|
+
}) }),
|
|
707
|
+
/* @__PURE__ */ C(V, { text: U ? v(U) : null }),
|
|
708
|
+
/* @__PURE__ */ C(z, { items: g.paths.map((e) => ({
|
|
709
|
+
name: e.name,
|
|
710
|
+
color: e.color,
|
|
711
|
+
hint: n(`${N}.pathHint`, "path")
|
|
712
|
+
})) }),
|
|
713
|
+
/* @__PURE__ */ C(B, {
|
|
714
|
+
shown: f.shown,
|
|
715
|
+
total: f.total
|
|
716
|
+
}),
|
|
717
|
+
/* @__PURE__ */ C(H, {
|
|
718
|
+
columns: [
|
|
719
|
+
n(`${N}.colLabel`, "Label"),
|
|
720
|
+
t.axes.x,
|
|
721
|
+
t.axes.y,
|
|
722
|
+
t.axes.z,
|
|
723
|
+
..._ ? [n(`${N}.value`, "value")] : []
|
|
724
|
+
],
|
|
725
|
+
rows: [...t.points.map((e) => ({
|
|
726
|
+
p: e,
|
|
727
|
+
owner: e.label ?? ""
|
|
728
|
+
})), ...t.paths.flatMap((e) => e.points.map((t) => ({
|
|
729
|
+
p: t,
|
|
730
|
+
owner: t.label ?? e.name
|
|
731
|
+
})))].slice(0, M).map(({ p: e, owner: t }) => [
|
|
732
|
+
t,
|
|
733
|
+
u(e.x),
|
|
734
|
+
u(e.y),
|
|
735
|
+
u(e.z),
|
|
736
|
+
..._ ? [e.value === void 0 ? "" : u(e.value)] : []
|
|
737
|
+
]),
|
|
738
|
+
total: f.total
|
|
739
|
+
})
|
|
740
|
+
]
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
function ae({ view: e }) {
|
|
744
|
+
return /* @__PURE__ */ w("div", {
|
|
745
|
+
className: "space-y-2",
|
|
746
|
+
children: [e.title || e.description ? /* @__PURE__ */ w("div", { children: [e.title ? /* @__PURE__ */ C("p", {
|
|
747
|
+
className: "text-sm font-medium text-text-primary",
|
|
748
|
+
children: e.title
|
|
749
|
+
}) : null, e.description ? /* @__PURE__ */ C("p", {
|
|
750
|
+
className: "text-xs text-text-secondary",
|
|
751
|
+
children: e.description
|
|
752
|
+
}) : null] }) : null, e.kind === "skymap" ? /* @__PURE__ */ C(q, { view: e }) : e.kind === "scene3d" ? /* @__PURE__ */ C(ie, { view: e }) : /* @__PURE__ */ C(ne, { view: e })]
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
var oe = /* @__PURE__ */ new WeakMap(), se = 0;
|
|
756
|
+
function ce(e) {
|
|
757
|
+
let t = oe.get(e);
|
|
758
|
+
return t === void 0 && (se += 1, t = se, oe.set(e, t)), t;
|
|
759
|
+
}
|
|
760
|
+
function le({ results: r, className: i }) {
|
|
761
|
+
let a = e(), o = b(() => c(r), [r]), s = g(o.map((e) => e.title ?? I(a, e.kind)), (e, t) => a(`${N}.tabNumbered`, "{{label}} {{n}}", {
|
|
762
|
+
label: e,
|
|
763
|
+
n: t
|
|
764
|
+
}));
|
|
765
|
+
return o.length === 0 ? /* @__PURE__ */ C(n, {
|
|
766
|
+
results: r,
|
|
767
|
+
className: i
|
|
768
|
+
}) : o.length === 1 ? /* @__PURE__ */ C("div", {
|
|
769
|
+
className: t("space-y-3", i),
|
|
770
|
+
"data-testid": "science-canvas",
|
|
771
|
+
children: /* @__PURE__ */ C(ae, { view: o[0] }, ce(r))
|
|
772
|
+
}) : /* @__PURE__ */ w(E, {
|
|
773
|
+
defaultValue: "view-0",
|
|
774
|
+
className: t("space-y-3", i),
|
|
775
|
+
"data-testid": "science-canvas",
|
|
776
|
+
children: [/* @__PURE__ */ C(O, {
|
|
777
|
+
className: "flex h-auto flex-wrap justify-start",
|
|
778
|
+
children: s.map((e, t) => /* @__PURE__ */ C(k, {
|
|
779
|
+
value: `view-${t}`,
|
|
780
|
+
children: e
|
|
781
|
+
}, `tab-${t}`))
|
|
782
|
+
}), o.map((e, t) => /* @__PURE__ */ C(D, {
|
|
783
|
+
value: `view-${t}`,
|
|
784
|
+
children: /* @__PURE__ */ C(ae, { view: e })
|
|
785
|
+
}, `panel-${t}`))]
|
|
786
|
+
}, ce(r));
|
|
787
|
+
}
|
|
788
|
+
//#endregion
|
|
789
|
+
export { ne as PlotCanvas, ie as SceneCanvas, le as ScienceCanvas, le as default, q as SkyMapCanvas };
|
|
790
|
+
|
|
791
|
+
//# sourceMappingURL=ScienceCanvas.js.map
|