svelteplot 0.4.1-pr-182.2 → 0.4.2-pr-185.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.
@@ -4,7 +4,9 @@
4
4
  <script lang="ts" generics="Datum extends DataRecord">
5
5
  interface ArrowMarkProps extends Omit<BaseMarkProps<Datum>, 'fill' | 'fillOpacity'> {
6
6
  data: Datum[];
7
- sort?: ConstantAccessor<RawValue> | { channel: 'stroke' | 'fill' };
7
+ sort?:
8
+ | ConstantAccessor<RawValue>
9
+ | { channel: 'stroke' | 'fill' | 'x1' | 'y1' | 'x2' | 'y2' };
8
10
  x1: ChannelAccessor<Datum>;
9
11
  y1: ChannelAccessor<Datum>;
10
12
  x2: ChannelAccessor<Datum>;
@@ -52,6 +54,7 @@
52
54
  import { replaceChannels } from '../transforms/rename.js';
53
55
  import { addEventHandlers } from './helpers/events.js';
54
56
  import GroupMultiple from './helpers/GroupMultiple.svelte';
57
+ import { sort } from '../transforms/sort.js';
55
58
 
56
59
  let markProps: ArrowMarkProps = $props();
57
60
 
@@ -74,16 +77,13 @@
74
77
  const { getPlotState } = getContext<PlotContext>('svelteplot');
75
78
  const plot = $derived(getPlotState());
76
79
 
77
- const sorted = $derived(
78
- options.sort
79
- ? maybeData(data).toSorted((a, b) =>
80
- resolveChannel('sort', a, options) > resolveChannel('sort', b, options) ? 1 : -1
81
- )
82
- : maybeData(data)
83
- );
84
-
85
80
  const args: ArrowMarkProps = $derived(
86
- replaceChannels({ data: sorted, ...options }, { y: ['y1', 'y2'], x: ['x1', 'x2'] })
81
+ sort(
82
+ replaceChannels(
83
+ { data: maybeData(data), ...options },
84
+ { y: ['y1', 'y2'], x: ['x1', 'x2'] }
85
+ )
86
+ )
87
87
  );
88
88
  </script>
89
89
 
@@ -63,7 +63,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
63
63
  }>, "fill" | "fillOpacity"> & {
64
64
  data: Datum[];
65
65
  sort?: ConstantAccessor<RawValue> | {
66
- channel: "stroke" | "fill";
66
+ channel: "stroke" | "fill" | "x1" | "y1" | "x2" | "y2";
67
67
  };
68
68
  x1: ChannelAccessor<Datum>;
69
69
  y1: ChannelAccessor<Datum>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.4.1-pr-182.2",
3
+ "version": "0.4.2-pr-185.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",