svelteplot 0.3.3 → 0.3.5-pr-121.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 (191) 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 +4 -2
  21. package/dist/helpers/getBaseStyles.js +8 -0
  22. package/dist/helpers/group.d.ts +1 -1
  23. package/dist/helpers/index.d.ts +3 -3
  24. package/dist/helpers/isDataRecord.d.ts +1 -1
  25. package/dist/helpers/isRawValue.d.ts +1 -1
  26. package/dist/helpers/projection.d.ts +1 -1
  27. package/dist/helpers/reduce.d.ts +1 -1
  28. package/dist/helpers/regressionLoess.d.ts +1 -1
  29. package/dist/helpers/resolve.d.ts +3 -3
  30. package/dist/helpers/scales.d.ts +2 -2
  31. package/dist/helpers/typeChecks.d.ts +5 -5
  32. package/dist/marks/Area.svelte +14 -17
  33. package/dist/marks/Area.svelte.d.ts +91 -19
  34. package/dist/marks/AreaX.svelte +15 -12
  35. package/dist/marks/AreaX.svelte.d.ts +94 -3
  36. package/dist/marks/AreaY.svelte +15 -15
  37. package/dist/marks/AreaY.svelte.d.ts +94 -3
  38. package/dist/marks/Arrow.svelte +16 -19
  39. package/dist/marks/Arrow.svelte.d.ts +110 -38
  40. package/dist/marks/AxisX.svelte +60 -56
  41. package/dist/marks/AxisX.svelte.d.ts +98 -25
  42. package/dist/marks/AxisY.svelte +73 -54
  43. package/dist/marks/AxisY.svelte.d.ts +100 -27
  44. package/dist/marks/BarX.svelte +28 -30
  45. package/dist/marks/BarX.svelte.d.ts +89 -17
  46. package/dist/marks/BarY.svelte +27 -27
  47. package/dist/marks/BarY.svelte.d.ts +88 -16
  48. package/dist/marks/BollingerX.svelte +21 -16
  49. package/dist/marks/BollingerX.svelte.d.ts +17 -16
  50. package/dist/marks/BollingerY.svelte +21 -16
  51. package/dist/marks/BollingerY.svelte.d.ts +17 -16
  52. package/dist/marks/BoxX.svelte +5 -7
  53. package/dist/marks/BoxX.svelte.d.ts +5 -3
  54. package/dist/marks/BoxY.svelte +13 -16
  55. package/dist/marks/BoxY.svelte.d.ts +41 -28
  56. package/dist/marks/Brush.svelte +27 -30
  57. package/dist/marks/Brush.svelte.d.ts +20 -15
  58. package/dist/marks/BrushX.svelte +9 -7
  59. package/dist/marks/BrushX.svelte.d.ts +5 -2
  60. package/dist/marks/BrushY.svelte +9 -7
  61. package/dist/marks/BrushY.svelte.d.ts +5 -2
  62. package/dist/marks/Cell.svelte +17 -18
  63. package/dist/marks/Cell.svelte.d.ts +80 -8
  64. package/dist/marks/CellX.svelte +12 -8
  65. package/dist/marks/CellX.svelte.d.ts +5 -2
  66. package/dist/marks/CellY.svelte +12 -8
  67. package/dist/marks/CellY.svelte.d.ts +5 -2
  68. package/dist/marks/ColorLegend.svelte +5 -8
  69. package/dist/marks/ColorLegend.svelte.d.ts +2 -2
  70. package/dist/marks/CustomMark.svelte +23 -16
  71. package/dist/marks/CustomMark.svelte.d.ts +17 -14
  72. package/dist/marks/CustomMarkHTML.svelte +20 -18
  73. package/dist/marks/CustomMarkHTML.svelte.d.ts +29 -15
  74. package/dist/marks/DifferenceY.svelte +54 -18
  75. package/dist/marks/DifferenceY.svelte.d.ts +59 -28
  76. package/dist/marks/Dot.svelte +13 -14
  77. package/dist/marks/Dot.svelte.d.ts +84 -12
  78. package/dist/marks/DotX.svelte +9 -9
  79. package/dist/marks/DotX.svelte.d.ts +86 -4
  80. package/dist/marks/DotY.svelte +10 -9
  81. package/dist/marks/DotY.svelte.d.ts +87 -5
  82. package/dist/marks/Frame.svelte +20 -27
  83. package/dist/marks/Frame.svelte.d.ts +24 -10
  84. package/dist/marks/Geo.svelte +22 -15
  85. package/dist/marks/Geo.svelte.d.ts +97 -13
  86. package/dist/marks/Graticule.svelte +16 -19
  87. package/dist/marks/Graticule.svelte.d.ts +3 -3
  88. package/dist/marks/GridX.svelte +5 -8
  89. package/dist/marks/GridX.svelte.d.ts +79 -7
  90. package/dist/marks/GridY.svelte +5 -8
  91. package/dist/marks/GridY.svelte.d.ts +79 -7
  92. package/dist/marks/HTMLTooltip.svelte +9 -14
  93. package/dist/marks/HTMLTooltip.svelte.d.ts +25 -12
  94. package/dist/marks/Line.svelte +24 -29
  95. package/dist/marks/Line.svelte.d.ts +97 -25
  96. package/dist/marks/LineX.svelte +9 -4
  97. package/dist/marks/LineX.svelte.d.ts +99 -3
  98. package/dist/marks/LineY.svelte +11 -5
  99. package/dist/marks/LineY.svelte.d.ts +100 -4
  100. package/dist/marks/Link.svelte +35 -19
  101. package/dist/marks/Link.svelte.d.ts +107 -18
  102. package/dist/marks/Pointer.svelte +13 -18
  103. package/dist/marks/Pointer.svelte.d.ts +34 -21
  104. package/dist/marks/Rect.svelte +19 -19
  105. package/dist/marks/Rect.svelte.d.ts +86 -13
  106. package/dist/marks/RectX.svelte +10 -9
  107. package/dist/marks/RectX.svelte.d.ts +22 -6
  108. package/dist/marks/RectY.svelte +9 -10
  109. package/dist/marks/RectY.svelte.d.ts +22 -6
  110. package/dist/marks/RegressionX.svelte +1 -1
  111. package/dist/marks/RegressionX.svelte.d.ts +1 -1
  112. package/dist/marks/RegressionY.svelte +1 -1
  113. package/dist/marks/RegressionY.svelte.d.ts +1 -1
  114. package/dist/marks/RuleX.svelte +14 -16
  115. package/dist/marks/RuleX.svelte.d.ts +84 -12
  116. package/dist/marks/RuleY.svelte +12 -15
  117. package/dist/marks/RuleY.svelte.d.ts +84 -12
  118. package/dist/marks/Sphere.svelte +6 -7
  119. package/dist/marks/Sphere.svelte.d.ts +3 -2
  120. package/dist/marks/Spike.svelte +17 -9
  121. package/dist/marks/Spike.svelte.d.ts +94 -4
  122. package/dist/marks/SymbolLegend.svelte +1 -1
  123. package/dist/marks/Text.svelte +34 -124
  124. package/dist/marks/Text.svelte.d.ts +101 -20
  125. package/dist/marks/TickX.svelte +12 -13
  126. package/dist/marks/TickX.svelte.d.ts +92 -20
  127. package/dist/marks/TickY.svelte +11 -14
  128. package/dist/marks/TickY.svelte.d.ts +92 -20
  129. package/dist/marks/Vector.svelte +19 -23
  130. package/dist/marks/Vector.svelte.d.ts +93 -21
  131. package/dist/marks/helpers/AreaCanvas.svelte +1 -1
  132. package/dist/marks/helpers/AreaCanvas.svelte.d.ts +1 -1
  133. package/dist/marks/helpers/BaseAxisX.svelte +5 -3
  134. package/dist/marks/helpers/BaseAxisX.svelte.d.ts +1 -1
  135. package/dist/marks/helpers/BaseAxisY.svelte +10 -8
  136. package/dist/marks/helpers/BaseAxisY.svelte.d.ts +3 -1
  137. package/dist/marks/helpers/CanvasLayer.svelte +1 -1
  138. package/dist/marks/helpers/DotCanvas.svelte +1 -1
  139. package/dist/marks/helpers/DotCanvas.svelte.d.ts +1 -1
  140. package/dist/marks/helpers/GeoCanvas.svelte +1 -1
  141. package/dist/marks/helpers/GeoCanvas.svelte.d.ts +1 -1
  142. package/dist/marks/helpers/LineCanvas.svelte +1 -1
  143. package/dist/marks/helpers/LineCanvas.svelte.d.ts +1 -1
  144. package/dist/marks/helpers/LinearGradientX.svelte +1 -1
  145. package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
  146. package/dist/marks/helpers/LinearGradientY.svelte +1 -1
  147. package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
  148. package/dist/marks/helpers/MarkerPath.svelte +1 -1
  149. package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
  150. package/dist/marks/helpers/MultilineText.svelte +158 -0
  151. package/dist/marks/helpers/MultilineText.svelte.d.ts +12 -0
  152. package/dist/marks/helpers/RectPath.svelte +29 -26
  153. package/dist/marks/helpers/RectPath.svelte.d.ts +39 -26
  154. package/dist/marks/helpers/Regression.svelte +7 -2
  155. package/dist/marks/helpers/Regression.svelte.d.ts +2 -5
  156. package/dist/marks/helpers/events.d.ts +1 -1
  157. package/dist/transforms/bin.d.ts +2 -2
  158. package/dist/transforms/bollinger.d.ts +2 -67
  159. package/dist/transforms/centroid.d.ts +8 -66
  160. package/dist/transforms/centroid.js +10 -7
  161. package/dist/transforms/filter.d.ts +1 -1
  162. package/dist/transforms/group.d.ts +5 -13
  163. package/dist/transforms/interval.d.ts +3 -123
  164. package/dist/transforms/jitter.d.ts +1 -1
  165. package/dist/transforms/map.d.ts +4 -184
  166. package/dist/transforms/normalize.d.ts +3 -123
  167. package/dist/transforms/recordize.d.ts +1 -1
  168. package/dist/transforms/rename.d.ts +2 -2
  169. package/dist/transforms/select.d.ts +8 -428
  170. package/dist/transforms/shift.d.ts +1 -1
  171. package/dist/transforms/sort.d.ts +4 -243
  172. package/dist/transforms/stack.d.ts +1 -1
  173. package/dist/transforms/window.d.ts +3 -131
  174. package/dist/types/channel.d.ts +11 -0
  175. package/dist/types/channel.js +1 -0
  176. package/dist/types/colorScheme.d.ts +1 -0
  177. package/dist/types/colorScheme.js +1 -0
  178. package/dist/types/data.d.ts +13 -0
  179. package/dist/types/data.js +1 -0
  180. package/dist/types/facet.d.ts +50 -0
  181. package/dist/types/facet.js +1 -0
  182. package/dist/types/index.d.ts +58 -0
  183. package/dist/types/index.js +7 -0
  184. package/dist/types/mark.d.ts +123 -0
  185. package/dist/types/mark.js +1 -0
  186. package/dist/types/plot.d.ts +459 -0
  187. package/dist/types/plot.js +1 -0
  188. package/dist/types/scale.d.ts +143 -0
  189. package/dist/types/scale.js +1 -0
  190. package/dist/types.d.ts +120 -127
  191. package/package.json +125 -120
