svelteplot 0.10.3 → 0.11.0

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 (222) hide show
  1. package/dist/Mark.svelte +42 -25
  2. package/dist/Mark.svelte.d.ts +111 -32
  3. package/dist/Plot.svelte +21 -15
  4. package/dist/core/Facet.svelte +1 -1
  5. package/dist/core/FacetAxes.svelte +13 -8
  6. package/dist/core/FacetGrid.svelte +4 -4
  7. package/dist/core/Plot.svelte +41 -35
  8. package/dist/helpers/autoScales.d.ts +3 -3
  9. package/dist/helpers/autoScales.js +28 -18
  10. package/dist/helpers/autoTicks.js +2 -0
  11. package/dist/helpers/callWithProps.d.ts +1 -2
  12. package/dist/helpers/facets.js +0 -1
  13. package/dist/helpers/index.js +1 -1
  14. package/dist/helpers/mergeDeep.d.ts +1 -3
  15. package/dist/helpers/mergeDeep.js +15 -16
  16. package/dist/helpers/projection.d.ts +4 -3
  17. package/dist/helpers/projection.js +17 -5
  18. package/dist/helpers/reduce.d.ts +4 -4
  19. package/dist/helpers/reduce.js +6 -4
  20. package/dist/helpers/regressionLoess.js +2 -1
  21. package/dist/helpers/resolve.d.ts +6 -3
  22. package/dist/helpers/resolve.js +25 -16
  23. package/dist/helpers/scales.d.ts +10 -10
  24. package/dist/helpers/scales.js +43 -13
  25. package/dist/helpers/time.d.ts +10 -3
  26. package/dist/helpers/time.js +2 -1
  27. package/dist/hooks/index.d.ts +2 -0
  28. package/dist/hooks/index.js +2 -0
  29. package/dist/hooks/plotDefaults.d.ts +3 -1
  30. package/dist/hooks/plotDefaults.js +33 -1
  31. package/dist/hooks/usePlot.svelte.d.ts +10 -25
  32. package/dist/hooks/usePlot.svelte.js +8 -7
  33. package/dist/index.d.ts +1 -2
  34. package/dist/index.js +1 -3
  35. package/dist/marks/Area.svelte +24 -13
  36. package/dist/marks/Area.svelte.d.ts +118 -34
  37. package/dist/marks/AreaX.svelte +42 -8
  38. package/dist/marks/AreaX.svelte.d.ts +154 -71
  39. package/dist/marks/AreaY.svelte +42 -8
  40. package/dist/marks/AreaY.svelte.d.ts +154 -71
  41. package/dist/marks/Arrow.svelte +42 -23
  42. package/dist/marks/Arrow.svelte.d.ts +114 -35
  43. package/dist/marks/AxisX.svelte +43 -28
  44. package/dist/marks/AxisX.svelte.d.ts +125 -40
  45. package/dist/marks/AxisY.svelte +43 -26
  46. package/dist/marks/AxisY.svelte.d.ts +127 -40
  47. package/dist/marks/BarX.svelte +12 -10
  48. package/dist/marks/BarX.svelte.d.ts +104 -32
  49. package/dist/marks/BarY.svelte +11 -10
  50. package/dist/marks/BarY.svelte.d.ts +106 -34
  51. package/dist/marks/BollingerX.svelte +4 -7
  52. package/dist/marks/BollingerX.svelte.d.ts +105 -30
  53. package/dist/marks/BollingerY.svelte +3 -0
  54. package/dist/marks/BollingerY.svelte.d.ts +105 -30
  55. package/dist/marks/BoxX.svelte +3 -3
  56. package/dist/marks/BoxY.svelte +12 -9
  57. package/dist/marks/BoxY.svelte.d.ts +128 -53
  58. package/dist/marks/Brush.svelte +26 -21
  59. package/dist/marks/Brush.svelte.d.ts +119 -60
  60. package/dist/marks/Cell.svelte +13 -9
  61. package/dist/marks/Cell.svelte.d.ts +105 -30
  62. package/dist/marks/CellX.svelte +2 -1
  63. package/dist/marks/CellX.svelte.d.ts +105 -32
  64. package/dist/marks/CellY.svelte +2 -1
  65. package/dist/marks/CellY.svelte.d.ts +105 -32
  66. package/dist/marks/ColorLegend.svelte +24 -13
  67. package/dist/marks/ColorLegend.svelte.d.ts +1 -0
  68. package/dist/marks/CustomMark.svelte +16 -10
  69. package/dist/marks/CustomMark.svelte.d.ts +112 -31
  70. package/dist/marks/CustomMarkHTML.svelte +8 -2
  71. package/dist/marks/CustomMarkHTML.svelte.d.ts +8 -2
  72. package/dist/marks/DifferenceY.svelte +31 -20
  73. package/dist/marks/DifferenceY.svelte.d.ts +134 -55
  74. package/dist/marks/Dot.svelte +21 -11
  75. package/dist/marks/Dot.svelte.d.ts +117 -38
  76. package/dist/marks/DotX.svelte +2 -0
  77. package/dist/marks/DotX.svelte.d.ts +136 -62
  78. package/dist/marks/DotY.svelte +1 -0
  79. package/dist/marks/DotY.svelte.d.ts +135 -62
  80. package/dist/marks/Frame.svelte +47 -9
  81. package/dist/marks/Frame.svelte.d.ts +124 -41
  82. package/dist/marks/Geo.svelte +21 -12
  83. package/dist/marks/Geo.svelte.d.ts +105 -30
  84. package/dist/marks/Graticule.svelte +3 -0
  85. package/dist/marks/Graticule.svelte.d.ts +3 -0
  86. package/dist/marks/GridX.svelte +31 -16
  87. package/dist/marks/GridX.svelte.d.ts +108 -32
  88. package/dist/marks/GridY.svelte +30 -15
  89. package/dist/marks/GridY.svelte.d.ts +108 -32
  90. package/dist/marks/HTMLTooltip.svelte +14 -7
  91. package/dist/marks/HTMLTooltip.svelte.d.ts +7 -0
  92. package/dist/marks/Image.svelte +50 -25
  93. package/dist/marks/Image.svelte.d.ts +117 -35
  94. package/dist/marks/Line.svelte +67 -44
  95. package/dist/marks/Line.svelte.d.ts +119 -30
  96. package/dist/marks/LineX.svelte +2 -1
  97. package/dist/marks/LineX.svelte.d.ts +142 -69
  98. package/dist/marks/LineY.svelte +2 -1
  99. package/dist/marks/LineY.svelte.d.ts +142 -69
  100. package/dist/marks/Link.svelte +70 -46
  101. package/dist/marks/Link.svelte.d.ts +126 -41
  102. package/dist/marks/Pointer.svelte +24 -15
  103. package/dist/marks/Pointer.svelte.d.ts +7 -0
  104. package/dist/marks/Rect.svelte +13 -5
  105. package/dist/marks/Rect.svelte.d.ts +116 -35
  106. package/dist/marks/RectX.svelte +6 -3
  107. package/dist/marks/RectX.svelte.d.ts +158 -12
  108. package/dist/marks/RectY.svelte +6 -3
  109. package/dist/marks/RectY.svelte.d.ts +158 -12
  110. package/dist/marks/RegressionX.svelte +13 -6
  111. package/dist/marks/RegressionX.svelte.d.ts +8 -3
  112. package/dist/marks/RegressionY.svelte +13 -6
  113. package/dist/marks/RegressionY.svelte.d.ts +8 -3
  114. package/dist/marks/RuleX.svelte +18 -11
  115. package/dist/marks/RuleX.svelte.d.ts +112 -32
  116. package/dist/marks/RuleY.svelte +19 -12
  117. package/dist/marks/RuleY.svelte.d.ts +114 -34
  118. package/dist/marks/Spike.svelte +11 -5
  119. package/dist/marks/Spike.svelte.d.ts +146 -68
  120. package/dist/marks/Text.svelte +24 -7
  121. package/dist/marks/Text.svelte.d.ts +253 -75
  122. package/dist/marks/TickX.svelte +56 -48
  123. package/dist/marks/TickX.svelte.d.ts +114 -40
  124. package/dist/marks/TickY.svelte +59 -51
  125. package/dist/marks/TickY.svelte.d.ts +117 -43
  126. package/dist/marks/Trail.svelte +25 -13
  127. package/dist/marks/Trail.svelte.d.ts +116 -33
  128. package/dist/marks/Vector.svelte +20 -11
  129. package/dist/marks/Vector.svelte.d.ts +116 -35
  130. package/dist/marks/WaffleX.svelte +18 -16
  131. package/dist/marks/WaffleX.svelte.d.ts +131 -57
  132. package/dist/marks/WaffleY.svelte +16 -15
  133. package/dist/marks/WaffleY.svelte.d.ts +129 -56
  134. package/dist/marks/helpers/Anchor.svelte +17 -2
  135. package/dist/marks/helpers/Anchor.svelte.d.ts +16 -1
  136. package/dist/marks/helpers/AreaCanvas.svelte +8 -8
  137. package/dist/marks/helpers/BaseAxisX.svelte +38 -41
  138. package/dist/marks/helpers/BaseAxisX.svelte.d.ts +11 -17
  139. package/dist/marks/helpers/BaseAxisY.svelte +35 -35
  140. package/dist/marks/helpers/BaseAxisY.svelte.d.ts +12 -15
  141. package/dist/marks/helpers/Box.svelte +35 -28
  142. package/dist/marks/helpers/Box.svelte.d.ts +122 -50
  143. package/dist/marks/helpers/DotCanvas.svelte +11 -9
  144. package/dist/marks/helpers/GeoCanvas.svelte +7 -6
  145. package/dist/marks/helpers/LineCanvas.svelte +7 -7
  146. package/dist/marks/helpers/LinearGradientX.svelte +2 -2
  147. package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
  148. package/dist/marks/helpers/LinearGradientY.svelte +2 -2
  149. package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
  150. package/dist/marks/helpers/Marker.svelte +2 -2
  151. package/dist/marks/helpers/MarkerPath.svelte +15 -12
  152. package/dist/marks/helpers/MarkerPath.svelte.d.ts +105 -32
  153. package/dist/marks/helpers/MultilineText.svelte +24 -17
  154. package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
  155. package/dist/marks/helpers/RectCanvas.svelte +31 -26
  156. package/dist/marks/helpers/RectPath.svelte +2 -2
  157. package/dist/marks/helpers/Regression.svelte +176 -86
  158. package/dist/marks/helpers/Regression.svelte.d.ts +20 -8
  159. package/dist/marks/helpers/RuleCanvas.svelte +9 -6
  160. package/dist/marks/helpers/TextCanvas.svelte +13 -9
  161. package/dist/marks/helpers/TextCanvas.svelte.d.ts +6 -6
  162. package/dist/marks/helpers/TickCanvas.svelte +6 -5
  163. package/dist/marks/helpers/TrailCanvas.svelte +16 -18
  164. package/dist/marks/helpers/TrailCanvas.svelte.d.ts +3 -5
  165. package/dist/marks/helpers/canvas.js +16 -9
  166. package/dist/marks/helpers/events.d.ts +2 -2
  167. package/dist/marks/helpers/events.js +14 -7
  168. package/dist/marks/helpers/waffle.d.ts +3 -3
  169. package/dist/marks/helpers/waffle.js +6 -4
  170. package/dist/regression/polynomial.d.ts +1 -1
  171. package/dist/regression/polynomial.js +5 -5
  172. package/dist/regression/utils/determination.d.ts +1 -1
  173. package/dist/regression/utils/determination.js +1 -1
  174. package/dist/regression/utils/geometry.d.ts +1 -1
  175. package/dist/regression/utils/interpose.d.ts +1 -1
  176. package/dist/regression/utils/interpose.js +1 -1
  177. package/dist/regression/utils/points.d.ts +1 -1
  178. package/dist/transforms/bin.d.ts +3 -3
  179. package/dist/transforms/bin.js +29 -20
  180. package/dist/transforms/bollinger.d.ts +8 -0
  181. package/dist/transforms/bollinger.js +9 -1
  182. package/dist/transforms/centroid.d.ts +4 -0
  183. package/dist/transforms/centroid.js +4 -0
  184. package/dist/transforms/density.d.ts +4 -4
  185. package/dist/transforms/density.js +20 -13
  186. package/dist/transforms/dodge.d.ts +12 -1
  187. package/dist/transforms/dodge.js +15 -6
  188. package/dist/transforms/group.d.ts +141 -4
  189. package/dist/transforms/group.js +4 -1
  190. package/dist/transforms/interval.d.ts +204 -60
  191. package/dist/transforms/jitter.d.ts +421 -4
  192. package/dist/transforms/jitter.js +10 -1
  193. package/dist/transforms/map.d.ts +412 -4
  194. package/dist/transforms/map.js +3 -3
  195. package/dist/transforms/normalize.d.ts +276 -5
  196. package/dist/transforms/normalize.js +5 -3
  197. package/dist/transforms/recordize.d.ts +17 -5
  198. package/dist/transforms/recordize.js +13 -9
  199. package/dist/transforms/rename.d.ts +11 -4
  200. package/dist/transforms/rename.js +7 -2
  201. package/dist/transforms/select.d.ts +722 -210
  202. package/dist/transforms/select.js +13 -1
  203. package/dist/transforms/shift.d.ts +8 -0
  204. package/dist/transforms/shift.js +20 -6
  205. package/dist/transforms/sort.d.ts +13 -258
  206. package/dist/transforms/sort.js +13 -10
  207. package/dist/transforms/stack.d.ts +58 -9
  208. package/dist/transforms/stack.js +27 -11
  209. package/dist/transforms/window.d.ts +221 -66
  210. package/dist/transforms/window.js +8 -2
  211. package/dist/types/axes.d.ts +43 -0
  212. package/dist/types/axes.js +1 -0
  213. package/dist/types/channel.d.ts +30 -2
  214. package/dist/types/data.d.ts +14 -1
  215. package/dist/types/facet.d.ts +5 -0
  216. package/dist/types/index.d.ts +33 -8
  217. package/dist/types/index.js +11 -7
  218. package/dist/types/mark.d.ts +124 -35
  219. package/dist/types/plot.d.ts +118 -16
  220. package/dist/types/scale.d.ts +125 -8
  221. package/package.json +178 -175
  222. package/dist/helpers/autoTicks.d.ts +0 -12
