@flanksource/clicky-ui 0.3.84 → 0.3.86

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 (219) hide show
  1. package/dist/components/Combobox.cjs +8 -6
  2. package/dist/components/Combobox.cjs.map +1 -1
  3. package/dist/components/Combobox.d.ts.map +1 -1
  4. package/dist/components/Combobox.js +8 -6
  5. package/dist/components/Combobox.js.map +1 -1
  6. package/dist/components/ComboboxMenu.cjs +7 -4
  7. package/dist/components/ComboboxMenu.cjs.map +1 -1
  8. package/dist/components/ComboboxMenu.d.ts +3 -2
  9. package/dist/components/ComboboxMenu.d.ts.map +1 -1
  10. package/dist/components/ComboboxMenu.js +7 -4
  11. package/dist/components/ComboboxMenu.js.map +1 -1
  12. package/dist/components/FilterBar.cjs +64 -47
  13. package/dist/components/FilterBar.cjs.map +1 -1
  14. package/dist/components/FilterBar.d.ts +20 -2
  15. package/dist/components/FilterBar.d.ts.map +1 -1
  16. package/dist/components/FilterBar.js +63 -46
  17. package/dist/components/FilterBar.js.map +1 -1
  18. package/dist/components/TimeRange.cjs +156 -128
  19. package/dist/components/TimeRange.cjs.map +1 -1
  20. package/dist/components/TimeRange.d.ts +8 -1
  21. package/dist/components/TimeRange.d.ts.map +1 -1
  22. package/dist/components/TimeRange.js +156 -128
  23. package/dist/components/TimeRange.js.map +1 -1
  24. package/dist/components/combobox-types.d.ts +5 -0
  25. package/dist/components/combobox-types.d.ts.map +1 -1
  26. package/dist/components/filter-bar-context.cjs.map +1 -1
  27. package/dist/components/filter-bar-context.d.ts +2 -0
  28. package/dist/components/filter-bar-context.d.ts.map +1 -1
  29. package/dist/components/filter-bar-context.js.map +1 -1
  30. package/dist/components/filter-bar-field-utils.cjs +18 -4
  31. package/dist/components/filter-bar-field-utils.cjs.map +1 -1
  32. package/dist/components/filter-bar-field-utils.d.ts +3 -2
  33. package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
  34. package/dist/components/filter-bar-field-utils.js +19 -5
  35. package/dist/components/filter-bar-field-utils.js.map +1 -1
  36. package/dist/components/filter-bar-menu.cjs +189 -0
  37. package/dist/components/filter-bar-menu.cjs.map +1 -0
  38. package/dist/components/filter-bar-menu.d.ts +25 -0
  39. package/dist/components/filter-bar-menu.d.ts.map +1 -0
  40. package/dist/components/filter-bar-menu.js +189 -0
  41. package/dist/components/filter-bar-menu.js.map +1 -0
  42. package/dist/components/filter-bar-multi.cjs +1 -1
  43. package/dist/components/filter-bar-multi.cjs.map +1 -1
  44. package/dist/components/filter-bar-multi.js +2 -2
  45. package/dist/components/filter-bar-multi.js.map +1 -1
  46. package/dist/components/filter-bar-popup.cjs +37 -0
  47. package/dist/components/filter-bar-popup.cjs.map +1 -0
  48. package/dist/components/filter-bar-popup.d.ts +32 -0
  49. package/dist/components/filter-bar-popup.d.ts.map +1 -0
  50. package/dist/components/filter-bar-popup.js +37 -0
  51. package/dist/components/filter-bar-popup.js.map +1 -0
  52. package/dist/components/filter-bar-tree.cjs +1 -1
  53. package/dist/components/filter-bar-tree.cjs.map +1 -1
  54. package/dist/components/filter-bar-tree.js +2 -2
  55. package/dist/components/filter-bar-tree.js.map +1 -1
  56. package/dist/components/json-schema-form-table-array.cjs +5 -3
  57. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  58. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  59. package/dist/components/json-schema-form-table-array.js +5 -3
  60. package/dist/components/json-schema-form-table-array.js.map +1 -1
  61. package/dist/components.cjs +1 -1
  62. package/dist/components.js +1 -1
  63. package/dist/connections/ConnectionPicker.cjs +6 -2
  64. package/dist/connections/ConnectionPicker.cjs.map +1 -1
  65. package/dist/connections/ConnectionPicker.d.ts.map +1 -1
  66. package/dist/connections/ConnectionPicker.js +6 -2
  67. package/dist/connections/ConnectionPicker.js.map +1 -1
  68. package/dist/connections/CreateConnectionDialog.cjs +8 -21
  69. package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
  70. package/dist/connections/CreateConnectionDialog.d.ts +2 -1
  71. package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
  72. package/dist/connections/CreateConnectionDialog.js +8 -21
  73. package/dist/connections/CreateConnectionDialog.js.map +1 -1
  74. package/dist/data/ExpandableMarkdown.cjs +59 -0
  75. package/dist/data/ExpandableMarkdown.cjs.map +1 -0
  76. package/dist/data/ExpandableMarkdown.d.ts +17 -0
  77. package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
  78. package/dist/data/ExpandableMarkdown.js +59 -0
  79. package/dist/data/ExpandableMarkdown.js.map +1 -0
  80. package/dist/data/MultiGaugeBar.cjs +49 -21
  81. package/dist/data/MultiGaugeBar.cjs.map +1 -1
  82. package/dist/data/MultiGaugeBar.d.ts +5 -2
  83. package/dist/data/MultiGaugeBar.d.ts.map +1 -1
  84. package/dist/data/MultiGaugeBar.js +49 -21
  85. package/dist/data/MultiGaugeBar.js.map +1 -1
  86. package/dist/data/flow-node/BoxNode.cjs +45 -0
  87. package/dist/data/flow-node/BoxNode.cjs.map +1 -0
  88. package/dist/data/flow-node/BoxNode.d.ts +28 -0
  89. package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
  90. package/dist/data/flow-node/BoxNode.js +45 -0
  91. package/dist/data/flow-node/BoxNode.js.map +1 -0
  92. package/dist/data/flow-node/FlowMetrics.cjs +208 -0
  93. package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
  94. package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
  95. package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
  96. package/dist/data/flow-node/FlowMetrics.js +206 -0
  97. package/dist/data/flow-node/FlowMetrics.js.map +1 -0
  98. package/dist/data/flow-node/WorkloadNode.cjs +63 -0
  99. package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
  100. package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
  101. package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
  102. package/dist/data/flow-node/WorkloadNode.js +63 -0
  103. package/dist/data/flow-node/WorkloadNode.js.map +1 -0
  104. package/dist/data/flow-node/index.d.ts +5 -0
  105. package/dist/data/flow-node/index.d.ts.map +1 -0
  106. package/dist/data/flow-node/latency.cjs +37 -0
  107. package/dist/data/flow-node/latency.cjs.map +1 -0
  108. package/dist/data/flow-node/latency.d.ts +13 -0
  109. package/dist/data/flow-node/latency.d.ts.map +1 -0
  110. package/dist/data/flow-node/latency.js +35 -0
  111. package/dist/data/flow-node/latency.js.map +1 -0
  112. package/dist/data/traces/index.d.ts +1 -0
  113. package/dist/data/traces/index.d.ts.map +1 -1
  114. package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
  115. package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
  116. package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
  117. package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
  118. package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
  119. package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
  120. package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
  121. package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
  122. package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
  123. package/dist/data/traces/otel/QueryBar.cjs +83 -10
  124. package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
  125. package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
  126. package/dist/data/traces/otel/QueryBar.js +83 -10
  127. package/dist/data/traces/otel/QueryBar.js.map +1 -1
  128. package/dist/data/traces/otel/TraceResults.cjs +81 -13
  129. package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
  130. package/dist/data/traces/otel/TraceResults.d.ts +11 -3
  131. package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
  132. package/dist/data/traces/otel/TraceResults.js +81 -13
  133. package/dist/data/traces/otel/TraceResults.js.map +1 -1
  134. package/dist/data/traces/otel/api.cjs.map +1 -1
  135. package/dist/data/traces/otel/api.d.ts +14 -0
  136. package/dist/data/traces/otel/api.d.ts.map +1 -1
  137. package/dist/data/traces/otel/api.js.map +1 -1
  138. package/dist/data/traces/otel/query.cjs +2 -2
  139. package/dist/data/traces/otel/query.cjs.map +1 -1
  140. package/dist/data/traces/otel/query.d.ts +1 -1
  141. package/dist/data/traces/otel/query.d.ts.map +1 -1
  142. package/dist/data/traces/otel/query.js +2 -2
  143. package/dist/data/traces/otel/query.js.map +1 -1
  144. package/dist/data/version-info.cjs +3 -3
  145. package/dist/data/version-info.cjs.map +1 -1
  146. package/dist/data/version-info.js +3 -3
  147. package/dist/data/version-info.js.map +1 -1
  148. package/dist/data/workload-panel/MemoryStack.cjs +38 -1
  149. package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
  150. package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
  151. package/dist/data/workload-panel/MemoryStack.js +38 -1
  152. package/dist/data/workload-panel/MemoryStack.js.map +1 -1
  153. package/dist/data.cjs +18 -1
  154. package/dist/data.d.ts +2 -0
  155. package/dist/data.d.ts.map +1 -1
  156. package/dist/data.js +8 -2
  157. package/dist/file-findings/AnnotatedCode.cjs +18 -2
  158. package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
  159. package/dist/file-findings/AnnotatedCode.d.ts +2 -0
  160. package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
  161. package/dist/file-findings/AnnotatedCode.js +18 -2
  162. package/dist/file-findings/AnnotatedCode.js.map +1 -1
  163. package/dist/file-findings/FileFindingsView.cjs.map +1 -1
  164. package/dist/file-findings/FileFindingsView.d.ts +2 -0
  165. package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
  166. package/dist/file-findings/FileFindingsView.js.map +1 -1
  167. package/dist/file-findings/file-review/FileReview.cjs +2 -1
  168. package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
  169. package/dist/file-findings/file-review/FileReview.d.ts +3 -1
  170. package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
  171. package/dist/file-findings/file-review/FileReview.js +2 -1
  172. package/dist/file-findings/file-review/FileReview.js.map +1 -1
  173. package/dist/index.cjs +18 -1
  174. package/dist/index.js +8 -2
  175. package/dist/profiles/editor/profileEditor.cjs +29 -30
  176. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  177. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  178. package/dist/profiles/editor/profileEditor.js +29 -30
  179. package/dist/profiles/editor/profileEditor.js.map +1 -1
  180. package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
  181. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  182. package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
  183. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  184. package/dist/profiles/editor/profileEditorPreview.js +44 -43
  185. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  186. package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
  187. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  188. package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
  189. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  190. package/dist/profiles/editor/profileMappingPreview.js +155 -50
  191. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  192. package/dist/profiles/editor/sampleError.cjs +29 -0
  193. package/dist/profiles/editor/sampleError.cjs.map +1 -0
  194. package/dist/profiles/editor/sampleError.d.ts +16 -0
  195. package/dist/profiles/editor/sampleError.d.ts.map +1 -0
  196. package/dist/profiles/editor/sampleError.js +27 -0
  197. package/dist/profiles/editor/sampleError.js.map +1 -0
  198. package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
  199. package/dist/profiles/query/profileSampleResult.d.ts +2 -0
  200. package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
  201. package/dist/profiles/query/profileSampleResult.js.map +1 -1
  202. package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
  203. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  204. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
  205. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  206. package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
  207. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  208. package/dist/react-grab/core/index.js +1 -1
  209. package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
  210. package/dist/react-grab/index.js +1 -1
  211. package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
  212. package/dist/rpc/apiClient.cjs +12 -15
  213. package/dist/rpc/apiClient.cjs.map +1 -1
  214. package/dist/rpc/apiClient.js +12 -15
  215. package/dist/rpc/apiClient.js.map +1 -1
  216. package/dist/runtime/barrels.json +6481 -6441
  217. package/dist/runtime/importmap.json +2198 -2190
  218. package/dist/styles.css +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MultiGaugeBar.js","names":[],"sources":["../../src/data/MultiGaugeBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport type { GaugeTone } from \"./Gauge\";\n\nexport interface GaugeMarker {\n label: string;\n value: number;\n id?: string;\n /** Ranges outline zero to value; pointers mark observations and ceilings. */\n shape?: \"pointer\" | \"range\";\n tone?: GaugeTone;\n}\nexport interface MultiGaugeBarProps {\n label: string;\n icon?: ReactNode;\n average?: number;\n averageId?: string;\n /** Configured ceiling in the same units. Observations above it remain visible. */\n max?: number;\n markers?: readonly GaugeMarker[];\n formatValue?: (value: number) => string;\n /** Shared unit shown beside the scale, e.g. cores or GiB. */\n unit?: string;\n /** Compact inline presentation for table cells, with marker values in the tooltip. */\n variant?: \"default\" | \"cell\";\n /** `sm` draws a thin 8px track without the inline usage text; values stay in the summary. */\n size?: \"md\" | \"sm\";\n /** Side of the track the pointer markers sit on; `bottom` flips them to point up at the track. */\n markerSide?: \"top\" | \"bottom\";\n className?: string;\n}\n\nconst pointerPath = { top: \"M0 0H10L5 8Z\", bottom: \"M0 8H10L5 0Z\" } as const;\n\nconst markerTone: Record<GaugeTone, string> = {\n neutral: \"text-muted-foreground\",\n success: \"text-[var(--clicky-success)]\",\n warning: \"text-[var(--clicky-warning)]\",\n danger: \"text-[var(--clicky-error)]\",\n info: \"text-[var(--clicky-info)]\",\n};\n\nexport function MultiGaugeBar({\n label,\n icon,\n average,\n averageId,\n max,\n markers = [],\n formatValue = String,\n unit,\n variant = \"default\",\n size = \"md\",\n markerSide = \"top\",\n className,\n}: MultiGaugeBarProps) {\n const below = markerSide === \"bottom\";\n const trackHeight = size === \"sm\" ? 8 : 24;\n const values = [\n ...markers.map((marker) => marker.value),\n ...(average === undefined ? [] : [average]),\n ...(max === undefined ? [] : [max]),\n ];\n if (values.some((value) => !Number.isFinite(value) || value < 0))\n throw new Error(\"Gauge observations must be finite and non-negative\");\n const ceiling = Math.max(0, ...values);\n const position = (value: number) =>\n ceiling === 0 ? 0 : (value / ceiling) * 100;\n const placed: { position: number; lane: number }[] = [];\n const layout = markers.map((marker) => {\n const x = position(marker.value);\n let lane = 0;\n while (\n marker.shape !== \"range\" &&\n placed.some(\n (item) => item.lane === lane && Math.abs(item.position - x) < 5,\n )\n )\n lane++;\n if (marker.shape !== \"range\") placed.push({ position: x, lane });\n return { ...marker, position: x, lane };\n });\n const lanes = Math.max(0, ...placed.map((item) => item.lane));\n const markerBand = 8 + lanes * 8;\n const trackOffset = below ? 0 : markerBand;\n const usageLabel =\n average === undefined ? \"Not collected\" : formatValue(average);\n const summary = `${label}${unit ? ` (${unit})` : \"\"}. ${average === undefined ? \"Average not collected\" : `Average ${formatValue(average)}`}. ${markers.map((marker) => `${marker.label} ${formatValue(marker.value)}`).join(\". \")}. Scale 0 to ${formatValue(ceiling)}`;\n return (\n <div\n className={cn(\n \"min-w-0 w-full text-sm tabular-nums\",\n variant === \"default\" && \"rounded-xl border border-border bg-card p-4\",\n className,\n )}\n role=\"img\"\n aria-label={summary}\n title={variant === \"cell\" ? summary : undefined}\n >\n {variant === \"default\" && (\n <div className=\"flex items-center gap-1.5 font-medium text-foreground\">\n {icon}\n {label}\n </div>\n )}\n <div\n className={cn(\n \"flex items-start gap-3\",\n variant === \"default\" ? \"mt-3\" : \"py-1\",\n )}\n >\n <div\n className=\"relative mx-1 min-w-0 flex-1\"\n style={\n below\n ? { paddingBottom: `${markerBand}px` }\n : { paddingTop: `${markerBand}px` }\n }\n >\n <div\n data-gauge-track=\"\"\n className={cn(\n \"relative overflow-hidden bg-muted\",\n size === \"sm\" ? \"h-2 rounded-sm\" : \"h-6 rounded-md\",\n )}\n >\n {size === \"md\" && (\n <span\n id={averageId}\n data-gauge-usage=\"\"\n className=\"relative block truncate px-2 text-xs font-medium leading-6 text-foreground\"\n >\n {usageLabel}\n </span>\n )}\n <div\n data-gauge-fill=\"\"\n {...(size === \"sm\" && averageId ? { id: averageId } : {})}\n className={cn(\n \"absolute inset-y-0 left-0 overflow-hidden bg-[var(--clicky-success-500)]\",\n size === \"sm\" ? \"rounded-sm\" : \"rounded-md\",\n )}\n style={{\n width: `${average === undefined ? 0 : position(average)}%`,\n }}\n >\n {size === \"md\" && (\n <span\n aria-hidden=\"true\"\n className=\"block whitespace-nowrap px-2 text-xs font-medium leading-6 text-white\"\n >\n {usageLabel}\n </span>\n )}\n </div>\n </div>\n {[...layout]\n .sort((a, b) => b.lane - a.lane)\n .map((marker, index) => (\n <span\n key={index}\n data-gauge-marker={marker.label}\n data-gauge-shape={marker.shape ?? \"pointer\"}\n id={marker.id}\n title={`${marker.label}: ${formatValue(marker.value)}`}\n className={cn(\n \"absolute\",\n markerTone[marker.tone ?? \"neutral\"],\n marker.shape === \"range\"\n ? cn(\n \"border-dashed border-current\",\n size === \"sm\"\n ? \"h-2 rounded-sm border\"\n : \"h-6 rounded-md border-2\",\n )\n : \"w-2.5 -translate-x-1/2\",\n )}\n style={\n marker.shape === \"range\"\n ? {\n left: \"0%\",\n width: `${marker.position}%`,\n top: `${trackOffset}px`,\n }\n : {\n left: `${marker.position}%`,\n top: `${below ? trackHeight + marker.lane * 8 : (lanes - marker.lane) * 8}px`,\n height: \"8px\",\n }\n }\n >\n {marker.shape !== \"range\" && (\n <svg\n className=\"h-2 w-2.5 fill-current\"\n viewBox=\"0 0 10 8\"\n aria-hidden=\"true\"\n >\n <path d={pointerPath[markerSide]} />\n </svg>\n )}\n </span>\n ))}\n {variant === \"default\" && (\n <div\n className={cn(\n \"relative h-5 text-xs text-muted-foreground\",\n below ? \"mt-1\" : \"mt-3\",\n )}\n >\n {(ceiling === 0 ? [0] : [0, 1, 2, 3]).map((tick) => (\n <span\n key={tick}\n data-gauge-tick=\"\"\n className=\"absolute -translate-x-1/2\"\n style={{ left: `${tick * 25}%` }}\n >\n {formatValue((ceiling / 4) * tick)}\n </span>\n ))}\n </div>\n )}\n </div>\n <span\n data-gauge-max=\"\"\n className={cn(\n \"shrink-0 text-xs text-muted-foreground\",\n size === \"sm\" ? \"leading-[8px]\" : \"leading-6\",\n )}\n style={{ paddingTop: `${trackOffset}px` }}\n >\n {formatValue(ceiling)}\n {unit ? ` ${unit}` : \"\"}\n </span>\n </div>\n {variant === \"default\" && (\n <div className=\"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {average === undefined ? (\n <span>Avg not collected</span>\n ) : (\n <span className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-3 w-1 rounded-full bg-[var(--clicky-success-500)]\"\n aria-hidden=\"true\"\n />\n <span>Avg</span>{\" \"}\n <span className=\"font-medium text-foreground\">\n {formatValue(average)}\n </span>\n </span>\n )}\n {markers.map((marker, index) => (\n <span key={index} className=\"inline-flex items-center gap-1.5\">\n <svg\n className={cn(\n \"h-2 w-2.5 fill-current\",\n markerTone[marker.tone ?? \"neutral\"],\n )}\n viewBox=\"0 0 10 8\"\n aria-hidden=\"true\"\n >\n <path d={pointerPath[markerSide]} />\n </svg>\n <span>{marker.label}</span>{\" \"}\n <span className=\"font-medium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YAAY,IAAI;KAN1C,UAAA,CAQG,YAAY,OAAO,GACnB,OAAO,IAAI,SAAS,EACjB;IACH,CAAA,CAAA;;GACJ,YAAY,aACX,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,YAAY,KAAA,IACX,oBAAC,QAAD,EAAA,UAAM,oBAAuB,CAAA,IAE7B,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA;MACE,oBAAC,QAAD;OACE,WAAU;OACV,eAAY;MACb,CAAA;MACD,oBAAC,QAAD,EAAA,UAAM,MAAS,CAAA;MAAE;MACjB,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,YAAY,OAAO;MAChB,CAAA;KACF;IAEP,CAAA,GAAA,QAAQ,KAAK,QAAQ,UACpB,qBAAC,QAAD;KAAkB,WAAU;KAA5B,UAAA;MACE,oBAAC,OAAD;OACE,WAAW,GACT,0BACA,WAAW,OAAO,QAAQ,UAC5B;OACA,SAAQ;OACR,eAAY;OAEZ,UAAA,oBAAC,QAAD,EAAM,GAAG,YAAY,YAAc,CAAA;MAChC,CAAA;MACL,oBAAC,QAAD,EAAA,UAAO,OAAO,MAAY,CAAA;MAAE;MAC5B,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,YAAY,OAAO,KAAK;MACrB,CAAA;KACF;IAfK,GAAA,KAeL,CACP,CACE;;EAEJ;;AAET"}
