@flanksource/clicky-ui 0.3.78 → 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 (745) hide show
  1. package/dist/ai.cjs +2 -2
  2. package/dist/ai.js +2 -2
  3. package/dist/comments/CommentThreadList.cjs +13 -14
  4. package/dist/comments/CommentThreadList.cjs.map +1 -1
  5. package/dist/comments/CommentThreadList.d.ts.map +1 -1
  6. package/dist/comments/CommentThreadList.js +13 -14
  7. package/dist/comments/CommentThreadList.js.map +1 -1
  8. package/dist/components/EndpointSelector.cjs +7 -1
  9. package/dist/components/EndpointSelector.cjs.map +1 -1
  10. package/dist/components/EndpointSelector.d.ts.map +1 -1
  11. package/dist/components/EndpointSelector.js +7 -1
  12. package/dist/components/EndpointSelector.js.map +1 -1
  13. package/dist/components/FilterBar.cjs +36 -12
  14. package/dist/components/FilterBar.cjs.map +1 -1
  15. package/dist/components/FilterBar.d.ts +14 -2
  16. package/dist/components/FilterBar.d.ts.map +1 -1
  17. package/dist/components/FilterBar.js +36 -12
  18. package/dist/components/FilterBar.js.map +1 -1
  19. package/dist/components/FormLookupProvider.cjs +12 -4
  20. package/dist/components/FormLookupProvider.cjs.map +1 -1
  21. package/dist/components/FormLookupProvider.d.ts.map +1 -1
  22. package/dist/components/FormLookupProvider.js +13 -5
  23. package/dist/components/FormLookupProvider.js.map +1 -1
  24. package/dist/components/JSONPathPlayground.cjs +124 -233
  25. package/dist/components/JSONPathPlayground.cjs.map +1 -1
  26. package/dist/components/JSONPathPlayground.d.ts +15 -13
  27. package/dist/components/JSONPathPlayground.d.ts.map +1 -1
  28. package/dist/components/JSONPathPlayground.js +125 -234
  29. package/dist/components/JSONPathPlayground.js.map +1 -1
  30. package/dist/components/JsonSchemaForm.cjs +6 -0
  31. package/dist/components/JsonSchemaForm.cjs.map +1 -1
  32. package/dist/components/JsonSchemaForm.js +6 -0
  33. package/dist/components/JsonSchemaForm.js.map +1 -1
  34. package/dist/components/SegmentedControl.cjs +1 -1
  35. package/dist/components/SegmentedControl.cjs.map +1 -1
  36. package/dist/components/SegmentedControl.d.ts.map +1 -1
  37. package/dist/components/SegmentedControl.js +1 -1
  38. package/dist/components/SegmentedControl.js.map +1 -1
  39. package/dist/components/TimeRange.cjs +133 -60
  40. package/dist/components/TimeRange.cjs.map +1 -1
  41. package/dist/components/TimeRange.d.ts +8 -1
  42. package/dist/components/TimeRange.d.ts.map +1 -1
  43. package/dist/components/TimeRange.js +133 -60
  44. package/dist/components/TimeRange.js.map +1 -1
  45. package/dist/components/json-schema-form-accordion-array.cjs +8 -6
  46. package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
  47. package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
  48. package/dist/components/json-schema-form-accordion-array.js +9 -7
  49. package/dist/components/json-schema-form-accordion-array.js.map +1 -1
  50. package/dist/components/json-schema-form-array-rows.cjs +45 -0
  51. package/dist/components/json-schema-form-array-rows.cjs.map +1 -0
  52. package/dist/components/json-schema-form-array-rows.d.ts +10 -0
  53. package/dist/components/json-schema-form-array-rows.d.ts.map +1 -0
  54. package/dist/components/json-schema-form-array-rows.js +45 -0
  55. package/dist/components/json-schema-form-array-rows.js.map +1 -0
  56. package/dist/components/json-schema-form-item-summary.cjs +3 -5
  57. package/dist/components/json-schema-form-item-summary.cjs.map +1 -1
  58. package/dist/components/json-schema-form-item-summary.d.ts +1 -1
  59. package/dist/components/json-schema-form-item-summary.d.ts.map +1 -1
  60. package/dist/components/json-schema-form-item-summary.js +3 -5
  61. package/dist/components/json-schema-form-item-summary.js.map +1 -1
  62. package/dist/components/json-schema-form-render.cjs +11 -2
  63. package/dist/components/json-schema-form-render.cjs.map +1 -1
  64. package/dist/components/json-schema-form-render.d.ts.map +1 -1
  65. package/dist/components/json-schema-form-render.js +12 -3
  66. package/dist/components/json-schema-form-render.js.map +1 -1
  67. package/dist/components/json-schema-form-resolve.cjs +10 -0
  68. package/dist/components/json-schema-form-resolve.cjs.map +1 -1
  69. package/dist/components/json-schema-form-resolve.d.ts +1 -0
  70. package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
  71. package/dist/components/json-schema-form-resolve.js +10 -1
  72. package/dist/components/json-schema-form-resolve.js.map +1 -1
  73. package/dist/components/json-schema-form-runtime-types.d.ts +4 -0
  74. package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
  75. package/dist/components/json-schema-form-table-array.cjs +25 -16
  76. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  77. package/dist/components/json-schema-form-table-array.d.ts +1 -1
  78. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  79. package/dist/components/json-schema-form-table-array.js +26 -17
  80. package/dist/components/json-schema-form-table-array.js.map +1 -1
  81. package/dist/components/json-schema-form-types.d.ts +0 -2
  82. package/dist/components/json-schema-form-types.d.ts.map +1 -1
  83. package/dist/components/jsonPathPlaygroundEvaluator.cjs +53 -0
  84. package/dist/components/jsonPathPlaygroundEvaluator.cjs.map +1 -0
  85. package/dist/components/jsonPathPlaygroundEvaluator.d.ts +23 -0
  86. package/dist/components/jsonPathPlaygroundEvaluator.d.ts.map +1 -0
  87. package/dist/components/jsonPathPlaygroundEvaluator.js +53 -0
  88. package/dist/components/jsonPathPlaygroundEvaluator.js.map +1 -0
  89. package/dist/components/jsonPathTree.cjs +1 -0
  90. package/dist/components/jsonPathTree.cjs.map +1 -1
  91. package/dist/components/jsonPathTree.d.ts +6 -0
  92. package/dist/components/jsonPathTree.d.ts.map +1 -1
  93. package/dist/components/jsonPathTree.js +1 -0
  94. package/dist/components/jsonPathTree.js.map +1 -1
  95. package/dist/data/Clicky.cjs +37 -18
  96. package/dist/data/Clicky.cjs.map +1 -1
  97. package/dist/data/Clicky.d.ts +5 -0
  98. package/dist/data/Clicky.d.ts.map +1 -1
  99. package/dist/data/Clicky.js +37 -18
  100. package/dist/data/Clicky.js.map +1 -1
  101. package/dist/data/DataTable.cjs +49 -12
  102. package/dist/data/DataTable.cjs.map +1 -1
  103. package/dist/data/DataTable.d.ts +17 -2
  104. package/dist/data/DataTable.d.ts.map +1 -1
  105. package/dist/data/DataTable.js +49 -12
  106. package/dist/data/DataTable.js.map +1 -1
  107. package/dist/data/TaskPoolUsage.cjs +2 -1
  108. package/dist/data/TaskPoolUsage.cjs.map +1 -1
  109. package/dist/data/TaskPoolUsage.d.ts.map +1 -1
  110. package/dist/data/TaskPoolUsage.js +2 -1
  111. package/dist/data/TaskPoolUsage.js.map +1 -1
  112. package/dist/data/TimeseriesPanel.axes.cjs +18 -3
  113. package/dist/data/TimeseriesPanel.axes.cjs.map +1 -1
  114. package/dist/data/TimeseriesPanel.axes.d.ts +10 -1
  115. package/dist/data/TimeseriesPanel.axes.d.ts.map +1 -1
  116. package/dist/data/TimeseriesPanel.axes.js +17 -4
  117. package/dist/data/TimeseriesPanel.axes.js.map +1 -1
  118. package/dist/data/TimeseriesPanel.cjs +57 -23
  119. package/dist/data/TimeseriesPanel.cjs.map +1 -1
  120. package/dist/data/TimeseriesPanel.d.ts.map +1 -1
  121. package/dist/data/TimeseriesPanel.js +59 -25
  122. package/dist/data/TimeseriesPanel.js.map +1 -1
  123. package/dist/data/TimeseriesPanel.model.cjs +10 -7
  124. package/dist/data/TimeseriesPanel.model.cjs.map +1 -1
  125. package/dist/data/TimeseriesPanel.model.d.ts +7 -4
  126. package/dist/data/TimeseriesPanel.model.d.ts.map +1 -1
  127. package/dist/data/TimeseriesPanel.model.js +11 -8
  128. package/dist/data/TimeseriesPanel.model.js.map +1 -1
  129. package/dist/data/TimeseriesPanel.readout.cjs +11 -0
  130. package/dist/data/TimeseriesPanel.readout.cjs.map +1 -0
  131. package/dist/data/TimeseriesPanel.readout.d.ts +4 -0
  132. package/dist/data/TimeseriesPanel.readout.d.ts.map +1 -0
  133. package/dist/data/TimeseriesPanel.readout.js +10 -0
  134. package/dist/data/TimeseriesPanel.readout.js.map +1 -0
  135. package/dist/data/TimeseriesPanel.segments.cjs +67 -0
  136. package/dist/data/TimeseriesPanel.segments.cjs.map +1 -0
  137. package/dist/data/TimeseriesPanel.segments.d.ts +27 -0
  138. package/dist/data/TimeseriesPanel.segments.d.ts.map +1 -0
  139. package/dist/data/TimeseriesPanel.segments.js +67 -0
  140. package/dist/data/TimeseriesPanel.segments.js.map +1 -0
  141. package/dist/data/TreeDataTable.cjs +12 -3
  142. package/dist/data/TreeDataTable.cjs.map +1 -1
  143. package/dist/data/TreeDataTable.d.ts +15 -3
  144. package/dist/data/TreeDataTable.d.ts.map +1 -1
  145. package/dist/data/TreeDataTable.js +12 -3
  146. package/dist/data/TreeDataTable.js.map +1 -1
  147. package/dist/data/TreeNode.cjs +18 -3
  148. package/dist/data/TreeNode.cjs.map +1 -1
  149. package/dist/data/TreeNode.d.ts +7 -1
  150. package/dist/data/TreeNode.d.ts.map +1 -1
  151. package/dist/data/TreeNode.js +18 -3
  152. package/dist/data/TreeNode.js.map +1 -1
  153. package/dist/data/ai/SessionChatComposer.cjs +2 -0
  154. package/dist/data/ai/SessionChatComposer.cjs.map +1 -1
  155. package/dist/data/ai/SessionChatComposer.d.ts.map +1 -1
  156. package/dist/data/ai/SessionChatComposer.js +2 -0
  157. package/dist/data/ai/SessionChatComposer.js.map +1 -1
  158. package/dist/data/ai/SessionInspector.panels.cjs +47 -1
  159. package/dist/data/ai/SessionInspector.panels.cjs.map +1 -1
  160. package/dist/data/ai/SessionInspector.panels.d.ts.map +1 -1
  161. package/dist/data/ai/SessionInspector.panels.js +48 -2
  162. package/dist/data/ai/SessionInspector.panels.js.map +1 -1
  163. package/dist/data/ai/SessionViewer.unified.d.ts +48 -0
  164. package/dist/data/ai/SessionViewer.unified.d.ts.map +1 -1
  165. package/dist/data/ai/index.d.ts +2 -2
  166. package/dist/data/ai/index.d.ts.map +1 -1
  167. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs +97 -100
  168. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs.map +1 -1
  169. package/dist/data/ai/runtime-profiles/PresetWorkspace.d.ts.map +1 -1
  170. package/dist/data/ai/runtime-profiles/PresetWorkspace.js +97 -100
  171. package/dist/data/ai/runtime-profiles/PresetWorkspace.js.map +1 -1
  172. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs +40 -38
  173. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs.map +1 -1
  174. package/dist/data/ai/runtime-profiles/ProfileWorkspace.d.ts.map +1 -1
  175. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js +41 -39
  176. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js.map +1 -1
  177. package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs +53 -0
  178. package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs.map +1 -0
  179. package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts +7 -0
  180. package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts.map +1 -0
  181. package/dist/data/ai/runtime-profiles/ResolutionPreview.js +53 -0
  182. package/dist/data/ai/runtime-profiles/ResolutionPreview.js.map +1 -0
  183. package/dist/data/ai/runtime-profiles/index.d.ts +1 -1
  184. package/dist/data/ai/runtime-profiles/index.d.ts.map +1 -1
  185. package/dist/data/ai/sessionSubmitVariant.cjs +30 -0
  186. package/dist/data/ai/sessionSubmitVariant.cjs.map +1 -0
  187. package/dist/data/ai/sessionSubmitVariant.d.ts +7 -0
  188. package/dist/data/ai/sessionSubmitVariant.d.ts.map +1 -0
  189. package/dist/data/ai/sessionSubmitVariant.js +30 -0
  190. package/dist/data/ai/sessionSubmitVariant.js.map +1 -0
  191. package/dist/data/cells/Timestamp.cjs +15 -4
  192. package/dist/data/cells/Timestamp.cjs.map +1 -1
  193. package/dist/data/cells/Timestamp.d.ts.map +1 -1
  194. package/dist/data/cells/Timestamp.js +15 -4
  195. package/dist/data/cells/Timestamp.js.map +1 -1
  196. package/dist/data/cells/timestamp-format.cjs +28 -8
  197. package/dist/data/cells/timestamp-format.cjs.map +1 -1
  198. package/dist/data/cells/timestamp-format.d.ts +3 -1
  199. package/dist/data/cells/timestamp-format.d.ts.map +1 -1
  200. package/dist/data/cells/timestamp-format.js +28 -8
  201. package/dist/data/cells/timestamp-format.js.map +1 -1
  202. package/dist/data/charts/TrendChart.cjs +65 -31
  203. package/dist/data/charts/TrendChart.cjs.map +1 -1
  204. package/dist/data/charts/TrendChart.d.ts +12 -3
  205. package/dist/data/charts/TrendChart.d.ts.map +1 -1
  206. package/dist/data/charts/TrendChart.js +67 -33
  207. package/dist/data/charts/TrendChart.js.map +1 -1
  208. package/dist/data/charts/index.d.ts +1 -1
  209. package/dist/data/charts/index.d.ts.map +1 -1
  210. package/dist/data/chat/PromptInput.cjs +11 -2
  211. package/dist/data/chat/PromptInput.cjs.map +1 -1
  212. package/dist/data/chat/PromptInput.d.ts +15 -1
  213. package/dist/data/chat/PromptInput.d.ts.map +1 -1
  214. package/dist/data/chat/PromptInput.js +11 -2
  215. package/dist/data/chat/PromptInput.js.map +1 -1
  216. package/dist/data/chat/index.d.ts +1 -1
  217. package/dist/data/chat/index.d.ts.map +1 -1
  218. package/dist/data/data-table-filter-values.cjs.map +1 -1
  219. package/dist/data/data-table-filter-values.d.ts +1 -1
  220. package/dist/data/data-table-filter-values.d.ts.map +1 -1
  221. package/dist/data/data-table-filter-values.js.map +1 -1
  222. package/dist/data/data-table-server-filters.cjs +2 -6
  223. package/dist/data/data-table-server-filters.cjs.map +1 -1
  224. package/dist/data/data-table-server-filters.d.ts +1 -1
  225. package/dist/data/data-table-server-filters.d.ts.map +1 -1
  226. package/dist/data/data-table-server-filters.js +1 -5
  227. package/dist/data/data-table-server-filters.js.map +1 -1
  228. package/dist/data/diagnostics/ErrorDetails.cjs +2 -1
  229. package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
  230. package/dist/data/diagnostics/ErrorDetails.d.ts +2 -1
  231. package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
  232. package/dist/data/diagnostics/ErrorDetails.js +2 -1
  233. package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
  234. package/dist/data/gauge-stats.cjs +7 -3
  235. package/dist/data/gauge-stats.cjs.map +1 -1
  236. package/dist/data/gauge-stats.d.ts.map +1 -1
  237. package/dist/data/gauge-stats.js +7 -3
  238. package/dist/data/gauge-stats.js.map +1 -1
  239. package/dist/data/query-browser/QueryBrowser.cjs +41 -17
  240. package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
  241. package/dist/data/query-browser/QueryBrowser.d.ts +1 -1
  242. package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
  243. package/dist/data/query-browser/QueryBrowser.fieldNames.cjs +23 -0
  244. package/dist/data/query-browser/QueryBrowser.fieldNames.cjs.map +1 -0
  245. package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts +11 -0
  246. package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts.map +1 -0
  247. package/dist/data/query-browser/QueryBrowser.fieldNames.js +23 -0
  248. package/dist/data/query-browser/QueryBrowser.fieldNames.js.map +1 -0
  249. package/dist/data/query-browser/QueryBrowser.js +41 -17
  250. package/dist/data/query-browser/QueryBrowser.js.map +1 -1
  251. package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
  252. package/dist/data/query-browser/QueryBrowser.types.d.ts +18 -0
  253. package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
  254. package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
  255. package/dist/data/runtime/RuntimeBarLayout.cjs +3 -2
  256. package/dist/data/runtime/RuntimeBarLayout.cjs.map +1 -1
  257. package/dist/data/runtime/RuntimeBarLayout.d.ts.map +1 -1
  258. package/dist/data/runtime/RuntimeBarLayout.js +3 -2
  259. package/dist/data/runtime/RuntimeBarLayout.js.map +1 -1
  260. package/dist/data/test-runner/TestRunner.cjs +3 -1
  261. package/dist/data/test-runner/TestRunner.cjs.map +1 -1
  262. package/dist/data/test-runner/TestRunner.d.ts +8 -1
  263. package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
  264. package/dist/data/test-runner/TestRunner.js +3 -1
  265. package/dist/data/test-runner/TestRunner.js.map +1 -1
  266. package/dist/data/test-runner/TestTree.cjs +1 -0
  267. package/dist/data/test-runner/TestTree.cjs.map +1 -1
  268. package/dist/data/test-runner/TestTree.d.ts.map +1 -1
  269. package/dist/data/test-runner/TestTree.js +1 -0
  270. package/dist/data/test-runner/TestTree.js.map +1 -1
  271. package/dist/data/test-runner/context.cjs.map +1 -1
  272. package/dist/data/test-runner/context.d.ts +2 -0
  273. package/dist/data/test-runner/context.d.ts.map +1 -1
  274. package/dist/data/test-runner/context.js.map +1 -1
  275. package/dist/data/timeseries-query.cjs +2 -2
  276. package/dist/data/timeseries-query.cjs.map +1 -1
  277. package/dist/data/timeseries-query.d.ts +1 -1
  278. package/dist/data/timeseries-query.d.ts.map +1 -1
  279. package/dist/data/timeseries-query.js +2 -2
  280. package/dist/data/timeseries-query.js.map +1 -1
  281. package/dist/data/version-info.cjs +3 -3
  282. package/dist/data/version-info.js +3 -3
  283. package/dist/data.cjs +1 -0
  284. package/dist/data.d.ts +1 -1
  285. package/dist/data.d.ts.map +1 -1
  286. package/dist/data.js +2 -2
  287. package/dist/expressions/playground/EmbeddedPlayground.cjs +40 -0
  288. package/dist/expressions/playground/EmbeddedPlayground.cjs.map +1 -0
  289. package/dist/expressions/playground/EmbeddedPlayground.d.ts +30 -0
  290. package/dist/expressions/playground/EmbeddedPlayground.d.ts.map +1 -0
  291. package/dist/expressions/playground/EmbeddedPlayground.js +40 -0
  292. package/dist/expressions/playground/EmbeddedPlayground.js.map +1 -0
  293. package/dist/expressions/playground/ExpressionPlayground.cjs +6 -6
  294. package/dist/expressions/playground/ExpressionPlayground.cjs.map +1 -1
  295. package/dist/expressions/playground/ExpressionPlayground.d.ts +10 -3
  296. package/dist/expressions/playground/ExpressionPlayground.d.ts.map +1 -1
  297. package/dist/expressions/playground/ExpressionPlayground.js +6 -6
  298. package/dist/expressions/playground/ExpressionPlayground.js.map +1 -1
  299. package/dist/expressions/playground/LazyEmbeddedPlayground.cjs +22 -0
  300. package/dist/expressions/playground/LazyEmbeddedPlayground.cjs.map +1 -0
  301. package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts +4 -0
  302. package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts.map +1 -0
  303. package/dist/expressions/playground/LazyEmbeddedPlayground.js +22 -0
  304. package/dist/expressions/playground/LazyEmbeddedPlayground.js.map +1 -0
  305. package/dist/expressions/playground/api.cjs.map +1 -1
  306. package/dist/expressions/playground/api.d.ts +10 -0
  307. package/dist/expressions/playground/api.d.ts.map +1 -1
  308. package/dist/expressions/playground/api.js.map +1 -1
  309. package/dist/expressions/playground/hostEvaluation.cjs +67 -0
  310. package/dist/expressions/playground/hostEvaluation.cjs.map +1 -0
  311. package/dist/expressions/playground/hostEvaluation.d.ts +39 -0
  312. package/dist/expressions/playground/hostEvaluation.d.ts.map +1 -0
  313. package/dist/expressions/playground/hostEvaluation.js +63 -0
  314. package/dist/expressions/playground/hostEvaluation.js.map +1 -0
  315. package/dist/expressions/playground/panels/GraphPanel.cjs +8 -3
  316. package/dist/expressions/playground/panels/GraphPanel.cjs.map +1 -1
  317. package/dist/expressions/playground/panels/GraphPanel.d.ts +2 -1
  318. package/dist/expressions/playground/panels/GraphPanel.d.ts.map +1 -1
  319. package/dist/expressions/playground/panels/GraphPanel.js +8 -3
  320. package/dist/expressions/playground/panels/GraphPanel.js.map +1 -1
  321. package/dist/expressions/playground/panels/graphNodes.cjs +6 -2
  322. package/dist/expressions/playground/panels/graphNodes.cjs.map +1 -1
  323. package/dist/expressions/playground/panels/graphNodes.d.ts +6 -2
  324. package/dist/expressions/playground/panels/graphNodes.d.ts.map +1 -1
  325. package/dist/expressions/playground/panels/graphNodes.js +6 -2
  326. package/dist/expressions/playground/panels/graphNodes.js.map +1 -1
  327. package/dist/expressions/playground.d.ts +1 -1
  328. package/dist/expressions/playground.d.ts.map +1 -1
  329. package/dist/hooks/use-element-height.cjs +26 -0
  330. package/dist/hooks/use-element-height.cjs.map +1 -0
  331. package/dist/hooks/use-element-height.d.ts +10 -0
  332. package/dist/hooks/use-element-height.d.ts.map +1 -0
  333. package/dist/hooks/use-element-height.js +26 -0
  334. package/dist/hooks/use-element-height.js.map +1 -0
  335. package/dist/index.cjs +6 -5
  336. package/dist/index.js +7 -7
  337. package/dist/jvm/classes/PatchedClassList.cjs +11 -2
  338. package/dist/jvm/classes/PatchedClassList.cjs.map +1 -1
  339. package/dist/jvm/classes/PatchedClassList.d.ts.map +1 -1
  340. package/dist/jvm/classes/PatchedClassList.js +11 -2
  341. package/dist/jvm/classes/PatchedClassList.js.map +1 -1
  342. package/dist/jvm/fixtures/fake-client.d.ts.map +1 -1
  343. package/dist/jvm/model/patches.cjs +4 -2
  344. package/dist/jvm/model/patches.cjs.map +1 -1
  345. package/dist/jvm/model/patches.d.ts +3 -1
  346. package/dist/jvm/model/patches.d.ts.map +1 -1
  347. package/dist/jvm/model/patches.js +4 -2
  348. package/dist/jvm/model/patches.js.map +1 -1
  349. package/dist/jvm/protocol/client.d.ts +7 -2
  350. package/dist/jvm/protocol/client.d.ts.map +1 -1
  351. package/dist/jvm/protocol/operation-client.cjs +30 -11
  352. package/dist/jvm/protocol/operation-client.cjs.map +1 -1
  353. package/dist/jvm/protocol/operation-client.d.ts.map +1 -1
  354. package/dist/jvm/protocol/operation-client.js +30 -11
  355. package/dist/jvm/protocol/operation-client.js.map +1 -1
  356. package/dist/jvm/protocol/query-keys.cjs +1 -1
  357. package/dist/jvm/protocol/query-keys.cjs.map +1 -1
  358. package/dist/jvm/protocol/query-keys.d.ts +1 -1
  359. package/dist/jvm/protocol/query-keys.d.ts.map +1 -1
  360. package/dist/jvm/protocol/query-keys.js +1 -1
  361. package/dist/jvm/protocol/query-keys.js.map +1 -1
  362. package/dist/jvm/protocol/status.cjs +38 -0
  363. package/dist/jvm/protocol/status.cjs.map +1 -0
  364. package/dist/jvm/protocol/status.d.ts +13 -0
  365. package/dist/jvm/protocol/status.d.ts.map +1 -0
  366. package/dist/jvm/protocol/status.js +38 -0
  367. package/dist/jvm/protocol/status.js.map +1 -0
  368. package/dist/jvm/protocol/types.d.ts +16 -4
  369. package/dist/jvm/protocol/types.d.ts.map +1 -1
  370. package/dist/jvm/runtime/GcSummary.cjs +7 -1
  371. package/dist/jvm/runtime/GcSummary.cjs.map +1 -1
  372. package/dist/jvm/runtime/GcSummary.d.ts.map +1 -1
  373. package/dist/jvm/runtime/GcSummary.js +7 -1
  374. package/dist/jvm/runtime/GcSummary.js.map +1 -1
  375. package/dist/jvm/surfaces/ClassesSurface.cjs +11 -10
  376. package/dist/jvm/surfaces/ClassesSurface.cjs.map +1 -1
  377. package/dist/jvm/surfaces/ClassesSurface.d.ts.map +1 -1
  378. package/dist/jvm/surfaces/ClassesSurface.js +12 -11
  379. package/dist/jvm/surfaces/ClassesSurface.js.map +1 -1
  380. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs +11 -3
  381. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs.map +1 -1
  382. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts +2 -0
  383. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts.map +1 -1
  384. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js +11 -3
  385. package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js.map +1 -1
  386. package/dist/jvm/surfaces/PatchesSurface.cjs +3 -8
  387. package/dist/jvm/surfaces/PatchesSurface.cjs.map +1 -1
  388. package/dist/jvm/surfaces/PatchesSurface.d.ts +2 -1
  389. package/dist/jvm/surfaces/PatchesSurface.d.ts.map +1 -1
  390. package/dist/jvm/surfaces/PatchesSurface.js +4 -9
  391. package/dist/jvm/surfaces/PatchesSurface.js.map +1 -1
  392. package/dist/jvm/surfaces/ThreadsSurface.cjs +7 -4
  393. package/dist/jvm/surfaces/ThreadsSurface.cjs.map +1 -1
  394. package/dist/jvm/surfaces/ThreadsSurface.d.ts +4 -1
  395. package/dist/jvm/surfaces/ThreadsSurface.d.ts.map +1 -1
  396. package/dist/jvm/surfaces/ThreadsSurface.js +7 -4
  397. package/dist/jvm/surfaces/ThreadsSurface.js.map +1 -1
  398. package/dist/jvm/surfaces/jvm-context.cjs +23 -4
  399. package/dist/jvm/surfaces/jvm-context.cjs.map +1 -1
  400. package/dist/jvm/surfaces/jvm-context.d.ts +7 -0
  401. package/dist/jvm/surfaces/jvm-context.d.ts.map +1 -1
  402. package/dist/jvm/surfaces/jvm-context.js +23 -5
  403. package/dist/jvm/surfaces/jvm-context.js.map +1 -1
  404. package/dist/jvm/surfaces/use-patch-actions.cjs +2 -2
  405. package/dist/jvm/surfaces/use-patch-actions.cjs.map +1 -1
  406. package/dist/jvm/surfaces/use-patch-actions.js +2 -2
  407. package/dist/jvm/surfaces/use-patch-actions.js.map +1 -1
  408. package/dist/jvm/threads/FoldedStackTrace.cjs +3 -2
  409. package/dist/jvm/threads/FoldedStackTrace.cjs.map +1 -1
  410. package/dist/jvm/threads/FoldedStackTrace.d.ts +4 -1
  411. package/dist/jvm/threads/FoldedStackTrace.d.ts.map +1 -1
  412. package/dist/jvm/threads/FoldedStackTrace.js +3 -2
  413. package/dist/jvm/threads/FoldedStackTrace.js.map +1 -1
  414. package/dist/jvm/threads/ThreadDetail.cjs +6 -2
  415. package/dist/jvm/threads/ThreadDetail.cjs.map +1 -1
  416. package/dist/jvm/threads/ThreadDetail.d.ts +4 -1
  417. package/dist/jvm/threads/ThreadDetail.d.ts.map +1 -1
  418. package/dist/jvm/threads/ThreadDetail.js +6 -2
  419. package/dist/jvm/threads/ThreadDetail.js.map +1 -1
  420. package/dist/jvm.cjs +3 -0
  421. package/dist/jvm.d.ts +2 -1
  422. package/dist/jvm.d.ts.map +1 -1
  423. package/dist/jvm.js +3 -2
  424. package/dist/layout/AppShell.cjs.map +1 -1
  425. package/dist/layout/AppShell.d.ts +16 -0
  426. package/dist/layout/AppShell.d.ts.map +1 -1
  427. package/dist/layout/AppShell.js.map +1 -1
  428. package/dist/layout/AppShell.nav.cjs +21 -2
  429. package/dist/layout/AppShell.nav.cjs.map +1 -1
  430. package/dist/layout/AppShell.nav.js +21 -2
  431. package/dist/layout/AppShell.nav.js.map +1 -1
  432. package/dist/layout/Workspace.cjs +66 -21
  433. package/dist/layout/Workspace.cjs.map +1 -1
  434. package/dist/layout/Workspace.d.ts +6 -1
  435. package/dist/layout/Workspace.d.ts.map +1 -1
  436. package/dist/layout/Workspace.js +66 -21
  437. package/dist/layout/Workspace.js.map +1 -1
  438. package/dist/layout/Workspace.model.cjs +20 -0
  439. package/dist/layout/Workspace.model.cjs.map +1 -1
  440. package/dist/layout/Workspace.model.d.ts +17 -0
  441. package/dist/layout/Workspace.model.d.ts.map +1 -1
  442. package/dist/layout/Workspace.model.js +20 -1
  443. package/dist/layout/Workspace.model.js.map +1 -1
  444. package/dist/layout/Workspace.regions.cjs +10 -6
  445. package/dist/layout/Workspace.regions.cjs.map +1 -1
  446. package/dist/layout/Workspace.regions.d.ts +4 -1
  447. package/dist/layout/Workspace.regions.d.ts.map +1 -1
  448. package/dist/layout/Workspace.regions.js +10 -6
  449. package/dist/layout/Workspace.regions.js.map +1 -1
  450. package/dist/lib/duration.cjs +20 -0
  451. package/dist/lib/duration.cjs.map +1 -1
  452. package/dist/lib/duration.d.ts +8 -0
  453. package/dist/lib/duration.d.ts.map +1 -1
  454. package/dist/lib/duration.js +19 -1
  455. package/dist/lib/duration.js.map +1 -1
  456. package/dist/monaco/MonacoEditor.cjs +34 -30
  457. package/dist/monaco/MonacoEditor.cjs.map +1 -1
  458. package/dist/monaco/MonacoEditor.d.ts.map +1 -1
  459. package/dist/monaco/MonacoEditor.js +34 -30
  460. package/dist/monaco/MonacoEditor.js.map +1 -1
  461. package/dist/overlay/ConfirmDialog.cjs +5 -2
  462. package/dist/overlay/ConfirmDialog.cjs.map +1 -1
  463. package/dist/overlay/ConfirmDialog.d.ts +14 -2
  464. package/dist/overlay/ConfirmDialog.d.ts.map +1 -1
  465. package/dist/overlay/ConfirmDialog.js +5 -2
  466. package/dist/overlay/ConfirmDialog.js.map +1 -1
  467. package/dist/profiles/cel/celEditor.cjs +94 -285
  468. package/dist/profiles/cel/celEditor.cjs.map +1 -1
  469. package/dist/profiles/cel/celEditor.d.ts +10 -15
  470. package/dist/profiles/cel/celEditor.d.ts.map +1 -1
  471. package/dist/profiles/cel/celEditor.js +97 -287
  472. package/dist/profiles/cel/celEditor.js.map +1 -1
  473. package/dist/profiles/cel/celExpression.cjs +1 -61
  474. package/dist/profiles/cel/celExpression.cjs.map +1 -1
  475. package/dist/profiles/cel/celExpression.d.ts +2 -38
  476. package/dist/profiles/cel/celExpression.d.ts.map +1 -1
  477. package/dist/profiles/cel/celExpression.js +2 -58
  478. package/dist/profiles/cel/celExpression.js.map +1 -1
  479. package/dist/profiles/cel/celPlayground.cjs +122 -0
  480. package/dist/profiles/cel/celPlayground.cjs.map +1 -0
  481. package/dist/profiles/cel/celPlayground.d.ts +43 -0
  482. package/dist/profiles/cel/celPlayground.d.ts.map +1 -0
  483. package/dist/profiles/cel/celPlayground.js +118 -0
  484. package/dist/profiles/cel/celPlayground.js.map +1 -0
  485. package/dist/profiles/connections/connectionBrowserModel.cjs +2 -2
  486. package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
  487. package/dist/profiles/connections/connectionBrowserModel.d.ts +5 -1
  488. package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
  489. package/dist/profiles/connections/connectionBrowserModel.js +2 -2
  490. package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
  491. package/dist/profiles/connections/connectionQueryWorkspace.cjs +2 -1
  492. package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
  493. package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -1
  494. package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
  495. package/dist/profiles/connections/connectionQueryWorkspace.js +2 -1
  496. package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
  497. package/dist/profiles/editor/UnwrapPreviewList.cjs +90 -0
  498. package/dist/profiles/editor/UnwrapPreviewList.cjs.map +1 -0
  499. package/dist/profiles/editor/UnwrapPreviewList.d.ts +7 -0
  500. package/dist/profiles/editor/UnwrapPreviewList.d.ts.map +1 -0
  501. package/dist/profiles/editor/UnwrapPreviewList.js +90 -0
  502. package/dist/profiles/editor/UnwrapPreviewList.js.map +1 -0
  503. package/dist/profiles/editor/profileCanonicalQuery.cjs +6 -58
  504. package/dist/profiles/editor/profileCanonicalQuery.cjs.map +1 -1
  505. package/dist/profiles/editor/profileCanonicalQuery.d.ts +1 -1
  506. package/dist/profiles/editor/profileCanonicalQuery.d.ts.map +1 -1
  507. package/dist/profiles/editor/profileCanonicalQuery.js +4 -56
  508. package/dist/profiles/editor/profileCanonicalQuery.js.map +1 -1
  509. package/dist/profiles/editor/profileCanonicalTranslate.cjs +48 -0
  510. package/dist/profiles/editor/profileCanonicalTranslate.cjs.map +1 -0
  511. package/dist/profiles/editor/profileCanonicalTranslate.d.ts +24 -0
  512. package/dist/profiles/editor/profileCanonicalTranslate.d.ts.map +1 -0
  513. package/dist/profiles/editor/profileCanonicalTranslate.js +47 -0
  514. package/dist/profiles/editor/profileCanonicalTranslate.js.map +1 -0
  515. package/dist/profiles/editor/profileEditor.cjs +106 -37
  516. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  517. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  518. package/dist/profiles/editor/profileEditor.js +107 -38
  519. package/dist/profiles/editor/profileEditor.js.map +1 -1
  520. package/dist/profiles/editor/profileEditorModel.cjs +65 -19
  521. package/dist/profiles/editor/profileEditorModel.cjs.map +1 -1
  522. package/dist/profiles/editor/profileEditorModel.d.ts +24 -8
  523. package/dist/profiles/editor/profileEditorModel.d.ts.map +1 -1
  524. package/dist/profiles/editor/profileEditorModel.js +64 -18
  525. package/dist/profiles/editor/profileEditorModel.js.map +1 -1
  526. package/dist/profiles/editor/profileEditorPreview.cjs +129 -29
  527. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  528. package/dist/profiles/editor/profileEditorPreview.d.ts +18 -5
  529. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  530. package/dist/profiles/editor/profileEditorPreview.js +129 -29
  531. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  532. package/dist/profiles/editor/profileEditorSections.cjs +137 -88
  533. package/dist/profiles/editor/profileEditorSections.cjs.map +1 -1
  534. package/dist/profiles/editor/profileEditorSections.d.ts +18 -2
  535. package/dist/profiles/editor/profileEditorSections.d.ts.map +1 -1
  536. package/dist/profiles/editor/profileEditorSections.js +138 -90
  537. package/dist/profiles/editor/profileEditorSections.js.map +1 -1
  538. package/dist/profiles/editor/profileMappingPreview.cjs +22 -6
  539. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  540. package/dist/profiles/editor/profileMappingPreview.d.ts +17 -1
  541. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  542. package/dist/profiles/editor/profileMappingPreview.js +23 -7
  543. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  544. package/dist/profiles/editor/profileSaveAsDialog.cjs +21 -13
  545. package/dist/profiles/editor/profileSaveAsDialog.cjs.map +1 -1
  546. package/dist/profiles/editor/profileSaveAsDialog.d.ts.map +1 -1
  547. package/dist/profiles/editor/profileSaveAsDialog.js +21 -13
  548. package/dist/profiles/editor/profileSaveAsDialog.js.map +1 -1
  549. package/dist/profiles/editor/profileSourceExtensions.cjs +71 -0
  550. package/dist/profiles/editor/profileSourceExtensions.cjs.map +1 -0
  551. package/dist/profiles/editor/profileSourceExtensions.d.ts +26 -0
  552. package/dist/profiles/editor/profileSourceExtensions.d.ts.map +1 -0
  553. package/dist/profiles/editor/profileSourceExtensions.js +70 -0
  554. package/dist/profiles/editor/profileSourceExtensions.js.map +1 -0
  555. package/dist/profiles/editor/samplePaths.cjs +54 -0
  556. package/dist/profiles/editor/samplePaths.cjs.map +1 -0
  557. package/dist/profiles/editor/samplePaths.d.ts +27 -0
  558. package/dist/profiles/editor/samplePaths.d.ts.map +1 -0
  559. package/dist/profiles/editor/samplePaths.js +53 -0
  560. package/dist/profiles/editor/samplePaths.js.map +1 -0
  561. package/dist/profiles/editor/testSchema.d.ts.map +1 -1
  562. package/dist/profiles/editor/useUnwrapPreviews.cjs +60 -0
  563. package/dist/profiles/editor/useUnwrapPreviews.cjs.map +1 -0
  564. package/dist/profiles/editor/useUnwrapPreviews.d.ts +38 -0
  565. package/dist/profiles/editor/useUnwrapPreviews.d.ts.map +1 -0
  566. package/dist/profiles/editor/useUnwrapPreviews.js +60 -0
  567. package/dist/profiles/editor/useUnwrapPreviews.js.map +1 -0
  568. package/dist/profiles/elasticsearch/esQueryBuilder.cjs +10 -1
  569. package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
  570. package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
  571. package/dist/profiles/elasticsearch/esQueryBuilder.js +11 -2
  572. package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
  573. package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs +38 -0
  574. package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs.map +1 -1
  575. package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts +17 -0
  576. package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts.map +1 -1
  577. package/dist/profiles/elasticsearch/esQueryBuilderForm.js +37 -1
  578. package/dist/profiles/elasticsearch/esQueryBuilderForm.js.map +1 -1
  579. package/dist/profiles/elasticsearch/esQueryConditionRow.cjs +4 -3
  580. package/dist/profiles/elasticsearch/esQueryConditionRow.cjs.map +1 -1
  581. package/dist/profiles/elasticsearch/esQueryConditionRow.d.ts.map +1 -1
  582. package/dist/profiles/elasticsearch/esQueryConditionRow.js +4 -3
  583. package/dist/profiles/elasticsearch/esQueryConditionRow.js.map +1 -1
  584. package/dist/profiles/elasticsearch/esQueryOperators.cjs.map +1 -1
  585. package/dist/profiles/elasticsearch/esQueryOperators.d.ts +8 -0
  586. package/dist/profiles/elasticsearch/esQueryOperators.d.ts.map +1 -1
  587. package/dist/profiles/elasticsearch/esQueryOperators.js.map +1 -1
  588. package/dist/profiles/fields/profileFieldControls.cjs +3 -2
  589. package/dist/profiles/fields/profileFieldControls.cjs.map +1 -1
  590. package/dist/profiles/fields/profileFieldControls.d.ts +3 -1
  591. package/dist/profiles/fields/profileFieldControls.d.ts.map +1 -1
  592. package/dist/profiles/fields/profileFieldControls.js +3 -2
  593. package/dist/profiles/fields/profileFieldControls.js.map +1 -1
  594. package/dist/profiles/fields/profileFieldEditor.cjs +98 -185
  595. package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
  596. package/dist/profiles/fields/profileFieldEditor.d.ts +11 -3
  597. package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
  598. package/dist/profiles/fields/profileFieldEditor.js +99 -186
  599. package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
  600. package/dist/profiles/fields/profileFieldFilterEditor.cjs +115 -81
  601. package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
  602. package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
  603. package/dist/profiles/fields/profileFieldFilterEditor.js +116 -82
  604. package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
  605. package/dist/profiles/fields/profileFieldIcons.cjs +2 -0
  606. package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
  607. package/dist/profiles/fields/profileFieldIcons.d.ts.map +1 -1
  608. package/dist/profiles/fields/profileFieldIcons.js +2 -0
  609. package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
  610. package/dist/profiles/fields/profileFieldList.cjs +23 -1
  611. package/dist/profiles/fields/profileFieldList.cjs.map +1 -1
  612. package/dist/profiles/fields/profileFieldList.d.ts.map +1 -1
  613. package/dist/profiles/fields/profileFieldList.js +23 -1
  614. package/dist/profiles/fields/profileFieldList.js.map +1 -1
  615. package/dist/profiles/fields/profileFieldPreview.cjs +111 -0
  616. package/dist/profiles/fields/profileFieldPreview.cjs.map +1 -0
  617. package/dist/profiles/fields/profileFieldPreview.d.ts +25 -0
  618. package/dist/profiles/fields/profileFieldPreview.d.ts.map +1 -0
  619. package/dist/profiles/fields/profileFieldPreview.js +110 -0
  620. package/dist/profiles/fields/profileFieldPreview.js.map +1 -0
  621. package/dist/profiles/fields/profileFieldSample.cjs +182 -0
  622. package/dist/profiles/fields/profileFieldSample.cjs.map +1 -0
  623. package/dist/profiles/fields/profileFieldSample.d.ts +35 -0
  624. package/dist/profiles/fields/profileFieldSample.d.ts.map +1 -0
  625. package/dist/profiles/fields/profileFieldSample.js +180 -0
  626. package/dist/profiles/fields/profileFieldSample.js.map +1 -0
  627. package/dist/profiles/fields/profileFieldTypeField.cjs +104 -0
  628. package/dist/profiles/fields/profileFieldTypeField.cjs.map +1 -0
  629. package/dist/profiles/fields/profileFieldTypeField.d.ts +17 -0
  630. package/dist/profiles/fields/profileFieldTypeField.d.ts.map +1 -0
  631. package/dist/profiles/fields/profileFieldTypeField.js +104 -0
  632. package/dist/profiles/fields/profileFieldTypeField.js.map +1 -0
  633. package/dist/profiles/fields/profileFieldTypes.cjs +1 -0
  634. package/dist/profiles/fields/profileFieldTypes.cjs.map +1 -1
  635. package/dist/profiles/fields/profileFieldTypes.d.ts +1 -1
  636. package/dist/profiles/fields/profileFieldTypes.d.ts.map +1 -1
  637. package/dist/profiles/fields/profileFieldTypes.js +1 -0
  638. package/dist/profiles/fields/profileFieldTypes.js.map +1 -1
  639. package/dist/profiles/fields/profileFieldValueEditor.cjs +298 -0
  640. package/dist/profiles/fields/profileFieldValueEditor.cjs.map +1 -0
  641. package/dist/profiles/fields/profileFieldValueEditor.d.ts +18 -0
  642. package/dist/profiles/fields/profileFieldValueEditor.d.ts.map +1 -0
  643. package/dist/profiles/fields/profileFieldValueEditor.js +298 -0
  644. package/dist/profiles/fields/profileFieldValueEditor.js.map +1 -0
  645. package/dist/profiles/fields/profileFieldValueMode.cjs +61 -0
  646. package/dist/profiles/fields/profileFieldValueMode.cjs.map +1 -0
  647. package/dist/profiles/fields/profileFieldValueMode.d.ts +34 -0
  648. package/dist/profiles/fields/profileFieldValueMode.d.ts.map +1 -0
  649. package/dist/profiles/fields/profileFieldValueMode.js +59 -0
  650. package/dist/profiles/fields/profileFieldValueMode.js.map +1 -0
  651. package/dist/profiles/processor/processorConfig.cjs +79 -79
  652. package/dist/profiles/processor/processorConfig.cjs.map +1 -1
  653. package/dist/profiles/processor/processorConfig.d.ts +30 -3
  654. package/dist/profiles/processor/processorConfig.d.ts.map +1 -1
  655. package/dist/profiles/processor/processorConfig.js +78 -78
  656. package/dist/profiles/processor/processorConfig.js.map +1 -1
  657. package/dist/profiles/processor/processorPipeline.cjs +8 -6
  658. package/dist/profiles/processor/processorPipeline.cjs.map +1 -1
  659. package/dist/profiles/processor/processorPipeline.d.ts +3 -3
  660. package/dist/profiles/processor/processorPipeline.d.ts.map +1 -1
  661. package/dist/profiles/processor/processorPipeline.js +9 -7
  662. package/dist/profiles/processor/processorPipeline.js.map +1 -1
  663. package/dist/profiles/processor/processorPipelineEditor.cjs +38 -94
  664. package/dist/profiles/processor/processorPipelineEditor.cjs.map +1 -1
  665. package/dist/profiles/processor/processorPipelineEditor.d.ts +3 -3
  666. package/dist/profiles/processor/processorPipelineEditor.d.ts.map +1 -1
  667. package/dist/profiles/processor/processorPipelineEditor.js +39 -95
  668. package/dist/profiles/processor/processorPipelineEditor.js.map +1 -1
  669. package/dist/profiles/processor/processorPipelineExtension.cjs +3 -2
  670. package/dist/profiles/processor/processorPipelineExtension.cjs.map +1 -1
  671. package/dist/profiles/processor/processorPipelineExtension.d.ts.map +1 -1
  672. package/dist/profiles/processor/processorPipelineExtension.js +3 -2
  673. package/dist/profiles/processor/processorPipelineExtension.js.map +1 -1
  674. package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -1
  675. package/dist/profiles/query/profileSampleFilterLookup.d.ts +6 -3
  676. package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -1
  677. package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -1
  678. package/dist/profiles/wizard/profileWizardModel.cjs +10 -1
  679. package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
  680. package/dist/profiles/wizard/profileWizardModel.d.ts +6 -0
  681. package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
  682. package/dist/profiles/wizard/profileWizardModel.js +10 -1
  683. package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
  684. package/dist/profiles/wizard/profileWizardQueryStep.cjs +10 -22
  685. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  686. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +8 -1
  687. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  688. package/dist/profiles/wizard/profileWizardQueryStep.js +11 -23
  689. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  690. package/dist/profiles/wizard/useProfileInspection.cjs +39 -0
  691. package/dist/profiles/wizard/useProfileInspection.cjs.map +1 -0
  692. package/dist/profiles/wizard/useProfileInspection.d.ts +21 -0
  693. package/dist/profiles/wizard/useProfileInspection.d.ts.map +1 -0
  694. package/dist/profiles/wizard/useProfileInspection.js +39 -0
  695. package/dist/profiles/wizard/useProfileInspection.js.map +1 -0
  696. package/dist/profiles.cjs +9 -11
  697. package/dist/profiles.js +8 -8
  698. package/dist/rpc/EntityExplorerApp.cjs +7 -3
  699. package/dist/rpc/EntityExplorerApp.cjs.map +1 -1
  700. package/dist/rpc/EntityExplorerApp.d.ts +16 -1
  701. package/dist/rpc/EntityExplorerApp.d.ts.map +1 -1
  702. package/dist/rpc/EntityExplorerApp.js +7 -3
  703. package/dist/rpc/EntityExplorerApp.js.map +1 -1
  704. package/dist/rpc/InlineError.cjs +30 -10
  705. package/dist/rpc/InlineError.cjs.map +1 -1
  706. package/dist/rpc/InlineError.d.ts +10 -1
  707. package/dist/rpc/InlineError.d.ts.map +1 -1
  708. package/dist/rpc/InlineError.js +30 -10
  709. package/dist/rpc/InlineError.js.map +1 -1
  710. package/dist/rpc/SchemaActionForm.cjs +9 -6
  711. package/dist/rpc/SchemaActionForm.cjs.map +1 -1
  712. package/dist/rpc/SchemaActionForm.d.ts.map +1 -1
  713. package/dist/rpc/SchemaActionForm.js +9 -6
  714. package/dist/rpc/SchemaActionForm.js.map +1 -1
  715. package/dist/rpc/SessionHeader.cjs +3 -3
  716. package/dist/rpc/SessionHeader.cjs.map +1 -1
  717. package/dist/rpc/SessionHeader.d.ts.map +1 -1
  718. package/dist/rpc/SessionHeader.js +3 -3
  719. package/dist/rpc/SessionHeader.js.map +1 -1
  720. package/dist/rpc/formMetadata.cjs +2 -6
  721. package/dist/rpc/formMetadata.cjs.map +1 -1
  722. package/dist/rpc/formMetadata.d.ts.map +1 -1
  723. package/dist/rpc/formMetadata.js +1 -5
  724. package/dist/rpc/formMetadata.js.map +1 -1
  725. package/dist/rpc/surfaceNav.cjs +5 -0
  726. package/dist/rpc/surfaceNav.cjs.map +1 -1
  727. package/dist/rpc/surfaceNav.d.ts.map +1 -1
  728. package/dist/rpc/surfaceNav.js +5 -0
  729. package/dist/rpc/surfaceNav.js.map +1 -1
  730. package/dist/runtime/barrels.json +4982 -4979
  731. package/dist/runtime/importmap.json +2168 -2146
  732. package/dist/styles.css +1 -1
  733. package/package.json +1 -1
  734. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs +0 -91
  735. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs.map +0 -1
  736. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts +0 -7
  737. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts.map +0 -1
  738. package/dist/data/ai/runtime-profiles/ResolutionInspector.js +0 -91
  739. package/dist/data/ai/runtime-profiles/ResolutionInspector.js.map +0 -1
  740. package/dist/profiles/cel/celEditorResults.cjs +0 -158
  741. package/dist/profiles/cel/celEditorResults.cjs.map +0 -1
  742. package/dist/profiles/cel/celEditorResults.d.ts +0 -37
  743. package/dist/profiles/cel/celEditorResults.d.ts.map +0 -1
  744. package/dist/profiles/cel/celEditorResults.js +0 -156
  745. package/dist/profiles/cel/celEditorResults.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"timestamp-format.js","names":[],"sources":["../../../src/data/cells/timestamp-format.ts"],"sourcesContent":["import type { TimeRangePreset, TimeRangePresetGroup } from \"../../components/TimeRange\";\n\nexport const LAST_24_HOURS = { label: \"Last 24 hours\", from: \"now-24h\", to: \"now\" };\n\nexport const TIMESTAMP_RANGE_PRESETS: TimeRangePreset[] = [\n { label: \"Last 5 minutes\", from: \"now-5m\", to: \"now\" },\n { label: \"Last 15 minutes\", from: \"now-15m\", to: \"now\" },\n { label: \"Last 1 hour\", from: \"now-1h\", to: \"now\" },\n { label: \"Last 6 hours\", from: \"now-6h\", to: \"now\" },\n LAST_24_HOURS,\n { label: \"Last 7 days\", from: \"now-7d\", to: \"now\" },\n { label: \"Last 30 days\", from: \"now-30d\", to: \"now\" },\n];\n\nexport type TimestampMode = \"auto\" | \"absolute\" | \"relative\" | \"time\";\n\nexport type TimestampFormat = \"relative\" | \"time\" | \"short\" | \"iso\";\n\nexport type TimestampOptions = {\n /** Rendering mode for timestamp cells. */\n mode?: TimestampMode;\n /** Show the full timestamp in a tooltip even for absolute/ISO formats. */\n alwaysShowFullOnHover?: boolean;\n /**\n * When the column is on a DataTable with `autoFilter`, DataTable mounts a\n * \"Time range\" picker (matching the trace UI) and filters rows whose\n * timestamp falls outside the selected range. Set `false` to suppress.\n */\n autoRangeFilter?: boolean;\n /** Override the trace-style preset list (\"Last 15 minutes\", etc.). */\n rangePresets?: Array<{ label: string; from: string; to: string } | TimeRangePresetGroup>;\n /** Enable absolute date+time input and timezone selection for range filters. */\n timeEnabled?: boolean;\n /** Default timezone used when encoding absolute date+time range values. */\n timeZone?: string;\n /** Selectable timezones shown when `timeEnabled` is true. */\n timeZones?: string[];\n /**\n * Default range applied on first render. Either side may use date-math\n * (`now-24h`, `now`) or any value parseable by `parseTimestamp`.\n */\n defaultRange?: { from?: string; to?: string };\n};\n\nexport function parseTimestamp(value: unknown): Date | null {\n if (value == null) return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;\n\n if (typeof value === \"number\") {\n const ms = value < 1e12 ? value * 1000 : value;\n const d = new Date(ms);\n return Number.isNaN(d.getTime()) ? null : d;\n }\n\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!trimmed) return null;\n const d = new Date(trimmed);\n return Number.isNaN(d.getTime()) ? null : d;\n }\n\n return null;\n}\n\nconst UNIT_MS: Record<string, number> = {\n s: 1_000,\n m: 60_000,\n h: 3_600_000,\n d: 86_400_000,\n w: 604_800_000,\n};\n\nconst RELATIVE_PATTERN = /^now\\s*([+-])\\s*(\\d+)\\s*([smhdwMqy])$/;\nconst ANCHORED_PATTERN = /^now\\/([wMqy])(?:\\s*([+-])\\s*(\\d+)\\s*([wMqy]))?$/;\n\n/**\n * Resolves date-math strings to an absolute Date. Recognised forms:\n * - \"now\"\n * - \"now-15m\", \"now-1h\", \"now+30s\", \"now-7d\", \"now-2w\" (units: s/m/h/d/w/M/q/y)\n * - \"now/w\", \"now/M\", \"now/q\", \"now/y\" with optional calendar offsets\n * - any value parseable by `parseTimestamp` (ISO, epoch ms/s, Date)\n * Returns null for unparseable input.\n */\nexport function resolveDateMath(value: unknown, now: Date = new Date()): Date | null {\n if (value == null) return null;\n\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!trimmed) return null;\n\n if (trimmed.toLowerCase() === \"now\") return new Date(now.getTime());\n\n const anchoredMatch = trimmed.match(ANCHORED_PATTERN);\n if (anchoredMatch) {\n const [, anchor, sign, amount, unit] = anchoredMatch;\n let anchored = startOfPeriod(now, anchor!);\n if (sign && amount && unit) {\n anchored = addPeriod(anchored, unit, Number(amount) * (sign === \"-\" ? -1 : 1));\n }\n return anchored;\n }\n\n const match = trimmed.match(RELATIVE_PATTERN);\n if (match) {\n const [, sign, amount, unit] = match;\n const calendarUnit = unit!;\n if (isCalendarUnit(calendarUnit)) {\n return addPeriod(now, calendarUnit, Number(amount) * (sign === \"-\" ? -1 : 1));\n }\n const unitMs = UNIT_MS[calendarUnit.toLowerCase()];\n if (!unitMs) return null;\n const delta = Number(amount) * unitMs * (sign === \"-\" ? -1 : 1);\n return new Date(now.getTime() + delta);\n }\n }\n\n return parseTimestamp(value);\n}\n\nfunction isCalendarUnit(unit: string) {\n return unit === \"M\" || unit === \"q\" || unit === \"y\";\n}\n\nfunction startOfPeriod(date: Date, unit: string) {\n const year = date.getUTCFullYear();\n const month = date.getUTCMonth();\n const day = date.getUTCDate();\n\n if (unit === \"w\") {\n const start = new Date(Date.UTC(year, month, day));\n const dayOfWeek = start.getUTCDay();\n const daysSinceMonday = (dayOfWeek + 6) % 7;\n start.setUTCDate(start.getUTCDate() - daysSinceMonday);\n return start;\n }\n if (unit === \"M\") return new Date(Date.UTC(year, month, 1));\n if (unit === \"q\") return new Date(Date.UTC(year, Math.floor(month / 3) * 3, 1));\n if (unit === \"y\") return new Date(Date.UTC(year, 0, 1));\n return new Date(date.getTime());\n}\n\nfunction addPeriod(date: Date, unit: string, amount: number) {\n const next = new Date(date.getTime());\n if (unit === \"w\") {\n next.setUTCDate(next.getUTCDate() + amount * 7);\n } else if (unit === \"M\") {\n next.setUTCMonth(next.getUTCMonth() + amount);\n } else if (unit === \"q\") {\n next.setUTCMonth(next.getUTCMonth() + amount * 3);\n } else if (unit === \"y\") {\n next.setUTCFullYear(next.getUTCFullYear() + amount);\n } else {\n const unitMs = UNIT_MS[unit.toLowerCase()];\n if (unitMs) next.setTime(next.getTime() + amount * unitMs);\n }\n return next;\n}\n\nconst MS_PER_MINUTE = 60_000;\nconst MS_PER_DAY = 86_400_000;\n\nexport function chooseTimestampFormat(values: Date[]): TimestampFormat {\n if (values.length === 0) return \"iso\";\n\n let min = Infinity;\n let max = -Infinity;\n for (const d of values) {\n const t = d.getTime();\n if (t < min) min = t;\n if (t > max) max = t;\n }\n const span = max - min;\n\n if (span <= MS_PER_MINUTE) return \"relative\";\n\n const minDate = new Date(min);\n const maxDate = new Date(max);\n\n if (\n minDate.getFullYear() === maxDate.getFullYear() &&\n minDate.getMonth() === maxDate.getMonth() &&\n minDate.getDate() === maxDate.getDate()\n ) {\n return \"time\";\n }\n\n if (minDate.getFullYear() === maxDate.getFullYear() && span <= MS_PER_DAY * 365) {\n return \"short\";\n }\n\n return \"iso\";\n}\n\nexport function formatTimestamp(\n date: Date,\n format: TimestampFormat,\n now: Date = new Date(),\n): string {\n switch (format) {\n case \"relative\":\n return formatRelativeTime(date, now);\n case \"time\":\n return date.toLocaleTimeString(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n case \"short\":\n return date.toLocaleString(undefined, {\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n case \"iso\":\n default:\n return formatIso(date);\n }\n}\n\nfunction formatIso(date: Date): string {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n const hh = String(date.getHours()).padStart(2, \"0\");\n const min = String(date.getMinutes()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd} ${hh}:${min}`;\n}\n\nexport type RelativeTimeOptions = {\n /**\n * \"phrase\" (default) reads \"30s ago\" / \"in 5m\" / \"just now\". \"token\" is the\n * list-row form — now / 5m / 2h / 3d / 4w / 1y, floored so a token never\n * claims the next unit early — for a meta line where \"ago\" is implied.\n */\n style?: \"phrase\" | \"token\";\n};\n\nconst TOKEN_UNITS: ReadonlyArray<[unit: string, seconds: number]> = [\n [\"y\", 365 * 86400],\n [\"w\", 7 * 86400],\n [\"d\", 86400],\n [\"h\", 3600],\n [\"m\", 60],\n];\n\n// formatRelativeTime renders a compact \"30s ago\" / \"in 5m\" / \"just now\" string,\n// or with style \"token\" the bare now / 5m / 2h / 3d / 4w token.\nexport function formatRelativeTime(\n date: Date,\n now: Date = new Date(),\n options: RelativeTimeOptions = {},\n): string {\n const diffMs = now.getTime() - date.getTime();\n const future = diffMs < 0;\n const abs = Math.abs(diffMs);\n if (options.style === \"token\") {\n const seconds = Math.floor(abs / 1000);\n const match = TOKEN_UNITS.find(([, size]) => seconds >= size);\n if (!match) return \"now\";\n const token = `${Math.floor(seconds / match[1])}${match[0]}`;\n return future ? `in ${token}` : token;\n }\n const sec = Math.round(abs / 1000);\n\n let value: string;\n if (sec < 1) value = \"just now\";\n else if (sec < 60) value = `${sec}s`;\n else if (sec < 3600) value = `${Math.round(sec / 60)}m`;\n else if (sec < 86400) value = `${Math.round(sec / 3600)}h`;\n else value = `${Math.round(sec / 86400)}d`;\n\n if (value === \"just now\") return value;\n return future ? `in ${value}` : `${value} ago`;\n}\n\n// formatDateTimeRelative renders a value as an absolute locale date+time plus a\n// parenthesised relative hint, e.g. \"Apr 15, 2026, 12:00 PM (2h ago)\". It is the\n// shared \"locale + relative\" presentation used for date-typed values across the\n// form, filter, and combobox surfaces. Unparseable strings pass through\n// unchanged (so a template token or freeform value is preserved); nullish input\n// yields an empty string. The hint is dropped when the value reads \"just now\".\nexport function formatDateTimeRelative(value: unknown, now: Date = new Date()): string {\n const parsed = parseTimestamp(value);\n if (!parsed) return typeof value === \"string\" ? value : \"\";\n const absolute = parsed.toLocaleString(undefined, {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n const relative = formatRelativeTime(parsed, now);\n return relative === \"just now\" ? absolute : `${absolute} (${relative})`;\n}\n\nexport function modeToFormat(mode: TimestampMode, dataFormat: TimestampFormat): TimestampFormat {\n switch (mode) {\n case \"absolute\":\n return \"iso\";\n case \"relative\":\n return \"relative\";\n case \"time\":\n return \"time\";\n case \"auto\":\n default:\n return dataFormat;\n }\n}\n"],"mappings":";AAEA,IAAa,gBAAgB;CAAE,OAAO;CA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OAAO;EACnB,MAAM,QAAQ,GAAG,KAAK,MAAM,UAAU,MAAM,EAAE,IAAI,MAAM;EACxD,OAAO,SAAS,MAAM,UAAU;CAClC;CACA,MAAM,MAAM,KAAK,MAAM,MAAM,GAAI;CAEjC,IAAI;CACJ,IAAI,MAAM,GAAG,QAAQ;MAChB,IAAI,MAAM,IAAI,QAAQ,GAAG,IAAI;MAC7B,IAAI,MAAM,MAAM,QAAQ,GAAG,KAAK,MAAM,MAAM,EAAE,EAAE;MAChD,IAAI,MAAM,OAAO,QAAQ,GAAG,KAAK,MAAM,MAAM,IAAI,EAAE;MACnD,QAAQ,GAAG,KAAK,MAAM,MAAM,KAAK,EAAE;CAExC,IAAI,UAAU,YAAY,OAAO;CACjC,OAAO,SAAS,MAAM,UAAU,GAAG,MAAM;AAC3C;AAQA,SAAgB,uBAAuB,OAAgB,sBAAY,IAAI,KAAK,GAAW;CACrF,MAAM,SAAS,eAAe,KAAK;CACnC,IAAI,CAAC,QAAQ,OAAO,OAAO,UAAU,WAAW,QAAQ;CACxD,MAAM,WAAW,OAAO,eAAe,KAAA,GAAW;EAChD,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;CACV,CAAC;CACD,MAAM,WAAW,mBAAmB,QAAQ,GAAG;CAC/C,OAAO,aAAa,aAAa,WAAW,GAAG,SAAS,IAAI,SAAS;AACvE;AAEA,SAAgB,aAAa,MAAqB,YAA8C;CAC9F,QAAQ,MAAR;EACE,KAAK,YACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,QACH,OAAO;EAET,SACE,OAAO;CACX;AACF"}
