svelteplot 0.3.0 → 0.3.2-pr-113.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 (175) 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/core/Facet.svelte +1 -1
  6. package/dist/core/Facet.svelte.d.ts +1 -1
  7. package/dist/core/FacetAxes.svelte +1 -1
  8. package/dist/core/FacetGrid.svelte +1 -1
  9. package/dist/core/FacetGrid.svelte.d.ts +1 -1
  10. package/dist/core/Plot.svelte +1 -7
  11. package/dist/core/Plot.svelte.d.ts +1 -1
  12. package/dist/helpers/autoTicks.js +1 -1
  13. package/dist/helpers/colors.d.ts +1 -1
  14. package/dist/helpers/getBaseStyles.d.ts +2 -0
  15. package/dist/helpers/getBaseStyles.js +8 -0
  16. package/dist/helpers/index.d.ts +2 -2
  17. package/dist/helpers/projection.d.ts +1 -1
  18. package/dist/helpers/resolve.d.ts +1 -1
  19. package/dist/helpers/scales.d.ts +1 -1
  20. package/dist/helpers/typeChecks.d.ts +4 -4
  21. package/dist/marks/Area.svelte +14 -17
  22. package/dist/marks/Area.svelte.d.ts +91 -19
  23. package/dist/marks/AreaX.svelte +15 -12
  24. package/dist/marks/AreaX.svelte.d.ts +94 -3
  25. package/dist/marks/AreaY.svelte +15 -15
  26. package/dist/marks/AreaY.svelte.d.ts +94 -3
  27. package/dist/marks/Arrow.svelte +16 -19
  28. package/dist/marks/Arrow.svelte.d.ts +110 -38
  29. package/dist/marks/AxisX.svelte +41 -41
  30. package/dist/marks/AxisX.svelte.d.ts +97 -25
  31. package/dist/marks/AxisY.svelte +40 -40
  32. package/dist/marks/AxisY.svelte.d.ts +98 -27
  33. package/dist/marks/BarX.svelte +28 -30
  34. package/dist/marks/BarX.svelte.d.ts +89 -17
  35. package/dist/marks/BarY.svelte +27 -27
  36. package/dist/marks/BarY.svelte.d.ts +88 -16
  37. package/dist/marks/BollingerX.svelte +21 -16
  38. package/dist/marks/BollingerX.svelte.d.ts +17 -16
  39. package/dist/marks/BollingerY.svelte +21 -16
  40. package/dist/marks/BollingerY.svelte.d.ts +17 -16
  41. package/dist/marks/BoxX.svelte +5 -7
  42. package/dist/marks/BoxX.svelte.d.ts +5 -3
  43. package/dist/marks/BoxY.svelte +13 -16
  44. package/dist/marks/BoxY.svelte.d.ts +41 -28
  45. package/dist/marks/Brush.svelte +27 -30
  46. package/dist/marks/Brush.svelte.d.ts +20 -15
  47. package/dist/marks/BrushX.svelte +9 -7
  48. package/dist/marks/BrushX.svelte.d.ts +5 -2
  49. package/dist/marks/BrushY.svelte +9 -7
  50. package/dist/marks/BrushY.svelte.d.ts +5 -2
  51. package/dist/marks/Cell.svelte +17 -18
  52. package/dist/marks/Cell.svelte.d.ts +80 -8
  53. package/dist/marks/CellX.svelte +12 -8
  54. package/dist/marks/CellX.svelte.d.ts +5 -2
  55. package/dist/marks/CellY.svelte +12 -8
  56. package/dist/marks/CellY.svelte.d.ts +5 -2
  57. package/dist/marks/ColorLegend.svelte +5 -8
  58. package/dist/marks/ColorLegend.svelte.d.ts +2 -2
  59. package/dist/marks/CustomMark.svelte +23 -16
  60. package/dist/marks/CustomMark.svelte.d.ts +17 -14
  61. package/dist/marks/CustomMarkHTML.svelte +20 -18
  62. package/dist/marks/CustomMarkHTML.svelte.d.ts +29 -15
  63. package/dist/marks/DifferenceY.svelte +54 -18
  64. package/dist/marks/DifferenceY.svelte.d.ts +59 -28
  65. package/dist/marks/Dot.svelte +13 -14
  66. package/dist/marks/Dot.svelte.d.ts +84 -12
  67. package/dist/marks/DotX.svelte +9 -9
  68. package/dist/marks/DotX.svelte.d.ts +86 -4
  69. package/dist/marks/DotY.svelte +10 -9
  70. package/dist/marks/DotY.svelte.d.ts +87 -5
  71. package/dist/marks/Frame.svelte +20 -27
  72. package/dist/marks/Frame.svelte.d.ts +24 -10
  73. package/dist/marks/Geo.svelte +22 -15
  74. package/dist/marks/Geo.svelte.d.ts +97 -13
  75. package/dist/marks/Graticule.svelte +16 -19
  76. package/dist/marks/Graticule.svelte.d.ts +3 -3
  77. package/dist/marks/GridX.svelte +5 -8
  78. package/dist/marks/GridX.svelte.d.ts +79 -7
  79. package/dist/marks/GridY.svelte +5 -8
  80. package/dist/marks/GridY.svelte.d.ts +79 -7
  81. package/dist/marks/HTMLTooltip.svelte +9 -14
  82. package/dist/marks/HTMLTooltip.svelte.d.ts +25 -12
  83. package/dist/marks/Line.svelte +24 -29
  84. package/dist/marks/Line.svelte.d.ts +97 -25
  85. package/dist/marks/LineX.svelte +9 -4
  86. package/dist/marks/LineX.svelte.d.ts +99 -3
  87. package/dist/marks/LineY.svelte +11 -5
  88. package/dist/marks/LineY.svelte.d.ts +100 -4
  89. package/dist/marks/Link.svelte +35 -19
  90. package/dist/marks/Link.svelte.d.ts +107 -18
  91. package/dist/marks/Pointer.svelte +13 -18
  92. package/dist/marks/Pointer.svelte.d.ts +34 -21
  93. package/dist/marks/Rect.svelte +19 -19
  94. package/dist/marks/Rect.svelte.d.ts +86 -13
  95. package/dist/marks/RectX.svelte +10 -9
  96. package/dist/marks/RectX.svelte.d.ts +22 -6
  97. package/dist/marks/RectY.svelte +9 -10
  98. package/dist/marks/RectY.svelte.d.ts +22 -6
  99. package/dist/marks/RegressionX.svelte +1 -1
  100. package/dist/marks/RegressionX.svelte.d.ts +1 -1
  101. package/dist/marks/RegressionY.svelte +1 -1
  102. package/dist/marks/RegressionY.svelte.d.ts +1 -1
  103. package/dist/marks/RuleX.svelte +14 -16
  104. package/dist/marks/RuleX.svelte.d.ts +84 -12
  105. package/dist/marks/RuleY.svelte +12 -15
  106. package/dist/marks/RuleY.svelte.d.ts +84 -12
  107. package/dist/marks/Sphere.svelte +6 -7
  108. package/dist/marks/Sphere.svelte.d.ts +3 -2
  109. package/dist/marks/Spike.svelte +17 -9
  110. package/dist/marks/Spike.svelte.d.ts +94 -4
  111. package/dist/marks/SymbolLegend.svelte +1 -1
  112. package/dist/marks/Text.svelte +36 -125
  113. package/dist/marks/Text.svelte.d.ts +101 -20
  114. package/dist/marks/TickX.svelte +12 -13
  115. package/dist/marks/TickX.svelte.d.ts +92 -20
  116. package/dist/marks/TickY.svelte +11 -14
  117. package/dist/marks/TickY.svelte.d.ts +92 -20
  118. package/dist/marks/Vector.svelte +19 -23
  119. package/dist/marks/Vector.svelte.d.ts +93 -21
  120. package/dist/marks/helpers/AreaCanvas.svelte +1 -1
  121. package/dist/marks/helpers/AreaCanvas.svelte.d.ts +1 -1
  122. package/dist/marks/helpers/BaseAxisX.svelte +1 -2
  123. package/dist/marks/helpers/BaseAxisX.svelte.d.ts +1 -1
  124. package/dist/marks/helpers/BaseAxisY.svelte +2 -3
  125. package/dist/marks/helpers/BaseAxisY.svelte.d.ts +1 -1
  126. package/dist/marks/helpers/CanvasLayer.svelte +1 -1
  127. package/dist/marks/helpers/DotCanvas.svelte +1 -1
  128. package/dist/marks/helpers/DotCanvas.svelte.d.ts +1 -1
  129. package/dist/marks/helpers/GeoCanvas.svelte +1 -1
  130. package/dist/marks/helpers/GeoCanvas.svelte.d.ts +1 -1
  131. package/dist/marks/helpers/LineCanvas.svelte +1 -1
  132. package/dist/marks/helpers/LineCanvas.svelte.d.ts +1 -1
  133. package/dist/marks/helpers/LinearGradientX.svelte +1 -1
  134. package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
  135. package/dist/marks/helpers/LinearGradientY.svelte +1 -1
  136. package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
  137. package/dist/marks/helpers/MarkerPath.svelte +1 -1
  138. package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
  139. package/dist/marks/helpers/MultilineText.svelte +158 -0
  140. package/dist/marks/helpers/MultilineText.svelte.d.ts +12 -0
  141. package/dist/marks/helpers/RectPath.svelte +29 -26
  142. package/dist/marks/helpers/RectPath.svelte.d.ts +39 -26
  143. package/dist/marks/helpers/Regression.svelte +7 -2
  144. package/dist/marks/helpers/Regression.svelte.d.ts +2 -5
  145. package/dist/transforms/bollinger.d.ts +1 -66
  146. package/dist/transforms/centroid.d.ts +7 -65
  147. package/dist/transforms/centroid.js +10 -7
  148. package/dist/transforms/group.d.ts +4 -12
  149. package/dist/transforms/interval.d.ts +2 -122
  150. package/dist/transforms/jitter.js +3 -3
  151. package/dist/transforms/map.d.ts +4 -184
  152. package/dist/transforms/normalize.d.ts +3 -123
  153. package/dist/transforms/select.d.ts +7 -427
  154. package/dist/transforms/sort.d.ts +3 -242
  155. package/dist/transforms/window.d.ts +2 -130
  156. package/dist/types/channel.d.ts +11 -0
  157. package/dist/types/channel.js +1 -0
  158. package/dist/types/colorScheme.d.ts +1 -0
  159. package/dist/types/colorScheme.js +1 -0
  160. package/dist/types/data.d.ts +13 -0
  161. package/dist/types/data.js +1 -0
  162. package/dist/types/facet.d.ts +50 -0
  163. package/dist/types/facet.js +1 -0
  164. package/dist/types/index.d.ts +58 -0
  165. package/dist/types/index.js +7 -0
  166. package/dist/types/mark.d.ts +123 -0
  167. package/dist/types/mark.js +1 -0
  168. package/dist/types/plot.d.ts +459 -0
  169. package/dist/types/plot.js +1 -0
  170. package/dist/types/scale.d.ts +143 -0
  171. package/dist/types/scale.js +1 -0
  172. package/dist/types.d.ts +120 -127
  173. package/dist/ui/Slider.svelte +1 -1
  174. package/dist/ui/Slider.svelte.d.ts +1 -1
  175. package/package.json +15 -11
