svelteplot 0.2.10 → 0.3.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/Plot.svelte +2 -1
- package/dist/core/Plot.svelte +35 -18
- package/dist/marks/Area.svelte +13 -3
- package/dist/marks/AreaX.svelte +7 -3
- package/dist/marks/AreaX.svelte.d.ts +1 -6
- package/dist/marks/AreaY.svelte +7 -2
- package/dist/marks/AreaY.svelte.d.ts +1 -9
- package/dist/marks/Arrow.svelte +24 -7
- package/dist/marks/AxisX.svelte +19 -20
- package/dist/marks/AxisX.svelte.d.ts +1 -4
- package/dist/marks/AxisY.svelte +19 -20
- package/dist/marks/AxisY.svelte.d.ts +1 -4
- package/dist/marks/BarX.svelte +16 -2
- package/dist/marks/BarY.svelte +17 -3
- package/dist/marks/BoxX.svelte +25 -9
- package/dist/marks/BoxX.svelte.d.ts +3 -2
- package/dist/marks/BoxY.svelte +22 -10
- package/dist/marks/BoxY.svelte.d.ts +3 -3
- package/dist/marks/Brush.svelte +30 -10
- package/dist/marks/BrushX.svelte +8 -2
- package/dist/marks/BrushX.svelte.d.ts +1 -1
- package/dist/marks/BrushY.svelte +8 -2
- package/dist/marks/BrushY.svelte.d.ts +1 -1
- package/dist/marks/Cell.svelte +16 -2
- package/dist/marks/ColorLegend.svelte +2 -2
- package/dist/marks/Dot.svelte +9 -5
- package/dist/marks/Frame.svelte +23 -4
- package/dist/marks/Geo.svelte +14 -4
- package/dist/marks/Graticule.svelte +15 -5
- package/dist/marks/GridX.svelte +16 -2
- package/dist/marks/GridY.svelte +16 -2
- package/dist/marks/Line.svelte +22 -8
- package/dist/marks/Link.svelte +12 -4
- package/dist/marks/Pointer.svelte +12 -3
- package/dist/marks/Rect.svelte +16 -2
- package/dist/marks/RectX.svelte +16 -2
- package/dist/marks/RectY.svelte +16 -2
- package/dist/marks/RuleX.svelte +15 -2
- package/dist/marks/RuleY.svelte +15 -2
- package/dist/marks/Sphere.svelte +13 -2
- package/dist/marks/Spike.svelte +21 -11
- package/dist/marks/Text.svelte +22 -4
- package/dist/marks/TickX.svelte +15 -2
- package/dist/marks/TickY.svelte +15 -2
- package/dist/marks/Vector.svelte +13 -5
- package/dist/transforms/sort.d.ts +2 -2
- package/dist/types.d.ts +227 -75
- package/dist/ui/ExamplesGrid.svelte +1 -1
- package/package.json +1 -1
package/dist/marks/BoxY.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Creates a vertical box plot for visualizing data distribution with quartiles and outliers
|
|
3
3
|
-->
|
|
4
4
|
<script lang="ts" module>
|
|
5
|
-
export type
|
|
5
|
+
export type BoxYMarkProps = Pick<BaseMarkProps, 'class'> & {
|
|
6
6
|
data: DataRecord[];
|
|
7
7
|
x: ChannelAccessor;
|
|
8
8
|
y: ChannelAccessor;
|
|
@@ -31,21 +31,33 @@
|
|
|
31
31
|
|
|
32
32
|
<script lang="ts">
|
|
33
33
|
import GroupMultiple from './helpers/GroupMultiple.svelte';
|
|
34
|
-
import type { ChannelAccessor, DataRecord } from '../types.js';
|
|
34
|
+
import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types.js';
|
|
35
35
|
import { groupX, BarY, TickY, RuleX, Dot } from '../index.js';
|
|
36
36
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
37
|
+
import { getContext } from 'svelte';
|
|
38
|
+
import type { PlotDefaults } from '../types.js';
|
|
37
39
|
|
|
38
|
-
let
|
|
40
|
+
let markProps: BoxYMarkProps = $props();
|
|
41
|
+
const DEFAULTS = {
|
|
42
|
+
tickMedian: true,
|
|
43
|
+
tickMinMax: false,
|
|
44
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').box,
|
|
45
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').boxY
|
|
46
|
+
};
|
|
47
|
+
const {
|
|
39
48
|
data = [{}],
|
|
40
|
-
|
|
41
|
-
y,
|
|
42
|
-
rule,
|
|
49
|
+
class: className = '',
|
|
43
50
|
bar,
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
rule,
|
|
52
|
+
tickMedian,
|
|
53
|
+
tickMinMax,
|
|
46
54
|
dot,
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
x,
|
|
56
|
+
y
|
|
57
|
+
}: BoxYMarkProps = $derived({
|
|
58
|
+
...DEFAULTS,
|
|
59
|
+
...markProps
|
|
60
|
+
});
|
|
49
61
|
|
|
50
62
|
let { data: grouped } = $derived(
|
|
51
63
|
groupX(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type BoxYMarkProps = Pick<BaseMarkProps, 'class'> & {
|
|
2
2
|
data: DataRecord[];
|
|
3
3
|
x: ChannelAccessor;
|
|
4
4
|
y: ChannelAccessor;
|
|
@@ -23,8 +23,8 @@ export type BoxProps = {
|
|
|
23
23
|
*/
|
|
24
24
|
dot: Record<string, ChannelAccessor>;
|
|
25
25
|
};
|
|
26
|
-
import type { ChannelAccessor, DataRecord } from '../types.js';
|
|
26
|
+
import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types.js';
|
|
27
27
|
/** Creates a vertical box plot for visualizing data distribution with quartiles and outliers */
|
|
28
|
-
declare const BoxY: import("svelte").Component<
|
|
28
|
+
declare const BoxY: import("svelte").Component<BoxYMarkProps, {}, "">;
|
|
29
29
|
type BoxY = ReturnType<typeof BoxY>;
|
|
30
30
|
export default BoxY;
|
package/dist/marks/Brush.svelte
CHANGED
|
@@ -44,27 +44,41 @@
|
|
|
44
44
|
import { getContext } from 'svelte';
|
|
45
45
|
import Frame from './Frame.svelte';
|
|
46
46
|
import Rect from './Rect.svelte';
|
|
47
|
-
import type { BaseMarkProps, PlotContext } from '../types.js';
|
|
47
|
+
import type { BaseMarkProps, PlotContext, PlotDefaults } from '../types.js';
|
|
48
48
|
import { clientToLayerCoordinates } from './helpers/events.js';
|
|
49
49
|
|
|
50
|
-
let {
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
let { brush = $bindable({ enabled: false }), ...markProps }: BrushMarkProps = $props();
|
|
51
|
+
|
|
52
|
+
const DEFAULTS = {
|
|
53
|
+
stroke: 'currentColor',
|
|
54
|
+
strokeDasharray: '2,3',
|
|
55
|
+
strokeOpacity: 0.6,
|
|
56
|
+
resizeHandleSize: 10,
|
|
57
|
+
constrainToDomain: false,
|
|
58
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').brush
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const {
|
|
62
|
+
data = [{}],
|
|
63
|
+
stroke,
|
|
53
64
|
strokeWidth,
|
|
54
|
-
strokeDasharray
|
|
55
|
-
strokeOpacity
|
|
65
|
+
strokeDasharray,
|
|
66
|
+
strokeOpacity,
|
|
56
67
|
strokeLinecap,
|
|
57
68
|
strokeDashoffset,
|
|
58
69
|
strokeLinejoin,
|
|
59
70
|
strokeMiterlimit,
|
|
60
71
|
cursor: forceCursor,
|
|
61
72
|
limitDimension = false,
|
|
62
|
-
constrainToDomain
|
|
63
|
-
resizeHandleSize
|
|
73
|
+
constrainToDomain,
|
|
74
|
+
resizeHandleSize,
|
|
64
75
|
onbrushstart,
|
|
65
76
|
onbrushend,
|
|
66
77
|
onbrush
|
|
67
|
-
}: BrushMarkProps = $
|
|
78
|
+
}: BrushMarkProps = $derived({
|
|
79
|
+
...DEFAULTS,
|
|
80
|
+
...markProps
|
|
81
|
+
});
|
|
68
82
|
|
|
69
83
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
70
84
|
const plot = $derived(getPlotState());
|
|
@@ -361,4 +375,10 @@
|
|
|
361
375
|
{strokeMiterlimit}
|
|
362
376
|
{strokeWidth} />
|
|
363
377
|
{/if}
|
|
364
|
-
<Frame
|
|
378
|
+
<Frame
|
|
379
|
+
fill="transparent"
|
|
380
|
+
stroke="transparent"
|
|
381
|
+
inset={-20}
|
|
382
|
+
{cursor}
|
|
383
|
+
{onpointerdown}
|
|
384
|
+
{onpointermove} />
|
package/dist/marks/BrushX.svelte
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import Brush, { type BrushMarkProps } from './Brush.svelte';
|
|
7
|
+
import type { PlotDefaults } from '../types.js';
|
|
8
|
+
import { getContext } from 'svelte';
|
|
7
9
|
|
|
8
|
-
let { brush, ...
|
|
10
|
+
let { brush = $bindable({ enabled: false }), ...options }: BrushXMarkProps = $props();
|
|
11
|
+
const DEFAULTS = {
|
|
12
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').brush,
|
|
13
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').brushX
|
|
14
|
+
};
|
|
9
15
|
</script>
|
|
10
16
|
|
|
11
|
-
<Brush bind:brush limitDimension="x" {...
|
|
17
|
+
<Brush bind:brush limitDimension="x" {...DEFAULTS} {...options} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type BrushXMarkProps = Omit<BrushMarkProps, 'limitDimension'>;
|
|
2
2
|
import { type BrushMarkProps } from './Brush.svelte';
|
|
3
|
-
declare const BrushX: import("svelte").Component<BrushXMarkProps, {}, "">;
|
|
3
|
+
declare const BrushX: import("svelte").Component<BrushXMarkProps, {}, "brush">;
|
|
4
4
|
type BrushX = ReturnType<typeof BrushX>;
|
|
5
5
|
export default BrushX;
|
package/dist/marks/BrushY.svelte
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import Brush, { type BrushMarkProps } from './Brush.svelte';
|
|
7
|
+
import type { PlotDefaults } from '../types.js';
|
|
8
|
+
import { getContext } from 'svelte';
|
|
7
9
|
|
|
8
|
-
let { brush, ...
|
|
10
|
+
let { brush = $bindable({ enabled: false }), ...options }: BrushYMarkProps = $props();
|
|
11
|
+
const DEFAULTS = {
|
|
12
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').brush,
|
|
13
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').brushY
|
|
14
|
+
};
|
|
9
15
|
</script>
|
|
10
16
|
|
|
11
|
-
<Brush bind:brush limitDimension="y" {...
|
|
17
|
+
<Brush bind:brush limitDimension="y" {...DEFAULTS} {...options} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type BrushYMarkProps = Omit<BrushMarkProps, 'limitDimension'>;
|
|
2
2
|
import { type BrushMarkProps } from './Brush.svelte';
|
|
3
|
-
declare const BrushY: import("svelte").Component<BrushYMarkProps, {}, "">;
|
|
3
|
+
declare const BrushY: import("svelte").Component<BrushYMarkProps, {}, "brush">;
|
|
4
4
|
type BrushY = ReturnType<typeof BrushY>;
|
|
5
5
|
export default BrushY;
|
package/dist/marks/Cell.svelte
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
DataRecord,
|
|
9
9
|
BaseMarkProps,
|
|
10
10
|
BaseRectMarkProps,
|
|
11
|
-
ChannelAccessor
|
|
11
|
+
ChannelAccessor,
|
|
12
|
+
PlotDefaults
|
|
12
13
|
} from '../types.js';
|
|
13
14
|
|
|
14
15
|
export type CellMarkProps = BaseMarkProps &
|
|
@@ -29,7 +30,20 @@
|
|
|
29
30
|
import { isValid } from '../helpers/isValid.js';
|
|
30
31
|
import RectPath from './helpers/RectPath.svelte';
|
|
31
32
|
|
|
32
|
-
let
|
|
33
|
+
let markProps: CellMarkProps = $props();
|
|
34
|
+
|
|
35
|
+
const DEFAULTS = {
|
|
36
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').cell
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
data = [{}],
|
|
41
|
+
class: className = '',
|
|
42
|
+
...options
|
|
43
|
+
}: CellMarkProps = $derived({
|
|
44
|
+
...DEFAULTS,
|
|
45
|
+
...markProps
|
|
46
|
+
});
|
|
33
47
|
|
|
34
48
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
35
49
|
const plot = $derived(getPlotState());
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
import { range as d3Range, extent } from 'd3-array';
|
|
12
12
|
import { maybeSymbol } from '../helpers/symbols.js';
|
|
13
13
|
|
|
14
|
-
import type {
|
|
14
|
+
import type { PlotDefaults, PlotContext } from '../types.js';
|
|
15
15
|
|
|
16
16
|
let { class: className = null }: ColorLegendMarkProps = $props();
|
|
17
17
|
|
|
18
18
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
19
19
|
const plot = $derived(getPlotState());
|
|
20
20
|
|
|
21
|
-
const DEFAULTS = getContext<Partial<
|
|
21
|
+
const DEFAULTS = getContext<Partial<PlotDefaults>>('svelteplot/_defaults');
|
|
22
22
|
|
|
23
23
|
const legendTitle = $derived(plot.options.color.label);
|
|
24
24
|
const scaleType = $derived(plot.scales.color.type);
|
package/dist/marks/Dot.svelte
CHANGED
|
@@ -35,13 +35,19 @@
|
|
|
35
35
|
import { addEventHandlers } from './helpers/events.js';
|
|
36
36
|
import Anchor from './helpers/Anchor.svelte';
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const DEFAULTS = {
|
|
39
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').dot
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
let markProps: DotMarkProps = $props();
|
|
43
|
+
|
|
44
|
+
const {
|
|
39
45
|
data = [{}],
|
|
40
46
|
canvas = false,
|
|
41
47
|
class: className = '',
|
|
42
48
|
dotClass = null,
|
|
43
49
|
...options
|
|
44
|
-
}: DotMarkProps = $
|
|
50
|
+
}: DotMarkProps = $derived({ ...DEFAULTS, ...markProps });
|
|
45
51
|
|
|
46
52
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
47
53
|
const plot = $derived(getPlotState());
|
|
@@ -50,8 +56,6 @@
|
|
|
50
56
|
return d3Symbol(maybeSymbol(symbolType), size)();
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
const { dotRadius } = getContext<PlotDefaults>('svelteplot/_defaults');
|
|
54
|
-
|
|
55
59
|
const args = $derived(
|
|
56
60
|
// todo: move sorting to Mark
|
|
57
61
|
sort(
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
'fillOpacity',
|
|
81
85
|
'strokeOpacity'
|
|
82
86
|
]}
|
|
83
|
-
defaults={{ r:
|
|
87
|
+
defaults={{ r: 3, symbol: 'circle' }}
|
|
84
88
|
{...args}>
|
|
85
89
|
{#snippet children({ mark, usedScales, scaledData })}
|
|
86
90
|
<g class="dot {className || ''}">
|
package/dist/marks/Frame.svelte
CHANGED
|
@@ -28,19 +28,38 @@
|
|
|
28
28
|
<script lang="ts">
|
|
29
29
|
import Mark from '../Mark.svelte';
|
|
30
30
|
import { getContext } from 'svelte';
|
|
31
|
-
import type {
|
|
31
|
+
import type {
|
|
32
|
+
PlotContext,
|
|
33
|
+
BaseRectMarkProps,
|
|
34
|
+
LinkableMarkProps,
|
|
35
|
+
PlotDefaults
|
|
36
|
+
} from '../types.js';
|
|
32
37
|
import type { BaseMarkProps } from '../types.js';
|
|
33
38
|
import RectPath from './helpers/RectPath.svelte';
|
|
34
39
|
|
|
35
|
-
let
|
|
40
|
+
let markProps: FrameMarkProps = $props();
|
|
41
|
+
|
|
42
|
+
const DEFAULTS: FrameMarkProps = {
|
|
43
|
+
fill: 'none',
|
|
44
|
+
class: 'frame',
|
|
45
|
+
stroke: 'currentColor',
|
|
46
|
+
fillOpacity: 1,
|
|
47
|
+
strokeOpacity: 1,
|
|
48
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').frame
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const {
|
|
36
52
|
automatic,
|
|
37
|
-
class: className
|
|
53
|
+
class: className,
|
|
38
54
|
fill,
|
|
39
55
|
stroke,
|
|
40
56
|
fillOpacity,
|
|
41
57
|
strokeOpacity,
|
|
42
58
|
...options
|
|
43
|
-
}: FrameMarkProps = $
|
|
59
|
+
}: FrameMarkProps = $derived({
|
|
60
|
+
...DEFAULTS,
|
|
61
|
+
...markProps
|
|
62
|
+
});
|
|
44
63
|
|
|
45
64
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
46
65
|
const plot = $derived(getPlotState());
|
package/dist/marks/Geo.svelte
CHANGED
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
PlotContext,
|
|
23
23
|
BaseMarkProps,
|
|
24
24
|
ConstantAccessor,
|
|
25
|
-
LinkableMarkProps
|
|
25
|
+
LinkableMarkProps,
|
|
26
|
+
PlotDefaults
|
|
26
27
|
} from '../types.js';
|
|
27
28
|
import Mark from '../Mark.svelte';
|
|
28
29
|
import { geoPath } from 'd3-geo';
|
|
@@ -38,14 +39,23 @@
|
|
|
38
39
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
39
40
|
const plot = $derived(getPlotState());
|
|
40
41
|
|
|
41
|
-
let
|
|
42
|
+
let markProps: GeoMarkProps = $props();
|
|
43
|
+
|
|
44
|
+
const DEFAULTS = {
|
|
45
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').geo
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const {
|
|
42
49
|
data = [{}],
|
|
43
50
|
canvas = false,
|
|
44
51
|
geoType,
|
|
45
52
|
dragRotate,
|
|
46
|
-
class: className =
|
|
53
|
+
class: className = '',
|
|
47
54
|
...options
|
|
48
|
-
}: GeoMarkProps = $
|
|
55
|
+
}: GeoMarkProps = $derived({
|
|
56
|
+
...DEFAULTS,
|
|
57
|
+
...markProps
|
|
58
|
+
});
|
|
49
59
|
|
|
50
60
|
const path = $derived(
|
|
51
61
|
callWithProps(geoPath, [plot.scales.projection], {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Renders a geographic graticule grid with customizable step sizes
|
|
3
3
|
-->
|
|
4
4
|
<script module lang="ts">
|
|
5
|
-
import type {
|
|
5
|
+
import type { PlotDefaults, BaseMarkProps } from '../types.js';
|
|
6
6
|
export type GraticuleMarkProps = Omit<
|
|
7
7
|
BaseMarkProps,
|
|
8
8
|
'fill' | 'fillOpacity' | 'paintOrder' | 'title' | 'href' | 'target' | 'cursor'
|
|
@@ -17,17 +17,27 @@
|
|
|
17
17
|
import Geo from './Geo.svelte';
|
|
18
18
|
import { geoGraticule } from 'd3-geo';
|
|
19
19
|
import { getContext } from 'svelte';
|
|
20
|
+
import type { PlotDefaults } from '../types.js';
|
|
21
|
+
|
|
22
|
+
let markProps: GraticuleMarkProps = $props();
|
|
20
23
|
|
|
21
24
|
const DEFAULTS = {
|
|
22
|
-
|
|
23
|
-
...getContext<
|
|
25
|
+
step: 10,
|
|
26
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').graticule
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
const {
|
|
30
|
+
data = [{}],
|
|
31
|
+
class: className = '',
|
|
32
|
+
...options
|
|
33
|
+
}: GraticuleMarkProps = $derived({
|
|
34
|
+
...DEFAULTS,
|
|
35
|
+
...markProps
|
|
36
|
+
});
|
|
27
37
|
|
|
28
38
|
let graticule = $derived.by(() => {
|
|
29
39
|
const graticule = geoGraticule();
|
|
30
|
-
graticule.stepMinor([stepX || step, stepY || step]);
|
|
40
|
+
graticule.stepMinor([options.stepX || options.step, options.stepY || options.step]);
|
|
31
41
|
return graticule;
|
|
32
42
|
});
|
|
33
43
|
</script>
|
package/dist/marks/GridX.svelte
CHANGED
|
@@ -11,13 +11,27 @@
|
|
|
11
11
|
<script lang="ts">
|
|
12
12
|
import { getContext } from 'svelte';
|
|
13
13
|
import Mark from '../Mark.svelte';
|
|
14
|
-
import type { PlotContext, BaseMarkProps, RawValue } from '../types.js';
|
|
14
|
+
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types.js';
|
|
15
15
|
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
16
16
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
17
17
|
import { testFilter } from '../helpers/index.js';
|
|
18
18
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
19
19
|
|
|
20
|
-
let
|
|
20
|
+
let markProps: GridXMarkProps = $props();
|
|
21
|
+
|
|
22
|
+
const DEFAULTS = {
|
|
23
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').grid,
|
|
24
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').gridX
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
data = [],
|
|
29
|
+
automatic = false,
|
|
30
|
+
...options
|
|
31
|
+
}: GridXMarkProps = $derived({
|
|
32
|
+
...DEFAULTS,
|
|
33
|
+
...markProps
|
|
34
|
+
});
|
|
21
35
|
|
|
22
36
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
23
37
|
const plot = $derived(getPlotState());
|
package/dist/marks/GridY.svelte
CHANGED
|
@@ -11,13 +11,27 @@
|
|
|
11
11
|
<script lang="ts">
|
|
12
12
|
import { getContext } from 'svelte';
|
|
13
13
|
import Mark from '../Mark.svelte';
|
|
14
|
-
import type { PlotContext, BaseMarkProps, RawValue } from '../types.js';
|
|
14
|
+
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types.js';
|
|
15
15
|
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
16
16
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
17
17
|
import { testFilter } from '../helpers/index.js';
|
|
18
18
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
19
19
|
|
|
20
|
-
let
|
|
20
|
+
let markProps: GridYMarkProps = $props();
|
|
21
|
+
|
|
22
|
+
const DEFAULTS = {
|
|
23
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').grid,
|
|
24
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').gridY
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
data = [],
|
|
29
|
+
automatic = false,
|
|
30
|
+
...options
|
|
31
|
+
}: GridYMarkProps = $derived({
|
|
32
|
+
...DEFAULTS,
|
|
33
|
+
...markProps
|
|
34
|
+
});
|
|
21
35
|
|
|
22
36
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
23
37
|
const plot = $derived(getPlotState());
|
package/dist/marks/Line.svelte
CHANGED
|
@@ -47,22 +47,36 @@
|
|
|
47
47
|
import { pick } from 'es-toolkit';
|
|
48
48
|
import LineCanvas from './helpers/LineCanvas.svelte';
|
|
49
49
|
|
|
50
|
-
import type { RawValue } from '../types.js';
|
|
50
|
+
import type { RawValue, PlotDefaults } from '../types.js';
|
|
51
51
|
import { isValid } from '../helpers/index.js';
|
|
52
52
|
import { sort } from '../transforms/sort.js';
|
|
53
53
|
import { recordizeXY } from '../transforms/recordize.js';
|
|
54
54
|
import GroupMultiple from './helpers/GroupMultiple.svelte';
|
|
55
55
|
|
|
56
|
-
let
|
|
56
|
+
let markProps: LineMarkProps = $props();
|
|
57
|
+
|
|
58
|
+
const DEFAULTS: LineMarkProps = {
|
|
59
|
+
curve: 'auto',
|
|
60
|
+
tension: 0,
|
|
61
|
+
canvas: false,
|
|
62
|
+
class: null,
|
|
63
|
+
lineClass: null,
|
|
64
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').line
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const {
|
|
57
68
|
data = [{}],
|
|
58
|
-
curve
|
|
59
|
-
tension
|
|
69
|
+
curve,
|
|
70
|
+
tension,
|
|
60
71
|
text,
|
|
61
|
-
canvas
|
|
62
|
-
class: className
|
|
63
|
-
lineClass
|
|
72
|
+
canvas,
|
|
73
|
+
class: className,
|
|
74
|
+
lineClass,
|
|
64
75
|
...options
|
|
65
|
-
}: LineMarkProps = $
|
|
76
|
+
}: LineMarkProps = $derived({
|
|
77
|
+
...DEFAULTS,
|
|
78
|
+
...markProps
|
|
79
|
+
});
|
|
66
80
|
|
|
67
81
|
const args = $derived(sort(recordizeXY({ data, ...options })));
|
|
68
82
|
|
package/dist/marks/Link.svelte
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
CurveName,
|
|
29
29
|
MarkerOptions,
|
|
30
30
|
RawValue,
|
|
31
|
-
ScaledDataRecord
|
|
31
|
+
ScaledDataRecord,
|
|
32
|
+
PlotDefaults
|
|
32
33
|
} from '../types.js';
|
|
33
34
|
import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
34
35
|
import { maybeData } from '../helpers/index.js';
|
|
@@ -41,14 +42,21 @@
|
|
|
41
42
|
import { geoPath } from 'd3-geo';
|
|
42
43
|
import { pick } from 'es-toolkit';
|
|
43
44
|
|
|
44
|
-
let
|
|
45
|
+
let markProps: LinkMarkProps = $props();
|
|
46
|
+
const DEFAULTS = {
|
|
47
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').link
|
|
48
|
+
};
|
|
49
|
+
const {
|
|
45
50
|
data = [{}],
|
|
46
51
|
curve = 'auto',
|
|
47
52
|
tension = 0,
|
|
48
53
|
text,
|
|
49
|
-
class: className =
|
|
54
|
+
class: className = '',
|
|
50
55
|
...options
|
|
51
|
-
}: LinkMarkProps = $
|
|
56
|
+
}: LinkMarkProps = $derived({
|
|
57
|
+
...DEFAULTS,
|
|
58
|
+
...markProps
|
|
59
|
+
});
|
|
52
60
|
|
|
53
61
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
54
62
|
let plot = $derived(getPlotState());
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import { getContext, type Snippet } from 'svelte';
|
|
24
|
-
import type { PlotContext } from '../types.js';
|
|
24
|
+
import type { PlotContext, PlotDefaults } from '../types.js';
|
|
25
25
|
import { groups as d3Groups } from 'd3-array';
|
|
26
26
|
|
|
27
27
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
@@ -33,7 +33,13 @@
|
|
|
33
33
|
import isDataRecord from '../helpers/isDataRecord.js';
|
|
34
34
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
35
35
|
|
|
36
|
-
let
|
|
36
|
+
let markProps: PointerMarkProps = $props();
|
|
37
|
+
|
|
38
|
+
const DEFAULTS = {
|
|
39
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').pointer
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const {
|
|
37
43
|
data = [{}],
|
|
38
44
|
children,
|
|
39
45
|
x,
|
|
@@ -41,7 +47,10 @@
|
|
|
41
47
|
z,
|
|
42
48
|
maxDistance = 15,
|
|
43
49
|
onupdate = null
|
|
44
|
-
}: PointerMarkProps = $
|
|
50
|
+
}: PointerMarkProps = $derived({
|
|
51
|
+
...DEFAULTS,
|
|
52
|
+
...markProps
|
|
53
|
+
});
|
|
45
54
|
|
|
46
55
|
let selectedData = $state([]);
|
|
47
56
|
|
package/dist/marks/Rect.svelte
CHANGED
|
@@ -26,12 +26,26 @@
|
|
|
26
26
|
DataRecord,
|
|
27
27
|
BaseMarkProps,
|
|
28
28
|
BaseRectMarkProps,
|
|
29
|
-
ChannelAccessor
|
|
29
|
+
ChannelAccessor,
|
|
30
|
+
PlotDefaults
|
|
30
31
|
} from '../types.js';
|
|
31
32
|
import GroupMultiple from './helpers/GroupMultiple.svelte';
|
|
32
33
|
import RectPath from './helpers/RectPath.svelte';
|
|
33
34
|
|
|
34
|
-
let
|
|
35
|
+
let markProps: RectMarkProps = $props();
|
|
36
|
+
|
|
37
|
+
const DEFAULTS = {
|
|
38
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').rect
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
data = [{}],
|
|
43
|
+
class: className = '',
|
|
44
|
+
...options
|
|
45
|
+
}: RectMarkProps = $derived({
|
|
46
|
+
...DEFAULTS,
|
|
47
|
+
...markProps
|
|
48
|
+
});
|
|
35
49
|
|
|
36
50
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
37
51
|
let plot = $derived(getPlotState());
|
package/dist/marks/RectX.svelte
CHANGED
|
@@ -8,11 +8,25 @@
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import Rect, { type RectMarkProps } from './Rect.svelte';
|
|
10
10
|
import { intervalY, stackX, recordizeX } from '../index.js';
|
|
11
|
-
import type { PlotContext } from '../types.js';
|
|
11
|
+
import type { PlotContext, PlotDefaults } from '../types.js';
|
|
12
12
|
import { getContext } from 'svelte';
|
|
13
13
|
import type { StackOptions } from '../transforms/stack';
|
|
14
14
|
|
|
15
|
-
let
|
|
15
|
+
let markProps: RectXMarkProps = $props();
|
|
16
|
+
|
|
17
|
+
const DEFAULTS = {
|
|
18
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').rect,
|
|
19
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').rectX
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
data = [{}],
|
|
24
|
+
stack,
|
|
25
|
+
...options
|
|
26
|
+
}: RectXMarkProps = $derived({
|
|
27
|
+
...DEFAULTS,
|
|
28
|
+
...markProps
|
|
29
|
+
});
|
|
16
30
|
|
|
17
31
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
18
32
|
let plot = $derived(getPlotState());
|
package/dist/marks/RectY.svelte
CHANGED
|
@@ -8,11 +8,25 @@
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import Rect, { type RectMarkProps } from './Rect.svelte';
|
|
10
10
|
import { intervalX, stackY, recordizeY } from '../index.js';
|
|
11
|
-
import type { PlotContext } from '../types.js';
|
|
11
|
+
import type { PlotContext, PlotDefaults } from '../types.js';
|
|
12
12
|
import { getContext } from 'svelte';
|
|
13
13
|
import type { StackOptions } from '../transforms/stack';
|
|
14
14
|
|
|
15
|
-
let
|
|
15
|
+
let markProps: RectYMarkProps = $props();
|
|
16
|
+
|
|
17
|
+
const DEFAULTS = {
|
|
18
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').rect,
|
|
19
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').rectY
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
data = [{}],
|
|
24
|
+
stack,
|
|
25
|
+
...options
|
|
26
|
+
}: RectYMarkProps = $derived({
|
|
27
|
+
...DEFAULTS,
|
|
28
|
+
...markProps
|
|
29
|
+
});
|
|
16
30
|
|
|
17
31
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
18
32
|
const plot = $derived(getPlotState());
|