svelteplot 0.3.4 → 0.3.5-pr-121.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/Mark.svelte +25 -27
  2. package/dist/Mark.svelte.d.ts +87 -17
  3. package/dist/Plot.svelte +1 -2
  4. package/dist/Plot.svelte.d.ts +1 -1
  5. package/dist/constants.d.ts +1 -1
  6. package/dist/core/Facet.svelte +1 -1
  7. package/dist/core/Facet.svelte.d.ts +1 -1
  8. package/dist/core/FacetAxes.svelte +3 -1
  9. package/dist/core/FacetGrid.svelte +1 -1
  10. package/dist/core/FacetGrid.svelte.d.ts +1 -1
  11. package/dist/core/Plot.svelte +1 -1
  12. package/dist/core/Plot.svelte.d.ts +1 -1
  13. package/dist/helpers/autoScales.d.ts +1 -1
  14. package/dist/helpers/autoTicks.d.ts +1 -1
  15. package/dist/helpers/autoTicks.js +1 -1
  16. package/dist/helpers/callWithProps.d.ts +1 -1
  17. package/dist/helpers/colors.d.ts +2 -2
  18. package/dist/helpers/curves.d.ts +1 -1
  19. package/dist/helpers/facets.d.ts +1 -1
  20. package/dist/helpers/getBaseStyles.d.ts +2 -2
  21. package/dist/helpers/group.d.ts +1 -1
  22. package/dist/helpers/index.d.ts +3 -3
  23. package/dist/helpers/isDataRecord.d.ts +1 -1
  24. package/dist/helpers/isRawValue.d.ts +1 -1
  25. package/dist/helpers/projection.d.ts +1 -1
  26. package/dist/helpers/reduce.d.ts +1 -1
  27. package/dist/helpers/regressionLoess.d.ts +1 -1
  28. package/dist/helpers/resolve.d.ts +3 -3
  29. package/dist/helpers/scales.d.ts +2 -2
  30. package/dist/helpers/typeChecks.d.ts +5 -5
  31. package/dist/marks/Area.svelte +14 -17
  32. package/dist/marks/Area.svelte.d.ts +91 -19
  33. package/dist/marks/AreaX.svelte +15 -12
  34. package/dist/marks/AreaX.svelte.d.ts +94 -3
  35. package/dist/marks/AreaY.svelte +15 -15
  36. package/dist/marks/AreaY.svelte.d.ts +94 -3
  37. package/dist/marks/Arrow.svelte +16 -19
  38. package/dist/marks/Arrow.svelte.d.ts +110 -38
  39. package/dist/marks/AxisX.svelte +60 -56
  40. package/dist/marks/AxisX.svelte.d.ts +98 -25
  41. package/dist/marks/AxisY.svelte +73 -54
  42. package/dist/marks/AxisY.svelte.d.ts +100 -27
  43. package/dist/marks/BarX.svelte +28 -30
  44. package/dist/marks/BarX.svelte.d.ts +89 -17
  45. package/dist/marks/BarY.svelte +27 -27
  46. package/dist/marks/BarY.svelte.d.ts +88 -16
  47. package/dist/marks/BollingerX.svelte +21 -16
  48. package/dist/marks/BollingerX.svelte.d.ts +17 -16
  49. package/dist/marks/BollingerY.svelte +21 -16
  50. package/dist/marks/BollingerY.svelte.d.ts +17 -16
  51. package/dist/marks/BoxX.svelte +5 -7
  52. package/dist/marks/BoxX.svelte.d.ts +5 -3
  53. package/dist/marks/BoxY.svelte +13 -16
  54. package/dist/marks/BoxY.svelte.d.ts +41 -28
  55. package/dist/marks/Brush.svelte +27 -30
  56. package/dist/marks/Brush.svelte.d.ts +20 -15
  57. package/dist/marks/BrushX.svelte +9 -7
  58. package/dist/marks/BrushX.svelte.d.ts +5 -2
  59. package/dist/marks/BrushY.svelte +9 -7
  60. package/dist/marks/BrushY.svelte.d.ts +5 -2
  61. package/dist/marks/Cell.svelte +17 -18
  62. package/dist/marks/Cell.svelte.d.ts +80 -8
  63. package/dist/marks/CellX.svelte +12 -8
  64. package/dist/marks/CellX.svelte.d.ts +5 -2
  65. package/dist/marks/CellY.svelte +12 -8
  66. package/dist/marks/CellY.svelte.d.ts +5 -2
  67. package/dist/marks/ColorLegend.svelte +5 -8
  68. package/dist/marks/ColorLegend.svelte.d.ts +2 -2
  69. package/dist/marks/CustomMark.svelte +23 -16
  70. package/dist/marks/CustomMark.svelte.d.ts +17 -14
  71. package/dist/marks/CustomMarkHTML.svelte +20 -18
  72. package/dist/marks/CustomMarkHTML.svelte.d.ts +29 -15
  73. package/dist/marks/DifferenceY.svelte +54 -18
  74. package/dist/marks/DifferenceY.svelte.d.ts +59 -28
  75. package/dist/marks/Dot.svelte +13 -14
  76. package/dist/marks/Dot.svelte.d.ts +84 -12
  77. package/dist/marks/DotX.svelte +9 -9
  78. package/dist/marks/DotX.svelte.d.ts +86 -4
  79. package/dist/marks/DotY.svelte +10 -9
  80. package/dist/marks/DotY.svelte.d.ts +87 -5
  81. package/dist/marks/Frame.svelte +20 -27
  82. package/dist/marks/Frame.svelte.d.ts +24 -10
  83. package/dist/marks/Geo.svelte +22 -15
  84. package/dist/marks/Geo.svelte.d.ts +97 -13
  85. package/dist/marks/Graticule.svelte +16 -19
  86. package/dist/marks/Graticule.svelte.d.ts +3 -3
  87. package/dist/marks/GridX.svelte +5 -8
  88. package/dist/marks/GridX.svelte.d.ts +79 -7
  89. package/dist/marks/GridY.svelte +5 -8
  90. package/dist/marks/GridY.svelte.d.ts +79 -7
  91. package/dist/marks/HTMLTooltip.svelte +9 -14
  92. package/dist/marks/HTMLTooltip.svelte.d.ts +25 -12
  93. package/dist/marks/Line.svelte +24 -29
  94. package/dist/marks/Line.svelte.d.ts +97 -25
  95. package/dist/marks/LineX.svelte +9 -4
  96. package/dist/marks/LineX.svelte.d.ts +99 -3
  97. package/dist/marks/LineY.svelte +11 -5
  98. package/dist/marks/LineY.svelte.d.ts +100 -4
  99. package/dist/marks/Link.svelte +35 -19
  100. package/dist/marks/Link.svelte.d.ts +107 -18
  101. package/dist/marks/Pointer.svelte +13 -18
  102. package/dist/marks/Pointer.svelte.d.ts +34 -21
  103. package/dist/marks/Rect.svelte +19 -19
  104. package/dist/marks/Rect.svelte.d.ts +86 -13
  105. package/dist/marks/RectX.svelte +10 -9
  106. package/dist/marks/RectX.svelte.d.ts +22 -6
  107. package/dist/marks/RectY.svelte +9 -10
  108. package/dist/marks/RectY.svelte.d.ts +22 -6
  109. package/dist/marks/RegressionX.svelte +1 -1
  110. package/dist/marks/RegressionX.svelte.d.ts +1 -1
  111. package/dist/marks/RegressionY.svelte +1 -1
  112. package/dist/marks/RegressionY.svelte.d.ts +1 -1
  113. package/dist/marks/RuleX.svelte +14 -16
  114. package/dist/marks/RuleX.svelte.d.ts +84 -12
  115. package/dist/marks/RuleY.svelte +12 -15
  116. package/dist/marks/RuleY.svelte.d.ts +84 -12
  117. package/dist/marks/Sphere.svelte +6 -7
  118. package/dist/marks/Sphere.svelte.d.ts +3 -2
  119. package/dist/marks/Spike.svelte +17 -9
  120. package/dist/marks/Spike.svelte.d.ts +94 -4
  121. package/dist/marks/SymbolLegend.svelte +1 -1
  122. package/dist/marks/Text.svelte +25 -23
  123. package/dist/marks/Text.svelte.d.ts +101 -25
  124. package/dist/marks/TickX.svelte +12 -13
  125. package/dist/marks/TickX.svelte.d.ts +92 -20
  126. package/dist/marks/TickY.svelte +11 -14
  127. package/dist/marks/TickY.svelte.d.ts +92 -20
  128. package/dist/marks/Vector.svelte +19 -23
  129. package/dist/marks/Vector.svelte.d.ts +93 -21
  130. package/dist/marks/helpers/AreaCanvas.svelte +1 -1
  131. package/dist/marks/helpers/AreaCanvas.svelte.d.ts +1 -1
  132. package/dist/marks/helpers/BaseAxisX.svelte +5 -3
  133. package/dist/marks/helpers/BaseAxisX.svelte.d.ts +1 -1
  134. package/dist/marks/helpers/BaseAxisY.svelte +10 -8
  135. package/dist/marks/helpers/BaseAxisY.svelte.d.ts +3 -1
  136. package/dist/marks/helpers/CanvasLayer.svelte +1 -1
  137. package/dist/marks/helpers/DotCanvas.svelte +1 -1
  138. package/dist/marks/helpers/DotCanvas.svelte.d.ts +1 -1
  139. package/dist/marks/helpers/GeoCanvas.svelte +1 -1
  140. package/dist/marks/helpers/GeoCanvas.svelte.d.ts +1 -1
  141. package/dist/marks/helpers/LineCanvas.svelte +1 -1
  142. package/dist/marks/helpers/LineCanvas.svelte.d.ts +1 -1
  143. package/dist/marks/helpers/LinearGradientX.svelte +1 -1
  144. package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
  145. package/dist/marks/helpers/LinearGradientY.svelte +1 -1
  146. package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
  147. package/dist/marks/helpers/MarkerPath.svelte +1 -1
  148. package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
  149. package/dist/marks/helpers/MultilineText.svelte +1 -1
  150. package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
  151. package/dist/marks/helpers/RectPath.svelte +29 -26
  152. package/dist/marks/helpers/RectPath.svelte.d.ts +39 -26
  153. package/dist/marks/helpers/Regression.svelte +7 -2
  154. package/dist/marks/helpers/Regression.svelte.d.ts +2 -5
  155. package/dist/marks/helpers/events.d.ts +1 -1
  156. package/dist/transforms/bin.d.ts +2 -2
  157. package/dist/transforms/bollinger.d.ts +2 -67
  158. package/dist/transforms/centroid.d.ts +8 -66
  159. package/dist/transforms/centroid.js +10 -7
  160. package/dist/transforms/filter.d.ts +1 -1
  161. package/dist/transforms/group.d.ts +5 -13
  162. package/dist/transforms/interval.d.ts +3 -123
  163. package/dist/transforms/jitter.d.ts +1 -1
  164. package/dist/transforms/map.d.ts +4 -184
  165. package/dist/transforms/normalize.d.ts +3 -123
  166. package/dist/transforms/recordize.d.ts +1 -1
  167. package/dist/transforms/rename.d.ts +2 -2
  168. package/dist/transforms/select.d.ts +8 -428
  169. package/dist/transforms/shift.d.ts +1 -1
  170. package/dist/transforms/sort.d.ts +4 -243
  171. package/dist/transforms/stack.d.ts +1 -1
  172. package/dist/transforms/window.d.ts +3 -131
  173. package/dist/types/channel.d.ts +11 -0
  174. package/dist/types/colorScheme.d.ts +1 -0
  175. package/dist/types/colorScheme.js +1 -0
  176. package/dist/types/data.d.ts +13 -0
  177. package/dist/types/data.js +1 -0
  178. package/dist/types/facet.d.ts +50 -0
  179. package/dist/types/facet.js +1 -0
  180. package/dist/types/index.d.ts +58 -0
  181. package/dist/types/index.js +7 -0
  182. package/dist/types/mark.d.ts +123 -0
  183. package/dist/types/mark.js +1 -0
  184. package/dist/types/plot.d.ts +459 -0
  185. package/dist/types/plot.js +1 -0
  186. package/dist/types/scale.d.ts +143 -0
  187. package/dist/types/scale.js +1 -0
  188. package/package.json +125 -120
  189. package/dist/types.d.ts +0 -841
  190. /package/dist/{types.js → types/channel.js} +0 -0