1
+ {"version":3,"file":"MultiGaugeBar.js","names":[],"sources":["../../src/data/MultiGaugeBar.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport type { GaugeTone } from \"./Gauge\";\n\nexport interface GaugeMarker {\n label: string;\n value: number;\n id?: string;\n /**\n * Ranges outline zero to value; pointers mark observations and ceilings; ticks are thin lines\n * across the track for thresholds (warn/breach) and need no band beside the track.\n */\n shape?: \"pointer\" | \"range\" | \"tick\";\n tone?: GaugeTone;\n}\nexport interface MultiGaugeBarProps {\n label: string;\n icon?: ReactNode;\n average?: number;\n averageId?: string;\n /** Configured ceiling in the same units. Observations above it remain visible. */\n max?: number;\n markers?: readonly GaugeMarker[];\n formatValue?: (value: number) => string;\n /** Shared unit shown beside the scale, e.g. cores or GiB. */\n unit?: string;\n /** Compact inline presentation for table cells, with marker values in the tooltip. */\n variant?: \"default\" | \"cell\";\n /** `sm` draws a thin 8px track without the inline usage text; values stay in the summary. */\n size?: \"md\" | \"sm\";\n /** Side of the track the pointer markers sit on; `bottom` flips them to point up at the track. */\n markerSide?: \"top\" | \"bottom\";\n className?: string;\n}\n\nconst pointerPath = { top: \"M0 0H10L5 8Z\", bottom: \"M0 8H10L5 0Z\" } as const;\n\n/** How far a tick line extends past the track on each side. */\nconst TICK_OVERHANG_PX = 2;\n\nconst markerTone: Record<GaugeTone, string> = {\n neutral: \"text-muted-foreground\",\n success: \"text-[var(--clicky-success)]\",\n warning: \"text-[var(--clicky-warning)]\",\n danger: \"text-[var(--clicky-error)]\",\n info: \"text-[var(--clicky-info)]\",\n};\n\nexport function MultiGaugeBar({\n label,\n icon,\n average,\n averageId,\n max,\n markers = [],\n formatValue = String,\n unit,\n variant = \"default\",\n size = \"md\",\n markerSide = \"top\",\n className,\n}: MultiGaugeBarProps) {\n const below = markerSide === \"bottom\";\n const trackHeight = size === \"sm\" ? 8 : 24;\n const values = [\n ...markers.map((marker) => marker.value),\n ...(average === undefined ? [] : [average]),\n ...(max === undefined ? [] : [max]),\n ];\n if (values.some((value) => !Number.isFinite(value) || value < 0))\n throw new Error(\"Gauge observations must be finite and non-negative\");\n const ceiling = Math.max(0, ...values);\n const position = (value: number) =>\n ceiling === 0 ? 0 : (value / ceiling) * 100;\n const placed: { position: number; lane: number }[] = [];\n const laned = (marker: GaugeMarker) =>\n marker.shape !== \"range\" && marker.shape !== \"tick\";\n const layout = markers.map((marker) => {\n const x = position(marker.value);\n let lane = 0;\n while (\n laned(marker) &&\n placed.some(\n (item) => item.lane === lane && Math.abs(item.position - x) < 5,\n )\n )\n lane++;\n if (laned(marker)) placed.push({ position: x, lane });\n return { ...marker, position: x, lane };\n });\n const lanes = Math.max(0, ...placed.map((item) => item.lane));\n const onlyTicks =\n markers.length > 0 && markers.every((marker) => marker.shape === \"tick\");\n const markerBand = onlyTicks ? 0 : 8 + lanes * 8;\n const trackOffset = below ? 0 : markerBand;\n const usageLabel =\n average === undefined ? \"Not collected\" : formatValue(average);\n const usagePosition = average === undefined ? 0 : position(average);\n // The usage value sits inside the fill when its width allows, otherwise just\n // after the fill's end, re-measured whenever the fill or the value resizes.\n const fillRef = useRef<HTMLDivElement>(null);\n const usageRef = useRef<HTMLSpanElement>(null);\n const [usageFits, setUsageFits] = useState(true);\n useLayoutEffect(() => {\n const fill = fillRef.current;\n const usage = usageRef.current;\n if (!fill || !usage) return;\n const measure = () => setUsageFits(usage.offsetWidth <= fill.offsetWidth);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(fill);\n observer.observe(usage);\n return () => observer.disconnect();\n }, [usageLabel, usagePosition]);\n const summary = `${label}${unit ? ` (${unit})` : \"\"}. ${average === undefined ? \"Average not collected\" : `Average ${formatValue(average)}`}. ${markers.map((marker) => `${marker.label} ${formatValue(marker.value)}`).join(\". \")}. Scale 0 to ${formatValue(ceiling)}`;\n return (\n <div\n className={cn(\n \"min-w-0 w-full text-sm tabular-nums\",\n variant === \"default\" && \"rounded-xl border border-border bg-card p-4\",\n className,\n )}\n role=\"img\"\n aria-label={summary}\n title={variant === \"cell\" ? summary : undefined}\n >\n {variant === \"default\" && (\n <div className=\"flex items-center gap-1.5 font-medium text-foreground\">\n {icon}\n {label}\n </div>\n )}\n <div\n className={cn(\n \"flex items-start gap-3\",\n variant === \"default\" ? \"mt-3\" : \"py-1\",\n )}\n >\n <div\n className=\"relative mx-1 min-w-0 flex-1\"\n style={\n below\n ? { paddingBottom: `${markerBand}px` }\n : { paddingTop: `${markerBand}px` }\n }\n >\n <div\n data-gauge-track=\"\"\n className={cn(\n \"relative overflow-hidden bg-muted\",\n size === \"sm\" ? \"h-2 rounded-sm\" : \"h-6 rounded-md\",\n )}\n >\n <div\n ref={fillRef}\n data-gauge-fill=\"\"\n {...(size === \"sm\" && averageId ? { id: averageId } : {})}\n className={cn(\n \"absolute inset-y-0 left-0 bg-[var(--clicky-success-500)]\",\n size === \"sm\" ? \"rounded-sm\" : \"rounded-md\",\n )}\n style={{ width: `${usagePosition}%` }}\n />\n {size === \"md\" && (\n <span\n ref={usageRef}\n id={averageId}\n data-gauge-usage={usageFits ? \"inside\" : \"outside\"}\n className={cn(\n \"absolute inset-y-0 w-max whitespace-nowrap px-2 text-xs font-medium leading-6\",\n usageFits ? \"text-white\" : \"text-foreground\",\n )}\n style={{ left: usageFits ? \"0%\" : `${usagePosition}%` }}\n >\n {usageLabel}\n </span>\n )}\n </div>\n {[...layout]\n .sort((a, b) => b.lane - a.lane)\n .map((marker, index) => (\n <span\n key={index}\n data-gauge-marker={marker.label}\n data-gauge-shape={marker.shape ?? \"pointer\"}\n id={marker.id}\n title={`${marker.label}: ${formatValue(marker.value)}`}\n className={cn(\n \"absolute\",\n markerTone[marker.tone ?? \"neutral\"],\n marker.shape === \"range\" &&\n cn(\n \"border-dashed border-current\",\n size === \"sm\"\n ? \"h-2 rounded-sm border\"\n : \"h-6 rounded-md border-2\",\n ),\n marker.shape === \"tick\" &&\n \"flex w-2 -translate-x-1/2 justify-center\",\n laned(marker) && \"w-2.5 -translate-x-1/2\",\n )}\n style={\n marker.shape === \"range\"\n ? {\n left: \"0%\",\n width: `${marker.position}%`,\n top: `${trackOffset}px`,\n }\n : marker.shape === \"tick\"\n ? {\n left: `${marker.position}%`,\n top: `${trackOffset - TICK_OVERHANG_PX}px`,\n height: `${trackHeight + TICK_OVERHANG_PX * 2}px`,\n }\n : {\n left: `${marker.position}%`,\n top: `${below ? trackHeight + marker.lane * 8 : (lanes - marker.lane) * 8}px`,\n height: \"8px\",\n }\n }\n >\n {marker.shape === \"tick\" && (\n <span\n className=\"h-full w-px bg-current\"\n aria-hidden=\"true\"\n />\n )}\n {laned(marker) && (\n <svg\n className=\"h-2 w-2.5 fill-current\"\n viewBox=\"0 0 10 8\"\n aria-hidden=\"true\"\n >\n <path d={pointerPath[markerSide]} />\n </svg>\n )}\n </span>\n ))}\n {variant === \"default\" && (\n <div\n className={cn(\n \"relative h-5 text-xs text-muted-foreground\",\n below ? \"mt-1\" : \"mt-3\",\n )}\n >\n {(ceiling === 0 ? [0] : [0, 1, 2, 3]).map((tick) => (\n <span\n key={tick}\n data-gauge-tick=\"\"\n className=\"absolute -translate-x-1/2\"\n style={{ left: `${tick * 25}%` }}\n >\n {formatValue((ceiling / 4) * tick)}\n </span>\n ))}\n </div>\n )}\n </div>\n <span\n data-gauge-max=\"\"\n className={cn(\n \"shrink-0 text-xs text-muted-foreground\",\n size === \"sm\" ? \"leading-[8px]\" : \"leading-6\",\n )}\n style={{ paddingTop: `${trackOffset}px` }}\n >\n {formatValue(ceiling)}\n {unit ? ` ${unit}` : \"\"}\n </span>\n </div>\n {variant === \"default\" && (\n <div className=\"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {average === undefined ? (\n <span>Avg not collected</span>\n ) : (\n <span className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-3 w-1 rounded-full bg-[var(--clicky-success-500)]\"\n aria-hidden=\"true\"\n />\n <span>Avg</span>{\" \"}\n <span className=\"font-medium text-foreground\">\n {formatValue(average)}\n </span>\n </span>\n )}\n {markers.map((marker, index) => (\n <span key={index} className=\"inline-flex items-center gap-1.5\">\n {marker.shape === \"tick\" ? (\n <span\n className={cn(\n \"h-3 w-px bg-current\",\n markerTone[marker.tone ?? \"neutral\"],\n )}\n aria-hidden=\"true\"\n />\n ) : (\n <svg\n className={cn(\n \"h-2 w-2.5 fill-current\",\n markerTone[marker.tone ?? \"neutral\"],\n )}\n viewBox=\"0 0 10 8\"\n aria-hidden=\"true\"\n >\n <path d={pointerPath[markerSide]} />\n </svg>\n )}\n <span>{marker.label}</span>{\" \"}\n <span className=\"font-medium text-foreground\">\n {formatValue(marker.value)}\n </span>\n </span>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;AAmCA,IAAM,cAAc;CAAE,KAAK;CAAgB,QAAQ;AAAe;;AAGlE,IAAM,mBAAmB;AAEzB,IAAM,aAAwC;CAC5C,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACR,MAAM;AACR;AAEA,SAAgB,cAAc,EAC5B,OACA,MACA,SACA,WACA,KACA,UAAU,CAAC,GACX,cAAc,QACd,MACA,UAAU,WACV,OAAO,MACP,aAAa,OACb,aACqB;CACrB,MAAM,QAAQ,eAAe;CAC7B,MAAM,cAAc,SAAS,OAAO,IAAI;CACxC,MAAM,SAAS;EACb,GAAG,QAAQ,KAAK,WAAW,OAAO,KAAK;EACvC,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,CAAC,OAAO;EACzC,GAAI,QAAQ,KAAA,IAAY,CAAC,IAAI,CAAC,GAAG;CACnC;CACA,IAAI,OAAO,MAAM,UAAU,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,CAAC,GAC7D,MAAM,IAAI,MAAM,oDAAoD;CACtE,MAAM,UAAU,KAAK,IAAI,GAAG,GAAG,MAAM;CACrC,MAAM,YAAY,UAChB,YAAY,IAAI,IAAK,QAAQ,UAAW;CAC1C,MAAM,SAA+C,CAAC;CACtD,MAAM,SAAS,WACb,OAAO,UAAU,WAAW,OAAO,UAAU;CAC/C,MAAM,SAAS,QAAQ,KAAK,WAAW;EACrC,MAAM,IAAI,SAAS,OAAO,KAAK;EAC/B,IAAI,OAAO;EACX,OACE,MAAM,MAAM,KACZ,OAAO,MACJ,SAAS,KAAK,SAAS,QAAQ,KAAK,IAAI,KAAK,WAAW,CAAC,IAAI,CAChE,GAEA;EACF,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK;GAAE,UAAU;GAAG;EAAK,CAAC;EACpD,OAAO;GAAE,GA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,WAAU;OACV,eAAY;MACb,CAAA;MACD,oBAAC,QAAD,EAAA,UAAM,MAAS,CAAA;MAAE;MACjB,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,YAAY,OAAO;MAChB,CAAA;KACF;IAEP,CAAA,GAAA,QAAQ,KAAK,QAAQ,UACpB,qBAAC,QAAD;KAAkB,WAAU;KAA5B,UAAA;MACG,OAAO,UAAU,SAChB,oBAAC,QAAD;OACE,WAAW,GACT,uBACA,WAAW,OAAO,QAAQ,UAC5B;OACA,eAAY;MACb,CAAA,IAED,oBAAC,OAAD;OACE,WAAW,GACT,0BACA,WAAW,OAAO,QAAQ,UAC5B;OACA,SAAQ;OACR,eAAY;OAEZ,UAAA,oBAAC,QAAD,EAAM,GAAG,YAAY,YAAc,CAAA;MAChC,CAAA;MAEP,oBAAC,QAAD,EAAA,UAAO,OAAO,MAAY,CAAA;MAAE;MAC5B,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,YAAY,OAAO,KAAK;MACrB,CAAA;KACF;IAzBK,GAAA,KAyBL,CACP,CACE;;EAEJ;;AAET"}
@@ -0,0 +1,45 @@
1
+ const require_utils = require("../../lib/utils.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ // src/data/flow-node/BoxNode.tsx
4
+ var JOIN_TOP = "rounded-t-none border-t-0 before:pointer-events-none before:absolute before:inset-x-0 before:top-0 before:border-t before:border-dashed before:border-border";
5
+ var JOIN_BOTTOM = "rounded-b-none border-b-0";
6
+ var JOIN_CLASS = {
7
+ top: JOIN_TOP,
8
+ bottom: JOIN_BOTTOM,
9
+ both: `${JOIN_TOP} ${JOIN_BOTTOM}`
10
+ };
11
+ /**
12
+ * A diagram box: an icon and title (with an optional subtitle) over a body under a hairline, with a 6px left stripe.
13
+ * Boxes size to their content; pass `id` for arrow libraries that attach to elements by id.
14
+ *
15
+ * Style it with plain classes: `className="border-l-orange-600"` colours the stripe (it takes the border colour
16
+ * otherwise) and `className="text-orange-600"` on the `icon` colours the icon. Colours that are only known at runtime
17
+ * go through the standard `style` prop, e.g. `style={{ borderLeftColor }}`.
18
+ */
19
+ function BoxNode({ title, subtitle, icon, dashed = false, join, className, children, ...rest }) {
20
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
21
+ ...rest,
22
+ className: require_utils.cn("relative flex flex-col justify-center rounded-md border border-l-[6px] border-border bg-background text-[11px] text-foreground", dashed && "border-dashed", join && JOIN_CLASS[join], className),
23
+ "data-box-node": "",
24
+ "data-join": join,
25
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
26
+ className: require_utils.cn("flex items-center gap-2 px-2 pt-2 font-semibold", children == null && "pb-2"),
27
+ children: [icon, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
28
+ className: "flex min-w-0 flex-col leading-tight",
29
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
30
+ className: "truncate text-[10px]",
31
+ children: title
32
+ }), subtitle != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
33
+ className: "truncate font-mono text-[8px] font-normal text-muted-foreground",
34
+ children: subtitle
35
+ })]
36
+ })]
37
+ }), children != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
38
+ className: "mx-2 mb-2 mt-1 flex flex-col gap-1 border-t border-border/50 pt-1",
39
+ children
40
+ })]
41
+ });
42
+ }
43
+ exports.BoxNode = BoxNode;
44
+
45
+ //# sourceMappingURL=BoxNode.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoxNode.cjs","names":["cn"],"sources":["../../../src/data/flow-node/BoxNode.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\n/** Which edges of a box fuse onto a neighbour stacked against them. */\nexport type BoxNodeJoin = \"top\" | \"bottom\" | \"both\";\n\nexport interface BoxNodeProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n title: ReactNode;\n /** A second, muted mono line under the title, e.g. a truncated API path. */\n subtitle?: ReactNode;\n /** Leads the title: a product logo or a kind icon, sized by the caller. */\n icon?: ReactNode;\n /** Dashed border, e.g. for a dead-letter queue or another standby box. */\n dashed?: boolean;\n /**\n * Fuses the box onto a neighbour stacked against that edge. A joined bottom edge drops its border and corners; a\n * joined top edge drops its border and corners and draws a dashed divider inside the side borders, so the accent\n * stripe runs unbroken down a stack of joined boxes and the divider stops at it.\n */\n join?: BoxNodeJoin;\n}\n\nconst JOIN_TOP = \"rounded-t-none border-t-0 before:pointer-events-none before:absolute before:inset-x-0 before:top-0 before:border-t before:border-dashed before:border-border\";\nconst JOIN_BOTTOM = \"rounded-b-none border-b-0\";\nconst JOIN_CLASS: Record<BoxNodeJoin, string> = { top: JOIN_TOP, bottom: JOIN_BOTTOM, both: `${JOIN_TOP} ${JOIN_BOTTOM}` };\n\n/**\n * A diagram box: an icon and title (with an optional subtitle) over a body under a hairline, with a 6px left stripe.\n * Boxes size to their content; pass `id` for arrow libraries that attach to elements by id.\n *\n * Style it with plain classes: `className=\"border-l-orange-600\"` colours the stripe (it takes the border colour\n * otherwise) and `className=\"text-orange-600\"` on the `icon` colours the icon. Colours that are only known at runtime\n * go through the standard `style` prop, e.g. `style={{ borderLeftColor }}`.\n */\nexport function BoxNode({ title, subtitle, icon, dashed = false, join, className, children, ...rest }: BoxNodeProps) {\n return (\n <div\n {...rest}\n className={cn(\n \"relative flex flex-col justify-center rounded-md border border-l-[6px] border-border bg-background text-[11px] text-foreground\",\n dashed && \"border-dashed\",\n join && JOIN_CLASS[join],\n className,\n )}\n data-box-node=\"\"\n data-join={join}\n >\n <div className={cn(\"flex items-center gap-2 px-2 pt-2 font-semibold\", children == null && \"pb-2\")}>\n {icon}\n <span className=\"flex min-w-0 flex-col leading-tight\">\n <span className=\"truncate text-[10px]\">{title}</span>\n {subtitle != null && <span className=\"truncate font-mono text-[8px] font-normal text-muted-foreground\">{subtitle}</span>}\n </span>\n </div>\n {children != null && <div className=\"mx-2 mb-2 mt-1 flex flex-col gap-1 border-t border-border/50 pt-1\">{children}</div>}\n </div>\n );\n}\n"],"mappings":";;;AAsBA,IAAM,WAAW;AACjB,IAAM,cAAc;AACpB,IAAM,aAA0C;CAAE,KAAK;CAAU,QAAQ;CAAa,MAAM,GAAG,SAAS,GAAG;AAAc;;;;;;;;;AAUzH,SAAgB,QAAQ,EAAE,OAAO,UAAU,MAAM,SAAS,OAAO,MAAM,WAAW,UAAU,GAAG,QAAsB;CACnH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,GAAI;EACJ,WAAWA,cAAAA,GACT,kIACA,UAAU,iBACV,QAAQ,WAAW,OACnB,SACF;EACA,iBAAc;EACd,aAAW;EATb,UAAA,CAWE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAWA,cAAAA,GAAG,mDAAmD,YAAY,QAAQ,MAAM;GAAhG,UAAA,CACG,MACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAAwB,UAAA;IAAY,CAAA,GACnD,YAAY,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAAmE,UAAA;IAAe,CAAA,CACnH;GACH,CAAA,CAAA;EACJ,CAAA,GAAA,YAAY,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GAAqE;EAAc,CAAA,CACpH;;AAET"}
@@ -0,0 +1,28 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ /** Which edges of a box fuse onto a neighbour stacked against them. */
3
+ export type BoxNodeJoin = "top" | "bottom" | "both";
4
+ export interface BoxNodeProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
5
+ title: ReactNode;
6
+ /** A second, muted mono line under the title, e.g. a truncated API path. */
7
+ subtitle?: ReactNode;
8
+ /** Leads the title: a product logo or a kind icon, sized by the caller. */
9
+ icon?: ReactNode;
10
+ /** Dashed border, e.g. for a dead-letter queue or another standby box. */
11
+ dashed?: boolean;
12
+ /**
13
+ * Fuses the box onto a neighbour stacked against that edge. A joined bottom edge drops its border and corners; a
14
+ * joined top edge drops its border and corners and draws a dashed divider inside the side borders, so the accent
15
+ * stripe runs unbroken down a stack of joined boxes and the divider stops at it.
16
+ */
17
+ join?: BoxNodeJoin;
18
+ }
19
+ /**
20
+ * A diagram box: an icon and title (with an optional subtitle) over a body under a hairline, with a 6px left stripe.
21
+ * Boxes size to their content; pass `id` for arrow libraries that attach to elements by id.
22
+ *
23
+ * Style it with plain classes: `className="border-l-orange-600"` colours the stripe (it takes the border colour
24
+ * otherwise) and `className="text-orange-600"` on the `icon` colours the icon. Colours that are only known at runtime
25
+ * go through the standard `style` prop, e.g. `style={{ borderLeftColor }}`.
26
+ */
27
+ export declare function BoxNode({ title, subtitle, icon, dashed, join, className, children, ...rest }: BoxNodeProps): import("react").JSX.Element;
28
+ //# sourceMappingURL=BoxNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoxNode.d.ts","sourceRoot":"","sources":["../../../src/data/flow-node/BoxNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACjF,KAAK,EAAE,SAAS,CAAC;IACjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,+BAuBlH"}
@@ -0,0 +1,45 @@
1
+ import { cn } from "../../lib/utils.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/data/flow-node/BoxNode.tsx
4
+ var JOIN_TOP = "rounded-t-none border-t-0 before:pointer-events-none before:absolute before:inset-x-0 before:top-0 before:border-t before:border-dashed before:border-border";
5
+ var JOIN_BOTTOM = "rounded-b-none border-b-0";
6
+ var JOIN_CLASS = {
7
+ top: JOIN_TOP,
8
+ bottom: JOIN_BOTTOM,
9
+ both: `${JOIN_TOP} ${JOIN_BOTTOM}`
10
+ };
11
+ /**
12
+ * A diagram box: an icon and title (with an optional subtitle) over a body under a hairline, with a 6px left stripe.
13
+ * Boxes size to their content; pass `id` for arrow libraries that attach to elements by id.
14
+ *
15
+ * Style it with plain classes: `className="border-l-orange-600"` colours the stripe (it takes the border colour
16
+ * otherwise) and `className="text-orange-600"` on the `icon` colours the icon. Colours that are only known at runtime
17
+ * go through the standard `style` prop, e.g. `style={{ borderLeftColor }}`.
18
+ */
19
+ function BoxNode({ title, subtitle, icon, dashed = false, join, className, children, ...rest }) {
20
+ return /* @__PURE__ */ jsxs("div", {
21
+ ...rest,
22
+ className: cn("relative flex flex-col justify-center rounded-md border border-l-[6px] border-border bg-background text-[11px] text-foreground", dashed && "border-dashed", join && JOIN_CLASS[join], className),
23
+ "data-box-node": "",
24
+ "data-join": join,
25
+ children: [/* @__PURE__ */ jsxs("div", {
26
+ className: cn("flex items-center gap-2 px-2 pt-2 font-semibold", children == null && "pb-2"),
27
+ children: [icon, /* @__PURE__ */ jsxs("span", {
28
+ className: "flex min-w-0 flex-col leading-tight",
29
+ children: [/* @__PURE__ */ jsx("span", {
30
+ className: "truncate text-[10px]",
31
+ children: title
32
+ }), subtitle != null && /* @__PURE__ */ jsx("span", {
33
+ className: "truncate font-mono text-[8px] font-normal text-muted-foreground",
34
+ children: subtitle
35
+ })]
36
+ })]
37
+ }), children != null && /* @__PURE__ */ jsx("div", {
38
+ className: "mx-2 mb-2 mt-1 flex flex-col gap-1 border-t border-border/50 pt-1",
39
+ children
40
+ })]
41
+ });
42
+ }
43
+ export { BoxNode };
44
+
45
+ //# sourceMappingURL=BoxNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoxNode.js","names":[],"sources":["../../../src/data/flow-node/BoxNode.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\n/** Which edges of a box fuse onto a neighbour stacked against them. */\nexport type BoxNodeJoin = \"top\" | \"bottom\" | \"both\";\n\nexport interface BoxNodeProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n title: ReactNode;\n /** A second, muted mono line under the title, e.g. a truncated API path. */\n subtitle?: ReactNode;\n /** Leads the title: a product logo or a kind icon, sized by the caller. */\n icon?: ReactNode;\n /** Dashed border, e.g. for a dead-letter queue or another standby box. */\n dashed?: boolean;\n /**\n * Fuses the box onto a neighbour stacked against that edge. A joined bottom edge drops its border and corners; a\n * joined top edge drops its border and corners and draws a dashed divider inside the side borders, so the accent\n * stripe runs unbroken down a stack of joined boxes and the divider stops at it.\n */\n join?: BoxNodeJoin;\n}\n\nconst JOIN_TOP = \"rounded-t-none border-t-0 before:pointer-events-none before:absolute before:inset-x-0 before:top-0 before:border-t before:border-dashed before:border-border\";\nconst JOIN_BOTTOM = \"rounded-b-none border-b-0\";\nconst JOIN_CLASS: Record<BoxNodeJoin, string> = { top: JOIN_TOP, bottom: JOIN_BOTTOM, both: `${JOIN_TOP} ${JOIN_BOTTOM}` };\n\n/**\n * A diagram box: an icon and title (with an optional subtitle) over a body under a hairline, with a 6px left stripe.\n * Boxes size to their content; pass `id` for arrow libraries that attach to elements by id.\n *\n * Style it with plain classes: `className=\"border-l-orange-600\"` colours the stripe (it takes the border colour\n * otherwise) and `className=\"text-orange-600\"` on the `icon` colours the icon. Colours that are only known at runtime\n * go through the standard `style` prop, e.g. `style={{ borderLeftColor }}`.\n */\nexport function BoxNode({ title, subtitle, icon, dashed = false, join, className, children, ...rest }: BoxNodeProps) {\n return (\n <div\n {...rest}\n className={cn(\n \"relative flex flex-col justify-center rounded-md border border-l-[6px] border-border bg-background text-[11px] text-foreground\",\n dashed && \"border-dashed\",\n join && JOIN_CLASS[join],\n className,\n )}\n data-box-node=\"\"\n data-join={join}\n >\n <div className={cn(\"flex items-center gap-2 px-2 pt-2 font-semibold\", children == null && \"pb-2\")}>\n {icon}\n <span className=\"flex min-w-0 flex-col leading-tight\">\n <span className=\"truncate text-[10px]\">{title}</span>\n {subtitle != null && <span className=\"truncate font-mono text-[8px] font-normal text-muted-foreground\">{subtitle}</span>}\n </span>\n </div>\n {children != null && <div className=\"mx-2 mb-2 mt-1 flex flex-col gap-1 border-t border-border/50 pt-1\">{children}</div>}\n </div>\n );\n}\n"],"mappings":";;;AAsBA,IAAM,WAAW;AACjB,IAAM,cAAc;AACpB,IAAM,aAA0C;CAAE,KAAK;CAAU,QAAQ;CAAa,MAAM,GAAG,SAAS,GAAG;AAAc;;;;;;;;;AAUzH,SAAgB,QAAQ,EAAE,OAAO,UAAU,MAAM,SAAS,OAAO,MAAM,WAAW,UAAU,GAAG,QAAsB;CACnH,OACE,qBAAC,OAAD;EACE,GAAI;EACJ,WAAW,GACT,kIACA,UAAU,iBACV,QAAQ,WAAW,OACnB,SACF;EACA,iBAAc;EACd,aAAW;EATb,UAAA,CAWE,qBAAC,OAAD;GAAK,WAAW,GAAG,mDAAmD,YAAY,QAAQ,MAAM;GAAhG,UAAA,CACG,MACD,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAAwB,UAAA;IAAY,CAAA,GACnD,YAAY,QAAQ,oBAAC,QAAD;KAAM,WAAU;KAAmE,UAAA;IAAe,CAAA,CACnH;GACH,CAAA,CAAA;EACJ,CAAA,GAAA,YAAY,QAAQ,oBAAC,OAAD;GAAK,WAAU;GAAqE;EAAc,CAAA,CACpH;;AAET"}
@@ -0,0 +1,208 @@
1
+ const require_utils = require("../../lib/utils.cjs");
2
+ const require_UiArrowDown = require("../../icons/components/UiArrowDown.cjs");
3
+ const require_UiArrowUp = require("../../icons/components/UiArrowUp.cjs");
4
+ const require_UiPulse = require("../../icons/components/UiPulse.cjs");
5
+ const require_UiSkull = require("../../icons/components/UiSkull.cjs");
6
+ const require_UiStack = require("../../icons/components/UiStack.cjs");
7
+ const require_UiTimer = require("../../icons/components/UiTimer.cjs");
8
+ const require_UiWarningCircle = require("../../icons/components/UiWarningCircle.cjs");
9
+ const require_latency = require("./latency.cjs");
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ // src/data/flow-node/FlowMetrics.tsx
12
+ var ICON_CLASS = "h-2.5 w-2.5 shrink-0";
13
+ /** A metric's name in muted lowercase, before its value. */
14
+ function MetricLabel({ children }) {
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
16
+ className: "text-muted-foreground",
17
+ "data-red-label": true,
18
+ children
19
+ });
20
+ }
21
+ var DIRECTION_ICON = {
22
+ consume: require_UiArrowDown.UiArrowDown,
23
+ produce: require_UiArrowUp.UiArrowUp
24
+ };
25
+ var linearPct = (ms, scaleMax) => `${Math.min(ms / scaleMax, 1) * 100}%`;
26
+ /**
27
+ * Duration: the average, then a bar from 0 to the smallest of 100ms, 1s, 10s, 1m, 10m, 1h, 8h, 1d that holds the
28
+ * average, filled linearly to it, with ticks at p95 (foreground) and max (muted). A tick past the end pins to it and is
29
+ * marked `data-latency-overflow`. Its min-width of 100% wraps it onto its own line in a wrapping row.
30
+ */
31
+ function LatencyBar({ latency }) {
32
+ const { avg, p95, max } = latency;
33
+ if (!(avg <= p95 && p95 <= max)) throw new Error(`LatencyBar needs avg <= p95 <= max (got ${avg}, ${p95}, ${max})`);
34
+ const scaleMax = require_latency.latencyScaleMax(avg);
35
+ const ticks = [{
36
+ key: "p95",
37
+ ms: p95,
38
+ className: "bg-foreground"
39
+ }, {
40
+ key: "max",
41
+ ms: max,
42
+ className: "bg-muted-foreground"
43
+ }];
44
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
45
+ className: "inline-flex items-center gap-1",
46
+ style: { minWidth: "100%" },
47
+ "data-latency": true,
48
+ title: `avg ${require_latency.formatMs(avg)} · p95 ${require_latency.formatMs(p95)} · max ${require_latency.formatMs(max)} (scale 0–${require_latency.formatMs(scaleMax)})`,
49
+ children: [
50
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UiTimer.UiTimer, {
51
+ className: require_utils.cn(ICON_CLASS, "text-muted-foreground"),
52
+ "aria-label": "duration"
53
+ }),
54
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: require_latency.formatMs(avg) }),
55
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
56
+ className: "relative h-1.5 min-w-12 flex-1 rounded-full bg-muted",
57
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
58
+ className: "absolute inset-y-0 left-0 rounded-full bg-muted-foreground/60",
59
+ style: { width: linearPct(avg, scaleMax) },
60
+ "data-latency-fill": true
61
+ }), ticks.map(({ key, ms, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
62
+ className: require_utils.cn("absolute -inset-y-0.5 w-px", className),
63
+ style: { left: linearPct(ms, scaleMax) },
64
+ "data-latency-tick": key,
65
+ "data-latency-overflow": ms > scaleMax || void 0
66
+ }, key))]
67
+ }),
68
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
69
+ className: "font-mono text-[8px] text-muted-foreground",
70
+ "data-latency-scale-max": true,
71
+ children: require_latency.formatMs(scaleMax)
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ /**
77
+ * A RED row: requests, error rate and duration (when measured), each led by an icon. A `direction` arrow replaces the pulse icon and
78
+ * the label; otherwise a `label` sits above the values. A breached error rate turns red; the errors metric is hidden
79
+ * when both the rate and the error codes are empty.
80
+ */
81
+ function RedLine({ metrics }) {
82
+ const { requests, per = "/min", duration, direction, label, labelled = false } = metrics;
83
+ const RequestsIcon = direction ? DIRECTION_ICON[direction] : require_UiPulse.UiPulse;
84
+ const requestsLabel = direction ? `${label ?? direction} rate` : "requests";
85
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
86
+ className: "flex flex-col leading-tight",
87
+ "data-red-line": true,
88
+ children: [!direction && label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
89
+ className: "truncate font-mono text-[8px] text-muted-foreground",
90
+ children: label
91
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
92
+ className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums",
93
+ children: [
94
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
95
+ className: "inline-flex items-center gap-0.5",
96
+ title: requestsLabel,
97
+ "data-red": "requests",
98
+ children: [
99
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestsIcon, {
100
+ className: require_utils.cn(ICON_CLASS, "text-muted-foreground"),
101
+ "aria-label": requestsLabel
102
+ }),
103
+ labelled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MetricLabel, { children: "req" }),
104
+ requests.toLocaleString("en-US"),
105
+ per
106
+ ]
107
+ }),
108
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RedErrors, { metrics }),
109
+ duration && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LatencyBar, { latency: duration })
110
+ ]
111
+ })]
112
+ });
113
+ }
114
+ function RedErrors({ metrics }) {
115
+ const { errorRate, errorBreach = false, errorCodes = [], labelled = false } = metrics;
116
+ if (!Number.isFinite(errorRate) || errorRate < 0) throw new Error(`RedLine errorRate must be a percentage >= 0, got ${errorRate}`);
117
+ if (errorRate === 0 && errorCodes.length === 0) return null;
118
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
119
+ className: require_utils.cn("inline-flex items-center gap-0.5", errorBreach && "text-destructive"),
120
+ title: "error rate",
121
+ "data-red": "errors",
122
+ "data-breach": errorBreach || void 0,
123
+ children: [
124
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UiWarningCircle.UiWarningCircle, {
125
+ className: require_utils.cn(ICON_CLASS, errorBreach ? "text-destructive" : "text-muted-foreground"),
126
+ "aria-label": "error rate"
127
+ }),
128
+ labelled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MetricLabel, { children: "errors" }),
129
+ errorRate !== 0 && `${errorRate.toFixed(1)}%`,
130
+ errorCodes.map(({ status, count }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
131
+ className: "font-mono",
132
+ title: `${count} × ${status}`,
133
+ "data-red-error-code": status,
134
+ children: [status, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
135
+ className: "text-muted-foreground",
136
+ children: ["×", count]
137
+ })]
138
+ }, status))
139
+ ]
140
+ });
141
+ }
142
+ var QUEUE_FIELDS = [
143
+ {
144
+ key: "size",
145
+ title: "depth",
146
+ Icon: require_UiStack.UiStack,
147
+ rate: false,
148
+ labelled: false
149
+ },
150
+ {
151
+ key: "enqueued",
152
+ title: "enqueued",
153
+ Icon: require_UiArrowUp.UiArrowUp,
154
+ rate: true,
155
+ labelled: true
156
+ },
157
+ {
158
+ key: "dequeued",
159
+ title: "dequeued",
160
+ Icon: require_UiArrowDown.UiArrowDown,
161
+ rate: true,
162
+ labelled: true
163
+ },
164
+ {
165
+ key: "dlq",
166
+ title: "dead letter",
167
+ Icon: require_UiSkull.UiSkull,
168
+ rate: false,
169
+ labelled: false
170
+ }
171
+ ];
172
+ /**
173
+ * A queue row: depth (a stack), enqueued (up), dequeued (down) and dead letters (a skull, red with its count: a dead
174
+ * letter is always a breach). Missing or zero counters are not drawn; renders nothing when all are empty.
175
+ */
176
+ function QueueStats({ counts }) {
177
+ const per = counts.per ?? "/min";
178
+ const shown = QUEUE_FIELDS.map((field) => ({
179
+ ...field,
180
+ value: counts[field.key] ?? 0
181
+ })).filter(({ value }) => value !== 0);
182
+ if (shown.length === 0) return null;
183
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
184
+ className: "flex flex-wrap gap-x-2 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums",
185
+ "data-queue-stats": true,
186
+ children: shown.map(({ key, title, Icon, rate, labelled, value }) => {
187
+ const text = `${value.toLocaleString("en-US")}${rate ? per : ""}`;
188
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
189
+ className: require_utils.cn("inline-flex items-center gap-0.5", key === "dlq" && "text-destructive"),
190
+ "data-queue-stat": key,
191
+ title: `${title} ${text}`,
192
+ children: [
193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
194
+ className: require_utils.cn(ICON_CLASS, key === "dlq" ? "text-destructive" : "text-muted-foreground"),
195
+ "aria-label": title
196
+ }),
197
+ counts.labelled && labelled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MetricLabel, { children: title }),
198
+ text
199
+ ]
200
+ }, key);
201
+ })
202
+ });
203
+ }
204
+ exports.LatencyBar = LatencyBar;
205
+ exports.QueueStats = QueueStats;
206
+ exports.RedLine = RedLine;
207
+
208
+ //# sourceMappingURL=FlowMetrics.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowMetrics.cjs","names":["UiArrowDown","UiArrowUp","latencyScaleMax","formatMs","UiTimer","cn","UiPulse","UiWarningCircle","UiStack","UiSkull"],"sources":["../../../src/data/flow-node/FlowMetrics.tsx"],"sourcesContent":["import { cn } from \"../../lib/utils\";\nimport { UiArrowDown, UiArrowUp, UiPulse, UiSkull, UiStack, UiTimer, UiWarningCircle } from \"../../icons\";\nimport { formatMs, latencyScaleMax, type Latency } from \"./latency\";\n\n/** Rate, Errors and Duration for one role a workload plays in a flow. */\nexport interface RedMetrics {\n /** Requests per `per`. */\n requests: number;\n /** Rate unit after the request count; defaults to \"/min\". */\n per?: string;\n /** Error rate in percent; a zero rate is not drawn. */\n errorRate: number;\n /** Marks the error rate as breaching its budget: it turns red, icon included. */\n errorBreach?: boolean;\n /** Omitted when the role has no measured duration: the row then draws requests and errors only. */\n duration?: Latency;\n /** The flow direction this role handles: its arrow (↓ consume, ↑ produce) leads the rate instead of the pulse icon. */\n direction?: \"consume\" | \"produce\";\n /** Names the role. Shown above the values, or as the rate's tooltip when `direction` is set. */\n label?: string;\n /** The errors by status code (e.g. HTTP 401 ×2), drawn in the errors metric after the rate. */\n errorCodes?: ReadonlyArray<{ status: string; count: number }>;\n /** Names requests and errors in muted lowercase (\"req\", \"errors\") before their values. */\n labelled?: boolean;\n}\n\n/** Broker counters for one queue. Enqueued and dequeued are rates per `per`; size and dlq are message counts. */\nexport interface QueueCounts {\n size?: number;\n enqueued?: number;\n dequeued?: number;\n dlq?: number;\n /** Rate unit after enqueued and dequeued; defaults to \"/min\". */\n per?: string;\n /** Names enqueued and dequeued in muted lowercase before their values. */\n labelled?: boolean;\n}\n\nconst ICON_CLASS = \"h-2.5 w-2.5 shrink-0\";\n\n/** A metric's name in muted lowercase, before its value. */\nfunction MetricLabel({ children }: { children: string }) {\n return <span className=\"text-muted-foreground\" data-red-label>{children}</span>;\n}\nconst DIRECTION_ICON = { consume: UiArrowDown, produce: UiArrowUp } as const;\n\nconst linearPct = (ms: number, scaleMax: number) => `${Math.min(ms / scaleMax, 1) * 100}%`;\n\n/**\n * Duration: the average, then a bar from 0 to the smallest of 100ms, 1s, 10s, 1m, 10m, 1h, 8h, 1d that holds the\n * average, filled linearly to it, with ticks at p95 (foreground) and max (muted). A tick past the end pins to it and is\n * marked `data-latency-overflow`. Its min-width of 100% wraps it onto its own line in a wrapping row.\n */\nexport function LatencyBar({ latency }: { latency: Latency }) {\n const { avg, p95, max } = latency;\n if (!(avg <= p95 && p95 <= max)) throw new Error(`LatencyBar needs avg <= p95 <= max (got ${avg}, ${p95}, ${max})`);\n const scaleMax = latencyScaleMax(avg);\n const ticks = [{ key: \"p95\", ms: p95, className: \"bg-foreground\" }, { key: \"max\", ms: max, className: \"bg-muted-foreground\" }] as const;\n return (\n <span className=\"inline-flex items-center gap-1\" style={{ minWidth: \"100%\" }} data-latency\n title={`avg ${formatMs(avg)} · p95 ${formatMs(p95)} · max ${formatMs(max)} (scale 0–${formatMs(scaleMax)})`}>\n <UiTimer className={cn(ICON_CLASS, \"text-muted-foreground\")} aria-label=\"duration\" />\n <span>{formatMs(avg)}</span>\n <span className=\"relative h-1.5 min-w-12 flex-1 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-muted-foreground/60\" style={{ width: linearPct(avg, scaleMax) }} data-latency-fill />\n {ticks.map(({ key, ms, className }) => (\n <span key={key} className={cn(\"absolute -inset-y-0.5 w-px\", className)} style={{ left: linearPct(ms, scaleMax) }}\n data-latency-tick={key} data-latency-overflow={ms > scaleMax || undefined} />\n ))}\n </span>\n <span className=\"font-mono text-[8px] text-muted-foreground\" data-latency-scale-max>{formatMs(scaleMax)}</span>\n </span>\n );\n}\n\n/**\n * A RED row: requests, error rate and duration (when measured), each led by an icon. A `direction` arrow replaces the pulse icon and\n * the label; otherwise a `label` sits above the values. A breached error rate turns red; the errors metric is hidden\n * when both the rate and the error codes are empty.\n */\nexport function RedLine({ metrics }: { metrics: RedMetrics }) {\n const { requests, per = \"/min\", duration, direction, label, labelled = false } = metrics;\n const RequestsIcon = direction ? DIRECTION_ICON[direction] : UiPulse;\n const requestsLabel = direction ? `${label ?? direction} rate` : \"requests\";\n return (\n <div className=\"flex flex-col leading-tight\" data-red-line>\n {!direction && label && <span className=\"truncate font-mono text-[8px] text-muted-foreground\">{label}</span>}\n <span className=\"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums\">\n <span className=\"inline-flex items-center gap-0.5\" title={requestsLabel} data-red=\"requests\">\n <RequestsIcon className={cn(ICON_CLASS, \"text-muted-foreground\")} aria-label={requestsLabel} />\n {labelled && <MetricLabel>req</MetricLabel>}\n {requests.toLocaleString(\"en-US\")}{per}\n </span>\n <RedErrors metrics={metrics} />\n {duration && <LatencyBar latency={duration} />}\n </span>\n </div>\n );\n}\n\nfunction RedErrors({ metrics }: { metrics: RedMetrics }) {\n const { errorRate, errorBreach = false, errorCodes = [], labelled = false } = metrics;\n if (!Number.isFinite(errorRate) || errorRate < 0) throw new Error(`RedLine errorRate must be a percentage >= 0, got ${errorRate}`);\n if (errorRate === 0 && errorCodes.length === 0) return null;\n return (\n <span className={cn(\"inline-flex items-center gap-0.5\", errorBreach && \"text-destructive\")} title=\"error rate\" data-red=\"errors\" data-breach={errorBreach || undefined}>\n <UiWarningCircle className={cn(ICON_CLASS, errorBreach ? \"text-destructive\" : \"text-muted-foreground\")} aria-label=\"error rate\" />\n {labelled && <MetricLabel>errors</MetricLabel>}\n {errorRate !== 0 && `${errorRate.toFixed(1)}%`}\n {errorCodes.map(({ status, count }) => (\n <span key={status} className=\"font-mono\" title={`${count} × ${status}`} data-red-error-code={status}>{status}<span className=\"text-muted-foreground\">×{count}</span></span>\n ))}\n </span>\n );\n}\n\nconst QUEUE_FIELDS = [\n { key: \"size\", title: \"depth\", Icon: UiStack, rate: false, labelled: false },\n { key: \"enqueued\", title: \"enqueued\", Icon: UiArrowUp, rate: true, labelled: true },\n { key: \"dequeued\", title: \"dequeued\", Icon: UiArrowDown, rate: true, labelled: true },\n { key: \"dlq\", title: \"dead letter\", Icon: UiSkull, rate: false, labelled: false },\n] as const;\n\n/**\n * A queue row: depth (a stack), enqueued (up), dequeued (down) and dead letters (a skull, red with its count: a dead\n * letter is always a breach). Missing or zero counters are not drawn; renders nothing when all are empty.\n */\nexport function QueueStats({ counts }: { counts: QueueCounts }) {\n const per = counts.per ?? \"/min\";\n const shown = QUEUE_FIELDS.map((field) => ({ ...field, value: counts[field.key] ?? 0 })).filter(({ value }) => value !== 0);\n if (shown.length === 0) return null;\n return (\n <span className=\"flex flex-wrap gap-x-2 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums\" data-queue-stats>\n {shown.map(({ key, title, Icon, rate, labelled, value }) => {\n const text = `${value.toLocaleString(\"en-US\")}${rate ? per : \"\"}`;\n return (\n <span key={key} className={cn(\"inline-flex items-center gap-0.5\", key === \"dlq\" && \"text-destructive\")} data-queue-stat={key} title={`${title} ${text}`}>\n <Icon className={cn(ICON_CLASS, key === \"dlq\" ? \"text-destructive\" : \"text-muted-foreground\")} aria-label={title} />\n {counts.labelled && labelled && <MetricLabel>{title}</MetricLabel>}\n {text}\n </span>\n );\n })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;AAsCA,IAAM,aAAa;;AAGnB,SAAS,YAAY,EAAE,YAAkC;CACvD,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;EAAwB,kBAAA;EAAgB;CAAe,CAAA;AAChF;AACA,IAAM,iBAAiB;CAAE,SAASA,oBAAAA;CAAa,SAASC,kBAAAA;AAAU;AAElE,IAAM,aAAa,IAAY,aAAqB,GAAG,KAAK,IAAI,KAAK,UAAU,CAAC,IAAI,IAAI;;;;;;AAOxF,SAAgB,WAAW,EAAE,WAAiC;CAC5D,MAAM,EAAE,KAAK,KAAK,QAAQ;CAC1B,IAAI,EAAE,OAAO,OAAO,OAAO,MAAM,MAAM,IAAI,MAAM,2CAA2C,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;CAClH,MAAM,WAAWC,gBAAAA,gBAAgB,GAAG;CACpC,MAAM,QAAQ,CAAC;EAAE,KAAK;EAAO,IAAI;EAAK,WAAW;CAAgB,GAAG;EAAE,KAAK;EAAO,IAAI;EAAK,WAAW;CAAsB,CAAC;CAC7H,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAA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,OAAO,IAAI,OAAO,MAAM;GAC7D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IAAgB,WAAWJ,cAAAA,GAAG,oCAAoC,QAAQ,SAAS,kBAAkB;IAAG,mBAAiB;IAAK,OAAO,GAAG,MAAM,GAAG;IAAjJ,UAAA;KACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;MAAM,WAAWA,cAAAA,GAAG,YAAY,QAAQ,QAAQ,qBAAqB,uBAAuB;MAAG,cAAY;KAAQ,CAAA;KAClH,OAAO,YAAY,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,EAAA,UAAc,MAAmB,CAAA;KAChE;IACG;GAJK,GAAA,GAIL;EAEV,CAAC;CACG,CAAA;AAEV"}
@@ -0,0 +1,60 @@
1
+ import { Latency } from './latency.js';
2
+ /** Rate, Errors and Duration for one role a workload plays in a flow. */
3
+ export interface RedMetrics {
4
+ /** Requests per `per`. */
5
+ requests: number;
6
+ /** Rate unit after the request count; defaults to "/min". */
7
+ per?: string;
8
+ /** Error rate in percent; a zero rate is not drawn. */
9
+ errorRate: number;
10
+ /** Marks the error rate as breaching its budget: it turns red, icon included. */
11
+ errorBreach?: boolean;
12
+ /** Omitted when the role has no measured duration: the row then draws requests and errors only. */
13
+ duration?: Latency;
14
+ /** The flow direction this role handles: its arrow (↓ consume, ↑ produce) leads the rate instead of the pulse icon. */
15
+ direction?: "consume" | "produce";
16
+ /** Names the role. Shown above the values, or as the rate's tooltip when `direction` is set. */
17
+ label?: string;
18
+ /** The errors by status code (e.g. HTTP 401 ×2), drawn in the errors metric after the rate. */
19
+ errorCodes?: ReadonlyArray<{
20
+ status: string;
21
+ count: number;
22
+ }>;
23
+ /** Names requests and errors in muted lowercase ("req", "errors") before their values. */
24
+ labelled?: boolean;
25
+ }
26
+ /** Broker counters for one queue. Enqueued and dequeued are rates per `per`; size and dlq are message counts. */
27
+ export interface QueueCounts {
28
+ size?: number;
29
+ enqueued?: number;
30
+ dequeued?: number;
31
+ dlq?: number;
32
+ /** Rate unit after enqueued and dequeued; defaults to "/min". */
33
+ per?: string;
34
+ /** Names enqueued and dequeued in muted lowercase before their values. */
35
+ labelled?: boolean;
36
+ }
37
+ /**
38
+ * Duration: the average, then a bar from 0 to the smallest of 100ms, 1s, 10s, 1m, 10m, 1h, 8h, 1d that holds the
39
+ * average, filled linearly to it, with ticks at p95 (foreground) and max (muted). A tick past the end pins to it and is
40
+ * marked `data-latency-overflow`. Its min-width of 100% wraps it onto its own line in a wrapping row.
41
+ */
42
+ export declare function LatencyBar({ latency }: {
43
+ latency: Latency;
44
+ }): import("react").JSX.Element;
45
+ /**
46
+ * A RED row: requests, error rate and duration (when measured), each led by an icon. A `direction` arrow replaces the pulse icon and
47
+ * the label; otherwise a `label` sits above the values. A breached error rate turns red; the errors metric is hidden
48
+ * when both the rate and the error codes are empty.
49
+ */
50
+ export declare function RedLine({ metrics }: {
51
+ metrics: RedMetrics;
52
+ }): import("react").JSX.Element;
53
+ /**
54
+ * A queue row: depth (a stack), enqueued (up), dequeued (down) and dead letters (a skull, red with its count: a dead
55
+ * letter is always a breach). Missing or zero counters are not drawn; renders nothing when all are empty.
56
+ */
57
+ export declare function QueueStats({ counts }: {
58
+ counts: QueueCounts;
59
+ }): import("react").JSX.Element | null;
60
+ //# sourceMappingURL=FlowMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowMetrics.d.ts","sourceRoot":"","sources":["../../../src/data/flow-node/FlowMetrics.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpE,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,WAAW,CAAC,EAAE,OAAO,C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