svelteplot 0.8.1 → 0.9.0-pr-309.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/README.md +4 -3
  2. package/dist/Mark.svelte +1 -1
  3. package/dist/Mark.svelte.d.ts +6 -4
  4. package/dist/constants.d.ts +3 -1
  5. package/dist/constants.js +11 -2
  6. package/dist/core/Plot.svelte +4 -4
  7. package/dist/helpers/autoScales.d.ts +1 -1
  8. package/dist/helpers/callWithProps.d.ts +1 -3
  9. package/dist/helpers/callWithProps.js +5 -3
  10. package/dist/helpers/colors.d.ts +9 -12
  11. package/dist/helpers/facets.d.ts +1 -1
  12. package/dist/helpers/getBaseStyles.d.ts +2 -4
  13. package/dist/helpers/index.d.ts +3 -3
  14. package/dist/helpers/projection.js +7 -2
  15. package/dist/helpers/reduce.d.ts +1 -1
  16. package/dist/helpers/scales.d.ts +7 -7
  17. package/dist/helpers/symbols.d.ts +2 -2
  18. package/dist/helpers/time.d.ts +3 -3
  19. package/dist/helpers/typeChecks.d.ts +8 -8
  20. package/dist/hooks/usePlot.svelte.d.ts +51 -0
  21. package/dist/hooks/usePlot.svelte.js +90 -0
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/marks/Area.svelte +3 -5
  25. package/dist/marks/Area.svelte.d.ts +6 -4
  26. package/dist/marks/AreaX.svelte.d.ts +7 -5
  27. package/dist/marks/Arrow.svelte +3 -5
  28. package/dist/marks/Arrow.svelte.d.ts +6 -4
  29. package/dist/marks/AxisX.svelte +2 -3
  30. package/dist/marks/AxisX.svelte.d.ts +7 -5
  31. package/dist/marks/AxisY.svelte +3 -4
  32. package/dist/marks/AxisY.svelte.d.ts +7 -5
  33. package/dist/marks/BarX.svelte +2 -4
  34. package/dist/marks/BarX.svelte.d.ts +6 -4
  35. package/dist/marks/BarY.svelte +2 -4
  36. package/dist/marks/BarY.svelte.d.ts +6 -4
  37. package/dist/marks/BollingerX.svelte.d.ts +2 -76
  38. package/dist/marks/BollingerY.svelte.d.ts +2 -76
  39. package/dist/marks/BoxX.svelte +4 -138
  40. package/dist/marks/BoxY.svelte +20 -137
  41. package/dist/marks/BoxY.svelte.d.ts +6 -64
  42. package/dist/marks/Brush.svelte +3 -3
  43. package/dist/marks/Brush.svelte.d.ts +1 -63
  44. package/dist/marks/Cell.svelte +2 -4
  45. package/dist/marks/Cell.svelte.d.ts +6 -4
  46. package/dist/marks/ColorLegend.svelte +2 -4
  47. package/dist/marks/CustomMark.svelte.d.ts +2 -84
  48. package/dist/marks/CustomMarkHTML.svelte +5 -10
  49. package/dist/marks/DifferenceY.svelte +3 -5
  50. package/dist/marks/DifferenceY.svelte.d.ts +1 -63
  51. package/dist/marks/Dot.svelte +4 -5
  52. package/dist/marks/Dot.svelte.d.ts +6 -4
  53. package/dist/marks/DotX.svelte.d.ts +7 -5
  54. package/dist/marks/DotY.svelte.d.ts +7 -5
  55. package/dist/marks/Frame.svelte +3 -9
  56. package/dist/marks/Frame.svelte.d.ts +7 -5
  57. package/dist/marks/Geo.svelte +5 -5
  58. package/dist/marks/Geo.svelte.d.ts +7 -4
  59. package/dist/marks/GridX.svelte +3 -10
  60. package/dist/marks/GridX.svelte.d.ts +6 -4
  61. package/dist/marks/GridY.svelte +3 -4
  62. package/dist/marks/GridY.svelte.d.ts +6 -4
  63. package/dist/marks/HTMLTooltip.svelte +5 -5
  64. package/dist/marks/Image.svelte.d.ts +2 -75
  65. package/dist/marks/Line.svelte +7 -6
  66. package/dist/marks/Line.svelte.d.ts +6 -4
  67. package/dist/marks/LineX.svelte.d.ts +8 -6
  68. package/dist/marks/LineY.svelte.d.ts +8 -6
  69. package/dist/marks/Link.svelte +2 -4
  70. package/dist/marks/Link.svelte.d.ts +6 -4
  71. package/dist/marks/Pointer.svelte +4 -4
  72. package/dist/marks/Rect.svelte +2 -4
  73. package/dist/marks/Rect.svelte.d.ts +6 -4
  74. package/dist/marks/RectX.svelte +4 -4
  75. package/dist/marks/RectY.svelte +4 -4
  76. package/dist/marks/RuleX.svelte +2 -4
  77. package/dist/marks/RuleX.svelte.d.ts +6 -4
  78. package/dist/marks/RuleY.svelte +2 -4
  79. package/dist/marks/RuleY.svelte.d.ts +6 -4
  80. package/dist/marks/Spike.svelte.d.ts +7 -5
  81. package/dist/marks/SymbolLegend.svelte +2 -4
  82. package/dist/marks/SymbolLegend.svelte.d.ts +17 -2
  83. package/dist/marks/Text.svelte.d.ts +6 -4
  84. package/dist/marks/TickX.svelte +2 -3
  85. package/dist/marks/TickX.svelte.d.ts +6 -4
  86. package/dist/marks/TickY.svelte +2 -3
  87. package/dist/marks/TickY.svelte.d.ts +6 -4
  88. package/dist/marks/Trail.svelte +161 -0
  89. package/dist/marks/Trail.svelte.d.ts +44 -0
  90. package/dist/marks/Vector.svelte +3 -4
  91. package/dist/marks/Vector.svelte.d.ts +6 -4
  92. package/dist/marks/WaffleX.svelte +2 -3
  93. package/dist/marks/WaffleX.svelte.d.ts +2 -85
  94. package/dist/marks/WaffleY.svelte +2 -4
  95. package/dist/marks/WaffleY.svelte.d.ts +2 -83
  96. package/dist/marks/helpers/AreaCanvas.svelte +2 -4
  97. package/dist/marks/helpers/Box.svelte +271 -0
  98. package/dist/marks/helpers/Box.svelte.d.ts +55 -0
  99. package/dist/marks/helpers/CanvasLayer.svelte +2 -4
  100. package/dist/marks/helpers/DotCanvas.svelte +3 -5
  101. package/dist/marks/helpers/GeoCanvas.svelte +2 -4
  102. package/dist/marks/helpers/LineCanvas.svelte +2 -4
  103. package/dist/marks/helpers/LinearGradientX.svelte +3 -4
  104. package/dist/marks/helpers/LinearGradientY.svelte +3 -4
  105. package/dist/marks/helpers/MarkerPath.svelte +4 -5
  106. package/dist/marks/helpers/MarkerPath.svelte.d.ts +2 -102
  107. package/dist/marks/helpers/MultilineText.svelte +4 -4
  108. package/dist/marks/helpers/RectPath.svelte +5 -6
  109. package/dist/marks/helpers/Regression.svelte +4 -8
  110. package/dist/marks/helpers/TrailCanvas.svelte +138 -0
  111. package/dist/marks/helpers/TrailCanvas.svelte.d.ts +40 -0
  112. package/dist/marks/helpers/events.d.ts +2 -2
  113. package/dist/marks/helpers/events.js +4 -4
  114. package/dist/marks/helpers/trail.d.ts +23 -0
  115. package/dist/marks/helpers/trail.js +372 -0
  116. package/dist/marks/index.d.ts +1 -0
  117. package/dist/marks/index.js +1 -0
  118. package/dist/transforms/bollinger.d.ts +1 -69
  119. package/dist/transforms/centroid.d.ts +1 -4
  120. package/dist/transforms/group.d.ts +4 -12
  121. package/dist/transforms/interval.d.ts +2 -128
  122. package/dist/transforms/normalize.d.ts +23 -0
  123. package/dist/transforms/recordize.d.ts +4 -7
  124. package/dist/transforms/select.d.ts +7 -448
  125. package/dist/transforms/sort.d.ts +5 -253
  126. package/dist/transforms/stack.d.ts +3 -23
  127. package/dist/transforms/window.d.ts +2 -134
  128. package/dist/types/mark.d.ts +2 -1
  129. package/dist/types/plot.d.ts +6 -1
  130. package/dist/ui/Spiral.svelte +4 -0
  131. package/package.json +25 -23
