@fundar/data-chart-telling 0.0.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/README.md +250 -0
- package/dist/charts/Chart.svelte +125 -0
- package/dist/charts/Chart.svelte.d.ts +42 -0
- package/dist/charts/bar/Chart.svelte +104 -0
- package/dist/charts/bar/Chart.svelte.d.ts +27 -0
- package/dist/charts/container/ChartContainer.svelte +127 -0
- package/dist/charts/container/ChartContainer.svelte.d.ts +14 -0
- package/dist/charts/heatmap/Chart.svelte +107 -0
- package/dist/charts/heatmap/Chart.svelte.d.ts +30 -0
- package/dist/charts/line/Chart.svelte +106 -0
- package/dist/charts/line/Chart.svelte.d.ts +27 -0
- package/dist/charts/pyramid/Chart.svelte +127 -0
- package/dist/charts/pyramid/Chart.svelte.d.ts +31 -0
- package/dist/configuration/config.svelte.d.ts +12 -0
- package/dist/configuration/config.svelte.js +159 -0
- package/dist/configuration/themes/compact.d.ts +2 -0
- package/dist/configuration/themes/compact.js +9 -0
- package/dist/configuration/themes/dark.d.ts +2 -0
- package/dist/configuration/themes/dark.js +17 -0
- package/dist/configuration/themes/default.d.ts +3 -0
- package/dist/configuration/themes/default.js +2 -0
- package/dist/configuration/themes/editorial.d.ts +2 -0
- package/dist/configuration/themes/editorial.js +14 -0
- package/dist/configuration/themes/index.d.ts +481 -0
- package/dist/configuration/themes/index.js +16 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +27 -0
- package/dist/layout/facet/FacetLayout.svelte +97 -0
- package/dist/layout/facet/FacetLayout.svelte.d.ts +35 -0
- package/dist/layout/legend/ContinuousSection.svelte +95 -0
- package/dist/layout/legend/ContinuousSection.svelte.d.ts +7 -0
- package/dist/layout/legend/DiscreteSection.svelte +87 -0
- package/dist/layout/legend/DiscreteSection.svelte.d.ts +7 -0
- package/dist/layout/legend/LegendLayout.svelte +47 -0
- package/dist/layout/legend/LegendLayout.svelte.d.ts +7 -0
- package/dist/layout/plot/PlotLayout.svelte +236 -0
- package/dist/layout/plot/PlotLayout.svelte.d.ts +70 -0
- package/dist/layout/timeline/Timeline.svelte +86 -0
- package/dist/layout/timeline/Timeline.svelte.d.ts +11 -0
- package/dist/layout/timeline/TimelineLayout.svelte +181 -0
- package/dist/layout/timeline/TimelineLayout.svelte.d.ts +38 -0
- package/dist/layout/tooltip/Tooltip.svelte +55 -0
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +12 -0
- package/dist/layout/tooltip/controller.svelte.d.ts +52 -0
- package/dist/layout/tooltip/controller.svelte.js +128 -0
- package/dist/layout/tooltip/hover.svelte.d.ts +7 -0
- package/dist/layout/tooltip/hover.svelte.js +28 -0
- package/dist/layout/tooltip/utils.d.ts +41 -0
- package/dist/layout/tooltip/utils.js +78 -0
- package/dist/plots/bar/Plot.svelte +176 -0
- package/dist/plots/bar/Plot.svelte.d.ts +26 -0
- package/dist/plots/heatmap/Plot.svelte +175 -0
- package/dist/plots/heatmap/Plot.svelte.d.ts +26 -0
- package/dist/plots/line/Plot.svelte +232 -0
- package/dist/plots/line/Plot.svelte.d.ts +26 -0
- package/dist/plots/markers/DeltaMarker.svelte +104 -0
- package/dist/plots/markers/DeltaMarker.svelte.d.ts +30 -0
- package/dist/plots/markers/DotMarker.svelte +41 -0
- package/dist/plots/markers/DotMarker.svelte.d.ts +31 -0
- package/dist/plots/markers/HoverMarker.svelte +78 -0
- package/dist/plots/markers/HoverMarker.svelte.d.ts +22 -0
- package/dist/plots/markers/PeakMarker.svelte +80 -0
- package/dist/plots/markers/PeakMarker.svelte.d.ts +13 -0
- package/dist/plots/markers/TextMarker.svelte +55 -0
- package/dist/plots/markers/TextMarker.svelte.d.ts +32 -0
- package/dist/plots/pyramid/Plot.svelte +282 -0
- package/dist/plots/pyramid/Plot.svelte.d.ts +26 -0
- package/dist/plots/utils/accessors.d.ts +6 -0
- package/dist/plots/utils/accessors.js +10 -0
- package/dist/plots/utils/delta.d.ts +12 -0
- package/dist/plots/utils/delta.js +69 -0
- package/dist/plots/utils/segments.d.ts +33 -0
- package/dist/plots/utils/segments.js +153 -0
- package/dist/stores/device.d.ts +7 -0
- package/dist/stores/device.js +39 -0
- package/dist/types/charts/common.d.ts +64 -0
- package/dist/types/charts/common.js +1 -0
- package/dist/types/charts/interpolate.d.ts +2 -0
- package/dist/types/charts/interpolate.js +1 -0
- package/dist/types/charts/legend.d.ts +29 -0
- package/dist/types/charts/legend.js +1 -0
- package/dist/types/charts/props.d.ts +35 -0
- package/dist/types/charts/props.js +1 -0
- package/dist/types/configuration/styling.d.ts +97 -0
- package/dist/types/configuration/styling.js +1 -0
- package/dist/types/layout/tooltip.d.ts +88 -0
- package/dist/types/layout/tooltip.js +1 -0
- package/dist/types/plots/common.d.ts +100 -0
- package/dist/types/plots/common.js +1 -0
- package/dist/types/plots/delta.d.ts +19 -0
- package/dist/types/plots/delta.js +1 -0
- package/dist/types/plots/markers.d.ts +56 -0
- package/dist/types/plots/markers.js +1 -0
- package/dist/types/plots/props.d.ts +23 -0
- package/dist/types/plots/props.js +1 -0
- package/dist/types/plots/styles.d.ts +176 -0
- package/dist/types/plots/styles.js +1 -0
- package/dist/types/viewport.d.ts +4 -0
- package/dist/types/viewport.js +1 -0
- package/dist/utils/color.d.ts +5 -0
- package/dist/utils/color.js +42 -0
- package/dist/utils/grouping.d.ts +14 -0
- package/dist/utils/grouping.js +36 -0
- package/dist/utils/interpolate.d.ts +30 -0
- package/dist/utils/interpolate.js +71 -0
- package/package.json +76 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ready-made theme presets — partial configs deep-merged over
|
|
3
|
+
* `DEFAULT_CONFIG` by `setConfiguration`. `DEFAULT_CONFIG` itself stays an
|
|
4
|
+
* opinion-free no-op (`font: 'inherit'`, `color: 'currentColor'`, …); these
|
|
5
|
+
* are the actual visual identities consumers can opt into.
|
|
6
|
+
*/
|
|
7
|
+
export declare const THEMES: {
|
|
8
|
+
Default: {
|
|
9
|
+
font?: string | undefined;
|
|
10
|
+
color?: string | undefined;
|
|
11
|
+
background?: string | undefined;
|
|
12
|
+
border?: string | undefined;
|
|
13
|
+
spacing?: {
|
|
14
|
+
headerPadding?: string | undefined;
|
|
15
|
+
legendPadding?: string | undefined;
|
|
16
|
+
captionPadding?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
title?: {
|
|
19
|
+
font?: string | undefined;
|
|
20
|
+
size?: string | undefined;
|
|
21
|
+
weight?: string | number | undefined;
|
|
22
|
+
color?: string | undefined;
|
|
23
|
+
leading?: string | undefined;
|
|
24
|
+
spacing?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
subtitle?: {
|
|
27
|
+
font?: string | undefined;
|
|
28
|
+
size?: string | undefined;
|
|
29
|
+
weight?: string | number | undefined;
|
|
30
|
+
color?: string | undefined;
|
|
31
|
+
leading?: string | undefined;
|
|
32
|
+
spacing?: string | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
caption?: {
|
|
35
|
+
font?: string | undefined;
|
|
36
|
+
size?: string | undefined;
|
|
37
|
+
weight?: string | number | undefined;
|
|
38
|
+
color?: string | undefined;
|
|
39
|
+
leading?: string | undefined;
|
|
40
|
+
spacing?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
legend?: {
|
|
43
|
+
font?: string | undefined;
|
|
44
|
+
size?: string | undefined;
|
|
45
|
+
weight?: string | number | undefined;
|
|
46
|
+
color?: string | undefined;
|
|
47
|
+
titleSize?: string | undefined;
|
|
48
|
+
titleWeight?: string | number | undefined;
|
|
49
|
+
gap?: string | undefined;
|
|
50
|
+
swatchSize?: string | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
axis?: {
|
|
53
|
+
color?: string | undefined;
|
|
54
|
+
fontSize?: number | undefined;
|
|
55
|
+
labelFontSize?: number | undefined;
|
|
56
|
+
titleFontSize?: number | undefined;
|
|
57
|
+
xTickSize?: number | undefined;
|
|
58
|
+
yTickSize?: number | undefined;
|
|
59
|
+
xTickPadding?: number | undefined;
|
|
60
|
+
yTickPadding?: number | undefined;
|
|
61
|
+
grid?: boolean | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
tooltip?: {
|
|
64
|
+
background?: string | undefined;
|
|
65
|
+
color?: string | undefined;
|
|
66
|
+
fontSize?: string | undefined;
|
|
67
|
+
padding?: string | undefined;
|
|
68
|
+
radius?: string | undefined;
|
|
69
|
+
border?: string | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
margins?: {
|
|
72
|
+
top?: number | undefined;
|
|
73
|
+
right?: number | undefined;
|
|
74
|
+
bottom?: number | undefined;
|
|
75
|
+
left?: number | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
palette?: string[] | undefined;
|
|
78
|
+
continuous?: {
|
|
79
|
+
min?: string | undefined;
|
|
80
|
+
max?: string | undefined;
|
|
81
|
+
labelColor?: string | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
line?: {
|
|
84
|
+
strokeWidth?: number | undefined;
|
|
85
|
+
dotRadius?: number | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
timeline?: {
|
|
88
|
+
axisColor?: string | undefined;
|
|
89
|
+
activeColor?: string | undefined;
|
|
90
|
+
thickness?: number | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
hover?: {
|
|
93
|
+
rule?: {
|
|
94
|
+
stroke?: string | undefined;
|
|
95
|
+
strokeWidth?: number | undefined;
|
|
96
|
+
strokeOpacity?: number | undefined;
|
|
97
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
98
|
+
strokeLinecap?: import("../../types/plots/styles").LineCap | undefined;
|
|
99
|
+
strokeLinejoin?: import("../../types/plots/styles").LineJoin | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
dot?: {
|
|
102
|
+
dotRadius?: number | undefined;
|
|
103
|
+
dotFill?: string | undefined;
|
|
104
|
+
dotFillOpacity?: number | undefined;
|
|
105
|
+
dotSymbol?: import("../..").SymbolType | undefined;
|
|
106
|
+
dotStroke?: string | undefined;
|
|
107
|
+
dotStrokeWidth?: number | undefined;
|
|
108
|
+
dotStrokeOpacity?: number | undefined;
|
|
109
|
+
dotStrokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
font?: {
|
|
112
|
+
fill?: string | undefined;
|
|
113
|
+
fontSize?: number | undefined;
|
|
114
|
+
fontWeight?: "normal" | "bold" | undefined;
|
|
115
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
116
|
+
textAnchor?: "start" | "middle" | "end" | undefined;
|
|
117
|
+
lineAnchor?: "top" | "middle" | "bottom" | undefined;
|
|
118
|
+
stroke?: string | undefined;
|
|
119
|
+
strokeWidth?: number | undefined;
|
|
120
|
+
paintOrder?: string | undefined;
|
|
121
|
+
dx?: number | undefined;
|
|
122
|
+
dy?: number | undefined;
|
|
123
|
+
} | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
};
|
|
126
|
+
Editorial: {
|
|
127
|
+
font?: string | undefined;
|
|
128
|
+
color?: string | undefined;
|
|
129
|
+
background?: string | undefined;
|
|
130
|
+
border?: string | undefined;
|
|
131
|
+
spacing?: {
|
|
132
|
+
headerPadding?: string | undefined;
|
|
133
|
+
legendPadding?: string | undefined;
|
|
134
|
+
captionPadding?: string | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
title?: {
|
|
137
|
+
font?: string | undefined;
|
|
138
|
+
size?: string | undefined;
|
|
139
|
+
weight?: string | number | undefined;
|
|
140
|
+
color?: string | undefined;
|
|
141
|
+
leading?: string | undefined;
|
|
142
|
+
spacing?: string | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
subtitle?: {
|
|
145
|
+
font?: string | undefined;
|
|
146
|
+
size?: string | undefined;
|
|
147
|
+
weight?: string | number | undefined;
|
|
148
|
+
color?: string | undefined;
|
|
149
|
+
leading?: string | undefined;
|
|
150
|
+
spacing?: string | undefined;
|
|
151
|
+
} | undefined;
|
|
152
|
+
caption?: {
|
|
153
|
+
font?: string | undefined;
|
|
154
|
+
size?: string | undefined;
|
|
155
|
+
weight?: string | number | undefined;
|
|
156
|
+
color?: string | undefined;
|
|
157
|
+
leading?: string | undefined;
|
|
158
|
+
spacing?: string | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
legend?: {
|
|
161
|
+
font?: string | undefined;
|
|
162
|
+
size?: string | undefined;
|
|
163
|
+
weight?: string | number | undefined;
|
|
164
|
+
color?: string | undefined;
|
|
165
|
+
titleSize?: string | undefined;
|
|
166
|
+
titleWeight?: string | number | undefined;
|
|
167
|
+
gap?: string | undefined;
|
|
168
|
+
swatchSize?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
axis?: {
|
|
171
|
+
color?: string | undefined;
|
|
172
|
+
fontSize?: number | undefined;
|
|
173
|
+
labelFontSize?: number | undefined;
|
|
174
|
+
titleFontSize?: number | undefined;
|
|
175
|
+
xTickSize?: number | undefined;
|
|
176
|
+
yTickSize?: number | undefined;
|
|
177
|
+
xTickPadding?: number | undefined;
|
|
178
|
+
yTickPadding?: number | undefined;
|
|
179
|
+
grid?: boolean | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
tooltip?: {
|
|
182
|
+
background?: string | undefined;
|
|
183
|
+
color?: string | undefined;
|
|
184
|
+
fontSize?: string | undefined;
|
|
185
|
+
padding?: string | undefined;
|
|
186
|
+
radius?: string | undefined;
|
|
187
|
+
border?: string | undefined;
|
|
188
|
+
} | undefined;
|
|
189
|
+
margins?: {
|
|
190
|
+
top?: number | undefined;
|
|
191
|
+
right?: number | undefined;
|
|
192
|
+
bottom?: number | undefined;
|
|
193
|
+
left?: number | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
palette?: string[] | undefined;
|
|
196
|
+
continuous?: {
|
|
197
|
+
min?: string | undefined;
|
|
198
|
+
max?: string | undefined;
|
|
199
|
+
labelColor?: string | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
line?: {
|
|
202
|
+
strokeWidth?: number | undefined;
|
|
203
|
+
dotRadius?: number | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
timeline?: {
|
|
206
|
+
axisColor?: string | undefined;
|
|
207
|
+
activeColor?: string | undefined;
|
|
208
|
+
thickness?: number | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
hover?: {
|
|
211
|
+
rule?: {
|
|
212
|
+
stroke?: string | undefined;
|
|
213
|
+
strokeWidth?: number | undefined;
|
|
214
|
+
strokeOpacity?: number | undefined;
|
|
215
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
216
|
+
strokeLinecap?: import("../../types/plots/styles").LineCap | undefined;
|
|
217
|
+
strokeLinejoin?: import("../../types/plots/styles").LineJoin | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
dot?: {
|
|
220
|
+
dotRadius?: number | undefined;
|
|
221
|
+
dotFill?: string | undefined;
|
|
222
|
+
dotFillOpacity?: number | undefined;
|
|
223
|
+
dotSymbol?: import("../..").SymbolType | undefined;
|
|
224
|
+
dotStroke?: string | undefined;
|
|
225
|
+
dotStrokeWidth?: number | undefined;
|
|
226
|
+
dotStrokeOpacity?: number | undefined;
|
|
227
|
+
dotStrokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
228
|
+
} | undefined;
|
|
229
|
+
font?: {
|
|
230
|
+
fill?: string | undefined;
|
|
231
|
+
fontSize?: number | undefined;
|
|
232
|
+
fontWeight?: "normal" | "bold" | undefined;
|
|
233
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
234
|
+
textAnchor?: "start" | "middle" | "end" | undefined;
|
|
235
|
+
lineAnchor?: "top" | "middle" | "bottom" | undefined;
|
|
236
|
+
stroke?: string | undefined;
|
|
237
|
+
strokeWidth?: number | undefined;
|
|
238
|
+
paintOrder?: string | undefined;
|
|
239
|
+
dx?: number | undefined;
|
|
240
|
+
dy?: number | undefined;
|
|
241
|
+
} | undefined;
|
|
242
|
+
} | undefined;
|
|
243
|
+
};
|
|
244
|
+
Dark: {
|
|
245
|
+
font?: string | undefined;
|
|
246
|
+
color?: string | undefined;
|
|
247
|
+
background?: string | undefined;
|
|
248
|
+
border?: string | undefined;
|
|
249
|
+
spacing?: {
|
|
250
|
+
headerPadding?: string | undefined;
|
|
251
|
+
legendPadding?: string | undefined;
|
|
252
|
+
captionPadding?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
title?: {
|
|
255
|
+
font?: string | undefined;
|
|
256
|
+
size?: string | undefined;
|
|
257
|
+
weight?: string | number | undefined;
|
|
258
|
+
color?: string | undefined;
|
|
259
|
+
leading?: string | undefined;
|
|
260
|
+
spacing?: string | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
subtitle?: {
|
|
263
|
+
font?: string | undefined;
|
|
264
|
+
size?: string | undefined;
|
|
265
|
+
weight?: string | number | undefined;
|
|
266
|
+
color?: string | undefined;
|
|
267
|
+
leading?: string | undefined;
|
|
268
|
+
spacing?: string | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
caption?: {
|
|
271
|
+
font?: string | undefined;
|
|
272
|
+
size?: string | undefined;
|
|
273
|
+
weight?: string | number | undefined;
|
|
274
|
+
color?: string | undefined;
|
|
275
|
+
leading?: string | undefined;
|
|
276
|
+
spacing?: string | undefined;
|
|
277
|
+
} | undefined;
|
|
278
|
+
legend?: {
|
|
279
|
+
font?: string | undefined;
|
|
280
|
+
size?: string | undefined;
|
|
281
|
+
weight?: string | number | undefined;
|
|
282
|
+
color?: string | undefined;
|
|
283
|
+
titleSize?: string | undefined;
|
|
284
|
+
titleWeight?: string | number | undefined;
|
|
285
|
+
gap?: string | undefined;
|
|
286
|
+
swatchSize?: string | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
axis?: {
|
|
289
|
+
color?: string | undefined;
|
|
290
|
+
fontSize?: number | undefined;
|
|
291
|
+
labelFontSize?: number | undefined;
|
|
292
|
+
titleFontSize?: number | undefined;
|
|
293
|
+
xTickSize?: number | undefined;
|
|
294
|
+
yTickSize?: number | undefined;
|
|
295
|
+
xTickPadding?: number | undefined;
|
|
296
|
+
yTickPadding?: number | undefined;
|
|
297
|
+
grid?: boolean | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
tooltip?: {
|
|
300
|
+
background?: string | undefined;
|
|
301
|
+
color?: string | undefined;
|
|
302
|
+
fontSize?: string | undefined;
|
|
303
|
+
padding?: string | undefined;
|
|
304
|
+
radius?: string | undefined;
|
|
305
|
+
border?: string | undefined;
|
|
306
|
+
} | undefined;
|
|
307
|
+
margins?: {
|
|
308
|
+
top?: number | undefined;
|
|
309
|
+
right?: number | undefined;
|
|
310
|
+
bottom?: number | undefined;
|
|
311
|
+
left?: number | undefined;
|
|
312
|
+
} | undefined;
|
|
313
|
+
palette?: string[] | undefined;
|
|
314
|
+
continuous?: {
|
|
315
|
+
min?: string | undefined;
|
|
316
|
+
max?: string | undefined;
|
|
317
|
+
labelColor?: string | undefined;
|
|
318
|
+
} | undefined;
|
|
319
|
+
line?: {
|
|
320
|
+
strokeWidth?: number | undefined;
|
|
321
|
+
dotRadius?: number | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
timeline?: {
|
|
324
|
+
axisColor?: string | undefined;
|
|
325
|
+
activeColor?: string | undefined;
|
|
326
|
+
thickness?: number | undefined;
|
|
327
|
+
} | undefined;
|
|
328
|
+
hover?: {
|
|
329
|
+
rule?: {
|
|
330
|
+
stroke?: string | undefined;
|
|
331
|
+
strokeWidth?: number | undefined;
|
|
332
|
+
strokeOpacity?: number | undefined;
|
|
333
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
334
|
+
strokeLinecap?: import("../../types/plots/styles").LineCap | undefined;
|
|
335
|
+
strokeLinejoin?: import("../../types/plots/styles").LineJoin | undefined;
|
|
336
|
+
} | undefined;
|
|
337
|
+
dot?: {
|
|
338
|
+
dotRadius?: number | undefined;
|
|
339
|
+
dotFill?: string | undefined;
|
|
340
|
+
dotFillOpacity?: number | undefined;
|
|
341
|
+
dotSymbol?: import("../..").SymbolType | undefined;
|
|
342
|
+
dotStroke?: string | undefined;
|
|
343
|
+
dotStrokeWidth?: number | undefined;
|
|
344
|
+
dotStrokeOpacity?: number | undefined;
|
|
345
|
+
dotStrokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
346
|
+
} | undefined;
|
|
347
|
+
font?: {
|
|
348
|
+
fill?: string | undefined;
|
|
349
|
+
fontSize?: number | undefined;
|
|
350
|
+
fontWeight?: "normal" | "bold" | undefined;
|
|
351
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
352
|
+
textAnchor?: "start" | "middle" | "end" | undefined;
|
|
353
|
+
lineAnchor?: "top" | "middle" | "bottom" | undefined;
|
|
354
|
+
stroke?: string | undefined;
|
|
355
|
+
strokeWidth?: number | undefined;
|
|
356
|
+
paintOrder?: string | undefined;
|
|
357
|
+
dx?: number | undefined;
|
|
358
|
+
dy?: number | undefined;
|
|
359
|
+
} | undefined;
|
|
360
|
+
} | undefined;
|
|
361
|
+
};
|
|
362
|
+
Compact: {
|
|
363
|
+
font?: string | undefined;
|
|
364
|
+
color?: string | undefined;
|
|
365
|
+
background?: string | undefined;
|
|
366
|
+
border?: string | undefined;
|
|
367
|
+
spacing?: {
|
|
368
|
+
headerPadding?: string | undefined;
|
|
369
|
+
legendPadding?: string | undefined;
|
|
370
|
+
captionPadding?: string | undefined;
|
|
371
|
+
} | undefined;
|
|
372
|
+
title?: {
|
|
373
|
+
font?: string | undefined;
|
|
374
|
+
size?: string | undefined;
|
|
375
|
+
weight?: string | number | undefined;
|
|
376
|
+
color?: string | undefined;
|
|
377
|
+
leading?: string | undefined;
|
|
378
|
+
spacing?: string | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
subtitle?: {
|
|
381
|
+
font?: string | undefined;
|
|
382
|
+
size?: string | undefined;
|
|
383
|
+
weight?: string | number | undefined;
|
|
384
|
+
color?: string | undefined;
|
|
385
|
+
leading?: string | undefined;
|
|
386
|
+
spacing?: string | undefined;
|
|
387
|
+
} | undefined;
|
|
388
|
+
caption?: {
|
|
389
|
+
font?: string | undefined;
|
|
390
|
+
size?: string | undefined;
|
|
391
|
+
weight?: string | number | undefined;
|
|
392
|
+
color?: string | undefined;
|
|
393
|
+
leading?: string | undefined;
|
|
394
|
+
spacing?: string | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
legend?: {
|
|
397
|
+
font?: string | undefined;
|
|
398
|
+
size?: string | undefined;
|
|
399
|
+
weight?: string | number | undefined;
|
|
400
|
+
color?: string | undefined;
|
|
401
|
+
titleSize?: string | undefined;
|
|
402
|
+
titleWeight?: string | number | undefined;
|
|
403
|
+
gap?: string | undefined;
|
|
404
|
+
swatchSize?: string | undefined;
|
|
405
|
+
} | undefined;
|
|
406
|
+
axis?: {
|
|
407
|
+
color?: string | undefined;
|
|
408
|
+
fontSize?: number | undefined;
|
|
409
|
+
labelFontSize?: number | undefined;
|
|
410
|
+
titleFontSize?: number | undefined;
|
|
411
|
+
xTickSize?: number | undefined;
|
|
412
|
+
yTickSize?: number | undefined;
|
|
413
|
+
xTickPadding?: number | undefined;
|
|
414
|
+
yTickPadding?: number | undefined;
|
|
415
|
+
grid?: boolean | undefined;
|
|
416
|
+
} | undefined;
|
|
417
|
+
tooltip?: {
|
|
418
|
+
background?: string | undefined;
|
|
419
|
+
color?: string | undefined;
|
|
420
|
+
fontSize?: string | undefined;
|
|
421
|
+
padding?: string | undefined;
|
|
422
|
+
radius?: string | undefined;
|
|
423
|
+
border?: string | undefined;
|
|
424
|
+
} | undefined;
|
|
425
|
+
margins?: {
|
|
426
|
+
top?: number | undefined;
|
|
427
|
+
right?: number | undefined;
|
|
428
|
+
bottom?: number | undefined;
|
|
429
|
+
left?: number | undefined;
|
|
430
|
+
} | undefined;
|
|
431
|
+
palette?: string[] | undefined;
|
|
432
|
+
continuous?: {
|
|
433
|
+
min?: string | undefined;
|
|
434
|
+
max?: string | undefined;
|
|
435
|
+
labelColor?: string | undefined;
|
|
436
|
+
} | undefined;
|
|
437
|
+
line?: {
|
|
438
|
+
strokeWidth?: number | undefined;
|
|
439
|
+
dotRadius?: number | undefined;
|
|
440
|
+
} | undefined;
|
|
441
|
+
timeline?: {
|
|
442
|
+
axisColor?: string | undefined;
|
|
443
|
+
activeColor?: string | undefined;
|
|
444
|
+
thickness?: number | undefined;
|
|
445
|
+
} | undefined;
|
|
446
|
+
hover?: {
|
|
447
|
+
rule?: {
|
|
448
|
+
stroke?: string | undefined;
|
|
449
|
+
strokeWidth?: number | undefined;
|
|
450
|
+
strokeOpacity?: number | undefined;
|
|
451
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
452
|
+
strokeLinecap?: import("../../types/plots/styles").LineCap | undefined;
|
|
453
|
+
strokeLinejoin?: import("../../types/plots/styles").LineJoin | undefined;
|
|
454
|
+
} | undefined;
|
|
455
|
+
dot?: {
|
|
456
|
+
dotRadius?: number | undefined;
|
|
457
|
+
dotFill?: string | undefined;
|
|
458
|
+
dotFillOpacity?: number | undefined;
|
|
459
|
+
dotSymbol?: import("../..").SymbolType | undefined;
|
|
460
|
+
dotStroke?: string | undefined;
|
|
461
|
+
dotStrokeWidth?: number | undefined;
|
|
462
|
+
dotStrokeOpacity?: number | undefined;
|
|
463
|
+
dotStrokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
464
|
+
} | undefined;
|
|
465
|
+
font?: {
|
|
466
|
+
fill?: string | undefined;
|
|
467
|
+
fontSize?: number | undefined;
|
|
468
|
+
fontWeight?: "normal" | "bold" | undefined;
|
|
469
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
470
|
+
textAnchor?: "start" | "middle" | "end" | undefined;
|
|
471
|
+
lineAnchor?: "top" | "middle" | "bottom" | undefined;
|
|
472
|
+
stroke?: string | undefined;
|
|
473
|
+
strokeWidth?: number | undefined;
|
|
474
|
+
paintOrder?: string | undefined;
|
|
475
|
+
dx?: number | undefined;
|
|
476
|
+
dy?: number | undefined;
|
|
477
|
+
} | undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
export type ThemeName = keyof typeof THEMES;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DEFAULT_THEME } from './default';
|
|
2
|
+
import { EDITORIAL_THEME } from './editorial';
|
|
3
|
+
import { DARK_THEME } from './dark';
|
|
4
|
+
import { COMPACT_THEME } from './compact';
|
|
5
|
+
/**
|
|
6
|
+
* Ready-made theme presets — partial configs deep-merged over
|
|
7
|
+
* `DEFAULT_CONFIG` by `setConfiguration`. `DEFAULT_CONFIG` itself stays an
|
|
8
|
+
* opinion-free no-op (`font: 'inherit'`, `color: 'currentColor'`, …); these
|
|
9
|
+
* are the actual visual identities consumers can opt into.
|
|
10
|
+
*/
|
|
11
|
+
export const THEMES = {
|
|
12
|
+
Default: DEFAULT_THEME,
|
|
13
|
+
Editorial: EDITORIAL_THEME,
|
|
14
|
+
Dark: DARK_THEME,
|
|
15
|
+
Compact: COMPACT_THEME,
|
|
16
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { default as BarPlot } from './plots/bar/Plot.svelte';
|
|
2
|
+
export { default as HeatmapPlot } from './plots/heatmap/Plot.svelte';
|
|
3
|
+
export { default as LinePlot } from './plots/line/Plot.svelte';
|
|
4
|
+
export { default as PyramidPlot } from './plots/pyramid/Plot.svelte';
|
|
5
|
+
export { default as Chart } from './charts/Chart.svelte';
|
|
6
|
+
export { default as BarChart } from './charts/bar/Chart.svelte';
|
|
7
|
+
export { default as HeatmapChart } from './charts/heatmap/Chart.svelte';
|
|
8
|
+
export { default as LineChart } from './charts/line/Chart.svelte';
|
|
9
|
+
export { default as PyramidChart } from './charts/pyramid/Chart.svelte';
|
|
10
|
+
export { default as ChartContainer } from './charts/container/ChartContainer.svelte';
|
|
11
|
+
export { default as PlotLayout } from './layout/plot/PlotLayout.svelte';
|
|
12
|
+
export { default as Timeline } from './layout/timeline/Timeline.svelte';
|
|
13
|
+
export { default as TimelineLayout } from './layout/timeline/TimelineLayout.svelte';
|
|
14
|
+
export { default as FacetLayout } from './layout/facet/FacetLayout.svelte';
|
|
15
|
+
export { default as LegendLayout } from './layout/legend/LegendLayout.svelte';
|
|
16
|
+
export { default as Tooltip } from './layout/tooltip/Tooltip.svelte';
|
|
17
|
+
export { default as HoverMarker } from './plots/markers/HoverMarker.svelte';
|
|
18
|
+
export { setConfiguration, getConfiguration, resetConfiguration, configToCssVars, cssVarsStyle, DEFAULT_CONFIG, } from './configuration/config.svelte';
|
|
19
|
+
export { THEMES } from './configuration/themes';
|
|
20
|
+
export type { ThemeName } from './configuration/themes';
|
|
21
|
+
export { groupBy, buildSeries } from './utils/grouping';
|
|
22
|
+
export { makeColorScale, normalize, resolveCssColor, paletteColor } from './utils/color';
|
|
23
|
+
export type { AxisValue, Accessor, AxisScale, ScalesConfig, Series, SeriesProps, DataProps } from './types/plots/common';
|
|
24
|
+
export type { DeltaConfig, } from './types/plots/delta';
|
|
25
|
+
export type { SymbolType, LineStyle, StrokeStyle, DotStyle, FontStyle, LineSegmentStyle, BarSegmentStyle, CellSegmentStyle, Range, Area, Segment, SeriesAwareSegmentsMap, SegmentsMap, ValueAnchor, ValuesStyle, ColorsStyle, PlotStyles, } from './types/plots/styles';
|
|
26
|
+
export type { Marker, MarkerProps } from './types/plots/markers';
|
|
27
|
+
export type { PlotProps } from './types/plots/props';
|
|
28
|
+
export type { TimeValue, Orientation, FacetColumns, FacetConfig, TimelineConfig, ChartPlotContext, ChartPlotSnippet, } from './types/charts/common';
|
|
29
|
+
export type { LegendSection, DiscreteLegendSection, ContinuousLegendSection, LegendItem, } from './types/charts/legend';
|
|
30
|
+
export type { HoverStrategy, TooltipOptions, TooltipProp, TooltipRuntime, } from './types/layout/tooltip';
|
|
31
|
+
export type { ChartConfig, ChartConfigInput, TextStyle } from './types/configuration/styling';
|
|
32
|
+
export type { ChartProps } from './types/charts/props';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// ── Plots ───────────────────────────────────────────────────────────────────
|
|
2
|
+
// Low-level graphics: one specific mark family each, drawn into a given box.
|
|
3
|
+
export { default as BarPlot } from './plots/bar/Plot.svelte';
|
|
4
|
+
export { default as HeatmapPlot } from './plots/heatmap/Plot.svelte';
|
|
5
|
+
export { default as LinePlot } from './plots/line/Plot.svelte';
|
|
6
|
+
export { default as PyramidPlot } from './plots/pyramid/Plot.svelte';
|
|
7
|
+
// ── Charts ──────────────────────────────────────────────────────────────────
|
|
8
|
+
// High-level, plot-agnostic chrome plus ready-made chart kinds.
|
|
9
|
+
export { default as Chart } from './charts/Chart.svelte';
|
|
10
|
+
export { default as BarChart } from './charts/bar/Chart.svelte';
|
|
11
|
+
export { default as HeatmapChart } from './charts/heatmap/Chart.svelte';
|
|
12
|
+
export { default as LineChart } from './charts/line/Chart.svelte';
|
|
13
|
+
export { default as PyramidChart } from './charts/pyramid/Chart.svelte';
|
|
14
|
+
// Interchangeable layout primitives (compose your own chart kinds with these).
|
|
15
|
+
export { default as ChartContainer } from './charts/container/ChartContainer.svelte';
|
|
16
|
+
export { default as PlotLayout } from './layout/plot/PlotLayout.svelte';
|
|
17
|
+
export { default as Timeline } from './layout/timeline/Timeline.svelte';
|
|
18
|
+
export { default as TimelineLayout } from './layout/timeline/TimelineLayout.svelte';
|
|
19
|
+
export { default as FacetLayout } from './layout/facet/FacetLayout.svelte';
|
|
20
|
+
export { default as LegendLayout } from './layout/legend/LegendLayout.svelte';
|
|
21
|
+
export { default as Tooltip } from './layout/tooltip/Tooltip.svelte';
|
|
22
|
+
export { default as HoverMarker } from './plots/markers/HoverMarker.svelte';
|
|
23
|
+
export { setConfiguration, getConfiguration, resetConfiguration, configToCssVars, cssVarsStyle, DEFAULT_CONFIG, } from './configuration/config.svelte';
|
|
24
|
+
export { THEMES } from './configuration/themes';
|
|
25
|
+
// ── Utils ─────────────────────────────────────────────────────────────────────
|
|
26
|
+
export { groupBy, buildSeries } from './utils/grouping';
|
|
27
|
+
export { makeColorScale, normalize, resolveCssColor, paletteColor } from './utils/color';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts" generics="TRow extends Record<string, unknown>">
|
|
2
|
+
import { isMobile } from '../../stores/device';
|
|
3
|
+
import { groupBy } from '../../utils/grouping';
|
|
4
|
+
import type {
|
|
5
|
+
FacetColumns,
|
|
6
|
+
FacetCellSnippet,
|
|
7
|
+
} from '../../types/charts/common';
|
|
8
|
+
import type { Accessor } from '../../types/plots/common';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Small-multiples layout. It splits the data by `by`, arranges the groups in a
|
|
12
|
+
* responsive grid and renders each group through the `cell` snippet with its
|
|
13
|
+
* own measured box. Like the other primitives it never draws the plot itself —
|
|
14
|
+
* any plot that accepts `{ data, width, height }` can be faceted.
|
|
15
|
+
*/
|
|
16
|
+
let {
|
|
17
|
+
data,
|
|
18
|
+
by,
|
|
19
|
+
columns = { desktop: 3, mobile: 1 },
|
|
20
|
+
values,
|
|
21
|
+
gap = 12,
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
cell,
|
|
25
|
+
}: {
|
|
26
|
+
data: TRow[];
|
|
27
|
+
by: Accessor<TRow, unknown>;
|
|
28
|
+
columns?: FacetColumns;
|
|
29
|
+
values?: string[];
|
|
30
|
+
gap?: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
cell: FacetCellSnippet<TRow>;
|
|
34
|
+
} = $props();
|
|
35
|
+
|
|
36
|
+
const groups = $derived(groupBy(data, by));
|
|
37
|
+
|
|
38
|
+
const entries = $derived.by((): [string, TRow[]][] => {
|
|
39
|
+
if (!values) return [...groups.entries()];
|
|
40
|
+
return values
|
|
41
|
+
.filter((v) => groups.has(v))
|
|
42
|
+
.map((v) => [v, groups.get(v)!] as [string, TRow[]]);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const cols = $derived.by(() => {
|
|
46
|
+
const desired =
|
|
47
|
+
typeof columns === 'number'
|
|
48
|
+
? columns
|
|
49
|
+
: $isMobile
|
|
50
|
+
? columns.mobile
|
|
51
|
+
: columns.desktop;
|
|
52
|
+
return Math.max(1, Math.min(desired, entries.length || 1));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const rows = $derived(Math.ceil((entries.length || 1) / cols));
|
|
56
|
+
const cellWidth = $derived(Math.max(0, Math.floor((width - (cols - 1) * gap) / cols)));
|
|
57
|
+
const TITLE_H = 24;
|
|
58
|
+
const cellHeight = $derived(
|
|
59
|
+
Math.max(0, Math.floor((height - (rows - 1) * gap) / rows) - TITLE_H),
|
|
60
|
+
);
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<div
|
|
64
|
+
class="dct-facet"
|
|
65
|
+
style:grid-template-columns="repeat({cols}, 1fr)"
|
|
66
|
+
style:gap="{gap}px"
|
|
67
|
+
>
|
|
68
|
+
{#each entries as [facetValue, rowsForCell] (facetValue)}
|
|
69
|
+
<div class="dct-facet__cell">
|
|
70
|
+
<div class="dct-facet__title">{facetValue}</div>
|
|
71
|
+
{#if cellWidth > 0 && cellHeight > 0}
|
|
72
|
+
{@render cell({ facetValue, data: rowsForCell, width: cellWidth, height: cellHeight })}
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
{/each}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<style>
|
|
79
|
+
.dct-facet {
|
|
80
|
+
display: grid;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}
|
|
84
|
+
.dct-facet__cell {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
min-height: 0;
|
|
89
|
+
}
|
|
90
|
+
.dct-facet__title {
|
|
91
|
+
flex: 0 0 auto;
|
|
92
|
+
font-size: 0.85rem;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
text-align: center;
|
|
95
|
+
opacity: 0.9;
|
|
96
|
+
}
|
|
97
|
+
</style>
|