svelteplot 0.2.7-pr-65.2 → 0.2.8
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.
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/scales.d.ts +1 -1
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/marks/BollingerX.svelte.d.ts +1 -1
- package/dist/marks/BollingerY.svelte.d.ts +1 -1
- package/dist/marks/ColorLegend.svelte +1 -1
- package/dist/marks/Line.svelte +1 -5
- package/dist/marks/Line.svelte.d.ts +1 -1
- package/dist/marks/Sphere.svelte.d.ts +56 -1
- package/dist/marks/helpers/CanvasLayer.svelte +30 -8
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +41 -1
- package/dist/transforms/bollinger.d.ts +8 -1
- package/dist/transforms/centroid.d.ts +8 -1
- package/dist/transforms/group.d.ts +12 -4
- package/dist/transforms/interval.d.ts +6 -2
- package/dist/transforms/map.d.ts +10 -4
- package/dist/transforms/normalize.d.ts +6 -2
- package/dist/transforms/select.d.ts +21 -7
- package/dist/transforms/sort.d.ts +16 -3
- package/dist/transforms/window.d.ts +14 -2
- package/package.json +117 -118
package/dist/helpers/colors.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type SchemeGetter = (n: number) => readonly string[];
|
|
|
6
6
|
export declare function isOrdinalScheme(scheme: ColorScheme): boolean;
|
|
7
7
|
export declare function ordinalScheme(scheme: string): SchemeGetter | undefined;
|
|
8
8
|
export declare function ordinalRange(scheme: string, length: number): readonly string[] | undefined;
|
|
9
|
-
export declare function maybeBooleanRange(domain: boolean[], scheme?: string):
|
|
9
|
+
export declare function maybeBooleanRange(domain: boolean[], scheme?: string): unknown[] | undefined;
|
|
10
10
|
export declare function isQuantitativeScheme(scheme: string): boolean;
|
|
11
11
|
export declare function quantitativeScheme(scheme: string): typeof interpolateBrBG | undefined;
|
|
12
12
|
export declare function isDivergingScheme(scheme: string): boolean;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
|
-
export declare function coalesce(...args: (RawValue | undefined | null)[]):
|
|
7
|
-
export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>):
|
|
6
|
+
export declare function coalesce(...args: (RawValue | undefined | null)[]): RawValue | null;
|
|
7
|
+
export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>): string | number | boolean | symbol | Date | null;
|
|
8
8
|
export declare function randomId(): string;
|
|
9
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
10
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
package/dist/helpers/scales.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
|
|
|
15
15
|
autoTitle?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
type: ScaleType;
|
|
18
|
-
domain:
|
|
18
|
+
domain: RawValue[] | [undefined, undefined];
|
|
19
19
|
range: any;
|
|
20
20
|
fn: any;
|
|
21
21
|
skip: Map<ScaledChannelName, Set<symbol>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawValue } from '../types.js';
|
|
2
|
-
export declare function isBooleanOrNull(v: RawValue): boolean;
|
|
2
|
+
export declare function isBooleanOrNull(v: RawValue): v is boolean;
|
|
3
3
|
export declare function isDate(v: RawValue): v is Date;
|
|
4
|
-
export declare function isDateOrNull(v: RawValue | null | undefined):
|
|
4
|
+
export declare function isDateOrNull(v: RawValue | null | undefined): v is Date | null | undefined;
|
|
5
5
|
export declare function isNumberOrNull(v: RawValue | null | undefined): boolean;
|
|
6
6
|
export declare function isNumberOrNullOrNaN(v: RawValue | null | undefined): boolean;
|
|
7
|
-
export declare function isStringOrNull(v: RawValue | null | undefined):
|
|
7
|
+
export declare function isStringOrNull(v: RawValue | null | undefined): v is string | null | undefined;
|
|
8
8
|
export declare function isSymbolOrNull(v: RawValue | null | undefined): boolean;
|
|
9
|
-
export declare function isColorOrNull(v: RawValue | null | undefined):
|
|
9
|
+
export declare function isColorOrNull(v: RawValue | null | undefined): boolean;
|
|
10
10
|
export declare function isOpacityOrNull(v: RawValue): boolean;
|
|
@@ -13,6 +13,6 @@ export type BollingerXMarkProps = BaseMarkProps & {
|
|
|
13
13
|
};
|
|
14
14
|
import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
|
|
15
15
|
/** line representing a moving average and an area representing volatility as a band */
|
|
16
|
-
declare const BollingerX: import("svelte").Component<
|
|
16
|
+
declare const BollingerX: import("svelte").Component<BollingerXMarkProps, {}, "">;
|
|
17
17
|
type BollingerX = ReturnType<typeof BollingerX>;
|
|
18
18
|
export default BollingerX;
|
|
@@ -13,6 +13,6 @@ export type BollingerYMarkProps = BaseMarkProps & {
|
|
|
13
13
|
};
|
|
14
14
|
import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
|
|
15
15
|
/** line representing a moving average and an area representing volatility as a band */
|
|
16
|
-
declare const BollingerY: import("svelte").Component<
|
|
16
|
+
declare const BollingerY: import("svelte").Component<BollingerYMarkProps, {}, "">;
|
|
17
17
|
type BollingerY = ReturnType<typeof BollingerY>;
|
|
18
18
|
export default BollingerY;
|
package/dist/marks/Line.svelte
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
outlineStroke?: string;
|
|
22
22
|
outlineStrokeWidth?: number;
|
|
23
23
|
outlineStrokeOpacity?: number;
|
|
24
|
-
curve?: CurveName | CurveFactory;
|
|
24
|
+
curve?: CurveName | CurveFactory | 'auto';
|
|
25
25
|
tension?: number;
|
|
26
26
|
sort?: ConstantAccessor<RawValue> | { channel: 'stroke' | 'fill' };
|
|
27
27
|
text?: ConstantAccessor<string>;
|
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
if (groupValue === lastGroupValue) {
|
|
77
77
|
group.push(d);
|
|
78
78
|
} else {
|
|
79
|
-
if (group.length === 1) {
|
|
80
|
-
// just one point makes a bad line, add this one, too
|
|
81
|
-
group.push(d);
|
|
82
|
-
}
|
|
83
79
|
// new group
|
|
84
80
|
group = [d];
|
|
85
81
|
groups.push(group);
|
|
@@ -7,7 +7,7 @@ export type LineMarkProps = {
|
|
|
7
7
|
outlineStroke?: string;
|
|
8
8
|
outlineStrokeWidth?: number;
|
|
9
9
|
outlineStrokeOpacity?: number;
|
|
10
|
-
curve?: CurveName | CurveFactory;
|
|
10
|
+
curve?: CurveName | CurveFactory | 'auto';
|
|
11
11
|
tension?: number;
|
|
12
12
|
sort?: ConstantAccessor<RawValue> | {
|
|
13
13
|
channel: 'stroke' | 'fill';
|
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
import { type BaseMarkProps } from '../types.js';
|
|
2
2
|
export type SphereMarkProps = BaseMarkProps;
|
|
3
3
|
/** Geo mark with Sphere geometry object */
|
|
4
|
-
declare const Sphere: import("svelte").Component<
|
|
4
|
+
declare const Sphere: import("svelte").Component<Partial<{
|
|
5
|
+
filter?: import("../types.js").ConstantAccessor<boolean>;
|
|
6
|
+
facet?: "auto" | "include" | "exclude";
|
|
7
|
+
fx: import("../types.js").ChannelAccessor;
|
|
8
|
+
fy: import("../types.js").ChannelAccessor;
|
|
9
|
+
dx: import("../types.js").ConstantAccessor<number>;
|
|
10
|
+
dy: import("../types.js").ConstantAccessor<number>;
|
|
11
|
+
fill: import("../types.js").ConstantAccessor<string>;
|
|
12
|
+
fillOpacity: import("../types.js").ConstantAccessor<number>;
|
|
13
|
+
stroke: import("../types.js").ConstantAccessor<string>;
|
|
14
|
+
strokeWidth: import("../types.js").ConstantAccessor<number>;
|
|
15
|
+
strokeOpacity: import("../types.js").ConstantAccessor<number>;
|
|
16
|
+
strokeLinejoin: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin>;
|
|
17
|
+
strokeLinecap: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinecap>;
|
|
18
|
+
strokeMiterlimit: import("../types.js").ConstantAccessor<number>;
|
|
19
|
+
opacity: import("../types.js").ConstantAccessor<number>;
|
|
20
|
+
strokeDasharray: import("../types.js").ConstantAccessor<string>;
|
|
21
|
+
strokeDashoffset: import("../types.js").ConstantAccessor<number>;
|
|
22
|
+
mixBlendMode: import("../types.js").ConstantAccessor<import("csstype").Property.MixBlendMode>;
|
|
23
|
+
clipPath: string;
|
|
24
|
+
imageFilter: import("../types.js").ConstantAccessor<string>;
|
|
25
|
+
shapeRendering: import("../types.js").ConstantAccessor<import("csstype").Property.ShapeRendering>;
|
|
26
|
+
paintOrder: import("../types.js").ConstantAccessor<string>;
|
|
27
|
+
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
28
|
+
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
29
|
+
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
30
|
+
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
|
+
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
|
+
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
33
|
+
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
34
|
+
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
35
|
+
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
36
|
+
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
37
|
+
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
38
|
+
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
39
|
+
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
40
|
+
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
41
|
+
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
42
|
+
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
43
|
+
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
44
|
+
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
45
|
+
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
46
|
+
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
47
|
+
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
48
|
+
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
49
|
+
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
50
|
+
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
51
|
+
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
52
|
+
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
53
|
+
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
54
|
+
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
55
|
+
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
56
|
+
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
57
|
+
class: string | null;
|
|
58
|
+
cursor: import("../types.js").ConstantAccessor<import("csstype").Property.Cursor>;
|
|
59
|
+
}>, {}, "">;
|
|
5
60
|
type Sphere = ReturnType<typeof Sphere>;
|
|
6
61
|
export default Sphere;
|
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
3
|
import type { PlotContext } from '../../types';
|
|
4
4
|
import { devicePixelRatio } from 'svelte/reactivity/window';
|
|
5
|
+
import { MediaQuery } from 'svelte/reactivity';
|
|
6
|
+
import type { Attachment } from 'svelte/attachments';
|
|
7
|
+
|
|
8
|
+
const darkMode = new MediaQuery('prefers-color-scheme: dark');
|
|
9
|
+
let colorScheme = $state();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* we need to repaint on dark mode changes in case the user
|
|
13
|
+
* is using any css variables or currentColor that changes
|
|
14
|
+
* with the color scheme
|
|
15
|
+
*/
|
|
16
|
+
const watchColorScheme: Attachment = (element: Element) => {
|
|
17
|
+
const htmlElement = element.ownerDocument.documentElement;
|
|
18
|
+
const observer = new MutationObserver(() => {
|
|
19
|
+
colorScheme = getComputedStyle(htmlElement).colorScheme;
|
|
20
|
+
});
|
|
21
|
+
observer.observe(htmlElement, { attributes: true });
|
|
22
|
+
return () => {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
};
|
|
25
|
+
};
|
|
5
26
|
|
|
6
27
|
let restProps: {} = $props();
|
|
7
28
|
|
|
@@ -14,14 +35,15 @@
|
|
|
14
35
|
canvas element inside a foreignObject for use in a plot and takes care of
|
|
15
36
|
scaling it to the device pixel ratio.
|
|
16
37
|
-->
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
<foreignObject x="0" y="0" {@attach watchColorScheme} width={plot.width} height={plot.height}>
|
|
39
|
+
{#key [colorScheme, darkMode.current]}
|
|
40
|
+
<canvas
|
|
41
|
+
xmlns="http://www.w3.org/1999/xhtml"
|
|
42
|
+
{...restProps}
|
|
43
|
+
width={plot.width * (devicePixelRatio.current ?? 1)}
|
|
44
|
+
height={plot.height * (devicePixelRatio.current ?? 1)}
|
|
45
|
+
style="width: {plot.width}px; height: {plot.height}px;"></canvas>
|
|
46
|
+
{/key}
|
|
25
47
|
</foreignObject>
|
|
26
48
|
|
|
27
49
|
<style>
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
+
import { type MarkerShape } from './Marker.svelte';
|
|
2
|
+
import type { BaseMarkProps, ConstantAccessor, DataRecord, Mark, PlotScales } from '../../types.js';
|
|
3
|
+
type MarkerPathProps = BaseMarkProps & {
|
|
4
|
+
/**
|
|
5
|
+
* the datum associated with this path, usually the first
|
|
6
|
+
* element of the data array group
|
|
7
|
+
*/
|
|
8
|
+
datum: DataRecord;
|
|
9
|
+
/**
|
|
10
|
+
* the marker shape to use at the start of the path, defaults to
|
|
11
|
+
* circle
|
|
12
|
+
*/
|
|
13
|
+
markerStart?: boolean | MarkerShape;
|
|
14
|
+
/**
|
|
15
|
+
* the marker shape to use at the middle of the path, defaults to circle
|
|
16
|
+
*/
|
|
17
|
+
markerMid?: boolean | MarkerShape;
|
|
18
|
+
/**
|
|
19
|
+
* the marker shape to use at the end of the path, defaults to circle
|
|
20
|
+
*/
|
|
21
|
+
markerEnd?: boolean | MarkerShape;
|
|
22
|
+
/**
|
|
23
|
+
* shorthand for setting all markers
|
|
24
|
+
*/
|
|
25
|
+
marker?: boolean | MarkerShape;
|
|
26
|
+
/**
|
|
27
|
+
* path string
|
|
28
|
+
*/
|
|
29
|
+
d: string;
|
|
30
|
+
style: string;
|
|
31
|
+
startOffset: string;
|
|
32
|
+
textStyle: string;
|
|
33
|
+
textStyleClass?: string | null;
|
|
34
|
+
text: string;
|
|
35
|
+
transform: string;
|
|
36
|
+
color: string;
|
|
37
|
+
strokeWidth: ConstantAccessor<number>;
|
|
38
|
+
mark: Mark<BaseMarkProps>;
|
|
39
|
+
scales: PlotScales;
|
|
40
|
+
};
|
|
1
41
|
/** Helper component for paths with markers and optional text along the path. */
|
|
2
|
-
declare const MarkerPath: import("svelte").Component<
|
|
42
|
+
declare const MarkerPath: import("svelte").Component<MarkerPathProps, {}, "">;
|
|
3
43
|
type MarkerPath = ReturnType<typeof MarkerPath>;
|
|
4
44
|
export default MarkerPath;
|
|
@@ -11,4 +11,11 @@ export type BollingerOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function bollingerX(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
|
|
13
13
|
export declare function bollingerY(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
|
|
14
|
-
export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions):
|
|
14
|
+
export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): {
|
|
15
|
+
data: {
|
|
16
|
+
__x: import("../types.js").RawValue;
|
|
17
|
+
__lo: number;
|
|
18
|
+
__avg: number;
|
|
19
|
+
__hi: number;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { DataRecord, TransformArg } from '../types.js';
|
|
2
|
-
export declare function geoCentroid({ data, ...options }: TransformArg<DataRecord>):
|
|
2
|
+
export declare function geoCentroid({ data, ...options }: TransformArg<DataRecord>): {
|
|
3
|
+
x: (d: any) => any;
|
|
4
|
+
y: (d: any) => any;
|
|
5
|
+
data: {
|
|
6
|
+
__centroid__: [number, number];
|
|
7
|
+
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
@@ -38,21 +38,29 @@ type GroupZOptions = GroupXOptions | GroupYOptions;
|
|
|
38
38
|
* groups the dataset by x and y channel and optionally reduces the group items
|
|
39
39
|
* to output channels fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
40
40
|
*/
|
|
41
|
-
export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions):
|
|
41
|
+
export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): {
|
|
42
|
+
data: DataRecord[];
|
|
43
|
+
};
|
|
42
44
|
/**
|
|
43
45
|
* groups the dataset by the x channel and optionally reduces the group items
|
|
44
46
|
* to output channels y, y1, y2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
45
47
|
*/
|
|
46
|
-
export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions):
|
|
48
|
+
export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): {
|
|
49
|
+
data: DataRecord[];
|
|
50
|
+
};
|
|
47
51
|
/**
|
|
48
52
|
* groups the dataset by the y channel and optionally reduces the group items
|
|
49
53
|
* to output channels x, x1, x2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
50
54
|
*/
|
|
51
|
-
export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions):
|
|
55
|
+
export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): {
|
|
56
|
+
data: DataRecord[];
|
|
57
|
+
};
|
|
52
58
|
/**
|
|
53
59
|
* groups the dataset by the z channel and optionally reduces the group items
|
|
54
60
|
* to output channels x, x1, x2, y, y1, y2, fill, stroke, r, opacity, fillOpacity,
|
|
55
61
|
* or strokeOpacity
|
|
56
62
|
*/
|
|
57
|
-
export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions):
|
|
63
|
+
export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): {
|
|
64
|
+
data: DataRecord[];
|
|
65
|
+
};
|
|
58
66
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { PlotState, TransformArg } from '../types.js';
|
|
2
2
|
export declare function intervalX<T>(args: TransformArg<T>, { plot }: {
|
|
3
3
|
plot: PlotState;
|
|
4
|
-
}):
|
|
4
|
+
}): {
|
|
5
|
+
data: T[];
|
|
6
|
+
};
|
|
5
7
|
export declare function intervalY<T>(args: TransformArg<T>, { plot }: {
|
|
6
8
|
plot: PlotState;
|
|
7
|
-
}):
|
|
9
|
+
}): {
|
|
10
|
+
data: T[];
|
|
11
|
+
};
|
package/dist/transforms/map.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { TransformArg, MapOptions, MapMethod } from '../types.js';
|
|
2
|
-
export declare function map<T>(args: TransformArg<T>, options: MapOptions):
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { TransformArg, MapOptions, MapMethod, DataRecord } from '../types.js';
|
|
2
|
+
export declare function map<T>(args: TransformArg<T>, options: MapOptions): {
|
|
3
|
+
data: DataRecord[];
|
|
4
|
+
};
|
|
5
|
+
export declare function mapX<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
6
|
+
data: DataRecord[];
|
|
7
|
+
};
|
|
8
|
+
export declare function mapY<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
9
|
+
data: DataRecord[];
|
|
10
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { TransformArg, MapIndexObject } from '../types.js';
|
|
2
2
|
type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | MapIndexObject;
|
|
3
|
-
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis):
|
|
4
|
-
|
|
3
|
+
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis): {
|
|
4
|
+
data: import("../types.js").DataRecord[];
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): {
|
|
7
|
+
data: import("../types.js").DataRecord[];
|
|
8
|
+
};
|
|
5
9
|
export {};
|
|
@@ -5,17 +5,31 @@ type AtLeastOne<T, U = {
|
|
|
5
5
|
type SelectOptions = 'first' | 'last' | AtLeastOne<{
|
|
6
6
|
[k in ChannelName]: 'min' | 'max';
|
|
7
7
|
}>;
|
|
8
|
-
export declare function select({ data, ...channels }: TransformArg<DataRecord>, options: SelectOptions):
|
|
8
|
+
export declare function select({ data, ...channels }: TransformArg<DataRecord>, options: SelectOptions): {
|
|
9
|
+
data: DataRecord[];
|
|
10
|
+
};
|
|
9
11
|
/**
|
|
10
12
|
* Keeps only the first item of each group
|
|
11
13
|
*/
|
|
12
|
-
export declare function selectFirst(args: TransformArg<DataRecord>):
|
|
14
|
+
export declare function selectFirst(args: TransformArg<DataRecord>): {
|
|
15
|
+
data: DataRecord[];
|
|
16
|
+
};
|
|
13
17
|
/**
|
|
14
18
|
* Keeps only the last item of each group
|
|
15
19
|
*/
|
|
16
|
-
export declare function selectLast(args: TransformArg<DataRecord>):
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare function
|
|
20
|
-
|
|
20
|
+
export declare function selectLast(args: TransformArg<DataRecord>): {
|
|
21
|
+
data: DataRecord[];
|
|
22
|
+
};
|
|
23
|
+
export declare function selectMinX(args: TransformArg<DataRecord>): {
|
|
24
|
+
data: DataRecord[];
|
|
25
|
+
};
|
|
26
|
+
export declare function selectMaxX(args: TransformArg<DataRecord>): {
|
|
27
|
+
data: DataRecord[];
|
|
28
|
+
};
|
|
29
|
+
export declare function selectMinY(args: TransformArg<DataRecord>): {
|
|
30
|
+
data: DataRecord[];
|
|
31
|
+
};
|
|
32
|
+
export declare function selectMaxY(args: TransformArg<DataRecord>): {
|
|
33
|
+
data: DataRecord[];
|
|
34
|
+
};
|
|
21
35
|
export {};
|
|
@@ -2,14 +2,27 @@ import type { DataRecord, DataRow, TransformArg } from '../types.js';
|
|
|
2
2
|
export declare const SORT_KEY: unique symbol;
|
|
3
3
|
export declare function sort({ data, ...channels }: TransformArg<DataRecord>, options?: {
|
|
4
4
|
reverse?: boolean;
|
|
5
|
-
}):
|
|
5
|
+
}): {
|
|
6
|
+
sort: null;
|
|
7
|
+
data: {
|
|
8
|
+
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
9
|
+
}[];
|
|
10
|
+
} | {
|
|
11
|
+
data: DataRecord[];
|
|
12
|
+
};
|
|
6
13
|
/**
|
|
7
14
|
* reverses the data row order
|
|
8
15
|
*/
|
|
9
16
|
export declare function shuffle({ data, ...channels }: TransformArg<DataRow[]>, options?: {
|
|
10
17
|
seed?: number;
|
|
11
|
-
}):
|
|
18
|
+
}): {
|
|
19
|
+
sort: null;
|
|
20
|
+
data: DataRow[][];
|
|
21
|
+
};
|
|
12
22
|
/**
|
|
13
23
|
* reverses the data row order
|
|
14
24
|
*/
|
|
15
|
-
export declare function reverse({ data, ...channels }: TransformArg<DataRow[]>):
|
|
25
|
+
export declare function reverse({ data, ...channels }: TransformArg<DataRow[]>): {
|
|
26
|
+
sort: null;
|
|
27
|
+
data: DataRow[][];
|
|
28
|
+
};
|
|
@@ -7,6 +7,18 @@ type WindowOptions = {
|
|
|
7
7
|
reduce: ReducerName;
|
|
8
8
|
strict: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions):
|
|
11
|
-
|
|
10
|
+
export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions): {
|
|
11
|
+
data: {
|
|
12
|
+
[x: string]: import("../types.js").RawValue;
|
|
13
|
+
[x: symbol]: import("../types.js").RawValue;
|
|
14
|
+
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export declare function windowY(args: TransformArg<DataRecord>, options: WindowOptions): {
|
|
18
|
+
data: {
|
|
19
|
+
[x: string]: import("../types.js").RawValue;
|
|
20
|
+
[x: symbol]: import("../types.js").RawValue;
|
|
21
|
+
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
12
24
|
export {};
|
package/package.json
CHANGED
|
@@ -1,124 +1,123 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "svelteplot",
|
|
3
|
+
"version": "0.2.8",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Gregor Aisch",
|
|
7
|
+
"email": "gka@users.noreply.github.com"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"svelte": "./dist/index.js"
|
|
8
13
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"build": "vite build",
|
|
12
|
-
"preview": "vite preview",
|
|
13
|
-
"test": "npm run test:unit",
|
|
14
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
15
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
16
|
-
"lint": "prettier --check src && eslint src",
|
|
17
|
-
"format": "prettier --write .",
|
|
18
|
-
"test:unit": "vitest",
|
|
19
|
-
"prepack": "npx svelte-package",
|
|
20
|
-
"release-next": "npm version prerelease --preid next && npm publish && git push && git push --tags && sleep 1 && npm dist-tag add svelteplot@$(npm view . version) next",
|
|
21
|
-
"docs": "npm run build && cd build && rsync --recursive . vis4.net:svelteplot/alpha0/"
|
|
14
|
+
"./*.js": {
|
|
15
|
+
"import": "./dist/*.js"
|
|
22
16
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"svelte": "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./*.js": {
|
|
29
|
-
"import": "./dist/*.js"
|
|
30
|
-
},
|
|
31
|
-
"./*.svelte": {
|
|
32
|
-
"import": "./dist/*.svelte"
|
|
33
|
-
},
|
|
34
|
-
"./core/*.svelte": {
|
|
35
|
-
"import": "./dist/core/*.svelte"
|
|
36
|
-
},
|
|
37
|
-
"./marks/*.svelte": {
|
|
38
|
-
"import": "./dist/marks/*.svelte"
|
|
39
|
-
},
|
|
40
|
-
"./transforms": {
|
|
41
|
-
"import": "./dist/transforms/index.js"
|
|
42
|
-
}
|
|
17
|
+
"./*.svelte": {
|
|
18
|
+
"import": "./dist/*.svelte"
|
|
43
19
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"dist",
|
|
47
|
-
"!dist/**/*.test.*",
|
|
48
|
-
"!dist/**/*.spec.*"
|
|
49
|
-
],
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
52
|
-
"@emotion/css": "^11.13.5",
|
|
53
|
-
"@sveltejs/adapter-auto": "^6.0.1",
|
|
54
|
-
"@sveltejs/adapter-static": "^3.0.8",
|
|
55
|
-
"@sveltejs/eslint-config": "^8.2.0",
|
|
56
|
-
"@sveltejs/kit": "^2.21.1",
|
|
57
|
-
"@sveltejs/package": "^2.3.11",
|
|
58
|
-
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
59
|
-
"@sveltepress/theme-default": "^6.0.3",
|
|
60
|
-
"@sveltepress/twoslash": "^1.2.2",
|
|
61
|
-
"@sveltepress/vite": "^1.2.2",
|
|
62
|
-
"@testing-library/svelte": "^5.2.8",
|
|
63
|
-
"@testing-library/user-event": "^14.6.1",
|
|
64
|
-
"@types/d3-array": "^3.2.1",
|
|
65
|
-
"@types/d3-color": "^3.1.3",
|
|
66
|
-
"@types/d3-dsv": "^3.0.7",
|
|
67
|
-
"@types/d3-geo": "^3.1.0",
|
|
68
|
-
"@types/d3-interpolate": "^3.0.4",
|
|
69
|
-
"@types/d3-path": "^3.1.1",
|
|
70
|
-
"@types/d3-random": "^3.0.3",
|
|
71
|
-
"@types/d3-scale": "^4.0.9",
|
|
72
|
-
"@types/d3-scale-chromatic": "^3.1.0",
|
|
73
|
-
"@types/d3-shape": "^3.1.7",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
75
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
76
|
-
"csstype": "^3.1.3",
|
|
77
|
-
"d3-dsv": "^3.0.1",
|
|
78
|
-
"d3-fetch": "^3.0.1",
|
|
79
|
-
"d3-force": "^3.0.0",
|
|
80
|
-
"eslint": "^9.27.0",
|
|
81
|
-
"eslint-config-prettier": "^10.1.5",
|
|
82
|
-
"eslint-plugin-svelte": "3.9.0",
|
|
83
|
-
"jsdom": "^26.1.0",
|
|
84
|
-
"prettier": "^3.5.3",
|
|
85
|
-
"prettier-plugin-svelte": "^3.4.0",
|
|
86
|
-
"remark-code-extra": "^1.0.1",
|
|
87
|
-
"remark-code-frontmatter": "^1.0.0",
|
|
88
|
-
"resize-observer-polyfill": "^1.5.1",
|
|
89
|
-
"sass": "^1.89.0",
|
|
90
|
-
"svelte-check": "^4.2.1",
|
|
91
|
-
"svelte-eslint-parser": "1.2.0",
|
|
92
|
-
"svelte-highlight": "^7.8.3",
|
|
93
|
-
"svg-path-parser": "^1.1.0",
|
|
94
|
-
"topojson-client": "^3.1.0",
|
|
95
|
-
"tslib": "^2.8.1",
|
|
96
|
-
"typedoc": "^0.28.4",
|
|
97
|
-
"typedoc-plugin-markdown": "^4.6.3",
|
|
98
|
-
"typescript": "^5.8.3",
|
|
99
|
-
"vite": "^6.3.5",
|
|
100
|
-
"vitest": "^3.1.4",
|
|
101
|
-
"vitest-matchmedia-mock": "^2.0.3"
|
|
20
|
+
"./core/*.svelte": {
|
|
21
|
+
"import": "./dist/core/*.svelte"
|
|
102
22
|
},
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"d3-format": "^3.1.0",
|
|
109
|
-
"d3-geo": "^3.1.1",
|
|
110
|
-
"d3-interpolate": "^3.0.1",
|
|
111
|
-
"d3-path": "^3.1.0",
|
|
112
|
-
"d3-quadtree": "^3.0.1",
|
|
113
|
-
"d3-random": "^3.0.1",
|
|
114
|
-
"d3-regression": "^1.3.10",
|
|
115
|
-
"d3-scale": "^4.0.2",
|
|
116
|
-
"d3-scale-chromatic": "^3.1.0",
|
|
117
|
-
"d3-shape": "^3.2.0",
|
|
118
|
-
"d3-time": "^3.1.0",
|
|
119
|
-
"es-toolkit": "^1.38.0",
|
|
120
|
-
"fast-equals": "^5.2.2",
|
|
121
|
-
"merge-deep": "^3.0.3",
|
|
122
|
-
"svelte": "5.33.2"
|
|
23
|
+
"./marks/*.svelte": {
|
|
24
|
+
"import": "./dist/marks/*.svelte"
|
|
25
|
+
},
|
|
26
|
+
"./transforms": {
|
|
27
|
+
"import": "./dist/transforms/index.js"
|
|
123
28
|
}
|
|
124
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"!dist/**/*.test.*",
|
|
34
|
+
"!dist/**/*.spec.*"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
38
|
+
"@emotion/css": "^11.13.5",
|
|
39
|
+
"@sveltejs/adapter-auto": "^6.0.1",
|
|
40
|
+
"@sveltejs/adapter-static": "^3.0.8",
|
|
41
|
+
"@sveltejs/eslint-config": "^8.2.0",
|
|
42
|
+
"@sveltejs/kit": "^2.21.1",
|
|
43
|
+
"@sveltejs/package": "^2.3.11",
|
|
44
|
+
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
45
|
+
"@sveltepress/theme-default": "^6.0.3",
|
|
46
|
+
"@sveltepress/twoslash": "^1.2.2",
|
|
47
|
+
"@sveltepress/vite": "^1.2.2",
|
|
48
|
+
"@testing-library/svelte": "^5.2.8",
|
|
49
|
+
"@testing-library/user-event": "^14.6.1",
|
|
50
|
+
"@types/d3-array": "^3.2.1",
|
|
51
|
+
"@types/d3-color": "^3.1.3",
|
|
52
|
+
"@types/d3-dsv": "^3.0.7",
|
|
53
|
+
"@types/d3-geo": "^3.1.0",
|
|
54
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
55
|
+
"@types/d3-path": "^3.1.1",
|
|
56
|
+
"@types/d3-random": "^3.0.3",
|
|
57
|
+
"@types/d3-scale": "^4.0.9",
|
|
58
|
+
"@types/d3-scale-chromatic": "^3.1.0",
|
|
59
|
+
"@types/d3-shape": "^3.1.7",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
61
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
62
|
+
"csstype": "^3.1.3",
|
|
63
|
+
"d3-dsv": "^3.0.1",
|
|
64
|
+
"d3-fetch": "^3.0.1",
|
|
65
|
+
"d3-force": "^3.0.0",
|
|
66
|
+
"eslint": "^9.27.0",
|
|
67
|
+
"eslint-config-prettier": "^10.1.5",
|
|
68
|
+
"eslint-plugin-svelte": "3.9.0",
|
|
69
|
+
"jsdom": "^26.1.0",
|
|
70
|
+
"prettier": "^3.5.3",
|
|
71
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
72
|
+
"remark-code-extra": "^1.0.1",
|
|
73
|
+
"remark-code-frontmatter": "^1.0.0",
|
|
74
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
75
|
+
"sass": "^1.89.0",
|
|
76
|
+
"svelte-check": "^4.2.1",
|
|
77
|
+
"svelte-eslint-parser": "1.2.0",
|
|
78
|
+
"svelte-highlight": "^7.8.3",
|
|
79
|
+
"svg-path-parser": "^1.1.0",
|
|
80
|
+
"topojson-client": "^3.1.0",
|
|
81
|
+
"tslib": "^2.8.1",
|
|
82
|
+
"typedoc": "^0.28.5",
|
|
83
|
+
"typedoc-plugin-markdown": "^4.6.3",
|
|
84
|
+
"typescript": "^5.8.3",
|
|
85
|
+
"vite": "^6.3.5",
|
|
86
|
+
"vitest": "^3.1.4",
|
|
87
|
+
"vitest-matchmedia-mock": "^2.0.3"
|
|
88
|
+
},
|
|
89
|
+
"types": "./dist/index.d.ts",
|
|
90
|
+
"type": "module",
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"d3-array": "^3.2.4",
|
|
93
|
+
"d3-color": "^3.1.0",
|
|
94
|
+
"d3-format": "^3.1.0",
|
|
95
|
+
"d3-geo": "^3.1.1",
|
|
96
|
+
"d3-interpolate": "^3.0.1",
|
|
97
|
+
"d3-path": "^3.1.0",
|
|
98
|
+
"d3-quadtree": "^3.0.1",
|
|
99
|
+
"d3-random": "^3.0.1",
|
|
100
|
+
"d3-regression": "^1.3.10",
|
|
101
|
+
"d3-scale": "^4.0.2",
|
|
102
|
+
"d3-scale-chromatic": "^3.1.0",
|
|
103
|
+
"d3-shape": "^3.2.0",
|
|
104
|
+
"d3-time": "^3.1.0",
|
|
105
|
+
"es-toolkit": "^1.38.0",
|
|
106
|
+
"fast-equals": "^5.2.2",
|
|
107
|
+
"merge-deep": "^3.0.3",
|
|
108
|
+
"svelte": "5.33.2"
|
|
109
|
+
},
|
|
110
|
+
"scripts": {
|
|
111
|
+
"dev": "vite dev",
|
|
112
|
+
"build": "vite build",
|
|
113
|
+
"preview": "vite preview",
|
|
114
|
+
"test": "npm run test:unit",
|
|
115
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
116
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
117
|
+
"lint": "prettier --check src && eslint src",
|
|
118
|
+
"format": "prettier --write .",
|
|
119
|
+
"test:unit": "vitest",
|
|
120
|
+
"release-next": "npm version prerelease --preid next && npm publish && git push && git push --tags && sleep 1 && npm dist-tag add svelteplot@$(npm view . version) next",
|
|
121
|
+
"docs": "npm run build && cd build && rsync --recursive . vis4.net:svelteplot/alpha0/"
|
|
122
|
+
}
|
|
123
|
+
}
|