@@ -1,19 +1,91 @@
1
- import type { BaseMarkProps, BaseRectMarkProps, ChannelAccessor, DataRow } from '../types.js';
2
- export type BarYMarkProps = BaseMarkProps & LinkableMarkProps & BaseRectMarkProps & {
3
- data: DataRow[];
4
- x?: ChannelAccessor;
5
- y?: ChannelAccessor;
6
- y1?: ChannelAccessor;
7
- y2?: ChannelAccessor;
8
- stack?: StackOptions;
9
- /**
10
- * Converts y into y1/y2 ranges based on the provided interval. Disables the
11
- * implicit stacking
12
- */
13
- interval?: number | string;
14
- };
15
1
  import type { StackOptions } from '../transforms/stack.js';
2
+ import type { BaseRectMarkProps, ChannelAccessor, DataRow, LinkableMarkProps } from '../types/index.js';
3
+ declare class __sveltets_Render<Datum extends DataRow> {
4
+ props(): Partial<{
5
+ filter?: import("../types/index.js").ConstantAccessor<boolean, Datum>;
6
+ facet?: "auto" | "include" | "exclude";
7
+ fx: ChannelAccessor<Datum>;
8
+ fy: ChannelAccessor<Datum>;
9
+ dx: import("../types/index.js").ConstantAccessor<number, Datum>;
10
+ dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
+ fill: ChannelAccessor<Datum>;
12
+ fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
13
+ sort: {
14
+ channel: string;
15
+ order?: "ascending" | "descending";
16
+ } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Datum>;
17
+ stroke: ChannelAccessor<Datum>;
18
+ strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
19
+ strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
20
+ strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
21
+ strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
22
+ strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
23
+ opacity: ChannelAccessor<Datum>;
24
+ strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
25
+ strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
26
+ mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
27
+ clipPath: string;
28
+ imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
29
+ shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
30
+ paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
31
+ onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
32
+ ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
+ onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
+ onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
+ onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
+ onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
+ onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
+ onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
+ onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
+ onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
+ onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
+ onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
+ onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
+ onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
+ onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
+ onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
+ onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
+ ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
+ ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
+ ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
+ ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
+ ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
+ ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
+ ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
+ ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
+ ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
+ ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
+ ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
+ oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
+ onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
+ class: string | null;
62
+ cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
63
+ }> & LinkableMarkProps<Datum> & BaseRectMarkProps<Datum> & {
64
+ data: Datum[];
65
+ x?: ChannelAccessor<Datum>;
66
+ y?: ChannelAccessor<Datum>;
67
+ y1?: ChannelAccessor<Datum>;
68
+ y2?: ChannelAccessor<Datum>;
69
+ stack?: StackOptions;
70
+ /**
71
+ * Converts y into y1/y2 ranges based on the provided interval. Disables the
72
+ * implicit stacking
73
+ */
74
+ interval?: number | string;
75
+ };
76
+ events(): {};
77
+ slots(): {};
78
+ bindings(): "";
79
+ exports(): {};
80
+ }
81
+ interface $$IsomorphicComponent {
82
+ new <Datum extends DataRow>(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']>> & {
83
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
84
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
85
+ <Datum extends DataRow>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
86
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
87
+ }
16
88
  /** For vertical column charts using a band scale as x axis */
17
- declare const BarY: import("svelte").Component<any, {}, "">;
18
- type BarY = ReturnType<typeof BarY>;
89
+ declare const BarY: $$IsomorphicComponent;
90
+ type BarY<Datum extends DataRow> = InstanceType<typeof BarY<Datum>>;
19
91
  export default BarY;
@@ -2,26 +2,29 @@
2
2
  @component
3
3
  line representing a moving average and an area representing volatility as a band
4
4
  -->
5
- <script module lang="ts">
6
- export type BollingerXMarkProps = BaseMarkProps & {
7
- data: DataRow[];
8
- x?: ChannelAccessor;
9
- y?: ChannelAccessor;
5
+ <script lang="ts" generics="Datum extends DataRecord">
6
+ import { Area, Line, bollingerX, recordizeX } from '..';
7
+ import type {
8
+ BaseMarkProps,
9
+ ChannelAccessor,
10
+ DataRecord,
11
+ TransformArg
12
+ } from '../types/index.js';
13
+ import { pick } from 'es-toolkit';
14
+
15
+ interface BollingerXMarkProps extends BaseMarkProps<Datum> {
16
+ data: Datum[];
17
+ x?: ChannelAccessor<Datum>;
18
+ y?: ChannelAccessor<Datum>;
10
19
  /**
11
- * the window size (the window transforms k option), an integer; defaults to 20
20
+ * the window size (the window transform's k option), an integer; defaults to 20
12
21
  */
13
22
  n?: number;
14
23
  /**
15
24
  * the band radius, a number representing a multiple of standard deviations; defaults to 2
16
25
  */
17
26
  k?: number;
18
- };
19
- </script>
20
-
21
- <script lang="ts">
22
- import { Area, Line, bollingerX, recordizeX } from '../index.js';
23
- import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
24
- import { pick } from 'es-toolkit';
27
+ }
25
28
 
26
29
  let {
27
30
  data,
@@ -31,7 +34,9 @@
31
34
  ...options
32
35
  }: BollingerXMarkProps = $props();
33
36
 
34
- let args = $derived(bollingerX(recordizeX({ data, ...options }), { n, k }));
37
+ let args = $derived(
38
+ bollingerX(recordizeX({ data, ...options } as TransformArg<DataRecord>), { n, k })
39
+ );
35
40
  </script>
36
41
 
37
42
  <g class="bollinger {className || ''}">
@@ -46,7 +51,7 @@
46
51
  y1: '__x',
47
52
  x1: '__lo',
48
53
  x2: '__hi',
49
- fillOpacity: 0.2,
50
- ...pick(args, ['data', 'fill', 'fillOpacity', 'opacity'])
54
+ ...pick(args, ['data', 'fill', 'fillOpacity', 'opacity']),
55
+ fillOpacity: 0.2
51
56
  }} />
