@k2b/ui 0.52.0 → 0.53.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 (320) hide show
  1. package/dist/base.css +17 -0
  2. package/dist/browser/actions/SplitButton.js +10 -1
  3. package/dist/browser/actions/SplitButton.js.map +1 -1
  4. package/dist/browser/actions/Toolbar.js +83 -51
  5. package/dist/browser/actions/Toolbar.js.map +1 -1
  6. package/dist/browser/actions/index.js +1 -1
  7. package/dist/browser/actions/index.js.map +1 -1
  8. package/dist/browser/charts/core/area.js +1 -1
  9. package/dist/browser/charts/core/area.js.map +1 -1
  10. package/dist/browser/charts/core/bar-base-render.js +10 -0
  11. package/dist/browser/charts/core/bar-base-render.js.map +1 -0
  12. package/dist/browser/charts/core/bar-common.js +63 -0
  13. package/dist/browser/charts/core/bar-common.js.map +1 -0
  14. package/dist/browser/charts/core/bar-labels.js +12 -0
  15. package/dist/browser/charts/core/bar-labels.js.map +1 -1
  16. package/dist/browser/charts/core/bar-render.js +10 -0
  17. package/dist/browser/charts/core/bar-render.js.map +1 -0
  18. package/dist/browser/charts/core/bar-series.js +112 -0
  19. package/dist/browser/charts/core/bar-series.js.map +1 -0
  20. package/dist/browser/charts/core/calendar.js +63 -47
  21. package/dist/browser/charts/core/calendar.js.map +1 -1
  22. package/dist/browser/charts/core/dot-options.js +28 -0
  23. package/dist/browser/charts/core/dot-options.js.map +1 -0
  24. package/dist/browser/charts/core/dots.js +12 -0
  25. package/dist/browser/charts/core/dots.js.map +1 -0
  26. package/dist/browser/charts/core/index.js +14 -2
  27. package/dist/browser/charts/core/index.js.map +1 -1
  28. package/dist/browser/charts/core/line-base.js +102 -0
  29. package/dist/browser/charts/core/line-base.js.map +1 -0
  30. package/dist/browser/charts/core/line-details.js +264 -0
  31. package/dist/browser/charts/core/line-details.js.map +1 -0
  32. package/dist/browser/charts/core/line-options.js +32 -0
  33. package/dist/browser/charts/core/line-options.js.map +1 -0
  34. package/dist/browser/charts/core/line-paths.js +60 -0
  35. package/dist/browser/charts/core/line-paths.js.map +1 -0
  36. package/dist/browser/charts/core/line.js +15 -0
  37. package/dist/browser/charts/core/line.js.map +1 -0
  38. package/dist/browser/charts/core/palette.js +11 -0
  39. package/dist/browser/charts/core/palette.js.map +1 -0
  40. package/dist/browser/charts/core/pareto.js +23 -5
  41. package/dist/browser/charts/core/pareto.js.map +1 -1
  42. package/dist/browser/charts/core/registry.js +4 -2
  43. package/dist/browser/charts/core/registry.js.map +1 -1
  44. package/dist/browser/charts/core/render-size.js +4 -1
  45. package/dist/browser/charts/core/render-size.js.map +1 -1
  46. package/dist/browser/charts/core/render.js +23 -7
  47. package/dist/browser/charts/core/render.js.map +1 -1
  48. package/dist/browser/charts/core/sankey-size.js +105 -0
  49. package/dist/browser/charts/core/sankey-size.js.map +1 -0
  50. package/dist/browser/charts/core/sankey.js +280 -0
  51. package/dist/browser/charts/core/sankey.js.map +1 -0
  52. package/dist/browser/charts/core/snapshot.js +4 -2
  53. package/dist/browser/charts/core/snapshot.js.map +1 -1
  54. package/dist/browser/charts/core/svg-common.js +5 -67
  55. package/dist/browser/charts/core/svg-common.js.map +1 -1
  56. package/dist/browser/charts/core/svg-format.js +7 -0
  57. package/dist/browser/charts/core/svg-format.js.map +1 -0
  58. package/dist/browser/charts/core/svg-renderers.js +10 -108
  59. package/dist/browser/charts/core/svg-renderers.js.map +1 -1
  60. package/dist/browser/charts/core/treemap.js +1 -1
  61. package/dist/browser/charts/core/treemap.js.map +1 -1
  62. package/dist/browser/charts/description.js.map +1 -1
  63. package/dist/browser/charts.js +2 -1
  64. package/dist/browser/charts.js.map +1 -1
  65. package/dist/browser/content/ChartExplorer.js +22 -7
  66. package/dist/browser/content/ChartExplorer.js.map +1 -1
  67. package/dist/browser/content/ChartRoot.js +69 -52
  68. package/dist/browser/content/ChartRoot.js.map +1 -1
  69. package/dist/browser/content/ChartSnapshotView.js +18 -11
  70. package/dist/browser/content/ChartSnapshotView.js.map +1 -1
  71. package/dist/browser/content/chart-bar.js +50 -200
  72. package/dist/browser/content/chart-bar.js.map +1 -1
  73. package/dist/browser/content/chart-calendar.js +30 -14
  74. package/dist/browser/content/chart-calendar.js.map +1 -1
  75. package/dist/browser/content/chart-inspection-core.js +13 -6
  76. package/dist/browser/content/chart-inspection-core.js.map +1 -1
  77. package/dist/browser/content/chart-message-catalog.js +8 -0
  78. package/dist/browser/content/chart-message-catalog.js.map +1 -1
  79. package/dist/browser/content/chart-sankey.js +13 -0
  80. package/dist/browser/content/chart-sankey.js.map +1 -0
  81. package/dist/browser/content/chart-svg.js +1 -1
  82. package/dist/browser/content/chart-svg.js.map +1 -1
  83. package/dist/browser/content/chart-time-axis.js +10 -108
  84. package/dist/browser/content/chart-time-axis.js.map +1 -1
  85. package/dist/browser/content/chart-time-calendar.js +108 -0
  86. package/dist/browser/content/chart-time-calendar.js.map +1 -0
  87. package/dist/browser/inputs/DatePicker.js +30 -21
  88. package/dist/browser/inputs/DatePicker.js.map +1 -1
  89. package/dist/browser/inputs/NumberInput.js +188 -160
  90. package/dist/browser/inputs/NumberInput.js.map +1 -1
  91. package/dist/browser/inputs/Select.js +433 -400
  92. package/dist/browser/inputs/Select.js.map +1 -1
  93. package/dist/browser/inputs/Switch.js +203 -77
  94. package/dist/browser/inputs/Switch.js.map +1 -1
  95. package/dist/browser/inputs/TextInput.js +212 -188
  96. package/dist/browser/inputs/TextInput.js.map +1 -1
  97. package/dist/browser/inputs/field-contract.js.map +1 -1
  98. package/dist/browser/inputs/field-suggestion-slot.js +21 -0
  99. package/dist/browser/inputs/field-suggestion-slot.js.map +1 -0
  100. package/dist/browser/inputs/field-suggestion-types.js +2 -0
  101. package/dist/browser/inputs/field-suggestion-types.js.map +1 -0
  102. package/dist/browser/inputs/field-suggestion.js +502 -0
  103. package/dist/browser/inputs/field-suggestion.js.map +1 -0
  104. package/dist/browser/inputs/index.js +1 -0
  105. package/dist/browser/inputs/index.js.map +1 -1
  106. package/dist/browser/inputs/suggestion-messages.js +160 -0
  107. package/dist/browser/inputs/suggestion-messages.js.map +1 -0
  108. package/dist/browser/layout/AppOverview.js +15 -5
  109. package/dist/browser/layout/AppOverview.js.map +1 -1
  110. package/dist/browser/layout/DetailPanel.js +66 -411
  111. package/dist/browser/layout/DetailPanel.js.map +1 -1
  112. package/dist/browser/layout/DetailSections.js +8 -7
  113. package/dist/browser/layout/DetailSections.js.map +1 -1
  114. package/dist/browser/layout/Discussion.js +194 -246
  115. package/dist/browser/layout/Discussion.js.map +1 -1
  116. package/dist/browser/layout/detail-panel-messages.js +1 -1
  117. package/dist/browser/layout/detail-panel-messages.js.map +1 -1
  118. package/dist/browser/layout/index.js.map +1 -1
  119. package/dist/browser/surfaces/Field.js +102 -0
  120. package/dist/browser/surfaces/Field.js.map +1 -0
  121. package/dist/browser/surfaces/LinkCard.js +70 -21
  122. package/dist/browser/surfaces/LinkCard.js.map +1 -1
  123. package/dist/browser/surfaces/NoticeRow.js +75 -0
  124. package/dist/browser/surfaces/NoticeRow.js.map +1 -0
  125. package/dist/browser/surfaces/Section.js +441 -0
  126. package/dist/browser/surfaces/Section.js.map +1 -0
  127. package/dist/browser/surfaces/index.js +3 -0
  128. package/dist/browser/surfaces/index.js.map +1 -1
  129. package/dist/browser/surfaces/section-messages.js +25 -0
  130. package/dist/browser/surfaces/section-messages.js.map +1 -0
  131. package/dist/ssr/actions/SplitButton.js +10 -1
  132. package/dist/ssr/actions/SplitButton.js.map +1 -1
  133. package/dist/ssr/actions/Toolbar.js +40 -16
  134. package/dist/ssr/actions/Toolbar.js.map +1 -1
  135. package/dist/ssr/actions/index.js +1 -1
  136. package/dist/ssr/actions/index.js.map +1 -1
  137. package/dist/ssr/charts/core/area.js +1 -1
  138. package/dist/ssr/charts/core/area.js.map +1 -1
  139. package/dist/ssr/charts/core/bar-base-render.js +10 -0
  140. package/dist/ssr/charts/core/bar-base-render.js.map +1 -0
  141. package/dist/ssr/charts/core/bar-common.js +63 -0
  142. package/dist/ssr/charts/core/bar-common.js.map +1 -0
  143. package/dist/ssr/charts/core/bar-labels.js +12 -0
  144. package/dist/ssr/charts/core/bar-labels.js.map +1 -1
  145. package/dist/ssr/charts/core/bar-render.js +10 -0
  146. package/dist/ssr/charts/core/bar-render.js.map +1 -0
  147. package/dist/ssr/charts/core/bar-series.js +112 -0
  148. package/dist/ssr/charts/core/bar-series.js.map +1 -0
  149. package/dist/ssr/charts/core/calendar.js +63 -47
  150. package/dist/ssr/charts/core/calendar.js.map +1 -1
  151. package/dist/ssr/charts/core/dot-options.js +28 -0
  152. package/dist/ssr/charts/core/dot-options.js.map +1 -0
  153. package/dist/ssr/charts/core/dots.js +12 -0
  154. package/dist/ssr/charts/core/dots.js.map +1 -0
  155. package/dist/ssr/charts/core/index.js +14 -2
  156. package/dist/ssr/charts/core/index.js.map +1 -1
  157. package/dist/ssr/charts/core/line-base.js +102 -0
  158. package/dist/ssr/charts/core/line-base.js.map +1 -0
  159. package/dist/ssr/charts/core/line-details.js +264 -0
  160. package/dist/ssr/charts/core/line-details.js.map +1 -0
  161. package/dist/ssr/charts/core/line-options.js +32 -0
  162. package/dist/ssr/charts/core/line-options.js.map +1 -0
  163. package/dist/ssr/charts/core/line-paths.js +60 -0
  164. package/dist/ssr/charts/core/line-paths.js.map +1 -0
  165. package/dist/ssr/charts/core/line.js +15 -0
  166. package/dist/ssr/charts/core/line.js.map +1 -0
  167. package/dist/ssr/charts/core/palette.js +11 -0
  168. package/dist/ssr/charts/core/palette.js.map +1 -0
  169. package/dist/ssr/charts/core/pareto.js +23 -5
  170. package/dist/ssr/charts/core/pareto.js.map +1 -1
  171. package/dist/ssr/charts/core/registry.js +4 -2
  172. package/dist/ssr/charts/core/registry.js.map +1 -1
  173. package/dist/ssr/charts/core/render-size.js +4 -1
  174. package/dist/ssr/charts/core/render-size.js.map +1 -1
  175. package/dist/ssr/charts/core/render.js +23 -7
  176. package/dist/ssr/charts/core/render.js.map +1 -1
  177. package/dist/ssr/charts/core/sankey-size.js +105 -0
  178. package/dist/ssr/charts/core/sankey-size.js.map +1 -0
  179. package/dist/ssr/charts/core/sankey.js +280 -0
  180. package/dist/ssr/charts/core/sankey.js.map +1 -0
  181. package/dist/ssr/charts/core/snapshot.js +4 -2
  182. package/dist/ssr/charts/core/snapshot.js.map +1 -1
  183. package/dist/ssr/charts/core/svg-common.js +5 -67
  184. package/dist/ssr/charts/core/svg-common.js.map +1 -1
  185. package/dist/ssr/charts/core/svg-format.js +7 -0
  186. package/dist/ssr/charts/core/svg-format.js.map +1 -0
  187. package/dist/ssr/charts/core/svg-renderers.js +10 -108
  188. package/dist/ssr/charts/core/svg-renderers.js.map +1 -1
  189. package/dist/ssr/charts/core/treemap.js +1 -1
  190. package/dist/ssr/charts/core/treemap.js.map +1 -1
  191. package/dist/ssr/charts/description.js.map +1 -1
  192. package/dist/ssr/charts.js +2 -1
  193. package/dist/ssr/charts.js.map +1 -1
  194. package/dist/ssr/content/ChartExplorer.js +16 -4
  195. package/dist/ssr/content/ChartExplorer.js.map +1 -1
  196. package/dist/ssr/content/ChartRoot.js +24 -12
  197. package/dist/ssr/content/ChartRoot.js.map +1 -1
  198. package/dist/ssr/content/ChartSnapshotView.js +6 -2
  199. package/dist/ssr/content/ChartSnapshotView.js.map +1 -1
  200. package/dist/ssr/content/chart-bar.js +50 -200
  201. package/dist/ssr/content/chart-bar.js.map +1 -1
  202. package/dist/ssr/content/chart-calendar.js +30 -14
  203. package/dist/ssr/content/chart-calendar.js.map +1 -1
  204. package/dist/ssr/content/chart-inspection-core.js +13 -6
  205. package/dist/ssr/content/chart-inspection-core.js.map +1 -1
  206. package/dist/ssr/content/chart-message-catalog.js +8 -0
  207. package/dist/ssr/content/chart-message-catalog.js.map +1 -1
  208. package/dist/ssr/content/chart-sankey.js +13 -0
  209. package/dist/ssr/content/chart-sankey.js.map +1 -0
  210. package/dist/ssr/content/chart-svg.js +1 -1
  211. package/dist/ssr/content/chart-svg.js.map +1 -1
  212. package/dist/ssr/content/chart-time-axis.js +10 -108
  213. package/dist/ssr/content/chart-time-axis.js.map +1 -1
  214. package/dist/ssr/content/chart-time-calendar.js +108 -0
  215. package/dist/ssr/content/chart-time-calendar.js.map +1 -0
  216. package/dist/ssr/inputs/DatePicker.js +30 -21
  217. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  218. package/dist/ssr/inputs/NumberInput.js +33 -7
  219. package/dist/ssr/inputs/NumberInput.js.map +1 -1
  220. package/dist/ssr/inputs/Select.js +38 -7
  221. package/dist/ssr/inputs/Select.js.map +1 -1
  222. package/dist/ssr/inputs/Switch.js +79 -18
  223. package/dist/ssr/inputs/Switch.js.map +1 -1
  224. package/dist/ssr/inputs/TextInput.js +31 -7
  225. package/dist/ssr/inputs/TextInput.js.map +1 -1
  226. package/dist/ssr/inputs/field-contract.js.map +1 -1
  227. package/dist/ssr/inputs/field-suggestion-slot.js +21 -0
  228. package/dist/ssr/inputs/field-suggestion-slot.js.map +1 -0
  229. package/dist/ssr/inputs/field-suggestion-types.js +2 -0
  230. package/dist/ssr/inputs/field-suggestion-types.js.map +1 -0
  231. package/dist/ssr/inputs/field-suggestion.js +402 -0
  232. package/dist/ssr/inputs/field-suggestion.js.map +1 -0
  233. package/dist/ssr/inputs/index.js +1 -0
  234. package/dist/ssr/inputs/index.js.map +1 -1
  235. package/dist/ssr/inputs/suggestion-messages.js +160 -0
  236. package/dist/ssr/inputs/suggestion-messages.js.map +1 -0
  237. package/dist/ssr/layout/AppOverview.js +3 -3
  238. package/dist/ssr/layout/AppOverview.js.map +1 -1
  239. package/dist/ssr/layout/DetailPanel.js +24 -220
  240. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  241. package/dist/ssr/layout/DetailSections.js +8 -7
  242. package/dist/ssr/layout/DetailSections.js.map +1 -1
  243. package/dist/ssr/layout/Discussion.js +56 -76
  244. package/dist/ssr/layout/Discussion.js.map +1 -1
  245. package/dist/ssr/layout/detail-panel-messages.js +1 -1
  246. package/dist/ssr/layout/detail-panel-messages.js.map +1 -1
  247. package/dist/ssr/layout/index.js.map +1 -1
  248. package/dist/ssr/surfaces/Field.js +58 -0
  249. package/dist/ssr/surfaces/Field.js.map +1 -0
  250. package/dist/ssr/surfaces/LinkCard.js +38 -5
  251. package/dist/ssr/surfaces/LinkCard.js.map +1 -1
  252. package/dist/ssr/surfaces/NoticeRow.js +39 -0
  253. package/dist/ssr/surfaces/NoticeRow.js.map +1 -0
  254. package/dist/ssr/surfaces/Section.js +295 -0
  255. package/dist/ssr/surfaces/Section.js.map +1 -0
  256. package/dist/ssr/surfaces/index.js +3 -0
  257. package/dist/ssr/surfaces/index.js.map +1 -1
  258. package/dist/ssr/surfaces/section-messages.js +25 -0
  259. package/dist/ssr/surfaces/section-messages.js.map +1 -0
  260. package/dist/styles.css +1 -1
  261. package/dist/tabler.css +2 -1
  262. package/dist/types/actions/SplitButton.d.ts +5 -1
  263. package/dist/types/actions/Toolbar.d.ts +18 -1
  264. package/dist/types/actions/index.d.ts +2 -2
  265. package/dist/types/charts/core/bar-base-render.d.ts +7 -0
  266. package/dist/types/charts/core/bar-common.d.ts +13 -0
  267. package/dist/types/charts/core/bar-labels.d.ts +1 -0
  268. package/dist/types/charts/core/bar-render.d.ts +7 -0
  269. package/dist/types/charts/core/bar-series.d.ts +7 -0
  270. package/dist/types/charts/core/calendar.d.ts +9 -0
  271. package/dist/types/charts/core/dot-options.d.ts +27 -0
  272. package/dist/types/charts/core/dots.d.ts +7 -0
  273. package/dist/types/charts/core/index.d.ts +14 -2
  274. package/dist/types/charts/core/line-base.d.ts +3 -0
  275. package/dist/types/charts/core/line-details.d.ts +30 -0
  276. package/dist/types/charts/core/line-options.d.ts +25 -0
  277. package/dist/types/charts/core/line-paths.d.ts +16 -0
  278. package/dist/types/charts/core/line.d.ts +2 -0
  279. package/dist/types/charts/core/palette.d.ts +5 -0
  280. package/dist/types/charts/core/pareto.d.ts +2 -0
  281. package/dist/types/charts/core/registry.d.ts +3 -1
  282. package/dist/types/charts/core/render.d.ts +4 -1
  283. package/dist/types/charts/core/sankey-size.d.ts +38 -0
  284. package/dist/types/charts/core/sankey.d.ts +106 -0
  285. package/dist/types/charts/core/snapshot.d.ts +2 -0
  286. package/dist/types/charts/core/svg-common.d.ts +23 -16
  287. package/dist/types/charts/core/svg-format.d.ts +1 -0
  288. package/dist/types/charts/core/svg-renderers.d.ts +9 -9
  289. package/dist/types/charts/description.d.ts +39 -1
  290. package/dist/types/charts.d.ts +2 -1
  291. package/dist/types/content/ChartExplorer.d.ts +2 -0
  292. package/dist/types/content/chart-bar.d.ts +27 -19
  293. package/dist/types/content/chart-inspection-core.d.ts +4 -1
  294. package/dist/types/content/chart-sankey.d.ts +3 -0
  295. package/dist/types/content/chart-svg.d.ts +1 -1
  296. package/dist/types/content/chart-time-axis.d.ts +3 -19
  297. package/dist/types/content/chart-time-calendar.d.ts +24 -0
  298. package/dist/types/inputs/DatePicker.d.ts +4 -2
  299. package/dist/types/inputs/NumberInput.d.ts +2 -2
  300. package/dist/types/inputs/Select.d.ts +2 -2
  301. package/dist/types/inputs/Switch.d.ts +8 -2
  302. package/dist/types/inputs/TextInput.d.ts +4 -2
  303. package/dist/types/inputs/field-contract.d.ts +1 -0
  304. package/dist/types/inputs/field-suggestion-slot.d.ts +3 -0
  305. package/dist/types/inputs/field-suggestion-types.d.ts +103 -0
  306. package/dist/types/inputs/field-suggestion.d.ts +26 -0
  307. package/dist/types/inputs/index.d.ts +3 -1
  308. package/dist/types/inputs/suggestion-messages.d.ts +67 -0
  309. package/dist/types/layout/AppOverview.d.ts +2 -0
  310. package/dist/types/layout/DetailPanel.d.ts +4 -37
  311. package/dist/types/layout/detail-panel-messages.d.ts +1 -1
  312. package/dist/types/layout/index.d.ts +1 -1
  313. package/dist/types/surfaces/Field.d.ts +20 -0
  314. package/dist/types/surfaces/LinkCard.d.ts +9 -1
  315. package/dist/types/surfaces/NoticeRow.d.ts +23 -0
  316. package/dist/types/surfaces/Section.d.ts +74 -0
  317. package/dist/types/surfaces/index.d.ts +6 -0
  318. package/dist/types/surfaces/section-messages.d.ts +10 -0
  319. package/package.json +2 -2
  320. /package/dist/{tabler-icons-15sezdfp.woff2 → tabler-icons-dafbdda4cb0cdcb2.woff2} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["charts/core/index.ts"],"sourcesContent":["/** Portable chart contracts. This entry never imports Solid or browser APIs. */\n\nexport {\n type BarChartLayout,\n type BarChartOptions,\n barChartLayout,\n rankedBarLayout,\n renderBarChartSvg,\n seriesBarLayout,\n} from \"../../content/chart-bar\";\nexport {\n renderStateTimelineSvg,\n type StateTimelineChartOptions,\n type StateTimelineDomain,\n stateTimelineDomain,\n stateTimelineHeight,\n} from \"../../content/chart-state-timeline\";\nexport { type ChartTimeAxis } from \"../../content/chart-time-axis\";\nexport { type AreaOptions, areaLayout, renderAreaSvg } from \"./area\";\nexport * from \"./bubble\";\nexport * from \"./calendar\";\nexport { type FunnelLayout, type FunnelOptions, funnelLayout, renderFunnelLayoutSvg, renderFunnelSvg } from \"./funnel\";\nexport { type HorizontalBarLayout, type HorizontalBarOptions, hbarLayout, renderHbarLayoutSvg, renderHbarSvg } from \"./hbar\";\nexport * from \"./inspection\";\nexport { map } from \"./map\";\nexport * from \"./pareto\";\n\nexport * from \"./radar\";\nexport * from \"./render\";\nexport { chartRenderHeight, preservesAspectRatio } from \"./render-size\";\nexport * from \"./snapshot\";\nexport { charts } from \"./svg\";\nexport {\n type AxisOptions,\n arcPathD,\n autoBin,\n type BarItem,\n bar,\n barGauge,\n boxplot,\n type ChartOptions,\n chartDatumSvg,\n computeBoxStats,\n computeDomain,\n donut,\n escapeXml,\n extendDomainToNice,\n gauge,\n heatmap,\n histogram,\n type LineStyle,\n line,\n linearRegression,\n linePathD,\n type MapOptions,\n type MapPoint,\n type MapSeries,\n type MapViewport,\n type MarkerShape,\n mapLog,\n mapRange,\n markerPath,\n niceLogTicks,\n niceStep,\n normalizePadding,\n type Padding,\n type Point,\n pie,\n type ReferenceLine,\n type Series,\n type SliceItem,\n scatter,\n smoothPathD,\n sparkline,\n stat,\n stateTimeline,\n stepPathD,\n svgRoot,\n} from \"./svg-renderers\";\nexport * from \"./treemap\";\nexport {\n type ChartDateFormat,\n type ChartDatum,\n type ChartDatumRole,\n type ChartFormat,\n type ChartKind,\n type ChartNumberFormat,\n chartDatumRoles,\n} from \"./types\";\n\nexport { renderWaterfallLayoutSvg, renderWaterfallSvg, type WaterfallLayout, type WaterfallOptions, waterfallLayout } from \"./waterfall\";\n"],"mappings":"AAAA;;AAEA,SAGE,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,QACV,yBAAyB;AAChC,SACE,sBAAsB,EAGtB,mBAAmB,EACnB,mBAAmB,QACd,oCAAoC;AAE3C,SAA2B,UAAU,EAAE,aAAa,QAAQ,QAAQ;AACpE,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,SAAgD,YAAY,EAAE,qBAAqB,EAAE,eAAe,QAAQ,UAAU;AACtH,SAA8D,UAAU,EAAE,mBAAmB,EAAE,aAAa,QAAQ,QAAQ;AAC5H,cAAc,cAAc;AAC5B,SAAS,GAAG,QAAQ,OAAO;AAC3B,cAAc,UAAU;AAExB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,SAAS,iBAAiB,EAAE,oBAAoB,QAAQ,eAAe;AACvE,cAAc,YAAY;AAC1B,SAAS,MAAM,QAAQ,OAAO;AAC9B,SAEE,QAAQ,EACR,OAAO,EAEP,GAAG,EACH,QAAQ,EACR,OAAO,EAEP,aAAa,EACb,eAAe,EACf,aAAa,EACb,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,OAAO,EACP,SAAS,EAET,IAAI,EACJ,gBAAgB,EAChB,SAAS,EAMT,MAAM,EACN,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAGhB,GAAG,EAIH,OAAO,EACP,WAAW,EACX,SAAS,EACT,IAAI,EACJ,aAAa,EACb,SAAS,EACT,OAAO,QACF,iBAAiB;AACxB,cAAc,WAAW;AACzB,SAOE,eAAe,QACV,SAAS;AAEhB,SAAS,wBAAwB,EAAE,kBAAkB,EAA+C,eAAe,QAAQ,aAAa","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["charts/core/index.ts"],"sourcesContent":["/** Portable chart contracts. This entry never imports Solid or browser APIs. */\n\nexport {\n type BarChartLayout,\n type BarChartOptions,\n barChartLayout,\n rankedBarLayout,\n type SeriesBarLayout,\n seriesBarLayout,\n} from \"../../content/chart-bar\";\nexport {\n renderStateTimelineSvg,\n type StateTimelineChartOptions,\n type StateTimelineDomain,\n stateTimelineDomain,\n stateTimelineHeight,\n} from \"../../content/chart-state-timeline\";\nexport { type ChartTimeAxis } from \"../../content/chart-time-axis\";\nexport { calendarTimeLabel, calendarTimeTicks, chartTimeStep } from \"../../content/chart-time-calendar\";\nexport { type AreaOptions, areaLayout, renderAreaSvg } from \"./area\";\nexport { renderBarBaseSvg } from \"./bar-base-render\";\nexport { renderBarChartSvg } from \"./bar-render\";\nexport * from \"./bubble\";\nexport * from \"./calendar\";\nexport { nestedDotOptions } from \"./dot-options\";\nexport { renderDotMatrixLayoutSvg } from \"./dots\";\nexport { type FunnelLayout, type FunnelOptions, funnelLayout, renderFunnelLayoutSvg, renderFunnelSvg } from \"./funnel\";\nexport { renderHbarLayoutSvg, renderHbarSvg } from \"./hbar\";\nexport { type HorizontalBarLayout, type HorizontalBarOptions, hbarLayout } from \"./hbar-layout\";\nexport * from \"./inspection\";\nexport { lineBase } from \"./line-base\";\nexport { renderLineDetailsSvg } from \"./line-details\";\nexport { lineDetailsEnabled, lineForecastLayout } from \"./line-options\";\nexport { map } from \"./map\";\nexport { chartSvgWithUiPalette } from \"./palette\";\nexport * from \"./pareto\";\n\nexport * from \"./radar\";\nexport * from \"./render\";\nexport { chartRenderHeight, preservesAspectRatio } from \"./render-size\";\nexport { renderSankeySvg, type SankeyLink, type SankeyNode, type SankeyOptions, sankeyColor, sankeyLayout } from \"./sankey\";\nexport { sankeyFrame, sankeyGraph, sankeyWidth } from \"./sankey-size\";\nexport * from \"./snapshot\";\nexport { charts } from \"./svg\";\nexport {\n type AxisOptions,\n arcPathD,\n autoBin,\n type BarItem,\n bar,\n barGauge,\n boxplot,\n type ChartOptions,\n chartDatumSvg,\n computeBoxStats,\n computeDomain,\n donut,\n escapeXml,\n extendDomainToNice,\n gauge,\n heatmap,\n histogram,\n type LineStyle,\n line,\n linearRegression,\n linePathD,\n type MapOptions,\n type MapPoint,\n type MapSeries,\n type MapViewport,\n type MarkerShape,\n mapLog,\n mapRange,\n markerPath,\n niceLogTicks,\n niceStep,\n normalizePadding,\n type Padding,\n type Point,\n pie,\n type ReferenceLine,\n type Series,\n type SliceItem,\n scatter,\n smoothPathD,\n sparkline,\n stat,\n stateTimeline,\n stepPathD,\n svgRoot,\n} from \"./svg-renderers\";\nexport * from \"./treemap\";\nexport {\n type ChartDateFormat,\n type ChartDatum,\n type ChartDatumRole,\n type ChartFormat,\n type ChartKind,\n type ChartNumberFormat,\n chartDatumRoles,\n} from \"./types\";\n\nexport { renderWaterfallLayoutSvg, renderWaterfallSvg, type WaterfallLayout, type WaterfallOptions, waterfallLayout } from \"./waterfall\";\n"],"mappings":"AAAA;;AAEA,SAGE,cAAc,EACd,eAAe,EAEf,eAAe,QACV,yBAAyB;AAChC,SACE,sBAAsB,EAGtB,mBAAmB,EACnB,mBAAmB,QACd,oCAAoC;AAE3C,SAAS,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,QAAQ,mCAAmC;AACvG,SAA2B,UAAU,EAAE,aAAa,QAAQ,QAAQ;AACpE,SAAS,gBAAgB,QAAQ,mBAAmB;AACpD,SAAS,iBAAiB,QAAQ,cAAc;AAChD,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,wBAAwB,QAAQ,QAAQ;AACjD,SAAgD,YAAY,EAAE,qBAAqB,EAAE,eAAe,QAAQ,UAAU;AACtH,SAAS,mBAAmB,EAAE,aAAa,QAAQ,QAAQ;AAC3D,SAA8D,UAAU,QAAQ,eAAe;AAC/F,cAAc,cAAc;AAC5B,SAAS,QAAQ,QAAQ,aAAa;AACtC,SAAS,oBAAoB,QAAQ,gBAAgB;AACrD,SAAS,kBAAkB,EAAE,kBAAkB,QAAQ,gBAAgB;AACvE,SAAS,GAAG,QAAQ,OAAO;AAC3B,SAAS,qBAAqB,QAAQ,WAAW;AACjD,cAAc,UAAU;AAExB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,SAAS,iBAAiB,EAAE,oBAAoB,QAAQ,eAAe;AACvE,SAAS,eAAe,EAAwD,WAAW,EAAE,YAAY,QAAQ,UAAU;AAC3H,SAAS,WAAW,EAAE,WAAW,EAAE,WAAW,QAAQ,eAAe;AACrE,cAAc,YAAY;AAC1B,SAAS,MAAM,QAAQ,OAAO;AAC9B,SAEE,QAAQ,EACR,OAAO,EAEP,GAAG,EACH,QAAQ,EACR,OAAO,EAEP,aAAa,EACb,eAAe,EACf,aAAa,EACb,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,OAAO,EACP,SAAS,EAET,IAAI,EACJ,gBAAgB,EAChB,SAAS,EAMT,MAAM,EACN,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAGhB,GAAG,EAIH,OAAO,EACP,WAAW,EACX,SAAS,EACT,IAAI,EACJ,aAAa,EACb,SAAS,EACT,OAAO,QACF,iBAAiB;AACxB,cAAc,WAAW;AACzB,SAOE,eAAe,QACV,SAAS;AAEhB,SAAS,wBAAwB,EAAE,kBAAkB,EAA+C,eAAe,QAAQ,aAAa","ignoreList":[]}
