@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,410 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* GanttChart - planning xrange : une ligne (rangée Y) par tâche, une barre
|
|
4
|
+
* horizontale couvrant `start → end` sur un axe temporel numérique (X).
|
|
5
|
+
* API canonique (référence Svelte, React/Vue doivent s'aligner).
|
|
6
|
+
*
|
|
7
|
+
* Modèle : une tâche = une barre avec un OFFSET de départ (x0 = start) et une
|
|
8
|
+
* largeur (end - start), sur un axe X commun gradué (niceTicks). La couleur
|
|
9
|
+
* suit `category` (catégorie → categoryN, 8 teintes) ou reste unie si aucune
|
|
10
|
+
* catégorie n'est fournie. Étiquette de tâche à gauche (ellipsis). Marqueur
|
|
11
|
+
* « aujourd'hui » optionnel via `marker`.
|
|
12
|
+
*
|
|
13
|
+
* Props obligatoires :
|
|
14
|
+
* data GanttChartTask[] - tableau {task, start, end, category?}
|
|
15
|
+
* label string
|
|
16
|
+
*
|
|
17
|
+
* Props optionnelles :
|
|
18
|
+
* width number (défaut 640)
|
|
19
|
+
* height number (défaut 320)
|
|
20
|
+
* marker number - position d'un repère vertical (ex. « aujourd'hui »)
|
|
21
|
+
* class string
|
|
22
|
+
*/
|
|
23
|
+
export type GanttChartTask = {
|
|
24
|
+
task: string;
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
category?: string;
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import ChartDataList from "./ChartDataList.svelte";
|
|
33
|
+
|
|
34
|
+
type GanttChartProps = {
|
|
35
|
+
data: GanttChartTask[];
|
|
36
|
+
label: string;
|
|
37
|
+
width?: number;
|
|
38
|
+
height?: number;
|
|
39
|
+
marker?: number;
|
|
40
|
+
class?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let {
|
|
44
|
+
data = [],
|
|
45
|
+
label,
|
|
46
|
+
width = 640,
|
|
47
|
+
height = 320,
|
|
48
|
+
marker,
|
|
49
|
+
class: className
|
|
50
|
+
}: GanttChartProps = $props();
|
|
51
|
+
|
|
52
|
+
const MARGIN = { top: 16, right: 16, bottom: 32, left: 132 };
|
|
53
|
+
|
|
54
|
+
function scaleLinear(v: number, d0: number, d1: number, r0: number, r1: number) {
|
|
55
|
+
if (d1 === d0) return r0;
|
|
56
|
+
return r0 + ((v - d0) * (r1 - r0)) / (d1 - d0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function niceTicks(min: number, max: number, target = 5): number[] {
|
|
60
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || min === max) {
|
|
61
|
+
const base = Number.isFinite(max) ? max : 0;
|
|
62
|
+
return [base];
|
|
63
|
+
}
|
|
64
|
+
const range = max - min;
|
|
65
|
+
const rough = range / Math.max(target - 1, 1);
|
|
66
|
+
const pow = Math.pow(10, Math.floor(Math.log10(rough)));
|
|
67
|
+
const norm = rough / pow;
|
|
68
|
+
let step: number;
|
|
69
|
+
if (norm < 1.5) step = 1 * pow;
|
|
70
|
+
else if (norm < 3) step = 2 * pow;
|
|
71
|
+
else if (norm < 7) step = 5 * pow;
|
|
72
|
+
else step = 10 * pow;
|
|
73
|
+
const start = Math.floor(min / step) * step;
|
|
74
|
+
const end = Math.ceil(max / step) * step;
|
|
75
|
+
const ticks: number[] = [];
|
|
76
|
+
for (let v = start; v <= end + step / 2; v += step) {
|
|
77
|
+
ticks.push(Number(v.toFixed(10)));
|
|
78
|
+
}
|
|
79
|
+
return ticks;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function formatTick(v: number): string {
|
|
83
|
+
if (Math.abs(v) >= 1000) return `${(v / 1000).toFixed(v % 1000 === 0 ? 0 : 1)}k`;
|
|
84
|
+
if (Number.isInteger(v)) return String(v);
|
|
85
|
+
return v.toFixed(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Tronque une étiquette à la largeur de la marge gauche (approx. par char).
|
|
89
|
+
function ellipsize(text: string, maxChars: number): string {
|
|
90
|
+
if (text.length <= maxChars) return text;
|
|
91
|
+
if (maxChars <= 1) return "…";
|
|
92
|
+
return `${text.slice(0, maxChars - 1)}…`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let hoveredIndex: number | null = $state(null);
|
|
96
|
+
|
|
97
|
+
const plotWidth = $derived(Math.max(width - MARGIN.left - MARGIN.right, 1));
|
|
98
|
+
const plotHeight = $derived(Math.max(height - MARGIN.top - MARGIN.bottom, 1));
|
|
99
|
+
|
|
100
|
+
// Normalise start ≤ end et filtre les tâches non finies (ou sans libellé).
|
|
101
|
+
const validData = $derived(
|
|
102
|
+
data
|
|
103
|
+
.filter(
|
|
104
|
+
(d) =>
|
|
105
|
+
typeof d.task === "string" &&
|
|
106
|
+
d.task.length > 0 &&
|
|
107
|
+
Number.isFinite(d.start) &&
|
|
108
|
+
Number.isFinite(d.end)
|
|
109
|
+
)
|
|
110
|
+
.map((d) => ({
|
|
111
|
+
task: d.task,
|
|
112
|
+
start: Math.min(d.start, d.end),
|
|
113
|
+
end: Math.max(d.start, d.end),
|
|
114
|
+
category: d.category
|
|
115
|
+
}))
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// Catégories distinctes (ordre d'apparition) → index categoryN (1..8, cyclé).
|
|
119
|
+
const categoryOrder = $derived.by(() => {
|
|
120
|
+
const seen: string[] = [];
|
|
121
|
+
for (const d of validData) {
|
|
122
|
+
if (d.category && !seen.includes(d.category)) seen.push(d.category);
|
|
123
|
+
}
|
|
124
|
+
return seen;
|
|
125
|
+
});
|
|
126
|
+
const hasCategories = $derived(categoryOrder.length > 0);
|
|
127
|
+
const toneOf = (category: string | undefined): string => {
|
|
128
|
+
if (!category) return "category1";
|
|
129
|
+
const idx = categoryOrder.indexOf(category);
|
|
130
|
+
return `category${(idx % 8) + 1}`;
|
|
131
|
+
};
|
|
132
|
+
const legendItems = $derived(categoryOrder.map((category) => ({ category, tone: toneOf(category) })));
|
|
133
|
+
|
|
134
|
+
const domainBounds = $derived.by(() => {
|
|
135
|
+
const vals: number[] = [];
|
|
136
|
+
for (const d of validData) vals.push(d.start, d.end);
|
|
137
|
+
if (typeof marker === "number" && Number.isFinite(marker)) vals.push(marker);
|
|
138
|
+
if (vals.length === 0) return { rawMin: 0, rawMax: 1 };
|
|
139
|
+
const rawMin = Math.min(...vals);
|
|
140
|
+
const rawMax = Math.max(...vals);
|
|
141
|
+
return { rawMin, rawMax: rawMax === rawMin ? rawMin + 1 : rawMax };
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const ticks = $derived(niceTicks(domainBounds.rawMin, domainBounds.rawMax, 5));
|
|
145
|
+
const domainMin = $derived(ticks[0]);
|
|
146
|
+
const domainMax = $derived(ticks[ticks.length - 1]);
|
|
147
|
+
|
|
148
|
+
const xOf = $derived(
|
|
149
|
+
(v: number) => MARGIN.left + scaleLinear(v, domainMin, domainMax, 0, plotWidth)
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const bars = $derived.by(() => {
|
|
153
|
+
if (validData.length === 0) return [];
|
|
154
|
+
const band = plotHeight / validData.length;
|
|
155
|
+
const barHeight = Math.min(band * 0.62, 28);
|
|
156
|
+
return validData.map((d, i) => {
|
|
157
|
+
const x0 = xOf(d.start);
|
|
158
|
+
const x1 = xOf(d.end);
|
|
159
|
+
const x = Math.min(x0, x1);
|
|
160
|
+
const w = Math.max(Math.abs(x1 - x0), 1);
|
|
161
|
+
const y = MARGIN.top + band * i + (band - barHeight) / 2;
|
|
162
|
+
return {
|
|
163
|
+
datum: d,
|
|
164
|
+
index: i,
|
|
165
|
+
x,
|
|
166
|
+
y,
|
|
167
|
+
width: w,
|
|
168
|
+
height: barHeight,
|
|
169
|
+
rowCenterY: MARGIN.top + band * (i + 0.5),
|
|
170
|
+
cx: x + w / 2,
|
|
171
|
+
tone: toneOf(d.category)
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const markerGeom = $derived.by(() => {
|
|
177
|
+
if (typeof marker !== "number" || !Number.isFinite(marker)) return null;
|
|
178
|
+
return { x: xOf(marker), value: marker };
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const dataValueItems = $derived(validData.map((d) => `${d.task}: ${d.start} → ${d.end}`));
|
|
182
|
+
|
|
183
|
+
function handlePointerMove(event: PointerEvent) {
|
|
184
|
+
const target = event.target;
|
|
185
|
+
if (!(target instanceof Element)) {
|
|
186
|
+
hoveredIndex = null;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const idx = Number(target.getAttribute("data-chart-index"));
|
|
190
|
+
hoveredIndex = Number.isInteger(idx) ? idx : null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const classes = () => ["st-ganttChart", className].filter(Boolean).join(" ");
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<div class={classes()}>
|
|
197
|
+
<div
|
|
198
|
+
class="st-ganttChart__visual"
|
|
199
|
+
role="img"
|
|
200
|
+
aria-label={label}
|
|
201
|
+
onpointermove={handlePointerMove}
|
|
202
|
+
onpointerleave={() => (hoveredIndex = null)}
|
|
203
|
+
>
|
|
204
|
+
<svg
|
|
205
|
+
viewBox="0 0 {width} {height}"
|
|
206
|
+
preserveAspectRatio="xMidYMid meet"
|
|
207
|
+
width="100%"
|
|
208
|
+
height="100%"
|
|
209
|
+
focusable="false"
|
|
210
|
+
aria-hidden="true"
|
|
211
|
+
>
|
|
212
|
+
<!-- gridlines + tick labels (axe X temporel) -->
|
|
213
|
+
{#each ticks as tick (tick)}
|
|
214
|
+
{@const tx = xOf(tick)}
|
|
215
|
+
<line class="st-ganttChart__grid" x1={tx} x2={tx} y1={MARGIN.top} y2={height - MARGIN.bottom} />
|
|
216
|
+
<text class="st-ganttChart__tickLabel" x={tx} y={height - MARGIN.bottom + 16} text-anchor="middle">
|
|
217
|
+
{formatTick(tick)}
|
|
218
|
+
</text>
|
|
219
|
+
{/each}
|
|
220
|
+
|
|
221
|
+
<!-- axes -->
|
|
222
|
+
<line class="st-ganttChart__axis" x1={MARGIN.left} x2={MARGIN.left} y1={MARGIN.top} y2={height - MARGIN.bottom} />
|
|
223
|
+
<line class="st-ganttChart__axis" x1={MARGIN.left} x2={width - MARGIN.right} y1={height - MARGIN.bottom} y2={height - MARGIN.bottom} />
|
|
224
|
+
|
|
225
|
+
<!-- une barre par tâche + étiquette de tâche à gauche -->
|
|
226
|
+
{#each bars as bar, i (`${i}-${bar.datum.task}`)}
|
|
227
|
+
<text
|
|
228
|
+
class="st-ganttChart__taskLabel"
|
|
229
|
+
x={MARGIN.left - 8}
|
|
230
|
+
y={bar.rowCenterY}
|
|
231
|
+
text-anchor="end"
|
|
232
|
+
dominant-baseline="middle"
|
|
233
|
+
>
|
|
234
|
+
{ellipsize(bar.datum.task, 18)}
|
|
235
|
+
</text>
|
|
236
|
+
<rect
|
|
237
|
+
class="st-ganttChart__bar st-ganttChart__bar--{bar.tone}"
|
|
238
|
+
class:st-ganttChart__bar--dim={hoveredIndex !== null && hoveredIndex !== i}
|
|
239
|
+
x={bar.x}
|
|
240
|
+
y={bar.y}
|
|
241
|
+
width={bar.width}
|
|
242
|
+
height={bar.height}
|
|
243
|
+
rx="2"
|
|
244
|
+
data-chart-index={i}
|
|
245
|
+
/>
|
|
246
|
+
{/each}
|
|
247
|
+
|
|
248
|
+
<!-- marqueur « aujourd'hui » -->
|
|
249
|
+
{#if markerGeom}
|
|
250
|
+
<line
|
|
251
|
+
class="st-ganttChart__marker"
|
|
252
|
+
x1={markerGeom.x}
|
|
253
|
+
x2={markerGeom.x}
|
|
254
|
+
y1={MARGIN.top}
|
|
255
|
+
y2={height - MARGIN.bottom}
|
|
256
|
+
/>
|
|
257
|
+
{/if}
|
|
258
|
+
</svg>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
{#if hasCategories}
|
|
262
|
+
<ul class="st-ganttChart__legend" aria-label={`Catégories de ${label}`}>
|
|
263
|
+
{#each legendItems as item (item.category)}
|
|
264
|
+
<li class="st-ganttChart__legendItem">
|
|
265
|
+
<span class="st-ganttChart__legendSwatch st-ganttChart__legendSwatch--{item.tone}" aria-hidden="true"></span>
|
|
266
|
+
{item.category}
|
|
267
|
+
</li>
|
|
268
|
+
{/each}
|
|
269
|
+
</ul>
|
|
270
|
+
{/if}
|
|
271
|
+
|
|
272
|
+
<ChartDataList {label} items={dataValueItems} />
|
|
273
|
+
|
|
274
|
+
{#if hoveredIndex !== null && bars[hoveredIndex]}
|
|
275
|
+
{@const bar = bars[hoveredIndex]}
|
|
276
|
+
<div
|
|
277
|
+
class="st-ganttChart__tooltip"
|
|
278
|
+
role="presentation"
|
|
279
|
+
style="left: {(bar.cx / width) * 100}%; top: {(bar.rowCenterY / height) * 100}%"
|
|
280
|
+
>
|
|
281
|
+
<span class="st-ganttChart__tooltipLabel">{bar.datum.task}</span>
|
|
282
|
+
<span class="st-ganttChart__tooltipValue">{bar.datum.start} → {bar.datum.end}</span>
|
|
283
|
+
</div>
|
|
284
|
+
{/if}
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<style>
|
|
288
|
+
.st-ganttChart {
|
|
289
|
+
color: var(--st-semantic-text-secondary);
|
|
290
|
+
display: block;
|
|
291
|
+
font-family: inherit;
|
|
292
|
+
position: relative;
|
|
293
|
+
width: 100%;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.st-ganttChart svg {
|
|
297
|
+
display: block;
|
|
298
|
+
overflow: visible;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.st-ganttChart__visual {
|
|
302
|
+
display: block;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.st-ganttChart__axis {
|
|
306
|
+
stroke: var(--st-semantic-border-subtle);
|
|
307
|
+
stroke-width: 1;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.st-ganttChart__grid {
|
|
311
|
+
stroke: var(--st-semantic-border-subtle);
|
|
312
|
+
stroke-dasharray: 2 3;
|
|
313
|
+
stroke-width: 1;
|
|
314
|
+
opacity: 0.7;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.st-ganttChart__tickLabel,
|
|
318
|
+
.st-ganttChart__taskLabel {
|
|
319
|
+
fill: var(--st-semantic-text-secondary);
|
|
320
|
+
font-size: 0.6875rem;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.st-ganttChart__bar {
|
|
324
|
+
cursor: pointer;
|
|
325
|
+
transition: opacity 120ms ease;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.st-ganttChart__bar--dim {
|
|
329
|
+
opacity: 0.4;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.st-ganttChart__bar--category1 { fill: var(--st-semantic-data-category1); }
|
|
333
|
+
.st-ganttChart__bar--category2 { fill: var(--st-semantic-data-category2); }
|
|
334
|
+
.st-ganttChart__bar--category3 { fill: var(--st-semantic-data-category3); }
|
|
335
|
+
.st-ganttChart__bar--category4 { fill: var(--st-semantic-data-category4); }
|
|
336
|
+
.st-ganttChart__bar--category5 { fill: var(--st-semantic-data-category5); }
|
|
337
|
+
.st-ganttChart__bar--category6 { fill: var(--st-semantic-data-category6); }
|
|
338
|
+
.st-ganttChart__bar--category7 { fill: var(--st-semantic-data-category7); }
|
|
339
|
+
.st-ganttChart__bar--category8 { fill: var(--st-semantic-data-category8); }
|
|
340
|
+
|
|
341
|
+
.st-ganttChart__marker {
|
|
342
|
+
stroke: var(--st-semantic-feedback-error);
|
|
343
|
+
stroke-width: 1.5;
|
|
344
|
+
stroke-dasharray: 4 3;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.st-ganttChart__legend {
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-wrap: wrap;
|
|
350
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
351
|
+
list-style: none;
|
|
352
|
+
margin: var(--st-spacing-2, 0.5rem) 0 0 0;
|
|
353
|
+
padding: 0;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.st-ganttChart__legendItem {
|
|
357
|
+
align-items: center;
|
|
358
|
+
color: var(--st-semantic-text-secondary);
|
|
359
|
+
display: inline-flex;
|
|
360
|
+
font-size: 0.75rem;
|
|
361
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
362
|
+
line-height: 1;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.st-ganttChart__legendSwatch {
|
|
366
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
367
|
+
display: inline-block;
|
|
368
|
+
height: 0.625rem;
|
|
369
|
+
width: 0.625rem;
|
|
370
|
+
}
|
|
371
|
+
.st-ganttChart__legendSwatch--category1 { background: var(--st-semantic-data-category1); }
|
|
372
|
+
.st-ganttChart__legendSwatch--category2 { background: var(--st-semantic-data-category2); }
|
|
373
|
+
.st-ganttChart__legendSwatch--category3 { background: var(--st-semantic-data-category3); }
|
|
374
|
+
.st-ganttChart__legendSwatch--category4 { background: var(--st-semantic-data-category4); }
|
|
375
|
+
.st-ganttChart__legendSwatch--category5 { background: var(--st-semantic-data-category5); }
|
|
376
|
+
.st-ganttChart__legendSwatch--category6 { background: var(--st-semantic-data-category6); }
|
|
377
|
+
.st-ganttChart__legendSwatch--category7 { background: var(--st-semantic-data-category7); }
|
|
378
|
+
.st-ganttChart__legendSwatch--category8 { background: var(--st-semantic-data-category8); }
|
|
379
|
+
|
|
380
|
+
.st-ganttChart__tooltip {
|
|
381
|
+
background: var(--st-semantic-surface-inverse);
|
|
382
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
383
|
+
color: var(--st-semantic-text-inverse);
|
|
384
|
+
display: inline-flex;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
font-size: 0.75rem;
|
|
387
|
+
gap: 0.125rem;
|
|
388
|
+
line-height: 1.2;
|
|
389
|
+
padding: 0.375rem 0.5rem;
|
|
390
|
+
pointer-events: none;
|
|
391
|
+
position: absolute;
|
|
392
|
+
transform: translate(-50%, calc(-100% - 8px));
|
|
393
|
+
white-space: nowrap;
|
|
394
|
+
z-index: 1;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.st-ganttChart__tooltipLabel {
|
|
398
|
+
font-weight: 600;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.st-ganttChart__tooltipValue {
|
|
402
|
+
opacity: 0.85;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
@media (prefers-reduced-motion: reduce) {
|
|
406
|
+
.st-ganttChart__bar {
|
|
407
|
+
transition: none;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GanttChart - planning xrange : une ligne (rangée Y) par tâche, une barre
|
|
3
|
+
* horizontale couvrant `start → end` sur un axe temporel numérique (X).
|
|
4
|
+
* API canonique (référence Svelte, React/Vue doivent s'aligner).
|
|
5
|
+
*
|
|
6
|
+
* Modèle : une tâche = une barre avec un OFFSET de départ (x0 = start) et une
|
|
7
|
+
* largeur (end - start), sur un axe X commun gradué (niceTicks). La couleur
|
|
8
|
+
* suit `category` (catégorie → categoryN, 8 teintes) ou reste unie si aucune
|
|
9
|
+
* catégorie n'est fournie. Étiquette de tâche à gauche (ellipsis). Marqueur
|
|
10
|
+
* « aujourd'hui » optionnel via `marker`.
|
|
11
|
+
*
|
|
12
|
+
* Props obligatoires :
|
|
13
|
+
* data GanttChartTask[] - tableau {task, start, end, category?}
|
|
14
|
+
* label string
|
|
15
|
+
*
|
|
16
|
+
* Props optionnelles :
|
|
17
|
+
* width number (défaut 640)
|
|
18
|
+
* height number (défaut 320)
|
|
19
|
+
* marker number - position d'un repère vertical (ex. « aujourd'hui »)
|
|
20
|
+
* class string
|
|
21
|
+
*/
|
|
22
|
+
export type GanttChartTask = {
|
|
23
|
+
task: string;
|
|
24
|
+
start: number;
|
|
25
|
+
end: number;
|
|
26
|
+
category?: string;
|
|
27
|
+
};
|
|
28
|
+
type GanttChartProps = {
|
|
29
|
+
data: GanttChartTask[];
|
|
30
|
+
label: string;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
marker?: number;
|
|
34
|
+
class?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const GanttChart: import("svelte").Component<GanttChartProps, {}, "">;
|
|
37
|
+
type GanttChart = ReturnType<typeof GanttChart>;
|
|
38
|
+
export default GanttChart;
|
|
39
|
+
//# sourceMappingURL=GanttChart.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GanttChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/GanttChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAyNJ,QAAA,MAAM,UAAU,qDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|