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,85 +1,158 @@
1
- import type { DataRecord, ChannelAccessor, LinkableMarkProps } from '../types';
2
- import { type WaffleOptions } from './helpers/waffle';
1
+ import type { DataRecord, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
2
+ import { type WaffleOptions } from './helpers/waffle.js';
3
3
  declare function $$render<Datum extends DataRecord>(): {
4
4
  props: Partial<{
5
- filter: import("../types").ConstantAccessor<boolean, Datum>;
5
+ filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
6
6
  facet: "auto" | "include" | "exclude";
7
7
  fx: ChannelAccessor<Datum>;
8
8
  fy: ChannelAccessor<Datum>;
9
- dx: import("../types").ConstantAccessor<number, Datum>;
10
- dy: import("../types").ConstantAccessor<number, Datum>;
11
- dodgeX: import("../transforms/dodge").DodgeXOptions;
12
- dodgeY: import("../transforms/dodge").DodgeYOptions;
9
+ dx: import("../types/index.js").ConstantAccessor<number, Datum>;
10
+ dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
+ dodgeX: import("../transforms/dodge.js").DodgeXOptions;
12
+ dodgeY: import("../transforms/dodge.js").DodgeYOptions;
13
13
  fill: ChannelAccessor<Datum>;
14
- fillOpacity: import("../types").ConstantAccessor<number, Datum>;
15
- sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
14
+ fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
15
+ fontFamily: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, Datum>;
16
+ 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", Datum>;
17
+ fontStyle: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, Datum>;
18
+ fontVariant: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, Datum>;
19
+ fontWeight: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, Datum>;
20
+ letterSpacing: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, Datum>;
21
+ wordSpacing: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, Datum>;
22
+ textAnchor: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, Datum>;
23
+ textTransform: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, Datum>;
24
+ textDecoration: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, Datum>;
25
+ sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
16
26
  channel: string;
17
27
  order?: "ascending" | "descending";
18
- } | import("../types").ConstantAccessor<import("../types").RawValue, Datum>;
28
+ } | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
19
29
  stroke: ChannelAccessor<Datum>;
20
- strokeWidth: import("../types").ConstantAccessor<number, Datum>;
21
- strokeOpacity: import("../types").ConstantAccessor<number, Datum>;
22
- strokeLinejoin: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
23
- strokeLinecap: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
24
- strokeMiterlimit: import("../types").ConstantAccessor<number, Datum>;
30
+ strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
31
+ strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
32
+ strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
33
+ strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
34
+ strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
25
35
  opacity: ChannelAccessor<Datum>;
26
- strokeDasharray: import("../types").ConstantAccessor<string, Datum>;
27
- strokeDashoffset: import("../types").ConstantAccessor<number, Datum>;
28
- mixBlendMode: import("../types").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
36
+ strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
37
+ strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
38
+ blend: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
39
+ mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
29
40
  clipPath: string;
30
41
  mask: string;
31
- imageFilter: import("../types").ConstantAccessor<string, Datum>;
32
- shapeRendering: import("../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
33
- paintOrder: import("../types").ConstantAccessor<string, Datum>;
34
- onclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- ondblclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onmouseup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onmousedown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onmouseenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onmousemove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onmouseleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- onmouseout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- onmouseover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- onpointercancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- onpointerdown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- onpointerup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- onpointerenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- onpointerleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- onpointermove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- onpointerover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- onpointerout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ondrag: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- ondrop: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- ondragstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- ondragenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
- ondragleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
- ondragover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
- ondragend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
- ontouchstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
- ontouchmove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
- ontouchend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
- ontouchcancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
62
- oncontextmenu: import("svelte/elements").MouseEventHandler<SVGPathElement>;
63
- onwheel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
+ imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
43
+ shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
44
+ paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
45
+ onclick: (event: Event & {
46
+ currentTarget: SVGPathElement;
47
+ }, datum: Datum, index: number) => void;
48
+ ondblclick: (event: Event & {
49
+ currentTarget: SVGPathElement;
50
+ }, datum: Datum, index: number) => void;
51
+ onmouseup: (event: Event & {
52
+ currentTarget: SVGPathElement;
53
+ }, datum: Datum, index: number) => void;
54
+ onmousedown: (event: Event & {
55
+ currentTarget: SVGPathElement;
56
+ }, datum: Datum, index: number) => void;
57
+ onmouseenter: (event: Event & {
58
+ currentTarget: SVGPathElement;
59
+ }, datum: Datum, index: number) => void;
60
+ onmousemove: (event: Event & {
61
+ currentTarget: SVGPathElement;
62
+ }, datum: Datum, index: number) => void;
63
+ onmouseleave: (event: Event & {
64
+ currentTarget: SVGPathElement;
65
+ }, datum: Datum, index: number) => void;
66
+ onmouseout: (event: Event & {
67
+ currentTarget: SVGPathElement;
68
+ }, datum: Datum, index: number) => void;
69
+ onmouseover: (event: Event & {
70
+ currentTarget: SVGPathElement;
71
+ }, datum: Datum, index: number) => void;
72
+ onpointercancel: (event: Event & {
73
+ currentTarget: SVGPathElement;
74
+ }, datum: Datum, index: number) => void;
75
+ onpointerdown: (event: Event & {
76
+ currentTarget: SVGPathElement;
77
+ }, datum: Datum, index: number) => void;
78
+ onpointerup: (event: Event & {
79
+ currentTarget: SVGPathElement;
80
+ }, datum: Datum, index: number) => void;
81
+ onpointerenter: (event: Event & {
82
+ currentTarget: SVGPathElement;
83
+ }, datum: Datum, index: number) => void;
84
+ onpointerleave: (event: Event & {
85
+ currentTarget: SVGPathElement;
86
+ }, datum: Datum, index: number) => void;
87
+ onpointermove: (event: Event & {
88
+ currentTarget: SVGPathElement;
89
+ }, datum: Datum, index: number) => void;
90
+ onpointerover: (event: Event & {
91
+ currentTarget: SVGPathElement;
92
+ }, datum: Datum, index: number) => void;
93
+ onpointerout: (event: Event & {
94
+ currentTarget: SVGPathElement;
95
+ }, datum: Datum, index: number) => void;
96
+ ondrag: (event: Event & {
97
+ currentTarget: SVGPathElement;
98
+ }, datum: Datum, index: number) => void;
99
+ ondrop: (event: Event & {
100
+ currentTarget: SVGPathElement;
101
+ }, datum: Datum, index: number) => void;
102
+ ondragstart: (event: Event & {
103
+ currentTarget: SVGPathElement;
104
+ }, datum: Datum, index: number) => void;
105
+ ondragenter: (event: Event & {
106
+ currentTarget: SVGPathElement;
107
+ }, datum: Datum, index: number) => void;
108
+ ondragleave: (event: Event & {
109
+ currentTarget: SVGPathElement;
110
+ }, datum: Datum, index: number) => void;
111
+ ondragover: (event: Event & {
112
+ currentTarget: SVGPathElement;
113
+ }, datum: Datum, index: number) => void;
114
+ ondragend: (event: Event & {
115
+ currentTarget: SVGPathElement;
116
+ }, datum: Datum, index: number) => void;
117
+ ontouchstart: (event: Event & {
118
+ currentTarget: SVGPathElement;
119
+ }, datum: Datum, index: number) => void;
120
+ ontouchmove: (event: Event & {
121
+ currentTarget: SVGPathElement;
122
+ }, datum: Datum, index: number) => void;
123
+ ontouchend: (event: Event & {
124
+ currentTarget: SVGPathElement;
125
+ }, datum: Datum, index: number) => void;
126
+ ontouchcancel: (event: Event & {
127
+ currentTarget: SVGPathElement;
128
+ }, datum: Datum, index: number) => void;
129
+ oncontextmenu: (event: Event & {
130
+ currentTarget: SVGPathElement;
131
+ }, datum: Datum, index: number) => void;
132
+ onwheel: (event: Event & {
133
+ currentTarget: SVGPathElement;
134
+ }, datum: Datum, index: number) => void;
64
135
  class: string;
65
136
  style: string;
66
- cursor: import("../types").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
137
+ cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
138
+ title: import("../types/index.js").ConstantAccessor<string, Datum>;
67
139
  }> & LinkableMarkProps<Datum> & WaffleOptions<Datum> & {
140
+ /** the input data array */
68
141
  data?: Datum[];
69
142
  /**
70
- * bound to a babd scale
143
+ * the horizontal position channel; bound to a band scale
71
144
  */
72
145
  x?: ChannelAccessor<Datum>;
73
146
  /**
74
- * bound to a quantitative scale
147
+ * the vertical position channel; bound to a quantitative scale
75
148
  */
76
149
  y?: ChannelAccessor<Datum>;
77
150
  /**
78
- * bound to a quantitative scale
151
+ * the starting vertical position; bound to a quantitative scale
79
152
  */
80
153
  y1?: ChannelAccessor<Datum>;
81
154
  /**
82
- * bound to a quantitative scale
155
+ * the ending vertical position; bound to a quantitative scale
83
156
  */
84
157
  y2?: ChannelAccessor<Datum>;
85
158
  };
@@ -1,21 +1,36 @@
1
1
  <script lang="ts" generics="Datum extends Record<string, any>">
2
2
  import { resolveProp } from '../../helpers/resolve.js';
3
- import type { ConstantAccessor } from '../../types';
3
+ import type { ConstantAccessor } from '../../types/index.js';
4
4
 
5
5
  interface AnchorProps {
6
6
  datum?: Datum;
7
7
  options?: {
8
+ /**
9
+ * The URL or URL fragment the hyperlink points to.
10
+ */
8
11
  href?: ConstantAccessor<string, Datum>;
12
+ /**
13
+ * Where to display the linked URL, e.g. _self, _blank
14
+ */
9
15
  target?: ConstantAccessor<string, Datum>;
16
+ /**
17
+ * The relationship of the target object to the link object.
18
+ */
10
19
  rel?: ConstantAccessor<string, Datum>;
20
+ /**
21
+ * A MIME type for the linked URL.
22
+ */
11
23
  type?: ConstantAccessor<string, Datum>;
24
+ /**
25
+ * Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file.
26
+ */
12
27
  download?: ConstantAccessor<string, Datum>;
13
28
  [key: string]: any;
14
29
  };
15
30
  children?: () => any;
16
31
  }
17
32
 
18
- let { datum = {}, options = {}, children }: AnchorProps = $props();
33
+ let { datum = {} as Datum, options = {}, children }: AnchorProps = $props();
19
34
 
20
35
  const href = $derived(resolveProp(options.href, datum, null));
21
36
  const target = $derived(resolveProp(options.target, datum, null));
@@ -1,12 +1,27 @@
1
- import type { ConstantAccessor } from '../../types';
1
+ import type { ConstantAccessor } from '../../types/index.js';
2
2
  declare function $$render<Datum extends Record<string, any>>(): {
3
3
  props: {
4
4
  datum?: Datum;
5
5
  options?: {
6
+ /**
7
+ * The URL or URL fragment the hyperlink points to.
8
+ */
6
9
  href?: ConstantAccessor<string, Datum>;
10
+ /**
11
+ * Where to display the linked URL, e.g. _self, _blank
12
+ */
7
13
  target?: ConstantAccessor<string, Datum>;
14
+ /**
15
+ * The relationship of the target object to the link object.
16
+ */
8
17
  rel?: ConstantAccessor<string, Datum>;
18
+ /**
19
+ * A MIME type for the linked URL.
20
+ */
9
21
  type?: ConstantAccessor<string, Datum>;
22
+ /**
23
+ * Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file.
24
+ */
10
25
  download?: ConstantAccessor<string, Datum>;
11
26
  [key: string]: any;
12
27
  };
@@ -47,13 +47,13 @@
47
47
  const firstPoint = group[0];
48
48
  if (!firstPoint || !firstPoint.valid) continue;
49
49
 
50
- let { fill, stroke, ...restStyles } = resolveScaledStyleProps(
50
+ const { fill, stroke, ...restStyles } = resolveScaledStyleProps(
51
51
  firstPoint.datum,
52
52
  mark.options,
53
53
  usedScales,
54
54
  plot,
55
55
  'fill'
56
- );
56
+ ) as { fill: string; stroke: string } & Record<string, unknown>;
57
57
 
58
58
  const opacity = maybeOpacity(restStyles['opacity']);
59
59
  const fillOpacity = maybeOpacity(restStyles['fill-opacity']);
@@ -65,23 +65,23 @@
65
65
  0
66
66
  ) as number;
67
67
 
68
- fill = resolveColor(fill || 'currentColor', canvas);
69
- stroke = resolveColor(stroke, canvas);
68
+ const fillStyle = resolveColor(fill || 'currentColor', canvas);
69
+ const strokeStyle = resolveColor(stroke, canvas);
70
70
 
71
71
  // Start drawing the area
72
72
  context.beginPath();
73
73
  areaPath(group);
74
74
 
75
75
  // Fill the area
76
- if (fill && fill !== 'none') {
77
- context.fillStyle = fill;
76
+ if (fillStyle && fillStyle !== 'none') {
77
+ context.fillStyle = fillStyle;
78
78
  context.globalAlpha = opacity * fillOpacity;
79
79
  context.fill();
80
80
  }
81
81
 
82
82
  // Stroke the area outline if strokeWidth > 0
83
- if (stroke && stroke !== 'none' && strokeWidth > 0) {
84
- context.strokeStyle = stroke;
83
+ if (strokeStyle && strokeStyle !== 'none' && strokeWidth > 0) {
84
+ context.strokeStyle = strokeStyle;
85
85
  context.lineWidth = strokeWidth;
86
86
  context.globalAlpha = opacity * strokeOpacity;
87
87
  context.stroke();
@@ -5,42 +5,38 @@
5
5
  import removeIdenticalLines from '../../helpers/removeIdenticalLines.js';
6
6
  import type {
7
7
  AutoMarginStores,
8
- ChannelAccessor,
9
8
  ConstantAccessor,
10
9
  PlotState,
10
+ PlotScaleFunction,
11
11
  RawValue,
12
12
  ScaledDataRecord,
13
13
  ScaleType
14
14
  } from '../../types/index.js';
15
+ import type { AxisTickDatum, AxisXTick, BaseAxisXOptions } from '../../types/axes.js';
15
16
  import { resolveProp, resolveStyles } from '../../helpers/resolve.js';
16
17
  import { max } from 'd3-array';
17
18
  import { randomId, testFilter } from '../../helpers/index.js';
18
- import { INDEX } from '../../constants';
19
- import { RAW_VALUE } from '../../transforms/recordize';
20
- import wordwrap from '../../helpers/wordwrap';
19
+ import { INDEX } from '../../constants.js';
20
+ import { RAW_VALUE } from '../../transforms/recordize.js';
21
+ import wordwrap from '../../helpers/wordwrap.js';
22
+ type AxisDatum = AxisTickDatum<typeof RAW_VALUE, typeof INDEX>;
23
+ type AxisTick = AxisXTick<AxisDatum>;
21
24
 
22
25
  type BaseAxisXProps = {
23
- scaleFn: (d: RawValue) => number;
26
+ scaleFn: PlotScaleFunction;
24
27
  scaleType: ScaleType;
25
28
  ticks: RawValue[];
26
29
  tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
27
- anchor: 'top' | 'bottom';
28
- tickSize: number;
29
- tickPadding: number;
30
- tickFontSize: ConstantAccessor<number>;
31
- tickClass: ConstantAccessor<string>;
30
+ anchor?: 'top' | 'bottom';
31
+ tickSize?: number;
32
+ tickPadding?: number;
33
+ tickFontSize?: ConstantAccessor<number>;
34
+ tickClass?: ConstantAccessor<string>;
32
35
  marginTop: number;
33
36
  height: number;
34
- title: string;
35
- options: {
36
- dx: ConstantAccessor<number>;
37
- dy: ConstantAccessor<number>;
38
- filter: ChannelAccessor;
39
- wordwrap: boolean;
40
- textAnchor: ConstantAccessor<'start' | 'middle' | 'end'> | 'auto';
41
- removeDuplicateTicks: boolean;
42
- };
43
- text: boolean;
37
+ title: string | null;
38
+ options: BaseAxisXOptions;
39
+ text?: boolean | null;
44
40
  plot: PlotState;
45
41
  class: string | undefined;
46
42
  };
@@ -50,16 +46,16 @@
50
46
  scaleType,
51
47
  ticks,
52
48
  tickFormat,
53
- anchor,
54
- tickSize,
55
- tickPadding,
56
- tickFontSize,
57
- tickClass,
49
+ anchor = 'bottom',
50
+ tickSize = 6,
51
+ tickPadding = 3,
52
+ tickFontSize = 11,
53
+ tickClass = null,
58
54
  marginTop,
59
55
  height,
60
56
  options,
61
57
  plot,
62
- title,
58
+ title = null,
63
59
  class: className = 'axis-x',
64
60
  text = true
65
61
  }: BaseAxisXProps = $props();
@@ -74,7 +70,7 @@
74
70
  ? wordwrap(tick, {
75
71
  maxLineWidth: bandWidth * 0.9,
76
72
  minCharactersPerLine: 4,
77
- fontSize: +resolveProp(tickFontSize, {}, 11),
73
+ fontSize: Number(resolveProp(tickFontSize, null, 11) ?? 11),
78
74
  monospace: false
79
75
  })
80
76
  : [tick];
@@ -92,23 +88,24 @@
92
88
  const { autoMarginTop, autoMarginBottom, autoMarginLeft, autoMarginRight } =
93
89
  getContext<AutoMarginStores>('svelteplot/autoMargins');
94
90
 
95
- let tickTextElements = $state([] as SVGTextElement[]);
91
+ let tickTextElements = $state([] as (SVGTextElement | undefined)[]);
92
+ const toScaledDatum = (tick: AxisTick) => ({ datum: tick }) as unknown as ScaledDataRecord;
96
93
 
97
94
  const positionedTicks = $derived.by(() => {
98
95
  let tickObjects = removeIdenticalLines(
99
96
  ticks.map((tick, i) => {
100
- const datum = { [RAW_VALUE]: tick, [INDEX]: i };
97
+ const datum: AxisDatum = { [RAW_VALUE]: tick, [INDEX]: i };
101
98
  return {
102
99
  ...datum,
103
100
  hidden: false,
104
- dx: +resolveProp(options.dx, datum, 0),
105
- dy: +resolveProp(options.dy, datum, 0),
106
- x: scaleFn(tick) + (scaleType === 'band' ? scaleFn.bandwidth() * 0.5 : 0),
101
+ dx: Number(resolveProp(options.dx, datum, 0) ?? 0),
102
+ dy: Number(resolveProp(options.dy, datum, 0) ?? 0),
103
+ x: scaleFn(tick) + (isBandScale ? scaleFn.bandwidth() * 0.5 : 0),
107
104
  text: splitTick(tickFormat(tick, i, ticks)),
108
105
  element: null as SVGTextElement | null
109
106
  };
110
107
  })
111
- );
108
+ ) as AxisTick[];
112
109
  const T = tickObjects.length;
113
110
  if (text) {
114
111
  for (let i = 0; i < T; i++) {
@@ -123,7 +120,7 @@
123
120
  }
124
121
  }
125
122
  }
126
- return tickObjects as ScaledDataRecord[];
123
+ return tickObjects;
127
124
  });
128
125
 
129
126
  $effect(() => {
@@ -153,7 +150,7 @@
153
150
  return tickTextElements[i].getBoundingClientRect().height;
154
151
  return 0;
155
152
  }) as number[]
156
- )
153
+ ) ?? 0
157
154
  ) +