@@ -1,56 +1,55 @@
1
1
  <!-- @component
2
2
  Renders a horizontal axis with labels and tick marks
3
3
  -->
4
- <script module lang="ts">
5
- import type { XOR } from 'ts-essentials';
6
- export type AxisXMarkProps = Omit<
4
+ <script lang="ts" generics="Datum extends RawValue">
5
+ import { getContext } from 'svelte';
6
+ import Mark from '../Mark.svelte';
7
+ import BaseAxisX from './helpers/BaseAxisX.svelte';
8
+ import type {
9
+ PlotContext,
7
10
  BaseMarkProps,
8
- 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'
9
- > & {
10
- data?: RawValue[];
11
+ RawValue,
12
+ ConstantAccessor,
13
+ FacetContext,
14
+ PlotDefaults,
15
+ ChannelName
16
+ } from '../types/index.js';
17
+ import autoTimeFormat from '../helpers/autoTimeFormat.js';
18
+ import { derived } from 'svelte/store';
19
+ import { autoTicks } from '../helpers/autoTicks.js';
20
+ import { resolveScaledStyles } from '../helpers/resolve.js';
21
+
22
+ interface AxisXMarkProps
23
+ extends Omit<
24
+ BaseMarkProps<Datum>,
25
+ 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'
26
+ > {
27
+ data?: Datum[];
11
28
  automatic?: boolean;
12
- title?: string;
29
+ title?: string | false | null;
13
30
  anchor?: 'top' | 'bottom';
14
31
  interval?: string | number;
15
32
  facetAnchor?: 'auto' | 'top-empty' | 'bottom-empty' | 'top' | 'bottom';
16
33
  labelAnchor?: 'auto' | 'left' | 'center' | 'right';
17
34
  tickSize?: number;
18
- tickFontSize?: ConstantAccessor<number>;
35
+ tickFontSize?: ConstantAccessor<number, Datum>;
36
+ titleFontSize?: number;
19
37
  tickPadding?: number;
20
38
  tickFormat?:
21
39
  | 'auto'
22
40
  | Intl.DateTimeFormatOptions
23
41
  | Intl.NumberFormatOptions
24
42
  | ((d: RawValue) => string);
25
- tickClass?: ConstantAccessor<string>;
43
+ tickClass?: ConstantAccessor<string, Datum>;
26
44
  /** ticks is a shorthand for defining data, tickCount or interval */
27
- ticks?: number | string | RawValue[];
45
+ ticks?: number | string | Datum[];
28
46
  /** set to false or null to disable tick labels */
29
47
  text: boolean | null;
30
48
  /** approximate number of ticks to be generated */
31
49
  tickCount?: number;
32
50
  /** approximate number of pixels between generated ticks */
33
51
  tickSpacing?: number;
34
- };
35
- </script>
36
-
37
- <script lang="ts">
38
- import { getContext } from 'svelte';
39
- import Mark from '../Mark.svelte';
40
- import BaseAxisX from './helpers/BaseAxisX.svelte';
41
- import type {
42
- PlotContext,
43
- BaseMarkProps,
44
- RawValue,
45
- ConstantAccessor,
46
- FacetContext,
47
- PlotDefaults,
48
- ChannelName
49
- } from '../types.js';
50
- import autoTimeFormat from '../helpers/autoTimeFormat.js';
51
- import { derived } from 'svelte/store';
52
- import { autoTicks } from '../helpers/autoTicks.js';
53
- import { resolveScaledStyles } from '../helpers/resolve.js';
52
+ }
54
53
 
