svelteplot 0.3.5-pr-121.9 → 0.3.5

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.
Files changed (127) hide show
  1. package/dist/Mark.svelte.d.ts +23 -23
  2. package/dist/Plot.svelte +1 -1
  3. package/dist/constants.d.ts +1 -1
  4. package/dist/core/FacetAxes.svelte +0 -2
  5. package/dist/helpers/autoScales.d.ts +1 -1
  6. package/dist/helpers/autoTicks.d.ts +1 -1
  7. package/dist/helpers/autoTimeFormat.d.ts +2 -2
  8. package/dist/helpers/autoTimeFormat.js +1 -1
  9. package/dist/helpers/callWithProps.d.ts +1 -1
  10. package/dist/helpers/colors.d.ts +2 -2
  11. package/dist/helpers/curves.d.ts +1 -1
  12. package/dist/helpers/facets.d.ts +1 -1
  13. package/dist/helpers/getBaseStyles.d.ts +2 -2
  14. package/dist/helpers/group.d.ts +1 -1
  15. package/dist/helpers/index.d.ts +6 -3
  16. package/dist/helpers/isDataRecord.d.ts +1 -1
  17. package/dist/helpers/isRawValue.d.ts +1 -1
  18. package/dist/helpers/reduce.d.ts +1 -1
  19. package/dist/helpers/regressionLoess.d.ts +1 -1
  20. package/dist/helpers/resolve.d.ts +2 -2
  21. package/dist/helpers/scales.d.ts +2 -2
  22. package/dist/helpers/typeChecks.d.ts +5 -5
  23. package/dist/marks/Area.svelte +2 -2
  24. package/dist/marks/Area.svelte.d.ts +24 -23
  25. package/dist/marks/AreaX.svelte.d.ts +23 -24
  26. package/dist/marks/AreaY.svelte.d.ts +23 -24
  27. package/dist/marks/Arrow.svelte.d.ts +22 -22
  28. package/dist/marks/AxisX.svelte +16 -20
  29. package/dist/marks/AxisX.svelte.d.ts +24 -25
  30. package/dist/marks/AxisY.svelte +14 -33
  31. package/dist/marks/AxisY.svelte.d.ts +24 -26
  32. package/dist/marks/BarX.svelte +1 -1
  33. package/dist/marks/BarX.svelte.d.ts +22 -22
  34. package/dist/marks/BarY.svelte +1 -1
  35. package/dist/marks/BarY.svelte.d.ts +22 -22
  36. package/dist/marks/BollingerX.svelte +1 -1
  37. package/dist/marks/BollingerX.svelte.d.ts +73 -2
  38. package/dist/marks/BollingerY.svelte +1 -1
  39. package/dist/marks/BollingerY.svelte.d.ts +73 -2
  40. package/dist/marks/BoxX.svelte +1 -1
  41. package/dist/marks/BoxY.svelte +1 -1
  42. package/dist/marks/BoxY.svelte.d.ts +65 -6
  43. package/dist/marks/Cell.svelte +1 -1
  44. package/dist/marks/Cell.svelte.d.ts +22 -22
  45. package/dist/marks/CellX.svelte +1 -1
  46. package/dist/marks/CellY.svelte +1 -1
  47. package/dist/marks/ColorLegend.svelte +2 -4
  48. package/dist/marks/CustomMark.svelte.d.ts +71 -2
  49. package/dist/marks/DifferenceY.svelte +1 -1
  50. package/dist/marks/DifferenceY.svelte.d.ts +66 -7
  51. package/dist/marks/Dot.svelte +1 -1
  52. package/dist/marks/Dot.svelte.d.ts +22 -22
  53. package/dist/marks/DotX.svelte +1 -1
  54. package/dist/marks/DotX.svelte.d.ts +23 -23
  55. package/dist/marks/DotY.svelte +1 -1
  56. package/dist/marks/DotY.svelte.d.ts +23 -23
  57. package/dist/marks/Geo.svelte +1 -1
  58. package/dist/marks/Geo.svelte.d.ts +22 -22
  59. package/dist/marks/GridX.svelte.d.ts +22 -22
  60. package/dist/marks/GridY.svelte.d.ts +22 -22
  61. package/dist/marks/Line.svelte.d.ts +23 -23
  62. package/dist/marks/LineX.svelte +2 -2
  63. package/dist/marks/LineX.svelte.d.ts +3 -4
  64. package/dist/marks/LineY.svelte +2 -2
  65. package/dist/marks/LineY.svelte.d.ts +3 -4
  66. package/dist/marks/Link.svelte.d.ts +22 -22
  67. package/dist/marks/Rect.svelte +1 -1
  68. package/dist/marks/Rect.svelte.d.ts +22 -22
  69. package/dist/marks/RectX.svelte +2 -2
  70. package/dist/marks/RectX.svelte.d.ts +1 -1
  71. package/dist/marks/RectY.svelte +2 -2
  72. package/dist/marks/RectY.svelte.d.ts +1 -1
  73. package/dist/marks/RuleX.svelte.d.ts +22 -22
  74. package/dist/marks/RuleY.svelte.d.ts +22 -22
  75. package/dist/marks/Spike.svelte.d.ts +23 -23
  76. package/dist/marks/Text.svelte +1 -1
  77. package/dist/marks/Text.svelte.d.ts +23 -23
  78. package/dist/marks/TickX.svelte +1 -1
  79. package/dist/marks/TickX.svelte.d.ts +22 -22
  80. package/dist/marks/TickY.svelte +1 -1
  81. package/dist/marks/TickY.svelte.d.ts +22 -22
  82. package/dist/marks/Vector.svelte +1 -1
  83. package/dist/marks/Vector.svelte.d.ts +22 -22
  84. package/dist/marks/helpers/Anchor.svelte +1 -1
  85. package/dist/marks/helpers/AreaCanvas.svelte +1 -1
  86. package/dist/marks/helpers/BaseAxisX.svelte +2 -4
  87. package/dist/marks/helpers/BaseAxisY.svelte +6 -8
  88. package/dist/marks/helpers/BaseAxisY.svelte.d.ts +0 -2
  89. package/dist/marks/helpers/CanvasLayer.svelte +1 -1
  90. package/dist/marks/helpers/DotCanvas.svelte +1 -1
  91. package/dist/marks/helpers/LineCanvas.svelte +1 -1
  92. package/dist/marks/helpers/LinearGradientX.svelte +1 -1
  93. package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
  94. package/dist/marks/helpers/LinearGradientY.svelte +1 -1
  95. package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
  96. package/dist/marks/helpers/MultilineText.svelte +1 -1
  97. package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
  98. package/dist/marks/helpers/RectPath.svelte +2 -2
  99. package/dist/marks/helpers/RectPath.svelte.d.ts +1 -1
  100. package/dist/marks/helpers/Regression.svelte +2 -2
  101. package/dist/marks/helpers/events.d.ts +1 -1
  102. package/dist/transforms/bin.d.ts +2 -2
  103. package/dist/transforms/bollinger.d.ts +67 -2
  104. package/dist/transforms/centroid.d.ts +1 -1
  105. package/dist/transforms/filter.d.ts +1 -1
  106. package/dist/transforms/group.d.ts +13 -5
  107. package/dist/transforms/interval.d.ts +123 -3
  108. package/dist/transforms/jitter.d.ts +1 -1
  109. package/dist/transforms/map.d.ts +1 -1
  110. package/dist/transforms/normalize.d.ts +1 -1
  111. package/dist/transforms/recordize.d.ts +1 -1
  112. package/dist/transforms/rename.d.ts +2 -2
  113. package/dist/transforms/select.d.ts +428 -8
  114. package/dist/transforms/shift.d.ts +1 -1
  115. package/dist/transforms/sort.d.ts +243 -4
  116. package/dist/transforms/stack.d.ts +1 -1
  117. package/dist/transforms/window.d.ts +131 -3
  118. package/dist/types/channel.d.ts +1 -1
  119. package/dist/types/data.d.ts +1 -1
  120. package/dist/types/facet.d.ts +1 -1
  121. package/dist/types/index.d.ts +4 -4
  122. package/dist/types/mark.d.ts +2 -2
  123. package/dist/types/plot.d.ts +3 -3
  124. package/dist/types/scale.d.ts +1 -1
  125. package/dist/types.d.ts +834 -0
  126. package/dist/types.js +1 -0
  127. package/package.json +124 -126
