@fundar/data-chart-telling 1.1.0 → 1.2.0

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 (524) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +6 -6
  3. package/dist/configuration/config.svelte.d.ts +1 -1
  4. package/dist/configuration/config.svelte.js +165 -100
  5. package/dist/configuration/themes/index.d.ts +5 -1428
  6. package/dist/index.d.ts +23 -14
  7. package/dist/index.js +20 -11
  8. package/dist/layout/base/BasePlotLayout.svelte +115 -50
  9. package/dist/layout/base/BasePlotLayout.svelte.d.ts +1 -38
  10. package/dist/layout/coordinates/CoordinatesLayout.svelte +42 -40
  11. package/dist/layout/coordinates/CoordinatesLayout.svelte.d.ts +0 -2
  12. package/dist/layout/coordinates/ProjectionZoom.svelte +48 -0
  13. package/dist/layout/coordinates/ProjectionZoom.svelte.d.ts +10 -0
  14. package/dist/layout/coordinates/ZoomedProjection.d.ts +11 -0
  15. package/dist/layout/coordinates/ZoomedProjection.js +24 -0
  16. package/dist/layout/coordinates/camera.svelte.js +11 -8
  17. package/dist/layout/coordinates/projections/argentina.js +1 -1
  18. package/dist/layout/coordinates/projections/fit.d.ts +1 -1
  19. package/dist/layout/coordinates/projections/fit.js +1 -1
  20. package/dist/layout/coordinates/zoom.svelte.d.ts +4 -5
  21. package/dist/layout/coordinates/zoom.svelte.js +4 -5
  22. package/dist/layout/facet/FacetLayout.svelte +1 -1
  23. package/dist/layout/facet/config.js +1 -1
  24. package/dist/layout/figure/Figure.svelte +2 -0
  25. package/dist/layout/geometry/GeometryLayout.svelte +14 -9
  26. package/dist/layout/geometry/GeometryLayout.svelte.d.ts +0 -3
  27. package/dist/layout/geometry/MarkerOffset.svelte +28 -0
  28. package/dist/layout/geometry/MarkerOffset.svelte.d.ts +13 -0
  29. package/dist/layout/grid/GridCell.svelte +6 -8
  30. package/dist/layout/legend/ContinuousSection.svelte +44 -9
  31. package/dist/layout/legend/DiscreteBadgeItem.svelte +2 -2
  32. package/dist/layout/legend/DiscreteSection.svelte +2 -2
  33. package/dist/layout/legend/DiscreteSymbolIcon.svelte +1 -1
  34. package/dist/layout/legend/LegendChannels.js +36 -12
  35. package/dist/layout/legend/LegendLayout.svelte +9 -1
  36. package/dist/layout/legend/LegendState.svelte.d.ts +4 -0
  37. package/dist/layout/legend/LegendState.svelte.js +20 -3
  38. package/dist/layout/legend/SizeSection.svelte +1 -1
  39. package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -5
  40. package/dist/layout/margins/PlotMargins.svelte.js +4 -8
  41. package/dist/layout/plot/Slice.d.ts +5 -1
  42. package/dist/layout/plot/Slice.js +14 -4
  43. package/dist/layout/scales/NiceTicks.d.ts +3 -0
  44. package/dist/layout/scales/NiceTicks.js +4 -0
  45. package/dist/layout/scales/ScalesLayout.svelte +72 -7
  46. package/dist/layout/scales/ScalesLayout.svelte.d.ts +5 -0
  47. package/dist/layout/scales/SveltePlotScale.d.ts +2 -2
  48. package/dist/layout/scales/SveltePlotScale.js +13 -6
  49. package/dist/layout/scales/TickLabels.d.ts +32 -0
  50. package/dist/layout/scales/TickLabels.js +55 -0
  51. package/dist/layout/styles/StylesLayout.svelte +2 -2
  52. package/dist/layout/styles/ValueLabels.d.ts +33 -5
  53. package/dist/layout/styles/ValueLabels.js +80 -21
  54. package/dist/layout/timeline/TimelineLayout.svelte +1 -1
  55. package/dist/layout/tooltip/Tooltip.svelte +4 -4
  56. package/dist/layout/tooltip/Tooltip.svelte.d.ts +4 -4
  57. package/dist/layout/tooltip/TooltipState.svelte.js +1 -1
  58. package/dist/markers/MarkerKinds.d.ts +5 -0
  59. package/dist/markers/MarkerKinds.js +1 -0
  60. package/dist/markers/area/AreaMarker.svelte +15 -63
  61. package/dist/markers/arrow/ArrowMarker.svelte +51 -9
  62. package/dist/markers/bar/BarMarker.svelte +8 -4
  63. package/dist/markers/bollinger/BollingerMarker.svelte +33 -18
  64. package/dist/markers/box/BoxMarker.svelte +40 -9
  65. package/dist/markers/delta/Delta.js +1 -1
  66. package/dist/markers/dot/DotMarker.svelte +24 -27
  67. package/dist/markers/image/ImageMarker.svelte +17 -12
  68. package/dist/markers/inset/InsetMarker.svelte +2 -2
  69. package/dist/markers/line/LineMarker.svelte +1 -0
  70. package/dist/markers/link/LinkMarker.svelte +174 -29
  71. package/dist/markers/regression/RegressionMarker.svelte +16 -33
  72. package/dist/markers/rule/RuleMarker.svelte +9 -3
  73. package/dist/markers/text/Declutter.d.ts +4 -0
  74. package/dist/markers/text/Declutter.js +26 -11
  75. package/dist/markers/text/TextMarker.svelte +91 -48
  76. package/dist/markers/tick/TickMarker.svelte +27 -25
  77. package/dist/markers/utils/MarkerChannels.d.ts +24 -0
  78. package/dist/markers/utils/MarkerChannels.js +42 -7
  79. package/dist/markers/utils/RowOffset.d.ts +23 -0
  80. package/dist/markers/utils/RowOffset.js +23 -0
  81. package/dist/markers/utils/RowOffsetMarks.svelte +30 -0
  82. package/dist/markers/utils/RowOffsetMarks.svelte.d.ts +33 -0
  83. package/dist/markers/utils/RowStroke.d.ts +31 -0
  84. package/dist/markers/utils/RowStroke.js +28 -0
  85. package/dist/markers/violin/ViolinMarker.svelte +75 -0
  86. package/dist/markers/violin/ViolinMarker.svelte.d.ts +7 -0
  87. package/dist/markers/violin/ViolinProfiles.d.ts +29 -0
  88. package/dist/markers/violin/ViolinProfiles.js +55 -0
  89. package/dist/markers/waffle/WaffleMarker.svelte +17 -37
  90. package/dist/phases/Pipeline.d.ts +5 -0
  91. package/dist/phases/Pipeline.js +5 -0
  92. package/dist/phases/data/DataPhase.js +3 -3
  93. package/dist/phases/data/PlotAxes.d.ts +10 -0
  94. package/dist/phases/data/PlotAxes.js +14 -1
  95. package/dist/phases/facet/FacetPanels.d.ts +1 -0
  96. package/dist/phases/facet/FacetPanels.js +1 -0
  97. package/dist/phases/mapping/MappingPhase.js +1 -1
  98. package/dist/phases/markers/MarkersPhase.js +2 -1
  99. package/dist/phases/scales/CategoryOrder.d.ts +23 -0
  100. package/dist/phases/scales/CategoryOrder.js +73 -0
  101. package/dist/phases/scales/ScalesPhase.js +21 -7
  102. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +3 -2
  103. package/dist/phases/sharedScales/SharedScalesPhase.js +5 -2
  104. package/dist/phases/statistics/Statistics.d.ts +10 -6
  105. package/dist/phases/statistics/Statistics.js +20 -10
  106. package/dist/phases/statistics/StatisticsPhase.js +7 -2
  107. package/dist/phases/statistics/methods/BollingerStatistic.d.ts +1 -1
  108. package/dist/phases/statistics/methods/BollingerStatistic.js +13 -11
  109. package/dist/phases/statistics/methods/BoxStatistic.d.ts +1 -1
  110. package/dist/phases/statistics/methods/BoxStatistic.js +14 -12
  111. package/dist/phases/statistics/methods/Density2dStatistic.d.ts +1 -1
  112. package/dist/phases/statistics/methods/Density2dStatistic.js +13 -11
  113. package/dist/phases/statistics/methods/DensityStatistic.d.ts +1 -1
  114. package/dist/phases/statistics/methods/DensityStatistic.js +11 -9
  115. package/dist/phases/statistics/methods/DeviationStatistic.d.ts +8 -0
  116. package/dist/phases/statistics/methods/DeviationStatistic.js +111 -0
  117. package/dist/phases/statistics/methods/MovingAverageStatistic.d.ts +1 -1
  118. package/dist/phases/statistics/methods/MovingAverageStatistic.js +11 -9
  119. package/dist/phases/statistics/methods/RegressionStatistic.d.ts +1 -1
  120. package/dist/phases/statistics/methods/RegressionStatistic.js +16 -14
  121. package/dist/phases/transforms/ProcessedPositions.js +1 -1
  122. package/dist/phases/transforms/TransformsPhase.js +49 -3
  123. package/dist/phases/transforms/ValueSelection.d.ts +30 -0
  124. package/dist/phases/transforms/ValueSelection.js +53 -0
  125. package/dist/plots/{heatmap → correlation/heatmap}/Plot.svelte +5 -2
  126. package/dist/plots/{heatmap → correlation/heatmap}/Plot.svelte.d.ts +2 -2
  127. package/dist/plots/{heatmap → correlation/heatmap}/defaults.d.ts +2 -2
  128. package/dist/plots/{heatmap → correlation/heatmap}/defaults.js +5 -5
  129. package/dist/plots/{heatmap → correlation/heatmap}/markers.d.ts +4 -4
  130. package/dist/plots/{heatmap → correlation/heatmap}/markers.js +3 -3
  131. package/dist/plots/{scatter → correlation/scatter}/Plot.svelte +5 -2
  132. package/dist/plots/{scatter → correlation/scatter}/Plot.svelte.d.ts +2 -2
  133. package/dist/plots/{scatter → correlation/scatter}/defaults.d.ts +2 -2
  134. package/dist/plots/{scatter → correlation/scatter}/defaults.js +4 -4
  135. package/dist/plots/{scatter → correlation/scatter}/markers.d.ts +4 -4
  136. package/dist/plots/{scatter → correlation/scatter}/markers.js +3 -3
  137. package/dist/plots/{box → distribution/box}/BoxSummaries.d.ts +2 -2
  138. package/dist/plots/{box → distribution/box}/BoxSummaries.js +6 -6
  139. package/dist/plots/{box → distribution/box}/Plot.svelte +2 -2
  140. package/dist/plots/{box → distribution/box}/Plot.svelte.d.ts +2 -2
  141. package/dist/plots/{box → distribution/box}/defaults.d.ts +2 -2
  142. package/dist/plots/{box → distribution/box}/defaults.js +1 -1
  143. package/dist/plots/{box → distribution/box}/markers.d.ts +2 -2
  144. package/dist/plots/distribution/density/Plot.svelte +45 -0
  145. package/dist/plots/distribution/density/Plot.svelte.d.ts +26 -0
  146. package/dist/plots/distribution/density/defaults.d.ts +9 -0
  147. package/dist/plots/distribution/density/defaults.js +29 -0
  148. package/dist/plots/distribution/density/markers.d.ts +9 -0
  149. package/dist/plots/distribution/density/markers.js +42 -0
  150. package/dist/plots/{histogram → distribution/histogram}/Plot.svelte +2 -2
  151. package/dist/plots/{histogram → distribution/histogram}/Plot.svelte.d.ts +2 -2
  152. package/dist/plots/{histogram → distribution/histogram}/defaults.d.ts +2 -2
  153. package/dist/plots/{histogram → distribution/histogram}/defaults.js +3 -3
  154. package/dist/plots/{histogram → distribution/histogram}/markers.d.ts +3 -3
  155. package/dist/plots/{histogram → distribution/histogram}/markers.js +5 -5
  156. package/dist/plots/{pyramid → distribution/pyramid}/Plot.svelte +5 -2
  157. package/dist/plots/{pyramid → distribution/pyramid}/Plot.svelte.d.ts +2 -2
  158. package/dist/plots/{pyramid → distribution/pyramid}/defaults.d.ts +2 -2
  159. package/dist/plots/{pyramid → distribution/pyramid}/defaults.js +6 -6
  160. package/dist/plots/{pyramid → distribution/pyramid}/markers.d.ts +4 -4
  161. package/dist/plots/{pyramid → distribution/pyramid}/markers.js +6 -6
  162. package/dist/plots/distribution/violin/Plot.svelte +45 -0
  163. package/dist/plots/distribution/violin/Plot.svelte.d.ts +26 -0
  164. package/dist/plots/distribution/violin/defaults.d.ts +10 -0
  165. package/dist/plots/distribution/violin/defaults.js +58 -0
  166. package/dist/plots/distribution/violin/markers.d.ts +10 -0
  167. package/dist/plots/distribution/violin/markers.js +71 -0
  168. package/dist/plots/{area → evolution/area}/Plot.svelte +2 -2
  169. package/dist/plots/{area → evolution/area}/Plot.svelte.d.ts +2 -2
  170. package/dist/plots/{area → evolution/area}/defaults.d.ts +2 -2
  171. package/dist/plots/{area → evolution/area}/defaults.js +2 -0
  172. package/dist/plots/{area → evolution/area}/markers.d.ts +2 -2
  173. package/dist/plots/{area → evolution/area}/markers.js +1 -1
  174. package/dist/plots/{line → evolution/line}/Plot.svelte +2 -2
  175. package/dist/plots/{line → evolution/line}/Plot.svelte.d.ts +2 -2
  176. package/dist/plots/{line → evolution/line}/defaults.d.ts +2 -2
  177. package/dist/plots/{line → evolution/line}/defaults.js +2 -0
  178. package/dist/plots/{line → evolution/line}/markers.d.ts +11 -8
  179. package/dist/plots/{line → evolution/line}/markers.js +6 -4
  180. package/dist/plots/evolution/slope/Plot.svelte +42 -0
  181. package/dist/plots/evolution/slope/Plot.svelte.d.ts +26 -0
  182. package/dist/plots/evolution/slope/defaults.d.ts +8 -0
  183. package/dist/plots/evolution/slope/defaults.js +31 -0
  184. package/dist/plots/evolution/slope/markers.d.ts +16 -0
  185. package/dist/plots/evolution/slope/markers.js +79 -0
  186. package/dist/plots/evolution/sparkline/Plot.svelte +45 -0
  187. package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +26 -0
  188. package/dist/plots/evolution/sparkline/defaults.d.ts +7 -0
  189. package/dist/plots/evolution/sparkline/defaults.js +23 -0
  190. package/dist/plots/evolution/sparkline/markers.d.ts +7 -0
  191. package/dist/plots/evolution/sparkline/markers.js +56 -0
  192. package/dist/plots/{geo → map/geo}/Core.svelte +11 -10
  193. package/dist/plots/{geo → map/geo}/Core.svelte.d.ts +1 -1
  194. package/dist/plots/map/geo/GeoFeatures.svelte.d.ts +9 -0
  195. package/dist/plots/map/geo/GeoFeatures.svelte.js +55 -0
  196. package/dist/plots/map/geo/GeoGeometry.d.ts +27 -0
  197. package/dist/plots/map/geo/GeoGeometry.js +142 -0
  198. package/dist/plots/map/geo/GeoSegments.d.ts +16 -0
  199. package/dist/plots/map/geo/GeoSegments.js +23 -0
  200. package/dist/plots/{geo → map/geo}/Plot.svelte +10 -10
  201. package/dist/plots/{geo → map/geo}/Plot.svelte.d.ts +2 -2
  202. package/dist/plots/{geo → map/geo}/defaults.d.ts +2 -2
  203. package/dist/plots/{geo → map/geo}/defaults.js +1 -1
  204. package/dist/plots/{geo → map/geo}/phases/data.d.ts +1 -1
  205. package/dist/plots/{geo → map/geo}/phases/data.js +7 -6
  206. package/dist/plots/{geo → map/geo}/phases/hover.d.ts +1 -1
  207. package/dist/plots/{geo → map/geo}/phases/hover.js +2 -2
  208. package/dist/plots/{geo → map/geo}/phases/markers.d.ts +1 -1
  209. package/dist/plots/{geo → map/geo}/phases/markers.js +6 -10
  210. package/dist/plots/{geo → map/geo}/phases/scales.d.ts +2 -2
  211. package/dist/plots/{geo → map/geo}/phases/scales.js +28 -12
  212. package/dist/plots/{geo → map/geo}/phases/tooltip.d.ts +1 -1
  213. package/dist/plots/map/geo/phases/tooltip.js +5 -0
  214. package/dist/plots/{geo → map/geo}/slices.d.ts +2 -2
  215. package/dist/plots/{geo → map/geo}/slices.js +2 -2
  216. package/dist/plots/{bar → ranking/bar}/Plot.svelte +2 -2
  217. package/dist/plots/{bar → ranking/bar}/Plot.svelte.d.ts +2 -2
  218. package/dist/plots/ranking/bar/defaults.d.ts +16 -0
  219. package/dist/plots/{bar → ranking/bar}/defaults.js +15 -9
  220. package/dist/plots/{bar → ranking/bar}/markers.d.ts +8 -8
  221. package/dist/plots/{bar → ranking/bar}/markers.js +8 -17
  222. package/dist/plots/ranking/bullet/Plot.svelte +42 -0
  223. package/dist/plots/ranking/bullet/Plot.svelte.d.ts +26 -0
  224. package/dist/plots/ranking/bullet/defaults.d.ts +8 -0
  225. package/dist/plots/ranking/bullet/defaults.js +24 -0
  226. package/dist/plots/ranking/bullet/markers.d.ts +10 -0
  227. package/dist/plots/ranking/bullet/markers.js +90 -0
  228. package/dist/plots/ranking/cleveland/ClevelandConnector.d.ts +48 -0
  229. package/dist/plots/ranking/cleveland/ClevelandConnector.js +140 -0
  230. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +33 -0
  231. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +375 -0
  232. package/dist/plots/ranking/cleveland/ClevelandRanges.d.ts +31 -0
  233. package/dist/plots/ranking/cleveland/ClevelandRanges.js +116 -0
  234. package/dist/plots/ranking/cleveland/Plot.svelte +45 -0
  235. package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +26 -0
  236. package/dist/plots/ranking/cleveland/defaults.d.ts +13 -0
  237. package/dist/plots/ranking/cleveland/defaults.js +66 -0
  238. package/dist/plots/ranking/dumbbell/Plot.svelte +45 -0
  239. package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +26 -0
  240. package/dist/plots/ranking/dumbbell/defaults.d.ts +9 -0
  241. package/dist/plots/ranking/dumbbell/defaults.js +19 -0
  242. package/dist/plots/ranking/forest/Plot.svelte +42 -0
  243. package/dist/plots/ranking/forest/Plot.svelte.d.ts +26 -0
  244. package/dist/plots/ranking/forest/defaults.d.ts +11 -0
  245. package/dist/plots/ranking/forest/defaults.js +20 -0
  246. package/dist/plots/ranking/lollipop/Plot.svelte +45 -0
  247. package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +26 -0
  248. package/dist/plots/ranking/lollipop/defaults.d.ts +9 -0
  249. package/dist/plots/ranking/lollipop/defaults.js +18 -0
  250. package/dist/plots/utils/RowNumbers.d.ts +16 -0
  251. package/dist/plots/utils/RowNumbers.js +24 -0
  252. package/dist/plots/utils/gaps.js +1 -1
  253. package/dist/plots/utils/segments.js +1 -1
  254. package/dist/types/configuration/styling.d.ts +276 -143
  255. package/dist/types/layout/coordinates.d.ts +5 -4
  256. package/dist/types/layout/legend.d.ts +21 -5
  257. package/dist/types/layout/plot.d.ts +44 -1
  258. package/dist/types/layout/scales.d.ts +39 -7
  259. package/dist/types/layout/statistics/deviation.d.ts +40 -0
  260. package/dist/types/layout/statistics/index.d.ts +7 -2
  261. package/dist/types/layout/styles/base.d.ts +18 -0
  262. package/dist/types/layout/styles/bullet.d.ts +25 -0
  263. package/dist/types/layout/styles/connector.d.ts +98 -0
  264. package/dist/types/layout/styles/curve.d.ts +11 -0
  265. package/dist/types/layout/styles/frame.d.ts +17 -0
  266. package/dist/types/layout/styles/gaps.d.ts +12 -0
  267. package/dist/types/layout/styles/geo.d.ts +55 -0
  268. package/dist/types/layout/styles/index.d.ts +8 -0
  269. package/dist/types/layout/styles/index.js +8 -0
  270. package/dist/types/layout/styles/values.d.ts +47 -0
  271. package/dist/types/layout/timeline.d.ts +5 -2
  272. package/dist/types/layout/tooltip.d.ts +6 -2
  273. package/dist/types/markers/axis/area.d.ts +2 -2
  274. package/dist/types/markers/axis/arrow.d.ts +3 -0
  275. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
  276. package/dist/types/markers/axis/bar.d.ts +1 -1
  277. package/dist/types/markers/axis/box.d.ts +5 -0
  278. package/dist/types/markers/axis/difference.d.ts +2 -2
  279. package/dist/types/markers/axis/image.d.ts +3 -2
  280. package/dist/types/markers/axis/line.d.ts +2 -0
  281. package/dist/types/markers/axis/rule.d.ts +9 -0
  282. package/dist/types/markers/axis/trail.d.ts +2 -3
  283. package/dist/types/markers/axis/violin.d.ts +25 -0
  284. package/dist/types/markers/basic/dot.d.ts +3 -2
  285. package/dist/types/markers/basic/text.d.ts +13 -3
  286. package/dist/types/markers/channels/commonMarkerConfig.d.ts +7 -3
  287. package/dist/types/markers/channels/commonMarkerConfigWithRowOffset.d.ts +13 -0
  288. package/dist/types/markers/common.d.ts +1 -1
  289. package/dist/types/markers/common.js +1 -0
  290. package/dist/types/markers/geo/link.d.ts +5 -1
  291. package/dist/types/phases/index.d.ts +1 -1
  292. package/dist/types/phases/scales/phase.d.ts +5 -1
  293. package/dist/types/phases/state.d.ts +15 -2
  294. package/dist/types/phases/statistics/source.d.ts +3 -1
  295. package/dist/types/phases/transforms/phase.d.ts +22 -0
  296. package/dist/types/plots/{heatmap → correlation/heatmap}/props.d.ts +6 -6
  297. package/dist/types/plots/{heatmap → correlation/heatmap}/state.d.ts +4 -4
  298. package/dist/types/plots/{scatter → correlation/scatter}/props.d.ts +6 -6
  299. package/dist/types/plots/{scatter → correlation/scatter}/state.d.ts +2 -2
  300. package/dist/types/plots/{box → distribution/box}/props.d.ts +6 -6
  301. package/dist/types/plots/{box → distribution/box}/state.d.ts +3 -3
  302. package/dist/types/plots/distribution/density/props.d.ts +23 -0
  303. package/dist/types/plots/distribution/density/state.d.ts +6 -0
  304. package/dist/types/plots/{histogram → distribution/histogram}/props.d.ts +7 -7
  305. package/dist/types/plots/{histogram → distribution/histogram}/state.d.ts +2 -2
  306. package/dist/types/plots/distribution/histogram/state.js +1 -0
  307. package/dist/types/plots/{pyramid → distribution/pyramid}/props.d.ts +6 -6
  308. package/dist/types/plots/distribution/pyramid/props.js +1 -0
  309. package/dist/types/plots/{pyramid → distribution/pyramid}/state.d.ts +3 -3
  310. package/dist/types/plots/distribution/pyramid/state.js +1 -0
  311. package/dist/types/plots/distribution/violin/props.d.ts +23 -0
  312. package/dist/types/plots/distribution/violin/props.js +1 -0
  313. package/dist/types/plots/distribution/violin/state.d.ts +6 -0
  314. package/dist/types/plots/distribution/violin/state.js +1 -0
  315. package/dist/types/plots/{area → evolution/area}/props.d.ts +6 -6
  316. package/dist/types/plots/evolution/area/props.js +1 -0
  317. package/dist/types/plots/{area → evolution/area}/state.d.ts +2 -2
  318. package/dist/types/plots/evolution/area/state.js +1 -0
  319. package/dist/types/plots/evolution/line/props.d.ts +10 -0
  320. package/dist/types/plots/evolution/line/props.js +1 -0
  321. package/dist/types/plots/{line → evolution/line}/state.d.ts +3 -3
  322. package/dist/types/plots/evolution/line/state.js +1 -0
  323. package/dist/types/plots/evolution/slope/props.d.ts +5 -0
  324. package/dist/types/plots/evolution/slope/props.js +1 -0
  325. package/dist/types/plots/evolution/slope/state.d.ts +5 -0
  326. package/dist/types/plots/evolution/slope/state.js +1 -0
  327. package/dist/types/plots/evolution/sparkline/props.d.ts +5 -0
  328. package/dist/types/plots/evolution/sparkline/props.js +1 -0
  329. package/dist/types/plots/evolution/sparkline/state.d.ts +5 -0
  330. package/dist/types/plots/evolution/sparkline/state.js +1 -0
  331. package/dist/types/plots/{geo → map/geo}/props.d.ts +8 -8
  332. package/dist/types/plots/map/geo/props.js +1 -0
  333. package/dist/types/plots/{geo → map/geo}/state.d.ts +18 -11
  334. package/dist/types/plots/map/geo/state.js +1 -0
  335. package/dist/types/plots/props.d.ts +1 -1
  336. package/dist/types/plots/{bar → ranking/bar}/props.d.ts +6 -6
  337. package/dist/types/plots/ranking/bar/props.js +1 -0
  338. package/dist/types/plots/{bar → ranking/bar}/state.d.ts +2 -2
  339. package/dist/types/plots/ranking/bar/state.js +1 -0
  340. package/dist/types/plots/ranking/bullet/props.d.ts +22 -0
  341. package/dist/types/plots/ranking/bullet/props.js +1 -0
  342. package/dist/types/plots/ranking/bullet/state.d.ts +5 -0
  343. package/dist/types/plots/ranking/bullet/state.js +1 -0
  344. package/dist/types/plots/ranking/cleveland/props.d.ts +10 -0
  345. package/dist/types/plots/ranking/cleveland/props.js +1 -0
  346. package/dist/types/plots/ranking/cleveland/state.d.ts +49 -0
  347. package/dist/types/plots/ranking/cleveland/state.js +1 -0
  348. package/dist/types/plots/ranking/dumbbell/props.d.ts +10 -0
  349. package/dist/types/plots/ranking/dumbbell/props.js +1 -0
  350. package/dist/types/plots/ranking/dumbbell/state.d.ts +5 -0
  351. package/dist/types/plots/ranking/dumbbell/state.js +1 -0
  352. package/dist/types/plots/ranking/forest/props.d.ts +23 -0
  353. package/dist/types/plots/ranking/forest/props.js +1 -0
  354. package/dist/types/plots/ranking/forest/state.d.ts +5 -0
  355. package/dist/types/plots/ranking/forest/state.js +1 -0
  356. package/dist/types/plots/ranking/lollipop/props.d.ts +10 -0
  357. package/dist/types/plots/ranking/lollipop/props.js +1 -0
  358. package/dist/types/plots/ranking/lollipop/state.d.ts +5 -0
  359. package/dist/types/plots/ranking/lollipop/state.js +1 -0
  360. package/dist/types/plots/segments/common.d.ts +4 -1
  361. package/dist/utils/OpacityScale.d.ts +14 -0
  362. package/dist/utils/OpacityScale.js +43 -0
  363. package/dist/utils/{symbol.d.ts → SymbolPath.d.ts} +0 -12
  364. package/dist/utils/{symbol.js → SymbolPath.js} +0 -24
  365. package/dist/utils/SymbolScale.d.ts +18 -0
  366. package/dist/utils/SymbolScale.js +29 -0
  367. package/dist/utils/color/ColorRamp.d.ts +27 -0
  368. package/dist/utils/color/ColorRamp.js +120 -0
  369. package/dist/utils/color/CssColor.d.ts +19 -0
  370. package/dist/utils/color/CssColor.js +114 -0
  371. package/dist/utils/color/Palette.d.ts +21 -0
  372. package/dist/utils/color/Palette.js +52 -0
  373. package/dist/utils/color/index.d.ts +11 -3
  374. package/dist/utils/color/index.js +14 -3
  375. package/dist/utils/grouping.js +1 -1
  376. package/docs/architecture.md +1 -1
  377. package/docs/chrome.md +2 -2
  378. package/docs/composer.md +2 -2
  379. package/docs/concepts.md +1 -1
  380. package/docs/development.md +1 -1
  381. package/docs/facets.md +3 -3
  382. package/docs/getting-started.md +2 -2
  383. package/docs/legend.md +13 -11
  384. package/docs/markers.md +29 -27
  385. package/docs/plots/correlation/heatmap.md +26 -0
  386. package/docs/plots/correlation/scatter.md +35 -0
  387. package/docs/plots/distribution/box.md +28 -0
  388. package/docs/plots/distribution/density.md +26 -0
  389. package/docs/plots/distribution/histogram.md +33 -0
  390. package/docs/plots/distribution/pyramid.md +31 -0
  391. package/docs/plots/distribution/violin.md +35 -0
  392. package/docs/plots/evolution/area.md +32 -0
  393. package/docs/plots/evolution/line.md +93 -0
  394. package/docs/plots/evolution/slope.md +39 -0
  395. package/docs/plots/evolution/sparkline.md +34 -0
  396. package/docs/plots/ranking/bar.md +59 -0
  397. package/docs/plots/ranking/bullet.md +37 -0
  398. package/docs/plots/ranking/cleveland.md +54 -0
  399. package/docs/plots/ranking/dumbbell.md +39 -0
  400. package/docs/plots/ranking/forest.md +40 -0
  401. package/docs/plots/ranking/lollipop.md +39 -0
  402. package/docs/plots.md +22 -280
  403. package/docs/scales.md +30 -24
  404. package/docs/styles-and-segments.md +24 -21
  405. package/docs/theming.md +23 -20
  406. package/docs/timeline.md +3 -3
  407. package/docs/tooltip-and-hover.md +10 -10
  408. package/docs/transforms-and-statistics.md +13 -12
  409. package/examples/BarValues.svelte +1 -1
  410. package/examples/Box.svelte +1 -1
  411. package/examples/Bullet.svelte +17 -0
  412. package/examples/Chrome.svelte +1 -1
  413. package/examples/ChromeOrder.svelte +1 -1
  414. package/examples/Cleveland.svelte +15 -0
  415. package/examples/Composer.svelte +2 -2
  416. package/examples/CustomTooltip.svelte +1 -1
  417. package/examples/Density.svelte +7 -0
  418. package/examples/Dumbbell.svelte +16 -0
  419. package/examples/Facets.svelte +1 -1
  420. package/examples/FacetsCarousel.svelte +1 -1
  421. package/examples/FacetsRowsCols.svelte +1 -1
  422. package/examples/FirstPlot.svelte +1 -1
  423. package/examples/Forest.svelte +17 -0
  424. package/examples/Gaps.svelte +2 -2
  425. package/examples/GroupedBars.svelte +1 -1
  426. package/examples/Heatmap.svelte +3 -3
  427. package/examples/HeatmapSegments.svelte +8 -8
  428. package/examples/Histogram.svelte +1 -1
  429. package/examples/HorizontalBars.svelte +1 -1
  430. package/examples/LegendSections.svelte +1 -1
  431. package/examples/LegendToggle.svelte +1 -1
  432. package/examples/LineByRegion.svelte +1 -1
  433. package/examples/LineDates.svelte +1 -1
  434. package/examples/LineStep.svelte +16 -0
  435. package/examples/LineStepSegment.svelte +18 -0
  436. package/examples/Lollipop.svelte +17 -0
  437. package/examples/Markers.svelte +1 -1
  438. package/examples/MovingAverage.svelte +1 -1
  439. package/examples/Pyramid.svelte +9 -2
  440. package/examples/Regression.svelte +2 -2
  441. package/examples/ResponsiveLine.svelte +1 -1
  442. package/examples/Scales.svelte +1 -1
  443. package/examples/Scatter.svelte +2 -2
  444. package/examples/SegmentHighlight.svelte +1 -1
  445. package/examples/Segments.svelte +1 -1
  446. package/examples/SegmentsBySeries.svelte +1 -1
  447. package/examples/Slope.svelte +17 -0
  448. package/examples/Sparkline.svelte +14 -0
  449. package/examples/StackedArea.svelte +1 -1
  450. package/examples/StackedBars.svelte +1 -1
  451. package/examples/TimelinePlayer.svelte +1 -1
  452. package/examples/TimelineRule.svelte +1 -1
  453. package/examples/Tooltip.svelte +1 -1
  454. package/examples/ValueLabels.svelte +1 -1
  455. package/examples/Violin.svelte +14 -0
  456. package/examples/datasets/argentina-chile-trends.ts +34 -0
  457. package/examples/datasets/commodity-prices.ts +48 -0
  458. package/examples/datasets/countries-over-time.ts +368 -0
  459. package/examples/datasets/daily-temperature.ts +121 -0
  460. package/examples/datasets/earthquakes.ts +977 -0
  461. package/examples/datasets/flight-routes.ts +29 -0
  462. package/examples/datasets/height-density.ts +37 -0
  463. package/examples/datasets/heights.ts +370 -0
  464. package/examples/datasets/index.ts +24 -0
  465. package/examples/datasets/inflation-by-region.ts +44 -0
  466. package/examples/datasets/inflation-ranges.ts +34 -0
  467. package/examples/datasets/iris-flower.ts +207 -0
  468. package/examples/datasets/life-expectancy.ts +95 -0
  469. package/examples/datasets/napoleons-march.ts +182 -0
  470. package/examples/datasets/penguins.ts +54 -0
  471. package/examples/datasets/population-by-age-with-gaps.ts +23 -0
  472. package/examples/datasets/population-by-age.ts +890 -0
  473. package/examples/datasets/province-population.ts +521 -0
  474. package/examples/datasets/stock-prices.ts +63 -0
  475. package/examples/datasets/weather-stations-over-time.ts +31 -0
  476. package/examples/datasets/weather-stations.ts +22 -0
  477. package/examples/datasets/wind-vectors.ts +30 -0
  478. package/examples/datasets/world-temperature.ts +400 -0
  479. package/llms-full.txt +22 -11
  480. package/llms.txt +32 -4
  481. package/package.json +10 -1
  482. package/dist/plots/bar/defaults.d.ts +0 -9
  483. package/dist/plots/geo/features.svelte.d.ts +0 -5
  484. package/dist/plots/geo/features.svelte.js +0 -44
  485. package/dist/plots/geo/phases/tooltip.js +0 -5
  486. package/dist/plots/utils/geoAccessors.d.ts +0 -72
  487. package/dist/plots/utils/geoAccessors.js +0 -220
  488. package/dist/plots/utils/geoSegments.d.ts +0 -29
  489. package/dist/plots/utils/geoSegments.js +0 -37
  490. package/dist/types/layout/styles.d.ts +0 -122
  491. package/dist/types/markers/axis/curveName.d.ts +0 -2
  492. package/dist/types/plots/line/props.d.ts +0 -10
  493. package/dist/utils/color/contrast.d.ts +0 -9
  494. package/dist/utils/color/contrast.js +0 -40
  495. package/dist/utils/color/cssColor.d.ts +0 -4
  496. package/dist/utils/color/cssColor.js +0 -77
  497. package/dist/utils/color/ramp.d.ts +0 -17
  498. package/dist/utils/color/ramp.js +0 -110
  499. package/dist/utils/opacity.d.ts +0 -9
  500. package/dist/utils/opacity.js +0 -38
  501. package/examples/data.ts +0 -324
  502. /package/dist/plots/{box → distribution/box}/markers.js +0 -0
  503. /package/dist/types/layout/{styles.js → statistics/deviation.js} +0 -0
  504. /package/dist/types/{markers/axis/curveName.js → layout/styles/base.js} +0 -0
  505. /package/dist/types/{plots/area/props.js → layout/styles/bullet.js} +0 -0
  506. /package/dist/types/{plots/area/state.js → layout/styles/connector.js} +0 -0
  507. /package/dist/types/{plots/bar/props.js → layout/styles/curve.js} +0 -0
  508. /package/dist/types/{plots/bar/state.js → layout/styles/frame.js} +0 -0
  509. /package/dist/types/{plots/box/props.js → layout/styles/gaps.js} +0 -0
  510. /package/dist/types/{plots/box/state.js → layout/styles/geo.js} +0 -0
  511. /package/dist/types/{plots/geo/props.js → layout/styles/values.js} +0 -0
  512. /package/dist/types/{plots/geo/state.js → markers/axis/violin.js} +0 -0
  513. /package/dist/types/{plots/heatmap/props.js → markers/channels/commonMarkerConfigWithRowOffset.js} +0 -0
  514. /package/dist/types/plots/{histogram → correlation/heatmap}/props.js +0 -0
  515. /package/dist/types/plots/{heatmap → correlation/heatmap}/state.js +0 -0
  516. /package/dist/types/plots/{line → correlation/scatter}/props.js +0 -0
  517. /package/dist/types/plots/{histogram → correlation/scatter}/state.js +0 -0
  518. /package/dist/types/plots/{pyramid → distribution/box}/props.js +0 -0
  519. /package/dist/types/plots/{line → distribution/box}/state.js +0 -0
  520. /package/dist/types/plots/{scatter → distribution/density}/props.js +0 -0
  521. /package/dist/types/plots/{pyramid → distribution/density}/state.js +0 -0
  522. /package/dist/types/plots/{scatter/state.js → distribution/histogram/props.js} +0 -0
  523. /package/dist/{plots/utils → utils}/accessors.d.ts +0 -0
  524. /package/dist/{plots/utils → utils}/accessors.js +0 -0
