@galaxy-io/dls 1.2.7 → 1.3.1

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 (305) hide show
  1. package/README.md +2 -0
  2. package/dist/avatar/Avatar.d.ts +2 -1
  3. package/dist/avatar/Avatar.js +103 -14
  4. package/dist/buttons/Button.d.ts +6 -1
  5. package/dist/buttons/Button.js +8 -4
  6. package/dist/charts/BarChart.d.ts +30 -20
  7. package/dist/charts/BarChart.js +183 -253
  8. package/dist/charts/ChartAxis.d.ts +47 -22
  9. package/dist/charts/ChartAxis.js +81 -60
  10. package/dist/charts/ChartCategoryTargets.d.ts +27 -0
  11. package/dist/charts/ChartCategoryTargets.js +75 -0
  12. package/dist/charts/ChartEmptyState.d.ts +17 -0
  13. package/dist/charts/ChartEmptyState.js +29 -0
  14. package/dist/charts/ChartFrame.d.ts +110 -0
  15. package/dist/charts/ChartFrame.js +143 -0
  16. package/dist/charts/ChartLegend.d.ts +27 -4
  17. package/dist/charts/ChartLegend.js +46 -23
  18. package/dist/charts/ChartPrimitives.d.ts +230 -0
  19. package/dist/charts/ChartPrimitives.js +305 -0
  20. package/dist/charts/ChartTooltip.d.ts +25 -4
  21. package/dist/charts/ChartTooltip.js +55 -49
  22. package/dist/charts/LineChart.d.ts +42 -20
  23. package/dist/charts/LineChart.js +175 -241
  24. package/dist/charts/PieChart.d.ts +48 -32
  25. package/dist/charts/PieChart.js +180 -170
  26. package/dist/charts/barChartGeometry.d.ts +120 -0
  27. package/dist/charts/barChartGeometry.js +210 -0
  28. package/dist/charts/barChartLegend.d.ts +25 -0
  29. package/dist/charts/barChartLegend.js +23 -0
  30. package/dist/charts/chartFormat.d.ts +27 -0
  31. package/dist/charts/chartFormat.js +71 -0
  32. package/dist/charts/chartScales.d.ts +120 -0
  33. package/dist/charts/chartScales.js +165 -0
  34. package/dist/charts/chartTheme.d.ts +18 -0
  35. package/dist/charts/chartTheme.js +26 -0
  36. package/dist/charts/constants.d.ts +241 -18
  37. package/dist/charts/constants.js +261 -32
  38. package/dist/charts/lineChartGeometry.d.ts +92 -0
  39. package/dist/charts/lineChartGeometry.js +134 -0
  40. package/dist/charts/pieChartGeometry.d.ts +60 -0
  41. package/dist/charts/pieChartGeometry.js +79 -0
  42. package/dist/charts/types.d.ts +428 -54
  43. package/dist/charts/types.js +155 -0
  44. package/dist/charts/useCartesianChartLayout.d.ts +70 -0
  45. package/dist/charts/useCartesianChartLayout.js +56 -0
  46. package/dist/charts/useChartDimensions.d.ts +47 -0
  47. package/dist/charts/useChartDimensions.js +63 -0
  48. package/dist/charts/useChartFormatters.d.ts +19 -0
  49. package/dist/charts/useChartFormatters.js +20 -0
  50. package/dist/charts/useChartInteraction.d.ts +76 -0
  51. package/dist/charts/useChartInteraction.js +126 -0
  52. package/dist/charts/useChartTooltipPosition.d.ts +53 -0
  53. package/dist/charts/useChartTooltipPosition.js +39 -0
  54. package/dist/charts/useSeriesColorResolver.d.ts +37 -0
  55. package/dist/charts/useSeriesColorResolver.js +27 -0
  56. package/dist/hooks/useElementClientSize.d.ts +20 -0
  57. package/dist/hooks/useElementClientSize.js +43 -0
  58. package/dist/inputs/CheckboxInput.d.ts +7 -2
  59. package/dist/inputs/CheckboxInput.js +30 -14
  60. package/dist/inputs/Input.d.ts +1 -1
  61. package/dist/inputs/Input.js +6 -2
  62. package/dist/inputs/MultiSelectInput.js +1 -1
  63. package/dist/inputs/RadioInput.js +7 -2
  64. package/dist/styles.css +69 -74
  65. package/dist/table/InfiniteSpreadsheet.d.ts +6 -0
  66. package/dist/table/InfiniteSpreadsheet.js +235 -0
  67. package/dist/table/InfiniteTable.d.ts +7 -88
  68. package/dist/table/InfiniteTable.js +366 -577
  69. package/dist/{spreadsheet → table}/SpreadsheetCell.d.ts +6 -4
  70. package/dist/table/SpreadsheetCell.js +71 -0
  71. package/dist/{spreadsheet → table}/SpreadsheetCellEditor.js +27 -21
  72. package/dist/table/SpreadsheetHeaderCell.d.ts +23 -0
  73. package/dist/table/SpreadsheetHeaderCell.js +91 -0
  74. package/dist/table/SpreadsheetMenuItem.d.ts +14 -0
  75. package/dist/table/SpreadsheetMenuItem.js +33 -0
  76. package/dist/table/SpreadsheetPrimitives.d.ts +172 -0
  77. package/dist/table/SpreadsheetPrimitives.js +105 -0
  78. package/dist/table/SpreadsheetRow.d.ts +33 -0
  79. package/dist/table/SpreadsheetRow.js +73 -0
  80. package/dist/{spreadsheet → table}/SpreadsheetRowActionCell.d.ts +5 -7
  81. package/dist/table/SpreadsheetRowActionCell.js +51 -0
  82. package/dist/table/TableExpandCell.d.ts +11 -0
  83. package/dist/table/TableExpandCell.js +24 -0
  84. package/dist/table/TableExpandedRow.d.ts +16 -0
  85. package/dist/table/TableExpandedRow.js +77 -0
  86. package/dist/table/TableHeaderCellContent.d.ts +30 -0
  87. package/dist/table/TableHeaderCellContent.js +48 -0
  88. package/dist/table/TablePrimitives.d.ts +307 -0
  89. package/dist/table/TablePrimitives.js +298 -0
  90. package/dist/table/TableSelectCell.d.ts +18 -0
  91. package/dist/table/TableSelectCell.js +26 -0
  92. package/dist/table/TableStatusRow.d.ts +18 -0
  93. package/dist/table/TableStatusRow.js +50 -0
  94. package/dist/table/VirtualizedInfiniteTable.d.ts +11 -27
  95. package/dist/table/VirtualizedInfiniteTable.js +182 -317
  96. package/dist/table/types.d.ts +249 -0
  97. package/dist/table/types.js +51 -0
  98. package/dist/table/useInfiniteScrollSentinel.d.ts +24 -0
  99. package/dist/table/useInfiniteScrollSentinel.js +53 -0
  100. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.d.ts +1 -1
  101. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.js +1 -1
  102. package/dist/table/useTableColumnLayout.d.ts +28 -0
  103. package/dist/table/useTableColumnLayout.js +63 -0
  104. package/dist/table/useTableColumnResize.d.ts +38 -0
  105. package/dist/table/useTableColumnResize.js +155 -0
  106. package/dist/table/useTableKeyboardNavigation.d.ts +25 -0
  107. package/dist/table/useTableKeyboardNavigation.js +83 -0
  108. package/dist/table/useTableRowExpansion.d.ts +24 -0
  109. package/dist/table/useTableRowExpansion.js +62 -0
  110. package/dist/table/useTableRowSelection.d.ts +27 -0
  111. package/dist/table/useTableRowSelection.js +94 -0
  112. package/dist/table/utils.d.ts +50 -0
  113. package/dist/table/utils.js +78 -0
  114. package/dist/text/MarkdownText.js +45 -27
  115. package/dist/theme/variants/dark.js +1 -1
  116. package/dist/widget/Widget.d.ts +2 -0
  117. package/dist/widget/Widget.js +14 -7
  118. package/package.json +1 -5
  119. package/dist/assets/components/enrichment/PerplexityIcon.d.ts +0 -3
  120. package/dist/assets/components/enrichment/PerplexityIcon.js +0 -35
  121. package/dist/assets/components/enrichment/TavilyIcon.d.ts +0 -3
  122. package/dist/assets/components/enrichment/TavilyIcon.js +0 -15
  123. package/dist/assets/components/onboarding/TenantSetupDark.d.ts +0 -3
  124. package/dist/assets/components/onboarding/TenantSetupDark.js +0 -498
  125. package/dist/assets/components/onboarding/TenantSetupLight.d.ts +0 -3
  126. package/dist/assets/components/onboarding/TenantSetupLight.js +0 -482
  127. package/dist/assets/components/onboarding/UserSetupDark.d.ts +0 -3
  128. package/dist/assets/components/onboarding/UserSetupDark.js +0 -1086
  129. package/dist/assets/components/onboarding/UserSetupLight.d.ts +0 -3
  130. package/dist/assets/components/onboarding/UserSetupLight.js +0 -1024
  131. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.d.ts +0 -3
  132. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.js +0 -466
  133. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.d.ts +0 -3
  134. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.js +0 -460
  135. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.d.ts +0 -3
  136. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.js +0 -336
  137. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.d.ts +0 -3
  138. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.js +0 -336
  139. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.d.ts +0 -3
  140. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.js +0 -153
  141. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.d.ts +0 -3
  142. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.js +0 -153
  143. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.d.ts +0 -3
  144. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.js +0 -117
  145. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.d.ts +0 -3
  146. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.js +0 -117
  147. package/dist/assets/components/projects/MappingMethodBlankDark.d.ts +0 -3
  148. package/dist/assets/components/projects/MappingMethodBlankDark.js +0 -150
  149. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.d.ts +0 -3
  150. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.js +0 -150
  151. package/dist/assets/components/projects/MappingMethodBlankLight.d.ts +0 -3
  152. package/dist/assets/components/projects/MappingMethodBlankLight.js +0 -150
  153. package/dist/assets/components/projects/MappingMethodBlankLightHovered.d.ts +0 -3
  154. package/dist/assets/components/projects/MappingMethodBlankLightHovered.js +0 -150
  155. package/dist/assets/components/projects/MappingMethodJsonDark.d.ts +0 -3
  156. package/dist/assets/components/projects/MappingMethodJsonDark.js +0 -90
  157. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.d.ts +0 -3
  158. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.js +0 -90
  159. package/dist/assets/components/projects/MappingMethodJsonLight.d.ts +0 -3
  160. package/dist/assets/components/projects/MappingMethodJsonLight.js +0 -90
  161. package/dist/assets/components/projects/MappingMethodJsonLightHovered.d.ts +0 -3
  162. package/dist/assets/components/projects/MappingMethodJsonLightHovered.js +0 -90
  163. package/dist/assets/components/projects/ProjectsEmptyStateDark.d.ts +0 -3
  164. package/dist/assets/components/projects/ProjectsEmptyStateDark.js +0 -454
  165. package/dist/assets/components/projects/ProjectsEmptyStateLight.d.ts +0 -3
  166. package/dist/assets/components/projects/ProjectsEmptyStateLight.js +0 -456
  167. package/dist/assets/components/root/CreateProjectActionCardDark.d.ts +0 -3
  168. package/dist/assets/components/root/CreateProjectActionCardDark.js +0 -1796
  169. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.d.ts +0 -3
  170. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.js +0 -1796
  171. package/dist/assets/components/root/CreateProjectActionCardLight.d.ts +0 -3
  172. package/dist/assets/components/root/CreateProjectActionCardLight.js +0 -1786
  173. package/dist/assets/components/root/CreateProjectActionCardLightHovered.d.ts +0 -3
  174. package/dist/assets/components/root/CreateProjectActionCardLightHovered.js +0 -1786
  175. package/dist/assets/components/root/CreateSourceActionCardDark.d.ts +0 -3
  176. package/dist/assets/components/root/CreateSourceActionCardDark.js +0 -879
  177. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.d.ts +0 -3
  178. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.js +0 -879
  179. package/dist/assets/components/root/CreateSourceActionCardLight.d.ts +0 -3
  180. package/dist/assets/components/root/CreateSourceActionCardLight.js +0 -889
  181. package/dist/assets/components/root/CreateSourceActionCardLightHovered.d.ts +0 -3
  182. package/dist/assets/components/root/CreateSourceActionCardLightHovered.js +0 -889
  183. package/dist/assets/components/sources/AttioIcon.d.ts +0 -3
  184. package/dist/assets/components/sources/AttioIcon.js +0 -11
  185. package/dist/assets/components/sources/BigquerySourceIcon.d.ts +0 -3
  186. package/dist/assets/components/sources/BigquerySourceIcon.js +0 -39
  187. package/dist/assets/components/sources/BrowserbaseSourceIcon.d.ts +0 -3
  188. package/dist/assets/components/sources/BrowserbaseSourceIcon.js +0 -35
  189. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.d.ts +0 -3
  190. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.js +0 -13
  191. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.d.ts +0 -3
  192. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.js +0 -13
  193. package/dist/assets/components/sources/ConfluenceSourceIcon.d.ts +0 -3
  194. package/dist/assets/components/sources/ConfluenceSourceIcon.js +0 -30
  195. package/dist/assets/components/sources/GithubSourceIcon.d.ts +0 -3
  196. package/dist/assets/components/sources/GithubSourceIcon.js +0 -27
  197. package/dist/assets/components/sources/GoogleDriveIcon.d.ts +0 -3
  198. package/dist/assets/components/sources/GoogleDriveIcon.js +0 -45
  199. package/dist/assets/components/sources/HubspotSourceIcon.d.ts +0 -3
  200. package/dist/assets/components/sources/HubspotSourceIcon.js +0 -14
  201. package/dist/assets/components/sources/JiraSourceIcon.d.ts +0 -3
  202. package/dist/assets/components/sources/JiraSourceIcon.js +0 -54
  203. package/dist/assets/components/sources/LinearSourceIcon.d.ts +0 -3
  204. package/dist/assets/components/sources/LinearSourceIcon.js +0 -14
  205. package/dist/assets/components/sources/MysqlLogoSourceIconDark.d.ts +0 -3
  206. package/dist/assets/components/sources/MysqlLogoSourceIconDark.js +0 -17
  207. package/dist/assets/components/sources/NetsuiteSourceIcon.d.ts +0 -3
  208. package/dist/assets/components/sources/NetsuiteSourceIcon.js +0 -32
  209. package/dist/assets/components/sources/NotionIcon.d.ts +0 -3
  210. package/dist/assets/components/sources/NotionIcon.js +0 -20
  211. package/dist/assets/components/sources/PostgresqlIcon.d.ts +0 -3
  212. package/dist/assets/components/sources/PostgresqlIcon.js +0 -61
  213. package/dist/assets/components/sources/S3Icon.d.ts +0 -3
  214. package/dist/assets/components/sources/S3Icon.js +0 -76
  215. package/dist/assets/components/sources/SalesforceSourceIcon.d.ts +0 -3
  216. package/dist/assets/components/sources/SalesforceSourceIcon.js +0 -23
  217. package/dist/assets/components/sources/SlackIcon.d.ts +0 -3
  218. package/dist/assets/components/sources/SlackIcon.js +0 -32
  219. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.d.ts +0 -3
  220. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.js +0 -14
  221. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.d.ts +0 -3
  222. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.js +0 -14
  223. package/dist/assets/components/sources/WikipediaSourceIcon.d.ts +0 -3
  224. package/dist/assets/components/sources/WikipediaSourceIcon.js +0 -1490
  225. package/dist/avatar/AvatarEmpty.d.ts +0 -7
  226. package/dist/avatar/AvatarEmpty.js +0 -99
  227. package/dist/avatar/types.d.ts +0 -5
  228. package/dist/avatar/types.js +0 -9
  229. package/dist/charts/utils.d.ts +0 -29
  230. package/dist/charts/utils.js +0 -62
  231. package/dist/icons/BackIcon.d.ts +0 -3
  232. package/dist/icons/BackIcon.js +0 -13
  233. package/dist/icons/CloseIcon.d.ts +0 -3
  234. package/dist/icons/CloseIcon.js +0 -13
  235. package/dist/icons/CreateIcon.d.ts +0 -3
  236. package/dist/icons/CreateIcon.js +0 -13
  237. package/dist/icons/ForwardIcon.d.ts +0 -3
  238. package/dist/icons/ForwardIcon.js +0 -13
  239. package/dist/icons/HelpIcon.d.ts +0 -3
  240. package/dist/icons/HelpIcon.js +0 -14
  241. package/dist/icons/ProjectsIcon.d.ts +0 -3
  242. package/dist/icons/ProjectsIcon.js +0 -12
  243. package/dist/icons/SearchIcon.d.ts +0 -3
  244. package/dist/icons/SearchIcon.js +0 -12
  245. package/dist/icons/SourcesIcon.d.ts +0 -3
  246. package/dist/icons/SourcesIcon.js +0 -12
  247. package/dist/icons/TextIcon.d.ts +0 -4
  248. package/dist/icons/TextIcon.js +0 -22
  249. package/dist/icons/WebScrapeIcon.d.ts +0 -4
  250. package/dist/icons/WebScrapeIcon.js +0 -22
  251. package/dist/icons/WebhookIcon.d.ts +0 -4
  252. package/dist/icons/WebhookIcon.js +0 -22
  253. package/dist/icons/sources/AttioLogomark.d.ts +0 -4
  254. package/dist/icons/sources/AttioLogomark.js +0 -8
  255. package/dist/icons/sources/BrowserbaseLogomark.d.ts +0 -4
  256. package/dist/icons/sources/BrowserbaseLogomark.js +0 -8
  257. package/dist/icons/sources/ClickhouseLogomark.d.ts +0 -4
  258. package/dist/icons/sources/ClickhouseLogomark.js +0 -16
  259. package/dist/icons/sources/ConfluenceLogomark.d.ts +0 -4
  260. package/dist/icons/sources/ConfluenceLogomark.js +0 -8
  261. package/dist/icons/sources/GithubLogomark.d.ts +0 -4
  262. package/dist/icons/sources/GithubLogomark.js +0 -8
  263. package/dist/icons/sources/GoogleBigqueryLogomark.d.ts +0 -4
  264. package/dist/icons/sources/GoogleBigqueryLogomark.js +0 -8
  265. package/dist/icons/sources/GoogleDriveLogomark.d.ts +0 -4
  266. package/dist/icons/sources/GoogleDriveLogomark.js +0 -8
  267. package/dist/icons/sources/HubspotLogomark.d.ts +0 -4
  268. package/dist/icons/sources/HubspotLogomark.js +0 -8
  269. package/dist/icons/sources/JiraLogomark.d.ts +0 -4
  270. package/dist/icons/sources/JiraLogomark.js +0 -8
  271. package/dist/icons/sources/LinearLogomark.d.ts +0 -4
  272. package/dist/icons/sources/LinearLogomark.js +0 -8
  273. package/dist/icons/sources/MySQLLogomark.d.ts +0 -4
  274. package/dist/icons/sources/MySQLLogomark.js +0 -8
  275. package/dist/icons/sources/NetsuiteLogomark.d.ts +0 -4
  276. package/dist/icons/sources/NetsuiteLogomark.js +0 -8
  277. package/dist/icons/sources/NotionLogomark.d.ts +0 -4
  278. package/dist/icons/sources/NotionLogomark.js +0 -8
  279. package/dist/icons/sources/PostgresLogomark.d.ts +0 -4
  280. package/dist/icons/sources/PostgresLogomark.js +0 -8
  281. package/dist/icons/sources/S3Logomark.d.ts +0 -4
  282. package/dist/icons/sources/S3Logomark.js +0 -8
  283. package/dist/icons/sources/SalesforceLogomark.d.ts +0 -4
  284. package/dist/icons/sources/SalesforceLogomark.js +0 -8
  285. package/dist/icons/sources/SlackLogoIconmark.d.ts +0 -4
  286. package/dist/icons/sources/SlackLogoIconmark.js +0 -8
  287. package/dist/icons/sources/SnowflakeLogomark.d.ts +0 -4
  288. package/dist/icons/sources/SnowflakeLogomark.js +0 -16
  289. package/dist/icons/sources/WikipediaLogomark.d.ts +0 -4
  290. package/dist/icons/sources/WikipediaLogomark.js +0 -8
  291. package/dist/spreadsheet/InfiniteSpreadsheet.d.ts +0 -3
  292. package/dist/spreadsheet/InfiniteSpreadsheet.js +0 -265
  293. package/dist/spreadsheet/SpreadsheetAddColumnButton.d.ts +0 -6
  294. package/dist/spreadsheet/SpreadsheetAddColumnButton.js +0 -32
  295. package/dist/spreadsheet/SpreadsheetCell.js +0 -115
  296. package/dist/spreadsheet/SpreadsheetHeaderCell.d.ts +0 -18
  297. package/dist/spreadsheet/SpreadsheetHeaderCell.js +0 -141
  298. package/dist/spreadsheet/SpreadsheetRow.d.ts +0 -21
  299. package/dist/spreadsheet/SpreadsheetRow.js +0 -68
  300. package/dist/spreadsheet/SpreadsheetRowActionCell.js +0 -78
  301. package/dist/spreadsheet/hooks/useColumnResize.d.ts +0 -6
  302. package/dist/spreadsheet/hooks/useColumnResize.js +0 -46
  303. package/dist/spreadsheet/types.d.ts +0 -92
  304. package/dist/spreadsheet/types.js +0 -21
  305. /package/dist/{spreadsheet → table}/SpreadsheetCellEditor.d.ts +0 -0
