@kymoscope/sdk 0.0.0-stage → 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/LICENSE.md +69 -0
- package/README.md +138 -2
- package/dist/assets/duckdb-browser-eh.worker--3HUwN9R.js +14 -0
- package/dist/assets/duckdb-eh-D-nnNw7L.wasm.gz +0 -0
- package/dist/assets/h5wasmModule-BCQWU2Gw.js +24295 -0
- package/dist/assets/importer.worker-D4is7BLf.js +6 -0
- package/dist/assets/offscreenLineWorker-mShhnyXX.js +79 -0
- package/dist/assets/parseDataset.worker-PynRsPD8.js +5 -0
- package/dist/importers-DivmF3tx.js +5 -0
- package/dist/krc-CbE28CjD.js +9 -0
- package/dist/kymoscope-embed.js +633 -0
- package/dist/kymoscope-sdk.js +616 -0
- package/dist/react.js +2 -0
- package/dist/styles/charts.css +207 -0
- package/dist/styles/fonts/OFL.txt +93 -0
- package/dist/styles/fonts/plus-jakarta-sans-italic-latin-ext.woff2 +0 -0
- package/dist/styles/fonts/plus-jakarta-sans-italic-latin.woff2 +0 -0
- package/dist/styles/fonts/plus-jakarta-sans-latin-ext.woff2 +0 -0
- package/dist/styles/fonts/plus-jakarta-sans-latin.woff2 +0 -0
- package/dist/styles/tokens.css +218 -0
- package/dist/types/charts/AlarmOverlay.d.ts +11 -0
- package/dist/types/charts/AnnotationLayer.d.ts +29 -0
- package/dist/types/charts/ChartBody.d.ts +52 -0
- package/dist/types/charts/PerfHud.d.ts +20 -0
- package/dist/types/charts/beacon.d.ts +27 -0
- package/dist/types/charts/chartWindow.d.ts +31 -0
- package/dist/types/charts/liveOverlay.d.ts +16 -0
- package/dist/types/charts/runtime.d.ts +63 -0
- package/dist/types/charts/useWorksheetData.d.ts +159 -0
- package/dist/types/components/AreaChart.d.ts +21 -0
- package/dist/types/components/BarChart.d.ts +30 -0
- package/dist/types/components/BoxPlotChart.d.ts +16 -0
- package/dist/types/components/BubbleChart.d.ts +24 -0
- package/dist/types/components/CalibrationChart.d.ts +15 -0
- package/dist/types/components/CdfChart.d.ts +15 -0
- package/dist/types/components/ConfusionChart.d.ts +11 -0
- package/dist/types/components/ControlChart.d.ts +17 -0
- package/dist/types/components/DuckDbMultiBandPanel.d.ts +35 -0
- package/dist/types/components/EmbeddingChart.d.ts +25 -0
- package/dist/types/components/FlameGraphChart.d.ts +15 -0
- package/dist/types/components/GanttChart.d.ts +15 -0
- package/dist/types/components/GaugeChart.d.ts +27 -0
- package/dist/types/components/HeatmapChart.d.ts +41 -0
- package/dist/types/components/HistogramChart.d.ts +15 -0
- package/dist/types/components/LossCurveChart.d.ts +17 -0
- package/dist/types/components/MultiBandCanvasChart.d.ts +156 -0
- package/dist/types/components/ParallelCoordsChart.d.ts +21 -0
- package/dist/types/components/PolarChart.d.ts +17 -0
- package/dist/types/components/QQPlotChart.d.ts +16 -0
- package/dist/types/components/RadarChart.d.ts +17 -0
- package/dist/types/components/RocChart.d.ts +12 -0
- package/dist/types/components/SankeyChart.d.ts +15 -0
- package/dist/types/components/SpectrogramChart.d.ts +16 -0
- package/dist/types/components/SpectrogramWaterfall.d.ts +14 -0
- package/dist/types/components/SpectrumChart.d.ts +17 -0
- package/dist/types/components/TreemapChart.d.ts +14 -0
- package/dist/types/components/ViolinChart.d.ts +17 -0
- package/dist/types/components/XYScatterChart.d.ts +47 -0
- package/dist/types/components/XYZMeshChart.d.ts +68 -0
- package/dist/types/components/dashboardGridLayout.d.ts +50 -0
- package/dist/types/components/liveFollowEase.d.ts +10 -0
- package/dist/types/components/liveWindow.d.ts +63 -0
- package/dist/types/components/multiBandHover.d.ts +44 -0
- package/dist/types/embed/Attribution.d.ts +5 -0
- package/dist/types/embed/license.d.ts +29 -0
- package/dist/types/embed/standalone.d.ts +5 -0
- package/dist/types/engine/columns.d.ts +44 -0
- package/dist/types/engine/createEngine.d.ts +394 -0
- package/dist/types/engine/derive.d.ts +27 -0
- package/dist/types/engine/emitter.d.ts +6 -0
- package/dist/types/engine/errors.d.ts +7 -0
- package/dist/types/engine/history.d.ts +29 -0
- package/dist/types/engine/kinds.d.ts +9 -0
- package/dist/types/engine/liveController.d.ts +27 -0
- package/dist/types/engine/store.d.ts +8 -0
- package/dist/types/engine/types.d.ts +194 -0
- package/dist/types/index.d.ts +69 -0
- package/dist/types/lib/annotations.d.ts +37 -0
- package/dist/types/lib/beacon.d.ts +62 -0
- package/dist/types/lib/colorScheme.d.ts +5 -0
- package/dist/types/lib/colormap.d.ts +9 -0
- package/dist/types/lib/columnTable.d.ts +37 -0
- package/dist/types/lib/data/arrowDecimation.d.ts +11 -0
- package/dist/types/lib/data/binnedHeatmap.d.ts +27 -0
- package/dist/types/lib/data/columnCaches.d.ts +6 -0
- package/dist/types/lib/data/columnarDataSource.d.ts +34 -0
- package/dist/types/lib/data/createDataSource.d.ts +23 -0
- package/dist/types/lib/data/dataSource.d.ts +75 -0
- package/dist/types/lib/data/decimate.d.ts +25 -0
- package/dist/types/lib/data/duckDbDataSource.d.ts +42 -0
- package/dist/types/lib/data/envelope.d.ts +16 -0
- package/dist/types/lib/data/inMemoryDataSource.d.ts +25 -0
- package/dist/types/lib/data/liveDataSource.d.ts +77 -0
- package/dist/types/lib/data/lruCache.d.ts +11 -0
- package/dist/types/lib/data/openDataset.d.ts +24 -0
- package/dist/types/lib/data/opfsParquet.d.ts +4 -0
- package/dist/types/lib/data/pointColumns.d.ts +59 -0
- package/dist/types/lib/data/schemaColumns.d.ts +5 -0
- package/dist/types/lib/data/useSeriesPoints.d.ts +48 -0
- package/dist/types/lib/data/xyColumns.d.ts +77 -0
- package/dist/types/lib/dataBounds.d.ts +10 -0
- package/dist/types/lib/datasetColors.d.ts +19 -0
- package/dist/types/lib/datasetColumns.d.ts +3 -0
- package/dist/types/lib/datasetMerge.d.ts +8 -0
- package/dist/types/lib/duckdb/duckdbInstance.d.ts +7 -0
- package/dist/types/lib/duckdb/fileIdentity.d.ts +9 -0
- package/dist/types/lib/duckdb/sql.d.ts +124 -0
- package/dist/types/lib/fft.d.ts +15 -0
- package/dist/types/lib/folderTree.d.ts +29 -0
- package/dist/types/lib/gaugeColors.d.ts +32 -0
- package/dist/types/lib/importers/arrowSink.d.ts +35 -0
- package/dist/types/lib/importers/blobReader.d.ts +22 -0
- package/dist/types/lib/importers/bytes.d.ts +11 -0
- package/dist/types/lib/importers/combine.d.ts +30 -0
- package/dist/types/lib/importers/comtrade/format.d.ts +2 -0
- package/dist/types/lib/importers/comtrade/importer.d.ts +25 -0
- package/dist/types/lib/importers/dbc.d.ts +45 -0
- package/dist/types/lib/importers/edf/format.d.ts +2 -0
- package/dist/types/lib/importers/edf/importer.d.ts +7 -0
- package/dist/types/lib/importers/expr.d.ts +10 -0
- package/dist/types/lib/importers/formats.d.ts +23 -0
- package/dist/types/lib/importers/hdf5/format.d.ts +4 -0
- package/dist/types/lib/importers/hdf5/h5.d.ts +76 -0
- package/dist/types/lib/importers/hdf5/h5wasmModule.d.ts +1 -0
- package/dist/types/lib/importers/hdf5/importer.d.ts +2 -0
- package/dist/types/lib/importers/importer.worker.d.ts +5 -0
- package/dist/types/lib/importers/importers.d.ts +4 -0
- package/dist/types/lib/importers/limits.d.ts +28 -0
- package/dist/types/lib/importers/mat/format.d.ts +2 -0
- package/dist/types/lib/importers/mat/group.d.ts +19 -0
- package/dist/types/lib/importers/mat/importer.d.ts +2 -0
- package/dist/types/lib/importers/mat/v5.d.ts +24 -0
- package/dist/types/lib/importers/mat/v73.d.ts +13 -0
- package/dist/types/lib/importers/mdf/blocks3.d.ts +3 -0
- package/dist/types/lib/importers/mdf/blocks4.d.ts +7 -0
- package/dist/types/lib/importers/mdf/bus.d.ts +59 -0
- package/dist/types/lib/importers/mdf/conversion.d.ts +48 -0
- package/dist/types/lib/importers/mdf/decode.d.ts +15 -0
- package/dist/types/lib/importers/mdf/format.d.ts +2 -0
- package/dist/types/lib/importers/mdf/importer.d.ts +19 -0
- package/dist/types/lib/importers/mdf/model.d.ts +75 -0
- package/dist/types/lib/importers/mdf/records.d.ts +31 -0
- package/dist/types/lib/importers/mdf/stream.d.ts +42 -0
- package/dist/types/lib/importers/memorySink.d.ts +11 -0
- package/dist/types/lib/importers/names.d.ts +2 -0
- package/dist/types/lib/importers/openImport.d.ts +33 -0
- package/dist/types/lib/importers/registry.d.ts +24 -0
- package/dist/types/lib/importers/run.d.ts +35 -0
- package/dist/types/lib/importers/session.d.ts +28 -0
- package/dist/types/lib/importers/tdms/format.d.ts +2 -0
- package/dist/types/lib/importers/tdms/importer.d.ts +10 -0
- package/dist/types/lib/importers/types.d.ts +172 -0
- package/dist/types/lib/importers/workerCore.d.ts +44 -0
- package/dist/types/lib/importers/xdf/format.d.ts +2 -0
- package/dist/types/lib/importers/xdf/importer.d.ts +2 -0
- package/dist/types/lib/importers/zlib.d.ts +13 -0
- package/dist/types/lib/kde.d.ts +2 -0
- package/dist/types/lib/live/buffer.d.ts +265 -0
- package/dist/types/lib/live/columnsWire.d.ts +24 -0
- package/dist/types/lib/live/crypto.d.ts +157 -0
- package/dist/types/lib/live/liveMathChannels.d.ts +11 -0
- package/dist/types/lib/live/recorder.d.ts +32 -0
- package/dist/types/lib/live/stream.d.ts +33 -0
- package/dist/types/lib/live/timeBuckets.d.ts +71 -0
- package/dist/types/lib/live/types.d.ts +72 -0
- package/dist/types/lib/live/wire.d.ts +25 -0
- package/dist/types/lib/mathChannels/compile.d.ts +22 -0
- package/dist/types/lib/mathChannels/evaluator.d.ts +40 -0
- package/dist/types/lib/mathChannels/functions/conditional.d.ts +2 -0
- package/dist/types/lib/mathChannels/functions/filters.d.ts +7 -0
- package/dist/types/lib/mathChannels/functions/index.d.ts +3 -0
- package/dist/types/lib/mathChannels/functions/reference.d.ts +7 -0
- package/dist/types/lib/mathChannels/functions/windowOps.d.ts +11 -0
- package/dist/types/lib/mathChannels/index.d.ts +13 -0
- package/dist/types/lib/mathChannels/io.d.ts +18 -0
- package/dist/types/lib/mathChannels/mathjsSetup.d.ts +7 -0
- package/dist/types/lib/mathChannels/parseMath.d.ts +12 -0
- package/dist/types/lib/mathChannels/parser.d.ts +22 -0
- package/dist/types/lib/mathChannels/types.d.ts +34 -0
- package/dist/types/lib/mathChannels/usedChannels.d.ts +14 -0
- package/dist/types/lib/moduleWorker.d.ts +7 -0
- package/dist/types/lib/panelChartSettings.d.ts +438 -0
- package/dist/types/lib/parseDataset.d.ts +74 -0
- package/dist/types/lib/parseDataset.worker.d.ts +1 -0
- package/dist/types/lib/parseDatasetWorkerClient.d.ts +32 -0
- package/dist/types/lib/perfLog.d.ts +4 -0
- package/dist/types/lib/quantiles.d.ts +10 -0
- package/dist/types/lib/recordings/csvWriter.d.ts +10 -0
- package/dist/types/lib/recordings/export.d.ts +26 -0
- package/dist/types/lib/recordings/importer.d.ts +2 -0
- package/dist/types/lib/recordings/keys.d.ts +23 -0
- package/dist/types/lib/recordings/krc.d.ts +38 -0
- package/dist/types/lib/recordings/mf4Writer.d.ts +20 -0
- package/dist/types/lib/render/chartFonts.d.ts +10 -0
- package/dist/types/lib/render/colorBucket.d.ts +6 -0
- package/dist/types/lib/render/contours.d.ts +16 -0
- package/dist/types/lib/render/cssColor.d.ts +2 -0
- package/dist/types/lib/render/frames.d.ts +46 -0
- package/dist/types/lib/render/gl3d.d.ts +63 -0
- package/dist/types/lib/render/glLines.d.ts +62 -0
- package/dist/types/lib/render/glPlot.d.ts +36 -0
- package/dist/types/lib/render/glPoints.d.ts +37 -0
- package/dist/types/lib/render/glSeries.d.ts +67 -0
- package/dist/types/lib/render/heatGrid.d.ts +9 -0
- package/dist/types/lib/render/hitGrid.d.ts +16 -0
- package/dist/types/lib/render/liveZoomBus.d.ts +18 -0
- package/dist/types/lib/render/margins.d.ts +14 -0
- package/dist/types/lib/render/offscreenLineRenderer.d.ts +53 -0
- package/dist/types/lib/render/offscreenLineWorker.d.ts +1 -0
- package/dist/types/lib/render/plotFrame.d.ts +36 -0
- package/dist/types/lib/render/resample.d.ts +18 -0
- package/dist/types/lib/render/sharedGl.d.ts +38 -0
- package/dist/types/lib/render/useGlPlot.d.ts +7 -0
- package/dist/types/lib/savedLayout.d.ts +45 -0
- package/dist/types/lib/stft.d.ts +37 -0
- package/dist/types/lib/workspaces/encrypted.d.ts +50 -0
- package/dist/types/lib/workspaces/io.d.ts +120 -0
- package/dist/types/lib/xyFit.d.ts +14 -0
- package/dist/types/lib/yAxisTicks.d.ts +28 -0
- package/dist/types/react/index.d.ts +32 -0
- package/dist/types/types/loadedDataset.d.ts +42 -0
- package/dist/types/types/plotSeries.d.ts +27 -0
- package/package.json +63 -4
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as duckdb from '@duckdb/duckdb-wasm';
|
|
2
|
+
import type { DataSource, ColumnSchema, SeriesQuery, DecimatedSeries, Viewport, MultiSeriesResult } from './dataSource';
|
|
3
|
+
import { type XRange } from '../duckdb/sql';
|
|
4
|
+
import type { IngestProgress } from './dataSource';
|
|
5
|
+
import { type DatasetRow } from '../parseDataset';
|
|
6
|
+
export type { IngestProgress } from './dataSource';
|
|
7
|
+
/** A table name no other open dataset uses. */
|
|
8
|
+
export declare const nextTableName: () => string;
|
|
9
|
+
export declare class DuckDbDataSource implements DataSource {
|
|
10
|
+
#private;
|
|
11
|
+
private constructor();
|
|
12
|
+
/** Ingest a file into an in-memory DuckDB table and return a ready DataSource. */
|
|
13
|
+
static open(file: File, onProgress?: (p: IngestProgress) => void): Promise<DuckDbDataSource>;
|
|
14
|
+
/** A source over a table already in DuckDB (a CSV ingest, a binary import); its schema from DESCRIBE. */
|
|
15
|
+
static attach(conn: duckdb.AsyncDuckDBConnection, table: string, unitByName: Map<string, string>): Promise<DuckDbDataSource>;
|
|
16
|
+
getSchema(): Promise<ColumnSchema[]>;
|
|
17
|
+
getSeries(q: SeriesQuery): Promise<DecimatedSeries>;
|
|
18
|
+
/**
|
|
19
|
+
* Decimate SEVERAL columns over a viewport in ONE query. Returns the raw query
|
|
20
|
+
* rows (aliased y{i}lo/y{i}hi) plus the bucket geometry; the caller turns them
|
|
21
|
+
* into points. One round-trip for all series, vs one query per series.
|
|
22
|
+
*/
|
|
23
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<MultiSeriesResult>;
|
|
24
|
+
/**
|
|
25
|
+
* A decimated, order-preserving sample of ~`maxRows` rows as plain objects, so
|
|
26
|
+
* the row-based chart pipelines (scatter, histogram, mesh, …) can render a
|
|
27
|
+
* large dataset with bounded memory — the same way multiband uses decimation,
|
|
28
|
+
* just materialized into rows instead of per-series buckets.
|
|
29
|
+
*
|
|
30
|
+
* Pass `range` to sample only within an x window: as the shared X view zooms
|
|
31
|
+
* in, the sample is re-taken inside that window, so the row-based charts gain
|
|
32
|
+
* resolution on zoom exactly like multiband's per-viewport decimation. Rows in
|
|
33
|
+
* a narrow window are denser, so the same `maxRows` budget buys finer detail.
|
|
34
|
+
*/
|
|
35
|
+
sampleRows(maxRows: number, range?: XRange): Promise<DatasetRow[]>;
|
|
36
|
+
/** Full-range x bounds for a column, for an initial viewport. */
|
|
37
|
+
xBounds(xKey: string): Promise<{
|
|
38
|
+
x0: number;
|
|
39
|
+
x1: number;
|
|
40
|
+
}>;
|
|
41
|
+
dispose(): Promise<void>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The min–max envelope of several traces of one signal (one per dataset or
|
|
3
|
+
* lap): each trace is read at the same X positions (linear interpolation
|
|
4
|
+
* between its samples), and at each position the envelope spans the smallest
|
|
5
|
+
* to the largest value. Where fewer than two traces have a value, it is NaN.
|
|
6
|
+
*/
|
|
7
|
+
export interface Envelope {
|
|
8
|
+
x: Float64Array;
|
|
9
|
+
lo: Float64Array;
|
|
10
|
+
hi: Float64Array;
|
|
11
|
+
}
|
|
12
|
+
export interface Trace {
|
|
13
|
+
x: ArrayLike<number>;
|
|
14
|
+
y: ArrayLike<number>;
|
|
15
|
+
}
|
|
16
|
+
export declare function minMaxEnvelope(traces: Trace[], points: number): Envelope | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataSource, ColumnSchema, SeriesQuery, DecimatedSeries, Viewport, MultiSeriesResult } from './dataSource';
|
|
2
|
+
import type { PointColumns } from './pointColumns';
|
|
3
|
+
import { type Dataset } from '../parseDataset';
|
|
4
|
+
/** DataSource backed by an already-parsed in-memory Dataset (small files). */
|
|
5
|
+
export declare class InMemoryDataSource implements DataSource {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(dataset: Dataset);
|
|
8
|
+
getSchema(): Promise<ColumnSchema[]>;
|
|
9
|
+
getSeries(q: SeriesQuery): Promise<DecimatedSeries>;
|
|
10
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<MultiSeriesResult>;
|
|
11
|
+
/** {@link getSeriesMulti} without the Promise: in memory it is pure computation. */
|
|
12
|
+
getSeriesMultiSync(columns: string[], viewport: Viewport, maxPoints: number): MultiSeriesResult;
|
|
13
|
+
/** {@link DataSource.getColumnsSync}: a table's columns are the samples (other rows: null, decimate). */
|
|
14
|
+
getColumnsSync(columns: string[], viewport: Viewport, limit: number): PointColumns | null;
|
|
15
|
+
/** Exact min/max like the DuckDB source ({0, 0} when the column has no numbers), not `columnBounds`' padded axis range. */
|
|
16
|
+
xBounds(column: string): Promise<{
|
|
17
|
+
x0: number;
|
|
18
|
+
x1: number;
|
|
19
|
+
}>;
|
|
20
|
+
xBoundsSync(column: string): {
|
|
21
|
+
x0: number;
|
|
22
|
+
x1: number;
|
|
23
|
+
};
|
|
24
|
+
dispose(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { DataSource, ColumnSchema, SeriesQuery, DecimatedSeries, Viewport, MultiSeriesResult } from './dataSource';
|
|
2
|
+
import type { LiveBuffer } from '../live/buffer';
|
|
3
|
+
import type { Dataset } from '../parseDataset';
|
|
4
|
+
import type { PointColumns } from './pointColumns';
|
|
5
|
+
/**
|
|
6
|
+
* A `DataSource` over a live `LiveBuffer`. Decimates straight from the columnar
|
|
7
|
+
* ring buffer (no row objects), so a live stream feeds the same decimated
|
|
8
|
+
* interface as static/out-of-core sources — the prerequisite for compositing
|
|
9
|
+
* many datasets + streams at flat cost. The buffer is read lazily on each query,
|
|
10
|
+
* so new samples are picked up without rebuilding anything.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LiveDataSource implements DataSource {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(buffer: LiveBuffer | (() => LiveBuffer));
|
|
15
|
+
/** Current sample count of the underlying ring, read live (no allocation). Lets
|
|
16
|
+
* a host's sample-count badge show the climbing count by polling itself, instead of the
|
|
17
|
+
* count riding on the ~1 Hz `connections` state whose update re-renders the App. */
|
|
18
|
+
size(): number;
|
|
19
|
+
/** Changes whenever the buffered data does (see LiveBuffer.version). */
|
|
20
|
+
version(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Every buffered sample, column by column, read on demand: a column is copied
|
|
23
|
+
* out of the ring when first asked for (incrementally, see
|
|
24
|
+
* LiveBuffer.mirrorColumn). A new map per call: the columns as they are now.
|
|
25
|
+
*/
|
|
26
|
+
columns(): ReadonlyMap<string, Float64Array>;
|
|
27
|
+
/** A fresh row snapshot of the newest samples (at most `maxRows`, evenly thinned). */
|
|
28
|
+
snapshot(maxRows: number): Dataset;
|
|
29
|
+
getSchema(): Promise<ColumnSchema[]>;
|
|
30
|
+
getSeries(q: SeriesQuery): Promise<DecimatedSeries>;
|
|
31
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<MultiSeriesResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Synchronous multi-column decimation — the live multiband chart calls this
|
|
34
|
+
* every animation frame from its own rAF loop, so it must not go through a
|
|
35
|
+
* Promise (a microtask per frame would add churn). Reads the ring buffer lazily,
|
|
36
|
+
* so each call sees the newest samples. Buckets by x VALUE, so a wrapping X
|
|
37
|
+
* channel (lap distance resetting each lap) decimates correctly.
|
|
38
|
+
*/
|
|
39
|
+
getSeriesMultiSync(columns: string[], viewport: Viewport, maxPoints: number): MultiSeriesResult;
|
|
40
|
+
/** {@link getSeriesMultiSync} as chart points: on the live time axis with no
|
|
41
|
+
* row objects in between (see LiveBuffer.decimatePoints). */
|
|
42
|
+
getPointsSync(columns: string[], viewport: Viewport, maxPoints: number): PointColumns;
|
|
43
|
+
xBounds(column: string): Promise<{
|
|
44
|
+
x0: number;
|
|
45
|
+
x1: number;
|
|
46
|
+
}>;
|
|
47
|
+
/** Synchronous {@link xBounds} for the chart's per-frame pull (no allocation). */
|
|
48
|
+
xBoundsSync(column: string): {
|
|
49
|
+
x0: number;
|
|
50
|
+
x1: number;
|
|
51
|
+
};
|
|
52
|
+
/** X distance covered by the newest `seconds` of samples (see LiveBuffer.xTravel). */
|
|
53
|
+
xTravelSync(column: string, seconds: number): number;
|
|
54
|
+
/** Time of the newest sample (NaN if empty). */
|
|
55
|
+
latestTimeSync(): number;
|
|
56
|
+
/** Value of `column` at time `t` (see LiveBuffer.xAtTime). */
|
|
57
|
+
xAtTimeSync(column: string, t: number): number;
|
|
58
|
+
/** The newest sample's value of `column` (NaN if none): the live position on X. */
|
|
59
|
+
latestSync(column: string): number;
|
|
60
|
+
/** Newest received value of each column it has (finite values only). */
|
|
61
|
+
latestValuesSync(columns: string[]): Map<string, number>;
|
|
62
|
+
/** Follow cycles on `xKey` (beacon): see LiveBuffer.trackCycles. */
|
|
63
|
+
trackCycles(xKey: string): void;
|
|
64
|
+
/** X span of every sample seen on a tracked key, or null. */
|
|
65
|
+
cycleSpanSync(xKey: string): [number, number] | null;
|
|
66
|
+
/** Decimated columns of the current or previous cycle on `xKey`. */
|
|
67
|
+
decimateCycleSync(xKey: string, which: 'current' | 'previous', columns: string[], viewport: {
|
|
68
|
+
x0: number;
|
|
69
|
+
x1: number;
|
|
70
|
+
}, maxPoints: number): MultiSeriesResult;
|
|
71
|
+
/** {@link decimateCycleSync} as chart points (see LiveBuffer.decimateCyclePoints). */
|
|
72
|
+
cyclePointsSync(xKey: string, which: 'current' | 'previous', columns: string[], viewport: {
|
|
73
|
+
x0: number;
|
|
74
|
+
x1: number;
|
|
75
|
+
}, maxPoints: number): PointColumns;
|
|
76
|
+
dispose(): Promise<void>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny insertion-ordered LRU cache. `get` marks an entry as most-recently used;
|
|
3
|
+
* `set` evicts the least-recently used once `max` is exceeded.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LruCache<K, V> {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(max: number);
|
|
8
|
+
get(key: K): V | undefined;
|
|
9
|
+
set(key: K, value: V): void;
|
|
10
|
+
get size(): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LoadedDataset } from '../../types/loadedDataset';
|
|
2
|
+
import type { IngestProgress } from './dataSource';
|
|
3
|
+
/** Build an in-memory LoadedDataset from text handed over directly (the whole text is kept). */
|
|
4
|
+
export declare function openDatasetFromText(id: string, name: string, text: string): Promise<LoadedDataset>;
|
|
5
|
+
/**
|
|
6
|
+
* Build an in-memory LoadedDataset from a file. The parse worker reads the file
|
|
7
|
+
* itself, so its text never reaches the page; the dataset keeps only `head` (the
|
|
8
|
+
* start of the file, for previews) and the file, read again to re-parse.
|
|
9
|
+
*/
|
|
10
|
+
export declare function openDatasetFromBlob(id: string, name: string, blob: Blob, head: string, readText?: (b: Blob) => Promise<string>, signal?: AbortSignal): Promise<LoadedDataset>;
|
|
11
|
+
/** Build a DuckDB-backed LoadedDataset (large files; out-of-core). */
|
|
12
|
+
export declare function openDatasetFromFile(id: string, file: File, onProgress?: (p: IngestProgress) => void): Promise<LoadedDataset>;
|
|
13
|
+
/** Route by values: in memory while it fits the budget (see chooseSourceKind), DuckDB otherwise. */
|
|
14
|
+
export declare function openDataset(id: string, file: File, readText: (f: File) => Promise<string>, onProgress?: (p: IngestProgress) => void,
|
|
15
|
+
/** Values (rows × columns) already held by in-memory datasets, for the shared budget. */
|
|
16
|
+
priorInMemoryValues?: number, signal?: AbortSignal): Promise<LoadedDataset>;
|
|
17
|
+
/**
|
|
18
|
+
* `file` again when an open dataset already holds it as parsed in memory: the new
|
|
19
|
+
* dataset reads the same columns (no read, no parse, no second copy). Null when
|
|
20
|
+
* there is no such dataset, or it was re-parsed with another config.
|
|
21
|
+
*/
|
|
22
|
+
export declare function openTwin(id: string, file: File, datasets: LoadedDataset[]): Promise<LoadedDataset | null>;
|
|
23
|
+
/** Values (rows × columns) held in memory by `datasets`, counting shared columns once. */
|
|
24
|
+
export declare function inMemoryValues(datasets: LoadedDataset[]): number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Deterministic, filesystem-safe OPFS Parquet name for an identity key. */
|
|
2
|
+
export declare function opfsParquetName(identityKey: string): string;
|
|
3
|
+
/** Ingest only when the target parquet is not already present in OPFS. */
|
|
4
|
+
export declare function shouldIngest(parquetName: string, existingNames: string[]): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { MultiDecimationRow } from './dataSource';
|
|
2
|
+
import { type DatasetRow } from '../parseDataset';
|
|
3
|
+
/**
|
|
4
|
+
* Points of a multiband chart, stored by column: X, the trace starts, and one
|
|
5
|
+
* array per series key (NaN where a point has no value for it). What the chart
|
|
6
|
+
* draws, measures and hands to the GPU as is. Point objects (`{ x, values }`)
|
|
7
|
+
* cost an object per point and a property per value: 2000 series × 2000 points
|
|
8
|
+
* was 4 million properties written, then read back to fill the GPU buffers.
|
|
9
|
+
*/
|
|
10
|
+
export interface PointColumns {
|
|
11
|
+
readonly length: number;
|
|
12
|
+
readonly x: Float64Array;
|
|
13
|
+
/** 1 where an independent trace starts (never joined to the previous point). */
|
|
14
|
+
readonly brk?: Uint8Array;
|
|
15
|
+
readonly cols: ReadonlyMap<string, Float64Array>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Columns known to hold no NaN (marked where they are made, which reads every
|
|
19
|
+
* value anyway): a reader can skip scanning them for gaps.
|
|
20
|
+
*/
|
|
21
|
+
export declare const finiteColumns: WeakSet<Float64Array<ArrayBufferLike>>;
|
|
22
|
+
export declare const NO_COLUMNS: PointColumns;
|
|
23
|
+
/** One point as an object: hand-made data and tests (the chart takes {@link PointColumns}). */
|
|
24
|
+
export interface ChartPoint {
|
|
25
|
+
x: number;
|
|
26
|
+
values: Record<string, number>;
|
|
27
|
+
/** An independent trace starts here: never join it to the previous point
|
|
28
|
+
* (e.g. the previous lap ahead of the car on a wrapping lap-distance X). */
|
|
29
|
+
brk?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Point objects as columns. */
|
|
32
|
+
export declare function pointsToColumns(pts: ChartPoint[]): PointColumns;
|
|
33
|
+
/** Layers as point objects (a point keeps only the values it has). */
|
|
34
|
+
export declare function columnsToPoints(layers: PointColumns | PointColumns[]): ChartPoint[];
|
|
35
|
+
/**
|
|
36
|
+
* Multi-column decimation rows (`{ b, y0lo, y0hi, … }`) as points: per bucket, at
|
|
37
|
+
* its centre X, one point with every column's min and one with every max. A
|
|
38
|
+
* bucket where every column has min == max (a single sample) is one point: the
|
|
39
|
+
* pair only drew a zero-length bar and on fast channels read as a flickering
|
|
40
|
+
* comb. A change of pass (laps of a wrapping X) starts a new trace.
|
|
41
|
+
*/
|
|
42
|
+
export declare function multiDecimatedToColumns(rows: MultiDecimationRow[], columns: string[], x0: number, bucket: number): PointColumns;
|
|
43
|
+
/** X-sorted points up to `cut` (all when undefined): a live trace's display edge. */
|
|
44
|
+
export declare function columnsUpTo(pc: PointColumns, cut: number | undefined): PointColumns;
|
|
45
|
+
/** Points with X in [x0, x1] of an X-sorted set (views, no copy). */
|
|
46
|
+
export declare function columnsInRange(pc: PointColumns, x0: number, x1: number): PointColumns;
|
|
47
|
+
/** The points whose X passes `keep` (any order; a copy). */
|
|
48
|
+
export declare function filterColumns(pc: PointColumns, keep: (x: number) => boolean): PointColumns;
|
|
49
|
+
/**
|
|
50
|
+
* Rows as points: X from `xKey`, each of `cols` keyed `col + suffix`, X shifted
|
|
51
|
+
* by `offset`, at most `maxPoints` rows (evenly subsampled). Rows over a column
|
|
52
|
+
* table are read by column; when every row is kept, unshifted, the table's own
|
|
53
|
+
* arrays are the points (nothing copied). Rows without a numeric X are left out.
|
|
54
|
+
*/
|
|
55
|
+
export declare function rowsToColumns(rows: DatasetRow[], xKey: string, cols: string[], maxPoints: number, suffix?: string, offset?: number): PointColumns;
|
|
56
|
+
/** Series keys with `suffix` appended and X shifted by `offset` (multi-dataset overlays). */
|
|
57
|
+
export declare function remapColumns(pc: PointColumns, suffix: string, offset: number): PointColumns;
|
|
58
|
+
/** Point sets one after the other (each key's column NaN where a part lacks it). */
|
|
59
|
+
export declare function concatColumns(parts: PointColumns[]): PointColumns;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ColumnSchema } from './dataSource';
|
|
2
|
+
/** Numeric column names from a schema (the plottable channels). */
|
|
3
|
+
export declare function schemaNumericCols(schema: ColumnSchema[]): string[];
|
|
4
|
+
/** Unit string for a column, or '' if unknown. */
|
|
5
|
+
export declare function schemaUnitOf(schema: ColumnSchema[], name: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Viewport } from './dataSource';
|
|
2
|
+
import { type PointColumns } from './pointColumns';
|
|
3
|
+
/** The slice of DuckDbDataSource this hook needs (one query for all columns). */
|
|
4
|
+
export interface MultiSeriesSource {
|
|
5
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<{
|
|
6
|
+
x0: number;
|
|
7
|
+
bucket: number;
|
|
8
|
+
rows: Array<Record<string, number | bigint | null>>;
|
|
9
|
+
columns: string[];
|
|
10
|
+
}>;
|
|
11
|
+
/** The samples as they are, when few enough: see `rawLimit` in useSeriesPoints. */
|
|
12
|
+
getColumnsSync?(columns: string[], viewport: Viewport, limit: number): PointColumns | null;
|
|
13
|
+
/** Synchronous variant (in-memory sources): see `sync` in useSeriesPoints. */
|
|
14
|
+
getSeriesMultiSync?(columns: string[], viewport: Viewport, maxPoints: number): {
|
|
15
|
+
x0: number;
|
|
16
|
+
bucket: number;
|
|
17
|
+
rows: Array<Record<string, number | bigint | null>>;
|
|
18
|
+
columns: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Fetch min/max envelope points for ALL `columns` over `viewport` in one query. */
|
|
22
|
+
export declare function fetchMultiSeriesPoints(source: MultiSeriesSource, columns: string[], viewport: Viewport, maxPoints: number): Promise<PointColumns>;
|
|
23
|
+
/**
|
|
24
|
+
* React hook: re-fetches decimated points for `columns` over `viewport` whenever
|
|
25
|
+
* they change, in a SINGLE multi-column query. Debounced so a continuous
|
|
26
|
+
* zoom/pan (the chart re-renders existing points fluidly meanwhile) triggers one
|
|
27
|
+
* query on settle rather than one per wheel event. Previous points are kept
|
|
28
|
+
* until the new ones arrive, so there is no flicker.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useSeriesPoints(source: MultiSeriesSource | null, columns: string[], viewport: Viewport | null, maxPoints: number,
|
|
31
|
+
/** Data version: a change re-fetches the same viewport (a growing live source). */
|
|
32
|
+
version?: number,
|
|
33
|
+
/**
|
|
34
|
+
* Decimate in the render with `source.getSeriesMultiSync` (an in-memory source):
|
|
35
|
+
* no debounce and no Promise, so data replaced every frame is drawn every frame
|
|
36
|
+
* instead of each update cancelling the previous, still pending, query.
|
|
37
|
+
*/
|
|
38
|
+
sync?: boolean,
|
|
39
|
+
/**
|
|
40
|
+
* With `sync`: up to this many samples in the viewport are handed over as they
|
|
41
|
+
* are (`full`), not decimated: the GPU draws them for less than decimating costs.
|
|
42
|
+
*/
|
|
43
|
+
rawLimit?: number): {
|
|
44
|
+
points: PointColumns;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
fetchedViewport: Viewport | null;
|
|
47
|
+
full?: boolean;
|
|
48
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { DatasetRow } from '../parseDataset';
|
|
2
|
+
import type { XYPoint } from '../../components/XYScatterChart';
|
|
3
|
+
/**
|
|
4
|
+
* X-Y points as columns: what the scatter draws (every point, on the GPU) and
|
|
5
|
+
* what its fit and dialogs read. `c` is a 0..1 colour value per point
|
|
6
|
+
* (colormap), `d` a dataset index per point (several datasets at once).
|
|
7
|
+
*/
|
|
8
|
+
export interface XYColumns {
|
|
9
|
+
length: number;
|
|
10
|
+
x: ArrayLike<number>;
|
|
11
|
+
y: ArrayLike<number>;
|
|
12
|
+
c?: Float32Array;
|
|
13
|
+
d?: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function isXYColumns(v: unknown): v is XYColumns;
|
|
16
|
+
/** XYPoint objects as columns (the SDK still accepts them). */
|
|
17
|
+
export declare function xyColumnsFromPoints(pts: XYPoint[]): XYColumns;
|
|
18
|
+
/** Point `i` as an XYPoint. */
|
|
19
|
+
export declare function xyPointAt(cols: XYColumns, i: number): XYPoint;
|
|
20
|
+
/**
|
|
21
|
+
* Column `name` of `rows`: the table's own array when the rows are table-backed
|
|
22
|
+
* (no copy), else read row by row (non-numbers → NaN). `full` (the dataset's
|
|
23
|
+
* columns when it is columnar, `rows` then being a sample) wins. Undefined when
|
|
24
|
+
* no row has the column.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rowsColumn(rows: DatasetRow[], name: string, full?: ReadonlyMap<string, Float64Array>): Float64Array | undefined;
|
|
27
|
+
/** The finite values of a column, in order: the column itself when it has none missing. */
|
|
28
|
+
export declare function finiteValues(rows: DatasetRow[], name: string, full?: ReadonlyMap<string, Float64Array>): Float64Array | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The finite values of `valueCol` split by the value of `groupCol`, groups in
|
|
31
|
+
* order of first appearance (label 'unknown' for a missing group); without a
|
|
32
|
+
* group column, one group labelled `valueCol`. Read from columns, no row objects.
|
|
33
|
+
*/
|
|
34
|
+
export declare function groupedValues(rows: DatasetRow[], valueCol: string, groupCol: string | undefined, full?: ReadonlyMap<string, Float64Array>): {
|
|
35
|
+
label: string;
|
|
36
|
+
values: Float64Array;
|
|
37
|
+
}[];
|
|
38
|
+
/**
|
|
39
|
+
* Samples per unit of a time column (Hz for seconds): its finite samples over
|
|
40
|
+
* the span they cover, so uniformly sampled data gets its exact rate. Null
|
|
41
|
+
* when it doesn't advance.
|
|
42
|
+
*/
|
|
43
|
+
export declare function sampleRateOf(t: ArrayLike<number>): number | null;
|
|
44
|
+
export interface XySource {
|
|
45
|
+
id: string;
|
|
46
|
+
rows: DatasetRow[];
|
|
47
|
+
/** The dataset's own full columns when `rows` is only a sample of it. */
|
|
48
|
+
full?: ReadonlyMap<string, Float64Array>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The scatter's columns for one dataset: every point (no sampling), only those
|
|
52
|
+
* whose `xKey` is inside `viewXRange` when one is set, and a colormap value per
|
|
53
|
+
* point when `colorCol` has a range. X and Y are the dataset's own arrays when
|
|
54
|
+
* nothing filters them.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildXyColumns(src: XySource, xCol: string, yCol: string, opts: {
|
|
57
|
+
xKey: string;
|
|
58
|
+
viewXRange: [number, number] | null;
|
|
59
|
+
colorCol?: string;
|
|
60
|
+
}): {
|
|
61
|
+
cols: XYColumns;
|
|
62
|
+
color?: {
|
|
63
|
+
label: string;
|
|
64
|
+
min: number;
|
|
65
|
+
max: number;
|
|
66
|
+
};
|
|
67
|
+
} | null;
|
|
68
|
+
/** Several datasets on one scatter, each point carrying its dataset index and colour. */
|
|
69
|
+
export declare function buildMultiDatasetXyColumns(sources: XySource[], xCol: string, yCol: string, opts: {
|
|
70
|
+
xKey: string;
|
|
71
|
+
viewXRange: [number, number] | null;
|
|
72
|
+
colorOverrides: Record<string, string>;
|
|
73
|
+
palette?: readonly string[];
|
|
74
|
+
}): {
|
|
75
|
+
cols: XYColumns;
|
|
76
|
+
colors: string[];
|
|
77
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DatasetRow } from './parseDataset';
|
|
2
|
+
/**
|
|
3
|
+
* Min/max of a column. Scans every row up to `maxScan`; past that, rows spread
|
|
4
|
+
* evenly over the WHOLE array (never just the first ones: merged data puts one
|
|
5
|
+
* source after another, so a later source's values would be ignored).
|
|
6
|
+
*/
|
|
7
|
+
export declare function columnBounds(rows: DatasetRow[], col: string, maxScan?: number): {
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-dataset color palette — each selected dataset gets a distinct hue: orange,
|
|
3
|
+
* blue, green, red, then the rest. No purples: they read as one muddy family
|
|
4
|
+
* next to each other on a dark chart.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DATASET_PALETTE: string[];
|
|
7
|
+
/**
|
|
8
|
+
* The color for a dataset: a user override keyed by dataset id, or the palette
|
|
9
|
+
* hue for its position when no override is set (the host's palette, see
|
|
10
|
+
* EngineOptions.palette, else the default one).
|
|
11
|
+
*/
|
|
12
|
+
export declare function colorForDataset(overrides: Record<string, string>, dsId: string, index: number, palette?: readonly string[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* The default palette for a color scheme: the first dataset in the theme's
|
|
15
|
+
* strongest contrast (white on dark, black on light), then DATASET_PALETTE.
|
|
16
|
+
*/
|
|
17
|
+
export declare function defaultDatasetPalette(scheme: 'light' | 'dark'): string[];
|
|
18
|
+
/** A host palette as given (valid colors only), or the default one for `scheme`. */
|
|
19
|
+
export declare function resolvePalette(palette: readonly string[] | undefined, scheme?: 'light' | 'dark'): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Dataset } from './parseDataset';
|
|
2
|
+
/**
|
|
3
|
+
* Union-merge datasets into one: union of column names, rows concatenated in part
|
|
4
|
+
* order, and per column the LAST non-empty unit across parts. Returns the single
|
|
5
|
+
* part unchanged (same reference) when there's one, and null when there are none.
|
|
6
|
+
* This is the exact merge the chart pipeline has always used.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mergeDatasets(parts: Dataset[]): Dataset | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as duckdb from '@duckdb/duckdb-wasm';
|
|
2
|
+
/** The module URL DuckDB's worker fetches: a `.gz` asset is inflated here into a blob: URL (same origin as the page).
|
|
3
|
+
* Some servers send a `.gz` file with `Content-Encoding: gzip` (the browser has inflated it already): the gzip
|
|
4
|
+
* magic bytes decide. */
|
|
5
|
+
export declare function wasmModuleUrl(url: string): Promise<string>;
|
|
6
|
+
/** Lazily instantiate a single DuckDB-WASM database for this tab. */
|
|
7
|
+
export declare function getDuckDb(): Promise<duckdb.AsyncDuckDB>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FileMeta {
|
|
2
|
+
name: string;
|
|
3
|
+
size: number;
|
|
4
|
+
lastModified: number;
|
|
5
|
+
}
|
|
6
|
+
/** Stable identity key for a picked file + a hash of its header bytes. */
|
|
7
|
+
export declare function fileIdentityKey(meta: FileMeta, headerHashHex: string): string;
|
|
8
|
+
/** Hash the first `bytes` of a File via SubtleCrypto (browser). */
|
|
9
|
+
export declare function hashHeader(file: Blob, bytes?: number): Promise<string>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Quote a SQL identifier (column/table), escaping embedded double quotes. */
|
|
2
|
+
export declare function quoteIdent(name: string): string;
|
|
3
|
+
export interface DecimationParams {
|
|
4
|
+
table: string;
|
|
5
|
+
xcol: string;
|
|
6
|
+
ycol: string;
|
|
7
|
+
x0: number;
|
|
8
|
+
x1: number;
|
|
9
|
+
maxPoints: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build a min/max-per-x-bucket decimation query. Returns SQL with `?`
|
|
13
|
+
* placeholders and the ordered numeric params [x0, bucket, x0, x1].
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildDecimationSql(p: DecimationParams): {
|
|
16
|
+
sql: string;
|
|
17
|
+
params: number[];
|
|
18
|
+
};
|
|
19
|
+
export interface MultiDecimationParams {
|
|
20
|
+
table: string;
|
|
21
|
+
xcol: string;
|
|
22
|
+
ycols: string[];
|
|
23
|
+
x0: number;
|
|
24
|
+
x1: number;
|
|
25
|
+
maxPoints: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build ONE decimation query returning min/max per x-bucket for SEVERAL y
|
|
29
|
+
* columns at once (aliased `y{i}lo` / `y{i}hi` by column index). Lets a
|
|
30
|
+
* multi-series chart fetch every series in a single round-trip instead of one
|
|
31
|
+
* query per series. Params: [x0, bucket, maxPoints, x0, x1].
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildMultiDecimationSql(p: MultiDecimationParams): {
|
|
34
|
+
sql: string;
|
|
35
|
+
params: number[];
|
|
36
|
+
};
|
|
37
|
+
export interface PyramidBuildL0Params {
|
|
38
|
+
srcTable: string;
|
|
39
|
+
dstTable: string;
|
|
40
|
+
xcol: string;
|
|
41
|
+
/** Numeric columns to aggregate (NOT the x column). */
|
|
42
|
+
ycols: string[];
|
|
43
|
+
/** Pyramid base = the column's minimum x. */
|
|
44
|
+
x0base: number;
|
|
45
|
+
/** Bin width of the finest level. */
|
|
46
|
+
binWidth: number;
|
|
47
|
+
}
|
|
48
|
+
/** CREATE the finest pyramid level by binning the raw table's x into min/max. */
|
|
49
|
+
export declare function buildPyramidBuildL0Sql(p: PyramidBuildL0Params): string;
|
|
50
|
+
/** CREATE the next coarser level (half the bins) from a finer one. */
|
|
51
|
+
export declare function buildPyramidCascadeSql(p: {
|
|
52
|
+
srcTable: string;
|
|
53
|
+
dstTable: string;
|
|
54
|
+
ycols: string[];
|
|
55
|
+
}): string;
|
|
56
|
+
export interface PyramidQueryParams {
|
|
57
|
+
levelTable: string;
|
|
58
|
+
/** Requested numeric columns (subset of the level's columns), in order. */
|
|
59
|
+
ycols: string[];
|
|
60
|
+
/** Pyramid base x and this level's bin width. */
|
|
61
|
+
x0base: number;
|
|
62
|
+
binWidth: number;
|
|
63
|
+
/** Query viewport + target bucket count. */
|
|
64
|
+
x0: number;
|
|
65
|
+
x1: number;
|
|
66
|
+
maxPoints: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Query one pyramid level for a viewport, re-binning its bins into the query's
|
|
70
|
+
* `maxPoints` buckets. Returns the SAME shape as {@link buildMultiDecimationSql}
|
|
71
|
+
* (`b`, `y{i}lo`, `y{i}hi`), so the row→points conversion is unchanged.
|
|
72
|
+
* Params: [D, C, maxPoints-1, binLo, binHi].
|
|
73
|
+
*/
|
|
74
|
+
export declare function buildPyramidQuerySql(p: PyramidQueryParams): {
|
|
75
|
+
sql: string;
|
|
76
|
+
params: number[];
|
|
77
|
+
};
|
|
78
|
+
export interface XRange {
|
|
79
|
+
xcol: string;
|
|
80
|
+
x0: number;
|
|
81
|
+
x1: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build a row-count query, optionally restricted to an x range. Used to size the
|
|
85
|
+
* decimation stride before sampling rows. Params are [] or [x0, x1].
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildRowCountSql(p: {
|
|
88
|
+
table: string;
|
|
89
|
+
range?: XRange;
|
|
90
|
+
}): {
|
|
91
|
+
sql: string;
|
|
92
|
+
params: number[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Build an order-preserving, strided row sample (every `stride`-th row),
|
|
96
|
+
* optionally restricted to an x range. `stride` is a positive integer computed
|
|
97
|
+
* from the row count, interpolated as a literal (never user input). When
|
|
98
|
+
* `stride` is 1 it selects all matching rows. Params are [] or [x0, x1].
|
|
99
|
+
*/
|
|
100
|
+
export declare function buildSampleRowsSql(p: {
|
|
101
|
+
table: string;
|
|
102
|
+
stride: number;
|
|
103
|
+
range?: XRange;
|
|
104
|
+
}): {
|
|
105
|
+
sql: string;
|
|
106
|
+
params: number[];
|
|
107
|
+
};
|
|
108
|
+
/** Quote a SQL string literal, escaping single quotes by doubling them. */
|
|
109
|
+
export declare function quoteStr(s: string): string;
|
|
110
|
+
export interface ReadCsvParams {
|
|
111
|
+
handle: string;
|
|
112
|
+
columnNames: string[];
|
|
113
|
+
delim: '\t' | ',' | ';';
|
|
114
|
+
dataStartRow: number;
|
|
115
|
+
/** True for European-locale files where the comma is the decimal separator. */
|
|
116
|
+
decimalComma?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Build a read_csv() call that ingests data rows only. The header and any units
|
|
120
|
+
* row are skipped (skip=dataStartRow), names are supplied explicitly, and each
|
|
121
|
+
* column is typed as DOUBLE when possible else VARCHAR. When `decimalComma` is
|
|
122
|
+
* set, a comma is read as the decimal point so "232,6" parses as 232.6.
|
|
123
|
+
*/
|
|
124
|
+
export declare function buildReadCsvSql(p: ReadCsvParams): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** In-place radix-2 complex FFT (length a power of two). */
|
|
2
|
+
export declare function fft(re: Float64Array, im: Float64Array): void;
|
|
3
|
+
/**
|
|
4
|
+
* |X[k]| for k < n/2 of the length-`n` DFT (n a power of two ≥ 2) of `x`
|
|
5
|
+
* (zero-padded to n), each sample first multiplied by `w[i]` when given: the
|
|
6
|
+
* real signal is packed into an n/2-point complex FFT (half the work of an
|
|
7
|
+
* n-point one) and the halves untangled. Scratch is reused between calls.
|
|
8
|
+
*/
|
|
9
|
+
export declare function realFftMagnitudes(x: ArrayLike<number>, n: number, w?: ArrayLike<number>): Float64Array;
|
|
10
|
+
/**
|
|
11
|
+
* The Hann window over `len` samples, in a buffer reused between calls (a live
|
|
12
|
+
* signal asks for a slightly longer one each time): its cosine by rotation,
|
|
13
|
+
* no trigonometry per sample.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hannWindow(len: number): Float64Array;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A file picked from a folder, keyed by its path relative to the picked root. */
|
|
2
|
+
export interface FolderEntry {
|
|
3
|
+
path: string;
|
|
4
|
+
file: File;
|
|
5
|
+
}
|
|
6
|
+
export interface DirNode {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
dirs: DirNode[];
|
|
10
|
+
files: FolderEntry[];
|
|
11
|
+
/** Every importable file path in this subtree (for tri-state checkboxes). */
|
|
12
|
+
allPaths: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Delimited text plus every binary format and its companion files. */
|
|
15
|
+
export declare const IMPORTABLE_EXT: string[];
|
|
16
|
+
export declare function isImportable(name: string): boolean;
|
|
17
|
+
/** Build a folder tree of importable files; empty folders are pruned. */
|
|
18
|
+
export declare function buildTree(entries: FolderEntry[], rootName?: string): DirNode;
|
|
19
|
+
/** Entries from an `<input webkitdirectory>` FileList. */
|
|
20
|
+
export declare function entriesFromFileList(files: File[]): FolderEntry[];
|
|
21
|
+
/** Recursively read dropped files and folders (Chromium, Firefox and Safari). */
|
|
22
|
+
export declare function entriesFromDrop(roots: FileSystemEntry[]): Promise<FolderEntry[]>;
|
|
23
|
+
/** True where the browser can open a folder without the "upload N files" prompt (Chrome, Edge). */
|
|
24
|
+
export declare function canPickDirectory(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Let the user pick a folder via the File System Access API. Returns null if
|
|
27
|
+
* they cancel. getFile() only snapshots metadata; contents are read on import.
|
|
28
|
+
*/
|
|
29
|
+
export declare function pickDirectoryEntries(): Promise<FolderEntry[] | null>;
|