@tetrascience-npm/ts-lib-viz 0.0.0-stage → 0.1.5

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 (278) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +2171 -2
  3. package/dist/src/builder/PlotPanel.d.ts +42 -0
  4. package/dist/src/builder/PlotPanel.js +433 -0
  5. package/dist/src/builder/Popover.d.ts +37 -0
  6. package/dist/src/builder/Popover.js +32 -0
  7. package/dist/src/builder/Stepper.d.ts +21 -0
  8. package/dist/src/builder/Stepper.js +41 -0
  9. package/dist/src/builder/index.d.ts +10 -0
  10. package/dist/src/builder/index.js +10 -0
  11. package/dist/src/core/adapters.d.ts +86 -0
  12. package/dist/src/core/adapters.js +219 -0
  13. package/dist/src/core/aggregate.d.ts +74 -0
  14. package/dist/src/core/aggregate.js +102 -0
  15. package/dist/src/core/annotations.d.ts +34 -0
  16. package/dist/src/core/annotations.js +71 -0
  17. package/dist/src/core/band-order.d.ts +86 -0
  18. package/dist/src/core/band-order.js +132 -0
  19. package/dist/src/core/binning.d.ts +123 -0
  20. package/dist/src/core/binning.js +193 -0
  21. package/dist/src/core/bounds.d.ts +40 -0
  22. package/dist/src/core/bounds.js +107 -0
  23. package/dist/src/core/brush.d.ts +73 -0
  24. package/dist/src/core/brush.js +102 -0
  25. package/dist/src/core/build.d.ts +322 -0
  26. package/dist/src/core/build.js +496 -0
  27. package/dist/src/core/camera.d.ts +152 -0
  28. package/dist/src/core/camera.js +303 -0
  29. package/dist/src/core/capabilities.d.ts +24 -0
  30. package/dist/src/core/capabilities.js +307 -0
  31. package/dist/src/core/chord.d.ts +49 -0
  32. package/dist/src/core/chord.js +57 -0
  33. package/dist/src/core/circular.d.ts +83 -0
  34. package/dist/src/core/circular.js +63 -0
  35. package/dist/src/core/cluster.d.ts +136 -0
  36. package/dist/src/core/cluster.js +607 -0
  37. package/dist/src/core/critique.d.ts +92 -0
  38. package/dist/src/core/critique.js +905 -0
  39. package/dist/src/core/density.d.ts +38 -0
  40. package/dist/src/core/density.js +82 -0
  41. package/dist/src/core/figure-set.d.ts +34 -0
  42. package/dist/src/core/figure-set.js +55 -0
  43. package/dist/src/core/finding-codes.d.ts +10 -0
  44. package/dist/src/core/finding-codes.js +1 -0
  45. package/dist/src/core/fit-types.d.ts +46 -0
  46. package/dist/src/core/fit-types.js +7 -0
  47. package/dist/src/core/fitter.d.ts +62 -0
  48. package/dist/src/core/fitter.js +102 -0
  49. package/dist/src/core/frame-geometry.d.ts +407 -0
  50. package/dist/src/core/frame-geometry.js +612 -0
  51. package/dist/src/core/frame.d.ts +329 -0
  52. package/dist/src/core/frame.js +1432 -0
  53. package/dist/src/core/geom-table.d.ts +503 -0
  54. package/dist/src/core/geom-table.js +484 -0
  55. package/dist/src/core/geom-types.d.ts +182 -0
  56. package/dist/src/core/geom-types.js +17 -0
  57. package/dist/src/core/grammar.d.ts +359 -0
  58. package/dist/src/core/grammar.js +397 -0
  59. package/dist/src/core/heat-reductions.d.ts +36 -0
  60. package/dist/src/core/heat-reductions.js +133 -0
  61. package/dist/src/core/hexbin.d.ts +84 -0
  62. package/dist/src/core/hexbin.js +168 -0
  63. package/dist/src/core/hierarchy.d.ts +59 -0
  64. package/dist/src/core/hierarchy.js +248 -0
  65. package/dist/src/core/hit.d.ts +75 -0
  66. package/dist/src/core/hit.js +37 -0
  67. package/dist/src/core/index.d.ts +33 -0
  68. package/dist/src/core/index.js +18 -0
  69. package/dist/src/core/internal.d.ts +58 -0
  70. package/dist/src/core/internal.js +58 -0
  71. package/dist/src/core/labels.d.ts +37 -0
  72. package/dist/src/core/labels.js +54 -0
  73. package/dist/src/core/layers.d.ts +594 -0
  74. package/dist/src/core/layers.js +2892 -0
  75. package/dist/src/core/load.d.ts +17 -0
  76. package/dist/src/core/load.js +356 -0
  77. package/dist/src/core/marginal.d.ts +65 -0
  78. package/dist/src/core/marginal.js +116 -0
  79. package/dist/src/core/mesh.d.ts +69 -0
  80. package/dist/src/core/mesh.js +237 -0
  81. package/dist/src/core/omission.d.ts +41 -0
  82. package/dist/src/core/omission.js +62 -0
  83. package/dist/src/core/palette-sets.d.ts +623 -0
  84. package/dist/src/core/palette-sets.js +1058 -0
  85. package/dist/src/core/palette.d.ts +871 -0
  86. package/dist/src/core/palette.js +511 -0
  87. package/dist/src/core/plot-data.d.ts +71 -0
  88. package/dist/src/core/plot-data.js +82 -0
  89. package/dist/src/core/predicate.d.ts +50 -0
  90. package/dist/src/core/predicate.js +20 -0
  91. package/dist/src/core/profile.d.ts +111 -0
  92. package/dist/src/core/profile.js +221 -0
  93. package/dist/src/core/readout.d.ts +108 -0
  94. package/dist/src/core/readout.js +215 -0
  95. package/dist/src/core/region.d.ts +56 -0
  96. package/dist/src/core/region.js +101 -0
  97. package/dist/src/core/rings.d.ts +96 -0
  98. package/dist/src/core/rings.js +171 -0
  99. package/dist/src/core/rules.d.ts +45 -0
  100. package/dist/src/core/rules.js +69 -0
  101. package/dist/src/core/sankey.d.ts +49 -0
  102. package/dist/src/core/sankey.js +96 -0
  103. package/dist/src/core/select.d.ts +52 -0
  104. package/dist/src/core/select.js +216 -0
  105. package/dist/src/core/side-track.d.ts +98 -0
  106. package/dist/src/core/side-track.js +197 -0
  107. package/dist/src/core/sizing.d.ts +54 -0
  108. package/dist/src/core/sizing.js +37 -0
  109. package/dist/src/core/spec-edit.d.ts +68 -0
  110. package/dist/src/core/spec-edit.js +105 -0
  111. package/dist/src/core/spec.d.ts +1111 -0
  112. package/dist/src/core/spec.js +39 -0
  113. package/dist/src/core/stats.d.ts +161 -0
  114. package/dist/src/core/stats.js +318 -0
  115. package/dist/src/core/tick-format.d.ts +21 -0
  116. package/dist/src/core/tick-format.js +87 -0
  117. package/dist/src/core/tokens.d.ts +47 -0
  118. package/dist/src/core/tokens.js +138 -0
  119. package/dist/src/core/transform.d.ts +21 -0
  120. package/dist/src/core/transform.js +19 -0
  121. package/dist/src/core/voxels.d.ts +53 -0
  122. package/dist/src/core/voxels.js +129 -0
  123. package/dist/src/core/zoom.d.ts +76 -0
  124. package/dist/src/core/zoom.js +103 -0
  125. package/dist/src/graph/GraphSurface.d.ts +127 -0
  126. package/dist/src/graph/GraphSurface.js +423 -0
  127. package/dist/src/graph/data.d.ts +103 -0
  128. package/dist/src/graph/data.js +140 -0
  129. package/dist/src/graph/index.d.ts +7 -0
  130. package/dist/src/graph/index.js +7 -0
  131. package/dist/src/mcp/data.d.ts +28 -0
  132. package/dist/src/mcp/data.js +131 -0
  133. package/dist/src/mcp/index.d.ts +7 -0
  134. package/dist/src/mcp/index.js +7 -0
  135. package/dist/src/mcp/paths.d.ts +12 -0
  136. package/dist/src/mcp/paths.js +30 -0
  137. package/dist/src/mcp/render.d.ts +67 -0
  138. package/dist/src/mcp/render.js +189 -0
  139. package/dist/src/mcp/server.d.ts +7 -0
  140. package/dist/src/mcp/server.js +25 -0
  141. package/dist/src/mcp/tools.d.ts +82 -0
  142. package/dist/src/mcp/tools.js +412 -0
  143. package/dist/src/react/BrushLayer.d.ts +20 -0
  144. package/dist/src/react/BrushLayer.js +98 -0
  145. package/dist/src/react/ColorLegend.d.ts +45 -0
  146. package/dist/src/react/ColorLegend.js +64 -0
  147. package/dist/src/react/Figure.d.ts +19 -0
  148. package/dist/src/react/Figure.js +6 -0
  149. package/dist/src/react/Frame.d.ts +87 -0
  150. package/dist/src/react/Frame.js +192 -0
  151. package/dist/src/react/MarkLegend.d.ts +32 -0
  152. package/dist/src/react/MarkLegend.js +24 -0
  153. package/dist/src/react/SeriesLegend.d.ts +38 -0
  154. package/dist/src/react/SeriesLegend.js +27 -0
  155. package/dist/src/react/SizeLegend.d.ts +24 -0
  156. package/dist/src/react/SizeLegend.js +25 -0
  157. package/dist/src/react/Toolbar.d.ts +109 -0
  158. package/dist/src/react/Toolbar.js +483 -0
  159. package/dist/src/react/Tooltip.d.ts +37 -0
  160. package/dist/src/react/Tooltip.js +59 -0
  161. package/dist/src/react/Viz.d.ts +112 -0
  162. package/dist/src/react/Viz.js +1311 -0
  163. package/dist/src/react/export.d.ts +32 -0
  164. package/dist/src/react/export.js +181 -0
  165. package/dist/src/react/geoms/Area.d.ts +38 -0
  166. package/dist/src/react/geoms/Area.js +48 -0
  167. package/dist/src/react/geoms/Bars.d.ts +130 -0
  168. package/dist/src/react/geoms/Bars.js +164 -0
  169. package/dist/src/react/geoms/Box.d.ts +50 -0
  170. package/dist/src/react/geoms/Box.js +32 -0
  171. package/dist/src/react/geoms/Chord.d.ts +60 -0
  172. package/dist/src/react/geoms/Chord.js +78 -0
  173. package/dist/src/react/geoms/Contour.d.ts +44 -0
  174. package/dist/src/react/geoms/Contour.js +78 -0
  175. package/dist/src/react/geoms/DensityCurve.d.ts +30 -0
  176. package/dist/src/react/geoms/DensityCurve.js +38 -0
  177. package/dist/src/react/geoms/FitCurve.d.ts +26 -0
  178. package/dist/src/react/geoms/FitCurve.js +52 -0
  179. package/dist/src/react/geoms/Freqpoly.d.ts +30 -0
  180. package/dist/src/react/geoms/Freqpoly.js +45 -0
  181. package/dist/src/react/geoms/Gauge.d.ts +42 -0
  182. package/dist/src/react/geoms/Gauge.js +90 -0
  183. package/dist/src/react/geoms/Heatmap.d.ts +79 -0
  184. package/dist/src/react/geoms/Heatmap.js +51 -0
  185. package/dist/src/react/geoms/Hexbin.d.ts +74 -0
  186. package/dist/src/react/geoms/Hexbin.js +89 -0
  187. package/dist/src/react/geoms/Icicle.d.ts +38 -0
  188. package/dist/src/react/geoms/Icicle.js +9 -0
  189. package/dist/src/react/geoms/Ideogram.d.ts +58 -0
  190. package/dist/src/react/geoms/Ideogram.js +77 -0
  191. package/dist/src/react/geoms/Interval.d.ts +30 -0
  192. package/dist/src/react/geoms/Interval.js +39 -0
  193. package/dist/src/react/geoms/Line.d.ts +39 -0
  194. package/dist/src/react/geoms/Line.js +52 -0
  195. package/dist/src/react/geoms/Parallel.d.ts +38 -0
  196. package/dist/src/react/geoms/Parallel.js +131 -0
  197. package/dist/src/react/geoms/Pie.d.ts +62 -0
  198. package/dist/src/react/geoms/Pie.js +59 -0
  199. package/dist/src/react/geoms/Points.d.ts +84 -0
  200. package/dist/src/react/geoms/Points.js +207 -0
  201. package/dist/src/react/geoms/Points3d.d.ts +49 -0
  202. package/dist/src/react/geoms/Points3d.js +58 -0
  203. package/dist/src/react/geoms/Radar.d.ts +39 -0
  204. package/dist/src/react/geoms/Radar.js +59 -0
  205. package/dist/src/react/geoms/Range.d.ts +31 -0
  206. package/dist/src/react/geoms/Range.js +20 -0
  207. package/dist/src/react/geoms/RingStack.d.ts +39 -0
  208. package/dist/src/react/geoms/RingStack.js +65 -0
  209. package/dist/src/react/geoms/Rule.d.ts +29 -0
  210. package/dist/src/react/geoms/Rule.js +51 -0
  211. package/dist/src/react/geoms/Sankey.d.ts +24 -0
  212. package/dist/src/react/geoms/Sankey.js +51 -0
  213. package/dist/src/react/geoms/Segment.d.ts +36 -0
  214. package/dist/src/react/geoms/Segment.js +39 -0
  215. package/dist/src/react/geoms/Sunburst.d.ts +46 -0
  216. package/dist/src/react/geoms/Sunburst.js +64 -0
  217. package/dist/src/react/geoms/Surface.d.ts +32 -0
  218. package/dist/src/react/geoms/Surface.js +49 -0
  219. package/dist/src/react/geoms/Text.d.ts +35 -0
  220. package/dist/src/react/geoms/Text.js +40 -0
  221. package/dist/src/react/geoms/Treemap.d.ts +39 -0
  222. package/dist/src/react/geoms/Treemap.js +16 -0
  223. package/dist/src/react/geoms/Violin.d.ts +56 -0
  224. package/dist/src/react/geoms/Violin.js +60 -0
  225. package/dist/src/react/geoms/Volume.d.ts +37 -0
  226. package/dist/src/react/geoms/Volume.js +40 -0
  227. package/dist/src/react/geoms/Waterfall.d.ts +43 -0
  228. package/dist/src/react/geoms/Waterfall.js +18 -0
  229. package/dist/src/react/geoms/cube-stage.d.ts +39 -0
  230. package/dist/src/react/geoms/cube-stage.js +85 -0
  231. package/dist/src/react/geoms/hierarchy-cells.d.ts +42 -0
  232. package/dist/src/react/geoms/hierarchy-cells.js +59 -0
  233. package/dist/src/react/geoms/sector-axis.d.ts +66 -0
  234. package/dist/src/react/geoms/sector-axis.js +99 -0
  235. package/dist/src/react/gl/GlMesh.d.ts +22 -0
  236. package/dist/src/react/gl/GlMesh.js +78 -0
  237. package/dist/src/react/gl/GlPoints.d.ts +45 -0
  238. package/dist/src/react/gl/GlPoints.js +117 -0
  239. package/dist/src/react/gl/GlVolume.d.ts +28 -0
  240. package/dist/src/react/gl/GlVolume.js +112 -0
  241. package/dist/src/react/gl/GlWalls.d.ts +24 -0
  242. package/dist/src/react/gl/GlWalls.js +55 -0
  243. package/dist/src/react/gl/context.d.ts +71 -0
  244. package/dist/src/react/gl/context.js +98 -0
  245. package/dist/src/react/gl/encode.d.ts +120 -0
  246. package/dist/src/react/gl/encode.js +215 -0
  247. package/dist/src/react/gl/index.d.ts +10 -0
  248. package/dist/src/react/gl/index.js +8 -0
  249. package/dist/src/react/gl/refresh.d.ts +7 -0
  250. package/dist/src/react/gl/refresh.js +19 -0
  251. package/dist/src/react/gl/renderer.d.ts +377 -0
  252. package/dist/src/react/gl/renderer.js +1081 -0
  253. package/dist/src/react/gl/shaders.d.ts +92 -0
  254. package/dist/src/react/gl/shaders.js +405 -0
  255. package/dist/src/react/gl/surface.d.ts +31 -0
  256. package/dist/src/react/gl/surface.js +73 -0
  257. package/dist/src/react/index.d.ts +12 -0
  258. package/dist/src/react/index.js +11 -0
  259. package/dist/src/react/orbit.d.ts +38 -0
  260. package/dist/src/react/orbit.js +81 -0
  261. package/dist/src/react/sides/DendrogramPanel.d.ts +32 -0
  262. package/dist/src/react/sides/DendrogramPanel.js +39 -0
  263. package/dist/src/react/sides/DensityPanel.d.ts +31 -0
  264. package/dist/src/react/sides/DensityPanel.js +37 -0
  265. package/dist/src/react/sides/HistogramPanel.d.ts +30 -0
  266. package/dist/src/react/sides/HistogramPanel.js +18 -0
  267. package/dist/src/react/sides/RugPanel.d.ts +28 -0
  268. package/dist/src/react/sides/RugPanel.js +21 -0
  269. package/dist/src/react/sides/TrackPanel.d.ts +37 -0
  270. package/dist/src/react/sides/TrackPanel.js +27 -0
  271. package/dist/src/react/theme.d.ts +48 -0
  272. package/dist/src/react/theme.js +148 -0
  273. package/dist/src/react/useFits.d.ts +26 -0
  274. package/dist/src/react/useFits.js +62 -0
  275. package/dist/src/react/useZoom.d.ts +50 -0
  276. package/dist/src/react/useZoom.js +141 -0
  277. package/package.json +164 -5
  278. package/theme/default.css +62 -0
