@sentropic/design-system-svelte 0.27.0 → 0.29.0
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/ChordDiagram.svelte +396 -0
- package/dist/ChordDiagram.svelte.d.ts +41 -0
- package/dist/ChordDiagram.svelte.d.ts.map +1 -0
- package/dist/PackedBubblesChart.svelte +322 -0
- package/dist/PackedBubblesChart.svelte.d.ts +38 -0
- package/dist/PackedBubblesChart.svelte.d.ts.map +1 -0
- package/dist/RoseChart.svelte +291 -0
- package/dist/RoseChart.svelte.d.ts +49 -0
- package/dist/RoseChart.svelte.d.ts.map +1 -0
- package/dist/ViolinChart.svelte +371 -0
- package/dist/ViolinChart.svelte.d.ts +53 -0
- package/dist/ViolinChart.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* ChordDiagram - API canonique (référence Svelte, React/Vue doivent s'aligner)
|
|
4
|
+
*
|
|
5
|
+
* Représente des flux pondérés entre nœuds répartis sur un cercle. Chaque nœud
|
|
6
|
+
* occupe un arc proportionnel à la somme de ses flux (entrants + sortants) ;
|
|
7
|
+
* chaque flux est un ruban (path SVG quadratique) reliant les deux arcs.
|
|
8
|
+
*
|
|
9
|
+
* Props obligatoires :
|
|
10
|
+
* data ChordDiagramFlow[] - liste de flux {from, to, value}
|
|
11
|
+
* from/to = identifiants de nœuds (string) ;
|
|
12
|
+
* un nœud est créé pour chaque identifiant cité.
|
|
13
|
+
* label string - aria-label du graphique
|
|
14
|
+
*
|
|
15
|
+
* Props optionnelles :
|
|
16
|
+
* labels? Record<string,string> - libellés d'affichage par identifiant de
|
|
17
|
+
* nœud (sinon l'identifiant est utilisé)
|
|
18
|
+
* width number (défaut 360) - largeur du viewBox en px
|
|
19
|
+
* height number (défaut 360) - hauteur du viewBox en px
|
|
20
|
+
* class string - classe CSS supplémentaire
|
|
21
|
+
*
|
|
22
|
+
* Garde : seuls les flux dont `value` est finie et > 0 sont pris en compte.
|
|
23
|
+
* Les flux NaN / Infinity / négatifs sont ignorés silencieusement (pas de crash).
|
|
24
|
+
*/
|
|
25
|
+
export type ChordDiagramTone =
|
|
26
|
+
| "category1"
|
|
27
|
+
| "category2"
|
|
28
|
+
| "category3"
|
|
29
|
+
| "category4"
|
|
30
|
+
| "category5"
|
|
31
|
+
| "category6"
|
|
32
|
+
| "category7"
|
|
33
|
+
| "category8";
|
|
34
|
+
|
|
35
|
+
export type ChordDiagramFlow = {
|
|
36
|
+
from: string;
|
|
37
|
+
to: string;
|
|
38
|
+
value: number;
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<script lang="ts">
|
|
43
|
+
import ChartDataList from "./ChartDataList.svelte";
|
|
44
|
+
import { contrastTextForTone } from "./chartContrast.js";
|
|
45
|
+
|
|
46
|
+
type ChordDiagramProps = {
|
|
47
|
+
data: ChordDiagramFlow[];
|
|
48
|
+
label: string;
|
|
49
|
+
labels?: Record<string, string>;
|
|
50
|
+
width?: number;
|
|
51
|
+
height?: number;
|
|
52
|
+
class?: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
let {
|
|
56
|
+
data,
|
|
57
|
+
label,
|
|
58
|
+
labels,
|
|
59
|
+
width = 360,
|
|
60
|
+
height = 360,
|
|
61
|
+
class: className
|
|
62
|
+
}: ChordDiagramProps = $props();
|
|
63
|
+
|
|
64
|
+
const TONES = [
|
|
65
|
+
"category1",
|
|
66
|
+
"category2",
|
|
67
|
+
"category3",
|
|
68
|
+
"category4",
|
|
69
|
+
"category5",
|
|
70
|
+
"category6",
|
|
71
|
+
"category7",
|
|
72
|
+
"category8"
|
|
73
|
+
] as const;
|
|
74
|
+
|
|
75
|
+
const GAP = 0.04; // espace angulaire entre arcs (rad)
|
|
76
|
+
const ARC_WIDTH = 14; // épaisseur de l'anneau d'arcs
|
|
77
|
+
|
|
78
|
+
function magnitude(value: number): number {
|
|
79
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function displayLabel(id: string): string {
|
|
83
|
+
return labels?.[id] ?? id;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function polar(cx: number, cy: number, radius: number, angle: number) {
|
|
87
|
+
return { x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function arcPath(cx: number, cy: number, inner: number, outer: number, start: number, end: number): string {
|
|
91
|
+
const large = end - start > Math.PI ? 1 : 0;
|
|
92
|
+
const o0 = polar(cx, cy, outer, start);
|
|
93
|
+
const o1 = polar(cx, cy, outer, end);
|
|
94
|
+
const i1 = polar(cx, cy, inner, end);
|
|
95
|
+
const i0 = polar(cx, cy, inner, start);
|
|
96
|
+
return `M ${o0.x} ${o0.y} A ${outer} ${outer} 0 ${large} 1 ${o1.x} ${o1.y} L ${i1.x} ${i1.y} A ${inner} ${inner} 0 ${large} 0 ${i0.x} ${i0.y} Z`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let hoveredFlowIndex: number | null = $state(null);
|
|
100
|
+
|
|
101
|
+
const layout = $derived.by(() => {
|
|
102
|
+
const cx = width / 2;
|
|
103
|
+
const cy = height / 2;
|
|
104
|
+
const outer = Math.max(Math.min(width, height) / 2 - 6, 1);
|
|
105
|
+
const inner = Math.max(outer - ARC_WIDTH, 1);
|
|
106
|
+
const ribbonRadius = Math.max(inner - 2, 0);
|
|
107
|
+
|
|
108
|
+
// Flux valides + ordre d'apparition des nœuds (stable).
|
|
109
|
+
const flows = data
|
|
110
|
+
.map((flow, index) => ({ flow, index, value: magnitude(flow.value) }))
|
|
111
|
+
.filter((entry) => entry.value > 0);
|
|
112
|
+
|
|
113
|
+
const order: string[] = [];
|
|
114
|
+
const total = new Map<string, number>();
|
|
115
|
+
for (const { flow, value } of flows) {
|
|
116
|
+
for (const id of [flow.from, flow.to]) {
|
|
117
|
+
if (!total.has(id)) {
|
|
118
|
+
total.set(id, 0);
|
|
119
|
+
order.push(id);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
total.set(flow.from, (total.get(flow.from) ?? 0) + value);
|
|
123
|
+
total.set(flow.to, (total.get(flow.to) ?? 0) + value);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const grandTotal = order.reduce((sum, id) => sum + (total.get(id) ?? 0), 0);
|
|
127
|
+
if (order.length === 0 || grandTotal <= 0) {
|
|
128
|
+
return { cx, cy, inner, outer, arcs: [], ribbons: [] };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Répartition angulaire : part proportionnelle - gap par nœud.
|
|
132
|
+
const totalGap = GAP * order.length;
|
|
133
|
+
const usable = Math.max(Math.PI * 2 - totalGap, 0.0001);
|
|
134
|
+
type ArcInfo = {
|
|
135
|
+
id: string;
|
|
136
|
+
tone: ChordDiagramTone;
|
|
137
|
+
start: number;
|
|
138
|
+
end: number;
|
|
139
|
+
mid: number;
|
|
140
|
+
cursor: number; // avance pour positionner les rubans
|
|
141
|
+
};
|
|
142
|
+
const arcMap = new Map<string, ArcInfo>();
|
|
143
|
+
const arcs: Array<{
|
|
144
|
+
id: string;
|
|
145
|
+
tone: ChordDiagramTone;
|
|
146
|
+
value: number;
|
|
147
|
+
span: number;
|
|
148
|
+
path: string;
|
|
149
|
+
labelX: number;
|
|
150
|
+
labelY: number;
|
|
151
|
+
labelAngle: number;
|
|
152
|
+
textColor: string;
|
|
153
|
+
}> = [];
|
|
154
|
+
|
|
155
|
+
let angle = -Math.PI / 2;
|
|
156
|
+
order.forEach((id, index) => {
|
|
157
|
+
const span = (usable * (total.get(id) ?? 0)) / grandTotal;
|
|
158
|
+
const start = angle + GAP / 2;
|
|
159
|
+
const end = start + span;
|
|
160
|
+
angle = end + GAP / 2;
|
|
161
|
+
const tone = TONES[index % TONES.length];
|
|
162
|
+
const mid = (start + end) / 2;
|
|
163
|
+
arcMap.set(id, { id, tone, start, end, mid, cursor: start });
|
|
164
|
+
const labelRadius = (inner + outer) / 2;
|
|
165
|
+
const labelPoint = polar(cx, cy, labelRadius, mid);
|
|
166
|
+
arcs.push({
|
|
167
|
+
id,
|
|
168
|
+
tone,
|
|
169
|
+
value: total.get(id) ?? 0,
|
|
170
|
+
span,
|
|
171
|
+
path: arcPath(cx, cy, inner, outer, start, end),
|
|
172
|
+
labelX: labelPoint.x,
|
|
173
|
+
labelY: labelPoint.y,
|
|
174
|
+
labelAngle: mid,
|
|
175
|
+
textColor: contrastTextForTone(tone)
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const maxValue = Math.max(1, ...flows.map((entry) => entry.value));
|
|
180
|
+
const ribbons = flows.map(({ flow, value, index }) => {
|
|
181
|
+
const source = arcMap.get(flow.from)!;
|
|
182
|
+
const target = arcMap.get(flow.to)!;
|
|
183
|
+
const sourceSpan = (usable * value) / grandTotal;
|
|
184
|
+
const targetSpan = (usable * value) / grandTotal;
|
|
185
|
+
const s0 = source.cursor;
|
|
186
|
+
const s1 = source.cursor + sourceSpan;
|
|
187
|
+
source.cursor = s1;
|
|
188
|
+
const t0 = target.cursor;
|
|
189
|
+
const t1 = target.cursor + targetSpan;
|
|
190
|
+
target.cursor = t1;
|
|
191
|
+
|
|
192
|
+
const ps0 = polar(cx, cy, ribbonRadius, s0);
|
|
193
|
+
const ps1 = polar(cx, cy, ribbonRadius, s1);
|
|
194
|
+
const pt0 = polar(cx, cy, ribbonRadius, t0);
|
|
195
|
+
const pt1 = polar(cx, cy, ribbonRadius, t1);
|
|
196
|
+
|
|
197
|
+
// Ruban : deux courbes quadratiques passant par le centre.
|
|
198
|
+
const path =
|
|
199
|
+
`M ${ps0.x} ${ps0.y} ` +
|
|
200
|
+
`Q ${cx} ${cy} ${pt1.x} ${pt1.y} ` +
|
|
201
|
+
`A ${ribbonRadius} ${ribbonRadius} 0 0 1 ${pt0.x} ${pt0.y} ` +
|
|
202
|
+
`Q ${cx} ${cy} ${ps1.x} ${ps1.y} ` +
|
|
203
|
+
`A ${ribbonRadius} ${ribbonRadius} 0 0 0 ${ps0.x} ${ps0.y} Z`;
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
index,
|
|
207
|
+
from: flow.from,
|
|
208
|
+
to: flow.to,
|
|
209
|
+
value,
|
|
210
|
+
tone: source.tone,
|
|
211
|
+
strokeWidth: Math.max(1, (value / maxValue) * 4),
|
|
212
|
+
path,
|
|
213
|
+
midX: cx,
|
|
214
|
+
midY: cy
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return { cx, cy, inner, outer, arcs, ribbons };
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const dataValueItems = $derived(
|
|
222
|
+
data
|
|
223
|
+
.filter((flow) => magnitude(flow.value) > 0)
|
|
224
|
+
.map((flow) => `${displayLabel(flow.from)} -> ${displayLabel(flow.to)}: ${flow.value}`)
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
function handleVisualPointerMove(event: PointerEvent) {
|
|
228
|
+
const target = event.target;
|
|
229
|
+
if (!(target instanceof Element)) {
|
|
230
|
+
hoveredFlowIndex = null;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const index = Number(target.getAttribute("data-flow-index"));
|
|
234
|
+
hoveredFlowIndex = Number.isInteger(index) ? index : null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const classes = () => ["st-chordDiagram", className].filter(Boolean).join(" ");
|
|
238
|
+
</script>
|
|
239
|
+
|
|
240
|
+
<div class={classes()}>
|
|
241
|
+
<div
|
|
242
|
+
class="st-chordDiagram__visual"
|
|
243
|
+
role="img"
|
|
244
|
+
aria-label={label}
|
|
245
|
+
onpointermove={handleVisualPointerMove}
|
|
246
|
+
onpointerleave={() => (hoveredFlowIndex = null)}
|
|
247
|
+
>
|
|
248
|
+
<svg
|
|
249
|
+
viewBox="0 0 {width} {height}"
|
|
250
|
+
preserveAspectRatio="xMidYMid meet"
|
|
251
|
+
width="100%"
|
|
252
|
+
height="100%"
|
|
253
|
+
focusable="false"
|
|
254
|
+
aria-hidden="true"
|
|
255
|
+
>
|
|
256
|
+
<g class="st-chordDiagram__ribbons">
|
|
257
|
+
{#each layout.ribbons as ribbon (ribbon.index)}
|
|
258
|
+
<path
|
|
259
|
+
class="st-chordDiagram__ribbon st-chordDiagram__ribbon--{ribbon.tone}"
|
|
260
|
+
class:st-chordDiagram__ribbon--dim={hoveredFlowIndex !== null && hoveredFlowIndex !== ribbon.index}
|
|
261
|
+
d={ribbon.path}
|
|
262
|
+
stroke-width={ribbon.strokeWidth}
|
|
263
|
+
data-flow-index={ribbon.index}
|
|
264
|
+
/>
|
|
265
|
+
{/each}
|
|
266
|
+
</g>
|
|
267
|
+
|
|
268
|
+
<g class="st-chordDiagram__arcs">
|
|
269
|
+
{#each layout.arcs as arc (arc.id)}
|
|
270
|
+
<path
|
|
271
|
+
class="st-chordDiagram__arc st-chordDiagram__arc--{arc.tone}"
|
|
272
|
+
d={arc.path}
|
|
273
|
+
/>
|
|
274
|
+
{#if arc.span > 0.34}
|
|
275
|
+
<text
|
|
276
|
+
class="st-chordDiagram__arcLabel"
|
|
277
|
+
x={arc.labelX}
|
|
278
|
+
y={arc.labelY}
|
|
279
|
+
text-anchor="middle"
|
|
280
|
+
dominant-baseline="middle"
|
|
281
|
+
fill={arc.textColor}
|
|
282
|
+
>
|
|
283
|
+
{displayLabel(arc.id)}
|
|
284
|
+
</text>
|
|
285
|
+
{/if}
|
|
286
|
+
{/each}
|
|
287
|
+
</g>
|
|
288
|
+
</svg>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<ChartDataList {label} items={dataValueItems} />
|
|
292
|
+
|
|
293
|
+
{#if hoveredFlowIndex !== null && layout.ribbons.find((r) => r.index === hoveredFlowIndex)}
|
|
294
|
+
{@const ribbon = layout.ribbons.find((r) => r.index === hoveredFlowIndex)!}
|
|
295
|
+
<div
|
|
296
|
+
class="st-chordDiagram__tooltip"
|
|
297
|
+
role="presentation"
|
|
298
|
+
style="left: {(ribbon.midX / width) * 100}%; top: {(ribbon.midY / height) * 100}%"
|
|
299
|
+
>
|
|
300
|
+
<span class="st-chordDiagram__tooltipLabel">{displayLabel(ribbon.from)} -> {displayLabel(ribbon.to)}</span>
|
|
301
|
+
<span class="st-chordDiagram__tooltipValue">{ribbon.value}</span>
|
|
302
|
+
</div>
|
|
303
|
+
{/if}
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<style>
|
|
307
|
+
.st-chordDiagram {
|
|
308
|
+
color: var(--st-semantic-text-secondary);
|
|
309
|
+
display: block;
|
|
310
|
+
font-family: inherit;
|
|
311
|
+
max-width: 100%;
|
|
312
|
+
position: relative;
|
|
313
|
+
width: 100%;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.st-chordDiagram svg,
|
|
317
|
+
.st-chordDiagram__visual {
|
|
318
|
+
display: block;
|
|
319
|
+
overflow: visible;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.st-chordDiagram__ribbon {
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
fill-opacity: 0.4;
|
|
325
|
+
stroke-opacity: 0.55;
|
|
326
|
+
transition: opacity 120ms ease;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.st-chordDiagram__ribbon:hover {
|
|
330
|
+
fill-opacity: 0.62;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.st-chordDiagram__ribbon--dim {
|
|
334
|
+
opacity: 0.18;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@media (prefers-reduced-motion: reduce) {
|
|
338
|
+
.st-chordDiagram__ribbon {
|
|
339
|
+
transition: none;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.st-chordDiagram__arc {
|
|
344
|
+
stroke: var(--st-semantic-surface-default, Canvas);
|
|
345
|
+
stroke-width: 1;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.st-chordDiagram__arc--category1,
|
|
349
|
+
.st-chordDiagram__ribbon--category1 { fill: var(--st-semantic-data-category1); stroke: var(--st-semantic-data-category1); }
|
|
350
|
+
.st-chordDiagram__arc--category2,
|
|
351
|
+
.st-chordDiagram__ribbon--category2 { fill: var(--st-semantic-data-category2); stroke: var(--st-semantic-data-category2); }
|
|
352
|
+
.st-chordDiagram__arc--category3,
|
|
353
|
+
.st-chordDiagram__ribbon--category3 { fill: var(--st-semantic-data-category3); stroke: var(--st-semantic-data-category3); }
|
|
354
|
+
.st-chordDiagram__arc--category4,
|
|
355
|
+
.st-chordDiagram__ribbon--category4 { fill: var(--st-semantic-data-category4); stroke: var(--st-semantic-data-category4); }
|
|
356
|
+
.st-chordDiagram__arc--category5,
|
|
357
|
+
.st-chordDiagram__ribbon--category5 { fill: var(--st-semantic-data-category5); stroke: var(--st-semantic-data-category5); }
|
|
358
|
+
.st-chordDiagram__arc--category6,
|
|
359
|
+
.st-chordDiagram__ribbon--category6 { fill: var(--st-semantic-data-category6); stroke: var(--st-semantic-data-category6); }
|
|
360
|
+
.st-chordDiagram__arc--category7,
|
|
361
|
+
.st-chordDiagram__ribbon--category7 { fill: var(--st-semantic-data-category7); stroke: var(--st-semantic-data-category7); }
|
|
362
|
+
.st-chordDiagram__arc--category8,
|
|
363
|
+
.st-chordDiagram__ribbon--category8 { fill: var(--st-semantic-data-category8); stroke: var(--st-semantic-data-category8); }
|
|
364
|
+
|
|
365
|
+
.st-chordDiagram__arcLabel {
|
|
366
|
+
/* fill calculé par contrastTextForTone() en inline - pas de couleur fixe */
|
|
367
|
+
font-size: 0.7rem;
|
|
368
|
+
font-weight: 600;
|
|
369
|
+
pointer-events: none;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.st-chordDiagram__tooltip {
|
|
373
|
+
background: var(--st-semantic-surface-inverse);
|
|
374
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
375
|
+
color: var(--st-semantic-text-inverse);
|
|
376
|
+
display: inline-flex;
|
|
377
|
+
flex-direction: column;
|
|
378
|
+
font-size: 0.75rem;
|
|
379
|
+
gap: 0.125rem;
|
|
380
|
+
line-height: 1.2;
|
|
381
|
+
padding: 0.375rem 0.5rem;
|
|
382
|
+
pointer-events: none;
|
|
383
|
+
position: absolute;
|
|
384
|
+
transform: translate(-50%, -115%);
|
|
385
|
+
white-space: nowrap;
|
|
386
|
+
z-index: 1;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.st-chordDiagram__tooltipLabel {
|
|
390
|
+
font-weight: 600;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.st-chordDiagram__tooltipValue {
|
|
394
|
+
opacity: 0.85;
|
|
395
|
+
}
|
|
396
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChordDiagram - API canonique (référence Svelte, React/Vue doivent s'aligner)
|
|
3
|
+
*
|
|
4
|
+
* Représente des flux pondérés entre nœuds répartis sur un cercle. Chaque nœud
|
|
5
|
+
* occupe un arc proportionnel à la somme de ses flux (entrants + sortants) ;
|
|
6
|
+
* chaque flux est un ruban (path SVG quadratique) reliant les deux arcs.
|
|
7
|
+
*
|
|
8
|
+
* Props obligatoires :
|
|
9
|
+
* data ChordDiagramFlow[] - liste de flux {from, to, value}
|
|
10
|
+
* from/to = identifiants de nœuds (string) ;
|
|
11
|
+
* un nœud est créé pour chaque identifiant cité.
|
|
12
|
+
* label string - aria-label du graphique
|
|
13
|
+
*
|
|
14
|
+
* Props optionnelles :
|
|
15
|
+
* labels? Record<string,string> - libellés d'affichage par identifiant de
|
|
16
|
+
* nœud (sinon l'identifiant est utilisé)
|
|
17
|
+
* width number (défaut 360) - largeur du viewBox en px
|
|
18
|
+
* height number (défaut 360) - hauteur du viewBox en px
|
|
19
|
+
* class string - classe CSS supplémentaire
|
|
20
|
+
*
|
|
21
|
+
* Garde : seuls les flux dont `value` est finie et > 0 sont pris en compte.
|
|
22
|
+
* Les flux NaN / Infinity / négatifs sont ignorés silencieusement (pas de crash).
|
|
23
|
+
*/
|
|
24
|
+
export type ChordDiagramTone = "category1" | "category2" | "category3" | "category4" | "category5" | "category6" | "category7" | "category8";
|
|
25
|
+
export type ChordDiagramFlow = {
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
value: number;
|
|
29
|
+
};
|
|
30
|
+
type ChordDiagramProps = {
|
|
31
|
+
data: ChordDiagramFlow[];
|
|
32
|
+
label: string;
|
|
33
|
+
labels?: Record<string, string>;
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
class?: string;
|
|
37
|
+
};
|
|
38
|
+
declare const ChordDiagram: import("svelte").Component<ChordDiagramProps, {}, "">;
|
|
39
|
+
type ChordDiagram = ReturnType<typeof ChordDiagram>;
|
|
40
|
+
export default ChordDiagram;
|
|
41
|
+
//# sourceMappingURL=ChordDiagram.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChordDiagram.svelte.d.ts","sourceRoot":"","sources":["../src/lib/ChordDiagram.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAOF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAsOJ,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|