svelteplot 0.8.1-pr-283.11 → 0.8.1-pr-298.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.
- package/dist/Mark.svelte +1 -1
- package/dist/Mark.svelte.d.ts +0 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +0 -2
- package/dist/helpers/projection.js +2 -7
- package/dist/marks/Area.svelte.d.ts +0 -1
- package/dist/marks/AreaX.svelte.d.ts +0 -1
- package/dist/marks/Arrow.svelte.d.ts +0 -1
- package/dist/marks/AxisX.svelte.d.ts +0 -1
- package/dist/marks/AxisY.svelte +1 -1
- package/dist/marks/AxisY.svelte.d.ts +0 -1
- package/dist/marks/BarX.svelte.d.ts +0 -1
- package/dist/marks/BarY.svelte.d.ts +0 -1
- package/dist/marks/BoxX.svelte +3 -138
- package/dist/marks/BoxY.svelte +8 -137
- package/dist/marks/BoxY.svelte.d.ts +5 -1
- package/dist/marks/Cell.svelte.d.ts +0 -1
- package/dist/marks/Dot.svelte.d.ts +0 -1
- package/dist/marks/DotX.svelte.d.ts +0 -1
- package/dist/marks/DotY.svelte.d.ts +0 -1
- package/dist/marks/Frame.svelte.d.ts +0 -1
- package/dist/marks/Geo.svelte +0 -2
- package/dist/marks/Geo.svelte.d.ts +0 -2
- package/dist/marks/GridX.svelte.d.ts +0 -1
- package/dist/marks/GridY.svelte.d.ts +0 -1
- package/dist/marks/Line.svelte +2 -5
- package/dist/marks/Line.svelte.d.ts +0 -1
- package/dist/marks/LineX.svelte.d.ts +0 -1
- package/dist/marks/LineY.svelte.d.ts +0 -1
- package/dist/marks/Link.svelte.d.ts +0 -1
- package/dist/marks/Rect.svelte.d.ts +0 -1
- package/dist/marks/RuleX.svelte.d.ts +0 -1
- package/dist/marks/RuleY.svelte.d.ts +0 -1
- package/dist/marks/Spike.svelte.d.ts +0 -1
- package/dist/marks/Text.svelte.d.ts +0 -1
- package/dist/marks/TickX.svelte.d.ts +0 -1
- package/dist/marks/TickY.svelte.d.ts +0 -1
- package/dist/marks/Vector.svelte.d.ts +0 -1
- package/dist/marks/helpers/Box.svelte +254 -0
- package/dist/marks/helpers/Box.svelte.d.ts +55 -0
- package/dist/marks/index.d.ts +0 -1
- package/dist/marks/index.js +0 -1
- package/dist/types/mark.d.ts +1 -2
- package/dist/types/plot.d.ts +1 -5
- package/package.json +15 -16
- package/dist/marks/Trail.svelte +0 -163
- package/dist/marks/Trail.svelte.d.ts +0 -44
- package/dist/marks/helpers/TrailCanvas.svelte +0 -140
- package/dist/marks/helpers/TrailCanvas.svelte.d.ts +0 -40
- package/dist/marks/helpers/trail.d.ts +0 -23
- package/dist/marks/helpers/trail.js +0 -372
package/dist/marks/Trail.svelte
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="Datum extends DataRecord">
|
|
2
|
-
interface TrailMarkProps extends Omit<
|
|
3
|
-
BaseMarkProps<Datum>,
|
|
4
|
-
'stroke' | 'strokeWidth' | 'strokeDasharray'
|
|
5
|
-
> {
|
|
6
|
-
data?: Datum[];
|
|
7
|
-
x?: ChannelAccessor<Datum>;
|
|
8
|
-
y?: ChannelAccessor<Datum>;
|
|
9
|
-
z?: ChannelAccessor<Datum>;
|
|
10
|
-
r?: ChannelAccessor<Datum>;
|
|
11
|
-
curve?: CurveName | CurveFactory;
|
|
12
|
-
tension?: number;
|
|
13
|
-
sort?: ConstantAccessor<RawValue, Datum> | { channel: 'stroke' | 'fill' };
|
|
14
|
-
defined?: ConstantAccessor<boolean, Datum>;
|
|
15
|
-
canvas?: boolean;
|
|
16
|
-
cap?: 'butt' | 'round';
|
|
17
|
-
/**
|
|
18
|
-
* Samples per segment for curve interpolation
|
|
19
|
-
*/
|
|
20
|
-
resolution?: number | 'auto';
|
|
21
|
-
}
|
|
22
|
-
import type {
|
|
23
|
-
DataRecord,
|
|
24
|
-
ChannelAccessor,
|
|
25
|
-
BaseMarkProps,
|
|
26
|
-
ConstantAccessor,
|
|
27
|
-
RawValue,
|
|
28
|
-
PlotContext,
|
|
29
|
-
ScaledDataRecord,
|
|
30
|
-
CurveName
|
|
31
|
-
} from '../types';
|
|
32
|
-
import Mark from '../Mark.svelte';
|
|
33
|
-
import { getContext } from 'svelte';
|
|
34
|
-
import { path as d3Path } from 'd3-path';
|
|
35
|
-
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
36
|
-
import { getPlotDefaults } from '../hooks/plotDefaults';
|
|
37
|
-
import { sort } from '../transforms';
|
|
38
|
-
import trailPath, { type TrailSample } from './helpers/trail.js';
|
|
39
|
-
import TrailCanvas from './helpers/TrailCanvas.svelte';
|
|
40
|
-
import { addEventHandlers } from './helpers/events';
|
|
41
|
-
import type { CurveFactory } from 'd3-shape';
|
|
42
|
-
|
|
43
|
-
let markProps: TrailMarkProps = $props();
|
|
44
|
-
|
|
45
|
-
const DEFAULTS: TrailMarkProps = {
|
|
46
|
-
curve: 'linear',
|
|
47
|
-
r: 3,
|
|
48
|
-
canvas: false,
|
|
49
|
-
resolution: 'auto',
|
|
50
|
-
cap: 'round',
|
|
51
|
-
tension: 0,
|
|
52
|
-
...getPlotDefaults().trail
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
data = [{} as Datum],
|
|
57
|
-
curve,
|
|
58
|
-
resolution,
|
|
59
|
-
tension,
|
|
60
|
-
canvas,
|
|
61
|
-
cap,
|
|
62
|
-
class: className,
|
|
63
|
-
...options
|
|
64
|
-
}: TrailMarkProps = $derived({
|
|
65
|
-
...DEFAULTS,
|
|
66
|
-
...markProps
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const args = $derived(sort({ data, ...options })) as TrailMarkProps;
|
|
70
|
-
|
|
71
|
-
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
72
|
-
const plot = $derived(getPlotState());
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Groups the data by the specified key
|
|
76
|
-
*/
|
|
77
|
-
function groupIndex(data: ScaledDataRecord[], groupByKey: ChannelAccessor<Datum> | null) {
|
|
78
|
-
if (!groupByKey) return [data];
|
|
79
|
-
let group: ScaledDataRecord[] = [];
|
|
80
|
-
const groups = [group];
|
|
81
|
-
let lastGroupValue;
|
|
82
|
-
for (const d of data) {
|
|
83
|
-
const groupValue = resolveProp(groupByKey, d.datum);
|
|
84
|
-
if (groupValue === lastGroupValue || group.length === 0) {
|
|
85
|
-
group.push(d);
|
|
86
|
-
lastGroupValue = groupValue;
|
|
87
|
-
} else {
|
|
88
|
-
// new group
|
|
89
|
-
group = [d];
|
|
90
|
-
groups.push(group);
|
|
91
|
-
lastGroupValue = groupValue;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return groups.filter((d) => d.length > 0);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const groupByKey = $derived(args.z || args.fill) as ChannelAccessor<Datum> | null;
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<Mark
|
|
101
|
-
type="trail"
|
|
102
|
-
channels={['x', 'y', 'opacity', 'fill', 'fillOpacity', 'r']}
|
|
103
|
-
required={['x', 'y']}
|
|
104
|
-
{...args}>
|
|
105
|
-
{#snippet children({ mark, usedScales, scaledData })}
|
|
106
|
-
{#if scaledData.length > 0}
|
|
107
|
-
{@const groupedTrailData = groupIndex(scaledData, groupByKey)}
|
|
108
|
-
{#if canvas}
|
|
109
|
-
<!-- todo -->
|
|
110
|
-
<TrailCanvas
|
|
111
|
-
{curve}
|
|
112
|
-
{cap}
|
|
113
|
-
{tension}
|
|
114
|
-
{resolution}
|
|
115
|
-
{usedScales}
|
|
116
|
-
data={groupedTrailData}
|
|
117
|
-
options={args} />
|
|
118
|
-
{:else}
|
|
119
|
-
<g class={['trail', className]}>
|
|
120
|
-
{#each groupedTrailData as trailData, i (i)}
|
|
121
|
-
{@const samples = trailData.map((d) => ({
|
|
122
|
-
x: Number(d.x),
|
|
123
|
-
y: Number(d.y),
|
|
124
|
-
r: Number(d.r ?? 0)
|
|
125
|
-
})) satisfies TrailSample[]}
|
|
126
|
-
{@const defined = trailData.map(
|
|
127
|
-
(d) =>
|
|
128
|
-
d.valid &&
|
|
129
|
-
d.r >= 0 &&
|
|
130
|
-
(resolveProp(options.defined, d.datum, true) ?? true)
|
|
131
|
-
)}
|
|
132
|
-
{@const pathString = trailPath(samples, defined, d3Path(), {
|
|
133
|
-
curve,
|
|
134
|
-
cap,
|
|
135
|
-
tension,
|
|
136
|
-
...(typeof resolution === 'number'
|
|
137
|
-
? { samplesPerSegment: resolution }
|
|
138
|
-
: {})
|
|
139
|
-
})}
|
|
140
|
-
{@const [style, styleClass] = resolveStyles(
|
|
141
|
-
plot,
|
|
142
|
-
trailData[0],
|
|
143
|
-
{
|
|
144
|
-
...args
|
|
145
|
-
},
|
|
146
|
-
'fill',
|
|
147
|
-
usedScales
|
|
148
|
-
)}
|
|
149
|
-
<path
|
|
150
|
-
d={pathString}
|
|
151
|
-
{style}
|
|
152
|
-
class={styleClass}
|
|
153
|
-
{@attach addEventHandlers({
|
|
154
|
-
getPlotState,
|
|
155
|
-
options: mark.options,
|
|
156
|
-
datum: trailData[0].datum
|
|
157
|
-
})} />
|
|
158
|
-
{/each}
|
|
159
|
-
</g>
|
|
160
|
-
{/if}
|
|
161
|
-
{/if}
|
|
162
|
-
{/snippet}
|
|
163
|
-
</Mark>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { DataRecord, ChannelAccessor, ConstantAccessor, RawValue, CurveName } from '../types';
|
|
2
|
-
import type { CurveFactory } from 'd3-shape';
|
|
3
|
-
declare function $$render<Datum extends DataRecord>(): {
|
|
4
|
-
props: Omit<BaseMarkProps<Datum>, "stroke" | "strokeDasharray" | "strokeWidth"> & {
|
|
5
|
-
data?: Datum[];
|
|
6
|
-
x?: ChannelAccessor<Datum>;
|
|
7
|
-
y?: ChannelAccessor<Datum>;
|
|
8
|
-
z?: ChannelAccessor<Datum>;
|
|
9
|
-
r?: ChannelAccessor<Datum>;
|
|
10
|
-
curve?: CurveName | CurveFactory;
|
|
11
|
-
tension?: number;
|
|
12
|
-
sort?: ConstantAccessor<RawValue, Datum> | {
|
|
13
|
-
channel: "stroke" | "fill";
|
|
14
|
-
};
|
|
15
|
-
defined?: ConstantAccessor<boolean, Datum>;
|
|
16
|
-
canvas?: boolean;
|
|
17
|
-
cap?: "butt" | "round";
|
|
18
|
-
/**
|
|
19
|
-
* Samples per segment for curve interpolation
|
|
20
|
-
*/
|
|
21
|
-
resolution?: number | "auto";
|
|
22
|
-
};
|
|
23
|
-
exports: {};
|
|
24
|
-
bindings: "";
|
|
25
|
-
slots: {};
|
|
26
|
-
events: {};
|
|
27
|
-
};
|
|
28
|
-
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
29
|
-
props(): ReturnType<typeof $$render<Datum>>['props'];
|
|
30
|
-
events(): ReturnType<typeof $$render<Datum>>['events'];
|
|
31
|
-
slots(): ReturnType<typeof $$render<Datum>>['slots'];
|
|
32
|
-
bindings(): "";
|
|
33
|
-
exports(): {};
|
|
34
|
-
}
|
|
35
|
-
interface $$IsomorphicComponent {
|
|
36
|
-
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
37
|
-
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
38
|
-
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
39
|
-
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
40
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
41
|
-
}
|
|
42
|
-
declare const Trail: $$IsomorphicComponent;
|
|
43
|
-
type Trail<Datum extends DataRecord> = InstanceType<typeof Trail<Datum>>;
|
|
44
|
-
export default Trail;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="Datum extends DataRecord">
|
|
2
|
-
import type {
|
|
3
|
-
Mark,
|
|
4
|
-
BaseMarkProps,
|
|
5
|
-
PlotContext,
|
|
6
|
-
ScaledDataRecord,
|
|
7
|
-
UsedScales,
|
|
8
|
-
CurveName,
|
|
9
|
-
ConstantAccessor
|
|
10
|
-
} from '../../types/index.js';
|
|
11
|
-
import CanvasLayer from './CanvasLayer.svelte';
|
|
12
|
-
import type { Attachment } from 'svelte/attachments';
|
|
13
|
-
import { devicePixelRatio } from 'svelte/reactivity/window';
|
|
14
|
-
import { resolveColor } from './canvas.js';
|
|
15
|
-
import { getContext } from 'svelte';
|
|
16
|
-
import type { CurveFactory } from 'd3-shape';
|
|
17
|
-
import { trailPath, type TrailSample } from './trail';
|
|
18
|
-
import { resolveProp, resolveScaledStyleProps } from '../../helpers/resolve';
|
|
19
|
-
|
|
20
|
-
interface TrailCanvasProps<Datum> {
|
|
21
|
-
curve?: CurveName | CurveFactory;
|
|
22
|
-
tension?: number;
|
|
23
|
-
cap?: 'butt' | 'round';
|
|
24
|
-
resolution?: number | 'auto';
|
|
25
|
-
data: ScaledDataRecord<Datum>[][];
|
|
26
|
-
usedScales: UsedScales;
|
|
27
|
-
options: {
|
|
28
|
-
fill?: ConstantAccessor<string, Datum>;
|
|
29
|
-
defined?: ConstantAccessor<boolean, Datum>;
|
|
30
|
-
opacity?: ConstantAccessor<number, Datum>;
|
|
31
|
-
'fill-opacity'?: ConstantAccessor<number, Datum>;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let {
|
|
36
|
-
curve,
|
|
37
|
-
cap,
|
|
38
|
-
tension,
|
|
39
|
-
resolution,
|
|
40
|
-
usedScales,
|
|
41
|
-
data: groupedTrailData,
|
|
42
|
-
options
|
|
43
|
-
}: TrailCanvasProps<Datum> = $props();
|
|
44
|
-
|
|
45
|
-
function maybeOpacity(value: unknown) {
|
|
46
|
-
return value == null ? 1 : +value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
50
|
-
const plot = $derived(getPlotState());
|
|
51
|
-
|
|
52
|
-
const render = ((canvas: HTMLCanvasElement) => {
|
|
53
|
-
const context = canvas.getContext('2d');
|
|
54
|
-
|
|
55
|
-
$effect(() => {
|
|
56
|
-
if (context) {
|
|
57
|
-
context.resetTransform();
|
|
58
|
-
context.scale(devicePixelRatio.current ?? 1, devicePixelRatio.current ?? 1);
|
|
59
|
-
|
|
60
|
-
for (const trailData of groupedTrailData) {
|
|
61
|
-
if (trailData.length < 2) continue;
|
|
62
|
-
|
|
63
|
-
// Get the first point to determine line styles
|
|
64
|
-
const firstPoint = trailData[0];
|
|
65
|
-
if (!firstPoint || !firstPoint.valid) continue;
|
|
66
|
-
|
|
67
|
-
const samples = trailData.map((d) => ({
|
|
68
|
-
x: Number(d.x),
|
|
69
|
-
y: Number(d.y),
|
|
70
|
-
r: Number(d.r ?? 0)
|
|
71
|
-
})) satisfies TrailSample[];
|
|
72
|
-
|
|
73
|
-
const defined = trailData.map(
|
|
74
|
-
(d) =>
|
|
75
|
-
d.valid &&
|
|
76
|
-
d.r >= 0 &&
|
|
77
|
-
(resolveProp(options.defined, d.datum, true) ?? true)
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
let { fill, ...restStyles } = resolveScaledStyleProps(
|
|
81
|
-
firstPoint.datum,
|
|
82
|
-
options,
|
|
83
|
-
usedScales,
|
|
84
|
-
plot,
|
|
85
|
-
'fill'
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const opacity = maybeOpacity(restStyles['opacity']);
|
|
89
|
-
const fillOpacity = maybeOpacity(restStyles['fill-opacity']);
|
|
90
|
-
|
|
91
|
-
fill = resolveColor(fill, canvas);
|
|
92
|
-
|
|
93
|
-
context.fillStyle = fill ? fill : 'currentColor';
|
|
94
|
-
context.beginPath();
|
|
95
|
-
|
|
96
|
-
trailPath(samples, defined, context, {
|
|
97
|
-
curve,
|
|
98
|
-
cap,
|
|
99
|
-
tension,
|
|
100
|
-
...(typeof resolution === 'number' ? { samplesPerSegment: resolution } : {})
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
context.globalAlpha = opacity * fillOpacity;
|
|
104
|
-
context.fill();
|
|
105
|
-
|
|
106
|
-
// {#each groupedTrailData as trailData, i (i)}
|
|
107
|
-
// {@const samples = trailData.map((d) => ({
|
|
108
|
-
// x: Number(d.x),
|
|
109
|
-
// y: Number(d.y),
|
|
110
|
-
// r: Number(d.r ?? 0)
|
|
111
|
-
// })) satisfies TrailSample[]}
|
|
112
|
-
// {@const defined = trailData.map(
|
|
113
|
-
// (d) =>
|
|
114
|
-
// d.valid &&
|
|
115
|
-
// d.r >= 0 &&
|
|
116
|
-
// (resolveProp(options.defined, d.datum, true) ?? true)
|
|
117
|
-
// )}
|
|
118
|
-
// {@const pathString = trailPath(samples, defined, d3Path(), {
|
|
119
|
-
// curve,
|
|
120
|
-
// cap,
|
|
121
|
-
// tension,
|
|
122
|
-
// ...(typeof resolution === 'number'
|
|
123
|
-
// ? { samplesPerSegment: resolution }
|
|
124
|
-
// : {})
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return () => {
|
|
129
|
-
context?.clearRect(
|
|
130
|
-
0,
|
|
131
|
-
0,
|
|
132
|
-
plot.width * (devicePixelRatio.current ?? 1),
|
|
133
|
-
plot.height * (devicePixelRatio.current ?? 1)
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
}) as Attachment;
|
|
138
|
-
</script>
|
|
139
|
-
|
|
140
|
-
<CanvasLayer {@attach render} />
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ScaledDataRecord, UsedScales, CurveName, ConstantAccessor } from '../../types/index.js';
|
|
2
|
-
import type { CurveFactory } from 'd3-shape';
|
|
3
|
-
interface TrailCanvasProps<Datum> {
|
|
4
|
-
curve?: CurveName | CurveFactory;
|
|
5
|
-
tension?: number;
|
|
6
|
-
cap?: 'butt' | 'round';
|
|
7
|
-
resolution?: number | 'auto';
|
|
8
|
-
data: ScaledDataRecord<Datum>[][];
|
|
9
|
-
usedScales: UsedScales;
|
|
10
|
-
options: {
|
|
11
|
-
fill?: ConstantAccessor<string, Datum>;
|
|
12
|
-
defined?: ConstantAccessor<boolean, Datum>;
|
|
13
|
-
opacity?: ConstantAccessor<number, Datum>;
|
|
14
|
-
'fill-opacity'?: ConstantAccessor<number, Datum>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
declare function $$render<Datum extends DataRecord>(): {
|
|
18
|
-
props: TrailCanvasProps<Datum>;
|
|
19
|
-
exports: {};
|
|
20
|
-
bindings: "";
|
|
21
|
-
slots: {};
|
|
22
|
-
events: {};
|
|
23
|
-
};
|
|
24
|
-
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
25
|
-
props(): ReturnType<typeof $$render<Datum>>['props'];
|
|
26
|
-
events(): ReturnType<typeof $$render<Datum>>['events'];
|
|
27
|
-
slots(): ReturnType<typeof $$render<Datum>>['slots'];
|
|
28
|
-
bindings(): "";
|
|
29
|
-
exports(): {};
|
|
30
|
-
}
|
|
31
|
-
interface $$IsomorphicComponent {
|
|
32
|
-
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
33
|
-
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
34
|
-
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
35
|
-
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
36
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
37
|
-
}
|
|
38
|
-
declare const TrailCanvas: $$IsomorphicComponent;
|
|
39
|
-
type TrailCanvas<Datum extends DataRecord> = InstanceType<typeof TrailCanvas<Datum>>;
|
|
40
|
-
export default TrailCanvas;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Path } from 'd3-path';
|
|
2
|
-
import type { CurveName } from '../../types/index.js';
|
|
3
|
-
import type { CurveFactory } from 'd3-shape';
|
|
4
|
-
export type TrailContext = CanvasRenderingContext2D | Path;
|
|
5
|
-
export type TrailCurve = CurveName | CurveFactory;
|
|
6
|
-
export type TrailCap = 'round' | 'butt';
|
|
7
|
-
export type TrailOptions = {
|
|
8
|
-
curve?: TrailCurve;
|
|
9
|
-
samplesPerSegment?: number;
|
|
10
|
-
cap?: TrailCap;
|
|
11
|
-
tension?: number;
|
|
12
|
-
};
|
|
13
|
-
export type TrailSample = {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
r: number;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Draw a stroked capsule trail along successive points with varying widths.
|
|
20
|
-
* Adapted from Vega's trail mark implementation.
|
|
21
|
-
*/
|
|
22
|
-
export declare function trailPath(samples: TrailSample[], defined: boolean[], context: TrailContext, options?: TrailOptions): string | void;
|
|
23
|
-
export default trailPath;
|