svelteplot 0.3.11-pr-153.20 → 0.3.11-pr-153.21

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.
@@ -1,6 +1,6 @@
1
- import type { Channels, DataRecord } from '../types/index.js';
1
+ import type { Channels } from '../types/index.js';
2
2
  /**
3
3
  * Groups the data by the fx, fy and z channels and calls the reduce function
4
4
  * for each group. Returns the new channels to be added in the transform.
5
5
  */
6
- export declare function groupFacetsAndZ<T>(items: T[], channels: Channels, reduce: (items: DataRecord[]) => any): any;
6
+ export declare function groupFacetsAndZ<T>(items: T[], channels: Channels<T>, reduce: (items: T[]) => any): any;
@@ -1,15 +1,15 @@
1
- import type { ChannelAccessor, ChannelName, DataRecord, RawValue } from '../types/index.js';
1
+ import type { ChannelName, Channels, DataRecord, RawValue } from '../types/index.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  /**
4
4
  * Returns first argument that is not null or undefined
5
5
  */
6
6
  export declare function coalesce(...args: (RawValue | undefined | null)[]): any;
7
- export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>): any;
7
+ export declare function testFilter<T>(datum: T, options: Channels<T>): any;
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;
11
11
  export declare function maybeData(data: DataRecord[]): DataRecord[];
12
- export declare function isObject(option: object | RawValue): option is object;
12
+ export declare function isObject<T>(option: object | T): option is object;
13
13
  export declare function maybeNumber(value: RawValue | null): number | null;
14
14
  export declare const constant: <T>(x: T) => () => T;
15
15
  export declare const POSITION_CHANNELS: Set<ChannelName>;
@@ -14,7 +14,7 @@ export function coalesce(...args) {
14
14
  }
15
15
  export function testFilter(datum, options) {
16
16
  return (options.filter == null ||
17
- resolveProp(options.filter, datum?.hasOwnProperty(RAW_VALUE) ? datum[RAW_VALUE] : datum));
17
+ resolveProp(options.filter, isObject(datum) && datum.hasOwnProperty(RAW_VALUE) ? datum[RAW_VALUE] : datum));
18
18
  }
19
19
  export function randomId() {
20
20
  return Math.ceil(1e9 + Math.random() * 1e9).toString(36);
@@ -1,2 +1,2 @@
1
- import type { DataRecord, TransformArg } from '../types/index.js';
2
- export declare function filter({ data, ...channels }: TransformArg<DataRecord>): TransformArg<DataRecord>;
1
+ import type { TransformArg } from '../types/index.js';
2
+ export declare function filter<T>({ data, ...channels }: TransformArg<T>): TransformArg<T>;
@@ -1,7 +1,7 @@
1
- import type { DataRecord, DataRow, TransformArg } from '../types/index.js';
1
+ import type { DataRow, TransformArg } from '../types/index.js';
2
2
  export declare const SORT_KEY: unique symbol;
3
3
  export declare const IS_SORTED: unique symbol;
4
- export declare function sort({ data, ...channels }: TransformArg<DataRecord>, options?: {
4
+ export declare function sort<T>({ data, ...channels }: TransformArg<T>, options?: {
5
5
  reverse?: boolean;
6
6
  }): any;
7
7
  /**
@@ -8,25 +8,5 @@ export type StackOptions = {
8
8
  };
9
9
  export declare function stackY<T>({ data, ...channels }: T, opts?: Partial<StackOptions>): T;
10
10
  export declare function stackX({ data, ...channels }: TransformArg, opts?: Partial<StackOptions>): TransformArg;
11
- export declare function stackMosaicX<T>(args: any, opts: any): {
12
- fx: any;
13
- fy: any;
14
- data: unknown[];
15
- x: symbol;
16
- x1: symbol;
17
- x2: symbol;
18
- y: symbol;
19
- y1: symbol;
20
- y2: symbol;
21
- };
22
- export declare function stackMosaicY<T>(args: any, opts: any): {
23
- fx: any;
24
- fy: any;
25
- data: unknown[];
26
- x: symbol;
27
- x1: symbol;
28
- x2: symbol;
29
- y: symbol;
30
- y1: symbol;
31
- y2: symbol;
32
- };
11
+ export declare function stackMosaicX<T>(args: any, opts: any): any;
12
+ export declare function stackMosaicY<T>(args: any, opts: any): any;
@@ -1,5 +1,5 @@
1
1
  import type { ConstantAccessor, RawValue } from './index.js';
2
- export type Channels = Record<string, ChannelAccessor | ConstantAccessor<string | number | boolean | symbol>>;
2
+ export type Channels<T> = Record<string, ChannelAccessor<T> | ConstantAccessor<T, string | number | boolean | symbol>>;
3
3
  export type ChannelAccessor<T = Record<string | symbol, RawValue>> = ChannelValue<T> | {
4
4
  /** the channel value */
5
5
  value: ChannelValue<T>;
@@ -25,11 +25,11 @@ export type MarkerOptions = {
25
25
  marker?: boolean | MarkerShape | Snippet;
26
26
  };
27
27
  export type ConstantAccessor<T, D = Record<string | symbol, RawValue>> = T | ((d: D) => T) | null | undefined;
28
- export type TransformArg<K> = Channels & BaseMarkProps<K> & {
29
- data: K[];
28
+ export type TransformArg<T> = Channels<T> & BaseMarkProps<T> & {
29
+ data: T[];
30
30
  };
31
- export type MapArg<K> = Channels & {
32
- data: K[];
31
+ export type MapArg<T> = Channels<T> & {
32
+ data: T[];
33
33
  };
34
34
  export type TransformArgsRow = Partial<Channels> & {
35
35
  data: DataRow[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.3.11-pr-153.20",
3
+ "version": "0.3.11-pr-153.21",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",