svelteplot 0.2.6-next.5 → 0.2.6-pr-67.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 (131) hide show
  1. package/dist/Mark.svelte +1 -1
  2. package/dist/Plot.svelte +1 -1
  3. package/dist/core/FacetGrid.svelte +2 -2
  4. package/dist/core/Plot.svelte +1 -0
  5. package/dist/helpers/colors.d.ts +1 -1
  6. package/dist/helpers/index.d.ts +2 -2
  7. package/dist/helpers/resolve.js +7 -4
  8. package/dist/helpers/scales.d.ts +1 -1
  9. package/dist/helpers/scales.js +2 -1
  10. package/dist/helpers/time.d.ts +4 -3
  11. package/dist/helpers/time.js +1 -1
  12. package/dist/helpers/typeChecks.d.ts +4 -4
  13. package/dist/marks/Area.svelte +17 -23
  14. package/dist/marks/Area.svelte.d.ts +9 -17
  15. package/dist/marks/AreaX.svelte +7 -6
  16. package/dist/marks/AreaX.svelte.d.ts +7 -6
  17. package/dist/marks/AreaY.svelte +7 -15
  18. package/dist/marks/AreaY.svelte.d.ts +7 -10
  19. package/dist/marks/Arrow.svelte +25 -25
  20. package/dist/marks/Arrow.svelte.d.ts +5 -8
  21. package/dist/marks/AxisX.svelte +50 -44
  22. package/dist/marks/AxisX.svelte.d.ts +4 -3
  23. package/dist/marks/AxisY.svelte +39 -31
  24. package/dist/marks/AxisY.svelte.d.ts +7 -4
  25. package/dist/marks/BarX.svelte +27 -12
  26. package/dist/marks/BarX.svelte.d.ts +17 -1
  27. package/dist/marks/BarY.svelte +21 -11
  28. package/dist/marks/BarY.svelte.d.ts +4 -4
  29. package/dist/marks/BollingerX.svelte +15 -7
  30. package/dist/marks/BollingerX.svelte.d.ts +3 -3
  31. package/dist/marks/BollingerY.svelte +9 -7
  32. package/dist/marks/BollingerY.svelte.d.ts +3 -3
  33. package/dist/marks/BoxX.svelte +3 -0
  34. package/dist/marks/BoxX.svelte.d.ts +1 -0
  35. package/dist/marks/BoxY.svelte +3 -0
  36. package/dist/marks/BoxY.svelte.d.ts +1 -0
  37. package/dist/marks/BrushX.svelte +5 -1
  38. package/dist/marks/BrushX.svelte.d.ts +2 -1
  39. package/dist/marks/BrushY.svelte +5 -1
  40. package/dist/marks/BrushY.svelte.d.ts +2 -1
  41. package/dist/marks/Cell.svelte +18 -21
  42. package/dist/marks/Cell.svelte.d.ts +3 -9
  43. package/dist/marks/CellX.svelte +7 -12
  44. package/dist/marks/CellX.svelte.d.ts +3 -1
  45. package/dist/marks/CellY.svelte +7 -12
  46. package/dist/marks/CellY.svelte.d.ts +3 -1
  47. package/dist/marks/ColorLegend.svelte +10 -8
  48. package/dist/marks/ColorLegend.svelte.d.ts +3 -5
  49. package/dist/marks/CustomMark.svelte +1 -1
  50. package/dist/marks/CustomMarkHTML.svelte +1 -1
  51. package/dist/marks/DifferenceY.svelte +22 -20
  52. package/dist/marks/DifferenceY.svelte.d.ts +5 -5
  53. package/dist/marks/Dot.svelte +17 -27
  54. package/dist/marks/Dot.svelte.d.ts +5 -15
  55. package/dist/marks/DotX.svelte +10 -9
  56. package/dist/marks/DotX.svelte.d.ts +4 -7
  57. package/dist/marks/DotY.svelte +9 -2
  58. package/dist/marks/DotY.svelte.d.ts +4 -3
  59. package/dist/marks/Frame.svelte +42 -31
  60. package/dist/marks/Frame.svelte.d.ts +8 -3
  61. package/dist/marks/Geo.svelte +18 -11
  62. package/dist/marks/Geo.svelte.d.ts +4 -3
  63. package/dist/marks/Graticule.svelte +15 -8
  64. package/dist/marks/Graticule.svelte.d.ts +2 -1
  65. package/dist/marks/GridX.svelte +11 -6
  66. package/dist/marks/GridX.svelte.d.ts +3 -2
  67. package/dist/marks/GridY.svelte +11 -3
  68. package/dist/marks/GridY.svelte.d.ts +3 -2
  69. package/dist/marks/HTMLTooltip.svelte +2 -1
  70. package/dist/marks/HTMLTooltip.svelte.d.ts +4 -0
  71. package/dist/marks/Line.svelte +9 -19
  72. package/dist/marks/Line.svelte.d.ts +6 -11
  73. package/dist/marks/LineX.svelte +5 -2
  74. package/dist/marks/LineX.svelte.d.ts +3 -2
  75. package/dist/marks/LineY.svelte +5 -2
  76. package/dist/marks/LineY.svelte.d.ts +3 -2
  77. package/dist/marks/Link.svelte +20 -19
  78. package/dist/marks/Link.svelte.d.ts +6 -6
  79. package/dist/marks/Rect.svelte +15 -12
  80. package/dist/marks/Rect.svelte.d.ts +3 -3
  81. package/dist/marks/RectX.svelte +10 -20
  82. package/dist/marks/RectX.svelte.d.ts +6 -12
  83. package/dist/marks/RectY.svelte +10 -20
  84. package/dist/marks/RectY.svelte.d.ts +6 -12
  85. package/dist/marks/RegressionX.svelte +10 -2
  86. package/dist/marks/RegressionX.svelte.d.ts +2 -0
  87. package/dist/marks/RegressionY.svelte +9 -2
  88. package/dist/marks/RegressionY.svelte.d.ts +2 -0
  89. package/dist/marks/RuleX.svelte +16 -13
  90. package/dist/marks/RuleX.svelte.d.ts +3 -4
  91. package/dist/marks/RuleY.svelte +16 -13
  92. package/dist/marks/RuleY.svelte.d.ts +3 -4
  93. package/dist/marks/Sphere.svelte +9 -2
  94. package/dist/marks/Sphere.svelte.d.ts +4 -59
  95. package/dist/marks/Spike.svelte +9 -1
  96. package/dist/marks/Spike.svelte.d.ts +2 -0
  97. package/dist/marks/SymbolLegend.svelte +1 -1
  98. package/dist/marks/Text.svelte +34 -35
  99. package/dist/marks/Text.svelte.d.ts +4 -7
  100. package/dist/marks/TickX.svelte +25 -20
  101. package/dist/marks/TickX.svelte.d.ts +3 -3
  102. package/dist/marks/TickY.svelte +25 -20
  103. package/dist/marks/TickY.svelte.d.ts +3 -3
  104. package/dist/marks/Vector.svelte +5 -5
  105. package/dist/marks/Vector.svelte.d.ts +2 -5
  106. package/dist/marks/helpers/BaseAxisX.svelte +1 -1
  107. package/dist/marks/helpers/LinearGradientX.svelte +1 -1
  108. package/dist/marks/helpers/LinearGradientY.svelte +1 -1
  109. package/dist/marks/helpers/MarkerPath.svelte +1 -1
  110. package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
  111. package/dist/marks/helpers/RectPath.svelte +17 -13
  112. package/dist/marks/helpers/RectPath.svelte.d.ts +1 -0
  113. package/dist/marks/helpers/events.js +3 -6
  114. package/dist/transforms/bollinger.d.ts +1 -8
  115. package/dist/transforms/centroid.d.ts +1 -8
  116. package/dist/transforms/group.d.ts +4 -12
  117. package/dist/transforms/index.d.ts +1 -0
  118. package/dist/transforms/index.js +1 -0
  119. package/dist/transforms/interval.d.ts +2 -6
  120. package/dist/transforms/jitter.d.ts +17 -0
  121. package/dist/transforms/jitter.js +60 -1
  122. package/dist/transforms/map.d.ts +4 -10
  123. package/dist/transforms/normalize.d.ts +2 -6
  124. package/dist/transforms/recordize.js +4 -4
  125. package/dist/transforms/select.d.ts +7 -21
  126. package/dist/transforms/sort.d.ts +3 -16
  127. package/dist/transforms/window.d.ts +2 -14
  128. package/dist/types.d.ts +13 -11
  129. package/dist/ui/RadioInput.svelte +1 -1
  130. package/dist/ui/Select.svelte +1 -1
  131. package/package.json +9 -9
