@flanksource/clicky-ui 0.3.77 → 0.3.79

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 (854) hide show
  1. package/NOTICE.md +16 -0
  2. package/dist/ai.cjs +2 -2
  3. package/dist/ai.js +2 -2
  4. package/dist/comments/CommentThreadList.cjs +13 -14
  5. package/dist/comments/CommentThreadList.cjs.map +1 -1
  6. package/dist/comments/CommentThreadList.d.ts.map +1 -1
  7. package/dist/comments/CommentThreadList.js +13 -14
  8. package/dist/comments/CommentThreadList.js.map +1 -1
  9. package/dist/components/EndpointSelector.cjs +7 -1
  10. package/dist/components/EndpointSelector.cjs.map +1 -1
  11. package/dist/components/EndpointSelector.d.ts.map +1 -1
  12. package/dist/components/EndpointSelector.js +7 -1
  13. package/dist/components/EndpointSelector.js.map +1 -1
  14. package/dist/components/FilterBar.cjs +36 -12
  15. package/dist/components/FilterBar.cjs.map +1 -1
  16. package/dist/components/FilterBar.d.ts +14 -2
  17. package/dist/components/FilterBar.d.ts.map +1 -1
  18. package/dist/components/FilterBar.js +36 -12
  19. package/dist/components/FilterBar.js.map +1 -1
  20. package/dist/components/FormLookupProvider.cjs +12 -4
  21. package/dist/components/FormLookupProvider.cjs.map +1 -1
  22. package/dist/components/FormLookupProvider.d.ts.map +1 -1
  23. package/dist/components/FormLookupProvider.js +13 -5
  24. package/dist/components/FormLookupProvider.js.map +1 -1
  25. package/dist/components/JSONPathPlayground.cjs +124 -233
  26. package/dist/components/JSONPathPlayground.cjs.map +1 -1
  27. package/dist/components/JSONPathPlayground.d.ts +15 -13
  28. package/dist/components/JSONPathPlayground.d.ts.map +1 -1
  29. package/dist/components/JSONPathPlayground.js +125 -234
  30. package/dist/components/JSONPathPlayground.js.map +1 -1
  31. package/dist/components/JsonSchemaForm.cjs +6 -0
  32. package/dist/components/JsonSchemaForm.cjs.map +1 -1
  33. package/dist/components/JsonSchemaForm.js +6 -0
  34. package/dist/components/JsonSchemaForm.js.map +1 -1
  35. package/dist/components/SegmentedControl.cjs +1 -1
  36. package/dist/components/SegmentedControl.cjs.map +1 -1
  37. package/dist/components/SegmentedControl.d.ts.map +1 -1
  38. package/dist/components/SegmentedControl.js +1 -1
  39. package/dist/components/SegmentedControl.js.map +1 -1
  40. package/dist/components/TimeRange.cjs +133 -60
  41. package/dist/components/TimeRange.cjs.map +1 -1
  42. package/dist/components/TimeRange.d.ts +8 -1
  43. package/dist/components/TimeRange.d.ts.map +1 -1
  44. package/dist/components/TimeRange.js +133 -60
  45. package/dist/components/TimeRange.js.map +1 -1
  46. package/dist/components/json-schema-form-accordion-array.cjs +8 -6
  47. package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
  48. package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
  49. package/dist/components/json-schema-form-accordion-array.js +9 -7
  50. package/dist/components/json-schema-form-accordion-array.js.map +1 -1
  51. package/dist/components/json-schema-form-array-rows.cjs +45 -0
  52. package/dist/components/json-schema-form-array-rows.cjs.map +1 -0
  53. package/dist/components/json-schema-form-array-rows.d.ts +10 -0
  54. package/dist/components/json-schema-form-array-rows.d.ts.map +1 -0
  55. package/dist/components/json-schema-form-array-rows.js +45 -0
  56. package/dist/components/json-schema-form-array-rows.js.map +1 -0
  57. package/dist/components/json-schema-form-item-summary.cjs +3 -5
  58. package/dist/components/json-schema-form-item-summary.cjs.map +1 -1
  59. package/dist/components/json-schema-form-item-summary.d.ts +1 -1
  60. package/dist/components/json-schema-form-item-summary.d.ts.map +1 -1
  61. package/dist/components/json-schema-form-item-summary.js +3 -5
  62. package/dist/components/json-schema-form-item-summary.js.map +1 -1
  63. package/dist/components/json-schema-form-render.cjs +11 -2
  64. package/dist/components/json-schema-form-render.cjs.map +1 -1
  65. package/dist/components/json-schema-form-render.d.ts.map +1 -1
  66. package/dist/components/json-schema-form-render.js +12 -3
  67. package/dist/components/json-schema-form-render.js.map +1 -1
  68. package/dist/components/json-schema-form-resolve.cjs +10 -0
  69. package/dist/components/json-schema-form-resolve.cjs.map +1 -1
  70. package/dist/components/json-schema-form-resolve.d.ts +1 -0
  71. package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
  72. package/dist/components/json-schema-form-resolve.js +10 -1
  73. package/dist/components/json-schema-form-resolve.js.map +1 -1
  74. package/dist/components/json-schema-form-runtime-types.d.ts +4 -0
  75. package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
  76. package/dist/components/json-schema-form-table-array.cjs +25 -16
  77. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  78. package/dist/components/json-schema-form-table-array.d.ts +1 -1
  79. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  80. package/dist/components/json-schema-form-table-array.js +26 -17
  81. package/dist/components/json-schema-form-table-array.js.map +1 -1
  82. package/dist/components/json-schema-form-types.d.ts +0 -2
  83. package/dist/components/json-schema-form-types.d.ts.map +1 -1
  84. package/dist/components/jsonPathPlaygroundEvaluator.cjs +53 -0
  85. package/dist/components/jsonPathPlaygroundEvaluator.cjs.map +1 -0
  86. package/dist/components/jsonPathPlaygroundEvaluator.d.ts +23 -0
  87. package/dist/components/jsonPathPlaygroundEvaluator.d.ts.map +1 -0
  88. package/dist/components/jsonPathPlaygroundEvaluator.js +53 -0
  89. package/dist/components/jsonPathPlaygroundEvaluator.js.map +1 -0
  90. package/dist/components/jsonPathTree.cjs +1 -0
  91. package/dist/components/jsonPathTree.cjs.map +1 -1
  92. package/dist/components/jsonPathTree.d.ts +6 -0
  93. package/dist/components/jsonPathTree.d.ts.map +1 -1
  94. package/dist/components/jsonPathTree.js +1 -0
  95. package/dist/components/jsonPathTree.js.map +1 -1
  96. package/dist/data/Clicky.cjs +37 -18
  97. package/dist/data/Clicky.cjs.map +1 -1
  98. package/dist/data/Clicky.d.ts +5 -0
  99. package/dist/data/Clicky.d.ts.map +1 -1
  100. package/dist/data/Clicky.js +37 -18
  101. package/dist/data/Clicky.js.map +1 -1
  102. package/dist/data/DataTable.cjs +49 -12
  103. package/dist/data/DataTable.cjs.map +1 -1
  104. package/dist/data/DataTable.d.ts +17 -2
  105. package/dist/data/DataTable.d.ts.map +1 -1
  106. package/dist/data/DataTable.js +49 -12
  107. package/dist/data/DataTable.js.map +1 -1
  108. package/dist/data/TaskPoolUsage.cjs +2 -1
  109. package/dist/data/TaskPoolUsage.cjs.map +1 -1
  110. package/dist/data/TaskPoolUsage.d.ts.map +1 -1
  111. package/dist/data/TaskPoolUsage.js +2 -1
  112. package/dist/data/TaskPoolUsage.js.map +1 -1
  113. package/dist/data/TimeseriesPanel.axes.cjs +18 -3
  114. package/dist/data/TimeseriesPanel.axes.cjs.map +1 -1
  115. package/dist/data/TimeseriesPanel.axes.d.ts +10 -1
  116. package/dist/data/TimeseriesPanel.axes.d.ts.map +1 -1
  117. package/dist/data/TimeseriesPanel.axes.js +17 -4
  118. package/dist/data/TimeseriesPanel.axes.js.map +1 -1
  119. package/dist/data/TimeseriesPanel.cjs +57 -23
  120. package/dist/data/TimeseriesPanel.cjs.map +1 -1
  121. package/dist/data/TimeseriesPanel.d.ts.map +1 -1
  122. package/dist/data/TimeseriesPanel.js +59 -25
  123. package/dist/data/TimeseriesPanel.js.map +1 -1
  124. package/dist/data/TimeseriesPanel.model.cjs +10 -7
  125. package/dist/data/TimeseriesPanel.model.cjs.map +1 -1
  126. package/dist/data/TimeseriesPanel.model.d.ts +7 -4
  127. package/dist/data/TimeseriesPanel.model.d.ts.map +1 -1
  128. package/dist/data/TimeseriesPanel.model.js +11 -8
  129. package/dist/data/TimeseriesPanel.model.js.map +1 -1
  130. package/dist/data/TimeseriesPanel.readout.cjs +11 -0
  131. package/dist/data/TimeseriesPanel.readout.cjs.map +1 -0
  132. package/dist/data/TimeseriesPanel.readout.d.ts +4 -0
  133. package/dist/data/TimeseriesPanel.readout.d.ts.map +1 -0
  134. package/dist/data/TimeseriesPanel.readout.js +10 -0
  135. package/dist/data/TimeseriesPanel.readout.js.map +1 -0
  136. package/dist/data/TimeseriesPanel.segments.cjs +67 -0
  137. package/dist/data/TimeseriesPanel.segments.cjs.map +1 -0
  138. package/dist/data/TimeseriesPanel.segments.d.ts +27 -0
  139. package/dist/data/TimeseriesPanel.segments.d.ts.map +1 -0
  140. package/dist/data/TimeseriesPanel.segments.js +67 -0
  141. package/dist/data/TimeseriesPanel.segments.js.map +1 -0
  142. package/dist/data/TreeDataTable.cjs +12 -3
  143. package/dist/data/TreeDataTable.cjs.map +1 -1
  144. package/dist/data/TreeDataTable.d.ts +15 -3
  145. package/dist/data/TreeDataTable.d.ts.map +1 -1
  146. package/dist/data/TreeDataTable.js +12 -3
  147. package/dist/data/TreeDataTable.js.map +1 -1
  148. package/dist/data/TreeNode.cjs +18 -3
  149. package/dist/data/TreeNode.cjs.map +1 -1
  150. package/dist/data/TreeNode.d.ts +7 -1
  151. package/dist/data/TreeNode.d.ts.map +1 -1
  152. package/dist/data/TreeNode.js +18 -3
  153. package/dist/data/TreeNode.js.map +1 -1
  154. package/dist/data/ai/SessionChatComposer.cjs +2 -0
  155. package/dist/data/ai/SessionChatComposer.cjs.map +1 -1
  156. package/dist/data/ai/SessionChatComposer.d.ts.map +1 -1
  157. package/dist/data/ai/SessionChatComposer.js +2 -0
  158. package/dist/data/ai/SessionChatComposer.js.map +1 -1
  159. package/dist/data/ai/SessionInspector.panels.cjs +47 -1
  160. package/dist/data/ai/SessionInspector.panels.cjs.map +1 -1
  161. package/dist/data/ai/SessionInspector.panels.d.ts.map +1 -1
  162. package/dist/data/ai/SessionInspector.panels.js +48 -2
  163. package/dist/data/ai/SessionInspector.panels.js.map +1 -1
  164. package/dist/data/ai/SessionViewer.unified.d.ts +48 -0
  165. package/dist/data/ai/SessionViewer.unified.d.ts.map +1 -1
  166. package/dist/data/ai/index.d.ts +2 -2
  167. package/dist/data/ai/index.d.ts.map +1 -1
  168. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs +97 -100
  169. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs.map +1 -1
  170. package/dist/data/ai/runtime-profiles/PresetWorkspace.d.ts.map +1 -1
  171. package/dist/data/ai/runtime-profiles/PresetWorkspace.js +97 -100
  172. package/dist/data/ai/runtime-profiles/PresetWorkspace.js.map +1 -1
  173. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs +40 -38
  174. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs.map +1 -1
  175. package/dist/data/ai/runtime-profiles/ProfileWorkspace.d.ts.map +1 -1
  176. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js +41 -39
  177. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js.map +1 -1
  178. package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs +53 -0
  179. package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs.map +1 -0
  180. package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts +7 -0
  181. package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts.map +1 -0
  182. package/dist/data/ai/runtime-profiles/ResolutionPreview.js +53 -0
  183. package/dist/data/ai/runtime-profiles/ResolutionPreview.js.map +1 -0
  184. package/dist/data/ai/runtime-profiles/index.d.ts +1 -1
  185. package/dist/data/ai/runtime-profiles/index.d.ts.map +1 -1
  186. package/dist/data/ai/sessionSubmitVariant.cjs +30 -0
  187. package/dist/data/ai/sessionSubmitVariant.cjs.map +1 -0
  188. package/dist/data/ai/sessionSubmitVariant.d.ts +7 -0
  189. package/dist/data/ai/sessionSubmitVariant.d.ts.map +1 -0
  190. package/dist/data/ai/sessionSubmitVariant.js +30 -0
  191. package/dist/data/ai/sessionSubmitVariant.js.map +1 -0
  192. package/dist/data/cells/Timestamp.cjs +15 -4
  193. package/dist/data/cells/Timestamp.cjs.map +1 -1
  194. package/dist/data/cells/Timestamp.d.ts.map +1 -1
  195. package/dist/data/cells/Timestamp.js +15 -4
  196. package/dist/data/cells/Timestamp.js.map +1 -1
  197. package/dist/data/cells/timestamp-format.cjs +28 -8
  198. package/dist/data/cells/timestamp-format.cjs.map +1 -1
  199. package/dist/data/cells/timestamp-format.d.ts +3 -1
  200. package/dist/data/cells/timestamp-format.d.ts.map +1 -1
  201. package/dist/data/cells/timestamp-format.js +28 -8
  202. package/dist/data/cells/timestamp-format.js.map +1 -1
  203. package/dist/data/charts/TrendChart.cjs +65 -31
  204. package/dist/data/charts/TrendChart.cjs.map +1 -1
  205. package/dist/data/charts/TrendChart.d.ts +12 -3
  206. package/dist/data/charts/TrendChart.d.ts.map +1 -1
  207. package/dist/data/charts/TrendChart.js +67 -33
  208. package/dist/data/charts/TrendChart.js.map +1 -1
  209. package/dist/data/charts/index.d.ts +1 -1
  210. package/dist/data/charts/index.d.ts.map +1 -1
  211. package/dist/data/chat/PromptInput.cjs +11 -2
  212. package/dist/data/chat/PromptInput.cjs.map +1 -1
  213. package/dist/data/chat/PromptInput.d.ts +15 -1
  214. package/dist/data/chat/PromptInput.d.ts.map +1 -1
  215. package/dist/data/chat/PromptInput.js +11 -2
  216. package/dist/data/chat/PromptInput.js.map +1 -1
  217. package/dist/data/chat/index.d.ts +1 -1
  218. package/dist/data/chat/index.d.ts.map +1 -1
  219. package/dist/data/data-table-filter-values.cjs.map +1 -1
  220. package/dist/data/data-table-filter-values.d.ts +1 -1
  221. package/dist/data/data-table-filter-values.d.ts.map +1 -1
  222. package/dist/data/data-table-filter-values.js.map +1 -1
  223. package/dist/data/data-table-server-filters.cjs +2 -6
  224. package/dist/data/data-table-server-filters.cjs.map +1 -1
  225. package/dist/data/data-table-server-filters.d.ts +1 -1
  226. package/dist/data/data-table-server-filters.d.ts.map +1 -1
  227. package/dist/data/data-table-server-filters.js +1 -5
  228. package/dist/data/data-table-server-filters.js.map +1 -1
  229. package/dist/data/diagnostics/ErrorDetails.cjs +2 -1
  230. package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
  231. package/dist/data/diagnostics/ErrorDetails.d.ts +2 -1
  232. package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
  233. package/dist/data/diagnostics/ErrorDetails.js +2 -1
  234. package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
  235. package/dist/data/gauge-stats.cjs +7 -3
  236. package/dist/data/gauge-stats.cjs.map +1 -1
  237. package/dist/data/gauge-stats.d.ts.map +1 -1
  238. package/dist/data/gauge-stats.js +7 -3
  239. package/dist/data/gauge-stats.js.map +1 -1
  240. package/dist/data/query-browser/QueryBrowser.cjs +41 -17
  241. package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
  242. package/dist/data/query-browser/QueryBrowser.d.ts +1 -1
  243. package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
  244. package/dist/data/query-browser/QueryBrowser.fieldNames.cjs +23 -0
  245. package/dist/data/query-browser/QueryBrowser.fieldNames.cjs.map +1 -0
  246. package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts +11 -0
  247. package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts.map +1 -0
  248. package/dist/data/query-browser/QueryBrowser.fieldNames.js +23 -0
  249. package/dist/data/query-browser/QueryBrowser.fieldNames.js.map +1 -0
  250. package/dist/data/query-browser/QueryBrowser.js +41 -17
  251. package/dist/data/query-browser/QueryBrowser.js.map +1 -1
  252. package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
  253. package/dist/data/query-browser/QueryBrowser.types.d.ts +18 -0
  254. package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
  255. package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
  256. package/dist/data/runtime/RuntimeBarLayout.cjs +3 -2
  257. package/dist/data/runtime/RuntimeBarLayout.cjs.map +1 -1
  258. package/dist/data/runtime/RuntimeBarLayout.d.ts.map +1 -1
  259. package/dist/data/runtime/RuntimeBarLayout.js +3 -2
  260. package/dist/data/runtime/RuntimeBarLayout.js.map +1 -1
  261. package/dist/data/test-runner/TestRunner.cjs +3 -1
  262. package/dist/data/test-runner/TestRunner.cjs.map +1 -1
  263. package/dist/data/test-runner/TestRunner.d.ts +8 -1
  264. package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
  265. package/dist/data/test-runner/TestRunner.js +3 -1
  266. package/dist/data/test-runner/TestRunner.js.map +1 -1
  267. package/dist/data/test-runner/TestTree.cjs +1 -0
  268. package/dist/data/test-runner/TestTree.cjs.map +1 -1
  269. package/dist/data/test-runner/TestTree.d.ts.map +1 -1
  270. package/dist/data/test-runner/TestTree.js +1 -0
  271. package/dist/data/test-runner/TestTree.js.map +1 -1
  272. package/dist/data/test-runner/context.cjs.map +1 -1
  273. package/dist/data/test-runner/context.d.ts +2 -0
  274. package/dist/data/test-runner/context.d.ts.map +1 -1
  275. package/dist/data/test-runner/context.js.map +1 -1
  276. package/dist/data/timeseries-query.cjs +2 -2
  277. package/dist/data/timeseries-query.cjs.map +1 -1
  278. package/dist/data/timeseries-query.d.ts +1 -1
  279. package/dist/data/timeseries-query.d.ts.map +1 -1
  280. package/dist/data/timeseries-query.js +2 -2
  281. package/dist/data/timeseries-query.js.map +1 -1
  282. package/dist/data/version-info.cjs +3 -3
  283. package/dist/data/version-info.js +3 -3
  284. package/dist/data.cjs +33 -0
  285. package/dist/data.d.ts +1 -1
  286. package/dist/data.d.ts.map +1 -1
  287. package/dist/data.js +18 -2
  288. package/dist/expressions/playground/EmbeddedPlayground.cjs +40 -0
  289. package/dist/expressions/playground/EmbeddedPlayground.cjs.map +1 -0
  290. package/dist/expressions/playground/EmbeddedPlayground.d.ts +30 -0
  291. package/dist/expressions/playground/EmbeddedPlayground.d.ts.map +1 -0
  292. package/dist/expressions/playground/EmbeddedPlayground.js +40 -0
  293. package/dist/expressions/playground/EmbeddedPlayground.js.map +1 -0
  294. package/dist/expressions/playground/ExpressionPlayground.cjs +6 -6
  295. package/dist/expressions/playground/ExpressionPlayground.cjs.map +1 -1
  296. package/dist/expressions/playground/ExpressionPlayground.d.ts +10 -3
  297. package/dist/expressions/playground/ExpressionPlayground.d.ts.map +1 -1
  298. package/dist/expressions/playground/ExpressionPlayground.js +6 -6
  299. package/dist/expressions/playground/ExpressionPlayground.js.map +1 -1
  300. package/dist/expressions/playground/LazyEmbeddedPlayground.cjs +22 -0
  301. package/dist/expressions/playground/LazyEmbeddedPlayground.cjs.map +1 -0
  302. package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts +4 -0
  303. package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts.map +1 -0
  304. package/dist/expressions/playground/LazyEmbeddedPlayground.js +22 -0
  305. package/dist/expressions/playground/LazyEmbeddedPlayground.js.map +1 -0
  306. package/dist/expressions/playground/api.cjs.map +1 -1
  307. package/dist/expressions/playground/api.d.ts +10 -0
  308. package/dist/expressions/playground/api.d.ts.map +1 -1
  309. package/dist/expressions/playground/api.js.map +1 -1
  310. package/dist/expressions/playground/hostEvaluation.cjs +67 -0
  311. package/dist/expressions/playground/hostEvaluation.cjs.map +1 -0
  312. package/dist/expressions/playground/hostEvaluation.d.ts +39 -0
  313. package/dist/expressions/playground/hostEvaluation.d.ts.map +1 -0
  314. package/dist/expressions/playground/hostEvaluation.js +63 -0
  315. package/dist/expressions/playground/hostEvaluation.js.map +1 -0
  316. package/dist/expressions/playground/panels/GraphPanel.cjs +8 -3
  317. package/dist/expressions/playground/panels/GraphPanel.cjs.map +1 -1
  318. package/dist/expressions/playground/panels/GraphPanel.d.ts +2 -1
  319. package/dist/expressions/playground/panels/GraphPanel.d.ts.map +1 -1
  320. package/dist/expressions/playground/panels/GraphPanel.js +8 -3
  321. package/dist/expressions/playground/panels/GraphPanel.js.map +1 -1
  322. package/dist/expressions/playground/panels/graphNodes.cjs +6 -2
  323. package/dist/expressions/playground/panels/graphNodes.cjs.map +1 -1
  324. package/dist/expressions/playground/panels/graphNodes.d.ts +6 -2
  325. package/dist/expressions/playground/panels/graphNodes.d.ts.map +1 -1
  326. package/dist/expressions/playground/panels/graphNodes.js +6 -2
  327. package/dist/expressions/playground/panels/graphNodes.js.map +1 -1
  328. package/dist/expressions/playground.d.ts +1 -1
  329. package/dist/expressions/playground.d.ts.map +1 -1
  330. package/dist/hooks/use-element-height.cjs +26 -0
  331. package/dist/hooks/use-element-height.cjs.map +1 -0
  332. package/dist/hooks/use-element-height.d.ts +10 -0
  333. package/dist/hooks/use-element-height.d.ts.map +1 -0
  334. package/dist/hooks/use-element-height.js +26 -0
  335. package/dist/hooks/use-element-height.js.map +1 -0
  336. package/dist/icons/components/UiGlobeShare.cjs +33 -0
  337. package/dist/icons/components/UiGlobeShare.cjs.map +1 -0
  338. package/dist/icons/components/UiGlobeShare.d.ts +9 -0
  339. package/dist/icons/components/UiGlobeShare.d.ts.map +1 -0
  340. package/dist/icons/components/UiGlobeShare.js +31 -0
  341. package/dist/icons/components/UiGlobeShare.js.map +1 -0
  342. package/dist/icons/components/UiKubernetesLink.cjs +38 -0
  343. package/dist/icons/components/UiKubernetesLink.cjs.map +1 -0
  344. package/dist/icons/components/UiKubernetesLink.d.ts +9 -0
  345. package/dist/icons/components/UiKubernetesLink.d.ts.map +1 -0
  346. package/dist/icons/components/UiKubernetesLink.js +36 -0
  347. package/dist/icons/components/UiKubernetesLink.js.map +1 -0
  348. package/dist/icons/components/UiLogoAws.cjs +29 -0
  349. package/dist/icons/components/UiLogoAws.cjs.map +1 -0
  350. package/dist/icons/components/UiLogoAws.d.ts +9 -0
  351. package/dist/icons/components/UiLogoAws.d.ts.map +1 -0
  352. package/dist/icons/components/UiLogoAws.js +27 -0
  353. package/dist/icons/components/UiLogoAws.js.map +1 -0
  354. package/dist/icons/components/UiLogoAzure.cjs +29 -0
  355. package/dist/icons/components/UiLogoAzure.cjs.map +1 -0
  356. package/dist/icons/components/UiLogoAzure.d.ts +9 -0
  357. package/dist/icons/components/UiLogoAzure.d.ts.map +1 -0
  358. package/dist/icons/components/UiLogoAzure.js +27 -0
  359. package/dist/icons/components/UiLogoAzure.js.map +1 -0
  360. package/dist/icons/components/UiLogoAzureDevops.cjs +29 -0
  361. package/dist/icons/components/UiLogoAzureDevops.cjs.map +1 -0
  362. package/dist/icons/components/UiLogoAzureDevops.d.ts +9 -0
  363. package/dist/icons/components/UiLogoAzureDevops.d.ts.map +1 -0
  364. package/dist/icons/components/UiLogoAzureDevops.js +27 -0
  365. package/dist/icons/components/UiLogoAzureDevops.js.map +1 -0
  366. package/dist/icons/components/UiLogoGit.cjs +29 -0
  367. package/dist/icons/components/UiLogoGit.cjs.map +1 -0
  368. package/dist/icons/components/UiLogoGit.d.ts +9 -0
  369. package/dist/icons/components/UiLogoGit.d.ts.map +1 -0
  370. package/dist/icons/components/UiLogoGit.js +27 -0
  371. package/dist/icons/components/UiLogoGit.js.map +1 -0
  372. package/dist/icons/components/UiLogoGithub.cjs +29 -0
  373. package/dist/icons/components/UiLogoGithub.cjs.map +1 -0
  374. package/dist/icons/components/UiLogoGithub.d.ts +9 -0
  375. package/dist/icons/components/UiLogoGithub.d.ts.map +1 -0
  376. package/dist/icons/components/UiLogoGithub.js +27 -0
  377. package/dist/icons/components/UiLogoGithub.js.map +1 -0
  378. package/dist/icons/components/UiLogoJava.cjs +29 -0
  379. package/dist/icons/components/UiLogoJava.cjs.map +1 -0
  380. package/dist/icons/components/UiLogoJava.d.ts +9 -0
  381. package/dist/icons/components/UiLogoJava.d.ts.map +1 -0
  382. package/dist/icons/components/UiLogoJava.js +27 -0
  383. package/dist/icons/components/UiLogoJava.js.map +1 -0
  384. package/dist/icons/components/UiLogoKubernetes.cjs +29 -0
  385. package/dist/icons/components/UiLogoKubernetes.cjs.map +1 -0
  386. package/dist/icons/components/UiLogoKubernetes.d.ts +9 -0
  387. package/dist/icons/components/UiLogoKubernetes.d.ts.map +1 -0
  388. package/dist/icons/components/UiLogoKubernetes.js +27 -0
  389. package/dist/icons/components/UiLogoKubernetes.js.map +1 -0
  390. package/dist/icons/components/UiLogoMssql.cjs +29 -0
  391. package/dist/icons/components/UiLogoMssql.cjs.map +1 -0
  392. package/dist/icons/components/UiLogoMssql.d.ts +9 -0
  393. package/dist/icons/components/UiLogoMssql.d.ts.map +1 -0
  394. package/dist/icons/components/UiLogoMssql.js +27 -0
  395. package/dist/icons/components/UiLogoMssql.js.map +1 -0
  396. package/dist/icons/components/UiLogoOpenjdk.cjs +29 -0
  397. package/dist/icons/components/UiLogoOpenjdk.cjs.map +1 -0
  398. package/dist/icons/components/UiLogoOpenjdk.d.ts +9 -0
  399. package/dist/icons/components/UiLogoOpenjdk.d.ts.map +1 -0
  400. package/dist/icons/components/UiLogoOpenjdk.js +27 -0
  401. package/dist/icons/components/UiLogoOpenjdk.js.map +1 -0
  402. package/dist/icons/components/UiLogoOpensearch.cjs +29 -0
  403. package/dist/icons/components/UiLogoOpensearch.cjs.map +1 -0
  404. package/dist/icons/components/UiLogoOpensearch.d.ts +9 -0
  405. package/dist/icons/components/UiLogoOpensearch.d.ts.map +1 -0
  406. package/dist/icons/components/UiLogoOpensearch.js +27 -0
  407. package/dist/icons/components/UiLogoOpensearch.js.map +1 -0
  408. package/dist/icons/components/UiLogoOpentelemetry.cjs +29 -0
  409. package/dist/icons/components/UiLogoOpentelemetry.cjs.map +1 -0
  410. package/dist/icons/components/UiLogoOpentelemetry.d.ts +9 -0
  411. package/dist/icons/components/UiLogoOpentelemetry.d.ts.map +1 -0
  412. package/dist/icons/components/UiLogoOpentelemetry.js +27 -0
  413. package/dist/icons/components/UiLogoOpentelemetry.js.map +1 -0
  414. package/dist/icons/components/UiLogoPostgres.cjs +29 -0
  415. package/dist/icons/components/UiLogoPostgres.cjs.map +1 -0
  416. package/dist/icons/components/UiLogoPostgres.d.ts +9 -0
  417. package/dist/icons/components/UiLogoPostgres.d.ts.map +1 -0
  418. package/dist/icons/components/UiLogoPostgres.js +27 -0
  419. package/dist/icons/components/UiLogoPostgres.js.map +1 -0
  420. package/dist/icons/components/UiLogoSqlite.cjs +29 -0
  421. package/dist/icons/components/UiLogoSqlite.cjs.map +1 -0
  422. package/dist/icons/components/UiLogoSqlite.d.ts +9 -0
  423. package/dist/icons/components/UiLogoSqlite.d.ts.map +1 -0
  424. package/dist/icons/components/UiLogoSqlite.js +27 -0
  425. package/dist/icons/components/UiLogoSqlite.js.map +1 -0
  426. package/dist/icons/components/UiWebLink.cjs +40 -0
  427. package/dist/icons/components/UiWebLink.cjs.map +1 -0
  428. package/dist/icons/components/UiWebLink.d.ts +9 -0
  429. package/dist/icons/components/UiWebLink.d.ts.map +1 -0
  430. package/dist/icons/components/UiWebLink.js +38 -0
  431. package/dist/icons/components/UiWebLink.js.map +1 -0
  432. package/dist/icons/index.d.ts +16 -0
  433. package/dist/icons/index.d.ts.map +1 -1
  434. package/dist/icons/registry.cjs +32 -0
  435. package/dist/icons/registry.cjs.map +1 -1
  436. package/dist/icons/registry.d.ts.map +1 -1
  437. package/dist/icons/registry.js +32 -0
  438. package/dist/icons/registry.js.map +1 -1
  439. package/dist/icons.cjs +32 -0
  440. package/dist/icons.js +17 -1
  441. package/dist/index.cjs +38 -5
  442. package/dist/index.js +23 -7
  443. package/dist/jvm/classes/PatchedClassList.cjs +11 -2
  444. package/dist/jvm/classes/PatchedClassList.cjs.map +1 -1
  445. package/dist/jvm/classes/PatchedClassList.d.ts.map +1 -1
  446. package/dist/jvm/classes/PatchedClassList.js +11 -2
  447. package/dist/jvm/classes/PatchedClassList.js.map +1 -1
  448. package/dist/jvm/fixtures/fake-client.d.ts.map +1 -1
  449. package/dist/jvm/model/patches.cjs +4 -2
  450. package/dist/jvm/model/patches.cjs.map +1 -1
  451. package/dist/jvm/model/patches.d.ts +3 -1
  452. package/dist/jvm/model/patches.d.ts.map +1 -1
  453. package/dist/jvm/model/patches.js +4 -2
  454. package/dist/jvm/model/patches.js.map +1 -1
  455. package/dist/jvm/protocol/client.d.ts +7 -2
  456. package/dist/jvm/protocol/client.d.ts.map +1 -1
  457. package/dist/jvm/protocol/operation-client.cjs +30 -11
  458. package/dist/jvm/protocol/operation-client.cjs.map +1 -1
  459. package/dist/jvm/protocol/operation-client.d.ts.map +1 -1
  460. package/dist/jvm/protocol/operation-client.js +30 -11
  461. package/dist/jvm/protocol/operation-client.js.map +1 -1
  462. package/dist/jvm/protocol/query-keys.cjs +1 -1
  463. package/dist/jvm/protocol/query-keys.cjs.map +1 -1
  464. package/dist/jvm/protocol/query-keys.d.ts +1 -1
  465. package/dist/jvm/protocol/query-keys.d.ts.map +1 -1
  466. package/dist/jvm/protocol/query-keys.js +1 -1
  467. package/dist/jvm/protocol/query-keys.js.map +1 -1
  468. package/dist/jvm/protocol/status.cjs +38 -0
  469. package/dist/jvm/protocol/status.cjs.map +1 -0
  470. package/dist/jvm/protocol/status.d.ts +13 -0
  471. package/dist/jvm/protocol/status.d.ts.map +1 -0
  472. package/dist/jvm/protocol/status.js +38 -0
  473. package/dist/jvm/protocol/status.js.map +1 -0
  474. package/dist/jvm/protocol/types.d.ts +16 -4
  475. package/dist/jvm/protocol/types.d.ts.map +1 -1
  476. package/dist/jvm/runtime/GcSummary.cjs +7 -1
  477. package/dist/jvm/runtime/GcSummary.cjs.map +1 -1
  478. package/dist/jvm/runtime/GcSummary.d.ts.map +1 -1
  479. package/dist/jvm/runtime/GcSummary.js +7 -1
  480. package/dist/jvm/runtime/GcSummary.js.map +1 -1
  481. package/dist/jvm/surfaces/ClassesSurface.cjs +11 -10
  482. package/dist/jvm/surfaces/ClassesSurface.cjs.map +1 -1
  483. package/dist/jvm/surfaces/ClassesSurface.d.ts.map +1 -1
  484. package/dist/jvm/surfaces/ClassesSurface.js +12 -11
  485. package/dist/jvm/surfaces/ClassesSurface.js.map +1 -1
  486. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs +11 -3
  487. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs.map +1 -1
  488. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts +2 -0
  489. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts.map +1 -1
  490. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js +11 -3
  491. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js.map +1 -1
  492. package/dist/jvm/surfaces/PatchesSurface.cjs +3 -8
  493. package/dist/jvm/surfaces/PatchesSurface.cjs.map +1 -1
  494. package/dist/jvm/surfaces/PatchesSurface.d.ts +2 -1
  495. package/dist/jvm/surfaces/PatchesSurface.d.ts.map +1 -1
  496. package/dist/jvm/surfaces/PatchesSurface.js +4 -9
  497. package/dist/jvm/surfaces/PatchesSurface.js.map +1 -1
  498. package/dist/jvm/surfaces/ThreadsSurface.cjs +7 -4
  499. package/dist/jvm/surfaces/ThreadsSurface.cjs.map +1 -1
  500. package/dist/jvm/surfaces/ThreadsSurface.d.ts +4 -1
  501. package/dist/jvm/surfaces/ThreadsSurface.d.ts.map +1 -1
  502. package/dist/jvm/surfaces/ThreadsSurface.js +7 -4
  503. package/dist/jvm/surfaces/ThreadsSurface.js.map +1 -1
  504. package/dist/jvm/surfaces/jvm-context.cjs +23 -4
  505. package/dist/jvm/surfaces/jvm-context.cjs.map +1 -1
  506. package/dist/jvm/surfaces/jvm-context.d.ts +7 -0
  507. package/dist/jvm/surfaces/jvm-context.d.ts.map +1 -1
  508. package/dist/jvm/surfaces/jvm-context.js +23 -5
  509. package/dist/jvm/surfaces/jvm-context.js.map +1 -1
  510. package/dist/jvm/surfaces/use-patch-actions.cjs +2 -2
  511. package/dist/jvm/surfaces/use-patch-actions.cjs.map +1 -1
  512. package/dist/jvm/surfaces/use-patch-actions.js +2 -2
  513. package/dist/jvm/surfaces/use-patch-actions.js.map +1 -1
  514. package/dist/jvm/threads/FoldedStackTrace.cjs +3 -2
  515. package/dist/jvm/threads/FoldedStackTrace.cjs.map +1 -1
  516. package/dist/jvm/threads/FoldedStackTrace.d.ts +4 -1
  517. package/dist/jvm/threads/FoldedStackTrace.d.ts.map +1 -1
  518. package/dist/jvm/threads/FoldedStackTrace.js +3 -2
  519. package/dist/jvm/threads/FoldedStackTrace.js.map +1 -1
  520. package/dist/jvm/threads/ThreadDetail.cjs +6 -2
  521. package/dist/jvm/threads/ThreadDetail.cjs.map +1 -1
  522. package/dist/jvm/threads/ThreadDetail.d.ts +4 -1
  523. package/dist/jvm/threads/ThreadDetail.d.ts.map +1 -1
  524. package/dist/jvm/threads/ThreadDetail.js +6 -2
  525. package/dist/jvm/threads/ThreadDetail.js.map +1 -1
  526. package/dist/jvm.cjs +3 -0
  527. package/dist/jvm.d.ts +2 -1
  528. package/dist/jvm.d.ts.map +1 -1
  529. package/dist/jvm.js +3 -2
  530. package/dist/layout/AppShell.cjs.map +1 -1
  531. package/dist/layout/AppShell.d.ts +16 -0
  532. package/dist/layout/AppShell.d.ts.map +1 -1
  533. package/dist/layout/AppShell.js.map +1 -1
  534. package/dist/layout/AppShell.nav.cjs +21 -2
  535. package/dist/layout/AppShell.nav.cjs.map +1 -1
  536. package/dist/layout/AppShell.nav.js +21 -2
  537. package/dist/layout/AppShell.nav.js.map +1 -1
  538. package/dist/layout/Workspace.cjs +66 -21
  539. package/dist/layout/Workspace.cjs.map +1 -1
  540. package/dist/layout/Workspace.d.ts +6 -1
  541. package/dist/layout/Workspace.d.ts.map +1 -1
  542. package/dist/layout/Workspace.js +66 -21
  543. package/dist/layout/Workspace.js.map +1 -1
  544. package/dist/layout/Workspace.model.cjs +20 -0
  545. package/dist/layout/Workspace.model.cjs.map +1 -1
  546. package/dist/layout/Workspace.model.d.ts +17 -0
  547. package/dist/layout/Workspace.model.d.ts.map +1 -1
  548. package/dist/layout/Workspace.model.js +20 -1
  549. package/dist/layout/Workspace.model.js.map +1 -1
  550. package/dist/layout/Workspace.regions.cjs +10 -6
  551. package/dist/layout/Workspace.regions.cjs.map +1 -1
  552. package/dist/layout/Workspace.regions.d.ts +4 -1
  553. package/dist/layout/Workspace.regions.d.ts.map +1 -1
  554. package/dist/layout/Workspace.regions.js +10 -6
  555. package/dist/layout/Workspace.regions.js.map +1 -1
  556. package/dist/lib/duration.cjs +20 -0
  557. package/dist/lib/duration.cjs.map +1 -1
  558. package/dist/lib/duration.d.ts +8 -0
  559. package/dist/lib/duration.d.ts.map +1 -1
  560. package/dist/lib/duration.js +19 -1
  561. package/dist/lib/duration.js.map +1 -1
  562. package/dist/monaco/MonacoEditor.cjs +34 -30
  563. package/dist/monaco/MonacoEditor.cjs.map +1 -1
  564. package/dist/monaco/MonacoEditor.d.ts.map +1 -1
  565. package/dist/monaco/MonacoEditor.js +34 -30
  566. package/dist/monaco/MonacoEditor.js.map +1 -1
  567. package/dist/overlay/ConfirmDialog.cjs +5 -2
  568. package/dist/overlay/ConfirmDialog.cjs.map +1 -1
  569. package/dist/overlay/ConfirmDialog.d.ts +14 -2
  570. package/dist/overlay/ConfirmDialog.d.ts.map +1 -1
  571. package/dist/overlay/ConfirmDialog.js +5 -2
  572. package/dist/overlay/ConfirmDialog.js.map +1 -1
  573. package/dist/profiles/cel/celEditor.cjs +94 -285
  574. package/dist/profiles/cel/celEditor.cjs.map +1 -1
  575. package/dist/profiles/cel/celEditor.d.ts +10 -15
  576. package/dist/profiles/cel/celEditor.d.ts.map +1 -1
  577. package/dist/profiles/cel/celEditor.js +97 -287
  578. package/dist/profiles/cel/celEditor.js.map +1 -1
  579. package/dist/profiles/cel/celExpression.cjs +1 -61
  580. package/dist/profiles/cel/celExpression.cjs.map +1 -1
  581. package/dist/profiles/cel/celExpression.d.ts +2 -38
  582. package/dist/profiles/cel/celExpression.d.ts.map +1 -1
  583. package/dist/profiles/cel/celExpression.js +2 -58
  584. package/dist/profiles/cel/celExpression.js.map +1 -1
  585. package/dist/profiles/cel/celPlayground.cjs +122 -0
  586. package/dist/profiles/cel/celPlayground.cjs.map +1 -0
  587. package/dist/profiles/cel/celPlayground.d.ts +43 -0
  588. package/dist/profiles/cel/celPlayground.d.ts.map +1 -0
  589. package/dist/profiles/cel/celPlayground.js +118 -0
  590. package/dist/profiles/cel/celPlayground.js.map +1 -0
  591. package/dist/profiles/connections/connectionBrowserModel.cjs +2 -2
  592. package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
  593. package/dist/profiles/connections/connectionBrowserModel.d.ts +5 -1
  594. package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
  595. package/dist/profiles/connections/connectionBrowserModel.js +2 -2
  596. package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
  597. package/dist/profiles/connections/connectionQueryWorkspace.cjs +2 -1
  598. package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
  599. package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -1
  600. package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
  601. package/dist/profiles/connections/connectionQueryWorkspace.js +2 -1
  602. package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
  603. package/dist/profiles/editor/UnwrapPreviewList.cjs +90 -0
  604. package/dist/profiles/editor/UnwrapPreviewList.cjs.map +1 -0
  605. package/dist/profiles/editor/UnwrapPreviewList.d.ts +7 -0
  606. package/dist/profiles/editor/UnwrapPreviewList.d.ts.map +1 -0
  607. package/dist/profiles/editor/UnwrapPreviewList.js +90 -0
  608. package/dist/profiles/editor/UnwrapPreviewList.js.map +1 -0
  609. package/dist/profiles/editor/profileCanonicalQuery.cjs +6 -58
  610. package/dist/profiles/editor/profileCanonicalQuery.cjs.map +1 -1
  611. package/dist/profiles/editor/profileCanonicalQuery.d.ts +1 -1
  612. package/dist/profiles/editor/profileCanonicalQuery.d.ts.map +1 -1
  613. package/dist/profiles/editor/profileCanonicalQuery.js +4 -56
  614. package/dist/profiles/editor/profileCanonicalQuery.js.map +1 -1
  615. package/dist/profiles/editor/profileCanonicalTranslate.cjs +48 -0
  616. package/dist/profiles/editor/profileCanonicalTranslate.cjs.map +1 -0
  617. package/dist/profiles/editor/profileCanonicalTranslate.d.ts +24 -0
  618. package/dist/profiles/editor/profileCanonicalTranslate.d.ts.map +1 -0
  619. package/dist/profiles/editor/profileCanonicalTranslate.js +47 -0
  620. package/dist/profiles/editor/profileCanonicalTranslate.js.map +1 -0
  621. package/dist/profiles/editor/profileEditor.cjs +126 -38
  622. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  623. package/dist/profiles/editor/profileEditor.d.ts +5 -1
  624. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  625. package/dist/profiles/editor/profileEditor.js +127 -39
  626. package/dist/profiles/editor/profileEditor.js.map +1 -1
  627. package/dist/profiles/editor/profileEditorModel.cjs +65 -19
  628. package/dist/profiles/editor/profileEditorModel.cjs.map +1 -1
  629. package/dist/profiles/editor/profileEditorModel.d.ts +24 -8
  630. package/dist/profiles/editor/profileEditorModel.d.ts.map +1 -1
  631. package/dist/profiles/editor/profileEditorModel.js +64 -18
  632. package/dist/profiles/editor/profileEditorModel.js.map +1 -1
  633. package/dist/profiles/editor/profileEditorPreview.cjs +129 -29
  634. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  635. package/dist/profiles/editor/profileEditorPreview.d.ts +18 -5
  636. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  637. package/dist/profiles/editor/profileEditorPreview.js +129 -29
  638. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  639. package/dist/profiles/editor/profileEditorSections.cjs +137 -88
  640. package/dist/profiles/editor/profileEditorSections.cjs.map +1 -1
  641. package/dist/profiles/editor/profileEditorSections.d.ts +18 -2
  642. package/dist/profiles/editor/profileEditorSections.d.ts.map +1 -1
  643. package/dist/profiles/editor/profileEditorSections.js +138 -90
  644. package/dist/profiles/editor/profileEditorSections.js.map +1 -1
  645. package/dist/profiles/editor/profileMappingPreview.cjs +22 -6
  646. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  647. package/dist/profiles/editor/profileMappingPreview.d.ts +17 -1
  648. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  649. package/dist/profiles/editor/profileMappingPreview.js +23 -7
  650. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  651. package/dist/profiles/editor/profileSaveAsDialog.cjs +93 -0
  652. package/dist/profiles/editor/profileSaveAsDialog.cjs.map +1 -0
  653. package/dist/profiles/editor/profileSaveAsDialog.d.ts +17 -0
  654. package/dist/profiles/editor/profileSaveAsDialog.d.ts.map +1 -0
  655. package/dist/profiles/editor/profileSaveAsDialog.js +93 -0
  656. package/dist/profiles/editor/profileSaveAsDialog.js.map +1 -0
  657. package/dist/profiles/editor/profileSourceExtensions.cjs +71 -0
  658. package/dist/profiles/editor/profileSourceExtensions.cjs.map +1 -0
  659. package/dist/profiles/editor/profileSourceExtensions.d.ts +26 -0
  660. package/dist/profiles/editor/profileSourceExtensions.d.ts.map +1 -0
  661. package/dist/profiles/editor/profileSourceExtensions.js +70 -0
  662. package/dist/profiles/editor/profileSourceExtensions.js.map +1 -0
  663. package/dist/profiles/editor/samplePaths.cjs +54 -0
  664. package/dist/profiles/editor/samplePaths.cjs.map +1 -0
  665. package/dist/profiles/editor/samplePaths.d.ts +27 -0
  666. package/dist/profiles/editor/samplePaths.d.ts.map +1 -0
  667. package/dist/profiles/editor/samplePaths.js +53 -0
  668. package/dist/profiles/editor/samplePaths.js.map +1 -0
  669. package/dist/profiles/editor/testSchema.d.ts.map +1 -1
  670. package/dist/profiles/editor/useUnwrapPreviews.cjs +60 -0
  671. package/dist/profiles/editor/useUnwrapPreviews.cjs.map +1 -0
  672. package/dist/profiles/editor/useUnwrapPreviews.d.ts +38 -0
  673. package/dist/profiles/editor/useUnwrapPreviews.d.ts.map +1 -0
  674. package/dist/profiles/editor/useUnwrapPreviews.js +60 -0
  675. package/dist/profiles/editor/useUnwrapPreviews.js.map +1 -0
  676. package/dist/profiles/elasticsearch/esQueryBuilder.cjs +10 -1
  677. package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
  678. package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
  679. package/dist/profiles/elasticsearch/esQueryBuilder.js +11 -2
  680. package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
  681. package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs +38 -0
  682. package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs.map +1 -1
  683. package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts +17 -0
  684. package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts.map +1 -1
  685. package/dist/profiles/elasticsearch/esQueryBuilderForm.js +37 -1
  686. package/dist/profiles/elasticsearch/esQueryBuilderForm.js.map +1 -1
  687. package/dist/profiles/elasticsearch/esQueryConditionRow.cjs +4 -3
  688. package/dist/profiles/elasticsearch/esQueryConditionRow.cjs.map +1 -1
  689. package/dist/profiles/elasticsearch/esQueryConditionRow.d.ts.map +1 -1
  690. package/dist/profiles/elasticsearch/esQueryConditionRow.js +4 -3
  691. package/dist/profiles/elasticsearch/esQueryConditionRow.js.map +1 -1
  692. package/dist/profiles/elasticsearch/esQueryOperators.cjs.map +1 -1
  693. package/dist/profiles/elasticsearch/esQueryOperators.d.ts +8 -0
  694. package/dist/profiles/elasticsearch/esQueryOperators.d.ts.map +1 -1
  695. package/dist/profiles/elasticsearch/esQueryOperators.js.map +1 -1
  696. package/dist/profiles/fields/profileFieldControls.cjs +3 -2
  697. package/dist/profiles/fields/profileFieldControls.cjs.map +1 -1
  698. package/dist/profiles/fields/profileFieldControls.d.ts +3 -1
  699. package/dist/profiles/fields/profileFieldControls.d.ts.map +1 -1
  700. package/dist/profiles/fields/profileFieldControls.js +3 -2
  701. package/dist/profiles/fields/profileFieldControls.js.map +1 -1
  702. package/dist/profiles/fields/profileFieldEditor.cjs +98 -185
  703. package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
  704. package/dist/profiles/fields/profileFieldEditor.d.ts +11 -3
  705. package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
  706. package/dist/profiles/fields/profileFieldEditor.js +99 -186
  707. package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
  708. package/dist/profiles/fields/profileFieldFilterEditor.cjs +115 -81
  709. package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
  710. package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
  711. package/dist/profiles/fields/profileFieldFilterEditor.js +116 -82
  712. package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
  713. package/dist/profiles/fields/profileFieldIcons.cjs +2 -0
  714. package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
  715. package/dist/profiles/fields/profileFieldIcons.d.ts.map +1 -1
  716. package/dist/profiles/fields/profileFieldIcons.js +2 -0
  717. package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
  718. package/dist/profiles/fields/profileFieldList.cjs +23 -1
  719. package/dist/profiles/fields/profileFieldList.cjs.map +1 -1
  720. package/dist/profiles/fields/profileFieldList.d.ts.map +1 -1
  721. package/dist/profiles/fields/profileFieldList.js +23 -1
  722. package/dist/profiles/fields/profileFieldList.js.map +1 -1
  723. package/dist/profiles/fields/profileFieldPreview.cjs +111 -0
  724. package/dist/profiles/fields/profileFieldPreview.cjs.map +1 -0
  725. package/dist/profiles/fields/profileFieldPreview.d.ts +25 -0
  726. package/dist/profiles/fields/profileFieldPreview.d.ts.map +1 -0
  727. package/dist/profiles/fields/profileFieldPreview.js +110 -0
  728. package/dist/profiles/fields/profileFieldPreview.js.map +1 -0
  729. package/dist/profiles/fields/profileFieldSample.cjs +182 -0
  730. package/dist/profiles/fields/profileFieldSample.cjs.map +1 -0
  731. package/dist/profiles/fields/profileFieldSample.d.ts +35 -0
  732. package/dist/profiles/fields/profileFieldSample.d.ts.map +1 -0
  733. package/dist/profiles/fields/profileFieldSample.js +180 -0
  734. package/dist/profiles/fields/profileFieldSample.js.map +1 -0
  735. package/dist/profiles/fields/profileFieldTypeField.cjs +104 -0
  736. package/dist/profiles/fields/profileFieldTypeField.cjs.map +1 -0
  737. package/dist/profiles/fields/profileFieldTypeField.d.ts +17 -0
  738. package/dist/profiles/fields/profileFieldTypeField.d.ts.map +1 -0
  739. package/dist/profiles/fields/profileFieldTypeField.js +104 -0
  740. package/dist/profiles/fields/profileFieldTypeField.js.map +1 -0
  741. package/dist/profiles/fields/profileFieldTypes.cjs +1 -0
  742. package/dist/profiles/fields/profileFieldTypes.cjs.map +1 -1
  743. package/dist/profiles/fields/profileFieldTypes.d.ts +1 -1
  744. package/dist/profiles/fields/profileFieldTypes.d.ts.map +1 -1
  745. package/dist/profiles/fields/profileFieldTypes.js +1 -0
  746. package/dist/profiles/fields/profileFieldTypes.js.map +1 -1
  747. package/dist/profiles/fields/profileFieldValueEditor.cjs +298 -0
  748. package/dist/profiles/fields/profileFieldValueEditor.cjs.map +1 -0
  749. package/dist/profiles/fields/profileFieldValueEditor.d.ts +18 -0
  750. package/dist/profiles/fields/profileFieldValueEditor.d.ts.map +1 -0
  751. package/dist/profiles/fields/profileFieldValueEditor.js +298 -0
  752. package/dist/profiles/fields/profileFieldValueEditor.js.map +1 -0
  753. package/dist/profiles/fields/profileFieldValueMode.cjs +61 -0
  754. package/dist/profiles/fields/profileFieldValueMode.cjs.map +1 -0
  755. package/dist/profiles/fields/profileFieldValueMode.d.ts +34 -0
  756. package/dist/profiles/fields/profileFieldValueMode.d.ts.map +1 -0
  757. package/dist/profiles/fields/profileFieldValueMode.js +59 -0
  758. package/dist/profiles/fields/profileFieldValueMode.js.map +1 -0
  759. package/dist/profiles/processor/processorConfig.cjs +79 -79
  760. package/dist/profiles/processor/processorConfig.cjs.map +1 -1
  761. package/dist/profiles/processor/processorConfig.d.ts +30 -3
  762. package/dist/profiles/processor/processorConfig.d.ts.map +1 -1
  763. package/dist/profiles/processor/processorConfig.js +78 -78
  764. package/dist/profiles/processor/processorConfig.js.map +1 -1
  765. package/dist/profiles/processor/processorPipeline.cjs +24 -8
  766. package/dist/profiles/processor/processorPipeline.cjs.map +1 -1
  767. package/dist/profiles/processor/processorPipeline.d.ts +3 -3
  768. package/dist/profiles/processor/processorPipeline.d.ts.map +1 -1
  769. package/dist/profiles/processor/processorPipeline.js +25 -9
  770. package/dist/profiles/processor/processorPipeline.js.map +1 -1
  771. package/dist/profiles/processor/processorPipelineEditor.cjs +38 -94
  772. package/dist/profiles/processor/processorPipelineEditor.cjs.map +1 -1
  773. package/dist/profiles/processor/processorPipelineEditor.d.ts +3 -3
  774. package/dist/profiles/processor/processorPipelineEditor.d.ts.map +1 -1
  775. package/dist/profiles/processor/processorPipelineEditor.js +39 -95
  776. package/dist/profiles/processor/processorPipelineEditor.js.map +1 -1
  777. package/dist/profiles/processor/processorPipelineExtension.cjs +3 -2
  778. package/dist/profiles/processor/processorPipelineExtension.cjs.map +1 -1
  779. package/dist/profiles/processor/processorPipelineExtension.d.ts.map +1 -1
  780. package/dist/profiles/processor/processorPipelineExtension.js +3 -2
  781. package/dist/profiles/processor/processorPipelineExtension.js.map +1 -1
  782. package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -1
  783. package/dist/profiles/query/profileSampleFilterLookup.d.ts +6 -3
  784. package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -1
  785. package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -1
  786. package/dist/profiles/wizard/profileWizardModel.cjs +10 -1
  787. package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
  788. package/dist/profiles/wizard/profileWizardModel.d.ts +6 -0
  789. package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
  790. package/dist/profiles/wizard/profileWizardModel.js +10 -1
  791. package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
  792. package/dist/profiles/wizard/profileWizardQueryStep.cjs +10 -22
  793. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  794. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +8 -1
  795. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  796. package/dist/profiles/wizard/profileWizardQueryStep.js +11 -23
  797. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  798. package/dist/profiles/wizard/useProfileInspection.cjs +39 -0
  799. package/dist/profiles/wizard/useProfileInspection.cjs.map +1 -0
  800. package/dist/profiles/wizard/useProfileInspection.d.ts +21 -0
  801. package/dist/profiles/wizard/useProfileInspection.d.ts.map +1 -0
  802. package/dist/profiles/wizard/useProfileInspection.js +39 -0
  803. package/dist/profiles/wizard/useProfileInspection.js.map +1 -0
  804. package/dist/profiles.cjs +9 -11
  805. package/dist/profiles.js +8 -8
  806. package/dist/rpc/EntityExplorerApp.cjs +7 -3
  807. package/dist/rpc/EntityExplorerApp.cjs.map +1 -1
  808. package/dist/rpc/EntityExplorerApp.d.ts +16 -1
  809. package/dist/rpc/EntityExplorerApp.d.ts.map +1 -1
  810. package/dist/rpc/EntityExplorerApp.js +7 -3
  811. package/dist/rpc/EntityExplorerApp.js.map +1 -1
  812. package/dist/rpc/InlineError.cjs +30 -10
  813. package/dist/rpc/InlineError.cjs.map +1 -1
  814. package/dist/rpc/InlineError.d.ts +10 -1
  815. package/dist/rpc/InlineError.d.ts.map +1 -1
  816. package/dist/rpc/InlineError.js +30 -10
  817. package/dist/rpc/InlineError.js.map +1 -1
  818. package/dist/rpc/SchemaActionForm.cjs +9 -6
  819. package/dist/rpc/SchemaActionForm.cjs.map +1 -1
  820. package/dist/rpc/SchemaActionForm.d.ts.map +1 -1
  821. package/dist/rpc/SchemaActionForm.js +9 -6
  822. package/dist/rpc/SchemaActionForm.js.map +1 -1
  823. package/dist/rpc/SessionHeader.cjs +117 -111
  824. package/dist/rpc/SessionHeader.cjs.map +1 -1
  825. package/dist/rpc/SessionHeader.d.ts +3 -1
  826. package/dist/rpc/SessionHeader.d.ts.map +1 -1
  827. package/dist/rpc/SessionHeader.js +117 -111
  828. package/dist/rpc/SessionHeader.js.map +1 -1
  829. package/dist/rpc/formMetadata.cjs +2 -6
  830. package/dist/rpc/formMetadata.cjs.map +1 -1
  831. package/dist/rpc/formMetadata.d.ts.map +1 -1
  832. package/dist/rpc/formMetadata.js +1 -5
  833. package/dist/rpc/formMetadata.js.map +1 -1
  834. package/dist/rpc/surfaceNav.cjs +5 -0
  835. package/dist/rpc/surfaceNav.cjs.map +1 -1
  836. package/dist/rpc/surfaceNav.d.ts.map +1 -1
  837. package/dist/rpc/surfaceNav.js +5 -0
  838. package/dist/rpc/surfaceNav.js.map +1 -1
  839. package/dist/runtime/barrels.json +8944 -8877
  840. package/dist/runtime/importmap.json +2168 -2129
  841. package/dist/styles.css +1 -1
  842. package/package.json +1 -1
  843. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs +0 -91
  844. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs.map +0 -1
  845. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts +0 -7
  846. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts.map +0 -1
  847. package/dist/data/ai/runtime-profiles/ResolutionInspector.js +0 -91
  848. package/dist/data/ai/runtime-profiles/ResolutionInspector.js.map +0 -1
  849. package/dist/profiles/cel/celEditorResults.cjs +0 -158
  850. package/dist/profiles/cel/celEditorResults.cjs.map +0 -1
  851. package/dist/profiles/cel/celEditorResults.d.ts +0 -37
  852. package/dist/profiles/cel/celEditorResults.d.ts.map +0 -1
  853. package/dist/profiles/cel/celEditorResults.js +0 -156
  854. package/dist/profiles/cel/celEditorResults.js.map +0 -1