1
+ {"version":3,"file":"timestamp-format.js","names":[],"sources":["../../../src/data/cells/timestamp-format.ts"],"sourcesContent":["import type { TimeRangePreset, TimeRangePresetGroup } from \"../../components/TimeRange\";\n\nexport const LAST_24_HOURS = { label: \"Last 24 hours\", from: \"now-24h\", to: \"now\" };\n\nexport const TIMESTAMP_RANGE_PRESETS: TimeRangePreset[] = [\n { label: \"Last 5 minutes\", from: \"now-5m\", to: \"now\" },\n { label: \"Last 15 minutes\", from: \"now-15m\", to: \"now\" },\n { label: \"Last 1 hour\", from: \"now-1h\", to: \"now\" },\n { label: \"Last 6 hours\", from: \"now-6h\", to: \"now\" },\n LAST_24_HOURS,\n { label: \"Last 7 days\", from: \"now-7d\", to: \"now\" },\n { label: \"Last 30 days\", from: \"now-30d\", to: \"now\" },\n];\n\nexport type TimestampMode = \"auto\" | \"absolute\" | \"relative\" | \"time\";\n\nexport type TimestampFormat = \"relative\" | \"time\" | \"short\" | \"iso\";\n\nexport type TimestampOptions = {\n /** Rendering mode for timestamp cells. */\n mode?: TimestampMode;\n /** Show the full timestamp in a tooltip even for absolute/ISO formats. */\n alwaysShowFullOnHover?: boolean;\n /**\n * When the column is on a DataTable with `autoFilter`, DataTable mounts a\n * \"Time range\" picker (matching the trace UI) and filters rows whose\n * timestamp falls outside the selected range. Set `false` to suppress.\n */\n autoRangeFilter?: boolean;\n /** Override the trace-style preset list (\"Last 15 minutes\", etc.). */\n rangePresets?: Array<{ label: string; from: string; to: string } | TimeRangePresetGroup>;\n /** Enable absolute date+time input and timezone selection for range filters. */\n timeEnabled?: boolean;\n /** Default timezone used when encoding absolute date+time range values. */\n timeZone?: string;\n /** Selectable timezones shown when `timeEnabled` is true. */\n timeZones?: string[];\n /**\n * Default range applied on first render. Either side may use date-math\n * (`now-24h`, `now`) or any value parseable by `parseTimestamp`.\n */\n defaultRange?: { from?: string; to?: string };\n};\n\n// An all-digit string this long is an epoch, not a year: even in seconds nine\n// digits reach back to 1973. Shorter ones (\"2026\") stay with the date parser.\nconst EPOCH_STRING = /^\\d{9,}$/;\n\n/**\n * epochToMilliseconds names the unit of an epoch by its magnitude: below 1e12 is\n * seconds, below 1e14 milliseconds, below 1e17 microseconds, anything above\n * nanoseconds. Between 1973 and 2100 the four ranges are 3 orders of magnitude\n * apart (seconds ~1e9, ms ~1e12, µs ~1e15, ns ~1e18), so no real instant is\n * ambiguous. The seconds/milliseconds boundary at 1e12 is the one the numeric\n * branch always had; the µs and ns bands are the span-time units Jaeger and\n * OpenTelemetry store, which would otherwise read as a year tens of thousands\n * of years out.\n */\nfunction epochToMilliseconds(epoch: number): number {\n const magnitude = Math.abs(epoch);\n if (magnitude < 1e12) return epoch * 1000;\n if (magnitude < 1e14) return epoch;\n if (magnitude < 1e17) return epoch / 1e3;\n return epoch / 1e6;\n}\n\nfunction validDate(ms: number): Date | null {\n const d = new Date(ms);\n return Number.isNaN(d.getTime()) ? null : d;\n}\n\nexport function parseTimestamp(value: unknown): Date | null {\n if (value == null) return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;\n\n if (typeof value === \"number\") return validDate(epochToMilliseconds(value));\n\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!trimmed) return null;\n if (EPOCH_STRING.test(trimmed)) return validDate(epochToMilliseconds(Number(trimmed)));\n return validDate(new Date(trimmed).getTime());\n }\n\n return null;\n}\n\nconst UNIT_MS: Record<string, number> = {\n s: 1_000,\n m: 60_000,\n h: 3_600_000,\n d: 86_400_000,\n w: 604_800_000,\n};\n\nconst RELATIVE_PATTERN = /^now\\s*([+-])\\s*(\\d+)\\s*([smhdwMqy])$/;\nconst ANCHORED_PATTERN = /^now\\/([wMqy])(?:\\s*([+-])\\s*(\\d+)\\s*([wMqy]))?$/;\n\n/**\n * Resolves date-math strings to an absolute Date. Recognised forms:\n * - \"now\"\n * - \"now-15m\", \"now-1h\", \"now+30s\", \"now-7d\", \"now-2w\" (units: s/m/h/d/w/M/q/y)\n * - \"now/w\", \"now/M\", \"now/q\", \"now/y\" with optional calendar offsets\n * - any value parseable by `parseTimestamp` (ISO, epoch ms/s, Date)\n * The rounding forms start the period in UTC (weeks start on Monday 00:00 UTC), not in the viewer's\n * or a selected time zone. \"now/d\" is not supported (no day anchor): it is unparseable, so it\n * returns null. Returns null for unparseable input.\n */\nexport function resolveDateMath(value: unknown, now: Date = new Date()): Date | null {\n if (value == null) return null;\n\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!trimmed) return null;\n\n if (trimmed.toLowerCase() === \"now\") return new Date(now.getTime());\n\n const anchoredMatch = trimmed.match(ANCHORED_PATTERN);\n if (anchoredMatch) {\n const [, anchor, sign, amount, unit] = anchoredMatch;\n let anchored = startOfPeriod(now, anchor!);\n if (sign && amount && unit) {\n anchored = addPeriod(anchored, unit, Number(amount) * (sign === \"-\" ? -1 : 1));\n }\n return anchored;\n }\n\n const match = trimmed.match(RELATIVE_PATTERN);\n if (match) {\n const [, sign, amount, unit] = match;\n const calendarUnit = unit!;\n if (isCalendarUnit(calendarUnit)) {\n return addPeriod(now, calendarUnit, Number(amount) * (sign === \"-\" ? -1 : 1));\n }\n const unitMs = UNIT_MS[calendarUnit.toLowerCase()];\n if (!unitMs) return null;\n const delta = Number(amount) * unitMs * (sign === \"-\" ? -1 : 1);\n return new Date(now.getTime() + delta);\n }\n }\n\n return parseTimestamp(value);\n}\n\nfunction isCalendarUnit(unit: string) {\n return unit === \"M\" || unit === \"q\" || unit === \"y\";\n}\n\nfunction startOfPeriod(date: Date, unit: string) {\n const year = date.getUTCFullYear();\n const month = date.getUTCMonth();\n const day = date.getUTCDate();\n\n if (unit === \"w\") {\n const start = new Date(Date.UTC(year, month, day));\n const dayOfWeek = start.getUTCDay();\n const daysSinceMonday = (dayOfWeek + 6) % 7;\n start.setUTCDate(start.getUTCDate() - daysSinceMonday);\n return start;\n }\n if (unit === \"M\") return new Date(Date.UTC(year, month, 1));\n if (unit === \"q\") return new Date(Date.UTC(year, Math.floor(month / 3) * 3, 1));\n if (unit === \"y\") return new Date(Date.UTC(year, 0, 1));\n return new Date(date.getTime());\n}\n\nfunction addPeriod(date: Date, unit: string, amount: number) {\n const next = new Date(date.getTime());\n if (unit === \"w\") {\n next.setUTCDate(next.getUTCDate() + amount * 7);\n } else if (unit === \"M\") {\n next.setUTCMonth(next.getUTCMonth() + amount);\n } else if (unit === \"q\") {\n next.setUTCMonth(next.getUTCMonth() + amount * 3);\n } else if (unit === \"y\") {\n next.setUTCFullYear(next.getUTCFullYear() + amount);\n } else {\n const unitMs = UNIT_MS[unit.toLowerCase()];\n if (unitMs) next.setTime(next.getTime() + amount * unitMs);\n }\n return next;\n}\n\nconst MS_PER_MINUTE = 60_000;\nconst MS_PER_DAY = 86_400_000;\n\nexport function chooseTimestampFormat(values: Date[]): TimestampFormat {\n if (values.length === 0) return \"iso\";\n\n let min = Infinity;\n let max = -Infinity;\n for (const d of values) {\n const t = d.getTime();\n if (t < min) min = t;\n if (t > max) max = t;\n }\n const span = max - min;\n\n if (span <= MS_PER_MINUTE) return \"relative\";\n\n const minDate = new Date(min);\n const maxDate = new Date(max);\n\n if (\n minDate.getFullYear() === maxDate.getFullYear() &&\n minDate.getMonth() === maxDate.getMonth() &&\n minDate.getDate() === maxDate.getDate()\n ) {\n return \"time\";\n }\n\n if (minDate.getFullYear() === maxDate.getFullYear() && span <= MS_PER_DAY * 365) {\n return \"short\";\n }\n\n return \"iso\";\n}\n\nexport function formatTimestamp(\n date: Date,\n format: TimestampFormat,\n now: Date = new Date(),\n): string {\n switch (format) {\n case \"relative\":\n return formatRelativeTime(date, now);\n case \"time\":\n return date.toLocaleTimeString(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n case \"short\":\n return date.toLocaleString(undefined, {\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n case \"iso\":\n default:\n return formatIso(date);\n }\n}\n\nfunction formatIso(date: Date): string {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n const hh = String(date.getHours()).padStart(2, \"0\");\n const min = String(date.getMinutes()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd} ${hh}:${min}`;\n}\n\nexport type RelativeTimeOptions = {\n /**\n * \"phrase\" (default) reads \"30s ago\" / \"in 5m\" / \"just now\". \"token\" is the\n * list-row form — now / 5m / 2h / 3d / 4w / 1y, floored so a token never\n * claims the next unit early — for a meta line where \"ago\" is implied.\n */\n style?: \"phrase\" | \"token\";\n};\n\nconst TOKEN_UNITS: ReadonlyArray<[unit: string, seconds: number]> = [\n [\"y\", 365 * 86400],\n [\"w\", 7 * 86400],\n [\"d\", 86400],\n [\"h\", 3600],\n [\"m\", 60],\n];\n\n// formatRelativeTime renders a compact \"30s ago\" / \"in 5m\" / \"just now\" string,\n// or with style \"token\" the bare now / 5m / 2h / 3d / 4w token.\nexport function formatRelativeTime(\n date: Date,\n now: Date = new Date(),\n options: RelativeTimeOptions = {},\n): string {\n const diffMs = now.getTime() - date.getTime();\n const future = diffMs < 0;\n const abs = Math.abs(diffMs);\n if (options.style === \"token\") {\n const seconds = Math.floor(abs / 1000);\n const match = TOKEN_UNITS.find(([, size]) => seconds >= size);\n if (!match) return \"now\";\n const token = `${Math.floor(seconds / match[1])}${match[0]}`;\n return future ? `in ${token}` : token;\n }\n const sec = Math.round(abs / 1000);\n\n let value: string;\n if (sec < 1) value = \"just now\";\n else if (sec < 60) value = `${sec}s`;\n else if (sec < 3600) value = `${Math.round(sec / 60)}m`;\n else if (sec < 86400) value = `${Math.round(sec / 3600)}h`;\n else value = `${Math.round(sec / 86400)}d`;\n\n if (value === \"just now\") return value;\n return future ? `in ${value}` : `${value} ago`;\n}\n\n// formatDateTimeRelative renders a value as an absolute locale date+time plus a\n// parenthesised relative hint, e.g. \"Apr 15, 2026, 12:00 PM (2h ago)\". It is the\n// shared \"locale + relative\" presentation used for date-typed values across the\n// form, filter, and combobox surfaces. Unparseable strings pass through\n// unchanged (so a template token or freeform value is preserved); nullish input\n// yields an empty string. The hint is dropped when the value reads \"just now\".\nexport function formatDateTimeRelative(value: unknown, now: Date = new Date()): string {\n const parsed = parseTimestamp(value);\n if (!parsed) return typeof value === \"string\" ? value : \"\";\n const absolute = parsed.toLocaleString(undefined, {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n const relative = formatRelativeTime(parsed, now);\n return relative === \"just now\" ? absolute : `${absolute} (${relative})`;\n}\n\nexport function modeToFormat(mode: TimestampMode, dataFormat: TimestampFormat): TimestampFormat {\n switch (mode) {\n case \"absolute\":\n return \"iso\";\n case \"relative\":\n return \"relative\";\n case \"time\":\n return \"time\";\n case \"auto\":\n default:\n return dataFormat;\n }\n}\n"],"mappings":";AAEA,IAAa,gBAAgB;CAAE,OAAO;CAAiB,MAAM;CAAW,IAAI;AAAM;AAElF,IAAa,0BAA6C;CACxD;EAAE,OAAO;EAAkB,MAAM;EAAU,IAAI;CAAM;CACrD;EAAE,OAAO;EAAmB,MAAM;EAAW,IAAI;CAAM;CACvD;EAAE,OAAO;EAAe,MAAM;EAAU,IAAI;CAAM;CAClD;EAAE,OAAO;EAAgB,MAAM;EAAU,IAAI;CAAM;CACnD;CACA;EAAE,OAAO;EAAe,MAAM;EAAU,IAAI;CAAM;CAClD;EAAE,OAAO;EAAgB,MAAM;EAAW,IAAI;CAAM;AACtD;AAkCA,IAAM,eAAe;;;;;;;;;;;AAYrB,SAAS,oBAAoB,OAAuB;CAClD,MAAM,YAAY,KAAK,IAAI,KAAK;CAChC,IAAI,YAAY,cAAM,OAAO,QAAQ;CACrC,IAAI,YAAY,gBAAM,OAAO;CAC7B,IAAI,YAAY,mBAAM,OAAO,QAAQ;CACrC,OAAO,QAAQ;AACjB;AAEA,SAAS,UAAU,IAAyB;CAC1C,MAAM,IAAI,IAAI,KAAK,EAAE;CACrB,OAAO,OAAO,MAAM,EAAE,QAAQ,CAAC,IAAI,OAAO;AAC5C;AAEA,SAAgB,eAAe,OAA6B;CAC1D,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,iBAAiB,MAAM,OAAO,OAAO,MAAM,MAAM,QAAQ,CAAC,IAAI,OAAO;CAEzE,IAAI,OAAO,UAAU,UAAU,OAAO,UAAU,oBAAoB,KAAK,CAAC;CAE1E,IAAI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UAAU,WAAW,QAAQ;CACxD,MAAM,WAAW,OAAO,eAAe,KAAA,GAAW;EAChD,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;CACV,CAAC;CACD,MAAM,WAAW,mBAAmB,QAAQ,GAAG;CAC/C,OAAO,aAAa,aAAa,WAAW,GAAG,SAAS,IAAI,SAAS;AACvE;AAEA,SAAgB,aAAa,MAAqB,YAA8C;CAC9F,QAAQ,MAAR;EACE,KAAK,YACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,QACH,OAAO;EAET,SACE,OAAO;CACX;AACF"}
@@ -2,6 +2,7 @@ const require_format = require("../../lib/format.cjs");
2
2
  const require_chart_marks = require("./chart-marks.cjs");
