svelteplot 0.3.10-pr-151.0 → 0.3.10-pr-152.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.
@@ -1,10 +1,12 @@
1
1
  <script lang="ts" generics="Datum extends DataRow">
2
2
  interface PointerMarkProps {
3
3
  data: Datum[];
4
- children: Snippet<[{ data: Datum[] }]>;
4
+ children?: Snippet<[{ data: Datum[] }]>;
5
5
  x?: ChannelAccessor<Datum>;
6
6
  y?: ChannelAccessor<Datum>;
7
7
  z?: ChannelAccessor<Datum>;
8
+ fx?: ChannelAccessor<Datum>;
9
+ fy?: ChannelAccessor<Datum>;
8
10
  /**
9
11
  * maximum cursor distance to select data points
10
12
  */
@@ -29,6 +31,7 @@
29
31
  import { projectXY } from '../helpers/scales.js';
30
32
  import isDataRecord from '../helpers/isDataRecord.js';
31
33
  import { RAW_VALUE } from '../transforms/recordize.js';
34
+ import { groupFacetsAndZ } from '../helpers/group.js';
32
35
 
33
36
  const { getPlotState } = getContext<PlotContext>('svelteplot');
34
37
  const plot = $derived(getPlotState());
@@ -48,6 +51,8 @@
48
51
  x,
49
52
  y,
50
53
  z,
54
+ fx,
55
+ fy,
51
56
  maxDistance = 15,
52
57
  tolerance = Number.NEGATIVE_INFINITY,
53
58
  onupdate = null
@@ -109,12 +114,14 @@
109
114
  };
110
115
  });
111
116
 
112
- const groups = $derived(
113
- z != null ? d3Groups(data, (d) => resolveChannel('z', d, { x, z })) : [[null, data]]
114
- );
117
+ const groups = $derived.by(() => {
118
+ const groups = [];
119
+ groupFacetsAndZ(data, { x, y, z, fx, fy }, (d) => groups.push(d));
120
+ return groups;
121
+ });
115
122
 
116
123
  const trees = $derived(
117
- groups.map(([, items]) =>
124
+ groups.map((items) =>
118
125
  quadtree()
119
126
  .x(x != null ? (d) => d[POINTER_X] : () => 0)
120
127
  .y(y != null ? (d) => d[POINTER_Y] : () => 0)
@@ -3,12 +3,14 @@ import type { ChannelAccessor, DataRow } from '../types/index.js';
3
3
  declare class __sveltets_Render<Datum extends DataRow> {
4
4
  props(): {
5
5
  data: Datum[];
6
- children: Snippet<[{
6
+ children?: Snippet<[{
7
7
  data: Datum[];
8
- }]>;
8
+ }]> | undefined;
9
9
  x?: ChannelAccessor<Datum>;
10
10
  y?: ChannelAccessor<Datum>;
11
11
  z?: ChannelAccessor<Datum>;
12
+ fx?: ChannelAccessor<Datum>;
13
+ fy?: ChannelAccessor<Datum>;
12
14
  /**
13
15
  * maximum cursor distance to select data points
14
16
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.3.10-pr-151.0",
3
+ "version": "0.3.10-pr-152.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",