55
54
  let markProps: AxisXMarkProps = $props();
56
55
 
@@ -58,6 +57,8 @@
58
57
  tickSize: 6,
59
58
  tickPadding: 3,
60
59
  tickFontSize: 11,
60
+ titleFontSize: 11,
61
+ opacity: 0.8,
61
62
  anchor: 'bottom',
62
63
  ...getContext<PlotDefaults>('svelteplot/_defaults').axis,
63
64
  ...getContext<PlotDefaults>('svelteplot/_defaults').axisX
@@ -142,18 +143,19 @@
142
143
  const isQuantitative = $derived(scaleType !== 'point' && scaleType !== 'band');
143
144
 
144
145
  const useTitle = $derived(
145
- title ||
146
- (optionsLabel === null
147
- ? null
148
- : optionsLabel !== undefined
149
- ? optionsLabel
150
- : plot.scales.x.autoTitle
151
- ? isQuantitative
152
- ? plot.options.x?.reverse
153
- ? `← ${plot.scales.x.autoTitle}${plot.options.x.percent ? ' (%)' : ''}`
154
- : `${plot.scales.x.autoTitle}${plot.options.x.percent ? ' (%)' : ''} →`
155
- : plot.scales.x.autoTitle
156
- : '')
146
+ title !== undefined
147
+ ? title || ''
148
+ : optionsLabel === null
149
+ ? null
150
+ : optionsLabel !== undefined
151
+ ? optionsLabel
152
+ : plot.scales.x.autoTitle
153
+ ? isQuantitative
154
+ ? plot.options.x?.reverse
155
+ ? `← ${plot.scales.x.autoTitle}${plot.options.x.percent ? ' (%)' : ''}`
156
+ : `${plot.scales.x.autoTitle}${plot.options.x.percent ? ' (%)' : ''} →`
157
+ : plot.scales.x.autoTitle
158
+ : ''
157
159
  );