52
57
  </g>
@@ -1,18 +1,19 @@
1
- export type BollingerXMarkProps = BaseMarkProps & {
2
- data: DataRow[];
3
- x?: ChannelAccessor;
4
- y?: ChannelAccessor;
5
- /**
6
- * the window size (the window transform’s k option), an integer; defaults to 20
7
- */
8
- n?: number;
9
- /**
10
- * the band radius, a number representing a multiple of standard deviations; defaults to 2
11
- */
12
- k?: number;
13
- };
14
- import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
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
+ }
15
16
  /** line representing a moving average and an area representing volatility as a band */
16
- declare const BollingerX: import("svelte").Component<BollingerXMarkProps, {}, "">;
17
- type BollingerX = ReturnType<typeof BollingerX>;
17
+ declare const BollingerX: $$IsomorphicComponent;
18
+ type BollingerX<Datum extends DataRecord> = InstanceType<typeof BollingerX<Datum>>;
18
19
  export default BollingerX;
@@ -2,30 +2,35 @@
2
2
  @component
3
3
  line representing a moving average and an area representing volatility as a band
4
4
  -->
5
- <script module lang="ts">
6
- export type BollingerYMarkProps = BaseMarkProps & {
7
- data: DataRow[];
8
- x?: ChannelAccessor;
9
- y?: ChannelAccessor;
5
+ <script lang="ts" generics="Datum extends DataRecord">
6
+ import { Area, Line, bollingerY, recordizeY } from '..';
7
+ import type {
8
+ BaseMarkProps,
9
+ ChannelAccessor,
10
+ DataRecord,
11
+ TransformArg
12
+ } from '../types/index.js';
13
+ import { pick } from 'es-toolkit';
14
+
15
+ interface BollingerYMarkProps extends BaseMarkProps<Datum> {
16
+ data: Datum[];
17
+ x?: ChannelAccessor<Datum>;
18
+ y?: ChannelAccessor<Datum>;
10
19
  /**
11
- * the window size (the window transforms k option), an integer; defaults to 20
20
+ * the window size (the window transform's k option), an integer; defaults to 20
12
21
  */
13
22
  n?: number;
14
23
  /**
15
24
  * the band radius, a number representing a multiple of standard deviations; defaults to 2
16
25
  */
17
26
  k?: number;
18
- };
19
- </script>
20
-
21
- <script lang="ts">
22
- import { Area, Line, bollingerY, recordizeY } from '../index.js';
23
- import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
24
- import { pick } from 'es-toolkit';
27
+ }
25
28
 
