svelteplot 0.3.11 → 0.4.1

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 (40) hide show
  1. package/dist/core/FacetGrid.svelte +3 -0
  2. package/dist/helpers/autoScales.js +1 -1
  3. package/dist/helpers/group.d.ts +2 -2
  4. package/dist/helpers/index.d.ts +3 -6
  5. package/dist/helpers/index.js +1 -1
  6. package/dist/helpers/mergeDeep.js +0 -1
  7. package/dist/helpers/reduce.js +0 -1
  8. package/dist/helpers/scales.js +1 -1
  9. package/dist/marks/AreaX.svelte.d.ts +29 -29
  10. package/dist/marks/AreaY.svelte.d.ts +29 -29
  11. package/dist/marks/DotX.svelte.d.ts +29 -29
  12. package/dist/marks/DotY.svelte.d.ts +29 -29
  13. package/dist/marks/GridX.svelte +4 -2
  14. package/dist/marks/GridY.svelte +4 -2
  15. package/dist/marks/HTMLTooltip.svelte +38 -12
  16. package/dist/marks/HTMLTooltip.svelte.d.ts +2 -0
  17. package/dist/marks/LineX.svelte.d.ts +33 -33
  18. package/dist/marks/LineY.svelte.d.ts +33 -33
  19. package/dist/marks/Spike.svelte.d.ts +27 -27
  20. package/dist/marks/Text.svelte +9 -6
  21. package/dist/marks/Text.svelte.d.ts +8 -4
  22. package/dist/marks/helpers/MultilineText.svelte +6 -8
  23. package/dist/transforms/bollinger.d.ts +22 -22
  24. package/dist/transforms/filter.d.ts +2 -2
  25. package/dist/transforms/group.d.ts +4 -4
  26. package/dist/transforms/index.d.ts +1 -1
  27. package/dist/transforms/index.js +1 -1
  28. package/dist/transforms/map.d.ts +4 -184
  29. package/dist/transforms/normalize.d.ts +3 -123
  30. package/dist/transforms/select.d.ts +161 -161
  31. package/dist/transforms/sort.d.ts +50 -50
  32. package/dist/transforms/stack.d.ts +23 -1
  33. package/dist/transforms/stack.js +71 -2
  34. package/dist/transforms/window.d.ts +44 -46
  35. package/dist/types/channel.d.ts +1 -1
  36. package/dist/types/data.d.ts +1 -3
  37. package/dist/types/index.d.ts +4 -4
  38. package/dist/types/scale.d.ts +1 -1
  39. package/dist/ui/ExamplesGrid.svelte +2 -1
  40. package/package.json +16 -16
@@ -1,36 +1,36 @@
1
- import type { DataRecord, DataRow, TransformArg } from '../types/index.js';
1
+ import type { DataRow, TransformArg } from '../types/index.js';
2
2
  export declare const SORT_KEY: unique symbol;
3
3
  export declare const IS_SORTED: unique symbol;
