@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.
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -14710
- package/dist/pages/area-chart/area-chart.js +1151 -0
- package/dist/pages/area-chart/area-chart.props.js +3 -0
- package/dist/pages/bar-chart/bar-chart.js +990 -0
- package/dist/pages/bar-chart/bar-chart.props.js +3 -0
- package/dist/pages/box-plot/box-plot.js +1585 -0
- package/dist/pages/box-plot/box-plot.props.js +3 -0
- package/dist/pages/bubble-chart/bubble-chart.js +938 -0
- package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
- package/dist/pages/burndown-chart/burndown-chart.js +805 -0
- package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
- package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
- package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
- package/dist/pages/chart/chart.js +1190 -0
- package/dist/pages/chart/chart.props.js +3 -0
- package/dist/pages/chord-diagram/chord-diagram.js +891 -0
- package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
- package/dist/pages/combo-chart/combo-chart.js +873 -0
- package/dist/pages/combo-chart/combo-chart.props.js +3 -0
- package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
- package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
- package/dist/pages/donut-chart/donut-chart.js +726 -0
- package/dist/pages/donut-chart/donut-chart.props.js +3 -0
- package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
- package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
- package/dist/pages/gauge-chart/gauge-chart.js +767 -0
- package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
- package/dist/pages/heatmap/heatmap.js +1967 -0
- package/dist/pages/heatmap/heatmap.props.js +3 -0
- package/dist/pages/histogram-chart/histogram-chart.js +768 -0
- package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
- package/dist/pages/line-chart/line-chart.js +1882 -0
- package/dist/pages/line-chart/line-chart.props.js +3 -0
- package/dist/pages/pages.json +393 -0
- package/dist/pages/pareto-chart/pareto-chart.js +669 -0
- package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
- package/dist/pages/pie-chart/pie-chart.js +1007 -0
- package/dist/pages/pie-chart/pie-chart.props.js +3 -0
- package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
- package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
- package/dist/pages/radar-chart/radar-chart.js +1101 -0
- package/dist/pages/radar-chart/radar-chart.props.js +3 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
- package/dist/pages/range-chart/range-chart.js +914 -0
- package/dist/pages/range-chart/range-chart.props.js +3 -0
- package/dist/pages/regression-overlay/regression-overlay.js +494 -0
- package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
- package/dist/pages/sankey-chart/sankey-chart.js +700 -0
- package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
- package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
- package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
- package/dist/pages/sparkbar/sparkbar.js +629 -0
- package/dist/pages/sparkbar/sparkbar.props.js +3 -0
- package/dist/pages/sparkline/sparkline.js +960 -0
- package/dist/pages/sparkline/sparkline.props.js +3 -0
- package/dist/pages/spend-5xQ76WSj.js +185 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
- package/dist/pages/step-line-chart/step-line-chart.js +573 -0
- package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
- package/dist/pages/stream-graph/stream-graph.js +1662 -0
- package/dist/pages/stream-graph/stream-graph.props.js +3 -0
- package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
- package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
- package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
- package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
- package/dist/pages/treemap-chart/treemap-chart.js +904 -0
- package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
- package/dist/pages/violin-plot/violin-plot.js +1303 -0
- package/dist/pages/violin-plot/violin-plot.props.js +3 -0
- package/dist/pages/visitors-oFFVcbIZ.js +248 -0
- package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
- package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
- package/dist/shared-DVZJ2nST.js +14711 -0
- package/dist/theme.js +29 -13
- package/locales/en/specimen/area-chart.json +56 -0
- package/locales/en/specimen/bar-chart.json +56 -0
- package/locales/en/specimen/box-plot.json +65 -0
- package/locales/en/specimen/bubble-chart.json +47 -0
- package/locales/en/specimen/burndown-chart.json +46 -0
- package/locales/en/specimen/candlestick-chart.json +42 -0
- package/locales/en/specimen/chart.json +53 -0
- package/locales/en/specimen/chord-diagram.json +69 -0
- package/locales/en/specimen/combo-chart.json +41 -0
- package/locales/en/specimen/distribution-chart.json +47 -0
- package/locales/en/specimen/donut-chart.json +63 -0
- package/locales/en/specimen/funnel-chart.json +84 -0
- package/locales/en/specimen/gauge-chart.json +68 -0
- package/locales/en/specimen/heatmap.json +187 -0
- package/locales/en/specimen/histogram-chart.json +48 -0
- package/locales/en/specimen/horizontal-bar-chart.json +54 -0
- package/locales/en/specimen/line-chart.json +106 -0
- package/locales/en/specimen/pareto-chart.json +43 -0
- package/locales/en/specimen/percent-stacked-bar.json +37 -0
- package/locales/en/specimen/pie-chart.json +80 -0
- package/locales/en/specimen/polar-area-chart.json +90 -0
- package/locales/en/specimen/radar-chart.json +82 -0
- package/locales/en/specimen/radial-bar-chart.json +62 -0
- package/locales/en/specimen/range-chart.json +42 -0
- package/locales/en/specimen/regression-overlay.json +36 -0
- package/locales/en/specimen/sankey-chart.json +89 -0
- package/locales/en/specimen/scatter-plot.json +88 -0
- package/locales/en/specimen/sparkbar.json +51 -0
- package/locales/en/specimen/sparkline.json +70 -0
- package/locales/en/specimen/stacked-area-chart.json +44 -0
- package/locales/en/specimen/stacked-bar-chart.json +34 -0
- package/locales/en/specimen/step-line-chart.json +33 -0
- package/locales/en/specimen/stream-graph.json +54 -0
- package/locales/en/specimen/sunburst-chart.json +110 -0
- package/locales/en/specimen/timeline-chart.json +77 -0
- package/locales/en/specimen/treemap-chart.json +107 -0
- package/locales/en/specimen/violin-plot.json +54 -0
- package/locales/en/specimen/waterfall-chart.json +71 -0
- package/package.json +9 -8
- /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
|
@@ -0,0 +1,1662 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { l as StreamGraph } 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 { Stack } from "@stealthscale/component-layout";
|
|
10
|
+
//#region src/stream-graph/examples/campaign.example.tsx
|
|
11
|
+
var campaign_example_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
Campaign: () => Campaign,
|
|
13
|
+
source: () => source$5
|
|
14
|
+
});
|
|
15
|
+
const WEEKS$3 = [
|
|
16
|
+
[
|
|
17
|
+
42,
|
|
18
|
+
18,
|
|
19
|
+
4,
|
|
20
|
+
0,
|
|
21
|
+
6
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
43,
|
|
25
|
+
18,
|
|
26
|
+
5,
|
|
27
|
+
0,
|
|
28
|
+
7
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
45,
|
|
32
|
+
19,
|
|
33
|
+
5,
|
|
34
|
+
0,
|
|
35
|
+
6
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
44,
|
|
39
|
+
19,
|
|
40
|
+
6,
|
|
41
|
+
1,
|
|
42
|
+
7
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
46,
|
|
46
|
+
20,
|
|
47
|
+
12,
|
|
48
|
+
1,
|
|
49
|
+
7
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
47,
|
|
53
|
+
19,
|
|
54
|
+
26,
|
|
55
|
+
2,
|
|
56
|
+
8
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
48,
|
|
60
|
+
20,
|
|
61
|
+
38,
|
|
62
|
+
3,
|
|
63
|
+
7
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
47,
|
|
67
|
+
21,
|
|
68
|
+
31,
|
|
69
|
+
5,
|
|
70
|
+
8
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
49,
|
|
74
|
+
21,
|
|
75
|
+
19,
|
|
76
|
+
8,
|
|
77
|
+
8
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
50,
|
|
81
|
+
20,
|
|
82
|
+
11,
|
|
83
|
+
11,
|
|
84
|
+
9
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
51,
|
|
88
|
+
21,
|
|
89
|
+
8,
|
|
90
|
+
14,
|
|
91
|
+
8
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
52,
|
|
95
|
+
22,
|
|
96
|
+
7,
|
|
97
|
+
16,
|
|
98
|
+
9
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
51,
|
|
102
|
+
22,
|
|
103
|
+
6,
|
|
104
|
+
18,
|
|
105
|
+
9
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
53,
|
|
109
|
+
23,
|
|
110
|
+
6,
|
|
111
|
+
19,
|
|
112
|
+
10
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
54,
|
|
116
|
+
22,
|
|
117
|
+
5,
|
|
118
|
+
21,
|
|
119
|
+
9
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
55,
|
|
123
|
+
23,
|
|
124
|
+
5,
|
|
125
|
+
22,
|
|
126
|
+
10
|
|
127
|
+
]
|
|
128
|
+
].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({
|
|
129
|
+
direct: direct * 1e3,
|
|
130
|
+
email: email * 1e3,
|
|
131
|
+
organic: organic * 1e3,
|
|
132
|
+
referral: referral * 1e3,
|
|
133
|
+
social: social * 1e3,
|
|
134
|
+
week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10)
|
|
135
|
+
}));
|
|
136
|
+
function Campaign() {
|
|
137
|
+
const $ = c(39);
|
|
138
|
+
const { t } = useWords("stream-graph");
|
|
139
|
+
let t0;
|
|
140
|
+
if ($[0] !== t) {
|
|
141
|
+
t0 = t("campaign.caption");
|
|
142
|
+
$[0] = t;
|
|
143
|
+
$[1] = t0;
|
|
144
|
+
} else t0 = $[1];
|
|
145
|
+
let t1;
|
|
146
|
+
if ($[2] !== t) {
|
|
147
|
+
t1 = t("traffic.label");
|
|
148
|
+
$[2] = t;
|
|
149
|
+
$[3] = t1;
|
|
150
|
+
} else t1 = $[3];
|
|
151
|
+
let t2;
|
|
152
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
153
|
+
t2 = {
|
|
154
|
+
day: "numeric",
|
|
155
|
+
month: "short",
|
|
156
|
+
timeZone: "UTC"
|
|
157
|
+
};
|
|
158
|
+
$[4] = t2;
|
|
159
|
+
} else t2 = $[4];
|
|
160
|
+
let t3;
|
|
161
|
+
if ($[5] !== t) {
|
|
162
|
+
t3 = t("traffic.sources");
|
|
163
|
+
$[5] = t;
|
|
164
|
+
$[6] = t3;
|
|
165
|
+
} else t3 = $[6];
|
|
166
|
+
let t4;
|
|
167
|
+
if ($[7] !== t) {
|
|
168
|
+
t4 = t("traffic.organic");
|
|
169
|
+
$[7] = t;
|
|
170
|
+
$[8] = t4;
|
|
171
|
+
} else t4 = $[8];
|
|
172
|
+
let t5;
|
|
173
|
+
if ($[9] !== t4) {
|
|
174
|
+
t5 = {
|
|
175
|
+
key: "organic",
|
|
176
|
+
label: t4
|
|
177
|
+
};
|
|
178
|
+
$[9] = t4;
|
|
179
|
+
$[10] = t5;
|
|
180
|
+
} else t5 = $[10];
|
|
181
|
+
let t6;
|
|
182
|
+
if ($[11] !== t) {
|
|
183
|
+
t6 = t("traffic.direct");
|
|
184
|
+
$[11] = t;
|
|
185
|
+
$[12] = t6;
|
|
186
|
+
} else t6 = $[12];
|
|
187
|
+
let t7;
|
|
188
|
+
if ($[13] !== t6) {
|
|
189
|
+
t7 = {
|
|
190
|
+
key: "direct",
|
|
191
|
+
label: t6
|
|
192
|
+
};
|
|
193
|
+
$[13] = t6;
|
|
194
|
+
$[14] = t7;
|
|
195
|
+
} else t7 = $[14];
|
|
196
|
+
let t8;
|
|
197
|
+
if ($[15] !== t) {
|
|
198
|
+
t8 = t("traffic.social");
|
|
199
|
+
$[15] = t;
|
|
200
|
+
$[16] = t8;
|
|
201
|
+
} else t8 = $[16];
|
|
202
|
+
let t9;
|
|
203
|
+
if ($[17] !== t8) {
|
|
204
|
+
t9 = {
|
|
205
|
+
key: "social",
|
|
206
|
+
label: t8
|
|
207
|
+
};
|
|
208
|
+
$[17] = t8;
|
|
209
|
+
$[18] = t9;
|
|
210
|
+
} else t9 = $[18];
|
|
211
|
+
let t10;
|
|
212
|
+
if ($[19] !== t) {
|
|
213
|
+
t10 = t("traffic.email");
|
|
214
|
+
$[19] = t;
|
|
215
|
+
$[20] = t10;
|
|
216
|
+
} else t10 = $[20];
|
|
217
|
+
let t11;
|
|
218
|
+
if ($[21] !== t10) {
|
|
219
|
+
t11 = {
|
|
220
|
+
key: "email",
|
|
221
|
+
label: t10
|
|
222
|
+
};
|
|
223
|
+
$[21] = t10;
|
|
224
|
+
$[22] = t11;
|
|
225
|
+
} else t11 = $[22];
|
|
226
|
+
let t12;
|
|
227
|
+
if ($[23] !== t) {
|
|
228
|
+
t12 = t("traffic.referral");
|
|
229
|
+
$[23] = t;
|
|
230
|
+
$[24] = t12;
|
|
231
|
+
} else t12 = $[24];
|
|
232
|
+
let t13;
|
|
233
|
+
if ($[25] !== t12) {
|
|
234
|
+
t13 = {
|
|
235
|
+
key: "referral",
|
|
236
|
+
label: t12
|
|
237
|
+
};
|
|
238
|
+
$[25] = t12;
|
|
239
|
+
$[26] = t13;
|
|
240
|
+
} else t13 = $[26];
|
|
241
|
+
let t14;
|
|
242
|
+
if ($[27] !== t11 || $[28] !== t13 || $[29] !== t5 || $[30] !== t7 || $[31] !== t9) {
|
|
243
|
+
t14 = [
|
|
244
|
+
t5,
|
|
245
|
+
t7,
|
|
246
|
+
t9,
|
|
247
|
+
t11,
|
|
248
|
+
t13
|
|
249
|
+
];
|
|
250
|
+
$[27] = t11;
|
|
251
|
+
$[28] = t13;
|
|
252
|
+
$[29] = t5;
|
|
253
|
+
$[30] = t7;
|
|
254
|
+
$[31] = t9;
|
|
255
|
+
$[32] = t14;
|
|
256
|
+
} else t14 = $[32];
|
|
257
|
+
let t15;
|
|
258
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
259
|
+
t15 = { notation: "compact" };
|
|
260
|
+
$[33] = t15;
|
|
261
|
+
} else t15 = $[33];
|
|
262
|
+
let t16;
|
|
263
|
+
if ($[34] !== t0 || $[35] !== t1 || $[36] !== t14 || $[37] !== t3) {
|
|
264
|
+
t16 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
265
|
+
caption: t0,
|
|
266
|
+
categoryKey: "week",
|
|
267
|
+
data: WEEKS$3,
|
|
268
|
+
defaultIndex: 6,
|
|
269
|
+
label: t1,
|
|
270
|
+
labelOptions: t2,
|
|
271
|
+
legendLabel: t3,
|
|
272
|
+
series: t14,
|
|
273
|
+
valueOptions: t15
|
|
274
|
+
});
|
|
275
|
+
$[34] = t0;
|
|
276
|
+
$[35] = t1;
|
|
277
|
+
$[36] = t14;
|
|
278
|
+
$[37] = t3;
|
|
279
|
+
$[38] = t16;
|
|
280
|
+
} else t16 = $[38];
|
|
281
|
+
return t16;
|
|
282
|
+
}
|
|
283
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst WEEKS = [\n [42, 18, 4, 0, 6],\n [43, 18, 5, 0, 7],\n [45, 19, 5, 0, 6],\n [44, 19, 6, 1, 7],\n [46, 20, 12, 1, 7],\n [47, 19, 26, 2, 8],\n [48, 20, 38, 3, 7],\n [47, 21, 31, 5, 8],\n [49, 21, 19, 8, 8],\n [50, 20, 11, 11, 9],\n [51, 21, 8, 14, 8],\n [52, 22, 7, 16, 9],\n [51, 22, 6, 18, 9],\n [53, 23, 6, 19, 10],\n [54, 22, 5, 21, 9],\n [55, 23, 5, 22, 10],\n].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({\n direct: direct * 1000,\n email: email * 1000,\n organic: organic * 1000,\n referral: referral * 1000,\n social: social * 1000,\n week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10),\n}));\n\nexport function Campaign(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n\n return (\n <StreamGraph\n caption={t(\"campaign.caption\")}\n categoryKey=\"week\"\n data={WEEKS}\n defaultIndex={6}\n label={t(\"traffic.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n legendLabel={t(\"traffic.sources\")}\n series={[\n { key: \"organic\", label: t(\"traffic.organic\") },\n { key: \"direct\", label: t(\"traffic.direct\") },\n { key: \"social\", label: t(\"traffic.social\") },\n { key: \"email\", label: t(\"traffic.email\") },\n { key: \"referral\", label: t(\"traffic.referral\") },\n ]}\n valueOptions={{ notation: \"compact\" }}\n />\n );\n}\n";
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/stream-graph/examples/listening.example.tsx
|
|
286
|
+
var listening_example_exports = /* @__PURE__ */ __exportAll({
|
|
287
|
+
Listening: () => Listening,
|
|
288
|
+
source: () => source$4
|
|
289
|
+
});
|
|
290
|
+
const MONTHS$1 = [
|
|
291
|
+
[
|
|
292
|
+
130,
|
|
293
|
+
82,
|
|
294
|
+
60,
|
|
295
|
+
32,
|
|
296
|
+
30,
|
|
297
|
+
50
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
128,
|
|
301
|
+
85,
|
|
302
|
+
62,
|
|
303
|
+
40,
|
|
304
|
+
38,
|
|
305
|
+
45
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
135,
|
|
309
|
+
88,
|
|
310
|
+
64,
|
|
311
|
+
46,
|
|
312
|
+
52,
|
|
313
|
+
42
|
|
314
|
+
],
|
|
315
|
+
[
|
|
316
|
+
120,
|
|
317
|
+
80,
|
|
318
|
+
66,
|
|
319
|
+
30,
|
|
320
|
+
25,
|
|
321
|
+
40
|
|
322
|
+
],
|
|
323
|
+
[
|
|
324
|
+
118,
|
|
325
|
+
82,
|
|
326
|
+
70,
|
|
327
|
+
32,
|
|
328
|
+
24,
|
|
329
|
+
45
|
|
330
|
+
],
|
|
331
|
+
[
|
|
332
|
+
125,
|
|
333
|
+
78,
|
|
334
|
+
74,
|
|
335
|
+
28,
|
|
336
|
+
22,
|
|
337
|
+
52
|
|
338
|
+
],
|
|
339
|
+
[
|
|
340
|
+
130,
|
|
341
|
+
75,
|
|
342
|
+
78,
|
|
343
|
+
25,
|
|
344
|
+
20,
|
|
345
|
+
60
|
|
346
|
+
],
|
|
347
|
+
[
|
|
348
|
+
140,
|
|
349
|
+
72,
|
|
350
|
+
84,
|
|
351
|
+
22,
|
|
352
|
+
18,
|
|
353
|
+
72
|
|
354
|
+
],
|
|
355
|
+
[
|
|
356
|
+
150,
|
|
357
|
+
70,
|
|
358
|
+
88,
|
|
359
|
+
20,
|
|
360
|
+
16,
|
|
361
|
+
85
|
|
362
|
+
],
|
|
363
|
+
[
|
|
364
|
+
160,
|
|
365
|
+
68,
|
|
366
|
+
94,
|
|
367
|
+
18,
|
|
368
|
+
15,
|
|
369
|
+
95
|
|
370
|
+
],
|
|
371
|
+
[
|
|
372
|
+
155,
|
|
373
|
+
70,
|
|
374
|
+
96,
|
|
375
|
+
20,
|
|
376
|
+
16,
|
|
377
|
+
90
|
|
378
|
+
],
|
|
379
|
+
[
|
|
380
|
+
145,
|
|
381
|
+
74,
|
|
382
|
+
92,
|
|
383
|
+
24,
|
|
384
|
+
19,
|
|
385
|
+
75
|
|
386
|
+
]
|
|
387
|
+
].map(([pop = 0, rock = 0, hiphop = 0, jazz = 0, classical = 0, electronic = 0], index) => ({
|
|
388
|
+
classical,
|
|
389
|
+
electronic,
|
|
390
|
+
hiphop,
|
|
391
|
+
jazz,
|
|
392
|
+
month: new Date(Date.UTC(2025, 9 + index, 1)).toISOString().slice(0, 10),
|
|
393
|
+
pop,
|
|
394
|
+
rock
|
|
395
|
+
}));
|
|
396
|
+
function Listening() {
|
|
397
|
+
const $ = c(44);
|
|
398
|
+
const { t } = useWords("stream-graph");
|
|
399
|
+
let t0;
|
|
400
|
+
if ($[0] !== t) {
|
|
401
|
+
t0 = t("listening.caption");
|
|
402
|
+
$[0] = t;
|
|
403
|
+
$[1] = t0;
|
|
404
|
+
} else t0 = $[1];
|
|
405
|
+
let t1;
|
|
406
|
+
if ($[2] !== t) {
|
|
407
|
+
t1 = t("listening.label");
|
|
408
|
+
$[2] = t;
|
|
409
|
+
$[3] = t1;
|
|
410
|
+
} else t1 = $[3];
|
|
411
|
+
let t2;
|
|
412
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
413
|
+
t2 = {
|
|
414
|
+
month: "short",
|
|
415
|
+
timeZone: "UTC"
|
|
416
|
+
};
|
|
417
|
+
$[4] = t2;
|
|
418
|
+
} else t2 = $[4];
|
|
419
|
+
let t3;
|
|
420
|
+
if ($[5] !== t) {
|
|
421
|
+
t3 = t("listening.genres");
|
|
422
|
+
$[5] = t;
|
|
423
|
+
$[6] = t3;
|
|
424
|
+
} else t3 = $[6];
|
|
425
|
+
let t4;
|
|
426
|
+
if ($[7] !== t) {
|
|
427
|
+
t4 = t("listening.pop");
|
|
428
|
+
$[7] = t;
|
|
429
|
+
$[8] = t4;
|
|
430
|
+
} else t4 = $[8];
|
|
431
|
+
let t5;
|
|
432
|
+
if ($[9] !== t4) {
|
|
433
|
+
t5 = {
|
|
434
|
+
key: "pop",
|
|
435
|
+
label: t4
|
|
436
|
+
};
|
|
437
|
+
$[9] = t4;
|
|
438
|
+
$[10] = t5;
|
|
439
|
+
} else t5 = $[10];
|
|
440
|
+
let t6;
|
|
441
|
+
if ($[11] !== t) {
|
|
442
|
+
t6 = t("listening.rock");
|
|
443
|
+
$[11] = t;
|
|
444
|
+
$[12] = t6;
|
|
445
|
+
} else t6 = $[12];
|
|
446
|
+
let t7;
|
|
447
|
+
if ($[13] !== t6) {
|
|
448
|
+
t7 = {
|
|
449
|
+
key: "rock",
|
|
450
|
+
label: t6
|
|
451
|
+
};
|
|
452
|
+
$[13] = t6;
|
|
453
|
+
$[14] = t7;
|
|
454
|
+
} else t7 = $[14];
|
|
455
|
+
let t8;
|
|
456
|
+
if ($[15] !== t) {
|
|
457
|
+
t8 = t("listening.hiphop");
|
|
458
|
+
$[15] = t;
|
|
459
|
+
$[16] = t8;
|
|
460
|
+
} else t8 = $[16];
|
|
461
|
+
let t9;
|
|
462
|
+
if ($[17] !== t8) {
|
|
463
|
+
t9 = {
|
|
464
|
+
key: "hiphop",
|
|
465
|
+
label: t8
|
|
466
|
+
};
|
|
467
|
+
$[17] = t8;
|
|
468
|
+
$[18] = t9;
|
|
469
|
+
} else t9 = $[18];
|
|
470
|
+
let t10;
|
|
471
|
+
if ($[19] !== t) {
|
|
472
|
+
t10 = t("listening.jazz");
|
|
473
|
+
$[19] = t;
|
|
474
|
+
$[20] = t10;
|
|
475
|
+
} else t10 = $[20];
|
|
476
|
+
let t11;
|
|
477
|
+
if ($[21] !== t10) {
|
|
478
|
+
t11 = {
|
|
479
|
+
key: "jazz",
|
|
480
|
+
label: t10
|
|
481
|
+
};
|
|
482
|
+
$[21] = t10;
|
|
483
|
+
$[22] = t11;
|
|
484
|
+
} else t11 = $[22];
|
|
485
|
+
let t12;
|
|
486
|
+
if ($[23] !== t) {
|
|
487
|
+
t12 = t("listening.classical");
|
|
488
|
+
$[23] = t;
|
|
489
|
+
$[24] = t12;
|
|
490
|
+
} else t12 = $[24];
|
|
491
|
+
let t13;
|
|
492
|
+
if ($[25] !== t12) {
|
|
493
|
+
t13 = {
|
|
494
|
+
key: "classical",
|
|
495
|
+
label: t12
|
|
496
|
+
};
|
|
497
|
+
$[25] = t12;
|
|
498
|
+
$[26] = t13;
|
|
499
|
+
} else t13 = $[26];
|
|
500
|
+
let t14;
|
|
501
|
+
if ($[27] !== t) {
|
|
502
|
+
t14 = t("listening.electronic");
|
|
503
|
+
$[27] = t;
|
|
504
|
+
$[28] = t14;
|
|
505
|
+
} else t14 = $[28];
|
|
506
|
+
let t15;
|
|
507
|
+
if ($[29] !== t14) {
|
|
508
|
+
t15 = {
|
|
509
|
+
key: "electronic",
|
|
510
|
+
label: t14
|
|
511
|
+
};
|
|
512
|
+
$[29] = t14;
|
|
513
|
+
$[30] = t15;
|
|
514
|
+
} else t15 = $[30];
|
|
515
|
+
let t16;
|
|
516
|
+
if ($[31] !== t11 || $[32] !== t13 || $[33] !== t15 || $[34] !== t5 || $[35] !== t7 || $[36] !== t9) {
|
|
517
|
+
t16 = [
|
|
518
|
+
t5,
|
|
519
|
+
t7,
|
|
520
|
+
t9,
|
|
521
|
+
t11,
|
|
522
|
+
t13,
|
|
523
|
+
t15
|
|
524
|
+
];
|
|
525
|
+
$[31] = t11;
|
|
526
|
+
$[32] = t13;
|
|
527
|
+
$[33] = t15;
|
|
528
|
+
$[34] = t5;
|
|
529
|
+
$[35] = t7;
|
|
530
|
+
$[36] = t9;
|
|
531
|
+
$[37] = t16;
|
|
532
|
+
} else t16 = $[37];
|
|
533
|
+
let t17;
|
|
534
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
535
|
+
t17 = {
|
|
536
|
+
style: "unit",
|
|
537
|
+
unit: "hour",
|
|
538
|
+
unitDisplay: "short"
|
|
539
|
+
};
|
|
540
|
+
$[38] = t17;
|
|
541
|
+
} else t17 = $[38];
|
|
542
|
+
let t18;
|
|
543
|
+
if ($[39] !== t0 || $[40] !== t1 || $[41] !== t16 || $[42] !== t3) {
|
|
544
|
+
t18 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
545
|
+
baseline: "silhouette",
|
|
546
|
+
caption: t0,
|
|
547
|
+
categoryKey: "month",
|
|
548
|
+
data: MONTHS$1,
|
|
549
|
+
label: t1,
|
|
550
|
+
labelOptions: t2,
|
|
551
|
+
legendLabel: t3,
|
|
552
|
+
series: t16,
|
|
553
|
+
valueOptions: t17
|
|
554
|
+
});
|
|
555
|
+
$[39] = t0;
|
|
556
|
+
$[40] = t1;
|
|
557
|
+
$[41] = t16;
|
|
558
|
+
$[42] = t3;
|
|
559
|
+
$[43] = t18;
|
|
560
|
+
} else t18 = $[43];
|
|
561
|
+
return t18;
|
|
562
|
+
}
|
|
563
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst MONTHS = [\n [130, 82, 60, 32, 30, 50],\n [128, 85, 62, 40, 38, 45],\n [135, 88, 64, 46, 52, 42],\n [120, 80, 66, 30, 25, 40],\n [118, 82, 70, 32, 24, 45],\n [125, 78, 74, 28, 22, 52],\n [130, 75, 78, 25, 20, 60],\n [140, 72, 84, 22, 18, 72],\n [150, 70, 88, 20, 16, 85],\n [160, 68, 94, 18, 15, 95],\n [155, 70, 96, 20, 16, 90],\n [145, 74, 92, 24, 19, 75],\n].map(([pop = 0, rock = 0, hiphop = 0, jazz = 0, classical = 0, electronic = 0], index) => ({\n classical,\n electronic,\n hiphop,\n jazz,\n month: new Date(Date.UTC(2025, 9 + index, 1)).toISOString().slice(0, 10),\n pop,\n rock,\n}));\n\nexport function Listening(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n\n return (\n <StreamGraph\n baseline=\"silhouette\"\n caption={t(\"listening.caption\")}\n categoryKey=\"month\"\n data={MONTHS}\n label={t(\"listening.label\")}\n labelOptions={{ month: \"short\", timeZone: \"UTC\" }}\n legendLabel={t(\"listening.genres\")}\n series={[\n { key: \"pop\", label: t(\"listening.pop\") },\n { key: \"rock\", label: t(\"listening.rock\") },\n { key: \"hiphop\", label: t(\"listening.hiphop\") },\n { key: \"jazz\", label: t(\"listening.jazz\") },\n { key: \"classical\", label: t(\"listening.classical\") },\n { key: \"electronic\", label: t(\"listening.electronic\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"hour\", unitDisplay: \"short\" }}\n />\n );\n}\n";
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/stream-graph/examples/ordered.example.tsx
|
|
566
|
+
var ordered_example_exports = /* @__PURE__ */ __exportAll({
|
|
567
|
+
Ordered: () => Ordered,
|
|
568
|
+
source: () => source$3
|
|
569
|
+
});
|
|
570
|
+
const WEEKS$2 = [
|
|
571
|
+
[
|
|
572
|
+
42,
|
|
573
|
+
18,
|
|
574
|
+
4,
|
|
575
|
+
0,
|
|
576
|
+
6
|
|
577
|
+
],
|
|
578
|
+
[
|
|
579
|
+
43,
|
|
580
|
+
18,
|
|
581
|
+
5,
|
|
582
|
+
0,
|
|
583
|
+
7
|
|
584
|
+
],
|
|
585
|
+
[
|
|
586
|
+
45,
|
|
587
|
+
19,
|
|
588
|
+
5,
|
|
589
|
+
0,
|
|
590
|
+
6
|
|
591
|
+
],
|
|
592
|
+
[
|
|
593
|
+
44,
|
|
594
|
+
19,
|
|
595
|
+
6,
|
|
596
|
+
1,
|
|
597
|
+
7
|
|
598
|
+
],
|
|
599
|
+
[
|
|
600
|
+
46,
|
|
601
|
+
20,
|
|
602
|
+
12,
|
|
603
|
+
1,
|
|
604
|
+
7
|
|
605
|
+
],
|
|
606
|
+
[
|
|
607
|
+
47,
|
|
608
|
+
19,
|
|
609
|
+
26,
|
|
610
|
+
2,
|
|
611
|
+
8
|
|
612
|
+
],
|
|
613
|
+
[
|
|
614
|
+
48,
|
|
615
|
+
20,
|
|
616
|
+
38,
|
|
617
|
+
3,
|
|
618
|
+
7
|
|
619
|
+
],
|
|
620
|
+
[
|
|
621
|
+
47,
|
|
622
|
+
21,
|
|
623
|
+
31,
|
|
624
|
+
5,
|
|
625
|
+
8
|
|
626
|
+
],
|
|
627
|
+
[
|
|
628
|
+
49,
|
|
629
|
+
21,
|
|
630
|
+
19,
|
|
631
|
+
8,
|
|
632
|
+
8
|
|
633
|
+
],
|
|
634
|
+
[
|
|
635
|
+
50,
|
|
636
|
+
20,
|
|
637
|
+
11,
|
|
638
|
+
11,
|
|
639
|
+
9
|
|
640
|
+
],
|
|
641
|
+
[
|
|
642
|
+
51,
|
|
643
|
+
21,
|
|
644
|
+
8,
|
|
645
|
+
14,
|
|
646
|
+
8
|
|
647
|
+
],
|
|
648
|
+
[
|
|
649
|
+
52,
|
|
650
|
+
22,
|
|
651
|
+
7,
|
|
652
|
+
16,
|
|
653
|
+
9
|
|
654
|
+
],
|
|
655
|
+
[
|
|
656
|
+
51,
|
|
657
|
+
22,
|
|
658
|
+
6,
|
|
659
|
+
18,
|
|
660
|
+
9
|
|
661
|
+
],
|
|
662
|
+
[
|
|
663
|
+
53,
|
|
664
|
+
23,
|
|
665
|
+
6,
|
|
666
|
+
19,
|
|
667
|
+
10
|
|
668
|
+
],
|
|
669
|
+
[
|
|
670
|
+
54,
|
|
671
|
+
22,
|
|
672
|
+
5,
|
|
673
|
+
21,
|
|
674
|
+
9
|
|
675
|
+
],
|
|
676
|
+
[
|
|
677
|
+
55,
|
|
678
|
+
23,
|
|
679
|
+
5,
|
|
680
|
+
22,
|
|
681
|
+
10
|
|
682
|
+
]
|
|
683
|
+
].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({
|
|
684
|
+
direct: direct * 1e3,
|
|
685
|
+
email: email * 1e3,
|
|
686
|
+
organic: organic * 1e3,
|
|
687
|
+
referral: referral * 1e3,
|
|
688
|
+
social: social * 1e3,
|
|
689
|
+
week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10)
|
|
690
|
+
}));
|
|
691
|
+
function Ordered() {
|
|
692
|
+
const $ = c(39);
|
|
693
|
+
const { t } = useWords("stream-graph");
|
|
694
|
+
let t0;
|
|
695
|
+
if ($[0] !== t) {
|
|
696
|
+
t0 = t("ordered.caption");
|
|
697
|
+
$[0] = t;
|
|
698
|
+
$[1] = t0;
|
|
699
|
+
} else t0 = $[1];
|
|
700
|
+
let t1;
|
|
701
|
+
if ($[2] !== t) {
|
|
702
|
+
t1 = t("traffic.label");
|
|
703
|
+
$[2] = t;
|
|
704
|
+
$[3] = t1;
|
|
705
|
+
} else t1 = $[3];
|
|
706
|
+
let t2;
|
|
707
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
708
|
+
t2 = {
|
|
709
|
+
day: "numeric",
|
|
710
|
+
month: "short",
|
|
711
|
+
timeZone: "UTC"
|
|
712
|
+
};
|
|
713
|
+
$[4] = t2;
|
|
714
|
+
} else t2 = $[4];
|
|
715
|
+
let t3;
|
|
716
|
+
if ($[5] !== t) {
|
|
717
|
+
t3 = t("traffic.sources");
|
|
718
|
+
$[5] = t;
|
|
719
|
+
$[6] = t3;
|
|
720
|
+
} else t3 = $[6];
|
|
721
|
+
let t4;
|
|
722
|
+
if ($[7] !== t) {
|
|
723
|
+
t4 = t("traffic.organic");
|
|
724
|
+
$[7] = t;
|
|
725
|
+
$[8] = t4;
|
|
726
|
+
} else t4 = $[8];
|
|
727
|
+
let t5;
|
|
728
|
+
if ($[9] !== t4) {
|
|
729
|
+
t5 = {
|
|
730
|
+
key: "organic",
|
|
731
|
+
label: t4
|
|
732
|
+
};
|
|
733
|
+
$[9] = t4;
|
|
734
|
+
$[10] = t5;
|
|
735
|
+
} else t5 = $[10];
|
|
736
|
+
let t6;
|
|
737
|
+
if ($[11] !== t) {
|
|
738
|
+
t6 = t("traffic.direct");
|
|
739
|
+
$[11] = t;
|
|
740
|
+
$[12] = t6;
|
|
741
|
+
} else t6 = $[12];
|
|
742
|
+
let t7;
|
|
743
|
+
if ($[13] !== t6) {
|
|
744
|
+
t7 = {
|
|
745
|
+
key: "direct",
|
|
746
|
+
label: t6
|
|
747
|
+
};
|
|
748
|
+
$[13] = t6;
|
|
749
|
+
$[14] = t7;
|
|
750
|
+
} else t7 = $[14];
|
|
751
|
+
let t8;
|
|
752
|
+
if ($[15] !== t) {
|
|
753
|
+
t8 = t("traffic.social");
|
|
754
|
+
$[15] = t;
|
|
755
|
+
$[16] = t8;
|
|
756
|
+
} else t8 = $[16];
|
|
757
|
+
let t9;
|
|
758
|
+
if ($[17] !== t8) {
|
|
759
|
+
t9 = {
|
|
760
|
+
key: "social",
|
|
761
|
+
label: t8
|
|
762
|
+
};
|
|
763
|
+
$[17] = t8;
|
|
764
|
+
$[18] = t9;
|
|
765
|
+
} else t9 = $[18];
|
|
766
|
+
let t10;
|
|
767
|
+
if ($[19] !== t) {
|
|
768
|
+
t10 = t("traffic.email");
|
|
769
|
+
$[19] = t;
|
|
770
|
+
$[20] = t10;
|
|
771
|
+
} else t10 = $[20];
|
|
772
|
+
let t11;
|
|
773
|
+
if ($[21] !== t10) {
|
|
774
|
+
t11 = {
|
|
775
|
+
key: "email",
|
|
776
|
+
label: t10
|
|
777
|
+
};
|
|
778
|
+
$[21] = t10;
|
|
779
|
+
$[22] = t11;
|
|
780
|
+
} else t11 = $[22];
|
|
781
|
+
let t12;
|
|
782
|
+
if ($[23] !== t) {
|
|
783
|
+
t12 = t("traffic.referral");
|
|
784
|
+
$[23] = t;
|
|
785
|
+
$[24] = t12;
|
|
786
|
+
} else t12 = $[24];
|
|
787
|
+
let t13;
|
|
788
|
+
if ($[25] !== t12) {
|
|
789
|
+
t13 = {
|
|
790
|
+
key: "referral",
|
|
791
|
+
label: t12
|
|
792
|
+
};
|
|
793
|
+
$[25] = t12;
|
|
794
|
+
$[26] = t13;
|
|
795
|
+
} else t13 = $[26];
|
|
796
|
+
let t14;
|
|
797
|
+
if ($[27] !== t11 || $[28] !== t13 || $[29] !== t5 || $[30] !== t7 || $[31] !== t9) {
|
|
798
|
+
t14 = [
|
|
799
|
+
t5,
|
|
800
|
+
t7,
|
|
801
|
+
t9,
|
|
802
|
+
t11,
|
|
803
|
+
t13
|
|
804
|
+
];
|
|
805
|
+
$[27] = t11;
|
|
806
|
+
$[28] = t13;
|
|
807
|
+
$[29] = t5;
|
|
808
|
+
$[30] = t7;
|
|
809
|
+
$[31] = t9;
|
|
810
|
+
$[32] = t14;
|
|
811
|
+
} else t14 = $[32];
|
|
812
|
+
let t15;
|
|
813
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
814
|
+
t15 = { notation: "compact" };
|
|
815
|
+
$[33] = t15;
|
|
816
|
+
} else t15 = $[33];
|
|
817
|
+
let t16;
|
|
818
|
+
if ($[34] !== t0 || $[35] !== t1 || $[36] !== t14 || $[37] !== t3) {
|
|
819
|
+
t16 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
820
|
+
caption: t0,
|
|
821
|
+
categoryKey: "week",
|
|
822
|
+
data: WEEKS$2,
|
|
823
|
+
insideOut: false,
|
|
824
|
+
label: t1,
|
|
825
|
+
labelOptions: t2,
|
|
826
|
+
legendLabel: t3,
|
|
827
|
+
series: t14,
|
|
828
|
+
valueOptions: t15
|
|
829
|
+
});
|
|
830
|
+
$[34] = t0;
|
|
831
|
+
$[35] = t1;
|
|
832
|
+
$[36] = t14;
|
|
833
|
+
$[37] = t3;
|
|
834
|
+
$[38] = t16;
|
|
835
|
+
} else t16 = $[38];
|
|
836
|
+
return t16;
|
|
837
|
+
}
|
|
838
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst WEEKS = [\n [42, 18, 4, 0, 6],\n [43, 18, 5, 0, 7],\n [45, 19, 5, 0, 6],\n [44, 19, 6, 1, 7],\n [46, 20, 12, 1, 7],\n [47, 19, 26, 2, 8],\n [48, 20, 38, 3, 7],\n [47, 21, 31, 5, 8],\n [49, 21, 19, 8, 8],\n [50, 20, 11, 11, 9],\n [51, 21, 8, 14, 8],\n [52, 22, 7, 16, 9],\n [51, 22, 6, 18, 9],\n [53, 23, 6, 19, 10],\n [54, 22, 5, 21, 9],\n [55, 23, 5, 22, 10],\n].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({\n direct: direct * 1000,\n email: email * 1000,\n organic: organic * 1000,\n referral: referral * 1000,\n social: social * 1000,\n week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10),\n}));\n\nexport function Ordered(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n\n return (\n <StreamGraph\n caption={t(\"ordered.caption\")}\n categoryKey=\"week\"\n data={WEEKS}\n insideOut={false}\n label={t(\"traffic.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n legendLabel={t(\"traffic.sources\")}\n series={[\n { key: \"organic\", label: t(\"traffic.organic\") },\n { key: \"direct\", label: t(\"traffic.direct\") },\n { key: \"social\", label: t(\"traffic.social\") },\n { key: \"email\", label: t(\"traffic.email\") },\n { key: \"referral\", label: t(\"traffic.referral\") },\n ]}\n valueOptions={{ notation: \"compact\" }}\n />\n );\n}\n";
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region src/stream-graph/examples/quiet.example.tsx
|
|
841
|
+
var quiet_example_exports = /* @__PURE__ */ __exportAll({
|
|
842
|
+
Quiet: () => Quiet,
|
|
843
|
+
source: () => source$2
|
|
844
|
+
});
|
|
845
|
+
const WEEKS$1 = [];
|
|
846
|
+
function Quiet() {
|
|
847
|
+
const $ = c(30);
|
|
848
|
+
const { t } = useWords("stream-graph");
|
|
849
|
+
let t0;
|
|
850
|
+
if ($[0] !== t) {
|
|
851
|
+
t0 = t("quiet.caption");
|
|
852
|
+
$[0] = t;
|
|
853
|
+
$[1] = t0;
|
|
854
|
+
} else t0 = $[1];
|
|
855
|
+
let t1;
|
|
856
|
+
if ($[2] !== t) {
|
|
857
|
+
t1 = t("quiet.empty");
|
|
858
|
+
$[2] = t;
|
|
859
|
+
$[3] = t1;
|
|
860
|
+
} else t1 = $[3];
|
|
861
|
+
let t2;
|
|
862
|
+
if ($[4] !== t) {
|
|
863
|
+
t2 = t("traffic.label");
|
|
864
|
+
$[4] = t;
|
|
865
|
+
$[5] = t2;
|
|
866
|
+
} else t2 = $[5];
|
|
867
|
+
let t3;
|
|
868
|
+
if ($[6] !== t) {
|
|
869
|
+
t3 = t("traffic.sources");
|
|
870
|
+
$[6] = t;
|
|
871
|
+
$[7] = t3;
|
|
872
|
+
} else t3 = $[7];
|
|
873
|
+
let t4;
|
|
874
|
+
if ($[8] !== t) {
|
|
875
|
+
t4 = t("traffic.organic");
|
|
876
|
+
$[8] = t;
|
|
877
|
+
$[9] = t4;
|
|
878
|
+
} else t4 = $[9];
|
|
879
|
+
let t5;
|
|
880
|
+
if ($[10] !== t4) {
|
|
881
|
+
t5 = {
|
|
882
|
+
key: "organic",
|
|
883
|
+
label: t4
|
|
884
|
+
};
|
|
885
|
+
$[10] = t4;
|
|
886
|
+
$[11] = t5;
|
|
887
|
+
} else t5 = $[11];
|
|
888
|
+
let t6;
|
|
889
|
+
if ($[12] !== t) {
|
|
890
|
+
t6 = t("traffic.direct");
|
|
891
|
+
$[12] = t;
|
|
892
|
+
$[13] = t6;
|
|
893
|
+
} else t6 = $[13];
|
|
894
|
+
let t7;
|
|
895
|
+
if ($[14] !== t6) {
|
|
896
|
+
t7 = {
|
|
897
|
+
key: "direct",
|
|
898
|
+
label: t6
|
|
899
|
+
};
|
|
900
|
+
$[14] = t6;
|
|
901
|
+
$[15] = t7;
|
|
902
|
+
} else t7 = $[15];
|
|
903
|
+
let t8;
|
|
904
|
+
if ($[16] !== t) {
|
|
905
|
+
t8 = t("traffic.social");
|
|
906
|
+
$[16] = t;
|
|
907
|
+
$[17] = t8;
|
|
908
|
+
} else t8 = $[17];
|
|
909
|
+
let t9;
|
|
910
|
+
if ($[18] !== t8) {
|
|
911
|
+
t9 = {
|
|
912
|
+
key: "social",
|
|
913
|
+
label: t8
|
|
914
|
+
};
|
|
915
|
+
$[18] = t8;
|
|
916
|
+
$[19] = t9;
|
|
917
|
+
} else t9 = $[19];
|
|
918
|
+
let t10;
|
|
919
|
+
if ($[20] !== t5 || $[21] !== t7 || $[22] !== t9) {
|
|
920
|
+
t10 = [
|
|
921
|
+
t5,
|
|
922
|
+
t7,
|
|
923
|
+
t9
|
|
924
|
+
];
|
|
925
|
+
$[20] = t5;
|
|
926
|
+
$[21] = t7;
|
|
927
|
+
$[22] = t9;
|
|
928
|
+
$[23] = t10;
|
|
929
|
+
} else t10 = $[23];
|
|
930
|
+
let t11;
|
|
931
|
+
if ($[24] !== t0 || $[25] !== t1 || $[26] !== t10 || $[27] !== t2 || $[28] !== t3) {
|
|
932
|
+
t11 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
933
|
+
caption: t0,
|
|
934
|
+
categoryKey: "week",
|
|
935
|
+
data: WEEKS$1,
|
|
936
|
+
empty: t1,
|
|
937
|
+
label: t2,
|
|
938
|
+
legendLabel: t3,
|
|
939
|
+
series: t10
|
|
940
|
+
});
|
|
941
|
+
$[24] = t0;
|
|
942
|
+
$[25] = t1;
|
|
943
|
+
$[26] = t10;
|
|
944
|
+
$[27] = t2;
|
|
945
|
+
$[28] = t3;
|
|
946
|
+
$[29] = t11;
|
|
947
|
+
} else t11 = $[29];
|
|
948
|
+
return t11;
|
|
949
|
+
}
|
|
950
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst WEEKS: Array<{ direct: number; organic: number; social: number; week: string }> = [];\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n\n return (\n <StreamGraph\n caption={t(\"quiet.caption\")}\n categoryKey=\"week\"\n data={WEEKS}\n empty={t(\"quiet.empty\")}\n label={t(\"traffic.label\")}\n legendLabel={t(\"traffic.sources\")}\n series={[\n { key: \"organic\", label: t(\"traffic.organic\") },\n { key: \"direct\", label: t(\"traffic.direct\") },\n { key: \"social\", label: t(\"traffic.social\") },\n ]}\n />\n );\n}\n";
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/stream-graph/examples/replay.example.tsx
|
|
953
|
+
var replay_example_exports = /* @__PURE__ */ __exportAll({
|
|
954
|
+
Replay: () => Replay,
|
|
955
|
+
source: () => source$1
|
|
956
|
+
});
|
|
957
|
+
const MONTHS = [
|
|
958
|
+
[
|
|
959
|
+
130,
|
|
960
|
+
82,
|
|
961
|
+
60,
|
|
962
|
+
32,
|
|
963
|
+
30,
|
|
964
|
+
50
|
|
965
|
+
],
|
|
966
|
+
[
|
|
967
|
+
128,
|
|
968
|
+
85,
|
|
969
|
+
62,
|
|
970
|
+
40,
|
|
971
|
+
38,
|
|
972
|
+
45
|
|
973
|
+
],
|
|
974
|
+
[
|
|
975
|
+
135,
|
|
976
|
+
88,
|
|
977
|
+
64,
|
|
978
|
+
46,
|
|
979
|
+
52,
|
|
980
|
+
42
|
|
981
|
+
],
|
|
982
|
+
[
|
|
983
|
+
120,
|
|
984
|
+
80,
|
|
985
|
+
66,
|
|
986
|
+
30,
|
|
987
|
+
25,
|
|
988
|
+
40
|
|
989
|
+
],
|
|
990
|
+
[
|
|
991
|
+
118,
|
|
992
|
+
82,
|
|
993
|
+
70,
|
|
994
|
+
32,
|
|
995
|
+
24,
|
|
996
|
+
45
|
|
997
|
+
],
|
|
998
|
+
[
|
|
999
|
+
125,
|
|
1000
|
+
78,
|
|
1001
|
+
74,
|
|
1002
|
+
28,
|
|
1003
|
+
22,
|
|
1004
|
+
52
|
|
1005
|
+
],
|
|
1006
|
+
[
|
|
1007
|
+
130,
|
|
1008
|
+
75,
|
|
1009
|
+
78,
|
|
1010
|
+
25,
|
|
1011
|
+
20,
|
|
1012
|
+
60
|
|
1013
|
+
],
|
|
1014
|
+
[
|
|
1015
|
+
140,
|
|
1016
|
+
72,
|
|
1017
|
+
84,
|
|
1018
|
+
22,
|
|
1019
|
+
18,
|
|
1020
|
+
72
|
|
1021
|
+
],
|
|
1022
|
+
[
|
|
1023
|
+
150,
|
|
1024
|
+
70,
|
|
1025
|
+
88,
|
|
1026
|
+
20,
|
|
1027
|
+
16,
|
|
1028
|
+
85
|
|
1029
|
+
],
|
|
1030
|
+
[
|
|
1031
|
+
160,
|
|
1032
|
+
68,
|
|
1033
|
+
94,
|
|
1034
|
+
18,
|
|
1035
|
+
15,
|
|
1036
|
+
95
|
|
1037
|
+
],
|
|
1038
|
+
[
|
|
1039
|
+
155,
|
|
1040
|
+
70,
|
|
1041
|
+
96,
|
|
1042
|
+
20,
|
|
1043
|
+
16,
|
|
1044
|
+
90
|
|
1045
|
+
],
|
|
1046
|
+
[
|
|
1047
|
+
145,
|
|
1048
|
+
74,
|
|
1049
|
+
92,
|
|
1050
|
+
24,
|
|
1051
|
+
19,
|
|
1052
|
+
75
|
|
1053
|
+
]
|
|
1054
|
+
].map(([pop = 0, rock = 0, hiphop = 0, jazz = 0, classical = 0, electronic = 0], index) => ({
|
|
1055
|
+
classical,
|
|
1056
|
+
electronic,
|
|
1057
|
+
hiphop,
|
|
1058
|
+
jazz,
|
|
1059
|
+
month: new Date(Date.UTC(2025, 9 + index, 1)).toISOString().slice(0, 10),
|
|
1060
|
+
pop,
|
|
1061
|
+
rock
|
|
1062
|
+
}));
|
|
1063
|
+
function Replay() {
|
|
1064
|
+
const $ = c(56);
|
|
1065
|
+
const { t } = useWords("stream-graph");
|
|
1066
|
+
const [run, setRun] = useState(0);
|
|
1067
|
+
let t0;
|
|
1068
|
+
if ($[0] !== t) {
|
|
1069
|
+
t0 = t("listening.caption");
|
|
1070
|
+
$[0] = t;
|
|
1071
|
+
$[1] = t0;
|
|
1072
|
+
} else t0 = $[1];
|
|
1073
|
+
let t1;
|
|
1074
|
+
if ($[2] !== t) {
|
|
1075
|
+
t1 = t("listening.label");
|
|
1076
|
+
$[2] = t;
|
|
1077
|
+
$[3] = t1;
|
|
1078
|
+
} else t1 = $[3];
|
|
1079
|
+
let t2;
|
|
1080
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1081
|
+
t2 = {
|
|
1082
|
+
month: "short",
|
|
1083
|
+
timeZone: "UTC"
|
|
1084
|
+
};
|
|
1085
|
+
$[4] = t2;
|
|
1086
|
+
} else t2 = $[4];
|
|
1087
|
+
let t3;
|
|
1088
|
+
if ($[5] !== t) {
|
|
1089
|
+
t3 = t("listening.genres");
|
|
1090
|
+
$[5] = t;
|
|
1091
|
+
$[6] = t3;
|
|
1092
|
+
} else t3 = $[6];
|
|
1093
|
+
let t4;
|
|
1094
|
+
if ($[7] !== t) {
|
|
1095
|
+
t4 = t("listening.pop");
|
|
1096
|
+
$[7] = t;
|
|
1097
|
+
$[8] = t4;
|
|
1098
|
+
} else t4 = $[8];
|
|
1099
|
+
let t5;
|
|
1100
|
+
if ($[9] !== t4) {
|
|
1101
|
+
t5 = {
|
|
1102
|
+
key: "pop",
|
|
1103
|
+
label: t4
|
|
1104
|
+
};
|
|
1105
|
+
$[9] = t4;
|
|
1106
|
+
$[10] = t5;
|
|
1107
|
+
} else t5 = $[10];
|
|
1108
|
+
let t6;
|
|
1109
|
+
if ($[11] !== t) {
|
|
1110
|
+
t6 = t("listening.rock");
|
|
1111
|
+
$[11] = t;
|
|
1112
|
+
$[12] = t6;
|
|
1113
|
+
} else t6 = $[12];
|
|
1114
|
+
let t7;
|
|
1115
|
+
if ($[13] !== t6) {
|
|
1116
|
+
t7 = {
|
|
1117
|
+
key: "rock",
|
|
1118
|
+
label: t6
|
|
1119
|
+
};
|
|
1120
|
+
$[13] = t6;
|
|
1121
|
+
$[14] = t7;
|
|
1122
|
+
} else t7 = $[14];
|
|
1123
|
+
let t8;
|
|
1124
|
+
if ($[15] !== t) {
|
|
1125
|
+
t8 = t("listening.hiphop");
|
|
1126
|
+
$[15] = t;
|
|
1127
|
+
$[16] = t8;
|
|
1128
|
+
} else t8 = $[16];
|
|
1129
|
+
let t9;
|
|
1130
|
+
if ($[17] !== t8) {
|
|
1131
|
+
t9 = {
|
|
1132
|
+
key: "hiphop",
|
|
1133
|
+
label: t8
|
|
1134
|
+
};
|
|
1135
|
+
$[17] = t8;
|
|
1136
|
+
$[18] = t9;
|
|
1137
|
+
} else t9 = $[18];
|
|
1138
|
+
let t10;
|
|
1139
|
+
if ($[19] !== t) {
|
|
1140
|
+
t10 = t("listening.jazz");
|
|
1141
|
+
$[19] = t;
|
|
1142
|
+
$[20] = t10;
|
|
1143
|
+
} else t10 = $[20];
|
|
1144
|
+
let t11;
|
|
1145
|
+
if ($[21] !== t10) {
|
|
1146
|
+
t11 = {
|
|
1147
|
+
key: "jazz",
|
|
1148
|
+
label: t10
|
|
1149
|
+
};
|
|
1150
|
+
$[21] = t10;
|
|
1151
|
+
$[22] = t11;
|
|
1152
|
+
} else t11 = $[22];
|
|
1153
|
+
let t12;
|
|
1154
|
+
if ($[23] !== t) {
|
|
1155
|
+
t12 = t("listening.classical");
|
|
1156
|
+
$[23] = t;
|
|
1157
|
+
$[24] = t12;
|
|
1158
|
+
} else t12 = $[24];
|
|
1159
|
+
let t13;
|
|
1160
|
+
if ($[25] !== t12) {
|
|
1161
|
+
t13 = {
|
|
1162
|
+
key: "classical",
|
|
1163
|
+
label: t12
|
|
1164
|
+
};
|
|
1165
|
+
$[25] = t12;
|
|
1166
|
+
$[26] = t13;
|
|
1167
|
+
} else t13 = $[26];
|
|
1168
|
+
let t14;
|
|
1169
|
+
if ($[27] !== t) {
|
|
1170
|
+
t14 = t("listening.electronic");
|
|
1171
|
+
$[27] = t;
|
|
1172
|
+
$[28] = t14;
|
|
1173
|
+
} else t14 = $[28];
|
|
1174
|
+
let t15;
|
|
1175
|
+
if ($[29] !== t14) {
|
|
1176
|
+
t15 = {
|
|
1177
|
+
key: "electronic",
|
|
1178
|
+
label: t14
|
|
1179
|
+
};
|
|
1180
|
+
$[29] = t14;
|
|
1181
|
+
$[30] = t15;
|
|
1182
|
+
} else t15 = $[30];
|
|
1183
|
+
let t16;
|
|
1184
|
+
if ($[31] !== t11 || $[32] !== t13 || $[33] !== t15 || $[34] !== t5 || $[35] !== t7 || $[36] !== t9) {
|
|
1185
|
+
t16 = [
|
|
1186
|
+
t5,
|
|
1187
|
+
t7,
|
|
1188
|
+
t9,
|
|
1189
|
+
t11,
|
|
1190
|
+
t13,
|
|
1191
|
+
t15
|
|
1192
|
+
];
|
|
1193
|
+
$[31] = t11;
|
|
1194
|
+
$[32] = t13;
|
|
1195
|
+
$[33] = t15;
|
|
1196
|
+
$[34] = t5;
|
|
1197
|
+
$[35] = t7;
|
|
1198
|
+
$[36] = t9;
|
|
1199
|
+
$[37] = t16;
|
|
1200
|
+
} else t16 = $[37];
|
|
1201
|
+
let t17;
|
|
1202
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1203
|
+
t17 = {
|
|
1204
|
+
style: "unit",
|
|
1205
|
+
unit: "hour",
|
|
1206
|
+
unitDisplay: "short"
|
|
1207
|
+
};
|
|
1208
|
+
$[38] = t17;
|
|
1209
|
+
} else t17 = $[38];
|
|
1210
|
+
let t18;
|
|
1211
|
+
if ($[39] !== run || $[40] !== t0 || $[41] !== t1 || $[42] !== t16 || $[43] !== t3) {
|
|
1212
|
+
t18 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
1213
|
+
animate: true,
|
|
1214
|
+
baseline: "silhouette",
|
|
1215
|
+
caption: t0,
|
|
1216
|
+
categoryKey: "month",
|
|
1217
|
+
data: MONTHS,
|
|
1218
|
+
label: t1,
|
|
1219
|
+
labelOptions: t2,
|
|
1220
|
+
legendLabel: t3,
|
|
1221
|
+
series: t16,
|
|
1222
|
+
valueOptions: t17
|
|
1223
|
+
}, run);
|
|
1224
|
+
$[39] = run;
|
|
1225
|
+
$[40] = t0;
|
|
1226
|
+
$[41] = t1;
|
|
1227
|
+
$[42] = t16;
|
|
1228
|
+
$[43] = t3;
|
|
1229
|
+
$[44] = t18;
|
|
1230
|
+
} else t18 = $[44];
|
|
1231
|
+
let t19;
|
|
1232
|
+
if ($[45] !== run) {
|
|
1233
|
+
t19 = () => {
|
|
1234
|
+
setRun(run + 1);
|
|
1235
|
+
};
|
|
1236
|
+
$[45] = run;
|
|
1237
|
+
$[46] = t19;
|
|
1238
|
+
} else t19 = $[46];
|
|
1239
|
+
let t20;
|
|
1240
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1241
|
+
t20 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
|
|
1242
|
+
$[47] = t20;
|
|
1243
|
+
} else t20 = $[47];
|
|
1244
|
+
let t21;
|
|
1245
|
+
if ($[48] !== t) {
|
|
1246
|
+
t21 = t("replay.replay");
|
|
1247
|
+
$[48] = t;
|
|
1248
|
+
$[49] = t21;
|
|
1249
|
+
} else t21 = $[49];
|
|
1250
|
+
let t22;
|
|
1251
|
+
if ($[50] !== t19 || $[51] !== t21) {
|
|
1252
|
+
t22 = /* @__PURE__ */ jsxs(Button, {
|
|
1253
|
+
onClick: t19,
|
|
1254
|
+
size: "sm",
|
|
1255
|
+
variant: "outline",
|
|
1256
|
+
children: [t20, t21]
|
|
1257
|
+
});
|
|
1258
|
+
$[50] = t19;
|
|
1259
|
+
$[51] = t21;
|
|
1260
|
+
$[52] = t22;
|
|
1261
|
+
} else t22 = $[52];
|
|
1262
|
+
let t23;
|
|
1263
|
+
if ($[53] !== t18 || $[54] !== t22) {
|
|
1264
|
+
t23 = /* @__PURE__ */ jsxs(Stack, {
|
|
1265
|
+
align: "flex-start",
|
|
1266
|
+
children: [t18, t22]
|
|
1267
|
+
});
|
|
1268
|
+
$[53] = t18;
|
|
1269
|
+
$[54] = t22;
|
|
1270
|
+
$[55] = t23;
|
|
1271
|
+
} else t23 = $[55];
|
|
1272
|
+
return t23;
|
|
1273
|
+
}
|
|
1274
|
+
const source$1 = "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 { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst MONTHS = [\n [130, 82, 60, 32, 30, 50],\n [128, 85, 62, 40, 38, 45],\n [135, 88, 64, 46, 52, 42],\n [120, 80, 66, 30, 25, 40],\n [118, 82, 70, 32, 24, 45],\n [125, 78, 74, 28, 22, 52],\n [130, 75, 78, 25, 20, 60],\n [140, 72, 84, 22, 18, 72],\n [150, 70, 88, 20, 16, 85],\n [160, 68, 94, 18, 15, 95],\n [155, 70, 96, 20, 16, 90],\n [145, 74, 92, 24, 19, 75],\n].map(([pop = 0, rock = 0, hiphop = 0, jazz = 0, classical = 0, electronic = 0], index) => ({\n classical,\n electronic,\n hiphop,\n jazz,\n month: new Date(Date.UTC(2025, 9 + index, 1)).toISOString().slice(0, 10),\n pop,\n rock,\n}));\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <StreamGraph\n animate\n baseline=\"silhouette\"\n caption={t(\"listening.caption\")}\n categoryKey=\"month\"\n data={MONTHS}\n key={run}\n label={t(\"listening.label\")}\n labelOptions={{ month: \"short\", timeZone: \"UTC\" }}\n legendLabel={t(\"listening.genres\")}\n series={[\n { key: \"pop\", label: t(\"listening.pop\") },\n { key: \"rock\", label: t(\"listening.rock\") },\n { key: \"hiphop\", label: t(\"listening.hiphop\") },\n { key: \"jazz\", label: t(\"listening.jazz\") },\n { key: \"classical\", label: t(\"listening.classical\") },\n { key: \"electronic\", label: t(\"listening.electronic\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"hour\", unitDisplay: \"short\" }}\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";
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/stream-graph/examples/traffic.example.tsx
|
|
1277
|
+
var traffic_example_exports = /* @__PURE__ */ __exportAll({
|
|
1278
|
+
Traffic: () => Traffic,
|
|
1279
|
+
source: () => source
|
|
1280
|
+
});
|
|
1281
|
+
const WEEKS = [
|
|
1282
|
+
[
|
|
1283
|
+
42,
|
|
1284
|
+
18,
|
|
1285
|
+
4,
|
|
1286
|
+
0,
|
|
1287
|
+
6
|
|
1288
|
+
],
|
|
1289
|
+
[
|
|
1290
|
+
43,
|
|
1291
|
+
18,
|
|
1292
|
+
5,
|
|
1293
|
+
0,
|
|
1294
|
+
7
|
|
1295
|
+
],
|
|
1296
|
+
[
|
|
1297
|
+
45,
|
|
1298
|
+
19,
|
|
1299
|
+
5,
|
|
1300
|
+
0,
|
|
1301
|
+
6
|
|
1302
|
+
],
|
|
1303
|
+
[
|
|
1304
|
+
44,
|
|
1305
|
+
19,
|
|
1306
|
+
6,
|
|
1307
|
+
1,
|
|
1308
|
+
7
|
|
1309
|
+
],
|
|
1310
|
+
[
|
|
1311
|
+
46,
|
|
1312
|
+
20,
|
|
1313
|
+
12,
|
|
1314
|
+
1,
|
|
1315
|
+
7
|
|
1316
|
+
],
|
|
1317
|
+
[
|
|
1318
|
+
47,
|
|
1319
|
+
19,
|
|
1320
|
+
26,
|
|
1321
|
+
2,
|
|
1322
|
+
8
|
|
1323
|
+
],
|
|
1324
|
+
[
|
|
1325
|
+
48,
|
|
1326
|
+
20,
|
|
1327
|
+
38,
|
|
1328
|
+
3,
|
|
1329
|
+
7
|
|
1330
|
+
],
|
|
1331
|
+
[
|
|
1332
|
+
47,
|
|
1333
|
+
21,
|
|
1334
|
+
31,
|
|
1335
|
+
5,
|
|
1336
|
+
8
|
|
1337
|
+
],
|
|
1338
|
+
[
|
|
1339
|
+
49,
|
|
1340
|
+
21,
|
|
1341
|
+
19,
|
|
1342
|
+
8,
|
|
1343
|
+
8
|
|
1344
|
+
],
|
|
1345
|
+
[
|
|
1346
|
+
50,
|
|
1347
|
+
20,
|
|
1348
|
+
11,
|
|
1349
|
+
11,
|
|
1350
|
+
9
|
|
1351
|
+
],
|
|
1352
|
+
[
|
|
1353
|
+
51,
|
|
1354
|
+
21,
|
|
1355
|
+
8,
|
|
1356
|
+
14,
|
|
1357
|
+
8
|
|
1358
|
+
],
|
|
1359
|
+
[
|
|
1360
|
+
52,
|
|
1361
|
+
22,
|
|
1362
|
+
7,
|
|
1363
|
+
16,
|
|
1364
|
+
9
|
|
1365
|
+
],
|
|
1366
|
+
[
|
|
1367
|
+
51,
|
|
1368
|
+
22,
|
|
1369
|
+
6,
|
|
1370
|
+
18,
|
|
1371
|
+
9
|
|
1372
|
+
],
|
|
1373
|
+
[
|
|
1374
|
+
53,
|
|
1375
|
+
23,
|
|
1376
|
+
6,
|
|
1377
|
+
19,
|
|
1378
|
+
10
|
|
1379
|
+
],
|
|
1380
|
+
[
|
|
1381
|
+
54,
|
|
1382
|
+
22,
|
|
1383
|
+
5,
|
|
1384
|
+
21,
|
|
1385
|
+
9
|
|
1386
|
+
],
|
|
1387
|
+
[
|
|
1388
|
+
55,
|
|
1389
|
+
23,
|
|
1390
|
+
5,
|
|
1391
|
+
22,
|
|
1392
|
+
10
|
|
1393
|
+
]
|
|
1394
|
+
].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({
|
|
1395
|
+
direct: direct * 1e3,
|
|
1396
|
+
email: email * 1e3,
|
|
1397
|
+
organic: organic * 1e3,
|
|
1398
|
+
referral: referral * 1e3,
|
|
1399
|
+
social: social * 1e3,
|
|
1400
|
+
week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10)
|
|
1401
|
+
}));
|
|
1402
|
+
function Traffic() {
|
|
1403
|
+
const $ = c(39);
|
|
1404
|
+
const { t } = useWords("stream-graph");
|
|
1405
|
+
let t0;
|
|
1406
|
+
if ($[0] !== t) {
|
|
1407
|
+
t0 = t("traffic.caption");
|
|
1408
|
+
$[0] = t;
|
|
1409
|
+
$[1] = t0;
|
|
1410
|
+
} else t0 = $[1];
|
|
1411
|
+
let t1;
|
|
1412
|
+
if ($[2] !== t) {
|
|
1413
|
+
t1 = t("traffic.label");
|
|
1414
|
+
$[2] = t;
|
|
1415
|
+
$[3] = t1;
|
|
1416
|
+
} else t1 = $[3];
|
|
1417
|
+
let t2;
|
|
1418
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1419
|
+
t2 = {
|
|
1420
|
+
day: "numeric",
|
|
1421
|
+
month: "short",
|
|
1422
|
+
timeZone: "UTC"
|
|
1423
|
+
};
|
|
1424
|
+
$[4] = t2;
|
|
1425
|
+
} else t2 = $[4];
|
|
1426
|
+
let t3;
|
|
1427
|
+
if ($[5] !== t) {
|
|
1428
|
+
t3 = t("traffic.sources");
|
|
1429
|
+
$[5] = t;
|
|
1430
|
+
$[6] = t3;
|
|
1431
|
+
} else t3 = $[6];
|
|
1432
|
+
let t4;
|
|
1433
|
+
if ($[7] !== t) {
|
|
1434
|
+
t4 = t("traffic.organic");
|
|
1435
|
+
$[7] = t;
|
|
1436
|
+
$[8] = t4;
|
|
1437
|
+
} else t4 = $[8];
|
|
1438
|
+
let t5;
|
|
1439
|
+
if ($[9] !== t4) {
|
|
1440
|
+
t5 = {
|
|
1441
|
+
key: "organic",
|
|
1442
|
+
label: t4
|
|
1443
|
+
};
|
|
1444
|
+
$[9] = t4;
|
|
1445
|
+
$[10] = t5;
|
|
1446
|
+
} else t5 = $[10];
|
|
1447
|
+
let t6;
|
|
1448
|
+
if ($[11] !== t) {
|
|
1449
|
+
t6 = t("traffic.direct");
|
|
1450
|
+
$[11] = t;
|
|
1451
|
+
$[12] = t6;
|
|
1452
|
+
} else t6 = $[12];
|
|
1453
|
+
let t7;
|
|
1454
|
+
if ($[13] !== t6) {
|
|
1455
|
+
t7 = {
|
|
1456
|
+
key: "direct",
|
|
1457
|
+
label: t6
|
|
1458
|
+
};
|
|
1459
|
+
$[13] = t6;
|
|
1460
|
+
$[14] = t7;
|
|
1461
|
+
} else t7 = $[14];
|
|
1462
|
+
let t8;
|
|
1463
|
+
if ($[15] !== t) {
|
|
1464
|
+
t8 = t("traffic.social");
|
|
1465
|
+
$[15] = t;
|
|
1466
|
+
$[16] = t8;
|
|
1467
|
+
} else t8 = $[16];
|
|
1468
|
+
let t9;
|
|
1469
|
+
if ($[17] !== t8) {
|
|
1470
|
+
t9 = {
|
|
1471
|
+
key: "social",
|
|
1472
|
+
label: t8
|
|
1473
|
+
};
|
|
1474
|
+
$[17] = t8;
|
|
1475
|
+
$[18] = t9;
|
|
1476
|
+
} else t9 = $[18];
|
|
1477
|
+
let t10;
|
|
1478
|
+
if ($[19] !== t) {
|
|
1479
|
+
t10 = t("traffic.email");
|
|
1480
|
+
$[19] = t;
|
|
1481
|
+
$[20] = t10;
|
|
1482
|
+
} else t10 = $[20];
|
|
1483
|
+
let t11;
|
|
1484
|
+
if ($[21] !== t10) {
|
|
1485
|
+
t11 = {
|
|
1486
|
+
key: "email",
|
|
1487
|
+
label: t10
|
|
1488
|
+
};
|
|
1489
|
+
$[21] = t10;
|
|
1490
|
+
$[22] = t11;
|
|
1491
|
+
} else t11 = $[22];
|
|
1492
|
+
let t12;
|
|
1493
|
+
if ($[23] !== t) {
|
|
1494
|
+
t12 = t("traffic.referral");
|
|
1495
|
+
$[23] = t;
|
|
1496
|
+
$[24] = t12;
|
|
1497
|
+
} else t12 = $[24];
|
|
1498
|
+
let t13;
|
|
1499
|
+
if ($[25] !== t12) {
|
|
1500
|
+
t13 = {
|
|
1501
|
+
key: "referral",
|
|
1502
|
+
label: t12
|
|
1503
|
+
};
|
|
1504
|
+
$[25] = t12;
|
|
1505
|
+
$[26] = t13;
|
|
1506
|
+
} else t13 = $[26];
|
|
1507
|
+
let t14;
|
|
1508
|
+
if ($[27] !== t11 || $[28] !== t13 || $[29] !== t5 || $[30] !== t7 || $[31] !== t9) {
|
|
1509
|
+
t14 = [
|
|
1510
|
+
t5,
|
|
1511
|
+
t7,
|
|
1512
|
+
t9,
|
|
1513
|
+
t11,
|
|
1514
|
+
t13
|
|
1515
|
+
];
|
|
1516
|
+
$[27] = t11;
|
|
1517
|
+
$[28] = t13;
|
|
1518
|
+
$[29] = t5;
|
|
1519
|
+
$[30] = t7;
|
|
1520
|
+
$[31] = t9;
|
|
1521
|
+
$[32] = t14;
|
|
1522
|
+
} else t14 = $[32];
|
|
1523
|
+
let t15;
|
|
1524
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1525
|
+
t15 = { notation: "compact" };
|
|
1526
|
+
$[33] = t15;
|
|
1527
|
+
} else t15 = $[33];
|
|
1528
|
+
let t16;
|
|
1529
|
+
if ($[34] !== t0 || $[35] !== t1 || $[36] !== t14 || $[37] !== t3) {
|
|
1530
|
+
t16 = /* @__PURE__ */ jsx(StreamGraph, {
|
|
1531
|
+
caption: t0,
|
|
1532
|
+
categoryKey: "week",
|
|
1533
|
+
data: WEEKS,
|
|
1534
|
+
label: t1,
|
|
1535
|
+
labelOptions: t2,
|
|
1536
|
+
legendLabel: t3,
|
|
1537
|
+
series: t14,
|
|
1538
|
+
valueOptions: t15
|
|
1539
|
+
});
|
|
1540
|
+
$[34] = t0;
|
|
1541
|
+
$[35] = t1;
|
|
1542
|
+
$[36] = t14;
|
|
1543
|
+
$[37] = t3;
|
|
1544
|
+
$[38] = t16;
|
|
1545
|
+
} else t16 = $[38];
|
|
1546
|
+
return t16;
|
|
1547
|
+
}
|
|
1548
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StreamGraph } from \"@stealthscale/component-charts\";\n\nconst WEEKS = [\n [42, 18, 4, 0, 6],\n [43, 18, 5, 0, 7],\n [45, 19, 5, 0, 6],\n [44, 19, 6, 1, 7],\n [46, 20, 12, 1, 7],\n [47, 19, 26, 2, 8],\n [48, 20, 38, 3, 7],\n [47, 21, 31, 5, 8],\n [49, 21, 19, 8, 8],\n [50, 20, 11, 11, 9],\n [51, 21, 8, 14, 8],\n [52, 22, 7, 16, 9],\n [51, 22, 6, 18, 9],\n [53, 23, 6, 19, 10],\n [54, 22, 5, 21, 9],\n [55, 23, 5, 22, 10],\n].map(([organic = 0, direct = 0, social = 0, email = 0, referral = 0], index) => ({\n direct: direct * 1000,\n email: email * 1000,\n organic: organic * 1000,\n referral: referral * 1000,\n social: social * 1000,\n week: new Date(Date.UTC(2026, 5, 8 + index * 7)).toISOString().slice(0, 10),\n}));\n\nexport function Traffic(): ReactElement {\n const { t } = useWords(\"stream-graph\");\n\n return (\n <StreamGraph\n caption={t(\"traffic.caption\")}\n categoryKey=\"week\"\n data={WEEKS}\n label={t(\"traffic.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n legendLabel={t(\"traffic.sources\")}\n series={[\n { key: \"organic\", label: t(\"traffic.organic\") },\n { key: \"direct\", label: t(\"traffic.direct\") },\n { key: \"social\", label: t(\"traffic.social\") },\n { key: \"email\", label: t(\"traffic.email\") },\n { key: \"referral\", label: t(\"traffic.referral\") },\n ]}\n valueOptions={{ notation: \"compact\" }}\n />\n );\n}\n";
|
|
1549
|
+
//#endregion
|
|
1550
|
+
//#region src/stream-graph/stream-graph.specimen.tsx
|
|
1551
|
+
/**
|
|
1552
|
+
* Catalogue page for the stream graph.
|
|
1553
|
+
*
|
|
1554
|
+
* @remarks
|
|
1555
|
+
* The stream graph has no recipe of its own: the chart's recipe styles its figure, so every scene
|
|
1556
|
+
* is hand-written. The scenes render traffic sources stacked inside out, listening by genre on a
|
|
1557
|
+
* centred baseline, the sources in the series' order, the tooltip open at a campaign's peak, the
|
|
1558
|
+
* bands animated in with a replay, the traffic at a phone's width, and a range without rows.
|
|
1559
|
+
* Every scene renders a component from `examples/` and shows that file as its source. The words
|
|
1560
|
+
* are keys under `stream-graph` in `locales/en/specimen/stream-graph.json`.
|
|
1561
|
+
*/
|
|
1562
|
+
/**
|
|
1563
|
+
* Hand-written scene for series stacked inside out.
|
|
1564
|
+
*/
|
|
1565
|
+
const insideOut = {
|
|
1566
|
+
about: "stream-graph.traffic.about",
|
|
1567
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1568
|
+
size: "lg",
|
|
1569
|
+
children: /* @__PURE__ */ jsx(Traffic, {})
|
|
1570
|
+
}),
|
|
1571
|
+
example: traffic_example_exports,
|
|
1572
|
+
title: "stream-graph.traffic.title"
|
|
1573
|
+
};
|
|
1574
|
+
/**
|
|
1575
|
+
* Hand-written scene for a stack centred on a straight line.
|
|
1576
|
+
*/
|
|
1577
|
+
const centred = {
|
|
1578
|
+
about: "stream-graph.listening.about",
|
|
1579
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1580
|
+
size: "lg",
|
|
1581
|
+
children: /* @__PURE__ */ jsx(Listening, {})
|
|
1582
|
+
}),
|
|
1583
|
+
example: listening_example_exports,
|
|
1584
|
+
title: "stream-graph.listening.title"
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* Hand-written scene for series stacked in their order.
|
|
1588
|
+
*/
|
|
1589
|
+
const order = {
|
|
1590
|
+
about: "stream-graph.ordered.about",
|
|
1591
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1592
|
+
size: "lg",
|
|
1593
|
+
children: /* @__PURE__ */ jsx(Ordered, {})
|
|
1594
|
+
}),
|
|
1595
|
+
example: ordered_example_exports,
|
|
1596
|
+
title: "stream-graph.ordered.title"
|
|
1597
|
+
};
|
|
1598
|
+
/**
|
|
1599
|
+
* Hand-written scene for the tooltip open at a row.
|
|
1600
|
+
*/
|
|
1601
|
+
const tooltip = {
|
|
1602
|
+
about: "stream-graph.campaign.about",
|
|
1603
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1604
|
+
size: "lg",
|
|
1605
|
+
children: /* @__PURE__ */ jsx(Campaign, {})
|
|
1606
|
+
}),
|
|
1607
|
+
example: campaign_example_exports,
|
|
1608
|
+
title: "stream-graph.campaign.title"
|
|
1609
|
+
};
|
|
1610
|
+
/**
|
|
1611
|
+
* Hand-written scene for the bands animated in, with a replay.
|
|
1612
|
+
*/
|
|
1613
|
+
const animated = {
|
|
1614
|
+
about: "stream-graph.replay.about",
|
|
1615
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1616
|
+
size: "lg",
|
|
1617
|
+
children: /* @__PURE__ */ jsx(Replay, {})
|
|
1618
|
+
}),
|
|
1619
|
+
example: replay_example_exports,
|
|
1620
|
+
title: "stream-graph.replay.title"
|
|
1621
|
+
};
|
|
1622
|
+
/**
|
|
1623
|
+
* Hand-written scene for the traffic at a phone's width.
|
|
1624
|
+
*/
|
|
1625
|
+
const narrow = {
|
|
1626
|
+
about: "stream-graph.narrow.about",
|
|
1627
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1628
|
+
size: "xs",
|
|
1629
|
+
children: /* @__PURE__ */ jsx(Traffic, {})
|
|
1630
|
+
}),
|
|
1631
|
+
example: traffic_example_exports,
|
|
1632
|
+
title: "stream-graph.narrow.title"
|
|
1633
|
+
};
|
|
1634
|
+
/**
|
|
1635
|
+
* Hand-written scene for a range without rows.
|
|
1636
|
+
*/
|
|
1637
|
+
const empty = {
|
|
1638
|
+
about: "stream-graph.quiet.about",
|
|
1639
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1640
|
+
size: "md",
|
|
1641
|
+
children: /* @__PURE__ */ jsx(Quiet, {})
|
|
1642
|
+
}),
|
|
1643
|
+
example: quiet_example_exports,
|
|
1644
|
+
title: "stream-graph.quiet.title"
|
|
1645
|
+
};
|
|
1646
|
+
var stream_graph_specimen_default = specimen({
|
|
1647
|
+
about: "stream-graph.about",
|
|
1648
|
+
id: "components/charts/stream-graph",
|
|
1649
|
+
imports: "import { StreamGraph } from \"@stealthscale/component-charts\";",
|
|
1650
|
+
scenes: [
|
|
1651
|
+
insideOut,
|
|
1652
|
+
centred,
|
|
1653
|
+
order,
|
|
1654
|
+
tooltip,
|
|
1655
|
+
animated,
|
|
1656
|
+
narrow,
|
|
1657
|
+
empty
|
|
1658
|
+
],
|
|
1659
|
+
title: "stream-graph.title"
|
|
1660
|
+
});
|
|
1661
|
+
//#endregion
|
|
1662
|
+
export { animated, centred, stream_graph_specimen_default as default, empty, insideOut, narrow, order, tooltip };
|