@perses-dev/components 0.21.1 → 0.23.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 (399) hide show
  1. package/README.md +2 -3
  2. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +2 -1
  3. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  4. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +88 -51
  5. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  6. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  7. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  8. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  9. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  10. package/dist/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  11. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  12. package/dist/DateTimeRangePicker/index.js +1 -1
  13. package/dist/DateTimeRangePicker/index.js.map +1 -1
  14. package/dist/DateTimeRangePicker/utils.js +1 -1
  15. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  16. package/dist/Dialog/Dialog.d.ts +24 -0
  17. package/dist/Dialog/Dialog.d.ts.map +1 -0
  18. package/dist/Dialog/Dialog.js +74 -0
  19. package/dist/Dialog/Dialog.js.map +1 -0
  20. package/dist/Dialog/index.d.ts +2 -0
  21. package/dist/Dialog/index.d.ts.map +1 -0
  22. package/dist/{Tooltip → Dialog}/index.js +2 -3
  23. package/dist/{Tooltip → Dialog}/index.js.map +1 -1
  24. package/dist/Drawer/Drawer.js +1 -1
  25. package/dist/Drawer/Drawer.js.map +1 -1
  26. package/dist/Drawer/index.js +1 -1
  27. package/dist/Drawer/index.js.map +1 -1
  28. package/dist/EChart.js +1 -1
  29. package/dist/EChart.js.map +1 -1
  30. package/dist/ErrorAlert.js +1 -1
  31. package/dist/ErrorAlert.js.map +1 -1
  32. package/dist/ErrorBoundary.js +1 -1
  33. package/dist/ErrorBoundary.js.map +1 -1
  34. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  35. package/dist/GaugeChart/GaugeChart.js +5 -10
  36. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  37. package/dist/GaugeChart/index.js +1 -1
  38. package/dist/GaugeChart/index.js.map +1 -1
  39. package/dist/InfoTooltip/InfoTooltip.d.ts +1 -6
  40. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  41. package/dist/InfoTooltip/InfoTooltip.js +2 -9
  42. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  43. package/dist/InfoTooltip/InfoTooltip.test.js +1 -1
  44. package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -1
  45. package/dist/InfoTooltip/index.js +1 -1
  46. package/dist/InfoTooltip/index.js.map +1 -1
  47. package/dist/JSONEditor.d.ts +5 -4
  48. package/dist/JSONEditor.d.ts.map +1 -1
  49. package/dist/JSONEditor.js +21 -16
  50. package/dist/JSONEditor.js.map +1 -1
  51. package/dist/Legend/CompactLegend.js +1 -1
  52. package/dist/Legend/CompactLegend.js.map +1 -1
  53. package/dist/Legend/Legend.d.ts.map +1 -1
  54. package/dist/Legend/Legend.js +18 -6
  55. package/dist/Legend/Legend.js.map +1 -1
  56. package/dist/Legend/LegendColorBadge.js +1 -1
  57. package/dist/Legend/LegendColorBadge.js.map +1 -1
  58. package/dist/Legend/ListLegend.js +1 -1
  59. package/dist/Legend/ListLegend.js.map +1 -1
  60. package/dist/Legend/ListLegendItem.js +1 -1
  61. package/dist/Legend/ListLegendItem.js.map +1 -1
  62. package/dist/Legend/index.js +1 -1
  63. package/dist/Legend/index.js.map +1 -1
  64. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  65. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  66. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  67. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  68. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +1 -1
  69. package/dist/LegendOptionsEditor/index.js +1 -1
  70. package/dist/LegendOptionsEditor/index.js.map +1 -1
  71. package/dist/LineChart/LineChart.js +3 -3
  72. package/dist/LineChart/LineChart.js.map +1 -1
  73. package/dist/LineChart/index.js +1 -1
  74. package/dist/LineChart/index.js.map +1 -1
  75. package/dist/LineChart/utils.js +1 -1
  76. package/dist/LineChart/utils.js.map +1 -1
  77. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  78. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  79. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  80. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  81. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  82. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  83. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  84. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  85. package/dist/OptionsEditorLayout/index.js +1 -1
  86. package/dist/OptionsEditorLayout/index.js.map +1 -1
  87. package/dist/StatChart/StatChart.d.ts.map +1 -1
  88. package/dist/StatChart/StatChart.js +21 -12
  89. package/dist/StatChart/StatChart.js.map +1 -1
  90. package/dist/StatChart/StatChart.test.js +1 -1
  91. package/dist/StatChart/StatChart.test.js.map +1 -1
  92. package/dist/StatChart/index.js +1 -1
  93. package/dist/StatChart/index.js.map +1 -1
  94. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesInfo.d.ts +1 -2
  95. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -0
  96. package/dist/TimeSeriesTooltip/SeriesInfo.js +89 -0
  97. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
  98. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +2 -0
  99. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +1 -0
  100. package/dist/TimeSeriesTooltip/SeriesInfo.test.js +52 -0
  101. package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +1 -0
  102. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +9 -0
  103. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -0
  104. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +99 -0
  105. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
  106. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.d.ts +2 -1
  107. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -0
  108. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  109. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
  110. package/dist/{Tooltip/Tooltip.d.ts → TimeSeriesTooltip/TimeSeriesTooltip.d.ts} +4 -4
  111. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -0
  112. package/dist/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +3 -4
  113. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -0
  114. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.d.ts +1 -2
  115. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -0
  116. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  117. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -0
  118. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +2 -0
  119. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +1 -0
  120. package/dist/TimeSeriesTooltip/TooltipContent.test.js +78 -0
  121. package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +1 -0
  122. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
  123. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -0
  124. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  125. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -0
  126. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.d.ts +0 -0
  127. package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +1 -0
  128. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  129. package/dist/TimeSeriesTooltip/focused-series.test.js.map +1 -0
  130. package/dist/TimeSeriesTooltip/index.d.ts +9 -0
  131. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -0
  132. package/dist/TimeSeriesTooltip/index.js +22 -0
  133. package/dist/TimeSeriesTooltip/index.js.map +1 -0
  134. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
  135. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -0
  136. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  137. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -0
  138. package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
  139. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -0
  140. package/dist/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  141. package/dist/TimeSeriesTooltip/utils.js.map +1 -0
  142. package/dist/UnitSelector/UnitSelector.js +1 -1
  143. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  144. package/dist/UnitSelector/UnitSelector.test.js +1 -1
  145. package/dist/UnitSelector/UnitSelector.test.js.map +1 -1
  146. package/dist/UnitSelector/index.js +1 -1
  147. package/dist/UnitSelector/index.js.map +1 -1
  148. package/dist/YAxisLabel.js +1 -1
  149. package/dist/YAxisLabel.js.map +1 -1
  150. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +87 -50
  151. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  152. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  153. package/dist/cjs/DateTimeRangePicker/index.js +1 -1
  154. package/dist/cjs/DateTimeRangePicker/utils.js +1 -1
  155. package/dist/cjs/Dialog/Dialog.js +85 -0
  156. package/dist/cjs/{Tooltip → Dialog}/index.js +2 -3
  157. package/dist/cjs/Drawer/Drawer.js +1 -1
  158. package/dist/cjs/Drawer/index.js +1 -1
  159. package/dist/cjs/EChart.js +1 -1
  160. package/dist/cjs/ErrorAlert.js +1 -1
  161. package/dist/cjs/ErrorBoundary.js +1 -1
  162. package/dist/cjs/GaugeChart/GaugeChart.js +5 -10
  163. package/dist/cjs/GaugeChart/index.js +1 -1
  164. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
  165. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +1 -1
  166. package/dist/cjs/InfoTooltip/index.js +1 -1
  167. package/dist/cjs/JSONEditor.js +25 -15
  168. package/dist/cjs/Legend/CompactLegend.js +1 -1
  169. package/dist/cjs/Legend/Legend.js +17 -5
  170. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  171. package/dist/cjs/Legend/ListLegend.js +1 -1
  172. package/dist/cjs/Legend/ListLegendItem.js +1 -1
  173. package/dist/cjs/Legend/index.js +1 -1
  174. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  175. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  176. package/dist/cjs/LegendOptionsEditor/index.js +1 -1
  177. package/dist/cjs/LineChart/LineChart.js +3 -3
  178. package/dist/cjs/LineChart/index.js +1 -1
  179. package/dist/cjs/LineChart/utils.js +1 -1
  180. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  181. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  182. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  183. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  184. package/dist/cjs/OptionsEditorLayout/index.js +1 -1
  185. package/dist/cjs/StatChart/StatChart.js +21 -12
  186. package/dist/cjs/StatChart/StatChart.test.js +1 -1
  187. package/dist/cjs/StatChart/index.js +1 -1
  188. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -0
  189. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +54 -0
  190. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +105 -0
  191. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  192. package/dist/cjs/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +4 -4
  193. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  194. package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +80 -0
  195. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  196. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  197. package/dist/cjs/TimeSeriesTooltip/index.js +35 -0
  198. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  199. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  200. package/dist/cjs/UnitSelector/UnitSelector.js +1 -1
  201. package/dist/cjs/UnitSelector/UnitSelector.test.js +1 -1
  202. package/dist/cjs/UnitSelector/index.js +1 -1
  203. package/dist/cjs/YAxisLabel.js +1 -1
  204. package/dist/cjs/context/ChartsThemeProvider.js +1 -1
  205. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  206. package/dist/cjs/index.js +3 -1
  207. package/dist/cjs/model/graph.js +4 -15
  208. package/dist/cjs/model/index.js +2 -1
  209. package/dist/cjs/model/legend.js +67 -0
  210. package/dist/cjs/model/legend.test.js +29 -0
  211. package/dist/cjs/model/theme.js +1 -1
  212. package/dist/cjs/model/units/bytes.js +1 -1
  213. package/dist/cjs/model/units/constants.js +1 -1
  214. package/dist/cjs/model/units/decimal.js +5 -2
  215. package/dist/cjs/model/units/index.js +1 -1
  216. package/dist/cjs/model/units/percent.js +1 -1
  217. package/dist/cjs/model/units/time.js +1 -1
  218. package/dist/cjs/model/units/types.js +1 -1
  219. package/dist/cjs/model/units/units.js +1 -1
  220. package/dist/cjs/model/units/units.test.js +59 -6
  221. package/dist/cjs/test/index.js +1 -1
  222. package/dist/cjs/test/render.js +1 -1
  223. package/dist/cjs/test/setup-tests.js +1 -1
  224. package/dist/cjs/test-utils/index.js +1 -1
  225. package/dist/cjs/test-utils/theme.js +6 -1
  226. package/dist/cjs/theme/index.js +1 -1
  227. package/dist/cjs/theme/palette/background.js +1 -1
  228. package/dist/cjs/theme/palette/colors/blue.js +1 -1
  229. package/dist/cjs/theme/palette/colors/common.js +1 -1
  230. package/dist/cjs/theme/palette/colors/green.js +1 -1
  231. package/dist/cjs/theme/palette/colors/grey.js +1 -1
  232. package/dist/cjs/theme/palette/colors/index.js +1 -1
  233. package/dist/cjs/theme/palette/colors/orange.js +1 -1
  234. package/dist/cjs/theme/palette/colors/purple.js +1 -1
  235. package/dist/cjs/theme/palette/colors/red.js +1 -1
  236. package/dist/cjs/theme/palette/colors/types.js +1 -1
  237. package/dist/cjs/theme/palette/error.js +1 -1
  238. package/dist/cjs/theme/palette/grey.js +1 -1
  239. package/dist/cjs/theme/palette/index.js +1 -1
  240. package/dist/cjs/theme/palette/palette-options.js +1 -1
  241. package/dist/cjs/theme/palette/primary.js +1 -1
  242. package/dist/cjs/theme/palette/secondary.js +1 -1
  243. package/dist/cjs/theme/palette/success.js +1 -1
  244. package/dist/cjs/theme/palette/text.js +1 -1
  245. package/dist/cjs/theme/palette/warning.js +1 -1
  246. package/dist/cjs/theme/theme.js +12 -1
  247. package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
  248. package/dist/cjs/theme/typography.js +1 -1
  249. package/dist/cjs/utils/combine-sx.js +1 -1
  250. package/dist/cjs/utils/component-ids.js +1 -1
  251. package/dist/cjs/utils/format.js +1 -1
  252. package/dist/cjs/utils/format.test.js +1 -1
  253. package/dist/cjs/utils/index.js +1 -1
  254. package/dist/cjs/utils/mathjs.js +1 -1
  255. package/dist/cjs/utils/theme-gen.js +6 -1
  256. package/dist/cjs/utils/theme-gen.test.js +6 -1
  257. package/dist/context/ChartsThemeProvider.js +1 -1
  258. package/dist/context/ChartsThemeProvider.js.map +1 -1
  259. package/dist/context/TimeZoneProvider.js +1 -1
  260. package/dist/context/TimeZoneProvider.js.map +1 -1
  261. package/dist/index.d.ts +2 -0
  262. package/dist/index.d.ts.map +1 -1
  263. package/dist/index.js +3 -1
  264. package/dist/index.js.map +1 -1
  265. package/dist/model/graph.d.ts +1 -16
  266. package/dist/model/graph.d.ts.map +1 -1
  267. package/dist/model/graph.js +1 -5
  268. package/dist/model/graph.js.map +1 -1
  269. package/dist/model/index.d.ts +1 -0
  270. package/dist/model/index.d.ts.map +1 -1
  271. package/dist/model/index.js +2 -1
  272. package/dist/model/index.js.map +1 -1
  273. package/dist/model/legend.d.ts +22 -0
  274. package/dist/model/legend.d.ts.map +1 -0
  275. package/dist/model/legend.js +51 -0
  276. package/dist/model/legend.js.map +1 -0
  277. package/dist/model/legend.test.d.ts +2 -0
  278. package/dist/model/legend.test.d.ts.map +1 -0
  279. package/dist/model/legend.test.js +27 -0
  280. package/dist/model/legend.test.js.map +1 -0
  281. package/dist/model/theme.d.ts +11 -0
  282. package/dist/model/theme.d.ts.map +1 -1
  283. package/dist/model/theme.js +1 -1
  284. package/dist/model/theme.js.map +1 -1
  285. package/dist/model/units/bytes.js +1 -1
  286. package/dist/model/units/bytes.js.map +1 -1
  287. package/dist/model/units/constants.js +1 -1
  288. package/dist/model/units/constants.js.map +1 -1
  289. package/dist/model/units/decimal.d.ts.map +1 -1
  290. package/dist/model/units/decimal.js +5 -2
  291. package/dist/model/units/decimal.js.map +1 -1
  292. package/dist/model/units/index.js +1 -1
  293. package/dist/model/units/index.js.map +1 -1
  294. package/dist/model/units/percent.js +1 -1
  295. package/dist/model/units/percent.js.map +1 -1
  296. package/dist/model/units/time.js +1 -1
  297. package/dist/model/units/time.js.map +1 -1
  298. package/dist/model/units/types.js +1 -1
  299. package/dist/model/units/types.js.map +1 -1
  300. package/dist/model/units/units.js +1 -1
  301. package/dist/model/units/units.js.map +1 -1
  302. package/dist/model/units/units.test.js +59 -6
  303. package/dist/model/units/units.test.js.map +1 -1
  304. package/dist/test/index.js +1 -1
  305. package/dist/test/index.js.map +1 -1
  306. package/dist/test/render.js +1 -1
  307. package/dist/test/render.js.map +1 -1
  308. package/dist/test/setup-tests.js +1 -1
  309. package/dist/test/setup-tests.js.map +1 -1
  310. package/dist/test-utils/index.js +1 -1
  311. package/dist/test-utils/index.js.map +1 -1
  312. package/dist/test-utils/theme.d.ts.map +1 -1
  313. package/dist/test-utils/theme.js +6 -1
  314. package/dist/test-utils/theme.js.map +1 -1
  315. package/dist/theme/index.js +1 -1
  316. package/dist/theme/index.js.map +1 -1
  317. package/dist/theme/palette/background.js +1 -1
  318. package/dist/theme/palette/background.js.map +1 -1
  319. package/dist/theme/palette/colors/blue.js +1 -1
  320. package/dist/theme/palette/colors/blue.js.map +1 -1
  321. package/dist/theme/palette/colors/common.js +1 -1
  322. package/dist/theme/palette/colors/common.js.map +1 -1
  323. package/dist/theme/palette/colors/green.js +1 -1
  324. package/dist/theme/palette/colors/green.js.map +1 -1
  325. package/dist/theme/palette/colors/grey.js +1 -1
  326. package/dist/theme/palette/colors/grey.js.map +1 -1
  327. package/dist/theme/palette/colors/index.js +1 -1
  328. package/dist/theme/palette/colors/index.js.map +1 -1
  329. package/dist/theme/palette/colors/orange.js +1 -1
  330. package/dist/theme/palette/colors/orange.js.map +1 -1
  331. package/dist/theme/palette/colors/purple.js +1 -1
  332. package/dist/theme/palette/colors/purple.js.map +1 -1
  333. package/dist/theme/palette/colors/red.js +1 -1
  334. package/dist/theme/palette/colors/red.js.map +1 -1
  335. package/dist/theme/palette/colors/types.js +1 -1
  336. package/dist/theme/palette/colors/types.js.map +1 -1
  337. package/dist/theme/palette/error.js +1 -1
  338. package/dist/theme/palette/error.js.map +1 -1
  339. package/dist/theme/palette/grey.js +1 -1
  340. package/dist/theme/palette/grey.js.map +1 -1
  341. package/dist/theme/palette/index.js +1 -1
  342. package/dist/theme/palette/index.js.map +1 -1
  343. package/dist/theme/palette/palette-options.js +1 -1
  344. package/dist/theme/palette/palette-options.js.map +1 -1
  345. package/dist/theme/palette/primary.js +1 -1
  346. package/dist/theme/palette/primary.js.map +1 -1
  347. package/dist/theme/palette/secondary.js +1 -1
  348. package/dist/theme/palette/secondary.js.map +1 -1
  349. package/dist/theme/palette/success.js +1 -1
  350. package/dist/theme/palette/success.js.map +1 -1
  351. package/dist/theme/palette/text.js +1 -1
  352. package/dist/theme/palette/text.js.map +1 -1
  353. package/dist/theme/palette/warning.js +1 -1
  354. package/dist/theme/palette/warning.js.map +1 -1
  355. package/dist/theme/theme.d.ts.map +1 -1
  356. package/dist/theme/theme.js +13 -2
  357. package/dist/theme/theme.js.map +1 -1
  358. package/dist/theme/types/ThemeExtension.d.js +1 -1
  359. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  360. package/dist/theme/typography.js +1 -1
  361. package/dist/theme/typography.js.map +1 -1
  362. package/dist/utils/combine-sx.js +1 -1
  363. package/dist/utils/combine-sx.js.map +1 -1
  364. package/dist/utils/component-ids.js +1 -1
  365. package/dist/utils/component-ids.js.map +1 -1
  366. package/dist/utils/format.js +1 -1
  367. package/dist/utils/format.js.map +1 -1
  368. package/dist/utils/format.test.js +1 -1
  369. package/dist/utils/format.test.js.map +1 -1
  370. package/dist/utils/index.js +1 -1
  371. package/dist/utils/index.js.map +1 -1
  372. package/dist/utils/mathjs.js +1 -1
  373. package/dist/utils/mathjs.js.map +1 -1
  374. package/dist/utils/theme-gen.d.ts.map +1 -1
  375. package/dist/utils/theme-gen.js +6 -1
  376. package/dist/utils/theme-gen.js.map +1 -1
  377. package/dist/utils/theme-gen.test.js +6 -1
  378. package/dist/utils/theme-gen.test.js.map +1 -1
  379. package/package.json +5 -3
  380. package/dist/Tooltip/SeriesInfo.d.ts.map +0 -1
  381. package/dist/Tooltip/SeriesInfo.js +0 -143
  382. package/dist/Tooltip/SeriesInfo.js.map +0 -1
  383. package/dist/Tooltip/SeriesMarker.d.ts.map +0 -1
  384. package/dist/Tooltip/SeriesMarker.js.map +0 -1
  385. package/dist/Tooltip/Tooltip.d.ts.map +0 -1
  386. package/dist/Tooltip/Tooltip.js.map +0 -1
  387. package/dist/Tooltip/TooltipContent.d.ts.map +0 -1
  388. package/dist/Tooltip/TooltipContent.js.map +0 -1
  389. package/dist/Tooltip/focused-series.d.ts.map +0 -1
  390. package/dist/Tooltip/focused-series.js.map +0 -1
  391. package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
  392. package/dist/Tooltip/focused-series.test.js.map +0 -1
  393. package/dist/Tooltip/index.d.ts +0 -3
  394. package/dist/Tooltip/index.d.ts.map +0 -1
  395. package/dist/Tooltip/tooltip-model.d.ts.map +0 -1
  396. package/dist/Tooltip/tooltip-model.js.map +0 -1
  397. package/dist/Tooltip/utils.d.ts.map +0 -1
  398. package/dist/Tooltip/utils.js.map +0 -1
  399. package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = typeof bytesUnitKinds[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n abbreviate: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\n/**\n * Format value as bytes, use abbreviate option for more readable sizes (KB, MB, GB, etc.)\n * https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828\n */\nexport function formatBytes(bytes: number, unitOptions: BytesUnitOptions) {\n if (bytes === 0) return '0 bytes';\n\n // default to full 'Bytes' formatting\n const options = unitOptions.abbreviate === undefined ? { ...unitOptions, abbreviate: false } : unitOptions;\n\n let decimals = options.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n // avoids minimumFractionDigits value is out of range error, possible values are 0 to 20\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimals < 0) {\n decimals = 0;\n } else if (decimals > 20) {\n decimals = 20;\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const formatter = new Intl.NumberFormat('en-US', formatParams);\n\n if (options.abbreviate === false) {\n return `${formatter.format(bytes)} bytes`;\n }\n\n const k = 1024;\n const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n // Math.max(0, ...) ensures that we don't return -1 as a value for the index.\n // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.\n const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));\n const abbreviatedValue = bytes / Math.pow(k, i);\n return `${formatter.format(abbreviatedValue)} ${sizes[i]}`;\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","unitOptions","options","undefined","decimals","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","formatter","Intl","NumberFormat","format","k","sizes","i","Math","max","floor","log","abbreviatedValue","pow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAO1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAAE,OAAO;IACdC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,OAAO,MAAMC,iBAAiB,GAAgD;IAC5EC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdL,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF;;;CAGC,GACD,OAAO,SAASM,WAAW,CAACC,KAAa,EAAEC,WAA6B,EAAE;IACxE,IAAID,KAAK,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IAElC,qCAAqC;IACrC,MAAME,OAAO,GAAGD,WAAW,CAACN,UAAU,KAAKQ,SAAS,GAAG;QAAE,GAAGF,WAAW;QAAEN,UAAU,EAAE,KAAK;KAAE,GAAGM,WAAW,AAAC;QAE5FC,eAAsB;IAArC,IAAIE,QAAQ,GAAGF,CAAAA,eAAsB,GAAtBA,OAAO,CAACR,cAAc,cAAtBQ,eAAsB,cAAtBA,eAAsB,GAAIZ,sBAAsB,AAAC;IAChE,wFAAwF;IACxF,wIAAwI;IACxI,IAAIc,QAAQ,GAAG,CAAC,EAAE;QAChBA,QAAQ,GAAG,CAAC,CAAC;IACf,OAAO,IAAIA,QAAQ,GAAG,EAAE,EAAE;QACxBA,QAAQ,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,MAAMC,YAAY,GAA6B;QAC7CC,KAAK,EAAE,SAAS;QAChBC,qBAAqB,EAAEH,QAAQ;QAC/BI,qBAAqB,EAAEJ,QAAQ;QAC/BK,WAAW,EAAE,IAAI;KAClB,AAAC;IACF,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAEP,YAAY,CAAC,AAAC;IAE/D,IAAIH,OAAO,CAACP,UAAU,KAAK,KAAK,EAAE;QAChC,OAAO,CAAC,EAAEe,SAAS,CAACG,MAAM,CAACb,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,MAAMc,CAAC,GAAG,IAAI,AAAC;IACf,MAAMC,KAAK,GAAG;QAAC,OAAO;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;KAAC,AAAC;IAExE,6EAA6E;IAC7E,6GAA6G;IAC7G,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACF,IAAI,CAACG,GAAG,CAACpB,KAAK,CAAC,GAAGiB,IAAI,CAACG,GAAG,CAACN,CAAC,CAAC,CAAC,CAAC,AAAC;IACjE,MAAMO,gBAAgB,GAAGrB,KAAK,GAAGiB,IAAI,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC,AAAC;IAChD,OAAO,CAAC,EAAEN,SAAS,CAACG,MAAM,CAACQ,gBAAgB,CAAC,CAAC,CAAC,EAAEN,KAAK,CAACC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = typeof bytesUnitKinds[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n abbreviate: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\n/**\n * Format value as bytes, use abbreviate option for more readable sizes (KB, MB, GB, etc.)\n * https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828\n */\nexport function formatBytes(bytes: number, unitOptions: BytesUnitOptions) {\n if (bytes === 0) return '0 bytes';\n\n // default to full 'Bytes' formatting\n const options = unitOptions.abbreviate === undefined ? { ...unitOptions, abbreviate: false } : unitOptions;\n\n let decimals = options.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n // avoids minimumFractionDigits value is out of range error, possible values are 0 to 20\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimals < 0) {\n decimals = 0;\n } else if (decimals > 20) {\n decimals = 20;\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const formatter = new Intl.NumberFormat('en-US', formatParams);\n\n if (options.abbreviate === false) {\n return `${formatter.format(bytes)} bytes`;\n }\n\n const k = 1024;\n const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n // Math.max(0, ...) ensures that we don't return -1 as a value for the index.\n // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.\n const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));\n const abbreviatedValue = bytes / Math.pow(k, i);\n return `${formatter.format(abbreviatedValue)} ${sizes[i]}`;\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","unitOptions","options","undefined","decimals","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","formatter","Intl","NumberFormat","format","k","sizes","i","Math","max","floor","log","abbreviatedValue","pow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAO1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAAE,OAAO;IACdC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,OAAO,MAAMC,iBAAiB,GAAgD;IAC5EC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdL,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF;;;CAGC,GACD,OAAO,SAASM,WAAW,CAACC,KAAa,EAAEC,WAA6B,EAAE;IACxE,IAAID,KAAK,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IAElC,q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AAC,CAAC,CAAC,AAAC;IACjE,MAAMO,gBAAgB,GAAGrB,KAAK,GAAGiB,IAAI,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC,AAAC;IAChD,OAAO,CAAC,EAAEN,SAAS,CAACG,MAAM,CAACQ,gBAAgB,CAAC,CAAC,CAAC,EAAEN,KAAK,CAACC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/constants.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common constants needed across individual unit groups and the overall\n// combined units.\nexport const DEFAULT_DECIMAL_PLACES = 2;\n"],"names":["DEFAULT_DECIMAL_PLACES"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,wEAAwE;AACxE,kBAAkB;AAClB,OAAO,MAAMA,sBAAsB,GAAG,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/constants.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common constants needed across individual unit groups and the overall\n// combined units.\nexport const DEFAULT_DECIMAL_PLACES = 2;\n"],"names":["DEFAULT_DECIMAL_PLACES"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,wEAAwE;AACxE,kBAAkB;AAClB,OAAO,MAAMA,sBAAsB,GAAG,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,gBAAgB,sBAAuB,CAAC;AAC9C,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAK7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAepF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,UAG9D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAYlF"}
1
+ {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,gBAAgB,sBAAuB,CAAC;AAC9C,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAK7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAmBpF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,UAG9D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAYlF"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -28,7 +28,10 @@ export const DECIMAL_UNIT_CONFIG = {
28
28
  export function formatDecimal(value, unitOptions) {
29
29
  var _decimal_places;
30
30
  const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
31
- if (unitOptions.abbreviate === true) {
31
+ if (value === 0) {
32
+ return value.toString();
33
+ }
34
+ if (unitOptions.abbreviate && value >= 1000) {
32
35
  return abbreviateLargeNumber(value, decimals);
33
36
  }
34
37
  const formatParams = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/decimal.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { round } from '../../utils/mathjs';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = typeof decimalUnitKinds[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.abbreviate === true) {\n return abbreviateLargeNumber(value, decimals);\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);\n return decimalFormatter.format(value);\n}\n\n/**\n * Takes large numbers and abbreviates them with the appropriate suffix\n * 10123 -> 10.123k\n * 1000000 -> 1M\n */\nexport function abbreviateLargeNumber(num: number, decimals = 2) {\n const modifier = (n: number) => round(n, decimals);\n return formatNumber(num, modifier);\n}\n\n/**\n * Takes large numbers, rounds and abbreviates them with the appropriate suffix\n * Add modifier to run on output value prior to unit being added (defaults to rounding)\n */\nexport function formatNumber(num: number, modifier?: (n: number) => number): string {\n const fn = modifier ?? Math.round;\n\n return num >= 1e12\n ? fn(num / 1e12) + 'T'\n : num >= 1e9\n ? fn(num / 1e9) + 'B'\n : num >= 1e6\n ? fn(num / 1e6) + 'M'\n : num >= 1e3\n ? fn(num / 1e3) + 'K'\n : num.toString();\n}\n"],"names":["round","DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","unitOptions","decimals","abbreviate","abbreviateLargeNumber","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","decimalFormatter","Intl","NumberFormat","format","num","modifier","n","formatNumber","fn","Math","toString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,oBAAoB,CAAC;AAC3C,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EA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AE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,CAACM,QAAQ,EAAE,CAAC;AACrB,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/decimal.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { round } from '../../utils/mathjs';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = typeof decimalUnitKinds[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (value === 0) {\n return value.toString();\n }\n\n if (unitOptions.abbreviate && value >= 1000) {\n return abbreviateLargeNumber(value, decimals);\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);\n return decimalFormatter.format(value);\n}\n\n/**\n * Takes large numbers and abbreviates them with the appropriate suffix\n * 10123 -> 10.123k\n * 1000000 -> 1M\n */\nexport function abbreviateLargeNumber(num: number, decimals = 2) {\n const modifier = (n: number) => round(n, decimals);\n return formatNumber(num, modifier);\n}\n\n/**\n * Takes large numbers, rounds and abbreviates them with the appropriate suffix\n * Add modifier to run on output value prior to unit being added (defaults to rounding)\n */\nexport function formatNumber(num: number, modifier?: (n: number) => number): string {\n const fn = modifier ?? Math.round;\n\n return num >= 1e12\n ? fn(num / 1e12) + 'T'\n : num >= 1e9\n ? fn(num / 1e9) + 'B'\n : num >= 1e6\n ? fn(num / 1e6) + 'M'\n : num >= 1e3\n ? fn(num / 1e3) + 'K'\n : num.toString();\n}\n"],"names":["round","DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","unitOptions","decimals","toString","abbreviate","abbreviateLargeNumber","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","decimalFormatter","Intl","NumberFormat","format","num","modifier","n","formatNumber","fn","Math"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,oBAAoB,CAAC;AAC3C,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,mBAAmB,GAAkD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AC;IAElC,OAAOyB,GAAG,IAAI,IAAI,GACdI,EAAE,CAACJ,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GACpBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,CAACZ,QAAQ,EAAE,CAAC;AACrB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './units';\nexport * from './constants';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './units';\nexport * from './constants';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/percent.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\n\nconst percentUnitKinds = ['Percent', 'PercentDecimal', '%'] as const;\ntype PercentUnitKind = typeof percentUnitKinds[number];\nexport type PercentUnitOptions = {\n kind: PercentUnitKind;\n decimal_places?: number;\n};\nexport const DECIMAL_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Decimal',\n decimal_places: true,\n abbreviate: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>> = {\n Percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n PercentDecimal: {\n group: PERCENT_GROUP,\n label: 'Percent (0.0-1.0)',\n },\n '%': {\n // This option is not shown in the selector because it is a shorthand\n // duplicate of `Percent`.\n disableSelectorOption: true,\n group: PERCENT_GROUP,\n label: '%',\n },\n};\n\nexport function formatPercent(value: number, unitOptions: PercentUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.kind === 'PercentDecimal') {\n value = value * 100;\n }\n\n return value.toFixed(decimals) + '%';\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","percentUnitKinds","DECIMAL_GROUP_CONFIG","label","decimal_places","abbreviate","PERCENT_GROUP","PERCENT_UNIT_CONFIG","Percent","group","PercentDecimal","disableSelectorOption","formatPercent","value","unitOptions","decimals","kind","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAErD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;IAAE,gBAAgB;IAAE,GAAG;CAAC,AAAS,AAAC;AAMrE,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,MAAMC,aAAa,GAAG,SAAS,AAAC;AAChC,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,iBAAiB;KACzB;IACDO,cAAc,EAAE;QACdD,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,mBAAmB;KAC3B;IACD,GAAG,EAAE;QACH,qEAAqE;QACrE,0BAA0B;QAC1BQ,qBAAqB,EAAE,IAAI;QAC3BF,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,OAAO,SAASS,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACV,cAAc,cAA1BU,eAA0B,cAA1BA,eAA0B,GAAId,sBAAsB,AAAC;IAEtE,IAAIc,WAAW,CAACE,IAAI,KAAK,gBAAgB,EAAE;QACzCH,KAAK,GAAGA,KAAK,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,OAAOA,KAAK,CAACI,OAAO,CAACF,QAAQ,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/percent.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\n\nconst percentUnitKinds = ['Percent', 'PercentDecimal', '%'] as const;\ntype PercentUnitKind = typeof percentUnitKinds[number];\nexport type PercentUnitOptions = {\n kind: PercentUnitKind;\n decimal_places?: number;\n};\nexport const DECIMAL_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Decimal',\n decimal_places: true,\n abbreviate: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>> = {\n Percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n PercentDecimal: {\n group: PERCENT_GROUP,\n label: 'Percent (0.0-1.0)',\n },\n '%': {\n // This option is not shown in the selector because it is a shorthand\n // duplicate of `Percent`.\n disableSelectorOption: true,\n group: PERCENT_GROUP,\n label: '%',\n },\n};\n\nexport function formatPercent(value: number, unitOptions: PercentUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.kind === 'PercentDecimal') {\n value = value * 100;\n }\n\n return value.toFixed(decimals) + '%';\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","percentUnitKinds","DECIMAL_GROUP_CONFIG","label","decimal_places","abbreviate","PERCENT_GROUP","PERCENT_UNIT_CONFIG","Percent","group","PercentDecimal","disableSelectorOption","formatPercent","value","unitOptions","decimals","kind","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAErD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;IAAE,gBAAgB;IAAE,GAAG;CAAC,AAAS,AAAC;AAMrE,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,MAAMC,aAAa,GAAG,SAAS,AAAC;AAChC,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,iBAAiB;KACzB;IACDO,cAAc,EAAE;QACdD,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,mBAAmB;KAC3B;IACD,GAAG,EAAE;QACH,qEAAqE;QACrE,0BAA0B;QAC1BQ,qBAAqB,EAAE,IAAI;QAC3BF,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,OAAO,SAASS,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACV,cAAc,cAA1BU,eAA0B,cAA1BA,eAA0B,GAAId,sBAAsB,AAAC;IAEtE,IAAIc,WAAW,CAACE,IAAI,KAAK,gBAAgB,EAAE;QACzCH,KAAK,GAAGA,KAAK,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,OAAOA,KAAK,CAACI,OAAO,CAACF,QAAQ,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/time.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = typeof timeUnitKinds[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimals","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","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IAAG,aAAa;IADlBS,gBAAgB,CAE1BP,SAAO,IAAG,QAAQ;IAFRO,gBAAgB,CAG1BN,SAAO,IAAG,QAAQ;IAHRM,gBAAgB,CAI1BL,OAAK,IAAG,MAAM;IAJJK,gBAAgB,CAK1BJ,MAAI,IAAG,KAAK;IALFI,gBAAgB,CAM1BH,OAAK,IAAG,MAAM;IANJG,gBAAgB,CAO1BF,QAAM,IAAG,OAAO;IAPNE,gBAAgB,CAQ1BD,OAAK,IAAG,MAAM;GARJC,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,SAASC,UAAU,CAACC,KAAa,EAAEC,WAA4B,EAAU;QAC7DA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACd,cAAc,cAA1Bc,eAA0B,cAA1BA,eAA0B,GAAInB,sBAAsB,AAAC;IACtE,MAAMqB,QAAQ,GAAWL,gBAAgB,CAACG,WAAW,CAACG,IAAI,CAAC,AAAC;IAC5D,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;QAC/CC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAEN,QAAQ;QACdO,WAAW,EAAE,MAAM;QACnBC,qBAAqB,EAAET,QAAQ;QAC/BU,qBAAqB,EAAEV,QAAQ;KAChC,CAAC,AAAC;IACH,OAAOG,SAAS,CAACQ,MAAM,CAACb,KAAK,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/time.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = typeof timeUnitKinds[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimals","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","unitDisplay","minimumFractionDigits","maximumFractionDigits","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,aAAa,GAAG;IAAC,cAAc;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;IAAE,MAAM;IAAE,OAAO;IAAE,QAAQ;IAAE,OAAO;CAAC,AAAS,AAAC;AAMnH,MAAMC,UAAU,GAAG,MAAM,AAAC;AAC1B,OAAO,MAAMC,iBAAiB,GAAoB;IAChDC,KAAK,EAAE,MAAM;IACbC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,gBAAgB,GAA+C;IAC1EC,YAAY,EAAE;QACZC,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,cAAc;KACtB;IACDK,OAAO,EAAE;QACPD,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDM,OAAO,EAAE;QACPF,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDO,KAAK,EAAE;QACLH,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDQ,IAAI,EAAE;QACJJ,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,MAAM;KACd;IACDS,KAAK,EAAE;QACLL,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDU,MAAM,EAAE;QACNN,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,QAAQ;KAChB;IACDW,KAAK,EAAE;QACLP,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;CACF,CAAC;WAIK,gBASN;UATWY,gBAAgB;IAAhBA,gBAAgB,CAC1BT,cAAY,IAAG,aAAa;IADlBS,gBAAgB,CAE1BP,SAAO,IAAG,QAAQ;IAFRO,gBAAgB,CAG1BN,SAAO,IAAG,QAAQ;IAHRM,gBAAgB,CAI1BL,OAAK,IAAG,MAAM;IAJJK,gBAAgB,CAK1BJ,MAAI,IAAG,KAAK;IALFI,gBAAgB,CAM1BH,OAAK,IAAG,MAAM;IANJG,gBAAgB,CAO1BF,QAAM,IAAG,OAAO;IAPNE,gBAAgB,CAQ1BD,OAAK,IAAG,MAAM;GARJC,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,SAASC,UAAU,CAACC,KAAa,EAAEC,WAA4B,EAAU;QAC7DA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACd,cAAc,cAA1Bc,eAA0B,cAA1BA,eAA0B,GAAInB,sBAAsB,AAAC;IACtE,MAAMqB,QAAQ,GAAWL,gBAAgB,CAACG,WAAW,CAACG,IAAI,CAAC,AAAC;IAC5D,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;QAC/CC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAEN,QAAQ;QACdO,WAAW,EAAE,MAAM;QACnBC,qBAAqB,EAAET,QAAQ;QAC/BU,qBAAqB,EAAEV,QAAQ;KAChC,CAAC,AAAC;IACH,OAAOG,SAAS,CAACQ,MAAM,CAACb,KAAK,CAAC,CAAC;AACjC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes'] as const;\nexport type UnitGroup = typeof UNIT_GROUPS[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimal_places?: boolean;\n /**\n * When true, the unit group supports enabling abbreviate.\n */\n abbreviate?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n"],"names":["UNIT_GROUPS"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6EAA6E;AAC7E,SAAS;AAET,OAAO,MAAMA,WAAW,GAAG;IAAC,MAAM;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;CAAC,AAAS,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes'] as const;\nexport type UnitGroup = typeof UNIT_GROUPS[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimal_places?: boolean;\n /**\n * When true, the unit group supports enabling abbreviate.\n */\n abbreviate?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n"],"names":["UNIT_GROUPS"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6EAA6E;AAC7E,SAAS;AAET,OAAO,MAAMA,WAAW,GAAG;IAAC,MAAM;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;CAAC,AAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/units.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BytesUnitOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG, formatBytes } from './bytes';\nimport { DecimalUnitOptions, DECIMAL_UNIT_CONFIG, formatDecimal, PERCENT_GROUP_CONFIG } from './decimal';\nimport { DECIMAL_GROUP_CONFIG, formatPercent, PercentUnitOptions, PERCENT_UNIT_CONFIG } from './percent';\nimport { formatTime, TimeUnitOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n} as const;\n\nexport type UnitOptions = TimeUnitOptions | PercentUnitOptions | DecimalUnitOptions | BytesUnitOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimal_places?: number } ? UnitOpt : never;\ntype HasAbbreviate<UnitOpt> = UnitOpt extends { abbreviate?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, unitOptions?: UnitOptions): string {\n if (unitOptions === undefined) {\n return value.toString();\n }\n\n if (isDecimalUnit(unitOptions)) {\n return formatDecimal(value, unitOptions);\n }\n\n if (isTimeUnit(unitOptions)) {\n return formatTime(value, unitOptions);\n }\n\n if (isPercentUnit(unitOptions)) {\n return formatPercent(value, unitOptions);\n }\n\n if (isBytesUnit(unitOptions)) {\n return formatBytes(value, unitOptions);\n }\n\n const exhaustive: never = unitOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitKindConfig(unitOptions: UnitOptions): UnitConfig {\n return UNIT_CONFIG[unitOptions.kind];\n}\n\nexport function getUnitGroup(unitOptions: UnitOptions): UnitGroup {\n return getUnitKindConfig(unitOptions).group;\n}\n\nexport function getUnitGroupConfig(unitOptions: UnitOptions): UnitGroupConfig {\n const unitConfig = getUnitKindConfig(unitOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group];\n}\n\n// Type guards\nexport function isTimeUnit(unitOptions: UnitOptions): unitOptions is TimeUnitOptions {\n return getUnitGroup(unitOptions) === 'Time';\n}\n\nexport function isPercentUnit(unitOptions: UnitOptions): unitOptions is PercentUnitOptions {\n return getUnitGroup(unitOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(unitOptions: UnitOptions): unitOptions is DecimalUnitOptions {\n return getUnitGroup(unitOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(unitOptions: UnitOptions): unitOptions is BytesUnitOptions {\n return getUnitGroup(unitOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(unitOptions: UnitOptions): unitOptions is HasDecimalPlaces<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.decimal_places;\n}\n\nexport function isUnitWithAbbreviate(unitOptions: UnitOptions): unitOptions is HasAbbreviate<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.abbreviate;\n}\n"],"names":["BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatBytes","DECIMAL_UNIT_CONFIG","formatDecimal","PERCENT_GROUP_CONFIG","DECIMAL_GROUP_CONFIG","formatPercent","PERCENT_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","UNIT_CONFIG","formatValue","value","unitOptions","undefined","toString","isDecimalUnit","isTimeUnit","isPercentUnit","isBytesUnit","exhaustive","Error","getUnitKindConfig","kind","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimal_places","isUnitWithAbbreviate","abbreviate"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAA2BA,kBAAkB,EAAEC,iBAAiB,EAAEC,WAAW,QAAQ,SAAS,CAAC;AAC/F,SAA6BC,mBAAmB,EAAEC,aAAa,EAAEC,oBAAoB,QAAQ,WAAW,CAAC;AACzG,SAASC,oBAAoB,EAAEC,aAAa,EAAsBC,mBAAmB,QAAQ,WAAW,CAAC;AACzG,SAASC,UAAU,EAAmBC,iBAAiB,EAAEC,gBAAgB,QAAQ,QAAQ,CAAC;AAG1F,OAAO,MAAMC,iBAAiB,GAAiD;IAC7EC,IAAI,EAAEH,iBAAiB;IACvBI,OAAO,EAAET,oBAAoB;IAC7BU,OAAO,EAAET,oBAAoB;IAC7BU,KAAK,EAAEhB,kBAAkB;CAC1B,CAAC;AACF,OAAO,MAAMiB,WAAW,GAAG;IACzB,GAAGN,gBAAgB;IACnB,GAAGH,mBAAmB;IACtB,GAAGL,mBAAmB;IACtB,GAAGF,iBAAiB;CACrB,AAAS,CAAC;AAOX,OAAO,SAASiB,WAAW,CAACC,KAAa,EAAEC,WAAyB,EAAU;IAC5E,IAAIA,WAAW,KAAKC,SAAS,EAAE;QAC7B,OAAOF,KAAK,CAACG,QAAQ,EAAE,CAAC;IA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C;AAED,OAAO,SAASG,aAAa,CAACH,WAAwB,EAAqC;IACzF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,OAAO,SAASM,WAAW,CAACN,WAAwB,EAAmC;IACrF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,OAAO,CAAC;AAC/C,CAAC;AAED,OAAO,SAASe,uBAAuB,CAACf,WAAwB,EAAgD;IAC9G,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACC,cAAc,CAAC;AACtC,CAAC;AAED,OAAO,SAASC,oBAAoB,CAAClB,WAAwB,EAA6C;IACxG,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACG,UAAU,CAAC;AAClC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/units.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BytesUnitOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG, formatBytes } from './bytes';\nimport { DecimalUnitOptions, DECIMAL_UNIT_CONFIG, formatDecimal, PERCENT_GROUP_CONFIG } from './decimal';\nimport { DECIMAL_GROUP_CONFIG, formatPercent, PercentUnitOptions, PERCENT_UNIT_CONFIG } from './percent';\nimport { formatTime, TimeUnitOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n} as const;\n\nexport type UnitOptions = TimeUnitOptions | PercentUnitOptions | DecimalUnitOptions | BytesUnitOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimal_places?: number } ? UnitOpt : never;\ntype HasAbbreviate<UnitOpt> = UnitOpt extends { abbreviate?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, unitOptions?: UnitOptions): string {\n if (unitOptions === undefined) {\n return value.toString();\n }\n\n if (isDecimalUnit(unitOptions)) {\n return formatDecimal(value, unitOptions);\n }\n\n if (isTimeUnit(unitOptions)) {\n return formatTime(value, unitOptions);\n }\n\n if (isPercentUnit(unitOptions)) {\n return formatPercent(value, unitOptions);\n }\n\n if (isBytesUnit(unitOptions)) {\n return formatBytes(value, unitOptions);\n }\n\n const exhaustive: never = unitOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitKindConfig(unitOptions: UnitOptions): UnitConfig {\n return UNIT_CONFIG[unitOptions.kind];\n}\n\nexport function getUnitGroup(unitOptions: UnitOptions): UnitGroup {\n return getUnitKindConfig(unitOptions).group;\n}\n\nexport function getUnitGroupConfig(unitOptions: UnitOptions): UnitGroupConfig {\n const unitConfig = getUnitKindConfig(unitOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group];\n}\n\n// Type guards\nexport function isTimeUnit(unitOptions: UnitOptions): unitOptions is TimeUnitOptions {\n return getUnitGroup(unitOptions) === 'Time';\n}\n\nexport function isPercentUnit(unitOptions: UnitOptions): unitOptions is PercentUnitOptions {\n return getUnitGroup(unitOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(unitOptions: UnitOptions): unitOptions is DecimalUnitOptions {\n return getUnitGroup(unitOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(unitOptions: UnitOptions): unitOptions is BytesUnitOptions {\n return getUnitGroup(unitOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(unitOptions: UnitOptions): unitOptions is HasDecimalPlaces<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.decimal_places;\n}\n\nexport function isUnitWithAbbreviate(unitOptions: UnitOptions): unitOptions is HasAbbreviate<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.abbreviate;\n}\n"],"names":["BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatBytes","DECIMAL_UNIT_CONFIG","formatDecimal","PERCENT_GROUP_CONFIG","DECIMAL_GROUP_CONFIG","formatPercent","PERCENT_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","UNIT_CONFIG","formatValue","value","unitOptions","undefined","toString","isDecimalUnit","isTimeUnit","isPercentUnit","isBytesUnit","exhaustive","Error","getUnitKindConfig","kind","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimal_places","isUnitWithAbbreviate","abbreviate"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAA2BA,kBAAkB,EAAEC,iBAAiB,EAAEC,WAAW,QAAQ,SAAS,CAAC;AAC/F,SAA6BC,mBAAmB,EAAEC,aAAa,EAAEC,oBAAoB,QAAQ,WAAW,CAAC;AACzG,SAASC,oBAAoB,EAAEC,aAAa,EA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IAAI,CAAC,CAAC;AACvC,CAAC;AAED,OAAO,SAASC,YAAY,CAACX,WAAwB,EAAa;IAChE,OAAOS,iBAAiB,CAACT,WAAW,CAAC,CAACY,KAAK,CAAC;AAC9C,CAAC;AAED,OAAO,SAASC,kBAAkB,CAACb,WAAwB,EAAmB;IAC5E,MAAMc,UAAU,GAAGL,iBAAiB,CAACT,WAAW,CAAC,AAAC;IAClD,OAAOR,iBAAiB,CAACsB,UAAU,CAACF,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,cAAc;AACd,OAAO,SAASR,UAAU,CAACJ,WAAwB,EAAkC;IACnF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,MAAM,CAAC;AAC9C,CAAC;AAED,OAAO,SAASK,aAAa,CAACL,WAAwB,EAAqC;IACzF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,OAAO,SAASG,aAAa,CAACH,WAAwB,EAAqC;IACzF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,OAAO,SAASM,WAAW,CAACN,WAAwB,EAAmC;IACrF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,OAAO,CAAC;AAC/C,CAAC;AAED,OAAO,SAASe,uBAAuB,CAACf,WAAwB,EAAgD;IAC9G,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACC,cAAc,CAAC;AACtC,CAAC;AAED,OAAO,SAASC,oBAAoB,CAAClB,WAAwB,EAA6C;IACxG,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACG,UAAU,CAAC;AAClC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { formatValue } from './units';
14
- describe('formatValue()', ()=>{
14
+ describe('formatValue', ()=>{
15
15
  const tests = [
16
16
  {
17
17
  value: 100000,
@@ -28,6 +28,60 @@ describe('formatValue()', ()=>{
28
28
  },
29
29
  expected: '155,900.0000'
30
30
  },
31
+ {
32
+ value: 1000,
33
+ unit: {
34
+ kind: 'Decimal',
35
+ decimal_places: 2,
36
+ abbreviate: true
37
+ },
38
+ expected: '1K'
39
+ },
40
+ {
41
+ value: 1590.878787,
42
+ unit: {
43
+ kind: 'Decimal',
44
+ decimal_places: 3,
45
+ abbreviate: true
46
+ },
47
+ expected: '1.591K'
48
+ },
49
+ {
50
+ value: 0.123456789,
51
+ unit: {
52
+ kind: 'Decimal',
53
+ decimal_places: 2,
54
+ abbreviate: true
55
+ },
56
+ expected: '0.12'
57
+ },
58
+ {
59
+ value: 0.123456789,
60
+ unit: {
61
+ kind: 'Decimal',
62
+ decimal_places: 4,
63
+ abbreviate: false
64
+ },
65
+ expected: '0.1235'
66
+ },
67
+ {
68
+ value: -0.123456789,
69
+ unit: {
70
+ kind: 'Decimal',
71
+ decimal_places: 3,
72
+ abbreviate: true
73
+ },
74
+ expected: '-0.123'
75
+ },
76
+ {
77
+ value: 0,
78
+ unit: {
79
+ kind: 'Decimal',
80
+ decimal_places: 2,
81
+ abbreviate: true
82
+ },
83
+ expected: '0'
84
+ },
31
85
  {
32
86
  value: 10,
33
87
  unit: {
@@ -141,10 +195,9 @@ describe('formatValue()', ()=>{
141
195
  expected: '300.00 years'
142
196
  }
143
197
  ];
144
- tests.forEach(({ value , unit , expected })=>{
145
- it(`formats ${value} as ${JSON.stringify(unit)}`, ()=>{
146
- expect(formatValue(value, unit)).toEqual(expected);
147
- });
198
+ it.each(tests)('returns $expected when $value formatted as $unit', (args)=>{
199
+ const { value , unit , expected } = args;
200
+ expect(formatValue(value, unit)).toEqual(expected);
148
201
  });
149
202
  });
150
203
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/units.test.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatValue, UnitOptions } from './units';\n\ndescribe('formatValue()', () => {\n const tests = [\n {\n value: 100000,\n unit: { kind: 'Decimal' },\n expected: '100,000.00',\n },\n {\n value: 155900,\n unit: { kind: 'Decimal', decimal_places: 4 },\n expected: '155,900.0000',\n },\n {\n value: 10,\n unit: { kind: 'Percent' },\n expected: '10.00%',\n },\n {\n value: 50,\n unit: { kind: 'Percent', decimal_places: 0 },\n expected: '50%',\n },\n {\n value: 0.1,\n unit: { kind: 'PercentDecimal' },\n expected: '10.00%',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: -1, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 225000,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: true },\n expected: '220 KB',\n },\n {\n value: 505200,\n unit: { kind: 'Bytes' },\n expected: '505,200.00 bytes',\n },\n {\n value: 8000,\n unit: { kind: 'Milliseconds' },\n expected: '8,000.00 milliseconds',\n },\n {\n value: 200900,\n unit: { kind: 'Seconds' },\n expected: '200,900.00 seconds',\n },\n {\n value: 300,\n unit: { kind: 'Minutes' },\n expected: '300.00 minutes',\n },\n {\n value: 300,\n unit: { kind: 'Hours' },\n expected: '300.00 hours',\n },\n {\n value: 300,\n unit: { kind: 'Days' },\n expected: '300.00 days',\n },\n {\n value: 300,\n unit: { kind: 'Weeks' },\n expected: '300.00 weeks',\n },\n {\n value: 300,\n unit: { kind: 'Months' },\n expected: '300.00 months',\n },\n {\n value: 300,\n unit: { kind: 'Years' },\n expected: '300.00 years',\n },\n ];\n\n tests.forEach(({ value, unit, expected }) => {\n it(`formats ${value} as ${JSON.stringify(unit)}`, () => {\n expect(formatValue(value, unit as UnitOptions)).toEqual(expected);\n });\n });\n});\n"],"names":["formatValue","describe","tests","value","unit","kind","expected","decimal_places","abbreviate","forEach","it","JSON","stringify","expect","toEqual"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAqB,SAAS,CAAC;AAEnDC,QAAQ,CAAC,eAAe,EAAE,IAAM;IAC9B,MAAMC,KAAK,GAAG;QACZ;YACEC,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;aAAE;YACzBC,QAAQ,EAAE,YAAY;SACvB;QACD;YACEH,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;aAAE;YAC5CD,QAAQ,EAAE,cAAc;SACzB;QACD;YACEH,KAAK,EAAE,EAAE;YACTC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;aAAE;YACzBC,QAAQ,EAAE,QAAQ;SACnB;QACD;YACEH,KAAK,EAAE,EAAE;YACTC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;aAAE;YAC5CD,QAAQ,EAAE,KAAK;SAChB;QACD;YACEH,KAAK,EAAE,GAAG;YACVC,IAAI,EAAE;gBAAEC,IAAI,EAAE,g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SACxB;QACD;YACEH,KAAK,EAAE,GAAG;YACVC,IAAI,EAAE;gBAAEC,IAAI,EAAE,OAAO;aAAE;YACvBC,QAAQ,EAAE,cAAc;SACzB;QACD;YACEH,KAAK,EAAE,GAAG;YACVC,IAAI,EAAE;gBAAEC,IAAI,EAAE,QAAQ;aAAE;YACxBC,QAAQ,EAAE,eAAe;SAC1B;QACD;YACEH,KAAK,EAAE,GAAG;YACVC,IAAI,EAAE;gBAAEC,IAAI,EAAE,OAAO;aAAE;YACvBC,QAAQ,EAAE,cAAc;SACzB;KACF,AAAC;IAEFJ,KAAK,CAACO,OAAO,CAAC,CAAC,EAAEN,KAAK,CAAA,EAAEC,IAAI,CAAA,EAAEE,QAAQ,CAAA,EAAE,GAAK;QAC3CI,EAAE,CAAC,CAAC,QAAQ,EAAEP,KAAK,CAAC,IAAI,EAAEQ,IAAI,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC,CAAC,EAAE,IAAM;YACtDS,MAAM,CAACb,WAAW,CAACG,KAAK,EAAEC,IAAI,CAAgB,CAAC,CAACU,OAAO,CAACR,QAAQ,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/units.test.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatValue, UnitOptions } from './units';\n\ninterface UnitTestCase {\n value: number;\n unit: UnitOptions;\n expected: string;\n}\n\ndescribe('formatValue', () => {\n const tests: UnitTestCase[] = [\n {\n value: 100000,\n unit: { kind: 'Decimal' },\n expected: '100,000.00',\n },\n {\n value: 155900,\n unit: { kind: 'Decimal', decimal_places: 4 },\n expected: '155,900.0000',\n },\n {\n value: 1000,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '1K',\n },\n {\n value: 1590.878787,\n unit: { kind: 'Decimal', decimal_places: 3, abbreviate: true },\n expected: '1.591K',\n },\n {\n value: 0.123456789,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '0.12',\n },\n {\n value: 0.123456789,\n unit: { kind: 'Decimal', decimal_places: 4, abbreviate: false },\n expected: '0.1235',\n },\n {\n value: -0.123456789,\n unit: { kind: 'Decimal', decimal_places: 3, abbreviate: true },\n expected: '-0.123',\n },\n {\n value: 0,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '0',\n },\n {\n value: 10,\n unit: { kind: 'Percent' },\n expected: '10.00%',\n },\n {\n value: 50,\n unit: { kind: 'Percent', decimal_places: 0 },\n expected: '50%',\n },\n {\n value: 0.1,\n unit: { kind: 'PercentDecimal' },\n expected: '10.00%',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: -1, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 225000,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: true },\n expected: '220 KB',\n },\n {\n value: 505200,\n unit: { kind: 'Bytes' },\n expected: '505,200.00 bytes',\n },\n {\n value: 8000,\n unit: { kind: 'Milliseconds' },\n expected: '8,000.00 milliseconds',\n },\n {\n value: 200900,\n unit: { kind: 'Seconds' },\n expected: '200,900.00 seconds',\n },\n {\n value: 300,\n unit: { kind: 'Minutes' },\n expected: '300.00 minutes',\n },\n {\n value: 300,\n unit: { kind: 'Hours' },\n expected: '300.00 hours',\n },\n {\n value: 300,\n unit: { kind: 'Days' },\n expected: '300.00 days',\n },\n {\n value: 300,\n unit: { kind: 'Weeks' },\n expected: '300.00 weeks',\n },\n {\n value: 300,\n unit: { kind: 'Months' },\n expected: '300.00 months',\n },\n {\n value: 300,\n unit: { kind: 'Years' },\n expected: '300.00 years',\n },\n ];\n it.each(tests)('returns $expected when $value formatted as $unit', (args: UnitTestCase) => {\n const { value, unit, expected } = args;\n expect(formatValue(value, unit)).toEqual(expected);\n });\n});\n"],"names":["formatValue","describe","tests","value","unit","kind","expected","decimal_places","abbreviate","it","each","args","expect","toEqual"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAqB,SAAS,CAAC;AAQnDC,QAAQ,CAAC,aAAa,EAAE,IAAM;IAC5B,MAAMC,KAAK,GAAmB;QAC5B;YACEC,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;aAAE;YACzBC,QAAQ,EAAE,YAAY;SACvB;QACD;YACEH,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;aAAE;YAC5CD,QAAQ,EAAE,cAAc;SACzB;QACD;YACEH,KAAK,EAAE,IAAI;YACXC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;gBAAEC,UAAU,EAAE,IAAI;aAAE;YAC9DF,QAAQ,EAAE,IAAI;SACf;QACD;YACEH,KAAK,EAAE,WAAW;YAClBC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;gBAAEC,UAAU,EAAE,IAAI;aAAE;YAC9DF,QAAQ,EAAE,QAAQ;SACnB;QACD;YACEH,KAAK,EAAE,WAAW;YAClBC,IAAI,EAAE;gBAAEC,IAAI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E,OAAO;aAAE;YACvBC,QAAQ,EAAE,cAAc;SACzB;KACF,AAAC;IACFG,EAAE,CAACC,IAAI,CAACR,KAAK,CAAC,CAAC,kDAAkD,EAAE,CAACS,IAAkB,GAAK;QACzF,MAAM,EAAER,KAAK,CAAA,EAAEC,IAAI,CAAA,EAAEE,QAAQ,CAAA,EAAE,GAAGK,IAAI,AAAC;QACvCC,MAAM,CAACZ,WAAW,CAACG,KAAK,EAAEC,IAAI,CAAC,CAAC,CAACS,OAAO,CAACP,QAAQ,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './render';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/test/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './render';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: React.ReactElement, options?: Omit<RenderOptions, 'queries'>) {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["render","QueryClient","QueryClientProvider","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAuB,wBAAwB,CAAC;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB,CAAC;AAEzE,MAAMC,WAAW,GAAG,IAAIF,WAAW,CAAC;IAAEG,cAAc,EAAE;QAAEC,OAAO,EAAE;YAAEC,oBAAoB,EAAE,KAAK;SAAE;KAAE;CAAE,CAAC,AAAC;AAEtG;;CAEC,GACD,OAAO,SAASC,iBAAiB,CAACC,EAAsB,EAAEC,OAAwC,EAAE;IAClG,OAAOT,MAAM,eAAC,KAACE,mBAAmB;QAACQ,MAAM,EAAEP,WAAW;kBAAGK,EAAE;MAAuB,EAAEC,OAAO,CAAC,CAAC;AAC/F,CAAC"}
1
+ {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: React.ReactElement, options?: Omit<RenderOptions, 'queries'>) {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["render","QueryClient","QueryClientProvider","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAuB,wBAAwB,CAAC;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB,CAAC;AAEzE,MAAMC,WAAW,GAAG,IAAIF,WAAW,CAAC;IAAEG,cAAc,EAAE;QAAEC,OAAO,EAAE;YAAEC,oBAAoB,EAAE,KAAK;SAAE;KAAE;CAAE,CAAC,AAAC;AAEtG;;CAEC,GACD,OAAO,SAASC,iBAAiB,CAACC,EAAsB,EAAEC,OAAwC,EAAE;IAClG,OAAOT,MAAM,eAAC,KAACE,mBAAmB;QAACQ,MAAM,EAAEP,WAAW;kBAAGK,EAAE;MAAuB,EAAEC,OAAO,CAAC,CAAC;AAC/F,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/setup-tests.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,iCAAiC;AACjC,OAAO,yCAAyC,CAAC;AAEjD,iFAAiF;AACjFA,IAAI,CAACC,IAAI,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/test/setup-tests.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,iCAAiC;AACjC,OAAO,yCAAyC,CAAC;AAEjD,iFAAiF;AACjFA,IAAI,CAACC,IAAI,CAAC,cAAc,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"sources":["../../src/test-utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/test-utils/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,iBAO7B,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/test-utils/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,iBAY7B,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -16,6 +16,11 @@ export const testChartsTheme = {
16
16
  sparkline: {
17
17
  width: 1,
18
18
  color: '#000000'
19
+ },
20
+ container: {
21
+ padding: {
22
+ default: 12
23
+ }
19
24
  }
20
25
  };
21
26
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/theme.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesChartsTheme } from '../model';\n\nexport const testChartsTheme: PersesChartsTheme = {\n echartsTheme: {},\n noDataOption: {},\n sparkline: {\n width: 1,\n color: '#000000',\n },\n};\n"],"names":["testChartsTheme","echartsTheme","noDataOption","sparkline","width","color"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAsB;IAChDC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;QACTC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,SAAS;KACjB;CACF,CAAC"}
1
+ {"version":3,"sources":["../../src/test-utils/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesChartsTheme } from '../model';\n\nexport const testChartsTheme: PersesChartsTheme = {\n echartsTheme: {},\n noDataOption: {},\n sparkline: {\n width: 1,\n color: '#000000',\n },\n container: {\n padding: {\n default: 12,\n },\n },\n};\n"],"names":["testChartsTheme","echartsTheme","noDataOption","sparkline","width","color","container","padding","default"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAsB;IAChDC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;QACTC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,SAAS;KACjB;IACDC,SAAS,EAAE;QACTC,OAAO,EAAE;YACPC,OAAO,EAAE,EAAE;SACZ;KACF;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {} from './types/ThemeExtension';\nimport { PersesColor } from './palette';\n\nexport * from './theme';\n\n//Use Typescript interface augmentation to extend the MUI type definition\ndeclare module '@mui/material/styles/createPalette' {\n interface TypeBackground {\n navigation: string;\n tooltip: string;\n overlay: string;\n border: string;\n }\n\n interface TypeText {\n navigation: string;\n accent: string;\n link: string;\n linkHover: string;\n }\n}\n\ndeclare module '@mui/material/styles' {\n interface Palette {\n /**\n * The base colors from Perses design system. Use sparingly since\n * this is meant as an escape hatch when the theme's other semantic colors\n * won't get you what you need.\n */\n designSystem: {\n blue: PersesColor;\n green: PersesColor;\n grey: PersesColor;\n orange: PersesColor;\n purple: PersesColor;\n red: PersesColor;\n };\n }\n\n interface PaletteOptions {\n designSystem?: Palette['designSystem'];\n }\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"sources":["../../src/theme/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {} from './types/ThemeExtension';\nimport { PersesColor } from './palette';\n\nexport * from './theme';\n\n//Use Typescript interface augmentation to extend the MUI type definition\ndeclare module '@mui/material/styles/createPalette' {\n interface TypeBackground {\n navigation: string;\n tooltip: string;\n overlay: string;\n border: string;\n }\n\n interface TypeText {\n navigation: string;\n accent: string;\n link: string;\n linkHover: string;\n }\n}\n\ndeclare module '@mui/material/styles' {\n interface Palette {\n /**\n * The base colors from Perses design system. Use sparingly since\n * this is meant as an escape hatch when the theme's other semantic colors\n * won't get you what you need.\n */\n designSystem: {\n blue: PersesColor;\n green: PersesColor;\n grey: PersesColor;\n orange: PersesColor;\n purple: PersesColor;\n red: PersesColor;\n };\n }\n\n interface PaletteOptions {\n designSystem?: Palette['designSystem'];\n }\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,cAAc,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/palette/background.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PaletteMode, PaletteOptions } from '@mui/material';\nimport { blue, grey, white } from './colors';\n\nexport const background = (mode: PaletteMode): PaletteOptions['background'] => {\n const navigation = blue[150];\n const overlay = 'rgba(21, 23, 33, 0.75)'; // grey[900] with opacity 75%\n return mode === 'light'\n ? {\n navigation,\n overlay,\n default: grey[50],\n paper: white,\n tooltip: grey[100],\n border: grey[100],\n }\n : {\n navigation,\n overlay,\n default: grey[900],\n paper: grey[850],\n tooltip: grey[700],\n border: grey[600],\n };\n};\n"],"names":["blue","grey","white","background","mode","navigation","overlay","default","paper","tooltip","border"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,UAAU,CAAC;AAE7C,OAAO,MAAMC,UAAU,GAAG,CAACC,IAAiB,GAAmC;IAC7E,MAAMC,UAAU,GAAGL,IAAI,CAAC,GAAG,CAAC,AAAC;IAC7B,MAAMM,OAAO,GAAG,wBAAwB,AAAC,EAAC,6BAA6B;IACvE,OAAOF,IAAI,KAAK,OAAO,GACnB;QACEC,UAAU;QACVC,OAAO;QACPC,OAAO,EAAEN,IAAI,CAAC,EAAE,CAAC;QACjBO,KAAK,EAAEN,KAAK;QACZO,OAAO,EAAER,IAAI,CAAC,GAAG,CAAC;QAClBS,MAAM,EAAET,IAAI,CAAC,GAAG,CAAC;KAClB,GACD;QACEI,UAAU;QACVC,OAAO;QACPC,OAAO,EAAEN,IAAI,CAAC,GAAG,CAAC;QAClBO,KAAK,EAAEP,IAAI,CAAC,GAAG,CAAC;QAChBQ,OAAO,EAAER,IAAI,CAAC,GAAG,CAAC;QAClBS,MAAM,EAAET,IAAI,CAAC,GAAG,CAAC;KAClB,CAAC;AACR,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/theme/palette/background.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PaletteMode, PaletteOptions } from '@mui/material';\nimport { blue, grey, white } from './colors';\n\nexport const background = (mode: PaletteMode): PaletteOptions['background'] => {\n const navigation = blue[150];\n const overlay = 'rgba(21, 23, 33, 0.75)'; // grey[900] with opacity 75%\n return mode === 'light'\n ? {\n navigation,\n overlay,\n default: grey[50],\n paper: white,\n tooltip: grey[100],\n border: grey[100],\n }\n : {\n navigation,\n overlay,\n default: grey[900],\n paper: grey[850],\n tooltip: grey[700],\n border: grey[600],\n };\n};\n"],"names":["blue","grey","white","background","mode","navigation","overlay","default","paper","tooltip","border"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,UAAU,CAAC;AAE7C,OAAO,MAAMC,UAAU,GAAG,CAACC,IAAiB,GAAmC;IAC7E,MAAMC,UAAU,GAAGL,IAAI,CAAC,GAAG,CAAC,AAAC;IAC7B,MAAMM,OAAO,GAAG,wBAAwB,AAAC,EAAC,6BAA6B;IACvE,OAAOF,IAAI,KAAK,OAAO,GACnB;QACEC,UAAU;QACVC,OAAO;QACPC,OAAO,EAAEN,IAAI,CAAC,EAAE,CAAC;QACjBO,KAAK,EAAEN,KAAK;QACZO,OAAO,EAAER,IAAI,CAAC,GAAG,CAAC;QAClBS,MAAM,EAAET,IAAI,CAAC,GAAG,CAAC;KAClB,GACD;QACEI,UAAU;QACVC,OAAO;QACPC,OAAO,EAAEN,IAAI,CAAC,GAAG,CAAC;QAClBO,KAAK,EAAEP,IAAI,CAAC,GAAG,CAAC;QAChBQ,OAAO,EAAER,IAAI,CAAC,GAAG,CAAC;QAClBS,MAAM,EAAET,IAAI,CAAC,GAAG,CAAC;KAClB,CAAC;AACR,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/theme/palette/colors/blue.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesColor } from './types';\n\nexport const blue: PersesColor = {\n 50: '#E7F1FC',\n 100: '#D0E3FA',\n 150: '#B8D5F7',\n 200: '#A1C7F5',\n 300: '#72ABF0',\n 400: '#438FEB',\n 500: '#1473E6',\n 600: '#105CB8',\n 700: '#0C458A',\n 800: '#082E5C',\n 850: '#062345',\n 900: '#04172E',\n 950: '#020C17',\n};\n"],"names":["blue"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,IAAI,GAAgB;AAC/B,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;CACf,CAAC"}
1
+ {"version":3,"sources":["../../../../src/theme/palette/colors/blue.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesColor } from './types';\n\nexport const blue: PersesColor = {\n 50: '#E7F1FC',\n 100: '#D0E3FA',\n 150: '#B8D5F7',\n 200: '#A1C7F5',\n 300: '#72ABF0',\n 400: '#438FEB',\n 500: '#1473E6',\n 600: '#105CB8',\n 700: '#0C458A',\n 800: '#082E5C',\n 850: '#062345',\n 900: '#04172E',\n 950: '#020C17',\n};\n"],"names":["blue"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,IAAI,GAAgB;AAC/B,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;CACf,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/theme/palette/colors/common.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport const white = '#FFFFFF';\nexport const black = '#000000';\n"],"names":["white","black"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,KAAK,GAAG,SAAS,CAAC;AAC/B,OAAO,MAAMC,KAAK,GAAG,SAAS,CAAC"}
1
+ {"version":3,"sources":["../../../../src/theme/palette/colors/common.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport const white = '#FFFFFF';\nexport const black = '#000000';\n"],"names":["white","black"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,KAAK,GAAG,SAAS,CAAC;AAC/B,OAAO,MAAMC,KAAK,GAAG,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/theme/palette/colors/green.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesColor } from './types';\n\nexport const green: PersesColor = {\n 50: '#EAF9F1',\n 100: '#D5F2E3',\n 150: '#C1ECD4',\n 200: '#ACE5C6',\n 300: '#82D9AA',\n 400: '#59CC8D',\n 500: '#2FBF71',\n 600: '#26995A',\n 700: '#1C7344',\n 800: '#134C2D',\n 850: '#0E3922',\n 900: '#092617',\n 950: '#05130B',\n};\n"],"names":["green"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,KAAK,GAAgB;AAChC,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;CACf,CAAC"}
1
+ {"version":3,"sources":["../../../../src/theme/palette/colors/green.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesColor } from './types';\n\nexport const green: PersesColor = {\n 50: '#EAF9F1',\n 100: '#D5F2E3',\n 150: '#C1ECD4',\n 200: '#ACE5C6',\n 300: '#82D9AA',\n 400: '#59CC8D',\n 500: '#2FBF71',\n 600: '#26995A',\n 700: '#1C7344',\n 800: '#134C2D',\n 850: '#0E3922',\n 900: '#092617',\n 950: '#05130B',\n};\n"],"names":["green"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,KAAK,GAAgB;AAChC,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,GAAG,EAAE,SAAS;CACf,CAAC"}