@@ -5,12 +5,14 @@ import { Modal } from "../overlay/Modal.js";
5
5
  import { ProgressBar } from "./ProgressBar.js";
6
6
  import { UiFullscreen } from "../icons/components/UiFullscreen.js";
7
7
  import { Icon } from "./Icon.js";
8
- import { assignAxes, latestOf } from "./TimeseriesPanel.axes.js";
8
+ import { assignAxes, latestReading } from "./TimeseriesPanel.axes.js";
9
+ import { NO_DATA_LABEL, formatReading } from "./TimeseriesPanel.readout.js";
10
+ import { splitGapRuns } from "./TimeseriesPanel.segments.js";
9
11
  import { expandServedSeries, mergeSeries, resolveBreakdown, resolveSeries } from "./TimeseriesPanel.model.js";
10
12
  import { defaultTimeseriesFetcher, useTimeseriesQueries } from "./timeseries-query.js";
11
13
  import { useMemo, useState } from "react";
12
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
- import { Area, AreaChart, CartesianGrid, Line, LineChart, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
15
+ import { Area, AreaChart, CartesianGrid, DefaultTooltipContent, Line, LineChart, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
14
16
  // src/data/TimeseriesPanel.tsx
15
17
  function formatClock(at) {
16
18
  const date = new Date(at);
@@ -139,11 +141,11 @@ function TimeseriesPanel(props) {
139
141
  function LatestReadout({ series, rows }) {
140
142
  const only = series.length === 1 ? series[0] : void 0;
141
143
  if (!only) return null;
142
- const v = latestOf(rows, only.key);
144
+ const v = latestReading(rows, only.key);
143
145
  if (v === void 0) return null;
144
146
  return /* @__PURE__ */ jsx("span", {
145
147
  className: "tabular-nums",
146
- children: formatUnit(Math.abs(v), only.unit)
148
+ children: formatReading(v, only.unit)
147
149
  });
148
150
  }
149
151
  var REFERENCE_LINE_COLOR = "var(--muted-foreground, #64748b)";
@@ -158,7 +160,7 @@ function ChartLegend({ series, rows, referenceLines, unit }) {
158
160
  return /* @__PURE__ */ jsxs("ul", {
159
161
  className: "mt-1.5 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",
160
162
  children: [series.map((s) => {
161
- const v = latestOf(rows, s.key);
163
+ const v = latestReading(rows, s.key);
162
164
  return /* @__PURE__ */ jsxs("li", {
163
165
  className: "inline-flex min-w-0 items-center gap-1.5",
164
166
  children: [
@@ -173,7 +175,7 @@ function ChartLegend({ series, rows, referenceLines, unit }) {
173
175
  }),
174
176
  v !== void 0 ? /* @__PURE__ */ jsx("span", {
175
177
  className: "tabular-nums",
176
- children: formatUnit(Math.abs(v), s.unit)
178
+ children: formatReading(v, s.unit)
177
179
  }) : null
178
180
  ]
179
181
  }, s.key);
@@ -199,7 +201,7 @@ function ChartLegend({ series, rows, referenceLines, unit }) {
199
201
  }
200
202
  /** Breakdown header readout: `used / total · pct%`, where used is the sum of segments. */
201
203
  function BreakdownReadout({ total, unit, items }) {
202
- const used = items.reduce((acc, it) => acc + it.value, 0);
204
+ const used = items.reduce((acc, it) => acc + (it.value ?? 0), 0);
203
205
  const pct = total > 0 ? Math.min(100, used / total * 100) : 0;
204
206
  return /* @__PURE__ */ jsxs("span", {
205
207
  className: "font-mono tabular-nums",
@@ -216,7 +218,7 @@ function BreakdownReadout({ total, unit, items }) {
216
218
  /** Instantaneous stacked bar + legend list. The expand button (in the panel header) opens the graph. */
217
219
  function BreakdownView({ total, unit, items }) {
218
220
  const segments = items.map((it) => ({
219
- count: it.value,
221
+ count: it.value ?? 0,
220
222
  color: it.color,
221
223
  label: it.label
222
224
  }));
@@ -242,11 +244,11 @@ function BreakdownView({ total, unit, items }) {
242
244
  }),
243
245
  /* @__PURE__ */ jsx("span", {
244
246
  className: "font-mono tabular-nums text-foreground",
245
- children: formatUnit(it.value, it.unit ?? unit)
247
+ children: it.value === null ? NO_DATA_LABEL : formatUnit(it.value, it.unit ?? unit)
246
248
  }),
247
- /* @__PURE__ */ jsxs("span", {
249
+ /* @__PURE__ */ jsx("span", {
248
250
  className: "w-10 text-right font-mono tabular-nums text-muted-foreground",
249
- children: [it.percent.toFixed(0), "%"]
251
+ children: it.value === null ? "" : `${it.percent.toFixed(0)}%`
250
252
  })
251
253
  ]
252
254
  }, it.key))
@@ -255,7 +257,7 @@ function BreakdownView({ total, unit, items }) {
255
257
  }
256
258
  function Chart({ rows, series, variant, unit, showZeroLine, referenceLines }) {
257
259
  const stacked = variant === "stacked";
258
- const seriesByKey = new Map(series.map((s) => [s.key, s]));
260
+ const { rows: plotRows, plots } = useMemo(() => splitGapRuns(series, rows), [series, rows]);
259
261
  const strokeOf = (s) => resolveCssColor(s.color);
260
262
  const { axes: yAxes, axisOfKey } = useMemo(() => assignAxes(series), [series]);
261
263
  const axisOf = (key) => axisOfKey.get(key) ?? "left";
@@ -283,11 +285,13 @@ function Chart({ rows, series, variant, unit, showZeroLine, referenceLines }) {
283
285
  tickFormatter: (v) => formatUnit(Math.abs(v), ax.unit)
284
286
  }, ax.id)),
285
287
  /* @__PURE__ */ jsx(Tooltip, {
288
+ filterNull: false,
289
+ content: /* @__PURE__ */ jsx(SeriesTooltip, {
290
+ rows,
291
+ series,
292
+ unit
293
+ }),
286
294
  labelFormatter: (label) => formatClock(String(label)),
287
- formatter: (value, name) => {
288
- const s = seriesByKey.get(String(name));
289
- return [formatUnit(Math.abs(Number(value) || 0), s?.unit ?? unit), s?.label ?? String(name)];
290
- },
291
295
  contentStyle: { fontSize: 12 }
292
296
  }),
293
297
  showZeroLine ? /* @__PURE__ */ jsx(ReferenceLine, {
@@ -308,48 +312,78 @@ function Chart({ rows, series, variant, unit, showZeroLine, referenceLines }) {
308
312
  width: "100%",
309
313
  height: "100%",
310
314
  children: variant === "line" ? /* @__PURE__ */ jsxs(LineChart, {
311
- data: rows,
315
+ data: plotRows,
312
316
  margin: {
313
317
  top: 4,
314
318
  right: 8,
315
319
  bottom: 0,
316
320
  left: 0
317
321
  },
318
- children: [axes, series.map((s) => /* @__PURE__ */ jsx(Line, {
322
+ children: [axes, plots.map(({ dataKey, series: s, isolatedSample }) => /* @__PURE__ */ jsx(Line, {
319
323
  yAxisId: axisOf(s.key),
320
324
  type: "monotone",
321
- dataKey: s.key,
325
+ dataKey,
322
326
  name: s.key,
323
327
  stroke: strokeOf(s),
324
328
  strokeWidth: 2,
325
- dot: false,
329
+ dot: isolatedSample ? isolatedDot(strokeOf(s)) : false,
326
330
  connectNulls: true,
327
331
  isAnimationActive: false
328
- }, s.key))]
332
+ }, dataKey))]
329
333
  }) : /* @__PURE__ */ jsxs(AreaChart, {
330
- data: rows,
334
+ data: plotRows,
331
335
  margin: {
332
336
  top: 4,
333
337
  right: 8,
334
338
  bottom: 0,
335
339
  left: 0
336
340
  },
337
- children: [axes, series.map((s) => /* @__PURE__ */ jsx(Area, {
341
+ children: [axes, plots.map(({ dataKey, series: s, isolatedSample }) => /* @__PURE__ */ jsx(Area, {
338
342
  yAxisId: axisOf(s.key),
339
343
  type: "monotone",
340
- dataKey: s.key,
344
+ dataKey,
341
345
  name: s.key,
342
346
  stroke: strokeOf(s),
343
347
  fill: strokeOf(s),
344
348
  ...stacked ? { stackId: `stack-${axisOf(s.key)}` } : {},
345
349
  fillOpacity: stacked ? .7 : .12,
346
350
  strokeWidth: stacked ? 0 : 2,
351
+ dot: isolatedSample ? isolatedDot(strokeOf(s)) : false,
347
352
  connectNulls: true,
348
353
  isAnimationActive: false
349
- }, s.key))]
354
+ }, dataKey))]
350
355
  })
351
356
  });
352
357
  }
358
+ /** A lone sample between two gaps has no line to carry it, so it is drawn as a dot. */
359
+ var isolatedDot = (color) => ({
360
+ r: 2.5,
361
+ fill: color,
362
+ stroke: color
363
+ });
364
+ /**
365
+ * Tooltip body read from the merged row at the hovered time, not from recharts' payload: a gapped
366
+ * series is drawn as several runs, none of which has a value at the gap, yet the gap must say
367
+ * "no data". Series that simply have no row at this time (undefined) are left out, as before.
368
+ */
369
+ function SeriesTooltip({ rows, series, unit, ...rest }) {
370
+ const row = rows.find((candidate) => candidate.at === rest.label);
371
+ const payload = series.flatMap((s) => {
372
+ const value = row?.[s.key];
373
+ if (value === void 0 || typeof value === "string") return [];
374
+ return [{
375
+ name: s.label,
376
+ value: formatReading(value, s.unit ?? unit),
377
+ color: resolveCssColor(s.color),
378
+ dataKey: s.key,
379
+ graphicalItemId: s.key
380
+ }];
381
+ });
382
+ return /* @__PURE__ */ jsx(DefaultTooltipContent, {
383
+ ...rest,
384
+ payload
385
+ });
386
+ }
353
387
  function PanelMessage({ children }) {
354
388
  return /* @__PURE__ */ jsx("div", {
355
389
  className: "flex h-full items-center justify-center text-xs text-muted-foreground",
@@ -1 +1 @@
1
- {"version":3,"file":"TimeseriesPanel.js","names":["_Fragment"],"sources":["../../src/data/TimeseriesPanel.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n Area,\n AreaChart,\n CartesianGrid,\n Line,\n LineChart,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport { cn } from \"../lib/utils\";\nimport { resolveCssColor } from \"../lib/color\";\nimport { formatUnit } from \"../lib/format\";\nimport { Modal } from \"../overlay/Modal\";\nimport { ProgressBar, type ProgressSegment } from \"./ProgressBar\";\nimport { UiFullscreen } from \"../icons\";\nimport { Icon, type StaticIconComponent } from \"./Icon\";\nimport { assignAxes, latestOf } from \"./TimeseriesPanel.axes\";\nimport {\n expandServedSeries,\n mergeSeries,\n resolveBreakdown,\n resolveSeries,\n type BreakdownItem,\n type MergedRow,\n type ResolvedSeries,\n type TimeseriesPanelProps,\n type TimeseriesReferenceLine,\n} from \"./TimeseriesPanel.model\";\nimport { defaultTimeseriesFetcher, useTimeseriesQueries } from \"./timeseries-query\";\n\nexport type { AxisAssignment, AxisOrientation, AxisSpec } from \"./TimeseriesPanel.axes\";\nexport type {\n BreakdownItem,\n DisplaySeries,\n MergedRow,\n ResolvedSeries,\n SeriesLoadContext,\n SeriesLoader,\n TimeseriesPanelProps,\n TimeseriesPoint,\n TimeseriesReferenceLine,\n TimeseriesResponse,\n TimeseriesSeries,\n TimeseriesServerSeries,\n} from \"./TimeseriesPanel.model\";\n\nfunction formatClock(at: string): string {\n const date = new Date(at);\n if (Number.isNaN(date.getTime())) return \"\";\n return date.toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" });\n}\n\nexport function TimeseriesPanel(props: TimeseriesPanelProps) {\n const {\n title,\n icon,\n unit,\n range = \"1h\",\n refreshMs = 5000,\n height = 160,\n variant = \"area\",\n expandable = true,\n total,\n referenceLines,\n fetcher = defaultTimeseriesFetcher,\n className,\n } = props;\n const isBreakdown = variant === \"breakdown\";\n // The inline chart (non-breakdown only) and the expand modal both need a\n // time-series variant; breakdown has no inline chart and expands to \"area\".\n const chartVariant: ChartVariant = isBreakdown ? \"area\" : variant;\n const expandVariant = props.expandVariant ?? chartVariant;\n\n const [expanded, setExpanded] = useState(false);\n\n const requested = useMemo(() => resolveSeries(props), [props]);\n const results = useTimeseriesQueries(\n requested.map((s) => ({ id: s.key, load: s.load })),\n { baseUrl: props.baseUrl ?? \"\", range, refreshMs, fetcher },\n );\n const refs = referenceLines ?? [];\n\n const error = results.find((r) => r.error)?.error ?? null;\n const isError = error !== null;\n const isLoading = results.some((r) => r.isLoading) && results.every((r) => !r.series);\n const served = results.map((r) => r.series);\n const { series, points } = useMemo(() => expandServedSeries(props, served), [props, served]);\n const rows = useMemo(() => mergeSeries(series, points), [series, points]);\n const hasMirrored = series.some((s) => s.transform);\n const breakdown = useMemo(\n () => (isBreakdown ? resolveBreakdown(series, rows, total) : null),\n [isBreakdown, series, rows, total],\n );\n\n // Breakdown renders instantly from `current`; the modal still needs polled\n // history. Other variants gate on having ≥2 points to draw a line.\n const canExpand = expandable && rows.length >= 2;\n\n return (\n <div className={cn(\"flex flex-col rounded-lg border border-border bg-card p-3\", className)}>\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <span className=\"inline-flex min-w-0 items-center gap-1.5\">\n {icon ? <PanelIcon icon={icon} /> : null}\n <span className=\"truncate font-medium text-foreground\">{title}</span>\n </span>\n <span className=\"inline-flex shrink-0 items-center gap-1.5\">\n {breakdown ? (\n <BreakdownReadout total={breakdown.total} unit={unit} items={breakdown.items} />\n ) : (\n <LatestReadout series={series} rows={rows} />\n )}\n {canExpand ? (\n <button\n type=\"button\"\n aria-label=\"Expand chart\"\n onClick={() => setExpanded(true)}\n className=\"text-muted-foreground transition-colors hover:text-foreground\"\n >\n <Icon icon={UiFullscreen} width={14} height={14} />\n </button>\n ) : null}\n </span>\n </div>\n <div className=\"mt-2\" style={breakdown ? undefined : { height }}>\n {error ? (\n <PanelMessage>{error.message || \"Failed to load metric\"}</PanelMessage>\n ) : breakdown ? (\n <BreakdownView total={breakdown.total} unit={unit} items={breakdown.items} />\n ) : isLoading ? (\n <PanelMessage>Loading…</PanelMessage>\n ) : rows.length < 2 ? (\n <PanelMessage>Collecting data…</PanelMessage>\n ) : (\n <Chart\n rows={rows}\n series={series}\n variant={chartVariant}\n unit={unit}\n showZeroLine={hasMirrored}\n referenceLines={refs}\n />\n )}\n </div>\n {!breakdown && !isError && !isLoading && rows.length >= 2 && series.length + refs.length > 1 ? (\n <ChartLegend series={series} rows={rows} referenceLines={refs} unit={unit} />\n ) : null}\n {canExpand ? (\n <Modal open={expanded} onClose={() => setExpanded(false)} title={title} size=\"xl\">\n <div style={{ height: 360 }}>\n <Chart\n rows={rows}\n series={series}\n variant={expandVariant}\n unit={unit}\n showZeroLine={hasMirrored}\n referenceLines={refs}\n />\n </div>\n {series.length + refs.length > 1 ? (\n <ChartLegend series={series} rows={rows} referenceLines={refs} unit={unit} />\n ) : null}\n </Modal>\n ) : null}\n </div>\n );\n}\n\n/**\n * Header readout for a single-series panel: the latest value, formatted with the\n * series' unit. Multi-series panels render the per-series values in {@link ChartLegend}\n * below the chart instead, so this returns null for them to avoid overlapping the title.\n */\nfunction LatestReadout({ series, rows }: { series: ResolvedSeries[]; rows: MergedRow[] }) {\n const only = series.length === 1 ? series[0] : undefined;\n if (!only) return null;\n const v = latestOf(rows, only.key);\n if (v === undefined) return null;\n return <span className=\"tabular-nums\">{formatUnit(Math.abs(v), only.unit)}</span>;\n}\n\nconst REFERENCE_LINE_COLOR = \"var(--muted-foreground, #64748b)\";\n\nfunction referenceColor(ref: TimeseriesReferenceLine): string {\n return resolveCssColor(ref.color ?? REFERENCE_LINE_COLOR);\n}\n\n/**\n * Wrapping color-keyed legend for the time-series variants: dot + label + latest\n * value, then each reference line with its fixed value.\n */\nfunction ChartLegend({\n series,\n rows,\n referenceLines,\n unit,\n}: {\n series: ResolvedSeries[];\n rows: MergedRow[];\n referenceLines: TimeseriesReferenceLine[];\n unit: string | undefined;\n}) {\n return (\n <ul className=\"mt-1.5 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground\">\n {series.map((s) => {\n const v = latestOf(rows, s.key);\n return (\n <li key={s.key} className=\"inline-flex min-w-0 items-center gap-1.5\">\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: resolveCssColor(s.color) }}\n aria-hidden\n />\n <span className=\"truncate text-foreground\">{s.label}</span>\n {v !== undefined ? (\n <span className=\"tabular-nums\">{formatUnit(Math.abs(v), s.unit)}</span>\n ) : null}\n </li>\n );\n })}\n {referenceLines.map((ref, i) => (\n <li key={`ref-${i}`} className=\"inline-flex min-w-0 items-center gap-1.5\">\n <span\n className=\"h-0.5 w-2.5 shrink-0\"\n style={{ backgroundColor: referenceColor(ref) }}\n aria-hidden\n />\n <span className=\"truncate text-foreground\">{ref.label}</span>\n <span className=\"tabular-nums\">{formatUnit(ref.value, ref.unit ?? unit)}</span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** Breakdown header readout: `used / total · pct%`, where used is the sum of segments. */\nfunction BreakdownReadout({\n total,\n unit,\n items,\n}: {\n total: number;\n unit: string | undefined;\n items: BreakdownItem[];\n}) {\n const used = items.reduce((acc, it) => acc + it.value, 0);\n const pct = total > 0 ? Math.min(100, (used / total) * 100) : 0;\n return (\n <span className=\"font-mono tabular-nums\">\n {formatUnit(used, unit)} / {formatUnit(total, unit)} · {pct.toFixed(0)}%\n </span>\n );\n}\n\n/** Instantaneous stacked bar + legend list. The expand button (in the panel header) opens the graph. */\nfunction BreakdownView({\n total,\n unit,\n items,\n}: {\n total: number;\n unit: string | undefined;\n items: BreakdownItem[];\n}) {\n const segments: ProgressSegment[] = items.map((it) => ({\n count: it.value,\n color: it.color,\n label: it.label,\n }));\n return (\n <div className=\"flex flex-col gap-2\">\n <ProgressBar segments={segments} total={total > 0 ? total : 1} height=\"h-3\" />\n {items.length > 0 ? (\n <ul className=\"grid grid-cols-1 gap-y-1 text-xs\">\n {items.map((it) => (\n <li key={it.key} className=\"flex items-center gap-2\">\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: resolveCssColor(it.color) }}\n aria-hidden\n />\n <span className=\"min-w-0 flex-1 truncate font-mono text-muted-foreground\">\n {it.label}\n </span>\n <span className=\"font-mono tabular-nums text-foreground\">\n {formatUnit(it.value, it.unit ?? unit)}\n </span>\n <span className=\"w-10 text-right font-mono tabular-nums text-muted-foreground\">\n {it.percent.toFixed(0)}%\n </span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\ntype ChartVariant = \"area\" | \"line\" | \"stacked\";\n\nfunction Chart({\n rows,\n series,\n variant,\n unit,\n showZeroLine,\n referenceLines,\n}: {\n rows: MergedRow[];\n series: ResolvedSeries[];\n variant: ChartVariant;\n unit: string | undefined;\n showZeroLine: boolean;\n referenceLines: TimeseriesReferenceLine[];\n}) {\n const stacked = variant === \"stacked\";\n // Mirrored series carry negative values; show magnitudes on axis and tooltip.\n const seriesByKey = new Map(series.map((s) => [s.key, s]));\n // recharts needs a CSS color value; a series may carry a Tailwind class.\n const strokeOf = (s: ResolvedSeries) => resolveCssColor(s.color);\n // Distinct units map to a left and (when present) right axis; each series draws\n // against the axis for its unit so mixed-unit panels keep independent scales.\n const { axes: yAxes, axisOfKey } = useMemo(() => assignAxes(series), [series]);\n const axisOf = (key: string): \"left\" | \"right\" => axisOfKey.get(key) ?? \"left\";\n // A reference line draws against the axis formatting its unit, else the left.\n const axisOfUnit = (u: string | undefined): \"left\" | \"right\" =>\n yAxes.find((ax) => ax.unit === u)?.id ?? \"left\";\n const axes = (\n <>\n <CartesianGrid strokeOpacity={0.12} vertical={false} />\n <XAxis\n dataKey=\"at\"\n tickFormatter={formatClock}\n tick={{ fontSize: 10 }}\n stroke=\"currentColor\"\n strokeOpacity={0.35}\n minTickGap={32}\n />\n {yAxes.map((ax) => (\n <YAxis\n key={ax.id}\n yAxisId={ax.id}\n orientation={ax.orientation}\n tick={{ fontSize: 10 }}\n stroke=\"currentColor\"\n strokeOpacity={0.35}\n width={40}\n tickFormatter={(v: number) => formatUnit(Math.abs(v), ax.unit)}\n />\n ))}\n <Tooltip\n labelFormatter={(label) => formatClock(String(label))}\n formatter={(value, name) => {\n const s = seriesByKey.get(String(name));\n return [formatUnit(Math.abs(Number(value) || 0), s?.unit ?? unit), s?.label ?? String(name)];\n }}\n contentStyle={{ fontSize: 12 }}\n />\n {showZeroLine ? (\n <ReferenceLine yAxisId=\"left\" y={0} stroke=\"currentColor\" strokeOpacity={0.35} />\n ) : null}\n {referenceLines.map((ref, i) => (\n <ReferenceLine\n key={`ref-${i}`}\n yAxisId={axisOfUnit(ref.unit ?? unit)}\n y={ref.value}\n stroke={referenceColor(ref)}\n strokeDasharray=\"4 4\"\n ifOverflow=\"extendDomain\"\n />\n ))}\n </>\n );\n\n return (\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {variant === \"line\" ? (\n <LineChart data={rows} margin={{ top: 4, right: 8, bottom: 0, left: 0 }}>\n {axes}\n {series.map((s) => (\n <Line\n key={s.key}\n yAxisId={axisOf(s.key)}\n type=\"monotone\"\n dataKey={s.key}\n name={s.key}\n stroke={strokeOf(s)}\n strokeWidth={2}\n dot={false}\n connectNulls\n isAnimationActive={false}\n />\n ))}\n </LineChart>\n ) : (\n <AreaChart data={rows} margin={{ top: 4, right: 8, bottom: 0, left: 0 }}>\n {axes}\n {series.map((s) => (\n <Area\n key={s.key}\n yAxisId={axisOf(s.key)}\n type=\"monotone\"\n dataKey={s.key}\n name={s.key}\n stroke={strokeOf(s)}\n fill={strokeOf(s)}\n {...(stacked ? { stackId: `stack-${axisOf(s.key)}` } : {})}\n fillOpacity={stacked ? 0.7 : 0.12}\n strokeWidth={stacked ? 0 : 2}\n connectNulls\n isAnimationActive={false}\n />\n ))}\n </AreaChart>\n )}\n </ResponsiveContainer>\n );\n}\n\nfunction PanelMessage({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"flex h-full items-center justify-center text-xs text-muted-foreground\">\n {children}\n </div>\n );\n}\n\nfunction PanelIcon({ icon }: { icon: string | StaticIconComponent }) {\n if (typeof icon === \"string\") {\n return <Icon name={icon} width={16} height={16} className=\"text-muted-foreground\" />;\n }\n return <Icon icon={icon} width={16} height={16} className=\"text-muted-foreground\" />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAkDA,SAAS,YAAY,IAAoB;CACvC,MAAM,OAAO,IAAI,KAAK,EAAE;CACx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AAE;IACX,MAAM,EAAE;IACR,QAAQ,SAAS,CAAC;IAClB,MAAM,SAAS,CAAC;IAChB,GAAK,UAAU,EAAE,SAAS,SAAS,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC;IACxD,aAAa,UAAU,KAAM;IAC7B,aAAa,UAAU,IAAI;IAC3B,cAAA;IACA,mBAAmB;GACpB,GAZM,EAAE,GAYR,CACF,CACQ;;CAEM,CAAA;AAEzB;AAEA,SAAS,aAAa,EAAE,YAA2C;CACjE,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ;CACE,CAAA;AAET;AAEA,SAAS,UAAU,EAAE,QAAgD;CACnE,IAAI,OAAO,SAAS,UAClB,OAAO,oBAAC,MAAD;EAAM,MAAM;EAAM,OAAO;EAAI,QAAQ;EAAI,WAAU;CAAyB,CAAA;CAErF,OAAO,oBAAC,MAAD;EAAY;EAAM,OAAO;EAAI,QAAQ;EAAI,WAAU;CAAyB,CAAA;AACrF"}
1
+ {"version":3,"file":"TimeseriesPanel.js","names":["_Fragment"],"sources":["../../src/data/TimeseriesPanel.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n Area,\n AreaChart,\n CartesianGrid,\n DefaultTooltipContent,\n type DefaultTooltipContentProps,\n Line,\n LineChart,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport { cn } from \"../lib/utils\";\nimport { resolveCssColor } from \"../lib/color\";\nimport { formatUnit } from \"../lib/format\";\nimport { Modal } from \"../overlay/Modal\";\nimport { ProgressBar, type ProgressSegment } from \"./ProgressBar\";\nimport { UiFullscreen } from \"../icons\";\nimport { Icon, type StaticIconComponent } from \"./Icon\";\nimport { assignAxes, latestReading } from \"./TimeseriesPanel.axes\";\nimport { formatReading, NO_DATA_LABEL } from \"./TimeseriesPanel.readout\";\nimport { splitGapRuns } from \"./TimeseriesPanel.segments\";\nimport {\n expandServedSeries,\n mergeSeries,\n resolveBreakdown,\n resolveSeries,\n type BreakdownItem,\n type MergedRow,\n type ResolvedSeries,\n type TimeseriesPanelProps,\n type TimeseriesReferenceLine,\n} from \"./TimeseriesPanel.model\";\nimport { defaultTimeseriesFetcher, useTimeseriesQueries } from \"./timeseries-query\";\n\nexport type { AxisAssignment, AxisOrientation, AxisSpec } from \"./TimeseriesPanel.axes\";\nexport type {\n BreakdownItem,\n DisplaySeries,\n MergedRow,\n ResolvedSeries,\n SeriesLoadContext,\n SeriesLoader,\n TimeseriesPanelProps,\n TimeseriesPoint,\n TimeseriesReferenceLine,\n TimeseriesResponse,\n TimeseriesSeries,\n TimeseriesServerSeries,\n} from \"./TimeseriesPanel.model\";\n\nfunction formatClock(at: string): string {\n const date = new Date(at);\n if (Number.isNaN(date.getTime())) return \"\";\n return date.toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" });\n}\n\nexport function TimeseriesPanel(props: TimeseriesPanelProps) {\n const {\n title,\n icon,\n unit,\n range = \"1h\",\n refreshMs = 5000,\n height = 160,\n variant = \"area\",\n expandable = true,\n total,\n referenceLines,\n fetcher = defaultTimeseriesFetcher,\n className,\n } = props;\n const isBreakdown = variant === \"breakdown\";\n // The inline chart (non-breakdown only) and the expand modal both need a\n // time-series variant; breakdown has no inline chart and expands to \"area\".\n const chartVariant: ChartVariant = isBreakdown ? \"area\" : variant;\n const expandVariant = props.expandVariant ?? chartVariant;\n\n const [expanded, setExpanded] = useState(false);\n\n const requested = useMemo(() => resolveSeries(props), [props]);\n const results = useTimeseriesQueries(\n requested.map((s) => ({ id: s.key, load: s.load })),\n { baseUrl: props.baseUrl ?? \"\", range, refreshMs, fetcher },\n );\n const refs = referenceLines ?? [];\n\n const error = results.find((r) => r.error)?.error ?? null;\n const isError = error !== null;\n const isLoading = results.some((r) => r.isLoading) && results.every((r) => !r.series);\n const served = results.map((r) => r.series);\n const { series, points } = useMemo(() => expandServedSeries(props, served), [props, served]);\n const rows = useMemo(() => mergeSeries(series, points), [series, points]);\n const hasMirrored = series.some((s) => s.transform);\n const breakdown = useMemo(\n () => (isBreakdown ? resolveBreakdown(series, rows, total) : null),\n [isBreakdown, series, rows, total],\n );\n\n // Breakdown renders instantly from `current`; the modal still needs polled\n // history. Other variants gate on having ≥2 points to draw a line.\n const canExpand = expandable && rows.length >= 2;\n\n return (\n <div className={cn(\"flex flex-col rounded-lg border border-border bg-card p-3\", className)}>\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <span className=\"inline-flex min-w-0 items-center gap-1.5\">\n {icon ? <PanelIcon icon={icon} /> : null}\n <span className=\"truncate font-medium text-foreground\">{title}</span>\n </span>\n <span className=\"inline-flex shrink-0 items-center gap-1.5\">\n {breakdown ? (\n <BreakdownReadout total={breakdown.total} unit={unit} items={breakdown.items} />\n ) : (\n <LatestReadout series={series} rows={rows} />\n )}\n {canExpand ? (\n <button\n type=\"button\"\n aria-label=\"Expand chart\"\n onClick={() => setExpanded(true)}\n className=\"text-muted-foreground transition-colors hover:text-foreground\"\n >\n <Icon icon={UiFullscreen} width={14} height={14} />\n </button>\n ) : null}\n </span>\n </div>\n <div className=\"mt-2\" style={breakdown ? undefined : { height }}>\n {error ? (\n <PanelMessage>{error.message || \"Failed to load metric\"}</PanelMessage>\n ) : breakdown ? (\n <BreakdownView total={breakdown.total} unit={unit} items={breakdown.items} />\n ) : isLoading ? (\n <PanelMessage>Loading…</PanelMessage>\n ) : rows.length < 2 ? (\n <PanelMessage>Collecting data…</PanelMessage>\n ) : (\n <Chart\n rows={rows}\n series={series}\n variant={chartVariant}\n unit={unit}\n showZeroLine={hasMirrored}\n referenceLines={refs}\n />\n )}\n </div>\n {!breakdown && !isError && !isLoading && rows.length >= 2 && series.length + refs.length > 1 ? (\n <ChartLegend series={series} rows={rows} referenceLines={refs} unit={unit} />\n ) : null}\n {canExpand ? (\n <Modal open={expanded} onClose={() => setExpanded(false)} title={title} size=\"xl\">\n <div style={{ height: 360 }}>\n <Chart\n rows={rows}\n series={series}\n variant={expandVariant}\n unit={unit}\n showZeroLine={hasMirrored}\n referenceLines={refs}\n />\n </div>\n {series.length + refs.length > 1 ? (\n <ChartLegend series={series} rows={rows} referenceLines={refs} unit={unit} />\n ) : null}\n </Modal>\n ) : null}\n </div>\n );\n}\n\n/**\n * Header readout for a single-series panel: the latest value, formatted with the\n * series' unit. Multi-series panels render the per-series values in {@link ChartLegend}\n * below the chart instead, so this returns null for them to avoid overlapping the title.\n */\nfunction LatestReadout({ series, rows }: { series: ResolvedSeries[]; rows: MergedRow[] }) {\n const only = series.length === 1 ? series[0] : undefined;\n if (!only) return null;\n const v = latestReading(rows, only.key);\n if (v === undefined) return null;\n return <span className=\"tabular-nums\">{formatReading(v, only.unit)}</span>;\n}\n\nconst REFERENCE_LINE_COLOR = \"var(--muted-foreground, #64748b)\";\n\nfunction referenceColor(ref: TimeseriesReferenceLine): string {\n return resolveCssColor(ref.color ?? REFERENCE_LINE_COLOR);\n}\n\n/**\n * Wrapping color-keyed legend for the time-series variants: dot + label + latest\n * value, then each reference line with its fixed value.\n */\nfunction ChartLegend({\n series,\n rows,\n referenceLines,\n unit,\n}: {\n series: ResolvedSeries[];\n rows: MergedRow[];\n referenceLines: TimeseriesReferenceLine[];\n unit: string | undefined;\n}) {\n return (\n <ul className=\"mt-1.5 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground\">\n {series.map((s) => {\n const v = latestReading(rows, s.key);\n return (\n <li key={s.key} className=\"inline-flex min-w-0 items-center gap-1.5\">\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: resolveCssColor(s.color) }}\n aria-hidden\n />\n <span className=\"truncate text-foreground\">{s.label}</span>\n {v !== undefined ? (\n <span className=\"tabular-nums\">{formatReading(v, s.unit)}</span>\n ) : null}\n </li>\n );\n })}\n {referenceLines.map((ref, i) => (\n <li key={`ref-${i}`} className=\"inline-flex min-w-0 items-center gap-1.5\">\n <span\n className=\"h-0.5 w-2.5 shrink-0\"\n style={{ backgroundColor: referenceColor(ref) }}\n aria-hidden\n />\n <span className=\"truncate text-foreground\">{ref.label}</span>\n <span className=\"tabular-nums\">{formatUnit(ref.value, ref.unit ?? unit)}</span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** Breakdown header readout: `used / total · pct%`, where used is the sum of segments. */\nfunction BreakdownReadout({\n total,\n unit,\n items,\n}: {\n total: number;\n unit: string | undefined;\n items: BreakdownItem[];\n}) {\n const used = items.reduce((acc, it) => acc + (it.value ?? 0), 0);\n const pct = total > 0 ? Math.min(100, (used / total) * 100) : 0;\n return (\n <span className=\"font-mono tabular-nums\">\n {formatUnit(used, unit)} / {formatUnit(total, unit)} · {pct.toFixed(0)}%\n </span>\n );\n}\n\n/** Instantaneous stacked bar + legend list. The expand button (in the panel header) opens the graph. */\nfunction BreakdownView({\n total,\n unit,\n items,\n}: {\n total: number;\n unit: string | undefined;\n items: BreakdownItem[];\n}) {\n const segments: ProgressSegment[] = items.map((it) => ({\n count: it.value ?? 0,\n color: it.color,\n label: it.label,\n }));\n return (\n <div className=\"flex flex-col gap-2\">\n <ProgressBar segments={segments} total={total > 0 ? total : 1} height=\"h-3\" />\n {items.length > 0 ? (\n <ul className=\"grid grid-cols-1 gap-y-1 text-xs\">\n {items.map((it) => (\n <li key={it.key} className=\"flex items-center gap-2\">\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: resolveCssColor(it.color) }}\n aria-hidden\n />\n <span className=\"min-w-0 flex-1 truncate font-mono text-muted-foreground\">\n {it.label}\n </span>\n <span className=\"font-mono tabular-nums text-foreground\">\n {it.value === null ? NO_DATA_LABEL : formatUnit(it.value, it.unit ?? unit)}\n </span>\n <span className=\"w-10 text-right font-mono tabular-nums text-muted-foreground\">\n {it.value === null ? \"\" : `${it.percent.toFixed(0)}%`}\n </span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\ntype ChartVariant = \"area\" | \"line\" | \"stacked\";\n\nfunction Chart({\n rows,\n series,\n variant,\n unit,\n showZeroLine,\n referenceLines,\n}: {\n rows: MergedRow[];\n series: ResolvedSeries[];\n variant: ChartVariant;\n unit: string | undefined;\n showZeroLine: boolean;\n referenceLines: TimeseriesReferenceLine[];\n}) {\n const stacked = variant === \"stacked\";\n // A series with an explicit gap is drawn as one line per run (see splitGapRuns); the rest as one.\n const { rows: plotRows, plots } = useMemo(() => splitGapRuns(series, rows), [series, rows]);\n // recharts needs a CSS color value; a series may carry a Tailwind class.\n const strokeOf = (s: ResolvedSeries) => resolveCssColor(s.color);\n // Distinct units map to a left and (when present) right axis; each series draws\n // against the axis for its unit so mixed-unit panels keep independent scales.\n const { axes: yAxes, axisOfKey } = useMemo(() => assignAxes(series), [series]);\n const axisOf = (key: string): \"left\" | \"right\" => axisOfKey.get(key) ?? \"left\";\n // A reference line draws against the axis formatting its unit, else the left.\n const axisOfUnit = (u: string | undefined): \"left\" | \"right\" =>\n yAxes.find((ax) => ax.unit === u)?.id ?? \"left\";\n const axes = (\n <>\n <CartesianGrid strokeOpacity={0.12} vertical={false} />\n <XAxis\n dataKey=\"at\"\n tickFormatter={formatClock}\n tick={{ fontSize: 10 }}\n stroke=\"currentColor\"\n strokeOpacity={0.35}\n minTickGap={32}\n />\n {yAxes.map((ax) => (\n <YAxis\n key={ax.id}\n yAxisId={ax.id}\n orientation={ax.orientation}\n tick={{ fontSize: 10 }}\n stroke=\"currentColor\"\n strokeOpacity={0.35}\n width={40}\n tickFormatter={(v: number) => formatUnit(Math.abs(v), ax.unit)}\n />\n ))}\n {/* filterNull off keeps the tooltip alive at a gap, where every run of a gapped series has no\n value; SeriesTooltip then reads the row itself, so a gap says \"no data\". */}\n <Tooltip\n filterNull={false}\n content={<SeriesTooltip rows={rows} series={series} unit={unit} />}\n labelFormatter={(label) => formatClock(String(label))}\n contentStyle={{ fontSize: 12 }}\n />\n {showZeroLine ? (\n <ReferenceLine yAxisId=\"left\" y={0} stroke=\"currentColor\" strokeOpacity={0.35} />\n ) : null}\n {referenceLines.map((ref, i) => (\n <ReferenceLine\n key={`ref-${i}`}\n yAxisId={axisOfUnit(ref.unit ?? unit)}\n y={ref.value}\n stroke={referenceColor(ref)}\n strokeDasharray=\"4 4\"\n ifOverflow=\"extendDomain\"\n />\n ))}\n </>\n );\n\n return (\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {variant === \"line\" ? (\n <LineChart data={plotRows} margin={{ top: 4, right: 8, bottom: 0, left: 0 }}>\n {axes}\n {plots.map(({ dataKey, series: s, isolatedSample }) => (\n <Line\n key={dataKey}\n yAxisId={axisOf(s.key)}\n type=\"monotone\"\n dataKey={dataKey}\n name={s.key}\n stroke={strokeOf(s)}\n strokeWidth={2}\n dot={isolatedSample ? isolatedDot(strokeOf(s)) : false}\n connectNulls\n isAnimationActive={false}\n />\n ))}\n </LineChart>\n ) : (\n <AreaChart data={plotRows} margin={{ top: 4, right: 8, bottom: 0, left: 0 }}>\n {axes}\n {plots.map(({ dataKey, series: s, isolatedSample }) => (\n <Area\n key={dataKey}\n yAxisId={axisOf(s.key)}\n type=\"monotone\"\n dataKey={dataKey}\n name={s.key}\n stroke={strokeOf(s)}\n fill={strokeOf(s)}\n {...(stacked ? { stackId: `stack-${axisOf(s.key)}` } : {})}\n fillOpacity={stacked ? 0.7 : 0.12}\n strokeWidth={stacked ? 0 : 2}\n dot={isolatedSample ? isolatedDot(strokeOf(s)) : false}\n connectNulls\n isAnimationActive={false}\n />\n ))}\n </AreaChart>\n )}\n </ResponsiveContainer>\n );\n}\n\n/** A lone sample between two gaps has no line to carry it, so it is drawn as a dot. */\nconst isolatedDot = (color: string) => ({ r: 2.5, fill: color, stroke: color });\n\ntype SeriesTooltipProps = {\n rows: MergedRow[];\n series: ResolvedSeries[];\n unit: string | undefined;\n} & Pick<DefaultTooltipContentProps, \"label\" | \"labelFormatter\" | \"contentStyle\">;\n\n/**\n * Tooltip body read from the merged row at the hovered time, not from recharts' payload: a gapped\n * series is drawn as several runs, none of which has a value at the gap, yet the gap must say\n * \"no data\". Series that simply have no row at this time (undefined) are left out, as before.\n */\nfunction SeriesTooltip({ rows, series, unit, ...rest }: SeriesTooltipProps) {\n const row = rows.find((candidate) => candidate.at === rest.label);\n const payload = series.flatMap((s) => {\n const value = row?.[s.key];\n if (value === undefined || typeof value === \"string\") return [];\n return [{ name: s.label, value: formatReading(value, s.unit ?? unit), color: resolveCssColor(s.color), dataKey: s.key, graphicalItemId: s.key }];\n });\n return <DefaultTooltipContent {...rest} payload={payload} />;\n}\n\nfunction PanelMessage({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"flex h-full items-center justify-center text-xs text-muted-foreground\">\n {children}\n </div>\n );\n}\n\nfunction PanelIcon({ icon }: { icon: string | StaticIconComponent }) {\n if (typeof icon === \"string\") {\n return <Icon name={icon} width={16} height={16} className=\"text-muted-foreground\" />;\n }\n return <Icon icon={icon} width={16} height={16} className=\"text-muted-foreground\" />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,SAAS,YAAY,IAAoB;CACvC,MAAM,OAAO,IAAI,KAAK,EAAE;CACxB,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzC,OAAO,KAAK,mBAAmB,CAAC,GAAG;EAAE,MAAM;EAAW,QAAQ;CAAU,CAAC;AAC3E;AAEA,SAAgB,gBAAgB,OAA6B;CAC3D,MAAM,EACJ,OACA,MACA,MACA,QAAQ,MACR,YAAY,KACZ,SAAS,KACT,UAAU,QACV,aAAa,MACb,OACA,gBACA,UAAU,0BACV,cACE;CACJ,MAAM,cAAc,YAAY;CAGhC,MAAM,eAA6B,cAAc,SAAS;CAC1D,MAAM,gBAAgB,MAAM,iBAAiB;CAE7C,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAE9C,MAAM,YAAY,cAAc,cAAc,KAAK,GAAG,CAAC,KAAK,CAAC;CAC7D,MAAM,UAAU,qBACd,UAAU,KAAK,OAAO;EAAE,IAAI,EAAE;EAAK,MAAM,EAAE;CAAK,EAAE,GAClD;EAAE,SAAS,MAAM,W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AU,UAAU,OAAO,CAAC;EAC9D,OAAO,CAAC;GAAE,MAAM,EAAE;GAAO,OAAO,cAAc,OAAO,EAAE,QAAQ,IAAI;GAAG,OAAO,gBAAgB,EAAE,KAAK;GAAG,SAAS,EAAE;GAAK,iBAAiB,EAAE;EAAI,CAAC;CACjJ,CAAC;CACD,OAAO,oBAAC,uBAAD;EAAuB,GAAI;EAAe;CAAU,CAAA;AAC7D;AAEA,SAAS,aAAa,EAAE,YAA2C;CACjE,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ;CACE,CAAA;AAET;AAEA,SAAS,UAAU,EAAE,QAAgD;CACnE,IAAI,OAAO,SAAS,UAClB,OAAO,oBAAC,MAAD;EAAM,MAAM;EAAM,OAAO;EAAI,QAAQ;EAAI,WAAU;CAAyB,CAAA;CAErF,OAAO,oBAAC,MAAD;EAAY;EAAM,OAAO;EAAI,QAAQ;EAAI,WAAU;CAAyB,CAAA;AACrF"}
@@ -75,11 +75,14 @@ function expandServedSeries(props, served) {
75
75
  };
76
76
  }
77
77
  function resolveBreakdown(series, rows, total) {
78
- const withValue = series.map((s) => ({
79
- s,
80
- value: s.current ?? require_TimeseriesPanel_axes.latestOf(rows, s.key) ?? 0
81
- }));
82
- const denom = total ?? withValue.reduce((acc, w) => acc + w.value, 0);
78
+ const withValue = series.map((s) => {
79
+ const latest = require_TimeseriesPanel_axes.latestReading(rows, s.key);
80
+ return {
81
+ s,
82
+ value: s.current ?? (latest === void 0 ? 0 : latest)
83
+ };
84
+ });
85
+ const denom = total ?? withValue.reduce((acc, w) => acc + (w.value ?? 0), 0);
83
86
  return {
84
87
  items: withValue.map(({ s, value }) => ({
85
88
  key: s.key,
@@ -87,7 +90,7 @@ function resolveBreakdown(series, rows, total) {
87
90
  color: s.color,
88
91
  ...s.unit ? { unit: s.unit } : {},
89
92
  value,
90
- percent: denom > 0 ? Math.min(100, Math.max(0, value / denom * 100)) : 0
93
+ percent: value === null || denom <= 0 ? 0 : Math.min(100, Math.max(0, value / denom * 100))
91
94
  })),
92
95
  total: denom
93
96
  };
@@ -97,7 +100,7 @@ function mergeSeries(series, pointsBySeries) {
97
100
  series.forEach((s, i) => {
98
101
  for (const p of pointsBySeries[i] ?? []) {
99
102
  const row = rows.get(p.at) ?? { at: p.at };
100
- row[s.key] = s.transform ? s.transform(p.value) : p.value;
103
+ row[s.key] = p.value !== null && s.transform ? s.transform(p.value) : p.value;
101
104
  rows.set(p.at, row);
102
105
  }
103
106
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TimeseriesPanel.model.cjs","names":["latestOf"],"sources":["../../src/data/TimeseriesPanel.model.ts"],"sourcesContent":["import type { StaticIconComponent } from \"./Icon\";\nimport { latestOf } from \"./TimeseriesPanel.axes\";\n\nexport interface TimeseriesPoint {\n at: string;\n value: number;\n}\n\nexport interface TimeseriesResponse {\n id: string;\n points: TimeseriesPoint[];\n}\n\n/**\n * One series as the metrics stream serves it. `source` is the id a panel\n * requested; one requested id can expand into several series (a profile\n * grouped by pod, say), each with its own `id` (`<source>#<labels>`) and\n * `labels`. For a plain metric id, `id === source`.\n */\nexport interface TimeseriesServerSeries {\n id: string;\n source: string;\n label?: string;\n labels?: Record<string, string>;\n /** A `formatUnit` key, used when the panel series names no unit. */\n unit?: string;\n points: TimeseriesPoint[];\n}\n\n/** What a {@link SeriesLoader} receives from the widget polling it. */\nexport interface SeriesLoadContext {\n /** The widget's look-back window, e.g. \"1h\". */\n range: string;\n /** Aborted when the query is cancelled, e.g. the widget unmounts mid-request. */\n signal: AbortSignal;\n}\n\n/**\n * Loads a series directly, instead of the widget requesting `baseUrl + id`\n * through its `fetcher`. Called again whenever the range changes and on every\n * poll.\n */\nexport type SeriesLoader = (ctx: SeriesLoadContext) => Promise<TimeseriesResponse>;\n\n/**\n * One metric plotted on a panel. Its request URL is `baseUrl + id`, unless a\n * `load` function supplies the data.\n */\nexport interface TimeseriesSeries {\n /**\n * Metric id appended to the panel's baseUrl, e.g. \"sqlserver.iops.read\".\n * With `load`, the id is the series' cache identity instead: loaded series\n * are cached under `[\"timeseries\", \"load\", id, range]`, so it must be unique\n * per data source (two series sharing an id share one cached response).\n */\n id: string;\n /** Loads the series' points; when set, `baseUrl` and `fetcher` are not used. */\n load?: SeriesLoader;\n /** Tooltip/legend label; defaults to the `labels` values, then the id. */\n label?: string;\n /** The series' label set, e.g. `{ pod: \"api\" }`; its values label the series when `label` is unset. */\n labels?: Record<string, string>;\n /**\n * The requested id this series was expanded from, when one id answers with\n * several series (see {@link TimeseriesServerSeries}). Unset on requested series.\n */\n source?: string;\n /**\n * Maps each point's value before plotting, e.g. writes pass `(v) => -v` to\n * render below the zero axis. Identity when omitted.\n */\n transform?: (value: number) => number;\n /**\n * Stroke/fill override as a CSS color value or a Tailwind color class.\n * Defaults cycle a small palette by index.\n */\n color?: string;\n /**\n * Grafana-style unit key for this series' readout/tooltip. Falls back to the\n * panel-level `unit`.\n */\n unit?: string;\n /**\n * Instantaneous value for the `breakdown` variant. When omitted, the\n * breakdown falls back to the latest polled point.\n */\n current?: number;\n}\n\n/** A horizontal marker line at a fixed value, e.g. a static capacity. */\nexport interface TimeseriesReferenceLine {\n value: number;\n /** Legend label, e.g. \"capacity\". */\n label: string;\n /** CSS color value or Tailwind color class; defaults to the muted foreground. */\n color?: string;\n /** Grafana-style unit key for the legend value; falls back to the panel `unit`. */\n unit?: string;\n}\n\nexport interface TimeseriesPanelProps {\n url?: string;\n baseUrl?: string;\n series?: TimeseriesSeries[];\n title: string;\n icon?: string | StaticIconComponent;\n unit?: string;\n range?: string;\n refreshMs?: number;\n height?: number;\n variant?: \"area\" | \"line\" | \"stacked\" | \"breakdown\";\n expandVariant?: \"area\" | \"line\" | \"stacked\";\n total?: number;\n /** Flat lines drawn across the time-series chart, e.g. a fixed capacity. */\n referenceLines?: TimeseriesReferenceLine[];\n expandable?: boolean;\n fetcher?: (url: string) => Promise<TimeseriesResponse>;\n className?: string;\n}\n\nconst SERIES_PALETTE = [\n \"var(--chart-1, #3b82f6)\",\n \"var(--chart-2, #ef4444)\",\n \"var(--chart-3, #10b981)\",\n \"var(--chart-4, #f59e0b)\",\n] as const;\n\nfunction paletteColor(index: number): string {\n return SERIES_PALETTE[index % SERIES_PALETTE.length] ?? SERIES_PALETTE[0];\n}\n\n/** A series with its full request URL, resolved label, color, and unit. */\nexport interface ResolvedSeries {\n key: string;\n url: string;\n label: string;\n color: string;\n unit?: string;\n transform?: (value: number) => number;\n load?: SeriesLoader;\n current?: number;\n labels?: Record<string, string>;\n /** The requested id an expanded series came from; unset on requested series. */\n source?: string;\n}\n\n/** The label-set values in key order, e.g. `{ pod: \"api\", ns: \"x\" }` → \"x, api\". */\nfunction labelValues(labels: Record<string, string> | undefined): string | undefined {\n if (!labels) return undefined;\n const values = Object.keys(labels)\n .sort()\n .map((key) => labels[key]);\n return values.length > 0 ? values.join(\", \") : undefined;\n}\n\nfunction requestedSeries(props: TimeseriesPanelProps): TimeseriesSeries[] {\n return props.series ?? (props.url ? [{ id: props.url }] : []);\n}\n\nfunction resolveEntry(\n s: TimeseriesSeries,\n index: number,\n props: TimeseriesPanelProps,\n servedUnit?: string,\n): ResolvedSeries {\n const unit = s.unit ?? servedUnit ?? props.unit;\n return {\n key: s.id,\n url: (props.baseUrl ?? \"\") + s.id,\n label: s.label ?? labelValues(s.labels) ?? s.id,\n color: s.color ?? paletteColor(index),\n ...(unit ? { unit } : {}),\n ...(s.transform ? { transform: s.transform } : {}),\n ...(s.load ? { load: s.load } : {}),\n ...(s.current !== undefined ? { current: s.current } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(s.source ? { source: s.source } : {}),\n };\n}\n\n/** Normalises the single-url and baseUrl+series forms to one list. */\nexport function resolveSeries(props: TimeseriesPanelProps): ResolvedSeries[] {\n return requestedSeries(props).map((s, i) => resolveEntry(s, i, props));\n}\n\n/** The series a panel plots, index-aligned with each one's points (undefined while loading). */\nexport interface DisplaySeries {\n series: ResolvedSeries[];\n points: (TimeseriesPoint[] | undefined)[];\n}\n\n/**\n * Resolves what a panel plots from what its requested series were answered\n * with (`served`, index-aligned with the requested series; undefined while a\n * series is loading). A requested id answered by its own series alone keeps\n * the panel's label, color and `current`; an id that expanded into several\n * series plots each one, labelled by its `label` or label values. A series\n * without a unit of its own takes the served unit, then the panel `unit`.\n */\nexport function expandServedSeries(\n props: TimeseriesPanelProps,\n served: readonly (readonly TimeseriesServerSeries[] | undefined)[],\n): DisplaySeries {\n const series: ResolvedSeries[] = [];\n const points: (TimeseriesPoint[] | undefined)[] = [];\n requestedSeries(props).forEach((requested, i) => {\n const answer = served[i];\n const [first] = answer ?? [];\n if (!answer || !first || (answer.length === 1 && first.id === requested.id)) {\n series.push(resolveEntry(requested, series.length, props, first?.unit));\n points.push(answer ? (first?.points ?? []) : undefined);\n return;\n }\n for (const s of answer) {\n const expanded: TimeseriesSeries = {\n id: s.id,\n source: requested.id,\n ...(s.label ? { label: s.label } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(requested.unit ? { unit: requested.unit } : {}),\n ...(requested.transform ? { transform: requested.transform } : {}),\n };\n series.push(resolveEntry(expanded, series.length, props, s.unit));\n points.push(s.points);\n }\n });\n return { series, points };\n}\n\n/** One legend/bar row of the breakdown variant. */\nexport interface BreakdownItem {\n key: string;\n label: string;\n color: string;\n unit?: string;\n value: number;\n percent: number;\n}\n\n/**\n * One row of the merged chart data: the timestamp in `at` plus each series'\n * value under its key.\n */\nexport interface MergedRow {\n at: string;\n [seriesKey: string]: string | number | undefined;\n}\n\nexport function resolveBreakdown(\n series: ResolvedSeries[],\n rows: MergedRow[],\n total?: number,\n): { items: BreakdownItem[]; total: number } {\n const withValue = series.map((s) => ({ s, value: s.current ?? latestOf(rows, s.key) ?? 0 }));\n const denom = total ?? withValue.reduce((acc, w) => acc + w.value, 0);\n const items = withValue.map(({ s, value }) => ({\n key: s.key,\n label: s.label,\n color: s.color,\n ...(s.unit ? { unit: s.unit } : {}),\n value,\n percent: denom > 0 ? Math.min(100, Math.max(0, (value / denom) * 100)) : 0,\n }));\n return { items, total: denom };\n}\n\nexport function mergeSeries(\n series: ResolvedSeries[],\n pointsBySeries: (TimeseriesPoint[] | undefined)[],\n): MergedRow[] {\n const rows = new Map<string, MergedRow>();\n series.forEach((s, i) => {\n for (const p of pointsBySeries[i] ?? []) {\n const row = rows.get(p.at) ?? { at: p.at };\n row[s.key] = s.transform ? s.transform(p.value) : p.value;\n rows.set(p.at, row);\n }\n });\n return [...rows.values()].sort((a, b) => a.at.localeCompare(b.at));\n}\n"],"mappings":";;AAwHA,IAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AAEA,SAAS,aAAa,OAAuB;CAC3C,OAAO,eAAe,QAAQ,eAAe,WAAW,eAAe;AACzE;;AAkBA,SAAS,YAAY,QAAgE;CACnF,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,SAAS,OAAO,KAAK,MAAM,CAAC,CAC/B,KAAK,CAAC,CACN,KAAK,QAAQ,OAAO,IAAI;CAC3B,OAAO,OAAO,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,KAAA;AACjD;AAEA,SAAS,gBAAgB,OAAiD;CACxE,OAAO,MAAM,WAAW,MAAM,MAAM,CAAC,EAAE,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC;AAC7D;AAEA,SAAS,aACP,GACA,OACA,OACA,YACgB;CAChB,MAAM,OAAO,EAAE,QAAQ,cAAc,MAAM;CAC3C,OAAO;EACL,KAAK,EAAE;EACP,MAAM,MAAM,WAAW,MAAM,EAAE;EAC/B,OAAO,EAAE,SAAS,YAAY,EAAE,MAAM,KAAK,EAAE;EAC7C,OAAO,EAAE,SAAS,aAAa,KAAK;EACpC,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;EACvB,GAAI,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,IAAI,CAAC;EAChD,GAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;EACjC,GAAI,EAAE,YAAY,KAAA,IAAY,EAAE,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3C,MAAM,YAAY,OAAO,KAAK,OAAO;EAAE;EAAG,OAAO,EAAE,WAAWA,6BAAAA,SAAS,MAAM,EAAE,GAAG,KAAK;CAAE,EAAE;CAC3F,MAAM,QAAQ,SAAS,UAAU,QAAQ,KAAK,MAAM,MAAM,EAAE,OAAO,CAAC;CASpE,OAAO;EAAE,OARK,UAAU,KAAK,EAAE,GAAG,aAAa;GAC7C,KAAK,EAAE;GACP,OAAO,EAAE;GACT,OAAO,EAAE;GACT,GAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;GACjC;GACA,SAAS,QAAQ,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,QAAQ,QAAS,GAAG,CAAC,IAAI;EAC3E,EACS;EAAO,OAAO;CAAM;AAC/B;AAEA,SAAgB,YACd,QACA,gBACa;CACb,MAAM,uBAAO,IAAI,IAAuB;CACxC,OAAO,SAAS,GAAG,MAAM;EACvB,KAAK,MAAM,KAAK,eAAe,MAAM,CAAC,GAAG;GACvC,MAAM,MAAM,KAAK,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;GACzC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE;GACpD,KAAK,IAAI,EAAE,IAAI,GAAG;EACpB;CACF,CAAC;CACD,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AACnE"}
1
+ {"version":3,"file":"TimeseriesPanel.model.cjs","names":["latestReading"],"sources":["../../src/data/TimeseriesPanel.model.ts"],"sourcesContent":["import type { StaticIconComponent } from \"./Icon\";\nimport { latestReading } from \"./TimeseriesPanel.axes\";\n\nexport interface TimeseriesPoint {\n at: string;\n /** `null` means \"no reading at this time\": the chart breaks the line there. */\n value: number | null;\n}\n\nexport interface TimeseriesResponse {\n id: string;\n points: TimeseriesPoint[];\n}\n\n/**\n * One series as the metrics stream serves it. `source` is the id a panel\n * requested; one requested id can expand into several series (a profile\n * grouped by pod, say), each with its own `id` (`<source>#<labels>`) and\n * `labels`. For a plain metric id, `id === source`.\n */\nexport interface TimeseriesServerSeries {\n id: string;\n source: string;\n label?: string;\n labels?: Record<string, string>;\n /** A `formatUnit` key, used when the panel series names no unit. */\n unit?: string;\n points: TimeseriesPoint[];\n}\n\n/** What a {@link SeriesLoader} receives from the widget polling it. */\nexport interface SeriesLoadContext {\n /** The widget's look-back window, e.g. \"1h\". */\n range: string;\n /** Aborted when the query is cancelled, e.g. the widget unmounts mid-request. */\n signal: AbortSignal;\n}\n\n/**\n * Loads a series directly, instead of the widget requesting `baseUrl + id`\n * through its `fetcher`. Called again whenever the range changes and on every\n * poll.\n */\nexport type SeriesLoader = (ctx: SeriesLoadContext) => Promise<TimeseriesResponse>;\n\n/**\n * One metric plotted on a panel. Its request URL is `baseUrl + id`, unless a\n * `load` function supplies the data.\n */\nexport interface TimeseriesSeries {\n /**\n * Metric id appended to the panel's baseUrl, e.g. \"sqlserver.iops.read\".\n * With `load`, the id is the series' cache identity instead: loaded series\n * are cached under `[\"timeseries\", \"load\", id, range]`, so it must be unique\n * per data source (two series sharing an id share one cached response).\n */\n id: string;\n /** Loads the series' points; when set, `baseUrl` and `fetcher` are not used. */\n load?: SeriesLoader;\n /** Tooltip/legend label; defaults to the `labels` values, then the id. */\n label?: string;\n /** The series' label set, e.g. `{ pod: \"api\" }`; its values label the series when `label` is unset. */\n labels?: Record<string, string>;\n /**\n * The requested id this series was expanded from, when one id answers with\n * several series (see {@link TimeseriesServerSeries}). Unset on requested series.\n */\n source?: string;\n /**\n * Maps each point's value before plotting, e.g. writes pass `(v) => -v` to\n * render below the zero axis. Identity when omitted.\n */\n transform?: (value: number) => number;\n /**\n * Stroke/fill override as a CSS color value or a Tailwind color class.\n * Defaults cycle a small palette by index.\n */\n color?: string;\n /**\n * Grafana-style unit key for this series' readout/tooltip. Falls back to the\n * panel-level `unit`.\n */\n unit?: string;\n /**\n * Instantaneous value for the `breakdown` variant. When omitted, the\n * breakdown falls back to the latest polled point.\n */\n current?: number;\n}\n\n/** A horizontal marker line at a fixed value, e.g. a static capacity. */\nexport interface TimeseriesReferenceLine {\n value: number;\n /** Legend label, e.g. \"capacity\". */\n label: string;\n /** CSS color value or Tailwind color class; defaults to the muted foreground. */\n color?: string;\n /** Grafana-style unit key for the legend value; falls back to the panel `unit`. */\n unit?: string;\n}\n\nexport interface TimeseriesPanelProps {\n url?: string;\n baseUrl?: string;\n series?: TimeseriesSeries[];\n title: string;\n icon?: string | StaticIconComponent;\n unit?: string;\n range?: string;\n refreshMs?: number;\n height?: number;\n variant?: \"area\" | \"line\" | \"stacked\" | \"breakdown\";\n expandVariant?: \"area\" | \"line\" | \"stacked\";\n total?: number;\n /** Flat lines drawn across the time-series chart, e.g. a fixed capacity. */\n referenceLines?: TimeseriesReferenceLine[];\n expandable?: boolean;\n fetcher?: (url: string) => Promise<TimeseriesResponse>;\n className?: string;\n}\n\nconst SERIES_PALETTE = [\n \"var(--chart-1, #3b82f6)\",\n \"var(--chart-2, #ef4444)\",\n \"var(--chart-3, #10b981)\",\n \"var(--chart-4, #f59e0b)\",\n] as const;\n\nfunction paletteColor(index: number): string {\n return SERIES_PALETTE[index % SERIES_PALETTE.length] ?? SERIES_PALETTE[0];\n}\n\n/** A series with its full request URL, resolved label, color, and unit. */\nexport interface ResolvedSeries {\n key: string;\n url: string;\n label: string;\n color: string;\n unit?: string;\n transform?: (value: number) => number;\n load?: SeriesLoader;\n current?: number;\n labels?: Record<string, string>;\n /** The requested id an expanded series came from; unset on requested series. */\n source?: string;\n}\n\n/** The label-set values in key order, e.g. `{ pod: \"api\", ns: \"x\" }` → \"x, api\". */\nfunction labelValues(labels: Record<string, string> | undefined): string | undefined {\n if (!labels) return undefined;\n const values = Object.keys(labels)\n .sort()\n .map((key) => labels[key]);\n return values.length > 0 ? values.join(\", \") : undefined;\n}\n\nfunction requestedSeries(props: TimeseriesPanelProps): TimeseriesSeries[] {\n return props.series ?? (props.url ? [{ id: props.url }] : []);\n}\n\nfunction resolveEntry(\n s: TimeseriesSeries,\n index: number,\n props: TimeseriesPanelProps,\n servedUnit?: string,\n): ResolvedSeries {\n const unit = s.unit ?? servedUnit ?? props.unit;\n return {\n key: s.id,\n url: (props.baseUrl ?? \"\") + s.id,\n label: s.label ?? labelValues(s.labels) ?? s.id,\n color: s.color ?? paletteColor(index),\n ...(unit ? { unit } : {}),\n ...(s.transform ? { transform: s.transform } : {}),\n ...(s.load ? { load: s.load } : {}),\n ...(s.current !== undefined ? { current: s.current } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(s.source ? { source: s.source } : {}),\n };\n}\n\n/** Normalises the single-url and baseUrl+series forms to one list. */\nexport function resolveSeries(props: TimeseriesPanelProps): ResolvedSeries[] {\n return requestedSeries(props).map((s, i) => resolveEntry(s, i, props));\n}\n\n/** The series a panel plots, index-aligned with each one's points (undefined while loading). */\nexport interface DisplaySeries {\n series: ResolvedSeries[];\n points: (TimeseriesPoint[] | undefined)[];\n}\n\n/**\n * Resolves what a panel plots from what its requested series were answered\n * with (`served`, index-aligned with the requested series; undefined while a\n * series is loading). A requested id answered by its own series alone keeps\n * the panel's label, color and `current`; an id that expanded into several\n * series plots each one, labelled by its `label` or label values. A series\n * without a unit of its own takes the served unit, then the panel `unit`.\n */\nexport function expandServedSeries(\n props: TimeseriesPanelProps,\n served: readonly (readonly TimeseriesServerSeries[] | undefined)[],\n): DisplaySeries {\n const series: ResolvedSeries[] = [];\n const points: (TimeseriesPoint[] | undefined)[] = [];\n requestedSeries(props).forEach((requested, i) => {\n const answer = served[i];\n const [first] = answer ?? [];\n if (!answer || !first || (answer.length === 1 && first.id === requested.id)) {\n series.push(resolveEntry(requested, series.length, props, first?.unit));\n points.push(answer ? (first?.points ?? []) : undefined);\n return;\n }\n for (const s of answer) {\n const expanded: TimeseriesSeries = {\n id: s.id,\n source: requested.id,\n ...(s.label ? { label: s.label } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(requested.unit ? { unit: requested.unit } : {}),\n ...(requested.transform ? { transform: requested.transform } : {}),\n };\n series.push(resolveEntry(expanded, series.length, props, s.unit));\n points.push(s.points);\n }\n });\n return { series, points };\n}\n\n/** One legend/bar row of the breakdown variant. */\nexport interface BreakdownItem {\n key: string;\n label: string;\n color: string;\n unit?: string;\n /** null when the series' latest sample is a gap (\"no data\"); it counts as nothing toward the total. */\n value: number | null;\n percent: number;\n}\n\n/**\n * One row of the merged chart data: the timestamp in `at` plus each series'\n * value under its key. A series with no sample at this timestamp is absent\n * (`undefined`); one that reported \"no reading\" is an explicit `null`.\n */\nexport interface MergedRow {\n at: string;\n [seriesKey: string]: string | number | null | undefined;\n}\n\nexport function resolveBreakdown(\n series: ResolvedSeries[],\n rows: MergedRow[],\n total?: number,\n): { items: BreakdownItem[]; total: number } {\n // An explicit `current` wins; else the newest sample, where a gap is \"no data\" (null), not 0, and a\n // series that never reported is 0 as before.\n const withValue = series.map((s) => {\n const latest = latestReading(rows, s.key);\n return { s, value: s.current ?? (latest === undefined ? 0 : latest) };\n });\n const denom = total ?? withValue.reduce((acc, w) => acc + (w.value ?? 0), 0);\n const items = withValue.map(({ s, value }) => ({\n key: s.key,\n label: s.label,\n color: s.color,\n ...(s.unit ? { unit: s.unit } : {}),\n value,\n percent: value === null || denom <= 0 ? 0 : Math.min(100, Math.max(0, (value / denom) * 100)),\n }));\n return { items, total: denom };\n}\n\nexport function mergeSeries(\n series: ResolvedSeries[],\n pointsBySeries: (TimeseriesPoint[] | undefined)[],\n): MergedRow[] {\n const rows = new Map<string, MergedRow>();\n series.forEach((s, i) => {\n for (const p of pointsBySeries[i] ?? []) {\n const row = rows.get(p.at) ?? { at: p.at };\n row[s.key] = p.value !== null && s.transform ? s.transform(p.value) : p.value;\n rows.set(p.at, row);\n }\n });\n return [...rows.values()].sort((a, b) => a.at.localeCompare(b.at));\n}\n"],"mappings":";;AAyHA,IAAM,iBA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ACT,OAAO,EAAE;GACT,GAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;GACjC;GACA,SAAS,UAAU,QAAQ,SAAS,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,QAAQ,QAAS,GAAG,CAAC;EAC9F,EACS;EAAO,OAAO;CAAM;AAC/B;AAEA,SAAgB,YACd,QACA,gBACa;CACb,MAAM,uBAAO,IAAI,IAAuB;CACxC,OAAO,SAAS,GAAG,MAAM;EACvB,KAAK,MAAM,KAAK,eAAe,MAAM,CAAC,GAAG;GACvC,MAAM,MAAM,KAAK,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;GACzC,IAAI,EAAE,OAAO,EAAE,UAAU,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE;GACxE,KAAK,IAAI,EAAE,IAAI,GAAG;EACpB;CACF,CAAC;CACD,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AACnE"}
@@ -1,7 +1,8 @@
1
1
  import { StaticIconComponent } from './Icon.js';
2
2
  export interface TimeseriesPoint {
3
3
  at: string;
4
- value: number;
4
+ /** `null` means "no reading at this time": the chart breaks the line there. */
5
+ value: number | null;
5
6
  }
6
7
  export interface TimeseriesResponse {
7
8
  id: string;
@@ -144,16 +145,18 @@ export interface BreakdownItem {
144
145
  label: string;
145
146
  color: string;
146
147
  unit?: string;
147
- value: number;
148
+ /** null when the series' latest sample is a gap ("no data"); it counts as nothing toward the total. */
149
+ value: number | null;
148
150
  percent: number;
149
151
  }
150
152
  /**
151
153
  * One row of the merged chart data: the timestamp in `at` plus each series'
152
- * value under its key.
154
+ * value under its key. A series with no sample at this timestamp is absent
155
+ * (`undefined`); one that reported "no reading" is an explicit `null`.
153
156
  */
154
157
  export interface MergedRow {
155
158
  at: string;
156
- [seriesKey: string]: string | number | undefined;
159
+ [seriesKey: string]: string | number | null | undefined;
157
160
  }
158
161
  export declare function resolveBreakdown(series: ResolvedSeries[], rows: MergedRow[], total?: number): {
159
162
  items: BreakdownItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"TimeseriesPanel.model.d.ts","sourceRoot":"","sources":["../../src/data/TimeseriesPanel.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,MAAM,CAAC,EAAE,MA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a;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzD;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EAAE,EACxB,IAAI,EAAE,SAAS,EAAE,EACjB,KAAK,CAAC,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiB3C;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EAAE,EACxB,cAAc,EAAE,CAAC,eAAe,EAAE,GAAG,SAAS,CAAC,EAAE,GAChD,SAAS,EAAE,CAUb"}
@@ -1,4 +1,4 @@
1
- import { latestOf } from "./TimeseriesPanel.axes.js";
1
+ import { latestReading } from "./TimeseriesPanel.axes.js";
2
2
  // src/data/TimeseriesPanel.model.ts
3
3
  var SERIES_PALETTE = [
4
4
  "var(--chart-1, #3b82f6)",
@@ -75,11 +75,14 @@ function expandServedSeries(props, served) {
75
75
  };
76
76
  }
77
77
  function resolveBreakdown(series, rows, total) {
78
- const withValue = series.map((s) => ({
79
- s,
80
- value: s.current ?? latestOf(rows, s.key) ?? 0
81
- }));
82
- const denom = total ?? withValue.reduce((acc, w) => acc + w.value, 0);
78
+ const withValue = series.map((s) => {
79
+ const latest = latestReading(rows, s.key);
80
+ return {
81
+ s,
82
+ value: s.current ?? (latest === void 0 ? 0 : latest)
83
+ };
84
+ });
85
+ const denom = total ?? withValue.reduce((acc, w) => acc + (w.value ?? 0), 0);
83
86
  return {
84
87
  items: withValue.map(({ s, value }) => ({
85
88
  key: s.key,
@@ -87,7 +90,7 @@ function resolveBreakdown(series, rows, total) {
87
90
  color: s.color,
88
91
  ...s.unit ? { unit: s.unit } : {},
89
92
  value,
90
- percent: denom > 0 ? Math.min(100, Math.max(0, value / denom * 100)) : 0
93
+ percent: value === null || denom <= 0 ? 0 : Math.min(100, Math.max(0, value / denom * 100))
91
94
  })),
92
95
  total: denom
93
96
  };
@@ -97,7 +100,7 @@ function mergeSeries(series, pointsBySeries) {
97
100
  series.forEach((s, i) => {
98
101
  for (const p of pointsBySeries[i] ?? []) {
99
102
  const row = rows.get(p.at) ?? { at: p.at };
100
- row[s.key] = s.transform ? s.transform(p.value) : p.value;
103
+ row[s.key] = p.value !== null && s.transform ? s.transform(p.value) : p.value;
101
104
  rows.set(p.at, row);
102
105
  }
103
106
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TimeseriesPanel.model.js","names":[],"sources":["../../src/data/TimeseriesPanel.model.ts"],"sourcesContent":["import type { StaticIconComponent } from \"./Icon\";\nimport { latestOf } from \"./TimeseriesPanel.axes\";\n\nexport interface TimeseriesPoint {\n at: string;\n value: number;\n}\n\nexport interface TimeseriesResponse {\n id: string;\n points: TimeseriesPoint[];\n}\n\n/**\n * One series as the metrics stream serves it. `source` is the id a panel\n * requested; one requested id can expand into several series (a profile\n * grouped by pod, say), each with its own `id` (`<source>#<labels>`) and\n * `labels`. For a plain metric id, `id === source`.\n */\nexport interface TimeseriesServerSeries {\n id: string;\n source: string;\n label?: string;\n labels?: Record<string, string>;\n /** A `formatUnit` key, used when the panel series names no unit. */\n unit?: string;\n points: TimeseriesPoint[];\n}\n\n/** What a {@link SeriesLoader} receives from the widget polling it. */\nexport interface SeriesLoadContext {\n /** The widget's look-back window, e.g. \"1h\". */\n range: string;\n /** Aborted when the query is cancelled, e.g. the widget unmounts mid-request. */\n signal: AbortSignal;\n}\n\n/**\n * Loads a series directly, instead of the widget requesting `baseUrl + id`\n * through its `fetcher`. Called again whenever the range changes and on every\n * poll.\n */\nexport type SeriesLoader = (ctx: SeriesLoadContext) => Promise<TimeseriesResponse>;\n\n/**\n * One metric plotted on a panel. Its request URL is `baseUrl + id`, unless a\n * `load` function supplies the data.\n */\nexport interface TimeseriesSeries {\n /**\n * Metric id appended to the panel's baseUrl, e.g. \"sqlserver.iops.read\".\n * With `load`, the id is the series' cache identity instead: loaded series\n * are cached under `[\"timeseries\", \"load\", id, range]`, so it must be unique\n * per data source (two series sharing an id share one cached response).\n */\n id: string;\n /** Loads the series' points; when set, `baseUrl` and `fetcher` are not used. */\n load?: SeriesLoader;\n /** Tooltip/legend label; defaults to the `labels` values, then the id. */\n label?: string;\n /** The series' label set, e.g. `{ pod: \"api\" }`; its values label the series when `label` is unset. */\n labels?: Record<string, string>;\n /**\n * The requested id this series was expanded from, when one id answers with\n * several series (see {@link TimeseriesServerSeries}). Unset on requested series.\n */\n source?: string;\n /**\n * Maps each point's value before plotting, e.g. writes pass `(v) => -v` to\n * render below the zero axis. Identity when omitted.\n */\n transform?: (value: number) => number;\n /**\n * Stroke/fill override as a CSS color value or a Tailwind color class.\n * Defaults cycle a small palette by index.\n */\n color?: string;\n /**\n * Grafana-style unit key for this series' readout/tooltip. Falls back to the\n * panel-level `unit`.\n */\n unit?: string;\n /**\n * Instantaneous value for the `breakdown` variant. When omitted, the\n * breakdown falls back to the latest polled point.\n */\n current?: number;\n}\n\n/** A horizontal marker line at a fixed value, e.g. a static capacity. */\nexport interface TimeseriesReferenceLine {\n value: number;\n /** Legend label, e.g. \"capacity\". */\n label: string;\n /** CSS color value or Tailwind color class; defaults to the muted foreground. */\n color?: string;\n /** Grafana-style unit key for the legend value; falls back to the panel `unit`. */\n unit?: string;\n}\n\nexport interface TimeseriesPanelProps {\n url?: string;\n baseUrl?: string;\n series?: TimeseriesSeries[];\n title: string;\n icon?: string | StaticIconComponent;\n unit?: string;\n range?: string;\n refreshMs?: number;\n height?: number;\n variant?: \"area\" | \"line\" | \"stacked\" | \"breakdown\";\n expandVariant?: \"area\" | \"line\" | \"stacked\";\n total?: number;\n /** Flat lines drawn across the time-series chart, e.g. a fixed capacity. */\n referenceLines?: TimeseriesReferenceLine[];\n expandable?: boolean;\n fetcher?: (url: string) => Promise<TimeseriesResponse>;\n className?: string;\n}\n\nconst SERIES_PALETTE = [\n \"var(--chart-1, #3b82f6)\",\n \"var(--chart-2, #ef4444)\",\n \"var(--chart-3, #10b981)\",\n \"var(--chart-4, #f59e0b)\",\n] as const;\n\nfunction paletteColor(index: number): string {\n return SERIES_PALETTE[index % SERIES_PALETTE.length] ?? SERIES_PALETTE[0];\n}\n\n/** A series with its full request URL, resolved label, color, and unit. */\nexport interface ResolvedSeries {\n key: string;\n url: string;\n label: string;\n color: string;\n unit?: string;\n transform?: (value: number) => number;\n load?: SeriesLoader;\n current?: number;\n labels?: Record<string, string>;\n /** The requested id an expanded series came from; unset on requested series. */\n source?: string;\n}\n\n/** The label-set values in key order, e.g. `{ pod: \"api\", ns: \"x\" }` → \"x, api\". */\nfunction labelValues(labels: Record<string, string> | undefined): string | undefined {\n if (!labels) return undefined;\n const values = Object.keys(labels)\n .sort()\n .map((key) => labels[key]);\n return values.length > 0 ? values.join(\", \") : undefined;\n}\n\nfunction requestedSeries(props: TimeseriesPanelProps): TimeseriesSeries[] {\n return props.series ?? (props.url ? [{ id: props.url }] : []);\n}\n\nfunction resolveEntry(\n s: TimeseriesSeries,\n index: number,\n props: TimeseriesPanelProps,\n servedUnit?: string,\n): ResolvedSeries {\n const unit = s.unit ?? servedUnit ?? props.unit;\n return {\n key: s.id,\n url: (props.baseUrl ?? \"\") + s.id,\n label: s.label ?? labelValues(s.labels) ?? s.id,\n color: s.color ?? paletteColor(index),\n ...(unit ? { unit } : {}),\n ...(s.transform ? { transform: s.transform } : {}),\n ...(s.load ? { load: s.load } : {}),\n ...(s.current !== undefined ? { current: s.current } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(s.source ? { source: s.source } : {}),\n };\n}\n\n/** Normalises the single-url and baseUrl+series forms to one list. */\nexport function resolveSeries(props: TimeseriesPanelProps): ResolvedSeries[] {\n return requestedSeries(props).map((s, i) => resolveEntry(s, i, props));\n}\n\n/** The series a panel plots, index-aligned with each one's points (undefined while loading). */\nexport interface DisplaySeries {\n series: ResolvedSeries[];\n points: (TimeseriesPoint[] | undefined)[];\n}\n\n/**\n * Resolves what a panel plots from what its requested series were answered\n * with (`served`, index-aligned with the requested series; undefined while a\n * series is loading). A requested id answered by its own series alone keeps\n * the panel's label, color and `current`; an id that expanded into several\n * series plots each one, labelled by its `label` or label values. A series\n * without a unit of its own takes the served unit, then the panel `unit`.\n */\nexport function expandServedSeries(\n props: TimeseriesPanelProps,\n served: readonly (readonly TimeseriesServerSeries[] | undefined)[],\n): DisplaySeries {\n const series: ResolvedSeries[] = [];\n const points: (TimeseriesPoint[] | undefined)[] = [];\n requestedSeries(props).forEach((requested, i) => {\n const answer = served[i];\n const [first] = answer ?? [];\n if (!answer || !first || (answer.length === 1 && first.id === requested.id)) {\n series.push(resolveEntry(requested, series.length, props, first?.unit));\n points.push(answer ? (first?.points ?? []) : undefined);\n return;\n }\n for (const s of answer) {\n const expanded: TimeseriesSeries = {\n id: s.id,\n source: requested.id,\n ...(s.label ? { label: s.label } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(requested.unit ? { unit: requested.unit } : {}),\n ...(requested.transform ? { transform: requested.transform } : {}),\n };\n series.push(resolveEntry(expanded, series.length, props, s.unit));\n points.push(s.points);\n }\n });\n return { series, points };\n}\n\n/** One legend/bar row of the breakdown variant. */\nexport interface BreakdownItem {\n key: string;\n label: string;\n color: string;\n unit?: string;\n value: number;\n percent: number;\n}\n\n/**\n * One row of the merged chart data: the timestamp in `at` plus each series'\n * value under its key.\n */\nexport interface MergedRow {\n at: string;\n [seriesKey: string]: string | number | undefined;\n}\n\nexport function resolveBreakdown(\n series: ResolvedSeries[],\n rows: MergedRow[],\n total?: number,\n): { items: BreakdownItem[]; total: number } {\n const withValue = series.map((s) => ({ s, value: s.current ?? latestOf(rows, s.key) ?? 0 }));\n const denom = total ?? withValue.reduce((acc, w) => acc + w.value, 0);\n const items = withValue.map(({ s, value }) => ({\n key: s.key,\n label: s.label,\n color: s.color,\n ...(s.unit ? { unit: s.unit } : {}),\n value,\n percent: denom > 0 ? Math.min(100, Math.max(0, (value / denom) * 100)) : 0,\n }));\n return { items, total: denom };\n}\n\nexport function mergeSeries(\n series: ResolvedSeries[],\n pointsBySeries: (TimeseriesPoint[] | undefined)[],\n): MergedRow[] {\n const rows = new Map<string, MergedRow>();\n series.forEach((s, i) => {\n for (const p of pointsBySeries[i] ?? []) {\n const row = rows.get(p.at) ?? { at: p.at };\n row[s.key] = s.transform ? s.transform(p.value) : p.value;\n rows.set(p.at, row);\n }\n });\n return [...rows.values()].sort((a, b) => a.at.localeCompare(b.at));\n}\n"],"mappings":";;AAwHA,IAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AAEA,SAAS,aAAa,OAAuB;CAC3C,OAAO,eAAe,QAAQ,eAAe,WAAW,eAAe;AACzE;;AAkBA,SAAS,YAAY,QAAgE;CACnF,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,SAAS,OAAO,KAAK,MAAM,CAAC,CAC/B,KAAK,CAAC,CACN,KAAK,QAAQ,OAAO,IAAI;CAC3B,OAAO,OAAO,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,KAAA;AACjD;AAEA,SAAS,gBAAgB,OAAiD;CACxE,OAAO,MAAM,WAAW,MAAM,MAAM,CAAC,EAAE,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC;AAC7D;AAEA,SAAS,aACP,GACA,OACA,OACA,YACgB;CAChB,MAAM,OAAO,EAAE,QAAQ,cAAc,MAAM;CAC3C,OAAO;EACL,KAAK,EAAE;EACP,MAAM,MAAM,WAAW,MAAM,EAAE;EAC/B,OAAO,EAAE,SAAS,YAAY,EAAE,MAAM,KA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/data/TimeseriesPanel.model.ts"],"sourcesContent":["import type { StaticIconComponent } from \"./Icon\";\nimport { latestReading } from \"./TimeseriesPanel.axes\";\n\nexport interface TimeseriesPoint {\n at: string;\n /** `null` means \"no reading at this time\": the chart breaks the line there. */\n value: number | null;\n}\n\nexport interface TimeseriesResponse {\n id: string;\n points: TimeseriesPoint[];\n}\n\n/**\n * One series as the metrics stream serves it. `source` is the id a panel\n * requested; one requested id can expand into several series (a profile\n * grouped by pod, say), each with its own `id` (`<source>#<labels>`) and\n * `labels`. For a plain metric id, `id === source`.\n */\nexport interface TimeseriesServerSeries {\n id: string;\n source: string;\n label?: string;\n labels?: Record<string, string>;\n /** A `formatUnit` key, used when the panel series names no unit. */\n unit?: string;\n points: TimeseriesPoint[];\n}\n\n/** What a {@link SeriesLoader} receives from the widget polling it. */\nexport interface SeriesLoadContext {\n /** The widget's look-back window, e.g. \"1h\". */\n range: string;\n /** Aborted when the query is cancelled, e.g. the widget unmounts mid-request. */\n signal: AbortSignal;\n}\n\n/**\n * Loads a series directly, instead of the widget requesting `baseUrl + id`\n * through its `fetcher`. Called again whenever the range changes and on every\n * poll.\n */\nexport type SeriesLoader = (ctx: SeriesLoadContext) => Promise<TimeseriesResponse>;\n\n/**\n * One metric plotted on a panel. Its request URL is `baseUrl + id`, unless a\n * `load` function supplies the data.\n */\nexport interface TimeseriesSeries {\n /**\n * Metric id appended to the panel's baseUrl, e.g. \"sqlserver.iops.read\".\n * With `load`, the id is the series' cache identity instead: loaded series\n * are cached under `[\"timeseries\", \"load\", id, range]`, so it must be unique\n * per data source (two series sharing an id share one cached response).\n */\n id: string;\n /** Loads the series' points; when set, `baseUrl` and `fetcher` are not used. */\n load?: SeriesLoader;\n /** Tooltip/legend label; defaults to the `labels` values, then the id. */\n label?: string;\n /** The series' label set, e.g. `{ pod: \"api\" }`; its values label the series when `label` is unset. */\n labels?: Record<string, string>;\n /**\n * The requested id this series was expanded from, when one id answers with\n * several series (see {@link TimeseriesServerSeries}). Unset on requested series.\n */\n source?: string;\n /**\n * Maps each point's value before plotting, e.g. writes pass `(v) => -v` to\n * render below the zero axis. Identity when omitted.\n */\n transform?: (value: number) => number;\n /**\n * Stroke/fill override as a CSS color value or a Tailwind color class.\n * Defaults cycle a small palette by index.\n */\n color?: string;\n /**\n * Grafana-style unit key for this series' readout/tooltip. Falls back to the\n * panel-level `unit`.\n */\n unit?: string;\n /**\n * Instantaneous value for the `breakdown` variant. When omitted, the\n * breakdown falls back to the latest polled point.\n */\n current?: number;\n}\n\n/** A horizontal marker line at a fixed value, e.g. a static capacity. */\nexport interface TimeseriesReferenceLine {\n value: number;\n /** Legend label, e.g. \"capacity\". */\n label: string;\n /** CSS color value or Tailwind color class; defaults to the muted foreground. */\n color?: string;\n /** Grafana-style unit key for the legend value; falls back to the panel `unit`. */\n unit?: string;\n}\n\nexport interface TimeseriesPanelProps {\n url?: string;\n baseUrl?: string;\n series?: TimeseriesSeries[];\n title: string;\n icon?: string | StaticIconComponent;\n unit?: string;\n range?: string;\n refreshMs?: number;\n height?: number;\n variant?: \"area\" | \"line\" | \"stacked\" | \"breakdown\";\n expandVariant?: \"area\" | \"line\" | \"stacked\";\n total?: number;\n /** Flat lines drawn across the time-series chart, e.g. a fixed capacity. */\n referenceLines?: TimeseriesReferenceLine[];\n expandable?: boolean;\n fetcher?: (url: string) => Promise<TimeseriesResponse>;\n className?: string;\n}\n\nconst SERIES_PALETTE = [\n \"var(--chart-1, #3b82f6)\",\n \"var(--chart-2, #ef4444)\",\n \"var(--chart-3, #10b981)\",\n \"var(--chart-4, #f59e0b)\",\n] as const;\n\nfunction paletteColor(index: number): string {\n return SERIES_PALETTE[index % SERIES_PALETTE.length] ?? SERIES_PALETTE[0];\n}\n\n/** A series with its full request URL, resolved label, color, and unit. */\nexport interface ResolvedSeries {\n key: string;\n url: string;\n label: string;\n color: string;\n unit?: string;\n transform?: (value: number) => number;\n load?: SeriesLoader;\n current?: number;\n labels?: Record<string, string>;\n /** The requested id an expanded series came from; unset on requested series. */\n source?: string;\n}\n\n/** The label-set values in key order, e.g. `{ pod: \"api\", ns: \"x\" }` → \"x, api\". */\nfunction labelValues(labels: Record<string, string> | undefined): string | undefined {\n if (!labels) return undefined;\n const values = Object.keys(labels)\n .sort()\n .map((key) => labels[key]);\n return values.length > 0 ? values.join(\", \") : undefined;\n}\n\nfunction requestedSeries(props: TimeseriesPanelProps): TimeseriesSeries[] {\n return props.series ?? (props.url ? [{ id: props.url }] : []);\n}\n\nfunction resolveEntry(\n s: TimeseriesSeries,\n index: number,\n props: TimeseriesPanelProps,\n servedUnit?: string,\n): ResolvedSeries {\n const unit = s.unit ?? servedUnit ?? props.unit;\n return {\n key: s.id,\n url: (props.baseUrl ?? \"\") + s.id,\n label: s.label ?? labelValues(s.labels) ?? s.id,\n color: s.color ?? paletteColor(index),\n ...(unit ? { unit } : {}),\n ...(s.transform ? { transform: s.transform } : {}),\n ...(s.load ? { load: s.load } : {}),\n ...(s.current !== undefined ? { current: s.current } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(s.source ? { source: s.source } : {}),\n };\n}\n\n/** Normalises the single-url and baseUrl+series forms to one list. */\nexport function resolveSeries(props: TimeseriesPanelProps): ResolvedSeries[] {\n return requestedSeries(props).map((s, i) => resolveEntry(s, i, props));\n}\n\n/** The series a panel plots, index-aligned with each one's points (undefined while loading). */\nexport interface DisplaySeries {\n series: ResolvedSeries[];\n points: (TimeseriesPoint[] | undefined)[];\n}\n\n/**\n * Resolves what a panel plots from what its requested series were answered\n * with (`served`, index-aligned with the requested series; undefined while a\n * series is loading). A requested id answered by its own series alone keeps\n * the panel's label, color and `current`; an id that expanded into several\n * series plots each one, labelled by its `label` or label values. A series\n * without a unit of its own takes the served unit, then the panel `unit`.\n */\nexport function expandServedSeries(\n props: TimeseriesPanelProps,\n served: readonly (readonly TimeseriesServerSeries[] | undefined)[],\n): DisplaySeries {\n const series: ResolvedSeries[] = [];\n const points: (TimeseriesPoint[] | undefined)[] = [];\n requestedSeries(props).forEach((requested, i) => {\n const answer = served[i];\n const [first] = answer ?? [];\n if (!answer || !first || (answer.length === 1 && first.id === requested.id)) {\n series.push(resolveEntry(requested, series.length, props, first?.unit));\n points.push(answer ? (first?.points ?? []) : undefined);\n return;\n }\n for (const s of answer) {\n const expanded: TimeseriesSeries = {\n id: s.id,\n source: requested.id,\n ...(s.label ? { label: s.label } : {}),\n ...(s.labels ? { labels: s.labels } : {}),\n ...(requested.unit ? { unit: requested.unit } : {}),\n ...(requested.transform ? { transform: requested.transform } : {}),\n };\n series.push(resolveEntry(expanded, series.length, props, s.unit));\n points.push(s.points);\n }\n });\n return { series, points };\n}\n\n/** One legend/bar row of the breakdown variant. */\nexport interface BreakdownItem {\n key: string;\n label: string;\n color: string;\n unit?: string;\n /** null when the series' latest sample is a gap (\"no data\"); it counts as nothing toward the total. */\n value: number | null;\n percent: number;\n}\n\n/**\n * One row of the merged chart data: the timestamp in `at` plus each series'\n * value under its key. A series with no sample at this timestamp is absent\n * (`undefined`); one that reported \"no reading\" is an explicit `null`.\n */\nexport interface MergedRow {\n at: string;\n [seriesKey: string]: string | number | null | undefined;\n}\n\nexport function resolveBreakdown(\n series: ResolvedSeries[],\n rows: MergedRow[],\n total?: number,\n): { items: BreakdownItem[]; total: number } {\n // An explicit `current` wins; else the newest sample, where a gap is \"no data\" (null), not 0, and a\n // series that never reported is 0 as before.\n const withValue = series.map((s) => {\n const latest = latestReading(rows, s.key);\n return { s, value: s.current ?? (latest === undefined ? 0 : latest) };\n });\n const denom = total ?? withValue.reduce((acc, w) => acc + (w.value ?? 0), 0);\n const items = withValue.map(({ s, value }) => ({\n key: s.key,\n label: s.label,\n color: s.color,\n ...(s.unit ? { unit: s.unit } : {}),\n value,\n percent: value === null || denom <= 0 ? 0 : Math.min(100, Math.max(0, (value / denom) * 100)),\n }));\n return { items, total: denom };\n}\n\nexport function mergeSeries(\n series: ResolvedSeries[],\n pointsBySeries: (TimeseriesPoint[] | undefined)[],\n): MergedRow[] {\n const rows = new Map<string, MergedRow>();\n series.forEach((s, i) => {\n for (const p of pointsBySeries[i] ?? []) {\n const row = rows.get(p.at) ?? { at: p.at };\n row[s.key] = p.value !== null && s.transform ? s.transform(p.value) : p.value;\n rows.set(p.at, row);\n }\n });\n return [...rows.values()].sort((a, b) => a.at.localeCompare(b.at));\n}\n"],"mappings":";;AAyHA,IAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AAEA,SAAS,aAAa,OAAuB;CAC3C,OAAO,eAAe,QAAQ,eAAe,WAAW,eAAe;AACzE;;AAkBA,SAAS,YAAY,QAAgE;CACnF,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,SAAS,OAAO,KAAK,MAAM,CAAC,CAC/B,KAAK,CAAC,CACN,KAAK,QAAQ,OAAO,IAAI;CAC3B,OAAO,OAAO,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,KAAA;AACjD;AAEA,SAAS,gBAAgB,OAAiD;CACxE,OAAO,MAAM,WAAW,MAAM,MAAM,CAAC,EAAE,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC;AAC7D;AAEA,SAAS,aACP,GACA,OACA,OACA,YACgB;CAChB,MAAM,OAAO,EAAE,QAAQ,cAAc,MAAM;CAC3C,OAAO;EACL,KAAK,EAAE;EACP,MAAM,MAAM,WAAW,MAAM,EAAE;EAC/B,OAAO,EAAE,SAAS,YAAY,EAAE,MAAM,KAAK,EAAE;EAC7C,OAAO,EAAE,SAAS,aAAa,KAAK;EACpC,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;EACvB,GAAI,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,IAAI,CAAC;EAChD,GAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;EACjC,GAAI,EAAE,YAAY,KAAA,IAAY,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;EACxD,GAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC;EACvC,GAAI,EA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AAE,YAAY,WAAW,KAAA,IAAY,IAAI;EAAQ;CACtE,CAAC;CACD,MAAM,QAAQ,SAAS,UAAU,QAAQ,KAAK,MAAM,OAAO,EAAE,SAAS,IAAI,CAAC;CAS3E,OAAO;EAAE,OARK,UAAU,KAAK,EAAE,GAAG,aAAa;GAC7C,KAAK,EAAE;GACP,OAAO,EAAE;GACT,OAAO,EAAE;GACT,GAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;GACjC;GACA,SAAS,UAAU,QAAQ,SAAS,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,QAAQ,QAAS,GAAG,CAAC;EAC9F,EACS;EAAO,OAAO;CAAM;AAC/B;AAEA,SAAgB,YACd,QACA,gBACa;CACb,MAAM,uBAAO,IAAI,IAAuB;CACxC,OAAO,SAAS,GAAG,MAAM;EACvB,KAAK,MAAM,KAAK,eAAe,MAAM,CAAC,GAAG;GACvC,MAAM,MAAM,KAAK,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;GACzC,IAAI,EAAE,OAAO,EAAE,UAAU,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE;GACxE,KAAK,IAAI,EAAE,IAAI,GAAG;EACpB;CACF,CAAC;CACD,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AACnE"}
@@ -0,0 +1,11 @@
1
+ const require_format = require("../lib/format.cjs");
2
+ // src/data/TimeseriesPanel.readout.ts
3
+ var NO_DATA_LABEL = "no data";
4
+ /** A series value as shown in the legend, header readout and tooltip: a magnitude with its unit, or "no data" for a gap. */
5
+ function formatReading(value, unit) {
6
+ return value === null ? NO_DATA_LABEL : require_format.formatUnit(Math.abs(value), unit);
7
+ }
8
+ exports.NO_DATA_LABEL = NO_DATA_LABEL;
9
+ exports.formatReading = formatReading;
10
+
11
+ //# sourceMappingURL=TimeseriesPanel.readout.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeseriesPanel.readout.cjs","names":["formatUnit"],"sources":["../../src/data/TimeseriesPanel.readout.ts"],"sourcesContent":["import { formatUnit } from \"../lib/format\";\n\nexport const NO_DATA_LABEL = \"no data\";\n\n/** A series value as shown in the legend, header readout and tooltip: a magnitude with its unit, or \"no data\" for a gap. */\nexport function formatReading(value: number | null, unit: string | undefined): string {\n return value === null ? NO_DATA_LABEL : formatUnit(Math.abs(value), unit);\n}\n"],"mappings":";;AAEA,IAAa,gBAAgB;;AAG7B,SAAgB,cAAc,OAAsB,MAAkC;CACpF,OAAO,UAAU,OAAO,gBAAgBA,eAAAA,WAAW,KAAK,IAAI,KAAK,GAAG,IAAI;AAC1E"}
@@ -0,0 +1,4 @@
1
+ export declare const NO_DATA_LABEL = "no data";
2
+ /** A series value as shown in the legend, header readout and tooltip: a magnitude with its unit, or "no data" for a gap. */
3
+ export declare function formatReading(value: number | null, unit: string | undefined): string;
4
+ //# sourceMappingURL=TimeseriesPanel.readout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeseriesPanel.readout.d.ts","sourceRoot":"","sources":["../../src/data/TimeseriesPanel.readout.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,4HAA4H;AAC5H,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEpF"}
@@ -0,0 +1,10 @@
1
+ import { formatUnit } from "../lib/format.js";
2
+ // src/data/TimeseriesPanel.readout.ts
3
+ var NO_DATA_LABEL = "no data";
4
+ /** A series value as shown in the legend, header readout and tooltip: a magnitude with its unit, or "no data" for a gap. */
5
+ function formatReading(value, unit) {
6
+ return value === null ? NO_DATA_LABEL : formatUnit(Math.abs(value), unit);
7
+ }
8
+ export { NO_DATA_LABEL, formatReading };
9
+
10
+ //# sourceMappingURL=TimeseriesPanel.readout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeseriesPanel.readout.js","names":[],"sources":["../../src/data/TimeseriesPanel.readout.ts"],"sourcesContent":["import { formatUnit } from \"../lib/format\";\n\nexport const NO_DATA_LABEL = \"no data\";\n\n/** A series value as shown in the legend, header readout and tooltip: a magnitude with its unit, or \"no data\" for a gap. */\nexport function formatReading(value: number | null, unit: string | undefined): string {\n return value === null ? NO_DATA_LABEL : formatUnit(Math.abs(value), unit);\n}\n"],"mappings":";;AAEA,IAAa,gBAAgB;;AAG7B,SAAgB,cAAc,OAAsB,MAAkC;CACpF,OAAO,UAAU,OAAO,gBAAgB,WAAW,KAAK,IAAI,KAAK,GAAG,IAAI;AAC1E"}