4
- export declare function sort({ data, ...channels }: TransformArg<DataRecord>, options?: {
4
+ export declare function sort<T>({ data, ...channels }: TransformArg<T>, options?: {
5
5
  reverse?: boolean;
6
6
  }): {
7
7
  [IS_SORTED]: string | number | true | symbol | Date | {
8
8
  channel: string;
9
9
  order?: "ascending" | "descending";
10
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | ((d: DataRecord) => import("../types/index.js").RawValue);
10
+ } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | ((d: T) => import("../types/index.js").RawValue);
11
11
  sort: null;
12
- filter?: import("../types/index.js").ConstantAccessor<boolean, DataRecord>;
12
+ filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
13
13
  facet?: "auto" | "include" | "exclude" | undefined;
14
- fx?: import("../types/index.js").ChannelAccessor<DataRecord>;
15
- fy?: import("../types/index.js").ChannelAccessor<DataRecord>;
16
- dx?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
17
- dy?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
18
- fill?: import("../types/index.js").ChannelAccessor<DataRecord>;
19
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
20
- stroke?: import("../types/index.js").ChannelAccessor<DataRecord>;
21
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
22
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
23
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, DataRecord>;
24
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, DataRecord>;
25
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
26
- opacity?: import("../types/index.js").ChannelAccessor<DataRecord>;
27
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
28
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
29
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, DataRecord>;
14
+ fx?: import("../types/index.js").ChannelAccessor<T>;
15
+ fy?: import("../types/index.js").ChannelAccessor<T>;
16
+ dx?: import("../types/index.js").ConstantAccessor<number, T>;
17
+ dy?: import("../types/index.js").ConstantAccessor<number, T>;
18
+ fill?: import("../types/index.js").ChannelAccessor<T>;
19
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
20
+ stroke?: import("../types/index.js").ChannelAccessor<T>;
21
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
22
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
23
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
24
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
25
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
26
+ opacity?: import("../types/index.js").ChannelAccessor<T>;
27
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
28
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
29
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
30
30
  clipPath?: string | undefined;
31
- imageFilter?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
32
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, DataRecord>;
33
- paintOrder?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
31
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
32
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
33
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
34
34
  onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
35
35
  ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
36
36
  onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
@@ -62,37 +62,37 @@ export declare function sort({ data, ...channels }: TransformArg<DataRecord>, op
62
62
  oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
63
63
  onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
64
64
  class?: string | null | undefined;
65
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, DataRecord>;
66
- data: {
67
- ___orig___?: import("../types/index.js").RawValue | [import("../types/index.js").RawValue, import("../types/index.js").RawValue];
68
- }[];
65
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
66
+ data: T[] | Omit<T & {
67
+ [SORT_KEY]: number | Date | string;
68
+ }, typeof SORT_KEY>[];
69
69
  } | {
70
- filter?: import("../types/index.js").ConstantAccessor<boolean, DataRecord>;
70
+ filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
71
71
  facet?: "auto" | "include" | "exclude" | undefined;
72
- fx?: import("../types/index.js").ChannelAccessor<DataRecord>;
73
- fy?: import("../types/index.js").ChannelAccessor<DataRecord>;
74
- dx?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
75
- dy?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
76
- fill?: import("../types/index.js").ChannelAccessor<DataRecord>;
77
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
72
+ fx?: import("../types/index.js").ChannelAccessor<T>;
73
+ fy?: import("../types/index.js").ChannelAccessor<T>;
74
+ dx?: import("../types/index.js").ConstantAccessor<number, T>;
75
+ dy?: import("../types/index.js").ConstantAccessor<number, T>;
76
+ fill?: import("../types/index.js").ChannelAccessor<T>;
77
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
78
78
  sort?: {
79
79
  channel: string;
80
80
  order?: "ascending" | "descending";
81
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, DataRecord>;
82
- stroke?: import("../types/index.js").ChannelAccessor<DataRecord>;
83
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
84
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
85
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, DataRecord>;
86
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, DataRecord>;
87
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
88
- opacity?: import("../types/index.js").ChannelAccessor<DataRecord>;
89
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
90
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
91
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, DataRecord>;
81
+ } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
82
+ stroke?: import("../types/index.js").ChannelAccessor<T>;
83
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
84
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
85
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
86
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
87
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
88
+ opacity?: import("../types/index.js").ChannelAccessor<T>;
89
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
90
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
91
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
92
92
  clipPath?: string | undefined;
93
- imageFilter?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
94
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, DataRecord>;
95
- paintOrder?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
93
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
94
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
95
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
96
96
  onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
97
97
  ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
98
98
  onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
@@ -124,8 +124,8 @@ export declare function sort({ data, ...channels }: TransformArg<DataRecord>, op
124
124
  oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
125
125
  onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
126
126
  class?: string | null | undefined;
127
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, DataRecord>;
128
- data: DataRecord[];
127
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
128
+ data: T[];
129
129
  };
130
130
  /**
131
131
  * shuffles the data row order
@@ -1,4 +1,4 @@
1
- import type { TransformArg } from '../types/index.js';
1
+ import type { ChannelAccessor, TransformArg } from '../types/index.js';
2
2
  export type StackOrder = 'none' | 'appearance' | 'inside-out' | 'sum';
3
3
  export type StackOffset = 'none' | 'wiggle' | 'center' | 'normalize' | 'diverging';
4
4
  export type StackOptions = {
@@ -8,3 +8,25 @@ export type StackOptions = {
8
8
  };
9
9
  export declare function stackY<T>({ data, ...channels }: T, opts?: Partial<StackOptions>): T;
10
10
  export declare function stackX({ data, ...channels }: TransformArg, opts?: Partial<StackOptions>): TransformArg;
11
+ export declare function stackMosaicX<T>(args: any, opts: any): {
12
+ fx: ChannelAccessor<unknown>;
13
+ fy: ChannelAccessor<unknown>;
14
+ data: unknown[];
15
+ x: symbol;
16
+ x1: symbol;
17
+ x2: symbol;
18
+ y: symbol;
19
+ y1: symbol;
20
+ y2: symbol;
21
+ };
22
+ export declare function stackMosaicY<T>(args: any, opts: any): {
23
+ fx: ChannelAccessor<unknown>;
24
+ fy: ChannelAccessor<unknown>;
25
+ data: unknown[];
26
+ x: symbol;
27
+ x1: symbol;
28
+ x2: symbol;
29
+ y: symbol;
30
+ y1: symbol;
31
+ y2: symbol;
32
+ };
@@ -1,7 +1,10 @@
1
1
  import isDataRecord from '../helpers/isDataRecord.js';
2
- import { resolveChannel } from '../helpers/resolve.js';
2
+ import { resolveChannel, resolveProp } from '../helpers/resolve.js';
3
3
  import { stack, stackOffsetExpand, stackOffsetSilhouette, stackOffsetWiggle, stackOrderAppearance, stackOrderAscending, stackOrderInsideOut, stackOrderNone, stackOffsetDiverging } from 'd3-shape';
4
- import { index, union, groups as d3Groups } from 'd3-array';
4
+ import { index, union, sum, groups as d3Groups, extent, min } from 'd3-array';
5
+ import { groupFacetsAndZ } from '../helpers/group';
6
+ import { filter } from './filter.js';
7
+ import { sort } from './sort.js';
5
8
  const GROUP = Symbol('group');
6
9
  const FACET = Symbol('group');
7
10
  const DEFAULT_STACK_OPTIONS = {
@@ -110,3 +113,69 @@ function applyDefaults(opts) {
110
113
  }
111
114
  return { ...DEFAULT_STACK_OPTIONS, ...opts };
112
115
  }
116
+ const X = Symbol('x');
117
+ const X1 = Symbol('x1');
118
+ const X2 = Symbol('x2');
119
+ const Y = Symbol('y');
120
+ const Y1 = Symbol('y1');
121
+ const Y2 = Symbol('y2');
122
+ function stackMosaic({ data, x, y, value, fx, fy, ...rest }, { outer, inner }, { x: xOpt, y: yOpt } = {}) {
123
+ const out = [];
124
+ const { data: filtered, ...restArgs } = sort(filter({ data, x, y, value, fx, fy, ...rest }));
125
+ if (!filtered)
126
+ throw new Error('stackMosaic: missing data');
127
+ if (!x)
128
+ throw new Error('stackMosaic: missing x channel');
129
+ if (!y)
130
+ throw new Error('stackMosaic: missing y channel');
131
+ if (!value)
132
+ throw new Error('stackMosaic: missing value channel');
133
+ if (min(filtered, (d) => resolveProp(d[value], d)) < 0)
134
+ throw new Error('stackMosaic: negative values not supported');
135
+ groupFacetsAndZ(filtered, restArgs, (data) => {
136
+ const total = sum(data, (d) => resolveProp(d[value], d));
137
+ let outerPos = 0;
138
+ const outerChannel = outer === 'x' ? x : y;
139
+ const innerChannel = inner === 'x' ? x : y;
140
+ const outerSym1 = outer === 'x' ? X1 : Y1;
141
+ const outerSym2 = outer === 'x' ? X2 : Y2;
142
+ const innerSym1 = inner === 'x' ? X1 : Y1;
143
+ const innerSym2 = inner === 'x' ? X2 : Y2;
144
+ const outerOpt = outer === 'x' ? xOpt : yOpt;
145
+ const innerOpt = inner === 'x' ? xOpt : yOpt;
146
+ const grouped = d3Groups(data, (d) => resolveProp(d[outerChannel], d));
147
+ const innerOrder = new Map(grouped[0][1].map((d, i) => [d[innerChannel], i]));
148
+ grouped.forEach(([k, items], i) => {
149
+ const groupValue = sum(items, (d) => resolveProp(d[value], d));
150
+ const o1 = outerPos, o2 = outerPos + groupValue;
151
+ outerPos = o2;
152
+ let innerPos = 0;
153
+ (i
154
+ ? items.sort((a, b) => innerOrder.get(a[innerChannel]) - innerOrder.get(b[innerChannel]))
155
+ : items).forEach((d) => {
156
+ const iv = resolveProp(d[value], d);
157
+ const i1 = innerPos, i2 = innerPos + iv;
158
+ innerPos = i2;
159
+ const normO1 = outerOpt?.percent ? o1 / total : o1;
160
+ const normO2 = outerOpt?.percent ? o2 / total : o2;
161
+ const normI1 = innerOpt?.percent ? i1 / groupValue : i1;
162
+ const normI2 = innerOpt?.percent ? i2 / groupValue : i2;
163
+ const result = { ...d };
164
+ result[outerSym1] = normO1;
165
+ result[outerSym2] = normO2;
166
+ result[innerSym1] = normI1;
167
+ result[innerSym2] = normI2;
168
+ result[X] = (result[X1] + result[X2]) / 2;
169
+ result[Y] = (result[Y1] + result[Y2]) / 2;
170
+ out.push(result);
171
+ });
172
+ });
173
+ });
174
+ return { ...rest, fx, fy, data: out, x: X, x1: X1, x2: X2, y: Y, y1: Y1, y2: Y2 };
175
+ }
176
+ export function stackMosaicX(args, opts) {
177
+ return stackMosaic(args, { outer: 'x', inner: 'y' }, opts);
178
+ }
179
+ export function stackMosaicY(args, opts) {
180
+ return stackMosaic(args, { outer: 'y', inner: 'x' }, opts);
181
+ }
@@ -8,32 +8,32 @@ type WindowOptions = {
8
8
  strict: boolean;
9
9
  };
10
10
  export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions): {
11
- filter?: import("../types/index.js").ConstantAccessor<boolean, DataRecord>;
11
+ filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/index.js").RawValue>>;
12
12
  facet?: "auto" | "include" | "exclude" | undefined;
13
- fx?: import("../types/index.js").ChannelAccessor<DataRecord>;
14
- fy?: import("../types/index.js").ChannelAccessor<DataRecord>;
15
- dx?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
16
- dy?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
17
- fill?: import("../types/index.js").ChannelAccessor<DataRecord>;
18
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
13
+ fx?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
14
+ fy?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
15
+ dx?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
16
+ dy?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
17
+ fill?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
18
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
19
19
  sort?: {
20
20
  channel: string;
21
21
  order?: "ascending" | "descending";
22
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, DataRecord>;
23
- stroke?: import("../types/index.js").ChannelAccessor<DataRecord>;
24
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
25
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
26
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, DataRecord>;
27
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, DataRecord>;
28
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
29
- opacity?: import("../types/index.js").ChannelAccessor<DataRecord>;
30
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
31
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
32
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, DataRecord>;
22
+ } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Record<string | symbol, import("../types/index.js").RawValue>>;
23
+ stroke?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
24
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
25
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
26
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/index.js").RawValue>>;
27
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/index.js").RawValue>>;
28
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
29
+ opacity?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
30
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
31
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
32
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/index.js").RawValue>>;
33
33
  clipPath?: string | undefined;
34
- imageFilter?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
35
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, DataRecord>;
36
- paintOrder?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
34
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
35
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/index.js").RawValue>>;
36
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
37
37
  onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
38
38
  ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
39
39
  onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
@@ -65,40 +65,39 @@ export declare function windowX(args: TransformArg<DataRecord>, options: WindowO
65
65
  oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
66
66
  onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
67
67
  class?: string | null | undefined;
68
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, DataRecord>;
68
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/index.js").RawValue>>;
69
69
  data: {
70
70
  [x: string]: import("../types/index.js").RawValue;
71
71
  [x: symbol]: import("../types/index.js").RawValue;
72
- ___orig___?: import("../types/index.js").RawValue | [import("../types/index.js").RawValue, import("../types/index.js").RawValue];
73
72
  }[];
74
73
  };
75
74
  export declare function windowY(args: TransformArg<DataRecord>, options: WindowOptions): {
76
- filter?: import("../types/index.js").ConstantAccessor<boolean, DataRecord>;
75
+ filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/index.js").RawValue>>;
77
76
  facet?: "auto" | "include" | "exclude" | undefined;
78
- fx?: import("../types/index.js").ChannelAccessor<DataRecord>;
79
- fy?: import("../types/index.js").ChannelAccessor<DataRecord>;
80
- dx?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
81
- dy?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
82
- fill?: import("../types/index.js").ChannelAccessor<DataRecord>;
83
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
77
+ fx?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
78
+ fy?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
79
+ dx?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
80
+ dy?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
81
+ fill?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
82
+ fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
84
83
  sort?: {
85
84
  channel: string;
86
85
  order?: "ascending" | "descending";
87
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, DataRecord>;
88
- stroke?: import("../types/index.js").ChannelAccessor<DataRecord>;
89
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
90
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
91
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, DataRecord>;
92
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, DataRecord>;
93
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
94
- opacity?: import("../types/index.js").ChannelAccessor<DataRecord>;
95
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
96
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, DataRecord>;
97
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, DataRecord>;
86
+ } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Record<string | symbol, import("../types/index.js").RawValue>>;
87
+ stroke?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
88
+ strokeWidth?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
89
+ strokeOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
90
+ strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/index.js").RawValue>>;
91
+ strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/index.js").RawValue>>;
92
+ strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
93
+ opacity?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
94
+ strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
95
+ strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
96
+ mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/index.js").RawValue>>;
98
97
  clipPath?: string | undefined;
99
- imageFilter?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
100
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, DataRecord>;
101
- paintOrder?: import("../types/index.js").ConstantAccessor<string, DataRecord>;
98
+ imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
99
+ shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/index.js").RawValue>>;
100
+ paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
102
101
  onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
103
102
  ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
104
103
  onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
@@ -130,11 +129,10 @@ export declare function windowY(args: TransformArg<DataRecord>, options: WindowO
130
129
  oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
131
130
  onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
132
131
  class?: string | null | undefined;
133
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, DataRecord>;
132
+ cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/index.js").RawValue>>;
134
133
  data: {
135
134
  [x: string]: import("../types/index.js").RawValue;
136
135
  [x: symbol]: import("../types/index.js").RawValue;
137
- ___orig___?: import("../types/index.js").RawValue | [import("../types/index.js").RawValue, import("../types/index.js").RawValue];
138
136
  }[];
139
137
  };
140
138
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { ConstantAccessor, RawValue } from './index.js';
2
- export type Channels = Record<string, ChannelAccessor | ConstantAccessor<string | number | boolean | symbol>>;
2
+ export type Channels<T> = Record<string, ChannelAccessor<T> | ConstantAccessor<T, string | number | boolean | symbol>>;
3
3
  export type ChannelAccessor<T = Record<string | symbol, RawValue>> = ChannelValue<T> | {
4
4
  /** the channel value */
5
5
  value: ChannelValue<T>;
@@ -1,8 +1,6 @@
1
1
  import type { ScaledChannelName, ScaledChannelType } from './channel.js';
2
2
  export type RawValue = number | Date | boolean | string | symbol;
3
- export type DataRecord<T = Record<string | symbol, RawValue>> = T & {
4
- ___orig___?: RawValue | [RawValue, RawValue];
5
- };
3
+ export type DataRecord<T = Record<string | symbol, RawValue>> = T;
6
4
  export type ResolvedDataRecord<T = Record<string | symbol, RawValue>> = Partial<Record<ScaledChannelName, any>> & {
7
5
  datum: DataRecord<T>;
8
6
  };
@@ -25,11 +25,11 @@ export type MarkerOptions = {
25
25
  marker?: boolean | MarkerShape | Snippet;
26
26
  };
27
27
  export type ConstantAccessor<T, D = Record<string | symbol, RawValue>> = T | ((d: D) => T) | null | undefined;
28
- export type TransformArg<K> = Channels & BaseMarkProps<K> & {
29
- data: K[];
28
+ export type TransformArg<T> = Channels<T> & BaseMarkProps<T> & {
29
+ data: T[];
30
30
  };
31
- export type MapArg<K> = Channels & {
32
- data: K[];
31
+ export type MapArg<T> = Channels<T> & {
32
+ data: T[];
33
33
  };
34
34
  export type TransformArgsRow = Partial<Channels> & {
35
35
  data: DataRow[];
@@ -21,7 +21,7 @@ export type ScaleOptions = {
21
21
  * Reverse the scale.
22
22
  */
23
23
  reverse: boolean;
24
- label?: string;
24
+ label?: string | false;
25
25
  interval?: string | number;
26
26
  clamp: boolean;
27
27
  nice: boolean;
@@ -1,10 +1,11 @@
1
1
  <script>
2
+ import { resolve } from '$app/paths';
2
3
  let { examples } = $props();
3
4
  </script>
4
5
 
5
6
  <div class="list">
6
7
  {#each examples as page, i (i)}
7
- <a href={page.url}>
8
+ <a href={resolve(page.url)}>
8
9
  <div>
9
10
  {#if page.screenshot}
10
11
  <img src={page.screenshot} alt={page.title} />{/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.3.11",
3
+ "version": "0.4.1",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",
@@ -36,11 +36,11 @@
36
36
  "devDependencies": {
37
37
  "@aitodotai/json-stringify-pretty-compact": "^1.3.0",
38
38
  "@emotion/css": "^11.13.5",
39
- "@sveltejs/adapter-auto": "^6.0.1",
40
- "@sveltejs/adapter-static": "^3.0.8",
39
+ "@sveltejs/adapter-auto": "^6.1.0",
40
+ "@sveltejs/adapter-static": "^3.0.9",
41
41
  "@sveltejs/eslint-config": "^8.3.4",
42
- "@sveltejs/kit": "^2.27.1",
43
- "@sveltejs/package": "^2.4.0",
42
+ "@sveltejs/kit": "^2.37.0",
43
+ "@sveltejs/package": "^2.5.0",
44
44
  "@sveltejs/vite-plugin-svelte": "5.1.1",
45
45
  "@sveltepress/theme-default": "^6.0.4",
46
46
  "@sveltepress/twoslash": "^1.2.2",
@@ -61,32 +61,32 @@
61
61
  "@types/geojson": "^7946.0.16",
62
62
  "@types/topojson": "^3.2.6",
63
63
  "@types/topojson-client": "^3.1.5",
64
- "@typescript-eslint/eslint-plugin": "^8.39.0",
65
- "@typescript-eslint/parser": "^8.39.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.42.0",
65
+ "@typescript-eslint/parser": "^8.42.0",
66
66
  "csstype": "^3.1.3",
67
67
  "d3-dsv": "^3.0.1",
68
68
  "d3-fetch": "^3.0.1",
69
69
  "d3-force": "^3.0.0",
70
- "eslint": "^9.32.0",
70
+ "eslint": "^9.34.0",
71
71
  "eslint-config-prettier": "^10.1.8",
72
- "eslint-plugin-svelte": "3.11.0",
72
+ "eslint-plugin-svelte": "3.12.1",
73
73
  "jsdom": "^26.1.0",
74
74
  "prettier": "^3.6.2",
75
75
  "prettier-plugin-svelte": "^3.4.0",
76
- "puppeteer": "^24.15.0",
76
+ "puppeteer": "^24.19.0",
77
77
  "remark-code-extra": "^1.0.1",
78
78
  "remark-code-frontmatter": "^1.0.0",
79
79
  "resize-observer-polyfill": "^1.5.1",
80
- "sass": "^1.90.0",
80
+ "sass": "^1.92.0",
81
81
  "svelte-check": "^4.3.1",
82
82
  "svelte-eslint-parser": "1.3.1",
83
- "svelte-highlight": "^7.8.3",
83
+ "svelte-highlight": "^7.8.4",
84
84
  "svg-path-parser": "^1.1.0",
85
85
  "topojson-client": "^3.1.0",
86
86
  "ts-essentials": "^10.1.1",
87
87
  "tslib": "^2.8.1",
88
- "typedoc": "^0.28.9",
89
- "typedoc-plugin-markdown": "^4.8.0",
88
+ "typedoc": "^0.28.12",
89
+ "typedoc-plugin-markdown": "^4.8.1",
90
90
  "typescript": "^5.9.2",
91
91
  "vite": "^6.3.5",
92
92
  "vitest": "^3.2.4",
@@ -108,10 +108,10 @@
108
108
  "d3-scale-chromatic": "^3.1.0",
109
109
  "d3-shape": "^3.2.0",
110
110
  "d3-time": "^3.1.0",
111
- "es-toolkit": "^1.39.8",
111
+ "es-toolkit": "^1.39.10",
112
112
  "fast-equals": "^5.2.2",
113
113
  "merge-deep": "^3.0.3",
114
- "svelte": "5.37.3"
114
+ "svelte": "5.38.7"
115
115
  },
116
116
  "scripts": {
117
117
  "dev": "vite dev",