@@ -17,6 +17,11 @@ function tweenState(args) {
17
17
  let from;
18
18
  let to;
19
19
  let raf;
20
+ function stop() {
21
+ if (raf != null)
22
+ cancelAnimationFrame(raf);
23
+ raf = undefined;
24
+ }
20
25
  function setCurrent(value) {
21
26
  current = value;
22
27
  lastValue = value;
@@ -37,16 +42,16 @@ function tweenState(args) {
37
42
  from = atStart ? target : (lastValue ?? target);
38
43
  to = target;
39
44
  }
40
- if (raf != null) {
41
- cancelAnimationFrame(raf);
42
- raf = undefined;
43
- }
44
45
  if (progress != null) {
46
+ stop();
45
47
  setCurrent(args.lerp(from, to, Interpolation.buildEasing(transition?.easing)(clamp01(progress)), direction));
46
48
  return;
47
49
  }
50
+ // A rerun with the same target (the caller rebuilds `transition` on every
51
+ // render) leaves a tween in flight alone.
48
52
  if (!changed)
49
53
  return;
54
+ stop();
50
55
  const duration = Math.max(0, transition?.duration ?? 750);
51
56
  const easing = Interpolation.buildEasing(transition?.easing);
52
57
  const startFrom = from;
@@ -58,11 +63,9 @@ function tweenState(args) {
58
63
  raf = t < 1 ? requestAnimationFrame(tick) : undefined;
59
64
  }
60
65
  raf = requestAnimationFrame(tick);
61
- return () => {
62
- if (raf != null)
63
- cancelAnimationFrame(raf);
64
- };
65
66
  });
