svelteplot 0.8.1 → 0.9.0-pr-311.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 +3 -4
  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,88 +1,6 @@
1
- import type { DataRecord, ChannelAccessor, ScaledDataRecord, UsedScales } from '../types/index.js';
2
- import type { Snippet } from 'svelte';
1
+ import type { DataRecord } from '../types/index.js';
3
2
  declare function $$render<Datum extends DataRecord>(): {
4
- props: Partial<{
5
- filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
6
- facet: "auto" | "include" | "exclude";
7
- fx: ChannelAccessor<Datum>;
8
- fy: ChannelAccessor<Datum>;
9
- dx: import("../types/index.js").ConstantAccessor<number, Datum>;
10
- dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
- dodgeX: import("../transforms/dodge").DodgeXOptions;
12
- dodgeY: import("../transforms/dodge").DodgeYOptions;
13
- fill: ChannelAccessor<Datum>;
14
- fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
15
- sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
16
- channel: string;
17
- order?: "ascending" | "descending";
18
- } | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
19
- stroke: ChannelAccessor<Datum>;
20
- strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
21
- strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
22
- strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
23
- strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
24
- strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
25
- opacity: ChannelAccessor<Datum>;
26
- strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
27
- strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
28
- mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
29
- clipPath: string;
30
- imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
31
- shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
32
- paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
33
- onclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
- ondblclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- onmouseup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onmousedown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onmouseenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onmousemove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onmouseleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onmouseout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- onmouseover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- onpointercancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- onpointerdown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- onpointerup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- onpointerenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- onpointerleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- onpointermove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- onpointerover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- onpointerout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- ondrag: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ondrop: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- ondragstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- ondragenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- ondragleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
- ondragover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
- ondragend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
- ontouchstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
- ontouchmove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
- ontouchend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
- ontouchcancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
- oncontextmenu: import("svelte/elements").MouseEventHandler<SVGPathElement>;
62
- onwheel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
63
- class: string;
64
- style: string;
65
- cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
66
- }> & {
67
- data?: Datum[];
68
- type?: string;
69
- x?: ChannelAccessor<Datum>;
70
- x1?: ChannelAccessor<Datum>;
71
- x2?: ChannelAccessor<Datum>;
72
- y?: ChannelAccessor<Datum>;
73
- y1?: ChannelAccessor<Datum>;
74
- y2?: ChannelAccessor<Datum>;
75
- r?: ChannelAccessor<Datum>;
76
- mark?: Snippet<[{
77
- record: ScaledDataRecord<Datum>;
78
- index: number;
79
- usedScales: UsedScales;
80
- }]>;
81
- marks?: Snippet<[{
82
- records: ScaledDataRecord<Datum>[];
83
- usedScales: UsedScales;
84
- }]>;
85
- };
3
+ props: any;
86
4
  exports: {};
87
5
  bindings: "";
88
6
  slots: {};
@@ -23,21 +23,16 @@
23
23
  class: string | null;
24
24
  children: Snippet<{ datum: Datum; x: number; y: number }>;
25
25
  }
26
- import { getContext, type Snippet } from 'svelte';
27
- import type {
28
- ChannelAccessor,
29
- ConstantAccessor,
30
- DataRecord,
31
- PlotContext
32
- } from '../types/index.js';
33
-
34
- const { getPlotState } = getContext<PlotContext>('svelteplot');
35
- const plot = $derived(getPlotState());
26
+ import { type Snippet } from 'svelte';
27
+ import type { ChannelAccessor, ConstantAccessor, DataRecord } from '../types/index.js';
28
+ import { usePlot } from '../hooks/usePlot.svelte.js';
36
29
 
37
30
  import { resolveChannel } from '../helpers/resolve.js';
38
31
  import { projectX, projectY, projectXY } from '../helpers/scales.js';
39
32
  import { isValid } from '../helpers/index.js';
40
33
 