26
29
  let { data, n = 20, k = 2, class: className, ...options }: BollingerYMarkProps = $props();
27
30
 
28
- const args = $derived(bollingerY(recordizeY({ data, ...options }), { n, k }));
31
+ const args = $derived(
32
+ bollingerY(recordizeY({ data, ...options } as TransformArg<DataRecord>), { n, k })
33
+ );
29
34
  </script>
30
35
 
31
36
  <g class="bollinger {className || ''}">
@@ -35,7 +40,7 @@
35
40
  x1: '__x',
36
41
  y1: '__lo',
37
42
  y2: '__hi',
38
- fillOpacity: 0.2,
39
- ...pick(args, ['data', 'fill', 'fillOpacity', 'opacity'])
43
+ ...pick(args, ['data', 'fill', 'fillOpacity', 'opacity']),
44
+ fillOpacity: 0.2
40
45
  }} />
41
46
  </g>
@@ -1,18 +1,19 @@
1
- export type BollingerYMarkProps = BaseMarkProps & {
2
- data: DataRow[];
3
- x?: ChannelAccessor;
4
- y?: ChannelAccessor;
5
- /**
6
- * the window size (the window transform’s k option), an integer; defaults to 20
7
- */
8
- n?: number;
9
- /**
10
- * the band radius, a number representing a multiple of standard deviations; defaults to 2
11
- */
12
- k?: number;
13
- };
14
- import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
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
+ }
15
16
  /** line representing a moving average and an area representing volatility as a band */
