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
@@ -0,0 +1,158 @@
1
+ <script lang="ts">
2
+ import { resolveProp, resolveStyles } from '../../helpers/resolve';
3
+ import { getContext, type ComponentProps } from 'svelte';
4
+ import type { PlotContext, ScaledDataRecord, UsedScales } from '../..';
5
+ import type Text from '../Text.svelte';
6
+ import { CSS_VAR } from '../../constants';
7
+ import { maybeFromPixel, maybeFromRem } from '../../helpers/getBaseStyles';
8
+
9
+ const LINE_ANCHOR = {
10
+ bottom: 'auto',
11
+ middle: 'central',
12
+ top: 'hanging'
13
+ } as const;
14
+
15
+ const { getPlotState } = getContext<PlotContext>('svelteplot');
16
+ const plot = $derived(getPlotState());
17
+
18
+ let {
19
+ textLines,
20
+ d,
21
+ args,
22
+ usedScales
23
+ }: {
24
+ textLines: string[];
25
+ d: ScaledDataRecord;
26
+ args: ComponentProps<typeof Text>;
27
+ usedScales: UsedScales;
28
+ } = $props();
29
+
30
+ const title = $derived(resolveProp(args.title, d.datum, ''));
31
+ const frameAnchor = $derived(resolveProp(args.frameAnchor, d.datum));
32
+ const isLeft = $derived(
33
+ frameAnchor === 'left' || frameAnchor === 'top-left' || frameAnchor === 'bottom-left'
34
+ );
35
+ const isRight = $derived(
36
+ frameAnchor === 'right' || frameAnchor === 'top-right' || frameAnchor === 'bottom-right'
37
+ );
38
+ const isTop = $derived(
39
+ frameAnchor === 'top' || frameAnchor === 'top-left' || frameAnchor === 'top-right'
40
+ );
41
+ const isBottom = $derived(
42
+ frameAnchor === 'bottom' || frameAnchor === 'bottom-left' || frameAnchor === 'bottom-right'
43
+ );
44
+ const lineAnchor = $derived(
45
+ resolveProp(
46
+ args.lineAnchor,
47
+ d.datum,
48
+ args.y != null ? 'middle' : isTop ? 'top' : isBottom ? 'bottom' : 'middle'
49
+ )
50
+ );
51
+ const textClassName = $derived(resolveProp(args.textClass, d.datum, null));
52
+ const [x, y] = $derived(
53
+ args.x != null && args.y != null
54
+ ? [d.x, d.y]
55
+ : [
56
+ args.x != null
57
+ ? d.x
58
+ : isLeft
59
+ ? plot.options.marginLeft
60
+ : isRight
61
+ ? plot.options.marginLeft + plot.facetWidth
62
+ : plot.options.marginLeft + plot.facetWidth * 0.5,
63
+ args.y != null
64
+ ? d.y
65
+ : isTop
66
+ ? plot.options.marginTop
67
+ : isBottom
68
+ ? plot.options.marginTop + plot.facetHeight
69
+ : plot.options.marginTop + plot.facetHeight * 0.5
70
+ ]
71
+ );
72
+
73
+ const dx = $derived(+resolveProp(args.dx, d.datum, 0));
74
+ const dy = $derived(+resolveProp(args.dy, d.datum, 0));
75
+
76
+ const [style, styleClass] = $derived(
77
+ resolveStyles(
78
+ plot,
79
+ { ...d, __tspanIndex: 0 },
80
+ {
81
+ fontSize: 12,
82
+ fontWeight: 500,
83
+ strokeWidth: 1.6,
84
+ textAnchor: isLeft ? 'start' : isRight ? 'end' : 'middle',
85
+ ...args
86
+ },
87
+ 'fill',
88
+ usedScales
89
+ )
90
+ );
91
+
92
+ const fontSize = $derived(
93
+ textLines.length > 1 ? (resolveProp(args.fontSize, d.datum) ?? 12) : 0
94
+ );
95
+ let textElement: SVGTextElement | null = $state(null);
96
+
97
+ const rootFontSize = $derived(
98
+ textElement?.ownerDocument?.documentElement && textLines.length > 1
99
+ ? maybeFromPixel(getComputedStyle(textElement.ownerDocument.documentElement).fontSize)
100
+ : 14
101
+ );
102
+
103
+ const computedFontSize = $derived(
104
+ textElement && textLines.length > 1 && CSS_VAR.test(fontSize)
105
+ ? maybeFromRem(
106
+ maybeFromPixel(
107
+ getComputedStyle(textElement).getPropertyValue(
108
+ `--${fontSize.match(CSS_VAR)[1]}`
109
+ )
110
+ ),
111
+ rootFontSize
112
+ )
113
+ : fontSize
114
+ );
115
+
116
+ const lineHeight = $derived(
117
+ textLines.length > 1 ? (resolveProp(args.lineHeight, d.datum) ?? 1.2) : 0
118
+ );
119
+ </script>
120
+
121
+ {#if textLines.length > 1}
122
+ <!-- multiline text-->
123
+ <text
124
+ bind:this={textElement}
125
+ class={[textClassName]}
126
+ dominant-baseline={LINE_ANCHOR[lineAnchor]}
127
+ transform="translate({Math.round(x + dx)},{Math.round(
128
+ y +
129
+ dy -
130
+ (lineAnchor === 'bottom'
131
+ ? textLines.length - 1
132
+ : lineAnchor === 'middle'
133
+ ? (textLines.length - 1) * 0.5
134
+ : 0) *
135
+ computedFontSize *
136
+ lineHeight
137
+ )})"
138
+ >{#each textLines as line, l (l)}<tspan
139
+ x="0"
140
+ dy={l ? computedFontSize * lineHeight : 0}
141
+ class={styleClass}
142
+ {style}>{line}</tspan
143
+ >{/each}{#if title}<title>{title}</title>{/if}</text>
144
+ {:else}
145
+ <!-- singleline text-->
146
+ <text
147
+ class={[textClassName, styleClass]}
148
+ dominant-baseline={LINE_ANCHOR[lineAnchor]}
149
+ transform="translate({Math.round(x + dx)},{Math.round(y + dy)})"
150
+ {style}
151
+ >{textLines[0]}{#if title}<title>{title}</title>{/if}</text>
152
+ {/if}
153
+
154
+ <style>
155
+ text {
156
+ paint-order: stroke fill;
157
+ }
158
+ </style>
@@ -0,0 +1,12 @@
1
+ import { type ComponentProps } from 'svelte';
2
+ import type { ScaledDataRecord, UsedScales } from '../..';
3
+ import type Text from '../Text.svelte';
4
+ type $$ComponentProps = {
5
+ textLines: string[];
6
+ d: ScaledDataRecord;
7
+ args: ComponentProps<typeof Text>;
8
+ usedScales: UsedScales;
9
+ };
10
+ declare const MultilineText: import("svelte").Component<$$ComponentProps, {}, "">;
11
+ type MultilineText = ReturnType<typeof MultilineText>;
12
+ export default MultilineText;
@@ -1,7 +1,31 @@
1
1
  <!-- @component
2
2
  Helper component for rendering rectangular marks in SVG
3
3
  -->
4
- <script lang="ts">
4
+ <script lang="ts" generics="Datum extends DataRecord">
5
+ interface RectPathProps {
6
+ datum: ScaledDataRecord<Datum>;
7
+ class: string | null;
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ options: BaseRectMarkProps<Datum> & BaseMarkProps<Datum>;
13
+ /**
14
+ * By default, the `inset` property is applied to all four insets. Mark components
15
+ * can tweak this behavior for insetTop and insetBottom by setting the
16
+ * useInsetAsFallbackVertically prop to false.
17
+ */
18
+ useInsetAsFallbackVertically?: boolean;
19
+ /**
20
+ * By default, the `inset` property is applied to all four insets. Mark components
21
+ * can tweak this behavior for insetLeft and insetRight by setting the
22
+ * useInsetAsFallbackHorizontally prop to false.
23
+ */
24
+ useInsetAsFallbackHorizontally?: boolean;
25
+ usedScales: UsedScales;
26
+ fallbackStyle?: 'fill' | 'stroke';
27
+ }
28
+
5
29
  import { resolveProp, resolveStyles } from '../../helpers/resolve';
6
30
  import { roundedRect } from '../../helpers/roundedRect';
7
31
  import type {
@@ -10,8 +34,9 @@ Helper component for rendering rectangular marks in SVG
10
34
  BorderRadius,
11
35
  ScaledDataRecord,
12
36
  UsedScales,
13
- PlotContext
14
- } from '../../types';
37
+ PlotContext,
38
+ DataRecord
39
+ } from '../..';
15
40
  import { addEventHandlers } from './events';
16
41
  import { getContext } from 'svelte';
17
42
  import Anchor from './Anchor.svelte';
@@ -28,29 +53,7 @@ Helper component for rendering rectangular marks in SVG
28
53
  useInsetAsFallbackHorizontally = true,
29
54
  usedScales,
30
55
  fallbackStyle = 'fill'
31
- }: {
32
- datum: ScaledDataRecord;
33
- class: string | null;
34
- x: number;
35
- y: number;
36
- width: number;
37
- height: number;
38
- options: BaseRectMarkProps & BaseMarkProps;
39
- /**
40
- * By default, the `inset` property is applied to all four insets. Mark components
41
- * can tweak this behavior for insetTop and insetBottom by setting the
42
- * useInsetAsFallbackVertically prop to false.
43
- */
44
- useInsetAsFallbackVertically?: boolean;
45
- /**
46
- * By default, the `inset` property is applied to all four insets. Mark components
47
- * can tweak this behavior for insetLeft and insetRight by setting the
48
- * useInsetAsFallbackHorizontally prop to false.
49
- */
50
- useInsetAsFallbackHorizontally?: boolean;
51
- usedScales: UsedScales;
52
- fallbackStyle?: 'fill' | 'stroke';
53
- } = $props();
56
+ }: RectPathProps = $props();
54
57
 
