svelteplot 0.1.3-next.12 → 0.1.3-next.14

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.
@@ -4,7 +4,7 @@ import type { Snippet } from 'svelte';
4
4
  * Returns first argument that is not null or undefined
5
5
  */
6
6
  export declare function coalesce(...args: (RawValue | undefined | null)[]): RawValue | null;
7
- export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>): string | number | boolean | Date | null;
7
+ export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>): string | number | boolean | symbol | Date | null;
8
8
  export declare function randomId(): string;
9
9
  export declare function isSnippet(value: unknown): value is Snippet;
10
10
  export declare function isValid(value: RawValue | undefined): value is number | Date | string;
@@ -51,7 +51,7 @@ function resolve(datum, accessor, channel, scale) {
51
51
  // so we're passing the original value to accessor functions instead of our wrapped record
52
52
  return accessor(datum.___orig___ != null ? datum.___orig___ : datum);
53
53
  // use accessor string
54
- if (typeof accessor === 'string' && datum[accessor] !== undefined)
54
+ if ((typeof accessor === 'string' || typeof accessor === 'symbol') && datum[accessor] !== undefined)
55
55
  return datum[accessor];
56
56
  // fallback to channel name as accessor
57
57
  if (accessor === null && datum[channel] !== undefined)
@@ -51,8 +51,8 @@
51
51
  required={[]}
52
52
  channels={['x1', 'x2', 'y1', 'y2', 'fill', 'stroke', 'opacity', 'fillOpacity', 'strokeOpacity']}
53
53
  {...args}>
54
- {#snippet children({ mark, usedScales, scaledData })}
55
- <g class="rect">
54
+ {#snippet children({ usedScales, scaledData })}
55
+ <GroupMultiple class={scaledData.length > 1 ? 'rect' : null} length={scaledData.length}>
56
56
  {#each scaledData as d}
57
57
  {#if d.valid}
58
58
  {@const x1 = d.x1 == null ? plot.options.marginLeft : d.x1}
@@ -76,7 +76,7 @@
76
76
 
77
77
  {@const [style, styleClass] = resolveStyles(plot, d, args, 'fill', usedScales)}
78
78
  <rect
79
- class={[styleClass]}
79
+ class={[scaledData.length === 1 && 'rect', styleClass]}
80
80
  {style}
81
81
  x={minx + insetL}
82
82
  y={miny + insetT}
@@ -91,7 +91,7 @@
91
91
  }} />
92
92
  {/if}
93
93
  {/each}
94
- </g>
94
+ </GroupMultiple>
95
95
  {/snippet}
96
96
  </Mark>
97
97
 
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export type Mark<T> = {
16
16
  };
17
17
  export type ScaledChannelName = 'fill' | 'fillOpacity' | 'opacity' | 'r' | 'length' | 'stroke' | 'strokeOpacity' | 'symbol' | 'fx' | 'fy' | 'x' | 'x1' | 'x2' | 'y' | 'y1' | 'y2';
18
18
  export type ChannelName = ScaledChannelName | 'z' | 'sort' | 'filter' | 'interval';
19
- export type RawValue = number | Date | boolean | string;
19
+ export type RawValue = number | Date | boolean | string | symbol;
20
20
  export type ScaleOptions = {
21
21
  /**
22
22
  * Override the automatic scale type detection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.1.3-next.12",
3
+ "version": "0.1.3-next.14",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",