3
3
  const require_chart_palette = require("./chart-palette.cjs");
4
4
  const require_chart_scale = require("./chart-scale.cjs");
5
+ let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  // src/data/charts/TrendChart.tsx
7
8
  var GAP = 6;
@@ -17,7 +18,9 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
17
18
  require_chart_scale.assertChartSize("TrendChart", width, height);
18
19
  series.forEach((entry) => {
19
20
  if (entry.values.length !== x.length) throw new Error(`TrendChart: series "${entry.label}" has ${entry.values.length} values for ${x.length} x positions`);
20
- entry.values.forEach((value, index) => require_chart_scale.assertFinite("TrendChart", `${entry.label}[${index}]`, value));
21
+ entry.values.forEach((value, index) => {
22
+ if (value !== null) require_chart_scale.assertFinite("TrendChart", `${entry.label}[${index}]`, value);
23
+ });
21
24
  });
22
25
  if (x.length === 0 || series.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chart_marks.ChartEmpty, {
23
26
  className,
@@ -26,7 +29,7 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
26
29
  });
27
30
  const tickFormat = yFormat ?? require_format.formatShort;
28
31
  const valueFormat = yFormat ?? require_chart_scale.formatChartValue;
29
- const all = series.flatMap((entry) => entry.values);
32
+ const all = series.flatMap((entry) => entry.values.filter((value) => value !== null));
30
33
  const ticks = require_chart_scale.niceTicks(Math.min(0, ...all), Math.max(0, ...all));
