@fundar/data-chart-telling 0.0.63 → 1.0.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 (786) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +81 -558
  4. package/dist/configuration/config.svelte.d.ts +5 -5
  5. package/dist/configuration/config.svelte.js +133 -46
  6. package/dist/configuration/fonts.d.ts +6 -0
  7. package/dist/configuration/fonts.js +6 -0
  8. package/dist/configuration/themes/compact.d.ts +2 -2
  9. package/dist/configuration/themes/compact.js +1 -1
  10. package/dist/configuration/themes/dark.d.ts +2 -2
  11. package/dist/configuration/themes/dark.js +5 -4
  12. package/dist/configuration/themes/default.d.ts +8 -3
  13. package/dist/configuration/themes/default.js +8 -2
  14. package/dist/configuration/themes/editorial.d.ts +2 -2
  15. package/dist/configuration/themes/editorial.js +2 -2
  16. package/dist/configuration/themes/index.d.ts +433 -80
  17. package/dist/configuration/themes/index.js +6 -5
  18. package/dist/index.d.ts +34 -48
  19. package/dist/index.js +19 -35
  20. package/dist/layout/base/BasePlotLayout.svelte +312 -0
  21. package/dist/layout/base/BasePlotLayout.svelte.d.ts +111 -0
  22. package/dist/layout/composer/PlotComposer.svelte +94 -0
  23. package/dist/layout/composer/PlotComposer.svelte.d.ts +13 -0
  24. package/dist/layout/coordinates/CameraFit.svelte +4 -4
  25. package/dist/layout/coordinates/CoordinatesLayout.svelte +11 -3
  26. package/dist/layout/coordinates/CoordinatesLayout.svelte.d.ts +6 -2
  27. package/dist/layout/coordinates/camera.svelte.d.ts +1 -1
  28. package/dist/layout/coordinates/camera.svelte.js +6 -6
  29. package/dist/layout/coordinates/projections/argentina.js +3 -3
  30. package/dist/layout/coordinates/projections/fit.js +1 -1
  31. package/dist/layout/coordinates/resolveCameraTarget.d.ts +1 -1
  32. package/dist/layout/coordinates/resolveProjection.d.ts +1 -1
  33. package/dist/layout/coordinates/resolveProjection.js +2 -2
  34. package/dist/layout/coordinates/rotate.svelte.d.ts +3 -3
  35. package/dist/layout/coordinates/rotate.svelte.js +8 -8
  36. package/dist/layout/coordinates/zoom.svelte.d.ts +1 -1
  37. package/dist/layout/facet/FacetIndicator.svelte +23 -23
  38. package/dist/layout/facet/FacetLayout.svelte +435 -398
  39. package/dist/layout/facet/FacetLayout.svelte.d.ts +9 -3
  40. package/dist/layout/facet/axes.d.ts +16 -0
  41. package/dist/layout/facet/axes.js +25 -0
  42. package/dist/layout/facet/config.d.ts +32 -0
  43. package/dist/layout/facet/config.js +82 -0
  44. package/dist/layout/figure/Figure.svelte +177 -0
  45. package/dist/layout/figure/Figure.svelte.d.ts +14 -0
  46. package/dist/layout/figure/FigureChrome.svelte +341 -0
  47. package/dist/layout/figure/FigureChrome.svelte.d.ts +21 -0
  48. package/dist/layout/geometry/FrameClip.svelte +45 -0
  49. package/dist/layout/geometry/FrameClip.svelte.d.ts +8 -0
  50. package/dist/layout/geometry/FrameClipping.d.ts +24 -0
  51. package/dist/layout/geometry/FrameClipping.js +40 -0
  52. package/dist/layout/geometry/GeometryLayout.svelte +287 -224
  53. package/dist/layout/geometry/GeometryLayout.svelte.d.ts +10 -10
  54. package/dist/layout/grid/Grid.svelte +194 -0
  55. package/dist/layout/grid/Grid.svelte.d.ts +26 -0
  56. package/dist/layout/grid/GridAlignment.svelte.d.ts +31 -0
  57. package/dist/layout/grid/GridAlignment.svelte.js +56 -0
  58. package/dist/layout/grid/GridCell.svelte +141 -0
  59. package/dist/layout/grid/GridCell.svelte.d.ts +17 -0
  60. package/dist/layout/grid/GridCellsRegistry.svelte.d.ts +52 -0
  61. package/dist/layout/grid/GridCellsRegistry.svelte.js +70 -0
  62. package/dist/layout/grid/GridPlan.d.ts +49 -0
  63. package/dist/layout/grid/GridPlan.js +167 -0
  64. package/dist/layout/grid/Tags.d.ts +8 -0
  65. package/dist/layout/grid/Tags.js +39 -0
  66. package/dist/layout/hover/HoverScope.svelte +11 -0
  67. package/dist/layout/hover/HoverScope.svelte.d.ts +8 -0
  68. package/dist/layout/hover/HoverSettings.d.ts +20 -0
  69. package/dist/layout/hover/HoverSettings.js +27 -0
  70. package/dist/layout/hover/HoverState.svelte.d.ts +47 -0
  71. package/dist/layout/hover/HoverState.svelte.js +99 -0
  72. package/dist/layout/hover/PlotHover.svelte.d.ts +63 -0
  73. package/dist/layout/hover/PlotHover.svelte.js +133 -0
  74. package/dist/layout/interaction/PlotInteraction.svelte.d.ts +38 -0
  75. package/dist/layout/interaction/PlotInteraction.svelte.js +56 -0
  76. package/dist/layout/legend/AxisNumberFormat.d.ts +12 -0
  77. package/dist/layout/legend/AxisNumberFormat.js +25 -0
  78. package/dist/layout/legend/ContinuousSection.svelte +365 -335
  79. package/dist/layout/legend/DisabledStyle.d.ts +19 -0
  80. package/dist/layout/legend/DisabledStyle.js +57 -0
  81. package/dist/layout/legend/DiscreteBadgeItem.svelte +6 -3
  82. package/dist/layout/legend/DiscreteSection.svelte +39 -32
  83. package/dist/layout/legend/DiscreteSwatchItem.svelte +4 -1
  84. package/dist/layout/legend/DiscreteSymbolIcon.svelte +14 -9
  85. package/dist/layout/legend/LegendChannels.d.ts +21 -0
  86. package/dist/layout/legend/LegendChannels.js +221 -0
  87. package/dist/layout/legend/LegendLayout.svelte +49 -43
  88. package/dist/layout/legend/LegendState.svelte.d.ts +79 -0
  89. package/dist/layout/legend/LegendState.svelte.js +329 -0
  90. package/dist/layout/legend/LegendText.d.ts +12 -0
  91. package/dist/layout/legend/LegendText.js +22 -0
  92. package/dist/layout/legend/SizeSection.svelte +84 -0
  93. package/dist/layout/legend/SizeSection.svelte.d.ts +7 -0
  94. package/dist/layout/legend/SymbolSection.svelte +31 -0
  95. package/dist/layout/legend/SymbolSection.svelte.d.ts +8 -0
  96. package/dist/layout/margins/Box.d.ts +84 -0
  97. package/dist/layout/margins/Box.js +138 -0
  98. package/dist/layout/margins/Margins.d.ts +37 -0
  99. package/dist/layout/margins/Margins.js +71 -0
  100. package/dist/layout/margins/PlotMargins.svelte.d.ts +101 -0
  101. package/dist/layout/margins/PlotMargins.svelte.js +219 -0
  102. package/dist/layout/plot/Core.svelte +61 -0
  103. package/dist/layout/plot/Core.svelte.d.ts +41 -0
  104. package/dist/layout/plot/PanelRun.svelte +28 -0
  105. package/dist/{charts/heatmap/Chart.svelte.d.ts → layout/plot/PanelRun.svelte.d.ts} +11 -7
  106. package/dist/layout/plot/Plot.svelte +284 -0
  107. package/dist/layout/plot/Plot.svelte.d.ts +49 -0
  108. package/dist/layout/plot/PlotContext.d.ts +41 -0
  109. package/dist/layout/plot/PlotContext.js +46 -0
  110. package/dist/layout/plot/PublicPlotContext.d.ts +130 -0
  111. package/dist/layout/plot/PublicPlotContext.js +236 -0
  112. package/dist/layout/plot/Slice.d.ts +44 -0
  113. package/dist/layout/plot/Slice.js +98 -0
  114. package/dist/layout/plot/usePlot.d.ts +9 -0
  115. package/dist/layout/plot/usePlot.js +13 -0
  116. package/dist/layout/scales/ScalesLayout.svelte +241 -206
  117. package/dist/layout/scales/ScalesLayout.svelte.d.ts +2 -1
  118. package/dist/layout/scales/buildScale.d.ts +5 -22
  119. package/dist/layout/scales/buildScale.js +11 -34
  120. package/dist/layout/scales/niceDomain.d.ts +3 -3
  121. package/dist/layout/scales/niceDomain.js +4 -4
  122. package/dist/layout/styles/StylesLayout.svelte +65 -65
  123. package/dist/layout/styles/TileLayer.svelte +78 -76
  124. package/dist/layout/styles/TileLayer.svelte.d.ts +1 -1
  125. package/dist/layout/styles/ValueLabels.d.ts +97 -0
  126. package/dist/layout/styles/ValueLabels.js +237 -0
  127. package/dist/layout/timeline/Timeline.svelte +80 -74
  128. package/dist/layout/timeline/TimelineFrame.svelte +86 -0
  129. package/dist/layout/timeline/TimelineFrame.svelte.d.ts +16 -0
  130. package/dist/layout/timeline/TimelineLayout.svelte +114 -169
  131. package/dist/layout/timeline/TimelineLayout.svelte.d.ts +2 -0
  132. package/dist/layout/timeline/TimelinePlayer.svelte +195 -0
  133. package/dist/layout/timeline/TimelinePlayer.svelte.d.ts +7 -0
  134. package/dist/layout/timeline/TimelineRule.svelte +50 -0
  135. package/dist/layout/timeline/TimelineRule.svelte.d.ts +7 -0
  136. package/dist/layout/timeline/TimelineState.svelte.d.ts +82 -0
  137. package/dist/layout/timeline/TimelineState.svelte.js +226 -0
  138. package/dist/layout/timeline/TimelineSteps.d.ts +24 -0
  139. package/dist/layout/timeline/TimelineSteps.js +48 -0
  140. package/dist/layout/tooltip/Tooltip.svelte +82 -85
  141. package/dist/layout/tooltip/Tooltip.svelte.d.ts +43 -24
  142. package/dist/layout/tooltip/TooltipState.svelte.d.ts +61 -0
  143. package/dist/layout/tooltip/TooltipState.svelte.js +107 -0
  144. package/dist/markers/MarkerKinds.d.ts +173 -0
  145. package/dist/markers/MarkerKinds.js +51 -0
  146. package/dist/markers/area/AreaMarker.svelte +110 -0
  147. package/dist/markers/area/AreaMarker.svelte.d.ts +7 -0
  148. package/dist/markers/arrow/ArrowMarker.svelte +28 -0
  149. package/dist/markers/arrow/ArrowMarker.svelte.d.ts +7 -0
  150. package/dist/markers/{BarMarker.svelte → bar/BarMarker.svelte} +54 -52
  151. package/dist/markers/{BarMarker.svelte.d.ts → bar/BarMarker.svelte.d.ts} +1 -1
  152. package/dist/markers/bollinger/BollingerMarker.svelte +44 -0
  153. package/dist/markers/bollinger/BollingerMarker.svelte.d.ts +7 -0
  154. package/dist/markers/box/BoxMarker.svelte +143 -0
  155. package/dist/markers/box/BoxMarker.svelte.d.ts +7 -0
  156. package/dist/markers/brush/BrushMarker.svelte +32 -0
  157. package/dist/markers/brush/BrushMarker.svelte.d.ts +7 -0
  158. package/dist/markers/cell/CellMarker.svelte +27 -0
  159. package/dist/markers/{CellMarker.svelte.d.ts → cell/CellMarker.svelte.d.ts} +1 -1
  160. package/dist/markers/contour/ContourClipMarker.svelte +83 -0
  161. package/dist/markers/{ContourClipMarker.svelte.d.ts → contour/ContourClipMarker.svelte.d.ts} +1 -1
  162. package/dist/markers/contour/ContourMarker.svelte +28 -0
  163. package/dist/markers/{ContourMarker.svelte.d.ts → contour/ContourMarker.svelte.d.ts} +1 -1
  164. package/dist/markers/delaunay/DelaunayLinkMarker.svelte +26 -0
  165. package/dist/markers/delaunay/DelaunayLinkMarker.svelte.d.ts +7 -0
  166. package/dist/markers/delaunay/DelaunayMeshMarker.svelte +26 -0
  167. package/dist/markers/delaunay/DelaunayMeshMarker.svelte.d.ts +7 -0
  168. package/dist/markers/delta/Delta.d.ts +21 -0
  169. package/dist/markers/delta/Delta.js +60 -0
  170. package/dist/markers/delta/DeltaMarker.svelte +94 -0
  171. package/dist/markers/{DeltaMarker.svelte.d.ts → delta/DeltaMarker.svelte.d.ts} +2 -2
  172. package/dist/markers/density/DensityMarker.svelte +63 -0
  173. package/dist/markers/density/DensityMarker.svelte.d.ts +7 -0
  174. package/dist/markers/difference/DifferenceMarker.svelte +30 -0
  175. package/dist/markers/difference/DifferenceMarker.svelte.d.ts +7 -0
  176. package/dist/markers/dot/DotMarker.svelte +102 -0
  177. package/dist/markers/{DotMarker.svelte.d.ts → dot/DotMarker.svelte.d.ts} +5 -17
  178. package/dist/markers/geo/GeoFeaturesMarker.svelte +39 -0
  179. package/dist/markers/{GeoFeaturesMarker.svelte.d.ts → geo/GeoFeaturesMarker.svelte.d.ts} +1 -1
  180. package/dist/markers/geo/GeoHoverMarker.svelte +28 -0
  181. package/dist/markers/{GeoHoverMarker.svelte.d.ts → geo/GeoHoverMarker.svelte.d.ts} +2 -2
  182. package/dist/markers/geo/GraticuleMarker.svelte +18 -0
  183. package/dist/markers/{GraticuleMarker.svelte.d.ts → geo/GraticuleMarker.svelte.d.ts} +1 -1
  184. package/dist/markers/geo/SphereMarker.svelte +15 -0
  185. package/dist/markers/{SphereMarker.svelte.d.ts → geo/SphereMarker.svelte.d.ts} +1 -1
  186. package/dist/markers/hover/HoverMarker.svelte +252 -0
  187. package/dist/markers/{HoverMarker.svelte.d.ts → hover/HoverMarker.svelte.d.ts} +10 -10
  188. package/dist/markers/hull/HullMarker.svelte +25 -0
  189. package/dist/markers/hull/HullMarker.svelte.d.ts +7 -0
  190. package/dist/markers/image/ImageMarker.svelte +22 -0
  191. package/dist/markers/image/ImageMarker.svelte.d.ts +7 -0
  192. package/dist/markers/inset/InsetMarker.svelte +184 -150
  193. package/dist/markers/inset/InsetMarker.svelte.d.ts +4 -4
  194. package/dist/markers/inset/insetLayout.d.ts +1 -1
  195. package/dist/markers/inset/insetLayout.js +6 -2
  196. package/dist/markers/inset/insetProjection.d.ts +1 -1
  197. package/dist/markers/inset/insetProjection.js +3 -3
  198. package/dist/markers/line/LineMarker.svelte +30 -0
  199. package/dist/markers/{LineMarker.svelte.d.ts → line/LineMarker.svelte.d.ts} +1 -1
  200. package/dist/markers/link/LinkMarker.svelte +47 -0
  201. package/dist/markers/{LinkMarker.svelte.d.ts → link/LinkMarker.svelte.d.ts} +1 -1
  202. package/dist/markers/raster/RasterMarker.svelte +31 -0
  203. package/dist/markers/raster/RasterMarker.svelte.d.ts +7 -0
  204. package/dist/markers/rect/RectMarker.svelte +62 -0
  205. package/dist/markers/rect/RectMarker.svelte.d.ts +7 -0
  206. package/dist/markers/regression/RegressionMarker.svelte +60 -0
  207. package/dist/markers/regression/RegressionMarker.svelte.d.ts +7 -0
  208. package/dist/markers/rule/RuleMarker.svelte +47 -0
  209. package/dist/markers/{RuleMarker.svelte.d.ts → rule/RuleMarker.svelte.d.ts} +2 -5
  210. package/dist/markers/text/Declutter.d.ts +35 -0
  211. package/dist/markers/text/Declutter.js +157 -0
  212. package/dist/markers/text/TextMarker.svelte +244 -0
  213. package/dist/markers/{TextMarker.svelte.d.ts → text/TextMarker.svelte.d.ts} +5 -9
  214. package/dist/markers/tick/TickMarker.svelte +44 -0
  215. package/dist/markers/tick/TickMarker.svelte.d.ts +7 -0
  216. package/dist/markers/trail/TrailMarker.svelte +27 -0
  217. package/dist/markers/trail/TrailMarker.svelte.d.ts +7 -0
  218. package/dist/markers/utils/BandNudge.d.ts +22 -0
  219. package/dist/markers/utils/BandNudge.js +23 -0
  220. package/dist/markers/utils/MarkerChannels.d.ts +49 -0
  221. package/dist/markers/utils/MarkerChannels.js +97 -0
  222. package/dist/markers/vector/VectorMarker.svelte +29 -0
  223. package/dist/markers/{VectorMarker.svelte.d.ts → vector/VectorMarker.svelte.d.ts} +1 -1
  224. package/dist/markers/voronoi/VoronoiMarker.svelte +26 -0
  225. package/dist/markers/voronoi/VoronoiMarker.svelte.d.ts +7 -0
  226. package/dist/markers/voronoi/VoronoiMeshMarker.svelte +26 -0
  227. package/dist/markers/voronoi/VoronoiMeshMarker.svelte.d.ts +7 -0
  228. package/dist/markers/waffle/WaffleMarker.svelte +56 -0
  229. package/dist/markers/waffle/WaffleMarker.svelte.d.ts +7 -0
  230. package/dist/phases/Pipeline.d.ts +108 -0
  231. package/dist/phases/Pipeline.js +226 -0
  232. package/dist/phases/data/DataPhase.d.ts +25 -0
  233. package/dist/phases/data/DataPhase.js +82 -0
  234. package/dist/phases/data/PlotAxes.d.ts +75 -0
  235. package/dist/phases/data/PlotAxes.js +151 -0
  236. package/dist/phases/facet/FacetPhase.d.ts +52 -0
  237. package/dist/phases/facet/FacetPhase.js +114 -0
  238. package/dist/phases/hover/HoverPhase.d.ts +73 -0
  239. package/dist/phases/hover/HoverPhase.js +144 -0
  240. package/dist/phases/mapping/MappingPhase.d.ts +17 -0
  241. package/dist/phases/mapping/MappingPhase.js +42 -0
  242. package/dist/phases/markers/MarkersPhase.d.ts +14 -0
  243. package/dist/phases/markers/MarkersPhase.js +27 -0
  244. package/dist/phases/scales/MarkerAxisValues.d.ts +12 -0
  245. package/dist/phases/scales/MarkerAxisValues.js +34 -0
  246. package/dist/phases/scales/ScalesPhase.d.ts +31 -0
  247. package/dist/phases/scales/ScalesPhase.js +157 -0
  248. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +55 -0
  249. package/dist/phases/sharedScales/SharedScalesPhase.js +168 -0
  250. package/dist/phases/statistics/AuthorMarkers.d.ts +43 -0
  251. package/dist/phases/statistics/AuthorMarkers.js +69 -0
  252. package/dist/phases/statistics/MarkerGrouping.d.ts +48 -0
  253. package/dist/phases/statistics/MarkerGrouping.js +113 -0
  254. package/dist/phases/statistics/Statistics.d.ts +53 -0
  255. package/dist/phases/statistics/Statistics.js +156 -0
  256. package/dist/phases/statistics/StatisticsPhase.d.ts +18 -0
  257. package/dist/phases/statistics/StatisticsPhase.js +68 -0
  258. package/dist/phases/statistics/methods/BollingerStatistic.d.ts +9 -0
  259. package/dist/phases/statistics/methods/BollingerStatistic.js +18 -0
  260. package/dist/phases/statistics/methods/BoxStatistic.d.ts +9 -0
  261. package/dist/phases/statistics/methods/BoxStatistic.js +18 -0
  262. package/dist/phases/statistics/methods/Density2dStatistic.d.ts +9 -0
  263. package/dist/phases/statistics/methods/Density2dStatistic.js +18 -0
  264. package/dist/phases/statistics/methods/DensityStatistic.d.ts +12 -0
  265. package/dist/phases/statistics/methods/DensityStatistic.js +29 -0
  266. package/dist/phases/statistics/methods/MovingAverageStatistic.d.ts +12 -0
  267. package/dist/phases/statistics/methods/MovingAverageStatistic.js +30 -0
  268. package/dist/phases/statistics/methods/RegressionStatistic.d.ts +9 -0
  269. package/dist/phases/statistics/methods/RegressionStatistic.js +21 -0
  270. package/dist/phases/styles/StylesPhase.d.ts +13 -0
  271. package/dist/phases/styles/StylesPhase.js +17 -0
  272. package/dist/phases/tooltip/TooltipPhase.d.ts +12 -0
  273. package/dist/phases/tooltip/TooltipPhase.js +10 -0
  274. package/dist/phases/transforms/Transforms.d.ts +42 -0
  275. package/dist/phases/transforms/Transforms.js +130 -0
  276. package/dist/phases/transforms/TransformsPhase.d.ts +64 -0
  277. package/dist/phases/transforms/TransformsPhase.js +242 -0
  278. package/dist/phases/transforms/methods/AnchorBar.d.ts +13 -0
  279. package/dist/phases/transforms/methods/AnchorBar.js +21 -0
  280. package/dist/phases/transforms/methods/BinTransform.d.ts +7 -0
  281. package/dist/phases/transforms/methods/BinTransform.js +48 -0
  282. package/dist/phases/transforms/methods/DensityTransform.d.ts +6 -0
  283. package/dist/phases/transforms/methods/DensityTransform.js +13 -0
  284. package/dist/phases/transforms/methods/GroupTransform.d.ts +8 -0
  285. package/dist/phases/transforms/methods/GroupTransform.js +39 -0
  286. package/dist/phases/transforms/methods/NormalizeTransform.d.ts +10 -0
  287. package/dist/phases/transforms/methods/NormalizeTransform.js +30 -0
  288. package/dist/phases/transforms/methods/OrderTransform.d.ts +16 -0
  289. package/dist/phases/transforms/methods/OrderTransform.js +43 -0
  290. package/dist/phases/transforms/methods/PerGroup.d.ts +11 -0
  291. package/dist/phases/transforms/methods/PerGroup.js +39 -0
  292. package/dist/phases/transforms/methods/PositionTransform.d.ts +15 -0
  293. package/dist/phases/transforms/methods/PositionTransform.js +74 -0
  294. package/dist/phases/transforms/methods/StackTransform.d.ts +8 -0
  295. package/dist/phases/transforms/methods/StackTransform.js +29 -0
  296. package/dist/phases/transforms/methods/WindowTransform.d.ts +8 -0
  297. package/dist/phases/transforms/methods/WindowTransform.js +23 -0
  298. package/dist/plots/area/Plot.svelte +42 -0
  299. package/dist/plots/{heatmap/ValueLabels.svelte.d.ts → area/Plot.svelte.d.ts} +8 -16
  300. package/dist/plots/area/defaults.d.ts +4 -0
  301. package/dist/plots/area/defaults.js +21 -0
  302. package/dist/plots/area/markers.d.ts +14 -0
  303. package/dist/plots/area/markers.js +40 -0
  304. package/dist/plots/bar/Plot.svelte +33 -438
  305. package/dist/plots/bar/Plot.svelte.d.ts +5 -8
  306. package/dist/plots/bar/defaults.d.ts +9 -0
  307. package/dist/plots/bar/defaults.js +92 -0
  308. package/dist/plots/bar/markers.d.ts +45 -0
  309. package/dist/plots/bar/markers.js +232 -0
  310. package/dist/plots/geo/Core.svelte +151 -0
  311. package/dist/plots/geo/Core.svelte.d.ts +25 -0
  312. package/dist/plots/geo/Plot.svelte +103 -324
  313. package/dist/plots/geo/Plot.svelte.d.ts +5 -9
  314. package/dist/plots/geo/defaults.d.ts +4 -0
  315. package/dist/plots/geo/defaults.js +16 -0
  316. package/dist/plots/geo/features.svelte.d.ts +5 -0
  317. package/dist/plots/geo/features.svelte.js +44 -0
  318. package/dist/plots/geo/phases/data.d.ts +6 -0
  319. package/dist/plots/geo/phases/data.js +26 -0
  320. package/dist/plots/geo/phases/hover.d.ts +9 -0
  321. package/dist/plots/geo/phases/hover.js +45 -0
  322. package/dist/plots/geo/phases/markers.d.ts +9 -0
  323. package/dist/plots/geo/phases/markers.js +76 -0
  324. package/dist/plots/geo/phases/scales.d.ts +10 -0
  325. package/dist/plots/geo/phases/scales.js +85 -0
  326. package/dist/plots/geo/phases/tooltip.d.ts +3 -0
  327. package/dist/plots/geo/phases/tooltip.js +5 -0
  328. package/dist/plots/geo/slices.d.ts +18 -0
  329. package/dist/plots/geo/slices.js +56 -0
  330. package/dist/plots/heatmap/Plot.svelte +55 -249
  331. package/dist/plots/heatmap/Plot.svelte.d.ts +5 -8
  332. package/dist/plots/heatmap/defaults.d.ts +11 -0
  333. package/dist/plots/heatmap/defaults.js +91 -0
  334. package/dist/plots/heatmap/markers.d.ts +17 -0
  335. package/dist/plots/heatmap/markers.js +141 -0
  336. package/dist/plots/histogram/Plot.svelte +45 -0
  337. package/dist/plots/histogram/Plot.svelte.d.ts +26 -0
  338. package/dist/plots/histogram/defaults.d.ts +9 -0
  339. package/dist/plots/histogram/defaults.js +87 -0
  340. package/dist/plots/histogram/markers.d.ts +18 -0
  341. package/dist/plots/histogram/markers.js +89 -0
  342. package/dist/plots/line/Plot.svelte +37 -268
  343. package/dist/plots/line/Plot.svelte.d.ts +3 -7
  344. package/dist/plots/line/defaults.d.ts +4 -0
  345. package/dist/plots/line/defaults.js +29 -0
  346. package/dist/plots/line/markers.d.ts +49 -0
  347. package/dist/plots/line/markers.js +200 -0
  348. package/dist/plots/pyramid/Plot.svelte +34 -362
  349. package/dist/plots/pyramid/Plot.svelte.d.ts +5 -8
  350. package/dist/plots/pyramid/defaults.d.ts +13 -0
  351. package/dist/plots/pyramid/defaults.js +86 -0
  352. package/dist/plots/pyramid/markers.d.ts +21 -0
  353. package/dist/plots/pyramid/markers.js +159 -0
  354. package/dist/plots/scatter/Plot.svelte +34 -288
  355. package/dist/plots/scatter/Plot.svelte.d.ts +5 -8
  356. package/dist/plots/scatter/defaults.d.ts +4 -0
  357. package/dist/plots/scatter/defaults.js +79 -0
  358. package/dist/plots/scatter/markers.d.ts +19 -0
  359. package/dist/plots/scatter/markers.js +128 -0
  360. package/dist/plots/utils/ChannelName.d.ts +9 -0
  361. package/dist/plots/utils/ChannelName.js +14 -0
  362. package/dist/plots/utils/accessors.d.ts +1 -1
  363. package/dist/plots/utils/accessors.js +4 -2
  364. package/dist/plots/utils/gaps.d.ts +14 -19
  365. package/dist/plots/utils/gaps.js +38 -18
  366. package/dist/plots/utils/geoAccessors.d.ts +8 -8
  367. package/dist/plots/utils/geoAccessors.js +16 -12
  368. package/dist/plots/utils/geoSegments.d.ts +24 -9
  369. package/dist/plots/utils/geoSegments.js +31 -11
  370. package/dist/plots/utils/segments.d.ts +5 -16
  371. package/dist/plots/utils/segments.js +40 -52
  372. package/dist/plots/utils/tiles.d.ts +9 -9
  373. package/dist/plots/utils/tiles.js +35 -25
  374. package/dist/plots/utils/topojson.d.ts +1 -1
  375. package/dist/plots/utils/topojson.js +3 -3
  376. package/dist/stores/device.js +2 -4
  377. package/dist/types/configuration/styling.d.ts +158 -27
  378. package/dist/types/layout/box.d.ts +24 -0
  379. package/dist/types/layout/composer.d.ts +36 -0
  380. package/dist/types/layout/coordinates.d.ts +14 -14
  381. package/dist/types/layout/facet.d.ts +44 -22
  382. package/dist/types/layout/figure.d.ts +7 -0
  383. package/dist/types/layout/geometry.d.ts +6 -2
  384. package/dist/types/layout/grid.d.ts +66 -0
  385. package/dist/types/layout/hover.d.ts +48 -0
  386. package/dist/types/layout/legend.d.ts +258 -54
  387. package/dist/types/layout/mapping.d.ts +68 -0
  388. package/dist/types/layout/plot.d.ts +41 -0
  389. package/dist/types/layout/scales.d.ts +92 -24
  390. package/dist/types/layout/scales.js +19 -1
  391. package/dist/types/layout/statistics/bollinger.d.ts +18 -0
  392. package/dist/types/layout/statistics/box.d.ts +8 -0
  393. package/dist/types/layout/statistics/box.js +1 -0
  394. package/dist/types/layout/statistics/density.d.ts +27 -0
  395. package/dist/types/layout/statistics/density.js +1 -0
  396. package/dist/types/layout/statistics/index.d.ts +46 -0
  397. package/dist/types/layout/statistics/index.js +1 -0
  398. package/dist/types/layout/statistics/movingAverage.d.ts +12 -0
  399. package/dist/types/layout/statistics/movingAverage.js +1 -0
  400. package/dist/types/layout/statistics/regression.d.ts +20 -0
  401. package/dist/types/layout/statistics/regression.js +1 -0
  402. package/dist/types/layout/styles.d.ts +24 -35
  403. package/dist/types/layout/timeline.d.ts +51 -4
  404. package/dist/types/layout/tooltip.d.ts +7 -85
  405. package/dist/types/markers/all.d.ts +3 -4
  406. package/dist/types/markers/axis/area.d.ts +12 -0
  407. package/dist/types/markers/axis/area.js +1 -0
  408. package/dist/types/markers/axis/arrow.d.ts +15 -0
  409. package/dist/types/markers/axis/arrow.js +1 -0
  410. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +29 -0
  411. package/dist/types/markers/axis/axisBasedMarkersConfig.js +1 -0
  412. package/dist/types/markers/axis/bar.d.ts +18 -0
  413. package/dist/types/markers/axis/bar.js +1 -0
  414. package/dist/types/markers/axis/bollinger.d.ts +6 -0
  415. package/dist/types/markers/axis/bollinger.js +1 -0
  416. package/dist/types/markers/axis/box.d.ts +14 -0
  417. package/dist/types/markers/axis/box.js +1 -0
  418. package/dist/types/markers/axis/brush.d.ts +28 -0
  419. package/dist/types/markers/axis/brush.js +1 -0
  420. package/dist/types/markers/axis/cell.d.ts +9 -0
  421. package/dist/types/markers/axis/cell.js +1 -0
  422. package/dist/types/markers/axis/component.d.ts +9 -0
  423. package/dist/types/markers/axis/component.js +1 -0
  424. package/dist/types/markers/axis/curveName.d.ts +2 -0
  425. package/dist/types/markers/axis/curveName.js +1 -0
  426. package/dist/types/markers/axis/delaunayLink.d.ts +7 -0
  427. package/dist/types/markers/axis/delaunayLink.js +1 -0
  428. package/dist/types/markers/axis/delaunayMesh.d.ts +7 -0
  429. package/dist/types/markers/axis/delaunayMesh.js +1 -0
  430. package/dist/types/markers/axis/delta.d.ts +27 -0
  431. package/dist/types/markers/axis/delta.js +1 -0
  432. package/dist/types/markers/axis/density.d.ts +12 -0
  433. package/dist/types/markers/axis/density.js +1 -0
  434. package/dist/types/markers/axis/difference.d.ts +12 -0
  435. package/dist/types/markers/axis/difference.js +1 -0
  436. package/dist/types/markers/axis/hover.d.ts +21 -0
  437. package/dist/types/markers/axis/hover.js +1 -0
  438. package/dist/types/markers/axis/hull.d.ts +7 -0
  439. package/dist/types/markers/axis/hull.js +1 -0
  440. package/dist/types/markers/axis/image.d.ts +12 -0
  441. package/dist/types/markers/axis/image.js +1 -0
  442. package/dist/types/markers/axis/line.d.ts +7 -0
  443. package/dist/types/markers/axis/line.js +1 -0
  444. package/dist/types/markers/axis/raster.d.ts +18 -0
  445. package/dist/types/markers/axis/raster.js +1 -0
  446. package/dist/types/markers/axis/rect.d.ts +15 -0
  447. package/dist/types/markers/axis/rect.js +1 -0
  448. package/dist/types/markers/axis/regression.d.ts +6 -0
  449. package/dist/types/markers/axis/regression.js +1 -0
  450. package/dist/types/markers/axis/rule.d.ts +15 -0
  451. package/dist/types/markers/axis/rule.js +1 -0
  452. package/dist/types/markers/axis/tick.d.ts +8 -0
  453. package/dist/types/markers/axis/tick.js +1 -0
  454. package/dist/types/markers/axis/trail.d.ts +14 -0
  455. package/dist/types/markers/axis/trail.js +1 -0
  456. package/dist/types/markers/axis/voronoi.d.ts +7 -0
  457. package/dist/types/markers/axis/voronoi.js +1 -0
  458. package/dist/types/markers/axis/voronoiMesh.d.ts +7 -0
  459. package/dist/types/markers/axis/voronoiMesh.js +1 -0
  460. package/dist/types/markers/axis/waffle.d.ts +13 -0
  461. package/dist/types/markers/axis/waffle.js +1 -0
  462. package/dist/types/markers/basic/basicMarkersConfig.d.ts +4 -0
  463. package/dist/types/markers/basic/basicMarkersConfig.js +1 -0
  464. package/dist/types/markers/basic/dot.d.ts +9 -0
  465. package/dist/types/markers/basic/dot.js +1 -0
  466. package/dist/types/markers/basic/text.d.ts +60 -0
  467. package/dist/types/markers/basic/text.js +1 -0
  468. package/dist/types/markers/basic.d.ts +4 -0
  469. package/dist/types/markers/basic.js +1 -0
  470. package/dist/types/markers/channels/commonMarkerConfig.d.ts +26 -0
  471. package/dist/types/markers/channels/commonMarkerConfig.js +1 -0
  472. package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +6 -0
  473. package/dist/types/markers/channels/commonMarkerConfigWithArea.js +1 -0
  474. package/dist/types/markers/channels/commonMarkerConfigWithColor.d.ts +5 -0
  475. package/dist/types/markers/channels/commonMarkerConfigWithColor.js +1 -0
  476. package/dist/types/markers/channels/commonMarkerConfigWithInterval.d.ts +9 -0
  477. package/dist/types/markers/channels/commonMarkerConfigWithInterval.js +1 -0
  478. package/dist/types/markers/channels/commonMarkerConfigWithRadius.d.ts +5 -0
  479. package/dist/types/markers/channels/commonMarkerConfigWithRadius.js +1 -0
  480. package/dist/types/markers/channels/commonMarkerConfigWithSymbol.d.ts +5 -0
  481. package/dist/types/markers/channels/commonMarkerConfigWithSymbol.js +1 -0
  482. package/dist/types/markers/channels/commonMarkerConfigWithWeight.d.ts +5 -0
  483. package/dist/types/markers/channels/commonMarkerConfigWithWeight.js +1 -0
  484. package/dist/types/markers/common.d.ts +30 -103
  485. package/dist/types/markers/common.js +29 -1
  486. package/dist/types/markers/geo/contour.d.ts +27 -0
  487. package/dist/types/markers/geo/contour.js +1 -0
  488. package/dist/types/markers/geo/features.d.ts +12 -0
  489. package/dist/types/markers/geo/features.js +1 -0
  490. package/dist/types/markers/geo/geoComponent.d.ts +7 -0
  491. package/dist/types/markers/geo/geoComponent.js +1 -0
  492. package/dist/types/markers/geo/geoHover.d.ts +6 -0
  493. package/dist/types/markers/geo/geoHover.js +1 -0
  494. package/dist/types/markers/geo/geoMarkersConfig.d.ts +11 -0
  495. package/dist/types/markers/geo/geoMarkersConfig.js +1 -0
  496. package/dist/types/markers/geo/graticule.d.ts +11 -0
  497. package/dist/types/markers/geo/graticule.js +1 -0
  498. package/dist/types/markers/geo/inset.d.ts +50 -0
  499. package/dist/types/markers/geo/inset.js +1 -0
  500. package/dist/types/markers/geo/link.d.ts +13 -0
  501. package/dist/types/markers/geo/link.js +1 -0
  502. package/dist/types/markers/geo/sphere.d.ts +11 -0
  503. package/dist/types/markers/geo/sphere.js +1 -0
  504. package/dist/types/markers/geo/vector.d.ts +17 -0
  505. package/dist/types/markers/geo/vector.js +1 -0
  506. package/dist/types/markers/geo.d.ts +10 -212
  507. package/dist/types/markers/geo.js +10 -1
  508. package/dist/types/markers/traits.d.ts +22 -0
  509. package/dist/types/markers/traits.js +1 -0
  510. package/dist/types/misc/easing.js +1 -0
  511. package/dist/types/misc/viewport.js +1 -0
  512. package/dist/types/phases/data/axes.d.ts +18 -0
  513. package/dist/types/phases/data/axes.js +1 -0
  514. package/dist/types/phases/data/phase.d.ts +26 -0
  515. package/dist/types/phases/data/phase.js +2 -0
  516. package/dist/types/phases/facet/phase.d.ts +18 -0
  517. package/dist/types/phases/facet/phase.js +1 -0
  518. package/dist/types/phases/hover/phase.d.ts +34 -0
  519. package/dist/types/phases/hover/phase.js +1 -0
  520. package/dist/types/phases/index.d.ts +14 -0
  521. package/dist/types/phases/index.js +1 -0
  522. package/dist/types/phases/kind.d.ts +59 -0
  523. package/dist/types/phases/kind.js +1 -0
  524. package/dist/types/phases/mapping/phase.d.ts +5 -0
  525. package/dist/types/phases/mapping/phase.js +1 -0
  526. package/dist/types/phases/markers/phase.d.ts +13 -0
  527. package/dist/types/phases/markers/phase.js +1 -0
  528. package/dist/types/phases/pipeline.d.ts +10 -0
  529. package/dist/types/phases/pipeline.js +1 -0
  530. package/dist/types/phases/scales/phase.d.ts +26 -0
  531. package/dist/types/phases/scales/phase.js +1 -0
  532. package/dist/types/phases/sharedScales/phase.d.ts +12 -0
  533. package/dist/types/phases/sharedScales/phase.js +1 -0
  534. package/dist/types/phases/stage.d.ts +12 -0
  535. package/dist/types/phases/stage.js +1 -0
  536. package/dist/types/phases/state.d.ts +73 -0
  537. package/dist/types/phases/state.js +1 -0
  538. package/dist/types/phases/statistics/phase.d.ts +41 -0
  539. package/dist/types/phases/statistics/phase.js +1 -0
  540. package/dist/types/phases/statistics/source.d.ts +20 -0
  541. package/dist/types/phases/statistics/source.js +7 -0
  542. package/dist/types/phases/styles/phase.d.ts +24 -0
  543. package/dist/types/phases/styles/phase.js +1 -0
  544. package/dist/types/phases/transforms/adapter.d.ts +27 -0
  545. package/dist/types/phases/transforms/adapter.js +1 -0
  546. package/dist/types/phases/transforms/phase.d.ts +40 -0
  547. package/dist/types/phases/transforms/phase.js +1 -0
  548. package/dist/types/plots/area/props.d.ts +10 -0
  549. package/dist/types/plots/area/props.js +1 -0
  550. package/dist/types/plots/area/state.d.ts +6 -0
  551. package/dist/types/plots/area/state.js +1 -0
  552. package/dist/types/plots/bar/props.d.ts +10 -0
  553. package/dist/types/plots/bar/props.js +1 -0
  554. package/dist/types/plots/bar/state.d.ts +6 -0
  555. package/dist/types/plots/bar/state.js +1 -0
  556. package/dist/types/plots/camera.d.ts +7 -17
  557. package/dist/types/plots/constants.d.ts +16 -8
  558. package/dist/types/plots/data/common.d.ts +25 -17
  559. package/dist/types/plots/data/geo.d.ts +26 -12
  560. package/dist/types/plots/gaps.d.ts +19 -38
  561. package/dist/types/plots/geo/props.d.ts +23 -0
  562. package/dist/types/plots/geo/props.js +1 -0
  563. package/dist/types/plots/geo/state.d.ts +82 -0
  564. package/dist/types/plots/geo/state.js +1 -0
  565. package/dist/types/plots/heatmap/props.d.ts +10 -0
  566. package/dist/types/plots/heatmap/props.js +1 -0
  567. package/dist/types/plots/heatmap/state.d.ts +28 -0
  568. package/dist/types/plots/heatmap/state.js +1 -0
  569. package/dist/types/plots/histogram/props.d.ts +18 -0
  570. package/dist/types/plots/histogram/props.js +1 -0
  571. package/dist/types/plots/histogram/state.d.ts +6 -0
  572. package/dist/types/plots/histogram/state.js +1 -0
  573. package/dist/types/plots/line/props.d.ts +10 -0
  574. package/dist/types/plots/line/props.js +1 -0
  575. package/dist/types/plots/line/state.d.ts +9 -0
  576. package/dist/types/plots/line/state.js +1 -0
  577. package/dist/types/plots/props.d.ts +143 -35
  578. package/dist/types/plots/pyramid/props.d.ts +10 -0
  579. package/dist/types/plots/pyramid/props.js +1 -0
  580. package/dist/types/plots/pyramid/state.d.ts +16 -0
  581. package/dist/types/plots/pyramid/state.js +1 -0
  582. package/dist/types/plots/scatter/props.d.ts +10 -0
  583. package/dist/types/plots/scatter/props.js +1 -0
  584. package/dist/types/plots/scatter/state.d.ts +6 -0
  585. package/dist/types/plots/scatter/state.js +1 -0
  586. package/dist/types/plots/segments/common.d.ts +1 -1
  587. package/dist/types/plots/segments/config.d.ts +12 -6
  588. package/dist/types/plots/styling.d.ts +5 -5
  589. package/dist/types/transforms/bin.d.ts +84 -0
  590. package/dist/types/transforms/bin.js +28 -0
  591. package/dist/types/transforms/bollinger.d.ts +21 -0
  592. package/dist/types/transforms/bollinger.js +1 -0
  593. package/dist/types/transforms/common.d.ts +29 -0
  594. package/dist/types/transforms/common.js +16 -0
  595. package/dist/types/transforms/density.d.ts +45 -0
  596. package/dist/types/transforms/density.js +10 -0
  597. package/dist/types/transforms/filter.d.ts +12 -0
  598. package/dist/types/transforms/filter.js +14 -0
  599. package/dist/types/transforms/group.d.ts +70 -0
  600. package/dist/types/transforms/group.js +8 -0
  601. package/dist/types/transforms/index.d.ts +36 -0
  602. package/dist/types/transforms/index.js +1 -0
  603. package/dist/types/transforms/interval.d.ts +21 -0
  604. package/dist/types/transforms/interval.js +14 -0
  605. package/dist/types/transforms/jitter.d.ts +34 -0
  606. package/dist/types/transforms/jitter.js +1 -0
  607. package/dist/types/transforms/map.d.ts +24 -0
  608. package/dist/types/transforms/map.js +1 -0
  609. package/dist/types/transforms/normalize.d.ts +36 -0
  610. package/dist/types/transforms/normalize.js +1 -0
  611. package/dist/types/transforms/select.d.ts +15 -0
  612. package/dist/types/transforms/select.js +1 -0
  613. package/dist/types/transforms/shift.d.ts +20 -0
  614. package/dist/types/transforms/shift.js +1 -0
  615. package/dist/types/transforms/sort.d.ts +31 -0
  616. package/dist/types/transforms/sort.js +14 -0
  617. package/dist/types/transforms/stack.d.ts +64 -0
  618. package/dist/types/transforms/stack.js +12 -0
  619. package/dist/types/transforms/window.d.ts +29 -0
  620. package/dist/types/transforms/window.js +1 -0
  621. package/dist/utils/ContinuousDomain.d.ts +12 -0
  622. package/dist/utils/ContinuousDomain.js +19 -0
  623. package/dist/utils/Interpolation.d.ts +26 -0
  624. package/dist/utils/Interpolation.js +65 -0
  625. package/dist/utils/{color.d.ts → color/contrast.d.ts} +0 -5
  626. package/dist/utils/color/contrast.js +40 -0
  627. package/dist/utils/color/cssColor.d.ts +4 -0
  628. package/dist/utils/color/cssColor.js +77 -0
  629. package/dist/utils/color/index.d.ts +3 -0
  630. package/dist/utils/color/index.js +3 -0
  631. package/dist/utils/color/ramp.d.ts +17 -0
  632. package/dist/utils/color/ramp.js +110 -0
  633. package/dist/utils/grouping.d.ts +9 -5
  634. package/dist/utils/grouping.js +19 -10
  635. package/dist/utils/merge.d.ts +7 -0
  636. package/dist/utils/merge.js +17 -0
  637. package/dist/utils/opacity.d.ts +9 -0
  638. package/dist/utils/opacity.js +38 -0
  639. package/dist/utils/symbol.d.ts +31 -0
  640. package/dist/utils/symbol.js +92 -0
  641. package/docs/architecture.md +137 -0
  642. package/docs/chrome.md +68 -0
  643. package/docs/composer.md +53 -0
  644. package/docs/concepts.md +99 -0
  645. package/docs/development.md +94 -0
  646. package/docs/facets.md +69 -0
  647. package/docs/geo.md +151 -0
  648. package/docs/getting-started.md +79 -0
  649. package/docs/legend.md +106 -0
  650. package/docs/markers.md +106 -0
  651. package/docs/plots.md +158 -0
  652. package/docs/scales.md +78 -0
  653. package/docs/state.md +71 -0
  654. package/docs/styles-and-segments.md +215 -0
  655. package/docs/theming.md +215 -0
  656. package/docs/timeline.md +94 -0
  657. package/docs/tooltip-and-hover.md +80 -0
  658. package/docs/transforms-and-statistics.md +88 -0
  659. package/examples/BarValues.svelte +14 -0
  660. package/examples/CustomTooltip.svelte +37 -0
  661. package/examples/Facets.svelte +15 -0
  662. package/examples/LegendReader.svelte +8 -0
  663. package/examples/LegendToggle.svelte +25 -0
  664. package/examples/ResponsiveLine.svelte +37 -0
  665. package/examples/Segments.svelte +17 -0
  666. package/examples/TimelinePlayer.svelte +20 -0
  667. package/examples/Tooltip.svelte +19 -0
  668. package/examples/TooltipCard.svelte +86 -0
  669. package/examples/data.ts +12 -0
  670. package/llms-full.txt +114 -0
  671. package/llms.txt +49 -0
  672. package/package.json +41 -5
  673. package/dist/charts/BaseChart.svelte +0 -149
  674. package/dist/charts/BaseChart.svelte.d.ts +0 -47
  675. package/dist/charts/bar/Chart.svelte +0 -110
  676. package/dist/charts/bar/Chart.svelte.d.ts +0 -26
  677. package/dist/charts/container/ChartContainer.svelte +0 -137
  678. package/dist/charts/container/ChartContainer.svelte.d.ts +0 -16
  679. package/dist/charts/heatmap/Chart.svelte +0 -114
  680. package/dist/charts/line/Chart.svelte +0 -112
  681. package/dist/charts/line/Chart.svelte.d.ts +0 -26
  682. package/dist/charts/pyramid/Chart.svelte +0 -134
  683. package/dist/charts/pyramid/Chart.svelte.d.ts +0 -30
  684. package/dist/charts/scatter/Chart.svelte +0 -95
  685. package/dist/charts/scatter/Chart.svelte.d.ts +0 -28
  686. package/dist/layout/coordinates/margins.d.ts +0 -16
  687. package/dist/layout/coordinates/margins.js +0 -11
  688. package/dist/layout/legend/interaction.svelte.d.ts +0 -15
  689. package/dist/layout/legend/interaction.svelte.js +0 -32
  690. package/dist/layout/plot/BasePlotLayout.svelte +0 -332
  691. package/dist/layout/plot/BasePlotLayout.svelte.d.ts +0 -122
  692. package/dist/layout/plot/margins.d.ts +0 -18
  693. package/dist/layout/plot/margins.js +0 -15
  694. package/dist/layout/plot/measureText.d.ts +0 -4
  695. package/dist/layout/plot/measureText.js +0 -19
  696. package/dist/layout/tooltip/TooltipLayout.svelte +0 -51
  697. package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +0 -45
  698. package/dist/layout/tooltip/controller.svelte.d.ts +0 -61
  699. package/dist/layout/tooltip/controller.svelte.js +0 -173
  700. package/dist/layout/tooltip/hover.svelte.d.ts +0 -7
  701. package/dist/layout/tooltip/hover.svelte.js +0 -28
  702. package/dist/layout/tooltip/resolveTooltipPlacement.d.ts +0 -24
  703. package/dist/layout/tooltip/resolveTooltipPlacement.js +0 -49
  704. package/dist/layout/tooltip/utils.d.ts +0 -49
  705. package/dist/layout/tooltip/utils.js +0 -82
  706. package/dist/markers/CellMarker.svelte +0 -21
  707. package/dist/markers/ContourClipMarker.svelte +0 -77
  708. package/dist/markers/ContourMarker.svelte +0 -28
  709. package/dist/markers/DeltaMarker.svelte +0 -109
  710. package/dist/markers/DotMarker.svelte +0 -70
  711. package/dist/markers/GeoFeaturesMarker.svelte +0 -19
  712. package/dist/markers/GeoHoverMarker.svelte +0 -25
  713. package/dist/markers/GraticuleMarker.svelte +0 -18
  714. package/dist/markers/HoverMarker.svelte +0 -212
  715. package/dist/markers/LineMarker.svelte +0 -19
  716. package/dist/markers/LinkMarker.svelte +0 -42
  717. package/dist/markers/PeakMarker.svelte +0 -80
  718. package/dist/markers/PeakMarker.svelte.d.ts +0 -13
  719. package/dist/markers/RuleMarker.svelte +0 -24
  720. package/dist/markers/SphereMarker.svelte +0 -15
  721. package/dist/markers/TextMarker.svelte +0 -62
  722. package/dist/markers/VectorMarker.svelte +0 -20
  723. package/dist/plots/bar/ValueLabels.svelte +0 -149
  724. package/dist/plots/bar/ValueLabels.svelte.d.ts +0 -58
  725. package/dist/plots/bar/buildBarMarkers.d.ts +0 -27
  726. package/dist/plots/bar/buildBarMarkers.js +0 -151
  727. package/dist/plots/bar/hoverPoints.d.ts +0 -15
  728. package/dist/plots/bar/hoverPoints.js +0 -37
  729. package/dist/plots/bar/layout.svelte.d.ts +0 -42
  730. package/dist/plots/bar/layout.svelte.js +0 -182
  731. package/dist/plots/geo/buildGeoMarkers.d.ts +0 -33
  732. package/dist/plots/geo/buildGeoMarkers.js +0 -47
  733. package/dist/plots/heatmap/ValueLabels.svelte +0 -56
  734. package/dist/plots/heatmap/buildCellMarkers.d.ts +0 -21
  735. package/dist/plots/heatmap/buildCellMarkers.js +0 -25
  736. package/dist/plots/line/ValueLabels.svelte +0 -269
  737. package/dist/plots/line/ValueLabels.svelte.d.ts +0 -52
  738. package/dist/plots/line/buildGapMarkers.d.ts +0 -28
  739. package/dist/plots/line/buildGapMarkers.js +0 -74
  740. package/dist/plots/line/buildLineMarkers.d.ts +0 -16
  741. package/dist/plots/line/buildLineMarkers.js +0 -56
  742. package/dist/plots/line/valueLabelMargin.d.ts +0 -19
  743. package/dist/plots/line/valueLabelMargin.js +0 -65
  744. package/dist/plots/pyramid/ValueLabels.svelte +0 -139
  745. package/dist/plots/pyramid/ValueLabels.svelte.d.ts +0 -56
  746. package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +0 -26
  747. package/dist/plots/pyramid/buildPyramidBarMarkers.js +0 -72
  748. package/dist/plots/scatter/ValueLabels.svelte +0 -163
  749. package/dist/plots/scatter/ValueLabels.svelte.d.ts +0 -52
  750. package/dist/plots/scatter/buildScatterMarkers.d.ts +0 -12
  751. package/dist/plots/scatter/buildScatterMarkers.js +0 -36
  752. package/dist/plots/scatter/resolveRadiusPaddedDomain.d.ts +0 -10
  753. package/dist/plots/scatter/resolveRadiusPaddedDomain.js +0 -23
  754. package/dist/plots/utils/categoricalAxisMargin.d.ts +0 -14
  755. package/dist/plots/utils/categoricalAxisMargin.js +0 -20
  756. package/dist/plots/utils/declutter.d.ts +0 -120
  757. package/dist/plots/utils/declutter.js +0 -240
  758. package/dist/plots/utils/labelOverflow.svelte.d.ts +0 -107
  759. package/dist/plots/utils/labelOverflow.svelte.js +0 -257
  760. package/dist/plots/utils/legendDisabled.d.ts +0 -27
  761. package/dist/plots/utils/legendDisabled.js +0 -68
  762. package/dist/plots/utils/valueLabelMargin.d.ts +0 -67
  763. package/dist/plots/utils/valueLabelMargin.js +0 -60
  764. package/dist/types/charts/common.d.ts +0 -22
  765. package/dist/types/charts/props.d.ts +0 -50
  766. package/dist/types/markers/base.d.ts +0 -45
  767. package/dist/types/markers/line.d.ts +0 -34
  768. package/dist/types/markers/props.d.ts +0 -11
  769. package/dist/types/plots/data/scatter.d.ts +0 -13
  770. package/dist/utils/color.js +0 -141
  771. package/dist/utils/delta.d.ts +0 -12
  772. package/dist/utils/delta.js +0 -69
  773. package/dist/utils/edgeAwareAnchor.d.ts +0 -34
  774. package/dist/utils/edgeAwareAnchor.js +0 -60
  775. package/dist/utils/interpolate.d.ts +0 -31
  776. package/dist/utils/interpolate.js +0 -71
  777. /package/dist/types/{charts/common.js → layout/box.js} +0 -0
  778. /package/dist/types/{charts/interpolate.js → layout/composer.js} +0 -0
  779. /package/dist/types/{charts/props.js → layout/figure.js} +0 -0
  780. /package/dist/types/{markers/base.js → layout/grid.js} +0 -0
  781. /package/dist/types/{markers/line.js → layout/hover.js} +0 -0
  782. /package/dist/types/{markers/props.js → layout/mapping.js} +0 -0
  783. /package/dist/types/{plots/data/scatter.js → layout/plot.js} +0 -0
  784. /package/dist/types/{viewport.js → layout/statistics/bollinger.js} +0 -0
  785. /package/dist/types/{charts/interpolate.d.ts → misc/easing.d.ts} +0 -0
  786. /package/dist/types/{viewport.d.ts → misc/viewport.d.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ import type { LegendItemsLayout, SymbolLegendSection } from '../../types/layout/legend';
2
+ type $$ComponentProps = {
3
+ section: SymbolLegendSection;
4
+ defaultItemsLayout?: LegendItemsLayout;
5
+ };
6
+ declare const SymbolSection: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type SymbolSection = ReturnType<typeof SymbolSection>;
8
+ export default SymbolSection;
@@ -0,0 +1,84 @@
1
+ import { Margins } from './Margins';
2
+ import type { PlotStylesConfig } from '../../types/configuration/styling';
3
+ import type { BoxAnchors, BoxFlip } from '../../types/layout/box';
4
+ /**
5
+ * A rectangle in pixels: where something sits (`x`, `y`, its top-left) and
6
+ * how big it is. Anything a plot lays out - a label, a tooltip, the plot's
7
+ * own area - can be one, measured from the DOM ({@link Box.of}) or off it
8
+ * ({@link Box.ofText}). Immutable: every operation returns a new one.
9
+ */
10
+ export declare class Box {
11
+ #private;
12
+ readonly x: number;
13
+ readonly y: number;
14
+ readonly width: number;
15
+ readonly height: number;
16
+ constructor(x: number, y: number, width: number, height: number);
17
+ /** A box of `width` x `height` at the origin. */
18
+ static size(width: number, height: number): Box;
19
+ /** A box from any rect-like reading, e.g. an element's `getBBox()`. */
20
+ static of(rect: {
21
+ x: number;
22
+ y: number;
23
+ width: number;
24
+ height: number;
25
+ }): Box;
26
+ /**
27
+ * The box one line of `text` takes at `fontSize` in the configuration's
28
+ * font (`'inherit'` measures as sans-serif), measured off the DOM, on a
29
+ * canvas. Empty during SSR.
30
+ */
31
+ static ofText(text: string, fontSize: number, cfg: Pick<PlotStylesConfig, 'font'>): Box;
32
+ get left(): number;
33
+ get top(): number;
34
+ get right(): number;
35
+ get bottom(): number;
36
+ /** Whether the box has no area. */
37
+ get empty(): boolean;
38
+ /** How far this box reaches out from its origin (the point it sits around), in whole pixels. */
39
+ get reach(): Margins;
40
+ /** This box grown by `px` on every side. */
41
+ pad(px: number): Box;
42
+ /**
43
+ * This box placed beside `point` on `anchor`'s side per axis: `gap` px
44
+ * before or after it, or centred on it.
45
+ */
46
+ beside(point: {
47
+ x: number;
48
+ y: number;
49
+ }, anchor: BoxAnchors, gap?: {
50
+ x?: number;
51
+ y?: number;
52
+ }): Box;
53
+ /** How far this box reaches past `bounds` on each side, in whole pixels; an empty box reaches nowhere. */
54
+ overflow(bounds: Box): Margins;
55
+ /**
56
+ * This box placed next to `point`, `gap` px away, on its preferred side
57
+ * per axis (`anchor`), inside `within` with an `edge` px clearance: a side
58
+ * it doesn't fit on gives way to the centred position, then to the
59
+ * opposite side, and as a last resort it is pushed back inside.
60
+ */
61
+ placeNear(point: {
62
+ x: number;
63
+ y: number;
64
+ }, anchor: BoxAnchors, within: Box, { gap, edge }?: {
65
+ gap?: number | undefined;
66
+ edge?: number | undefined;
67
+ }): Box;
68
+ /**
69
+ * Which side of `point` this box goes on, per axis, to stay inside
70
+ * `within`: its preferred side `gap` px away, else the opposite one; a
71
+ * centred box shifts back inside instead. Returns the side and the offset
72
+ * from the point - for a label anchored at the point, like a text's
73
+ * `textAnchor`/`lineAnchor` and `dx`/`dy`. Measure the box off the DOM
74
+ * ({@link Box.ofText}): a reading of the rendered label would feed back
75
+ * into the layout it is placed in.
76
+ */
77
+ flipNear(point: {
78
+ x: number;
79
+ y: number;
80
+ }, anchor: BoxAnchors, within: Box, gap: {
81
+ x: number;
82
+ y: number;
83
+ }): BoxFlip;
84
+ }
@@ -0,0 +1,138 @@
1
+ import { Margins } from './Margins';
2
+ /**
3
+ * A rectangle in pixels: where something sits (`x`, `y`, its top-left) and
4
+ * how big it is. Anything a plot lays out - a label, a tooltip, the plot's
5
+ * own area - can be one, measured from the DOM ({@link Box.of}) or off it
6
+ * ({@link Box.ofText}). Immutable: every operation returns a new one.
7
+ */
8
+ export class Box {
9
+ x;
10
+ y;
11
+ width;
12
+ height;
13
+ static #canvas;
14
+ constructor(x, y, width, height) {
15
+ this.x = x;
16
+ this.y = y;
17
+ this.width = width;
18
+ this.height = height;
19
+ }
20
+ /** A box of `width` x `height` at the origin. */
21
+ static size(width, height) {
22
+ return new Box(0, 0, width, height);
23
+ }
24
+ /** A box from any rect-like reading, e.g. an element's `getBBox()`. */
25
+ static of(rect) {
26
+ return new Box(rect.x, rect.y, rect.width, rect.height);
27
+ }
28
+ /**
29
+ * The box one line of `text` takes at `fontSize` in the configuration's
30
+ * font (`'inherit'` measures as sans-serif), measured off the DOM, on a
31
+ * canvas. Empty during SSR.
32
+ */
33
+ static ofText(text, fontSize, cfg) {
34
+ if (Box.#canvas === undefined) {
35
+ Box.#canvas =
36
+ typeof document === 'undefined' ? null : document.createElement('canvas').getContext('2d');
37
+ }
38
+ const family = cfg.font === 'inherit' ? 'sans-serif' : cfg.font;
39
+ const canvas = Box.#canvas;
40
+ if (canvas)
41
+ canvas.font = `${fontSize}px ${family}`;
42
+ return Box.size(canvas?.measureText(text).width ?? 0, fontSize * 1.2);
43
+ }
44
+ get left() {
45
+ return this.x;
46
+ }
47
+ get top() {
48
+ return this.y;
49
+ }
50
+ get right() {
51
+ return this.x + this.width;
52
+ }
53
+ get bottom() {
54
+ return this.y + this.height;
55
+ }
56
+ /** Whether the box has no area. */
57
+ get empty() {
58
+ return this.width === 0 && this.height === 0;
59
+ }
60
+ /** How far this box reaches out from its origin (the point it sits around), in whole pixels. */
61
+ get reach() {
62
+ return this.overflow(Box.size(0, 0));
63
+ }
64
+ /** This box grown by `px` on every side. */
65
+ pad(px) {
66
+ return new Box(this.x - px, this.y - px, this.width + 2 * px, this.height + 2 * px);
67
+ }
68
+ /**
69
+ * This box placed beside `point` on `anchor`'s side per axis: `gap` px
70
+ * before or after it, or centred on it.
71
+ */
72
+ beside(point, anchor, gap = {}) {
73
+ const start = (pos, size, side, space) => side === 'before' ? pos - space - size : side === 'after' ? pos + space : pos - size / 2;
74
+ return new Box(start(point.x, this.width, anchor.x, gap.x ?? 0), start(point.y, this.height, anchor.y, gap.y ?? 0), this.width, this.height);
75
+ }
76
+ /** How far this box reaches past `bounds` on each side, in whole pixels; an empty box reaches nowhere. */
77
+ overflow(bounds) {
78
+ if (this.empty)
79
+ return Margins.ZERO;
80
+ return new Margins(Math.ceil(Math.max(0, bounds.top - this.top)), Math.ceil(Math.max(0, this.right - bounds.right)), Math.ceil(Math.max(0, this.bottom - bounds.bottom)), Math.ceil(Math.max(0, bounds.left - this.left)));
81
+ }
82
+ /**
83
+ * This box placed next to `point`, `gap` px away, on its preferred side
84
+ * per axis (`anchor`), inside `within` with an `edge` px clearance: a side
85
+ * it doesn't fit on gives way to the centred position, then to the
86
+ * opposite side, and as a last resort it is pushed back inside.
87
+ */
88
+ placeNear(point, anchor, within, { gap = 10, edge = 6 } = {}) {
89
+ const along = (pos, size, from, to, preferred) => {
90
+ const startAt = (side) => side === 'before' ? pos - gap - size : side === 'after' ? pos + gap : pos - size / 2;
91
+ const order = preferred === 'before'
92
+ ? ['before', 'middle', 'after']
93
+ : preferred === 'after'
94
+ ? ['after', 'middle', 'before']
95
+ : ['middle'];
96
+ for (const side of order) {
97
+ const start = startAt(side);
98
+ if (start >= from + edge && start + size <= to - edge)
99
+ return start;
100
+ }
101
+ const last = startAt(order[order.length - 1]);
102
+ return Math.min(Math.max(last, from + edge), Math.max(from + edge, to - size - edge));
103
+ };
104
+ return new Box(along(point.x, this.width, within.left, within.right, anchor.x), along(point.y, this.height, within.top, within.bottom, anchor.y), this.width, this.height);
105
+ }
106
+ /**
107
+ * Which side of `point` this box goes on, per axis, to stay inside
108
+ * `within`: its preferred side `gap` px away, else the opposite one; a
109
+ * centred box shifts back inside instead. Returns the side and the offset
110
+ * from the point - for a label anchored at the point, like a text's
111
+ * `textAnchor`/`lineAnchor` and `dx`/`dy`. Measure the box off the DOM
112
+ * ({@link Box.ofText}): a reading of the rendered label would feed back
113
+ * into the layout it is placed in.
114
+ */
115
+ flipNear(point, anchor, within, gap) {
116
+ const along = (pos, size, from, to, side, space) => {
117
+ if (side === 'after') {
118
+ return pos + space + size > to
119
+ ? { side: 'before', offset: -space }
120
+ : { side, offset: space };
121
+ }
122
+ if (side === 'before') {
123
+ return pos - space - size < from
124
+ ? { side: 'after', offset: space }
125
+ : { side, offset: -space };
126
+ }
127
+ const half = size / 2;
128
+ if (pos - half < from)
129
+ return { side, offset: from + half - pos };
130
+ if (pos + half > to)
131
+ return { side, offset: to - (pos + half) };
132
+ return { side, offset: 0 };
133
+ };
134
+ const x = along(point.x, this.width, within.left, within.right, anchor.x, gap.x);
135
+ const y = along(point.y, this.height, within.top, within.bottom, anchor.y, gap.y);
136
+ return { anchor: { x: x.side, y: y.side }, dx: x.offset, dy: y.offset };
137
+ }
138
+ }
@@ -0,0 +1,37 @@
1
+ import { Box } from './Box';
2
+ import type { MarginConfig, MarginSide } from '../../types/plots/props';
3
+ /** A box's four sides, in pixels. Immutable: every operation returns a new one. */
4
+ export declare class Margins {
5
+ readonly top: number;
6
+ readonly right: number;
7
+ readonly bottom: number;
8
+ readonly left: number;
9
+ static readonly SIDES: readonly MarginSide[];
10
+ static readonly ZERO: Margins;
11
+ /** What an axis plot's `'auto'` side reads as before svelteplot sizes its axes. */
12
+ static readonly AXIS_ESTIMATE: Margins;
13
+ /** What a map's `'auto'` side reads as: a small uniform gap, like an `inset` marker's own. */
14
+ static readonly GEO_ESTIMATE: Margins;
15
+ constructor(top: number, right: number, bottom: number, left: number);
16
+ /** Some sides, the rest `0`. */
17
+ static of(sides: Partial<Record<MarginSide, number>>): Margins;
18
+ /** Every side `value`. */
19
+ static uniform(value: number): Margins;
20
+ /** Half of each dimension: how far something inside a `width` x `height` box may reach out. */
21
+ static half(width: number, height: number): Margins;
22
+ /** A margin config as numbers: a side that is `'auto'` or unset reads as `estimate`'s. */
23
+ static resolve(config: MarginConfig | undefined, estimate?: Margins): Margins;
24
+ /** Each side through `fn`. */
25
+ map(fn: (value: number, side: MarginSide) => number): Margins;
26
+ max(other: Margins): Margins;
27
+ min(other: Margins): Margins;
28
+ plus(other: Margins): Margins;
29
+ /** Whether every side is within `tolerance` px of `other`'s. */
30
+ equals(other: Margins | undefined, tolerance?: number): boolean;
31
+ /** Whether every side is `0` or less. */
32
+ get empty(): boolean;
33
+ /** The box these margins leave inside a `width` x `height` one. */
34
+ contentBox(width: number, height: number): Box;
35
+ /** The sides as a plain object - what svelteplot and `JSON` read. */
36
+ toJSON(): Record<MarginSide, number>;
37
+ }
@@ -0,0 +1,71 @@
1
+ import { Box } from './Box';
2
+ /** A box's four sides, in pixels. Immutable: every operation returns a new one. */
3
+ export class Margins {
4
+ top;
5
+ right;
6
+ bottom;
7
+ left;
8
+ static SIDES = ['top', 'right', 'bottom', 'left'];
9
+ static ZERO = new Margins(0, 0, 0, 0);
10
+ /** What an axis plot's `'auto'` side reads as before svelteplot sizes its axes. */
11
+ static AXIS_ESTIMATE = new Margins(20, 20, 30, 40);
12
+ /** What a map's `'auto'` side reads as: a small uniform gap, like an `inset` marker's own. */
13
+ static GEO_ESTIMATE = new Margins(8, 8, 8, 8);
14
+ constructor(top, right, bottom, left) {
15
+ this.top = top;
16
+ this.right = right;
17
+ this.bottom = bottom;
18
+ this.left = left;
19
+ }
20
+ /** Some sides, the rest `0`. */
21
+ static of(sides) {
22
+ return new Margins(sides.top ?? 0, sides.right ?? 0, sides.bottom ?? 0, sides.left ?? 0);
23
+ }
24
+ /** Every side `value`. */
25
+ static uniform(value) {
26
+ return new Margins(value, value, value, value);
27
+ }
28
+ /** Half of each dimension: how far something inside a `width` x `height` box may reach out. */
29
+ static half(width, height) {
30
+ const w = Math.max(0, width / 2);
31
+ const h = Math.max(0, height / 2);
32
+ return new Margins(h, w, h, w);
33
+ }
34
+ /** A margin config as numbers: a side that is `'auto'` or unset reads as `estimate`'s. */
35
+ static resolve(config, estimate = Margins.AXIS_ESTIMATE) {
36
+ return estimate.map((fallback, side) => {
37
+ const value = config?.[side];
38
+ return typeof value === 'number' ? value : fallback;
39
+ });
40
+ }
41
+ /** Each side through `fn`. */
42
+ map(fn) {
43
+ return new Margins(fn(this.top, 'top'), fn(this.right, 'right'), fn(this.bottom, 'bottom'), fn(this.left, 'left'));
44
+ }
45
+ max(other) {
46
+ return this.map((value, side) => Math.max(value, other[side]));
47
+ }
48
+ min(other) {
49
+ return this.map((value, side) => Math.min(value, other[side]));
50
+ }
51
+ plus(other) {
52
+ return this.map((value, side) => value + other[side]);
53
+ }
54
+ /** Whether every side is within `tolerance` px of `other`'s. */
55
+ equals(other, tolerance = 0) {
56
+ return (other != null &&
57
+ Margins.SIDES.every((side) => Math.abs(this[side] - other[side]) <= tolerance));
58
+ }
59
+ /** Whether every side is `0` or less. */
60
+ get empty() {
61
+ return Margins.SIDES.every((side) => this[side] <= 0);
62
+ }
63
+ /** The box these margins leave inside a `width` x `height` one. */
64
+ contentBox(width, height) {
65
+ return new Box(this.left, this.top, Math.max(0, width - this.left - this.right), Math.max(0, height - this.top - this.bottom));
66
+ }
67
+ /** The sides as a plain object - what svelteplot and `JSON` read. */
68
+ toJSON() {
69
+ return { top: this.top, right: this.right, bottom: this.bottom, left: this.left };
70
+ }
71
+ }
@@ -0,0 +1,101 @@
1
+ import { Margins } from './Margins';
2
+ import { Box } from './Box';
3
+ import type { MarginConfig } from '../../types/plots/props';
4
+ import type { BoxAnchors, EdgeBox } from '../../types/layout/box';
5
+ import type { AxisScale } from '../../types/layout/scales';
6
+ import type { AxisChannelName } from '../../types/layout/mapping';
7
+ /** What a plot's margins are built from, each read reactively. */
8
+ export type PlotMarginsInputs = {
9
+ /** The theme's margins. */
10
+ theme: () => MarginConfig;
11
+ /** The author's `margins`: a side set here is theirs, and never grows. */
12
+ author: () => MarginConfig | undefined;
13
+ /** What an `'auto'` side reads as, for the plot's own numbers. */
14
+ estimate: () => Margins;
15
+ /**
16
+ * Boxes the plot expects around points on its edges - its labels, before
17
+ * they render: how far each reaches past its edges is where growth starts,
18
+ * so they fit from the first render.
19
+ */
20
+ reserve: () => EdgeBox[];
21
+ /** The plot's box: labels never reach out more than half of it. */
22
+ size: () => {
23
+ width: number;
24
+ height: number;
25
+ };
26
+ /** Growth resets to what `reserve` keeps whenever this changes (by identity). */
27
+ resetKey: () => unknown;
28
+ /** The plot's scales: an axis whose tick labels rotate (`tickRotate`) takes more or less room on its side. */
29
+ scales: () => Partial<Record<AxisChannelName, Pick<AxisScale, 'tickRotate'>>> | undefined;
30
+ /** The tick labels' font size. */
31
+ tickFontSize: () => number;
32
+ /** Receives the margins the labels settled on - the plot's bindable `margins`. */
33
+ settle?: (margins: MarginConfig) => void;
34
+ };
35
+ /**
36
+ * One plot's margins: the theme's, then the author's, then the room its
37
+ * labels reach out into (grown on every side the author left open), then the
38
+ * room rotated tick labels take or give back, and last the margins an aligned grid pinned on
39
+ * it. The plot's markers hand it what they draw to measure ({@link watch});
40
+ * it follows what svelteplot settles on ({@link follow}), for its grid. Its {@link box} and {@link contentBox} are the plot's box and
41
+ * area for any consumer, and {@link place} fits something of a given size
42
+ * next to a point inside the box.
43
+ *
44
+ * The margins the labels settled on go back out through `settle`; read back
45
+ * in as `author`, they hold as a minimum instead of fixing their sides.
46
+ * Create it during component init: it registers itself for the plot's
47
+ * markers ({@link PlotMargins.current}).
48
+ */
49
+ export declare class PlotMargins {
50
+ #private;
51
+ constructor(inputs: PlotMarginsInputs);
52
+ /** The plot's margins, or `null` outside a plot. Call during component init. */
53
+ static current(): PlotMargins | null;
54
+ /**
55
+ * Measures `el`'s rendered box once its readings settle - again whenever
56
+ * the content box or `deps` change - and reports how far it reaches past
57
+ * the content box: to `onOverflow`, and, when `grow` holds, into the room
58
+ * the margins grow by. Call during component init.
59
+ */
60
+ watch(el: () => SVGGraphicsElement | undefined, options: {
61
+ grow?: () => boolean;
62
+ onOverflow?: (overflow: Margins) => void;
63
+ deps?: () => unknown;
64
+ }): void;
65
+ /** Grows the labels' room to fit what reached `overflow` px past the content box. */
66
+ reportOverflow(overflow: Margins): void;
67
+ /**
68
+ * Follows the margins svelteplot settles on - `plot` is its `usePlot()`,
69
+ * only readable inside its `<Plot>` - and reports them to the enclosing
70
+ * aligned grid cell, if any. Call during the init of a component inside it.
71
+ */
72
+ follow(plot: {
73
+ options: Record<string, unknown>;
74
+ }): void;
75
+ /** What svelteplot's `<Plot margin>` takes. */
76
+ readonly config: Partial<{
77
+ top: number | "auto";
78
+ right: number | "auto";
79
+ bottom: number | "auto";
80
+ left: number | "auto";
81
+ }>;
82
+ /** {@link config} as numbers, an `'auto'` side read as the plot's estimate. */
83
+ readonly numeric: Margins;
84
+ /** The plot's whole box, in pixels. */
85
+ readonly box: Box;
86
+ /** The plot's own area, in pixels: what its margins leave inside its box. */
87
+ readonly contentBox: Box;
88
+ /**
89
+ * Where something of `size` sits next to `point`, on its preferred side
90
+ * per axis, without leaving the plot's box - see {@link Box.placeNear}.
91
+ */
92
+ place(size: Box, point: {
93
+ x: number;
94
+ y: number;
95
+ }, anchor: BoxAnchors): Box;
96
+ /**
97
+ * Changes whenever the labels' margins move after mount, which svelteplot
98
+ * only takes on a remount. The same margins read back from `settle` keep it.
99
+ */
100
+ readonly remountKey: string;
101
+ }
@@ -0,0 +1,219 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ import { Margins } from './Margins';
3
+ import { Box } from './Box';
4
+ import { CellAlignment } from '../grid/GridAlignment.svelte';
5
+ const PLOT_MARGINS_KEY = Symbol('dct-plot-margins');
6
+ /** The side each axis draws its tick labels on. */
7
+ const TICK_SIDES = { x: 'bottom', y: 'left' };
8
+ /**
9
+ * One plot's margins: the theme's, then the author's, then the room its
10
+ * labels reach out into (grown on every side the author left open), then the
11
+ * room rotated tick labels take or give back, and last the margins an aligned grid pinned on
12
+ * it. The plot's markers hand it what they draw to measure ({@link watch});
13
+ * it follows what svelteplot settles on ({@link follow}), for its grid. Its {@link box} and {@link contentBox} are the plot's box and
14
+ * area for any consumer, and {@link place} fits something of a given size
15
+ * next to a point inside the box.
16
+ *
17
+ * The margins the labels settled on go back out through `settle`; read back
18
+ * in as `author`, they hold as a minimum instead of fixing their sides.
19
+ * Create it during component init: it registers itself for the plot's
20
+ * markers ({@link PlotMargins.current}).
21
+ */
22
+ export class PlotMargins {
23
+ #inputs;
24
+ #cell = CellAlignment.current();
25
+ #measured = $state.raw(Margins.ZERO);
26
+ /** The sides the labels settled on, as last handed to `settle`. */
27
+ #settled;
28
+ constructor(inputs) {
29
+ this.#inputs = inputs;
30
+ setContext(PLOT_MARGINS_KEY, this);
31
+ // The first run is not a reset.
32
+ let first = true;
33
+ $effect(() => {
34
+ inputs.resetKey();
35
+ if (first)
36
+ first = false;
37
+ else
38
+ this.#measured = Margins.ZERO;
39
+ });
40
+ $effect(() => {
41
+ const grown = this.#grown;
42
+ const settled = this.#settled;
43
+ if (!inputs.settle || Object.keys(grown).length === 0)
44
+ return;
45
+ if (settled && Margins.SIDES.every((side) => settled[side] === grown[side]))
46
+ return;
47
+ this.#settled = grown;
48
+ inputs.settle({ ...inputs.author(), ...grown });
49
+ });
50
+ }
51
+ /** The plot's margins, or `null` outside a plot. Call during component init. */
52
+ static current() {
53
+ return getContext(PLOT_MARGINS_KEY) ?? null;
54
+ }
55
+ /**
56
+ * Measures `el`'s rendered box once its readings settle - again whenever
57
+ * the content box or `deps` change - and reports how far it reaches past
58
+ * the content box: to `onOverflow`, and, when `grow` holds, into the room
59
+ * the margins grow by. Call during component init.
60
+ */
61
+ watch(el, options) {
62
+ $effect(() => {
63
+ const element = el();
64
+ const bounds = this.contentBox;
65
+ options.deps?.();
66
+ if (!element)
67
+ return;
68
+ let cancelled = false;
69
+ let frame;
70
+ let attempt = 0;
71
+ let last;
72
+ const measure = () => {
73
+ if (cancelled)
74
+ return;
75
+ let box;
76
+ try {
77
+ box = Box.of(element.getBBox());
78
+ }
79
+ catch {
80
+ return;
81
+ }
82
+ const overflow = box.overflow(bounds);
83
+ attempt += 1;
84
+ const stable = overflow.equals(last);
85
+ last = overflow;
86
+ if (!stable && attempt < PlotMargins.#MAX_READINGS) {
87
+ frame = requestAnimationFrame(measure);
88
+ return;
89
+ }
90
+ options.onOverflow?.(overflow);
91
+ if (options.grow?.())
92
+ this.reportOverflow(overflow);
93
+ };
94
+ // Text measures right only once its fonts load.
95
+ (document.fonts?.ready ?? Promise.resolve()).then(() => {
96
+ if (!cancelled)
97
+ frame = requestAnimationFrame(measure);
98
+ });
99
+ return () => {
100
+ cancelled = true;
101
+ if (frame !== undefined)
102
+ cancelAnimationFrame(frame);
103
+ };
104
+ });
105
+ }
106
+ /** How many frames {@link watch} waits for a box to settle. */
107
+ static #MAX_READINGS = 30;
108
+ /** Grows the labels' room to fit what reached `overflow` px past the content box. */
109
+ reportOverflow(overflow) {
110
+ const next = this.#measured.max(overflow);
111
+ if (!next.equals(this.#measured))
112
+ this.#measured = next;
113
+ }
114
+ /**
115
+ * Follows the margins svelteplot settles on - `plot` is its `usePlot()`,
116
+ * only readable inside its `<Plot>` - and reports them to the enclosing
117
+ * aligned grid cell, if any. Call during the init of a component inside it.
118
+ */
119
+ follow(plot) {
120
+ const cell = this.#cell;
121
+ if (!cell)
122
+ return;
123
+ $effect(() => {
124
+ const { marginTop, marginRight, marginBottom, marginLeft } = plot.options;
125
+ cell.report(new Margins(Number(marginTop) || 0, Number(marginRight) || 0, Number(marginBottom) || 0, Number(marginLeft) || 0));
126
+ });
127
+ }
128
+ /** The room the `reserve` boxes take past the edges their points can sit on. */
129
+ #reserved = $derived.by(() => this.#inputs.reserve().reduce((room, { box, edges }) => {
130
+ const reach = box.reach;
131
+ return room.max(Margins.of(Object.fromEntries(edges.map((side) => [side, reach[side]]))));
132
+ }, Margins.ZERO));
133
+ /** The room labels need, on every side the author left open. */
134
+ #grown = $derived.by(() => {
135
+ const author = this.#inputs.author();
136
+ const settled = this.#settled;
137
+ const { width, height } = this.#inputs.size();
138
+ const growth = this.#measured.max(this.#reserved).min(Margins.half(width, height));
139
+ const estimate = this.#inputs.estimate();
140
+ const out = {};
141
+ for (const side of Margins.SIDES) {
142
+ const own = author?.[side];
143
+ // A side read back from `settle` is a minimum; any other the author set is fixed.
144
+ const held = typeof own === 'number' && settled?.[side] === own ? own : undefined;
145
+ if (own !== undefined && held === undefined)
146
+ continue;
147
+ const grown = growth[side] > 0 ? estimate[side] + growth[side] : undefined;
148
+ if (held !== undefined || grown !== undefined)
149
+ out[side] = Math.max(held ?? 0, grown ?? 0);
150
+ }
151
+ return out;
152
+ });
153
+ /** The author's margins, with the room labels need. */
154
+ #labels = $derived.by(() => {
155
+ const author = this.#inputs.author();
156
+ const grown = this.#grown;
157
+ return author === undefined && Object.keys(grown).length === 0
158
+ ? undefined
159
+ : { ...author, ...grown };
160
+ });
161
+ /**
162
+ * How much more room (or less) each axis' rotated tick labels take across
163
+ * it, on its side. An x label stands as tall as its text, a y label as wide;
164
+ * rotated, it reaches across by its turned box. A label is taken as twice
165
+ * as wide as its font size.
166
+ */
167
+ #tickRoom = $derived.by(() => {
168
+ const scales = this.#inputs.scales();
169
+ const height = this.#inputs.tickFontSize();
170
+ const width = 2 * height;
171
+ const room = {};
172
+ for (const axis of ['x', 'y']) {
173
+ const degrees = scales?.[axis]?.tickRotate;
174
+ if (!degrees)
175
+ continue;
176
+ const rad = (degrees * Math.PI) / 180;
177
+ const [across, along] = axis === 'x' ? [height, width] : [width, height];
178
+ const turned = Math.abs(Math.cos(rad)) * across + Math.abs(Math.sin(rad)) * along;
179
+ room[TICK_SIDES[axis]] = Math.ceil(turned - across);
180
+ }
181
+ return room;
182
+ });
183
+ /** What svelteplot's `<Plot margin>` takes. */
184
+ config = $derived.by(() => {
185
+ const base = { ...this.#inputs.theme(), ...this.#labels };
186
+ const pinned = this.#cell?.pinned;
187
+ if (pinned)
188
+ return { ...base, ...pinned.toJSON() };
189
+ // A fixed side makes room for its rotated tick labels; an `'auto'` one fits them itself.
190
+ const out = { ...base };
191
+ for (const [side, room] of Object.entries(this.#tickRoom)) {
192
+ const own = out[side];
193
+ if (typeof own === 'number')
194
+ out[side] = Math.max(0, own + room);
195
+ }
196
+ return out;
197
+ });
198
+ /** {@link config} as numbers, an `'auto'` side read as the plot's estimate. */
199
+ numeric = $derived.by(() => Margins.resolve(this.config, this.#inputs.estimate()));
200
+ /** The plot's whole box, in pixels. */
201
+ box = $derived.by(() => {
202
+ const { width, height } = this.#inputs.size();
203
+ return Box.size(width, height);
204
+ });
205
+ /** The plot's own area, in pixels: what its margins leave inside its box. */
206
+ contentBox = $derived.by(() => this.numeric.contentBox(this.box.width, this.box.height));
207
+ /**
208
+ * Where something of `size` sits next to `point`, on its preferred side
209
+ * per axis, without leaving the plot's box - see {@link Box.placeNear}.
210
+ */
211
+ place(size, point, anchor) {
212
+ return size.placeNear(point, anchor, this.box);
213
+ }
214
+ /**
215
+ * Changes whenever the labels' margins move after mount, which svelteplot
216
+ * only takes on a remount. The same margins read back from `settle` keep it.
217
+ */
218
+ remountKey = $derived.by(() => JSON.stringify(this.#labels ?? null));
219
+ }