16
- declare const BollingerY: import("svelte").Component<BollingerYMarkProps, {}, "">;
17
- type BollingerY = ReturnType<typeof BollingerY>;
17
+ declare const BollingerY: $$IsomorphicComponent;
18
+ type BollingerY<Datum extends DataRecord> = InstanceType<typeof BollingerY<Datum>>;
18
19
  export default BollingerY;
@@ -1,17 +1,15 @@
1
1
  <!-- @component
2
2
  Creates a horizontal box plot for visualizing data distribution with quartiles and outliers
3
3
  -->
4
- <script module lang="ts">
5
- export type BoxXMarkProps = BoxYMarkProps;
6
- </script>
7
4
 
8
5
  <script lang="ts">
6
+ interface BoxXMarkProps extends ComponentProps<typeof BoxY> {}
9
7
  import GroupMultiple from './helpers/GroupMultiple.svelte';
10
- import type { BoxYMarkProps } from './BoxY.svelte';
11
- import { BarX, TickX, RuleY, Dot, groupY } from '../index.js';
8
+ import { BarX, TickX, RuleY, Dot, groupY } from '..';
12
9
  import { resolveChannel } from '../helpers/resolve.js';
13
- import { getContext } from 'svelte';
14
- import type { PlotDefaults } from '../types.js';
10
+ import { getContext, type ComponentProps } from 'svelte';
11
+ import type { PlotDefaults } from '../types/index.js';
12
+ import type BoxY from './BoxY.svelte';
15
13
 