31
34
  const left = Math.max(...ticks.map((tick) => require_chart_scale.textWidth(tickFormat(tick)))) + GAP;
32
35
  const plot = {
@@ -73,7 +76,7 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
73
76
  labels.map((label, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HoverColumn, {
74
77
  index,
75
78
  plot,
76
- title: `${label} — ${series.map((entry) => `${entry.label}: ${valueFormat(entry.values[index])}`).join(" · ")}`
79
+ title: `${label} — ${series.map((entry) => `${entry.label}: ${formatPoint(entry.values[index], valueFormat)}`).join(" · ")}`
77
80
  }, `${index}-${label}`))
78
81
  ]
79
82
  })
@@ -104,37 +107,68 @@ function Axes({ plot, ticks, labels, tickFormat, width, height }) {
104
107
  children: label
105
108
  }, `${index}-${label}`) : null)] });
106
109
  }
110
+ function formatPoint(value, format) {
111
+ return value === null ? "no data" : format(value);
112
+ }
113
+ /** Consecutive present values: a `null` ends a run, so no segment is drawn across it. */
114
+ function presentRuns(plot, values) {
115
+ const runs = [];
116
+ let open = null;
117
+ for (const [index, value] of values.entries()) {
118
+ if (value === null) {
119
+ open = null;
120
+ continue;
121
+ }
122
+ if (!open) {
123
+ open = {
124
+ start: index,
125
+ points: []
126
+ };
127
+ runs.push(open);
128
+ }
129
+ open.points.push({
130
+ x: xAt(plot, index),
131
+ y: yAt(plot, value)
132
+ });
133
+ }
134
+ return runs;
135
+ }
107
136
  function SeriesMark({ label, values, color, plot, variant }) {
108
- const points = values.map((value, index) => `${xAt(plot, index)},${yAt(plot, value)}`);
109
137
  const zero = yAt(plot, 0);
110
- const lastX = xAt(plot, values.length - 1);
111
- const lastY = yAt(plot, values[values.length - 1]);
112
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
138
+ const runs = presentRuns(plot, values);
139
+ const endsAtLastX = (run) => run.start + run.points.length === values.length;
140
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
113
141
  "data-series": label,
114
- children: [
115
- variant === "area" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
116
- d: `M${xAt(plot, 0)},${zero} L${points.join(" L")} L${lastX},${zero} Z`,
117
- "data-mark": "area",
118
- fill: color,
119
- fillOpacity: .12
120
- }),
121
- values.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", {
122
- fill: "none",
123
- points: points.join(" "),
124
- stroke: color,
125
- strokeLinecap: "round",
126
- strokeLinejoin: "round",
127
- strokeWidth: 2
128
- }),
129
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
130
- cx: lastX,
131
- cy: lastY,
132
- fill: color,
133
- r: 4,
134
- stroke: require_chart_palette.CHART_INK.surface,
135
- strokeWidth: 2
136
- })
137
- ]
142
+ children: runs.map((run) => {
143
+ const points = run.points.map((point) => `${point.x},${point.y}`);
144
+ const first = run.points[0];
145
+ const last = run.points[run.points.length - 1];
146
+ const isolated = run.points.length === 1;
147
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
148
+ variant === "area" && !isolated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
149
+ d: `M${first.x},${zero} L${points.join(" L")} L${last.x},${zero} Z`,
150
+ "data-mark": "area",
151
+ fill: color,
152
+ fillOpacity: .12
153
+ }),
154
+ !isolated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", {
155
+ fill: "none",
156
+ points: points.join(" "),
157
+ stroke: color,
158
+ strokeLinecap: "round",
159
+ strokeLinejoin: "round",
160
+ strokeWidth: 2
161
+ }),
162
+ (endsAtLastX(run) || isolated) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
163
+ cx: last.x,
164
+ cy: last.y,
165
+ fill: color,
166
+ r: endsAtLastX(run) ? 4 : 3,
167
+ stroke: require_chart_palette.CHART_INK.surface,
168
+ strokeWidth: 2
169
+ })
170
+ ] }, run.start);
171
+ })
138
172
  });