@@ -1,3 +1,18 @@
1
+ <!-- @component
2
+ Renders horizontal rule lines at specified y positions with customizable horizontal range
3
+ -->
4
+ <script module lang="ts">
5
+ export type RuleYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
6
+ data: DataRecord[];
7
+ y?: ChannelAccessor;
8
+ x1?: ChannelAccessor;
9
+ x2?: ChannelAccessor;
10
+ inset?: ConstantAccessor<number>;
11
+ insetLeft?: ConstantAccessor<number>;
12
+ insetRight?: ConstantAccessor<number>;
13
+ };
14
+ </script>
15
+
1
16
  <script lang="ts">
2
17
  import Mark from '../Mark.svelte';
3
18
  import GroupMultiple from './helpers/GroupMultiple.svelte';
@@ -12,18 +27,6 @@
12
27
  ChannelAccessor
13
28
  } from '../types.js';
14
29
 
15
- type RuleYMarkProps = BaseMarkProps & {
16
- data: DataRecord[];
17
- y?: ChannelAccessor;
18
- x1?: ChannelAccessor;
19
- x2?: ChannelAccessor;
20
- inset?: ConstantAccessor<number>;
21
- insetLeft?: ConstantAccessor<number>;
22
- insetRight?: ConstantAccessor<number>;
23
- dx?: ConstantAccessor<number>;
24
- dy?: ConstantAccessor<number>;
25
- };
26
-
27
30
  let { data = [{}], class: className = null, ...options }: RuleYMarkProps = $props();
