svelteplot 0.1.3-next.5 → 0.1.3-next.6

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
@@ -156,6 +156,7 @@
156
156
  }
157
157
  });
158
158
 
159
+
159
160
  function isDifferent(array1: ResolvedDataRecord[], array2: ResolvedDataRecord[]) {
160
161
  if (array1.length !== array2.length) return true;
161
162
  for (let i = 0; i < array1.length; i++) {
@@ -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>>, useScale: Record<ScaledChannelName, boolean>, plot: PlotState, defaultColorProp?: 'fill' | 'stroke' | null): string;
16
- export declare function resolveStyles(plot: PlotState, datum: ScaledDataRecord, channels: Partial<Record<ChannelName & MarkStyleProps, ChannelAccessor>>, defaultColorProp: "fill" | "stroke" | null | undefined, useScale: Record<ScaledChannelName, boolean>, recomputeChannels?: boolean): [string | null, string | null];
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 {};
@@ -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]) => [key, cssAttr, recomputeChannels ? resolveChannel(key, datum.datum, channels) : datum[key]])
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), null];
154
+ return [`${stylePropsToCSS(styleProps)};${channels.style ?? ''}`, null];
151
155
  }
152
156
  }
@@ -120,7 +120,7 @@
120
120
  class={[className]}
121
121
  use:addEventHandlers={{
122
122
  getPlotState,
123
- options: mark.options,
123
+ options: args,
124
124
  datum: d.datum
125
125
  }}>
126
126
  {#if options.onmouseenter || options.onclick}
@@ -131,7 +131,8 @@
131
131
  {@const [style, styleClass] = resolveStyles(
132
132
  plot,
133
133
  { ...d, __tspanIndex: 0 },
134
- { textAnchor: isLeft ? 'start' : isRight ? 'end' : 'middle', ...args },
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, styleClass]}
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.1.3-next.5",
3
+ "version": "0.1.3-next.6",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",