svelteplot 0.2.9-pr-95.1 → 0.2.9-pr-104.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 CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  const channelsWithFacets: ScaledChannelName[] = $derived([...channels, 'fx', 'fy']);
58
58
 
59
- const { addMark, updateMark, updatePlotState, removeMark, getTopLevelFacet, getPlotState } =
59
+ const { addMark, removeMark, getTopLevelFacet, getPlotState } =
60
60
  getContext<PlotContext>('svelteplot');
61
61
 
62
62
  const plot = $derived(getPlotState());
@@ -258,16 +258,17 @@
258
258
  if (options?.[channel] != null && out[channel] === undefined) {
259
259
  // resolve value
260
260
  const value = row[channel];
261
-
262
261
  const scaled = usedScales[channel]
263
262
  ? scale === 'x'
264
263
  ? projectX(channel as 'x' | 'x1' | 'x2', plot.scales, value)
265
264
  : scale === 'y'
266
265
  ? projectY(channel as 'y' | 'y1' | 'y1', plot.scales, value)
267
- : plot.scales[scale].fn(value)
266
+ : scale === 'color' && !isValid(value)
267
+ ? plot.options.color.unknown
268
+ : plot.scales[scale].fn(value)
268
269
  : value;
269
270
 
270
- out.valid = out.valid && isValid(value);
271
+ out.valid = out.valid && (scale === 'color' || isValid(value));
271
272
 
272
273
  // apply dx/dy transform
273
274
  out[channel] =
package/dist/Plot.svelte CHANGED
@@ -117,7 +117,7 @@
117
117
  scales,
118
118
  ...restProps
119
119
  })}
120
- <svelte:boundary onerror={(err) => console.warn(err)}>
120
+ <svelte:boundary onerror={(err) => console.error(err)}>
121
121
  <!-- implicit axes -->
122
122
  {#if !hasProjection && !hasExplicitAxisX}
123
123
  {#if options.axes && (options.x.axis === 'top' || options.x.axis === 'both')}
@@ -62,7 +62,7 @@
62
62
  initialWidth: 500,
63
63
  inset: 0,
64
64
  colorScheme: 'turbo',
65
- unknown: '#cccccc',
65
+ unknown: '#cccccc99',
66
66
  dotRadius: 3,
67
67
  frame: false,
68
68
  axes: true,
@@ -450,7 +450,7 @@
450
450
  padding: 0,
451
451
  align: 0
452
452
  },
453
- color: { type: 'auto' },
453
+ color: { type: 'auto', unknown: DEFAULTS.unknown },
454
454
  length: { type: 'linear' },
455
455
  symbol: { type: 'ordinal' },
456
456
  fx: { type: 'band', axis: 'top' },
@@ -54,8 +54,9 @@ export function createScale(name, scaleOptions, marks, plotOptions, plotWidth, p
54
54
  // we're deliberately checking for !== undefined and not for != null
55
55
  // since the explicit sort transforms like shuffle will set the
56
56
  // sort channel to null to we know that there's an explicit order
57
- if (mark.channels.sort !== undefined)
57
+ if (name === 'x' && mark.options.sort != null) {
58
58
  sortOrdinalDomain = false;
59
+ }
59
60
  for (const channel of mark.channels) {
60
61
  // channelOptions can be passed as prop, but most often users will just
61
62
  // pass the channel accessor or constant value, so we may need to wrap
@@ -167,6 +167,7 @@
167
167
  .swatch {
168
168
  display: inline-flex;
169
169
  align-items: center;
170
+ column-gap: 0.3rem;
170
171
  }
171
172
  .item-label {
172
173
  vertical-align: super;
@@ -51,7 +51,6 @@
51
51
 
52
52
  const { getTestFacet } = getContext<FacetContext>('svelteplot/facet');
53
53
  const { dotRadius } = getContext<PlotDefaults>('svelteplot/_defaults');
54
- let testFacet = $derived(getTestFacet());
55
54
 
56
55
  const args = $derived(
57
56
  // todo: move sorting to Mark
@@ -84,7 +83,7 @@
84
83
  defaults={{ r: dotRadius, symbol: 'circle' }}
85
84
  {...args}>
86
85
  {#snippet children({ mark, usedScales, scaledData })}
87
- <g class="dots {className || ''}">
86
+ <g class="dot {className || ''}">
88
87
  {#if canvas}
89
88
  <DotCanvas data={scaledData} {mark} />
90
89
  {:else}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.2.9-pr-95.1",
3
+ "version": "0.2.9-pr-104.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",