67
+ // Only leaving the page stops a tween the effect above started.
68
+ $effect(() => stop);
66
69
  return {
67
70
  get current() {
68
71
  return current;
@@ -1,7 +1,7 @@
1
1
  import { geoAzimuthalEquidistant } from 'd3-geo';
2
2
  import { pointsToFitFeature } from './fit';
3
3
  // Representative extremity points - not real border geometry (which stays
4
- // out of `src/lib`, see stories/plots/geo/data.ts), just enough for
4
+ // out of `src/lib`, see stories/plots/map/geo/data.ts), just enough for
5
5
  // `fitSize` to frame Argentina's full territorial claim sensibly. These are
6
6
  // plain real-world coordinates, not derived from any particular dataset, so
7
7
  // they work the same way regardless of which Argentina GeoJSON actually
@@ -2,7 +2,7 @@
2
2
  * Wraps a handful of representative `[lon, lat]` points as a `MultiPoint`
3
3
  * Feature, just so `projection.fitExtent`/`fitSize` has something to
4
4
  * measure. Custom projections built on these live in `src/lib` (see
5
- * `stories/plots/geo/data.ts` for why real border geometry doesn't), so a
5
+ * `stories/plots/map/geo/data.ts` for why real border geometry doesn't), so a
6
6
  * few hand-picked extremity points stand in for a region's true extent.
7
7
  */
8
8
  export declare function pointsToFitFeature(points: [number, number][]): GeoJSON.Feature;
@@ -2,7 +2,7 @@
2
2
  * Wraps a handful of representative `[lon, lat]` points as a `MultiPoint`
3
3
  * Feature, just so `projection.fitExtent`/`fitSize` has something to
4
4
  * measure. Custom projections built on these live in `src/lib` (see
5
- * `stories/plots/geo/data.ts` for why real border geometry doesn't), so a
5
+ * `stories/plots/map/geo/data.ts` for why real border geometry doesn't), so a
6
6
  * few hand-picked extremity points stand in for a region's true extent.
7
7
  */
8
8
  export function pointsToFitFeature(points) {
@@ -6,15 +6,14 @@ export type GeoZoomTransform = {
6
6
  };
7
7
  /**
8
8
  * Wires drag-pan + scroll-zoom onto a DOM node via d3-zoom, exposing the
9
- * resulting transform as reactive Svelte state, applied by the caller as an
10
- * SVG `<g transform="translate(x,y) scale(k)">` wrapper.
9
+ * resulting transform as reactive Svelte state, which the caller applies to
10
+ * the plot's projection (see `ProjectionZoom`).
11
11
  *
12
12
  * `panEnabled`/`zoomEnabled` gate drag-translate and wheel/pinch-scale
13
13
  * independently, as separate `.filter()`s on the same underlying instance.
14
14
  *
15
- * Limitations: hover/tooltip hit-testing doesn't compensate for an active
16
- * transform. Touch pinch-to-zoom is gated by `panEnabled`, not `zoomEnabled`
17
- * (d3-zoom can't distinguish a pinch from a one-finger drag until underway).
15
+ * Touch pinch-to-zoom is gated by `panEnabled`, not `zoomEnabled` (d3-zoom
16
+ * can't distinguish a pinch from a one-finger drag until underway).
18
17
  */
19
18
  export declare function createGeoZoom(args: {
20
19
  panEnabled: () => boolean;
@@ -2,15 +2,14 @@ import { select } from 'd3-selection';
2
2
  import { zoom as d3zoom, zoomIdentity } from 'd3-zoom';
3
3
  /**
4
4
  * Wires drag-pan + scroll-zoom onto a DOM node via d3-zoom, exposing the
5
- * resulting transform as reactive Svelte state, applied by the caller as an
6
- * SVG `<g transform="translate(x,y) scale(k)">` wrapper.
5
+ * resulting transform as reactive Svelte state, which the caller applies to
6
+ * the plot's projection (see `ProjectionZoom`).
7
7
  *
8
8
  * `panEnabled`/`zoomEnabled` gate drag-translate and wheel/pinch-scale
9
9
  * independently, as separate `.filter()`s on the same underlying instance.
10
10
  *
11
- * Limitations: hover/tooltip hit-testing doesn't compensate for an active
12
- * transform. Touch pinch-to-zoom is gated by `panEnabled`, not `zoomEnabled`
13
- * (d3-zoom can't distinguish a pinch from a one-finger drag until underway).
11
+ * Touch pinch-to-zoom is gated by `panEnabled`, not `zoomEnabled` (d3-zoom
12
+ * can't distinguish a pinch from a one-finger drag until underway).
14
13
  */
15
14
  export function createGeoZoom(args) {
16
15
  let transform = $state({ x: 0, y: 0, k: 1 });
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" generics="TRow extends Record<string, unknown>">
2
2
  import { isMobile } from '../../stores/device';
3
- import { resolveAccessor } from '../../plots/utils/accessors';
3
+ import { resolveAccessor } from '../../utils/accessors';
4
4
  import FacetIndicator from './FacetIndicator.svelte';
5
5
  import Grid from '../grid/Grid.svelte';
6
6
  import GridCell from '../grid/GridCell.svelte';
@@ -1,4 +1,4 @@
1
- import { resolveAccessor } from '../../plots/utils/accessors';
1
+ import { resolveAccessor } from '../../utils/accessors';
2
2
  /** Whether a facet config wraps one facet per `by` value, rather than laying out a `rows`/`cols` grid. */
3
3
  export function isFacetWrap(facet) {
4
4
  return facet.by !== undefined;
@@ -90,6 +90,8 @@
90
90
  // svelte-ignore state_referenced_locally
91
91
  const ownLegend = (legend !== undefined && legend !== false) || !outer;
92
92
  const legendState = ownLegend ? LegendState.provide() : outer!;
93
+ // svelte-ignore state_referenced_locally
94
+ if (outer && legend === false) LegendState.silence();
93
95
 
94
96
  /** What the figure adds to its automatic legend, when `legend` is `{ items, sections }`. */
95
97
  const extension = $derived(
@@ -23,6 +23,7 @@
23
23
  import RasterMarker from '../../markers/raster/RasterMarker.svelte';
24
24
  import TickMarker from '../../markers/tick/TickMarker.svelte';
25
25
  import TrailMarker from '../../markers/trail/TrailMarker.svelte';
26
+ import ViolinMarker from '../../markers/violin/ViolinMarker.svelte';
26
27
  import WaffleMarker from '../../markers/waffle/WaffleMarker.svelte';
27
28
  import DotMarker from '../../markers/dot/DotMarker.svelte';
28
29
  import TextMarker from '../../markers/text/TextMarker.svelte';
@@ -39,6 +40,7 @@
39
40
  import ContourClipMarker from '../../markers/contour/ContourClipMarker.svelte';
40
41
  import InsetMarker from '../../markers/inset/InsetMarker.svelte';
41
42
  import FrameClip from './FrameClip.svelte';
43
+ import MarkerOffset from './MarkerOffset.svelte';
42
44
  import { getConfiguration } from '../../configuration/config.svelte';
43
45
  import { usePlot } from '../plot/usePlot';
44
46
  import { PlotMargins } from '../margins/PlotMargins.svelte';
@@ -48,7 +50,6 @@
48
50
  import type { PlotHover } from '../hover/PlotHover.svelte';
49
51
  import type { ScopedMarkerGroup } from '../../types/layout/geometry';
50
52
  import type { GeoFeature } from '../../types/plots/data/geo';
51
- import type { ChannelScalesConfig } from '../../types/layout/scales';
52
53
  import { MarkerGrouping } from '../../phases/statistics/MarkerGrouping';
53
54
  import { FrameClipping } from './FrameClipping';
54
55
 
@@ -75,7 +76,6 @@
75
76
  markers = [],
76
77
  seriesData = [],
77
78
  scopedGroups = [],
78
- channelScales = undefined,
79
79
  ctrl,
80
80
  numericMargins,
81
81
  data = [],
@@ -91,8 +91,6 @@
91
91
  seriesData?: Series<TSeries>[];
92
92
  /** One entry per series that can own a `series`-scoped marker. Same `TSeries` as `seriesData`. */
93
93
  scopedGroups?: ScopedMarkerGroup<TSeries>[];
94
- /** This plot kind's own `color`/`grouping` channel config - the fallback a marker's own `scales` inherits when it sets none of its own. */
95
- channelScales?: ChannelScalesConfig;
96
94
  /** `BasePlotLayout`'s own hover controller. */
97
95
  ctrl: PlotHover<TData>;
98
96
  /** The plot's own resolved margins - places the content box an `inset` marker needs. */
@@ -122,7 +120,8 @@
122
120
  const scope = scopedSeriesOf(marker);
123
121
  if (scope) return `${scope}-${marker.type}-${i}`;
124
122
  if (marker.type === 'rule') {
125
- const v = typeof marker.value === 'function' ? i : marker.value;
123
+ // A rule over rows (`data`) has no value of its own to tell it from another one.
124
+ const v = typeof marker.value === 'function' || marker.data ? i : marker.value;
126
125
  return `rule-${marker.axis}-${v}`;
127
126
  }
128
127
  if (marker.type === 'bar') return `bar-${marker.role}-${i}`;
@@ -130,7 +129,7 @@
130
129
  }
131
130
  </script>
132
131
 
133
- {#snippet renderMarker(marker: MarkerConfig, rows: TData[] | TSeries[])}
132
+ {#snippet drawMarker(marker: MarkerConfig, rows: TData[] | TSeries[])}
134
133
  {#if marker.type === 'bar'}
135
134
  <BarMarker marker={{ ...marker, data: marker.data ?? rows }} />
136
135
  {:else if marker.type === 'line'}
@@ -173,12 +172,12 @@
173
172
  <TickMarker marker={{ ...marker, data: marker.data ?? rows }} />
174
173
  {:else if marker.type === 'trail'}
175
174
  <TrailMarker marker={{ ...marker, data: marker.data ?? rows }} />
175
+ {:else if marker.type === 'violin'}
176
+ <ViolinMarker marker={{ ...marker, data: marker.data ?? rows }} />
176
177
  {:else if marker.type === 'waffle'}
177
178
  <WaffleMarker marker={{ ...marker, data: marker.data ?? rows }} />
178
179
  {:else if marker.type === 'dot'}
179
- <DotMarker
180
- marker={{ ...marker, data: marker.data ?? rows, scales: marker.scales ?? channelScales }}
181
- />
180
+ <DotMarker marker={{ ...marker, data: marker.data ?? rows }} />
182
181
  {:else if marker.type === 'text'}
183
182
  <TextMarker marker={{ ...marker, data: marker.data ?? rows }} />
184
183
  {:else if marker.type === 'rule'}
@@ -236,6 +235,12 @@
236
235
  {/if}
237
236
  {/snippet}
238
237
 
238
+ {#snippet renderMarker(marker: MarkerConfig, rows: TData[] | TSeries[])}
239
+ <MarkerOffset {marker}>
240
+ {@render drawMarker(marker, rows)}
241
+ </MarkerOffset>
242
+ {/snippet}
243
+
239
244
  {#snippet renderScoped(marker: MarkerConfig, group: ScopedMarkerGroup<TSeries>)}
240
245
  {#if marker.type === 'hover'}
241
246
  {@const seriesPoints = ctrl.points.filter((p) => p.series === group.name)}
@@ -4,7 +4,6 @@ import type { TooltipAnchorX, TooltipAnchorY } from '../../types/layout/tooltip'
4
4
  import type { PlotHover } from '../hover/PlotHover.svelte';
5
5
  import type { ScopedMarkerGroup } from '../../types/layout/geometry';
6
6
  import type { GeoFeature } from '../../types/plots/data/geo';
7
- import type { ChannelScalesConfig } from '../../types/layout/scales';
8
7
  declare function $$render<TData extends Record<string, unknown>, TSeries extends Record<string, unknown> = TData>(): {
9
8
  props: {
10
9
  /** The plot's own outer width/height - sizes the content box an `inset` marker needs. */
@@ -15,8 +14,6 @@ declare function $$render<TData extends Record<string, unknown>, TSeries extends
15
14
  seriesData?: Series<TSeries>[];
16
15
  /** One entry per series that can own a `series`-scoped marker. Same `TSeries` as `seriesData`. */
17
16
  scopedGroups?: ScopedMarkerGroup<TSeries>[];
18
- /** This plot kind's own `color`/`grouping` channel config - the fallback a marker's own `scales` inherits when it sets none of its own. */
19
- channelScales?: ChannelScalesConfig;
20
17
  /** `BasePlotLayout`'s own hover controller. */
21
18
  ctrl: PlotHover<TData>;
22
19
  /** The plot's own resolved margins - places the content box an `inset` marker needs. */
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { RowOffset } from '../../markers/utils/RowOffset';
4
+ import type { RowOffset as RowOffsetConfig } from '../../types/markers/channels/commonMarkerConfigWithRowOffset';
5
+
6
+ /**
7
+ * Moves what it draws by the marker's `dx` and `dy` (the numbers; a function of
8
+ * the row is each marker's own), as a translate of the whole marker - so any
9
+ * marker kind can be offset, on a map too, where svelteplot ignores a mark's
10
+ * own `dx`/`dy`. A `text` marker places its own labels, since its lanes and
11
+ * flips depend on the offset.
12
+ */
13
+ let {
14
+ marker,
15
+ children
16
+ }: {
17
+ marker: { type: string; dx?: RowOffsetConfig; dy?: RowOffsetConfig };
18
+ children: Snippet;
19
+ } = $props();
20
+
21
+ const offset = $derived(marker.type === 'text' ? { dx: 0, dy: 0 } : RowOffset.whole(marker));
22
+ </script>
23
+
24
+ {#if offset.dx !== 0 || offset.dy !== 0}
25
+ <g transform="translate({offset.dx},{offset.dy})">{@render children()}</g>
26
+ {:else}
27
+ {@render children()}
28
+ {/if}
@@ -0,0 +1,13 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { RowOffset as RowOffsetConfig } from '../../types/markers/channels/commonMarkerConfigWithRowOffset';
3
+ type $$ComponentProps = {
4
+ marker: {
5
+ type: string;
6
+ dx?: RowOffsetConfig;
7
+ dy?: RowOffsetConfig;
8
+ };
9
+ children: Snippet;
10
+ };
11
+ declare const MarkerOffset: import("svelte").Component<$$ComponentProps, {}, "">;
12
+ type MarkerOffset = ReturnType<typeof MarkerOffset>;
13
+ export default MarkerOffset;
@@ -96,14 +96,12 @@
96
96
  </div>
97
97
  {/if}
98
98
  {#if ready && layout && layout.box.width > 0 && layout.box.height > 0}
99
- {#key JSON.stringify(layout.box.margins ?? null)}
100
- {@render children({
101
- width: layout.box.width,
102
- height: layout.box.height,
103
- margins: layout.box.margins,
104
- edges: layout.edges
105
- })}
106
- {/key}
99
+ {@render children({
100
+ width: layout.box.width,
101
+ height: layout.box.height,
102
+ margins: layout.box.margins,
103
+ edges: layout.edges
104
+ })}
107
105
  {/if}
108
106
  </div>
109
107
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { untrack } from 'svelte';
3
3
  import type { ContinuousLegendSection } from '../../types/layout/legend';
4
- import { makeColorScale, resolveColorScale } from '../../utils/color';
4
+ import { ColorRamp } from '../../utils/color';
5
5
  import { getConfiguration } from '../../configuration/config.svelte';
6
6
  import { AxisNumberFormat } from './AxisNumberFormat';
7
7
  import { LegendState } from './LegendState.svelte';
@@ -10,6 +10,7 @@
10
10
 
11
11
  const cfg = $derived(getConfiguration());
12
12
  const gradientId = `dct-grad-${Math.random().toString(36).slice(2)}`;
13
+ const checkerId = `dct-checker-${Math.random().toString(36).slice(2)}`;
13
14
  const barWidth = $derived(section.width ?? 170);
14
15
 
15
16
  const fmt = $derived(section.format ?? AxisNumberFormat.of([section.min, section.max], cfg));
@@ -31,6 +32,7 @@
31
32
  const svgHeight = $derived(cfg.legend.continuous.height);
32
33
  const barHeight = $derived(cfg.legend.continuous.barHeight);
33
34
  const barRadius = $derived(cfg.legend.continuous.barRadius);
35
+ const opacityLook = $derived(cfg.legend.continuous.opacity);
34
36
 
35
37
  // Fill/opacity for the excluded-margin rects.
36
38
  const excludedStyle = $derived.by((): { fill: string; opacity: number } => {
@@ -79,16 +81,18 @@
79
81
  );
80
82
  const colorScale = $derived(
81
83
  section.scheme !== undefined
82
- ? resolveColorScale({ scheme: section.scheme, pivot: section.pivot }, colorDomain, [
84
+ ? ColorRamp.resolve({ scheme: section.scheme, pivot: section.pivot }, colorDomain, [
83
85
  cfg.continuous.min,
84
86
  cfg.continuous.max
85
87
  ])
86
- : makeColorScale(
87
- colorDomain[0],
88
- colorDomain[1],
89
- section.colorMin ?? cfg.continuous.min,
90
- section.colorMax ?? cfg.continuous.max
91
- )
88
+ : cfg.continuous.scheme && section.colorMin === undefined && section.colorMax === undefined
89
+ ? ColorRamp.continuous(cfg, undefined, colorDomain)
90
+ : ColorRamp.between(
91
+ colorDomain[0],
92
+ colorDomain[1],
93
+ section.colorMin ?? cfg.continuous.min,
94
+ section.colorMax ?? cfg.continuous.max
95
+ )
92
96
  );
93
97
 
94
98
  const stops = $derived(
@@ -98,7 +102,7 @@
98
102
  return section.opacity
99
103
  ? {
100
104
  offset: t * 100,
101
- color: section.colorMin ?? 'currentColor',
105
+ color: section.colorMin ?? opacityLook.color,
102
106
  opacity: section.opacity[0] + t * (section.opacity[1] - section.opacity[0])
103
107
  }
104
108
  : { offset: t * 100, color: colorScale(v), opacity: 1 };
@@ -203,7 +207,38 @@
203
207
  <stop offset="{s.offset}%" stop-color={s.color} stop-opacity={s.opacity} />
204
208
  {/each}
205
209
  </linearGradient>
210
+ {#if section.opacity}
211
+ <pattern
212
+ id={checkerId}
213
+ width={opacityLook.checker.size * 2}
214
+ height={opacityLook.checker.size * 2}
215
+ patternUnits="userSpaceOnUse"
216
+ >
217
+ <rect width="100%" height="100%" fill={opacityLook.checker.light} />
218
+ <rect
219
+ width={opacityLook.checker.size}
220
+ height={opacityLook.checker.size}
221
+ fill={opacityLook.checker.dark}
222
+ />
223
+ <rect
224
+ x={opacityLook.checker.size}
225
+ y={opacityLook.checker.size}
226
+ width={opacityLook.checker.size}
227
+ height={opacityLook.checker.size}
228
+ fill={opacityLook.checker.dark}
229
+ />
230
+ </pattern>
231
+ {/if}
206
232
  </defs>
233
+ {#if section.opacity}
234
+ <rect
235
+ x={handleBleed}
236
+ width={trackWidth}
237
+ height={barHeight}
238
+ rx={barRadius}
239
+ fill="url(#{checkerId})"
240
+ />
241
+ {/if}
207
242
  <rect
208
243
  x={handleBleed}
209
244
  width={trackWidth}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { contrastTextColor } from '../../utils/color';
2
+ import { CssColor } from '../../utils/color';
3
3
  import { getConfiguration } from '../../configuration/config.svelte';
4
4
  import { LegendText } from './LegendText';
5
5
  import DiscreteSymbolIcon from './DiscreteSymbolIcon.svelte';
@@ -24,7 +24,7 @@
24
24
  omitMode?: boolean;
25
25
  } = $props();
26
26
  const cfg = $derived(getConfiguration());
27
- const textColor = $derived(contrastTextColor(color));
27
+ const textColor = $derived(CssColor.contrastText(color));
28
28
  </script>
29
29
 
30
30
  <span class="dct-discrete__badge" style:background={color} style:color={textColor}>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { SvelteSet } from 'svelte/reactivity';
3
3
  import { getConfiguration } from '../../configuration/config.svelte';
4
- import { paletteColor } from '../../utils/color';
4
+ import { Palette } from '../../utils/color';
5
5
  import { LegendState } from './LegendState.svelte';
6
6
  import { DisabledStyle } from './DisabledStyle';
7
7
  import DiscreteBadgeItem from './DiscreteBadgeItem.svelte';
@@ -167,7 +167,7 @@
167
167
  disabledStyle?.fill ??
168
168
  disabledStyle?.stroke?.stroke ??
169
169
  item.color ??
170
- paletteColor(i, cfg.palette)}
170
+ Palette.at(i, cfg.palette)}
171
171
  {@const itemOpacity = disabledStyle
172
172
  ? (disabledStyle.opacity ?? cfg.legend.disabledOpacity)
173
173
  : (item.opacity ?? 1)}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { LegendItem } from '../../types/layout/legend';
3
3
  import type { LineStyle } from '../../types/plots/constants';
4
- import { SymbolPath } from '../../utils/symbol';
4
+ import { SymbolPath } from '../../utils/SymbolPath';
5
5
 
6
6
  /**
7
7
  * The series' symbol/line-style icon, shared by both discrete item looks
@@ -1,11 +1,11 @@
1
- import { resolveAccessor } from '../../plots/utils/accessors';
1
+ import { resolveAccessor } from '../../utils/accessors';
2
2
  import { getConfiguration } from '../../configuration/config.svelte';
3
3
  import { ChannelName } from '../../plots/utils/ChannelName';
4
4
  import { MarkerKinds } from '../../markers/MarkerKinds';
5
5
  import { ContinuousDomain } from '../../utils/ContinuousDomain';
6
- import { resolveColorScale } from '../../utils/color';
7
- import { resolveOpacityScale } from '../../utils/opacity';
8
- import { resolveSymbolScale } from '../../utils/symbol';
6
+ import { ColorRamp } from '../../utils/color';
7
+ import { OpacityScale } from '../../utils/OpacityScale';
8
+ import { SymbolScale } from '../../utils/SymbolScale';
9
9
  /**
10
10
  * What a plot's value channels - `color`, `opacity`, `r` and `symbol` - draw
11
11
  * with, as legend entries: the plot's own (a heatmap's cells, a map's
@@ -17,6 +17,7 @@ export class LegendChannels {
17
17
  const taken = new Set((plot.resolvedSeries ?? []).map((s) => s.name));
18
18
  return [
19
19
  ...LegendChannels.#plotColor(plot),
20
+ ...LegendChannels.#segmentColors(plot),
20
21
  ...markers.flatMap((marker) => LegendChannels.#markerColor(marker, taken)),
21
22
  ...LegendChannels.#plotOpacity(plot),
22
23
  ...markers.flatMap((marker) => LegendChannels.#markerOpacity(marker, plot)),
@@ -45,6 +46,15 @@ export class LegendChannels {
45
46
  static #title(channel, property) {
46
47
  return typeof channel === 'string' ? channel : ChannelName.of(channel, property);
47
48
  }
49
+ /** The domain svelteplot sizes with: the configured one or the values' own, taken down to 0 unless `zero` is off. */
50
+ static #sizeDomain(scale, values) {
51
+ const [low, high] = scale?.domain ?? [Math.min(...values), Math.max(...values)];
52
+ return scale?.zero === false ? [low, high] : [Math.min(0, low), Math.max(0, high)];
53
+ }
54
+ /** A plot channel's name: its field key, or the name of the function that computes it. */
55
+ static #sourceTitle(source, property) {
56
+ return typeof source === 'string' ? source : ChannelName.of(source, property);
57
+ }
48
58
  /** `marker`'s rows read through `channel` (a field or a function), without the missing and non-finite ones. */
49
59
  static #values(marker, channel) {
50
60
  if (channel === undefined || channel === null || typeof channel === 'number')
@@ -102,6 +112,11 @@ export class LegendChannels {
102
112
  LegendChannels.#scaleEntry(typeof source === 'string' ? source : undefined, domain, scale)
103
113
  ];
104
114
  }
115
+ /** One continuous ramp per segment that sets its own, over the values of just its own features. */
116
+ static #segmentColors(plot) {
117
+ const source = plot.channels?.color?.source;
118
+ return (plot.colorRamps ?? []).map(({ name, domain, scale }) => LegendChannels.#scaleEntry(typeof source === 'string' ? `${source} (${name})` : name, domain, scale));
119
+ }
105
120
  /**
106
121
  * A marker's `color` channel: a continuous scale for numbers; for
107
122
  * categories, one item each in the color the marker draws it, unless a
@@ -118,7 +133,7 @@ export class LegendChannels {
118
133
  return domain ? [LegendChannels.#scaleEntry(title, domain, scale)] : [];
119
134
  }
120
135
  const categories = [...new Set(values.map(String))];
121
- const colorOf = resolveColorScale(scale, categories, getConfiguration().palette);
136
+ const colorOf = ColorRamp.resolve(scale, categories, getConfiguration().palette);
122
137
  const mark = MarkerKinds.of(marker.type)?.legendSymbol;
123
138
  return categories
124
139
  .filter((name) => !taken.has(name))
@@ -127,7 +142,7 @@ export class LegendChannels {
127
142
  static #opacityEntry(title, domain, scale, color) {
128
143
  if (scale?.range !== undefined && !Array.isArray(scale.range))
129
144
  return [];
130
- const read = resolveOpacityScale(scale, domain, getConfiguration().continuous.opacityRange);
145
+ const read = OpacityScale.resolve(scale, domain, getConfiguration().continuous.opacityRange);
131
146
  return [
132
147
  {
133
148
  type: 'opacity',
@@ -141,13 +156,20 @@ export class LegendChannels {
141
156
  }
142
157
  ];
143
158
  }
144
- /** The plot's own numeric `opacity` channel, over the `opacityDomain` it hands over. */
159
+ /**
160
+ * The plot's own numeric `opacity` channel, over the `opacityDomain` it hands
161
+ * over, in its series' color - unless a `color` channel colors the marks, and
162
+ * no one color stands for them.
163
+ */
145
164
  static #plotOpacity(plot) {
146
165
  if (!plot.opacityDomain)
147
166
  return [];
148
167
  const source = plot.channels?.opacity?.source;
149
168
  const name = plot.resolvedSeries?.[0]?.name;
150
- const color = name !== undefined && name !== 'default' ? plot.colorForSeries?.(name) : undefined;
169
+ const colored = plot.channels?.color?.source !== undefined || !!plot.colorDomain;
170
+ const color = !colored && name !== undefined && name !== 'default'
171
+ ? plot.colorForSeries?.(name)
172
+ : undefined;
151
173
  return LegendChannels.#opacityEntry(typeof source === 'string' ? source : undefined, plot.opacityDomain, plot.scales?.opacity, color);
152
174
  }
153
175
  /** A marker's numeric `opacity` channel, in the color the marker draws. */
@@ -176,13 +198,14 @@ export class LegendChannels {
176
198
  if (values.length === 0)
177
199
  return [];
178
200
  const { filled, color, symbol } = LegendChannels.look(sized);
179
- const source = plot.channels?.r?.source ?? LegendChannels.#title(sized[0].r, 'r');
201
+ const source = LegendChannels.#sourceTitle(plot.channels?.r?.source, 'r') ??
202
+ LegendChannels.#title(sized[0].r, 'r');
180
203
  return [
181
204
  {
182
205
  type: 'size',
183
206
  channel: 'r',
184
207
  ...(typeof source === 'string' ? { title: source } : {}),
185
- domain: plot.scales?.r?.domain ?? [0, Math.max(...values)],
208
+ domain: LegendChannels.#sizeDomain(plot.scales?.r, values),
186
209
  range: plot.scales?.r?.range ?? [0, 10],
187
210
  ...(color ? { color } : {}),
188
211
  filled,
@@ -204,9 +227,10 @@ export class LegendChannels {
204
227
  shaped.flatMap((marker) => LegendChannels.#values(marker, marker.symbol).map(String))).filter((value, i, all) => all.indexOf(value) === i);
205
228
  if (domain.length === 0)
206
229
  return [];
207
- const shapeOf = resolveSymbolScale(config, domain, getConfiguration().symbols);
230
+ const shapeOf = SymbolScale.resolve(config, domain, getConfiguration().symbols);
208
231
  const { filled, color } = LegendChannels.look(shaped);
209
- const source = plot.channels?.symbol?.source ?? LegendChannels.#title(shaped[0].symbol, 'symbol');
232
+ const source = LegendChannels.#sourceTitle(plot.channels?.symbol?.source, 'symbol') ??
233
+ LegendChannels.#title(shaped[0].symbol, 'symbol');
210
234
  return [
211
235
  {
212
236
  type: 'symbol',
@@ -15,10 +15,18 @@
15
15
  const defaultItemsLayout = $derived<LegendItemsLayout>(
16
16
  sections.length === 1 ? { type: 'horizontal' } : { type: 'vertical' }
17
17
  );
18
+
19
+ // Sections of different channels can share a title, so a key leads with its channel; a repeat takes its position.
20
+ const keys = $derived.by(() => {
21
+ const bases = sections.map(
22
+ (section) => `${'channel' in section ? section.channel : section.type}:${section.title ?? ''}`
23
+ );
24
+ return bases.map((base, i) => (bases.indexOf(base) === i ? base : `${base}:${i}`));
25
+ });
18
26
  </script>
19
27
 
20
28
  <div class="dct-legend">
21
- {#each sections as section, i (section.title ?? i)}
29
+ {#each sections as section, i (keys[i])}
22
30
  <div class="dct-legend__section">
23
31
  {#if section.title}
24
32
  <div class="dct-legend__title">{section.title}</div>
@@ -18,6 +18,10 @@ export declare class LegendState {
18
18
  static current(): LegendState | null;
19
19
  /** A new legend, shared with everything below. Call during component init. */
20
20
  static provide(): LegendState;
21
+ /** Keeps the plots below out of the enclosing legend: they still follow its toggles, but add nothing to it. Call during component init. */
22
+ static silence(): void;
23
+ /** Whether the plots here are kept out of the enclosing legend (see {@link silence}). Call during component init. */
24
+ static isSilenced(): boolean;
21
25
  /** The enclosing figure's legend, or a private one for a legend drawn outside any. Call during component init. */
22
26
  static ensure(): LegendState;
23
27
  /** Whether `value` lies within `range`; a missing value always does. */