@@ -0,0 +1,92 @@
1
+ import { buildValueScale } from "./chartScales";
2
+ import { LineChartCurve } from "./types";
3
+ import type { LineChartLineDatum } from "./types";
4
+ /** Signed value domain across every line, ignoring gaps. */
5
+ export declare function getLineValueDomain<TMetric extends string>(lines: LineChartLineDatum<TMetric>[]): [number, number];
6
+ /** One line, resolved to SVG paths. */
7
+ export interface LineChartPath<TMetric extends string> {
8
+ /** React key. Equal to the metric, which is unique by construction. */
9
+ id: string;
10
+ metric: TMetric;
11
+ /** `d` for the stroke. Empty when the line has no plottable points. */
12
+ path: string;
13
+ /** `d` for the area fill. Present only when the line opted into an area. */
14
+ areaPath?: string;
15
+ /** Pre-serialised `stroke-dasharray`. Absent for a solid line. */
16
+ dashArray?: string;
17
+ strokeWidth: number;
18
+ color: string;
19
+ }
20
+ /** One point, resolved to pixels. */
21
+ export interface LineChartPoint<TMetric extends string> {
22
+ /** React key. `${metric}:${categoryIndex}`. */
23
+ id: string;
24
+ metric: TMetric;
25
+ value: number;
26
+ x: number;
27
+ y: number;
28
+ color: string;
29
+ }
30
+ /**
31
+ * One category column: the hit target and everything the tooltip needs.
32
+ *
33
+ * Line charts hit-test by column rather than by proximity to a stroke, so the
34
+ * whole vertical band is a target and the tooltip reports every line at once.
35
+ */
36
+ export interface LineChartColumn<TMetric extends string> {
37
+ categoryIndex: number;
38
+ label: string;
39
+ /** x of the category tick. */
40
+ x: number;
41
+ /** Full-height hit target, tiling with its neighbours. */
42
+ bandX: number;
43
+ bandWidth: number;
44
+ /** Points present in this column, one per line that has a value here. */
45
+ points: LineChartPoint<TMetric>[];
46
+ /** Topmost point in the column — where the tooltip anchors. */
47
+ anchorY: number;
48
+ }
49
+ export interface LineChartGeometry<TMetric extends string> {
50
+ paths: LineChartPath<TMetric>[];
51
+ columns: LineChartColumn<TMetric>[];
52
+ /**
53
+ * Points with no defined neighbour on either side.
54
+ *
55
+ * A lone reading has nothing to connect to, so it produces a zero-length path
56
+ * segment and renders as nothing at all — a silent hole in sparse data. These
57
+ * are drawn as explicit dots so the value is visible without hovering.
58
+ */
59
+ isolatedPoints: LineChartPoint<TMetric>[];
60
+ categories: string[];
61
+ valueScale: ReturnType<typeof buildValueScale>;
62
+ /**
63
+ * Distance between category ticks.
64
+ *
65
+ * Exposed because axis labels must be centred on their tick, which is not the
66
+ * same as being centred on the hit band: the first and last bands are clipped
67
+ * to the plot edge, and centring a label inside a half-width band pushes it
68
+ * off its tick.
69
+ */
70
+ step: number;
71
+ }
72
+ interface BuildLineChartGeometryArgs<TMetric extends string> {
73
+ lines: LineChartLineDatum<TMetric>[];
74
+ categories?: string[];
75
+ plotWidth: number;
76
+ plotHeight: number;
77
+ curve: LineChartCurve;
78
+ /**
79
+ * The final value domain, already overridden, zeroed and niced.
80
+ *
81
+ * Resolved by the caller rather than here, because the left gutter is sized
82
+ * from the tick labels and therefore needs the domain before the plot — and
83
+ * hence this builder — exists.
84
+ */
85
+ domain: [number, number];
86
+ strokeWidth?: number;
87
+ resolveColor: (args: {
88
+ metric: TMetric;
89
+ }) => string;
90
+ }
91
+ export declare function buildLineChartGeometry<TMetric extends string>({ lines, categories: explicitCategories, plotWidth, plotHeight, curve, domain, strokeWidth: defaultStrokeWidth, resolveColor, }: BuildLineChartGeometryArgs<TMetric>): LineChartGeometry<TMetric>;
92
+ export {};
@@ -0,0 +1,134 @@
1
+ import { LineChartCurve } from "./types.js";
2
+ import { DEFAULT_LINE_STROKE_WIDTH } from "./constants.js";
3
+ import { buildCategoryPointScale, buildValueScale, sanitizeValue } from "./chartScales.js";
4
+ import { match } from "ts-pattern";
5
+ import { area, curveLinear, curveMonotoneX, curveStepAfter, line } from "d3-shape";
6
+ //#region src/charts/lineChartGeometry.ts
7
+ function resolveCurve(curve) {
8
+ return match(curve).with(LineChartCurve.LINEAR, () => curveLinear).with(LineChartCurve.SMOOTH, () => curveMonotoneX).with(LineChartCurve.STEP, () => curveStepAfter).exhaustive();
9
+ }
10
+ /**
11
+ * The union of every line's categories, in first-seen order.
12
+ *
13
+ * Lines are allowed to be sparse, so the axis cannot come from any single one
14
+ * of them. An explicit `categories` list wins, and is worth supplying whenever
15
+ * the data is gappy — inferring order from a union of incomplete series is
16
+ * guesswork, and guessing wrong reorders time.
17
+ */
18
+ function getLineCategories(lines, explicit) {
19
+ if (explicit) return explicit;
20
+ const seen = [];
21
+ const index = /* @__PURE__ */ new Set();
22
+ for (const lineDatum of lines) for (const point of lineDatum.points) if (!index.has(point.x)) {
23
+ index.add(point.x);
24
+ seen.push(point.x);
25
+ }
26
+ return seen;
27
+ }
28
+ /** Signed value domain across every line, ignoring gaps. */
29
+ function getLineValueDomain(lines) {
30
+ let min = 0;
31
+ let max = 0;
32
+ let hasValue = false;
33
+ for (const lineDatum of lines) for (const point of lineDatum.points) {
34
+ if (point.y === null || point.y === void 0) continue;
35
+ const value = sanitizeValue(point.y);
36
+ if (!hasValue) {
37
+ min = value;
38
+ max = value;
39
+ hasValue = true;
40
+ continue;
41
+ }
42
+ if (value < min) min = value;
43
+ if (value > max) max = value;
44
+ }
45
+ return [Math.min(0, min), Math.max(0, max)];
46
+ }
47
+ function buildLineChartGeometry({ lines, categories: explicitCategories, plotWidth, plotHeight, curve, domain, strokeWidth: defaultStrokeWidth = DEFAULT_LINE_STROKE_WIDTH, resolveColor }) {
48
+ const categories = getLineCategories(lines, explicitCategories);
49
+ const valueScale = buildValueScale(domain, [plotHeight, 0]);
50
+ const categoryScale = buildCategoryPointScale(categories, [0, plotWidth]);
51
+ const baselineY = valueScale(0);
52
+ const paths = [];
53
+ const columns = [];
54
+ const isolatedPoints = [];
55
+ if (categories.length === 0 || plotWidth <= 0 || plotHeight <= 0) return {
56
+ paths,
57
+ columns,
58
+ isolatedPoints,
59
+ categories,
60
+ valueScale,
61
+ step: 0
62
+ };
63
+ const curveFactory = resolveCurve(curve);
64
+ const categoryIndex = new Map(categories.map((label, index) => [label, index]));
65
+ const xAt = (index) => categoryScale(categories[index]) ?? 0;
66
+ const pointsByCategory = categories.map(() => []);
67
+ lines.forEach((lineDatum) => {
68
+ const color = resolveColor({ metric: lineDatum.metric });
69
+ const stroke = lineDatum.strokeWidth ?? defaultStrokeWidth;
70
+ const plotted = categories.map((_, index) => ({
71
+ categoryIndex: index,
72
+ value: null
73
+ }));
74
+ for (const point of lineDatum.points) {
75
+ const index = categoryIndex.get(point.x);
76
+ if (index === void 0) continue;
77
+ plotted[index].value = point.y === null || point.y === void 0 ? null : sanitizeValue(point.y);
78
+ }
79
+ const isDefined = (p) => p.value !== null;
80
+ const strokePath = line().defined(isDefined).x((p) => xAt(p.categoryIndex)).y((p) => valueScale(p.value)).curve(curveFactory)(plotted) ?? "";
81
+ const areaPath = lineDatum.showArea ? area().defined(isDefined).x((p) => xAt(p.categoryIndex)).y0(baselineY).y1((p) => valueScale(p.value)).curve(curveFactory)(plotted) ?? void 0 : void 0;
82
+ paths.push({
83
+ id: lineDatum.metric,
84
+ metric: lineDatum.metric,
85
+ path: strokePath,
86
+ areaPath,
87
+ dashArray: lineDatum.dashSize ? `${lineDatum.dashSize} ${lineDatum.dashSize}` : void 0,
88
+ strokeWidth: stroke,
89
+ color
90
+ });
91
+ plotted.forEach((p, index) => {
92
+ if (p.value === null) return;
93
+ const point = {
94
+ id: `${lineDatum.metric}:${p.categoryIndex}`,
95
+ metric: lineDatum.metric,
96
+ value: p.value,
97
+ x: xAt(p.categoryIndex),
98
+ y: valueScale(p.value),
99
+ color
100
+ };
101
+ pointsByCategory[p.categoryIndex].push(point);
102
+ const hasPrev = index > 0 && plotted[index - 1].value !== null;
103
+ const hasNext = index < plotted.length - 1 && plotted[index + 1].value !== null;
104
+ if (!hasPrev && !hasNext) isolatedPoints.push(point);
105
+ });
106
+ });
107
+ const step = categories.length > 1 ? categoryScale.step() : plotWidth;
108
+ categories.forEach((label, index) => {
109
+ const x = xAt(index);
110
+ const points = pointsByCategory[index];
111
+ const rawBandX = x - step / 2;
112
+ const bandX = Math.max(0, rawBandX);
113
+ const bandWidth = Math.min(plotWidth, rawBandX + step) - bandX;
114
+ columns.push({
115
+ categoryIndex: index,
116
+ label,
117
+ x,
118
+ bandX,
119
+ bandWidth,
120
+ points,
121
+ anchorY: points.length > 0 ? Math.min(...points.map((p) => p.y)) : baselineY
122
+ });
123
+ });
124
+ return {
125
+ paths,
126
+ columns,
127
+ isolatedPoints,
128
+ categories,
129
+ valueScale,
130
+ step
131
+ };
132
+ }
133
+ //#endregion
134
+ export { buildLineChartGeometry, getLineValueDomain };
@@ -0,0 +1,60 @@
1
+ import type { ChartPalette, PieChartSliceDatum } from "./types";
2
+ /**
3
+ * Pie and donut geometry.
4
+ *
5
+ * Produces a flat array of finished arcs — path, anchor, colour and share all
6
+ * resolved — so the component body is a `.map()`.
7
+ *
8
+ * Pure: no React, no theme access. Colours arrive through a resolver callback.
9
+ */
10
+ /** One rendered arc. */
11
+ export interface PieChartArc {
12
+ /** React key. The slice key, or `AGGREGATED_SLICE_KEY` for the folded bucket. */
13
+ id: string;
14
+ label: string;
15
+ /** Summed value for the aggregated bucket, the slice's own otherwise. */
16
+ value: number;
17
+ /** Share of the total, 0–1. */
18
+ share: number;
19
+ /** `d` for the arc. */
20
+ path: string;
21
+ /** Anchor for the tooltip, just outside the arc's outer edge. */
22
+ anchorX: number;
23
+ anchorY: number;
24
+ color: string;
25
+ }
26
+ export interface PieChartGeometry {
27
+ arcs: PieChartArc[];
28
+ /** Centre of the pie, in plot coordinates. */
29
+ centerX: number;
30
+ centerY: number;
31
+ innerRadius: number;
32
+ }
33
+ interface BuildPieChartGeometryArgs<TSlice extends string> {
34
+ slices: PieChartSliceDatum<TSlice>[];
35
+ plotWidth: number;
36
+ plotHeight: number;
37
+ /** Hole size as a fraction of the outer radius. `0` is a solid pie. */
38
+ innerRadiusRatio?: number;
39
+ padAngle?: number;
40
+ cornerRadius?: number;
41
+ /**
42
+ * Slices below this share of the total are folded into one bucket.
43
+ *
44
+ * `0` disables folding. A donut with forty slivers communicates nothing, and
45
+ * the slivers are individually unhoverable, so a modest default is kinder
46
+ * than faithfully rendering every one.
47
+ */
48
+ minSliceShare?: number;
49
+ /** Label for the folded bucket. */
50
+ aggregatedLabel?: string;
51
+ resolveColor: (args: {
52
+ sliceKey: TSlice | null;
53
+ explicit?: ChartPalette;
54
+ }) => string;
55
+ /** Palette override declared by the caller for a given slice. */
56
+ getSliceColor?: (sliceKey: TSlice) => ChartPalette | undefined;
57
+ getSliceLabel: (sliceKey: TSlice) => string;
58
+ }
59
+ export declare function buildPieChartGeometry<TSlice extends string>({ slices, plotWidth, plotHeight, innerRadiusRatio, padAngle, cornerRadius, minSliceShare, aggregatedLabel, resolveColor, getSliceColor, getSliceLabel, }: BuildPieChartGeometryArgs<TSlice>): PieChartGeometry;
60
+ export {};
@@ -0,0 +1,79 @@
1
+ import { AGGREGATED_SLICE_KEY, PIE_DONUT_INNER_RATIO, PIE_MAX_AUTO_INNER_RATIO, PIE_MAX_INSET_SHARE, PIE_PAD_ANGLE } from "./constants.js";
2
+ import { sanitizeValue } from "./chartScales.js";
3
+ import { arc, pie } from "d3-shape";
4
+ //#region src/charts/pieChartGeometry.ts
5
+ function buildPieChartGeometry({ slices, plotWidth, plotHeight, innerRadiusRatio = PIE_DONUT_INNER_RATIO, padAngle = PIE_PAD_ANGLE, cornerRadius = 2, minSliceShare = 0, aggregatedLabel = "Other", resolveColor, getSliceColor, getSliceLabel }) {
6
+ const outerRadius = Math.max(0, Math.min(plotWidth, plotHeight) / 2);
7
+ const gapWidth = outerRadius * Math.max(0, padAngle);
8
+ const requestedInnerRadius = outerRadius * Math.min(Math.max(innerRadiusRatio, 0), .95);
9
+ const centerX = plotWidth / 2;
10
+ const centerY = plotHeight / 2;
11
+ const sanitized = slices.map((slice) => ({
12
+ sliceKey: slice.key,
13
+ value: Math.max(0, sanitizeValue(slice.value))
14
+ }));
15
+ const total = sanitized.reduce((sum, slice) => sum + slice.value, 0);
16
+ const empty = {
17
+ arcs: [],
18
+ centerX,
19
+ centerY,
20
+ innerRadius: requestedInnerRadius
21
+ };
22
+ if (total <= 0 || outerRadius <= 0) return empty;
23
+ const kept = [];
24
+ let foldedValue = 0;
25
+ for (const slice of sanitized) {
26
+ const share = slice.value / total;
27
+ if (minSliceShare > 0 && share < minSliceShare) {
28
+ foldedValue += slice.value;
29
+ continue;
30
+ }
31
+ kept.push({
32
+ sliceKey: slice.sliceKey,
33
+ label: getSliceLabel(slice.sliceKey),
34
+ value: slice.value,
35
+ explicit: getSliceColor?.(slice.sliceKey),
36
+ isAggregated: false
37
+ });
38
+ }
39
+ if (foldedValue > 0) kept.push({
40
+ sliceKey: null,
41
+ label: aggregatedLabel,
42
+ value: foldedValue,
43
+ isAggregated: true
44
+ });
45
+ const maxInset = kept.reduce((min, slice) => Math.min(min, slice.value), Infinity) / total * 2 * Math.PI * PIE_MAX_INSET_SHARE / 2;
46
+ const solvedInnerRadius = gapWidth > 0 && maxInset > 0 ? gapWidth / 2 / Math.sin(maxInset) : 0;
47
+ const innerRadius = Math.max(requestedInnerRadius, Math.min(solvedInnerRadius, outerRadius * PIE_MAX_AUTO_INNER_RATIO));
48
+ const layout = pie().sort(null).value((slice) => slice.value).padAngle(padAngle);
49
+ const arcGenerator = arc().innerRadius(innerRadius).outerRadius(outerRadius).cornerRadius(cornerRadius);
50
+ return {
51
+ arcs: layout(kept).map((slot) => {
52
+ const slice = slot.data;
53
+ const midAngle = (slot.startAngle + slot.endAngle) / 2;
54
+ const anchorRadius = outerRadius + 8;
55
+ return {
56
+ id: slice.isAggregated ? AGGREGATED_SLICE_KEY : slice.sliceKey,
57
+ label: slice.label,
58
+ value: slice.value,
59
+ share: slice.value / total,
60
+ path: arcGenerator({
61
+ startAngle: slot.startAngle,
62
+ endAngle: slot.endAngle,
63
+ padAngle: slot.padAngle
64
+ }) ?? "",
65
+ anchorX: centerX + Math.sin(midAngle) * anchorRadius,
66
+ anchorY: centerY - Math.cos(midAngle) * anchorRadius,
67
+ color: resolveColor({
68
+ sliceKey: slice.sliceKey,
69
+ explicit: slice.explicit
70
+ })
71
+ };
72
+ }),
73
+ centerX,
74
+ centerY,
75
+ innerRadius
76
+ };
77
+ }
78
+ //#endregion
79
+ export { buildPieChartGeometry };