@sentropic/design-system-svelte 0.34.0 → 0.34.20
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/AppHeader.svelte +159 -1
- package/dist/AppHeader.svelte.d.ts +18 -1
- package/dist/AppHeader.svelte.d.ts.map +1 -1
- package/dist/ArcDiagramChart.svelte +380 -0
- package/dist/ArcDiagramChart.svelte.d.ts +43 -0
- package/dist/ArcDiagramChart.svelte.d.ts.map +1 -0
- package/dist/AreaRangeChart.svelte +487 -0
- package/dist/AreaRangeChart.svelte.d.ts +38 -0
- package/dist/AreaRangeChart.svelte.d.ts.map +1 -0
- package/dist/AreaSplineRangeChart.svelte +478 -0
- package/dist/AreaSplineRangeChart.svelte.d.ts +37 -0
- package/dist/AreaSplineRangeChart.svelte.d.ts.map +1 -0
- package/dist/BellCurveChart.svelte +487 -0
- package/dist/BellCurveChart.svelte.d.ts +40 -0
- package/dist/BellCurveChart.svelte.d.ts.map +1 -0
- package/dist/Calendar.svelte +11 -0
- package/dist/ChatThread.svelte +32 -1
- package/dist/ChatThread.svelte.d.ts +14 -0
- package/dist/ChatThread.svelte.d.ts.map +1 -1
- package/dist/ColumnPyramidChart.svelte +332 -0
- package/dist/ColumnPyramidChart.svelte.d.ts +35 -0
- package/dist/ColumnPyramidChart.svelte.d.ts.map +1 -0
- package/dist/ColumnRangeChart.svelte +432 -0
- package/dist/ColumnRangeChart.svelte.d.ts +42 -0
- package/dist/ColumnRangeChart.svelte.d.ts.map +1 -0
- package/dist/Combobox.svelte +3 -0
- package/dist/ContentSwitcher.svelte +1 -1
- package/dist/DataTable.svelte.d.ts +1 -1
- package/dist/DatePicker.svelte +3 -0
- package/dist/DependencyWheelChart.svelte +413 -0
- package/dist/DependencyWheelChart.svelte.d.ts +42 -0
- package/dist/DependencyWheelChart.svelte.d.ts.map +1 -0
- package/dist/DumbbellChart.svelte +403 -0
- package/dist/DumbbellChart.svelte.d.ts +44 -0
- package/dist/DumbbellChart.svelte.d.ts.map +1 -0
- package/dist/ErrorBarChart.svelte +428 -0
- package/dist/ErrorBarChart.svelte.d.ts +40 -0
- package/dist/ErrorBarChart.svelte.d.ts.map +1 -0
- package/dist/GanttChart.svelte +410 -0
- package/dist/GanttChart.svelte.d.ts +39 -0
- package/dist/GanttChart.svelte.d.ts.map +1 -0
- package/dist/HLCChart.svelte +330 -0
- package/dist/HLCChart.svelte.d.ts +32 -0
- package/dist/HLCChart.svelte.d.ts.map +1 -0
- package/dist/HeikinAshiChart.svelte +365 -0
- package/dist/HeikinAshiChart.svelte.d.ts +37 -0
- package/dist/HeikinAshiChart.svelte.d.ts.map +1 -0
- package/dist/HollowCandlestickChart.svelte +357 -0
- package/dist/HollowCandlestickChart.svelte.d.ts +34 -0
- package/dist/HollowCandlestickChart.svelte.d.ts.map +1 -0
- package/dist/Input.svelte +3 -0
- package/dist/ItemChart.svelte +389 -0
- package/dist/ItemChart.svelte.d.ts +67 -0
- package/dist/ItemChart.svelte.d.ts.map +1 -0
- package/dist/LollipopChart.svelte +1 -1
- package/dist/MultiSelect.svelte +3 -0
- package/dist/NumberInput.svelte +3 -0
- package/dist/OHLCChart.svelte +343 -0
- package/dist/OHLCChart.svelte.d.ts +33 -0
- package/dist/OHLCChart.svelte.d.ts.map +1 -0
- package/dist/OrganizationChart.svelte +284 -0
- package/dist/OrganizationChart.svelte.d.ts +19 -0
- package/dist/OrganizationChart.svelte.d.ts.map +1 -0
- package/dist/PasswordInput.svelte +3 -0
- package/dist/PolygonChart.svelte +189 -0
- package/dist/PolygonChart.svelte.d.ts +17 -0
- package/dist/PolygonChart.svelte.d.ts.map +1 -0
- package/dist/Search.svelte +7 -5
- package/dist/Select.svelte +3 -0
- package/dist/StreamgraphChart.svelte +283 -0
- package/dist/StreamgraphChart.svelte.d.ts +23 -0
- package/dist/StreamgraphChart.svelte.d.ts.map +1 -0
- package/dist/StreamingMessage.svelte +44 -2
- package/dist/StreamingMessage.svelte.d.ts +18 -1
- package/dist/StreamingMessage.svelte.d.ts.map +1 -1
- package/dist/TileMapChart.svelte +314 -0
- package/dist/TileMapChart.svelte.d.ts +45 -0
- package/dist/TileMapChart.svelte.d.ts.map +1 -0
- package/dist/TimePicker.svelte +3 -0
- package/dist/TimelineChart.svelte +362 -0
- package/dist/TimelineChart.svelte.d.ts +22 -0
- package/dist/TimelineChart.svelte.d.ts.map +1 -0
- package/dist/TreegraphChart.svelte +281 -0
- package/dist/TreegraphChart.svelte.d.ts +19 -0
- package/dist/TreegraphChart.svelte.d.ts.map +1 -0
- package/dist/VariablePieChart.svelte +313 -0
- package/dist/VariablePieChart.svelte.d.ts +52 -0
- package/dist/VariablePieChart.svelte.d.ts.map +1 -0
- package/dist/VennChart.svelte +348 -0
- package/dist/VennChart.svelte.d.ts +72 -0
- package/dist/VennChart.svelte.d.ts.map +1 -0
- package/dist/WordCloudChart.svelte +279 -0
- package/dist/WordCloudChart.svelte.d.ts +18 -0
- package/dist/WordCloudChart.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -0
- package/package.json +5 -3
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* VariablePieChart (camembert à rayon variable) - API canonique (référence
|
|
4
|
+
* Svelte, React/Vue doivent s'aligner)
|
|
5
|
+
*
|
|
6
|
+
* Camembert où chaque part porte DEUX informations :
|
|
7
|
+
* - l'ANGLE de la part ∝ value (les angles somment à 360°, comme un
|
|
8
|
+
* camembert classique) ;
|
|
9
|
+
* - le RAYON de la part ∝ z (une 2e métrique), mappé linéairement entre un
|
|
10
|
+
* rayon minimum et un rayon maximum. C'est ce rayon variable qui distingue
|
|
11
|
+
* ce graphique d'un camembert ordinaire (rayon constant) et d'une rose de
|
|
12
|
+
* Nightingale (angles égaux, rayon ∝ value).
|
|
13
|
+
*
|
|
14
|
+
* Échelle du rayon : radius = rMin + (z - zMin) / (zMax - zMin) * (rMax - rMin).
|
|
15
|
+
* Mapping linéaire entre la plus petite et la plus grande valeur de z. Si
|
|
16
|
+
* toutes les valeurs de z sont égales, toutes les parts prennent rMax.
|
|
17
|
+
*
|
|
18
|
+
* Props obligatoires :
|
|
19
|
+
* data VariablePieChartDatum[] - {label, value, z, tone?}
|
|
20
|
+
* label string - aria-label du graphique
|
|
21
|
+
*
|
|
22
|
+
* Props optionnelles :
|
|
23
|
+
* width number (défaut 360) - largeur du viewBox en px
|
|
24
|
+
* height number (défaut 360) - hauteur du viewBox en px
|
|
25
|
+
* class string - classe CSS supplémentaire
|
|
26
|
+
*
|
|
27
|
+
* Labels : le libellé est posé sur la part si elle est assez grande (angle
|
|
28
|
+
* suffisant et rayon > 40% de R). Couleur de texte calculée par
|
|
29
|
+
* contrastTextForTone() pour garantir le contraste WCAG sur chaque fond
|
|
30
|
+
* catégoriel - pas de blanc fixe.
|
|
31
|
+
*
|
|
32
|
+
* NaN/négatif : les data dont value est non-finie ou ≤ 0 sont ignorées
|
|
33
|
+
* (filtrées). z non-fini est ramené à 0. Tableau vide → rendu vide sans
|
|
34
|
+
* crash.
|
|
35
|
+
*/
|
|
36
|
+
export type VariablePieChartTone =
|
|
37
|
+
| "category1"
|
|
38
|
+
| "category2"
|
|
39
|
+
| "category3"
|
|
40
|
+
| "category4"
|
|
41
|
+
| "category5"
|
|
42
|
+
| "category6"
|
|
43
|
+
| "category7"
|
|
44
|
+
| "category8";
|
|
45
|
+
|
|
46
|
+
export type VariablePieChartDatum = {
|
|
47
|
+
label: string;
|
|
48
|
+
value: number;
|
|
49
|
+
z: number;
|
|
50
|
+
tone?: VariablePieChartTone;
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<script lang="ts">
|
|
55
|
+
import ChartDataList from "./ChartDataList.svelte";
|
|
56
|
+
import { contrastTextForTone } from "./chartContrast.js";
|
|
57
|
+
|
|
58
|
+
type VariablePieChartProps = {
|
|
59
|
+
data: VariablePieChartDatum[];
|
|
60
|
+
label: string;
|
|
61
|
+
width?: number;
|
|
62
|
+
height?: number;
|
|
63
|
+
class?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
let {
|
|
67
|
+
data,
|
|
68
|
+
label,
|
|
69
|
+
width = 360,
|
|
70
|
+
height = 360,
|
|
71
|
+
class: className
|
|
72
|
+
}: VariablePieChartProps = $props();
|
|
73
|
+
|
|
74
|
+
const TONES = [
|
|
75
|
+
"category1",
|
|
76
|
+
"category2",
|
|
77
|
+
"category3",
|
|
78
|
+
"category4",
|
|
79
|
+
"category5",
|
|
80
|
+
"category6",
|
|
81
|
+
"category7",
|
|
82
|
+
"category8"
|
|
83
|
+
] as const;
|
|
84
|
+
|
|
85
|
+
function safeValue(value: number): number {
|
|
86
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function safeZ(z: number): number {
|
|
90
|
+
return Number.isFinite(z) ? z : 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function formatNumber(value: number): string {
|
|
94
|
+
if (!Number.isFinite(value)) return "0";
|
|
95
|
+
if (Number.isInteger(value)) return String(value);
|
|
96
|
+
return value.toFixed(2).replace(/\.?0+$/, "");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function point(cx: number, cy: number, radius: number, angle: number) {
|
|
100
|
+
return { x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function sectorPath(cx: number, cy: number, radius: number, start: number, end: number): string {
|
|
104
|
+
const safeEnd = Math.min(end, start + Math.PI * 2 - 0.0001);
|
|
105
|
+
const large = safeEnd - start > Math.PI ? 1 : 0;
|
|
106
|
+
const outerStart = point(cx, cy, radius, start);
|
|
107
|
+
const outerEnd = point(cx, cy, radius, safeEnd);
|
|
108
|
+
return `M ${cx} ${cy} L ${outerStart.x} ${outerStart.y} A ${radius} ${radius} 0 ${large} 1 ${outerEnd.x} ${outerEnd.y} Z`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let hoveredIndex: number | null = $state(null);
|
|
112
|
+
|
|
113
|
+
const sectors = $derived.by(() => {
|
|
114
|
+
const cx = width / 2;
|
|
115
|
+
const cy = height / 2;
|
|
116
|
+
const outerLimit = Math.max(Math.min(width, height) / 2 - 6, 1);
|
|
117
|
+
const rMin = outerLimit * 0.35;
|
|
118
|
+
const rMax = outerLimit;
|
|
119
|
+
|
|
120
|
+
// Filtre les parts à value ≤ 0 ou non-finie (angle nul → invisibles).
|
|
121
|
+
const visible = data.filter((datum) => safeValue(datum.value) > 0);
|
|
122
|
+
if (visible.length === 0) return [];
|
|
123
|
+
|
|
124
|
+
const total = visible.reduce((sum, datum) => sum + safeValue(datum.value), 0);
|
|
125
|
+
if (total <= 0) return [];
|
|
126
|
+
|
|
127
|
+
const zValues = visible.map((datum) => safeZ(datum.z));
|
|
128
|
+
const zMin = Math.min(...zValues);
|
|
129
|
+
const zMax = Math.max(...zValues);
|
|
130
|
+
const zSpan = zMax - zMin;
|
|
131
|
+
|
|
132
|
+
const TWO_PI = Math.PI * 2;
|
|
133
|
+
let angle = -Math.PI / 2; // départ en haut
|
|
134
|
+
|
|
135
|
+
return visible.map((datum, index) => {
|
|
136
|
+
const value = safeValue(datum.value);
|
|
137
|
+
const z = safeZ(datum.z);
|
|
138
|
+
// rayon ∝ z, mappé linéairement entre rMin et rMax.
|
|
139
|
+
const radius = zSpan > 0 ? rMin + ((z - zMin) / zSpan) * (rMax - rMin) : rMax;
|
|
140
|
+
const span = Math.min((value / total) * TWO_PI, TWO_PI - 0.0001);
|
|
141
|
+
const start = angle;
|
|
142
|
+
const end = angle + span;
|
|
143
|
+
angle = end;
|
|
144
|
+
const midAngle = (start + end) / 2;
|
|
145
|
+
const labelPoint = point(cx, cy, radius * 0.62, midAngle);
|
|
146
|
+
return {
|
|
147
|
+
datum,
|
|
148
|
+
value,
|
|
149
|
+
z,
|
|
150
|
+
tone: datum.tone ?? TONES[index % TONES.length],
|
|
151
|
+
radius,
|
|
152
|
+
start,
|
|
153
|
+
end,
|
|
154
|
+
path: sectorPath(cx, cy, radius, start, end),
|
|
155
|
+
labelX: labelPoint.x,
|
|
156
|
+
labelY: labelPoint.y,
|
|
157
|
+
// label posé si la part est assez ouverte et assez grande
|
|
158
|
+
showLabel: span > 0.25 && radius > outerLimit * 0.4
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const dataValueItems = $derived(
|
|
164
|
+
data
|
|
165
|
+
.filter((datum) => safeValue(datum.value) > 0)
|
|
166
|
+
.map((datum) => `${datum.label}: ${formatNumber(safeValue(datum.value))}`)
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
function handleVisualPointerMove(event: PointerEvent) {
|
|
170
|
+
const target = event.target;
|
|
171
|
+
if (!(target instanceof Element)) {
|
|
172
|
+
hoveredIndex = null;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const index = Number(target.getAttribute("data-chart-index"));
|
|
176
|
+
hoveredIndex = Number.isInteger(index) ? index : null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const classes = () => ["st-variablePieChart", className].filter(Boolean).join(" ");
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<div class={classes()}>
|
|
183
|
+
<div
|
|
184
|
+
class="st-variablePieChart__visual"
|
|
185
|
+
role="img"
|
|
186
|
+
aria-label={label}
|
|
187
|
+
onpointermove={handleVisualPointerMove}
|
|
188
|
+
onpointerleave={() => (hoveredIndex = null)}
|
|
189
|
+
>
|
|
190
|
+
<svg
|
|
191
|
+
viewBox="0 0 {width} {height}"
|
|
192
|
+
preserveAspectRatio="xMidYMid meet"
|
|
193
|
+
width="100%"
|
|
194
|
+
height="100%"
|
|
195
|
+
focusable="false"
|
|
196
|
+
aria-hidden="true"
|
|
197
|
+
>
|
|
198
|
+
{#each sectors as sector, i (sector.datum.label)}
|
|
199
|
+
<path
|
|
200
|
+
class="st-variablePieChart__sector st-variablePieChart__sector--{sector.tone}"
|
|
201
|
+
class:st-variablePieChart__sector--dim={hoveredIndex !== null && hoveredIndex !== i}
|
|
202
|
+
d={sector.path}
|
|
203
|
+
data-chart-index={i}
|
|
204
|
+
/>
|
|
205
|
+
{/each}
|
|
206
|
+
|
|
207
|
+
{#each sectors as sector (sector.datum.label)}
|
|
208
|
+
{#if sector.showLabel}
|
|
209
|
+
<text
|
|
210
|
+
class="st-variablePieChart__label"
|
|
211
|
+
x={sector.labelX}
|
|
212
|
+
y={sector.labelY}
|
|
213
|
+
text-anchor="middle"
|
|
214
|
+
dominant-baseline="middle"
|
|
215
|
+
fill={contrastTextForTone(sector.tone)}
|
|
216
|
+
>
|
|
217
|
+
{sector.datum.label}
|
|
218
|
+
</text>
|
|
219
|
+
{/if}
|
|
220
|
+
{/each}
|
|
221
|
+
</svg>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<ChartDataList {label} items={dataValueItems} />
|
|
225
|
+
|
|
226
|
+
{#if hoveredIndex !== null && sectors[hoveredIndex]}
|
|
227
|
+
{@const sector = sectors[hoveredIndex]}
|
|
228
|
+
<div
|
|
229
|
+
class="st-variablePieChart__tooltip"
|
|
230
|
+
role="presentation"
|
|
231
|
+
style="left: {(sector.labelX / width) * 100}%; top: {(sector.labelY / height) * 100}%"
|
|
232
|
+
>
|
|
233
|
+
<span class="st-variablePieChart__tooltipLabel">{sector.datum.label}</span>
|
|
234
|
+
<span class="st-variablePieChart__tooltipValue">{formatNumber(sector.value)} · {formatNumber(sector.z)}</span>
|
|
235
|
+
</div>
|
|
236
|
+
{/if}
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<style>
|
|
240
|
+
.st-variablePieChart {
|
|
241
|
+
color: var(--st-semantic-text-secondary);
|
|
242
|
+
display: block;
|
|
243
|
+
font-family: inherit;
|
|
244
|
+
max-width: 100%;
|
|
245
|
+
position: relative;
|
|
246
|
+
width: 100%;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.st-variablePieChart svg,
|
|
250
|
+
.st-variablePieChart__visual {
|
|
251
|
+
display: block;
|
|
252
|
+
overflow: visible;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.st-variablePieChart__sector {
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
fill-opacity: 0.82;
|
|
258
|
+
stroke: var(--st-semantic-surface-default, Canvas);
|
|
259
|
+
stroke-width: 1;
|
|
260
|
+
transition: opacity 120ms ease;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.st-variablePieChart__sector--dim {
|
|
264
|
+
opacity: 0.4;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@media (prefers-reduced-motion: reduce) {
|
|
268
|
+
.st-variablePieChart__sector {
|
|
269
|
+
transition: none;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.st-variablePieChart__sector--category1 { fill: var(--st-semantic-data-category1); }
|
|
274
|
+
.st-variablePieChart__sector--category2 { fill: var(--st-semantic-data-category2); }
|
|
275
|
+
.st-variablePieChart__sector--category3 { fill: var(--st-semantic-data-category3); }
|
|
276
|
+
.st-variablePieChart__sector--category4 { fill: var(--st-semantic-data-category4); }
|
|
277
|
+
.st-variablePieChart__sector--category5 { fill: var(--st-semantic-data-category5); }
|
|
278
|
+
.st-variablePieChart__sector--category6 { fill: var(--st-semantic-data-category6); }
|
|
279
|
+
.st-variablePieChart__sector--category7 { fill: var(--st-semantic-data-category7); }
|
|
280
|
+
.st-variablePieChart__sector--category8 { fill: var(--st-semantic-data-category8); }
|
|
281
|
+
|
|
282
|
+
.st-variablePieChart__label {
|
|
283
|
+
/* fill calculé par contrastTextForTone() en inline - pas de blanc fixe */
|
|
284
|
+
font-size: 0.68rem;
|
|
285
|
+
font-weight: 650;
|
|
286
|
+
pointer-events: none;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.st-variablePieChart__tooltip {
|
|
290
|
+
background: var(--st-semantic-surface-inverse);
|
|
291
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
292
|
+
color: var(--st-semantic-text-inverse);
|
|
293
|
+
display: inline-flex;
|
|
294
|
+
flex-direction: column;
|
|
295
|
+
font-size: 0.75rem;
|
|
296
|
+
gap: 0.125rem;
|
|
297
|
+
line-height: 1.2;
|
|
298
|
+
padding: 0.375rem 0.5rem;
|
|
299
|
+
pointer-events: none;
|
|
300
|
+
position: absolute;
|
|
301
|
+
transform: translate(-50%, -115%);
|
|
302
|
+
white-space: nowrap;
|
|
303
|
+
z-index: 1;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.st-variablePieChart__tooltipLabel {
|
|
307
|
+
font-weight: 600;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.st-variablePieChart__tooltipValue {
|
|
311
|
+
opacity: 0.85;
|
|
312
|
+
}
|
|
313
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VariablePieChart (camembert à rayon variable) - API canonique (référence
|
|
3
|
+
* Svelte, React/Vue doivent s'aligner)
|
|
4
|
+
*
|
|
5
|
+
* Camembert où chaque part porte DEUX informations :
|
|
6
|
+
* - l'ANGLE de la part ∝ value (les angles somment à 360°, comme un
|
|
7
|
+
* camembert classique) ;
|
|
8
|
+
* - le RAYON de la part ∝ z (une 2e métrique), mappé linéairement entre un
|
|
9
|
+
* rayon minimum et un rayon maximum. C'est ce rayon variable qui distingue
|
|
10
|
+
* ce graphique d'un camembert ordinaire (rayon constant) et d'une rose de
|
|
11
|
+
* Nightingale (angles égaux, rayon ∝ value).
|
|
12
|
+
*
|
|
13
|
+
* Échelle du rayon : radius = rMin + (z - zMin) / (zMax - zMin) * (rMax - rMin).
|
|
14
|
+
* Mapping linéaire entre la plus petite et la plus grande valeur de z. Si
|
|
15
|
+
* toutes les valeurs de z sont égales, toutes les parts prennent rMax.
|
|
16
|
+
*
|
|
17
|
+
* Props obligatoires :
|
|
18
|
+
* data VariablePieChartDatum[] - {label, value, z, tone?}
|
|
19
|
+
* label string - aria-label du graphique
|
|
20
|
+
*
|
|
21
|
+
* Props optionnelles :
|
|
22
|
+
* width number (défaut 360) - largeur du viewBox en px
|
|
23
|
+
* height number (défaut 360) - hauteur du viewBox en px
|
|
24
|
+
* class string - classe CSS supplémentaire
|
|
25
|
+
*
|
|
26
|
+
* Labels : le libellé est posé sur la part si elle est assez grande (angle
|
|
27
|
+
* suffisant et rayon > 40% de R). Couleur de texte calculée par
|
|
28
|
+
* contrastTextForTone() pour garantir le contraste WCAG sur chaque fond
|
|
29
|
+
* catégoriel - pas de blanc fixe.
|
|
30
|
+
*
|
|
31
|
+
* NaN/négatif : les data dont value est non-finie ou ≤ 0 sont ignorées
|
|
32
|
+
* (filtrées). z non-fini est ramené à 0. Tableau vide → rendu vide sans
|
|
33
|
+
* crash.
|
|
34
|
+
*/
|
|
35
|
+
export type VariablePieChartTone = "category1" | "category2" | "category3" | "category4" | "category5" | "category6" | "category7" | "category8";
|
|
36
|
+
export type VariablePieChartDatum = {
|
|
37
|
+
label: string;
|
|
38
|
+
value: number;
|
|
39
|
+
z: number;
|
|
40
|
+
tone?: VariablePieChartTone;
|
|
41
|
+
};
|
|
42
|
+
type VariablePieChartProps = {
|
|
43
|
+
data: VariablePieChartDatum[];
|
|
44
|
+
label: string;
|
|
45
|
+
width?: number;
|
|
46
|
+
height?: number;
|
|
47
|
+
class?: string;
|
|
48
|
+
};
|
|
49
|
+
declare const VariablePieChart: import("svelte").Component<VariablePieChartProps, {}, "">;
|
|
50
|
+
type VariablePieChart = ReturnType<typeof VariablePieChart>;
|
|
51
|
+
export default VariablePieChart;
|
|
52
|
+
//# sourceMappingURL=VariablePieChart.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariablePieChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VariablePieChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,CAAC,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAOF,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA4JJ,QAAA,MAAM,gBAAgB,2DAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|