@@ -1,5 +1,4 @@
1
1
  import type { TransformArg, RawValue, MapIndexObject } from '../types/index.js';
2
- import { sort } from './sort.js';
3
2
  type BasisFunction = (I: number[], S: RawValue[]) => number;
4
3
  type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | BasisFunction | MapIndexObject;
5
4
  type NormalizeOptions = NormalizeBasis | {
@@ -8,11 +7,283 @@ type NormalizeOptions = NormalizeBasis | {
8
7
  /**
9
8
  * Normalizes the x values based on the specified basis. Uses mapX.
10
9
  */
11
- export declare function normalizeX<T>(args: TransformArg<T>, options: NormalizeOptions): any;
10
+ export declare function normalizeX<T>(args: TransformArg<T>, options: NormalizeOptions): {
11
+ filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
12
+ facet?: "auto" | "include" | "exclude" | undefined;
13
+ fx?: import("../types/channel.js").ChannelAccessor<T>;
14
+ fy?: import("../types/channel.js").ChannelAccessor<T>;
15
+ dx?: import("../types/index.js").ConstantAccessor<number, T>;
16
+ dy?: import("../types/index.js").ConstantAccessor<number, T>;
17
+ dodgeX?: import("./dodge.js").DodgeXOptions | undefined;
18
+ dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
19
+ fill?: import("../types/channel.js").ChannelAccessor<T>;
20
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
21
+ fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, T>;
22
+ fontSize?: import("../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", T>;
23
+ fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, T>;
24
+ fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, T>;
25
+ fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, T>;
26
+ letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, T>;
27
+ wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, T>;
28
+ textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, T>;
29
+ textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, T>;
30
+ textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, T>;
31
+ sort?: ((a: RawValue, b: RawValue) => number) | {
32
+ channel: string;
33
+ order?: "ascending" | "descending";
34
+ } | import("../types/index.js").ConstantAccessor<RawValue, T>;
35
+ stroke?: import("../types/channel.js").ChannelAccessor<T>;
36
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
37
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
38
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
39
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
40
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
41
+ opacity?: import("../types/channel.js").ChannelAccessor<T>;
42
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
43
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
44
+ blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
45
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
46
+ clipPath?: string | undefined;
47
+ mask?: string | undefined;
48
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
49
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
50
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
51
+ onclick?: ((event: Event & {
52
+ currentTarget: SVGPathElement;
53
+ }, datum: T, index: number) => void) | undefined;
54
+ ondblclick?: ((event: Event & {
55
+ currentTarget: SVGPathElement;
56
+ }, datum: T, index: number) => void) | undefined;
57
+ onmouseup?: ((event: Event & {
58
+ currentTarget: SVGPathElement;
59
+ }, datum: T, index: number) => void) | undefined;
60
+ onmousedown?: ((event: Event & {
61
+ currentTarget: SVGPathElement;
62
+ }, datum: T, index: number) => void) | undefined;
63
+ onmouseenter?: ((event: Event & {
64
+ currentTarget: SVGPathElement;
65
+ }, datum: T, index: number) => void) | undefined;
66
+ onmousemove?: ((event: Event & {
67
+ currentTarget: SVGPathElement;
68
+ }, datum: T, index: number) => void) | undefined;
69
+ onmouseleave?: ((event: Event & {
70
+ currentTarget: SVGPathElement;
71
+ }, datum: T, index: number) => void) | undefined;
72
+ onmouseout?: ((event: Event & {
73
+ currentTarget: SVGPathElement;
74
+ }, datum: T, index: number) => void) | undefined;
75
+ onmouseover?: ((event: Event & {
76
+ currentTarget: SVGPathElement;
77
+ }, datum: T, index: number) => void) | undefined;
78
+ onpointercancel?: ((event: Event & {
79
+ currentTarget: SVGPathElement;
80
+ }, datum: T, index: number) => void) | undefined;
81
+ onpointerdown?: ((event: Event & {
82
+ currentTarget: SVGPathElement;
83
+ }, datum: T, index: number) => void) | undefined;
84
+ onpointerup?: ((event: Event & {
85
+ currentTarget: SVGPathElement;
86
+ }, datum: T, index: number) => void) | undefined;
87
+ onpointerenter?: ((event: Event & {
88
+ currentTarget: SVGPathElement;
89
+ }, datum: T, index: number) => void) | undefined;
90
+ onpointerleave?: ((event: Event & {
91
+ currentTarget: SVGPathElement;
92
+ }, datum: T, index: number) => void) | undefined;
93
+ onpointermove?: ((event: Event & {
94
+ currentTarget: SVGPathElement;
95
+ }, datum: T, index: number) => void) | undefined;
96
+ onpointerover?: ((event: Event & {
97
+ currentTarget: SVGPathElement;
98
+ }, datum: T, index: number) => void) | undefined;
99
+ onpointerout?: ((event: Event & {
100
+ currentTarget: SVGPathElement;
101
+ }, datum: T, index: number) => void) | undefined;
102
+ ondrag?: ((event: Event & {
103
+ currentTarget: SVGPathElement;
104
+ }, datum: T, index: number) => void) | undefined;
105
+ ondrop?: ((event: Event & {
106
+ currentTarget: SVGPathElement;
107
+ }, datum: T, index: number) => void) | undefined;
108
+ ondragstart?: ((event: Event & {
109
+ currentTarget: SVGPathElement;
110
+ }, datum: T, index: number) => void) | undefined;
111
+ ondragenter?: ((event: Event & {
112
+ currentTarget: SVGPathElement;
113
+ }, datum: T, index: number) => void) | undefined;
114
+ ondragleave?: ((event: Event & {
115
+ currentTarget: SVGPathElement;
116
+ }, datum: T, index: number) => void) | undefined;
117
+ ondragover?: ((event: Event & {
118
+ currentTarget: SVGPathElement;
119
+ }, datum: T, index: number) => void) | undefined;
120
+ ondragend?: ((event: Event & {
121
+ currentTarget: SVGPathElement;
122
+ }, datum: T, index: number) => void) | undefined;
123
+ ontouchstart?: ((event: Event & {
124
+ currentTarget: SVGPathElement;
125
+ }, datum: T, index: number) => void) | undefined;
126
+ ontouchmove?: ((event: Event & {
127
+ currentTarget: SVGPathElement;
128
+ }, datum: T, index: number) => void) | undefined;
129
+ ontouchend?: ((event: Event & {
130
+ currentTarget: SVGPathElement;
131
+ }, datum: T, index: number) => void) | undefined;
132
+ ontouchcancel?: ((event: Event & {
133
+ currentTarget: SVGPathElement;
134
+ }, datum: T, index: number) => void) | undefined;
135
+ oncontextmenu?: ((event: Event & {
136
+ currentTarget: SVGPathElement;
137
+ }, datum: T, index: number) => void) | undefined;
138
+ onwheel?: ((event: Event & {
139
+ currentTarget: SVGPathElement;
140
+ }, datum: T, index: number) => void) | undefined;
141
+ class?: string | undefined;
142
+ style?: string | undefined;
143
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
144
+ title?: import("../types/index.js").ConstantAccessor<string, T>;
145
+ data: Record<string | symbol, RawValue>[];
146
+ };
12
147
  /**
13
148
  * Normalizes the y values based on the specified basis. Uses mapY.
14
149
  */
15
- export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeOptions): any;
150
+ export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeOptions): {
151
+ filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
152
+ facet?: "auto" | "include" | "exclude" | undefined;
153
+ fx?: import("../types/channel.js").ChannelAccessor<T>;
154
+ fy?: import("../types/channel.js").ChannelAccessor<T>;
155
+ dx?: import("../types/index.js").ConstantAccessor<number, T>;
156
+ dy?: import("../types/index.js").ConstantAccessor<number, T>;
157
+ dodgeX?: import("./dodge.js").DodgeXOptions | undefined;
158
+ dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
159
+ fill?: import("../types/channel.js").ChannelAccessor<T>;
160
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
161
+ fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, T>;
162
+ fontSize?: import("../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", T>;
163
+ fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, T>;
164
+ fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, T>;
165
+ fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, T>;
166
+ letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, T>;
167
+ wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, T>;
168
+ textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, T>;
169
+ textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, T>;
170
+ textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, T>;
171
+ sort?: ((a: RawValue, b: RawValue) => number) | {
172
+ channel: string;
173
+ order?: "ascending" | "descending";
174
+ } | import("../types/index.js").ConstantAccessor<RawValue, T>;
175
+ stroke?: import("../types/channel.js").ChannelAccessor<T>;
176
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
177
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
178
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
179
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
180
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
181
+ opacity?: import("../types/channel.js").ChannelAccessor<T>;
182
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
183
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
184
+ blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
185
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
186
+ clipPath?: string | undefined;
187
+ mask?: string | undefined;
188
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
189
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
190
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
191
+ onclick?: ((event: Event & {
192
+ currentTarget: SVGPathElement;
193
+ }, datum: T, index: number) => void) | undefined;
194
+ ondblclick?: ((event: Event & {
195
+ currentTarget: SVGPathElement;
196
+ }, datum: T, index: number) => void) | undefined;
197
+ onmouseup?: ((event: Event & {
198
+ currentTarget: SVGPathElement;
199
+ }, datum: T, index: number) => void) | undefined;
200
+ onmousedown?: ((event: Event & {
201
+ currentTarget: SVGPathElement;
202
+ }, datum: T, index: number) => void) | undefined;
203
+ onmouseenter?: ((event: Event & {
204
+ currentTarget: SVGPathElement;
205
+ }, datum: T, index: number) => void) | undefined;
206
+ onmousemove?: ((event: Event & {
207
+ currentTarget: SVGPathElement;
208
+ }, datum: T, index: number) => void) | undefined;
209
+ onmouseleave?: ((event: Event & {
210
+ currentTarget: SVGPathElement;
211
+ }, datum: T, index: number) => void) | undefined;
212
+ onmouseout?: ((event: Event & {
213
+ currentTarget: SVGPathElement;
214
+ }, datum: T, index: number) => void) | undefined;
215
+ onmouseover?: ((event: Event & {
216
+ currentTarget: SVGPathElement;
217
+ }, datum: T, index: number) => void) | undefined;
218
+ onpointercancel?: ((event: Event & {
219
+ currentTarget: SVGPathElement;
220
+ }, datum: T, index: number) => void) | undefined;
221
+ onpointerdown?: ((event: Event & {
222
+ currentTarget: SVGPathElement;
223
+ }, datum: T, index: number) => void) | undefined;
224
+ onpointerup?: ((event: Event & {
225
+ currentTarget: SVGPathElement;
226
+ }, datum: T, index: number) => void) | undefined;
227
+ onpointerenter?: ((event: Event & {
228
+ currentTarget: SVGPathElement;
229
+ }, datum: T, index: number) => void) | undefined;
230
+ onpointerleave?: ((event: Event & {
231
+ currentTarget: SVGPathElement;
232
+ }, datum: T, index: number) => void) | undefined;
233
+ onpointermove?: ((event: Event & {
234
+ currentTarget: SVGPathElement;
235
+ }, datum: T, index: number) => void) | undefined;
236
+ onpointerover?: ((event: Event & {
237
+ currentTarget: SVGPathElement;
238
+ }, datum: T, index: number) => void) | undefined;
239
+ onpointerout?: ((event: Event & {
240
+ currentTarget: SVGPathElement;
241
+ }, datum: T, index: number) => void) | undefined;
242
+ ondrag?: ((event: Event & {
243
+ currentTarget: SVGPathElement;
244
+ }, datum: T, index: number) => void) | undefined;
245
+ ondrop?: ((event: Event & {
246
+ currentTarget: SVGPathElement;
247
+ }, datum: T, index: number) => void) | undefined;
248
+ ondragstart?: ((event: Event & {
249
+ currentTarget: SVGPathElement;
250
+ }, datum: T, index: number) => void) | undefined;
251
+ ondragenter?: ((event: Event & {
252
+ currentTarget: SVGPathElement;
253
+ }, datum: T, index: number) => void) | undefined;
254
+ ondragleave?: ((event: Event & {
255
+ currentTarget: SVGPathElement;
256
+ }, datum: T, index: number) => void) | undefined;
257
+ ondragover?: ((event: Event & {
258
+ currentTarget: SVGPathElement;
259
+ }, datum: T, index: number) => void) | undefined;
260
+ ondragend?: ((event: Event & {
261
+ currentTarget: SVGPathElement;
262
+ }, datum: T, index: number) => void) | undefined;
263
+ ontouchstart?: ((event: Event & {
264
+ currentTarget: SVGPathElement;
265
+ }, datum: T, index: number) => void) | undefined;
266
+ ontouchmove?: ((event: Event & {
267
+ currentTarget: SVGPathElement;
268
+ }, datum: T, index: number) => void) | undefined;
269
+ ontouchend?: ((event: Event & {
270
+ currentTarget: SVGPathElement;
271
+ }, datum: T, index: number) => void) | undefined;
272
+ ontouchcancel?: ((event: Event & {
273
+ currentTarget: SVGPathElement;
274
+ }, datum: T, index: number) => void) | undefined;
275
+ oncontextmenu?: ((event: Event & {
276
+ currentTarget: SVGPathElement;
277
+ }, datum: T, index: number) => void) | undefined;
278
+ onwheel?: ((event: Event & {
279
+ currentTarget: SVGPathElement;
280
+ }, datum: T, index: number) => void) | undefined;
281
+ class?: string | undefined;
282
+ style?: string | undefined;
283
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
284
+ title?: import("../types/index.js").ConstantAccessor<string, T>;
285
+ data: Record<string | symbol, RawValue>[];
286
+ };
16
287
  /**
17
288
  * Convenience wrapper for normalizeY for parallel coordinates.
18
289
  *
@@ -21,7 +292,7 @@ export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeO
21
292
  * - y: the value to normalize (e.g., 'Value')
22
293
  * - z: the grouping variable (e.g., 'Id')
23
294
  */
24
- export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: NormalizeBasis): ReturnType<typeof sort<T>>;
295
+ export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: NormalizeBasis): TransformArg<T>;
25
296
  /**
26
297
  * Convenience wrapper for normalizeY for parallel coordinates.
27
298
  *
@@ -30,5 +301,5 @@ export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: Norm
30
301
  * - y: the value to normalize (e.g., 'Value')
31
302
  * - z: the grouping variable (e.g., 'Id')
32
303
  */