34
+ const plot = usePlot();
35
+
41
36
  let {
42
37
  data = [{} as Datum],
43
38
  x,
@@ -49,19 +49,17 @@
49
49
  BaseMarkProps,
50
50
  ChannelAccessor,
51
51
  CurveName,
52
- DataRecord,
53
- PlotContext
52
+ DataRecord
54
53
  } from '../types/index.js';
55
54
  import { Line, Area } from './index.js';
56
55
  import { randomId, coalesce } from '../helpers/index.js';
57
- import { getContext } from 'svelte';
58
56
  import { extent, max, min } from 'd3-array';
59
57
  import { resolveChannel } from '../helpers/resolve.js';
60
58
  import type { CurveFactory } from 'd3-shape';
61
59
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
60
+ import { usePlot } from '../hooks/usePlot.svelte.js';
62
61
 
63
- const { getPlotState } = getContext<PlotContext>('svelteplot');
64
- let plot = $derived(getPlotState());
62
+ const plot = usePlot();
65
63
 
66
64
  let markProps: DifferenceYMarkProps = $props();
67
65
 
@@ -1,69 +1,7 @@
1
1
  import type { ChannelAccessor, CurveName, DataRecord } from '../types/index.js';
2
2
  import type { CurveFactory } from 'd3-shape';
