svelteplot 0.10.3-pr-487.1 → 0.10.3-pr-488.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/marks/BarX.svelte +11 -10
- package/dist/marks/BarY.svelte +11 -10
- package/dist/marks/RuleX.svelte +7 -7
- package/dist/marks/RuleY.svelte +7 -7
- package/package.json +1 -1
package/dist/marks/BarX.svelte
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
BaseMarkProps,
|
|
36
36
|
BaseRectMarkProps,
|
|
37
37
|
ChannelAccessor,
|
|
38
|
+
DataRecord,
|
|
38
39
|
LinkableMarkProps
|
|
39
40
|
} from '../types/index.js';
|
|
40
41
|
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
|
|
51
52
|
const {
|
|
52
53
|
data = [{} as Datum],
|
|
53
|
-
class: className =
|
|
54
|
+
class: className = '',
|
|
54
55
|
stack,
|
|
55
56
|
canvas = false,
|
|
56
57
|
...options
|
|
@@ -81,20 +82,20 @@
|
|
|
81
82
|
{@const rectCanvasData = scaledData
|
|
82
83
|
.filter((d) => d.valid)
|
|
83
84
|
.map((d) => {
|
|
84
|
-
const minx = Math.min(d.x1, d.x2);
|
|
85
|
-
const maxx = Math.max(d.x1, d.x2);
|
|
85
|
+
const minx = Math.min(d.x1 as number, d.x2 as number);
|
|
86
|
+
const maxx = Math.max(d.x1 as number, d.x2 as number);
|
|
86
87
|
|
|
87
88
|
return {
|
|
88
89
|
...d,
|
|
89
90
|
x1: minx,
|
|
90
91
|
x2: maxx,
|
|
91
|
-
y1: d.y - bw * 0.5,
|
|
92
|
-
y2: d.y + bw * 0.5
|
|
92
|
+
y1: (d.y as number) - bw * 0.5,
|
|
93
|
+
y2: (d.y as number) + bw * 0.5
|
|
93
94
|
};
|
|
94
95
|
})}
|
|
95
96
|
<GroupMultiple class={barGroupClass} length={scaledData.length}>
|
|
96
97
|
<RectCanvas
|
|
97
|
-
{options}
|
|
98
|
+
options={options as BaseMarkProps<DataRecord> & BaseRectMarkProps<DataRecord>}
|
|
98
99
|
data={rectCanvasData}
|
|
99
100
|
{usedScales}
|
|
100
101
|
useInsetAsFallbackHorizontally={false} />
|
|
@@ -102,17 +103,17 @@
|
|
|
102
103
|
{:else}
|
|
103
104
|
<GroupMultiple class="bar-x" length={scaledData.length}>
|
|
104
105
|
{#each scaledData as d, i (i)}
|
|
105
|
-
{@const minx = Math.min(d.x1, d.x2)}
|
|
106
|
-
{@const maxx = Math.max(d.x1, d.x2)}
|
|
106
|
+
{@const minx = Math.min(d.x1 as number, d.x2 as number)}
|
|
107
|
+
{@const maxx = Math.max(d.x1 as number, d.x2 as number)}
|
|
107
108
|
{#if d.valid}
|
|
108
109
|
<RectPath
|
|
109
110
|
{usedScales}
|
|
110
111
|
class={className}
|
|
111
|
-
{options}
|
|
112
|
+
options={options as BaseRectMarkProps<DataRecord> & BaseMarkProps<DataRecord>}
|
|
112
113
|
datum={d}
|
|
113
114
|
x={minx}
|
|
114
115
|
useInsetAsFallbackHorizontally={false}
|
|
115
|
-
y={d.y - bw * 0.5}
|
|
116
|
+
y={(d.y as number) - bw * 0.5}
|
|
116
117
|
width={maxx - minx}
|
|
117
118
|
height={bw} />
|
|
118
119
|
{/if}
|
package/dist/marks/BarY.svelte
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
BaseMarkProps,
|
|
35
35
|
BaseRectMarkProps,
|
|
36
36
|
ChannelAccessor,
|
|
37
|
+
DataRecord,
|
|
37
38
|
DataRow,
|
|
38
39
|
LinkableMarkProps
|
|
39
40
|
} from '../types/index.js';
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
let markProps: BarYMarkProps = $props();
|
|
51
52
|
|
|
52
53
|
const {
|
|
53
|
-
data = [{}],
|
|
54
|
-
class: className =
|
|
54
|
+
data = [{} as Datum],
|
|
55
|
+
class: className = '',
|
|
55
56
|
stack,
|
|
56
57
|
canvas = false,
|
|
57
58
|
...options
|
|
@@ -80,20 +81,20 @@
|
|
|
80
81
|
{@const rectCanvasData = scaledData
|
|
81
82
|
.filter((d) => d.valid)
|
|
82
83
|
.map((d) => {
|
|
83
|
-
const miny = Math.min(d.y1, d.y2);
|
|
84
|
-
const maxy = Math.max(d.y1, d.y2);
|
|
84
|
+
const miny = Math.min(d.y1 as number, d.y2 as number);
|
|
85
|
+
const maxy = Math.max(d.y1 as number, d.y2 as number);
|
|
85
86
|
|
|
86
87
|
return {
|
|
87
88
|
...d,
|
|
88
|
-
x1: d.x - bw * 0.5,
|
|
89
|
-
x2: d.x + bw * 0.5,
|
|
89
|
+
x1: (d.x as number) - bw * 0.5,
|
|
90
|
+
x2: (d.x as number) + bw * 0.5,
|
|
90
91
|
y1: miny,
|
|
91
92
|
y2: maxy
|
|
92
93
|
};
|
|
93
94
|
})}
|
|
94
95
|
<GroupMultiple class={barGroupClass} length={scaledData.length}>
|
|
95
96
|
<RectCanvas
|
|
96
|
-
{options}
|
|
97
|
+
options={options as BaseMarkProps<DataRecord> & BaseRectMarkProps<DataRecord>}
|
|
97
98
|
data={rectCanvasData}
|
|
98
99
|
{usedScales}
|
|
99
100
|
useInsetAsFallbackVertically={false} />
|
|
@@ -101,11 +102,11 @@
|
|
|
101
102
|
{:else}
|
|
102
103
|
<GroupMultiple class="bar-y" length={scaledData.length}>
|
|
103
104
|
{#each scaledData as d, i (i)}
|
|
104
|
-
{@const miny = Math.min(d.y1, d.y2)}
|
|
105
|
-
{@const maxy = Math.max(d.y1, d.y2)}
|
|
105
|
+
{@const miny = Math.min(d.y1 as number, d.y2 as number)}
|
|
106
|
+
{@const maxy = Math.max(d.y1 as number, d.y2 as number)}
|
|
106
107
|
{#if d.valid}
|
|
107
108
|
<RectPath
|
|
108
|
-
x={d.x - bw * 0.5}
|
|
109
|
+
x={(d.x as number) - bw * 0.5}
|
|
109
110
|
y={miny}
|
|
110
111
|
options={args}
|
|
111
112
|
class={className}
|
package/dist/marks/RuleX.svelte
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
28
28
|
import type {
|
|
29
29
|
DataRecord,
|
|
30
|
+
DataRow,
|
|
30
31
|
BaseMarkProps,
|
|
31
32
|
ConstantAccessor,
|
|
32
33
|
ChannelAccessor,
|
|
@@ -51,19 +52,18 @@
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
const plot = usePlot();
|
|
54
|
-
const args = $derived(recordizeX({ data, ...options }, { withIndex: false }));
|
|
55
|
+
const args = $derived(recordizeX({ data: data as DataRow[], ...options }, { withIndex: false }));
|
|
55
56
|
</script>
|
|
56
57
|
|
|
57
58
|
<Mark
|
|
58
59
|
type="ruleX"
|
|
59
60
|
channels={['x', 'y1', 'y2', 'stroke', 'opacity', 'strokeOpacity']}
|
|
60
|
-
{...markProps}
|
|
61
61
|
{...args}>
|
|
62
62
|
{#snippet children({ mark, scaledData, usedScales })}
|
|
63
63
|
{#if canvas}
|
|
64
64
|
<RuleCanvas
|
|
65
65
|
data={scaledData}
|
|
66
|
-
options={args}
|
|
66
|
+
options={args as any}
|
|
67
67
|
{usedScales}
|
|
68
68
|
orientation="vertical"
|
|
69
69
|
marginTop={plot.options.marginTop}
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
class="rule-x {className || ''}"
|
|
74
74
|
length={className ? 2 : scaledData.length}>
|
|
75
75
|
{#each scaledData as d, i (i)}
|
|
76
|
-
{@const inset = resolveProp(args.inset, d.datum, 0)}
|
|
77
|
-
{@const insetTop = resolveProp(args.insetTop, d.datum, 0)}
|
|
78
|
-
{@const insetBottom = resolveProp(args.insetBottom, d.datum, 0)}
|
|
76
|
+
{@const inset = resolveProp(args.inset, d.datum, 0) as number}
|
|
77
|
+
{@const insetTop = resolveProp(args.insetTop, d.datum, 0) as number}
|
|
78
|
+
{@const insetBottom = resolveProp(args.insetBottom, d.datum, 0) as number}
|
|
79
79
|
{@const [style, styleClass] = resolveStyles(
|
|
80
80
|
plot,
|
|
81
81
|
d,
|
|
82
|
-
args,
|
|
82
|
+
args as any,
|
|
83
83
|
'stroke',
|
|
84
84
|
usedScales
|
|
85
85
|
)}
|
package/dist/marks/RuleY.svelte
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
28
28
|
import type {
|
|
29
29
|
DataRecord,
|
|
30
|
+
DataRow,
|
|
30
31
|
BaseMarkProps,
|
|
31
32
|
ConstantAccessor,
|
|
32
33
|
ChannelAccessor
|
|
@@ -51,19 +52,18 @@
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
const plot = usePlot();
|
|
54
|
-
const args = $derived(recordizeY({ data, ...options }, { withIndex: false }));
|
|
55
|
+
const args = $derived(recordizeY({ data: data as DataRow[], ...options }, { withIndex: false }));
|
|
55
56
|
</script>
|
|
56
57
|
|
|
57
58
|
<Mark
|
|
58
59
|
type="ruleY"
|
|
59
60
|
channels={['y', 'x1', 'x2', 'stroke', 'opacity', 'strokeOpacity']}
|
|
60
|
-
{...markProps}
|
|
61
61
|
{...args}>
|
|
62
62
|
{#snippet children({ scaledData, usedScales })}
|
|
63
63
|
{#if canvas}
|
|
64
64
|
<RuleCanvas
|
|
65
65
|
data={scaledData}
|
|
66
|
-
options={args}
|
|
66
|
+
options={args as any}
|
|
67
67
|
{usedScales}
|
|
68
68
|
orientation="horizontal"
|
|
69
69
|
marginLeft={plot.options.marginLeft}
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
class="rule-y {className || ''}"
|
|
74
74
|
length={className ? 2 : args.data.length}>
|
|
75
75
|
{#each scaledData as d, i (i)}
|
|
76
|
-
{@const inset = resolveProp(args.inset, d.datum, 0)}
|
|
77
|
-
{@const insetLeft = resolveProp(args.insetLeft, d.datum, 0)}
|
|
78
|
-
{@const insetRight = resolveProp(args.insetRight, d.datum, 0)}
|
|
76
|
+
{@const inset = resolveProp(args.inset, d.datum, 0) as number}
|
|
77
|
+
{@const insetLeft = resolveProp(args.insetLeft, d.datum, 0) as number}
|
|
78
|
+
{@const insetRight = resolveProp(args.insetRight, d.datum, 0) as number}
|
|
79
79
|
{@const [style, styleClass] = resolveStyles(
|
|
80
80
|
plot,
|
|
81
81
|
d,
|
|
82
|
-
args,
|
|
82
|
+
args as any,
|
|
83
83
|
'stroke',
|
|
84
84
|
usedScales
|
|
85
85
|
)}
|