55
58
  const { getPlotState } = getContext<PlotContext>('svelteplot');
56
59
  const plot = $derived(getPlotState());
@@ -1,28 +1,41 @@
1
- import type { BaseMarkProps, BaseRectMarkProps, ScaledDataRecord, UsedScales } from '../../types';
2
- type $$ComponentProps = {
3
- datum: ScaledDataRecord;
4
- class: string | null;
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- options: BaseRectMarkProps & BaseMarkProps;
10
- /**
11
- * By default, the `inset` property is applied to all four insets. Mark components
12
- * can tweak this behavior for insetTop and insetBottom by setting the
13
- * useInsetAsFallbackVertically prop to false.
14
- */
15
- useInsetAsFallbackVertically?: boolean;
16
- /**
17
- * By default, the `inset` property is applied to all four insets. Mark components
18
- * can tweak this behavior for insetLeft and insetRight by setting the
19
- * useInsetAsFallbackHorizontally prop to false.
20
- */
21
- useInsetAsFallbackHorizontally?: boolean;
22
- usedScales: UsedScales;
23
- fallbackStyle?: 'fill' | 'stroke';
24
- };
1
+ import type { BaseMarkProps, BaseRectMarkProps, ScaledDataRecord, UsedScales, DataRecord } from '../..';
2
+ declare class __sveltets_Render<Datum extends DataRecord> {
3
+ props(): {
4
+ datum: ScaledDataRecord<Datum_1>;
5
+ class: string | null;
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ options: BaseRectMarkProps<Datum_1> & BaseMarkProps<Datum_1>;
11
+ /**
12
+ * By default, the `inset` property is applied to all four insets. Mark components
13
+ * can tweak this behavior for insetTop and insetBottom by setting the
14
+ * useInsetAsFallbackVertically prop to false.
15
+ */
16
+ useInsetAsFallbackVertically?: boolean;
17
+ /**
18
+ * By default, the `inset` property is applied to all four insets. Mark components
19
+ * can tweak this behavior for insetLeft and insetRight by setting the
20
+ * useInsetAsFallbackHorizontally prop to false.
21
+ */
22
+ useInsetAsFallbackHorizontally?: boolean;
23
+ usedScales: UsedScales;
24
+ fallbackStyle?: "fill" | "stroke";
25
+ };
26
+ events(): {};
27
+ slots(): {};
28
+ bindings(): "";
29
+ exports(): {};
30
+ }
31
+ interface $$IsomorphicComponent {
32
+ 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']>> & {
33
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
34
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
35
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
36
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
37
+ }
25
38
  /** Helper component for rendering rectangular marks in SVG */