16
14
  let markProps: BoxXMarkProps = $props();
17
15
  const DEFAULTS = {
@@ -1,6 +1,8 @@
1
- export type BoxXMarkProps = BoxYMarkProps;
2
- import type { BoxYMarkProps } from './BoxY.svelte';
1
+ import { type ComponentProps } from 'svelte';
2
+ import type BoxY from './BoxY.svelte';
3
+ interface BoxXMarkProps extends ComponentProps<typeof BoxY> {
4
+ }
3
5
  /** Creates a horizontal box plot for visualizing data distribution with quartiles and outliers */
4
- declare const BoxX: import("svelte").Component<BoxYMarkProps, {}, "">;
6
+ declare const BoxX: import("svelte").Component<BoxXMarkProps, {}, "">;
5
7
  type BoxX = ReturnType<typeof BoxX>;
6
8
  export default BoxX;
@@ -1,41 +1,38 @@
1
1
  <!-- @component
2
2
  Creates a vertical box plot for visualizing data distribution with quartiles and outliers
3
3
  -->
4
- <script lang="ts" module>
5
- export type BoxYMarkProps = Pick<BaseMarkProps, 'class'> & {
6
- data: DataRecord[];
4
+ <script lang="ts" generics="Datum extends DataRecord">
5
+ interface BoxYMarkProps extends Pick<BaseMarkProps<Datum>, 'class'> {
6
+ data: Datum[];
7
7
  x: ChannelAccessor;
8
8
  y: ChannelAccessor;
9
9
  /**
10
10
  * Options for the rule marks that represent the min/max range
11
11
  */
12
- rule: Record<string, ChannelAccessor>;
12
+ rule: Record<string, ChannelAccessor<Datum>>;
13
13
  /**
14
14
  * Options for the bar marks that represent the IQR range
15
15
  */
16
- bar: Record<string, ChannelAccessor>;
16
+ bar: Record<string, ChannelAccessor<Datum>>;
17
17
  /**
18
18
  * Options for the tick marks that represent the median
19
19
  */
20
- tickMedian: Record<string, ChannelAccessor> | boolean;
20
+ tickMedian: Record<string, ChannelAccessor<Datum>> | boolean;
21
21
  /**
22
22
  * Options for the tick marks that represent the min/max range
23
23
  */
24
- tickMinMax: Record<string, ChannelAccessor> | boolean;
24
+ tickMinMax: Record<string, ChannelAccessor<Datum>> | boolean;
25
25
  /**
26
26
  * Options for the dot marks that represent the outliers
27
27
  */
28
- dot: Record<string, ChannelAccessor>;
29
- };
30
- </script>
31
-
32
- <script lang="ts">
28
+ dot: Record<string, ChannelAccessor<Datum>>;
29
+ }
33
30
  import GroupMultiple from './helpers/GroupMultiple.svelte';
34
- import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types.js';
35
- import { groupX, BarY, TickY, RuleX, Dot } from '../index.js';
31
+ import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types/index.js';
32
+ import { groupX, BarY, TickY, RuleX, Dot } from '..';
36
33
  import { resolveChannel } from '../helpers/resolve.js';
37
34
  import { getContext } from 'svelte';
38
- import type { PlotDefaults } from '../types.js';
35
+ import type { PlotDefaults } from '../types/index.js';
39
36
 
40
37
  let markProps: BoxYMarkProps = $props();
41
38
  const DEFAULTS = {
@@ -45,7 +42,7 @@
45
42
  ...getContext<PlotDefaults>('svelteplot/_defaults').boxY
46
43
  };
47
44
  const {
48
- data = [{}],
45
+ data = [{} as Datum],
49
46
  class: className = '',
50
47
  bar,
51
48
  rule,
@@ -1,30 +1,43 @@
1
- export type BoxYMarkProps = Pick<BaseMarkProps, 'class'> & {
2
- data: DataRecord[];
3
- x: ChannelAccessor;
4
- y: ChannelAccessor;
5
- /**
6
- * Options for the rule marks that represent the min/max range
7
- */
8
- rule: Record<string, ChannelAccessor>;
9
- /**
10
- * Options for the bar marks that represent the IQR range
11
- */
12
- bar: Record<string, ChannelAccessor>;
13
- /**
14
- * Options for the tick marks that represent the median
15
- */
16
- tickMedian: Record<string, ChannelAccessor> | boolean;
17
- /**
18
- * Options for the tick marks that represent the min/max range
19
- */
20
- tickMinMax: Record<string, ChannelAccessor> | boolean;
21
- /**
22
- * Options for the dot marks that represent the outliers
23
- */
24
- dot: Record<string, ChannelAccessor>;
25
- };
26
- import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types.js';
1
+ import type { ChannelAccessor, DataRecord } from '../types/index.js';
2
+ declare class __sveltets_Render<Datum extends DataRecord> {
3
+ props(): Pick<BaseMarkProps<Datum_1>, "class"> & {
4
+ data: Datum[];
5
+ x: ChannelAccessor;
6
+ y: ChannelAccessor;
7
+ /**
8
+ * Options for the rule marks that represent the min/max range
9
+ */
10
+ rule: Record<string, ChannelAccessor<Datum_1>>;
11
+ /**
12
+ * Options for the bar marks that represent the IQR range
13
+ */
14
+ bar: Record<string, ChannelAccessor<Datum_1>>;
15
+ /**
16
+ * Options for the tick marks that represent the median
17
+ */
18
+ tickMedian: Record<string, ChannelAccessor<Datum_1>> | boolean;
19
+ /**
20
+ * Options for the tick marks that represent the min/max range
21
+ */
22
+ tickMinMax: Record<string, ChannelAccessor<Datum_1>> | boolean;
23
+ /**
24
+ * Options for the dot marks that represent the outliers
25
+ */
26
+ dot: Record<string, ChannelAccessor<Datum_1>>;
27
+ };
28
+ events(): {};
29
+ slots(): {};
30
+ bindings(): "";
31
+ exports(): {};
32
+ }
33
+ interface $$IsomorphicComponent {
34
+ 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']>> & {
35
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
36
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
37
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
38
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
39
+ }
27
40
  /** Creates a vertical box plot for visualizing data distribution with quartiles and outliers */
28
- declare const BoxY: import("svelte").Component<BoxYMarkProps, {}, "">;
29
- type BoxY = ReturnType<typeof BoxY>;
41
+ declare const BoxY: $$IsomorphicComponent;
42
+ type BoxY<Datum extends DataRecord> = InstanceType<typeof BoxY<Datum>>;
30
43
  export default BoxY;
@@ -1,15 +1,21 @@
1
- <script module lang="ts">
2
- export type Brush = {
3
- x1?: Date | number;
4
- x2?: Date | number;
5
- y1?: Date | number;
6
- y2?: Date | number;
7
- enabled: boolean;
8
- };
9
-
10
- type BrushEvent = MouseEvent & { brush: Brush };
11
-
12
- export type BrushMarkProps = {
1
+ <!--
2
+ @component
3
+ For creating a two-dimensional brush selection
4
+ -->
5
+ <script lang="ts" generics="Datum extends DataRecord">
6
+ interface BrushMarkProps
7
+ extends Pick<
8
+ BaseMarkProps<Datum>,
9
+ | 'cursor'
10
+ | 'stroke'
11
+ | 'strokeDasharray'
12
+ | 'strokeOpacity'
13
+ | 'strokeWidth'
14
+ | 'strokeLinecap'
15
+ | 'strokeDashoffset'
16
+ | 'strokeLinejoin'
17
+ | 'strokeMiterlimit'
18
+ > {
13
19
  brush: Brush;
14
20
  /**
15
21
  * limit brushing to x or y dimension
@@ -26,26 +32,17 @@
26
32
  onbrushstart?: (evt: BrushEvent) => void;
27
33
  onbrushend?: (evt: BrushEvent) => void;
28
34
  onbrush?: (evt: BrushEvent) => void;
29
- } & Pick<
30
- BaseMarkProps,
31
- | 'cursor'
32
- | 'stroke'
33
- | 'strokeDasharray'
34
- | 'strokeOpacity'
35
- | 'strokeWidth'
36
- | 'strokeLinecap'
37
- | 'strokeDashoffset'
38
- | 'strokeLinejoin'
39
- | 'strokeMiterlimit'
40
- >;
41
- </script>
42
-
43
- <script lang="ts">
35
+ }
44
36
  import { getContext } from 'svelte';
45
- import Frame from './Frame.svelte';
46
37
  import Rect from './Rect.svelte';
47
- import type { BaseMarkProps, PlotContext, PlotDefaults } from '../types.js';
38
+ import type {
39
+ BaseMarkProps,
40
+ DataRecord,
41
+ PlotContext,
42
+ PlotDefaults
43
+ } from '../types/index.js';
48
44
  import { clientToLayerCoordinates } from './helpers/events.js';
45
+ import Frame from './Frame.svelte';
49
46
 
50
47
  let { brush = $bindable({ enabled: false }), ...markProps }: BrushMarkProps = $props();
51
48
 
@@ -59,7 +56,7 @@
59
56
  };
60
57
 
61
58
  const {
62
- data = [{}],
59
+ data = [{} as Datum],
63
60
  stroke,
64
61
  strokeWidth,
65
62
  strokeDasharray,
@@ -1,14 +1,5 @@
1
- export type Brush = {
2
- x1?: Date | number;
3
- x2?: Date | number;
4
- y1?: Date | number;
5
- y2?: Date | number;
6
- enabled: boolean;
7
- };
8
- type BrushEvent = MouseEvent & {
9
- brush: Brush;
10
- };
11
- export type BrushMarkProps = {
1
+ import type { BaseMarkProps, DataRecord } from '../types/index.js';
2
+ interface BrushMarkProps extends Pick<BaseMarkProps<Datum>, 'cursor' | 'stroke' | 'strokeDasharray' | 'strokeOpacity' | 'strokeWidth' | 'strokeLinecap' | 'strokeDashoffset' | 'strokeLinejoin' | 'strokeMiterlimit'> {
12
3
  brush: Brush;
13
4
  /**
14
5
  * limit brushing to x or y dimension
@@ -25,8 +16,22 @@ export type BrushMarkProps = {
25
16
  onbrushstart?: (evt: BrushEvent) => void;
26
17
  onbrushend?: (evt: BrushEvent) => void;
27
18
  onbrush?: (evt: BrushEvent) => void;
28
- } & Pick<BaseMarkProps, 'cursor' | 'stroke' | 'strokeDasharray' | 'strokeOpacity' | 'strokeWidth' | 'strokeLinecap' | 'strokeDashoffset' | 'strokeLinejoin' | 'strokeMiterlimit'>;
29
- import type { BaseMarkProps } from '../types.js';
30
- declare const Brush: import("svelte").Component<BrushMarkProps, {}, "brush">;
31
- type Brush = ReturnType<typeof Brush>;
19
+ }
20
+ declare class __sveltets_Render<Datum extends DataRecord> {
21
+ props(): BrushMarkProps;
22
+ events(): {};
23
+ slots(): {};
24
+ bindings(): "brush";
25
+ exports(): {};
26
+ }
27
+ interface $$IsomorphicComponent {
28
+ 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']>> & {
29
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
30
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
31
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
32
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
33
+ }
34
+ /** For creating a two-dimensional brush selection */
35
+ declare const Brush: $$IsomorphicComponent;
36
+ type Brush<Datum extends DataRecord> = InstanceType<typeof Brush<Datum>>;
32
37
  export default Brush;
@@ -1,11 +1,13 @@
1
- <script module lang="ts">
2
- export type BrushXMarkProps = Omit<BrushMarkProps, 'limitDimension'>;
3
- </script>
4
-
1
+ <!--
2
+ @component
3
+ For creating a brush that can be dragged horizontally
4
+ -->
5
5
  <script lang="ts">
6
- import Brush, { type BrushMarkProps } from './Brush.svelte';
7
- import type { PlotDefaults } from '../types.js';
8
- import { getContext } from 'svelte';
6
+ interface BrushXMarkProps extends Omit<ComponentProps<typeof Brush>, 'limitDimension'> {}
7
+
8
+ import Brush from './Brush.svelte';
9
+ import type { PlotDefaults } from '../types/index.js';
10
+ import { getContext, type ComponentProps } from 'svelte';
9
11
 
10
12
  let { brush = $bindable({ enabled: false }), ...options }: BrushXMarkProps = $props();
11
13
  const DEFAULTS = {
@@ -1,5 +1,8 @@
1
- export type BrushXMarkProps = Omit<BrushMarkProps, 'limitDimension'>;
2
- import { type BrushMarkProps } from './Brush.svelte';
1
+ import Brush from './Brush.svelte';
2
+ import { type ComponentProps } from 'svelte';
3
+ interface BrushXMarkProps extends Omit<ComponentProps<typeof Brush>, 'limitDimension'> {
4
+ }
5
+ /** For creating a brush that can be dragged horizontally */
3
6
  declare const BrushX: import("svelte").Component<BrushXMarkProps, {}, "brush">;
4
7
  type BrushX = ReturnType<typeof BrushX>;
5
8
  export default BrushX;