@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 @@
|
|
|
1
|
+
{"version":3,"file":"ScienceCanvas.js","names":[],"sources":["../../../src/cosmicintersection/components/ScienceCanvas.tsx"],"sourcesContent":["/**\n * ScienceCanvas — the analyses results canvas (BOFF-3984, mock cosmic-17).\n *\n * Renders the canonical scientific views an analysis can record in\n * `results.visualization` / `results.visualizations` (see\n * `lib/visualization.ts`):\n *\n * - sky map all-sky Mollweide / Aitoff / equirectangular projection with a\n * graticule, east-left convention and value-scaled sources\n * - spectrum wavelength vs flux with error bars, step/line/scatter series and\n * labelled spectral-line markers\n * - light curve time vs flux or magnitude (magnitude axis inverted)\n * - 3-D scene orthographic point cloud / orbit paths, rotatable by pointer\n * drag or the arrow keys\n *\n * Several views are offered as tabs. Payloads without canonical views fall\n * back to the generic numeric-series <ResultsChart>, so legacy analyses render\n * exactly as before.\n *\n * Long series are thinned for rendering only: plots keep every bucket's\n * extremes (`decimateSeries`) and their axes span the full data, and each view\n * says when it shows fewer points than it holds. Every view also offers its\n * values as a data table, and tapping a marker shows its details in a readout,\n * so the data is available without hover tooltips (touch, assistive tech).\n *\n * Everything is hand-drawn SVG with the design system's dataviz tokens\n * (`var(--color-chart-*)`) and text tokens — no raw colours, no chart library.\n * Every SVG uses a viewBox at 100% width, so the canvas scales on phones.\n */\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n} from 'react';\n\nimport { Button, Tabs, TabsContent, TabsList, TabsTrigger } from '@burdenoff/fe-libs/ui';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport {\n DEFAULT_CAMERA,\n SKY_PROJECTIONS,\n clampPitch,\n decimateSeries,\n downsample,\n extractVisualizations,\n formatTick,\n formatValue,\n nearestPoint,\n niceTicks,\n tickStep,\n projectPoint,\n projectSky,\n sceneNormalizer,\n tabLabels,\n viewKindLabel,\n type Camera,\n type Point2D,\n type PlotView,\n type Scene3DView,\n type SkyMapView,\n type SkyProjection,\n type VisualizationView,\n} from '../lib/visualization';\nimport { cn } from '../utils/cn';\nimport { ResultsChart } from './ResultsChart';\n\nconst PALETTE = [1, 2, 3, 4, 5, 6].map((n) => `var(--color-chart-${n})`);\nconst MAX_RENDERED_POINTS = 2_000;\n/** Rows listed in a view's data table; the summary states the full count. */\nconst MAX_TABLE_ROWS = 50;\n\n/** Translation keys live under this prefix; English is the built-in fallback. */\nconst K = 'cosmicintersection.scienceCanvas';\n\ntype Tr = ReturnType<typeof useTr>;\n\nconst PROJECTION_LABEL: Record<SkyProjection, string> = {\n mollweide: 'Mollweide',\n aitoff: 'Aitoff',\n equirectangular: 'Equirectangular',\n};\n\nfunction projectionLabel(tr: Tr, projection: SkyProjection): string {\n return tr(`${K}.projection.${projection}`, PROJECTION_LABEL[projection]);\n}\n\nfunction kindLabel(tr: Tr, kind: VisualizationView['kind']): string {\n return tr(`${K}.kind.${kind}`, viewKindLabel(kind));\n}\n\nconst FRAME_LABEL: Record<SkyMapView['frame'], [string, string]> = {\n icrs: ['RA', 'Dec'],\n galactic: ['l', 'b'],\n ecliptic: ['λ', 'β'],\n};\n\nfunction Frame({ children }: { children: ReactNode }) {\n return (\n <div className=\"rounded-card border border-border-default bg-bg-sunken p-3\">{children}</div>\n );\n}\n\nfunction Legend({ items }: { items: Array<{ name: string; color: string; hint?: string }> }) {\n const tr = useTr();\n if (items.length < 2) return null;\n return (\n <ul className=\"flex flex-wrap gap-x-4 gap-y-1.5\" aria-label={tr(`${K}.legend`, 'Legend')}>\n {/* Names come from the payload and may repeat, so the index keeps keys unique. */}\n {items.map((item, i) => (\n <li\n key={`${i}-${item.name}`}\n className=\"flex items-center gap-1.5 text-xs text-text-secondary\"\n >\n <span\n aria-hidden=\"true\"\n className=\"inline-block size-2.5 rounded-full\"\n style={{ backgroundColor: item.color }}\n />\n <span className=\"truncate\">\n {item.name}\n {item.hint ? <span className=\"ml-1 text-text-tertiary\">({item.hint})</span> : null}\n </span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** States that a view renders fewer elements than the payload holds. */\nfunction ThinningNote({\n shown,\n total,\n extremaKept,\n}: {\n shown: number;\n total: number;\n extremaKept?: boolean;\n}) {\n const tr = useTr();\n if (shown >= total) return null;\n const params = { shown: shown.toLocaleString(), total: total.toLocaleString() };\n return (\n <p className=\"text-xs text-text-tertiary\" data-testid=\"thinning-note\">\n {extremaKept\n ? tr(\n `${K}.thinnedExtrema`,\n 'Showing {{shown}} of {{total}} points; each segment keeps its highest and lowest values.',\n params\n )\n : tr(`${K}.thinned`, 'Showing {{shown}} of {{total}} items.', params)}\n </p>\n );\n}\n\n/** Announces the marker the viewer tapped or clicked (touch has no hover). */\nfunction Readout({ text }: { text: string | null }) {\n const tr = useTr();\n return (\n <p\n className=\"min-h-4 text-xs text-text-secondary\"\n aria-live=\"polite\"\n data-testid=\"canvas-readout\"\n >\n {text ?? tr(`${K}.readoutHint`, 'Tap or click a marker to see its values.')}\n </p>\n );\n}\n\n/** The view's values as a table: the text alternative to the drawing. */\nfunction DataTable({\n columns,\n rows,\n total,\n}: {\n columns: string[];\n rows: string[][];\n total: number;\n}) {\n const tr = useTr();\n if (total === 0) return null;\n return (\n <details className=\"text-xs text-text-secondary\" data-testid=\"data-table\">\n <summary className=\"cursor-pointer select-none\">\n {total > rows.length\n ? tr(`${K}.dataTablePartial`, 'Data table (first {{shown}} of {{total}} rows)', {\n shown: rows.length.toLocaleString(),\n total: total.toLocaleString(),\n })\n : tr(`${K}.dataTable`, 'Data table ({{total}} rows)', { total: total.toLocaleString() })}\n </summary>\n <div className=\"mt-2 max-h-64 overflow-auto rounded-card border border-border-default\">\n <table className=\"w-full text-left\">\n <thead className=\"bg-bg-elevated text-text-primary\">\n <tr>\n {columns.map((c, i) => (\n <th key={`h-${i}`} scope=\"col\" className=\"px-2 py-1 font-medium\">\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={`r-${r}`} className=\"border-t border-border-default\">\n {row.map((cell, c) => (\n <td key={`c-${c}`} className=\"px-2 py-1 tabular-nums\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </details>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sky map\n// ---------------------------------------------------------------------------\n\nconst SKY_W = 640;\nconst SKY_H = 340;\nconst SKY_PAD = 14;\n\nfunction skyToSvg(lon: number, lat: number, projection: SkyProjection) {\n const { x, y } = projectSky(lon, lat, projection);\n const halfW = SKY_W / 2 - SKY_PAD;\n return { x: SKY_W / 2 + x * halfW, y: SKY_H / 2 - y * halfW };\n}\n\nfunction polyline(points: Array<{ x: number; y: number }>): string {\n return points\n .map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`)\n .join(' ');\n}\n\nexport function SkyMapCanvas({ view }: { view: SkyMapView }) {\n const tr = useTr();\n const [projection, setProjection] = useState<SkyProjection>(view.projection);\n const [selected, setSelected] = useState<number | null>(null);\n const [lonName, latName] = FRAME_LABEL[view.frame];\n const valueLabel = view.valueLabel ?? tr(`${K}.value`, 'value');\n\n const describe = (s: SkyMapView['sources'][number]) =>\n [\n s.label,\n `${lonName} ${s.ra.toFixed(3)}°`,\n `${latName} ${s.dec >= 0 ? '+' : ''}${s.dec.toFixed(3)}°`,\n s.value !== undefined ? `${valueLabel} ${formatValue(s.value)}` : null,\n ]\n .filter(Boolean)\n .join(' · ');\n\n const geometry = useMemo(() => {\n // The outline runs along lon 359.999° and 0.001° rather than 360° / 0°:\n // both ends of the seam project to the same x at exactly 0° / 360°, so the\n // epsilon keeps the left and right limbs of the ellipse apart.\n const outline: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 2) outline.push(skyToSvg(359.999, lat, projection));\n for (let lat = 90; lat >= -90; lat -= 2) outline.push(skyToSvg(0.001, lat, projection));\n const meridians = [60, 120, 180, 240, 300].map((lon) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 3) pts.push(skyToSvg(lon, lat, projection));\n return { lon, d: polyline(pts), label: skyToSvg(lon, 0, projection) };\n });\n const parallels = [-60, -30, 0, 30, 60].map((lat) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lon = 0.001; lon <= 359.999; lon += 3) pts.push(skyToSvg(lon, lat, projection));\n pts.push(skyToSvg(359.999, lat, projection));\n return { lat, d: polyline(pts), label: skyToSvg(359.999, lat, projection) };\n });\n const values = view.sources.map((s) => s.value).filter((v): v is number => v !== undefined);\n // A single pass instead of Math.min(...values): spreading up to 20,000\n // arguments can exceed the argument limit of some engines and WebViews.\n let vMin = values.length ? Infinity : 0;\n let vMax = values.length ? -Infinity : 0;\n for (const v of values) {\n vMin = Math.min(vMin, v);\n vMax = Math.max(vMax, v);\n }\n const scale = (value: number | undefined) =>\n value === undefined || vMax === vMin ? 0.5 : (value - vMin) / (vMax - vMin);\n const sources = downsample(view.sources, MAX_RENDERED_POINTS).map((s) => ({\n ...s,\n ...skyToSvg(s.ra, s.dec, projection),\n t: scale(s.value),\n }));\n return {\n outline: `${polyline(outline)} Z`,\n meridians,\n parallels,\n sources,\n vMin,\n vMax,\n hasValues: values.length > 0,\n };\n }, [projection, view.sources]);\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {view.sources.length === 1\n ? tr(`${K}.skySummaryOne`, '1 source · {{frame}} frame', {\n frame: view.frame.toUpperCase(),\n })\n : tr(`${K}.skySummary`, '{{count}} sources · {{frame}} frame', {\n count: view.sources.length.toLocaleString(),\n frame: view.frame.toUpperCase(),\n })}\n </p>\n <div\n role=\"group\"\n aria-label={tr(`${K}.projectionGroup`, 'Projection')}\n className=\"flex flex-wrap gap-1\"\n >\n {SKY_PROJECTIONS.map((p) => (\n <Button\n key={p}\n type=\"button\"\n size=\"sm\"\n variant={p === projection ? 'default' : 'outline'}\n aria-pressed={p === projection}\n onClick={() => setProjection(p)}\n >\n {projectionLabel(tr, p)}\n </Button>\n ))}\n </div>\n </div>\n <Frame>\n <svg\n viewBox={`0 0 ${SKY_W} ${SKY_H}`}\n className=\"h-auto w-full\"\n role=\"img\"\n aria-label={tr(`${K}.skyAria`, 'Sky map, {{projection}} projection, {{count}} sources', {\n projection: projectionLabel(tr, projection),\n count: view.sources.length,\n })}\n data-projection={projection}\n >\n <path\n d={geometry.outline}\n fill=\"var(--color-bg-elevated)\"\n stroke=\"var(--color-chart-axis)\"\n />\n {geometry.parallels.map((g) => (\n <g key={`lat-${g.lat}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x + 4}\n y={g.label.y}\n fontSize={10}\n dominantBaseline=\"central\"\n fill=\"var(--color-text-tertiary)\"\n >\n {g.lat > 0 ? `+${g.lat}°` : `${g.lat}°`}\n </text>\n </g>\n ))}\n {geometry.meridians.map((g) => (\n <g key={`lon-${g.lon}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x}\n y={g.label.y + 12}\n fontSize={10}\n textAnchor=\"middle\"\n fill=\"var(--color-text-tertiary)\"\n >\n {view.frame === 'icrs' ? `${g.lon / 15}h` : `${g.lon}°`}\n </text>\n </g>\n ))}\n {geometry.sources.map((s, i) => (\n <circle\n key={`src-${i}`}\n cx={s.x}\n cy={s.y}\n r={2 + s.t * 4}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.45 + s.t * 0.5}\n stroke=\"var(--color-chart-1)\"\n strokeWidth={selected === i ? 2 : 0.6}\n className=\"cursor-pointer\"\n data-testid=\"sky-source\"\n onClick={() => setSelected(i)}\n >\n <title>{describe(s)}</title>\n </circle>\n ))}\n </svg>\n </Frame>\n <Readout\n text={\n selected !== null && geometry.sources[selected]\n ? describe(geometry.sources[selected])\n : null\n }\n />\n {geometry.hasValues ? (\n <p className=\"text-xs text-text-tertiary\">\n {tr(\n `${K}.skyScale`,\n 'Marker size and opacity scale with {{label}} ({{min}} – {{max}}).',\n { label: valueLabel, min: formatTick(geometry.vMin), max: formatTick(geometry.vMax) }\n )}\n </p>\n ) : null}\n <ThinningNote shown={geometry.sources.length} total={view.sources.length} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n lonName,\n latName,\n ...(geometry.hasValues ? [valueLabel] : []),\n ]}\n rows={view.sources\n .slice(0, MAX_TABLE_ROWS)\n .map((s) => [\n s.label ?? '',\n `${s.ra.toFixed(3)}°`,\n `${s.dec.toFixed(3)}°`,\n ...(geometry.hasValues ? [s.value !== undefined ? formatValue(s.value) : ''] : []),\n ])}\n total={view.sources.length}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Spectrum / light curve\n// ---------------------------------------------------------------------------\n\nconst PLOT_W = 640;\nconst PLOT_H = 340;\nconst M = { top: 22, right: 20, bottom: 48, left: 62 };\nconst IW = PLOT_W - M.left - M.right;\nconst IH = PLOT_H - M.top - M.bottom;\n\n/** Hit radius for a tap on a plot, in viewBox units (about a fingertip). */\nconst PLOT_HIT_RADIUS = 14;\n\nexport function PlotCanvas({ view }: { view: PlotView }) {\n const tr = useTr();\n const [selected, setSelected] = useState<{ series: number; point: number } | null>(null);\n const model = useMemo(() => {\n const sorted = view.series.map((s) => [...s.points].sort((a, b) => a.x - b.x));\n const series = view.series.map((s, i) => ({\n ...s,\n color: PALETTE[i % PALETTE.length],\n points: decimateSeries(sorted[i], MAX_RENDERED_POINTS),\n }));\n // The domain comes from the full data, so thinning never clips the axes.\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (const points of sorted) {\n for (const p of points) {\n const err = p.err ?? 0;\n minX = Math.min(minX, p.x);\n maxX = Math.max(maxX, p.x);\n minY = Math.min(minY, p.y - err);\n maxY = Math.max(maxY, p.y + err);\n }\n }\n if (minX === maxX) {\n minX -= 1;\n maxX += 1;\n }\n if (minY === maxY) {\n minY -= 1;\n maxY += 1;\n }\n const pad = (maxY - minY) * 0.08;\n minY -= pad;\n maxY += pad;\n const lines = view.lines.filter((l) => l.x >= minX && l.x <= maxX);\n const xTicks = niceTicks(minX, maxX, 5);\n const yTicks = niceTicks(minY, maxY, 5);\n let shown = 0;\n let total = 0;\n for (let i = 0; i < series.length; i += 1) {\n shown += series[i].points.length;\n total += sorted[i].length;\n }\n return {\n series,\n shown,\n total,\n lines,\n domainX: [minX, maxX] as const,\n domainY: [minY, maxY] as const,\n xTicks,\n yTicks,\n xStep: tickStep(xTicks),\n yStep: tickStep(yTicks),\n };\n }, [view]);\n\n const { domainX, domainY } = model;\n const sx = (x: number) => M.left + ((x - domainX[0]) / (domainX[1] - domainX[0])) * IW;\n const yFrac = (y: number) => (y - domainY[0]) / (domainY[1] - domainY[0]);\n // Magnitudes: smaller is brighter, so brighter plots higher (axis inverted).\n const sy = (y: number) => (view.invertY ? M.top + yFrac(y) * IH : M.top + IH - yFrac(y) * IH);\n\n const onPlotClick = (e: MouseEvent<SVGSVGElement>) => {\n const rect = e.currentTarget.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return;\n const x = ((e.clientX - rect.left) / rect.width) * PLOT_W;\n const y = ((e.clientY - rect.top) / rect.height) * PLOT_H;\n const targets = model.series.flatMap((s, si) =>\n s.points.map((p, pi) => ({ x: sx(p.x), y: sy(p.y), series: si, point: pi }))\n );\n const hit = nearestPoint(targets, x, y, PLOT_HIT_RADIUS);\n setSelected(hit >= 0 ? { series: targets[hit].series, point: targets[hit].point } : null);\n };\n\n const selectedSeries = selected ? model.series[selected.series] : undefined;\n const selectedPoint = selected ? selectedSeries?.points[selected.point] : undefined;\n const readout =\n selectedSeries && selectedPoint\n ? [\n selectedSeries.name,\n `${view.xLabel} ${formatValue(selectedPoint.x)}`,\n `${view.yLabel} ${formatValue(selectedPoint.y)}${\n selectedPoint.err !== undefined ? ` ± ${formatValue(selectedPoint.err)}` : ''\n }`,\n ].join(' · ')\n : null;\n\n const pathFor = (points: Point2D[], step: boolean) => {\n if (!step) return polyline(points.map((p) => ({ x: sx(p.x), y: sy(p.y) })));\n const out: Array<{ x: number; y: number }> = [];\n points.forEach((p, i) => {\n if (i > 0) out.push({ x: sx(p.x), y: sy(points[i - 1].y) });\n out.push({ x: sx(p.x), y: sy(p.y) });\n });\n return polyline(out);\n };\n\n return (\n <div className=\"space-y-3\">\n <Frame>\n <svg\n viewBox={`0 0 ${PLOT_W} ${PLOT_H}`}\n role=\"img\"\n aria-label={tr(\n view.invertY ? `${K}.plotAriaInverted` : `${K}.plotAria`,\n view.invertY\n ? '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}} (inverted)'\n : '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}}',\n {\n kind: kindLabel(tr, view.kind),\n series: model.series.map((s) => s.name).join(', '),\n x: view.xLabel,\n y: view.yLabel,\n }\n )}\n data-inverted={view.invertY ? 'true' : 'false'}\n className=\"h-auto w-full cursor-crosshair\"\n onClick={onPlotClick}\n >\n {model.yTicks.map((t) => (\n <g key={`y-${t}`}>\n <line\n x1={M.left}\n x2={M.left + IW}\n y1={sy(t)}\n y2={sy(t)}\n stroke=\"var(--color-chart-grid)\"\n />\n <text\n x={M.left - 8}\n y={sy(t)}\n textAnchor=\"end\"\n dominantBaseline=\"central\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.yStep)}\n </text>\n </g>\n ))}\n {model.xTicks.map((t) => (\n <g key={`x-${t}`}>\n <line\n x1={sx(t)}\n x2={sx(t)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-grid)\"\n strokeDasharray=\"2 4\"\n />\n <text\n x={sx(t)}\n y={M.top + IH + 18}\n textAnchor=\"middle\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.xStep)}\n </text>\n </g>\n ))}\n <rect\n x={M.left}\n y={M.top}\n width={IW}\n height={IH}\n fill=\"none\"\n stroke=\"var(--color-chart-axis)\"\n />\n\n {model.lines.map((l, i) => (\n <g key={`line-${i}`} data-testid=\"spectral-line\">\n <line\n x1={sx(l.x)}\n x2={sx(l.x)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-negative)\"\n strokeDasharray=\"4 3\"\n />\n {l.label ? (\n <text\n x={sx(l.x) + 3}\n y={M.top - 6}\n fontSize={10}\n fill=\"var(--color-text-secondary)\"\n >\n {l.label}\n </text>\n ) : null}\n </g>\n ))}\n\n {selectedSeries && selectedPoint ? (\n <circle\n cx={sx(selectedPoint.x)}\n cy={sy(selectedPoint.y)}\n r={5}\n fill=\"none\"\n stroke=\"var(--color-text-primary)\"\n strokeWidth={1.5}\n pointerEvents=\"none\"\n data-testid=\"plot-selection\"\n />\n ) : null}\n {model.series.map((s, si) => (\n <g key={`series-${si}`} data-testid=\"plot-series\" data-style={s.style}>\n {s.points.map((p, i) =>\n p.err ? (\n <line\n key={`err-${i}`}\n x1={sx(p.x)}\n x2={sx(p.x)}\n y1={sy(p.y - p.err)}\n y2={sy(p.y + p.err)}\n stroke={s.color}\n strokeOpacity={0.5}\n data-testid=\"error-bar\"\n />\n ) : null\n )}\n {s.style !== 'scatter' ? (\n <path\n d={pathFor(s.points, s.style === 'step')}\n fill=\"none\"\n stroke={s.color}\n strokeWidth={1.8}\n strokeLinejoin=\"round\"\n />\n ) : (\n s.points.map((p, i) => (\n <circle\n key={`pt-${i}`}\n cx={sx(p.x)}\n cy={sy(p.y)}\n r={2.4}\n fill={s.color}\n fillOpacity={0.85}\n />\n ))\n )}\n </g>\n ))}\n\n <text\n x={M.left + IW / 2}\n y={PLOT_H - 6}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n >\n {view.xLabel}\n </text>\n <text\n x={14}\n y={M.top + IH / 2}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n transform={`rotate(-90 14 ${M.top + IH / 2})`}\n >\n {view.yLabel}\n </text>\n </svg>\n </Frame>\n <Readout text={readout} />\n <Legend items={model.series.map((s) => ({ name: s.name, color: s.color, hint: s.style }))} />\n <ThinningNote shown={model.shown} total={model.total} extremaKept />\n <DataTable\n columns={[tr(`${K}.colSeries`, 'Series'), view.xLabel, view.yLabel, tr(`${K}.colErr`, '±')]}\n rows={view.series\n .flatMap((s) => s.points.map((p) => ({ name: s.name, p })))\n .slice(0, MAX_TABLE_ROWS)\n .map(({ name, p }) => [\n name,\n formatValue(p.x),\n formatValue(p.y),\n p.err !== undefined ? formatValue(p.err) : '',\n ])}\n total={model.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// 3-D scene\n// ---------------------------------------------------------------------------\n\nconst SCENE_SIZE = 360;\nconst SCENE_SCALE = SCENE_SIZE * 0.32;\n\nexport function SceneCanvas({ view }: { view: Scene3DView }) {\n const tr = useTr();\n const [camera, setCamera] = useState<Camera>(DEFAULT_CAMERA);\n const [selected, setSelected] = useState<number | null>(null);\n const drag = useRef<{ x: number; y: number; camera: Camera } | null>(null);\n\n // Everything that does not depend on the camera is computed once per view,\n // so a drag only re-projects and re-sorts, never re-normalises or re-thins.\n const prepared = useMemo(() => {\n const normalize = sceneNormalizer([...view.points, ...view.paths.flatMap((p) => p.points)]);\n const points = downsample(view.points, MAX_RENDERED_POINTS).map((p) => ({\n label: p.label,\n value: p.value,\n data: { x: p.x, y: p.y, z: p.z },\n norm: normalize(p),\n }));\n const paths = view.paths.map((path, i) => ({\n name: path.name,\n // chart-1 is the point cloud, so paths cycle through chart-2..chart-6.\n color: PALETTE[1 + (i % (PALETTE.length - 1))],\n norm: downsample(path.points, MAX_RENDERED_POINTS).map((p) => normalize(p)),\n }));\n let pathPoints = 0;\n let renderedPathPoints = 0;\n for (let i = 0; i < view.paths.length; i += 1) {\n pathPoints += view.paths[i].points.length;\n renderedPathPoints += paths[i].norm.length;\n }\n return {\n points,\n paths,\n shown: points.length + renderedPathPoints,\n total: view.points.length + pathPoints,\n };\n }, [view]);\n\n const toScreen = useCallback(\n (p: { x: number; y: number; z: number }) => {\n const r = projectPoint(p, camera);\n return {\n x: SCENE_SIZE / 2 + r.x * SCENE_SCALE,\n y: SCENE_SIZE / 2 - r.y * SCENE_SCALE,\n depth: r.depth,\n };\n },\n [camera]\n );\n\n const projected = useMemo(() => {\n // Keep the data coordinates (for the tooltip) apart from the projected\n // SVG coordinates, which change as the camera rotates.\n const points = prepared.points\n .map((p, index) => ({\n index,\n label: p.label,\n value: p.value,\n data: p.data,\n ...toScreen(p.norm),\n }))\n .sort((a, b) => a.depth - b.depth);\n const paths = prepared.paths.map((path) => ({\n name: path.name,\n color: path.color,\n d: polyline(path.norm.map((p) => toScreen(p))),\n }));\n const axes = (['x', 'y', 'z'] as const).map((axis) => {\n const end = { x: 0, y: 0, z: 0, [axis]: 1.15 };\n return { axis, from: toScreen({ x: 0, y: 0, z: 0 }), to: toScreen(end) };\n });\n return { points, paths, axes };\n }, [prepared, toScreen]);\n\n const hasValues =\n view.points.some((p) => p.value !== undefined) ||\n view.paths.some((path) => path.points.some((p) => p.value !== undefined));\n const describe = (p: {\n label?: string;\n value?: number;\n data: { x: number; y: number; z: number };\n }) =>\n [\n p.label,\n `(${formatValue(p.data.x)}, ${formatValue(p.data.y)}, ${formatValue(p.data.z)})`,\n p.value !== undefined ? `· ${formatValue(p.value)}` : null,\n ]\n .filter(Boolean)\n .join(' ');\n\n // A drag that happens to end on a point must not also select it.\n const moved = useRef(false);\n const selectPoint = (index: number) => {\n if (moved.current) return;\n setSelected(index);\n };\n\n const onPointerDown = (e: PointerEvent<SVGSVGElement>) => {\n drag.current = { x: e.clientX, y: e.clientY, camera };\n moved.current = false;\n e.currentTarget.setPointerCapture?.(e.pointerId);\n };\n const endDrag = () => {\n drag.current = null;\n };\n const onPointerMove = (e: PointerEvent<SVGSVGElement>) => {\n const start = drag.current;\n if (!start) return;\n // Without pointer capture a mouse released outside the scene never sends\n // pointerup here; a move with no button pressed ends that stale drag.\n if (e.pointerType === 'mouse' && e.buttons === 0) {\n endDrag();\n return;\n }\n if (Math.hypot(e.clientX - start.x, e.clientY - start.y) > 3) moved.current = true;\n setCamera({\n yaw: start.camera.yaw + (e.clientX - start.x) * 0.5,\n pitch: clampPitch(start.camera.pitch + (e.clientY - start.y) * 0.5),\n });\n };\n const onKeyDown = (e: KeyboardEvent<SVGSVGElement>) => {\n const step = 10;\n const next: Partial<Record<string, Camera>> = {\n ArrowLeft: { ...camera, yaw: camera.yaw - step },\n ArrowRight: { ...camera, yaw: camera.yaw + step },\n ArrowUp: { ...camera, pitch: clampPitch(camera.pitch - step) },\n ArrowDown: { ...camera, pitch: clampPitch(camera.pitch + step) },\n };\n const target = next[e.key];\n if (target) {\n e.preventDefault();\n setCamera(target);\n }\n };\n\n const depthRange = projected.points.length\n ? [projected.points[0].depth, projected.points[projected.points.length - 1].depth]\n : [0, 0];\n const depthT = (d: number) =>\n depthRange[1] === depthRange[0] ? 1 : (d - depthRange[0]) / (depthRange[1] - depthRange[0]);\n\n const selectedPoint = selected !== null ? prepared.points[selected] : undefined;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {tr(\n `${K}.sceneHelp`,\n 'Drag or use the arrow keys to rotate · yaw {{yaw}}°, pitch {{pitch}}°',\n { yaw: Math.round(camera.yaw), pitch: Math.round(camera.pitch) }\n )}\n </p>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={() => setCamera(DEFAULT_CAMERA)}>\n {tr(`${K}.resetView`, 'Reset view')}\n </Button>\n </div>\n <Frame>\n {/* An interactive widget, not a picture: role=\"img\" would hide the\n point and source titles from assistive technology. */}\n <svg\n viewBox={`0 0 ${SCENE_SIZE} ${SCENE_SIZE}`}\n 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\"\n role=\"application\"\n aria-roledescription={tr(`${K}.sceneRole`, '3-D scene')}\n tabIndex={0}\n aria-label={tr(\n `${K}.sceneAria`,\n '3-D scene with {{points}} points and {{paths}} paths; drag or use arrow keys to rotate',\n { points: view.points.length, paths: view.paths.length }\n )}\n data-yaw={camera.yaw}\n data-pitch={camera.pitch}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n >\n {projected.axes.map((a) => (\n <g key={a.axis}>\n <line\n x1={a.from.x}\n y1={a.from.y}\n x2={a.to.x}\n y2={a.to.y}\n stroke=\"var(--color-chart-axis)\"\n />\n <text x={a.to.x} y={a.to.y} fontSize={10} fill=\"var(--color-text-tertiary)\" dy={-3}>\n {view.axes[a.axis]}\n </text>\n </g>\n ))}\n {projected.paths.map((p, i) => (\n <path\n key={`path-${i}`}\n d={p.d}\n fill=\"none\"\n stroke={p.color}\n strokeWidth={1.5}\n data-testid=\"scene-path\"\n />\n ))}\n {projected.points.map((p) => {\n const t = depthT(p.depth);\n return (\n <circle\n key={`p-${p.index}`}\n cx={p.x}\n cy={p.y}\n r={2 + t * 2}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.35 + t * 0.6}\n stroke={selected === p.index ? 'var(--color-text-primary)' : undefined}\n className=\"cursor-pointer\"\n data-testid=\"scene-point\"\n onClick={() => selectPoint(p.index)}\n >\n <title>{describe(p)}</title>\n </circle>\n );\n })}\n </svg>\n </Frame>\n <Readout text={selectedPoint ? describe(selectedPoint) : null} />\n <Legend\n items={projected.paths.map((p) => ({\n name: p.name,\n color: p.color,\n hint: tr(`${K}.pathHint`, 'path'),\n }))}\n />\n <ThinningNote shown={prepared.shown} total={prepared.total} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n view.axes.x,\n view.axes.y,\n view.axes.z,\n ...(hasValues ? [tr(`${K}.value`, 'value')] : []),\n ]}\n rows={[\n ...view.points.map((p) => ({ p, owner: p.label ?? '' })),\n ...view.paths.flatMap((path) =>\n path.points.map((p) => ({ p, owner: p.label ?? path.name }))\n ),\n ]\n .slice(0, MAX_TABLE_ROWS)\n .map(({ p, owner }) => [\n owner,\n formatValue(p.x),\n formatValue(p.y),\n formatValue(p.z),\n ...(hasValues ? [p.value !== undefined ? formatValue(p.value) : ''] : []),\n ])}\n total={prepared.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Canvas\n// ---------------------------------------------------------------------------\n\nfunction ViewBody({ view }: { view: VisualizationView }) {\n return (\n <div className=\"space-y-2\">\n {view.title || view.description ? (\n <div>\n {view.title ? (\n <p className=\"text-sm font-medium text-text-primary\">{view.title}</p>\n ) : null}\n {view.description ? (\n <p className=\"text-xs text-text-secondary\">{view.description}</p>\n ) : null}\n </div>\n ) : null}\n {view.kind === 'skymap' ? (\n <SkyMapCanvas view={view} />\n ) : view.kind === 'scene3d' ? (\n <SceneCanvas view={view} />\n ) : (\n <PlotCanvas view={view} />\n )}\n </div>\n );\n}\n\nexport interface ScienceCanvasProps {\n results: Record<string, unknown>;\n className?: string;\n}\n\n/**\n * A stable number per results object. Views are keyed on it, so when the\n * dialog is reused for another analysis the selection, camera, projection and\n * active tab start fresh instead of pointing into the previous payload.\n */\nconst payloadGenerations = new WeakMap<object, number>();\nlet nextGeneration = 0;\nfunction payloadGeneration(results: object): number {\n let generation = payloadGenerations.get(results);\n if (generation === undefined) {\n nextGeneration += 1;\n generation = nextGeneration;\n payloadGenerations.set(results, generation);\n }\n return generation;\n}\n\nexport function ScienceCanvas({ results, className }: ScienceCanvasProps) {\n const tr = useTr();\n const views = useMemo(() => extractVisualizations(results), [results]);\n const labels = tabLabels(\n views.map((view) => view.title ?? kindLabel(tr, view.kind)),\n (label, n) => tr(`${K}.tabNumbered`, '{{label}} {{n}}', { label, n })\n );\n\n if (views.length === 0) {\n return <ResultsChart results={results} className={className} />;\n }\n\n if (views.length === 1) {\n return (\n <div className={cn('space-y-3', className)} data-testid=\"science-canvas\">\n <ViewBody key={payloadGeneration(results)} view={views[0]} />\n </div>\n );\n }\n\n return (\n <Tabs\n key={payloadGeneration(results)}\n defaultValue=\"view-0\"\n className={cn('space-y-3', className)}\n data-testid=\"science-canvas\"\n >\n <TabsList className=\"flex h-auto flex-wrap justify-start\">\n {labels.map((label, i) => (\n <TabsTrigger key={`tab-${i}`} value={`view-${i}`}>\n {label}\n </TabsTrigger>\n ))}\n </TabsList>\n {views.map((view, i) => (\n <TabsContent key={`panel-${i}`} value={`view-${i}`}>\n <ViewBody view={view} />\n </TabsContent>\n ))}\n </Tabs>\n );\n}\n\nexport default ScienceCanvas;\n"],"mappings":";;;;;;;;AAuEA,I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ACZ,GAFK,SAAS,GAEd,CACd,CACG;IAjBC,GAAkB,CAAO,CAiB1B;AAEV"}
|
|
@@ -15,5 +15,7 @@ export { LoadingState, type LoadingStateProps } from './LoadingState';
|
|
|
15
15
|
export { PageLayout } from './PageLayout';
|
|
16
16
|
export { Pagination, usePagination, type PaginationProps, type UsePaginationOptions, type UsePaginationResult, } from './Pagination';
|
|
17
17
|
export { SafeLink, safeUrl, type SafeLinkProps } from './SafeLink';
|
|
18
|
+
export { ResultsChart, type ResultsChartProps } from './ResultsChart';
|
|
19
|
+
export { PlotCanvas, SceneCanvas, ScienceCanvas, SkyMapCanvas, type ScienceCanvasProps, } from './ScienceCanvas';
|
|
18
20
|
export { StatusBadge, formatEnumLabel, type StatusBadgeProps, type StatusTone, } from './StatusBadge';
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cosmicintersection/components/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,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AAkB,EAClB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC"}
|
|
@@ -11,5 +11,7 @@ import { WorkspaceTagsPicker as l } from "./WorkspaceTagsPicker.js";
|
|
|
11
11
|
import { FileUploadField as u, useFileDownloadUrl as d } from "./FileUploadField.js";
|
|
12
12
|
import { PageLayout as f } from "./PageLayout.js";
|
|
13
13
|
import { Pagination as p, usePagination as m } from "./Pagination.js";
|
|
14
|
+
import "./ResultsChart.js";
|
|
15
|
+
import "./ScienceCanvas.js";
|
|
14
16
|
import { StatusBadge as h, formatEnumLabel as g } from "./StatusBadge.js";
|
|
15
17
|
export { e as ActionMenu, i as ActivityFeedPanel, o as DiscussionPanel, t as EmptyState, s as EntityFormShell, c as EntityTagsField, n as ErrorState, u as FileUploadField, r as LoadingState, f as PageLayout, p as Pagination, a as SafeLink, h as StatusBadge, l as WorkspaceTagsPicker, g as formatEnumLabel, d as useFileDownloadUrl, m as usePagination };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical scientific-visualization payloads for analysis results (BOFF-3984).
|
|
3
|
+
*
|
|
4
|
+
* `cosCompleteAnalysis` persists free-form `results` JSON. A producer opts in to
|
|
5
|
+
* a domain view by adding `results.visualization` (one view) or
|
|
6
|
+
* `results.visualizations` (a list of up to 8). The backend validates these
|
|
7
|
+
* shapes at write time (wspace-cosmicintersection-svc `visualization.ts`); this
|
|
8
|
+
* module normalises them for rendering and is deliberately lenient, so a row
|
|
9
|
+
* written before validation existed degrades to "fewer elements", never a crash.
|
|
10
|
+
*
|
|
11
|
+
* skymap { sources: [{ ra, dec, label?, value? }], projection?, frame?, valueLabel? }
|
|
12
|
+
* spectrum { series: [{ name?, style?, points }], lines?: [{ x, label? }], x/y labels+units }
|
|
13
|
+
* lightcurve { series: [...], magnitude?: boolean, x/y labels+units }
|
|
14
|
+
* scene3d { points?: [{ x, y, z, label?, value? }], paths?: [{ name?, points }], axes? }
|
|
15
|
+
*
|
|
16
|
+
* 2-D points are `[x, y]`, `[x, y, err]` or `{ x, y, err? }`; 3-D points are
|
|
17
|
+
* `[x, y, z]` or `{ x, y, z }`. Angles are degrees.
|
|
18
|
+
*/
|
|
19
|
+
export type SkyProjection = 'mollweide' | 'aitoff' | 'equirectangular';
|
|
20
|
+
export type SkyFrame = 'icrs' | 'galactic' | 'ecliptic';
|
|
21
|
+
export type SeriesStyle = 'line' | 'scatter' | 'step';
|
|
22
|
+
export declare const SKY_PROJECTIONS: readonly SkyProjection[];
|
|
23
|
+
export interface SkySource {
|
|
24
|
+
ra: number;
|
|
25
|
+
dec: number;
|
|
26
|
+
label?: string;
|
|
27
|
+
value?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface Point2D {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
err?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface Series2D {
|
|
35
|
+
name: string;
|
|
36
|
+
style: SeriesStyle;
|
|
37
|
+
points: Point2D[];
|
|
38
|
+
}
|
|
39
|
+
export interface MarkerLine {
|
|
40
|
+
x: number;
|
|
41
|
+
label?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Point3D {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
z: number;
|
|
47
|
+
label?: string;
|
|
48
|
+
value?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface Path3D {
|
|
51
|
+
name: string;
|
|
52
|
+
points: Point3D[];
|
|
53
|
+
}
|
|
54
|
+
interface ViewBase {
|
|
55
|
+
title?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SkyMapView extends ViewBase {
|
|
59
|
+
kind: 'skymap';
|
|
60
|
+
projection: SkyProjection;
|
|
61
|
+
frame: SkyFrame;
|
|
62
|
+
valueLabel?: string;
|
|
63
|
+
sources: SkySource[];
|
|
64
|
+
}
|
|
65
|
+
export interface PlotView extends ViewBase {
|
|
66
|
+
kind: 'spectrum' | 'lightcurve';
|
|
67
|
+
xLabel: string;
|
|
68
|
+
yLabel: string;
|
|
69
|
+
/** Light curves in magnitudes plot brighter (smaller) values higher. */
|
|
70
|
+
invertY: boolean;
|
|
71
|
+
series: Series2D[];
|
|
72
|
+
lines: MarkerLine[];
|
|
73
|
+
}
|
|
74
|
+
export interface Scene3DView extends ViewBase {
|
|
75
|
+
kind: 'scene3d';
|
|
76
|
+
axes: {
|
|
77
|
+
x: string;
|
|
78
|
+
y: string;
|
|
79
|
+
z: string;
|
|
80
|
+
};
|
|
81
|
+
points: Point3D[];
|
|
82
|
+
paths: Path3D[];
|
|
83
|
+
}
|
|
84
|
+
export type VisualizationView = SkyMapView | PlotView | Scene3DView;
|
|
85
|
+
export declare const MAX_VISUALIZATIONS = 8;
|
|
86
|
+
/** Matches the backend cap; extra elements are dropped rather than rendered. */
|
|
87
|
+
export declare const MAX_ELEMENTS_PER_VIEW = 20000;
|
|
88
|
+
/** "Wavelength" + "nm" -> "Wavelength (nm)". */
|
|
89
|
+
export declare function axisTitle(label: string | undefined, unit: string | undefined, fallback: string): string;
|
|
90
|
+
/** Every renderable canonical view in an analysis `results` payload (may be empty). */
|
|
91
|
+
export declare function extractVisualizations(results: unknown): VisualizationView[];
|
|
92
|
+
/** The view kind's display name, used for tabs and fallback titles. */
|
|
93
|
+
export declare function viewKindLabel(kind: VisualizationView['kind']): string;
|
|
94
|
+
/**
|
|
95
|
+
* Project equatorial (or galactic) coordinates to normalised plane coordinates
|
|
96
|
+
* in [-1, 1] x [-0.5, 0.5] (a 2:1 frame). Astronomical convention: longitude
|
|
97
|
+
* increases to the LEFT (east is left when looking at the sky), centred on 180°.
|
|
98
|
+
*/
|
|
99
|
+
export declare function projectSky(lonDeg: number, latDeg: number, projection: SkyProjection): {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
};
|
|
103
|
+
export interface Camera {
|
|
104
|
+
/** Rotation about the vertical axis, degrees. */
|
|
105
|
+
yaw: number;
|
|
106
|
+
/** Rotation about the horizontal axis, degrees (clamped to ±89). */
|
|
107
|
+
pitch: number;
|
|
108
|
+
}
|
|
109
|
+
export declare const DEFAULT_CAMERA: Camera;
|
|
110
|
+
export declare function clampPitch(pitch: number): number;
|
|
111
|
+
/**
|
|
112
|
+
* Orthographic projection of a point (already centred and scaled to roughly
|
|
113
|
+
* unit size) for the given camera. Returns screen-plane x/y (y up) and a depth
|
|
114
|
+
* where larger means nearer the viewer.
|
|
115
|
+
*/
|
|
116
|
+
export declare function projectPoint(p: {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
z: number;
|
|
120
|
+
}, camera: Camera): {
|
|
121
|
+
x: number;
|
|
122
|
+
y: number;
|
|
123
|
+
depth: number;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Centre + uniform scale that fits every point inside a unit sphere.
|
|
127
|
+
*
|
|
128
|
+
* The scale is the bounding radius (the farthest point from the box centre),
|
|
129
|
+
* not the largest half-extent: a unit cube's corners sit at sqrt(3), so a
|
|
130
|
+
* half-extent scale would let rotation carry valid points outside the canvas.
|
|
131
|
+
*/
|
|
132
|
+
export declare function sceneNormalizer(points: Point3D[]): (p: Point3D) => Point3D;
|
|
133
|
+
/**
|
|
134
|
+
* Rounded, human-friendly tick values across [min, max].
|
|
135
|
+
*
|
|
136
|
+
* Each tick is computed from its index (never by repeated addition) and the
|
|
137
|
+
* loop is bounded, so a step below the floating-point spacing of the range
|
|
138
|
+
* cannot spin forever; rounding uses the step's own precision so very small
|
|
139
|
+
* scientific values (e.g. fluxes of 1e-15) keep distinct ticks. Ticks that
|
|
140
|
+
* collapse to the same representable value are emitted once.
|
|
141
|
+
*/
|
|
142
|
+
export declare function niceTicks(min: number, max: number, count: number): number[];
|
|
143
|
+
/** Spacing between adjacent ticks, or undefined when there is only one. */
|
|
144
|
+
export declare function tickStep(ticks: number[]): number | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Compact tick label. When the tick spacing is known, the label keeps enough
|
|
147
|
+
* precision to tell adjacent ticks apart (MJD 60200 vs 60201, or 1.0e-15 vs
|
|
148
|
+
* 1.5e-15) instead of a fixed number of significant digits.
|
|
149
|
+
*/
|
|
150
|
+
export declare function formatTick(value: number, step?: number): string;
|
|
151
|
+
/**
|
|
152
|
+
* Evenly downsample a long series so the SVG stays light on huge payloads.
|
|
153
|
+
* The first and last items are always kept, so a thinned path still ends
|
|
154
|
+
* where the data ends.
|
|
155
|
+
*/
|
|
156
|
+
export declare function downsample<T>(items: T[], max: number): T[];
|
|
157
|
+
/**
|
|
158
|
+
* Thin an x-sorted 2-D series to at most `max` points without losing the
|
|
159
|
+
* features a scientist looks for. The series is split into `max / 2` buckets
|
|
160
|
+
* and each bucket keeps its lowest and highest point (by y − err and y + err,
|
|
161
|
+
* so the largest error bars survive too), in x order. Absorption and emission
|
|
162
|
+
* peaks, flare maxima and eclipse minima therefore always remain visible,
|
|
163
|
+
* which an even stride cannot guarantee. A thinned `step` series is redrawn
|
|
164
|
+
* from these extremes, so its steps show each bucket's range rather than every
|
|
165
|
+
* original bin; the view's thinning note says so.
|
|
166
|
+
*/
|
|
167
|
+
export declare function decimateSeries(points: Point2D[], max: number): Point2D[];
|
|
168
|
+
/**
|
|
169
|
+
* Number repeated tab labels ("Spectrum 1", "Spectrum 2") so untitled views of
|
|
170
|
+
* the same kind stay distinguishable; unique labels are left as they are.
|
|
171
|
+
*/
|
|
172
|
+
export declare function tabLabels(labels: string[], numbered: (label: string, n: number) => string): string[];
|
|
173
|
+
/**
|
|
174
|
+
* Index of the point nearest to (`x`, `y`) in screen space, or -1 when no
|
|
175
|
+
* point lies within `maxDistance`. Plots use it to turn a tap anywhere near a
|
|
176
|
+
* line, step or scatter series into a readout of the closest measurement.
|
|
177
|
+
*/
|
|
178
|
+
export declare function nearestPoint(points: Array<{
|
|
179
|
+
x: number;
|
|
180
|
+
y: number;
|
|
181
|
+
}>, x: number, y: number, maxDistance: number): number;
|
|
182
|
+
/**
|
|
183
|
+
* A measured value at full precision, for readouts and data tables: unlike
|
|
184
|
+
* {@link formatTick} it never rounds, so 1.23456e-15 or MJD 60200.123456
|
|
185
|
+
* read back exactly as recorded.
|
|
186
|
+
*/
|
|
187
|
+
export declare function formatValue(value: number): string;
|
|
188
|
+
export {};
|
|
189
|
+
//# sourceMappingURL=visualization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualization.d.ts","sourceRoot":"","sources":["../../../src/cosmicintersection/lib/visualization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AACvE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEtD,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAA+C,CAAC;AAEpG,MAAM,WAAW,SAAS;IACxB,EAAE,E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AAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACvC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,MAAM,GAClB,MAAM,CAWR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
//#region src/cosmicintersection/lib/visualization.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"mollweide",
|
|
4
|
+
"aitoff",
|
|
5
|
+
"equirectangular"
|
|
6
|
+
], t = 2e4;
|
|
7
|
+
function n(e) {
|
|
8
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
9
|
+
}
|
|
10
|
+
function r(e) {
|
|
11
|
+
return typeof e == "number" && Number.isFinite(e);
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
15
|
+
}
|
|
16
|
+
function a(e, t, n) {
|
|
17
|
+
return typeof e == "string" && t.includes(e) ? e : n;
|
|
18
|
+
}
|
|
19
|
+
function o(e, t, n) {
|
|
20
|
+
let r = e ?? n;
|
|
21
|
+
return t ? `${r} (${t})` : r;
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
if (Array.isArray(e)) {
|
|
25
|
+
let [t, n, i] = e;
|
|
26
|
+
return !r(t) || !r(n) ? null : r(i) ? {
|
|
27
|
+
x: t,
|
|
28
|
+
y: n,
|
|
29
|
+
err: Math.abs(i)
|
|
30
|
+
} : {
|
|
31
|
+
x: t,
|
|
32
|
+
y: n
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return n(e) && r(e.x) && r(e.y) ? r(e.err) ? {
|
|
36
|
+
x: e.x,
|
|
37
|
+
y: e.y,
|
|
38
|
+
err: Math.abs(e.err)
|
|
39
|
+
} : {
|
|
40
|
+
x: e.x,
|
|
41
|
+
y: e.y
|
|
42
|
+
} : null;
|
|
43
|
+
}
|
|
44
|
+
function c(e) {
|
|
45
|
+
if (Array.isArray(e)) {
|
|
46
|
+
let [t, n, i] = e;
|
|
47
|
+
return r(t) && r(n) && r(i) ? {
|
|
48
|
+
x: t,
|
|
49
|
+
y: n,
|
|
50
|
+
z: i
|
|
51
|
+
} : null;
|
|
52
|
+
}
|
|
53
|
+
if (n(e) && r(e.x) && r(e.y) && r(e.z)) {
|
|
54
|
+
let t = {
|
|
55
|
+
x: e.x,
|
|
56
|
+
y: e.y,
|
|
57
|
+
z: e.z
|
|
58
|
+
}, n = i(e.label);
|
|
59
|
+
return n && (t.label = n), r(e.value) && (t.value = e.value), t;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
function l(e) {
|
|
64
|
+
return Array.isArray(e) ? e.slice(0, t) : [];
|
|
65
|
+
}
|
|
66
|
+
function u(t) {
|
|
67
|
+
let o = [];
|
|
68
|
+
for (let e of l(t.sources)) {
|
|
69
|
+
if (!n(e) || !r(e.ra) || !r(e.dec) || e.ra < 0 || e.ra > 360 || e.dec < -90 || e.dec > 90) continue;
|
|
70
|
+
let t = {
|
|
71
|
+
ra: e.ra,
|
|
72
|
+
dec: e.dec
|
|
73
|
+
}, a = i(e.label);
|
|
74
|
+
a && (t.label = a), r(e.value) && (t.value = e.value), o.push(t);
|
|
75
|
+
}
|
|
76
|
+
return o.length === 0 ? null : {
|
|
77
|
+
kind: "skymap",
|
|
78
|
+
title: i(t.title),
|
|
79
|
+
description: i(t.description),
|
|
80
|
+
projection: a(t.projection, e, "mollweide"),
|
|
81
|
+
frame: a(t.frame, [
|
|
82
|
+
"icrs",
|
|
83
|
+
"galactic",
|
|
84
|
+
"ecliptic"
|
|
85
|
+
], "icrs"),
|
|
86
|
+
valueLabel: i(t.valueLabel),
|
|
87
|
+
sources: o
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function d(e, t) {
|
|
91
|
+
let c = [];
|
|
92
|
+
if (l(e.series).forEach((e, t) => {
|
|
93
|
+
if (!n(e)) return;
|
|
94
|
+
let r = l(e.points).map(s).filter((e) => e !== null);
|
|
95
|
+
r.length < 2 || c.push({
|
|
96
|
+
name: i(e.name) ?? `Series ${t + 1}`,
|
|
97
|
+
style: a(e.style, [
|
|
98
|
+
"line",
|
|
99
|
+
"scatter",
|
|
100
|
+
"step"
|
|
101
|
+
], "line"),
|
|
102
|
+
points: r
|
|
103
|
+
});
|
|
104
|
+
}), c.length === 0) return null;
|
|
105
|
+
let u = [];
|
|
106
|
+
for (let t of l(e.lines)) !n(t) || !r(t.x) || u.push({
|
|
107
|
+
x: t.x,
|
|
108
|
+
label: i(t.label)
|
|
109
|
+
});
|
|
110
|
+
let d = t === "lightcurve" && e.magnitude === !0, f = t === "spectrum";
|
|
111
|
+
return {
|
|
112
|
+
kind: t,
|
|
113
|
+
title: i(e.title),
|
|
114
|
+
description: i(e.description),
|
|
115
|
+
xLabel: o(i(e.xLabel), i(e.xUnit), f ? "Wavelength" : "Time"),
|
|
116
|
+
yLabel: o(i(e.yLabel), i(e.yUnit), f ? "Flux" : d ? "Magnitude" : "Flux"),
|
|
117
|
+
invertY: d,
|
|
118
|
+
series: c,
|
|
119
|
+
lines: u
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function f(e) {
|
|
123
|
+
let t = l(e.points).map(c).filter((e) => e !== null), r = [];
|
|
124
|
+
if (l(e.paths).forEach((e, t) => {
|
|
125
|
+
if (!n(e)) return;
|
|
126
|
+
let a = l(e.points).map(c).filter((e) => e !== null);
|
|
127
|
+
a.length >= 2 && r.push({
|
|
128
|
+
name: i(e.name) ?? `Path ${t + 1}`,
|
|
129
|
+
points: a
|
|
130
|
+
});
|
|
131
|
+
}), t.length === 0 && r.length === 0) return null;
|
|
132
|
+
let a = n(e.axes) ? e.axes : {};
|
|
133
|
+
return {
|
|
134
|
+
kind: "scene3d",
|
|
135
|
+
title: i(e.title),
|
|
136
|
+
description: i(e.description),
|
|
137
|
+
axes: {
|
|
138
|
+
x: i(a.x) ?? "x",
|
|
139
|
+
y: i(a.y) ?? "y",
|
|
140
|
+
z: i(a.z) ?? "z"
|
|
141
|
+
},
|
|
142
|
+
points: t,
|
|
143
|
+
paths: r
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function p(e) {
|
|
147
|
+
if (!n(e)) return null;
|
|
148
|
+
switch (e.kind) {
|
|
149
|
+
case "skymap": return u(e);
|
|
150
|
+
case "spectrum": return d(e, "spectrum");
|
|
151
|
+
case "lightcurve": return d(e, "lightcurve");
|
|
152
|
+
case "scene3d": return f(e);
|
|
153
|
+
default: return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function m(e) {
|
|
157
|
+
if (!n(e)) return [];
|
|
158
|
+
let t = [];
|
|
159
|
+
return e.visualization !== void 0 && t.push(e.visualization), Array.isArray(e.visualizations) && t.push(...e.visualizations), t.slice(0, 8).map(p).filter((e) => e !== null);
|
|
160
|
+
}
|
|
161
|
+
function h(e) {
|
|
162
|
+
switch (e) {
|
|
163
|
+
case "skymap": return "Sky map";
|
|
164
|
+
case "spectrum": return "Spectrum";
|
|
165
|
+
case "lightcurve": return "Light curve";
|
|
166
|
+
case "scene3d": return "3-D scene";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
var g = Math.PI / 180;
|
|
170
|
+
function _(e, t, n) {
|
|
171
|
+
let r = ((e - 180) % 360 + 540) % 360 - 180;
|
|
172
|
+
r = -r;
|
|
173
|
+
let i = r * g, a = t * g;
|
|
174
|
+
if (n === "equirectangular") return {
|
|
175
|
+
x: r / 180,
|
|
176
|
+
y: t / 180
|
|
177
|
+
};
|
|
178
|
+
if (n === "aitoff") {
|
|
179
|
+
let e = Math.acos(Math.min(1, Math.cos(a) * Math.cos(i / 2))), t = e === 0 ? 1 : Math.sin(e) / e, n = 2 * Math.cos(a) * Math.sin(i / 2) / t, r = Math.sin(a) / t;
|
|
180
|
+
return {
|
|
181
|
+
x: n / Math.PI,
|
|
182
|
+
y: r / Math.PI
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
let o = a;
|
|
186
|
+
if (Math.abs(Math.abs(a) - Math.PI / 2) < 1e-9) o = a;
|
|
187
|
+
else for (let e = 0; e < 50; e += 1) {
|
|
188
|
+
let e = -(2 * o + Math.sin(2 * o) - Math.PI * Math.sin(a)) / (2 + 2 * Math.cos(2 * o));
|
|
189
|
+
if (o += e, Math.abs(e) < 1e-10) break;
|
|
190
|
+
}
|
|
191
|
+
let s = 2 * Math.SQRT2 / Math.PI * i * Math.cos(o), c = Math.SQRT2 * Math.sin(o);
|
|
192
|
+
return {
|
|
193
|
+
x: s / (2 * Math.SQRT2),
|
|
194
|
+
y: c / (2 * Math.SQRT2)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
var v = {
|
|
198
|
+
yaw: 35,
|
|
199
|
+
pitch: 25
|
|
200
|
+
};
|
|
201
|
+
function y(e) {
|
|
202
|
+
return Math.max(-89, Math.min(89, e));
|
|
203
|
+
}
|
|
204
|
+
function b(e, t) {
|
|
205
|
+
let n = t.yaw * g, r = t.pitch * g, i = e.x * Math.cos(n) - e.y * Math.sin(n), a = e.x * Math.sin(n) + e.y * Math.cos(n), o = e.z;
|
|
206
|
+
return {
|
|
207
|
+
x: i,
|
|
208
|
+
y: o * Math.cos(r) - a * Math.sin(r),
|
|
209
|
+
depth: -(o * Math.sin(r) + a * Math.cos(r))
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function x(e) {
|
|
213
|
+
if (e.length === 0) return (e) => e;
|
|
214
|
+
let t = Infinity, n = Infinity, r = Infinity, i = -Infinity, a = -Infinity, o = -Infinity;
|
|
215
|
+
for (let s of e) t = Math.min(t, s.x), n = Math.min(n, s.y), r = Math.min(r, s.z), i = Math.max(i, s.x), a = Math.max(a, s.y), o = Math.max(o, s.z);
|
|
216
|
+
let s = (t + i) / 2, c = (n + a) / 2, l = (r + o) / 2, u = 0;
|
|
217
|
+
for (let t of e) u = Math.max(u, Math.hypot(t.x - s, t.y - c, t.z - l));
|
|
218
|
+
let d = u || 1;
|
|
219
|
+
return (e) => ({
|
|
220
|
+
...e,
|
|
221
|
+
x: (e.x - s) / d,
|
|
222
|
+
y: (e.y - c) / d,
|
|
223
|
+
z: (e.z - l) / d
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
var S = 50;
|
|
227
|
+
function C(e) {
|
|
228
|
+
return !Number.isFinite(e) || e <= 0 ? 0 : Math.min(100, Math.max(0, Math.ceil(-Math.log10(e) - 1e-9)));
|
|
229
|
+
}
|
|
230
|
+
function w(e, t, n) {
|
|
231
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e === t) return [e];
|
|
232
|
+
let r = (t - e) / Math.max(1, n), i = 10 ** Math.floor(Math.log10(r)), a = r / i, o = (a < 1.5 ? 1 : a < 3 ? 2 : a < 7 ? 5 : 10) * i, s = Math.min(100, C(o) + 1), c = Math.ceil(e / o) * o, l = [];
|
|
233
|
+
for (let e = 0; e < S; e += 1) {
|
|
234
|
+
let n = c + e * o;
|
|
235
|
+
if (n > t + o * 1e-6) break;
|
|
236
|
+
let r = Number(n.toFixed(s));
|
|
237
|
+
(l.length === 0 || l[l.length - 1] !== r) && l.push(r);
|
|
238
|
+
}
|
|
239
|
+
return l.length > 0 ? l : [e];
|
|
240
|
+
}
|
|
241
|
+
function T(e) {
|
|
242
|
+
return e.length > 1 ? Math.abs(e[1] - e[0]) : void 0;
|
|
243
|
+
}
|
|
244
|
+
function E(e, t) {
|
|
245
|
+
if (e === 0) return "0";
|
|
246
|
+
let n = Math.abs(e), r = t !== void 0 && Number.isFinite(t) && t > 0;
|
|
247
|
+
if (n < .001 || n >= 1e6) {
|
|
248
|
+
if (!r) return e.toExponential(1);
|
|
249
|
+
let i = Math.floor(Math.log10(n)) - Math.floor(Math.log10(t)) + 1;
|
|
250
|
+
return e.toExponential(Math.min(15, Math.max(1, i - 1)));
|
|
251
|
+
}
|
|
252
|
+
return r ? e.toLocaleString(void 0, { maximumFractionDigits: Math.min(20, C(t)) }) : Number(e.toPrecision(4)).toLocaleString(void 0, { maximumFractionDigits: 4 });
|
|
253
|
+
}
|
|
254
|
+
function D(e, t) {
|
|
255
|
+
if (e.length <= t) return e;
|
|
256
|
+
if (t <= 1) return e.slice(0, Math.max(0, t));
|
|
257
|
+
let n = (e.length - 1) / (t - 1), r = [];
|
|
258
|
+
for (let i = 0; i < t; i += 1) r.push(e[Math.floor(i * n)]);
|
|
259
|
+
return r;
|
|
260
|
+
}
|
|
261
|
+
function O(e, t) {
|
|
262
|
+
if (e.length <= t) return e;
|
|
263
|
+
let n = Math.max(1, Math.floor(t / 2)), r = e.length / n, i = [];
|
|
264
|
+
for (let t = 0; t < n; t += 1) {
|
|
265
|
+
let n = Math.floor(t * r), a = Math.min(e.length, Math.floor((t + 1) * r)), o = n, s = n;
|
|
266
|
+
for (let t = n; t < a; t += 1) {
|
|
267
|
+
let n = e[t], r = n.err ?? 0;
|
|
268
|
+
n.y - r < e[o].y - (e[o].err ?? 0) && (o = t), n.y + r > e[s].y + (e[s].err ?? 0) && (s = t);
|
|
269
|
+
}
|
|
270
|
+
o === s ? i.push(e[o]) : o < s ? i.push(e[o], e[s]) : i.push(e[s], e[o]);
|
|
271
|
+
}
|
|
272
|
+
return i;
|
|
273
|
+
}
|
|
274
|
+
function k(e, t) {
|
|
275
|
+
let n = /* @__PURE__ */ new Map();
|
|
276
|
+
for (let t of e) n.set(t, (n.get(t) ?? 0) + 1);
|
|
277
|
+
let r = /* @__PURE__ */ new Map();
|
|
278
|
+
return e.map((e) => {
|
|
279
|
+
if ((n.get(e) ?? 0) < 2) return e;
|
|
280
|
+
let i = (r.get(e) ?? 0) + 1;
|
|
281
|
+
return r.set(e, i), t(e, i);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function A(e, t, n, r) {
|
|
285
|
+
let i = -1, a = r;
|
|
286
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
287
|
+
let o = Math.hypot(e[r].x - t, e[r].y - n);
|
|
288
|
+
o <= a && (i = r, a = o);
|
|
289
|
+
}
|
|
290
|
+
return i;
|
|
291
|
+
}
|
|
292
|
+
function j(e) {
|
|
293
|
+
return Object.is(e, -0) ? "0" : String(e);
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
export { v as DEFAULT_CAMERA, t as MAX_ELEMENTS_PER_VIEW, e as SKY_PROJECTIONS, o as axisTitle, y as clampPitch, O as decimateSeries, D as downsample, m as extractVisualizations, E as formatTick, j as formatValue, A as nearestPoint, w as niceTicks, b as projectPoint, _ as projectSky, x as sceneNormalizer, k as tabLabels, T as tickStep, h as viewKindLabel };
|
|
297
|
+
|
|
298
|
+
//# sourceMappingURL=visualization.js.map
|