158
155
  Math.max(0, tickPadding + tickSize) +
159
156
  (title ? 15 : 0);
@@ -182,7 +179,7 @@
182
179
  {#each positionedTicks as tick, t (tick[RAW_VALUE])}
183
180
  {#if testFilter(tick, options) && !tick.hidden}
184
181
  {@const tickClass_ = resolveProp(tickClass, tick)}
185
- {@const tickFontSize_ = +resolveProp(tickFontSize, tick, 10)}
182
+ {@const tickFontSize_ = Number(resolveProp(tickFontSize, tick, 10) ?? 10)}
186
183
  <g
187
184
  class="tick {tickClass_ || ''}"
188
185
  transform="translate({tick.x + tick.dx}, {tickY + tick.dy})"
@@ -190,10 +187,10 @@
190
187
  {#if tickSize}
191
188
  {@const [tickLineStyle, tickLineClass] = resolveStyles(
192
189
  plot,
193
- { datum: tick },
190
+ toScaledDatum(tick),
194
191
  options,
195
192
  'stroke',
196
- { x: true },
193
+ { x: true } as any,
197
194
  true
198
195
  )}
199
196
  <line
@@ -204,14 +201,14 @@
204
201
 
205
202
  {#if text}
206
203
  {@const textLines = tick.text}
207
- {@const prevTextLines = t && positionedTicks[t - 1].text}
204
+ {@const prevTextLines = t > 0 ? positionedTicks[t - 1].text : null}
208
205
 
209
206
  {@const moveDown =
210
207
  (tickSize + tickPadding + (tickRotate !== 0 ? tickFontSize_ * 0.35 : 0)) *
211
208
  (anchor === 'bottom' ? 1 : -1)}
212
209
  {@const [textStyle, textClass] = resolveStyles(
213
210
  plot,
214
- { datum: tick },
211
+ toScaledDatum(tick),
215
212
  {
216
213
  fontVariant: isQuantitative ? 'tabular-nums' : 'normal',
217
214
  ...options,
@@ -228,7 +225,7 @@
228
225
  stroke: null
229
226
  },
230
227
  'fill',
231
- { x: true },
228
+ { x: true } as any,
232
229
  true
233
230
  )}
234
231
  <text
@@ -1,26 +1,20 @@
1
- import type { ChannelAccessor, ConstantAccessor, PlotState, RawValue, ScaleType } from '../../types/index.js';
1
+ import type { ConstantAccessor, PlotState, PlotScaleFunction, RawValue, ScaleType } from '../../types/index.js';
2
+ import type { BaseAxisXOptions } from '../../types/axes.js';
2
3
  type BaseAxisXProps = {
3
- scaleFn: (d: RawValue) => number;
4
+ scaleFn: PlotScaleFunction;
4
5
  scaleType: ScaleType;
5
6
  ticks: RawValue[];
6
7
  tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
7
- anchor: 'top' | 'bottom';
8
- tickSize: number;
9
- tickPadding: number;
10
- tickFontSize: ConstantAccessor<number>;
11
- tickClass: ConstantAccessor<string>;
8
+ anchor?: 'top' | 'bottom';
9
+ tickSize?: number;
10
+ tickPadding?: number;
11
+ tickFontSize?: ConstantAccessor<number>;
12
+ tickClass?: ConstantAccessor<string>;
12
13
  marginTop: number;
13
14
  height: number;
14
- title: string;
15
- options: {
16
- dx: ConstantAccessor<number>;
17
- dy: ConstantAccessor<number>;
18
- filter: ChannelAccessor;
19
- wordwrap: boolean;
20
- textAnchor: ConstantAccessor<'start' | 'middle' | 'end'> | 'auto';
21
- removeDuplicateTicks: boolean;
22
- };
23
- text: boolean;
15
+ title: string | null;
16
+ options: BaseAxisXOptions;
17
+ text?: boolean | null;
24
18
  plot: PlotState;
25
19
  class: string | undefined;
26
20
  };