@@ -0,0 +1,834 @@
1
+ import type { ScaleBand, ScaleLinear, ScaleOrdinal } from 'd3-scale';
2
+ import type { ComponentProps, Snippet } from 'svelte';
3
+ import type { MouseEventHandler } from 'svelte/elements';
4
+ import type { MarkerShape } from './marks/helpers/Marker.svelte';
5
+ import type { Writable } from 'svelte/store';
6
+ import type * as CSS from 'csstype';
7
+ import type { Area, AreaX, AreaY, Arrow, AxisX, AxisY, BarX, BarY, BoxX, BoxY, Brush, BrushX, BrushY, Cell, Dot, Frame, Geo, Graticule, GridX, GridY, Line, Link, Pointer, Rect, RectX, RectY, RuleX, RuleY, Sphere, Spike, Text, TickX, TickY, Vector } from './marks';
8
+ import type { GeoProjection } from 'd3-geo';
9
+ import type { Clip } from './helpers/projection';
10
+ export type MarkType = 'area' | 'arrow' | 'axisX' | 'axisY' | 'barX' | 'barY' | 'cell' | 'dot' | 'vector' | 'frame' | 'geo' | 'gridX' | 'gridY' | 'line' | 'rect' | 'regression' | 'ruleX' | 'ruleY' | 'swoopyArrow' | 'text' | 'tickX' | 'tickY';
11
+ export type ScaleName = 'x' | 'y' | 'r' | 'color' | 'opacity' | 'length' | 'symbol' | 'fx' | 'fy' | 'projection';
12
+ export type ScaleType = 'linear' | 'pow' | 'sqrt' | 'log' | 'symlog' | 'time' | 'point' | 'ordinal' | 'sequential' | 'band' | 'categorical' | 'cyclical' | 'threshold' | 'quantile-cont' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
13
+ export type Mark<T> = {
14
+ id: symbol;
15
+ type: MarkType;
16
+ channels: ScaledChannelName[];
17
+ scales: Set<ScaleName>;
18
+ data: DataRecord<T>[];
19
+ options: T;
20
+ };
21
+ export type ScaledChannelName = 'fill' | 'fillOpacity' | 'opacity' | 'r' | 'length' | 'stroke' | 'strokeOpacity' | 'symbol' | 'fx' | 'fy' | 'x' | 'x1' | 'x2' | 'y' | 'y1' | 'y2';
22
+ export type ChannelName = ScaledChannelName | 'z' | 'sort' | 'filter' | 'interval';
23
+ export type RawValue = number | Date | boolean | string | symbol;
24
+ export type ScaleOptions = {
25
+ /**
26
+ * Override the automatic scale type detection.
27
+ */
28
+ type: ScaleType | 'auto';
29
+ /**
30
+ * Set a custom domain for the scale instead of auto-computing the domain
31
+ * from the mark data channels.
32
+ */
33
+ domain?: RawValue[];
34
+ /**
35
+ * Set a custom range for the scale.
36
+ */
37
+ range?: RawValue[];
38
+ /**
39
+ * Reverse the scale.
40
+ */
41
+ reverse: boolean;
42
+ label?: string;
43
+ interval?: string | number;
44
+ clamp: boolean;
45
+ nice: boolean;
46
+ zero: boolean;
47
+ round: boolean;
48
+ percent: boolean;
49
+ transform?: (d: RawValue) => RawValue;
50
+ /**
51
+ * set the padding for band scales
52
+ */
53
+ padding: number;
54
+ /**
55
+ * set the align for band or point scales
56
+ */
57
+ align: number;
58
+ /**
59
+ * set the inner padding for band scales
60
+ */
61
+ paddingInner?: number;
62
+ /**
63
+ * set the outer padding for band scales
64
+ */
65
+ paddingOuter?: number;
66
+ insetLeft?: number;
67
+ insetRight?: number;
68
+ insetTop?: number;
69
+ insetBottom?: number;
70
+ ticks?: (number | Date)[];
71
+ tickSpacing: number;
72
+ base?: number;
73
+ sort?: ChannelAccessor | ((a: RawValue, b: RawValue) => number) | {
74
+ channel: string;
75
+ order: 'ascending' | 'descending';
76
+ };
77
+ constant?: number;
78
+ };
79
+ export type ColorScaleOptions = ScaleOptions & {
80
+ legend: boolean;
81
+ type: ScaleType | 'categorical' | 'sequential' | 'cyclical' | 'threshold' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
82
+ scheme: string;
83
+ /**
84
+ * fallback color used for null/undefined
85
+ */
86
+ unknown: string;
87
+ /**
88
+ * center value for diverging scales
89
+ */
90
+ pivot: number;
91
+ /**
92
+ * number of colors for quantize and quantile-threshold scales
93
+ */
94
+ n: number;
95
+ interpolate: (d: any) => typeof d;
96
+ /**
97
+ * The tick format for the color scale legend.
98
+ */
99
+ tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
100
+ };
101
+ export type AxisXAnchor = 'bottom' | 'top' | 'both';
102
+ export type AxisYAnchor = 'left' | 'right' | 'both';
103
+ export type XScaleOptions = ScaleOptions & {
104
+ /**
105
+ * Activate the implicit GridX mark. For more control over the grid styling
106
+ * and layering, add an explicit GridX mark to your plot instead of using the
107
+ * implicit grids.
108
+ */
109
+ grid: boolean;
110
+ /**
111
+ * Controls the position of the implicit AxisX mark, or set to false to disable
112
+ * the implicit AxisX mark. For more control over the axis styling and layering
113
+ * add an explicit AxisX mark to your plot instead of using the implicit axes.
114
+ */
115
+ axis: AxisXAnchor | false;
116
+ /**
117
+ * rotate the axis ticks
118
+ */
119
+ tickRotate: number;
120
+ labelAnchor: 'auto' | 'left' | 'center' | 'right';
121
+ tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
122
+ };
123
+ export type YScaleOptions = ScaleOptions & {
124
+ /**
125
+ * Activate the implicit GridY mark. For more control over the grid styling
126
+ * and layering, add an explicit GridY mark to your plot instead of using the
127
+ * implicit grids.
128
+ */
129
+ grid: boolean;
130
+ /**
131
+ * Controls the position of the implicit AxisY mark, or set to false to disable
132
+ * the implicit AxisY mark. For more control over the axis styling and layering
133
+ * add an explicit AxisY mark to your plot instead of using the implicit axes.
134
+ */
135
+ axis: AxisYAnchor | false;
136
+ tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
137
+ /**
138
+ * rotate the axis ticks
139
+ */
140
+ tickRotate: number;
141
+ labelAnchor: 'auto' | 'bottom' | 'middle' | 'top';
142
+ };
143
+ export type LegendScaleOptions = ScaleOptions & {
144
+ legend: boolean;
145
+ };
146
+ export type PlotOptions = {
147
+ /**
148
+ * The plot title, rendered as H2 tag above the SVG element. Instead of
149
+ * using the title, you can also pass a "header" snippet and render your
150
+ * own custom title markup.
151
+ */
152
+ title: string;
153
+ /**
154
+ * The plot subtitle, rendered as H3 tag above the SVG element. Instead of
155
+ * using the subtitle, you can also pass a "header" snippet and render your
156
+ * own custom title markup.
157
+ */
158
+ subtitle: string;
159
+ /**
160
+ * The plot caption, rendered as FIGCAPTION tag below the SVG element. Instead of
161
+ * using the caption, you can also pass a "footer" snippet and render your
162
+ * own custom title markup.
163
+ */
164
+ caption: string;
165
+ /**
166
+ * By default, the plot will extend to fit 100% of the parent container width. By
167
+ * setting the maxWidth style property you can limit the width of your plot.
168
+ */
169
+ maxWidth?: string;
170
+ /**
171
+ * force the plot into a fixed width
172
+ */
173
+ width?: number;
174
+ /**
175
+ * force the plot into a fixed height
176
+ */
177
+ height: 'auto' | number | ((d: number) => number);
178
+ /**
179
+ * Convenience option for setting all four margins at once, in px.
180
+ */
181
+ margin: number | {
182
+ top?: number;
183
+ right?: number;
184
+ bottom?: number;
185
+ left?: number;
186
+ };
187
+ /**
188
+ * Left margin of the plot, in px.
189
+ */
190
+ marginLeft: number;
191
+ /**
192
+ * Right margin of the plot, in px.
193
+ */
194
+ marginRight: number;
195
+ /**
196
+ * Top margin of the plot, in px.
197
+ */
198
+ marginTop: number;
199
+ /**
200
+ * Bottom margin of the plot, in px.
201
+ */
202
+ marginBottom: number;
203
+ /**
204
+ * Activates the implicit GridX and GridY marks.
205
+ */
206
+ grid: boolean;
207
+ /**
208
+ * Activates the implicit AxisX and AxisY marks.
209
+ */
210
+ axes: boolean;
211
+ /**
212
+ * Activates the implicit frame marks
213
+ */
214
+ frame: boolean;
215
+ /**
216
+ * Convenience shortcut for setting both the x and y scale insets.
217
+ */
218
+ inset: number;
219
+ /**
220
+ * Convenience shortcut for setting both the x and y scale paddings
221
+ */
222
+ padding: number;
223
+ /**
224
+ * Geo-projection
225
+ */
226
+ projection: string | null | {
227
+ type?: string;
228
+ rotate?: [number, number] | [number, number, number];
229
+ domain?: object;
230
+ inset?: number;
231
+ clip?: Clip;
232
+ } | {
233
+ type: (d: {
234
+ width: number;
235
+ height: number;
236
+ }) => GeoProjection;
237
+ };
238
+ /**
239
+ * if not null, computes a default height such that a variation of one
240
+ * unit in the x dimension is represented by the corresponding number
241
+ * of pixels as a variation in the y dimension of one unit.
242
+ */
243
+ aspectRatio: number | null;
244
+ /**
245
+ * Top-level faceting options
246
+ */
247
+ facet: Partial<{
248
+ /**
249
+ * The data to facet by. Turns on automatic faceting for all marks that
250
+ * use the exact same data (===)
251
+ */
252
+ data: DataRecord<any>[];
253
+ x: ChannelAccessor;
254
+ y: ChannelAccessor;
255
+ }>;
256
+ /**
257
+ * Options for the shared x scale.
258
+ */
259
+ x: Partial<XScaleOptions>;
260
+ /**
261
+ * Options for the shared y scale
262
+ */
263
+ y: Partial<YScaleOptions>;
264
+ /**
265
+ * Options for the shared radius scale
266
+ */
267
+ r: Partial<ScaleOptions>;
268
+ color: Partial<ColorScaleOptions>;
269
+ opacity: Partial<ScaleOptions>;
270
+ symbol: Partial<LegendScaleOptions>;
271
+ length: Partial<ScaleOptions>;
272
+ fx: Partial<ScaleOptions>;
273
+ fy: Partial<ScaleOptions>;
274
+ children: Snippet<[
275
+ {
276
+ width: number;
277
+ height: number;
278
+ options: PlotOptions;
279
+ scales: PlotScales;
280
+ }
281
+ ]>;
282
+ /**
283
+ * You can use the header snippet to render a custom title and subtitle for
284
+ * your plot, or place a legend above the visualization.
285
+ */
286
+ header: Snippet;
287
+ footer: Snippet;
288
+ /**
289
+ * The underlay snippet is useful for adding a layer of custom HTML markup
290
+ * behind the SVG body of your plot, e.g. for a watermark or background image.
291
+ */
292
+ underlay: Snippet<[PlotOptions]>;
293
+ /**
294
+ * The overlay snippet is useful for adding a layer of custom HTML markup
295
+ * in front of the SVG body of your plot, e.g. for HTML tooltips.
296
+ */
297
+ overlay: Snippet;
298
+ facetAxes: Snippet;
299
+ /**
300
+ * if you set testid, the plot container will get a data-testid attribute which
301
+ * can be useful for automatic testing
302
+ */
303
+ testid: string;
304
+ /**
305
+ * in case you want to give your Plot element an extra CSS class
306
+ */
307
+ class: string | null;
308
+ /**
309
+ * if set to true, the plot will use the implicit scales
310
+ */
311
+ implicitScales: boolean;
312
+ /**
313
+ * locale used for automatic axis ticks
314
+ */
315
+ locale: string;
316
+ /**
317
+ * pass a @emotion/css function to style plot using dynamic classes
318
+ */
319
+ css: (d: string) => string | undefined;
320
+ };
321
+ export type GenericMarkOptions = Record<string | symbol, any>;
322
+ export type DataRecord<T = Record<string | symbol, RawValue>> = T & {
323
+ ___orig___?: RawValue | [RawValue, RawValue];
324
+ };
325
+ export type ResolvedDataRecord<T = Record<string | symbol, RawValue>> = Partial<Record<ScaledChannelName, any>> & {
326
+ datum: DataRecord<T>;
327
+ };
328
+ export type ScaledDataRecord<T = Record<string | symbol, RawValue>> = Partial<Record<ScaledChannelName, number | string | boolean | undefined>> & {
329
+ datum: DataRecord<T>;
330
+ valid: Boolean;
331
+ };
332
+ export type DataRow<T = Record<string | symbol, RawValue>> = DataRecord<T> | RawValue | [number, number] | null;
333
+ export type PlotScale = {
334
+ type: ScaleType;
335
+ domain: RawValue[];
336
+ range: RawValue[];
337
+ autoTitle?: string;
338
+ /**
339
+ * The number of marks that are using this scale.
340
+ */
341
+ manualActiveMarks: number;
342
+ /**
343
+ * Set of accessors used in channels that are bound to this scale.
344
+ */
345
+ uniqueScaleProps: Set<ChannelAccessor>;
346
+ skip: Map<ScaledChannelName, Set<symbol>>;
347
+ fn: ScaleLinear<RawValue, number> & ScaleBand<RawValue> & ScaleOrdinal<string | Date, number> & ScaleOrdinal<string | Date, string>;
348
+ };
349
+ export type CurveName = 'basis' | 'basis-closed' | 'basis-open' | 'bundle' | 'bump-x' | 'bump-y' | 'cardinal' | 'cardinal-closed' | 'cardinal-open' | 'catmull-rom' | 'catmull-rom-closed' | 'catmull-rom-open' | 'linear' | 'linear-closed' | 'monotone-x' | 'monotone-y' | 'natural' | 'step' | 'step-after' | 'step-before';
350
+ export type MarkerOptions = {
351
+ /**
352
+ * the marker for the starting point of a line segment
353
+ */
354
+ markerStart?: boolean | MarkerShape | Snippet;
355
+ /**
356
+ * the marker for any intermediate point of a line segment
357
+ */
358
+ markerMid?: boolean | MarkerShape | Snippet;
359
+ /**
360
+ * the marker for the end point of a line segment
361
+ */
362
+ markerEnd?: boolean | MarkerShape | Snippet;
363
+ /**
364
+ * shorthand for setting the marker on all points
365
+ */
366
+ marker?: boolean | MarkerShape | Snippet;
367
+ };
368
+ export type PlotScales = Record<ScaleName, PlotScale>;
369
+ export type ChannelAccessor<T = Record<string | symbol, RawValue>> = ChannelValue<T> | {
370
+ /** the channel value */
371
+ value: ChannelValue<T>;
372
+ /** you can bypass the scale by passing null */
373
+ scale: boolean | null;
374
+ };
375
+ export type ChannelValue<T = Record<string | symbol, RawValue>> = RawValue | keyof T | ((d: T) => RawValue) | null | undefined;
376
+ export type ConstantAccessor<T, D = Record<string | symbol, RawValue>> = T | ((d: D) => T) | null | undefined;
377
+ export type PlotState = {
378
+ width: number;
379
+ height: number;
380
+ options: PlotOptions;
381
+ facetWidth: number;
382
+ facetHeight: number;
383
+ plotWidth: number;
384
+ plotHeight: number;
385
+ scales: PlotScales;
386
+ body: HTMLDivElement;
387
+ /**
388
+ * True if there's a color scale and a symbol scale and both are bound to the same
389
+ * single channel accessor.
390
+ */
391
+ colorSymbolRedundant: boolean;
392
+ /**
393
+ * True if the plot is using filled dot marks.
394
+ */
395
+ hasFilledDotMarks: boolean;
396
+ css: ((d: string) => string) | null;
397
+ };
398
+ export type PlotContext = {
399
+ /**
400
+ * Registers a mark with the Plot component along with its
401
+ * data and the channel mappings.
402
+ */
403
+ addMark: (mark: Mark<GenericMarkOptions>) => Mark<GenericMarkOptions>;
404
+ /**
405
+ * Updates a mark after either the data or the channel mappings
406
+ * have been updated.
407
+ */
408
+ updateMark: (mark: Mark<GenericMarkOptions>) => void;
409
+ /**
410
+ * Unregister a mark from the Plot component after the mark
411
+ * component has been destroyed.
412
+ */
413
+ removeMark: (mark: Mark<GenericMarkOptions>) => void;
414
+ getPlotState: () => PlotState;
415
+ getTopLevelFacet: () => PlotOptions['facet'];
416
+ /**
417
+ * Updates the plots internal facetWidth and facetHeight dimensions
418
+ * which are used as range for the positional scales x and y.
419
+ */
420
+ updateDimensions: (width: number, height: number) => void;
421
+ };
422
+ type FacetState = {
423
+ fx: RawValue;
424
+ fy: RawValue;
425
+ /**
426
+ * True, if the facet is the leftmost in its row
427
+ */
428
+ left: boolean;
429
+ /**
430
+ * True, if the facet is the topmost in its column
431
+ */
432
+ top: boolean;
433
+ /**
434
+ * True, if the facet is the rightmost in its row
435
+ */
436
+ right: boolean;
437
+ /**
438
+ * True, if the facet is the bottommost in its column
439
+ */
440
+ bottom: boolean;
441
+ /**
442
+ * True, if the adjacent facet to the top is empty
443
+ */
444
+ topEmpty: boolean;
445
+ /**
446
+ * True, if the adjacent facet to the bottom is empty
447
+ */
448
+ bottomEmpty: boolean;
449
+ /**
450
+ * True, if the adjacent facet to the left is empty
451
+ */
452
+ leftEmpty: boolean;
453
+ /**
454
+ * True, if the adjacent facet to the right is empty
455
+ */
456
+ rightEmpty: boolean;
457
+ };
458
+ /**
459
+ * Test if the given data record is visible in the current facet.
460
+ */
461
+ type TestFacetFunction = (datum: DataRecord<any>, channels: Record<ChannelName, ChannelAccessor>) => boolean;
462
+ export type FacetContext = {
463
+ /**
464
+ * Returns a stateful function that tests whether a specific data
465
+ * record is visible in the current facet or not.
466
+ */
467
+ getTestFacet: () => TestFacetFunction;
468
+ getFacetState: () => FacetState;
469
+ };
470
+ export type LinkableMarkProps<T> = {
471
+ /**
472
+ * if set, the mark element will be wrapped in a <a> link element
473
+ */
474
+ href?: ConstantAccessor<string, T>;
475
+ /**
476
+ * the relationship of the target object to the link object (e.g. "noopener")
477
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#rel
478
+ */
479
+ rel?: ConstantAccessor<string, T>;
480
+ /**
481
+ * the link target mime type, e.g. "text/csv"
482
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#type
483
+ */
484
+ type?: ConstantAccessor<string, T>;
485
+ /**
486
+ * the target of the link, e.g. "_blank" or "_self"
487
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#target
488
+ */
489
+ target?: ConstantAccessor<'_self' | '_blank' | '_parent' | '_top' | string, T>;
490
+ /**
491
+ * if set to true, the link will be downloaded instead of navigating to it
492
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
493
+ */
494
+ download?: ConstantAccessor<boolean, T>;
495
+ [key: `data-sveltekit-${string}`]: string | boolean | undefined;
496
+ };
497
+ export type BaseMarkProps<T> = Partial<{
498
+ /**
499
+ * Filter the data without modifying the inferred scales
500
+ */
501
+ filter?: ConstantAccessor<boolean, T>;
502
+ facet?: 'auto' | 'include' | 'exclude';
503
+ fx: ChannelAccessor<T>;
504
+ fy: ChannelAccessor<T>;
505
+ dx: ConstantAccessor<number, T>;
506
+ dy: ConstantAccessor<number, T>;
507
+ fill: ChannelAccessor<T>;
508
+ fillOpacity: ConstantAccessor<number, T>;
509
+ sort: string | ConstantAccessor<RawValue, T> | ((a: RawValue, b: RawValue) => number) | {
510
+ /** sort data using an already defined channel */
511
+ channel: string;
512
+ /** sort order */
513
+ order?: 'ascending' | 'descending';
514
+ };
515
+ stroke: ChannelAccessor<T>;
516
+ strokeWidth: ConstantAccessor<number, T>;
517
+ strokeOpacity: ConstantAccessor<number, T>;
518
+ strokeLinejoin: ConstantAccessor<CSS.Property.StrokeLinejoin, T>;
519
+ strokeLinecap: ConstantAccessor<CSS.Property.StrokeLinecap, T>;
520
+ strokeMiterlimit: ConstantAccessor<number, T>;
521
+ opacity: ChannelAccessor<T>;
522
+ strokeDasharray: ConstantAccessor<string, T>;
523
+ strokeDashoffset: ConstantAccessor<number, T>;
524
+ mixBlendMode: ConstantAccessor<CSS.Property.MixBlendMode, T>;
525
+ clipPath: string;
526
+ imageFilter: ConstantAccessor<string, T>;
527
+ shapeRendering: ConstantAccessor<CSS.Property.ShapeRendering, T>;
528
+ paintOrder: ConstantAccessor<string, T>;
529
+ onclick?: MouseEventHandler<SVGPathElement>;
530
+ ondblclick?: MouseEventHandler<SVGPathElement>;
531
+ onmouseup?: MouseEventHandler<SVGPathElement>;
532
+ onmousedown?: MouseEventHandler<SVGPathElement>;
533
+ onmouseenter?: MouseEventHandler<SVGPathElement>;
534
+ onmousemove?: MouseEventHandler<SVGPathElement>;
535
+ onmouseleave?: MouseEventHandler<SVGPathElement>;
536
+ onmouseout?: MouseEventHandler<SVGPathElement>;
537
+ onmouseover?: MouseEventHandler<SVGPathElement>;
538
+ onpointercancel?: MouseEventHandler<SVGPathElement>;
539
+ onpointerdown?: MouseEventHandler<SVGPathElement>;
540
+ onpointerup?: MouseEventHandler<SVGPathElement>;
541
+ onpointerenter?: MouseEventHandler<SVGPathElement>;
542
+ onpointerleave?: MouseEventHandler<SVGPathElement>;
543
+ onpointermove?: MouseEventHandler<SVGPathElement>;
544
+ onpointerover?: MouseEventHandler<SVGPathElement>;
545
+ onpointerout?: MouseEventHandler<SVGPathElement>;
546
+ ondrag?: MouseEventHandler<SVGPathElement>;
547
+ ondrop?: MouseEventHandler<SVGPathElement>;
548
+ ondragstart?: MouseEventHandler<SVGPathElement>;
549
+ ondragenter?: MouseEventHandler<SVGPathElement>;
550
+ ondragleave?: MouseEventHandler<SVGPathElement>;
551
+ ondragover?: MouseEventHandler<SVGPathElement>;
552
+ ondragend?: MouseEventHandler<SVGPathElement>;
553
+ ontouchstart?: MouseEventHandler<SVGPathElement>;
554
+ ontouchmove?: MouseEventHandler<SVGPathElement>;
555
+ ontouchend?: MouseEventHandler<SVGPathElement>;
556
+ ontouchcancel?: MouseEventHandler<SVGPathElement>;
557
+ oncontextmenu?: MouseEventHandler<SVGPathElement>;
558
+ onwheel?: MouseEventHandler<SVGPathElement>;
559
+ /**
560
+ * if you want to give your mark element an extra CSS class
561
+ */
562
+ class: string | null;
563
+ cursor: ConstantAccessor<CSS.Property.Cursor, T>;
564
+ }>;
565
+ export type BorderRadius = number | {
566
+ topLeft?: number;
567
+ topRight?: number;
568
+ bottomRight?: number;
569
+ bottomLeft?: number;
570
+ };
571
+ export type BaseRectMarkProps<T> = {
572
+ inset?: ConstantAccessor<number, T>;
573
+ insetLeft?: ConstantAccessor<number, T>;
574
+ insetTop?: ConstantAccessor<number, T>;
575
+ insetRight?: ConstantAccessor<number, T>;
576
+ insetBottom?: ConstantAccessor<number, T>;
577
+ borderRadius?: BorderRadius;
578
+ };
579
+ export type Channels<T> = Record<string, ChannelAccessor<T> | ConstantAccessor<string | number | boolean | symbol, T>>;
580
+ export type TransformArg<T> = Channels<T> & BaseMarkProps<T> & {
581
+ data: T[];
582
+ };
583
+ export type MapArg<T> = Channels<T> & {
584
+ data: T[];
585
+ };
586
+ export type TransformArgsRow = Partial<Channels> & {
587
+ data: DataRow[];
588
+ };
589
+ export type TransformArgsRecord = Partial<Channels> & {
590
+ data: DataRecord[];
591
+ };
592
+ export type ColorScheme = 'brbg' | 'prgn' | 'piyg' | 'puor' | 'rdbu' | 'rdgy' | 'rdylbu' | 'rdylgn' | 'spectral' | 'burd' | 'buylrd' | 'blues' | 'greens' | 'grays' | 'greys' | 'oranges' | 'purples' | 'reds' | 'turbo' | 'viridis' | 'magma' | 'inferno' | 'plasma' | 'cividis' | 'cubehelix' | 'warm' | 'cool' | 'bugn' | 'bupu' | 'gnbu' | 'orrd' | 'pubu' | 'pubugn' | 'purd' | 'rdpu' | 'ylgn' | 'ylgnbu' | 'ylorbr' | 'ylorrd' | 'rainbow' | 'sinebow' | 'accent' | 'category10' | 'dark2' | 'paired' | 'pastel1' | 'pastel2' | 'set1' | 'set2' | 'set3' | 'tableau10' | 'observable10';
593
+ export type MarkStyleProps = 'strokeDasharray' | 'strokeLinejoin' | 'strokeLinecap' | 'opacity' | 'cursor' | 'pointerEvents' | 'blend' | 'fill' | 'fillOpacity' | 'fontWeight' | 'fontVariant' | 'fontSize' | 'fontStyle' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'clipPath' | 'mask' | 'filter' | 'angle' | 'radius' | 'symbol' | 'textAnchor' | 'width';
594
+ export type AutoMarginStores = {
595
+ autoMarginTop: Writable<Map<string, number>>;
596
+ autoMarginLeft: Writable<Map<string, number>>;
597
+ autoMarginRight: Writable<Map<string, number>>;
598
+ autoMarginBottom: Writable<Map<string, number>>;
599
+ };
600
+ type IgnoreDefaults = 'data' | 'facet' | ChannelName | 'title' | 'automatic' | 'children';
601
+ /**
602
+ * these are the default options for the plot marks that can be set using
603
+ * the 'svelteplot/defaults' context.
604
+ */
605
+ export type PlotDefaults = {
606
+ /**
607
+ * default plot height
608
+ */
609
+ height: number;
610
+ /**
611
+ * default plot inset
612
+ */
613
+ inset: number;
614
+ /**
615
+ * default color scheme
616
+ */
617
+ colorScheme: ColorScheme;
618
+ categoricalColorScheme: ColorScheme | string[];
619
+ /**
620
+ * fallback color to be used for null/NA
621
+ */
622
+ unknown: string;
623
+ /**
624
+ * optional @emotion/css function to style the plot
625
+ */
626
+ css: (d: string) => string | undefined;
627
+ /**
628
+ * for computing the automatic height based on the number of
629
+ * domain items in a point scale
630
+ */
631
+ pointScaleHeight: number;
632
+ /**
633
+ * for computing the automatic height based on the number of
634
+ * domain items in a band scale
635
+ */
636
+ bandScaleHeight: number;
637
+ /**
638
+ * initial width of the plot before measuring the actual width
639
+ */
640
+ initialWidth: number;
641
+ /**
642
+ * locale, used for automatic axis ticks
643
+ */
644
+ locale: string;
645
+ /**
646
+ * default number format for axis ticks
647
+ */
648
+ numberFormat: Intl.NumberFormatOptions;
649
+ /**
650
+ * default dot radius for line markers, used in dot, circle, and circle-stroke markers
651
+ */
652
+ markerDotRadius: number;
653
+ /**
654
+ * default props for area marks, applied to area, areaX, and areaY marks
655
+ */
656
+ area: Partial<Omit<ComponentProps<typeof Area>, IgnoreDefaults>>;
657
+ /**
658
+ * default props for areaX marks
659
+ */
660
+ areaX: Partial<Omit<ComponentProps<typeof AreaX>, IgnoreDefaults>>;
661
+ /**
662
+ * default props for areaY marks
663
+ */
664
+ areaY: Partial<Omit<ComponentProps<typeof AreaY>, IgnoreDefaults>>;
665
+ /**
666
+ * default props for arrow marks
667
+ */
668
+ arrow: Partial<Omit<ComponentProps<typeof Arrow>, IgnoreDefaults>>;
669
+ /**
670
+ * default props for axis marks, applied to both axisX and axisY marks
671
+ */
672
+ axis: Partial<Omit<ComponentProps<typeof AxisX>, 'data' | 'facet' | ChannelName | 'facetAnchor' | 'labelAnchor' | 'anchor'> & {
673
+ implicit: boolean;
674
+ }>;
675
+ /**
676
+ * default props for axisX marks
677
+ */
678
+ axisX: Partial<Omit<ComponentProps<typeof AxisX>, IgnoreDefaults> & {
679
+ implicit: boolean;
680
+ }>;
681
+ /**
682
+ * default props for axisY marks
683
+ */
684
+ axisY: Partial<Omit<ComponentProps<typeof AxisY>, IgnoreDefaults> & {
685
+ implicit: boolean;
686
+ }>;
687
+ /**
688
+ * default props for bar marks, applied to both barX and barY marks
689
+ */
690
+ bar: Partial<Omit<ComponentProps<typeof BarX>, IgnoreDefaults>>;
691
+ /**
692
+ * default props for barX marks
693
+ */
694
+ barX: Partial<Omit<ComponentProps<typeof BarX>, IgnoreDefaults>>;
695
+ /**
696
+ * default props for barY marks
697
+ */
698
+ barY: Partial<Omit<ComponentProps<typeof BarY>, IgnoreDefaults>>;
699
+ /**
700
+ * default props for box marks, applied to boxX and boxY marks
701
+ */
702
+ box: Partial<Omit<ComponentProps<typeof BoxX>, IgnoreDefaults>>;
703
+ /**
704
+ * default props for boxX marks
705
+ */
706
+ boxX: Partial<Omit<ComponentProps<typeof BoxX>, IgnoreDefaults>>;
707
+ /**
708
+ * default props for boxY marks
709
+ */
710
+ boxY: Partial<Omit<ComponentProps<typeof BoxY>, IgnoreDefaults>>;
711
+ /**
712
+ * default props for brush marks, applied to brush, brushX and brushY marks
713
+ */
714
+ brush: Partial<Omit<ComponentProps<typeof Brush>, IgnoreDefaults | 'limitDimension'>>;
715
+ /**
716
+ * default props for brushX marks
717
+ */
718
+ brushX: Partial<Omit<ComponentProps<typeof BrushX>, IgnoreDefaults>>;
719
+ /**
720
+ * default props for brushY marks
721
+ */
722
+ brushY: Partial<Omit<ComponentProps<typeof BrushY>, IgnoreDefaults>>;
723
+ /**
724
+ * default props for cell marks
725
+ */
726
+ cell: Partial<Omit<ComponentProps<typeof Cell>, IgnoreDefaults>>;
727
+ /**
728
+ * default props for dot marks
729
+ */
730
+ dot: Partial<Omit<ComponentProps<typeof Dot>, IgnoreDefaults>>;
731
+ /**
732
+ * default props for frame marks
733
+ */
734
+ frame: Partial<ComponentProps<typeof Frame> & {
735
+ implicit: boolean;
736
+ }>;
737
+ /**
738
+ * default props for geo marks
739
+ */
740
+ geo: Partial<Omit<ComponentProps<typeof Geo>, IgnoreDefaults>>;
741
+ /**
742
+ * default props for graticule marks
743
+ */
744
+ graticule: Partial<Omit<ComponentProps<typeof Graticule>, IgnoreDefaults>>;
745
+ /**
746
+ * default props for grid marks, applied to both gridX and gridY marks
747
+ */
748
+ grid: Partial<Omit<ComponentProps<typeof GridX>, IgnoreDefaults> & {
749
+ implicit: boolean;
750
+ }>;
751
+ /**
752
+ * default props for gridX marks
753
+ */
754
+ gridX: Partial<Omit<ComponentProps<typeof GridX>, IgnoreDefaults> & {
755
+ implicit: boolean;
756
+ }>;
757
+ /**
758
+ * default props for gridY marks
759
+ */
760
+ gridY: Partial<Omit<ComponentProps<typeof GridY>, IgnoreDefaults> & {
761
+ implicit: boolean;
762
+ }>;
763
+ /**
764
+ * default props for line marks
765
+ */
766
+ line: Partial<Omit<ComponentProps<typeof Line>, IgnoreDefaults>>;
767
+ /**
768
+ * default props for link marks
769
+ */
770
+ link: Partial<Omit<ComponentProps<typeof Link>, IgnoreDefaults>>;
771
+ /**
772
+ * default props for pointer marks
773
+ */
774
+ pointer: Partial<Omit<ComponentProps<typeof Pointer>, IgnoreDefaults>>;
775
+ /**
776
+ * default props for rect marks, applied to rect and rectX marks
777
+ */
778
+ rect: Partial<Omit<ComponentProps<typeof Rect>, IgnoreDefaults>>;
779
+ /**
780
+ * default props for rectX marks
781
+ */
782
+ rectX: Partial<Omit<ComponentProps<typeof RectX>, IgnoreDefaults>>;
783
+ /**
784
+ * default props for rectY marks
785
+ */
786
+ rectY: Partial<Omit<ComponentProps<typeof RectY>, IgnoreDefaults>>;
787
+ /**
788
+ * default props for rule marks
789
+ */
790
+ rule: Partial<Omit<ComponentProps<typeof RuleX>, IgnoreDefaults>>;
791
+ /**
792
+ * default props for rule marks
793
+ */
794
+ ruleX: Partial<Omit<ComponentProps<typeof RuleX>, IgnoreDefaults>>;
795
+ /**
796
+ * default props for rule marks
797
+ */
798
+ ruleY: Partial<Omit<ComponentProps<typeof RuleY>, IgnoreDefaults>>;
799
+ /**
800
+ * default props for sphere marks
801
+ */
802
+ sphere: Partial<ComponentProps<typeof Sphere>>;
803
+ /**
804
+ * default props for spike marks
805
+ */
806
+ spike: Partial<Omit<ComponentProps<typeof Spike>, IgnoreDefaults>>;
807
+ /**
808
+ * default props for text marks
809
+ */
810
+ text: Partial<Omit<ComponentProps<typeof Text>, IgnoreDefaults>>;
811
+ /**
812
+ * default props for tick marks, applied to tickX and tickY marks
813
+ */
814
+ tick: Partial<Omit<ComponentProps<typeof TickX>, IgnoreDefaults>>;
815
+ /**
816
+ * default props for tickX marks
817
+ */
818
+ tickX: Partial<Omit<ComponentProps<typeof TickX>, IgnoreDefaults>>;
819
+ /**
820
+ * default props for tickY marks
821
+ */
822
+ tickY: Partial<Omit<ComponentProps<typeof TickY>, IgnoreDefaults>>;
823
+ /**
824
+ * default props for vector marks
825
+ */
826
+ vector: Partial<Omit<ComponentProps<typeof Vector>, IgnoreDefaults>>;
827
+ };
828
+ export type MapIndexObject = {
829
+ mapIndex: (I: number[], S: RawValue[], T: RawValue[]) => void;
830
+ };
831
+ export type MapMethod = 'cumsum' | 'rank' | 'quantile' | ((I: number[], S: number[]) => number[]) | MapIndexObject;
832
+ export type MapOptions = Partial<Record<ScaledChannelName, MapMethod>>;
833
+ export type UsedScales = Record<ScaledChannelName, boolean>;
834
+ export {};