@@ -2,21 +2,22 @@
2
2
  @component
3
3
  For showing custom SVG marks positioned at x/y coordinates
4
4
  -->
5
- <script module lang="ts">
6
- import type { ChannelAccessor, DataRow } from '../types.js';
7
- import type { Snippet } from 'svelte';
8
-
9
- export type HTMLMarkProps = {
10
- data: DataRow[];
11
- x?: ChannelAccessor;
12
- y?: ChannelAccessor;
13
- children: Snippet<{ datum: DataRow; x: number; y: number }>;
14
- };
15
- </script>
5
+ <script lang="ts" generics="Datum extends DataRecord">
6
+ interface CustomMarkProps extends BaseMarkProps<Datum> {
7
+ data: Datum[];
8
+ x?: ChannelAccessor<Datum>;
9
+ y?: ChannelAccessor<Datum>;
10
+ children: Snippet<[{ datum: Datum; x: number; y: number }]>;
11
+ }
16
12
 
17
- <script lang="ts">
18
13
  import { getContext } from 'svelte';
19
- import type { PlotContext } from '../types.js';
14
+ import type {
15
+ PlotContext,
16
+ DataRecord,
17
+ ChannelAccessor,
18
+ BaseMarkProps
19
+ } from '../types/index.js';
20
+ import type { Snippet } from 'svelte';
20
21
 
