@sentropic/design-system-svelte 0.34.75 → 0.35.1
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/LICENSE +21 -0
- package/LICENSE.THIRD-PARTY.md +141 -0
- package/dist/ForceGraph.svelte +13 -135
- package/dist/ForceGraph.svelte.d.ts.map +1 -1
- package/dist/{GeoMap.svelte → GeoChart.svelte} +72 -72
- package/dist/{GeoMap.svelte.d.ts → GeoChart.svelte.d.ts} +44 -44
- package/dist/GeoChart.svelte.d.ts.map +1 -0
- package/dist/Icon.svelte +35 -3
- package/dist/Icon.svelte.d.ts +5 -1
- package/dist/Icon.svelte.d.ts.map +1 -1
- package/dist/PriorityMatrix.svelte +241 -0
- package/dist/PriorityMatrix.svelte.d.ts +29 -0
- package/dist/PriorityMatrix.svelte.d.ts.map +1 -0
- package/dist/TimeRangePicker.svelte +38 -1
- package/dist/TimeRangePicker.svelte.d.ts +12 -0
- package/dist/TimeRangePicker.svelte.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/priorityLabels.d.ts +143 -0
- package/dist/priorityLabels.d.ts.map +1 -0
- package/dist/priorityLabels.js +239 -0
- package/package.json +5 -3
- package/dist/GeoMap.svelte.d.ts.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
export type
|
|
2
|
+
export type GeoChartTone =
|
|
3
3
|
| "category1" | "category2" | "category3" | "category4"
|
|
4
4
|
| "category5" | "category6" | "category7" | "category8";
|
|
5
5
|
|
|
6
6
|
/** Coordonnée géographique — même forme que `GeoCoordinate` (dataviz-core). */
|
|
7
|
-
export type
|
|
7
|
+
export type GeoChartCoordinate = {
|
|
8
8
|
latitude: number;
|
|
9
9
|
longitude: number;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/** Emprise géographique — même forme que `GeoBounds` (dataviz-core). */
|
|
13
|
-
export type
|
|
13
|
+
export type GeoChartBounds = {
|
|
14
14
|
south: number;
|
|
15
15
|
west: number;
|
|
16
16
|
north: number;
|
|
17
17
|
east: number;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type GeoChartProjection = "equirectangular" | "mercator";
|
|
21
21
|
|
|
22
|
-
export type
|
|
22
|
+
export type GeoChartGeometryType =
|
|
23
23
|
| "Point"
|
|
24
24
|
| "MultiPoint"
|
|
25
25
|
| "LineString"
|
|
@@ -28,124 +28,124 @@
|
|
|
28
28
|
| "MultiPolygon";
|
|
29
29
|
|
|
30
30
|
/** Géométrie GeoJSON — même forme que `GeoJsonGeometry` (dataviz-core). */
|
|
31
|
-
export type
|
|
32
|
-
type:
|
|
31
|
+
export type GeoChartGeometry = {
|
|
32
|
+
type: GeoChartGeometryType;
|
|
33
33
|
coordinates: unknown[];
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
/** Entité géographique — sous-ensemble structurel de `GeoJsonFeature` (dataviz-core). */
|
|
37
|
-
export type
|
|
37
|
+
export type GeoChartFeature = {
|
|
38
38
|
id: string;
|
|
39
39
|
label?: string;
|
|
40
40
|
value?: number;
|
|
41
|
-
geometry:
|
|
41
|
+
geometry: GeoChartGeometry;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
/** Point géographique — sur-ensemble structurel de `GeoPoint` (dataviz-core). */
|
|
45
|
-
export type
|
|
45
|
+
export type GeoChartPoint = GeoChartCoordinate & {
|
|
46
46
|
id?: string;
|
|
47
47
|
label?: string;
|
|
48
48
|
value?: number;
|
|
49
|
-
tone?:
|
|
49
|
+
tone?: GeoChartTone;
|
|
50
50
|
/** Rayon explicite en px (prioritaire sur l'échelle par `value`), borné à 32. */
|
|
51
51
|
r?: number;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
/** Flux géographique — sous-ensemble structurel de `GeoFlowLink` (dataviz-core). */
|
|
55
|
-
export type
|
|
55
|
+
export type GeoChartFlow = {
|
|
56
56
|
id?: string;
|
|
57
57
|
label?: string;
|
|
58
|
-
source:
|
|
59
|
-
target:
|
|
58
|
+
source: GeoChartCoordinate;
|
|
59
|
+
target: GeoChartCoordinate;
|
|
60
60
|
value?: number;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
/** Entités GeoJSON (polygones, lignes, points) ; ton par couche ou cycle de palette par entité. */
|
|
64
|
-
export type
|
|
64
|
+
export type GeoChartGeojsonLayer = {
|
|
65
65
|
type: "geojson";
|
|
66
|
-
features:
|
|
67
|
-
tone?:
|
|
66
|
+
features: GeoChartFeature[];
|
|
67
|
+
tone?: GeoChartTone;
|
|
68
68
|
label?: string;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/** Choroplèthe : entités + valeur par id (`regions` dataviz : `key` → `value`) → intensité color-mix. */
|
|
72
|
-
export type
|
|
72
|
+
export type GeoChartChoroplethLayer = {
|
|
73
73
|
type: "choropleth";
|
|
74
|
-
features:
|
|
74
|
+
features: GeoChartFeature[];
|
|
75
75
|
values: Record<string, number>;
|
|
76
76
|
/** Ton de base de la rampe d'intensité (défaut `category1`). */
|
|
77
|
-
tone?:
|
|
77
|
+
tone?: GeoChartTone;
|
|
78
78
|
label?: string;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
/** Points/épingles : rayon ∝ `value` (bornes `minRadius`/`maxRadius`, défauts 5/14 comme dataviz). */
|
|
82
|
-
export type
|
|
82
|
+
export type GeoChartPointsLayer = {
|
|
83
83
|
type: "points";
|
|
84
|
-
points:
|
|
85
|
-
tone?:
|
|
84
|
+
points: GeoChartPoint[];
|
|
85
|
+
tone?: GeoChartTone;
|
|
86
86
|
minRadius?: number;
|
|
87
87
|
maxRadius?: number;
|
|
88
88
|
label?: string;
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
/** Densité : cercles translucides superposés, rayon/intensité ∝ `value` (poids). */
|
|
92
|
-
export type
|
|
92
|
+
export type GeoChartDensityLayer = {
|
|
93
93
|
type: "density";
|
|
94
|
-
points:
|
|
94
|
+
points: GeoChartPoint[];
|
|
95
95
|
/** Ton de la nappe (défaut `category3` — parité visuelle dataviz). */
|
|
96
|
-
tone?:
|
|
96
|
+
tone?: GeoChartTone;
|
|
97
97
|
maxRadius?: number;
|
|
98
98
|
label?: string;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
/** Flux : arcs quadratiques source → target, épaisseur ∝ `value` (défaut ton `category1`). */
|
|
102
|
-
export type
|
|
102
|
+
export type GeoChartFlowLayer = {
|
|
103
103
|
type: "flow";
|
|
104
|
-
flows:
|
|
105
|
-
tone?:
|
|
104
|
+
flows: GeoChartFlow[];
|
|
105
|
+
tone?: GeoChartTone;
|
|
106
106
|
label?: string;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
/** Hexbin : binning hexagonal des points (même binning que dataviz-core), intensité ∝ valeur agrégée. */
|
|
110
|
-
export type
|
|
110
|
+
export type GeoChartHexbinLayer = {
|
|
111
111
|
type: "hexbin";
|
|
112
|
-
points:
|
|
112
|
+
points: GeoChartPoint[];
|
|
113
113
|
/** Taille de cellule en degrés (défaut 1). */
|
|
114
114
|
cellSize?: number;
|
|
115
|
-
tone?:
|
|
115
|
+
tone?: GeoChartTone;
|
|
116
116
|
label?: string;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
/** Clusters : regroupement glouton des points (même algo que dataviz-core), centroïdes marqueurs distinctifs. */
|
|
120
|
-
export type
|
|
120
|
+
export type GeoChartClusterLayer = {
|
|
121
121
|
type: "cluster";
|
|
122
|
-
points:
|
|
122
|
+
points: GeoChartPoint[];
|
|
123
123
|
/** Rayon de regroupement en degrés (défaut 1). */
|
|
124
124
|
radius?: number;
|
|
125
|
-
tone?:
|
|
125
|
+
tone?: GeoChartTone;
|
|
126
126
|
label?: string;
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
export type
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
129
|
+
export type GeoChartLayer =
|
|
130
|
+
| GeoChartGeojsonLayer
|
|
131
|
+
| GeoChartChoroplethLayer
|
|
132
|
+
| GeoChartPointsLayer
|
|
133
|
+
| GeoChartDensityLayer
|
|
134
|
+
| GeoChartFlowLayer
|
|
135
|
+
| GeoChartHexbinLayer
|
|
136
|
+
| GeoChartClusterLayer;
|
|
137
137
|
</script>
|
|
138
138
|
|
|
139
139
|
<script lang="ts">
|
|
140
140
|
import ChartDataList from "./ChartDataList.svelte";
|
|
141
141
|
|
|
142
|
-
type
|
|
143
|
-
layers:
|
|
142
|
+
type GeoChartProps = {
|
|
143
|
+
layers: GeoChartLayer[];
|
|
144
144
|
width?: number;
|
|
145
145
|
height?: number;
|
|
146
|
-
projection?:
|
|
146
|
+
projection?: GeoChartProjection;
|
|
147
147
|
/** Emprise explicite ; sinon auto-ajustement sur les données de toutes les couches + marge. */
|
|
148
|
-
bounds?:
|
|
148
|
+
bounds?: GeoChartBounds;
|
|
149
149
|
label: string;
|
|
150
150
|
class?: string;
|
|
151
151
|
};
|
|
@@ -158,15 +158,15 @@
|
|
|
158
158
|
bounds,
|
|
159
159
|
label,
|
|
160
160
|
class: className
|
|
161
|
-
}:
|
|
161
|
+
}: GeoChartProps = $props();
|
|
162
162
|
|
|
163
163
|
const PADDING = 24;
|
|
164
164
|
const MAX_POINT_RADIUS = 32;
|
|
165
|
-
const WORLD:
|
|
165
|
+
const WORLD: GeoChartBounds = { south: -90, west: -180, north: 90, east: 180 };
|
|
166
166
|
const TONES = ["category1","category2","category3","category4","category5","category6","category7","category8"] as const;
|
|
167
167
|
const GEOMETRY_TYPES = new Set(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"]);
|
|
168
168
|
|
|
169
|
-
function isFiniteCoordinate<T extends
|
|
169
|
+
function isFiniteCoordinate<T extends GeoChartCoordinate>(c: T | undefined): c is T {
|
|
170
170
|
return !!c && Number.isFinite(c.latitude) && Number.isFinite(c.longitude);
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
return Math.round(Math.max(0, Math.min(100, value)));
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
function coordinatePair(value: unknown):
|
|
182
|
+
function coordinatePair(value: unknown): GeoChartCoordinate | undefined {
|
|
183
183
|
if (!Array.isArray(value) || value.length < 2 || Array.isArray(value[0])) return undefined;
|
|
184
184
|
const longitude = Number(value[0]);
|
|
185
185
|
const latitude = Number(value[1]);
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
return { latitude, longitude };
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
function collectGeometryCoordinates(value: unknown, out:
|
|
190
|
+
function collectGeometryCoordinates(value: unknown, out: GeoChartCoordinate[]): void {
|
|
191
191
|
if (!Array.isArray(value)) return;
|
|
192
192
|
const pair = coordinatePair(value);
|
|
193
193
|
if (pair) {
|
|
@@ -197,15 +197,15 @@
|
|
|
197
197
|
for (const item of value) collectGeometryCoordinates(item, out);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function isGeometry(geometry:
|
|
200
|
+
function isGeometry(geometry: GeoChartGeometry | undefined): geometry is GeoChartGeometry {
|
|
201
201
|
return !!geometry && GEOMETRY_TYPES.has(geometry.type) && Array.isArray(geometry.coordinates);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
function layerCoordinates(layer:
|
|
204
|
+
function layerCoordinates(layer: GeoChartLayer): GeoChartCoordinate[] {
|
|
205
205
|
switch (layer.type) {
|
|
206
206
|
case "geojson":
|
|
207
207
|
case "choropleth": {
|
|
208
|
-
const out:
|
|
208
|
+
const out: GeoChartCoordinate[] = [];
|
|
209
209
|
for (const feature of layer.features ?? []) {
|
|
210
210
|
if (isGeometry(feature.geometry)) collectGeometryCoordinates(feature.geometry.coordinates, out);
|
|
211
211
|
}
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
case "cluster":
|
|
218
218
|
return (layer.points ?? []).filter(isFiniteCoordinate);
|
|
219
219
|
case "flow": {
|
|
220
|
-
const out:
|
|
220
|
+
const out: GeoChartCoordinate[] = [];
|
|
221
221
|
for (const flow of layer.flows ?? []) {
|
|
222
222
|
if (isFiniteCoordinate(flow.source)) out.push(flow.source);
|
|
223
223
|
if (isFiniteCoordinate(flow.target)) out.push(flow.target);
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
function validBounds(candidate:
|
|
230
|
+
function validBounds(candidate: GeoChartBounds | undefined): GeoChartBounds | null {
|
|
231
231
|
return candidate &&
|
|
232
232
|
Number.isFinite(candidate.south) && Number.isFinite(candidate.west) &&
|
|
233
233
|
Number.isFinite(candidate.north) && Number.isFinite(candidate.east) &&
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
: null;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
function fitBounds(all:
|
|
239
|
+
function fitBounds(all: GeoChartLayer[]): GeoChartBounds {
|
|
240
240
|
const coords = all.flatMap(layerCoordinates);
|
|
241
241
|
if (coords.length === 0) return WORLD;
|
|
242
242
|
let south = Infinity, west = Infinity, north = -Infinity, east = -Infinity;
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
const bottom = projY(b.south);
|
|
274
274
|
const lonSpan = b.east - b.west || 1;
|
|
275
275
|
const ySpan = top - bottom || 1;
|
|
276
|
-
return (c:
|
|
276
|
+
return (c: GeoChartCoordinate) => ({
|
|
277
277
|
x: PADDING + ((c.longitude - b.west) / lonSpan) * innerW,
|
|
278
278
|
y: PADDING + ((top - projY(c.latitude)) / ySpan) * innerH
|
|
279
279
|
});
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
.join(" ");
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
function geometryPath(geometry:
|
|
304
|
+
function geometryPath(geometry: GeoChartGeometry): string {
|
|
305
305
|
switch (geometry.type) {
|
|
306
306
|
case "Point": {
|
|
307
307
|
const pair = coordinatePair(geometry.coordinates);
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
function pointRadius(point:
|
|
334
|
+
function pointRadius(point: GeoChartPoint, min: number, max: number, rMin: number, rMax: number): number {
|
|
335
335
|
if (typeof point.r === "number" && Number.isFinite(point.r) && point.r >= 0) {
|
|
336
336
|
return Math.min(point.r, MAX_POINT_RADIUS);
|
|
337
337
|
}
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
}).join(" ");
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
function flowPath(source:
|
|
348
|
+
function flowPath(source: GeoChartCoordinate, target: GeoChartCoordinate): string {
|
|
349
349
|
const a = project(source);
|
|
350
350
|
const b = project(target);
|
|
351
351
|
// Arc quadratique : point de contrôle au milieu, décalé perpendiculairement.
|
|
@@ -358,9 +358,9 @@
|
|
|
358
358
|
return `M ${a.x} ${a.y} Q ${cx} ${cy} ${b.x} ${b.y}`;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
type HexbinBin = { id: string; q: number; r: number; center:
|
|
361
|
+
type HexbinBin = { id: string; q: number; r: number; center: GeoChartCoordinate; count: number; value: number };
|
|
362
362
|
|
|
363
|
-
function binPoints(points:
|
|
363
|
+
function binPoints(points: GeoChartPoint[], cellSize: number): HexbinBin[] {
|
|
364
364
|
const hexHeight = cellSize * (Math.sqrt(3) / 2);
|
|
365
365
|
const bins = new Map<string, HexbinBin>();
|
|
366
366
|
for (const point of points) {
|
|
@@ -379,9 +379,9 @@
|
|
|
379
379
|
return [...bins.values()];
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
type Cluster =
|
|
382
|
+
type Cluster = GeoChartCoordinate & { id: string; count: number; value: number };
|
|
383
383
|
|
|
384
|
-
function clusterPoints(points:
|
|
384
|
+
function clusterPoints(points: GeoChartPoint[], radius: number): Cluster[] {
|
|
385
385
|
const clusters: Cluster[] = [];
|
|
386
386
|
for (const point of points) {
|
|
387
387
|
const cluster = clusters.find((item) => {
|
|
@@ -412,18 +412,18 @@
|
|
|
412
412
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
type FeatureMark = { key: string; d: string; tone:
|
|
415
|
+
type FeatureMark = { key: string; d: string; tone: GeoChartTone; line: boolean; text: string };
|
|
416
416
|
type RegionMark = { key: string; d: string; mix: number | null; text: string };
|
|
417
|
-
type CircleMark = { key: string; cx: number; cy: number; r: number; tone:
|
|
417
|
+
type CircleMark = { key: string; cx: number; cy: number; r: number; tone: GeoChartTone; mix?: number; text: string };
|
|
418
418
|
type FlowMark = { key: string; d: string; strokeWidth: number; text: string };
|
|
419
|
-
type HexMark = { key: string; points: string; mix: number; text: string; tone:
|
|
419
|
+
type HexMark = { key: string; points: string; mix: number; text: string; tone: GeoChartTone };
|
|
420
420
|
|
|
421
421
|
type LayerMarks =
|
|
422
422
|
| { type: "geojson"; key: string; summary: string; features: FeatureMark[] }
|
|
423
|
-
| { type: "choropleth"; key: string; summary: string; tone:
|
|
423
|
+
| { type: "choropleth"; key: string; summary: string; tone: GeoChartTone; regions: RegionMark[] }
|
|
424
424
|
| { type: "points"; key: string; summary: string; circles: CircleMark[] }
|
|
425
|
-
| { type: "density"; key: string; summary: string; tone:
|
|
426
|
-
| { type: "flow"; key: string; summary: string; tone:
|
|
425
|
+
| { type: "density"; key: string; summary: string; tone: GeoChartTone; circles: CircleMark[] }
|
|
426
|
+
| { type: "flow"; key: string; summary: string; tone: GeoChartTone; flows: FlowMark[] }
|
|
427
427
|
| { type: "hexbin"; key: string; summary: string; bins: HexMark[] }
|
|
428
428
|
| { type: "cluster"; key: string; summary: string; clusters: CircleMark[] };
|
|
429
429
|
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type GeoChartTone = "category1" | "category2" | "category3" | "category4" | "category5" | "category6" | "category7" | "category8";
|
|
2
2
|
/** Coordonnée géographique — même forme que `GeoCoordinate` (dataviz-core). */
|
|
3
|
-
export type
|
|
3
|
+
export type GeoChartCoordinate = {
|
|
4
4
|
latitude: number;
|
|
5
5
|
longitude: number;
|
|
6
6
|
};
|
|
7
7
|
/** Emprise géographique — même forme que `GeoBounds` (dataviz-core). */
|
|
8
|
-
export type
|
|
8
|
+
export type GeoChartBounds = {
|
|
9
9
|
south: number;
|
|
10
10
|
west: number;
|
|
11
11
|
north: number;
|
|
12
12
|
east: number;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
14
|
+
export type GeoChartProjection = "equirectangular" | "mercator";
|
|
15
|
+
export type GeoChartGeometryType = "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon";
|
|
16
16
|
/** Géométrie GeoJSON — même forme que `GeoJsonGeometry` (dataviz-core). */
|
|
17
|
-
export type
|
|
18
|
-
type:
|
|
17
|
+
export type GeoChartGeometry = {
|
|
18
|
+
type: GeoChartGeometryType;
|
|
19
19
|
coordinates: unknown[];
|
|
20
20
|
};
|
|
21
21
|
/** Entité géographique — sous-ensemble structurel de `GeoJsonFeature` (dataviz-core). */
|
|
22
|
-
export type
|
|
22
|
+
export type GeoChartFeature = {
|
|
23
23
|
id: string;
|
|
24
24
|
label?: string;
|
|
25
25
|
value?: number;
|
|
26
|
-
geometry:
|
|
26
|
+
geometry: GeoChartGeometry;
|
|
27
27
|
};
|
|
28
28
|
/** Point géographique — sur-ensemble structurel de `GeoPoint` (dataviz-core). */
|
|
29
|
-
export type
|
|
29
|
+
export type GeoChartPoint = GeoChartCoordinate & {
|
|
30
30
|
id?: string;
|
|
31
31
|
label?: string;
|
|
32
32
|
value?: number;
|
|
33
|
-
tone?:
|
|
33
|
+
tone?: GeoChartTone;
|
|
34
34
|
/** Rayon explicite en px (prioritaire sur l'échelle par `value`), borné à 32. */
|
|
35
35
|
r?: number;
|
|
36
36
|
};
|
|
37
37
|
/** Flux géographique — sous-ensemble structurel de `GeoFlowLink` (dataviz-core). */
|
|
38
|
-
export type
|
|
38
|
+
export type GeoChartFlow = {
|
|
39
39
|
id?: string;
|
|
40
40
|
label?: string;
|
|
41
|
-
source:
|
|
42
|
-
target:
|
|
41
|
+
source: GeoChartCoordinate;
|
|
42
|
+
target: GeoChartCoordinate;
|
|
43
43
|
value?: number;
|
|
44
44
|
};
|
|
45
45
|
/** Entités GeoJSON (polygones, lignes, points) ; ton par couche ou cycle de palette par entité. */
|
|
46
|
-
export type
|
|
46
|
+
export type GeoChartGeojsonLayer = {
|
|
47
47
|
type: "geojson";
|
|
48
|
-
features:
|
|
49
|
-
tone?:
|
|
48
|
+
features: GeoChartFeature[];
|
|
49
|
+
tone?: GeoChartTone;
|
|
50
50
|
label?: string;
|
|
51
51
|
};
|
|
52
52
|
/** Choroplèthe : entités + valeur par id (`regions` dataviz : `key` → `value`) → intensité color-mix. */
|
|
53
|
-
export type
|
|
53
|
+
export type GeoChartChoroplethLayer = {
|
|
54
54
|
type: "choropleth";
|
|
55
|
-
features:
|
|
55
|
+
features: GeoChartFeature[];
|
|
56
56
|
values: Record<string, number>;
|
|
57
57
|
/** Ton de base de la rampe d'intensité (défaut `category1`). */
|
|
58
|
-
tone?:
|
|
58
|
+
tone?: GeoChartTone;
|
|
59
59
|
label?: string;
|
|
60
60
|
};
|
|
61
61
|
/** Points/épingles : rayon ∝ `value` (bornes `minRadius`/`maxRadius`, défauts 5/14 comme dataviz). */
|
|
62
|
-
export type
|
|
62
|
+
export type GeoChartPointsLayer = {
|
|
63
63
|
type: "points";
|
|
64
|
-
points:
|
|
65
|
-
tone?:
|
|
64
|
+
points: GeoChartPoint[];
|
|
65
|
+
tone?: GeoChartTone;
|
|
66
66
|
minRadius?: number;
|
|
67
67
|
maxRadius?: number;
|
|
68
68
|
label?: string;
|
|
69
69
|
};
|
|
70
70
|
/** Densité : cercles translucides superposés, rayon/intensité ∝ `value` (poids). */
|
|
71
|
-
export type
|
|
71
|
+
export type GeoChartDensityLayer = {
|
|
72
72
|
type: "density";
|
|
73
|
-
points:
|
|
73
|
+
points: GeoChartPoint[];
|
|
74
74
|
/** Ton de la nappe (défaut `category3` — parité visuelle dataviz). */
|
|
75
|
-
tone?:
|
|
75
|
+
tone?: GeoChartTone;
|
|
76
76
|
maxRadius?: number;
|
|
77
77
|
label?: string;
|
|
78
78
|
};
|
|
79
79
|
/** Flux : arcs quadratiques source → target, épaisseur ∝ `value` (défaut ton `category1`). */
|
|
80
|
-
export type
|
|
80
|
+
export type GeoChartFlowLayer = {
|
|
81
81
|
type: "flow";
|
|
82
|
-
flows:
|
|
83
|
-
tone?:
|
|
82
|
+
flows: GeoChartFlow[];
|
|
83
|
+
tone?: GeoChartTone;
|
|
84
84
|
label?: string;
|
|
85
85
|
};
|
|
86
86
|
/** Hexbin : binning hexagonal des points (même binning que dataviz-core), intensité ∝ valeur agrégée. */
|
|
87
|
-
export type
|
|
87
|
+
export type GeoChartHexbinLayer = {
|
|
88
88
|
type: "hexbin";
|
|
89
|
-
points:
|
|
89
|
+
points: GeoChartPoint[];
|
|
90
90
|
/** Taille de cellule en degrés (défaut 1). */
|
|
91
91
|
cellSize?: number;
|
|
92
|
-
tone?:
|
|
92
|
+
tone?: GeoChartTone;
|
|
93
93
|
label?: string;
|
|
94
94
|
};
|
|
95
95
|
/** Clusters : regroupement glouton des points (même algo que dataviz-core), centroïdes marqueurs distinctifs. */
|
|
96
|
-
export type
|
|
96
|
+
export type GeoChartClusterLayer = {
|
|
97
97
|
type: "cluster";
|
|
98
|
-
points:
|
|
98
|
+
points: GeoChartPoint[];
|
|
99
99
|
/** Rayon de regroupement en degrés (défaut 1). */
|
|
100
100
|
radius?: number;
|
|
101
|
-
tone?:
|
|
101
|
+
tone?: GeoChartTone;
|
|
102
102
|
label?: string;
|
|
103
103
|
};
|
|
104
|
-
export type
|
|
105
|
-
type
|
|
106
|
-
layers:
|
|
104
|
+
export type GeoChartLayer = GeoChartGeojsonLayer | GeoChartChoroplethLayer | GeoChartPointsLayer | GeoChartDensityLayer | GeoChartFlowLayer | GeoChartHexbinLayer | GeoChartClusterLayer;
|
|
105
|
+
type GeoChartProps = {
|
|
106
|
+
layers: GeoChartLayer[];
|
|
107
107
|
width?: number;
|
|
108
108
|
height?: number;
|
|
109
|
-
projection?:
|
|
109
|
+
projection?: GeoChartProjection;
|
|
110
110
|
/** Emprise explicite ; sinon auto-ajustement sur les données de toutes les couches + marge. */
|
|
111
|
-
bounds?:
|
|
111
|
+
bounds?: GeoChartBounds;
|
|
112
112
|
label: string;
|
|
113
113
|
class?: string;
|
|
114
114
|
};
|
|
115
|
-
declare const
|
|
116
|
-
type
|
|
117
|
-
export default
|
|
118
|
-
//# sourceMappingURL=
|
|
115
|
+
declare const GeoChart: import("svelte").Component<GeoChartProps, {}, "">;
|
|
116
|
+
type GeoChart = ReturnType<typeof GeoChart>;
|
|
117
|
+
export default GeoChart;
|
|
118
|
+
//# sourceMappingURL=GeoChart.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeoChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/GeoChart.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,MAAM,YAAY,GACpB,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GACrD,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1D,+EAA+E;AAC/E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,UAAU,CAAC;AAEhE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AAE,CAAC;IACxB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,oBAAoB,GACpB,uBAAuB,GACvB,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,oBAAoB,CAAC;AAMzB,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,+FAA+F;IAC/F,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA2gBJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
package/dist/Icon.svelte
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
name: IconName;
|
|
8
8
|
/** Square size in px. Default 18 — the DS-standard inline glyph size. */
|
|
9
9
|
size?: number;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Stroke width. When omitted, the theme token
|
|
12
|
+
* `--st-component-icon-strokeWidth` applies (default 2.25 — the DS's
|
|
13
|
+
* existing lucide usage). When set, it wins over the token.
|
|
14
|
+
*/
|
|
11
15
|
strokeWidth?: number;
|
|
12
16
|
/**
|
|
13
17
|
* Accessible name. When set, the icon is exposed as an image with this
|
|
@@ -20,7 +24,7 @@
|
|
|
20
24
|
let {
|
|
21
25
|
name,
|
|
22
26
|
size = 18,
|
|
23
|
-
strokeWidth
|
|
27
|
+
strokeWidth,
|
|
24
28
|
title,
|
|
25
29
|
class: className,
|
|
26
30
|
...rest
|
|
@@ -28,12 +32,16 @@
|
|
|
28
32
|
|
|
29
33
|
const Glyph = $derived(ICONS[name]);
|
|
30
34
|
const classes = $derived(["st-icon", className].filter(Boolean).join(" "));
|
|
35
|
+
// An explicit prop is marked so the token rule below leaves it alone; the
|
|
36
|
+
// presentation attribute keeps 2.25 when no stylesheet or theme is loaded.
|
|
37
|
+
const strokeMarker = $derived(strokeWidth == null ? undefined : "prop");
|
|
31
38
|
</script>
|
|
32
39
|
|
|
33
40
|
{#if Glyph}
|
|
34
41
|
<Glyph
|
|
35
42
|
{size}
|
|
36
|
-
{strokeWidth}
|
|
43
|
+
strokeWidth={strokeWidth ?? 2.25}
|
|
44
|
+
data-st-icon-stroke={strokeMarker}
|
|
37
45
|
class={classes}
|
|
38
46
|
role={title ? "img" : undefined}
|
|
39
47
|
aria-label={title}
|
|
@@ -42,3 +50,27 @@
|
|
|
42
50
|
{...rest}
|
|
43
51
|
/>
|
|
44
52
|
{/if}
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
/* Stroke width and colour come from the theme tokens. The selectors only
|
|
56
|
+
match the DS defaults (stroke-width 2.25 set by no prop, stroke
|
|
57
|
+
currentColor), so an explicit strokeWidth prop or colour keeps its
|
|
58
|
+
presentation attribute. The rules live in the cascade layer `st-icon`: a
|
|
59
|
+
layered rule still beats the SVG presentation attributes, and any unlayered
|
|
60
|
+
consumer rule beats it. A consumer rule inside a layer (Tailwind v4
|
|
61
|
+
utilities) only wins if `st-icon` comes first in the layer order: declare
|
|
62
|
+
`@layer st-icon;` before `@import "tailwindcss";`. Svelte usually emits
|
|
63
|
+
component CSS after the app's global CSS, so without that declaration the
|
|
64
|
+
token rules beat layered utilities on the icon. The fallbacks reproduce
|
|
65
|
+
the former render when no theme is loaded. Same rules as the
|
|
66
|
+
React/Vue/Angular styles.css. */
|
|
67
|
+
@layer st-icon {
|
|
68
|
+
:global(:where(.st-icon[stroke-width="2.25"]:not([data-st-icon-stroke]))) {
|
|
69
|
+
stroke-width: var(--st-component-icon-strokeWidth, 2.25);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(:where(.st-icon[stroke="currentColor"])) {
|
|
73
|
+
stroke: var(--st-component-icon-color, currentColor);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
package/dist/Icon.svelte.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ type IconProps = Omit<SVGAttributes<SVGElement>, "class"> & {
|
|
|
5
5
|
name: IconName;
|
|
6
6
|
/** Square size in px. Default 18 — the DS-standard inline glyph size. */
|
|
7
7
|
size?: number;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Stroke width. When omitted, the theme token
|
|
10
|
+
* `--st-component-icon-strokeWidth` applies (default 2.25 — the DS's
|
|
11
|
+
* existing lucide usage). When set, it wins over the token.
|
|
12
|
+
*/
|
|
9
13
|
strokeWidth?: number;
|
|
10
14
|
/**
|
|
11
15
|
* Accessible name. When set, the icon is exposed as an image with this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,KAAK,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1D,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd
|
|
1
|
+
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,KAAK,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1D,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BJ,QAAA,MAAM,IAAI,+CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|