@stealthscale/component-charts 0.2.2 → 0.2.3

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 (123) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.js +1 -14710
  3. package/dist/pages/area-chart/area-chart.js +1151 -0
  4. package/dist/pages/area-chart/area-chart.props.js +3 -0
  5. package/dist/pages/bar-chart/bar-chart.js +990 -0
  6. package/dist/pages/bar-chart/bar-chart.props.js +3 -0
  7. package/dist/pages/box-plot/box-plot.js +1585 -0
  8. package/dist/pages/box-plot/box-plot.props.js +3 -0
  9. package/dist/pages/bubble-chart/bubble-chart.js +938 -0
  10. package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
  11. package/dist/pages/burndown-chart/burndown-chart.js +805 -0
  12. package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
  13. package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
  14. package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
  15. package/dist/pages/chart/chart.js +1190 -0
  16. package/dist/pages/chart/chart.props.js +3 -0
  17. package/dist/pages/chord-diagram/chord-diagram.js +891 -0
  18. package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
  19. package/dist/pages/combo-chart/combo-chart.js +873 -0
  20. package/dist/pages/combo-chart/combo-chart.props.js +3 -0
  21. package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
  22. package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
  23. package/dist/pages/donut-chart/donut-chart.js +726 -0
  24. package/dist/pages/donut-chart/donut-chart.props.js +3 -0
  25. package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
  26. package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
  27. package/dist/pages/gauge-chart/gauge-chart.js +767 -0
  28. package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
  29. package/dist/pages/heatmap/heatmap.js +1967 -0
  30. package/dist/pages/heatmap/heatmap.props.js +3 -0
  31. package/dist/pages/histogram-chart/histogram-chart.js +768 -0
  32. package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
  33. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
  34. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
  35. package/dist/pages/line-chart/line-chart.js +1882 -0
  36. package/dist/pages/line-chart/line-chart.props.js +3 -0
  37. package/dist/pages/pages.json +393 -0
  38. package/dist/pages/pareto-chart/pareto-chart.js +669 -0
  39. package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
  40. package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
  41. package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
  42. package/dist/pages/pie-chart/pie-chart.js +1007 -0
  43. package/dist/pages/pie-chart/pie-chart.props.js +3 -0
  44. package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
  45. package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
  46. package/dist/pages/radar-chart/radar-chart.js +1101 -0
  47. package/dist/pages/radar-chart/radar-chart.props.js +3 -0
  48. package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
  49. package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
  50. package/dist/pages/range-chart/range-chart.js +914 -0
  51. package/dist/pages/range-chart/range-chart.props.js +3 -0
  52. package/dist/pages/regression-overlay/regression-overlay.js +494 -0
  53. package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
  54. package/dist/pages/sankey-chart/sankey-chart.js +700 -0
  55. package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
  56. package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
  57. package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
  58. package/dist/pages/sparkbar/sparkbar.js +629 -0
  59. package/dist/pages/sparkbar/sparkbar.props.js +3 -0
  60. package/dist/pages/sparkline/sparkline.js +960 -0
  61. package/dist/pages/sparkline/sparkline.props.js +3 -0
  62. package/dist/pages/spend-5xQ76WSj.js +185 -0
  63. package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
  64. package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
  65. package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
  66. package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
  67. package/dist/pages/step-line-chart/step-line-chart.js +573 -0
  68. package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
  69. package/dist/pages/stream-graph/stream-graph.js +1662 -0
  70. package/dist/pages/stream-graph/stream-graph.props.js +3 -0
  71. package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
  72. package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
  73. package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
  74. package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
  75. package/dist/pages/treemap-chart/treemap-chart.js +904 -0
  76. package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
  77. package/dist/pages/violin-plot/violin-plot.js +1303 -0
  78. package/dist/pages/violin-plot/violin-plot.props.js +3 -0
  79. package/dist/pages/visitors-oFFVcbIZ.js +248 -0
  80. package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
  81. package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
  82. package/dist/shared-DVZJ2nST.js +14711 -0
  83. package/dist/theme.js +1 -1
  84. package/locales/en/specimen/area-chart.json +56 -0
  85. package/locales/en/specimen/bar-chart.json +56 -0
  86. package/locales/en/specimen/box-plot.json +65 -0
  87. package/locales/en/specimen/bubble-chart.json +47 -0
  88. package/locales/en/specimen/burndown-chart.json +46 -0
  89. package/locales/en/specimen/candlestick-chart.json +42 -0
  90. package/locales/en/specimen/chart.json +53 -0
  91. package/locales/en/specimen/chord-diagram.json +69 -0
  92. package/locales/en/specimen/combo-chart.json +41 -0
  93. package/locales/en/specimen/distribution-chart.json +47 -0
  94. package/locales/en/specimen/donut-chart.json +63 -0
  95. package/locales/en/specimen/funnel-chart.json +84 -0
  96. package/locales/en/specimen/gauge-chart.json +68 -0
  97. package/locales/en/specimen/heatmap.json +187 -0
  98. package/locales/en/specimen/histogram-chart.json +48 -0
  99. package/locales/en/specimen/horizontal-bar-chart.json +54 -0
  100. package/locales/en/specimen/line-chart.json +106 -0
  101. package/locales/en/specimen/pareto-chart.json +43 -0
  102. package/locales/en/specimen/percent-stacked-bar.json +37 -0
  103. package/locales/en/specimen/pie-chart.json +80 -0
  104. package/locales/en/specimen/polar-area-chart.json +90 -0
  105. package/locales/en/specimen/radar-chart.json +82 -0
  106. package/locales/en/specimen/radial-bar-chart.json +62 -0
  107. package/locales/en/specimen/range-chart.json +42 -0
  108. package/locales/en/specimen/regression-overlay.json +36 -0
  109. package/locales/en/specimen/sankey-chart.json +89 -0
  110. package/locales/en/specimen/scatter-plot.json +88 -0
  111. package/locales/en/specimen/sparkbar.json +51 -0
  112. package/locales/en/specimen/sparkline.json +70 -0
  113. package/locales/en/specimen/stacked-area-chart.json +44 -0
  114. package/locales/en/specimen/stacked-bar-chart.json +34 -0
  115. package/locales/en/specimen/step-line-chart.json +33 -0
  116. package/locales/en/specimen/stream-graph.json +54 -0
  117. package/locales/en/specimen/sunburst-chart.json +110 -0
  118. package/locales/en/specimen/timeline-chart.json +77 -0
  119. package/locales/en/specimen/treemap-chart.json +107 -0
  120. package/locales/en/specimen/violin-plot.json +54 -0
  121. package/locales/en/specimen/waterfall-chart.json +71 -0
  122. package/package.json +8 -7
  123. /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
