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

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 +28 -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,503 @@
1
+ /**
2
+ * What each kind draws with, one row per member of `PlotKind`.
3
+ *
4
+ * A row names the aesthetics, paints, style fields and layer fields its kind reads. Two kinds sharing
5
+ * a geometry each take a row.
6
+ */
7
+ import { GRAMMAR, type Stat } from "./grammar.js";
8
+ import type { Geom } from "./layers.js";
9
+ import type { ChartSpec, ColorScale, LayerSpec, LayerStyle, PlotKind, StatParams } from "./spec.js";
10
+ /**
11
+ * An aesthetic a geom maps a column to. ggplot's names.
12
+ *
13
+ * Positional names where a kind reads the frame's shared pair, role names where it does not.
14
+ */
15
+ export type Aesthetic = "x" | "y" | "z" | "ymin" | "ymax" | "xend" | "yend" | "color" | "fill" | "size" | "shape" | "alpha" | "linetype" | "source" | "target" | "value" | "sector" | "start" | "end" | "dimensions" | "faces" | "label" | "parent" | "group" | "xintercept" | "yintercept" | "slope" | "intercept";
16
+ /** Channels binding several columns at once. A channel binds one column unless named here. */
17
+ export type ListAesthetic = "dimensions" | "faces";
18
+ /**
19
+ * What a channel resolves to -- a column id, or several.
20
+ *
21
+ * `dimensions` takes as many measures as the figure draws axes for. `faces` takes three.
22
+ */
23
+ export type BoundTo<C extends Aesthetic> = C extends "faces" ? readonly [string, string, string] : C extends ListAesthetic ? readonly string[] : string;
24
+ /**
25
+ * The two paints, ggplot's color and fill.
26
+ *
27
+ * `fill` is the interior and `color` is the edge or the line.
28
+ */
29
+ export type Paint = "fill" | "color";
30
+ /**
31
+ * A part of a composite geom, paintable on its own.
32
+ *
33
+ * A boxplot is a box, a median, two whiskers, two staples and its outliers. `LayerStyle.parts` is
34
+ * keyed by these.
35
+ */
36
+ export type GeomPart = "band" | "whisker" | "staple" | "median" | "box" | "outlier" | "quantile" | "replicate" | "outline" | "label" | "rise" | "fall" | "connector";
37
+ /** Style fields other than the two paints, which each row names for itself. */
38
+ export type StyleField = "cornerRadius" | "cellGap" | "fadeBySupport" | "emptyAsZero" | "size" | "sizeRange" | "shape" | "alpha" | "linewidth" | "linetype" | "halo" | "hollow" | "thickness" | "half" | "step" | "tiling" | "arrow" | "innerRadius" | "gap" | "rotate" | "inset" | "radius" | "sweep" | "sections" | "isoLevel" | "panes" | "hjust" | "vjust" | "fontSize";
39
+ /**
40
+ * A field a layer states, beyond the four any layer carries.
41
+ *
42
+ * `name`, `axis` and `visible` apply whatever is drawn. These are the ones a statistic
43
+ * decides. `bin` names no field: a kind listing it bins a continuous x and takes `stat_bin`'s parameters.
44
+ */
45
+ export type LayerField = "aggregate" | "bin" | "error" | "replicates" | "position" | "directLabels" | "numbers" | "rings" | "links" | "fit" | "cumulative";
46
+ export interface GeomFacts {
47
+ /** Channels the geom draws nothing without. */
48
+ requires: readonly Aesthetic[];
49
+ /** Channels it reads where they are bound. */
50
+ accepts: readonly Aesthetic[];
51
+ /**
52
+ * Paints it draws with. The first is the geometry's own ink.
53
+ *
54
+ * The palette's color lands on that first paint. It is `fill` on an interior and `color` on a
55
+ * line.
56
+ */
57
+ paints: readonly Paint[];
58
+ style: readonly StyleField[];
59
+ parts: readonly GeomPart[];
60
+ layer: readonly LayerField[];
61
+ }
62
+ export declare const GEOMS: {
63
+ readonly point: {
64
+ readonly requires: readonly ["x", "y"];
65
+ readonly accepts: readonly ["color", "size", "shape", "alpha", "group"];
66
+ readonly paints: readonly ["color"];
67
+ readonly style: readonly ["size", "sizeRange", "shape", "alpha", "halo", "hollow"];
68
+ readonly parts: readonly ["outline", "label"];
69
+ readonly layer: readonly ["directLabels", "fit", "position"];
70
+ };
71
+ readonly line: {
72
+ readonly requires: readonly ["x", "y"];
73
+ readonly accepts: readonly ["color", "linetype", "group"];
74
+ readonly paints: readonly ["color"];
75
+ readonly style: readonly ["alpha", "linewidth", "linetype", "step"];
76
+ readonly parts: readonly ["label"];
77
+ readonly layer: readonly ["aggregate", "position", "directLabels", "cumulative"];
78
+ };
79
+ readonly area: {
80
+ readonly requires: readonly ["x", "y"];
81
+ readonly accepts: readonly ["fill", "group"];
82
+ readonly paints: readonly ["fill", "color"];
83
+ readonly style: readonly ["alpha", "linewidth"];
84
+ readonly parts: readonly ["label"];
85
+ readonly layer: readonly ["aggregate", "bin", "error", "position", "directLabels", "cumulative"];
86
+ };
87
+ readonly ribbon: {
88
+ readonly requires: readonly ["x", "ymin", "ymax"];
89
+ readonly accepts: readonly ["y", "fill", "group"];
90
+ readonly paints: readonly ["fill", "color"];
91
+ readonly style: readonly ["alpha"];
92
+ readonly parts: readonly ["band"];
93
+ readonly layer: readonly [];
94
+ };
95
+ readonly errorbar: {
96
+ readonly requires: readonly ["x", "ymin", "ymax"];
97
+ readonly accepts: readonly ["y", "color", "group"];
98
+ readonly paints: readonly ["color"];
99
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
100
+ readonly parts: readonly ["whisker"];
101
+ readonly layer: readonly [];
102
+ };
103
+ readonly linerange: {
104
+ readonly requires: readonly ["x", "ymin", "ymax"];
105
+ readonly accepts: readonly ["y", "color", "group"];
106
+ readonly paints: readonly ["color"];
107
+ readonly style: readonly ["alpha", "linewidth"];
108
+ readonly parts: readonly ["whisker"];
109
+ readonly layer: readonly [];
110
+ };
111
+ readonly pointrange: {
112
+ readonly requires: readonly ["x", "ymin", "ymax"];
113
+ readonly accepts: readonly ["y", "color", "group"];
114
+ readonly paints: readonly ["color"];
115
+ readonly style: readonly ["alpha", "linewidth"];
116
+ readonly parts: readonly ["median", "whisker"];
117
+ readonly layer: readonly [];
118
+ };
119
+ readonly crossbar: {
120
+ readonly requires: readonly ["x", "ymin", "ymax"];
121
+ readonly accepts: readonly ["y", "color", "group"];
122
+ readonly paints: readonly ["color", "fill"];
123
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
124
+ readonly parts: readonly ["median", "whisker"];
125
+ readonly layer: readonly [];
126
+ };
127
+ readonly segment: {
128
+ readonly requires: readonly ["x", "y", "xend", "yend"];
129
+ readonly accepts: readonly ["color", "group"];
130
+ readonly paints: readonly ["color"];
131
+ readonly style: readonly ["alpha", "linewidth", "arrow"];
132
+ readonly parts: readonly [];
133
+ readonly layer: readonly [];
134
+ };
135
+ readonly smooth: {
136
+ readonly requires: readonly ["x", "y"];
137
+ readonly accepts: readonly ["color", "group"];
138
+ readonly paints: readonly ["color"];
139
+ readonly style: readonly ["alpha", "linewidth"];
140
+ readonly parts: readonly ["band"];
141
+ readonly layer: readonly [];
142
+ };
143
+ readonly bar: {
144
+ readonly requires: readonly ["x"];
145
+ readonly accepts: readonly ["y", "fill"];
146
+ readonly paints: readonly ["fill", "color"];
147
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
148
+ readonly parts: readonly ["whisker", "staple", "replicate", "label"];
149
+ readonly layer: readonly ["aggregate", "error", "replicates", "position", "directLabels", "cumulative"];
150
+ };
151
+ readonly histogram: {
152
+ readonly requires: readonly ["x"];
153
+ readonly accepts: readonly ["y", "fill"];
154
+ readonly paints: readonly ["fill", "color"];
155
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
156
+ readonly parts: readonly ["whisker", "staple", "replicate", "label"];
157
+ readonly layer: readonly ["error", "replicates", "position", "directLabels", "cumulative"];
158
+ };
159
+ readonly waterfall: {
160
+ readonly requires: readonly ["x"];
161
+ readonly accepts: readonly ["y"];
162
+ readonly paints: readonly ["fill", "color"];
163
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
164
+ readonly parts: readonly ["rise", "fall", "connector", "label"];
165
+ readonly layer: readonly ["aggregate", "directLabels"];
166
+ };
167
+ readonly boxplot: {
168
+ readonly requires: readonly ["y"];
169
+ readonly accepts: readonly ["x", "fill"];
170
+ readonly paints: readonly ["fill", "color"];
171
+ readonly style: readonly ["alpha", "linewidth", "thickness"];
172
+ readonly parts: readonly ["box", "whisker", "staple", "median", "outlier", "replicate"];
173
+ readonly layer: readonly ["replicates"];
174
+ };
175
+ readonly freqpoly: {
176
+ readonly requires: readonly ["x"];
177
+ readonly accepts: readonly ["y", "color", "linetype", "group"];
178
+ readonly paints: readonly ["color"];
179
+ readonly style: readonly ["alpha", "linewidth", "linetype", "step"];
180
+ readonly parts: readonly ["label"];
181
+ readonly layer: readonly ["position", "directLabels", "cumulative"];
182
+ };
183
+ readonly density: {
184
+ readonly requires: readonly ["x"];
185
+ readonly accepts: readonly ["color", "fill", "group"];
186
+ readonly paints: readonly ["color", "fill"];
187
+ readonly style: readonly ["alpha", "linewidth"];
188
+ readonly parts: readonly ["label"];
189
+ readonly layer: readonly ["directLabels"];
190
+ };
191
+ readonly violin: {
192
+ readonly requires: readonly ["y"];
193
+ readonly accepts: readonly ["x", "fill"];
194
+ readonly paints: readonly ["fill", "color"];
195
+ readonly style: readonly ["alpha", "linewidth", "thickness", "half"];
196
+ readonly parts: readonly ["box", "median", "outlier", "quantile", "replicate"];
197
+ readonly layer: readonly ["replicates"];
198
+ };
199
+ readonly hex: {
200
+ readonly requires: readonly ["x", "y"];
201
+ readonly accepts: readonly [];
202
+ readonly paints: readonly ["fill", "color"];
203
+ readonly style: readonly ["alpha", "linewidth", "tiling"];
204
+ readonly parts: readonly ["outline"];
205
+ readonly layer: readonly [];
206
+ };
207
+ readonly contour: {
208
+ readonly requires: readonly ["x", "y"];
209
+ readonly accepts: readonly ["z"];
210
+ readonly paints: readonly ["fill", "color"];
211
+ readonly style: readonly ["alpha"];
212
+ readonly parts: readonly ["band"];
213
+ readonly layer: readonly [];
214
+ };
215
+ readonly heatmap: {
216
+ readonly requires: readonly ["x", "y"];
217
+ readonly accepts: readonly ["z", "dimensions", "fill"];
218
+ readonly paints: readonly ["fill", "color"];
219
+ readonly style: readonly ["alpha", "linewidth", "cornerRadius", "cellGap", "fadeBySupport", "emptyAsZero"];
220
+ readonly parts: readonly ["label", "outline"];
221
+ readonly layer: readonly ["aggregate", "numbers"];
222
+ };
223
+ readonly treemap: {
224
+ readonly requires: readonly ["label"];
225
+ readonly accepts: readonly ["value", "parent"];
226
+ readonly paints: readonly ["fill", "color"];
227
+ readonly style: readonly ["alpha"];
228
+ readonly parts: readonly ["label", "outline"];
229
+ readonly layer: readonly ["aggregate"];
230
+ };
231
+ readonly icicle: {
232
+ readonly requires: readonly ["label"];
233
+ readonly accepts: readonly ["value", "parent"];
234
+ readonly paints: readonly ["fill", "color"];
235
+ readonly style: readonly ["alpha"];
236
+ readonly parts: readonly ["label", "outline"];
237
+ readonly layer: readonly ["aggregate"];
238
+ };
239
+ readonly sunburst: {
240
+ readonly requires: readonly ["label"];
241
+ readonly accepts: readonly ["value", "parent"];
242
+ readonly paints: readonly ["fill", "color"];
243
+ readonly style: readonly ["alpha"];
244
+ readonly parts: readonly ["label", "outline"];
245
+ readonly layer: readonly ["aggregate", "directLabels", "numbers"];
246
+ };
247
+ readonly sankey: {
248
+ readonly requires: readonly ["source", "target"];
249
+ readonly accepts: readonly ["value"];
250
+ readonly paints: readonly ["fill"];
251
+ readonly style: readonly ["alpha"];
252
+ readonly parts: readonly ["label"];
253
+ readonly layer: readonly [];
254
+ };
255
+ readonly ideogram: {
256
+ readonly requires: readonly ["sector", "start", "end"];
257
+ readonly accepts: readonly ["fill"];
258
+ readonly paints: readonly ["fill"];
259
+ readonly style: readonly ["alpha", "gap", "rotate"];
260
+ readonly parts: readonly ["label"];
261
+ readonly layer: readonly ["numbers", "rings", "links"];
262
+ };
263
+ readonly chord: {
264
+ readonly requires: readonly ["source", "target"];
265
+ readonly accepts: readonly ["value"];
266
+ readonly paints: readonly ["fill"];
267
+ readonly style: readonly ["alpha", "gap", "rotate", "inset"];
268
+ readonly parts: readonly ["label"];
269
+ readonly layer: readonly ["numbers", "rings"];
270
+ };
271
+ readonly parcoords: {
272
+ readonly requires: readonly ["dimensions"];
273
+ readonly accepts: readonly ["color"];
274
+ readonly paints: readonly ["color"];
275
+ readonly style: readonly ["alpha"];
276
+ readonly parts: readonly [];
277
+ readonly layer: readonly [];
278
+ };
279
+ readonly radar: {
280
+ readonly requires: readonly ["dimensions"];
281
+ readonly accepts: readonly ["color"];
282
+ readonly paints: readonly ["color", "fill"];
283
+ readonly style: readonly ["alpha"];
284
+ readonly parts: readonly [];
285
+ readonly layer: readonly [];
286
+ };
287
+ readonly pie: {
288
+ readonly requires: readonly ["x"];
289
+ readonly accepts: readonly ["y", "fill"];
290
+ readonly paints: readonly ["fill", "color"];
291
+ readonly style: readonly ["alpha", "linewidth", "innerRadius"];
292
+ readonly parts: readonly ["label", "outline"];
293
+ readonly layer: readonly ["aggregate", "directLabels", "numbers"];
294
+ };
295
+ readonly gauge: {
296
+ readonly requires: readonly ["value"];
297
+ readonly accepts: readonly [];
298
+ readonly paints: readonly ["fill"];
299
+ readonly style: readonly ["alpha", "thickness", "radius", "sweep", "sections"];
300
+ readonly parts: readonly ["label"];
301
+ readonly layer: readonly ["aggregate", "numbers"];
302
+ };
303
+ readonly point3d: {
304
+ readonly requires: readonly ["x", "y", "z"];
305
+ readonly accepts: readonly ["color", "size"];
306
+ readonly paints: readonly ["color"];
307
+ readonly style: readonly ["size", "sizeRange", "panes"];
308
+ readonly parts: readonly [];
309
+ readonly layer: readonly [];
310
+ };
311
+ readonly surface: {
312
+ readonly requires: readonly ["x", "y", "z"];
313
+ readonly accepts: readonly [];
314
+ readonly paints: readonly ["fill"];
315
+ readonly style: readonly ["panes"];
316
+ readonly parts: readonly [];
317
+ readonly layer: readonly ["aggregate"];
318
+ };
319
+ readonly mesh3d: {
320
+ readonly requires: readonly ["x", "y", "z", "faces"];
321
+ readonly accepts: readonly [];
322
+ readonly paints: readonly ["fill"];
323
+ readonly style: readonly ["panes"];
324
+ readonly parts: readonly [];
325
+ readonly layer: readonly [];
326
+ };
327
+ readonly isosurface: {
328
+ readonly requires: readonly ["x", "y", "z"];
329
+ readonly accepts: readonly ["value"];
330
+ readonly paints: readonly ["fill"];
331
+ readonly style: readonly ["isoLevel", "panes"];
332
+ readonly parts: readonly [];
333
+ readonly layer: readonly [];
334
+ };
335
+ readonly volume: {
336
+ readonly requires: readonly ["x", "y", "z"];
337
+ readonly accepts: readonly ["value"];
338
+ readonly paints: readonly ["fill"];
339
+ readonly style: readonly ["panes"];
340
+ readonly parts: readonly [];
341
+ readonly layer: readonly [];
342
+ };
343
+ readonly hline: {
344
+ readonly requires: readonly ["yintercept"];
345
+ readonly accepts: readonly ["color", "linetype", "label"];
346
+ readonly paints: readonly ["color"];
347
+ readonly style: readonly ["alpha", "linewidth", "linetype"];
348
+ readonly parts: readonly [];
349
+ readonly layer: readonly [];
350
+ };
351
+ readonly vline: {
352
+ readonly requires: readonly ["xintercept"];
353
+ readonly accepts: readonly ["color", "linetype", "label"];
354
+ readonly paints: readonly ["color"];
355
+ readonly style: readonly ["alpha", "linewidth", "linetype"];
356
+ readonly parts: readonly [];
357
+ readonly layer: readonly [];
358
+ };
359
+ readonly abline: {
360
+ readonly requires: readonly ["slope", "intercept"];
361
+ readonly accepts: readonly ["color", "linetype", "label"];
362
+ readonly paints: readonly ["color"];
363
+ readonly style: readonly ["alpha", "linewidth", "linetype"];
364
+ readonly parts: readonly [];
365
+ readonly layer: readonly [];
366
+ };
367
+ readonly text: {
368
+ readonly requires: readonly ["x", "y", "label"];
369
+ readonly accepts: readonly ["color", "group"];
370
+ readonly paints: readonly ["color"];
371
+ readonly style: readonly ["hjust", "vjust", "fontSize"];
372
+ readonly parts: readonly [];
373
+ readonly layer: readonly ["position"];
374
+ };
375
+ readonly label: {
376
+ readonly requires: readonly ["x", "y", "label"];
377
+ readonly accepts: readonly ["color", "group"];
378
+ readonly paints: readonly ["color"];
379
+ readonly style: readonly ["hjust", "vjust", "fontSize"];
380
+ readonly parts: readonly [];
381
+ readonly layer: readonly ["position"];
382
+ };
383
+ };
384
+ /** The geometry a kind resolves to, read at the type level. */
385
+ export type GeomOf<K extends PlotKind> = (typeof GRAMMAR)[K]["geom"];
386
+ /** The row a kind reads. */
387
+ type FactsOf<K extends PlotKind> = (typeof GEOMS)[K];
388
+ /** Channels a kind draws nothing without. */
389
+ export type RequiredAesthetic<K extends PlotKind> = FactsOf<K>["requires"][number];
390
+ /** Channels a kind reads where they are bound. */
391
+ export type OptionalAesthetic<K extends PlotKind> = FactsOf<K>["accepts"][number];
392
+ /** Paints a kind draws with. The first is its own ink. */
393
+ export type PaintOf<K extends PlotKind> = FactsOf<K>["paints"][number];
394
+ /** Style fields a kind reads, apart from its paints. */
395
+ export type StyleOf<K extends PlotKind> = FactsOf<K>["style"][number];
396
+ /** Parts of a kind's geometry, each paintable on its own. */
397
+ export type PartOf<K extends PlotKind> = FactsOf<K>["parts"][number];
398
+ /** Layer fields a kind's statistic reaches. */
399
+ export type LayerFieldOf<K extends PlotKind> = FactsOf<K>["layer"][number];
400
+ /**
401
+ * Paint per part, for a kind with parts on its geometry.
402
+ *
403
+ * `never` where the row names none, which refuses the field.
404
+ */
405
+ export type Parts<K extends PlotKind> = [PartOf<K>] extends [never] ? never : Partial<Record<PartOf<K>, Omit<LayerStyle, "parts">>>;
406
+ /**
407
+ * Statistics a kind runs.
408
+ *
409
+ * `never` where the kind draws its records as they are. An empty `stat` list.
410
+ */
411
+ export type StatOf<K extends PlotKind> = (typeof GRAMMAR)[K]["stat"][number];
412
+ /**
413
+ * Which parameters each statistic reads.
414
+ *
415
+ * `GEOMS` says what a geometry draws with and this says what the statistic reads. A kind running
416
+ * two statistics reads both rows.
417
+ */
418
+ export interface StatOptions {
419
+ /** R's `stat_bin`: the width of an interval, where its edges fall, and which empty ones survive. */
420
+ bin: Pick<StatParams, "binwidth" | "bins" | "center" | "boundary" | "closed" | "pad" | "breaks" | "dropEmpty">;
421
+ /**
422
+ * R's `stat_bin_2d` and `stat_bin_hex` -- the same, per axis, over a lattice of cells.
423
+ *
424
+ * `pad` and `breaks` are off this row. `drop` reads as the boolean it is on `stat_bin_2d`.
425
+ */
426
+ bin2d: Pick<StatParams, "binwidth" | "bins" | "center" | "boundary" | "closed" | "drop">;
427
+ count: Record<never, never>;
428
+ summary: Record<never, never>;
429
+ /** What a flow's value is measured against, which decides the thickness a count draws at. */
430
+ flow: Pick<StatParams, "normalize" | "align">;
431
+ /** R's `stat_boxplot`: the whisker's reach and the quantile definition behind the quartiles. */
432
+ boxplot: Pick<StatParams, "coef" | "quantileType">;
433
+ /** R's `stat_density`: the one-dimensional kernel a curve draws. */
434
+ density: Pick<StatParams, "bw" | "adjust" | "kernel" | "n" | "trim" | "bounds">;
435
+ /**
436
+ * R's `stat_ydensity` -- the violin's kernel.
437
+ *
438
+ * The same six as `density` less `n`, plus the three a set of violins needs.
439
+ */
440
+ ydensity: Pick<StatParams, "bw" | "adjust" | "kernel" | "trim" | "bounds" | "scale" | "drop" | "quantiles">;
441
+ /**
442
+ * R's `stat_density_2d` -- the estimate a contour cuts into rings.
443
+ *
444
+ * `adjust` alone. The contour estimates in pixel space and a multiplier on the smoothing
445
+ * radius applies.
446
+ */
447
+ density2d: Pick<StatParams, "adjust">;
448
+ }
449
+ /**
450
+ * A union of statistics as one object.
451
+ *
452
+ * A violin runs `boxplot` and `ydensity`, and the layer takes the parameters of both at once.
453
+ */
454
+ type Intersected<U> = (U extends unknown ? (held: U) => void : never) extends (held: infer I) => void ? I : never;
455
+ /** Parameters of each statistic a kind runs. The empty object where it runs none. */
456
+ export type StatArgs<S extends Stat> = [S] extends [never] ? Record<never, never> : Intersected<StatOptions[S]>;
457
+ /**
458
+ * The statistic parameters a kind reads: those of each statistic its `GRAMMAR` row runs, and the
459
+ * bin statistic's where its `GEOMS` row lists `bin`.
460
+ */
461
+ export declare const statKeysOf: (kind: PlotKind) => ReadonlySet<string>;
462
+ /**
463
+ * Keys of `LayerStyle` a layer states flat, gathered off the table.
464
+ *
465
+ * What `add` splits a layer's options on. Gathered off the rows.
466
+ */
467
+ export declare const STYLE_KEYS: ReadonlySet<string>;
468
+ /** The geometry a kind resolves to, read off `GRAMMAR`. */
469
+ export declare const geomOf: (kind: PlotKind) => Geom;
470
+ /** What one kind draws with. */
471
+ export declare const kindFacts: (kind: PlotKind) => GeomFacts;
472
+ /** Whether a key names an aesthetic, for a caller holding a key no compiler checked. */
473
+ export declare const isAesthetic: (key: string) => key is Aesthetic;
474
+ /** A kind's own ink, which is the paint the palette and the author's pick land on. */
475
+ export declare const ownPaint: (kind: PlotKind) => Paint;
476
+ /**
477
+ * The paint aesthetic a layer's palette and color scale route through.
478
+ *
479
+ * A bar maps `fill` and a line maps `color`. A kind mapping both takes the first one its aes binds,
480
+ * and a kind mapping neither takes its own paint.
481
+ */
482
+ export declare function paintAesthetic(layer: Pick<LayerSpec, "kind" | "aes">): Paint;
483
+ /** The column a layer's paint aesthetic binds, where its kind maps one and the aes binds it. */
484
+ export declare const paintColumn: (layer: Pick<LayerSpec, "kind" | "aes">) => string | undefined;
485
+ /**
486
+ * The color scale a layer reads: the chart's and the layer's own on its paint aesthetic, merged.
487
+ *
488
+ * The layer's wins field by field. Absent where neither states one.
489
+ */
490
+ export declare function layerScale(plot: Pick<ChartSpec, "scales">, layer: LayerSpec): ColorScale | undefined;
491
+ /**
492
+ * The color a layer states for its geoms, read off the kind's own paint.
493
+ *
494
+ * A bar's is its `fill` and a line's its `color`. Absent where the author picked none.
495
+ */
496
+ export declare const geomColor: (style: LayerStyle | undefined, kind: PlotKind) => string | undefined;
497
+ /**
498
+ * The style with a kind's own paint set to a color.
499
+ *
500
+ * What a control offering one color per series writes. `geomColor` reads it back.
501
+ */
502
+ export declare const paintedWith: (style: LayerStyle, kind: PlotKind, color: string) => LayerStyle;
503
+ export {};