@@ -1,4 +1,5 @@
1
1
  import type { RawValue, ChannelAccessor } from '../types/index.js';
2
+ import { autoTicks } from '../helpers/autoTicks.js';
2
3
  declare function $$render<Datum = RawValue>(): {
3
4
  props: Omit<Partial<{
4
5
  filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
@@ -7,14 +8,14 @@ declare function $$render<Datum = RawValue>(): {
7
8
  fy: ChannelAccessor<Datum>;
8
9
  dx: import("../types/index.js").ConstantAccessor<number, Datum>;
9
10
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: autoTicks;
12
+ dodgeY: autoTicks;
12
13
  fill: ChannelAccessor<Datum>;
13
14
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
14
- sort: ((a: RawValue, b: RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
18
+ } | ((a: RawValue, b: RawValue) => number) | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
18
19
  stroke: ChannelAccessor<Datum>;
19
20
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
20
21
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -26,6 +27,7 @@ declare function $$render<Datum = RawValue>(): {
26
27
  strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
27
28
  mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
30
32
  shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
31
33
  paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
@@ -12,17 +12,17 @@
12
12
  fy?: ChannelAccessor<Datum>;
13
13
  children: Snippet<[{ datum: Datum }]>;
14
14
  }
15
- import { getContext, type Snippet } from 'svelte';
16
- import type { ChannelAccessor, DataRow, PlotContext } from '../types/index.js';
17
-
18
- const { getPlotState } = getContext<PlotContext>('svelteplot');
19
- let plot = $derived(getPlotState());
15
+ import { type Snippet } from 'svelte';
16
+ import type { ChannelAccessor, DataRow } from '../types/index.js';
17
+ import { usePlot } from '../hooks/usePlot.svelte.js';
20
18
 
21
19
  import { resolveChannel } from '../helpers/resolve.js';
22
20
  import { quadtree } from 'd3-quadtree';
23
21
  import { projectX, projectY } from '../helpers/scales.js';
24
22
  import { groupFacetsAndZ } from '../helpers/group.js';
25
23
 
24
+ const plot = usePlot();
25
+
26
26
  let { data, x, y, r, fx, fy, children }: HTMLTooltipMarkProps = $props();
27
27
 
28
28
  let datum = $state(false);
@@ -1,79 +1,6 @@
1
- import type { ChannelAccessor, ConstantAccessor, DataRecord, LinkableMarkProps } from '../types';
1
+ import type { DataRecord } from '../types';
2
2
  declare function $$render<Datum extends DataRecord>(): {
3
- props: Partial<{
4
- filter: ConstantAccessor<boolean, Datum>;
5
- facet: "auto" | "include" | "exclude";
6
- fx: ChannelAccessor<Datum>;
7
- fy: ChannelAccessor<Datum>;
8
- dx: ConstantAccessor<number, Datum>;
9
- dy: ConstantAccessor<number, Datum>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
12
- fill: ChannelAccessor<Datum>;
13
- fillOpacity: ConstantAccessor<number, Datum>;
14
- sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
15
- channel: string;
16
- order?: "ascending" | "descending";
17
- } | ConstantAccessor<import("../types").RawValue, Datum>;
18
- stroke: ChannelAccessor<Datum>;
19
- strokeWidth: ConstantAccessor<number, Datum>;
20
- strokeOpacity: ConstantAccessor<number, Datum>;
21
- strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
22
- strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
23
- strokeMiterlimit: ConstantAccessor<number, Datum>;
24
- opacity: ChannelAccessor<Datum>;
25
- strokeDasharray: ConstantAccessor<string, Datum>;
26
- strokeDashoffset: ConstantAccessor<number, Datum>;
27
- mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
28
- clipPath: string;
29
- imageFilter: ConstantAccessor<string, Datum>;
30
- shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
31
- paintOrder: ConstantAccessor<string, Datum>;
32
- onclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
- ondblclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
- onmouseup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- onmousedown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onmouseenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onmousemove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onmouseleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onmouseout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onmouseover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- onpointercancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- onpointerdown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- onpointerup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- onpointerenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- onpointerleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- onpointermove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- onpointerover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- onpointerout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- ondrag: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- ondrop: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ondragstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- ondragenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- ondragleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- ondragover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
- ondragend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
- ontouchstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
- ontouchmove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
- ontouchend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
- ontouchcancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
- oncontextmenu: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
- onwheel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
62
- class: string;
63
- style: string;
64
- cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
65
- }> & LinkableMarkProps<Datum> & {
66
- data: Datum[];
67
- x: ChannelAccessor<Datum>;
68
- y: ChannelAccessor<Datum>;
69
- r?: ChannelAccessor<Datum>;
70
- width?: ConstantAccessor<number, Datum>;
71
- height?: ConstantAccessor<number, Datum>;
72
- src?: ConstantAccessor<string, Datum>;
73
- title?: ConstantAccessor<string, Datum>;
74
- preserveAspectRatio?: string;
75
- imageClass?: ConstantAccessor<string, Datum>;
76
- };
3
+ props: any;
77
4
  exports: {};
78
5
  bindings: "";
79
6
  slots: {};
@@ -23,7 +23,6 @@
23
23
  }
24
24
  import type {
25
25
  CurveName,
26
- PlotContext,
27
26
  DataRecord,
28
27
  BaseMarkProps,
29
28
  ConstantAccessor,
@@ -33,7 +32,6 @@
33
32
  } from '../types/index.js';
34
33
  import Mark from '../Mark.svelte';
35
34
  import MarkerPath from './helpers/MarkerPath.svelte';
36
- import { getContext } from 'svelte';
37
35
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
38
36
  import { line, type CurveFactory, type Line as D3Line } from 'd3-shape';
39
37
  import { geoPath } from 'd3-geo';
@@ -48,6 +46,7 @@
48
46
  import { recordizeXY } from '../transforms/recordize.js';
49
47
  import GroupMultiple from './helpers/GroupMultiple.svelte';
50
48
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
49
+ import { usePlot } from '../hooks/usePlot.svelte.js';
51
50
 
52
51
  let markProps: LineMarkProps = $props();
53
52
 
@@ -76,7 +75,10 @@
76
75
 
77
76
  const args = $derived(sort(recordizeXY({ data, ...options })));
78
77
 
79
- function groupIndex(data: ScaledDataRecord[], groupByKey) {
78
+ /**
79
+ * Groups the data by the specified key
80
+ */
81
+ function groupIndex(data: ScaledDataRecord[], groupByKey: ChannelAccessor<Datum> | null) {
80
82
  if (!groupByKey) return [data];
81
83
  let group = [];
82
84
  const groups = [group];
@@ -95,10 +97,9 @@
95
97
  return groups;
96
98
  }
97
99
 
98
- const groupByKey = $derived(args.z || args.stroke);
100
+ const groupByKey = $derived(args.z || args.stroke) as ChannelAccessor<Datum> | null;
99
101
 
100
- const { getPlotState } = getContext<PlotContext>('svelteplot');
101
- const plot = $derived(getPlotState());
102
+ const plot = usePlot();
102
103
 
103
104
  const linePath: D3Line<ScaledDataRecord> = $derived(
104
105
  plot.scales.projection && curve === 'auto'
@@ -1,5 +1,6 @@
1
1
  import type { CurveName, DataRecord, ConstantAccessor, ChannelAccessor, MarkerOptions } from '../types/index.js';
2
2
  import { type CurveFactory } from 'd3-shape';
3
+ import callWithProps from '../helpers/callWithProps.js';
3
4
  import type { RawValue } from '../types/index.js';
4
5
  declare function $$render<Datum extends DataRecord>(): {
5
6
  props: MarkerOptions & Partial<{
@@ -9,14 +10,14 @@ declare function $$render<Datum extends DataRecord>(): {
9
10
  fy: ChannelAccessor<Datum>;
10
11
  dx: ConstantAccessor<number, Datum>;
11
12
  dy: ConstantAccessor<number, Datum>;
12
- dodgeX: import("../transforms/dodge.js").DodgeXOptions;
13
- dodgeY: import("../transforms/dodge.js").DodgeYOptions;
13
+ dodgeX: callWithProps;
14
+ dodgeY: callWithProps;
14
15
  fill: ChannelAccessor<Datum>;
15
16
  fillOpacity: ConstantAccessor<number, Datum>;
16
- sort: ((a: RawValue, b: RawValue) => number) | {
17
+ sort: {
17
18
  channel: string;
18
19
  order?: "ascending" | "descending";
19
- } | ConstantAccessor<RawValue, Datum>;
20
+ } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
20
21
  stroke: ChannelAccessor<Datum>;
21
22
  strokeWidth: ConstantAccessor<number, Datum>;
22
23
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -28,6 +29,7 @@ declare function $$render<Datum extends DataRecord>(): {
28
29
  strokeDashoffset: ConstantAccessor<number, Datum>;
29
30
  mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
30
31
  clipPath: string;
32
+ mask: string;
31
33
  imageFilter: ConstantAccessor<string, Datum>;
32
34
  shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
33
35
  paintOrder: ConstantAccessor<string, Datum>;
@@ -1,3 +1,4 @@
1
+ import { recordizeX } from '../index.js';
1
2
  import type { DataRow } from '../index.js';
2
3
  declare function $$render<Datum extends DataRow>(): {
3
4
  props: Omit<import("../types").MarkerOptions & Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRow>(): {
7
8
  fy: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
8
9
  dx: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
9
10
  dy: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: recordizeX;
12
+ dodgeY: recordizeX;
12
13
  fill: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
13
14
  fillOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
14
- sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
18
+ } | ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
18
19
  stroke: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
19
20
  strokeWidth: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
20
21
  strokeOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
@@ -26,6 +27,7 @@ declare function $$render<Datum extends DataRow>(): {
26
27
  strokeDashoffset: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
27
28
  mixBlendMode: import("../types").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types").RawValue>>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
30
32
  shapeRendering: import("../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types").RawValue>>;
31
33
  paintOrder: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
@@ -72,7 +74,7 @@ declare function $$render<Datum extends DataRow>(): {
72
74
  outlineStrokeOpacity?: number;
73
75
  curve?: import("../types").CurveName | import("d3-shape").CurveFactory | "auto";
74
76
  tension?: number;
75
- sort?: import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>> | {
77
+ sort?: import("../types").ConstantAccessor<recordizeX, Datum_1> | {
76
78
  channel: "stroke" | "fill";
77
79
  };
78
80
  text?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
@@ -82,7 +84,7 @@ declare function $$render<Datum extends DataRow>(): {
82
84
  textStrokeWidth?: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
83
85
  lineClass?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
84
86
  canvas?: boolean;
85
- }, "data" | "y"> & {
87
+ }, "y" | "data"> & {
86
88
  data: Datum[];
87
89
  };
88
90
  exports: {};
@@ -1,3 +1,4 @@
1
+ import { recordizeY } from '../index.js';
1
2
  import type { DataRow } from '../index.js';
2
3
  declare function $$render<Datum extends DataRow>(): {
3
4
  props: Omit<import("../types").MarkerOptions & Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRow>(): {
7
8
  fy: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
8
9
  dx: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
9
10
  dy: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: recordizeY;
12
+ dodgeY: recordizeY;
12
13
  fill: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
13
14
  fillOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
14
- sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
18
+ } | ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
18
19
  stroke: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
19
20
  strokeWidth: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
20
21
  strokeOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
@@ -26,6 +27,7 @@ declare function $$render<Datum extends DataRow>(): {
26
27
  strokeDashoffset: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
27
28
  mixBlendMode: import("../types").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types").RawValue>>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
30
32
  shapeRendering: import("../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types").RawValue>>;
31
33
  paintOrder: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
@@ -72,7 +74,7 @@ declare function $$render<Datum extends DataRow>(): {
72
74
  outlineStrokeOpacity?: number;
73
75
  curve?: import("../types").CurveName | import("d3-shape").CurveFactory | "auto";
74
76
  tension?: number;
75
- sort?: import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>> | {
77
+ sort?: import("../types").ConstantAccessor<recordizeY, Datum_1> | {
76
78
  channel: "stroke" | "fill";
77
79
  };
78
80
  text?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
@@ -82,7 +84,7 @@ declare function $$render<Datum extends DataRow>(): {
82
84
  textStrokeWidth?: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
83
85
  lineClass?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
84
86
  canvas?: boolean;
85
- }, "data" | "x"> & {
87
+ }, "x" | "data"> & {
86
88
  data: Datum[];
87
89
  };
88
90
  exports: {};
@@ -34,9 +34,7 @@
34
34
  */
35
35
  text?: ConstantAccessor<string, Datum>;
36
36
  }
37
- import { getContext } from 'svelte';
38
37
  import type {
39
- PlotContext,
40
38
  DataRecord,
41
39
  BaseMarkProps,
42
40
  ConstantAccessor,
@@ -58,6 +56,7 @@
58
56
  import { sort } from '../transforms/sort.js';
59
57
  import { indexData } from '../transforms/recordize.js';
60
58
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
59
+ import { usePlot } from '../hooks/usePlot.svelte.js';
61
60
 
62
61
  let markProps: LinkMarkProps = $props();
63
62
  const DEFAULTS = {
@@ -75,8 +74,7 @@
75
74
  ...markProps
76
75
  });
77
76
 
78
- const { getPlotState } = getContext<PlotContext>('svelteplot');
79
- let plot = $derived(getPlotState());
77
+ const plot = usePlot();
80
78
 
81
79
  const args = $derived(
82
80
  replaceChannels(
@@ -1,4 +1,5 @@
1
1
  import type { DataRecord, ConstantAccessor, ChannelAccessor, CurveName, MarkerOptions, RawValue } from '../types/index.js';
2
+ import { replaceChannels } from '../transforms/rename.js';
2
3
  import { type CurveFactory } from 'd3-shape';
3
4
  declare function $$render<Datum extends DataRecord>(): {
4
5
  props: Partial<{
@@ -8,14 +9,14 @@ declare function $$render<Datum extends DataRecord>(): {
8
9
  fy: ChannelAccessor<Datum>;
9
10
  dx: ConstantAccessor<number, Datum>;
10
11
  dy: ConstantAccessor<number, Datum>;
11
- dodgeX: import("../transforms/dodge.js").DodgeXOptions;
12
- dodgeY: import("../transforms/dodge.js").DodgeYOptions;
12
+ dodgeX: replaceChannels;
13
+ dodgeY: replaceChannels;
13
14
  fill: ChannelAccessor<Datum>;
14
15
  fillOpacity: ConstantAccessor<number, Datum>;
15
- sort: ((a: RawValue, b: RawValue) => number) | {
16
+ sort: {
16
17
  channel: string;
17
18
  order?: "ascending" | "descending";
18
- } | ConstantAccessor<RawValue, Datum>;
19
+ } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
19
20
  stroke: ChannelAccessor<Datum>;
20
21
  strokeWidth: ConstantAccessor<number, Datum>;
21
22
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -27,6 +28,7 @@ declare function $$render<Datum extends DataRecord>(): {
27
28
  strokeDashoffset: ConstantAccessor<number, Datum>;
28
29
  mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
29
30
  clipPath: string;
31
+ mask: string;
30
32
  imageFilter: ConstantAccessor<string, Datum>;
31
33
  shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
32
34
  paintOrder: ConstantAccessor<string, Datum>;
@@ -23,8 +23,8 @@
23
23
  onupdate?: (data: Datum[]) => void;
24
24
  }
25
25
 
26
- import { getContext, type Snippet } from 'svelte';
27
- import type { ChannelAccessor, DataRow, PlotContext } from '../types/index.js';
26
+ import { type Snippet } from 'svelte';
27
+ import type { ChannelAccessor, DataRow } from '../types/index.js';
28
28
  import { resolveChannel } from '../helpers/resolve.js';
29
29
  import { quadtree } from 'd3-quadtree';
30
30
  import { projectXY } from '../helpers/scales.js';
@@ -32,9 +32,9 @@
32
32
  import { indexData, RAW_VALUE } from '../transforms/recordize.js';
33
33
  import { groupFacetsAndZ } from '../helpers/group.js';
34
34
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
+ import { usePlot } from '../hooks/usePlot.svelte.js';
35
36
 
36
- const { getPlotState } = getContext<PlotContext>('svelteplot');
37
- const plot = $derived(getPlotState());
37
+ const plot = usePlot();
38
38
 
39
39
  const POINTER_X = Symbol('pointerX');
40
40
  const POINTER_Y = Symbol('pointerY');
@@ -16,10 +16,8 @@
16
16
  className?: string;
17
17
  }
18
18
  import Mark from '../Mark.svelte';
19
- import { getContext } from 'svelte';
20
19
  import { intervalX, intervalY } from '../index.js';
21
20
  import type {
22
- PlotContext,
23
21
  DataRecord,
24
22
  BaseMarkProps,
25
23
  BaseRectMarkProps,
@@ -30,6 +28,7 @@
30
28
  import RectPath from './helpers/RectPath.svelte';
31
29
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
32
30
  import { IS_SORTED } from '../transforms/sort';
31
+ import { usePlot } from '../hooks/usePlot.svelte.js';
33
32
 
34
33
  let markProps: RectMarkProps = $props();
35
34
 
@@ -46,8 +45,7 @@
46
45
  ...markProps
47
46
  });
48
47
 
49
- const { getPlotState } = getContext<PlotContext>('svelteplot');
50
- let plot = $derived(getPlotState());
48
+ const plot = usePlot();
51
49
 
52
50
  const args = $derived(
53
51
  intervalY(intervalX({ data, ...options }, { plot }), { plot }) as RectMarkProps
@@ -1,3 +1,4 @@
1
+ import { intervalX } from '../index.js';
1
2
  import type { DataRecord, BaseRectMarkProps, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
2
3
  declare function $$render<Datum extends DataRecord>(): {
3
4
  props: Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRecord>(): {
7
8
  fy: ChannelAccessor<Datum>;
8
9
  dx: import("../types/index.js").ConstantAccessor<number, Datum>;
9
10
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: intervalX;
12
+ dodgeY: intervalX;
12
13
  fill: ChannelAccessor<Datum>;
13
14
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
14
- sort: ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Datum>;
18
+ } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Datum>;
18
19
  stroke: ChannelAccessor<Datum>;
19
20
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
20
21
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -26,6 +27,7 @@ declare function $$render<Datum extends DataRecord>(): {
26
27
  strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
27
28
  mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
30
32
  shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
31
33
  paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
@@ -9,10 +9,11 @@
9
9
 
10
10
  import Rect from './Rect.svelte';
11
11
  import { intervalY, stackX, recordizeX } from '../index.js';
12
- import type { DataRecord, PlotContext } from '../types/index.js';
13
- import { getContext, type ComponentProps } from 'svelte';
12
+ import type { DataRecord } from '../types/index.js';
13
+ import { type ComponentProps } from 'svelte';
14
14
  import type { StackOptions } from '../transforms/stack.js';
15
15
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
16
+ import { usePlot } from '../hooks/usePlot.svelte.js';
16
17
 
17
18
  let markProps: RectXMarkProps = $props();
18
19
 
@@ -30,8 +31,7 @@
30
31
  ...markProps
31
32
  });
32
33
 
33
- const { getPlotState } = getContext<PlotContext>('svelteplot');
34
- let plot = $derived(getPlotState());
34
+ const plot = usePlot();
35
35
 
36
36
  const args = $derived(stackX(intervalY(recordizeX({ data, ...options }), { plot }), stack));
37
37
  </script>
@@ -7,10 +7,11 @@
7
7
  }
8
8
  import Rect from './Rect.svelte';
9
9
  import { intervalX, stackY, recordizeY } from '../index.js';
10
- import type { DataRecord, PlotContext } from '../types/index.js';
11
- import { getContext, type ComponentProps } from 'svelte';
10
+ import type { DataRecord } from '../types/index.js';
11
+ import { type ComponentProps } from 'svelte';
12
12
  import type { StackOptions } from '../transforms/stack.js';
13
13
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
14
+ import { usePlot } from '../hooks/usePlot.svelte.js';
14
15
 
15
16
  let markProps: RectYMarkProps = $props();
16
17
 
@@ -28,8 +29,7 @@
28
29
  ...markProps
29
30
  });
30
31
 
31
- const { getPlotState } = getContext<PlotContext>('svelteplot');
32
- const plot = $derived(getPlotState());
32
+ const plot = usePlot();
33
33
 
34
34
  const args = $derived(stackY(intervalX(recordizeY({ data, ...options }), { plot }), stack));
35
35
  </script>
@@ -13,11 +13,9 @@
13
13
  }
14
14
  import Mark from '../Mark.svelte';
15
15
  import GroupMultiple from './helpers/GroupMultiple.svelte';
16
- import { getContext } from 'svelte';
17
16
  import { recordizeX } from '../transforms/recordize.js';
18
17
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
19
18
  import type {
20
- PlotContext,
21
19
  DataRecord,
22
20
  BaseMarkProps,
23
21
  ConstantAccessor,
@@ -25,6 +23,7 @@
25
23
  RawValue
26
24
  } from '../types/index.js';
27
25
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
26
+ import { usePlot } from '../hooks/usePlot.svelte.js';
28
27
 
29
28
  let markProps: RuleXMarkProps = $props();
30
29
  const DEFAULTS = {
@@ -40,8 +39,7 @@
40
39
  ...markProps
41
40
  });
42
41
 
43
- const { getPlotState } = getContext<PlotContext>('svelteplot');
44
- const plot = $derived(getPlotState());
42
+ const plot = usePlot();
45
43
  const args = $derived(recordizeX({ data, ...options }, { withIndex: false }));
46
44
  </script>
47
45
 
@@ -1,3 +1,4 @@
1
+ import { recordizeX } from '../transforms/recordize.js';
1
2
  import type { DataRecord, ConstantAccessor, ChannelAccessor, RawValue } from '../types/index.js';
2
3
  declare function $$render<Datum = DataRecord | RawValue>(): {
3
4
  props: Omit<Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum = DataRecord | RawValue>(): {
7
8
  fy: ChannelAccessor<Datum>;
8
9
  dx: ConstantAccessor<number, Datum>;
9
10
  dy: ConstantAccessor<number, Datum>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: recordizeX;
12
+ dodgeY: recordizeX;
12
13
  fill: ChannelAccessor<Datum>;
13
14
  fillOpacity: ConstantAccessor<number, Datum>;
14
- sort: ((a: RawValue, b: RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | ConstantAccessor<RawValue, Datum>;
18
+ } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
18
19
  stroke: ChannelAccessor<Datum>;
19
20
  strokeWidth: ConstantAccessor<number, Datum>;
20
21
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -26,6 +27,7 @@ declare function $$render<Datum = DataRecord | RawValue>(): {
26
27
  strokeDashoffset: ConstantAccessor<number, Datum>;
27
28
  mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: ConstantAccessor<string, Datum>;
30
32
  shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
31
33
  paintOrder: ConstantAccessor<string, Datum>;
@@ -13,11 +13,9 @@
13
13
  }
14
14
  import Mark from '../Mark.svelte';
15
15
  import GroupMultiple from './helpers/GroupMultiple.svelte';
16
- import { getContext } from 'svelte';
17
16
  import { recordizeY } from '../transforms/recordize.js';
18
17
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
19
18
  import type {
20
- PlotContext,
21
19
  DataRecord,
22
20
  BaseMarkProps,
23
21
  ConstantAccessor,
@@ -25,6 +23,7 @@
25
23
  } from '../types/index.js';
26
24
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
27
25
  import { IS_SORTED } from '../transforms/sort';
26
+ import { usePlot } from '../hooks/usePlot.svelte.js';
28
27
 
29
28
  let markProps: RuleYMarkProps = $props();
30
29
  const DEFAULTS = {
@@ -40,8 +39,7 @@
40
39
  ...markProps
41
40
  });
42
41
 
43
- const { getPlotState } = getContext<PlotContext>('svelteplot');
44
- const plot = $derived(getPlotState());
42
+ const plot = usePlot();
45
43
  const args = $derived(recordizeY({ data, ...options }, { withIndex: false }));
46
44
  </script>
47
45