@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.
- 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 +1 -1
- 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 +8 -7
- /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
|
@@ -0,0 +1,891 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { nt as chordLayout, rt as flowBalance, tt as ChordDiagram } from "../../shared-DVZJ2nST.js";
|
|
3
|
+
import { l as named } 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/chord-diagram/examples/calls.ts
|
|
8
|
+
/**
|
|
9
|
+
* Keys of the services.
|
|
10
|
+
*/
|
|
11
|
+
const SERVICES = [
|
|
12
|
+
"api",
|
|
13
|
+
"auth",
|
|
14
|
+
"billing",
|
|
15
|
+
"search",
|
|
16
|
+
"jobs"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Lists an hour of calls between the services: every pair calls both ways, and api sends 6,100
|
|
20
|
+
* calls and receives 3,400.
|
|
21
|
+
*/
|
|
22
|
+
const CALLS = [
|
|
23
|
+
{
|
|
24
|
+
from: "api",
|
|
25
|
+
to: "auth",
|
|
26
|
+
value: 2600
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
from: "auth",
|
|
30
|
+
to: "api",
|
|
31
|
+
value: 1900
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
from: "api",
|
|
35
|
+
to: "billing",
|
|
36
|
+
value: 1400
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
from: "billing",
|
|
40
|
+
to: "api",
|
|
41
|
+
value: 700
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
from: "api",
|
|
45
|
+
to: "search",
|
|
46
|
+
value: 2100
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
from: "search",
|
|
50
|
+
to: "api",
|
|
51
|
+
value: 800
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
from: "jobs",
|
|
55
|
+
to: "billing",
|
|
56
|
+
value: 900
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
from: "billing",
|
|
60
|
+
to: "jobs",
|
|
61
|
+
value: 400
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
from: "jobs",
|
|
65
|
+
to: "auth",
|
|
66
|
+
value: 500
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
from: "auth",
|
|
70
|
+
to: "jobs",
|
|
71
|
+
value: 250
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
from: "search",
|
|
75
|
+
to: "jobs",
|
|
76
|
+
value: 300
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
from: "jobs",
|
|
80
|
+
to: "search",
|
|
81
|
+
value: 700
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
/**
|
|
85
|
+
* Lists the calls with jobs calling itself 2,600 times as it requeues its own work.
|
|
86
|
+
*/
|
|
87
|
+
const REQUEUED = [...CALLS, {
|
|
88
|
+
from: "jobs",
|
|
89
|
+
to: "jobs",
|
|
90
|
+
value: 2600
|
|
91
|
+
}];
|
|
92
|
+
/**
|
|
93
|
+
* Keys of the services and the audit log.
|
|
94
|
+
*/
|
|
95
|
+
const AUDITED = [...SERVICES, "audit"];
|
|
96
|
+
/**
|
|
97
|
+
* Lists the calls with three services writing 2,000 calls to an audit log that calls nobody.
|
|
98
|
+
*/
|
|
99
|
+
const LOGGED = [
|
|
100
|
+
...CALLS,
|
|
101
|
+
{
|
|
102
|
+
from: "api",
|
|
103
|
+
to: "audit",
|
|
104
|
+
value: 900
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
from: "auth",
|
|
108
|
+
to: "audit",
|
|
109
|
+
value: 700
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
from: "billing",
|
|
113
|
+
to: "audit",
|
|
114
|
+
value: 400
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
/**
|
|
118
|
+
* Keys of the regions.
|
|
119
|
+
*/
|
|
120
|
+
const REGIONS = [
|
|
121
|
+
"north",
|
|
122
|
+
"south",
|
|
123
|
+
"east",
|
|
124
|
+
"west"
|
|
125
|
+
];
|
|
126
|
+
/**
|
|
127
|
+
* Lists a decade of moves between the regions: every pair moves both ways, and north gains 1,030
|
|
128
|
+
* people.
|
|
129
|
+
*/
|
|
130
|
+
const MOVES = [
|
|
131
|
+
{
|
|
132
|
+
from: "south",
|
|
133
|
+
to: "north",
|
|
134
|
+
value: 840
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
from: "north",
|
|
138
|
+
to: "south",
|
|
139
|
+
value: 190
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
from: "east",
|
|
143
|
+
to: "north",
|
|
144
|
+
value: 520
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
from: "north",
|
|
148
|
+
to: "east",
|
|
149
|
+
value: 140
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
from: "south",
|
|
153
|
+
to: "west",
|
|
154
|
+
value: 310
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
from: "west",
|
|
158
|
+
to: "south",
|
|
159
|
+
value: 90
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
from: "east",
|
|
163
|
+
to: "west",
|
|
164
|
+
value: 260
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
from: "west",
|
|
168
|
+
to: "east",
|
|
169
|
+
value: 230
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/chord-diagram/examples/audit.example.tsx
|
|
174
|
+
var audit_example_exports = /* @__PURE__ */ __exportAll({
|
|
175
|
+
Audit: () => Audit,
|
|
176
|
+
source: () => source$7
|
|
177
|
+
});
|
|
178
|
+
function Audit() {
|
|
179
|
+
const $ = c(17);
|
|
180
|
+
const { t } = useWords("chord-diagram");
|
|
181
|
+
let T0;
|
|
182
|
+
let nodes;
|
|
183
|
+
let t0;
|
|
184
|
+
if ($[0] !== t) {
|
|
185
|
+
nodes = named(AUDITED, (key) => t(`names.${key}`));
|
|
186
|
+
const audit = flowBalance(nodes, LOGGED).find(_temp$5);
|
|
187
|
+
T0 = ChordDiagram;
|
|
188
|
+
t0 = t("audit.caption", {
|
|
189
|
+
name: t("names.audit"),
|
|
190
|
+
received: audit?.inflow
|
|
191
|
+
});
|
|
192
|
+
$[0] = t;
|
|
193
|
+
$[1] = T0;
|
|
194
|
+
$[2] = nodes;
|
|
195
|
+
$[3] = t0;
|
|
196
|
+
} else {
|
|
197
|
+
T0 = $[1];
|
|
198
|
+
nodes = $[2];
|
|
199
|
+
t0 = $[3];
|
|
200
|
+
}
|
|
201
|
+
let t1;
|
|
202
|
+
if ($[4] !== t) {
|
|
203
|
+
t1 = t("in");
|
|
204
|
+
$[4] = t;
|
|
205
|
+
$[5] = t1;
|
|
206
|
+
} else t1 = $[5];
|
|
207
|
+
let t2;
|
|
208
|
+
if ($[6] !== t) {
|
|
209
|
+
t2 = t("audit.label");
|
|
210
|
+
$[6] = t;
|
|
211
|
+
$[7] = t2;
|
|
212
|
+
} else t2 = $[7];
|
|
213
|
+
let t3;
|
|
214
|
+
if ($[8] !== t) {
|
|
215
|
+
t3 = t("out");
|
|
216
|
+
$[8] = t;
|
|
217
|
+
$[9] = t3;
|
|
218
|
+
} else t3 = $[9];
|
|
219
|
+
let t4;
|
|
220
|
+
if ($[10] !== T0 || $[11] !== nodes || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3) {
|
|
221
|
+
t4 = /* @__PURE__ */ jsx(T0, {
|
|
222
|
+
caption: t0,
|
|
223
|
+
defaultIndex: 14,
|
|
224
|
+
flows: LOGGED,
|
|
225
|
+
inflowLabel: t1,
|
|
226
|
+
label: t2,
|
|
227
|
+
nodes,
|
|
228
|
+
outflowLabel: t3
|
|
229
|
+
});
|
|
230
|
+
$[10] = T0;
|
|
231
|
+
$[11] = nodes;
|
|
232
|
+
$[12] = t0;
|
|
233
|
+
$[13] = t1;
|
|
234
|
+
$[14] = t2;
|
|
235
|
+
$[15] = t3;
|
|
236
|
+
$[16] = t4;
|
|
237
|
+
} else t4 = $[16];
|
|
238
|
+
return t4;
|
|
239
|
+
}
|
|
240
|
+
function _temp$5(node) {
|
|
241
|
+
return node.key === "audit";
|
|
242
|
+
}
|
|
243
|
+
const source$7 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram, flowBalance } from \"@stealthscale/component-charts\";\n\nimport { AUDITED, LOGGED, named } from \"./calls.ts\";\n\nexport function Audit(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n const nodes = named(AUDITED, (key) => t(`names.${key}`));\n const audit = flowBalance(nodes, LOGGED).find((node) => node.key === \"audit\");\n\n return (\n <ChordDiagram\n caption={t(\"audit.caption\", { name: t(\"names.audit\"), received: audit?.inflow })}\n defaultIndex={14}\n flows={LOGGED}\n inflowLabel={t(\"in\")}\n label={t(\"audit.label\")}\n nodes={nodes}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/chord-diagram/examples/internal.example.tsx
|
|
246
|
+
var internal_example_exports = /* @__PURE__ */ __exportAll({
|
|
247
|
+
Internal: () => Internal,
|
|
248
|
+
source: () => source$6
|
|
249
|
+
});
|
|
250
|
+
function Internal() {
|
|
251
|
+
const $ = c(18);
|
|
252
|
+
const { t } = useWords("chord-diagram");
|
|
253
|
+
let T0;
|
|
254
|
+
let t0;
|
|
255
|
+
if ($[0] !== t) {
|
|
256
|
+
const own = REQUEUED.find(_temp$4);
|
|
257
|
+
T0 = ChordDiagram;
|
|
258
|
+
t0 = t("internal.caption", {
|
|
259
|
+
calls: own?.value,
|
|
260
|
+
name: t(`names.${own?.from ?? ""}`)
|
|
261
|
+
});
|
|
262
|
+
$[0] = t;
|
|
263
|
+
$[1] = T0;
|
|
264
|
+
$[2] = t0;
|
|
265
|
+
} else {
|
|
266
|
+
T0 = $[1];
|
|
267
|
+
t0 = $[2];
|
|
268
|
+
}
|
|
269
|
+
let t1;
|
|
270
|
+
if ($[3] !== t) {
|
|
271
|
+
t1 = t("in");
|
|
272
|
+
$[3] = t;
|
|
273
|
+
$[4] = t1;
|
|
274
|
+
} else t1 = $[4];
|
|
275
|
+
let t2;
|
|
276
|
+
if ($[5] !== t) {
|
|
277
|
+
t2 = t("internal.label");
|
|
278
|
+
$[5] = t;
|
|
279
|
+
$[6] = t2;
|
|
280
|
+
} else t2 = $[6];
|
|
281
|
+
let t3;
|
|
282
|
+
if ($[7] !== t) {
|
|
283
|
+
t3 = named(SERVICES, (key) => t(`names.${key}`));
|
|
284
|
+
$[7] = t;
|
|
285
|
+
$[8] = t3;
|
|
286
|
+
} else t3 = $[8];
|
|
287
|
+
let t4;
|
|
288
|
+
if ($[9] !== t) {
|
|
289
|
+
t4 = t("out");
|
|
290
|
+
$[9] = t;
|
|
291
|
+
$[10] = t4;
|
|
292
|
+
} else t4 = $[10];
|
|
293
|
+
let t5;
|
|
294
|
+
if ($[11] !== T0 || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
|
|
295
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
296
|
+
caption: t0,
|
|
297
|
+
flows: REQUEUED,
|
|
298
|
+
inflowLabel: t1,
|
|
299
|
+
label: t2,
|
|
300
|
+
nodes: t3,
|
|
301
|
+
outflowLabel: t4
|
|
302
|
+
});
|
|
303
|
+
$[11] = T0;
|
|
304
|
+
$[12] = t0;
|
|
305
|
+
$[13] = t1;
|
|
306
|
+
$[14] = t2;
|
|
307
|
+
$[15] = t3;
|
|
308
|
+
$[16] = t4;
|
|
309
|
+
$[17] = t5;
|
|
310
|
+
} else t5 = $[17];
|
|
311
|
+
return t5;
|
|
312
|
+
}
|
|
313
|
+
function _temp$4(flow) {
|
|
314
|
+
return flow.from === flow.to;
|
|
315
|
+
}
|
|
316
|
+
const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram } from \"@stealthscale/component-charts\";\n\nimport { named, REQUEUED, SERVICES } from \"./calls.ts\";\n\nexport function Internal(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n const own = REQUEUED.find((flow) => flow.from === flow.to);\n\n return (\n <ChordDiagram\n caption={t(\"internal.caption\", {\n calls: own?.value,\n name: t(`names.${own?.from ?? \"\"}`),\n })}\n flows={REQUEUED}\n inflowLabel={t(\"in\")}\n label={t(\"internal.label\")}\n nodes={named(SERVICES, (key) => t(`names.${key}`))}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/chord-diagram/examples/layout.example.tsx
|
|
319
|
+
var layout_example_exports = /* @__PURE__ */ __exportAll({
|
|
320
|
+
Layout: () => Layout,
|
|
321
|
+
source: () => source$5
|
|
322
|
+
});
|
|
323
|
+
function Layout() {
|
|
324
|
+
const $ = c(25);
|
|
325
|
+
const { i18n, t } = useWords("chord-diagram");
|
|
326
|
+
let groups;
|
|
327
|
+
let nodes;
|
|
328
|
+
let t0;
|
|
329
|
+
if ($[0] !== t) {
|
|
330
|
+
nodes = named(SERVICES, (key) => t(`names.${key}`));
|
|
331
|
+
({groups} = chordLayout(nodes, CALLS));
|
|
332
|
+
t0 = groups.reduce(_temp$3, 0);
|
|
333
|
+
$[0] = t;
|
|
334
|
+
$[1] = groups;
|
|
335
|
+
$[2] = nodes;
|
|
336
|
+
$[3] = t0;
|
|
337
|
+
} else {
|
|
338
|
+
groups = $[1];
|
|
339
|
+
nodes = $[2];
|
|
340
|
+
t0 = $[3];
|
|
341
|
+
}
|
|
342
|
+
const arcs = t0;
|
|
343
|
+
const [first] = groups;
|
|
344
|
+
let T0;
|
|
345
|
+
let t1;
|
|
346
|
+
if ($[4] !== arcs || $[5] !== first?.endAngle || $[6] !== first?.key || $[7] !== first?.startAngle || $[8] !== i18n.language || $[9] !== t) {
|
|
347
|
+
const share = new Intl.NumberFormat(i18n.language, { style: "percent" });
|
|
348
|
+
T0 = ChordDiagram;
|
|
349
|
+
t1 = t("layout.caption", {
|
|
350
|
+
name: t(`names.${first?.key ?? ""}`),
|
|
351
|
+
share: share.format(((first?.endAngle ?? 0) - (first?.startAngle ?? 0)) / arcs)
|
|
352
|
+
});
|
|
353
|
+
$[4] = arcs;
|
|
354
|
+
$[5] = first?.endAngle;
|
|
355
|
+
$[6] = first?.key;
|
|
356
|
+
$[7] = first?.startAngle;
|
|
357
|
+
$[8] = i18n.language;
|
|
358
|
+
$[9] = t;
|
|
359
|
+
$[10] = T0;
|
|
360
|
+
$[11] = t1;
|
|
361
|
+
} else {
|
|
362
|
+
T0 = $[10];
|
|
363
|
+
t1 = $[11];
|
|
364
|
+
}
|
|
365
|
+
let t2;
|
|
366
|
+
if ($[12] !== t) {
|
|
367
|
+
t2 = t("in");
|
|
368
|
+
$[12] = t;
|
|
369
|
+
$[13] = t2;
|
|
370
|
+
} else t2 = $[13];
|
|
371
|
+
let t3;
|
|
372
|
+
if ($[14] !== t) {
|
|
373
|
+
t3 = t("services.label");
|
|
374
|
+
$[14] = t;
|
|
375
|
+
$[15] = t3;
|
|
376
|
+
} else t3 = $[15];
|
|
377
|
+
let t4;
|
|
378
|
+
if ($[16] !== t) {
|
|
379
|
+
t4 = t("out");
|
|
380
|
+
$[16] = t;
|
|
381
|
+
$[17] = t4;
|
|
382
|
+
} else t4 = $[17];
|
|
383
|
+
let t5;
|
|
384
|
+
if ($[18] !== T0 || $[19] !== nodes || $[20] !== t1 || $[21] !== t2 || $[22] !== t3 || $[23] !== t4) {
|
|
385
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
386
|
+
caption: t1,
|
|
387
|
+
flows: CALLS,
|
|
388
|
+
inflowLabel: t2,
|
|
389
|
+
label: t3,
|
|
390
|
+
nodes,
|
|
391
|
+
outflowLabel: t4
|
|
392
|
+
});
|
|
393
|
+
$[18] = T0;
|
|
394
|
+
$[19] = nodes;
|
|
395
|
+
$[20] = t1;
|
|
396
|
+
$[21] = t2;
|
|
397
|
+
$[22] = t3;
|
|
398
|
+
$[23] = t4;
|
|
399
|
+
$[24] = t5;
|
|
400
|
+
} else t5 = $[24];
|
|
401
|
+
return t5;
|
|
402
|
+
}
|
|
403
|
+
function _temp$3(sum, group) {
|
|
404
|
+
return sum + group.endAngle - group.startAngle;
|
|
405
|
+
}
|
|
406
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram, chordLayout } from \"@stealthscale/component-charts\";\n\nimport { CALLS, named, SERVICES } from \"./calls.ts\";\n\nexport function Layout(): ReactElement {\n const { i18n, t } = useWords(\"chord-diagram\");\n const nodes = named(SERVICES, (key) => t(`names.${key}`));\n const { groups } = chordLayout(nodes, CALLS);\n const arcs = groups.reduce((sum, group) => sum + group.endAngle - group.startAngle, 0);\n const [first] = groups;\n const share = new Intl.NumberFormat(i18n.language, { style: \"percent\" });\n\n return (\n <ChordDiagram\n caption={t(\"layout.caption\", {\n name: t(`names.${first?.key ?? \"\"}`),\n share: share.format(((first?.endAngle ?? 0) - (first?.startAngle ?? 0)) / arcs),\n })}\n flows={CALLS}\n inflowLabel={t(\"in\")}\n label={t(\"services.label\")}\n nodes={nodes}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/chord-diagram/examples/migration.example.tsx
|
|
409
|
+
var migration_example_exports = /* @__PURE__ */ __exportAll({
|
|
410
|
+
Migration: () => Migration,
|
|
411
|
+
source: () => source$4
|
|
412
|
+
});
|
|
413
|
+
function Migration() {
|
|
414
|
+
const $ = c(18);
|
|
415
|
+
const { t } = useWords("chord-diagram");
|
|
416
|
+
let nodes;
|
|
417
|
+
let t0;
|
|
418
|
+
if ($[0] !== t) {
|
|
419
|
+
nodes = named(REGIONS, (key) => t(`names.${key}`));
|
|
420
|
+
t0 = flowBalance(nodes, MOVES).find(_temp$2);
|
|
421
|
+
$[0] = t;
|
|
422
|
+
$[1] = nodes;
|
|
423
|
+
$[2] = t0;
|
|
424
|
+
} else {
|
|
425
|
+
nodes = $[1];
|
|
426
|
+
t0 = $[2];
|
|
427
|
+
}
|
|
428
|
+
const north = t0;
|
|
429
|
+
const t1 = (north?.inflow ?? 0) - (north?.outflow ?? 0);
|
|
430
|
+
let t2;
|
|
431
|
+
if ($[3] !== t || $[4] !== t1) {
|
|
432
|
+
t2 = t("migration.caption", {
|
|
433
|
+
gained: t1,
|
|
434
|
+
name: t("names.north")
|
|
435
|
+
});
|
|
436
|
+
$[3] = t;
|
|
437
|
+
$[4] = t1;
|
|
438
|
+
$[5] = t2;
|
|
439
|
+
} else t2 = $[5];
|
|
440
|
+
let t3;
|
|
441
|
+
if ($[6] !== t) {
|
|
442
|
+
t3 = t("migration.in");
|
|
443
|
+
$[6] = t;
|
|
444
|
+
$[7] = t3;
|
|
445
|
+
} else t3 = $[7];
|
|
446
|
+
let t4;
|
|
447
|
+
if ($[8] !== t) {
|
|
448
|
+
t4 = t("migration.label");
|
|
449
|
+
$[8] = t;
|
|
450
|
+
$[9] = t4;
|
|
451
|
+
} else t4 = $[9];
|
|
452
|
+
let t5;
|
|
453
|
+
if ($[10] !== t) {
|
|
454
|
+
t5 = t("migration.out");
|
|
455
|
+
$[10] = t;
|
|
456
|
+
$[11] = t5;
|
|
457
|
+
} else t5 = $[11];
|
|
458
|
+
let t6;
|
|
459
|
+
if ($[12] !== nodes || $[13] !== t2 || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
|
|
460
|
+
t6 = /* @__PURE__ */ jsx(ChordDiagram, {
|
|
461
|
+
caption: t2,
|
|
462
|
+
flows: MOVES,
|
|
463
|
+
inflowLabel: t3,
|
|
464
|
+
label: t4,
|
|
465
|
+
nodes,
|
|
466
|
+
outflowLabel: t5
|
|
467
|
+
});
|
|
468
|
+
$[12] = nodes;
|
|
469
|
+
$[13] = t2;
|
|
470
|
+
$[14] = t3;
|
|
471
|
+
$[15] = t4;
|
|
472
|
+
$[16] = t5;
|
|
473
|
+
$[17] = t6;
|
|
474
|
+
} else t6 = $[17];
|
|
475
|
+
return t6;
|
|
476
|
+
}
|
|
477
|
+
function _temp$2(region) {
|
|
478
|
+
return region.key === "north";
|
|
479
|
+
}
|
|
480
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram, flowBalance } from \"@stealthscale/component-charts\";\n\nimport { MOVES, named, REGIONS } from \"./calls.ts\";\n\nexport function Migration(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n const nodes = named(REGIONS, (key) => t(`names.${key}`));\n const north = flowBalance(nodes, MOVES).find((region) => region.key === \"north\");\n\n return (\n <ChordDiagram\n caption={t(\"migration.caption\", {\n gained: (north?.inflow ?? 0) - (north?.outflow ?? 0),\n name: t(\"names.north\"),\n })}\n flows={MOVES}\n inflowLabel={t(\"migration.in\")}\n label={t(\"migration.label\")}\n nodes={nodes}\n outflowLabel={t(\"migration.out\")}\n />\n );\n}\n";
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/chord-diagram/examples/pair.example.tsx
|
|
483
|
+
var pair_example_exports = /* @__PURE__ */ __exportAll({
|
|
484
|
+
Pair: () => Pair,
|
|
485
|
+
source: () => source$3
|
|
486
|
+
});
|
|
487
|
+
function Pair() {
|
|
488
|
+
const $ = c(18);
|
|
489
|
+
const { t } = useWords("chord-diagram");
|
|
490
|
+
let T0;
|
|
491
|
+
let t0;
|
|
492
|
+
if ($[0] !== t) {
|
|
493
|
+
const there = CALLS.find(_temp$1)?.value;
|
|
494
|
+
const back = CALLS.find(_temp2)?.value;
|
|
495
|
+
T0 = ChordDiagram;
|
|
496
|
+
t0 = t("pair.caption", {
|
|
497
|
+
back,
|
|
498
|
+
there
|
|
499
|
+
});
|
|
500
|
+
$[0] = t;
|
|
501
|
+
$[1] = T0;
|
|
502
|
+
$[2] = t0;
|
|
503
|
+
} else {
|
|
504
|
+
T0 = $[1];
|
|
505
|
+
t0 = $[2];
|
|
506
|
+
}
|
|
507
|
+
let t1;
|
|
508
|
+
if ($[3] !== t) {
|
|
509
|
+
t1 = t("in");
|
|
510
|
+
$[3] = t;
|
|
511
|
+
$[4] = t1;
|
|
512
|
+
} else t1 = $[4];
|
|
513
|
+
let t2;
|
|
514
|
+
if ($[5] !== t) {
|
|
515
|
+
t2 = t("services.label");
|
|
516
|
+
$[5] = t;
|
|
517
|
+
$[6] = t2;
|
|
518
|
+
} else t2 = $[6];
|
|
519
|
+
let t3;
|
|
520
|
+
if ($[7] !== t) {
|
|
521
|
+
t3 = named(SERVICES, (key) => t(`names.${key}`));
|
|
522
|
+
$[7] = t;
|
|
523
|
+
$[8] = t3;
|
|
524
|
+
} else t3 = $[8];
|
|
525
|
+
let t4;
|
|
526
|
+
if ($[9] !== t) {
|
|
527
|
+
t4 = t("out");
|
|
528
|
+
$[9] = t;
|
|
529
|
+
$[10] = t4;
|
|
530
|
+
} else t4 = $[10];
|
|
531
|
+
let t5;
|
|
532
|
+
if ($[11] !== T0 || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
|
|
533
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
534
|
+
caption: t0,
|
|
535
|
+
defaultIndex: 1,
|
|
536
|
+
flows: CALLS,
|
|
537
|
+
inflowLabel: t1,
|
|
538
|
+
label: t2,
|
|
539
|
+
nodes: t3,
|
|
540
|
+
outflowLabel: t4
|
|
541
|
+
});
|
|
542
|
+
$[11] = T0;
|
|
543
|
+
$[12] = t0;
|
|
544
|
+
$[13] = t1;
|
|
545
|
+
$[14] = t2;
|
|
546
|
+
$[15] = t3;
|
|
547
|
+
$[16] = t4;
|
|
548
|
+
$[17] = t5;
|
|
549
|
+
} else t5 = $[17];
|
|
550
|
+
return t5;
|
|
551
|
+
}
|
|
552
|
+
function _temp2(flow_0) {
|
|
553
|
+
return flow_0.from === "auth" && flow_0.to === "api";
|
|
554
|
+
}
|
|
555
|
+
function _temp$1(flow) {
|
|
556
|
+
return flow.from === "api" && flow.to === "auth";
|
|
557
|
+
}
|
|
558
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram } from \"@stealthscale/component-charts\";\n\nimport { CALLS, named, SERVICES } from \"./calls.ts\";\n\nexport function Pair(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n const there = CALLS.find((flow) => flow.from === \"api\" && flow.to === \"auth\")?.value;\n const back = CALLS.find((flow) => flow.from === \"auth\" && flow.to === \"api\")?.value;\n\n return (\n <ChordDiagram\n caption={t(\"pair.caption\", { back, there })}\n defaultIndex={1}\n flows={CALLS}\n inflowLabel={t(\"in\")}\n label={t(\"services.label\")}\n nodes={named(SERVICES, (key) => t(`names.${key}`))}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/chord-diagram/examples/palette.example.tsx
|
|
561
|
+
var palette_example_exports = /* @__PURE__ */ __exportAll({
|
|
562
|
+
Palette: () => Palette,
|
|
563
|
+
source: () => source$2
|
|
564
|
+
});
|
|
565
|
+
function Palette() {
|
|
566
|
+
const $ = c(16);
|
|
567
|
+
const { t } = useWords("chord-diagram");
|
|
568
|
+
let t0;
|
|
569
|
+
if ($[0] !== t) {
|
|
570
|
+
t0 = t("palette.caption");
|
|
571
|
+
$[0] = t;
|
|
572
|
+
$[1] = t0;
|
|
573
|
+
} else t0 = $[1];
|
|
574
|
+
let t1;
|
|
575
|
+
if ($[2] !== t) {
|
|
576
|
+
t1 = t("in");
|
|
577
|
+
$[2] = t;
|
|
578
|
+
$[3] = t1;
|
|
579
|
+
} else t1 = $[3];
|
|
580
|
+
let t2;
|
|
581
|
+
if ($[4] !== t) {
|
|
582
|
+
t2 = t("services.label");
|
|
583
|
+
$[4] = t;
|
|
584
|
+
$[5] = t2;
|
|
585
|
+
} else t2 = $[5];
|
|
586
|
+
let t3;
|
|
587
|
+
if ($[6] !== t) {
|
|
588
|
+
t3 = named(SERVICES, (key) => t(`names.${key}`), {
|
|
589
|
+
api: "teal",
|
|
590
|
+
auth: "purple",
|
|
591
|
+
billing: "orange",
|
|
592
|
+
search: "pink"
|
|
593
|
+
});
|
|
594
|
+
$[6] = t;
|
|
595
|
+
$[7] = t3;
|
|
596
|
+
} else t3 = $[7];
|
|
597
|
+
let t4;
|
|
598
|
+
if ($[8] !== t) {
|
|
599
|
+
t4 = t("out");
|
|
600
|
+
$[8] = t;
|
|
601
|
+
$[9] = t4;
|
|
602
|
+
} else t4 = $[9];
|
|
603
|
+
let t5;
|
|
604
|
+
if ($[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
|
|
605
|
+
t5 = /* @__PURE__ */ jsx(ChordDiagram, {
|
|
606
|
+
caption: t0,
|
|
607
|
+
flows: CALLS,
|
|
608
|
+
inflowLabel: t1,
|
|
609
|
+
label: t2,
|
|
610
|
+
nodes: t3,
|
|
611
|
+
outflowLabel: t4
|
|
612
|
+
});
|
|
613
|
+
$[10] = t0;
|
|
614
|
+
$[11] = t1;
|
|
615
|
+
$[12] = t2;
|
|
616
|
+
$[13] = t3;
|
|
617
|
+
$[14] = t4;
|
|
618
|
+
$[15] = t5;
|
|
619
|
+
} else t5 = $[15];
|
|
620
|
+
return t5;
|
|
621
|
+
}
|
|
622
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram } from \"@stealthscale/component-charts\";\n\nimport { CALLS, named, SERVICES } from \"./calls.ts\";\n\nexport function Palette(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n\n return (\n <ChordDiagram\n caption={t(\"palette.caption\")}\n flows={CALLS}\n inflowLabel={t(\"in\")}\n label={t(\"services.label\")}\n nodes={named(SERVICES, (key) => t(`names.${key}`), {\n api: \"teal\",\n auth: \"purple\",\n billing: \"orange\",\n search: \"pink\",\n })}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/chord-diagram/examples/quiet.example.tsx
|
|
625
|
+
var quiet_example_exports = /* @__PURE__ */ __exportAll({
|
|
626
|
+
Quiet: () => Quiet,
|
|
627
|
+
source: () => source$1
|
|
628
|
+
});
|
|
629
|
+
function Quiet() {
|
|
630
|
+
const $ = c(14);
|
|
631
|
+
const { t } = useWords("chord-diagram");
|
|
632
|
+
let t0;
|
|
633
|
+
if ($[0] !== t) {
|
|
634
|
+
t0 = t("quiet.caption");
|
|
635
|
+
$[0] = t;
|
|
636
|
+
$[1] = t0;
|
|
637
|
+
} else t0 = $[1];
|
|
638
|
+
let t1;
|
|
639
|
+
if ($[2] !== t) {
|
|
640
|
+
t1 = t("quiet.empty");
|
|
641
|
+
$[2] = t;
|
|
642
|
+
$[3] = t1;
|
|
643
|
+
} else t1 = $[3];
|
|
644
|
+
let t2;
|
|
645
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
646
|
+
t2 = [];
|
|
647
|
+
$[4] = t2;
|
|
648
|
+
} else t2 = $[4];
|
|
649
|
+
let t3;
|
|
650
|
+
if ($[5] !== t) {
|
|
651
|
+
t3 = t("services.label");
|
|
652
|
+
$[5] = t;
|
|
653
|
+
$[6] = t3;
|
|
654
|
+
} else t3 = $[6];
|
|
655
|
+
let t4;
|
|
656
|
+
if ($[7] !== t) {
|
|
657
|
+
t4 = named(SERVICES, (key) => t(`names.${key}`));
|
|
658
|
+
$[7] = t;
|
|
659
|
+
$[8] = t4;
|
|
660
|
+
} else t4 = $[8];
|
|
661
|
+
let t5;
|
|
662
|
+
if ($[9] !== t0 || $[10] !== t1 || $[11] !== t3 || $[12] !== t4) {
|
|
663
|
+
t5 = /* @__PURE__ */ jsx(ChordDiagram, {
|
|
664
|
+
caption: t0,
|
|
665
|
+
empty: t1,
|
|
666
|
+
flows: t2,
|
|
667
|
+
label: t3,
|
|
668
|
+
nodes: t4
|
|
669
|
+
});
|
|
670
|
+
$[9] = t0;
|
|
671
|
+
$[10] = t1;
|
|
672
|
+
$[11] = t3;
|
|
673
|
+
$[12] = t4;
|
|
674
|
+
$[13] = t5;
|
|
675
|
+
} else t5 = $[13];
|
|
676
|
+
return t5;
|
|
677
|
+
}
|
|
678
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram } from \"@stealthscale/component-charts\";\n\nimport { named, SERVICES } from \"./calls.ts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n\n return (\n <ChordDiagram\n caption={t(\"quiet.caption\")}\n empty={t(\"quiet.empty\")}\n flows={[]}\n label={t(\"services.label\")}\n nodes={named(SERVICES, (key) => t(`names.${key}`))}\n />\n );\n}\n";
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/chord-diagram/examples/services.example.tsx
|
|
681
|
+
var services_example_exports = /* @__PURE__ */ __exportAll({
|
|
682
|
+
Services: () => Services,
|
|
683
|
+
source: () => source
|
|
684
|
+
});
|
|
685
|
+
function Services() {
|
|
686
|
+
const $ = c(17);
|
|
687
|
+
const { t } = useWords("chord-diagram");
|
|
688
|
+
let T0;
|
|
689
|
+
let nodes;
|
|
690
|
+
let t0;
|
|
691
|
+
if ($[0] !== t) {
|
|
692
|
+
nodes = named(SERVICES, (key) => t(`names.${key}`));
|
|
693
|
+
const [loudest] = flowBalance(nodes, CALLS).toSorted(_temp);
|
|
694
|
+
T0 = ChordDiagram;
|
|
695
|
+
t0 = t("services.caption", {
|
|
696
|
+
name: t(`names.${loudest?.key ?? ""}`),
|
|
697
|
+
received: loudest?.inflow,
|
|
698
|
+
sent: loudest?.outflow
|
|
699
|
+
});
|
|
700
|
+
$[0] = t;
|
|
701
|
+
$[1] = T0;
|
|
702
|
+
$[2] = nodes;
|
|
703
|
+
$[3] = t0;
|
|
704
|
+
} else {
|
|
705
|
+
T0 = $[1];
|
|
706
|
+
nodes = $[2];
|
|
707
|
+
t0 = $[3];
|
|
708
|
+
}
|
|
709
|
+
let t1;
|
|
710
|
+
if ($[4] !== t) {
|
|
711
|
+
t1 = t("in");
|
|
712
|
+
$[4] = t;
|
|
713
|
+
$[5] = t1;
|
|
714
|
+
} else t1 = $[5];
|
|
715
|
+
let t2;
|
|
716
|
+
if ($[6] !== t) {
|
|
717
|
+
t2 = t("services.label");
|
|
718
|
+
$[6] = t;
|
|
719
|
+
$[7] = t2;
|
|
720
|
+
} else t2 = $[7];
|
|
721
|
+
let t3;
|
|
722
|
+
if ($[8] !== t) {
|
|
723
|
+
t3 = t("out");
|
|
724
|
+
$[8] = t;
|
|
725
|
+
$[9] = t3;
|
|
726
|
+
} else t3 = $[9];
|
|
727
|
+
let t4;
|
|
728
|
+
if ($[10] !== T0 || $[11] !== nodes || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3) {
|
|
729
|
+
t4 = /* @__PURE__ */ jsx(T0, {
|
|
730
|
+
caption: t0,
|
|
731
|
+
flows: CALLS,
|
|
732
|
+
inflowLabel: t1,
|
|
733
|
+
label: t2,
|
|
734
|
+
nodes,
|
|
735
|
+
outflowLabel: t3
|
|
736
|
+
});
|
|
737
|
+
$[10] = T0;
|
|
738
|
+
$[11] = nodes;
|
|
739
|
+
$[12] = t0;
|
|
740
|
+
$[13] = t1;
|
|
741
|
+
$[14] = t2;
|
|
742
|
+
$[15] = t3;
|
|
743
|
+
$[16] = t4;
|
|
744
|
+
} else t4 = $[16];
|
|
745
|
+
return t4;
|
|
746
|
+
}
|
|
747
|
+
function _temp(first, second) {
|
|
748
|
+
return second.outflow - first.outflow;
|
|
749
|
+
}
|
|
750
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ChordDiagram, flowBalance } from \"@stealthscale/component-charts\";\n\nimport { CALLS, named, SERVICES } from \"./calls.ts\";\n\nexport function Services(): ReactElement {\n const { t } = useWords(\"chord-diagram\");\n const nodes = named(SERVICES, (key) => t(`names.${key}`));\n const [loudest] = flowBalance(nodes, CALLS).toSorted(\n (first, second) => second.outflow - first.outflow,\n );\n\n return (\n <ChordDiagram\n caption={t(\"services.caption\", {\n name: t(`names.${loudest?.key ?? \"\"}`),\n received: loudest?.inflow,\n sent: loudest?.outflow,\n })}\n flows={CALLS}\n inflowLabel={t(\"in\")}\n label={t(\"services.label\")}\n nodes={nodes}\n outflowLabel={t(\"out\")}\n />\n );\n}\n";
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region src/chord-diagram/chord-diagram.specimen.tsx
|
|
753
|
+
/**
|
|
754
|
+
* Catalogue page for the chord diagram.
|
|
755
|
+
*
|
|
756
|
+
* @remarks
|
|
757
|
+
* The chord diagram has no recipe of its own: the chart's recipe styles its figure, so every
|
|
758
|
+
* scene is hand-written. The scenes render an hour of calls between five services with the
|
|
759
|
+
* loudest in the caption, the readout at a pair, a decade of moves between regions, a service
|
|
760
|
+
* that calls itself, an audit log that only receives, the exported layout, stated palettes, the
|
|
761
|
+
* calls at a phone's width, and a diagram without flows. Every scene renders a component from
|
|
762
|
+
* `examples/` and shows that file as its source. The words are keys under `chord-diagram` in
|
|
763
|
+
* `locales/en/specimen/chord-diagram.json`.
|
|
764
|
+
*/
|
|
765
|
+
/**
|
|
766
|
+
* Hand-written scene for an hour of calls between five services.
|
|
767
|
+
*/
|
|
768
|
+
const called = {
|
|
769
|
+
about: "chord-diagram.services.about",
|
|
770
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
771
|
+
size: "md",
|
|
772
|
+
children: /* @__PURE__ */ jsx(Services, {})
|
|
773
|
+
}),
|
|
774
|
+
example: services_example_exports,
|
|
775
|
+
title: "chord-diagram.services.title"
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Hand-written scene for the readout at a pair of services.
|
|
779
|
+
*/
|
|
780
|
+
const paired = {
|
|
781
|
+
about: "chord-diagram.pair.about",
|
|
782
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
783
|
+
size: "md",
|
|
784
|
+
children: /* @__PURE__ */ jsx(Pair, {})
|
|
785
|
+
}),
|
|
786
|
+
example: pair_example_exports,
|
|
787
|
+
title: "chord-diagram.pair.title"
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* Hand-written scene for a decade of moves between four regions.
|
|
791
|
+
*/
|
|
792
|
+
const moved = {
|
|
793
|
+
about: "chord-diagram.migration.about",
|
|
794
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
795
|
+
size: "md",
|
|
796
|
+
children: /* @__PURE__ */ jsx(Migration, {})
|
|
797
|
+
}),
|
|
798
|
+
example: migration_example_exports,
|
|
799
|
+
title: "chord-diagram.migration.title"
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Hand-written scene for a service that calls itself.
|
|
803
|
+
*/
|
|
804
|
+
const requeued = {
|
|
805
|
+
about: "chord-diagram.internal.about",
|
|
806
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
807
|
+
size: "md",
|
|
808
|
+
children: /* @__PURE__ */ jsx(Internal, {})
|
|
809
|
+
}),
|
|
810
|
+
example: internal_example_exports,
|
|
811
|
+
title: "chord-diagram.internal.title"
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* Hand-written scene for an audit log that only receives.
|
|
815
|
+
*/
|
|
816
|
+
const logged = {
|
|
817
|
+
about: "chord-diagram.audit.about",
|
|
818
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
819
|
+
size: "md",
|
|
820
|
+
children: /* @__PURE__ */ jsx(Audit, {})
|
|
821
|
+
}),
|
|
822
|
+
example: audit_example_exports,
|
|
823
|
+
title: "chord-diagram.audit.title"
|
|
824
|
+
};
|
|
825
|
+
/**
|
|
826
|
+
* Hand-written scene for a caption read from the exported layout.
|
|
827
|
+
*/
|
|
828
|
+
const laid = {
|
|
829
|
+
about: "chord-diagram.layout.about",
|
|
830
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
831
|
+
size: "md",
|
|
832
|
+
children: /* @__PURE__ */ jsx(Layout, {})
|
|
833
|
+
}),
|
|
834
|
+
example: layout_example_exports,
|
|
835
|
+
title: "chord-diagram.layout.title"
|
|
836
|
+
};
|
|
837
|
+
/**
|
|
838
|
+
* Hand-written scene for the services in stated palettes.
|
|
839
|
+
*/
|
|
840
|
+
const tinted = {
|
|
841
|
+
about: "chord-diagram.palette.about",
|
|
842
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
843
|
+
size: "md",
|
|
844
|
+
children: /* @__PURE__ */ jsx(Palette, {})
|
|
845
|
+
}),
|
|
846
|
+
example: palette_example_exports,
|
|
847
|
+
title: "chord-diagram.palette.title"
|
|
848
|
+
};
|
|
849
|
+
/**
|
|
850
|
+
* Hand-written scene for the calls at a phone's width.
|
|
851
|
+
*/
|
|
852
|
+
const narrow = {
|
|
853
|
+
about: "chord-diagram.narrow.about",
|
|
854
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
855
|
+
size: "xs",
|
|
856
|
+
children: /* @__PURE__ */ jsx(Services, {})
|
|
857
|
+
}),
|
|
858
|
+
example: services_example_exports,
|
|
859
|
+
title: "chord-diagram.narrow.title"
|
|
860
|
+
};
|
|
861
|
+
/**
|
|
862
|
+
* Hand-written scene for a chord diagram without flows.
|
|
863
|
+
*/
|
|
864
|
+
const empty = {
|
|
865
|
+
about: "chord-diagram.quiet.about",
|
|
866
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
867
|
+
size: "md",
|
|
868
|
+
children: /* @__PURE__ */ jsx(Quiet, {})
|
|
869
|
+
}),
|
|
870
|
+
example: quiet_example_exports,
|
|
871
|
+
title: "chord-diagram.quiet.title"
|
|
872
|
+
};
|
|
873
|
+
var chord_diagram_specimen_default = specimen({
|
|
874
|
+
about: "chord-diagram.about",
|
|
875
|
+
id: "components/charts/chord-diagram",
|
|
876
|
+
imports: "import { ChordDiagram } from \"@stealthscale/component-charts\";",
|
|
877
|
+
scenes: [
|
|
878
|
+
called,
|
|
879
|
+
paired,
|
|
880
|
+
moved,
|
|
881
|
+
requeued,
|
|
882
|
+
logged,
|
|
883
|
+
laid,
|
|
884
|
+
tinted,
|
|
885
|
+
narrow,
|
|
886
|
+
empty
|
|
887
|
+
],
|
|
888
|
+
title: "chord-diagram.title"
|
|
889
|
+
});
|
|
890
|
+
//#endregion
|
|
891
|
+
export { called, chord_diagram_specimen_default as default, empty, laid, logged, moved, narrow, paired, requeued, tinted };
|