@@ -0,0 +1,102 @@
1
+ /** The established line drawing; kept independent of opt-in line details for small hosts. */
2
+
3
+ import { collectAxisValues, collectSeriesLegend, computeAxisScale, computePlotArea, DEFAULT_HEIGHT, DEFAULT_LINE_STYLES, DEFAULT_WIDTH, emptyChart, fmt, inspectionPoint, isOnAxis, LINE_DASH_PATTERNS, linePathD, normalizePadding, pickMapper, pointValues, renderErrorBars, renderHeader, renderLegend, renderReferenceLines, renderXAxisNumeric, renderYAxis, resolveErrorY, smoothPathD, stepPathD, svgRoot } from "./svg-common";
4
+ export const lineBase = opts => {
5
+ const width = opts.width ?? DEFAULT_WIDTH;
6
+ const height = opts.height ?? DEFAULT_HEIGHT;
7
+ const padding = normalizePadding(opts.padding);
8
+ const header = renderHeader(width, opts.title, opts.subtitle);
9
+ const legendItems = collectSeriesLegend(opts);
10
+ const legendHeight = legendItems.length > 0 ? 20 : 0;
11
+ const finitePoints = opts.series.flatMap(s => s.data).filter(p => Number.isFinite(p.x) && Number.isFinite(p.y));
12
+ if (finitePoints.length === 0) return emptyChart(width, height, opts.className);
13
+ const area = computePlotArea(width, height, padding, !!opts.xAxis?.label, !!opts.yAxis?.label, header.height, legendHeight);
14
+ const xAxis = computeAxisScale(collectAxisValues(opts.series, "x"), opts.xAxis);
15
+ const yAxis = computeAxisScale(collectAxisValues(opts.series, "y"), opts.yAxis);
16
+ const xMap = pickMapper(xAxis.scale);
17
+ const yMap = pickMapper(yAxis.scale);
18
+ const body = [];
19
+ body.push(renderYAxis(yAxis, area, opts.yAxis));
20
+ body.push(renderXAxisNumeric(xAxis, area, height - legendHeight, opts.xAxis));
21
+
22
+ // Compute the area baseline (zero if it's in the y-domain, otherwise the
23
+ // bottom of the plot area). Log axes always start at the bottom.
24
+ const baselineY = yAxis.scale === "linear" && yAxis.domain[0] <= 0 && yAxis.domain[1] >= 0 ? yMap(0, yAxis.domain, [area.y1, area.y0]) : area.y1;
25
+
26
+ // Step plot takes precedence over smooth (treppe with curves doesn't make
27
+ // sense). Otherwise smooth is the default; explicit `smooth: false` opts out.
28
+ const pathFn = opts.step ? pts => stepPathD(pts, opts.step) : opts.smooth === false ? linePathD : smoothPathD;
29
+ opts.series.forEach((s, i) => {
30
+ const finite = s.data.filter(p => isOnAxis(xAxis, p.x) && isOnAxis(yAxis, p.y));
31
+ if (opts.inspect) s.data.forEach((p, index) => {
32
+ if (!isOnAxis(xAxis, p.x) || !isOnAxis(yAxis, p.y)) return;
33
+ body.push(inspectionPoint({
34
+ index,
35
+ seriesIndex: i,
36
+ role: "point",
37
+ label: s.label,
38
+ anchor: [xMap(p.x, xAxis.domain, [area.x0, area.x1]), yMap(p.y, yAxis.domain, [area.y1, area.y0])],
39
+ values: pointValues(p, opts.xAxis, opts.yAxis)
40
+ }, opts.inspect));
41
+ });
42
+ if (finite.length < 2) return;
43
+ const sorted = [...finite].sort((a, b) => a.x - b.x);
44
+ const mapped = sorted.map(p => ({
45
+ x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),
46
+ y: yMap(p.y, yAxis.domain, [area.y1, area.y0])
47
+ }));
48
+ const linePath = pathFn(mapped);
49
+
50
+ // Error band: filled translucent area between errYHigh and errYLow.
51
+ if (opts.errorBand) {
52
+ const upper = [];
53
+ const lower = [];
54
+ for (const p of sorted) {
55
+ const err = resolveErrorY(p);
56
+ if (!err) continue;
57
+ const [low, high] = err;
58
+ upper.push({
59
+ x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),
60
+ y: yMap(p.y + high, yAxis.domain, [area.y1, area.y0])
61
+ });
62
+ lower.push({
63
+ x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),
64
+ y: yMap(p.y - low, yAxis.domain, [area.y1, area.y0])
65
+ });
66
+ }
67
+ if (upper.length >= 2) {
68
+ const upperPath = pathFn(upper);
69
+ const lowerReversed = lower.slice().reverse();
70
+ const lowerSegments = lowerReversed.map(pt => ` L ${fmt(pt.x)} ${fmt(pt.y)}`).join("");
71
+ const bandPath = `${upperPath}${lowerSegments} Z`;
72
+ body.push(`<path class="stdlib-chart-error-band stdlib-chart-series-${i % 8}" d="${bandPath}"/>`);
73
+ }
74
+ }
75
+ if (opts.area) {
76
+ const last = mapped[mapped.length - 1];
77
+ const first = mapped[0];
78
+ const areaPath = `${linePath} L ${fmt(last.x)} ${fmt(baselineY)} L ${fmt(first.x)} ${fmt(baselineY)} Z`;
79
+ body.push(`<path class="stdlib-chart-area stdlib-chart-series-${i % 8}" d="${areaPath}"/>`);
80
+ }
81
+ const dashStyle = s.lineStyle ?? (opts.autoVariant ? DEFAULT_LINE_STYLES[i % DEFAULT_LINE_STYLES.length] : "solid");
82
+ const dashAttr = LINE_DASH_PATTERNS[dashStyle];
83
+ const cls = `stdlib-chart-line stdlib-chart-series-${i % 8}`;
84
+ const dashAttrStr = dashAttr ? ` stroke-dasharray="${dashAttr}"` : "";
85
+ body.push(`<path class="${cls}" d="${linePath}"${dashAttrStr}/>`);
86
+ });
87
+
88
+ // Error bars render after lines so caps don't disappear behind the stroke.
89
+ body.push(renderErrorBars(opts.series, xAxis, yAxis, area));
90
+
91
+ // References render AFTER data so labels stay on top.
92
+ if (opts.references && opts.references.length > 0) {
93
+ body.push(renderReferenceLines(opts.references, xAxis, yAxis, area));
94
+ }
95
+ const legend = renderLegend(legendItems, width, height - legendHeight);
96
+ return svgRoot({
97
+ width,
98
+ height,
99
+ className: opts.className
100
+ }, header.svg + body.join("") + legend.svg);
101
+ };
102
+ //# sourceMappingURL=line-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["charts/core/line-base.ts"],"sourcesContent":["/** The established line drawing; kept independent of opt-in line details for small hosts. */\n\nimport type { LineOptions } from \"./svg\";\nimport {\n collectAxisValues,\n collectSeriesLegend,\n computeAxisScale,\n computePlotArea,\n DEFAULT_HEIGHT,\n DEFAULT_LINE_STYLES,\n DEFAULT_WIDTH,\n emptyChart,\n fmt,\n inspectionPoint,\n isOnAxis,\n LINE_DASH_PATTERNS,\n linePathD,\n normalizePadding,\n pickMapper,\n pointValues,\n renderErrorBars,\n renderHeader,\n renderLegend,\n renderReferenceLines,\n renderXAxisNumeric,\n renderYAxis,\n resolveErrorY,\n smoothPathD,\n stepPathD,\n svgRoot,\n} from \"./svg-common\";\n\nexport const lineBase = (opts: LineOptions): string => {\n const width = opts.width ?? DEFAULT_WIDTH;\n const height = opts.height ?? DEFAULT_HEIGHT;\n const padding = normalizePadding(opts.padding);\n const header = renderHeader(width, opts.title, opts.subtitle);\n const legendItems = collectSeriesLegend(opts);\n const legendHeight = legendItems.length > 0 ? 20 : 0;\n\n const finitePoints = opts.series.flatMap((s) => s.data).filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y));\n if (finitePoints.length === 0) return emptyChart(width, height, opts.className);\n\n const area = computePlotArea(width, height, padding, !!opts.xAxis?.label, !!opts.yAxis?.label, header.height, legendHeight);\n const xAxis = computeAxisScale(collectAxisValues(opts.series, \"x\"), opts.xAxis);\n const yAxis = computeAxisScale(collectAxisValues(opts.series, \"y\"), opts.yAxis);\n const xMap = pickMapper(xAxis.scale);\n const yMap = pickMapper(yAxis.scale);\n\n const body: string[] = [];\n body.push(renderYAxis(yAxis, area, opts.yAxis));\n body.push(renderXAxisNumeric(xAxis, area, height - legendHeight, opts.xAxis));\n\n // Compute the area baseline (zero if it's in the y-domain, otherwise the\n // bottom of the plot area). Log axes always start at the bottom.\n const baselineY =\n yAxis.scale === \"linear\" && yAxis.domain[0] <= 0 && yAxis.domain[1] >= 0 ? yMap(0, yAxis.domain, [area.y1, area.y0]) : area.y1;\n\n // Step plot takes precedence over smooth (treppe with curves doesn't make\n // sense). Otherwise smooth is the default; explicit `smooth: false` opts out.\n const pathFn = opts.step\n ? (pts: Array<{ x: number; y: number }>) => stepPathD(pts, opts.step!)\n : opts.smooth === false\n ? linePathD\n : smoothPathD;\n\n opts.series.forEach((s, i) => {\n const finite = s.data.filter((p) => isOnAxis(xAxis, p.x) && isOnAxis(yAxis, p.y));\n if (opts.inspect)\n s.data.forEach((p, index) => {\n if (!isOnAxis(xAxis, p.x) || !isOnAxis(yAxis, p.y)) return;\n body.push(\n inspectionPoint(\n {\n index,\n seriesIndex: i,\n role: \"point\",\n label: s.label,\n anchor: [xMap(p.x, xAxis.domain, [area.x0, area.x1]), yMap(p.y, yAxis.domain, [area.y1, area.y0])],\n values: pointValues(p, opts.xAxis, opts.yAxis),\n },\n opts.inspect,\n ),\n );\n });\n if (finite.length < 2) return;\n const sorted = [...finite].sort((a, b) => a.x - b.x);\n const mapped = sorted.map((p) => ({\n x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),\n y: yMap(p.y, yAxis.domain, [area.y1, area.y0]),\n }));\n const linePath = pathFn(mapped);\n\n // Error band: filled translucent area between errYHigh and errYLow.\n if (opts.errorBand) {\n const upper: Array<{ x: number; y: number }> = [];\n const lower: Array<{ x: number; y: number }> = [];\n for (const p of sorted) {\n const err = resolveErrorY(p);\n if (!err) continue;\n const [low, high] = err;\n upper.push({\n x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),\n y: yMap(p.y + high, yAxis.domain, [area.y1, area.y0]),\n });\n lower.push({\n x: xMap(p.x, xAxis.domain, [area.x0, area.x1]),\n y: yMap(p.y - low, yAxis.domain, [area.y1, area.y0]),\n });\n }\n if (upper.length >= 2) {\n const upperPath = pathFn(upper);\n const lowerReversed = lower.slice().reverse();\n const lowerSegments = lowerReversed.map((pt) => ` L ${fmt(pt.x)} ${fmt(pt.y)}`).join(\"\");\n const bandPath = `${upperPath}${lowerSegments} Z`;\n body.push(`<path class=\"stdlib-chart-error-band stdlib-chart-series-${i % 8}\" d=\"${bandPath}\"/>`);\n }\n }\n\n if (opts.area) {\n const last = mapped[mapped.length - 1]!;\n const first = mapped[0]!;\n const areaPath = `${linePath} L ${fmt(last.x)} ${fmt(baselineY)} L ${fmt(first.x)} ${fmt(baselineY)} Z`;\n body.push(`<path class=\"stdlib-chart-area stdlib-chart-series-${i % 8}\" d=\"${areaPath}\"/>`);\n }\n\n const dashStyle = s.lineStyle ?? (opts.autoVariant ? DEFAULT_LINE_STYLES[i % DEFAULT_LINE_STYLES.length]! : \"solid\");\n const dashAttr = LINE_DASH_PATTERNS[dashStyle];\n const cls = `stdlib-chart-line stdlib-chart-series-${i % 8}`;\n const dashAttrStr = dashAttr ? ` stroke-dasharray=\"${dashAttr}\"` : \"\";\n body.push(`<path class=\"${cls}\" d=\"${linePath}\"${dashAttrStr}/>`);\n });\n\n // Error bars render after lines so caps don't disappear behind the stroke.\n body.push(renderErrorBars(opts.series, xAxis, yAxis, area));\n\n // References render AFTER data so labels stay on top.\n if (opts.references && opts.references.length > 0) {\n body.push(renderReferenceLines(opts.references, xAxis, yAxis, area));\n }\n\n const legend = renderLegend(legendItems, width, height - legendHeight);\n return svgRoot({ width, height, className: opts.className }, header.svg + body.join(\"\") + legend.svg);\n};\n"],"mappings":"AAAA;;AAGA,SACE,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,GAAG,EACH,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,QACF,cAAc;AAErB,OAAO,MAAM,QAAQ,GAAI,IAAiB,IAAa;EACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,aAAa;EACzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,cAAc;EAC5C,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;EAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;EAC7D,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC;EAC7C,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;EAEpD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAE,CAAC,IAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CA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** Existing line renderer, separated so detailed drawing stays behind lazy chart boundaries. */
2
+
3
+ import { lineForecastLayout, lineLegendX } from "./line-options";
4
+ import { chartDatumSvg, collectAxisValues, collectSeriesLegend, computeAxisScale, computeDomain, computePlotArea, DEFAULT_HEIGHT, DEFAULT_LINE_STYLES, DEFAULT_WIDTH, emptyChart, escapeXml, fmt, isOnAxis, LINE_DASH_PATTERNS, linePathD, normalizePadding, pickMapper, pointValues, renderErrorBars, renderHeader, renderReferenceLines, renderXAxisNumeric, renderYAxis, resolveErrorY, smoothPathD, stepPathD, svgRoot } from "./svg-common";
5
+
6
+ /**
7
+ * Render a line chart. Each series becomes a `<path class="stdlib-chart-line">`
8
+ * connecting its points (sorted by `x`). Multi-series charts get distinct
9
+ * `stdlib-chart-series-N` classes.
10
+ *
11
+ * Detailed lines split missing observations into runs and show isolated points.
12
+ * Existing descriptions retain their established filtering and gap behavior. An empty/all-non-finite chart renders
13
+ * an empty-state SVG.
14
+ *
15
+ * @example
16
+ * charts.line({ series: [{ data: [{x:1,y:10},{x:2,y:25},{x:3,y:18}] }] });
17
+ *
18
+ * @example
19
+ * charts.line({
20
+ * series: [
21
+ * { label: "Revenue", data: [...] },
22
+ * { label: "Costs", data: [...] },
23
+ * ],
24
+ * yAxis: { format: v => `$${v}k` },
25
+ * });
26
+ */
27
+
28
+ export const renderLineDetailsSvg = (opts, time, seriesLabel) => {
29
+ const {
30
+ chartTimeStep,
31
+ chartTimeTicks,
32
+ chartTimeLabel
33
+ } = time;
34
+ const forecast = lineForecastLayout(opts);
35
+ if (opts.maxGap !== undefined && (!Number.isFinite(opts.maxGap) || opts.maxGap <= 0)) throw new RangeError("Chart maxGap must be finite and positive");
36
+ if (opts.maxGap !== undefined && (opts.area || opts.errorBand)) throw new Error("Chart maxGap does not support area or errorBand fills");
37
+ if (opts.threshold && !isOnAxis({
38
+ scale: opts.yAxis?.scale ?? "linear"
39
+ }, opts.threshold.value)) throw new RangeError("Line threshold must be finite and positive on a log axis");
40
+ if (opts.marker && !isOnAxis({
41
+ scale: opts.xAxis?.scale ?? "linear"
42
+ }, opts.marker.at)) throw new RangeError("Line marker must be finite and positive on a log axis");
43
+ if (opts.marker && opts.xAxis?.domain && (opts.marker.at < opts.xAxis.domain[0] || opts.marker.at > opts.xAxis.domain[1])) throw new RangeError("Line marker must be inside the explicit X domain");
44
+ const width = opts.width ?? DEFAULT_WIDTH;
45
+ const height = opts.height ?? DEFAULT_HEIGHT;
46
+ const padding = normalizePadding(opts.padding);
47
+ const header = renderHeader(width, opts.title, opts.subtitle);
48
+ const legendItems = collectSeriesLegend(opts);
49
+ const legendHeight = legendItems.length > 2 ? 40 : legendItems.length ? 20 : 0;
50
+ const finitePoints = opts.series.flatMap(s => s.data).filter(p => Number.isFinite(p.x) && Number.isFinite(p.y));
51
+ if (finitePoints.length === 0) return emptyChart(width, height, opts.className);
52
+ const timeAxis = opts.timeAxis && {
53
+ ...opts.timeAxis,
54
+ locale: opts.timeAxis.locale ?? opts.locale
55
+ };
56
+ const xValues = [...collectAxisValues(opts.series, "x"), ...(opts.marker ? [opts.marker.at] : []), ...(timeAxis ? opts.references?.filter(ref => ref.axis === "x").map(ref => ref.value) ?? [] : [])];
57
+ const xAxis = computeAxisScale(xValues, timeAxis && !opts.xAxis?.domain ? {
58
+ ...opts.xAxis,
59
+ domain: computeDomain(xValues)
60
+ } : opts.xAxis);
61
+ const timeStep = timeAxis ? chartTimeStep(xAxis.domain[1] - xAxis.domain[0], (opts.xAxis?.ticks ?? 3) + 2) : undefined;
62
+ if (timeAxis && timeStep) {
63
+ xAxis.ticks = chartTimeTicks(xAxis.domain, timeAxis.timeZone, timeStep);
64
+ xAxis.minorTicks = [];
65
+ }
66
+ const bandValues = forecast.flatMap(p => Number.isFinite(p.y) && p.lo !== undefined && p.hi !== undefined ? [p.lo, p.hi] : []);
67
+ const yAxis = computeAxisScale([...collectAxisValues(opts.series, "y"), ...bandValues, ...(opts.zero ? [0] : []), ...(opts.threshold ? [opts.threshold.value] : [])], opts.yAxis);
68
+ const labelRoom = Math.max(...yAxis.ticks.map(tick => (opts.yAxis?.format?.(tick) ?? String(tick)).length * 6 + 12));
69
+ if ((opts.forecast || opts.zero || opts.threshold || opts.marker) && typeof opts.padding !== "number" && opts.padding?.left === undefined) padding.left = Math.max(padding.left, labelRoom);
70
+ const area = computePlotArea(width, height, padding, !!opts.xAxis?.label, !!opts.yAxis?.label, header.height, legendHeight);
71
+ const xMap = pickMapper(xAxis.scale),
72
+ yMap = pickMapper(yAxis.scale);
73
+ const x = value => xMap(value, xAxis.domain, [area.x0, area.x1]);
74
+ const y = value => yMap(value, yAxis.domain, [area.y1, area.y0]);
75
+ const palette = ["#3b82f6", "#10b981", "#f59e0b", "#8b5cf6", "#ec4899", "#06b6d4", "#84cc16", "#f97316"];
76
+ const paint = index => `var(--stdlib-chart-c${index % 8 + 1}, ${palette[index % 8]})`;
77
+ const body = [];
78
+ const inspectionMarks = [];
79
+ if (opts.zero && yAxis.scale === "linear" && yAxis.domain[0] < 0) {
80
+ const zeroY = y(Math.min(0, yAxis.domain[1]));
81
+ body.push(`<rect class="k2b-line-negative-zone" x="${fmt(area.x0)}" y="${fmt(zeroY)}" width="${fmt(area.x1 - area.x0)}" height="${fmt(area.y1 - zeroY)}" fill="var(--k2b-danger-500, #ef4444)" fill-opacity=".09" stroke="none"/>`);
82
+ }
83
+ body.push(renderYAxis(yAxis, area, opts.yAxis));
84
+ let xLabels = renderXAxisNumeric(xAxis, area, height - legendHeight, timeAxis && timeStep ? {
85
+ ...opts.xAxis,
86
+ format: opts.xAxis?.format ?? (value => chartTimeLabel(value, timeStep, timeAxis))
87
+ } : opts.xAxis);
88
+ if (timeAxis) {
89
+ let index = 0;
90
+ // Edge labels point into the plot, keeping the first date clear of the Y ticks.
91
+ xLabels = xLabels.replace(/<text class="stdlib-chart-tick-label"[^>]*>/g, tag => {
92
+ const anchor = index === 0 ? "start" : index === xAxis.ticks.length - 1 ? "end" : "middle";
93
+ index++;
94
+ return tag.replace('class="stdlib-chart-tick-label"', 'class="stdlib-chart-tick-label k2b-line-time-tick"').replace('text-anchor="middle"', `text-anchor="${anchor}"`);
95
+ });
96
+ }
97
+ body.push(xLabels);
98
+ const baselineY = yAxis.scale === "linear" && yAxis.domain[0] <= 0 && yAxis.domain[1] >= 0 ? y(0) : area.y1;
99
+ const pathFn = opts.step ? pts => stepPathD(pts, opts.step) : opts.smooth === false ? linePathD : smoothPathD;
100
+ // A missing observation ends a run before filtering; finite observations on either side never connect.
101
+ const runsOf = points => {
102
+ const runs = [];
103
+ let run = [];
104
+ for (const point of [...points].sort((a, b) => a.x - b.x)) {
105
+ if (!isOnAxis(xAxis, point.x) || !isOnAxis(yAxis, point.y)) {
106
+ if (run.length) runs.push(run);
107
+ run = [];
108
+ continue;
109
+ }
110
+ if (run.length && opts.maxGap !== undefined && point.x - run.at(-1).x > opts.maxGap) {
111
+ runs.push(run);
112
+ run = [];
113
+ }
114
+ run.push(point);
115
+ }
116
+ if (run.length) runs.push(run);
117
+ return runs;
118
+ };
119
+ if (opts.forecast?.band) for (const run of runsOf(forecast)) {
120
+ const valid = run.filter(p => p.lo !== undefined && p.hi !== undefined);
121
+ if (!valid.length) continue;
122
+ if (valid.length === 1) {
123
+ const point = valid[0],
124
+ center = x(point.x);
125
+ const slot = Math.min(12, (area.x1 - area.x0) / Math.max(1, opts.series[0]?.data.length ?? 1));
126
+ body.push(`<rect class="k2b-line-forecast-band" x="${fmt(Math.max(area.x0, center - slot / 2))}" y="${fmt(y(point.hi))}" width="${fmt(Math.min(area.x1, center + slot / 2) - Math.max(area.x0, center - slot / 2))}" height="${fmt(Math.max(1, y(point.lo) - y(point.hi)))}" fill="${paint(0)}" fill-opacity=".15" stroke="none"/>`);
127
+ continue;
128
+ }
129
+ const upper = valid.map(p => ({
130
+ x: x(p.x),
131
+ y: y(p.hi)
132
+ }));
133
+ const lower = valid.map(p => ({
134
+ x: x(p.x),
135
+ y: y(p.lo)
136
+ })).reverse();
137
+ // Traversing the lower edge backwards also reverses the step direction.
138
+ const lowerPath = opts.step ? stepPathD(lower, opts.step === "before" ? "after" : opts.step === "after" ? "before" : "middle") : pathFn(lower);
139
+ body.push(`<path class="k2b-line-forecast-band" d="${pathFn(upper)} ${lowerPath.replace(/^M/, "L")} Z" fill="${paint(0)}" fill-opacity=".15" stroke="none"/>`);
140
+ }
141
+ const boundsByPoint = new Map(forecast.map(point => [point.source, point]));
142
+ opts.series.forEach((s, i) => {
143
+ const runs = runsOf(s.data);
144
+ const isolated = new Set(runs.filter(run => run.length === 1).map(run => run[0]));
145
+ s.data.forEach((p, index) => {
146
+ if (!isOnAxis(xAxis, p.x) || !isOnAxis(yAxis, p.y)) return;
147
+ if (!opts.inspect && !isolated.has(p)) return;
148
+ const bounds = i === 0 ? boundsByPoint.get(p) : undefined;
149
+ const values = pointValues(p, opts.xAxis, opts.yAxis);
150
+ if (bounds?.lo !== undefined && bounds.hi !== undefined) values.push({
151
+ key: "forecastLow",
152
+ value: bounds.lo,
153
+ formatted: opts.yAxis?.format?.(bounds.lo)
154
+ }, {
155
+ key: "forecastHigh",
156
+ value: bounds.hi,
157
+ formatted: opts.yAxis?.format?.(bounds.hi)
158
+ });
159
+ const datum = {
160
+ index,
161
+ seriesIndex: i,
162
+ role: "point",
163
+ label: s.label,
164
+ anchor: [x(p.x), y(p.y)],
165
+ values
166
+ };
167
+ let mark = `<circle class="stdlib-chart-inspection-point" cx="${fmt(x(p.x))}" cy="${fmt(y(p.y))}" r="3" fill="transparent" stroke="none"/>`;
168
+ if (opts.inspect) mark = chartDatumSvg(mark, datum, true);
169
+ if (isolated.has(p)) mark = mark.replace('fill="transparent"', `fill="${paint(i)}"`);
170
+ inspectionMarks.push(mark);
171
+ });
172
+ for (const sorted of runs) {
173
+ if (sorted.length < 2) continue;
174
+ const mapped = sorted.map(p => ({
175
+ x: x(p.x),
176
+ y: y(p.y)
177
+ }));
178
+ const linePath = pathFn(mapped);
179
+ if (opts.errorBand) {
180
+ const upper = [],
181
+ lower = [];
182
+ for (const p of sorted) {
183
+ const err = resolveErrorY(p);
184
+ if (!err) continue;
185
+ upper.push({
186
+ x: x(p.x),
187
+ y: y(p.y + err[1])
188
+ });
189
+ lower.push({
190
+ x: x(p.x),
191
+ y: y(p.y - err[0])
192
+ });
193
+ }
194
+ if (upper.length >= 2) body.push(`<path class="stdlib-chart-error-band stdlib-chart-series-${i % 8}" d="${pathFn(upper)}${lower.reverse().map(p => ` L ${fmt(p.x)} ${fmt(p.y)}`).join("")} Z" fill="${paint(i)}" fill-opacity=".15" stroke="none"/>`);
195
+ }
196
+ if (opts.area) {
197
+ const first = mapped[0],
198
+ last = mapped.at(-1);
199
+ body.push(`<path class="stdlib-chart-area stdlib-chart-series-${i % 8}" d="${linePath} L ${fmt(last.x)} ${fmt(baselineY)} L ${fmt(first.x)} ${fmt(baselineY)} Z" fill="${paint(i)}" fill-opacity=".18" stroke="none"/>`);
200
+ }
201
+ const dashStyle = s.lineStyle ?? (opts.autoVariant ? DEFAULT_LINE_STYLES[i % DEFAULT_LINE_STYLES.length] : "solid");
202
+ const dash = LINE_DASH_PATTERNS[dashStyle];
203
+ const path = (forecastDash = false) => `<path class="stdlib-chart-line stdlib-chart-series-${i % 8}" d="${linePath}" fill="none" stroke="${paint(i)}" stroke-width="2"${forecastDash ? ' stroke-dasharray="5 4"' : dash ? ` stroke-dasharray="${dash}"` : ""}/>`;
204
+ const from = opts.forecast?.from;
205
+ if (from === undefined || sorted.at(-1).x <= from) body.push(path());else if (sorted[0].x >= from) body.push(`<g class="k2b-line-forecast">${path(true)}</g>`);else {
206
+ const cut = x(from);
207
+ const clipped = (left, right, content, cls) => `<svg class="${cls}" x="${fmt(left)}" y="${fmt(area.y0)}" width="${fmt(right - left)}" height="${fmt(area.y1 - area.y0)}" viewBox="${fmt(left)} ${fmt(area.y0)} ${fmt(right - left)} ${fmt(area.y1 - area.y0)}" overflow="hidden">${content}</svg>`;
208
+ body.push(clipped(area.x0, cut, path(), "k2b-line-observed"), clipped(cut, area.x1, path(true), "k2b-line-forecast"));
209
+ }
210
+ }
211
+ });
212
+ body.push(...inspectionMarks);
213
+ body.push(renderErrorBars(opts.series, xAxis, yAxis, area));
214
+ if (opts.references?.length) body.push(renderReferenceLines(opts.references, xAxis, yAxis, area));
215
+ const annotation = (cx, cy, label, anchor, color, className = "") => {
216
+ const room = anchor === "start" ? width - cx - 8 : anchor === "end" ? cx - 8 : 2 * Math.min(cx - 8, width - cx - 8);
217
+ const limit = Math.max(1, Math.min(40, Math.floor(room / 6)));
218
+ const shown = label.length > limit ? `${label.slice(0, Math.max(0, limit - 1))}…` : label;
219
+ return `<text class="${className}" x="${fmt(cx)}" y="${fmt(cy)}" text-anchor="${anchor}" fill="${color}" stroke="none" font-size="11" font-weight="600"><title>${escapeXml(label)}</title>${escapeXml(shown)}</text>`;
220
+ };
221
+ if (opts.threshold) {
222
+ const valueY = y(opts.threshold.value),
223
+ color = "var(--k2b-warning-500, #f59e0b)";
224
+ body.push(`<line class="k2b-line-threshold" x1="${fmt(area.x0)}" x2="${fmt(area.x1)}" y1="${fmt(valueY)}" y2="${fmt(valueY)}" stroke="${color}" stroke-width="1.2" stroke-dasharray="5 4"/>`, annotation(area.x1, area.y0 - 5, `${opts.threshold.label} ${opts.yAxis?.format?.(opts.threshold.value) ?? new Intl.NumberFormat(opts.locale ?? "en").format(opts.threshold.value)}`, "end", color, "k2b-line-threshold-label"));
225
+ }
226
+ if (opts.marker) {
227
+ const markerX = x(opts.marker.at),
228
+ color = "var(--k2b-text-secondary, #52525b)";
229
+ body.push(`<line class="k2b-line-marker" x1="${fmt(markerX)}" x2="${fmt(markerX)}" y1="${fmt(area.y0)}" y2="${fmt(area.y1)}" stroke="${color}" stroke-width="1.2"/>`, annotation(markerX, area.y0 - 5, opts.marker.label, markerX - area.x0 < 50 ? "start" : area.x1 - markerX < 50 ? "end" : "middle", color));
230
+ }
231
+ const defaultX = lineLegendX(opts);
232
+ const legend = [];
233
+ if (legendItems.length) {
234
+ const entries = legendItems.slice(0, 4),
235
+ cell = width / 2;
236
+ entries.forEach((entry, i) => {
237
+ const left = i % 2 * cell + 4,
238
+ baseY = height - legendHeight + 12 + Math.floor(i / 2) * 20;
239
+ if (i === 3 && legendItems.length > 4) {
240
+ legend.push(`<text x="${fmt(left)}" y="${fmt(baseY)}" fill="currentColor" stroke="none" font-size="11">+${legendItems.length - 3}</text>`);
241
+ return;
242
+ }
243
+ const series = opts.series[entry.seriesIndex],
244
+ point = series.data.find(p => p.x === defaultX);
245
+ const amount = point && Number.isFinite(point.y) ? opts.yAxis?.format?.(point.y) ?? new Intl.NumberFormat(opts.locale ?? "en", {
246
+ maximumFractionDigits: 6
247
+ }).format(point.y) : "—";
248
+ const label = series.label || seriesLabel(entry.seriesIndex);
249
+ const room = Math.max(1, Math.floor(cell * 296 / width / 6) - Math.min(14, amount.length) - 4);
250
+ const shortened = label.length > room ? label.slice(0, Math.max(0, room - 1)) + "…" : label;
251
+ legend.push(`<g class="stdlib-chart-legend-item"><rect class="stdlib-chart-legend-swatch" x="${fmt(left)}" y="${fmt(baseY - 8)}" width="8" height="8" rx="2" fill="${paint(entry.seriesIndex)}" stroke="none"/><text class="stdlib-chart-legend-label" aria-label="${escapeXml(label)}" x="${fmt(left + 12)}" y="${fmt(baseY)}" fill="currentColor" stroke="none" font-size="11">${escapeXml(shortened)}</text><text x="${fmt(left + cell - 8)}" y="${fmt(baseY)}" text-anchor="end" fill="currentColor" stroke="none" font-size="11" font-weight="600" data-chart-legend-value data-series-index="${entry.seriesIndex}" data-field="y" data-default="${escapeXml(amount)}">${escapeXml(amount)}</text></g>`);
252
+ });
253
+ }
254
+ const svg = svgRoot({
255
+ width,
256
+ height,
257
+ className: opts.className
258
+ }, header.svg + body.join("") + (legend.length ? `<g class="k2b-line-value-legend">${legend.join("")}</g>` : ""));
259
+ // CSS adds only the physical room missing in a narrow host. Its SVG transform is
260
+ // visible to the shared inspector, and the server emits the same geometry.
261
+ const fraction = Math.min(0.8, Math.max(0, area.x0 / width));
262
+ return svg.replace("<svg ", `<svg data-line-details="true" data-line-default-x="${defaultX}" data-line-axis-room="true" style="--k2b-line-label-room:${labelRoom}px;--k2b-line-axis-fraction:${fraction};--k2b-line-axis-expand:${1 / (1 - fraction)}" `);
263
+ };
264
+ //# sourceMappingURL=line-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["charts/core/line-details.ts"],"sourcesContent":["/** Existing line renderer, separated so detailed drawing stays behind lazy chart boundaries. */\nimport type { ChartTimeAxis, ChartTimeStep } from \"../../content/chart-time-calendar\";\nimport { lineForecastLayout, lineLegendX } from \"./line-options\";\nimport {\n chartDatumSvg,\n collectAxisValues,\n collectSeriesLegend,\n computeAxisScale,\n computeDomain,\n computePlotArea,\n DEFAULT_HEIGHT,\n DEFAULT_LINE_STYLES,\n DEFAULT_WIDTH,\n emptyChart,\n escapeXml,\n fmt,\n isOnAxis,\n LINE_DASH_PATTERNS,\n linePathD,\n normalizePadding,\n type Point,\n pickMapper,\n pointValues,\n renderErrorBars,\n renderHeader,\n renderReferenceLines,\n renderXAxisNumeric,\n renderYAxis,\n resolveErrorY,\n smoothPathD,\n stepPathD,\n svgRoot,\n} from \"./svg-common\";\nimport type { LineOptions } from \"./svg-renderers\";\nimport type { ChartDatum } from \"./types\";\n\n/**\n * Render a line chart. Each series becomes a `<path class=\"stdlib-chart-line\">`\n * connecting its points (sorted by `x`). Multi-series charts get distinct\n * `stdlib-chart-series-N` classes.\n *\n * Detailed lines split missing observations into runs and show isolated points.\n * Existing descriptions retain their established filtering and gap behavior. An empty/all-non-finite chart renders\n * an empty-state SVG.\n *\n * @example\n * charts.line({ series: [{ data: [{x:1,y:10},{x:2,y:25},{x:3,y:18}] }] });\n *\n * @example\n * charts.line({\n * series: [\n * { label: \"Revenue\", data: [...] },\n * { label: \"Costs\", data: [...] },\n * ],\n * yAxis: { format: v => `$${v}k` },\n * });\n */\nexport type LineTimeAdapter = {\n chartTimeStep: (span: number, maxTicks: number) => ChartTimeStep;\n chartTimeTicks: (domain: readonly [number, number], zone: string, step: ChartTimeStep) => number[];\n chartTimeLabel: (tick: number, step: ChartTimeStep, axis: ChartTimeAxis) => string;\n};\nexport const renderLineDetailsSvg = (opts: LineOptions, time: LineTimeAdapter, seriesLabel: (index: number) => string): string => {\n const { chartTimeStep, chartTimeTicks, chartTimeLabel } = time;\n const forecast = lineForecastLayout(opts);\n if (opts.maxGap !== undefined && (!Number.isFinite(opts.maxGap) || opts.maxGap <= 0))\n throw new RangeError(\"Chart maxGap must be finite and positive\");\n if (opts.maxGap !== undefined && (opts.area || opts.errorBand)) throw new Error(\"Chart maxGap does not support area or errorBand fills\");\n if (opts.threshold && !isOnAxis({ scale: opts.yAxis?.scale ?? \"linear\" }, opts.threshold.value))\n throw new RangeError(\"Line threshold must be finite and positive on a log axis\");\n if (opts.marker && !isOnAxis({ scale: opts.xAxis?.scale ?? \"linear\" }, opts.marker.at))\n throw new RangeError(\"Line marker must be finite and positive on a log axis\");\n if (opts.marker && opts.xAxis?.domain && (opts.marker.at < opts.xAxis.domain[0] || opts.marker.at > opts.xAxis.domain[1]))\n throw new RangeError(\"Line marker must be inside the explicit X domain\");\n const width = opts.width ?? DEFAULT_WIDTH;\n const height = opts.height ?? DEFAULT_HEIGHT;\n const padding = normalizePadding(opts.padding);\n const header = renderHeader(width, opts.title, opts.subtitle);\n const legendItems = collectSeriesLegend(opts);\n const legendHeight = legendItems.length > 2 ? 40 : legendItems.length ? 20 : 0;\n const finitePoints = opts.series.flatMap((s) => s.data).filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y));\n if (finitePoints.length === 0) return emptyChart(width, height, opts.className);\n const timeAxis = opts.timeAxis && { ...opts.timeAxis, locale: opts.timeAxis.locale ?? opts.locale };\n const xValues = [\n ...collectAxisValues(opts.series, \"x\"),\n ...(opts.marker ? [opts.marker.at] : []),\n ...(timeAxis ? (opts.references?.filter((ref) => ref.axis === \"x\").map((ref) => ref.value) ?? []) : []),\n ];\n const xAxis = computeAxisScale(xValues, timeAxis && !opts.xAxis?.domain ? { ...opts.xAxis, domain: computeDomain(xValues) } : opts.xAxis);\n const timeStep = timeAxis ? chartTimeStep(xAxis.domain[1] - xAxis.domain[0], (opts.xAxis?.ticks ?? 3) + 2) : undefined;\n if (timeAxis && timeStep) {\n xAxis.ticks = chartTimeTicks(xAxis.domain, timeAxis.timeZone, timeStep);\n xAxis.minorTicks = [];\n }\n const bandValues = forecast.flatMap((p) => (Number.isFinite(p.y) && p.lo !== undefined && p.hi !== undefined ? [p.lo, p.hi] : []));\n const yAxis = computeAxisScale(\n [...collectAxisValues(opts.series, \"y\"), ...bandValues, ...(opts.zero ? [0] : []), ...(opts.threshold ? [opts.threshold.value] : [])],\n opts.yAxis,\n );\n const labelRoom = Math.max(...yAxis.ticks.map((tick) => (opts.yAxis?.format?.(tick) ?? String(tick)).length * 6 + 12));\n if ((opts.forecast || opts.zero || opts.threshold || opts.marker) && typeof opts.padding !== \"number\" && opts.padding?.left === undefined)\n padding.left = Math.max(padding.left, labelRoom);\n const area = computePlotArea(width, height, padding, !!opts.xAxis?.label, !!opts.yAxis?.label, header.height, legendHeight);\n const xMap = pickMapper(xAxis.scale),\n yMap = pickMapper(yAxis.scale);\n const x = (value: number) => xMap(value, xAxis.domain, [area.x0, area.x1]);\n const y = (value: number) => yMap(value, yAxis.domain, [area.y1, area.y0]);\n const palette = [\"#3b82f6\", \"#10b981\", \"#f59e0b\", \"#8b5cf6\", \"#ec4899\", \"#06b6d4\", \"#84cc16\", \"#f97316\"];\n const paint = (index: number) => `var(--stdlib-chart-c${(index % 8) + 1}, ${palette[index % 8]})`;\n const body: string[] = [];\n const inspectionMarks: string[] = [];\n if (opts.zero && yAxis.scale === \"linear\" && yAxis.domain[0] < 0) {\n const zeroY = y(Math.min(0, yAxis.domain[1]));\n body.push(\n `<rect class=\"k2b-line-negative-zone\" x=\"${fmt(area.x0)}\" y=\"${fmt(zeroY)}\" width=\"${fmt(area.x1 - area.x0)}\" height=\"${fmt(area.y1 - zeroY)}\" fill=\"var(--k2b-danger-500, #ef4444)\" fill-opacity=\".09\" stroke=\"none\"/>`,\n );\n }\n body.push(renderYAxis(yAxis, area, opts.yAxis));\n let xLabels = renderXAxisNumeric(\n xAxis,\n area,\n height - legendHeight,\n timeAxis && timeStep\n ? { ...opts.xAxis, format: opts.xAxis?.format ?? ((value) => chartTimeLabel(value, timeStep, timeAxis)) }\n : opts.xAxis,\n );\n if (timeAxis) {\n let index = 0;\n // Edge labels point into the plot, keeping the first date clear of the Y ticks.\n xLabels = xLabels.replace(/<text class=\"stdlib-chart-tick-label\"[^>]*>/g, (tag) => {\n const anchor = index === 0 ? \"start\" : index === xAxis.ticks.length - 1 ? \"end\" : \"middle\";\n index++;\n return tag\n .replace('class=\"stdlib-chart-tick-label\"', 'class=\"stdlib-chart-tick-label k2b-line-time-tick\"')\n .replace('text-anchor=\"middle\"', `text-anchor=\"${anchor}\"`);\n });\n }\n body.push(xLabels);\n const baselineY = yAxis.scale === \"linear\" && yAxis.domain[0] <= 0 && yAxis.domain[1] >= 0 ? y(0) : area.y1;\n const pathFn = opts.step\n ? (pts: Array<{ x: number; y: number }>) => stepPathD(pts, opts.step!)\n : opts.smooth === false\n ? linePathD\n : smoothPathD;\n // A missing observation ends a run before filtering; finite observations on either side never connect.\n const runsOf = <T extends Point>(points: T[]) => {\n const runs: T[][] = [];\n let run: T[] = [];\n for (const point of [...points].sort((a, b) => a.x - b.x)) {\n if (!isOnAxis(xAxis, point.x) || !isOnAxis(yAxis, point.y)) {\n if (run.length) runs.push(run);\n run = [];\n continue;\n }\n if (run.length && opts.maxGap !== undefined && point.x - run.at(-1)!.x > opts.maxGap) {\n runs.push(run);\n run = [];\n }\n run.push(point);\n }\n if (run.length) runs.push(run);\n return runs;\n };\n if (opts.forecast?.band)\n for (const run of runsOf(forecast)) {\n const valid = run.filter((p): p is typeof p & { lo: number; hi: number } => p.lo !== undefined && p.hi !== undefined);\n if (!valid.length) continue;\n if (valid.length === 1) {\n const point = valid[0]!,\n center = x(point.x);\n const slot = Math.min(12, (area.x1 - area.x0) / Math.max(1, opts.series[0]?.data.length ?? 1));\n body.push(\n `<rect class=\"k2b-line-forecast-band\" x=\"${fmt(Math.max(area.x0, center - slot / 2))}\" y=\"${fmt(y(point.hi))}\" width=\"${fmt(Math.min(area.x1, center + slot / 2) - Math.max(area.x0, center - slot / 2))}\" height=\"${fmt(Math.max(1, y(point.lo) - y(point.hi)))}\" fill=\"${paint(0)}\" fill-opacity=\".15\" stroke=\"none\"/>`,\n );\n continue;\n }\n const upper = valid.map((p) => ({ x: x(p.x), y: y(p.hi) }));\n const lower = valid.map((p) => ({ x: x(p.x), y: y(p.lo) })).reverse();\n // Traversing the lower edge backwards also reverses the step direction.\n const lowerPath = opts.step\n ? stepPathD(lower, opts.step === \"before\" ? \"after\" : opts.step === \"after\" ? \"before\" : \"middle\")\n : pathFn(lower);\n body.push(\n `<path class=\"k2b-line-forecast-band\" d=\"${pathFn(upper)} ${lowerPath.replace(/^M/, \"L\")} Z\" fill=\"${paint(0)}\" fill-opacity=\".15\" stroke=\"none\"/>`,\n );\n }\n const boundsByPoint = new Map(forecast.map((point) => [point.source, point]));\n opts.series.forEach((s, i) => {\n const runs = runsOf(s.data);\n const isolated = new Set(runs.filter((run) => run.length === 1).map((run) => run[0]!));\n s.data.forEach((p, index) => {\n if (!isOnAxis(xAxis, p.x) || !isOnAxis(yAxis, p.y)) return;\n if (!opts.inspect && !isolated.has(p)) return;\n const bounds = i === 0 ? boundsByPoint.get(p) : undefined;\n const values = pointValues(p, opts.xAxis, opts.yAxis);\n if (bounds?.lo !== undefined && bounds.hi !== undefined)\n values.push(\n { key: \"forecastLow\", value: bounds.lo, formatted: opts.yAxis?.format?.(bounds.lo) },\n { key: \"forecastHigh\", value: bounds.hi, formatted: opts.yAxis?.format?.(bounds.hi) },\n );\n const datum: ChartDatum = { index, seriesIndex: i, role: \"point\", label: s.label, anchor: [x(p.x), y(p.y)], values };\n let mark = `<circle class=\"stdlib-chart-inspection-point\" cx=\"${fmt(x(p.x))}\" cy=\"${fmt(y(p.y))}\" r=\"3\" fill=\"transparent\" stroke=\"none\"/>`;\n if (opts.inspect) mark = chartDatumSvg(mark, datum, true);\n if (isolated.has(p)) mark = mark.replace('fill=\"transparent\"', `fill=\"${paint(i)}\"`);\n inspectionMarks.push(mark);\n });\n for (const sorted of runs) {\n if (sorted.length < 2) continue;\n const mapped = sorted.map((p) => ({ x: x(p.x), y: y(p.y) }));\n const linePath = pathFn(mapped);\n if (opts.errorBand) {\n const upper: Array<{ x: number; y: number }> = [],\n lower: Array<{ x: number; y: number }> = [];\n for (const p of sorted) {\n const err = resolveErrorY(p);\n if (!err) continue;\n upper.push({ x: x(p.x), y: y(p.y + err[1]) });\n lower.push({ x: x(p.x), y: y(p.y - err[0]) });\n }\n if (upper.length >= 2)\n body.push(\n `<path class=\"stdlib-chart-error-band stdlib-chart-series-${i % 8}\" d=\"${pathFn(upper)}${lower\n .reverse()\n .map((p) => ` L ${fmt(p.x)} ${fmt(p.y)}`)\n .join(\"\")} Z\" fill=\"${paint(i)}\" fill-opacity=\".15\" stroke=\"none\"/>`,\n );\n }\n if (opts.area) {\n const first = mapped[0]!,\n last = mapped.at(-1)!;\n body.push(\n `<path class=\"stdlib-chart-area stdlib-chart-series-${i % 8}\" d=\"${linePath} L ${fmt(last.x)} ${fmt(baselineY)} L ${fmt(first.x)} ${fmt(baselineY)} Z\" fill=\"${paint(i)}\" fill-opacity=\".18\" stroke=\"none\"/>`,\n );\n }\n const dashStyle = s.lineStyle ?? (opts.autoVariant ? DEFAULT_LINE_STYLES[i % DEFAULT_LINE_STYLES.length]! : \"solid\");\n const dash = LINE_DASH_PATTERNS[dashStyle];\n const path = (forecastDash = false) =>\n `<path class=\"stdlib-chart-line stdlib-chart-series-${i % 8}\" d=\"${linePath}\" fill=\"none\" stroke=\"${paint(i)}\" stroke-width=\"2\"${forecastDash ? ' stroke-dasharray=\"5 4\"' : dash ? ` stroke-dasharray=\"${dash}\"` : \"\"}/>`;\n const from = opts.forecast?.from;\n if (from === undefined || sorted.at(-1)!.x <= from) body.push(path());\n else if (sorted[0]!.x >= from) body.push(`<g class=\"k2b-line-forecast\">${path(true)}</g>`);\n else {\n const cut = x(from);\n const clipped = (left: number, right: number, content: string, cls: string) =>\n `<svg class=\"${cls}\" x=\"${fmt(left)}\" y=\"${fmt(area.y0)}\" width=\"${fmt(right - left)}\" height=\"${fmt(area.y1 - area.y0)}\" viewBox=\"${fmt(left)} ${fmt(area.y0)} ${fmt(right - left)} ${fmt(area.y1 - area.y0)}\" overflow=\"hidden\">${content}</svg>`;\n body.push(clipped(area.x0, cut, path(), \"k2b-line-observed\"), clipped(cut, area.x1, path(true), \"k2b-line-forecast\"));\n }\n }\n });\n body.push(...inspectionMarks);\n body.push(renderErrorBars(opts.series, xAxis, yAxis, area));\n if (opts.references?.length) body.push(renderReferenceLines(opts.references, xAxis, yAxis, area));\n const annotation = (cx: number, cy: number, label: string, anchor: string, color: string, className = \"\") => {\n const room = anchor === \"start\" ? width - cx - 8 : anchor === \"end\" ? cx - 8 : 2 * Math.min(cx - 8, width - cx - 8);\n const limit = Math.max(1, Math.min(40, Math.floor(room / 6)));\n const shown = label.length > limit ? `${label.slice(0, Math.max(0, limit - 1))}…` : label;\n return `<text class=\"${className}\" x=\"${fmt(cx)}\" y=\"${fmt(cy)}\" text-anchor=\"${anchor}\" fill=\"${color}\" stroke=\"none\" font-size=\"11\" font-weight=\"600\"><title>${escapeXml(label)}</title>${escapeXml(shown)}</text>`;\n };\n if (opts.threshold) {\n const valueY = y(opts.threshold.value),\n color = \"var(--k2b-warning-500, #f59e0b)\";\n body.push(\n `<line class=\"k2b-line-threshold\" x1=\"${fmt(area.x0)}\" x2=\"${fmt(area.x1)}\" y1=\"${fmt(valueY)}\" y2=\"${fmt(valueY)}\" stroke=\"${color}\" stroke-width=\"1.2\" stroke-dasharray=\"5 4\"/>`,\n annotation(\n area.x1,\n area.y0 - 5,\n `${opts.threshold.label} ${opts.yAxis?.format?.(opts.threshold.value) ?? new Intl.NumberFormat(opts.locale ?? \"en\").format(opts.threshold.value)}`,\n \"end\",\n color,\n \"k2b-line-threshold-label\",\n ),\n );\n }\n if (opts.marker) {\n const markerX = x(opts.marker.at),\n color = \"var(--k2b-text-secondary, #52525b)\";\n body.push(\n `<line class=\"k2b-line-marker\" x1=\"${fmt(markerX)}\" x2=\"${fmt(markerX)}\" y1=\"${fmt(area.y0)}\" y2=\"${fmt(area.y1)}\" stroke=\"${color}\" stroke-width=\"1.2\"/>`,\n annotation(\n markerX,\n area.y0 - 5,\n opts.marker.label,\n markerX - area.x0 < 50 ? \"start\" : area.x1 - markerX < 50 ? \"end\" : \"middle\",\n color,\n ),\n );\n }\n const defaultX = lineLegendX(opts);\n const legend: string[] = [];\n if (legendItems.length) {\n const entries = legendItems.slice(0, 4),\n cell = width / 2;\n entries.forEach((entry, i) => {\n const left = (i % 2) * cell + 4,\n baseY = height - legendHeight + 12 + Math.floor(i / 2) * 20;\n if (i === 3 && legendItems.length > 4) {\n legend.push(\n `<text x=\"${fmt(left)}\" y=\"${fmt(baseY)}\" fill=\"currentColor\" stroke=\"none\" font-size=\"11\">+${legendItems.length - 3}</text>`,\n );\n return;\n }\n const series = opts.series[entry.seriesIndex]!,\n point = series.data.find((p) => p.x === defaultX);\n const amount =\n point && Number.isFinite(point.y)\n ? (opts.yAxis?.format?.(point.y) ?? new Intl.NumberFormat(opts.locale ?? \"en\", { maximumFractionDigits: 6 }).format(point.y))\n : \"—\";\n const label = series.label || seriesLabel(entry.seriesIndex);\n const room = Math.max(1, Math.floor((cell * 296) / width / 6) - Math.min(14, amount.length) - 4);\n const shortened = label.length > room ? label.slice(0, Math.max(0, room - 1)) + \"…\" : label;\n legend.push(\n `<g class=\"stdlib-chart-legend-item\"><rect class=\"stdlib-chart-legend-swatch\" x=\"${fmt(left)}\" y=\"${fmt(baseY - 8)}\" width=\"8\" height=\"8\" rx=\"2\" fill=\"${paint(entry.seriesIndex)}\" stroke=\"none\"/><text class=\"stdlib-chart-legend-label\" aria-label=\"${escapeXml(label)}\" x=\"${fmt(left + 12)}\" y=\"${fmt(baseY)}\" fill=\"currentColor\" stroke=\"none\" font-size=\"11\">${escapeXml(shortened)}</text><text x=\"${fmt(left + cell - 8)}\" y=\"${fmt(baseY)}\" text-anchor=\"end\" fill=\"currentColor\" stroke=\"none\" font-size=\"11\" font-weight=\"600\" data-chart-legend-value data-series-index=\"${entry.seriesIndex}\" data-field=\"y\" data-default=\"${escapeXml(amount)}\">${escapeXml(amount)}</text></g>`,\n );\n });\n }\n const svg = svgRoot(\n { width, height, className: opts.className },\n header.svg + body.join(\"\") + (legend.length ? `<g class=\"k2b-line-value-legend\">${legend.join(\"\")}</g>` : \"\"),\n );\n // CSS adds only the physical room missing in a narrow host. Its SVG transform is\n // visible to the shared inspector, and the server emits the same geometry.\n const fraction = Math.min(0.8, Math.max(0, area.x0 / width));\n return svg.replace(\n \"<svg \",\n `<svg data-line-details=\"true\" data-line-default-x=\"${defaultX}\" data-line-axis-room=\"true\" style=\"--k2b-line-label-room:${labelRoom}px;--k2b-line-axis-fraction:${fraction};--k2b-line-axis-expand:${1 / (1 - fraction)}\" `,\n );\n};\n"],"mappings":"AAAA;;AAEA,SAAS,kBAAkB,EAAE,WAAW,QAAQ,gBAAgB;AAChE,SACE,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,SAAS,EACT,GAAG,EACH,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAEhB,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,QACF,cAAc;;AAIrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AG,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,qIAAqI,KAAK,CAAC,WAAW,kCAAkC,SAAS,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,aACrpB,CAAC;IACH,CAAC,CAAC;EACJ;EACA,MAAM,GAAG,GAAG,OAAO,CACjB;IAAE,KAAK;IAAE,MAAM;IAAE,SAAS,EAAE,IAAI,CAAC;EAAU,CAAC,EAC5C,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,oCAAoC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,EAAE,CAC9G,CAAC;EACD;EACA;EACA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;EAC5D,OAAO,GAAG,CAAC,OAAO,CAChB,OAAO,EACP,sDAAsD,QAAQ,6DAA6D,SAAS,+BAA+B,QAAQ,2BAA2B,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAC1N,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ /** A dated marker is the resting cursor; otherwise use the latest shared X. */
2
+ export const lineLegendX = opts => {
3
+ if (opts.marker) return opts.marker.at;
4
+ let latest = -Infinity;
5
+ for (const series of opts.series) for (const point of series.data) if (Number.isFinite(point.x)) latest = Math.max(latest, point.x);
6
+ return latest;
7
+ };
8
+
9
+ /** Validate forecast bounds against the first series, sorted by X. Missing Y values retain their bound position. */
10
+ export const lineForecastLayout = opts => {
11
+ if (!opts.forecast) return [];
12
+ const {
13
+ from,
14
+ band
15
+ } = opts.forecast;
16
+ const points = [...(opts.series[0]?.data ?? [])].filter(p => Number.isFinite(p.x)).sort((a, b) => a.x - b.x);
17
+ if (!Number.isFinite(from) || opts.xAxis?.scale === "log" && from <= 0 || !points.some(p => p.x === from)) throw new RangeError("Forecast must start at an X value of the first series");
18
+ const suffix = points.filter(p => p.x >= from);
19
+ if (band && band.length !== suffix.length) throw new RangeError("Forecast band must match the ordered first series suffix");
20
+ return suffix.map((p, index) => {
21
+ const bounds = band?.[index];
22
+ if (bounds && (bounds.length !== 2 || !bounds.every(Number.isFinite) || bounds[0] > bounds[1] || opts.yAxis?.scale === "log" && bounds[0] <= 0)) throw new RangeError("Forecast bounds must be finite and ordered");
23
+ return {
24
+ ...p,
25
+ source: p,
26
+ lo: bounds?.[0],
27
+ hi: bounds?.[1]
28
+ };
29
+ });
30
+ };
31
+ export const lineDetailsEnabled = opts => !!(opts.forecast || opts.zero || opts.threshold || opts.marker || opts.legendValues);
32
+ //# sourceMappingURL=line-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["charts/core/line-options.ts"],"sourcesContent":["import type { LineOptions } from \"./svg\";\n\n/** A dated marker is the resting cursor; otherwise use the latest shared X. */\nexport const lineLegendX = (opts: Pick<LineOptions, \"series\" | \"marker\">) => {\n if (opts.marker) return opts.marker.at;\n let latest = -Infinity;\n for (const series of opts.series) for (const point of series.data) if (Number.isFinite(point.x)) latest = Math.max(latest, point.x);\n return latest;\n};\n\n/** Validate forecast bounds against the first series, sorted by X. Missing Y values retain their bound position. */\nexport const lineForecastLayout = (opts: LineOptions) => {\n if (!opts.forecast) return [];\n const { from, band } = opts.forecast;\n const points = [...(opts.series[0]?.data ?? [])].filter((p) => Number.isFinite(p.x)).sort((a, b) => a.x - b.x);\n if (!Number.isFinite(from) || (opts.xAxis?.scale === \"log\" && from <= 0) || !points.some((p) => p.x === from))\n throw new RangeError(\"Forecast must start at an X value of the first series\");\n const suffix = points.filter((p) => p.x >= from);\n if (band && band.length !== suffix.length) throw new RangeError(\"Forecast band must match the ordered first series suffix\");\n return suffix.map((p, index) => {\n const bounds = band?.[index];\n if (\n bounds &&\n (bounds.length !== 2 || !bounds.every(Number.isFinite) || bounds[0] > bounds[1] || (opts.yAxis?.scale === \"log\" && bounds[0] <= 0))\n )\n throw new RangeError(\"Forecast bounds must be finite and ordered\");\n return { ...p, source: p, lo: bounds?.[0], hi: bounds?.[1] };\n });\n};\n\nexport const lineDetailsEnabled = (opts: {\n forecast?: unknown;\n zero?: boolean;\n threshold?: unknown;\n marker?: unknown;\n legendValues?: boolean;\n}) => !!(opts.forecast || opts.zero || opts.threshold || opts.marker || opts.legendValues);\n"],"mappings":"AAEA;AACA,OAAO,MAAM,WAAW,GAAI,IAA4C,IAAK;EAC3E,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE;EACtC,IAAI,MAAM,GAAG,CAAC,QAAQ;EACtB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;EACnI,OAAO,MAAM;AACf,CAAC;;AAED;AACA,OAAO,MAAM,kBAAkB,GAAI,IAAiB,IAAK;EACvD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;EAC7B,MAAM;IAAE,IAAI;IAAE;EAAK,CAAC,GAAG,IAAI,CAAC,QAAQ;EACpC,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAE,CAAC,IAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC9G,IAAI,CAAC,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C","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ import { fmt } from "./svg-format";
2
+ export const linePathD = points => {
3
+ if (points.length === 0) return "";
4
+ let d = `M ${fmt(points[0].x)} ${fmt(points[0].y)}`;
5
+ for (let i = 1; i < points.length; i++) {
6
+ d += ` L ${fmt(points[i].x)} ${fmt(points[i].y)}`;
7
+ }
8
+ return d;
9
+ };
10
+ export const smoothPathD = points => {
11
+ const n = points.length;
12
+ if (n === 0) return "";
13
+ if (n === 1) return `M ${fmt(points[0].x)} ${fmt(points[0].y)}`;
14
+ if (n === 2) return linePathD(points);
15
+ let d = `M ${fmt(points[0].x)} ${fmt(points[0].y)}`;
16
+ for (let i = 0; i < n - 1; i++) {
17
+ const p0 = i > 0 ? points[i - 1] : points[i];
18
+ const p1 = points[i];
19
+ const p2 = points[i + 1];
20
+ const p3 = i + 2 < n ? points[i + 2] : points[i + 1];
21
+ const dx = p2.x - p1.x;
22
+ const cp1x = p1.x + dx / 3;
23
+ const cp1y = p1.y + (p2.y - p0.y) / 6;
24
+ const cp2x = p2.x - dx / 3;
25
+ const cp2y = p2.y - (p3.y - p1.y) / 6;
26
+ d += ` C ${fmt(cp1x)} ${fmt(cp1y)} ${fmt(cp2x)} ${fmt(cp2y)} ${fmt(p2.x)} ${fmt(p2.y)}`;
27
+ }
28
+ return d;
29
+ };
30
+ export const stepPathD = (points, mode) => {
31
+ if (points.length === 0) return "";
32
+ if (points.length === 1) return `M ${fmt(points[0].x)} ${fmt(points[0].y)}`;
33
+ let d = `M ${fmt(points[0].x)} ${fmt(points[0].y)}`;
34
+ for (let i = 1; i < points.length; i++) {
35
+ const p = points[i];
36
+ const prev = points[i - 1];
37
+ if (mode === "before") {
38
+ // step at next-x: extend horizontally to new x at OLD y, then jump to new y.
39
+ d += ` L ${fmt(p.x)} ${fmt(prev.y)} L ${fmt(p.x)} ${fmt(p.y)}`;
40
+ } else if (mode === "after") {
41
+ // step at current-x: jump to new y immediately, persist until next x.
42
+ d += ` L ${fmt(prev.x)} ${fmt(p.y)} L ${fmt(p.x)} ${fmt(p.y)}`;
43
+ } else {
44
+ // middle: step at midpoint of x.
45
+ const mx = (prev.x + p.x) / 2;
46
+ d += ` L ${fmt(mx)} ${fmt(prev.y)} L ${fmt(mx)} ${fmt(p.y)} L ${fmt(p.x)} ${fmt(p.y)}`;
47
+ }
48
+ }
49
+ return d;
50
+ };
51
+ export const DEFAULT_LINE_STYLES = ["solid", "dashed", "dotted", "dashdot"];
52
+
53
+ /** SVG `stroke-dasharray` values per line style. Empty string = no dasharray. */
54
+ export const LINE_DASH_PATTERNS = {
55
+ solid: "",
56
+ dashed: "6 4",
57
+ dotted: "2 3",
58
+ dashdot: "6 3 2 3"
59
+ };
60
+ //# sourceMappingURL=line-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["charts/core/line-paths.ts"],"sourcesContent":["import type { LineStyle } from \"./svg-common\";\nimport { fmt } from \"./svg-format\";\n\nexport const linePathD = (points: ReadonlyArray<{ x: number; y: number }>): string => {\n if (points.length === 0) return \"\";\n let d = `M ${fmt(points[0]!.x)} ${fmt(points[0]!.y)}`;\n for (let i = 1; i < points.length; i++) {\n d += ` L ${fmt(points[i]!.x)} ${fmt(points[i]!.y)}`;\n }\n return d;\n};\n\nexport const smoothPathD = (points: ReadonlyArray<{ x: number; y: number }>): string => {\n const n = points.length;\n if (n === 0) return \"\";\n if (n === 1) return `M ${fmt(points[0]!.x)} ${fmt(points[0]!.y)}`;\n if (n === 2) return linePathD(points);\n\n let d = `M ${fmt(points[0]!.x)} ${fmt(points[0]!.y)}`;\n for (let i = 0; i < n - 1; i++) {\n const p0 = i > 0 ? points[i - 1]! : points[i]!;\n const p1 = points[i]!;\n const p2 = points[i + 1]!;\n const p3 = i + 2 < n ? points[i + 2]! : points[i + 1]!;\n const dx = p2.x - p1.x;\n const cp1x = p1.x + dx / 3;\n const cp1y = p1.y + (p2.y - p0.y) / 6;\n const cp2x = p2.x - dx / 3;\n const cp2y = p2.y - (p3.y - p1.y) / 6;\n d += ` C ${fmt(cp1x)} ${fmt(cp1y)} ${fmt(cp2x)} ${fmt(cp2y)} ${fmt(p2.x)} ${fmt(p2.y)}`;\n }\n return d;\n};\n\nexport const stepPathD = (points: ReadonlyArray<{ x: number; y: number }>, mode: \"before\" | \"after\" | \"middle\"): string => {\n if (points.length === 0) return \"\";\n if (points.length === 1) return `M ${fmt(points[0]!.x)} ${fmt(points[0]!.y)}`;\n\n let d = `M ${fmt(points[0]!.x)} ${fmt(points[0]!.y)}`;\n for (let i = 1; i < points.length; i++) {\n const p = points[i]!;\n const prev = points[i - 1]!;\n if (mode === \"before\") {\n // step at next-x: extend horizontally to new x at OLD y, then jump to new y.\n d += ` L ${fmt(p.x)} ${fmt(prev.y)} L ${fmt(p.x)} ${fmt(p.y)}`;\n } else if (mode === \"after\") {\n // step at current-x: jump to new y immediately, persist until next x.\n d += ` L ${fmt(prev.x)} ${fmt(p.y)} L ${fmt(p.x)} ${fmt(p.y)}`;\n } else {\n // middle: step at midpoint of x.\n const mx = (prev.x + p.x) / 2;\n d += ` L ${fmt(mx)} ${fmt(prev.y)} L ${fmt(mx)} ${fmt(p.y)} L ${fmt(p.x)} ${fmt(p.y)}`;\n }\n }\n return d;\n};\n\nexport const DEFAULT_LINE_STYLES: readonly LineStyle[] = [\"solid\", \"dashed\", \"dotted\", \"dashdot\"];\n\n/** SVG `stroke-dasharray` values per line style. Empty string = no dasharray. */\nexport const LINE_DASH_PATTERNS: Record<LineStyle, string> = {\n solid: \"\",\n dashed: \"6 4\",\n dotted: \"2 3\",\n dashdot: \"6 3 2 3\",\n};\n"],"mappings":"AACA,SAAS,GAAG,QAAQ,cAAc;AAElC,OAAO,MAAM,SAAS,GAAI,MAA+C,IAAa;EACpF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE;EAClC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC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