@@ -0,0 +1,138 @@
1
+ /**
2
+ * The theming contract -- which custom properties a chart paints with.
3
+ *
4
+ * Names, shipped values and the parse to a shader triple. A token appears here when the package
5
+ * reads it, and `theme/default.css` declares the same set.
6
+ */
7
+ /**
8
+ * Custom properties a chart reads.
9
+ *
10
+ * `--viz-paper` is the page color. A chart draws on a transparent background per chart-design
11
+ * rule 3 and a panel tone would read as a border.
12
+ */
13
+ export const VIZ_TOKENS = [
14
+ "--viz-paper",
15
+ "--viz-ink",
16
+ "--viz-ink-muted",
17
+ "--viz-rule",
18
+ "--viz-annotation",
19
+ "--viz-leader",
20
+ "--viz-status-fail",
21
+ "--viz-status-warn",
22
+ "--viz-tooltip-bg",
23
+ "--viz-tooltip-ink",
24
+ "--viz-tooltip-ink-muted",
25
+ "--viz-tooltip-ring",
26
+ ];
27
+ /** What each token paints, for a host deciding what to override. Frozen. */
28
+ export const TOKEN_MEANING = Object.freeze({
29
+ "--viz-paper": "The page the chart sits on. Segment gaps and point hairlines take it.",
30
+ "--viz-ink": "Geoms and the text on them.",
31
+ "--viz-ink-muted": "Secondary strokes: whiskers, medians, joined runs.",
32
+ "--viz-rule": "The axis rule, its ticks, and the rail behind an unselected category.",
33
+ "--viz-annotation": "Annotation text written on the plot.",
34
+ "--viz-leader": "Leader lines from an annotation to the geom it names.",
35
+ "--viz-status-fail": "A threshold breach. Fixed, so it means one thing whichever palette is picked.",
36
+ "--viz-status-warn": "A warning band, on the same terms.",
37
+ "--viz-tooltip-bg": "The hover card's fill, the one surface the package paints. Dark under both schemes.",
38
+ "--viz-tooltip-ink": "Values on the hover card.",
39
+ "--viz-tooltip-ink-muted": "Labels and notes on the hover card.",
40
+ "--viz-tooltip-ring": "The hover card's hairline edge.",
41
+ });
42
+ /**
43
+ * Values the package ships. Frozen.
44
+ *
45
+ * Neutral grays and two semantic tones. A host overrides any of them further up the tree. The
46
+ * two status tones lighten in dark mode.
47
+ */
48
+ export const LIGHT_THEME = Object.freeze({
49
+ "--viz-paper": "#ffffff",
50
+ "--viz-ink": "#171717",
51
+ "--viz-ink-muted": "#737373",
52
+ "--viz-rule": "#e5e5e5",
53
+ "--viz-annotation": "#404040",
54
+ "--viz-leader": "#a3a3a3",
55
+ "--viz-status-fail": "#dc2626",
56
+ "--viz-status-warn": "#d97706",
57
+ "--viz-tooltip-bg": "#171717",
58
+ "--viz-tooltip-ink": "#ffffff",
59
+ "--viz-tooltip-ink-muted": "#d4d4d4",
60
+ "--viz-tooltip-ring": "#ffffff1a",
61
+ });
62
+ export const DARK_THEME = Object.freeze({
63
+ "--viz-paper": "#0a0a0a",
64
+ "--viz-ink": "#fafafa",
65
+ "--viz-ink-muted": "#a3a3a3",
66
+ "--viz-rule": "#262626",
67
+ "--viz-annotation": "#d4d4d4",
68
+ "--viz-leader": "#525252",
69
+ "--viz-status-fail": "#f87171",
70
+ "--viz-status-warn": "#fbbf24",
71
+ "--viz-tooltip-bg": "#262626",
72
+ "--viz-tooltip-ink": "#ffffff",
73
+ "--viz-tooltip-ink-muted": "#d4d4d4",
74
+ "--viz-tooltip-ring": "#ffffff1a",
75
+ });
76
+ const HEX = /^#([0-9a-f]{3,8})$/i;
77
+ /* Both separator styles -- `rgb(17, 24, 39)` and `rgb(17 24 39 / 0.5)`. */
78
+ const RGB = /^rgba?\(([^)]+)\)$/i;
79
+ const byte = (value) => Math.min(1, Math.max(0, value / 255));
80
+ /**
81
+ * A color string as three channels.
82
+ *
83
+ * Hex and `rgb()` only. `oklch()` and `hsl()` return null. `resolveTheme` pushes a value through
84
+ * a probe element and reads back computed `rgb()`.
85
+ */
86
+ export function rgbOf(css) {
87
+ const text = css.trim();
88
+ const hex = HEX.exec(text);
89
+ if (hex) {
90
+ const digits = hex[1];
91
+ if (digits.length === 3 || digits.length === 4) {
92
+ const [r, g, b] = [...digits.slice(0, 3)].map((d) => Number.parseInt(d + d, 16));
93
+ return [byte(r), byte(g), byte(b)];
94
+ }
95
+ if (digits.length === 6 || digits.length === 8) {
96
+ const pair = (at) => Number.parseInt(digits.slice(at, at + 2), 16);
97
+ return [byte(pair(0)), byte(pair(2)), byte(pair(4))];
98
+ }
99
+ return null;
100
+ }
101
+ const rgb = RGB.exec(text);
102
+ if (!rgb)
103
+ return null;
104
+ /* An alpha follows a slash in the space-separated form and a comma in the older one. */
105
+ const channels = rgb[1]
106
+ .split("/")[0]
107
+ .split(/[\s,]+/)
108
+ .filter((part) => part.length > 0)
109
+ .slice(0, 3)
110
+ .map((part) => (part.endsWith("%") ? (Number.parseFloat(part) / 100) * 255 : Number.parseFloat(part)));
111
+ if (channels.length < 3 || channels.some((channel) => Number.isNaN(channel)))
112
+ return null;
113
+ return [byte(channels[0]), byte(channels[1]), byte(channels[2])];
114
+ }
115
+ /**
116
+ * A snapshot as channels, for the buffers the renderer packs.
117
+ *
118
+ * A token that is absent or did not parse falls back to the shipped value for that theme.
119
+ */
120
+ export function rgbSnapshot(snapshot, fallback = LIGHT_THEME) {
121
+ const out = {};
122
+ for (const token of VIZ_TOKENS) {
123
+ out[token] = rgbOf(snapshot[token] ?? "") ?? rgbOf(fallback[token]) ?? [0, 0, 0];
124
+ }
125
+ return out;
126
+ }
127
+ /**
128
+ * Whether the paper behind the geoms is dark.
129
+ *
130
+ * Read off the token. A host installs its own values and the package sees colors.
131
+ */
132
+ export function onDarkPaper(snapshot) {
133
+ const paper = rgbOf(snapshot["--viz-paper"]);
134
+ if (!paper)
135
+ return false;
136
+ const [r, g, b] = paper;
137
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b < 0.5;
138
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Position transforms, ggplot's `transform` argument to a continuous scale.
3
+ *
4
+ * Each maps a reading into the space the axis spaces evenly, and back.
5
+ */
6
+ /** How a scale spaces its readings, on a value axis or along a color map. */
7
+ export type AxisTransform = "identity" | "log10" | "log2" | "sqrt" | "pseudo_log";
8
+ export interface TransformRule {
9
+ forward: (value: number) => number;
10
+ back: (value: number) => number;
11
+ /** Whether a reading has a place on the axis. */
12
+ admits: (value: number) => boolean;
13
+ }
14
+ export declare const TRANSFORMS: Record<AxisTransform, TransformRule>;
15
+ /** Whether a transform has no place for zero. */
16
+ export declare const isLog: (transform: AxisTransform | undefined) => boolean;
17
+ /** The transform an axis names. A stated `transform` wins, and `log` is shorthand for `log10`. */
18
+ export declare const transformOf: (axis: {
19
+ log?: boolean;
20
+ transform?: AxisTransform;
21
+ }) => AxisTransform;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Position transforms, ggplot's `transform` argument to a continuous scale.
3
+ *
4
+ * Each maps a reading into the space the axis spaces evenly, and back.
5
+ */
6
+ const signed = (map) => (value) => Math.sign(value) * map(Math.abs(value));
7
+ export const TRANSFORMS = {
8
+ identity: { forward: (value) => value, back: (value) => value, admits: () => true },
9
+ log10: { forward: Math.log10, back: (value) => 10 ** value, admits: (value) => value > 0 },
10
+ log2: { forward: Math.log2, back: (value) => 2 ** value, admits: (value) => value > 0 },
11
+ /* Signed, as d3's square-root scale runs. A padded domain dips under zero and maps back. */
12
+ sqrt: { forward: signed(Math.sqrt), back: signed((value) => value * value), admits: (value) => value >= 0 },
13
+ /* d3's symlog at a constant of one: linear inside one unit of zero, logarithmic past it. */
14
+ pseudo_log: { forward: signed(Math.log1p), back: signed(Math.expm1), admits: () => true },
15
+ };
16
+ /** Whether a transform has no place for zero. */
17
+ export const isLog = (transform) => transform === "log10" || transform === "log2";
18
+ /** The transform an axis names. A stated `transform` wins, and `log` is shorthand for `log10`. */
19
+ export const transformOf = (axis) => axis.transform ?? (axis.log ? "log10" : "identity");
@@ -0,0 +1,53 @@
1
+ /**
2
+ * A scalar field on a grid.
3
+ *
4
+ * `isosurface` draws the shell at one value and `volume` integrates along the ray. Bytes, and
5
+ * `texImage3D` takes a byte without float sampling.
6
+ */
7
+ import { type Aggregate } from "./aggregate.js";
8
+ import type { PlotData } from "./plot-data.js";
9
+ /** The field, ready to upload, with what its bytes stand for. */
10
+ export interface Field3d {
11
+ /** One byte a cell, in x-fastest order. `texImage3D` reads this order. */
12
+ values: Uint8Array;
13
+ /** Cells along each axis, in the data's own axis order. */
14
+ dims: [number, number, number];
15
+ xDomain: [number, number];
16
+ yDomain: [number, number];
17
+ zDomain: [number, number];
18
+ /** What byte 0 and byte 255 stand for. A level and a legend read in the data's units. */
19
+ valueDomain: [number, number];
20
+ /** Cells no row landed in. The transfer function draws these as empty. */
21
+ empty: number;
22
+ }
23
+ /**
24
+ * The most cells a field takes along each axis.
25
+ *
26
+ * Thirty-two cubed is 32,768 voxels and a 32 KB texture. Finer grids buy detail the marching
27
+ * step throws away.
28
+ */
29
+ export declare const FIELD_CELLS = 32;
30
+ /**
31
+ * Cells this many rows supports along each axis.
32
+ *
33
+ * A grid finer than the rows fill is mostly holes. Two rows a cell, the cube root on a cube.
34
+ */
35
+ export declare const fieldCellsFor: (rowCount: number) => number;
36
+ /**
37
+ * The rows reduced onto a grid of three dimensions.
38
+ *
39
+ * With no measure bound the reduction is a count. With one, the cells take that measure.
40
+ */
41
+ export declare function field3d(data: PlotData, xId: string, yId: string, zId: string, valueId: string | null, aggregate?: Aggregate, cells?: number): Field3d | null;
42
+ /** Where a level in the data's units falls among the field's 255 steps. */
43
+ export declare const levelByte: (level: number, domain: [number, number]) => number;
44
+ /**
45
+ * The box itself, as triangles.
46
+ *
47
+ * A ray needs a surface to start on. The winding is counter-clockwise seen from outside and
48
+ * culling the back faces leaves one fragment a pixel.
49
+ */
50
+ export declare function boxMesh(xDomain: [number, number], yDomain: [number, number], zDomain: [number, number]): {
51
+ positions: Float32Array;
52
+ indices: Uint32Array;
53
+ };
@@ -0,0 +1,129 @@
1
+ /**
2
+ * A scalar field on a grid.
3
+ *
4
+ * `isosurface` draws the shell at one value and `volume` integrates along the ray. Bytes, and
5
+ * `texImage3D` takes a byte without float sampling.
6
+ */
7
+ import { NEEDS_VALUES, reduceBucket } from "./aggregate.js";
8
+ /**
9
+ * The most cells a field takes along each axis.
10
+ *
11
+ * Thirty-two cubed is 32,768 voxels and a 32 KB texture. Finer grids buy detail the marching
12
+ * step throws away.
13
+ */
14
+ export const FIELD_CELLS = 32;
15
+ /**
16
+ * Cells this many rows supports along each axis.
17
+ *
18
+ * A grid finer than the rows fill is mostly holes. Two rows a cell, the cube root on a cube.
19
+ */
20
+ export const fieldCellsFor = (rowCount) => Math.max(4, Math.min(FIELD_CELLS, Math.round(Math.cbrt(rowCount / 2))));
21
+ const extentOf = (data, field) => {
22
+ let lo = Infinity;
23
+ let hi = -Infinity;
24
+ for (let row = 0; row < data.rowCount; row += 1) {
25
+ const value = data.number(row, field);
26
+ if (value == null)
27
+ continue;
28
+ if (value < lo)
29
+ lo = value;
30
+ if (value > hi)
31
+ hi = value;
32
+ }
33
+ return Number.isFinite(lo) ? [lo, hi] : null;
34
+ };
35
+ /**
36
+ * The rows reduced onto a grid of three dimensions.
37
+ *
38
+ * With no measure bound the reduction is a count. With one, the cells take that measure.
39
+ */
40
+ export function field3d(data, xId, yId, zId, valueId, aggregate = "mean", cells = fieldCellsFor(data.rowCount)) {
41
+ const xDomain = extentOf(data, xId);
42
+ const yDomain = extentOf(data, yId);
43
+ const zDomain = extentOf(data, zId);
44
+ if (!xDomain || !yDomain || !zDomain)
45
+ return null;
46
+ const count = cells * cells * cells;
47
+ const buckets = Array.from({ length: count }, () => ({ sum: 0, sumSq: 0, n: 0, min: Infinity, max: -Infinity }));
48
+ /* The readings themselves, kept only under the aggregates that read them. */
49
+ const collected = valueId && NEEDS_VALUES.includes(aggregate) ? Array.from({ length: count }, () => []) : null;
50
+ const slot = (value, domain) => {
51
+ const span = domain[1] - domain[0] || 1;
52
+ return Math.min(cells - 1, Math.max(0, Math.floor(((value - domain[0]) / span) * cells)));
53
+ };
54
+ for (let row = 0; row < data.rowCount; row += 1) {
55
+ const x = data.number(row, xId);
56
+ const y = data.number(row, yId);
57
+ const z = data.number(row, zId);
58
+ if (x == null || y == null || z == null)
59
+ continue;
60
+ const measure = valueId ? data.number(row, valueId) : 1;
61
+ if (measure == null)
62
+ continue;
63
+ const at = slot(z, zDomain) * cells * cells + slot(y, yDomain) * cells + slot(x, xDomain);
64
+ const bucket = buckets[at];
65
+ bucket.sum += measure;
66
+ bucket.sumSq += measure * measure;
67
+ bucket.n += 1;
68
+ if (measure < bucket.min)
69
+ bucket.min = measure;
70
+ if (measure > bucket.max)
71
+ bucket.max = measure;
72
+ collected?.[at].push(measure);
73
+ }
74
+ const reduced = new Float64Array(count);
75
+ let lo = Infinity;
76
+ let hi = -Infinity;
77
+ let empty = 0;
78
+ for (let at = 0; at < count; at += 1) {
79
+ const bucket = buckets[at];
80
+ if (bucket.n === 0) {
81
+ reduced[at] = NaN;
82
+ empty += 1;
83
+ continue;
84
+ }
85
+ const value = valueId ? reduceBucket(bucket, aggregate, collected?.[at]) : bucket.n;
86
+ reduced[at] = value;
87
+ if (value < lo)
88
+ lo = value;
89
+ if (value > hi)
90
+ hi = value;
91
+ }
92
+ if (!Number.isFinite(lo))
93
+ return null;
94
+ /*
95
+ Zero is the empty cell and the levels run from one. A lowest cell sharing a byte with the
96
+ empties would draw its own floor as solid.
97
+ */
98
+ const span = hi - lo || 1;
99
+ const values = new Uint8Array(count);
100
+ for (let at = 0; at < count; at += 1) {
101
+ const value = reduced[at];
102
+ values[at] = Number.isNaN(value) ? 0 : 1 + Math.round(((value - lo) / span) * 254);
103
+ }
104
+ return { values, dims: [cells, cells, cells], xDomain, yDomain, zDomain, valueDomain: [lo, hi], empty };
105
+ }
106
+ /** Where a level in the data's units falls among the field's 255 steps. */
107
+ export const levelByte = (level, domain) => {
108
+ const span = domain[1] - domain[0] || 1;
109
+ return Math.min(255, Math.max(1, 1 + Math.round(((level - domain[0]) / span) * 254)));
110
+ };
111
+ /**
112
+ * The box itself, as triangles.
113
+ *
114
+ * A ray needs a surface to start on. The winding is counter-clockwise seen from outside and
115
+ * culling the back faces leaves one fragment a pixel.
116
+ */
117
+ export function boxMesh(xDomain, yDomain, zDomain) {
118
+ const positions = new Float32Array(8 * 3);
119
+ for (let corner = 0; corner < 8; corner += 1) {
120
+ positions[corner * 3] = xDomain[corner & 1];
121
+ positions[corner * 3 + 1] = yDomain[(corner >> 1) & 1];
122
+ positions[corner * 3 + 2] = zDomain[(corner >> 2) & 1];
123
+ }
124
+ // Six faces, two triangles each, wound outward.
125
+ const indices = new Uint32Array([
126
+ 0, 2, 1, 1, 2, 3, 4, 5, 6, 5, 7, 6, 0, 1, 4, 1, 5, 4, 2, 6, 3, 3, 6, 7, 0, 4, 2, 2, 4, 6, 1, 3, 5, 3, 7, 5,
127
+ ]);
128
+ return { positions, indices };
129
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * A zoom read as a domain, over a transform on the geoms.
3
+ *
4
+ * The axis states what is on screen and the geoms keep their size. The build does not re-run.
5
+ */
6
+ import type { ReadyFrame } from "./frame.js";
7
+ import { type AxisSpec, type Edges } from "./frame-geometry.js";
8
+ import { type AxisTransform } from "./transform.js";
9
+ /** What a gesture did to the box, in the shape the zoom library reports it. */
10
+ export interface ZoomTransform {
11
+ scaleX: number;
12
+ scaleY: number;
13
+ translateX: number;
14
+ translateY: number;
15
+ }
16
+ /** The transform a figure has before anybody touches it. */
17
+ export declare const AT_REST_ZOOM: ZoomTransform;
18
+ /** Whether a gesture has moved anything. A figure at rest draws what it always drew. */
19
+ export declare const isZoomed: (transform: ZoomTransform) => boolean;
20
+ /**
21
+ * Where an axis puts its domain ends inside the gesture's box.
22
+ *
23
+ * The plot area is inset in the panel. Vertically `from` is the foot of the rule.
24
+ */
25
+ export interface ZoomRule {
26
+ from: number;
27
+ to: number;
28
+ log?: boolean;
29
+ transform?: AxisTransform;
30
+ }
31
+ /**
32
+ * The slice of a domain a transform leaves under the axis.
33
+ *
34
+ * The rule stays where it was drawn. The content slides beneath it in the axis's transformed space.
35
+ */
36
+ export declare function zoomedDomain(domain: [number, number], rule: ZoomRule, scale: number, translate: number): [number, number];
37
+ /** Where the plot area falls inside the box a gesture is read against. */
38
+ export declare const plotArea: (width: number, height: number, margin: Edges) => {
39
+ left: number;
40
+ top: number;
41
+ right: number;
42
+ bottom: number;
43
+ };
44
+ type Area = {
45
+ left: number;
46
+ top: number;
47
+ right: number;
48
+ bottom: number;
49
+ };
50
+ /**
51
+ * Closest the view comes.
52
+ *
53
+ * Forty is where a linear axis starts labeling ticks that repeat at the precision the format
54
+ * carries. Past it a reader gains no number they did not already have.
55
+ */
56
+ export declare const MAX_SCALE = 40;
57
+ /** The transform that fills the plot area with a box dragged over the current view, in the gesture's pixels. */
58
+ export declare function zoomedTo(from: ZoomTransform, box: Area, area: Area): ZoomTransform;
59
+ /** The transform after one step in or out about the plot area's center. */
60
+ export declare function zoomedBy(from: ZoomTransform, factor: number, area: Area): ZoomTransform;
61
+ /**
62
+ * The domains a transform leaves under the two rules.
63
+ *
64
+ * Each rule takes the margin between the box and its own ends. The vertical one runs the other
65
+ * way.
66
+ */
67
+ export declare function zoomedAxes(frame: ReadyFrame, transform: ZoomTransform, area: {
68
+ left: number;
69
+ top: number;
70
+ right: number;
71
+ bottom: number;
72
+ }): {
73
+ x: AxisSpec;
74
+ y: AxisSpec;
75
+ };
76
+ export {};
@@ -0,0 +1,103 @@
1
+ /**
2
+ * A zoom read as a domain, over a transform on the geoms.
3
+ *
4
+ * The axis states what is on screen and the geoms keep their size. The build does not re-run.
5
+ */
6
+ import { innerSize } from "./frame-geometry.js";
7
+ import { TRANSFORMS, transformOf } from "./transform.js";
8
+ /** The transform a figure has before anybody touches it. */
9
+ export const AT_REST_ZOOM = { scaleX: 1, scaleY: 1, translateX: 0, translateY: 0 };
10
+ /** Whether a gesture has moved anything. A figure at rest draws what it always drew. */
11
+ export const isZoomed = (transform) => transform.scaleX !== 1 || transform.scaleY !== 1 || transform.translateX !== 0 || transform.translateY !== 0;
12
+ const between = (domain, t, transform) => {
13
+ const { forward, back } = TRANSFORMS[transform];
14
+ const [lo, hi] = [forward(domain[0]), forward(domain[1])];
15
+ if (transform !== "identity" && Number.isFinite(lo) && Number.isFinite(hi))
16
+ return back(lo + t * (hi - lo));
17
+ return domain[0] + t * (domain[1] - domain[0]);
18
+ };
19
+ /**
20
+ * The slice of a domain a transform leaves under the axis.
21
+ *
22
+ * The rule stays where it was drawn. The content slides beneath it in the axis's transformed space.
23
+ */
24
+ export function zoomedDomain(domain, rule, scale, translate) {
25
+ const reach = rule.to - rule.from;
26
+ if (!scale || !reach)
27
+ return domain;
28
+ const at = (px) => between(domain, ((px - translate) / scale - rule.from) / reach, transformOf(rule));
29
+ return [at(rule.from), at(rule.to)];
30
+ }
31
+ /** Where the plot area falls inside the box a gesture is read against. */
32
+ export const plotArea = (width, height, margin) => {
33
+ const inner = innerSize(width, height, margin);
34
+ return {
35
+ left: margin.left,
36
+ top: margin.top,
37
+ right: margin.left + inner.width,
38
+ bottom: margin.top + inner.height,
39
+ };
40
+ };
41
+ /**
42
+ * Closest the view comes.
43
+ *
44
+ * Forty is where a linear axis starts labeling ticks that repeat at the precision the format
45
+ * carries. Past it a reader gains no number they did not already have.
46
+ */
47
+ export const MAX_SCALE = 40;
48
+ /**
49
+ * One axis of a transform that puts the pixels lo..hi of the current view across start..end.
50
+ *
51
+ * The scale holds between one and `MAX_SCALE`, and the box's center lands on the span's center.
52
+ */
53
+ function fitted(scale, translate, a, b, start, end) {
54
+ const lo = (Math.min(a, b) - translate) / scale;
55
+ const hi = (Math.max(a, b) - translate) / scale;
56
+ const next = Math.min(MAX_SCALE, Math.max(1, (end - start) / Math.max(hi - lo, Number.EPSILON)));
57
+ return { scale: next, translate: (start + end) / 2 - (next * (lo + hi)) / 2 };
58
+ }
59
+ /** The transform that fills the plot area with a box dragged over the current view, in the gesture's pixels. */
60
+ export function zoomedTo(from, box, area) {
61
+ const x = fitted(from.scaleX, from.translateX, box.left, box.right, area.left, area.right);
62
+ const y = fitted(from.scaleY, from.translateY, box.top, box.bottom, area.top, area.bottom);
63
+ return { scaleX: x.scale, scaleY: y.scale, translateX: x.translate, translateY: y.translate };
64
+ }
65
+ /** The transform after one step in or out about the plot area's center. */
66
+ export function zoomedBy(from, factor, area) {
67
+ const cx = (area.left + area.right) / 2;
68
+ const cy = (area.top + area.bottom) / 2;
69
+ return {
70
+ scaleX: from.scaleX * factor,
71
+ scaleY: from.scaleY * factor,
72
+ translateX: cx - (cx - from.translateX) * factor,
73
+ translateY: cy - (cy - from.translateY) * factor,
74
+ };
75
+ }
76
+ /** The rule an axis runs along, from the pixel its domain starts at. A reversed axis starts at the far end. */
77
+ const ruleAlong = (spec, start, end) => spec.reverse
78
+ ? { from: end, to: start, transform: transformOf(spec) }
79
+ : { from: start, to: end, transform: transformOf(spec) };
80
+ /**
81
+ * The domains a transform leaves under the two rules.
82
+ *
83
+ * Each rule takes the margin between the box and its own ends. The vertical one runs the other
84
+ * way.
85
+ */
86
+ export function zoomedAxes(frame, transform, area) {
87
+ return {
88
+ x: "domain" in frame.x
89
+ ? {
90
+ ...frame.x,
91
+ clamp: false,
92
+ domain: zoomedDomain(frame.x.domain, ruleAlong(frame.x, area.left, area.right), transform.scaleX, transform.translateX),
93
+ }
94
+ : frame.x,
95
+ y: "domain" in frame.y
96
+ ? {
97
+ ...frame.y,
98
+ clamp: false,
99
+ domain: zoomedDomain(frame.y.domain, ruleAlong(frame.y, area.bottom, area.top), transform.scaleY, transform.translateY),
100
+ }
101
+ : frame.y,
102
+ };
103
+ }
@@ -0,0 +1,127 @@
1
+ /**
2
+ * A physics graph drawn on the canvas the charts are already using.
3
+ *
4
+ * cosmos owns the layout. Colors come off the package's tokens.
5
+ */
6
+ import { type FigureSet, type Finding, type Palettes } from "../core/internal.js";
7
+ import { type GraphNode, type GraphTables } from "./data.js";
8
+ /** What this file uses of cosmos. The type stays out of an optional peer's import. */
9
+ export interface CosmosGraph {
10
+ /** Resolves when the graph is initialized. Every setter requires it. */
11
+ readonly ready: Promise<void>;
12
+ setPointPositions(positions: Float32Array): void;
13
+ setPointColors(colors: Float32Array): void;
14
+ setPointSizes(sizes: Float32Array): void;
15
+ setLinks(links: Float32Array): void;
16
+ setLinkWidths(widths: Float32Array): void;
17
+ setLinkStrength(strength: Float32Array): void;
18
+ setPointClusters(clusters: (number | undefined)[]): void;
19
+ setPinnedPoints(indices: number[] | null): void;
20
+ /** Settings that can move without rebuilding the graph, which is how the theme reaches it. */
21
+ setConfigPartial(config: Record<string, unknown>): void;
22
+ render(): void;
23
+ /** Where a space position sits on the canvas, which is where the card goes. */
24
+ spaceToScreenPosition(position: [number, number]): [number, number];
25
+ start(alpha?: number): void;
26
+ pause(): void;
27
+ unpause(): void;
28
+ fitView(duration?: number, padding?: number, enableSimulation?: boolean): void;
29
+ destroy(): void;
30
+ }
31
+ /**
32
+ * The forces, as much of them as a caller needs to reach.
33
+ *
34
+ * cosmos ships settings tuned for tens of thousands of nodes. The defaults below suit a few hundred.
35
+ */
36
+ export interface GraphPhysics {
37
+ /** Pull toward the middle of the space. Raise it where a handful of nodes fly off. */
38
+ gravity?: number;
39
+ /** Push between every pair. */
40
+ repulsion?: number;
41
+ /** Pull along a link. */
42
+ linkSpring?: number;
43
+ /** Length a link settles at. This is what sets how large a community draws. */
44
+ linkDistance?: number;
45
+ /** How much speed a node keeps between steps. Lower settles sooner and wanders less. */
46
+ friction?: number;
47
+ /** How fast the simulation cools. Smaller cools faster. */
48
+ decay?: number;
49
+ /** Pull toward the middle of a node's group. Zero, the default, leaves groups to the links. */
50
+ cluster?: number;
51
+ }
52
+ /**
53
+ * How large the geoms draw.
54
+ *
55
+ * Ten thousand nodes require thinner links than two hundred. Only the caller knows the panel size.
56
+ */
57
+ export interface GraphDisplay {
58
+ /** Multiplies the node diameter. */
59
+ pointScale?: number;
60
+ /** Multiplies the link width. */
61
+ linkScale?: number;
62
+ /** Whether links draw. On by default. Off, they still pull on the force layout. */
63
+ links?: boolean;
64
+ }
65
+ /** Where the nodes go. `force` runs the physics, and `fixed` pins each node at its `nodeX` and `nodeY`. */
66
+ export type GraphLayout = "force" | "fixed";
67
+ export interface GraphSurfaceProps {
68
+ tables: GraphTables;
69
+ /**
70
+ * The claim the graph makes. Required, the way a chart's is.
71
+ *
72
+ * A published figure should state what a reader takes from it.
73
+ */
74
+ headline: string;
75
+ width: number;
76
+ height: number;
77
+ /** The two color maps. A graph reads in the same ink as the charts beside it. */
78
+ palettes: Palettes;
79
+ /**
80
+ * Whether the graph paints its own paper under the nodes.
81
+ *
82
+ * Off on a shared context. An opaque clear takes the charts and the page behind them.
83
+ */
84
+ ground?: boolean;
85
+ /**
86
+ * Whether the graph makes its own WebGL context. On by default, so the graph draws inside its panel.
87
+ *
88
+ * Off, the graph adopts the lent canvas and paints the whole page. It refuses that canvas while a
89
+ * chart draws on it.
90
+ */
91
+ ownContext?: boolean;
92
+ /** The forces. A field left absent takes the package's own value. */
93
+ physics?: GraphPhysics;
94
+ /** How large the geoms draw, for a graph denser or sparser than the middle case. */
95
+ display?: GraphDisplay;
96
+ /** `force` unless stated. */
97
+ layout?: GraphLayout;
98
+ /** Pauses the forces. */
99
+ paused?: boolean;
100
+ /** Node ids drawn in full. The rest draw in the muted ink at a low alpha. Absent draws each in full. */
101
+ focus?: readonly string[];
102
+ /** Pins a group's color across the figures of a page, as `Viz` does for a category. */
103
+ set?: FigureSet;
104
+ /**
105
+ * A node the reader clicked, and null where they clicked the space around it.
106
+ *
107
+ * `Viz` clears the same way and hands a `Selected` where this hands the node.
108
+ */
109
+ onSelect?: (node: GraphNode | null) => void;
110
+ /** The node under the pointer, and null once the pointer leaves it. */
111
+ onHover?: (node: GraphNode | null) => void;
112
+ /**
113
+ * A right-click on a node, and null on the space around it.
114
+ *
115
+ * cosmos keeps the browser's own menu off over the graph, with or without this prop.
116
+ */
117
+ onContextMenu?: (node: GraphNode | null) => void;
118
+ /** Called once the graph is drawing, and again after each change of data. */
119
+ onReady?: (state: {
120
+ nodes: number;
121
+ links: number;
122
+ sharedContext: boolean;
123
+ }) => void;
124
+ /** Findings about the graph, on the same contract the chart components use. */
125
+ onCritique?: (findings: Finding[]) => void;
126
+ }
127
+ export declare function GraphSurface({ tables, headline, width, height, palettes, ground, ownContext, physics, display, layout, paused, focus, set, onSelect, onHover, onContextMenu, onReady, onCritique, }: GraphSurfaceProps): import("react").JSX.Element;