svelteplot 0.1.3-next.5 → 0.1.3-next.7
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
CHANGED
|
@@ -12,6 +12,10 @@ type ChannelOptions = {
|
|
|
12
12
|
export declare function toChannelOption(name: ScaledChannelName, channel: ChannelAccessor | ChannelAlias): ChannelOptions;
|
|
13
13
|
export declare function resolveChannel(channel: ChannelName, datum: DataRow, channels: Partial<Record<ChannelName, ChannelAccessor | ChannelAlias>>): RawValue;
|
|
14
14
|
export declare function resolveScaledStyleProps(datum: DataRecord, channels: Partial<Record<ScaledChannelName, ChannelAccessor>>, useScale: Record<ScaledChannelName, boolean>, plot: PlotState, defaultColorProp?: 'fill' | 'stroke' | null): any;
|
|
15
|
-
export declare function resolveScaledStyles(datum: DataRecord, channels: Partial<Record<ScaledChannelName, ChannelAccessor
|
|
16
|
-
|
|
15
|
+
export declare function resolveScaledStyles(datum: DataRecord, channels: Partial<Record<ScaledChannelName, ChannelAccessor> & {
|
|
16
|
+
style: string;
|
|
17
|
+
}>, useScale: Record<ScaledChannelName, boolean>, plot: PlotState, defaultColorProp?: 'fill' | 'stroke' | null): string;
|
|
18
|
+
export declare function resolveStyles(plot: PlotState, datum: ScaledDataRecord, channels: Partial<Record<ChannelName & MarkStyleProps, ChannelAccessor> & {
|
|
19
|
+
style: string;
|
|
20
|
+
}>, defaultColorProp: "fill" | "stroke" | null | undefined, useScale: Record<ScaledChannelName, boolean>, recomputeChannels?: boolean): [string | null, string | null];
|
|
17
21
|
export {};
|
package/dist/helpers/resolve.js
CHANGED
|
@@ -130,7 +130,11 @@ export function resolveStyles(plot, datum, channels, defaultColorProp = null, us
|
|
|
130
130
|
: {}),
|
|
131
131
|
...Object.fromEntries(Object.entries(scaledStyleProps)
|
|
132
132
|
.filter(([key]) => channels[key] != null)
|
|
133
|
-
.map(([key, cssAttr]) => [
|
|
133
|
+
.map(([key, cssAttr]) => [
|
|
134
|
+
key,
|
|
135
|
+
cssAttr,
|
|
136
|
+
recomputeChannels ? resolveChannel(key, datum.datum, channels) : datum[key]
|
|
137
|
+
])
|
|
134
138
|
.filter(([key, , value]) => isValid(value) || key === 'fill' || key === 'stroke')
|
|
135
139
|
.map(([key, cssAttr, value]) => {
|
|
136
140
|
if (useScale[key]) {
|
|
@@ -144,9 +148,9 @@ export function resolveStyles(plot, datum, channels, defaultColorProp = null, us
|
|
|
144
148
|
}))
|
|
145
149
|
};
|
|
146
150
|
if (plot.css) {
|
|
147
|
-
return [null, plot.css(stylePropsToCSS(styleProps))];
|
|
151
|
+
return [null, plot.css(`${stylePropsToCSS(styleProps)};${channels.style ?? ''}`)];
|
|
148
152
|
}
|
|
149
153
|
else {
|
|
150
|
-
return [stylePropsToCSS(styleProps)
|
|
154
|
+
return [`${stylePropsToCSS(styleProps)};${channels.style ?? ''}`, null];
|
|
151
155
|
}
|
|
152
156
|
}
|
package/dist/marks/Arrow.svelte
CHANGED
package/dist/marks/Text.svelte
CHANGED
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
{@const [style, styleClass] = resolveStyles(
|
|
132
132
|
plot,
|
|
133
133
|
{ ...d, __tspanIndex: 0 },
|
|
134
|
-
{
|
|
134
|
+
{ fontSize: 12, fontWeight: 500, strokeWidth: 1.6,
|
|
135
|
+
textAnchor: isLeft ? 'start' : isRight ? 'end' : 'middle', ...args },
|
|
135
136
|
'fill',
|
|
136
137
|
usedScales
|
|
137
138
|
)}
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
<!-- multiline text-->
|
|
141
142
|
{@const fontSize = resolveProp(args.fontSize, d.datum) || 12}
|
|
142
143
|
<text
|
|
143
|
-
class={[textClassName
|
|
144
|
+
class={[textClassName]}
|
|
144
145
|
dominant-baseline={LINE_ANCHOR[lineAnchor]}
|
|
145
146
|
transform="translate({[
|
|
146
147
|
Math.round(x + dx),
|
|
@@ -155,7 +156,7 @@
|
|
|
155
156
|
fontSize
|
|
156
157
|
)
|
|
157
158
|
]})"
|
|
158
|
-
>{#each textLines as line, l}<tspan x="0" dy={l ? fontSize : 0} {style}
|
|
159
|
+
>{#each textLines as line, l}<tspan x="0" dy={l ? fontSize : 0} class={styleClass} {style}
|
|
159
160
|
>{line}</tspan
|
|
160
161
|
>{/each}{#if title}<title>{title}</title>{/if}</text>
|
|
161
162
|
{:else}
|
|
@@ -175,11 +176,6 @@
|
|
|
175
176
|
|
|
176
177
|
<style>
|
|
177
178
|
text {
|
|
178
|
-
fill: none;
|
|
179
|
-
stroke: none;
|
|
180
|
-
font-size: 12px;
|
|
181
|
-
font-weight: 500;
|
|
182
|
-
stroke-width: 1.6px;
|
|
183
179
|
paint-order: stroke fill;
|
|
184
180
|
}
|
|
185
181
|
</style>
|