3
3
  declare function $$render<Datum extends DataRecord>(): {
4
- props: Omit<Partial<{
5
- filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
6
- facet: "auto" | "include" | "exclude";
7
- fx: ChannelAccessor<Datum>;
8
- fy: ChannelAccessor<Datum>;
9
- dx: import("../types/index.js").ConstantAccessor<number, Datum>;
10
- dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
- dodgeX: import("../transforms/dodge").DodgeXOptions;
12
- dodgeY: import("../transforms/dodge").DodgeYOptions;
13
- fill: ChannelAccessor<Datum>;
14
- fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
15
- sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
16
- channel: string;
17
- order?: "ascending" | "descending";
18
- } | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
19
- stroke: ChannelAccessor<Datum>;
20
- strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
21
- strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
22
- strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
23
- strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
24
- strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
25
- opacity: ChannelAccessor<Datum>;
26
- strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
27
- strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
28
- mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
29
- clipPath: string;
30
- imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
31
- shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
32
- paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
33
- onclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
- ondblclick: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- onmouseup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onmousedown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onmouseenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onmousemove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onmouseleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onmouseout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- onmouseover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- onpointercancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- onpointerdown: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- onpointerup: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- onpointerenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- onpointerleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- onpointermove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- onpointerover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- onpointerout: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- ondrag: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ondrop: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- ondragstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- ondragenter: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- ondragleave: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
- ondragover: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
- ondragend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
- ontouchstart: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
- ontouchmove: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
- ontouchend: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
- ontouchcancel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
- oncontextmenu: import("svelte/elements").MouseEventHandler<SVGPathElement>;
62
- onwheel: import("svelte/elements").MouseEventHandler<SVGPathElement>;
63
- class: string;
64
- style: string;
65
- cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
66
- }>, "fill" | "fillOpacity"> & {
4
+ props: Omit<BaseMarkProps<Datum>, "fill" | "fillOpacity"> & {
67
5
  data: Datum[];
68
6
  x1: ChannelAccessor<Datum>;
69
7
  /**
@@ -12,9 +12,8 @@
12
12
  dotClass?: ConstantAccessor<string, Datum>;
13
13
  }
14
14
 
15
- import { getContext, type Snippet } from 'svelte';
15
+ import { type Snippet } from 'svelte';
16
16
  import type {
17
- PlotContext,
18
17
  DataRecord,
19
18
  BaseMarkProps,
20
19
  ConstantAccessor,
@@ -33,6 +32,7 @@
33
32
  import Anchor from './helpers/Anchor.svelte';
34
33
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
34
  import { isOrdinalScale } from '../helpers/scales.js';
35
+ import { usePlot } from '../hooks/usePlot.svelte.js';
36
36
 
37
37
  const DEFAULTS = {
38
38
  ...getPlotDefaults().dot
@@ -48,8 +48,7 @@
48
48
  ...options
49
49
  }: DotMarkProps = $derived({ ...DEFAULTS, ...markProps });
50
50
 
51
- const { getPlotState } = getContext<PlotContext>('svelteplot');
52
- const plot = $derived(getPlotState());
51
+ const plot = usePlot();
53
52
 
54
53
  function getSymbolPath(symbolType, size) {
55
54
  return d3Symbol(maybeSymbol(symbolType), size)();
@@ -113,7 +112,7 @@
113
112
  ]}
114
113
  {style}
115
114
  {@attach addEventHandlers({
116
- getPlotState,
115
+ plot,
117
116
  options: args,
118
117
  datum: d?.datum
119
118
  })} />
@@ -1,5 +1,6 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import type { DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
3
+ import { maybeSymbol } from '../helpers/symbols.js';
3
4
  declare function $$render<Datum extends DataRecord>(): {
4
5
  props: Partial<{
5
6
  filter: ConstantAccessor<boolean, Datum>;
@@ -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: maybeSymbol;
13
+ dodgeY: maybeSymbol;
13
14
  fill: ChannelAccessor<Datum>;
14
15
  fillOpacity: ConstantAccessor<number, Datum>;
15
- sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
16
+ sort: {
16
17
  channel: string;
17
18
  order?: "ascending" | "descending";
18
- } | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
19
+ } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").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>;
@@ -1,3 +1,4 @@
1
+ import { recordizeX } from '../index.js';
1
2
  import type { DataRow } from '../types/index.js';
2
3
  declare function $$render<Datum extends DataRow>(): {
3
4
  props: Omit<Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRow>(): {
7
8
  fy: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
8
9
  dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
9
10
  dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: recordizeX;
12
+ dodgeY: recordizeX;
12
13
  fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
13
14
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
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, Record<string | symbol, import("../types/data").RawValue>>;
18
+ } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
18
19
  stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
19
20
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
20
21
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
@@ -26,6 +27,7 @@ declare function $$render<Datum extends DataRow>(): {
26
27
  strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
27
28
  mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
30
32
  shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
31
33
  paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
@@ -70,7 +72,7 @@ declare function $$render<Datum extends DataRow>(): {
70
72
  symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
71
73
  canvas?: boolean;
72
74
  dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
73
- }, "data" | "y"> & {
75
+ }, "y" | "data"> & {
74
76
  data: Datum[];
75
77
  };
76
78
  exports: {};
@@ -1,3 +1,4 @@
1
+ import { recordizeY } from '../index.js';
1
2
  import type { DataRow } from '../types/index.js';
2
3
  declare function $$render<Datum extends DataRow>(): {
3
4
  props: Omit<Partial<{
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRow>(): {
7
8
  fy: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
8
9
  dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
9
10
  dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
- dodgeX: import("../transforms/dodge").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge").DodgeYOptions;
11
+ dodgeX: recordizeY;
12
+ dodgeY: recordizeY;
12
13
  fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
13
14
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
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, Record<string | symbol, import("../types/data").RawValue>>;
18
+ } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
18
19
  stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
19
20
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
20
21
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
@@ -26,6 +27,7 @@ declare function $$render<Datum extends DataRow>(): {
26
27
  strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
27
28
  mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
28
29
  clipPath: string;
30
+ mask: string;
29
31
  imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
30
32
  shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
31
33
  paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
@@ -70,7 +72,7 @@ declare function $$render<Datum extends DataRow>(): {
70
72
  symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
71
73
  canvas?: boolean;
72
74
  dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
73
- }, "data" | "x"> & {
75
+ }, "x" | "data"> & {
74
76
  data: Datum[];
75
77
  };
76
78
  exports: {};
@@ -21,17 +21,12 @@
21
21
  insetBottom?: number;
22
22
  }
23
23
  import Mark from '../Mark.svelte';
24
- import { getContext } from 'svelte';
25
- import type {
26
- PlotContext,
27
- BaseRectMarkProps,
28
- LinkableMarkProps,
29
- DataRecord
30
- } from '../types/index.js';
24
+ import type { BaseRectMarkProps, LinkableMarkProps, DataRecord } from '../types/index.js';
31
25
  import type { BaseMarkProps } from '../types/index.js';
32
26
  import RectPath from './helpers/RectPath.svelte';
33
27
  import { resolveProp } from '../helpers/resolve';
34
28
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
29
+ import { usePlot } from '../hooks/usePlot.svelte.js';
35
30
 
36
31
  let markProps: FrameMarkProps = $props();
37
32
 
@@ -61,8 +56,7 @@
61
56
  const dx = $derived(resolveProp(options.dx, null, 0) || 0);
62
57
  const dy = $derived(resolveProp(options.dy, null, 0) || 0);
63
58
 
64
- const { getPlotState } = getContext<PlotContext>('svelteplot');
65
- const plot = $derived(getPlotState());
59
+ const plot = usePlot();
66
60
  </script>
67
61
 
68
62
  <Mark type="frame" {automatic}>
@@ -1,4 +1,5 @@
1
1
  import type { BaseRectMarkProps, LinkableMarkProps, DataRecord } from '../types/index.js';
2
+ import { resolveProp } from '../helpers/resolve';
2
3
  declare function $$render<Datum extends DataRecord>(): {
3
4
  props: Omit<Partial<{
4
5
  filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
@@ -7,14 +8,14 @@ declare function $$render<Datum extends DataRecord>(): {
7
8
  fy: import("../types/channel").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: resolveProp;
12
+ dodgeY: resolveProp;
12
13
  fill: import("../types/channel").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: import("../types/channel").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>;
@@ -62,7 +64,7 @@ declare function $$render<Datum extends DataRecord>(): {
62
64
  class: string;
63
65
  style: string;
64
66
  cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
65
- }>, "fill" | "fillOpacity" | "stroke" | "strokeOpacity"> & BaseRectMarkProps<Datum> & LinkableMarkProps<Datum> & {
67
+ }>, "fill" | "stroke" | "fillOpacity" | "strokeOpacity"> & BaseRectMarkProps<Datum> & LinkableMarkProps<Datum> & {
66
68
  fill?: string;
67
69
  stroke?: string;
68
70
  fillOpacity?: number;
@@ -21,11 +21,10 @@
21
21
  * radius for point features
22
22
  */
23
23
  r?: ChannelAccessor<Datum>;
24
+ svgFilter?: ConstantAccessor<string | undefined, Datum>;
24
25
  }
25
- import { getContext } from 'svelte';
26
26
  import type {
27
27
  DataRecord,
28
- PlotContext,
29
28
  BaseMarkProps,
30
29
  ConstantAccessor,
31
30
  LinkableMarkProps,
@@ -42,9 +41,9 @@
42
41
  import { GEOJSON_PREFER_STROKE } from '../helpers/index.js';
43
42
  import Anchor from './helpers/Anchor.svelte';
44
43
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
44
+ import { usePlot } from '../hooks/usePlot.svelte.js';
45
45
 
46
- const { getPlotState } = getContext<PlotContext>('svelteplot');
47
- const plot = $derived(getPlotState());
46
+ const plot = usePlot();
48
47
 
49
48
  let markProps: GeoMarkProps = $props();
50
49
 
@@ -111,8 +110,9 @@
111
110
  d={path(geometry)}
112
111
  {style}
113
112
  class={[styleClass]}
113
+ filter={resolveProp(args.svgFilter, d.datum, undefined)}
114
114
  {@attach addEventHandlers({
115
- getPlotState,
115
+ plot,
116
116
  options: args,
117
117
  datum: d?.datum
118
118
  })}>
@@ -1,4 +1,5 @@
1
1
  import type { DataRecord, ConstantAccessor, LinkableMarkProps, ChannelAccessor } from '../types/index.js';
2
+ import { resolveChannel } from '../helpers/resolve.js';
2
3
  declare function $$render<Datum = DataRecord | GeoJSON.GeoJsonObject>(): {
3
4
  props: Partial<{
4
5
  filter: ConstantAccessor<boolean, Datum>;
@@ -7,14 +8,14 @@ declare function $$render<Datum = DataRecord | GeoJSON.GeoJsonObject>(): {
7
8
  fy: ChannelAccessor<Datum>;
8
9
  dx: ConstantAccessor<number, Datum>;
9
10
  dy: ConstantAccessor<number, Datum>;
10
- dodgeX: import("../transforms/dodge.js").DodgeXOptions;
11
- dodgeY: import("../transforms/dodge.js").DodgeYOptions;
11
+ dodgeX: resolveChannel;
12
+ dodgeY: resolveChannel;
12
13
  fill: ChannelAccessor<Datum>;
13
14
  fillOpacity: ConstantAccessor<number, Datum>;
14
- sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
15
+ sort: {
15
16
  channel: string;
16
17
  order?: "ascending" | "descending";
17
- } | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
18
+ } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").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 | GeoJSON.GeoJsonObject>(): {
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>;
@@ -83,6 +85,7 @@ declare function $$render<Datum = DataRecord | GeoJSON.GeoJsonObject>(): {
83
85
  * radius for point features
84
86
  */
85
87
  r?: ChannelAccessor<Datum>;
88
+ svgFilter?: ConstantAccessor<string | undefined, Datum>;
86
89
  };
87
90
  exports: {};
88
91
  bindings: "";
@@ -8,15 +8,8 @@
8
8
  y1?: ChannelAccessor<Datum>;
9
9
  y2?: ChannelAccessor<Datum>;
10
10
  }
11
- import { getContext } from 'svelte';
12
11
  import Mark from '../Mark.svelte';
13
- import type {
14
- PlotContext,
15
- BaseMarkProps,
16
- RawValue,
17
- DataRecord,
18
- ChannelAccessor
19
- } from '../types/index.js';
12
+ import type { BaseMarkProps, RawValue, DataRecord, ChannelAccessor } from '../types/index.js';
20
13
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
21
14
  import { autoTicks } from '../helpers/autoTicks.js';
22
15
  import { testFilter } from '../helpers/index.js';
@@ -24,6 +17,7 @@
24
17
  import isDataRecord from '../helpers/isDataRecord';
25
18
  import { INDEX } from '../constants';
26
19
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
20
+ import { usePlot } from '../hooks/usePlot.svelte.js';
27
21
 
28
22
  let markProps: GridXMarkProps = $props();
29
23
 
@@ -41,8 +35,7 @@
41
35
  ...markProps
42
36
  });
43
37
 
44
- const { getPlotState } = getContext<PlotContext>('svelteplot');
45
- const plot = $derived(getPlotState());
38
+ const plot = usePlot();
46
39
 
47
40
  const autoTickCount = $derived(
48
41
  Math.max(3, Math.round(plot.facetWidth / plot.options.x.tickSpacing))
@@ -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>;
@@ -8,14 +8,14 @@
8
8
  x1?: ChannelAccessor<Datum>;
9
9
  x2?: ChannelAccessor<Datum>;
10
10
  }
11
- import { getContext } from 'svelte';
12
11
  import Mark from '../Mark.svelte';
13
- import type { PlotContext, BaseMarkProps, RawValue, ChannelAccessor } from '../types/index.js';
12
+ import type { BaseMarkProps, RawValue, ChannelAccessor } from '../types/index.js';
14
13
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
15
14
  import { autoTicks } from '../helpers/autoTicks.js';
16
15
  import { testFilter } from '../helpers/index.js';
17
16
  import { RAW_VALUE } from '../transforms/recordize.js';
18
17
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
18
+ import { usePlot } from '../hooks/usePlot.svelte.js';
19
19
 
20
20
  let markProps: GridYMarkProps = $props();
21
21
 
@@ -33,8 +33,7 @@
33
33
  ...markProps
34
34
  });
35
35
 
36
- const { getPlotState } = getContext<PlotContext>('svelteplot');
37
- const plot = $derived(getPlotState());
36
+ const plot = usePlot();
38
37
 
39
38
  const autoTickCount = $derived(
40
39
  Math.max(2, Math.round(plot.facetHeight / plot.options.y.tickSpacing))