158
160
 
159
161
  const useLabelAnchor = $derived(labelAnchor || plot.options?.x?.labelAnchor || 'auto');
@@ -190,8 +192,10 @@
190
192
  style={resolveScaledStyles(
191
193
  null,
192
194
  {
195
+ opacity: 0.8,
193
196
  ...options,
194
197
  stroke: null,
198
+ fontSize: options.titleFontSize || 11,
195
199
  textAnchor:
196
200
  titleAlign === 'right'
197
201
  ? 'end'
@@ -211,28 +215,28 @@
211
215
  {/if}
212
216
  {#if showAxis}
213
217
  <BaseAxisX
218
+ {anchor}
219
+ {className}
220
+ {labelAnchor}
221
+ {options}
222
+ {plot}
223
+ {text}
224
+ {tickClass}
225
+ {tickFontSize}
226
+ {tickPadding}
227
+ {ticks}
228
+ {tickSize}
229
+ height={plot.facetHeight}
230
+ marginTop={plot.options.marginTop}
214
231
  scaleFn={plot.scales.x.fn}
215
232
  scaleType={plot.scales.x.type}
216
233
  tickFormat={useTickFormat}
217
- {ticks}
218
- marginTop={plot.options.marginTop}
219
- height={plot.facetHeight}
220
- {anchor}
221
- {tickSize}
222
- {tickPadding}
223
- {tickFontSize}
224
- {tickClass}
225
- {text}
226
- {options}
227
- title={useTitle}
228
- {plot} />
234
+ title={useTitle} />
229
235
  {/if}
230
236
  </Mark>
231
237
 
232
238
  <style>
233
239
  text {
234
- font-size: 11px;
235
- opacity: 0.8;
236
240
  fill: currentColor;
237
241
  }
238
242
  </style>
@@ -1,27 +1,100 @@
1
- export type AxisXMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'> & {
2
- data?: RawValue[];
3
- automatic?: boolean;
4
- title?: string;
5
- anchor?: 'top' | 'bottom';
6
- interval?: string | number;
7
- facetAnchor?: 'auto' | 'top-empty' | 'bottom-empty' | 'top' | 'bottom';
8
- labelAnchor?: 'auto' | 'left' | 'center' | 'right';
9
- tickSize?: number;
10
- tickFontSize?: ConstantAccessor<number>;
11
- tickPadding?: number;
12
- tickFormat?: 'auto' | Intl.DateTimeFormatOptions | Intl.NumberFormatOptions | ((d: RawValue) => string);
13
- tickClass?: ConstantAccessor<string>;
14
- /** ticks is a shorthand for defining data, tickCount or interval */
15
- ticks?: number | string | RawValue[];
16
- /** set to false or null to disable tick labels */
17
- text: boolean | null;
18
- /** approximate number of ticks to be generated */
19
- tickCount?: number;
20
- /** approximate number of pixels between generated ticks */
21
- tickSpacing?: number;
22
- };
23
- import type { BaseMarkProps, RawValue, ConstantAccessor } from '../types.js';
1
+ import type { RawValue, ConstantAccessor } from '../types/index.js';
2
+ declare class __sveltets_Render<Datum extends RawValue> {
3
+ props(): Omit<Partial<{
4
+ filter?: ConstantAccessor<boolean, Datum>;
5
+ facet?: "auto" | "include" | "exclude";
6
+ fx: import("../types/channel").ChannelAccessor<Datum>;
7
+ fy: import("../types/channel").ChannelAccessor<Datum>;
8
+ dx: ConstantAccessor<number, Datum>;
9
+ dy: ConstantAccessor<number, Datum>;
10
+ fill: import("../types/channel").ChannelAccessor<Datum>;
11
+ fillOpacity: ConstantAccessor<number, Datum>;
12
+ sort: {
13
+ channel: string;
14
+ order?: "ascending" | "descending";
15
+ } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
16
+ stroke: import("../types/channel").ChannelAccessor<Datum>;
17
+ strokeWidth: ConstantAccessor<number, Datum>;
18
+ strokeOpacity: ConstantAccessor<number, Datum>;
19
+ strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
20
+ strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
21
+ strokeMiterlimit: ConstantAccessor<number, Datum>;
22
+ opacity: import("../types/channel").ChannelAccessor<Datum>;
23
+ strokeDasharray: ConstantAccessor<string, Datum>;
24
+ strokeDashoffset: ConstantAccessor<number, Datum>;
25
+ mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
26
+ clipPath: string;
27
+ imageFilter: ConstantAccessor<string, Datum>;
28
+ shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
29
+ paintOrder: ConstantAccessor<string, Datum>;
30
+ onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
31
+ ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
32
+ onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
+ onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
+ onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
+ onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
+ onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
+ onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
+ onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
+ onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
+ onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
+ onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
+ onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
+ onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
+ onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
+ onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
+ onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
+ ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
+ ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
+ ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
+ ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
+ ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
+ ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
+ ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
+ ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
+ ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
+ ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
+ ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
+ oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
+ onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
+ class: string | null;
61
+ cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
62
+ }>, "fill" | "fillOpacity" | "href" | "target" | "title" | "paintOrder"> & {
63
+ data?: Datum[] | undefined;
64
+ automatic?: boolean;
65
+ title?: string | false | null;
66
+ anchor?: "top" | "bottom";
67
+ interval?: string | number;
68
+ facetAnchor?: "auto" | "top-empty" | "bottom-empty" | "top" | "bottom";
69
+ labelAnchor?: "auto" | "left" | "center" | "right";
70
+ tickSize?: number;
71
+ tickFontSize?: ConstantAccessor<number, Datum>;
72
+ titleFontSize?: number;
73
+ tickPadding?: number;
74
+ tickFormat?: "auto" | Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((d: RawValue) => string) | undefined;
75
+ tickClass?: ConstantAccessor<string, Datum>;
76
+ /** ticks is a shorthand for defining data, tickCount or interval */
77
+ ticks?: string | number | Datum[] | undefined;
78
+ /** set to false or null to disable tick labels */
79
+ text: boolean | null;
80
+ /** approximate number of ticks to be generated */
81
+ tickCount?: number;
82
+ /** approximate number of pixels between generated ticks */
83
+ tickSpacing?: number;
84
+ };
85
+ events(): {};
86
+ slots(): {};
87
+ bindings(): "";
88
+ exports(): {};
89
+ }
90
+ interface $$IsomorphicComponent {
91
+ new <Datum extends RawValue>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
92
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
93
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
94
+ <Datum extends RawValue>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
95
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
96
+ }
24
97
  /** Renders a horizontal axis with labels and tick marks */
25
- declare const AxisX: import("svelte").Component<AxisXMarkProps, {}, "">;
26
- type AxisX = ReturnType<typeof AxisX>;
98
+ declare const AxisX: $$IsomorphicComponent;
99
+ type AxisX<Datum extends RawValue> = InstanceType<typeof AxisX<Datum>>;
27
100
  export default AxisX;
@@ -1,56 +1,56 @@
1
1
  <!-- @component
2
2
  Renders a vertical axis with labels and tick marks
3
3
  -->
4
- <script module lang="ts">
5
- import type { XOR } from 'ts-essentials';
6
- export type AxisYMarkProps = Omit<
4
+ <script lang="ts" generics="Datum extends RawValue">
5
+ import { getContext } from 'svelte';
6
+ import BaseAxisY from './helpers/BaseAxisY.svelte';
7
+ import Mark from '../Mark.svelte';
8
+ import type {
9
+ PlotContext,
7
10
  BaseMarkProps,
8
- 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'
9
- > & {
10
- data?: RawValue[];
11
+ RawValue,
12
+ FacetContext,
13
+ PlotDefaults,
14
+ ChannelName,
15
+ ConstantAccessor
16
+ } from '../types/index.js';
17
+ import autoTimeFormat from '../helpers/autoTimeFormat.js';
18
+ import { autoTicks } from '../helpers/autoTicks.js';
19
+ import { resolveScaledStyles } from '../helpers/resolve.js';
20
+
21
+ interface AxisYMarkProps
22
+ extends Omit<
23
+ BaseMarkProps<Datum>,
24
+ 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'
25
+ > {
26
+ data?: Datum[];
11
27
  automatic?: boolean;
12
- title?: string;
28
+ title?: string | false | null;
13
29
  anchor?: 'left' | 'right';
14
30
  facetAnchor?: 'auto' | 'left' | 'right' | 'left-empty' | 'right-empty';
15
31
  lineAnchor?: 'top' | 'center' | 'bottom';
16
32
  interval?: string | number;
17
33
  labelAnchor?: 'auto' | 'left' | 'center' | 'right';
34
+ textAnchor?: 'auto' | 'start' | 'middle' | 'end';
18
35
  tickSize?: number;
19
- tickFontSize?: ConstantAccessor<number>;
36
+ tickFontSize?: ConstantAccessor<number, Datum>;
37
+ titleFontSize?: number;
20
38
  tickPadding?: number;
21
39
  tickFormat?:
22
40
  | 'auto'
23
41
  | Intl.DateTimeFormatOptions
24
42
  | Intl.NumberFormatOptions
25
43
  | ((d: RawValue) => string);
26
- tickClass?: ConstantAccessor<string>;
44
+ tickClass?: ConstantAccessor<string, Datum>;
27
45
  /** ticks is a shorthand for defining data, tickCount or interval */
28
- ticks?: number | string | RawValue[];
46
+ ticks?: number | string | Datum[];
29
47
  /** set to false or null to disable tick labels */
30
- text: boolean | null;
48
+ text?: boolean | null;
31
49
  /** approximate number of ticks to be generated */
32
50
  tickCount?: number;
33
51
  /** approximate number of pixels between generated ticks */
34
52
  tickSpacing?: number;
35
- };
36
- </script>
37
-
38
- <script lang="ts">
39
- import { getContext } from 'svelte';
40
- import BaseAxisY from './helpers/BaseAxisY.svelte';
41
- import Mark from '../Mark.svelte';
42
- import type {
43
- PlotContext,
44
- BaseMarkProps,
45
- RawValue,
46
- FacetContext,
47
- PlotDefaults,
48
- ChannelName
49
- } from '../types.js';
50
- import autoTimeFormat from '../helpers/autoTimeFormat.js';
51
- import type { ConstantAccessor } from '../types.js';
52
- import { autoTicks } from '../helpers/autoTicks.js';
53
- import { resolveScaledStyles } from '../helpers/resolve.js';
53
+ }
54
54
 
55
55
  let markProps: AxisYMarkProps = $props();
56
56
 
@@ -58,7 +58,9 @@
58
58
  tickSize: 6,
59
59
  tickPadding: 3,
60
60
  tickFontSize: 11,
61
+ opacity: 0.8,
61
62
  anchor: 'left',
63
+ textAnchor: 'auto',
62
64
  ...getContext<PlotDefaults>('svelteplot/_defaults').axis,
63
65
  ...getContext<PlotDefaults>('svelteplot/_defaults').axisY
64
66
  };
@@ -68,10 +70,12 @@
68
70
  data = Array.isArray(magicTicks) ? magicTicks : [],
69
71
  automatic = false,
70
72
  title,
71
- anchor,
73
+ anchor = 'left',
74
+ class: className,
72
75
  facetAnchor = 'auto',
73
76
  interval = typeof magicTicks === 'string' ? magicTicks : undefined,
74
77
  lineAnchor = 'center',
78
+ textAnchor,
75
79
  tickSize,
76
80
  tickFontSize,
77
81
  tickPadding,
@@ -139,14 +143,15 @@
139
143
  const optionsLabel = $derived(plot.options.y.label);
140
144
 
141
145
  const useTitle = $derived(
142
- title ||
143
- (optionsLabel === null
144
- ? null
145
- : optionsLabel !== undefined
146
- ? optionsLabel
147
- : plot.scales.y.autoTitle
148
- ? `↑ ${plot.scales.y.autoTitle}${plot.options.y.percent ? ' (%)' : ''}`
149
- : '')
146
+ title !== undefined
147
+ ? title || ''
148
+ : optionsLabel === null
149
+ ? null
150
+ : optionsLabel !== undefined
151
+ ? optionsLabel
152
+ : plot.scales.y.autoTitle
153
+ ? `↑ ${plot.scales.y.autoTitle}${plot.options.y.percent ? ' (%)' : ''}`
154
+ : ''
150
155
  );
151
156
 
152
157
  const { getFacetState } = getContext<FacetContext>('svelteplot/facet');
@@ -177,7 +182,14 @@
177
182
  <text
178
183
  style={resolveScaledStyles(
179
184
  null,
180
- { ...options, stroke: null, textAnchor: anchor === 'left' ? 'start' : 'end' },
185
+ {
186
+ opacity: 0.8,
187
+ ...options,
188
+ fontSize: options.titleFontSize ?? 11,
189
+ fill: 'currentColor',
190
+ stroke: null,
191
+ textAnchor: anchor === 'left' ? 'start' : 'end'
192
+ },
181
193
  {},
182
194
  plot,
183
195
  'fill'
@@ -189,29 +201,36 @@
189
201
  {/if}
190
202
  {#if showAxis}
191
203
  <BaseAxisY
192
- scaleFn={plot.scales.y.fn}
193
- scaleType={plot.scales.y.type}
194
- tickFormat={useTickFormat}
195
- {ticks}
196
- marginLeft={plot.options.marginLeft}
197
- width={plot.facetWidth}
198
204
  {anchor}
205
+ {className}
199
206
  {lineAnchor}
200
- {tickSize}
201
- {tickPadding}
202
- {tickFontSize}
203
- {tickClass}
204
- {options}
207
+ options={{
208
+ ...options,
209
+ textAnchor:
210
+ textAnchor == null || textAnchor === 'auto'
211
+ ? anchor === 'left'
212
+ ? 'end'
213
+ : 'start'
214
+ : textAnchor
215
+ }}
216
+ {plot}
205
217
  {text}
218
+ {tickClass}
219
+ {tickFontSize}
220
+ {tickPadding}
221
+ {ticks}
222
+ {tickSize}
223
+ marginLeft={plot.options.marginLeft}
224
+ scaleFn={plot.scales.y.fn}
225
+ scaleType={plot.scales.y.type}
226
+ tickFormat={useTickFormat}
206
227
  title={useTitle}
207
- {plot} />
228
+ width={plot.facetWidth} />
208
229
  {/if}
209
230
  </Mark>
210
231
 
211
232
  <style>
212
233
  text {
213
- font-size: 11px;
214
- opacity: 0.8;
215
234
  fill: currentColor;
216
235
  }
217
236
  </style>
@@ -1,29 +1,102 @@
1
- export type AxisYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target'> & {
2
- data?: RawValue[];
3
- automatic?: boolean;
4
- title?: string;
5
- anchor?: 'left' | 'right';
6
- facetAnchor?: 'auto' | 'left' | 'right' | 'left-empty' | 'right-empty';
7
- lineAnchor?: 'top' | 'center' | 'bottom';
8
- interval?: string | number;
9
- labelAnchor?: 'auto' | 'left' | 'center' | 'right';
10
- tickSize?: number;
11
- tickFontSize?: ConstantAccessor<number>;
12
- tickPadding?: number;
13
- tickFormat?: 'auto' | Intl.DateTimeFormatOptions | Intl.NumberFormatOptions | ((d: RawValue) => string);
14
- tickClass?: ConstantAccessor<string>;
15
- /** ticks is a shorthand for defining data, tickCount or interval */
16
- ticks?: number | string | RawValue[];
17
- /** set to false or null to disable tick labels */
18
- text: boolean | null;
19
- /** approximate number of ticks to be generated */
20
- tickCount?: number;
21
- /** approximate number of pixels between generated ticks */
22
- tickSpacing?: number;
23
- };
24
- import type { BaseMarkProps, RawValue } from '../types.js';
25
- import type { ConstantAccessor } from '../types.js';
1
+ import type { RawValue, ConstantAccessor } from '../types/index.js';
2
+ declare class __sveltets_Render<Datum extends RawValue> {
3
+ props(): Omit<Partial<{
4
+ filter?: ConstantAccessor<boolean, Datum>;
5
+ facet?: "auto" | "include" | "exclude";
6
+ fx: import("../types/channel").ChannelAccessor<Datum>;
7
+ fy: import("../types/channel").ChannelAccessor<Datum>;
8
+ dx: ConstantAccessor<number, Datum>;
9
+ dy: ConstantAccessor<number, Datum>;
10
+ fill: import("../types/channel").ChannelAccessor<Datum>;
11
+ fillOpacity: ConstantAccessor<number, Datum>;
12
+ sort: {
13
+ channel: string;
14
+ order?: "ascending" | "descending";
15
+ } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
16
+ stroke: import("../types/channel").ChannelAccessor<Datum>;
17
+ strokeWidth: ConstantAccessor<number, Datum>;
18
+ strokeOpacity: ConstantAccessor<number, Datum>;
19
+ strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
20
+ strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
21
+ strokeMiterlimit: ConstantAccessor<number, Datum>;
22
+ opacity: import("../types/channel").ChannelAccessor<Datum>;
23
+ strokeDasharray: ConstantAccessor<string, Datum>;
24
+ strokeDashoffset: ConstantAccessor<number, Datum>;
25
+ mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
26
+ clipPath: string;
27
+ imageFilter: ConstantAccessor<string, Datum>;
28
+ shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
29
+ paintOrder: ConstantAccessor<string, Datum>;
30
+ onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
31
+ ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
32
+ onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
+ onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
+ onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
+ onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
+ onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
+ onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
+ onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
+ onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
+ onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
+ onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
+ onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
+ onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
+ onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
+ onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
+ onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
+ ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
+ ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
+ ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
+ ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
+ ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
+ ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
+ ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
+ ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
+ ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
+ ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
+ ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
+ oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
+ onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
+ class: string | null;
61
+ cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
62
+ }>, "fill" | "fillOpacity" | "href" | "target" | "title" | "paintOrder"> & {
63
+ data?: Datum[] | undefined;
64
+ automatic?: boolean;
65
+ title?: string | false | null;
66
+ anchor?: "left" | "right";
67
+ facetAnchor?: "auto" | "left" | "right" | "left-empty" | "right-empty";
68
+ lineAnchor?: "top" | "center" | "bottom";
69
+ interval?: string | number;
70
+ labelAnchor?: "auto" | "left" | "center" | "right";
71
+ textAnchor?: "auto" | "start" | "middle" | "end";
72
+ tickSize?: number;
73
+ tickFontSize?: ConstantAccessor<number, Datum>;
74
+ titleFontSize?: number;
75
+ tickPadding?: number;
76
+ tickFormat?: "auto" | Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((d: RawValue) => string) | undefined;
77
+ tickClass?: ConstantAccessor<string, Datum>;
78
+ /** ticks is a shorthand for defining data, tickCount or interval */
79
+ ticks?: string | number | Datum[] | undefined;
80
+ /** set to false or null to disable tick labels */
81
+ text?: boolean | null;
82
+ /** approximate number of ticks to be generated */
83
+ tickCount?: number;
84
+ /** approximate number of pixels between generated ticks */
85
+ tickSpacing?: number;
86
+ };
87
+ events(): {};
88
+ slots(): {};
89
+ bindings(): "";
90
+ exports(): {};
91
+ }
92
+ interface $$IsomorphicComponent {
93
+ new <Datum extends RawValue>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
94
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
95
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
96
+ <Datum extends RawValue>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
97
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
98
+ }
26
99
  /** Renders a vertical axis with labels and tick marks */
27
- declare const AxisY: import("svelte").Component<AxisYMarkProps, {}, "">;
28
- type AxisY = ReturnType<typeof AxisY>;
100
+ declare const AxisY: $$IsomorphicComponent;
101
+ type AxisY<Datum extends RawValue> = InstanceType<typeof AxisY<Datum>>;
29
102
  export default AxisY;