21
22
  const { getPlotState } = getContext<PlotContext>('svelteplot');
22
23
  let plot = $derived(getPlotState());
@@ -26,13 +27,19 @@
26
27
  import { isValid } from '../helpers/index.js';
27
28
  import GroupMultiple from './helpers/GroupMultiple.svelte';
28
29
 
29
- let { data = [{}], x, y, children, class: className = null }: HTMLMarkProps = $props();
30
+ let {
31
+ data = [{} as Datum],
32
+ x,
33
+ y,
34
+ children,
35
+ class: className = null
36
+ }: CustomMarkProps = $props();
30
37
  </script>
31
38
 
32
39
  <GroupMultiple class="g-custom-mark {className || ''}" length={className ? 2 : data.length}>
33
40
  {#each data as datum, i (i)}
34
- {@const x_ = resolveChannel('x', datum, { x, y })}
35
- {@const y_ = resolveChannel('y', datum, { x, y })}
41
+ {@const x_ = resolveChannel<Datum>('x', datum, { x, y })}
42
+ {@const y_ = resolveChannel<Datum>('y', datum, { x, y })}
36
43
  {#if isValid(x_) && isValid(y_)}
37
44
  {@const [px, py] = projectXY(plot.scales, x_, y_)}
38
45
  <g transform="translate({px}, {py})">
@@ -1,16 +1,19 @@
1
- import type { ChannelAccessor, DataRow } from '../types.js';
2
- import type { Snippet } from 'svelte';
3
- export type HTMLMarkProps = {
4
- data: DataRow[];
5
- x?: ChannelAccessor;
6
- y?: ChannelAccessor;
7
- children: Snippet<{
8
- datum: DataRow;
9
- x: number;
10
- y: number;
11
- }>;
12
- };
1
+ import type { DataRecord } from '../types/index.js';
2
+ declare class __sveltets_Render<Datum extends DataRecord> {
3
+ props(): any;
4
+ events(): {};
5
+ slots(): {};
6
+ bindings(): "";
7
+ exports(): {};
8
+ }
9
+ interface $$IsomorphicComponent {
10
+ new <Datum extends DataRecord>(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']>> & {
11
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
12
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
13
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
14
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
15
+ }
13
16
  /** For showing custom SVG marks positioned at x/y coordinates */
14
- declare const CustomMark: import("svelte").Component<HTMLMarkProps, {}, "">;
15
- type CustomMark = ReturnType<typeof CustomMark>;
17
+ declare const CustomMark: $$IsomorphicComponent;
18
+ type CustomMark<Datum extends DataRecord> = InstanceType<typeof CustomMark<Datum>>;
16
19
  export default CustomMark;
@@ -2,14 +2,12 @@
2
2
  @component
3
3
  For showing custom HTML tooltips positioned at x/y coordinates
4
4
  -->
5
- <script module lang="ts">
6
- import type { ChannelAccessor, ConstantAccessor, DataRow } from '../types.js';
7
- import type { Snippet } from 'svelte';
8
5
 
9
- export type HTMLMarkProps = {
10
- data: DataRow[];
11
- x?: ChannelAccessor;
12
- y?: ChannelAccessor;
6
+ <script lang="ts" generics="Datum extends DataRecord">
7
+ interface CustomMarkHTMLProps {
8
+ data: Datum[];
9
+ x?: ChannelAccessor<Datum>;
10
+ y?: ChannelAccessor<Datum>;
13
11
  frameAnchor?: ConstantAccessor<
14
12
  | 'bottom'
15
13
  | 'top'
@@ -19,15 +17,19 @@
19
17
  | 'bottom-left'
20
18
  | 'top-right'
21
19
  | 'bottom-right'
22
- | 'center'
20
+ | 'center',
21
+ Datum
23
22
  >;
24
- children: Snippet<{ datum: DataRow; x: number; y: number }>;
25
- };
26
- </script>
27
-
28
- <script lang="ts">
29
- import { getContext } from 'svelte';
30
- import type { PlotContext } from '../types.js';
23
+ class: string | null;
24
+ children: Snippet<{ datum: Datum; x: number; y: number }>;
25
+ }
26
+ import { getContext, type Snippet } from 'svelte';
27
+ import type {
28
+ ChannelAccessor,
29
+ ConstantAccessor,
30
+ DataRecord,
31
+ PlotContext
32
+ } from '../types/index.js';
31
33
 
32
34
  const { getPlotState } = getContext<PlotContext>('svelteplot');
33
35
  const plot = $derived(getPlotState());
@@ -37,15 +39,15 @@
37
39
  import { isValid } from '../helpers/index.js';
38
40
 
39
41
  let {
40
- data = [{}],
42
+ data = [{} as Datum],
41
43
  x,
42
44
  y,
43
45
  frameAnchor,
44
46
  children,
45
47
  class: className = null
46
- }: HTMLMarkProps = $props();
48
+ }: CustomMarkHTMLProps = $props();
47
49
 
48
- function getXY(datum) {
50
+ function getXY(datum: Datum) {
49
51
  const fa = frameAnchor || 'center';
50
52
  const isLeft = fa.endsWith('left');
51
53
  const isRight = fa.endsWith('right');
@@ -1,17 +1,31 @@
1
- import type { ChannelAccessor, ConstantAccessor, DataRow } from '../types.js';
2
- import type { Snippet } from 'svelte';
3
- export type HTMLMarkProps = {
4
- data: DataRow[];
5
- x?: ChannelAccessor;
6
- y?: ChannelAccessor;
7
- frameAnchor?: ConstantAccessor<'bottom' | 'top' | 'left' | 'right' | 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right' | 'center'>;
8
- children: Snippet<{
9
- datum: DataRow;
10
- x: number;
11
- y: number;
12
- }>;
13
- };
1
+ import { type Snippet } from 'svelte';
2
+ import type { ChannelAccessor, ConstantAccessor, DataRecord } from '../types/index.js';
3
+ declare class __sveltets_Render<Datum extends DataRecord> {
4
+ props(): {
5
+ data: Datum[];
6
+ x?: ChannelAccessor<Datum>;
7
+ y?: ChannelAccessor<Datum>;
8
+ frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "center" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
9
+ class: string | null;
10
+ children: Snippet<{
11
+ datum: Datum;
12
+ x: number;
13
+ y: number;
14
+ }>;
15
+ };
16
+ events(): {};
17
+ slots(): {};
18
+ bindings(): "";
19
+ exports(): {};
20
+ }
21
+ interface $$IsomorphicComponent {
22
+ new <Datum extends DataRecord>(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']>> & {
23
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
24
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
25
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
26
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
27
+ }
14
28
  /** For showing custom HTML tooltips positioned at x/y coordinates */
15
- declare const CustomMarkHtml: import("svelte").Component<HTMLMarkProps, {}, "">;
16
- type CustomMarkHtml = ReturnType<typeof CustomMarkHtml>;
29
+ declare const CustomMarkHtml: $$IsomorphicComponent;
30
+ type CustomMarkHtml<Datum extends DataRecord> = InstanceType<typeof CustomMarkHtml<Datum>>;
17
31
  export default CustomMarkHtml;
@@ -1,43 +1,59 @@
1
- <script module lang="ts">
2
- export type DifferenceYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
3
- data: DataRecord[];
1
+ <script lang="ts" generics="Datum extends DataRecord">
2
+ interface DifferenceYMarkProps extends Omit<BaseMarkProps<Datum>, 'fill' | 'fillOpacity'> {
3
+ data: Datum[];
4
4
  /*
5
5
  * the horizontal position of the comparison; bound to the x scale
6
6
  */
7
- x1: ChannelAccessor;
7
+ x1: ChannelAccessor<Datum>;
8
8
  /**
9
9
  * the horizontal position of the metric; bound to the x scale
10
10
  */
11
- x2: ChannelAccessor;
12
- x: ChannelAccessor;
11
+ x2: ChannelAccessor<Datum>;
12
+ x: ChannelAccessor<Datum>;
13
13
  /**
14
14
  * the vertical position of the comparison; bound to the y scale
15
15
  */
16
- y1: ChannelAccessor;
16
+ y1: ChannelAccessor<Datum>;
17
17
  /**
18
18
  * the vertical position of the metric; bound to the y scale
19
19
  */
20
- y2: ChannelAccessor;
21
- y: ChannelAccessor;
20
+ y2: ChannelAccessor<Datum>;
21
+ y: ChannelAccessor<Datum>;
22
22
  fillOpacity?: number;
23
+ /**
24
+ * the stroke color of the "positive" area; defaults to 'blue'
25
+ */
23
26
  positiveFill?: string;
27
+ /**
28
+ * the fill opacity of the "positive" area; defaults to 1
29
+ */
24
30
  positiveFillOpacity?: number;
31
+ /**
32
+ * the stroke color of the "negative" area; defaults to 'red'
33
+ */
25
34
  negativeFill?: string;
35
+ /**
36
+ * the fill opacity of the "negative" area; defaults to 1
37
+ */
26
38
  negativeFillOpacity?: number;
39
+ /**
40
+ * curve type for the area; defaults to 'linear'
41
+ */
27
42
  curve?: CurveName | CurveFactory;
43
+ /**
44
+ * the tension of the area curve; defaults to 0
45
+ */
28
46
  tension?: number;
29
- };
30
- </script>
31
-
32
- <script lang="ts">
47
+ }
33
48
  import type {
34
49
  BaseMarkProps,
35
50
  ChannelAccessor,
36
51
  CurveName,
37
52
  DataRecord,
38
- PlotContext
39
- } from '../types.js';
40
- import { Line, Area } from '../index.js';
53
+ PlotContext,
54
+ PlotDefaults
55
+ } from '../types/index.js';
56
+ import { Line, Area } from './';
41
57
  import { randomId, coalesce } from '../helpers/index.js';
42
58
  import { getContext } from 'svelte';
43
59
  import { extent, max, min } from 'd3-array';
@@ -47,8 +63,28 @@
47
63
  const { getPlotState } = getContext<PlotContext>('svelteplot');
48
64
  let plot = $derived(getPlotState());
49
65
 
50
- let { data, stroke, class: className = null, ...options }: DifferenceYMarkProps = $props();
51
- let { x, x1, x2, y, y1, y2 } = $derived(options);
66
+ let markProps: DifferenceYMarkProps = $props();
67
+
68
+ const DEFAULTS = {
69
+ positiveFill: 'red',
70
+ positiveFillOpacity: 1,
71
+ negativeFill: 'blue',
72
+ negativeFillOpacity: 1,
73
+ curve: 'linear' as CurveName,
74
+ tension: 0,
75
+ ...getContext<PlotDefaults>('svelteplot/_defaults').differenceY
76
+ };
77
+
78
+ const {
79
+ data,
80
+ stroke,
81
+ class: className = null,
82
+ ...options
83
+ }: DifferenceYMarkProps = $derived({
84
+ ...DEFAULTS,
85
+ ...markProps
86
+ });
87
+ const { x, x1, x2, y, y1, y2 } = $derived(options);
52
88
 
53
89
  const x1x2Differ = $derived((x1 == null || x2 == null) && x1 !== x2);
54
90
 
@@ -1,30 +1,61 @@
1
- export type DifferenceYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
2
- data: DataRecord[];
3
- x1: ChannelAccessor;
4
- /**
5
- * the horizontal position of the metric; bound to the x scale
6
- */
7
- x2: ChannelAccessor;
8
- x: ChannelAccessor;
9
- /**
10
- * the vertical position of the comparison; bound to the y scale
11
- */
12
- y1: ChannelAccessor;
13
- /**
14
- * the vertical position of the metric; bound to the y scale
15
- */
16
- y2: ChannelAccessor;
17
- y: ChannelAccessor;
18
- fillOpacity?: number;
19
- positiveFill?: string;
20
- positiveFillOpacity?: number;
21
- negativeFill?: string;
22
- negativeFillOpacity?: number;
23
- curve?: CurveName | CurveFactory;
24
- tension?: number;
25
- };
26
- import type { BaseMarkProps, ChannelAccessor, CurveName, DataRecord } from '../types.js';
1
+ import type { ChannelAccessor, CurveName, DataRecord } from '../types/index.js';
27
2
  import type { CurveFactory } from 'd3-shape';
28
- declare const DifferenceY: import("svelte").Component<DifferenceYMarkProps, {}, "">;
29
- type DifferenceY = ReturnType<typeof DifferenceY>;
3
+ declare class __sveltets_Render<Datum extends DataRecord> {
4
+ props(): Omit<BaseMarkProps<Datum_1>, "fill" | "fillOpacity"> & {
5
+ data: Datum[];
6
+ x1: ChannelAccessor<Datum_1>;
7
+ /**
8
+ * the horizontal position of the metric; bound to the x scale
9
+ */
10
+ x2: ChannelAccessor<Datum_1>;
11
+ x: ChannelAccessor<Datum_1>;
12
+ /**
13
+ * the vertical position of the comparison; bound to the y scale
14
+ */
15
+ y1: ChannelAccessor<Datum_1>;
16
+ /**
17
+ * the vertical position of the metric; bound to the y scale
18
+ */
19
+ y2: ChannelAccessor<Datum_1>;
20
+ y: ChannelAccessor<Datum_1>;
21
+ fillOpacity?: number;
22
+ /**
23
+ * the stroke color of the "positive" area; defaults to 'blue'
24
+ */
25
+ positiveFill?: string;
26
+ /**
27
+ * the fill opacity of the "positive" area; defaults to 1
28
+ */
29
+ positiveFillOpacity?: number;
30
+ /**
31
+ * the stroke color of the "negative" area; defaults to 'red'
32
+ */
33
+ negativeFill?: string;
34
+ /**
35
+ * the fill opacity of the "negative" area; defaults to 1
36
+ */
37
+ negativeFillOpacity?: number;
38
+ /**
39
+ * curve type for the area; defaults to 'linear'
40
+ */
41
+ curve?: CurveName | CurveFactory;
42
+ /**
43
+ * the tension of the area curve; defaults to 0
44
+ */
45
+ tension?: number;
46
+ };
47
+ events(): {};
48
+ slots(): {};
49
+ bindings(): "";
50
+ exports(): {};
51
+ }
52
+ interface $$IsomorphicComponent {
53
+ new <Datum extends DataRecord>(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']>> & {
54
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
55
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
56
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
57
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
58
+ }
59
+ declare const DifferenceY: $$IsomorphicComponent;
60
+ type DifferenceY<Datum extends DataRecord> = InstanceType<typeof DifferenceY<Datum>>;
30
61
  export default DifferenceY;
@@ -1,19 +1,17 @@
1
1
  <!-- @component
2
2
  Creates dots or symbols at specified positions with customizable size and appearance
3
3
  -->
4
- <script module lang="ts">
5
- export type DotMarkProps = BaseMarkProps & {
6
- data: DataRecord[];
7
- x: ChannelAccessor;
8
- y: ChannelAccessor;
9
- r?: ChannelAccessor;
10
- symbol?: ChannelAccessor | Snippet<[number, string]>;
4
+ <script lang="ts" generics="Datum extends DataRecord">
5
+ interface DotMarkProps extends BaseMarkProps<Datum>, LinkableMarkProps<Datum> {
6
+ data: Datum[];
7
+ x: ChannelAccessor<Datum>;
8
+ y: ChannelAccessor<Datum>;
9
+ r?: ChannelAccessor<Datum>;
10
+ symbol?: ChannelAccessor<Datum> | Snippet<[number, string]>;
11
11
  canvas?: boolean;
12
- dotClass?: ConstantAccessor<string>;
13
- } & LinkableMarkProps;
14
- </script>
12
+ dotClass?: ConstantAccessor<string, Datum>;
13
+ }
15
14
 
16
- <script lang="ts">
17
15
  import { getContext, type Snippet } from 'svelte';
18
16
  import type {
19
17
  PlotContext,
@@ -23,17 +21,18 @@
23
21
  ChannelAccessor,
24
22
  PlotDefaults,
25
23
  LinkableMarkProps
26
- } from '../types.js';
24
+ } from '../types/index.js';
27
25
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
28
26
  import { maybeSymbol } from '../helpers/symbols.js';
29
27
  import { symbol as d3Symbol } from 'd3-shape';
30
- import { sort } from '../index.js';
28
+ import { sort } from '..';
31
29
  import Mark from '../Mark.svelte';
32
30
  import DotCanvas from './helpers/DotCanvas.svelte';
33
31
  import { maybeData, isValid } from '../helpers/index.js';
34
32
  import { recordizeXY } from '../transforms/recordize.js';
35
33
  import { addEventHandlers } from './helpers/events.js';
36
34
  import Anchor from './helpers/Anchor.svelte';
35
+ import type { D } from 'vitest/dist/chunks/reporters.d.DL9pg5DB.js';
37
36
 
38
37
  const DEFAULTS = {
39
38
  ...getContext<PlotDefaults>('svelteplot/_defaults').dot
@@ -42,7 +41,7 @@
42
41
  let markProps: DotMarkProps = $props();
43
42
 
44
43
  const {
45
- data = [{}],
44
+ data = [{} as Datum],
46
45
  canvas = false,
47
46
  class: className = '',
48
47
  dotClass = null,
@@ -1,15 +1,87 @@
1
- export type DotMarkProps = BaseMarkProps & {
2
- data: DataRecord[];
3
- x: ChannelAccessor;
4
- y: ChannelAccessor;
5
- r?: ChannelAccessor;
6
- symbol?: ChannelAccessor | Snippet<[number, string]>;
7
- canvas?: boolean;
8
- dotClass?: ConstantAccessor<string>;
9
- } & LinkableMarkProps;
10
1
  import { type Snippet } from 'svelte';
11
- import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types.js';
2
+ import type { DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
3
+ declare class __sveltets_Render<Datum extends DataRecord> {
4
+ props(): Partial<{
5
+ filter?: ConstantAccessor<boolean, Datum>;
6
+ facet?: "auto" | "include" | "exclude";
7
+ fx: ChannelAccessor<Datum>;
8
+ fy: ChannelAccessor<Datum>;
9
+ dx: ConstantAccessor<number, Datum>;
10
+ dy: ConstantAccessor<number, Datum>;
11
+ fill: ChannelAccessor<Datum>;
12
+ fillOpacity: ConstantAccessor<number, Datum>;
13
+ sort: {
14
+ channel: string;
15
+ order?: "ascending" | "descending";
16
+ } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
17
+ stroke: ChannelAccessor<Datum>;
18
+ strokeWidth: ConstantAccessor<number, Datum>;
19
+ strokeOpacity: ConstantAccessor<number, Datum>;
20
+ strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
21
+ strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
22
+ strokeMiterlimit: ConstantAccessor<number, Datum>;
23
+ opacity: ChannelAccessor<Datum>;
24
+ strokeDasharray: ConstantAccessor<string, Datum>;
25
+ strokeDashoffset: ConstantAccessor<number, Datum>;
26
+ mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
27
+ clipPath: string;
28
+ imageFilter: ConstantAccessor<string, Datum>;
29
+ shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
30
+ paintOrder: ConstantAccessor<string, Datum>;
31
+ onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
32
+ ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
33
+ onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
34
+ onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
35
+ onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
36
+ onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
37
+ onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
38
+ onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
39
+ onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
40
+ onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
41
+ onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
42
+ onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
43
+ onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
44
+ onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
45
+ onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
46
+ onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
47
+ onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
48
+ ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
49
+ ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
50
+ ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
51
+ ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
52
+ ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
53
+ ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
54
+ ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
55
+ ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
56
+ ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
57
+ ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
58
+ ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
59
+ oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
60
+ onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
61
+ class: string | null;
62
+ cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
63
+ }> & LinkableMarkProps<Datum> & {
64
+ data: Datum[];
65
+ x: ChannelAccessor<Datum>;
66
+ y: ChannelAccessor<Datum>;
67
+ r?: ChannelAccessor<Datum>;
68
+ symbol?: Snippet<[number, string]> | ChannelAccessor<Datum>;
69
+ canvas?: boolean;
70
+ dotClass?: ConstantAccessor<string, Datum>;
71
+ };
72
+ events(): {};
73
+ slots(): {};
74
+ bindings(): "";
75
+ exports(): {};
76
+ }
77
+ interface $$IsomorphicComponent {
78
+ new <Datum extends DataRecord>(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']>> & {
79
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
80
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
81
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
82
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
83
+ }
12
84
  /** Creates dots or symbols at specified positions with customizable size and appearance */
13
- declare const Dot: import("svelte").Component<DotMarkProps, {}, "">;
14
- type Dot = ReturnType<typeof Dot>;
85
+ declare const Dot: $$IsomorphicComponent;
86
+ type Dot<Datum extends DataRecord> = InstanceType<typeof Dot<Datum>>;
15
87
  export default Dot;
@@ -1,16 +1,16 @@
1
1
  <!-- @component
2
2
  Creates a horizontal dot plot with x values along a single y position
3
3
  -->
4
- <script module lang="ts">
5
- export type DotXMarkProps = Omit<DotMarkProps, 'y'>;
6
- </script>
7
-
8
- <script lang="ts">
9
- import Dot, { type DotMarkProps } from './Dot.svelte';
10
- import { recordizeX } from '../index.js';
11
- import type { DataRow } from '../types.js';
4
+ <script lang="ts" generics="Datum extends DataRow">
5
+ interface DotXMarkProps extends Omit<ComponentProps<typeof Dot>, 'y' | 'data'> {
6
+ data: Datum[];
7
+ }
8
+ import Dot from './Dot.svelte';
9
+ import { recordizeX } from '..';
10
+ import type { DataRow } from '../types/index.js';
11
+ import type { ComponentProps } from 'svelte';
12
12
 
13
- let { data = [{}], ...options }: DotXMarkProps = $props();
13
+ let { data = [{} as Datum], ...options }: DotXMarkProps = $props();
14
14
 
15
15
  const args = $derived(recordizeX({ data, ...options, y: 1 }, { withIndex: false }));
16
16
  </script>