33
- export declare function normalizeParallelX<T>(args: TransformArg<T>, basis: NormalizeBasis): ReturnType<typeof sort<T>>;
304
+ export declare function normalizeParallelX<T>(args: TransformArg<T>, basis: NormalizeBasis): TransformArg<T>;
34
305
  export {};
@@ -65,9 +65,9 @@ function normalizeAccessor(f) {
65
65
  const normalizeExtent = {
66
66
  mapIndex(I, S, T) {
67
67
  const [s1, s2] = extent(I, (i) => S[i]);
68
- const d = s2 - s1;
68
+ const d = (s2 ?? 0) - (s1 ?? 0);
69
69
  for (const i of I) {
70
- T[i] = S[i] === null ? NaN : (S[i] - s1) / d;
70
+ T[i] = S[i] === null ? NaN : (S[i] - (s1 ?? 0)) / d;
71
71
  }
72
72
  }
73
73
  };
@@ -77,6 +77,7 @@ const normalizeFirst = normalizeBasis((I, S) => {
77
77
  if (s != null && isFinite(s))
78
78
  return s;
79
79
  }
80
+ return NaN;
80
81
  });
81
82
  const normalizeLast = normalizeBasis((I, S) => {
82
83
  for (let i = I.length - 1; i >= 0; --i) {
@@ -84,13 +85,14 @@ const normalizeLast = normalizeBasis((I, S) => {
84
85
  if (s != null && isFinite(s))
85
86
  return s;
86
87
  }
88
+ return NaN;
87
89
  });
88
90
  const normalizeDeviation = {
89
91
  mapIndex(I, S, T) {
90
92
  const m = mean(I, (i) => S[i]);
91
93
  const d = deviation(I, (i) => S[i]);
92
94
  for (const i of I) {
93
- T[i] = S[i] === null ? NaN : d ? (S[i] - m) / d : 0;
95
+ T[i] = S[i] === null ? NaN : d ? (S[i] - (m ?? 0)) / d : 0;
94
96
  }
95
97
  }
96
98
  };
@@ -1,15 +1,23 @@
1
1
  import type { TransformArgsRow, TransformArgsRecord, DataRecord, DataRow } from '../types/index.js';
2
- import { INDEX } from '../constants';
2
+ import { INDEX } from '../constants.js';
3
3
  export declare const X: unique symbol;
4
4
  export declare const Y: unique symbol;
5
5
  export declare const RAW_VALUE: unique symbol;
6
6
  export declare function indexData<T extends object>(data: T[]): (T & {
7
7
  [INDEX]: number;
8
8
  })[];
9
- export declare function recordizeX<T>({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
9
+ /**
10
+ * takes an array of raw values and returns data records in which the values
11
+ * are interpreted as the x channel and their index as the y channel
12
+ */
13
+ export declare function recordizeX({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
10
14
  withIndex: boolean;
11
15
  }): TransformArgsRecord<DataRecord>;
12
- export declare function recordizeY<T>({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
16
+ /**
17
+ * takes an array of raw values and returns data records in which the values
18
+ * are interpreted as the y channel and their index as the x channel
19
+ */
20
+ export declare function recordizeY({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
13
21
  withIndex: boolean;
14
22
  }): TransformArgsRecord<DataRecord>;
15
23
  /**
@@ -17,5 +25,9 @@ export declare function recordizeY<T>({ data, ...channels }: TransformArgsRow<Da
17
25
  * as dataset to marks that support it. It transforms the arrays into records, so
18
26
  * the rest of our code doesn't have to deal with this case anymore.
19
27
  */
20
- export declare function recordizeXY<T>({ data, ...channels }: TransformArgsRow<T>): TransformArgsRecord<T>;
21
- export declare function recordize<T>({ data, ...channels }: TransformArgsRow<T>): TransformArgsRecord<T>;
28
+ export declare function recordizeXY({ data, ...channels }: TransformArgsRow<DataRow>): TransformArgsRecord<DataRecord>;
29
+ /**
30
+ * wraps raw values into data records with index tracking, without
31
+ * assigning them to a specific positional channel
32
+ */
33
+ export declare function recordize({ data, ...channels }: TransformArgsRow<DataRow>): TransformArgsRecord<DataRecord>;
@@ -1,21 +1,21 @@
1
1
  import isDataRecord from '../helpers/isDataRecord.js';
2
- import { INDEX } from '../constants';
2
+ import { INDEX } from '../constants.js';
3
3
  export const X = Symbol('x');
4
4
  export const Y = Symbol('y');
5
5
  export const RAW_VALUE = Symbol('originalValue');
6
6
  export function indexData(data) {
7
7
  return data.map((d, i) => ({ ...d, [INDEX]: i }));
8
8
  }
9
- /*
10
- * This transform takes an array of raw values as input and returns data records
11
- * in which the values are interpreted as x channel and their index as y
9
+ /**
10
+ * takes an array of raw values and returns data records in which the values
11
+ * are interpreted as the x channel and their index as the y channel
12
12
  */
13
13
  export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: true }) {
14
14
  const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.x == null;
15
15
  if (dataIsRawValueArray) {
16
16
  // we remove x, x1 and x2 from the channels since they make no sense when
17
17
  // the data is a raw value array
18
- const { x, x1, x2, ...nonXChannels } = channels;
18
+ const { x: _x, x1: _x1, x2: _x2, ...nonXChannels } = channels;
19
19
  return {
20
20
  data: data.map((value, index) => ({
21
21
  [RAW_VALUE]: value,
@@ -28,9 +28,9 @@ export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: t
28
28
  }
29
29
  return { data: indexData(data), ...channels };
30
30
  }
31
- /*
32
- * This transform takes an array of raw values as input and returns data records
33
- * in which the values are interpreted as y channel and their index as yx
31
+ /**
32
+ * takes an array of raw values and returns data records in which the values
33
+ * are interpreted as the y channel and their index as the x channel
34
34
  */
35
35
  export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: true }) {
36
36
  if (!data)
@@ -39,7 +39,7 @@ export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: t
39
39
  if (dataIsRawValueArray) {
40
40
  // we remove y, y1 and y2 from the channels since they make no sense when
41
41
  // the data is a raw value array
42
- const { y, y1, y2, ...nonYChannels } = channels;
42
+ const { y: _y, y1: _y1, y2: _y2, ...nonYChannels } = channels;
43
43
  return {
44
44
  data: Array.from(data).map((value, index) => ({
45
45
  [INDEX]: index,
@@ -78,6 +78,10 @@ export function recordizeXY({ data, ...channels }) {
78
78
  }
79
79
  return { data: data, ...channels };
80
80
  }
81
+ /**
82
+ * wraps raw values into data records with index tracking, without
83
+ * assigning them to a specific positional channel
84
+ */
81
85
  export function recordize({ data, ...channels }) {
82
86
  if (!data)
83
87
  return { data, ...channels };
@@ -1,15 +1,22 @@
1
1
  import type { DataRecord } from '../types/index.js';
2
- import type { ScaledChannelName, TransformArg } from '../types/index.js';
2
+ import type { ScaledChannelName } from '../types/index.js';
3
3
  type RenameChannelsOptions = Partial<Record<ScaledChannelName, ScaledChannelName>>;
4
4
  type ReplaceChannelsOptions = Partial<Record<ScaledChannelName, ScaledChannelName[]>>;
5
+ type TransformLike<T extends DataRecord = DataRecord> = {
6
+ data: T[];
7
+ } & Record<string | symbol, any>;
5
8
  export declare const RENAME: unique symbol;
6
9
  /**
7
10
  * renames a channel without modifying the data
8
11
  */
9
- export declare function renameChannels<T>({ data, ...channels }: TransformArg<T, DataRecord>, options: RenameChannelsOptions): TransformArg<T, DataRecord>;
12
+ export declare function renameChannels<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: RenameChannelsOptions): C;
10
13
  /**
11
14
  * renames a channel and copy the data
12
15
  */
13
- export declare function renameChannelsAndData<T>({ data, ...channels }: TransformArg<T, DataRecord>, options: RenameChannelsOptions): TransformArg<T, DataRecord>;
14
- export declare function replaceChannels<T>({ data, ...channels }: TransformArg<T, DataRecord>, options: ReplaceChannelsOptions): TransformArg<T, DataRecord>;
16
+ export declare function renameChannelsAndData<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: RenameChannelsOptions): C;
17
+ /**
18
+ * copies a channel's accessor to multiple target channels, then removes
19
+ * the source channel
20
+ */
21
+ export declare function replaceChannels<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: ReplaceChannelsOptions): C;
15
22
  export {};
@@ -23,16 +23,21 @@ export function renameChannelsAndData({ data, ...channels }, options) {
23
23
  const newData = [];
24
24
  for (const datum of data) {
25
25
  const newDatum = { ...datum };
26
+ const mutableDatum = newDatum;
26
27
  for (const [from, to] of Object.entries(options)) {
27
28
  if (channels[from] !== undefined) {
28
- newDatum[to] = newDatum[from];
29
- delete newDatum[from];
29
+ mutableDatum[to] = mutableDatum[from];
30
+ delete mutableDatum[from];
30
31
  }
31
32
  }
32
33
  newData.push(newDatum);
33
34
  }
34
35
  return renameChannels({ data: newData, ...channels }, options);
35
36
  }
37
+ /**
38
+ * copies a channel's accessor to multiple target channels, then removes
39
+ * the source channel
40
+ */
36
41
  export function replaceChannels({ data, ...channels }, options) {
37
42
  const newChannels = { ...channels };
38
43
  for (const [from, to] of Object.entries(options)) {