@stealthscale/component-charts 0.2.1 → 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 +29 -13
  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 +9 -8
  123. /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
@@ -0,0 +1,700 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { b as SankeyChart, it as sankeyCycles, rt as flowBalance } from "../../shared-DVZJ2nST.js";
3
+ import { a as LOOPED, c as VISITORS, i as LINES, l as named, n as INCOME, o as QUEUE, r as LEAKY, s as STEPS, t as CHECKOUT } from "../visitors-oFFVcbIZ.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Room, specimen, useWords } from "@stealthscale/specimen";
7
+ //#region src/sankey-chart/examples/income.example.tsx
8
+ var income_example_exports = /* @__PURE__ */ __exportAll({
9
+ Income: () => Income,
10
+ source: () => source$6
11
+ });
12
+ function Income() {
13
+ const $ = c(23);
14
+ const { t } = useWords("sankey-chart");
15
+ let t0;
16
+ if ($[0] !== t) {
17
+ t0 = t("income.caption");
18
+ $[0] = t;
19
+ $[1] = t0;
20
+ } else t0 = $[1];
21
+ let t1;
22
+ if ($[2] !== t) {
23
+ t1 = t("in");
24
+ $[2] = t;
25
+ $[3] = t1;
26
+ } else t1 = $[3];
27
+ let t2;
28
+ if ($[4] !== t) {
29
+ t2 = t("income.label");
30
+ $[4] = t;
31
+ $[5] = t2;
32
+ } else t2 = $[5];
33
+ let t3;
34
+ if ($[6] !== t) {
35
+ t3 = named(LINES, (key) => t(`names.${key}`));
36
+ $[6] = t;
37
+ $[7] = t3;
38
+ } else t3 = $[7];
39
+ let t4;
40
+ if ($[8] !== t) {
41
+ t4 = t("out");
42
+ $[8] = t;
43
+ $[9] = t4;
44
+ } else t4 = $[9];
45
+ let t5;
46
+ if ($[10] !== t) {
47
+ t5 = t("share");
48
+ $[10] = t;
49
+ $[11] = t5;
50
+ } else t5 = $[11];
51
+ let t6;
52
+ if ($[12] !== t) {
53
+ t6 = t("income.value");
54
+ $[12] = t;
55
+ $[13] = t6;
56
+ } else t6 = $[13];
57
+ let t7;
58
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
59
+ t7 = {
60
+ currency: "EUR",
61
+ maximumFractionDigits: 1,
62
+ notation: "compact",
63
+ style: "currency"
64
+ };
65
+ $[14] = t7;
66
+ } else t7 = $[14];
67
+ let t8;
68
+ if ($[15] !== t0 || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
69
+ t8 = /* @__PURE__ */ jsx(SankeyChart, {
70
+ caption: t0,
71
+ flows: INCOME,
72
+ inflowLabel: t1,
73
+ label: t2,
74
+ nodes: t3,
75
+ outflowLabel: t4,
76
+ shareLabel: t5,
77
+ valueLabel: t6,
78
+ valueOptions: t7
79
+ });
80
+ $[15] = t0;
81
+ $[16] = t1;
82
+ $[17] = t2;
83
+ $[18] = t3;
84
+ $[19] = t4;
85
+ $[20] = t5;
86
+ $[21] = t6;
87
+ $[22] = t8;
88
+ } else t8 = $[22];
89
+ return t8;
90
+ }
91
+ const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart } from \"@stealthscale/component-charts\";\n\nimport { INCOME, LINES, named } from \"./visitors.ts\";\n\nexport function Income(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n\n return (\n <SankeyChart\n caption={t(\"income.caption\")}\n flows={INCOME}\n inflowLabel={t(\"in\")}\n label={t(\"income.label\")}\n nodes={named(LINES, (key) => t(`names.${key}`))}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"income.value\")}\n valueOptions={{\n currency: \"EUR\",\n maximumFractionDigits: 1,\n notation: \"compact\",\n style: \"currency\",\n }}\n />\n );\n}\n";
92
+ //#endregion
93
+ //#region src/sankey-chart/examples/leak.example.tsx
94
+ var leak_example_exports = /* @__PURE__ */ __exportAll({
95
+ Leak: () => Leak,
96
+ source: () => source$5
97
+ });
98
+ function Leak() {
99
+ const $ = c(24);
100
+ const { t } = useWords("sankey-chart");
101
+ let nodes;
102
+ let t0;
103
+ if ($[0] !== t) {
104
+ nodes = named(QUEUE, (key) => t(`names.${key}`));
105
+ t0 = flowBalance(nodes, LEAKY).find(_temp$1);
106
+ $[0] = t;
107
+ $[1] = nodes;
108
+ $[2] = t0;
109
+ } else {
110
+ nodes = $[1];
111
+ t0 = $[2];
112
+ }
113
+ const leak = t0;
114
+ let t1;
115
+ if ($[3] !== leak || $[4] !== t) {
116
+ t1 = leak && t("leak.caption", {
117
+ lost: leak.inflow - leak.outflow,
118
+ name: t(`names.${leak.key}`)
119
+ });
120
+ $[3] = leak;
121
+ $[4] = t;
122
+ $[5] = t1;
123
+ } else t1 = $[5];
124
+ let t2;
125
+ if ($[6] !== t) {
126
+ t2 = t("in");
127
+ $[6] = t;
128
+ $[7] = t2;
129
+ } else t2 = $[7];
130
+ let t3;
131
+ if ($[8] !== t) {
132
+ t3 = t("leak.label");
133
+ $[8] = t;
134
+ $[9] = t3;
135
+ } else t3 = $[9];
136
+ let t4;
137
+ if ($[10] !== t) {
138
+ t4 = t("out");
139
+ $[10] = t;
140
+ $[11] = t4;
141
+ } else t4 = $[11];
142
+ let t5;
143
+ if ($[12] !== t) {
144
+ t5 = t("share");
145
+ $[12] = t;
146
+ $[13] = t5;
147
+ } else t5 = $[13];
148
+ let t6;
149
+ if ($[14] !== t) {
150
+ t6 = t("leak.value");
151
+ $[14] = t;
152
+ $[15] = t6;
153
+ } else t6 = $[15];
154
+ let t7;
155
+ if ($[16] !== nodes || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
156
+ t7 = /* @__PURE__ */ jsx(SankeyChart, {
157
+ caption: t1,
158
+ flows: LEAKY,
159
+ inflowLabel: t2,
160
+ label: t3,
161
+ nodes,
162
+ outflowLabel: t4,
163
+ shareLabel: t5,
164
+ valueLabel: t6
165
+ });
166
+ $[16] = nodes;
167
+ $[17] = t1;
168
+ $[18] = t2;
169
+ $[19] = t3;
170
+ $[20] = t4;
171
+ $[21] = t5;
172
+ $[22] = t6;
173
+ $[23] = t7;
174
+ } else t7 = $[23];
175
+ return t7;
176
+ }
177
+ function _temp$1(node) {
178
+ return node.outflow > 0 && node.inflow > node.outflow;
179
+ }
180
+ const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart, flowBalance } from \"@stealthscale/component-charts\";\n\nimport { LEAKY, named, QUEUE } from \"./visitors.ts\";\n\nexport function Leak(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n const nodes = named(QUEUE, (key) => t(`names.${key}`));\n const leak = flowBalance(nodes, LEAKY).find(\n (node) => node.outflow > 0 && node.inflow > node.outflow,\n );\n\n return (\n <SankeyChart\n caption={\n leak &&\n t(\"leak.caption\", { lost: leak.inflow - leak.outflow, name: t(`names.${leak.key}`) })\n }\n flows={LEAKY}\n inflowLabel={t(\"in\")}\n label={t(\"leak.label\")}\n nodes={nodes}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"leak.value\")}\n />\n );\n}\n";
181
+ //#endregion
182
+ //#region src/sankey-chart/examples/loop.example.tsx
183
+ var loop_example_exports = /* @__PURE__ */ __exportAll({
184
+ Loop: () => Loop,
185
+ source: () => source$4
186
+ });
187
+ function Loop() {
188
+ const $ = c(24);
189
+ const { t } = useWords("sankey-chart");
190
+ let T0;
191
+ let t0;
192
+ if ($[0] !== t) {
193
+ const cycles = sankeyCycles(LOOPED);
194
+ T0 = SankeyChart;
195
+ t0 = t("loop.caption", {
196
+ count: cycles.length,
197
+ names: cycles.map((flow) => t("loop.flow", {
198
+ from: t(`names.${flow.from}`),
199
+ to: t(`names.${flow.to}`)
200
+ })).join(", ")
201
+ });
202
+ $[0] = t;
203
+ $[1] = T0;
204
+ $[2] = t0;
205
+ } else {
206
+ T0 = $[1];
207
+ t0 = $[2];
208
+ }
209
+ let t1;
210
+ if ($[3] !== t) {
211
+ t1 = t("in");
212
+ $[3] = t;
213
+ $[4] = t1;
214
+ } else t1 = $[4];
215
+ let t2;
216
+ if ($[5] !== t) {
217
+ t2 = t("loop.label");
218
+ $[5] = t;
219
+ $[6] = t2;
220
+ } else t2 = $[6];
221
+ let t3;
222
+ if ($[7] !== t) {
223
+ t3 = named(CHECKOUT, (key) => t(`names.${key}`));
224
+ $[7] = t;
225
+ $[8] = t3;
226
+ } else t3 = $[8];
227
+ let t4;
228
+ if ($[9] !== t) {
229
+ t4 = t("out");
230
+ $[9] = t;
231
+ $[10] = t4;
232
+ } else t4 = $[10];
233
+ let t5;
234
+ if ($[11] !== t) {
235
+ t5 = t("share");
236
+ $[11] = t;
237
+ $[12] = t5;
238
+ } else t5 = $[12];
239
+ let t6;
240
+ if ($[13] !== t) {
241
+ t6 = t("loop.value");
242
+ $[13] = t;
243
+ $[14] = t6;
244
+ } else t6 = $[14];
245
+ let t7;
246
+ if ($[15] !== T0 || $[16] !== t0 || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
247
+ t7 = /* @__PURE__ */ jsx(T0, {
248
+ caption: t0,
249
+ flows: LOOPED,
250
+ inflowLabel: t1,
251
+ label: t2,
252
+ nodes: t3,
253
+ outflowLabel: t4,
254
+ shareLabel: t5,
255
+ valueLabel: t6
256
+ });
257
+ $[15] = T0;
258
+ $[16] = t0;
259
+ $[17] = t1;
260
+ $[18] = t2;
261
+ $[19] = t3;
262
+ $[20] = t4;
263
+ $[21] = t5;
264
+ $[22] = t6;
265
+ $[23] = t7;
266
+ } else t7 = $[23];
267
+ return t7;
268
+ }
269
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart, sankeyCycles } from \"@stealthscale/component-charts\";\n\nimport { CHECKOUT, LOOPED, named } from \"./visitors.ts\";\n\nexport function Loop(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n const cycles = sankeyCycles(LOOPED);\n\n return (\n <SankeyChart\n caption={t(\"loop.caption\", {\n count: cycles.length,\n names: cycles\n .map((flow) =>\n t(\"loop.flow\", { from: t(`names.${flow.from}`), to: t(`names.${flow.to}`) }),\n )\n .join(\", \"),\n })}\n flows={LOOPED}\n inflowLabel={t(\"in\")}\n label={t(\"loop.label\")}\n nodes={named(CHECKOUT, (key) => t(`names.${key}`))}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"loop.value\")}\n />\n );\n}\n";
270
+ //#endregion
271
+ //#region src/sankey-chart/examples/palette.example.tsx
272
+ var palette_example_exports = /* @__PURE__ */ __exportAll({
273
+ Palette: () => Palette,
274
+ source: () => source$3
275
+ });
276
+ function Palette() {
277
+ const $ = c(22);
278
+ const { t } = useWords("sankey-chart");
279
+ let t0;
280
+ if ($[0] !== t) {
281
+ t0 = t("palette.caption");
282
+ $[0] = t;
283
+ $[1] = t0;
284
+ } else t0 = $[1];
285
+ let t1;
286
+ if ($[2] !== t) {
287
+ t1 = t("in");
288
+ $[2] = t;
289
+ $[3] = t1;
290
+ } else t1 = $[3];
291
+ let t2;
292
+ if ($[4] !== t) {
293
+ t2 = t("visitors.label");
294
+ $[4] = t;
295
+ $[5] = t2;
296
+ } else t2 = $[5];
297
+ let t3;
298
+ if ($[6] !== t) {
299
+ t3 = named(STEPS, (key) => t(`names.${key}`), {
300
+ email: "pink",
301
+ organic: "teal",
302
+ paid: "purple",
303
+ social: "orange"
304
+ });
305
+ $[6] = t;
306
+ $[7] = t3;
307
+ } else t3 = $[7];
308
+ let t4;
309
+ if ($[8] !== t) {
310
+ t4 = t("out");
311
+ $[8] = t;
312
+ $[9] = t4;
313
+ } else t4 = $[9];
314
+ let t5;
315
+ if ($[10] !== t) {
316
+ t5 = t("share");
317
+ $[10] = t;
318
+ $[11] = t5;
319
+ } else t5 = $[11];
320
+ let t6;
321
+ if ($[12] !== t) {
322
+ t6 = t("visitors.value");
323
+ $[12] = t;
324
+ $[13] = t6;
325
+ } else t6 = $[13];
326
+ let t7;
327
+ if ($[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
328
+ t7 = /* @__PURE__ */ jsx(SankeyChart, {
329
+ caption: t0,
330
+ flows: VISITORS,
331
+ inflowLabel: t1,
332
+ label: t2,
333
+ nodes: t3,
334
+ outflowLabel: t4,
335
+ shareLabel: t5,
336
+ valueLabel: t6,
337
+ values: false
338
+ });
339
+ $[14] = t0;
340
+ $[15] = t1;
341
+ $[16] = t2;
342
+ $[17] = t3;
343
+ $[18] = t4;
344
+ $[19] = t5;
345
+ $[20] = t6;
346
+ $[21] = t7;
347
+ } else t7 = $[21];
348
+ return t7;
349
+ }
350
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart } from \"@stealthscale/component-charts\";\n\nimport { named, STEPS, VISITORS } from \"./visitors.ts\";\n\nexport function Palette(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n\n return (\n <SankeyChart\n caption={t(\"palette.caption\")}\n flows={VISITORS}\n inflowLabel={t(\"in\")}\n label={t(\"visitors.label\")}\n nodes={named(STEPS, (key) => t(`names.${key}`), {\n email: \"pink\",\n organic: \"teal\",\n paid: \"purple\",\n social: \"orange\",\n })}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"visitors.value\")}\n values={false}\n />\n );\n}\n";
351
+ //#endregion
352
+ //#region src/sankey-chart/examples/quiet.example.tsx
353
+ var quiet_example_exports = /* @__PURE__ */ __exportAll({
354
+ Quiet: () => Quiet,
355
+ source: () => source$2
356
+ });
357
+ function Quiet() {
358
+ const $ = c(12);
359
+ const { t } = useWords("sankey-chart");
360
+ let t0;
361
+ if ($[0] !== t) {
362
+ t0 = t("quiet.caption");
363
+ $[0] = t;
364
+ $[1] = t0;
365
+ } else t0 = $[1];
366
+ let t1;
367
+ if ($[2] !== t) {
368
+ t1 = t("quiet.empty");
369
+ $[2] = t;
370
+ $[3] = t1;
371
+ } else t1 = $[3];
372
+ let t2;
373
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
374
+ t2 = [];
375
+ $[4] = t2;
376
+ } else t2 = $[4];
377
+ let t3;
378
+ if ($[5] !== t) {
379
+ t3 = t("visitors.label");
380
+ $[5] = t;
381
+ $[6] = t3;
382
+ } else t3 = $[6];
383
+ let t4;
384
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
385
+ t4 = [];
386
+ $[7] = t4;
387
+ } else t4 = $[7];
388
+ let t5;
389
+ if ($[8] !== t0 || $[9] !== t1 || $[10] !== t3) {
390
+ t5 = /* @__PURE__ */ jsx(SankeyChart, {
391
+ caption: t0,
392
+ empty: t1,
393
+ flows: t2,
394
+ label: t3,
395
+ nodes: t4
396
+ });
397
+ $[8] = t0;
398
+ $[9] = t1;
399
+ $[10] = t3;
400
+ $[11] = t5;
401
+ } else t5 = $[11];
402
+ return t5;
403
+ }
404
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart } from \"@stealthscale/component-charts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n\n return (\n <SankeyChart\n caption={t(\"quiet.caption\")}\n empty={t(\"quiet.empty\")}\n flows={[]}\n label={t(\"visitors.label\")}\n nodes={[]}\n />\n );\n}\n";
405
+ //#endregion
406
+ //#region src/sankey-chart/examples/signups.example.tsx
407
+ var signups_example_exports = /* @__PURE__ */ __exportAll({
408
+ Signups: () => Signups,
409
+ source: () => source$1
410
+ });
411
+ function Signups() {
412
+ const $ = c(22);
413
+ const { t } = useWords("sankey-chart");
414
+ let t0;
415
+ if ($[0] !== t) {
416
+ t0 = t("signups.caption");
417
+ $[0] = t;
418
+ $[1] = t0;
419
+ } else t0 = $[1];
420
+ let t1;
421
+ if ($[2] !== t) {
422
+ t1 = t("in");
423
+ $[2] = t;
424
+ $[3] = t1;
425
+ } else t1 = $[3];
426
+ let t2;
427
+ if ($[4] !== t) {
428
+ t2 = t("visitors.label");
429
+ $[4] = t;
430
+ $[5] = t2;
431
+ } else t2 = $[5];
432
+ let t3;
433
+ if ($[6] !== t) {
434
+ t3 = named(STEPS, (key) => t(`names.${key}`));
435
+ $[6] = t;
436
+ $[7] = t3;
437
+ } else t3 = $[7];
438
+ let t4;
439
+ if ($[8] !== t) {
440
+ t4 = t("out");
441
+ $[8] = t;
442
+ $[9] = t4;
443
+ } else t4 = $[9];
444
+ let t5;
445
+ if ($[10] !== t) {
446
+ t5 = t("share");
447
+ $[10] = t;
448
+ $[11] = t5;
449
+ } else t5 = $[11];
450
+ let t6;
451
+ if ($[12] !== t) {
452
+ t6 = t("visitors.value");
453
+ $[12] = t;
454
+ $[13] = t6;
455
+ } else t6 = $[13];
456
+ let t7;
457
+ if ($[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
458
+ t7 = /* @__PURE__ */ jsx(SankeyChart, {
459
+ caption: t0,
460
+ defaultIndex: 1,
461
+ flows: VISITORS,
462
+ inflowLabel: t1,
463
+ label: t2,
464
+ nodes: t3,
465
+ outflowLabel: t4,
466
+ shareLabel: t5,
467
+ valueLabel: t6
468
+ });
469
+ $[14] = t0;
470
+ $[15] = t1;
471
+ $[16] = t2;
472
+ $[17] = t3;
473
+ $[18] = t4;
474
+ $[19] = t5;
475
+ $[20] = t6;
476
+ $[21] = t7;
477
+ } else t7 = $[21];
478
+ return t7;
479
+ }
480
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart } from \"@stealthscale/component-charts\";\n\nimport { named, STEPS, VISITORS } from \"./visitors.ts\";\n\nexport function Signups(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n\n return (\n <SankeyChart\n caption={t(\"signups.caption\")}\n defaultIndex={1}\n flows={VISITORS}\n inflowLabel={t(\"in\")}\n label={t(\"visitors.label\")}\n nodes={named(STEPS, (key) => t(`names.${key}`))}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"visitors.value\")}\n />\n );\n}\n";
481
+ //#endregion
482
+ //#region src/sankey-chart/examples/visitors.example.tsx
483
+ var visitors_example_exports = /* @__PURE__ */ __exportAll({
484
+ Visitors: () => Visitors,
485
+ source: () => source
486
+ });
487
+ function Visitors() {
488
+ const $ = c(23);
489
+ const { t } = useWords("sankey-chart");
490
+ let T0;
491
+ let nodes;
492
+ let t0;
493
+ if ($[0] !== t) {
494
+ nodes = named(STEPS, (key) => t(`names.${key}`));
495
+ const balance = flowBalance(nodes, VISITORS);
496
+ const into = (key_0) => balance.find((node) => node.key === key_0)?.inflow ?? 0;
497
+ const visitors = balance.filter(_temp).reduce(_temp2, 0);
498
+ T0 = SankeyChart;
499
+ t0 = t("visitors.caption", {
500
+ signedUp: Math.round(into("signup") / visitors * 100),
501
+ subscribed: Math.round(into("subscribed") / into("signup") * 100)
502
+ });
503
+ $[0] = t;
504
+ $[1] = T0;
505
+ $[2] = nodes;
506
+ $[3] = t0;
507
+ } else {
508
+ T0 = $[1];
509
+ nodes = $[2];
510
+ t0 = $[3];
511
+ }
512
+ let t1;
513
+ if ($[4] !== t) {
514
+ t1 = t("in");
515
+ $[4] = t;
516
+ $[5] = t1;
517
+ } else t1 = $[5];
518
+ let t2;
519
+ if ($[6] !== t) {
520
+ t2 = t("visitors.label");
521
+ $[6] = t;
522
+ $[7] = t2;
523
+ } else t2 = $[7];
524
+ let t3;
525
+ if ($[8] !== t) {
526
+ t3 = t("out");
527
+ $[8] = t;
528
+ $[9] = t3;
529
+ } else t3 = $[9];
530
+ let t4;
531
+ if ($[10] !== t) {
532
+ t4 = t("share");
533
+ $[10] = t;
534
+ $[11] = t4;
535
+ } else t4 = $[11];
536
+ let t5;
537
+ if ($[12] !== t) {
538
+ t5 = t("visitors.value");
539
+ $[12] = t;
540
+ $[13] = t5;
541
+ } else t5 = $[13];
542
+ let t6;
543
+ if ($[14] !== T0 || $[15] !== nodes || $[16] !== t0 || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5) {
544
+ t6 = /* @__PURE__ */ jsx(T0, {
545
+ caption: t0,
546
+ flows: VISITORS,
547
+ inflowLabel: t1,
548
+ label: t2,
549
+ nodes,
550
+ outflowLabel: t3,
551
+ shareLabel: t4,
552
+ valueLabel: t5
553
+ });
554
+ $[14] = T0;
555
+ $[15] = nodes;
556
+ $[16] = t0;
557
+ $[17] = t1;
558
+ $[18] = t2;
559
+ $[19] = t3;
560
+ $[20] = t4;
561
+ $[21] = t5;
562
+ $[22] = t6;
563
+ } else t6 = $[22];
564
+ return t6;
565
+ }
566
+ function _temp2(sum, node_1) {
567
+ return sum + node_1.outflow;
568
+ }
569
+ function _temp(node_0) {
570
+ return node_0.inflow === 0;
571
+ }
572
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SankeyChart, flowBalance } from \"@stealthscale/component-charts\";\n\nimport { named, STEPS, VISITORS } from \"./visitors.ts\";\n\nexport function Visitors(): ReactElement {\n const { t } = useWords(\"sankey-chart\");\n const nodes = named(STEPS, (key) => t(`names.${key}`));\n const balance = flowBalance(nodes, VISITORS);\n const into = (key: string): number => balance.find((node) => node.key === key)?.inflow ?? 0;\n const visitors = balance\n .filter((node) => node.inflow === 0)\n .reduce((sum, node) => sum + node.outflow, 0);\n\n return (\n <SankeyChart\n caption={t(\"visitors.caption\", {\n signedUp: Math.round((into(\"signup\") / visitors) * 100),\n subscribed: Math.round((into(\"subscribed\") / into(\"signup\")) * 100),\n })}\n flows={VISITORS}\n inflowLabel={t(\"in\")}\n label={t(\"visitors.label\")}\n nodes={nodes}\n outflowLabel={t(\"out\")}\n shareLabel={t(\"share\")}\n valueLabel={t(\"visitors.value\")}\n />\n );\n}\n";
573
+ //#endregion
574
+ //#region src/sankey-chart/sankey-chart.specimen.tsx
575
+ /**
576
+ * Catalogue page for the sankey chart.
577
+ *
578
+ * @remarks
579
+ * The sankey chart has no recipe of its own: the chart's recipe styles its figure, so every scene
580
+ * is hand-written. The scenes render a month's visitors by channel and outcome with two rates in
581
+ * the caption, the tooltip at a flow, a year's income statement in compact euros, a checkout
582
+ * whose refunds close a loop, a support queue that loses tickets, the channels in stated palettes
583
+ * without values, the visitors at a phone's width, and a sankey without flows. Every scene
584
+ * renders a component from `examples/` and shows that file as its source. The words are keys
585
+ * under `sankey-chart` in `locales/en/specimen/sankey-chart.json`.
586
+ */
587
+ /**
588
+ * Hand-written scene for a month's visitors, two rates in the caption.
589
+ */
590
+ const visited = {
591
+ about: "sankey-chart.visitors.about",
592
+ draw: () => /* @__PURE__ */ jsx(Room, {
593
+ size: "lg",
594
+ children: /* @__PURE__ */ jsx(Visitors, {})
595
+ }),
596
+ example: visitors_example_exports,
597
+ title: "sankey-chart.visitors.title"
598
+ };
599
+ /**
600
+ * Hand-written scene for the tooltip at a flow.
601
+ */
602
+ const pointed = {
603
+ about: "sankey-chart.signups.about",
604
+ draw: () => /* @__PURE__ */ jsx(Room, {
605
+ size: "lg",
606
+ children: /* @__PURE__ */ jsx(Signups, {})
607
+ }),
608
+ example: signups_example_exports,
609
+ title: "sankey-chart.signups.title"
610
+ };
611
+ /**
612
+ * Hand-written scene for a year's income statement in compact euros.
613
+ */
614
+ const stated = {
615
+ about: "sankey-chart.income.about",
616
+ draw: () => /* @__PURE__ */ jsx(Room, {
617
+ size: "lg",
618
+ children: /* @__PURE__ */ jsx(Income, {})
619
+ }),
620
+ example: income_example_exports,
621
+ title: "sankey-chart.income.title"
622
+ };
623
+ /**
624
+ * Hand-written scene for a checkout whose refunds close a loop, named in the caption.
625
+ */
626
+ const looped = {
627
+ about: "sankey-chart.loop.about",
628
+ draw: () => /* @__PURE__ */ jsx(Room, {
629
+ size: "lg",
630
+ children: /* @__PURE__ */ jsx(Loop, {})
631
+ }),
632
+ example: loop_example_exports,
633
+ title: "sankey-chart.loop.title"
634
+ };
635
+ /**
636
+ * Hand-written scene for a support queue that loses tickets, named in the caption.
637
+ */
638
+ const leaking = {
639
+ about: "sankey-chart.leak.about",
640
+ draw: () => /* @__PURE__ */ jsx(Room, {
641
+ size: "lg",
642
+ children: /* @__PURE__ */ jsx(Leak, {})
643
+ }),
644
+ example: leak_example_exports,
645
+ title: "sankey-chart.leak.title"
646
+ };
647
+ /**
648
+ * Hand-written scene for the channels in stated palettes, without values.
649
+ */
650
+ const tinted = {
651
+ about: "sankey-chart.palette.about",
652
+ draw: () => /* @__PURE__ */ jsx(Room, {
653
+ size: "lg",
654
+ children: /* @__PURE__ */ jsx(Palette, {})
655
+ }),
656
+ example: palette_example_exports,
657
+ title: "sankey-chart.palette.title"
658
+ };
659
+ /**
660
+ * Hand-written scene for the visitors at a phone's width.
661
+ */
662
+ const narrow = {
663
+ about: "sankey-chart.narrow.about",
664
+ draw: () => /* @__PURE__ */ jsx(Room, {
665
+ size: "xs",
666
+ children: /* @__PURE__ */ jsx(Visitors, {})
667
+ }),
668
+ example: visitors_example_exports,
669
+ title: "sankey-chart.narrow.title"
670
+ };
671
+ /**
672
+ * Hand-written scene for a sankey without flows.
673
+ */
674
+ const empty = {
675
+ about: "sankey-chart.quiet.about",
676
+ draw: () => /* @__PURE__ */ jsx(Room, {
677
+ size: "lg",
678
+ children: /* @__PURE__ */ jsx(Quiet, {})
679
+ }),
680
+ example: quiet_example_exports,
681
+ title: "sankey-chart.quiet.title"
682
+ };
683
+ var sankey_chart_specimen_default = specimen({
684
+ about: "sankey-chart.about",
685
+ id: "components/charts/sankey-chart",
686
+ imports: "import { SankeyChart } from \"@stealthscale/component-charts\";",
687
+ scenes: [
688
+ visited,
689
+ pointed,
690
+ stated,
691
+ looped,
692
+ leaking,
693
+ tinted,
694
+ narrow,
695
+ empty
696
+ ],
697
+ title: "sankey-chart.title"
698
+ });
699
+ //#endregion
700
+ export { sankey_chart_specimen_default as default, empty, leaking, looped, narrow, pointed, stated, tinted, visited };