@@ -0,0 +1,767 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { B as GaugeChart } from "../../shared-DVZJ2nST.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Room, specimen, useWords } from "@stealthscale/specimen";
7
+ import { RotateCcwIcon } from "lucide-react";
8
+ import { Button } from "@stealthscale/component-actions";
9
+ import { Grid, Stack } from "@stealthscale/component-layout";
10
+ //#region src/gauge-chart/examples/readings.ts
11
+ /**
12
+ * Lists the zones of a p99 latency in milliseconds: healthy up to 600, watch up to the 900ms error
13
+ * budget and critical up to 1,200.
14
+ */
15
+ const LATENCY = [
16
+ {
17
+ color: "success",
18
+ key: "healthy",
19
+ upTo: 600
20
+ },
21
+ {
22
+ color: "warning",
23
+ key: "watch",
24
+ upTo: 900
25
+ },
26
+ {
27
+ color: "error",
28
+ key: "critical",
29
+ upTo: 1200
30
+ }
31
+ ];
32
+ /**
33
+ * Milliseconds the latency dial ends at.
34
+ */
35
+ const BUDGET_MAX = 1200;
36
+ /**
37
+ * Requests a second the service was tested to.
38
+ */
39
+ const THROUGHPUT_MAX = 5e3;
40
+ /**
41
+ * Lists the zones of a resource's use as a share: fine up to 70%, filling up to 90% and full up to
42
+ * 100%.
43
+ */
44
+ const USE = [
45
+ {
46
+ color: "success",
47
+ key: "fine",
48
+ upTo: .7
49
+ },
50
+ {
51
+ color: "warning",
52
+ key: "filling",
53
+ upTo: .9
54
+ },
55
+ {
56
+ color: "error",
57
+ key: "full",
58
+ upTo: 1
59
+ }
60
+ ];
61
+ /**
62
+ * Lists a host's use of its CPU, memory and disk. The disk is 93% full.
63
+ */
64
+ const HOST = [
65
+ {
66
+ key: "cpu",
67
+ used: .64
68
+ },
69
+ {
70
+ key: "memory",
71
+ used: .81
72
+ },
73
+ {
74
+ key: "disk",
75
+ used: .93
76
+ }
77
+ ];
78
+ //#endregion
79
+ //#region src/gauge-chart/examples/critical.example.tsx
80
+ var critical_example_exports = /* @__PURE__ */ __exportAll({
81
+ Critical: () => Critical,
82
+ source: () => source$8
83
+ });
84
+ function Critical() {
85
+ const $ = c(11);
86
+ const { t } = useWords("gauge-chart");
87
+ let t0;
88
+ if ($[0] !== t) {
89
+ t0 = t("critical.caption");
90
+ $[0] = t;
91
+ $[1] = t0;
92
+ } else t0 = $[1];
93
+ let t1;
94
+ if ($[2] !== t) {
95
+ t1 = t("latency.label");
96
+ $[2] = t;
97
+ $[3] = t1;
98
+ } else t1 = $[3];
99
+ let t2;
100
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
101
+ t2 = {
102
+ style: "unit",
103
+ unit: "millisecond",
104
+ unitDisplay: "narrow"
105
+ };
106
+ $[4] = t2;
107
+ } else t2 = $[4];
108
+ let t3;
109
+ if ($[5] !== t) {
110
+ t3 = LATENCY.map((t4) => {
111
+ const { color, key, upTo } = t4;
112
+ return {
113
+ color,
114
+ label: t(`zones.${key}`),
115
+ upTo
116
+ };
117
+ });
118
+ $[5] = t;
119
+ $[6] = t3;
120
+ } else t3 = $[6];
121
+ let t4;
122
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t3) {
123
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
124
+ caption: t0,
125
+ label: t1,
126
+ max: BUDGET_MAX,
127
+ value: 1080,
128
+ valueOptions: t2,
129
+ zones: t3
130
+ });
131
+ $[7] = t0;
132
+ $[8] = t1;
133
+ $[9] = t3;
134
+ $[10] = t4;
135
+ } else t4 = $[10];
136
+ return t4;
137
+ }
138
+ const source$8 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX, LATENCY } from \"./readings.ts\";\n\nexport function Critical(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"critical.caption\")}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={1080}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n zones={LATENCY.map(({ color, key, upTo }) => ({ color, label: t(`zones.${key}`), upTo }))}\n />\n );\n}\n";
139
+ //#endregion
140
+ //#region src/gauge-chart/examples/disk.example.tsx
141
+ var disk_example_exports = /* @__PURE__ */ __exportAll({
142
+ Disk: () => Disk,
143
+ source: () => source$7
144
+ });
145
+ function Disk() {
146
+ const $ = c(11);
147
+ const { t } = useWords("gauge-chart");
148
+ let t0;
149
+ if ($[0] !== t) {
150
+ t0 = t("disk.caption");
151
+ $[0] = t;
152
+ $[1] = t0;
153
+ } else t0 = $[1];
154
+ let t1;
155
+ if ($[2] !== t) {
156
+ t1 = t("disk.label");
157
+ $[2] = t;
158
+ $[3] = t1;
159
+ } else t1 = $[3];
160
+ let t2;
161
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
162
+ t2 = { style: "percent" };
163
+ $[4] = t2;
164
+ } else t2 = $[4];
165
+ let t3;
166
+ if ($[5] !== t) {
167
+ t3 = USE.map((t4) => {
168
+ const { color, key, upTo } = t4;
169
+ return {
170
+ color,
171
+ label: t(`zones.${key}`),
172
+ upTo
173
+ };
174
+ });
175
+ $[5] = t;
176
+ $[6] = t3;
177
+ } else t3 = $[6];
178
+ let t4;
179
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t3) {
180
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
181
+ caption: t0,
182
+ label: t1,
183
+ max: 1,
184
+ value: .86,
185
+ valueOptions: t2,
186
+ zones: t3
187
+ });
188
+ $[7] = t0;
189
+ $[8] = t1;
190
+ $[9] = t3;
191
+ $[10] = t4;
192
+ } else t4 = $[10];
193
+ return t4;
194
+ }
195
+ const source$7 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { USE } from \"./readings.ts\";\n\nexport function Disk(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"disk.caption\")}\n label={t(\"disk.label\")}\n max={1}\n value={0.86}\n valueOptions={{ style: \"percent\" }}\n zones={USE.map(({ color, key, upTo }) => ({ color, label: t(`zones.${key}`), upTo }))}\n />\n );\n}\n";
196
+ //#endregion
197
+ //#region src/gauge-chart/examples/latency.example.tsx
198
+ var latency_example_exports = /* @__PURE__ */ __exportAll({
199
+ Latency: () => Latency,
200
+ source: () => source$6
201
+ });
202
+ function Latency() {
203
+ const $ = c(11);
204
+ const { t } = useWords("gauge-chart");
205
+ let t0;
206
+ if ($[0] !== t) {
207
+ t0 = t("latency.caption");
208
+ $[0] = t;
209
+ $[1] = t0;
210
+ } else t0 = $[1];
211
+ let t1;
212
+ if ($[2] !== t) {
213
+ t1 = t("latency.label");
214
+ $[2] = t;
215
+ $[3] = t1;
216
+ } else t1 = $[3];
217
+ let t2;
218
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
219
+ t2 = {
220
+ style: "unit",
221
+ unit: "millisecond",
222
+ unitDisplay: "narrow"
223
+ };
224
+ $[4] = t2;
225
+ } else t2 = $[4];
226
+ let t3;
227
+ if ($[5] !== t) {
228
+ t3 = LATENCY.map((t4) => {
229
+ const { color, key, upTo } = t4;
230
+ return {
231
+ color,
232
+ label: t(`zones.${key}`),
233
+ upTo
234
+ };
235
+ });
236
+ $[5] = t;
237
+ $[6] = t3;
238
+ } else t3 = $[6];
239
+ let t4;
240
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t3) {
241
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
242
+ caption: t0,
243
+ label: t1,
244
+ max: BUDGET_MAX,
245
+ value: 740,
246
+ valueOptions: t2,
247
+ zones: t3
248
+ });
249
+ $[7] = t0;
250
+ $[8] = t1;
251
+ $[9] = t3;
252
+ $[10] = t4;
253
+ } else t4 = $[10];
254
+ return t4;
255
+ }
256
+ const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX, LATENCY } from \"./readings.ts\";\n\nexport function Latency(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"latency.caption\")}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={740}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n zones={LATENCY.map(({ color, key, upTo }) => ({ color, label: t(`zones.${key}`), upTo }))}\n />\n );\n}\n";
257
+ //#endregion
258
+ //#region src/gauge-chart/examples/overrun.example.tsx
259
+ var overrun_example_exports = /* @__PURE__ */ __exportAll({
260
+ Overrun: () => Overrun,
261
+ source: () => source$5
262
+ });
263
+ function Overrun() {
264
+ const $ = c(11);
265
+ const { t } = useWords("gauge-chart");
266
+ let t0;
267
+ if ($[0] !== t) {
268
+ t0 = t("overrun.caption");
269
+ $[0] = t;
270
+ $[1] = t0;
271
+ } else t0 = $[1];
272
+ let t1;
273
+ if ($[2] !== t) {
274
+ t1 = t("latency.label");
275
+ $[2] = t;
276
+ $[3] = t1;
277
+ } else t1 = $[3];
278
+ let t2;
279
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
280
+ t2 = {
281
+ style: "unit",
282
+ unit: "millisecond",
283
+ unitDisplay: "narrow"
284
+ };
285
+ $[4] = t2;
286
+ } else t2 = $[4];
287
+ let t3;
288
+ if ($[5] !== t) {
289
+ t3 = LATENCY.map((t4) => {
290
+ const { color, key, upTo } = t4;
291
+ return {
292
+ color,
293
+ label: t(`zones.${key}`),
294
+ upTo
295
+ };
296
+ });
297
+ $[5] = t;
298
+ $[6] = t3;
299
+ } else t3 = $[6];
300
+ let t4;
301
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t3) {
302
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
303
+ caption: t0,
304
+ label: t1,
305
+ max: BUDGET_MAX,
306
+ value: 4e3,
307
+ valueOptions: t2,
308
+ zones: t3
309
+ });
310
+ $[7] = t0;
311
+ $[8] = t1;
312
+ $[9] = t3;
313
+ $[10] = t4;
314
+ } else t4 = $[10];
315
+ return t4;
316
+ }
317
+ const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX, LATENCY } from \"./readings.ts\";\n\nexport function Overrun(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"overrun.caption\")}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={4000}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n zones={LATENCY.map(({ color, key, upTo }) => ({ color, label: t(`zones.${key}`), upTo }))}\n />\n );\n}\n";
318
+ //#endregion
319
+ //#region src/gauge-chart/examples/quiet.example.tsx
320
+ var quiet_example_exports = /* @__PURE__ */ __exportAll({
321
+ Quiet: () => Quiet,
322
+ source: () => source$4
323
+ });
324
+ function Quiet() {
325
+ const $ = c(10);
326
+ const { t } = useWords("gauge-chart");
327
+ let t0;
328
+ if ($[0] !== t) {
329
+ t0 = t("quiet.caption");
330
+ $[0] = t;
331
+ $[1] = t0;
332
+ } else t0 = $[1];
333
+ let t1;
334
+ if ($[2] !== t) {
335
+ t1 = t("quiet.empty");
336
+ $[2] = t;
337
+ $[3] = t1;
338
+ } else t1 = $[3];
339
+ let t2;
340
+ if ($[4] !== t) {
341
+ t2 = t("latency.label");
342
+ $[4] = t;
343
+ $[5] = t2;
344
+ } else t2 = $[5];
345
+ let t3;
346
+ if ($[6] !== t0 || $[7] !== t1 || $[8] !== t2) {
347
+ t3 = /* @__PURE__ */ jsx(GaugeChart, {
348
+ caption: t0,
349
+ empty: t1,
350
+ label: t2,
351
+ max: BUDGET_MAX,
352
+ value: NaN
353
+ });
354
+ $[6] = t0;
355
+ $[7] = t1;
356
+ $[8] = t2;
357
+ $[9] = t3;
358
+ } else t3 = $[9];
359
+ return t3;
360
+ }
361
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX } from \"./readings.ts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"quiet.caption\")}\n empty={t(\"quiet.empty\")}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={Number.NaN}\n />\n );\n}\n";
362
+ //#endregion
363
+ //#region src/gauge-chart/examples/replay.example.tsx
364
+ var replay_example_exports = /* @__PURE__ */ __exportAll({
365
+ Replay: () => Replay,
366
+ source: () => source$3
367
+ });
368
+ function Replay() {
369
+ const $ = c(23);
370
+ const { t } = useWords("gauge-chart");
371
+ const [run, setRun] = useState(0);
372
+ let t0;
373
+ if ($[0] !== t) {
374
+ t0 = t("latency.caption");
375
+ $[0] = t;
376
+ $[1] = t0;
377
+ } else t0 = $[1];
378
+ let t1;
379
+ if ($[2] !== t) {
380
+ t1 = t("latency.label");
381
+ $[2] = t;
382
+ $[3] = t1;
383
+ } else t1 = $[3];
384
+ let t2;
385
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
386
+ t2 = {
387
+ style: "unit",
388
+ unit: "millisecond",
389
+ unitDisplay: "narrow"
390
+ };
391
+ $[4] = t2;
392
+ } else t2 = $[4];
393
+ let t3;
394
+ if ($[5] !== t) {
395
+ t3 = LATENCY.map((t4) => {
396
+ const { color, key, upTo } = t4;
397
+ return {
398
+ color,
399
+ label: t(`zones.${key}`),
400
+ upTo
401
+ };
402
+ });
403
+ $[5] = t;
404
+ $[6] = t3;
405
+ } else t3 = $[6];
406
+ let t4;
407
+ if ($[7] !== run || $[8] !== t0 || $[9] !== t1 || $[10] !== t3) {
408
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
409
+ animate: true,
410
+ caption: t0,
411
+ label: t1,
412
+ max: BUDGET_MAX,
413
+ value: 740,
414
+ valueOptions: t2,
415
+ zones: t3
416
+ }, run);
417
+ $[7] = run;
418
+ $[8] = t0;
419
+ $[9] = t1;
420
+ $[10] = t3;
421
+ $[11] = t4;
422
+ } else t4 = $[11];
423
+ let t5;
424
+ if ($[12] !== run) {
425
+ t5 = () => {
426
+ setRun(run + 1);
427
+ };
428
+ $[12] = run;
429
+ $[13] = t5;
430
+ } else t5 = $[13];
431
+ let t6;
432
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
433
+ t6 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
434
+ $[14] = t6;
435
+ } else t6 = $[14];
436
+ let t7;
437
+ if ($[15] !== t) {
438
+ t7 = t("replay.replay");
439
+ $[15] = t;
440
+ $[16] = t7;
441
+ } else t7 = $[16];
442
+ let t8;
443
+ if ($[17] !== t5 || $[18] !== t7) {
444
+ t8 = /* @__PURE__ */ jsxs(Button, {
445
+ onClick: t5,
446
+ size: "sm",
447
+ variant: "outline",
448
+ children: [t6, t7]
449
+ });
450
+ $[17] = t5;
451
+ $[18] = t7;
452
+ $[19] = t8;
453
+ } else t8 = $[19];
454
+ let t9;
455
+ if ($[20] !== t4 || $[21] !== t8) {
456
+ t9 = /* @__PURE__ */ jsxs(Stack, {
457
+ align: "flex-start",
458
+ children: [t4, t8]
459
+ });
460
+ $[20] = t4;
461
+ $[21] = t8;
462
+ $[22] = t9;
463
+ } else t9 = $[22];
464
+ return t9;
465
+ }
466
+ const source$3 = "import { type ReactElement, useState } from \"react\";\n\nimport { RotateCcwIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX, LATENCY } from \"./readings.ts\";\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <GaugeChart\n animate\n caption={t(\"latency.caption\")}\n key={run}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={740}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n zones={LATENCY.map(({ color, key, upTo }) => ({ color, label: t(`zones.${key}`), upTo }))}\n />\n <Button\n onClick={() => {\n setRun(run + 1);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <RotateCcwIcon />\n {t(\"replay.replay\")}\n </Button>\n </Stack>\n );\n}\n";
467
+ //#endregion
468
+ //#region src/gauge-chart/examples/short.example.tsx
469
+ var short_example_exports = /* @__PURE__ */ __exportAll({
470
+ Short: () => Short,
471
+ source: () => source$2
472
+ });
473
+ function Short() {
474
+ const $ = c(11);
475
+ const { t } = useWords("gauge-chart");
476
+ let t0;
477
+ if ($[0] !== t) {
478
+ t0 = t("short.caption");
479
+ $[0] = t;
480
+ $[1] = t0;
481
+ } else t0 = $[1];
482
+ let t1;
483
+ if ($[2] !== t) {
484
+ t1 = t("latency.label");
485
+ $[2] = t;
486
+ $[3] = t1;
487
+ } else t1 = $[3];
488
+ let t2;
489
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
490
+ t2 = {
491
+ style: "unit",
492
+ unit: "millisecond",
493
+ unitDisplay: "narrow"
494
+ };
495
+ $[4] = t2;
496
+ } else t2 = $[4];
497
+ let t3;
498
+ if ($[5] !== t) {
499
+ t3 = LATENCY.slice(0, 2).map((t4) => {
500
+ const { color, key, upTo } = t4;
501
+ return {
502
+ color,
503
+ label: t(`zones.${key}`),
504
+ upTo
505
+ };
506
+ });
507
+ $[5] = t;
508
+ $[6] = t3;
509
+ } else t3 = $[6];
510
+ let t4;
511
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t3) {
512
+ t4 = /* @__PURE__ */ jsx(GaugeChart, {
513
+ caption: t0,
514
+ label: t1,
515
+ max: BUDGET_MAX,
516
+ value: 1050,
517
+ valueOptions: t2,
518
+ zones: t3
519
+ });
520
+ $[7] = t0;
521
+ $[8] = t1;
522
+ $[9] = t3;
523
+ $[10] = t4;
524
+ } else t4 = $[10];
525
+ return t4;
526
+ }
527
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { BUDGET_MAX, LATENCY } from \"./readings.ts\";\n\nexport function Short(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"short.caption\")}\n label={t(\"latency.label\")}\n max={BUDGET_MAX}\n value={1050}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n zones={LATENCY.slice(0, 2).map(({ color, key, upTo }) => ({\n color,\n label: t(`zones.${key}`),\n upTo,\n }))}\n />\n );\n}\n";
528
+ //#endregion
529
+ //#region src/gauge-chart/examples/throughput.example.tsx
530
+ var throughput_example_exports = /* @__PURE__ */ __exportAll({
531
+ Throughput: () => Throughput,
532
+ source: () => source$1
533
+ });
534
+ function Throughput() {
535
+ const $ = c(10);
536
+ const { t } = useWords("gauge-chart");
537
+ let t0;
538
+ if ($[0] !== t) {
539
+ t0 = t("throughput.caption");
540
+ $[0] = t;
541
+ $[1] = t0;
542
+ } else t0 = $[1];
543
+ let t1;
544
+ if ($[2] !== t) {
545
+ t1 = t("throughput.unit");
546
+ $[2] = t;
547
+ $[3] = t1;
548
+ } else t1 = $[3];
549
+ let t2;
550
+ if ($[4] !== t) {
551
+ t2 = t("throughput.label");
552
+ $[4] = t;
553
+ $[5] = t2;
554
+ } else t2 = $[5];
555
+ let t3;
556
+ if ($[6] !== t0 || $[7] !== t1 || $[8] !== t2) {
557
+ t3 = /* @__PURE__ */ jsx(GaugeChart, {
558
+ caption: t0,
559
+ centerLabel: t1,
560
+ label: t2,
561
+ max: THROUGHPUT_MAX,
562
+ value: 3120
563
+ });
564
+ $[6] = t0;
565
+ $[7] = t1;
566
+ $[8] = t2;
567
+ $[9] = t3;
568
+ } else t3 = $[9];
569
+ return t3;
570
+ }
571
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { THROUGHPUT_MAX } from \"./readings.ts\";\n\nexport function Throughput(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <GaugeChart\n caption={t(\"throughput.caption\")}\n centerLabel={t(\"throughput.unit\")}\n label={t(\"throughput.label\")}\n max={THROUGHPUT_MAX}\n value={3120}\n />\n );\n}\n";
572
+ //#endregion
573
+ //#region src/gauge-chart/examples/tiles.example.tsx
574
+ var tiles_example_exports = /* @__PURE__ */ __exportAll({
575
+ Tiles: () => Tiles,
576
+ source: () => source
577
+ });
578
+ function Tiles() {
579
+ const $ = c(4);
580
+ const { t } = useWords("gauge-chart");
581
+ let t0;
582
+ if ($[0] !== t) {
583
+ t0 = HOST.map((t1) => {
584
+ const { key, used } = t1;
585
+ return /* @__PURE__ */ jsx(GaugeChart, {
586
+ caption: t(`tiles.${key}`),
587
+ label: t(`tiles.${key}`),
588
+ limits: false,
589
+ max: 1,
590
+ value: used,
591
+ valueOptions: { style: "percent" },
592
+ zones: USE.map((zone) => ({
593
+ color: zone.color,
594
+ label: t(`zones.${zone.key}`),
595
+ upTo: zone.upTo
596
+ }))
597
+ }, key);
598
+ });
599
+ $[0] = t;
600
+ $[1] = t0;
601
+ } else t0 = $[1];
602
+ let t1;
603
+ if ($[2] !== t0) {
604
+ t1 = /* @__PURE__ */ jsx(Grid.Root, {
605
+ columns: "3",
606
+ children: t0
607
+ });
608
+ $[2] = t0;
609
+ $[3] = t1;
610
+ } else t1 = $[3];
611
+ return t1;
612
+ }
613
+ const source = "import { type ReactElement } from \"react\";\n\nimport { Grid } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { GaugeChart } from \"@stealthscale/component-charts\";\n\nimport { HOST, USE } from \"./readings.ts\";\n\nexport function Tiles(): ReactElement {\n const { t } = useWords(\"gauge-chart\");\n\n return (\n <Grid.Root columns=\"3\">\n {HOST.map(({ key, used }) => (\n <GaugeChart\n caption={t(`tiles.${key}`)}\n key={key}\n label={t(`tiles.${key}`)}\n limits={false}\n max={1}\n value={used}\n valueOptions={{ style: \"percent\" }}\n zones={USE.map((zone) => ({\n color: zone.color,\n label: t(`zones.${zone.key}`),\n upTo: zone.upTo,\n }))}\n />\n ))}\n </Grid.Root>\n );\n}\n";
614
+ //#endregion
615
+ //#region src/gauge-chart/gauge-chart.specimen.tsx
616
+ /**
617
+ * Catalogue page for the gauge chart.
618
+ *
619
+ * @remarks
620
+ * The gauge chart has no recipe of its own: the chart's recipe styles its figure, so every scene
621
+ * is hand-written. The scenes render a latency in its watch zone, the latency past its error
622
+ * budget, zones that end early, a throughput without zones, a value past the dial's end, a disk's
623
+ * use as a percentage, three gauges as tiles, the dial animated in with a replay, the latency at
624
+ * a phone's width, and a gauge without a reading. Every scene renders a component from
625
+ * `examples/` and shows that file as its source. The words are keys under `gauge-chart` in
626
+ * `locales/en/specimen/gauge-chart.json`.
627
+ */
628
+ /**
629
+ * Hand-written scene for a latency in its watch zone.
630
+ */
631
+ const watched = {
632
+ about: "gauge-chart.latency.about",
633
+ draw: () => /* @__PURE__ */ jsx(Room, {
634
+ size: "sm",
635
+ children: /* @__PURE__ */ jsx(Latency, {})
636
+ }),
637
+ example: latency_example_exports,
638
+ title: "gauge-chart.latency.title"
639
+ };
640
+ /**
641
+ * Hand-written scene for a latency past its error budget.
642
+ */
643
+ const alarmed = {
644
+ about: "gauge-chart.critical.about",
645
+ draw: () => /* @__PURE__ */ jsx(Room, {
646
+ size: "sm",
647
+ children: /* @__PURE__ */ jsx(Critical, {})
648
+ }),
649
+ example: critical_example_exports,
650
+ title: "gauge-chart.critical.title"
651
+ };
652
+ /**
653
+ * Hand-written scene for zones that end before the range does.
654
+ */
655
+ const partial = {
656
+ about: "gauge-chart.short.about",
657
+ draw: () => /* @__PURE__ */ jsx(Room, {
658
+ size: "sm",
659
+ children: /* @__PURE__ */ jsx(Short, {})
660
+ }),
661
+ example: short_example_exports,
662
+ title: "gauge-chart.short.title"
663
+ };
664
+ /**
665
+ * Hand-written scene for a gauge without zones.
666
+ */
667
+ const plain = {
668
+ about: "gauge-chart.throughput.about",
669
+ draw: () => /* @__PURE__ */ jsx(Room, {
670
+ size: "sm",
671
+ children: /* @__PURE__ */ jsx(Throughput, {})
672
+ }),
673
+ example: throughput_example_exports,
674
+ title: "gauge-chart.throughput.title"
675
+ };
676
+ /**
677
+ * Hand-written scene for a value past the dial's end.
678
+ */
679
+ const overflowing = {
680
+ about: "gauge-chart.overrun.about",
681
+ draw: () => /* @__PURE__ */ jsx(Room, {
682
+ size: "sm",
683
+ children: /* @__PURE__ */ jsx(Overrun, {})
684
+ }),
685
+ example: overrun_example_exports,
686
+ title: "gauge-chart.overrun.title"
687
+ };
688
+ /**
689
+ * Hand-written scene for a share as a percentage.
690
+ */
691
+ const shared = {
692
+ about: "gauge-chart.disk.about",
693
+ draw: () => /* @__PURE__ */ jsx(Room, {
694
+ size: "sm",
695
+ children: /* @__PURE__ */ jsx(Disk, {})
696
+ }),
697
+ example: disk_example_exports,
698
+ title: "gauge-chart.disk.title"
699
+ };
700
+ /**
701
+ * Hand-written scene for three gauges as tiles.
702
+ */
703
+ const tiled = {
704
+ about: "gauge-chart.tiles.about",
705
+ draw: () => /* @__PURE__ */ jsx(Room, {
706
+ size: "md",
707
+ children: /* @__PURE__ */ jsx(Tiles, {})
708
+ }),
709
+ example: tiles_example_exports,
710
+ title: "gauge-chart.tiles.title"
711
+ };
712
+ /**
713
+ * Hand-written scene for the dial animated in, with a replay.
714
+ */
715
+ const animated = {
716
+ about: "gauge-chart.replay.about",
717
+ draw: () => /* @__PURE__ */ jsx(Room, {
718
+ size: "sm",
719
+ children: /* @__PURE__ */ jsx(Replay, {})
720
+ }),
721
+ example: replay_example_exports,
722
+ title: "gauge-chart.replay.title"
723
+ };
724
+ /**
725
+ * Hand-written scene for the latency at a phone's width.
726
+ */
727
+ const narrow = {
728
+ about: "gauge-chart.narrow.about",
729
+ draw: () => /* @__PURE__ */ jsx(Room, {
730
+ size: "xs",
731
+ children: /* @__PURE__ */ jsx(Latency, {})
732
+ }),
733
+ example: latency_example_exports,
734
+ title: "gauge-chart.narrow.title"
735
+ };
736
+ /**
737
+ * Hand-written scene for a gauge without a reading.
738
+ */
739
+ const empty = {
740
+ about: "gauge-chart.quiet.about",
741
+ draw: () => /* @__PURE__ */ jsx(Room, {
742
+ size: "sm",
743
+ children: /* @__PURE__ */ jsx(Quiet, {})
744
+ }),
745
+ example: quiet_example_exports,
746
+ title: "gauge-chart.quiet.title"
747
+ };
748
+ var gauge_chart_specimen_default = specimen({
749
+ about: "gauge-chart.about",
750
+ id: "components/charts/gauge-chart",
751
+ imports: "import { GaugeChart } from \"@stealthscale/component-charts\";",
752
+ scenes: [
753
+ watched,
754
+ alarmed,
755
+ partial,
756
+ plain,
757
+ overflowing,
758
+ shared,
759
+ tiled,
760
+ animated,
761
+ narrow,
762
+ empty
763
+ ],
764
+ title: "gauge-chart.title"
765
+ });
766
+ //#endregion
767
+ export { alarmed, animated, gauge_chart_specimen_default as default, empty, narrow, overflowing, partial, plain, shared, tiled, watched };