28
31
 
29
32
  const { getPlotState } = getContext<PlotContext>('svelteplot');
@@ -34,7 +37,7 @@
34
37
  <Mark type="ruleY" channels={['y', 'x1', 'x2', 'stroke', 'opacity', 'strokeOpacity']} {...args}>
35
38
  {#snippet children({ scaledData, usedScales })}
36
39
  <GroupMultiple class="rule-y {className || ''}" length={className ? 2 : args.data.length}>
37
- {#each scaledData as d}
40
+ {#each scaledData as d, i (i)}
38
41
  {@const inset = resolveProp(args.inset, d.datum, 0)}
39
42
  {@const insetLeft = resolveProp(args.insetLeft, d.datum, 0)}
40
43
  {@const insetRight = resolveProp(args.insetRight, d.datum, 0)}
@@ -1,5 +1,4 @@
1
- import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor } from '../types.js';
2
- type RuleYMarkProps = BaseMarkProps & {
1
+ export type RuleYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
3
2
  data: DataRecord[];
4
3
  y?: ChannelAccessor;
5
4
  x1?: ChannelAccessor;
@@ -7,9 +6,9 @@ type RuleYMarkProps = BaseMarkProps & {
7
6
  inset?: ConstantAccessor<number>;
8
7
  insetLeft?: ConstantAccessor<number>;
9
8
  insetRight?: ConstantAccessor<number>;
10
- dx?: ConstantAccessor<number>;
11
- dy?: ConstantAccessor<number>;
12
9
  };
10
+ import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor } from '../types.js';
11
+ /** Renders horizontal rule lines at specified y positions with customizable horizontal range */
13
12
  declare const RuleY: import("svelte").Component<RuleYMarkProps, {}, "">;
14
13
  type RuleY = ReturnType<typeof RuleY>;
15
14
  export default RuleY;
@@ -1,8 +1,15 @@
1
- <script lang="ts">
1
+ <!-- @component
2
+ Geo mark with Sphere geometry object -->
3
+
4
+ <script module lang="ts">
2
5
  import { type BaseMarkProps } from '../types.js';
6
+ export type SphereMarkProps = BaseMarkProps;
7
+ </script>
8
+
9
+ <script lang="ts">
3
10
  import Geo from './Geo.svelte';
4
11
 
5
- let { ...args }: BaseMarkProps = $props();
12
+ let { ...args }: SphereMarkProps = $props();
6
13
  </script>
7
14
 
8
15
  <Geo data={[{ type: 'Sphere' }]} {...args} geoType="sphere" />
@@ -1,61 +1,6 @@
1
- declare const Sphere: import("svelte").Component<Partial<{
2
- filter?: import("../types.js").ConstantAccessor<boolean>;
3
- facet?: "auto" | "include" | "exclude";
4
- fx: import("../types.js").ChannelAccessor;
5
- fy: import("../types.js").ChannelAccessor;
6
- dx: import("../types.js").ConstantAccessor<number>;
7
- dy: import("../types.js").ConstantAccessor<number>;
8
- fill: import("../types.js").ConstantAccessor<string>;
9
- fillOpacity: import("../types.js").ConstantAccessor<number>;
10
- stroke: import("../types.js").ConstantAccessor<string>;
11
- strokeWidth: import("../types.js").ConstantAccessor<number>;
12
- strokeOpacity: import("../types.js").ConstantAccessor<number>;
13
- strokeLinejoin: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin>;
14
- strokeLinecap: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinecap>;
15
- strokeMiterlimit: import("../types.js").ConstantAccessor<number>;
16
- opacity: import("../types.js").ConstantAccessor<number>;
17
- strokeDasharray: import("../types.js").ConstantAccessor<string>;
18
- strokeDashoffset: import("../types.js").ConstantAccessor<number>;
19
- mixBlendMode: import("../types.js").ConstantAccessor<import("csstype").Property.MixBlendMode>;
20
- clipPath: string;
21
- imageFilter: import("../types.js").ConstantAccessor<string>;
22
- shapeRendering: import("../types.js").ConstantAccessor<import("csstype").Property.ShapeRendering>;
23
- paintOrder: import("../types.js").ConstantAccessor<string>;
24
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
25
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
26
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
27
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
28
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
29
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
30
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
31
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
32
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- title: import("../types.js").ConstantAccessor<string>;
55
- href: import("../types.js").ConstantAccessor<string>;
56
- target: import("../types.js").ConstantAccessor<"_self" | "_blank" | string>;
57
- class: string;
58
- cursor: import("../types.js").ConstantAccessor<import("csstype").Property.Cursor>;
59
- }>, {}, "">;
1
+ import { type BaseMarkProps } from '../types.js';
2
+ export type SphereMarkProps = BaseMarkProps;
3
+ /** Geo mark with Sphere geometry object */
4
+ declare const Sphere: import("svelte").Component<BaseMarkProps, {}, "">;
60
5
  type Sphere = ReturnType<typeof Sphere>;
61
6
  export default Sphere;
@@ -1,6 +1,14 @@
1
+ <!--
2
+ @component
3
+ Wrapper around the vector mark with presets suitable for spike maps
4
+ -->
5
+ <script module lang="ts">
6
+ export type SpikeMarkProps = VectorMarkProps;
7
+ </script>
8
+
1
9
  <script lang="ts">
2
10
  import Vector, { type VectorMarkProps } from './Vector.svelte';
3
- let { data = [{}], ...options }: VectorMarkProps = $props();
11
+ let { data = [{}], ...options }: SpikeMarkProps = $props();
4
12
  </script>
5
13
 
6
14
  <Vector
@@ -1,4 +1,6 @@
1
+ export type SpikeMarkProps = VectorMarkProps;
1
2
  import { type VectorMarkProps } from './Vector.svelte';
3
+ /** Wrapper around the vector mark with presets suitable for spike maps */
2
4
  declare const Spike: import("svelte").Component<VectorMarkProps, {}, "">;
3
5
  type Spike = ReturnType<typeof Spike>;
4
6
  export default Spike;
@@ -19,7 +19,7 @@
19
19
 
20
20
  {#if plot.scales.color.manualActiveMarks > 0}
21
21
  <div class="symbol-legend">
22
- {#each plot.scales.color.domain as value}
22
+ {#each plot.scales.color.domain as value (value)}
23
23
  {@const symbolV = plot.scales.symbol.fn(value)}
24
24
  {@const symbolType = maybeSymbol(symbolV)}
25
25
  {@const color = plot.colorSymbolRedundant
@@ -1,26 +1,13 @@
1
- <script lang="ts">
2
- import { getContext, type Snippet } from 'svelte';
3
- import GroupMultiple from './helpers/GroupMultiple.svelte';
4
- import type {
5
- PlotContext,
6
- DataRecord,
7
- BaseMarkProps,
8
- ConstantAccessor,
9
- ChannelAccessor
10
- } from '../types.js';
11
- import { resolveProp, resolveStyles } from '../helpers/resolve.js';
12
- import Mark from '../Mark.svelte';
13
- import { sort } from '../index.js';
14
-
15
- type TextMarkProps = BaseMarkProps & {
1
+ <!--
2
+ @component
3
+ Useful for adding SVG text labels to your plot.
4
+ -->
5
+ <script module lang="ts">
6
+ export type TextMarkProps = BaseMarkProps & {
16
7
  data: DataRecord[];
17
8
  x: ChannelAccessor;
18
9
  y: ChannelAccessor;
19
- fill?: ChannelAccessor;
20
- stroke?: ChannelAccessor;
21
10
  children?: Snippet;
22
- dx?: ConstantAccessor<number>;
23
- dy?: ConstantAccessor<number>;
24
11
  text: ConstantAccessor<string>;
25
12
  title?: ConstantAccessor<string>;
26
13
  /**
@@ -42,6 +29,21 @@
42
29
  | 'bottom-right'
43
30
  >;
44
31
  };
32
+ </script>
33
+
34
+ <script lang="ts">
35
+ import { getContext, type Snippet } from 'svelte';
36
+ import GroupMultiple from './helpers/GroupMultiple.svelte';
37
+ import type {
38
+ PlotContext,
39
+ DataRecord,
40
+ BaseMarkProps,
41
+ ConstantAccessor,
42
+ ChannelAccessor
43
+ } from '../types.js';
44
+ import { resolveProp, resolveStyles } from '../helpers/resolve.js';
45
+ import Mark from '../Mark.svelte';
46
+ import { sort } from '../index.js';
45
47
 
46
48
  let { data = [{}], class: className = null, ...options }: TextMarkProps = $props();
47
49
 
@@ -78,7 +80,7 @@
78
80
  {...args}>
79
81
  {#snippet children({ mark, scaledData, usedScales })}
80
82
  <GroupMultiple class="text {className || null}" length={className ? 2 : args.data.length}>
81
- {#each scaledData as d}
83
+ {#each scaledData as d, i (i)}
82
84
  {#if d.valid}
83
85
  {@const title = resolveProp(args.title, d.datum, '')}
84
86
  {@const frameAnchor = resolveProp(args.frameAnchor, d.datum)}
@@ -148,20 +150,17 @@
148
150
  <text
149
151
  class={[textClassName]}
150
152
  dominant-baseline={LINE_ANCHOR[lineAnchor]}
151
- transform="translate({[
152
- Math.round(x + dx),
153
- Math.round(
154
- y +
155
- dy -
156
- (lineAnchor === 'bottom'
157
- ? textLines.length - 1
158
- : lineAnchor === 'middle'
159
- ? (textLines.length - 1) * 0.5
160
- : 0) *
161
- fontSize
162
- )
163
- ]})"
164
- >{#each textLines as line, l}<tspan
153
+ transform="translate({Math.round(x + dx)},{Math.round(
154
+ y +
155
+ dy -
156
+ (lineAnchor === 'bottom'
157
+ ? textLines.length - 1
158
+ : lineAnchor === 'middle'
159
+ ? (textLines.length - 1) * 0.5
160
+ : 0) *
161
+ fontSize
162
+ )})"
163
+ >{#each textLines as line, l (l)}<tspan
165
164
  x="0"
166
165
  dy={l ? fontSize : 0}
167
166
  class={styleClass}
@@ -172,7 +171,7 @@
172
171
  <text
173
172
  class={[textClassName, styleClass]}
174
173
  dominant-baseline={LINE_ANCHOR[lineAnchor]}
175
- transform="translate({[Math.round(x + dx), Math.round(y + dy)]})"
174
+ transform="translate({Math.round(x + dx)},{Math.round(y + dy)})"
176
175
  {style}
177
176
  >{textLines[0]}{#if title}<title>{title}</title>{/if}</text>
178
177
  {/if}
@@ -1,14 +1,8 @@
1
- import { type Snippet } from 'svelte';
2
- import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor } from '../types.js';
3
- type TextMarkProps = BaseMarkProps & {
1
+ export type TextMarkProps = BaseMarkProps & {
4
2
  data: DataRecord[];
5
3
  x: ChannelAccessor;
6
4
  y: ChannelAccessor;
7
- fill?: ChannelAccessor;
8
- stroke?: ChannelAccessor;
9
5
  children?: Snippet;
10
- dx?: ConstantAccessor<number>;
11
- dy?: ConstantAccessor<number>;
12
6
  text: ConstantAccessor<string>;
13
7
  title?: ConstantAccessor<string>;
14
8
  /**
@@ -21,6 +15,9 @@ type TextMarkProps = BaseMarkProps & {
21
15
  lineAnchor?: ConstantAccessor<'bottom' | 'top' | 'middle'>;
22
16
  frameAnchor?: ConstantAccessor<'bottom' | 'top' | 'left' | 'right' | 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'>;
23
17
  };
18
+ import { type Snippet } from 'svelte';
19
+ import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor } from '../types.js';
20
+ /** Useful for adding SVG text labels to your plot. */
24
21
  declare const Text: import("svelte").Component<TextMarkProps, {}, "">;
25
22
  type Text = ReturnType<typeof Text>;
26
23
  export default Text;
@@ -1,3 +1,27 @@
1
+ <!--
2
+ @component
3
+ The TickX mark is useful for showing one-dimensional distributions along the x axis. The y axis must be a band scale.
4
+ -->
5
+ <script module lang="ts">
6
+ export type TickXMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
7
+ data: DataRow[];
8
+ /**
9
+ * the horizontal position; bound to the x scale
10
+ */
11
+ x?: ChannelAccessor;
12
+ /**
13
+ * the vertical position; bound to the y scale, which must be band. If the y channel
14
+ * is not specified, the tick will span the full vertical extent of the frame.
15
+ */
16
+ y?: ChannelAccessor;
17
+ /**
18
+ * if ticks are used on a non-bandwidth scale, this will determine the
19
+ * length of the tick. Defaults to 10 pixel
20
+ */
21
+ tickLength?: ConstantAccessor<number>;
22
+ };
23
+ </script>
24
+
1
25
  <script lang="ts">
2
26
  import Mark from '../Mark.svelte';
3
27
  import { getContext } from 'svelte';
@@ -17,25 +41,6 @@
17
41
  const { getPlotState } = getContext<PlotContext>('svelteplot');
18
42
  let plot = $derived(getPlotState());
19
43
 
20
- type TickXMarkProps = BaseMarkProps & {
21
- data: DataRow[];
22
- /**
23
- * the horizontal position; bound to the x scale
24
- */
25
- x?: ChannelAccessor;
26
- /**
27
- * the vertical position; bound to the y scale, which must be band. If the y channel
28
- * is not specified, the tick will span the full vertical extent of the frame.
29
- */
30
- y?: ChannelAccessor;
31
- stroke?: ChannelAccessor;
32
- /**
33
- * if ticks are used on a non-bandwidth scale, this will determine the
34
- * length of the tick. Defaults to 10 pixel
35
- */
36
- tickLength?: ConstantAccessor<number>;
37
- };
38
-
39
44
  let { data = [{}], ...options }: TickXMarkProps = $props();
40
45
 
41
46
  let args = $derived(recordizeX({ data, ...options }, { withIndex: false }));
@@ -47,7 +52,7 @@
47
52
  <Mark type="tickX" channels={['x', 'y', 'stroke', 'opacity', 'strokeOpacity']} {...args}>
48
53
  {#snippet children({ mark, usedScales })}
49
54
  <g class="tick-x">
50
- {#each args.data as datum}
55
+ {#each args.data as datum, i (i)}
51
56
  {#if testFacet(datum, mark.options) && testFilter(datum, args)}
52
57
  {@const x_ = resolveChannel('x', datum, args)}
53
58
  {@const y_ = resolveChannel('y', datum, args)}
@@ -1,5 +1,4 @@
1
- import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
2
- type TickXMarkProps = BaseMarkProps & {
1
+ export type TickXMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
3
2
  data: DataRow[];
4
3
  /**
5
4
  * the horizontal position; bound to the x scale
@@ -10,13 +9,14 @@ type TickXMarkProps = BaseMarkProps & {
10
9
  * is not specified, the tick will span the full vertical extent of the frame.
11
10
  */
12
11
  y?: ChannelAccessor;
13
- stroke?: ChannelAccessor;
14
12
  /**
15
13
  * if ticks are used on a non-bandwidth scale, this will determine the
16
14
  * length of the tick. Defaults to 10 pixel
17
15
  */
18
16
  tickLength?: ConstantAccessor<number>;
19
17
  };
18
+ import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
19
+ /** The TickX mark is useful for showing one-dimensional distributions along the x axis. The y axis must be a band scale. */
20
20
  declare const TickX: import("svelte").Component<TickXMarkProps, {}, "">;
21
21
  type TickX = ReturnType<typeof TickX>;
22
22
  export default TickX;
@@ -1,3 +1,27 @@
1
+ <!--
2
+ @component
3
+ The TickY mark is useful for showing one-dimensional distributions along the y axis. The x axis must be a band scale.
4
+ -->
5
+ <script module lang="ts">
6
+ export type TickYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
7
+ data: DataRow[];
8
+ /**
9
+ * the vertical position; bound to the x scale
10
+ */
11
+ y?: ChannelAccessor;
12
+ /**
13
+ * the horizontal position; bound to the x scale, which must be band. If the x channel
14
+ * is not specified, the tick will span the full horizontal extent of the frame.
15
+ */
16
+ x?: ChannelAccessor;
17
+ /**
18
+ * if ticks are used on a non-bandwidth scale, this will determine the
19
+ * length of the tick. Defaults to 10 pixel
20
+ */
21
+ tickLength?: ConstantAccessor<number>;
22
+ };
23
+ </script>
24
+
1
25
  <script lang="ts">
2
26
  import Mark from '../Mark.svelte';
3
27
  import { getContext } from 'svelte';
@@ -18,25 +42,6 @@
18
42
  const { getPlotState } = getContext<PlotContext>('svelteplot');
19
43
  let plot = $derived(getPlotState());
20
44
 
21
- type TickYMarkProps = BaseMarkProps & {
22
- data: DataRow[];
23
- /**
24
- * the vertical position; bound to the x scale
25
- */
26
- y?: ChannelAccessor;
27
- /**
28
- * the horizontal position; bound to the x scale, which must be band. If the x channel
29
- * is not specified, the tick will span the full horizontal extent of the frame.
30
- */
31
- x?: ChannelAccessor;
32
- stroke?: ChannelAccessor;
33
- /**
34
- * if ticks are used on a non-bandwidth scale, this will determine the
35
- * length of the tick. Defaults to 10 pixel
36
- */
37
- tickLength?: ConstantAccessor<number>;
38
- };
39
-
40
45
  let { data = [{}], ...options }: TickYMarkProps = $props();
41
46
 
42
47
  let args = $derived(recordizeY({ data, ...options }, { withIndex: false }));
@@ -48,7 +53,7 @@
48
53
  <Mark type="tickY" channels={['x', 'y', 'stroke', 'opacity', 'strokeOpacity']} {...args}>
49
54
  {#snippet children({ mark, usedScales })}
50
55
  <g class="tick-y">
51
- {#each args.data as datum}
56
+ {#each args.data as datum, i (i)}
52
57
  {#if testFacet(datum, mark.options) && testFilter(datum, args)}
53
58
  {@const y_ = resolveChannel('y', datum, args)}
54
59
  {@const x_ = resolveChannel('x', datum, args)}
@@ -1,5 +1,4 @@
1
- import type { BaseMarkProps, ChannelAccessor, DataRow, ConstantAccessor } from '../types.js';
2
- type TickYMarkProps = BaseMarkProps & {
1
+ export type TickYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
3
2
  data: DataRow[];
4
3
  /**
5
4
  * the vertical position; bound to the x scale
@@ -10,13 +9,14 @@ type TickYMarkProps = BaseMarkProps & {
10
9
  * is not specified, the tick will span the full horizontal extent of the frame.
11
10
  */
12
11
  x?: ChannelAccessor;
13
- stroke?: ChannelAccessor;
14
12
  /**
15
13
  * if ticks are used on a non-bandwidth scale, this will determine the
16
14
  * length of the tick. Defaults to 10 pixel
17
15
  */
18
16
  tickLength?: ConstantAccessor<number>;
19
17
  };
18
+ import type { BaseMarkProps, ChannelAccessor, DataRow, ConstantAccessor } from '../types.js';
19
+ /** The TickY mark is useful for showing one-dimensional distributions along the y axis. The x axis must be a band scale. */
20
20
  declare const TickY: import("svelte").Component<TickYMarkProps, {}, "">;
21
21
  type TickY = ReturnType<typeof TickY>;
22
22
  export default TickY;
@@ -1,3 +1,7 @@
1
+ <!--
2
+ @component
3
+ The vector mark lets you place shapes (like arrows) on your plot.
4
+ -->
1
5
  <script lang="ts" module>
2
6
  import type {
3
7
  PlotContext,
@@ -21,8 +25,6 @@
21
25
  r?: number;
22
26
  length?: ChannelAccessor;
23
27
  rotate?: ChannelAccessor;
24
- fill?: ChannelAccessor;
25
- stroke?: ChannelAccessor;
26
28
  /**
27
29
  * Controls where the vector is anchored in relation to the x, y position.
28
30
  * If set to 'start', the arrow will start at the x, y position. If set to
@@ -32,8 +34,6 @@
32
34
  anchor: 'start' | 'middle' | 'end';
33
35
  shape?: 'arrow' | 'spike' | 'arrow-filled' | ShapeRenderer;
34
36
  children?: Snippet;
35
- dx?: ConstantAccessor<number>;
36
- dy?: ConstantAccessor<number>;
37
37
  canvas?: boolean;
38
38
  };
39
39
  </script>
@@ -170,7 +170,7 @@
170
170
  <text x="30" y="30" style="color:red"
171
171
  >implement canvas rendering for vector mark</text>
172
172
  {:else}
173
- {#each scaledData as d}
173
+ {#each scaledData as d, i (i)}
174
174
  {@const r = resolveChannel('r', d.datum, { r: 3, ...args })}
175
175
  {#if d.valid && isValid(r)}
176
176
  {@const dx = +resolveProp(args.dx, d.datum, 0)}
@@ -1,4 +1,4 @@
1
- import type { DataRecord, BaseMarkProps, ConstantAccessor, ChannelAccessor } from '../types.js';
1
+ import type { DataRecord, BaseMarkProps, ChannelAccessor } from '../types.js';
2
2
  type D3Path = ReturnType<typeof import('d3-path').path>;
3
3
  export type ShapeRenderer = {
4
4
  draw(context: D3Path, l: number, r: number): void;
@@ -10,8 +10,6 @@ export type VectorMarkProps = BaseMarkProps & {
10
10
  r?: number;
11
11
  length?: ChannelAccessor;
12
12
  rotate?: ChannelAccessor;
13
- fill?: ChannelAccessor;
14
- stroke?: ChannelAccessor;
15
13
  /**
16
14
  * Controls where the vector is anchored in relation to the x, y position.
17
15
  * If set to 'start', the arrow will start at the x, y position. If set to
@@ -21,11 +19,10 @@ export type VectorMarkProps = BaseMarkProps & {
21
19
  anchor: 'start' | 'middle' | 'end';
22
20
  shape?: 'arrow' | 'spike' | 'arrow-filled' | ShapeRenderer;
23
21
  children?: Snippet;
24
- dx?: ConstantAccessor<number>;
25
- dy?: ConstantAccessor<number>;
26
22
  canvas?: boolean;
27
23
  };
28
24
  import { type Snippet } from 'svelte';
25
+ /** The vector mark lets you place shapes (like arrows) on your plot. */
29
26
  declare const Vector: import("svelte").Component<VectorMarkProps, {}, "">;
30
27
  type Vector = ReturnType<typeof Vector>;
31
28
  export default Vector;
@@ -198,7 +198,7 @@
198
198
  {#if textLines.length === 1}
199
199
  {textLines[0]}
200
200
  {:else}
201
- {#each textLines as line, i}
201
+ {#each textLines as line, i (i)}
202
202
  <tspan x="0" dy={i ? 12 : 0}
203
203
  >{!prevTextLines || prevTextLines[i] !== line
204
204
  ? line
@@ -21,7 +21,7 @@
21
21
  </script>
22
22
 
23
23
  <linearGradient {id} gradientUnits="userSpaceOnUse" x1={0} y2={0} y1={0} x2={plot.width}>
24
- {#each projectedStops as { px, color }}
24
+ {#each projectedStops as { px, color }, i (i)}
25
25
  <stop stop-color={color} offset={px} />
26
26
  {/each}
27
27
  </linearGradient>
@@ -21,7 +21,7 @@
21
21
  </script>
22
22
 
23
23
  <linearGradient {id} gradientUnits="userSpaceOnUse" x1={0} x2={0} y1={0} y2={plot.height}>
24
- {#each projectedStops as { py, color }}
24
+ {#each projectedStops as { py, color }, i (i)}
25
25
  <stop stop-color={color} offset={py} />
26
26
  {/each}
27
27
  </linearGradient>
@@ -96,7 +96,7 @@
96
96
  class={className}
97
97
  stroke-width={strokeWidth_}
98
98
  use:addEventHandlers={{ getPlotState, options: mark.options, datum }}>
99
- {#each Object.entries( { start: markerStart, mid: markerMid, end: markerEnd, all: marker } ) as [key, marker]}
99
+ {#each Object.entries( { start: markerStart, mid: markerMid, end: markerEnd, all: marker } ) as [key, marker] (key)}
100
100
  {@const markerId = `marker-${key === 'all' ? '' : `${key}-`}${id}`}
101
101
  {#if isSnippet(marker)}
102
102
  {@render marker(markerId, color)}
@@ -1,44 +1,4 @@
1
- import { type MarkerShape } from './Marker.svelte';
2
- import type { BaseMarkProps, ConstantAccessor, DataRecord, Mark, PlotScales } from '../../types.js';
3
- type MarkerPathProps = BaseMarkProps & {
4
- /**
5
- * the datum associated with this path, usually the first
6
- * element of the data array group
7
- */
8
- datum: DataRecord;
9
- /**
10
- * the marker shape to use at the start of the path, defaults to
11
- * circle
12
- */
13
- markerStart?: boolean | MarkerShape;
14
- /**
15
- * the marker shape to use at the middle of the path, defaults to circle
16
- */
17
- markerMid?: boolean | MarkerShape;
18
- /**
19
- * the marker shape to use at the end of the path, defaults to circle
20
- */
21
- markerEnd?: boolean | MarkerShape;
22
- /**
23
- * shorthand for setting all markers
24
- */
25
- marker?: boolean | MarkerShape;
26
- /**
27
- * path string
28
- */
29
- d: string;
30
- style: string;
31
- startOffset: string;
32
- textStyle: string;
33
- textStyleClass?: string | null;
34
- text: string;
35
- transform: string;
36
- color: string;
37
- strokeWidth: ConstantAccessor<number>;
38
- mark: Mark<BaseMarkProps>;
39
- scales: PlotScales;
40
- };
41
1
  /** Helper component for paths with markers and optional text along the path. */
42
- declare const MarkerPath: import("svelte").Component<MarkerPathProps, {}, "">;
2
+ declare const MarkerPath: import("svelte").Component<any, {}, "">;
43
3
  type MarkerPath = ReturnType<typeof MarkerPath>;
44
4
  export default MarkerPath;