139
173
  }
140
174
  function HoverColumn({ plot, index, title }) {
@@ -1 +1 @@
1
- {"version":3,"file":"TrendChart.cjs","names":["px","formatChartX","assertFinite","ChartEmpty","formatShort","formatChartValue","niceTicks","textWidth","chartColor","WithLegend","ChartFrame","labelStep","_Fragment","CHART_INK","clampLabelX"],"sources":["../../../src/data/charts/TrendChart.tsx"],"sourcesContent":["import { formatShort } from \"../../lib/format\";\nimport { ChartEmpty, ChartFrame, WithLegend } from \"./chart-marks\";\nimport { CHART_INK, chartColor } from \"./chart-palette\";\nimport {\n assertChartSize,\n assertFinite,\n clampLabelX,\n formatChartValue,\n formatChartX,\n labelStep,\n niceTicks,\n px,\n textWidth,\n X_AXIS_BAND,\n X_LABEL_INSET,\n} from \"./chart-scale\";\nimport type { ChartSeries } from \"./StackedBarChart\";\n\nexport type TrendChartProps = {\n /** ISO dates or labels, drawn evenly spaced. */\n x: string[];\n /** `values[i]` is the series' value at `x[i]`. */\n series: ChartSeries[];\n width: number;\n height: number;\n variant?: \"line\" | \"area\";\n /** Defaults to on for two or more series. */\n legend?: boolean;\n /** Formats y ticks and hover values. Ticks default to SI-short (1.2K), hover values to grouped digits. */\n yFormat?: (n: number) => string;\n /** Formats x labels; ISO dates default to \"Aug 16\". */\n xFormat?: (x: string) => string;\n className?: string;\n};\n\ntype Plot = { left: number; top: number; width: number; height: number; low: number; high: number; count: number };\n\nconst GAP = 6;\nconst PAD = 8;\n\nfunction xAt(plot: Plot, index: number): number {\n return px(plot.count === 1 ? plot.left + plot.width / 2 : plot.left + (index / (plot.count - 1)) * plot.width);\n}\n\nfunction yAt(plot: Plot, value: number): number {\n return px(plot.top + ((plot.high - value) / (plot.high - plot.low)) * plot.height);\n}\n\n/** Series over evenly spaced x positions, on a y axis of nice ticks that includes 0. */\nexport function TrendChart({ x, series, width, height, variant = \"line\", legend, yFormat, xFormat = formatChartX, className }: TrendChartProps) {\n assertChartSize(\"TrendChart\", width, height);\n series.forEach((entry) => {\n if (entry.values.length !== x.length) {\n throw new Error(`TrendChart: series \"${entry.label}\" has ${entry.values.length} values for ${x.length} x positions`);\n }\n entry.values.forEach((value, index) => assertFinite(\"TrendChart\", `${entry.label}[${index}]`, value));\n });\n if (x.length === 0 || series.length === 0) return <ChartEmpty className={className} height={height} width={width} />;\n\n const tickFormat = yFormat ?? formatShort;\n const valueFormat = yFormat ?? formatChartValue;\n const all = series.flatMap((entry) => entry.values);\n const ticks = niceTicks(Math.min(0, ...all), Math.max(0, ...all));\n const left = Math.max(...ticks.map((tick) => textWidth(tickFormat(tick)))) + GAP;\n const plot: Plot = {\n left,\n top: PAD,\n width: width - left - PAD,\n height: height - PAD - X_AXIS_BAND,\n low: ticks[0]!,\n high: ticks[ticks.length - 1]!,\n count: x.length,\n };\n if (plot.width < 8 || plot.height < 8) throw new Error(`TrendChart: ${width}×${height} leaves no plot area after the axes`);\n const colors = series.map((entry, index) => entry.color ?? chartColor(index));\n const labels = x.map(xFormat);\n\n return (\n <WithLegend\n className={className}\n items={series.map((entry, index) => ({ label: entry.label, color: colors[index]! }))}\n show={legend ?? series.length > 1}\n width={width}\n >\n {(svgClassName) => (\n <ChartFrame className={svgClassName} height={height} label={`Trend of ${series.length} series over ${x.length} points`} width={width}>\n <Axes height={height} labels={labels} plot={plot} tickFormat={tickFormat} ticks={ticks} width={width} />\n {series.map((entry, index) => (\n <SeriesMark color={colors[index]!} key={`${index}-${entry.label}`} label={entry.label} plot={plot} values={entry.values} variant={variant} />\n ))}\n {labels.map((label, index) => (\n <HoverColumn\n index={index}\n key={`${index}-${label}`}\n plot={plot}\n title={`${label} — ${series.map((entry) => `${entry.label}: ${valueFormat(entry.values[index]!)}`).join(\" · \")}`}\n />\n ))}\n </ChartFrame>\n )}\n </WithLegend>\n );\n}\n\nfunction Axes({\n plot,\n ticks,\n labels,\n tickFormat,\n width,\n height,\n}: {\n plot: Plot;\n ticks: number[];\n labels: string[];\n tickFormat: (n: number) => string;\n width: number;\n height: number;\n}) {\n const step = labelStep(labels, plot.count === 1 ? plot.width : plot.width / (plot.count - 1));\n return (\n <>\n {ticks.map((tick) => (\n <g key={tick}>\n <line stroke={CHART_INK.grid} x1={px(plot.left)} x2={px(plot.left + plot.width)} y1={yAt(plot, tick)} y2={yAt(plot, tick)} />\n <text data-role=\"y-tick\" dominantBaseline=\"central\" fill={CHART_INK.axis} textAnchor=\"end\" x={px(plot.left - GAP)} y={yAt(plot, tick)}>\n {tickFormat(tick)}\n </text>\n </g>\n ))}\n {labels.map((label, index) =>\n index % step === 0 ? (\n <text data-role=\"x-label\" fill={CHART_INK.axis} key={`${index}-${label}`} textAnchor=\"middle\" x={clampLabelX(xAt(plot, index), label, width)} y={height - X_LABEL_INSET}>\n {label}\n </text>\n ) : null,\n )}\n </>\n );\n}\n\nfunction SeriesMark({\n label,\n values,\n color,\n plot,\n variant,\n}: {\n label: string;\n values: number[];\n color: string;\n plot: Plot;\n variant: \"line\" | \"area\";\n}) {\n const points = values.map((value, index) => `${xAt(plot, index)},${yAt(plot, value)}`);\n const zero = yAt(plot, 0);\n const lastX = xAt(plot, values.length - 1);\n const lastY = yAt(plot, values[values.length - 1]!);\n return (\n <g data-series={label}>\n {variant === \"area\" && (\n <path\n d={`M${xAt(plot, 0)},${zero} L${points.join(\" L\")} L${lastX},${zero} Z`}\n data-mark=\"area\"\n fill={color}\n fillOpacity={0.12}\n />\n )}\n {values.length > 1 && (\n <polyline fill=\"none\" points={points.join(\" \")} stroke={color} strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} />\n )}\n <circle cx={lastX} cy={lastY} fill={color} r={4} stroke={CHART_INK.surface} strokeWidth={2} />\n </g>\n );\n}\n\nfunction HoverColumn({ plot, index, title }: { plot: Plot; index: number; title: string }) {\n const half = (plot.count === 1 ? plot.width : plot.width / (plot.count - 1)) / 2;\n const start = Math.max(plot.left, xAt(plot, index) - half);\n const end = Math.min(plot.left + plot.width, xAt(plot, index) + half);\n return (\n <g data-role=\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,KAAD;EAAG,aAAU;EAAb,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UAAQ,MAAa,CAAA,GACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,MAAK;GAAc,QAAQb,oBAAAA,GAAG,KAAK,MAAM;GAAG,OAAOA,oBAAAA,GAAG,MAAM,KAAK;GAAG,GAAGA,oBAAAA,GAAG,KAAK;GAAG,GAAGA,oBAAAA,GAAG,KAAK,GAAG;EAAI,CAAA,CACzG;;AAEP"}
1
+ {"version":3,"file":"TrendChart.cjs","names":["px","formatChartX","ChartEmpty","formatShort","formatChartValue","niceTicks","textWidth","chartColor","WithLegend","ChartFrame","labelStep","_Fragment","CHART_INK","clampLabelX","Fragment"],"sources":["../../../src/data/charts/TrendChart.tsx"],"sourcesContent":["import { Fragment } from \"react\";\nimport { formatShort } from \"../../lib/format\";\nimport { ChartEmpty, ChartFrame, WithLegend } from \"./chart-marks\";\nimport { CHART_INK, chartColor } from \"./chart-palette\";\nimport {\n assertChartSize,\n assertFinite,\n clampLabelX,\n formatChartValue,\n formatChartX,\n labelStep,\n niceTicks,\n px,\n textWidth,\n X_AXIS_BAND,\n X_LABEL_INSET,\n} from \"./chart-scale\";\n\n/**\n * One line of a `TrendChart`. `null` marks a point that is missing (a group absent at that tick, a\n * rate not yet computable): it is drawn as a gap, never as 0. Unlike `ChartSeries` (shared with\n * `StackedBarChart`, where every bar has a height) a trend series may have gaps.\n */\nexport type TrendSeries = { label: string; values: (number | null)[]; color?: string };\n\nexport type TrendChartProps = {\n /** ISO dates or labels, drawn evenly spaced. */\n x: string[];\n /** `values[i]` is the series' value at `x[i]`, or `null` where it has none. Other non-finite numbers throw. */\n series: TrendSeries[];\n width: number;\n height: number;\n variant?: \"line\" | \"area\";\n /** Defaults to on for two or more series. */\n legend?: boolean;\n /** Formats y ticks and hover values. Ticks default to SI-short (1.2K), hover values to grouped digits. */\n yFormat?: (n: number) => string;\n /** Formats x labels; ISO dates default to \"Aug 16\". */\n xFormat?: (x: string) => string;\n className?: string;\n};\n\ntype Plot = { left: number; top: number; width: number; height: number; low: number; high: number; count: number };\n\nconst GAP = 6;\nconst PAD = 8;\n\nfunction xAt(plot: Plot, index: number): number {\n return px(plot.count === 1 ? plot.left + plot.width / 2 : plot.left + (index / (plot.count - 1)) * plot.width);\n}\n\nfunction yAt(plot: Plot, value: number): number {\n return px(plot.top + ((plot.high - value) / (plot.high - plot.low)) * plot.height);\n}\n\n/** Series over evenly spaced x positions, on a y axis of nice ticks that includes 0. */\nexport function TrendChart({ x, series, width, height, variant = \"line\", legend, yFormat, xFormat = formatChartX, className }: TrendChartProps) {\n assertChartSize(\"TrendChart\", width, height);\n series.forEach((entry) => {\n if (entry.values.length !== x.length) {\n throw new Error(`TrendChart: series \"${entry.label}\" has ${entry.values.length} values for ${x.length} x positions`);\n }\n entry.values.forEach((value, index) => {\n if (value !== null) assertFinite(\"TrendChart\", `${entry.label}[${index}]`, value);\n });\n });\n if (x.length === 0 || series.length === 0) return <ChartEmpty className={className} height={height} width={width} />;\n\n const tickFormat = yFormat ?? formatShort;\n const valueFormat = yFormat ?? formatChartValue;\n const all = series.flatMap((entry) => entry.values.filter((value): value is number => value !== null));\n const ticks = niceTicks(Math.min(0, ...all), Math.max(0, ...all));\n const left = Math.max(...ticks.map((tick) => textWidth(tickFormat(tick)))) + GAP;\n const plot: Plot = {\n left,\n top: PAD,\n width: width - left - PAD,\n height: height - PAD - X_AXIS_BAND,\n low: ticks[0]!,\n high: ticks[ticks.length - 1]!,\n count: x.length,\n };\n if (plot.width < 8 || plot.height < 8) throw new Error(`TrendChart: ${width}×${height} leaves no plot area after the axes`);\n const colors = series.map((entry, index) => entry.color ?? chartColor(index));\n const labels = x.map(xFormat);\n\n return (\n <WithLegend\n className={className}\n items={series.map((entry, index) => ({ label: entry.label, color: colors[index]! }))}\n show={legend ?? series.length > 1}\n width={width}\n >\n {(svgClassName) => (\n <ChartFrame className={svgClassName} height={height} label={`Trend of ${series.length} series over ${x.length} points`} width={width}>\n <Axes height={height} labels={labels} plot={plot} tickFormat={tickFormat} ticks={ticks} width={width} />\n {series.map((entry, index) => (\n <SeriesMark color={colors[index]!} key={`${index}-${entry.label}`} label={entry.label} plot={plot} values={entry.values} variant={variant} />\n ))}\n {labels.map((label, index) => (\n <HoverColumn\n index={index}\n key={`${index}-${label}`}\n plot={plot}\n title={`${label} — ${series.map((entry) => `${entry.label}: ${formatPoint(entry.values[index]!, valueFormat)}`).join(\" · \")}`}\n />\n ))}\n </ChartFrame>\n )}\n </WithLegend>\n );\n}\n\nfunction Axes({\n plot,\n ticks,\n labels,\n tickFormat,\n width,\n height,\n}: {\n plot: Plot;\n ticks: number[];\n labels: string[];\n tickFormat: (n: number) => string;\n width: number;\n height: number;\n}) {\n const step = labelStep(labels, plot.count === 1 ? plot.width : plot.width / (plot.count - 1));\n return (\n <>\n {ticks.map((tick) => (\n <g key={tick}>\n <line stroke={CHART_INK.grid} x1={px(plot.left)} x2={px(plot.left + plot.width)} y1={yAt(plot, tick)} y2={yAt(plot, tick)} />\n <text data-role=\"y-tick\" dominantBaseline=\"central\" fill={CHART_INK.axis} textAnchor=\"end\" x={px(plot.left - GAP)} y={yAt(plot, tick)}>\n {tickFormat(tick)}\n </text>\n </g>\n ))}\n {labels.map((label, index) =>\n index % step === 0 ? (\n <text data-role=\"x-label\" fill={CHART_INK.axis} key={`${index}-${label}`} textAnchor=\"middle\" x={clampLabelX(xAt(plot, index), label, width)} y={height - X_LABEL_INSET}>\n {label}\n </text>\n ) : null,\n )}\n </>\n );\n}\n\nfunction formatPoint(value: number | null, format: (n: number) => string): string {\n return value === null ? \"no data\" : format(value);\n}\n\ntype Run = { start: number; points: { x: number; y: number }[] };\n\n/** Consecutive present values: a `null` ends a run, so no segment is drawn across it. */\nfunction presentRuns(plot: Plot, values: (number | null)[]): Run[] {\n const runs: Run[] = [];\n let open: Run | null = null;\n for (const [index, value] of values.entries()) {\n if (value === null) {\n open = null;\n continue;\n }\n if (!open) {\n open = { start: index, points: [] };\n runs.push(open);\n }\n open.points.push({ x: xAt(plot, index), y: yAt(plot, value) });\n }\n return runs;\n}\n\nfunction SeriesMark({\n label,\n values,\n color,\n plot,\n variant,\n}: {\n label: string;\n values: (number | null)[];\n color: string;\n plot: Plot;\n variant: \"line\" | \"area\";\n}) {\n const zero = yAt(plot, 0);\n const runs = presentRuns(plot, values);\n const endsAtLastX = (run: Run) => run.start + run.points.length === values.length;\n return (\n <g data-series={label}>\n {runs.map((run) => {\n const points = run.points.map((point) => `${point.x},${point.y}`);\n const first = run.points[0]!;\n const last = run.points[run.points.length - 1]!;\n const isolated = run.points.length === 1;\n return (\n <Fragment key={run.start}>\n {variant === \"area\" && !isolated && (\n <path d={`M${first.x},${zero} L${points.join(\" L\")} L${last.x},${zero} Z`} data-mark=\"area\" fill={color} fillOpacity={0.12} />\n )}\n {!isolated && (\n <polyline fill=\"none\" points={points.join(\" \")} stroke={color} strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} />\n )}\n {(endsAtLastX(run) || isolated) && (\n <circle cx={last.x} cy={last.y} fill={color} r={endsAtLastX(run) ? 4 : 3} stroke={CHART_INK.surface} strokeWidth={2} />\n )}\n </Fragment>\n );\n })}\n </g>\n );\n}\n\nfunction HoverColumn({ plot, index, title }: { plot: Plot; index: number; title: string }) {\n const half = (plot.count === 1 ? plot.width : plot.width / (plot.count - 1)) / 2;\n const start = Math.max(plot.left, xAt(plot, index) - half);\n const end = Math.min(plot.left + plot.width, xAt(plot, index) + half);\n return (\n <g data-role=\"hover\">\n <title>{title}</title>\n <rect fill=\"transparent\" height={px(plot.height)} width={px(end - start)} x={px(start)} y={px(plot.top)} />\n </g>\n );\n}\n"],"mappings":";;;;;;;AA4CA,IAAM,MAAM;AACZ,IAAM,MAAM;AAEZ,SAAS,IAAI,MAAY,OAAuB;CAC9C,OAAOA,oBAAAA,GAAG,KAAK,UAAU,IAAI,KAAK,OAAO,KAAK,QAA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AAG,KAAK,aACpB,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;KAAQ,IAAI,KAAK;KAAG,IAAI,KAAK;KAAG,MAAM;KAAO,GAAG,YAAY,GAAG,IAAI,IAAI;KAAG,QAAQF,sBAAAA,UAAU;KAAS,aAAa;IAAI,CAAA;GAEhH,EAAA,GAVK,IAAI,KAUT;EAEd,CAAC;CACA,CAAA;AAEP;AAEA,SAAS,YAAY,EAAE,MAAM,OAAO,SAAuD;CACzF,MAAM,QAAQ,KAAK,UAAU,IAAI,KAAK,QAAQ,KAAK,SAAS,KAAK,QAAQ,MAAM;CAC/E,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,IAAI,MAAM,KAAK,IAAI,IAAI;CACzD,MAAM,MAAM,KAAK,IAAI,KAAK,OAAO,KAAK,OAAO,IAAI,MAAM,KAAK,IAAI,IAAI;CACpE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;EAAG,aAAU;EAAb,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UAAQ,MAAa,CAAA,GACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,MAAK;GAAc,QAAQZ,oBAAAA,GAAG,KAAK,MAAM;GAAG,OAAOA,oBAAAA,GAAG,MAAM,KAAK;GAAG,GAAGA,oBAAAA,GAAG,KAAK;GAAG,GAAGA,oBAAAA,GAAG,KAAK,GAAG;EAAI,CAAA,CACzG;;AAEP"}
@@ -1,9 +1,18 @@
1
- import { ChartSeries } from './StackedBarChart.js';
1
+ /**
2
+ * One line of a `TrendChart`. `null` marks a point that is missing (a group absent at that tick, a
3
+ * rate not yet computable): it is drawn as a gap, never as 0. Unlike `ChartSeries` (shared with
4
+ * `StackedBarChart`, where every bar has a height) a trend series may have gaps.
5
+ */
6
+ export type TrendSeries = {
7
+ label: string;
8
+ values: (number | null)[];
9
+ color?: string;
10
+ };
2
11
  export type TrendChartProps = {
3
12
  /** ISO dates or labels, drawn evenly spaced. */
4
13
  x: string[];
5
- /** `values[i]` is the series' value at `x[i]`. */
6
- series: ChartSeries[];
14
+ /** `values[i]` is the series' value at `x[i]`, or `null` where it has none. Other non-finite numbers throw. */
15
+ series: TrendSeries[];
7
16
  width: number;
8
17
  height: number;
9
18
  variant?: "line" | "area";
@@ -1 +1 @@
1
- {"version":3,"file":"TrendChart.d.ts","sourceRoot":"","sources":["../../../src/data/charts/TrendChart.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,gDAAgD;IAChD,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,kDAAkD;IAClD,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAeF,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAsB,EAAE,SAAS,EAAE,EAAE,eAAe,+BAqD7I"}
1
+ {"version":3,"file":"TrendChart.d.ts","sourceRoot":"","sources":["../../../src/data/charts/TrendChart.tsx"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,eAAe,GAAG;IAC5B,gDAAgD;IAChD,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,+GAA+G;IAC/G,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAeF,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAsB,EAAE,SAAS,EAAE,EAAE,eAAe,+BAuD7I"}
@@ -2,7 +2,8 @@ import { formatShort } from "../../lib/format.js";
2
2
  import { ChartEmpty, ChartFrame, WithLegend } from "./chart-marks.js";
3
3
  import { CHART_INK, chartColor } from "./chart-palette.js";
4
4
  import { assertChartSize, assertFinite, clampLabelX, formatChartValue, formatChartX, labelStep, niceTicks, px, textWidth } from "./chart-scale.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { Fragment } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
7
  // src/data/charts/TrendChart.tsx
7
8
  var GAP = 6;
8
9
  var PAD = 8;
@@ -17,7 +18,9 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
17
18
  assertChartSize("TrendChart", width, height);
18
19
  series.forEach((entry) => {
19
20
  if (entry.values.length !== x.length) throw new Error(`TrendChart: series "${entry.label}" has ${entry.values.length} values for ${x.length} x positions`);
20
- entry.values.forEach((value, index) => assertFinite("TrendChart", `${entry.label}[${index}]`, value));
21
+ entry.values.forEach((value, index) => {
22
+ if (value !== null) assertFinite("TrendChart", `${entry.label}[${index}]`, value);
23
+ });
21
24
  });
22
25
  if (x.length === 0 || series.length === 0) return /* @__PURE__ */ jsx(ChartEmpty, {
23
26
  className,
@@ -26,7 +29,7 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
26
29
  });
27
30
  const tickFormat = yFormat ?? formatShort;
28
31
  const valueFormat = yFormat ?? formatChartValue;
29
- const all = series.flatMap((entry) => entry.values);
32
+ const all = series.flatMap((entry) => entry.values.filter((value) => value !== null));
30
33
  const ticks = niceTicks(Math.min(0, ...all), Math.max(0, ...all));
31
34
  const left = Math.max(...ticks.map((tick) => textWidth(tickFormat(tick)))) + GAP;
32
35
  const plot = {
@@ -73,7 +76,7 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
73
76
  labels.map((label, index) => /* @__PURE__ */ jsx(HoverColumn, {
74
77
  index,
75
78
  plot,
76
- title: `${label} — ${series.map((entry) => `${entry.label}: ${valueFormat(entry.values[index])}`).join(" · ")}`
79
+ title: `${label} — ${series.map((entry) => `${entry.label}: ${formatPoint(entry.values[index], valueFormat)}`).join(" · ")}`
77
80
  }, `${index}-${label}`))
78
81
  ]
79
82
  })
@@ -81,7 +84,7 @@ function TrendChart({ x, series, width, height, variant = "line", legend, yForma
81
84
  }
82
85
  function Axes({ plot, ticks, labels, tickFormat, width, height }) {
83
86
  const step = labelStep(labels, plot.count === 1 ? plot.width : plot.width / (plot.count - 1));
84
- return /* @__PURE__ */ jsxs(Fragment, { children: [ticks.map((tick) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
87
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [ticks.map((tick) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
85
88
  stroke: CHART_INK.grid,
86
89
  x1: px(plot.left),
87
90
  x2: px(plot.left + plot.width),
@@ -104,37 +107,68 @@ function Axes({ plot, ticks, labels, tickFormat, width, height }) {
104
107
  children: label
105
108
  }, `${index}-${label}`) : null)] });
106
109
  }
110
+ function formatPoint(value, format) {
111
+ return value === null ? "no data" : format(value);
112
+ }
113
+ /** Consecutive present values: a `null` ends a run, so no segment is drawn across it. */
114
+ function presentRuns(plot, values) {
115
+ const runs = [];
116
+ let open = null;
117
+ for (const [index, value] of values.entries()) {
118
+ if (value === null) {
119
+ open = null;
120
+ continue;
121
+ }
122
+ if (!open) {
123
+ open = {
124
+ start: index,
125
+ points: []
126
+ };
127
+ runs.push(open);
128
+ }
129
+ open.points.push({
130
+ x: xAt(plot, index),
131
+ y: yAt(plot, value)
132
+ });
133
+ }
134
+ return runs;
135
+ }
107
136
  function SeriesMark({ label, values, color, plot, variant }) {
108
- const points = values.map((value, index) => `${xAt(plot, index)},${yAt(plot, value)}`);
109
137
  const zero = yAt(plot, 0);
110
- const lastX = xAt(plot, values.length - 1);
111
- const lastY = yAt(plot, values[values.length - 1]);
112
- return /* @__PURE__ */ jsxs("g", {
138
+ const runs = presentRuns(plot, values);
139
+ const endsAtLastX = (run) => run.start + run.points.length === values.length;
140
+ return /* @__PURE__ */ jsx("g", {
113
141
  "data-series": label,
114
- children: [
115
- variant === "area" && /* @__PURE__ */ jsx("path", {
116
- d: `M${xAt(plot, 0)},${zero} L${points.join(" L")} L${lastX},${zero} Z`,
117
- "data-mark": "area",
118
- fill: color,
119
- fillOpacity: .12
120
- }),
121
- values.length > 1 && /* @__PURE__ */ jsx("polyline", {
122
- fill: "none",
123
- points: points.join(" "),
124
- stroke: color,
125
- strokeLinecap: "round",
126
- strokeLinejoin: "round",
127
- strokeWidth: 2
128
- }),
129
- /* @__PURE__ */ jsx("circle", {
130
- cx: lastX,
131
- cy: lastY,
132
- fill: color,
133
- r: 4,
134
- stroke: CHART_INK.surface,
135
- strokeWidth: 2
136
- })
137
- ]
142
+ children: runs.map((run) => {
143
+ const points = run.points.map((point) => `${point.x},${point.y}`);
144
+ const first = run.points[0];
145
+ const last = run.points[run.points.length - 1];
146
+ const isolated = run.points.length === 1;
147
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
148
+ variant === "area" && !isolated && /* @__PURE__ */ jsx("path", {
149
+ d: `M${first.x},${zero} L${points.join(" L")} L${last.x},${zero} Z`,
150
+ "data-mark": "area",
151
+ fill: color,
152
+ fillOpacity: .12
153
+ }),
154
+ !isolated && /* @__PURE__ */ jsx("polyline", {
155
+ fill: "none",
156
+ points: points.join(" "),
157
+ stroke: color,
158
+ strokeLinecap: "round",
159
+ strokeLinejoin: "round",
160
+ strokeWidth: 2
161
+ }),
162
+ (endsAtLastX(run) || isolated) && /* @__PURE__ */ jsx("circle", {
163
+ cx: last.x,
164
+ cy: last.y,
165
+ fill: color,
166
+ r: endsAtLastX(run) ? 4 : 3,
167
+ stroke: CHART_INK.surface,
168
+ strokeWidth: 2
169
+ })
170
+ ] }, run.start);
171
+ })
138
172
  });
139
173
  }
140
174
  function HoverColumn({ plot, index, title }) {
@@ -1 +1 @@
1
- {"version":3,"file":"TrendChart.js","names":["_Fragment"],"sources":["../../../src/data/charts/TrendChart.tsx"],"sourcesContent":["import { formatShort } from \"../../lib/format\";\nimport { ChartEmpty, ChartFrame, WithLegend } from \"./chart-marks\";\nimport { CHART_INK, chartColor } from \"./chart-palette\";\nimport {\n assertChartSize,\n assertFinite,\n clampLabelX,\n formatChartValue,\n formatChartX,\n labelStep,\n niceTicks,\n px,\n textWidth,\n X_AXIS_BAND,\n X_LABEL_INSET,\n} from \"./chart-scale\";\nimport type { ChartSeries } from \"./StackedBarChart\";\n\nexport type TrendChartProps = {\n /** ISO dates or labels, drawn evenly spaced. */\n x: string[];\n /** `values[i]` is the series' value at `x[i]`. */\n series: ChartSeries[];\n width: number;\n height: number;\n variant?: \"line\" | \"area\";\n /** Defaults to on for two or more series. */\n legend?: boolean;\n /** Formats y ticks and hover values. Ticks default to SI-short (1.2K), hover values to grouped digits. */\n yFormat?: (n: number) => string;\n /** Formats x labels; ISO dates default to \"Aug 16\". */\n xFormat?: (x: string) => string;\n className?: string;\n};\n\ntype Plot = { left: number; top: number; width: number; height: number; low: number; high: number; count: number };\n\nconst GAP = 6;\nconst PAD = 8;\n\nfunction xAt(plot: Plot, index: number): number {\n return px(plot.count === 1 ? plot.left + plot.width / 2 : plot.left + (index / (plot.count - 1)) * plot.width);\n}\n\nfunction yAt(plot: Plot, value: number): number {\n return px(plot.top + ((plot.high - value) / (plot.high - plot.low)) * plot.height);\n}\n\n/** Series over evenly spaced x positions, on a y axis of nice ticks that includes 0. */\nexport function TrendChart({ x, series, width, height, variant = \"line\", legend, yFormat, xFormat = formatChartX, className }: TrendChartProps) {\n assertChartSize(\"TrendChart\", width, height);\n series.forEach((entry) => {\n if (entry.values.length !== x.length) {\n throw new Error(`TrendChart: series \"${entry.label}\" has ${entry.values.length} values for ${x.length} x positions`);\n }\n entry.values.forEach((value, index) => assertFinite(\"TrendChart\", `${entry.label}[${index}]`, value));\n });\n if (x.length === 0 || series.length === 0) return <ChartEmpty className={className} height={height} width={width} />;\n\n const tickFormat = yFormat ?? formatShort;\n const valueFormat = yFormat ?? formatChartValue;\n const all = series.flatMap((entry) => entry.values);\n const ticks = niceTicks(Math.min(0, ...all), Math.max(0, ...all));\n const left = Math.max(...ticks.map((tick) => textWidth(tickFormat(tick)))) + GAP;\n const plot: Plot = {\n left,\n top: PAD,\n width: width - left - PAD,\n height: height - PAD - X_AXIS_BAND,\n low: ticks[0]!,\n high: ticks[ticks.length - 1]!,\n count: x.length,\n };\n if (plot.width < 8 || plot.height < 8) throw new Error(`TrendChart: ${width}×${height} leaves no plot area after the axes`);\n const colors = series.map((entry, index) => entry.color ?? chartColor(index));\n const labels = x.map(xFormat);\n\n return (\n <WithLegend\n className={className}\n items={series.map((entry, index) => ({ label: entry.label, color: colors[index]! }))}\n show={legend ?? series.length > 1}\n width={width}\n >\n {(svgClassName) => (\n <ChartFrame className={svgClassName} height={height} label={`Trend of ${series.length} series over ${x.length} points`} width={width}>\n <Axes height={height} labels={labels} plot={plot} tickFormat={tickFormat} ticks={ticks} width={width} />\n {series.map((entry, index) => (\n <SeriesMark color={colors[index]!} key={`${index}-${entry.label}`} label={entry.label} plot={plot} values={entry.values} variant={variant} />\n ))}\n {labels.map((label, index) => (\n <HoverColumn\n index={index}\n key={`${index}-${label}`}\n plot={plot}\n title={`${label} — ${series.map((entry) => `${entry.label}: ${valueFormat(entry.values[index]!)}`).join(\" · \")}`}\n />\n ))}\n </ChartFrame>\n )}\n </WithLegend>\n );\n}\n\nfunction Axes({\n plot,\n ticks,\n labels,\n tickFormat,\n width,\n height,\n}: {\n plot: Plot;\n ticks: number[];\n labels: string[];\n tickFormat: (n: number) => string;\n width: number;\n height: number;\n}) {\n const step = labelStep(labels, plot.count === 1 ? plot.width : plot.width / (plot.count - 1));\n return (\n <>\n {ticks.map((tick) => (\n <g key={tick}>\n <line stroke={CHART_INK.grid} x1={px(plot.left)} x2={px(plot.left + plot.width)} y1={yAt(plot, tick)} y2={yAt(plot, tick)} />\n <text data-role=\"y-tick\" dominantBaseline=\"central\" fill={CHART_INK.axis} textAnchor=\"end\" x={px(plot.left - GAP)} y={yAt(plot, tick)}>\n {tickFormat(tick)}\n </text>\n </g>\n ))}\n {labels.map((label, index) =>\n index % step === 0 ? (\n <text data-role=\"x-label\" fill={CHART_INK.axis} key={`${index}-${label}`} textAnchor=\"middle\" x={clampLabelX(xAt(plot, index), label, width)} y={height - X_LABEL_INSET}>\n {label}\n </text>\n ) : null,\n )}\n </>\n );\n}\n\nfunction SeriesMark({\n label,\n values,\n color,\n plot,\n variant,\n}: {\n label: string;\n values: number[];\n color: string;\n plot: Plot;\n variant: \"line\" | \"area\";\n}) {\n const points = values.map((value, index) => `${xAt(plot, index)},${yAt(plot, value)}`);\n const zero = yAt(plot, 0);\n const lastX = xAt(plot, values.length - 1);\n const lastY = yAt(plot, values[values.length - 1]!);\n return (\n <g data-series={label}>\n {variant === \"area\" && (\n <path\n d={`M${xAt(plot, 0)},${zero} L${points.join(\" L\")} L${lastX},${zero} Z`}\n data-mark=\"area\"\n fill={color}\n fillOpacity={0.12}\n />\n )}\n {values.length > 1 && (\n <polyline fill=\"none\" points={points.join(\" \")} stroke={color} strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} />\n )}\n <circle cx={lastX} cy={lastY} fill={color} r={4} stroke={CHART_INK.surface} strokeWidth={2} />\n </g>\n );\n}\n\nfunction HoverColumn({ plot, index, title }: { plot: Plot; index: number; title: string }) {\n const half = (plot.count === 1 ? plot.width : plot.width / (plot.count - 1)) / 2;\n const start = Math.max(plot.left, xAt(plot, index) - half);\n const end = Math.min(plot.left + plot.width, xAt(plot, index) + half);\n return (\n <g data-role=\"hover\">\n <title>{title}</title>\n <rect fill=\"transparent\" height={px(plot.height)} width={px(end - start)} x={px(start)} y={px(plot.top)} />\n </g>\n );\n}\n"],"mappings":";;;;;;AAqCA,IAAM,MAAM;AACZ,IAAM,MAAM;AAEZ,SAAS,IAAI,MAAY,OAAuB;CAC9C,OAAO,GAAG,KAAK,UAAU,IAAI,KAAK,OAAO,KAAK,QAAQ,IAAI,KAAK,OAAQ,SAAS,KAAK,QAAQ,KAAM,KAAK,KAAK;AAC/G;AAEA,SAAS,IAAI,MAAY,OAAuB;CAC9C,OAAO,GAAG,KAAK,OAAQ,KAAK,OAAO,UAAU,KAAK,OAAO,KAAK,OAAQ,KAAK,MAAM;AACnF;;AAGA,SAAgB,WAAW,EAAE,GAAG,QAAQ,OAAO,QAAQ,UAAU,QAAQ,QAAQ,SAAS,UAAU,cAAc,aAA8B;CAC9I,gBAAgB,cAAc,OAAO,MAAM;CAC3C,OAAO,SAAS,UAAU;EACxB,IAAI,MAAM,OAAO,WAAW,EAAE,QAC5B,MAAM,IAAI,MAAM,uBAAuB,MAAM,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D,EAAA,UAAQ,MAAa,CAAA,GACrB,oBAAC,QAAD;GAAM,MAAK;GAAc,QAAQ,GAAG,KAAK,MAAM;GAAG,OAAO,GAAG,MAAM,KAAK;GAAG,GAAG,GAAG,KAAK;GAAG,GAAG,GAAG,KAAK,GAAG;EAAI,CAAA,CACzG;;AAEP"}
1
+ {"version":3,"file":"TrendChart.js","names":["_Fragment"],"sources":["../../../src/data/charts/TrendChart.tsx"],"sourcesContent":["import { Fragment } from \"react\";\nimport { formatShort } from \"../../lib/format\";\nimport { ChartEmpty, ChartFrame, WithLegend } from \"./chart-marks\";\nimport { CHART_INK, chartColor } from \"./chart-palette\";\nimport {\n assertChartSize,\n assertFinite,\n clampLabelX,\n formatChartValue,\n formatChartX,\n labelStep,\n niceTicks,\n px,\n textWidth,\n X_AXIS_BAND,\n X_LABEL_INSET,\n} from \"./chart-scale\";\n\n/**\n * One line of a `TrendChart`. `null` marks a point that is missing (a group absent at that tick, a\n * rate not yet computable): it is drawn as a gap, never as 0. Unlike `ChartSeries` (shared with\n * `StackedBarChart`, where every bar has a height) a trend series may have gaps.\n */\nexport type TrendSeries = { label: string; values: (number | null)[]; color?: string };\n\nexport type TrendChartProps = {\n /** ISO dates or labels, drawn evenly spaced. */\n x: string[];\n /** `values[i]` is the series' value at `x[i]`, or `null` where it has none. Other non-finite numbers throw. */\n series: TrendSeries[];\n width: number;\n height: number;\n variant?: \"line\" | \"area\";\n /** Defaults to on for two or more series. */\n legend?: boolean;\n /** Formats y ticks and hover values. Ticks default to SI-short (1.2K), hover values to grouped digits. */\n yFormat?: (n: number) => string;\n /** Formats x labels; ISO dates default to \"Aug 16\". */\n xFormat?: (x: string) => string;\n className?: string;\n};\n\ntype Plot = { left: number; top: number; width: number; height: number; low: number; high: number; count: number };\n\nconst GAP = 6;\nconst PAD = 8;\n\nfunction xAt(plot: Plot, index: number): number {\n return px(plot.count === 1 ? plot.left + plot.width / 2 : plot.left + (index / (plot.count - 1)) * plot.width);\n}\n\nfunction yAt(plot: Plot, value: number): number {\n return px(plot.top + ((plot.high - value) / (plot.high - plot.low)) * plot.height);\n}\n\n/** Series over evenly spaced x positions, on a y axis of nice ticks that includes 0. */\nexport function TrendChart({ x, series, width, height, variant = \"line\", legend, yFormat, xFormat = formatChartX, className }: TrendChartProps) {\n assertChartSize(\"TrendChart\", width, height);\n series.forEach((entry) => {\n if (entry.values.length !== x.length) {\n throw new Error(`TrendChart: series \"${entry.label}\" has ${entry.values.length} values for ${x.length} x positions`);\n }\n entry.values.forEach((value, index) => {\n if (value !== null) assertFinite(\"TrendChart\", `${entry.label}[${index}]`, value);\n });\n });\n if (x.length === 0 || series.length === 0) return <ChartEmpty className={className} height={height} width={width} />;\n\n const tickFormat = yFormat ?? formatShort;\n const valueFormat = yFormat ?? formatChartValue;\n const all = series.flatMap((entry) => entry.values.filter((value): value is number => value !== null));\n const ticks = niceTicks(Math.min(0, ...all), Math.max(0, ...all));\n const left = Math.max(...ticks.map((tick) => textWidth(tickFormat(tick)))) + GAP;\n const plot: Plot = {\n left,\n top: PAD,\n width: width - left - PAD,\n height: height - PAD - X_AXIS_BAND,\n low: ticks[0]!,\n high: ticks[ticks.length - 1]!,\n count: x.length,\n };\n if (plot.width < 8 || plot.height < 8) throw new Error(`TrendChart: ${width}×${height} leaves no plot area after the axes`);\n const colors = series.map((entry, index) => entry.color ?? chartColor(index));\n const labels = x.map(xFormat);\n\n return (\n <WithLegend\n className={className}\n items={series.map((entry, index) => ({ label: entry.label, color: colors[index]! }))}\n show={legend ?? series.length > 1}\n width={width}\n >\n {(svgClassName) => (\n <ChartFrame className={svgClassName} height={height} label={`Trend of ${series.length} series over ${x.length} points`} width={width}>\n <Axes height={height} labels={labels} plot={plot} tickFormat={tickFormat} ticks={ticks} width={width} />\n {series.map((entry, index) => (\n <SeriesMark color={colors[index]!} key={`${index}-${entry.label}`} label={entry.label} plot={plot} values={entry.values} variant={variant} />\n ))}\n {labels.map((label, index) => (\n <HoverColumn\n index={index}\n key={`${index}-${label}`}\n plot={plot}\n title={`${label} — ${series.map((entry) => `${entry.label}: ${formatPoint(entry.values[index]!, valueFormat)}`).join(\" · \")}`}\n />\n ))}\n </ChartFrame>\n )}\n </WithLegend>\n );\n}\n\nfunction Axes({\n plot,\n ticks,\n labels,\n tickFormat,\n width,\n height,\n}: {\n plot: Plot;\n ticks: number[];\n labels: string[];\n tickFormat: (n: number) => string;\n width: number;\n height: number;\n}) {\n const step = labelStep(labels, plot.count === 1 ? plot.width : plot.width / (plot.count - 1));\n return (\n <>\n {ticks.map((tick) => (\n <g key={tick}>\n <line stroke={CHART_INK.grid} x1={px(plot.left)} x2={px(plot.left + plot.width)} y1={yAt(plot, tick)} y2={yAt(plot, tick)} />\n <text data-role=\"y-tick\" dominantBaseline=\"central\" fill={CHART_INK.axis} textAnchor=\"end\" x={px(plot.left - GAP)} y={yAt(plot, tick)}>\n {tickFormat(tick)}\n </text>\n </g>\n ))}\n {labels.map((label, index) =>\n index % step === 0 ? (\n <text data-role=\"x-label\" fill={CHART_INK.axis} key={`${index}-${label}`} textAnchor=\"middle\" x={clampLabelX(xAt(plot, index), label, width)} y={height - X_LABEL_INSET}>\n {label}\n </text>\n ) : null,\n )}\n </>\n );\n}\n\nfunction formatPoint(value: number | null, format: (n: number) => string): string {\n return value === null ? \"no data\" : format(value);\n}\n\ntype Run = { start: number; points: { x: number; y: number }[] };\n\n/** Consecutive present values: a `null` ends a run, so no segment is drawn across it. */\nfunction presentRuns(plot: Plot, values: (number | null)[]): Run[] {\n const runs: Run[] = [];\n let open: Run | null = null;\n for (const [index, value] of values.entries()) {\n if (value === null) {\n open = null;\n continue;\n }\n if (!open) {\n open = { start: index, points: [] };\n runs.push(open);\n }\n open.points.push({ x: xAt(plot, index), y: yAt(plot, value) });\n }\n return runs;\n}\n\nfunction SeriesMark({\n label,\n values,\n color,\n plot,\n variant,\n}: {\n label: string;\n values: (number | null)[];\n color: string;\n plot: Plot;\n variant: \"line\" | \"area\";\n}) {\n const zero = yAt(plot, 0);\n const runs = presentRuns(plot, values);\n const endsAtLastX = (run: Run) => run.start + run.points.length === values.length;\n return (\n <g data-series={label}>\n {runs.map((run) => {\n const points = run.points.map((point) => `${point.x},${point.y}`);\n const first = run.points[0]!;\n const last = run.points[run.points.length - 1]!;\n const isolated = run.points.length === 1;\n return (\n <Fragment key={run.start}>\n {variant === \"area\" && !isolated && (\n <path d={`M${first.x},${zero} L${points.join(\" L\")} L${last.x},${zero} Z`} data-mark=\"area\" fill={color} fillOpacity={0.12} />\n )}\n {!isolated && (\n <polyline fill=\"none\" points={points.join(\" \")} stroke={color} strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} />\n )}\n {(endsAtLastX(run) || isolated) && (\n <circle cx={last.x} cy={last.y} fill={color} r={endsAtLastX(run) ? 4 : 3} stroke={CHART_INK.surface} strokeWidth={2} />\n )}\n </Fragment>\n );\n })}\n </g>\n );\n}\n\nfunction HoverColumn({ plot, index, title }: { plot: Plot; index: number; title: string }) {\n const half = (plot.count === 1 ? plot.width : plot.width / (plot.count - 1)) / 2;\n const start = Math.max(plot.left, xAt(plot, index) - half);\n const end = Math.min(plot.left + plot.width, xAt(plot, index) + half);\n return (\n <g data-role=\"hover\">\n <title>{title}</title>\n <rect fill=\"transparent\" height={px(plot.height)} width={px(end - start)} x={px(start)} y={px(plot.top)} />\n </g>\n );\n}\n"],"mappings":";;;;;;;AA4CA,IAAM,MAAM;AACZ,IAAM,MAAM;AAEZ,SAAS,IAAI,MAAY,OAAuB;CAC9C,OAAO,GAAG,KAAK,UAAU,IAAI,KAAK,OAAO,KAAK,QAAQ,IAAI,KAAK,OAAQ,SAAS,KAAK,QAAQ,KAAM,KAAK,KAAK;AAC/G;AAEA,SAAS,IAAI,MAAY,OAAuB;CAC9C,OAAO,GAAG,KAAK,OAAQ,KAAK,OAAO,UAAU,KAAK,OAAO,KAAK,OAAQ,KAAK,MAAM;AACnF;;AAGA,SAAgB,WAAW,EAAE,GAAG,QAAQ,OAAO,QAAQ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Props } from './Char
3
3
  export { CHART_PALETTE, chartColor } from './chart-palette.js';
4
4
  export { Sparkline, type SparklineProps } from './Sparkline.js';
5
5
  export { StackedBarChart, type ChartSeries, type StackedBarChartProps } from './StackedBarChart.js';
6
- export { TrendChart, type TrendChartProps } from './TrendChart.js';
6
+ export { TrendChart, type TrendChartProps, type TrendSeries } from './TrendChart.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/charts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/charts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -7,11 +7,17 @@ const require_Attachment = require("./Attachment.cjs");
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  // src/data/chat/PromptInput.tsx
10
+ var DEFAULT_SUBMIT_VARIANT = {
11
+ kind: "send",
12
+ icon: require_UiArrowUp.UiArrowUp,
13
+ variant: "default",
14
+ description: "Send"
15
+ };
10
16
  /** Auto-growing prompt textarea with a submit/stop button, optional attachment
11
17
  * controls, and a toolbar slot (model/effort selectors). Enter submits;
12
18
  * Shift+Enter inserts a newline; while streaming the button becomes a stop
13
19
  * control. */
14
- function PromptInput({ onSubmit, onStop, status, allowSubmitWhileStreaming = false, disabled = false, disabledReason, stopLabel = "Stop", placeholder = "What would you like to know?", enableAttachments = false, attachmentUpload, acceptedMediaTypes, attachmentLimits, draft, toolbar, inputAccessory, className }) {
20
+ function PromptInput({ onSubmit, onStop, status, allowSubmitWhileStreaming = false, disabled = false, disabledReason, stopLabel = "Stop", submitVariant = DEFAULT_SUBMIT_VARIANT, placeholder = "What would you like to know?", enableAttachments = false, attachmentUpload, acceptedMediaTypes, attachmentLimits, draft, toolbar, inputAccessory, className }) {
15
21
  const [value, setValue] = (0, react.useState)("");
16
22
  const [files, setFiles] = (0, react.useState)([]);
17
23
  const [attachmentError, setAttachmentError] = (0, react.useState)("");
@@ -85,10 +91,13 @@ function PromptInput({ onSubmit, onStop, status, allowSubmitWhileStreaming = fal
85
91
  (!isGenerating || allowSubmitWhileStreaming) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
86
92
  type: "submit",
87
93
  size: "icon",
94
+ variant: submitVariant.variant,
88
95
  "aria-label": "Send",
96
+ title: submitVariant.description,
97
+ "data-delivery": submitVariant.kind,
89
98
  disabled: !canSubmit,
90
99
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
91
- icon: require_UiArrowUp.UiArrowUp,
100
+ icon: submitVariant.icon,
92
101
  className: "size-4"
93
102
  })
94
103
  })