@dtour/scatter 0.1.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/data/analyze.d.ts +7 -0
- package/dist/data/analyze.d.ts.map +1 -0
- package/dist/data/arrow.d.ts +11 -0
- package/dist/data/arrow.d.ts.map +1 -0
- package/dist/data/detect.d.ts +3 -0
- package/dist/data/detect.d.ts.map +1 -0
- package/dist/data/messages.d.ts +67 -0
- package/dist/data/messages.d.ts.map +1 -0
- package/dist/data/palettes.d.ts +11 -0
- package/dist/data/palettes.d.ts.map +1 -0
- package/dist/data/parquet.d.ts +11 -0
- package/dist/data/parquet.d.ts.map +1 -0
- package/dist/data/parse.d.ts +7 -0
- package/dist/data/parse.d.ts.map +1 -0
- package/dist/data/types.d.ts +28 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/data/worker.d.ts +2 -0
- package/dist/data/worker.d.ts.map +1 -0
- package/dist/gpu/client.d.ts +104 -0
- package/dist/gpu/client.d.ts.map +1 -0
- package/dist/gpu/color-pipeline.d.ts +20 -0
- package/dist/gpu/color-pipeline.d.ts.map +1 -0
- package/dist/gpu/device.d.ts +10 -0
- package/dist/gpu/device.d.ts.map +1 -0
- package/dist/gpu/messages.d.ts +65 -0
- package/dist/gpu/messages.d.ts.map +1 -0
- package/dist/gpu/pipeline.d.ts +57 -0
- package/dist/gpu/pipeline.d.ts.map +1 -0
- package/dist/gpu/projection.d.ts +20 -0
- package/dist/gpu/projection.d.ts.map +1 -0
- package/dist/gpu/worker.d.ts +2 -0
- package/dist/gpu/worker.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/pca/jacobi.d.ts +16 -0
- package/dist/pca/jacobi.d.ts.map +1 -0
- package/dist/pca/pipeline.d.ts +13 -0
- package/dist/pca/pipeline.d.ts.map +1 -0
- package/dist/renderer.d.ts +20 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/scatter.js +2177 -0
- package/dist/selection.d.ts +10 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/tour/arc-length.d.ts +32 -0
- package/dist/tour/arc-length.d.ts.map +1 -0
- package/dist/tour/geodesic.d.ts +27 -0
- package/dist/tour/geodesic.d.ts.map +1 -0
- package/dist/tour/svd2x2.d.ts +13 -0
- package/dist/tour/svd2x2.d.ts.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/data/analyze.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,YAAY,KAAG,cAapD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CategoricalColumn } from './types.ts';
|
|
2
|
+
export type ArrowResult = {
|
|
3
|
+
numeric: Record<string, Float32Array>;
|
|
4
|
+
categorical: CategoricalColumn[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Load Arrow IPC (file or stream format) and extract all numeric columns
|
|
8
|
+
* as Float32Arrays plus categorical columns. Runs inside the Data Worker.
|
|
9
|
+
*/
|
|
10
|
+
export declare const loadArrow: (buffer: ArrayBuffer) => ArrowResult;
|
|
11
|
+
//# sourceMappingURL=arrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../src/data/arrow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,WAAW,EAAE,iBAAiB,EAAE,CAAC;CAClC,CAAC;AAaF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,WAAW,KAAG,WA+C/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/data/detect.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAU7C,eAAO,MAAM,YAAY,GAAI,QAAQ,WAAW,KAAG,UAYlD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Metadata } from './types.ts';
|
|
2
|
+
export type MainToData = {
|
|
3
|
+
type: 'init';
|
|
4
|
+
gpuPort: MessagePort;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'load';
|
|
7
|
+
buffer: ArrayBuffer;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'encodeColor';
|
|
10
|
+
column: string;
|
|
11
|
+
palette?: string;
|
|
12
|
+
theme?: 'light' | 'dark';
|
|
13
|
+
colorMap?: Record<string, [number, number, number]>;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'selectByColumn';
|
|
16
|
+
column: string;
|
|
17
|
+
labelIndices?: number[];
|
|
18
|
+
valueRanges?: Float32Array;
|
|
19
|
+
};
|
|
20
|
+
export type DataToMain = {
|
|
21
|
+
type: 'metadata';
|
|
22
|
+
metadata: Metadata;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'error';
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
export type DataToGpu = {
|
|
28
|
+
type: 'data';
|
|
29
|
+
dataVersion: number;
|
|
30
|
+
dims: number;
|
|
31
|
+
rows: number;
|
|
32
|
+
buffers: Float32Array[];
|
|
33
|
+
mins: number[];
|
|
34
|
+
ranges: number[];
|
|
35
|
+
/** Categorical column indices, transferred alongside numeric buffers. */
|
|
36
|
+
categoricalColumns: {
|
|
37
|
+
name: string;
|
|
38
|
+
indices: Uint32Array;
|
|
39
|
+
}[];
|
|
40
|
+
} | {
|
|
41
|
+
type: 'encodeColorContinuous';
|
|
42
|
+
dataVersion: number;
|
|
43
|
+
columnIndex: number;
|
|
44
|
+
min: number;
|
|
45
|
+
range: number;
|
|
46
|
+
/** Packed RGBA u32 colormap LUT (e.g. 25 stops for viridis). */
|
|
47
|
+
colormap: Uint32Array;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'encodeColorCategorical';
|
|
50
|
+
dataVersion: number;
|
|
51
|
+
catColumnName: string;
|
|
52
|
+
/** Packed RGBA u32 per label. */
|
|
53
|
+
palette: Uint32Array;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'selectContinuous';
|
|
56
|
+
dataVersion: number;
|
|
57
|
+
columnIndex: number;
|
|
58
|
+
/** Flat [lo0, hi0, lo1, hi1, ...] pairs. */
|
|
59
|
+
ranges: Float32Array;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'selectCategorical';
|
|
62
|
+
dataVersion: number;
|
|
63
|
+
catColumnName: string;
|
|
64
|
+
/** Per-label mask: selectedLabels[labelIdx] = 1 or 0. */
|
|
65
|
+
selectedLabels: Uint32Array;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/data/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,M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E,MAAM,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,YAAY,CAAC;CACtB,GACD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,cAAc,EAAE,WAAW,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Okabe-Ito colorblind-safe palette (7 colors, RGB 0-255). */
|
|
2
|
+
export declare const OKABE_ITO: [number, number, number][];
|
|
3
|
+
/** Glasbey dark palette (256 maximally-distinct colors, RGB 0-255). */
|
|
4
|
+
export declare const GLASBEY_DARK: [number, number, number][];
|
|
5
|
+
/** Glasbey light palette (256 maximally-distinct colors, RGB 0-255). */
|
|
6
|
+
export declare const GLASBEY_LIGHT: [number, number, number][];
|
|
7
|
+
/** Viridis 25-stop ramp (RGB 0-255). */
|
|
8
|
+
export declare const VIRIDIS_25: [number, number, number][];
|
|
9
|
+
/** Viridis 25-stop ramp (RGB 0-255). */
|
|
10
|
+
export declare const MAGMA_25: [number, number, number][];
|
|
11
|
+
//# sourceMappingURL=palettes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palettes.d.ts","sourceRoot":"","sources":["../../src/data/palettes.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAO,MAAM,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAQ/C,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAiElD,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAiQnD,CAAA;AAED,wCAAwC;AACxC,eAAO,MAAM,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EA0BhD,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EA0B9C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CategoricalColumn } from './types.ts';
|
|
2
|
+
export type ParquetResult = {
|
|
3
|
+
numeric: Record<string, Float32Array>;
|
|
4
|
+
categorical: CategoricalColumn[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Load a Parquet file from an ArrayBuffer and extract all numeric columns
|
|
8
|
+
* as Float32Arrays plus categorical columns. Runs inside the Data Worker.
|
|
9
|
+
*/
|
|
10
|
+
export declare const loadParquet: (buffer: ArrayBuffer) => Promise<ParquetResult>;
|
|
11
|
+
//# sourceMappingURL=parquet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parquet.d.ts","sourceRoot":"","sources":["../../src/data/parquet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,WAAW,EAAE,iBAAiB,EAAE,CAAC;CAClC,CAAC;AAaF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,QAAQ,WAAW,KAAG,OAAO,CAAC,aAAa,CA8E5E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnalyzedData } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Detect format, load, extract numeric columns, normalize to [-1, 1].
|
|
4
|
+
* Runs inside the Data Worker.
|
|
5
|
+
*/
|
|
6
|
+
export declare const parseBuffer: (buffer: ArrayBuffer) => Promise<AnalyzedData>;
|
|
7
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/data/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,QAAQ,WAAW,KAAG,OAAO,CAAC,YAAY,CAiC3E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ColumnData = {
|
|
2
|
+
name: string;
|
|
3
|
+
values: Float32Array;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
range: number;
|
|
7
|
+
};
|
|
8
|
+
export type CategoricalColumn = {
|
|
9
|
+
name: string;
|
|
10
|
+
indices: Uint32Array;
|
|
11
|
+
labels: string[];
|
|
12
|
+
};
|
|
13
|
+
export type AnalyzedData = {
|
|
14
|
+
columns: ColumnData[];
|
|
15
|
+
categoricalColumns: CategoricalColumn[];
|
|
16
|
+
rowCount: number;
|
|
17
|
+
};
|
|
18
|
+
export type Metadata = {
|
|
19
|
+
columnNames: string[];
|
|
20
|
+
categoricalColumnNames: string[];
|
|
21
|
+
categoricalLabels: Record<string, string[]>;
|
|
22
|
+
rowCount: number;
|
|
23
|
+
dimCount: number;
|
|
24
|
+
mins: number[];
|
|
25
|
+
maxes: number[];
|
|
26
|
+
ranges: number[];
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/data/worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Metadata } from '../data/types.ts';
|
|
2
|
+
export type ScatterOptions = {
|
|
3
|
+
/** All canvases to render into. Index 0 = main view, 1+ = previews. */
|
|
4
|
+
canvases: HTMLCanvasElement[];
|
|
5
|
+
/** Initial camera zoom level. Default 1. */
|
|
6
|
+
zoom?: number;
|
|
7
|
+
/** Device pixel ratio. Default `window.devicePixelRatio ?? 1`. */
|
|
8
|
+
dpr?: number;
|
|
9
|
+
};
|
|
10
|
+
export type ScatterStatus = {
|
|
11
|
+
type: 'ready';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'rendered';
|
|
14
|
+
viewIndex: number;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'metadata';
|
|
17
|
+
metadata: Metadata;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'error';
|
|
20
|
+
message: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'pcaResult';
|
|
23
|
+
eigenvectors: Float32Array[];
|
|
24
|
+
eigenvalues: Float32Array;
|
|
25
|
+
numDims: number;
|
|
26
|
+
};
|
|
27
|
+
export type ScatterInstance = {
|
|
28
|
+
/** Transfer an Arrow IPC or Parquet ArrayBuffer for loading. Ownership is transferred. */
|
|
29
|
+
loadData: (buffer: ArrayBuffer) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Set tour basis matrices. Each basis is a p×2 column-major Float32Array:
|
|
32
|
+
* [x0, x1, ..., xp-1, y0, y1, ..., yp-1]
|
|
33
|
+
* where x_i is the x-projection weight for dimension i.
|
|
34
|
+
* dims (p) is inferred as bases[0].length / 2.
|
|
35
|
+
*
|
|
36
|
+
* @param bases - array of basis matrices, one per tour keyframe
|
|
37
|
+
*/
|
|
38
|
+
setBases: (bases: Float32Array[]) => void;
|
|
39
|
+
/** Set tour position along the arc-length parameterized path [0, 1]. */
|
|
40
|
+
setTourPosition: (position: number) => void;
|
|
41
|
+
/** Update point rendering style. Use 'auto' for density-adaptive sizing. */
|
|
42
|
+
setStyle: (options: {
|
|
43
|
+
pointSize?: number | 'auto';
|
|
44
|
+
opacity?: number | 'auto';
|
|
45
|
+
color?: [number, number, number];
|
|
46
|
+
}) => void;
|
|
47
|
+
/** Set 2D camera (pan, zoom, and optional viewport inset for toolbar offset). */
|
|
48
|
+
setCamera: (options: {
|
|
49
|
+
pan?: [number, number];
|
|
50
|
+
zoom?: number;
|
|
51
|
+
/** NDC-space Y offset — shifts content to center below toolbar. */
|
|
52
|
+
insetOffsetY?: number;
|
|
53
|
+
/** Zoom multiplier — scales content to fit visible area below toolbar. */
|
|
54
|
+
insetZoom?: number;
|
|
55
|
+
}) => void;
|
|
56
|
+
/** Resize a canvas to the given pixel dimensions (use for DPI-aware sizing). */
|
|
57
|
+
resize: (viewIndex: number, width: number, height: number, dpr?: number) => void;
|
|
58
|
+
/** Request a render of all views. */
|
|
59
|
+
render: () => void;
|
|
60
|
+
/** Set a single basis directly for manual/zen modes. Renders main view only. */
|
|
61
|
+
setDirectBasis: (basis: Float32Array) => void;
|
|
62
|
+
/** Encode a column as per-point colors. Column can be categorical or numeric. */
|
|
63
|
+
encodeColor: (column: string, palette?: string, theme?: 'light' | 'dark', colorMap?: Record<string, [number, number, number]>) => void;
|
|
64
|
+
/** Set the background clear color (RGB 0–1). */
|
|
65
|
+
setBackgroundColor: (color: [number, number, number]) => void;
|
|
66
|
+
/** Clear per-point colors and revert to uniform color. */
|
|
67
|
+
clearColor: () => void;
|
|
68
|
+
/** Select points by column value. Mask is built in the data worker. */
|
|
69
|
+
selectByColumn: (column: string, opts: {
|
|
70
|
+
labelIndices?: number[];
|
|
71
|
+
valueRanges?: Float32Array;
|
|
72
|
+
}) => void;
|
|
73
|
+
/** Set a bit-packed selection mask (1 bit per point, 32 per u32). Length: ceil(numPoints / 32). */
|
|
74
|
+
setSelectionMask: (mask: Uint32Array) => void;
|
|
75
|
+
/** Lasso select: send NDC polygon, GPU does point-in-polygon test. */
|
|
76
|
+
lassoSelect: (polygon: Float32Array) => void;
|
|
77
|
+
/** Clear selection mask — all points visible. */
|
|
78
|
+
clearSelection: () => void;
|
|
79
|
+
/** Request GPU-accelerated PCA computation. Results arrive via subscribe as 'pcaResult'. */
|
|
80
|
+
computePCA: () => void;
|
|
81
|
+
/** Subscribe to status events from both workers. Returns an unsubscribe function. */
|
|
82
|
+
subscribe: (handler: (status: ScatterStatus) => void) => () => void;
|
|
83
|
+
/** Terminate both workers and release resources. */
|
|
84
|
+
destroy: () => void;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Create a scatter renderer instance.
|
|
88
|
+
*
|
|
89
|
+
* Instantiates the GPU Worker and Data Worker, connects them via a
|
|
90
|
+
* MessageChannel (so parsed data flows directly to the GPU worker without
|
|
91
|
+
* passing through the main thread), and transfers OffscreenCanvas control
|
|
92
|
+
* to the GPU worker.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const scatter = createScatter({ canvases: [mainCanvas, ...previewCanvases] });
|
|
97
|
+
* scatter.subscribe(console.log);
|
|
98
|
+
* scatter.loadData(arrowBuffer);
|
|
99
|
+
* scatter.setBases(bases);
|
|
100
|
+
* scatter.setTourPosition(0.5);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const createScatter: (options: ScatterOptions) => ScatterInstance;
|
|
104
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/gpu/client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,MAAM,cAAc,GAAG;IAC3B,uEAAuE;IACvE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG;IAC5B,0FAA0F;IAC1F,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,K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AAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAC9D,0DAA0D;IAC1D,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,uEAAuE;IACvE,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,CAAC,EAAE,YAAY,CAAA;KAAE,KAAK,IAAI,CAAC;IACxG,mGAAmG;IACnG,gBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,sEAAsE;IACtE,WAAW,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,iDAAiD;IACjD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,4FAA4F;IAC5F,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,qFAAqF;IACrF,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IACpE,oDAAoD;IACpD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAUF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,eA0LvD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ColorPipelines = {
|
|
2
|
+
colorContinuous: GPUComputePipeline;
|
|
3
|
+
colorCategorical: GPUComputePipeline;
|
|
4
|
+
selectContinuous: GPUComputePipeline;
|
|
5
|
+
selectCategorical: GPUComputePipeline;
|
|
6
|
+
bindGroupLayout: GPUBindGroupLayout;
|
|
7
|
+
paramsBuffer: GPUBuffer;
|
|
8
|
+
};
|
|
9
|
+
export declare const createColorPipelines: (device: GPUDevice) => ColorPipelines;
|
|
10
|
+
/** Create a bind group for any of the 4 color/selection compute operations. */
|
|
11
|
+
export declare const createColorBindGroup: (device: GPUDevice, layout: GPUBindGroupLayout, source: GPUBuffer, lookup: GPUBuffer, output: GPUBuffer, params: GPUBuffer) => GPUBindGroup;
|
|
12
|
+
/** Dispatch a color/selection compute shader and return the command buffer. */
|
|
13
|
+
export declare const dispatchColorCompute: (device: GPUDevice, pipeline: GPUComputePipeline, bindGroup: GPUBindGroup, numPoints: number) => GPUCommandBuffer;
|
|
14
|
+
export declare const writeContinuousColorParams: (device: GPUDevice, buf: GPUBuffer, numPoints: number, columnOffset: number, min: number, range: number, lutSize: number) => void;
|
|
15
|
+
export declare const writeCategoricalColorParams: (device: GPUDevice, buf: GPUBuffer, numPoints: number, paletteSize: number) => void;
|
|
16
|
+
export declare const writeContinuousSelectParams: (device: GPUDevice, buf: GPUBuffer, numPoints: number, columnOffset: number, numRanges: number) => void;
|
|
17
|
+
export declare const writeCategoricalSelectParams: (device: GPUDevice, buf: GPUBuffer, numPoints: number, numLabels: number) => void;
|
|
18
|
+
/** Pack an RGB palette [[r,g,b], ...] into Uint32Array of 0xAABBGGRR values. */
|
|
19
|
+
export declare const packPalette: (palette: [number, number, number][]) => Uint32Array;
|
|
20
|
+
//# sourceMappingURL=color-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-pipeline.d.ts","sourceRoot":"","sources":["../../src/gpu/color-pipeline.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,kBAAkB,CAAC;IACpC,gBAAgB,EAAE,kBAAkB,CAAC;IACrC,gBAAgB,EAAE,kBAAkB,CAAC;IACrC,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,eAAe,EAAE,kBAAkB,CAAC;IACpC,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,KAAG,cAkCxD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,SAAS,EACjB,QAAQ,kBAAkB,EAC1B,QAAQ,SAAS,EACjB,QAAQ,SAAS,EACjB,QAAQ,SAAS,EACjB,QAAQ,SAAS,KAChB,YAUC,CAAC;AAEL,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,SAAS,EACjB,UAAU,kBAAkB,EAC5B,WAAW,YAAY,EACvB,WAAW,MAAM,KAChB,gBAQF,CAAC;AAIF,eAAO,MAAM,0BAA0B,GACrC,QAAQ,SAAS,EACjB,KAAK,SAAS,EACd,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,MAAM,KACd,IAUF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,QAAQ,SAAS,EACjB,KAAK,SAAS,EACd,WAAW,MAAM,EACjB,aAAa,MAAM,KAClB,IAMF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,QAAQ,SAAS,EACjB,KAAK,SAAS,EACd,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,WAAW,MAAM,KAChB,IAOF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,QAAQ,SAAS,EACjB,KAAK,SAAS,EACd,WAAW,MAAM,EACjB,WAAW,MAAM,KAChB,IAMF,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,WAAW,GAAI,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAG,WAOjE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type GpuContext = {
|
|
2
|
+
adapter: GPUAdapter;
|
|
3
|
+
device: GPUDevice;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Request WebGPU adapter and device. Must run inside the GPU Worker
|
|
7
|
+
* (or main thread for testing). Throws if WebGPU is unavailable.
|
|
8
|
+
*/
|
|
9
|
+
export declare const initDevice: () => Promise<GpuContext>;
|
|
10
|
+
//# sourceMappingURL=device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/gpu/device.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,UAAU,CAqCrD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type MainToGpu = {
|
|
2
|
+
type: 'init';
|
|
3
|
+
canvases: OffscreenCanvas[];
|
|
4
|
+
dataPort: MessagePort;
|
|
5
|
+
zoom: number;
|
|
6
|
+
dpr: number;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'setBases';
|
|
9
|
+
bases: Float32Array[];
|
|
10
|
+
} | {
|
|
11
|
+
type: 'setTourPosition';
|
|
12
|
+
position: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'setStyle';
|
|
15
|
+
pointSize: number | 'auto';
|
|
16
|
+
opacity: number | 'auto';
|
|
17
|
+
color: [number, number, number];
|
|
18
|
+
} | {
|
|
19
|
+
type: 'setCamera';
|
|
20
|
+
pan: [number, number];
|
|
21
|
+
zoom: number;
|
|
22
|
+
insetOffsetY: number;
|
|
23
|
+
insetZoom: number;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'resize';
|
|
26
|
+
viewIndex: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
dpr?: number;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'render';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'setDirectBasis';
|
|
34
|
+
basis: Float32Array;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'clearColors';
|
|
37
|
+
} | {
|
|
38
|
+
type: 'setBackgroundColor';
|
|
39
|
+
color: [number, number, number];
|
|
40
|
+
} | {
|
|
41
|
+
type: 'setSelectionMask';
|
|
42
|
+
mask: Uint32Array;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'clearSelectionMask';
|
|
45
|
+
} | {
|
|
46
|
+
type: 'lassoSelect';
|
|
47
|
+
polygon: Float32Array;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'computePCA';
|
|
50
|
+
};
|
|
51
|
+
export type GpuToMain = {
|
|
52
|
+
type: 'ready';
|
|
53
|
+
} | {
|
|
54
|
+
type: 'rendered';
|
|
55
|
+
viewIndex: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'error';
|
|
58
|
+
message: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'pcaResult';
|
|
61
|
+
eigenvectors: Float32Array[];
|
|
62
|
+
eigenvalues: Float32Array;
|
|
63
|
+
numDims: number;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/gpu/messages.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,GACD;IAIE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB,GACD;IAGE,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3G;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAClF;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAEE,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAGE,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;CACvB,GACD;IAGE,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAGN,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type PointPipeline = {
|
|
2
|
+
/** Additive blend pipeline — accumulates light on dark background. */
|
|
3
|
+
additivePipeline: GPURenderPipeline;
|
|
4
|
+
/** Normal (premultiplied-over) blend pipeline — preserves label colors. */
|
|
5
|
+
normalPipeline: GPURenderPipeline;
|
|
6
|
+
/** Subtractive (reverse-subtract) blend pipeline — subtracts from light background. */
|
|
7
|
+
subtractivePipeline: GPURenderPipeline;
|
|
8
|
+
bindGroupLayout: GPUBindGroupLayout;
|
|
9
|
+
uniformBuffer: GPUBuffer;
|
|
10
|
+
cameraBuffer: GPUBuffer;
|
|
11
|
+
/** Small 4-byte default buffer used when no per-point colors are loaded. */
|
|
12
|
+
defaultColorBuffer: GPUBuffer;
|
|
13
|
+
/** Small 4-byte default buffer used when no selection mask is set. */
|
|
14
|
+
defaultSelectionBuffer: GPUBuffer;
|
|
15
|
+
};
|
|
16
|
+
/** Resolved style with concrete numeric values, ready for GPU upload. */
|
|
17
|
+
export type PointStyle = {
|
|
18
|
+
pointSize: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
color: [number, number, number];
|
|
21
|
+
};
|
|
22
|
+
/** Style as stored in worker state — may contain 'auto' for per-view resolution. */
|
|
23
|
+
export type RawPointStyle = {
|
|
24
|
+
pointSize: number | 'auto';
|
|
25
|
+
opacity: number | 'auto';
|
|
26
|
+
color: [number, number, number];
|
|
27
|
+
};
|
|
28
|
+
export type StyleFlags = {
|
|
29
|
+
usePerPointColor: boolean;
|
|
30
|
+
useSelectionMask: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type CameraState = {
|
|
33
|
+
panX: number;
|
|
34
|
+
panY: number;
|
|
35
|
+
zoom: number;
|
|
36
|
+
aspect: number;
|
|
37
|
+
viewportHeight: number;
|
|
38
|
+
/** NDC-space Y offset — shifts content to center below toolbar. */
|
|
39
|
+
insetOffsetY: number;
|
|
40
|
+
/** Zoom multiplier — scales content to fit visible area below toolbar. */
|
|
41
|
+
insetZoom: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const createPointPipeline: (device: GPUDevice, canvasFormat: GPUTextureFormat) => PointPipeline;
|
|
44
|
+
export declare const writeUniforms: (device: GPUDevice, uniformBuffer: GPUBuffer, style: PointStyle, flags?: StyleFlags, useSubtractive?: boolean) => void;
|
|
45
|
+
export declare const writeCamera: (device: GPUDevice, cameraBuffer: GPUBuffer, camera: CameraState) => void;
|
|
46
|
+
export declare const createPointBindGroup: (device: GPUDevice, layout: GPUBindGroupLayout, uniformBuffer: GPUBuffer, projectedBuffer: GPUBuffer, cameraBuffer: GPUBuffer, colorBuffer: GPUBuffer, selectionBuffer: GPUBuffer) => GPUBindGroup;
|
|
47
|
+
export type TonemapPipeline = {
|
|
48
|
+
pipeline: GPURenderPipeline;
|
|
49
|
+
bindGroupLayout: GPUBindGroupLayout;
|
|
50
|
+
/** Shared 16-byte uniform buffer: [mode(f32), pad, pad, pad]. */
|
|
51
|
+
paramsBuffer: GPUBuffer;
|
|
52
|
+
};
|
|
53
|
+
/** Tonemap mode: 0 = exponential (additive), 1 = clamp (over/subtractive). */
|
|
54
|
+
export declare const writeTonemapParams: (device: GPUDevice, paramsBuffer: GPUBuffer, mode: number) => void;
|
|
55
|
+
export declare const createTonemapPipeline: (device: GPUDevice, canvasFormat: GPUTextureFormat) => TonemapPipeline;
|
|
56
|
+
export declare const createTonemapBindGroup: (device: GPUDevice, layout: GPUBindGroupLayout, hdrTextureView: GPUTextureView, paramsBuffer: GPUBuffer) => GPUBindGroup;
|
|
57
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/gpu/pipeline.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IAC1B,sEAAsE;IACtE,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,2EAA2E;IAC3E,cAAc,EAAE,iBAAiB,CAAC;IAClC,uFAAuF;IACvF,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,eAAe,EAAE,kBAAkB,CAAC;IACpC,aAAa,EAAE,SAAS,CAAC;IACzB,YAAY,EAAE,SAAS,CAAC;IACxB,4E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,QAAQ,SAAS,EACjB,QAAQ,kBAAkB,EAC1B,eAAe,SAAS,EACxB,iBAAiB,SAAS,EAC1B,cAAc,SAAS,EACvB,aAAa,SAAS,EACtB,iBAAiB,SAAS,KACzB,YAWC,CAAC;AAIL,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,eAAe,EAAE,kBAAkB,CAAC;IACpC,iEAAiE;IACjE,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,SAAS,EACjB,cAAc,SAAS,EACvB,MAAM,MAAM,KACX,IAIF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,SAAS,EACjB,cAAc,gBAAgB,KAC7B,eAyCF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,EACjB,QAAQ,kBAAkB,EAC1B,gBAAgB,cAAc,EAC9B,cAAc,SAAS,KACtB,YAQC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ProjectionPipeline = {
|
|
2
|
+
pipeline: GPUComputePipeline;
|
|
3
|
+
bindGroupLayout: GPUBindGroupLayout;
|
|
4
|
+
paramsBuffer: GPUBuffer;
|
|
5
|
+
};
|
|
6
|
+
export declare const createProjectionPipeline: (device: GPUDevice) => ProjectionPipeline;
|
|
7
|
+
export declare const writeProjectionParams: (device: GPUDevice, paramsBuffer: GPUBuffer, numPoints: number, numDims: number, viewportScale: number) => void;
|
|
8
|
+
export type ProjectionResources = {
|
|
9
|
+
dataBuffer: GPUBuffer;
|
|
10
|
+
normParamsBuffer: GPUBuffer;
|
|
11
|
+
basisBuffer: GPUBuffer;
|
|
12
|
+
projectedBuffer: GPUBuffer;
|
|
13
|
+
bindGroup: GPUBindGroup;
|
|
14
|
+
};
|
|
15
|
+
export declare const createProjectionResources: (device: GPUDevice, pipeline: ProjectionPipeline, numPoints: number, numDims: number) => Omit<ProjectionResources, "bindGroup"> & {
|
|
16
|
+
bindGroup: null;
|
|
17
|
+
};
|
|
18
|
+
export declare const createProjectionBindGroup: (device: GPUDevice, layout: GPUBindGroupLayout, paramsBuffer: GPUBuffer, res: Omit<ProjectionResources, "bindGroup">) => GPUBindGroup;
|
|
19
|
+
export declare const dispatchProjection: (device: GPUDevice, pipeline: ProjectionPipeline, bindGroup: GPUBindGroup, numPoints: number) => GPUCommandBuffer;
|
|
20
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/gpu/projection.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,eAAe,EAAE,kBAAkB,CAAC;IACpC,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAWF,eAAO,MAAM,wBAAwB,GAAI,QAAQ,SAAS,KAAG,kBA8B5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,SAAS,EACjB,cAAc,SAAS,EACvB,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,eAAe,MAAM,KACpB,IASF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,SAAS,CAAC;IACtB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,WAAW,EAAE,SAAS,CAAC;IACvB,eAAe,EAAE,SAAS,CAAC;IAC3B,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,QAAQ,SAAS,EACjB,UAAU,kBAAkB,EAC5B,WAAW,MAAM,EACjB,SAAS,MAAM,KACd,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG;IAAE,SAAS,EAAE,IAAI,CAAA;CA0B5D,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,QAAQ,SAAS,EACjB,QAAQ,kBAAkB,EAC1B,cAAc,SAAS,EACvB,KAAK,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,KAC1C,YAWC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,SAAS,EACjB,UAAU,kBAAkB,EAC5B,WAAW,YAAY,EACvB,WAAW,MAAM,KAChB,gBAQF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/gpu/worker.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createScatter } from './gpu/client.ts';
|
|
2
|
+
export type { ScatterOptions, ScatterInstance, ScatterStatus } from './gpu/client.ts';
|
|
3
|
+
export type { Metadata } from './data/types.ts';
|
|
4
|
+
export { computeArcLengths, interpolateAtPosition } from './tour/arc-length.ts';
|
|
5
|
+
export { OKABE_ITO, GLASBEY_DARK, GLASBEY_LIGHT, VIRIDIS_25, MAGMA_25 } from './data/palettes.ts';
|
|
6
|
+
export { bitPackIndices } from './selection.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtF,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jacobi eigendecomposition of a symmetric d×d matrix.
|
|
3
|
+
*
|
|
4
|
+
* Iteratively applies Givens rotations to zero off-diagonal elements,
|
|
5
|
+
* converging to a diagonal matrix of eigenvalues with the accumulated
|
|
6
|
+
* rotations forming the eigenvector matrix.
|
|
7
|
+
*
|
|
8
|
+
* @param matrix d×d row-major symmetric matrix (modified in place)
|
|
9
|
+
* @param d dimension
|
|
10
|
+
* @returns eigenvalues (descending) and corresponding eigenvectors
|
|
11
|
+
*/
|
|
12
|
+
export declare const jacobiEigen: (matrix: Float32Array, d: number) => {
|
|
13
|
+
eigenvalues: Float32Array;
|
|
14
|
+
eigenvectors: Float32Array[];
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=jacobi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jacobi.d.ts","sourceRoot":"","sources":["../../src/pca/jacobi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,YAAY,EACpB,GAAG,MAAM,KACR;IAAE,WAAW,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAA;CA+E3D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PcaPipeline = {
|
|
2
|
+
partialPipeline: GPUComputePipeline;
|
|
3
|
+
finalPipeline: GPUComputePipeline;
|
|
4
|
+
bindGroupLayout: GPUBindGroupLayout;
|
|
5
|
+
paramsBuffer: GPUBuffer;
|
|
6
|
+
};
|
|
7
|
+
export declare const createPcaPipeline: (device: GPUDevice) => PcaPipeline;
|
|
8
|
+
/** Run PCA on data already in GPU buffers. Returns eigenvectors sorted by descending eigenvalue. */
|
|
9
|
+
export declare const runPCA: (device: GPUDevice, pipeline: PcaPipeline, dataBuffer: GPUBuffer, normParamsBuffer: GPUBuffer, numPoints: number, numDims: number) => Promise<{
|
|
10
|
+
eigenvalues: Float32Array;
|
|
11
|
+
eigenvectors: Float32Array[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/pca/pipeline.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,EAAE,kBAAkB,CAAC;IACpC,aAAa,EAAE,kBAAkB,CAAC;IAClC,eAAe,EAAE,kBAAkB,CAAC;IACpC,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAOF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,KAAG,WAwCrD,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,MAAM,GACjB,QAAQ,SAAS,EACjB,UAAU,WAAW,EACrB,YAAY,SAAS,EACrB,kBAAkB,SAAS,EAC3B,WAAW,MAAM,EACjB,SAAS,MAAM,KACd,OAAO,CAAC;IAAE,WAAW,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAA;CAAE,CAsFrE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type CanvasView = {
|
|
2
|
+
canvas: OffscreenCanvas;
|
|
3
|
+
context: GPUCanvasContext;
|
|
4
|
+
format: GPUTextureFormat;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Configure an OffscreenCanvas for WebGPU rendering.
|
|
8
|
+
*/
|
|
9
|
+
export declare const configureCanvas: (canvas: OffscreenCanvas, device: GPUDevice) => CanvasView;
|
|
10
|
+
/**
|
|
11
|
+
* Encode a render pass for numPoints instanced quads into a texture view.
|
|
12
|
+
* The target is typically an HDR (rgba32float) texture for later tone mapping.
|
|
13
|
+
* Returns a GPUCommandBuffer — caller batches with compute commands before submitting.
|
|
14
|
+
*/
|
|
15
|
+
export declare const renderPoints: (device: GPUDevice, target: GPUTextureView, pipeline: GPURenderPipeline, bindGroup: GPUBindGroup, numPoints: number, clearColor?: [number, number, number]) => GPUCommandBuffer;
|
|
16
|
+
/**
|
|
17
|
+
* Encode a fullscreen tone-map pass that reads an HDR texture and writes to a canvas.
|
|
18
|
+
*/
|
|
19
|
+
export declare const tonemapToCanvas: (device: GPUDevice, view: CanvasView, tonemapPipeline: GPURenderPipeline, tonemapBindGroup: GPUBindGroup) => GPUCommandBuffer;
|
|
20
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe,EAAE,QAAQ,SAAS,KAAG,UAU5E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,SAAS,EACjB,QAAQ,cAAc,EACtB,UAAU,iBAAiB,EAC3B,WAAW,YAAY,EACvB,WAAW,MAAM,EACjB,aAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAa,KAC/C,gBAqBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,SAAS,EACjB,MAAM,UAAU,EAChB,iBAAiB,iBAAiB,EAClC,kBAAkB,YAAY,KAC7B,gBAiBF,CAAC"}
|