26
- declare const RectPath: import("svelte").Component<$$ComponentProps, {}, "">;
27
- type RectPath = ReturnType<typeof RectPath>;
39
+ declare const RectPath: $$IsomorphicComponent;
40
+ type RectPath<Datum extends DataRecord> = InstanceType<typeof RectPath<Datum>>;
28
41
  export default RectPath;
@@ -1,5 +1,10 @@
1
1
  <script module lang="ts">
2
- import type { BaseMarkProps, ChannelAccessor, FacetContext, PlotContext } from '../../types.js';
2
+ import type {
3
+ BaseMarkProps,
4
+ ChannelAccessor,
5
+ FacetContext,
6
+ PlotContext
7
+ } from '../../types/index.js';
3
8
 
4
9
  type RegressionType = 'linear' | 'quad' | 'poly' | 'exp' | 'log' | 'pow' | 'loess';
5
10
 
@@ -28,7 +33,7 @@
28
33
 
29
34
  <script lang="ts">
30
35
  import { getContext } from 'svelte';
31
- import { Line, Area } from '../../index.js';
36
+ import { Line, Area } from '../..';
32
37
 
33
38
  import {
34
39
  regressionLinear,
@@ -1,4 +1,4 @@
1
- import type { BaseMarkProps, ChannelAccessor } from '../../types.js';
1
+ import type { BaseMarkProps, ChannelAccessor } from '../../types/index.js';
2
2
  type RegressionType = 'linear' | 'quad' | 'poly' | 'exp' | 'log' | 'pow' | 'loess';
3
3
  export type RegressionMarkProps = BaseMarkProps & {
4
4
  x: ChannelAccessor;
@@ -18,9 +18,6 @@ export type RegressionMarkProps = BaseMarkProps & {
18
18
  span: number;
19
19
  confidence: number;
20
20
  };
21
- type $$ComponentProps = RegressionMarkProps & {
22
- dependent: 'x' | 'y';
23
- };
24
- declare const Regression: import("svelte").Component<$$ComponentProps, {}, "">;
21
+ declare const Regression: import("svelte").Component<any, {}, "">;
25
22
  type Regression = ReturnType<typeof Regression>;
26
23
  export default Regression;
@@ -1,4 +1,4 @@
1
- import type { BaseMarkProps, DataRecord, PlotState } from '../../types.js';
1
+ import type { BaseMarkProps, DataRecord, PlotState } from '../../types/index.js';
2
2
  declare global {
3
3
  interface MouseEvent {
4
4
  layerX?: number;
@@ -1,5 +1,5 @@
1
- import type { DataRecord, RawValue } from '../types.js';
2
- import type { TransformArg } from '../types.js';
1
+ import type { DataRecord, RawValue } from '../types/index.js';
2
+ import type { TransformArg } from '../types/index.js';
3
3
  import { type ThresholdCountGenerator } from 'd3-array';
4
4
  import { type ReducerName } from '../helpers/reduce.js';
5
5
  type NamedThresholdsGenerator = 'auto' | 'scott' | 'sturges' | 'freedman-diaconis';
@@ -1,4 +1,4 @@
1
- import type { DataRecord, TransformArg } from '../types.js';
1
+ import type { DataRecord, TransformArg } from '../types/index.js';
2
2
  export type BollingerOptions = {
3
3
  /**
4
4
  * the window size (the window transform’s k option), an integer; defaults to 20
@@ -11,69 +11,4 @@ export type BollingerOptions = {
11
11
  };
12
12
  export declare function bollingerX(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
13
13
  export declare function bollingerY(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
14
- export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): {
15
- filter?: import("../types.js").ConstantAccessor<boolean>;
16
- facet?: "auto" | "include" | "exclude" | undefined;
17
- fx?: import("../types.js").ChannelAccessor;
18
- fy?: import("../types.js").ChannelAccessor;
19
- dx?: import("../types.js").ConstantAccessor<number>;
20
- dy?: import("../types.js").ConstantAccessor<number>;
21
- fill?: import("../types.js").ConstantAccessor<string>;
22
- fillOpacity?: import("../types.js").ConstantAccessor<number>;
23
- sort?: string | import("../types.js").ConstantAccessor<import("../types.js").RawValue> | ((a: import("../types.js").RawValue, b: import("../types.js").RawValue) => number) | {
24
- channel: string;
25
- order?: "ascending" | "descending";
26
- };
27
- stroke?: import("../types.js").ConstantAccessor<string>;
28
- strokeWidth?: import("../types.js").ConstantAccessor<number>;
29
- strokeOpacity?: import("../types.js").ConstantAccessor<number>;
30
- strokeLinejoin?: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin>;
31
- strokeLinecap?: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinecap>;
32
- strokeMiterlimit?: import("../types.js").ConstantAccessor<number>;
33
- opacity?: import("../types.js").ConstantAccessor<number>;
34
- strokeDasharray?: import("../types.js").ConstantAccessor<string>;
35
- strokeDashoffset?: import("../types.js").ConstantAccessor<number>;
36
- mixBlendMode?: import("../types.js").ConstantAccessor<import("csstype").Property.MixBlendMode>;
37
- clipPath?: string | undefined;
38
- imageFilter?: import("../types.js").ConstantAccessor<string>;
39
- shapeRendering?: import("../types.js").ConstantAccessor<import("csstype").Property.ShapeRendering>;
40
- paintOrder?: import("../types.js").ConstantAccessor<string>;
41
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
42
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
43
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
44
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
45
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
46
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
47
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
48
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
49
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
50
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
51
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
52
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
53
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
54
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
55
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
56
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
57
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
58
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
59
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
60
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
61
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
62
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
63
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
64
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
65
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
66
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
67
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
68
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
69
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
70
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
71
- class?: string | null | undefined;
72
- cursor?: import("../types.js").ConstantAccessor<import("csstype").Property.Cursor>;
73
- data: {
74
- __x: import("../types.js").RawValue;
75
- __lo: number;
76
- __avg: number;
77
- __hi: number;
78
- }[];
79
- };
14
+ export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): any;
@@ -1,67 +1,9 @@
1
- import type { DataRecord, TransformArg } from '../types.js';
2
- export declare function geoCentroid({ data, ...options }: TransformArg<DataRecord>): {
3
- x: (d: any) => any;
4
- y: (d: any) => any;
5
- filter?: import("../types.js").ConstantAccessor<boolean>;
6
- facet?: "auto" | "include" | "exclude" | undefined;
7
- fx?: import("../types.js").ChannelAccessor;
8
- fy?: import("../types.js").ChannelAccessor;
9
- dx?: import("../types.js").ConstantAccessor<number>;
10
- dy?: import("../types.js").ConstantAccessor<number>;
11
- fill?: import("../types.js").ConstantAccessor<string>;
12
- fillOpacity?: import("../types.js").ConstantAccessor<number>;
13
- sort?: string | import("../types.js").ConstantAccessor<import("../types.js").RawValue> | ((a: import("../types.js").RawValue, b: import("../types.js").RawValue) => number) | {
14
- channel: string;
15
- order?: "ascending" | "descending";
16
- };
17
- stroke?: import("../types.js").ConstantAccessor<string>;
18
- strokeWidth?: import("../types.js").ConstantAccessor<number>;
19
- strokeOpacity?: import("../types.js").ConstantAccessor<number>;
20
- strokeLinejoin?: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin>;
21
- strokeLinecap?: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinecap>;
22
- strokeMiterlimit?: import("../types.js").ConstantAccessor<number>;
23
- opacity?: import("../types.js").ConstantAccessor<number>;
24
- strokeDasharray?: import("../types.js").ConstantAccessor<string>;
25
- strokeDashoffset?: import("../types.js").ConstantAccessor<number>;
26
- mixBlendMode?: import("../types.js").ConstantAccessor<import("csstype").Property.MixBlendMode>;
27
- clipPath?: string | undefined;
28
- imageFilter?: import("../types.js").ConstantAccessor<string>;
29
- shapeRendering?: import("../types.js").ConstantAccessor<import("csstype").Property.ShapeRendering>;
30
- paintOrder?: import("../types.js").ConstantAccessor<string>;
31
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
32
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
33
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
34
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
35
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
36
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
37
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
38
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
39
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
40
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
41
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
42
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
43
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
44
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
45
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
46
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
47
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
48
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
49
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
50
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
51
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
52
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
53
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
54
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
55
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
56
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
57
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
58
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
59
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
60
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
61
- class?: string | null | undefined;
62
- cursor?: import("../types.js").ConstantAccessor<import("csstype").Property.Cursor>;
63
- data: {
64
- __centroid__: [number, number];
65
- ___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
66
- }[];
1
+ import type { DataRecord, TransformArg } from '../types/index.js';
2
+ declare const CENTROID: unique symbol;
3
+ type WithCentroid<T> = T & {
4
+ [CENTROID]: [number, number];
67
5
  };
6
+ export declare function geoCentroid<Datum extends DataRecord>({ data, ...options }: {
7
+ data: Datum[];
8
+ } & TransformArg<Datum>): TransformArg<WithCentroid<Datum>>;
9
+ export {};
@@ -1,13 +1,16 @@
1
1
  import { resolveProp } from '../helpers/resolve.js';
2
2
  import { geoCentroid as d3GeoCentroid } from 'd3-geo';
3
+ const CENTROID = Symbol('centroid');
3
4
  export function geoCentroid({ data, ...options }) {
5
+ const transformedData = data.map((d) => ({
6
+ ...d,
7
+ [CENTROID]: d3GeoCentroid(resolveProp(options.geometry, d, d))
8
+ }));
9
+ const newOptions = { ...options };
4
10
  return {
5
- data: data.map((d) => ({
6
- ...d,
7
- __centroid__: d3GeoCentroid(resolveProp(options.geometry, d, d))
8
- })),
9
- ...options,
10
- x: (d) => d.__centroid__[0],
11
- y: (d) => d.__centroid__[1]
11
+ data: transformedData,
12
+ ...newOptions,
13
+ x: (d) => d[CENTROID][0],
14
+ y: (d) => d[CENTROID][1]
12
15
  };
13
16
  }
@@ -1,2 +1,2 @@
1
- import type { DataRecord, TransformArg } from '../types.js';
1
+ import type { DataRecord, TransformArg } from '../types/index.js';
2
2
  export declare function filter({ data, ...channels }: TransformArg<DataRecord>): TransformArg<DataRecord>;
@@ -1,5 +1,5 @@
1
1
  import { type ReducerName } from '../helpers/reduce.js';
2
- import type { DataRecord, DataRow, RawValue, TransformArg } from '../types.js';
2
+ import type { DataRecord, DataRow, RawValue, TransformArg } from '../types/index.js';
3
3
  type ReducerFunc = (group: DataRow[]) => RawValue;
4
4
  type ReducerOption = ReducerName | ReducerFunc;
5
5
  type GroupBaseOptions = {
@@ -38,29 +38,21 @@ type GroupZOptions = GroupXOptions | GroupYOptions;
38
38
  * groups the dataset by x and y channel and optionally reduces the group items
39
39
  * to output channels fill, stroke, r, opacity, fillOpacity, or strokeOpacity
40
40
  */
41
- export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): {
42
- data: DataRecord[];
43
- };
41
+ export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
44
42
  /**
45
43
  * groups the dataset by the x channel and optionally reduces the group items
46
44
  * to output channels y, y1, y2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
47
45
  */
48
- export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): {
49
- data: DataRecord[];
50
- };
46
+ export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
51
47
  /**
52
48
  * groups the dataset by the y channel and optionally reduces the group items
53
49
  * to output channels x, x1, x2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
54
50
  */
55
- export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): {
56
- data: DataRecord[];
57
- };
51
+ export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): any;
58
52
  /**
59
53
  * groups the dataset by the z channel and optionally reduces the group items
60
54
  * to output channels x, x1, x2, y, y1, y2, fill, stroke, r, opacity, fillOpacity,
61
55
  * or strokeOpacity
62
56
  */
63
- export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): {
64
- data: DataRecord[];
65
- };
57
+ export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): any;
66
58
  export {};