@kymoscope/sdk 0.0.0-stage → 0.1.1
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,194 @@
|
|
|
1
|
+
import type { LiveStreamOptions } from '../lib/live/types';
|
|
2
|
+
import type { DashboardPanelKind } from '../components/dashboardGridLayout';
|
|
3
|
+
import type { PanelChartSettings } from '../lib/panelChartSettings';
|
|
4
|
+
import type { ChartAnnotation } from '../lib/annotations';
|
|
5
|
+
import type { MathChannel, MathChannelPatch } from '../lib/mathChannels/types';
|
|
6
|
+
import type { LiveRelayConfig } from '../lib/live/stream';
|
|
7
|
+
import type { BeaconConfig } from '../lib/beacon';
|
|
8
|
+
import type { DatasetParseConfig } from '../lib/parseDataset';
|
|
9
|
+
import type { DatasetFileInfo } from '../lib/importers/types';
|
|
10
|
+
export type ChartKind = DashboardPanelKind;
|
|
11
|
+
/** Why a limit blocked an action. */
|
|
12
|
+
export type LimitReason = 'charts-per-worksheet' | 'channels-per-chart' | 'worksheets' | 'workspaces-io' | 'math-channels';
|
|
13
|
+
/** Quantity limits; `null` = unlimited. */
|
|
14
|
+
export interface KymoscopeLimits {
|
|
15
|
+
maxChartsPerWorksheet: number | null;
|
|
16
|
+
maxChannelsPerChart: number | null;
|
|
17
|
+
maxWorksheets: number | null;
|
|
18
|
+
maxMathChannels: number | null;
|
|
19
|
+
canImportExportWorkspaces: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const UNLIMITED: KymoscopeLimits;
|
|
22
|
+
/**
|
|
23
|
+
* Where math channels are persisted. Without one they live in memory. With one,
|
|
24
|
+
* the engine calls these for every change and the host pushes its authoritative
|
|
25
|
+
* list back with `engine.mathChannels.sync(list)`.
|
|
26
|
+
*/
|
|
27
|
+
export interface MathChannelStoreAdapter {
|
|
28
|
+
create(channel: MathChannel): void | Promise<void>;
|
|
29
|
+
update(id: string, patch: MathChannelPatch): void | Promise<void>;
|
|
30
|
+
remove(id: string): void | Promise<void>;
|
|
31
|
+
importMany(channels: MathChannel[]): void | Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface EngineOptions {
|
|
34
|
+
/** License key for this domain, checked once at creation. Without a valid key, charts show a small
|
|
35
|
+
* attribution badge. For keys that renew themselves use `license` (with both, this one is used until
|
|
36
|
+
* the first successful `license.get`). */
|
|
37
|
+
licenseKey?: string;
|
|
38
|
+
/** Fetches license keys from your backend (which calls Kymoscope's `license-renew`). Called at creation
|
|
39
|
+
* and again 7 days before the held key expires; a failure, an invalid key or no answer within 30 s keeps the current key and
|
|
40
|
+
* retries every hour. The badge shows only while no held key verifies. */
|
|
41
|
+
license?: {
|
|
42
|
+
get: () => Promise<string>;
|
|
43
|
+
};
|
|
44
|
+
limits?: Partial<KymoscopeLimits>;
|
|
45
|
+
mathChannels?: MathChannelStoreAdapter;
|
|
46
|
+
/** Live streams: the relay, and how much of each stream viewers keep (per-stream
|
|
47
|
+
* options of `live.openLocal` / `live.connect` override these). */
|
|
48
|
+
live?: {
|
|
49
|
+
relay?: LiveRelayConfig;
|
|
50
|
+
} & LiveStreamOptions;
|
|
51
|
+
/** Runs before every file import; return false to cancel it (throws `import_vetoed`). */
|
|
52
|
+
beforeImport?: () => boolean | void | Promise<boolean | void>;
|
|
53
|
+
/** Colors given to plotted datasets in order (first plotted gets the first,
|
|
54
|
+
* and so on, cycling); a color picked for a dataset still wins. Hex colors.
|
|
55
|
+
* Default: defaultDatasetPalette for the page's theme (white first on dark,
|
|
56
|
+
* black first on light), updated when the theme changes. */
|
|
57
|
+
palette?: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface ColumnInfo {
|
|
60
|
+
name: string;
|
|
61
|
+
unit: string;
|
|
62
|
+
numeric: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface LapInfo {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
/** Lap metric value (e.g. lap time), null when not computable. */
|
|
68
|
+
value: number | null;
|
|
69
|
+
unit: string;
|
|
70
|
+
isTime: boolean;
|
|
71
|
+
color: string;
|
|
72
|
+
offset: number;
|
|
73
|
+
selected: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface DatasetInfo {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
/** 'memory' = parsed in memory; 'duckdb' = large file queried out of core; 'columnar' = large `addColumns` data kept as typed arrays. */
|
|
79
|
+
kind: 'memory' | 'duckdb' | 'columnar';
|
|
80
|
+
columns: ColumnInfo[];
|
|
81
|
+
/** Rows (in memory) or sampled rows (out of core). */
|
|
82
|
+
rowCount: number;
|
|
83
|
+
color: string;
|
|
84
|
+
/** True when the colour was set with `datasets.setColor` (not the palette default). */
|
|
85
|
+
customColor: boolean;
|
|
86
|
+
/** X shift applied when several datasets are plotted together. */
|
|
87
|
+
offset: number;
|
|
88
|
+
/** Delimited text only; null for binary files. */
|
|
89
|
+
parseConfig: DatasetParseConfig | null;
|
|
90
|
+
/** Binary files: format, start time, groups (with rates), events; null for text. */
|
|
91
|
+
fileInfo: DatasetFileInfo | null;
|
|
92
|
+
beacon: BeaconConfig | null;
|
|
93
|
+
/** Present when the dataset is split into laps (beacon). */
|
|
94
|
+
laps: LapInfo[] | null;
|
|
95
|
+
/** Selection state: true, false, or 'partial' when only some laps are selected. */
|
|
96
|
+
selected: boolean | 'partial';
|
|
97
|
+
}
|
|
98
|
+
export interface ChartModel {
|
|
99
|
+
id: string;
|
|
100
|
+
kind: ChartKind;
|
|
101
|
+
title: string | null;
|
|
102
|
+
settings: PanelChartSettings;
|
|
103
|
+
/** Plot background; null = theme. */
|
|
104
|
+
background: string | null;
|
|
105
|
+
/** Marks drawn over the chart (same list as `settings.annotations`). */
|
|
106
|
+
annotations: ChartAnnotation[];
|
|
107
|
+
/** Opaque grid rectangle for hosts that lay charts out on a 96×96 grid. */
|
|
108
|
+
layout: {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
w: number;
|
|
112
|
+
h: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export interface WorksheetState {
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
/** Shared X column of the worksheet's charts. */
|
|
119
|
+
xKey: string;
|
|
120
|
+
/** Linked X zoom of the worksheet (null = full range). */
|
|
121
|
+
xRange: [number, number] | null;
|
|
122
|
+
charts: ChartModel[];
|
|
123
|
+
}
|
|
124
|
+
export interface LiveConnectionInfo {
|
|
125
|
+
id: string;
|
|
126
|
+
name: string;
|
|
127
|
+
ownerName: string;
|
|
128
|
+
visibility: 'private' | 'public' | 'org' | 'project';
|
|
129
|
+
orgName: string | null;
|
|
130
|
+
status: 'connecting' | 'live' | 'stale' | 'error';
|
|
131
|
+
error: string | null;
|
|
132
|
+
rowCount: number;
|
|
133
|
+
selected: boolean;
|
|
134
|
+
/** Trace colour when several sources are plotted together. */
|
|
135
|
+
color: string;
|
|
136
|
+
/** When a recording is running: its start time (ms since epoch), else null. */
|
|
137
|
+
recordingSince: number | null;
|
|
138
|
+
}
|
|
139
|
+
export interface EngineState {
|
|
140
|
+
datasets: DatasetInfo[];
|
|
141
|
+
/** Plotted ids: dataset ids, lap ids and live connection ids. */
|
|
142
|
+
selection: string[];
|
|
143
|
+
worksheets: WorksheetState[];
|
|
144
|
+
activeWorksheetId: string;
|
|
145
|
+
mathChannels: MathChannel[];
|
|
146
|
+
live: LiveConnectionInfo[];
|
|
147
|
+
/** Scrolling window for live charts on a time X axis (seconds; null = all). */
|
|
148
|
+
liveWindowSeconds: number | null;
|
|
149
|
+
limits: KymoscopeLimits;
|
|
150
|
+
/** Colors given to plotted datasets in order (EngineOptions.palette). */
|
|
151
|
+
palette: string[];
|
|
152
|
+
/** Files currently being imported. */
|
|
153
|
+
importing: number;
|
|
154
|
+
/** Licence check result for this page; null while checking. */
|
|
155
|
+
licensed: boolean | null;
|
|
156
|
+
/** Something is plotted (a selected dataset, lap or live stream). */
|
|
157
|
+
hasData: boolean;
|
|
158
|
+
/** More than one source (dataset, lap or live stream) plotted: series are drawn once per source. */
|
|
159
|
+
multiDataset: boolean;
|
|
160
|
+
/** Numeric columns across the plotted data (+ math channels), for column pickers. */
|
|
161
|
+
numericColumns: string[];
|
|
162
|
+
/** Every column (numeric or not) across the plotted data, plus math channels. */
|
|
163
|
+
allColumns: string[];
|
|
164
|
+
/** Units by column name across the plotted data. */
|
|
165
|
+
columnUnits: Record<string, string>;
|
|
166
|
+
/** Undo/redo of the analysis (engine.history): worksheets, charts, settings, annotations and the math channels the
|
|
167
|
+
* workbook carries. Own (library) math channels are saved to the library at once and are not undone; laps settings
|
|
168
|
+
* follow the data and are not undone; switching worksheets is not a step. During a live stream an undo may plot
|
|
169
|
+
* against the step's X key until the next connection change. */
|
|
170
|
+
history: {
|
|
171
|
+
canUndo: boolean;
|
|
172
|
+
canRedo: boolean;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export interface EngineEvents extends Record<string, unknown> {
|
|
176
|
+
change: EngineState;
|
|
177
|
+
limit: {
|
|
178
|
+
reason: LimitReason;
|
|
179
|
+
};
|
|
180
|
+
error: {
|
|
181
|
+
error: Error;
|
|
182
|
+
context: string;
|
|
183
|
+
};
|
|
184
|
+
import: {
|
|
185
|
+
file: string;
|
|
186
|
+
phase: 'start' | 'progress' | 'done' | 'error';
|
|
187
|
+
/** phase 'progress': 0..1 of the file read. */
|
|
188
|
+
fraction?: number;
|
|
189
|
+
datasetId?: string;
|
|
190
|
+
/** phase 'done': every dataset made from the file (several when it was split). */
|
|
191
|
+
datasetIds?: string[];
|
|
192
|
+
error?: Error;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kymoscope/sdk — the Kymoscope data engine and charts, without an app UI.
|
|
3
|
+
*
|
|
4
|
+
* `createEngine()` holds every capability (datasets, laps, worksheets, 27 chart
|
|
5
|
+
* kinds, math channels, end-to-end encrypted live streams, import/export);
|
|
6
|
+
* `engine.charts.mount()` renders a chart into any element. You build the UI.
|
|
7
|
+
*
|
|
8
|
+
* This file is the only public surface (plus `@kymoscope/sdk/react` and
|
|
9
|
+
* `@kymoscope/sdk/styles/charts.css`).
|
|
10
|
+
*/
|
|
11
|
+
export { createEngine } from './engine/createEngine';
|
|
12
|
+
export type { KymoscopeEngine, Snapshot, ImportSource, ImportResult, ImportOptions, Exported, ParsedFile, ChartSettingsPatch, } from './engine/createEngine';
|
|
13
|
+
export { KymoscopeError } from './engine/errors';
|
|
14
|
+
export type { KymoscopeErrorCode } from './engine/errors';
|
|
15
|
+
export { UNLIMITED } from './engine/types';
|
|
16
|
+
export type { EngineOptions, EngineState, EngineEvents, KymoscopeLimits, LimitReason, MathChannelStoreAdapter, DatasetInfo, ColumnInfo, LapInfo, ChartKind, ChartModel, WorksheetState, LiveConnectionInfo, } from './engine/types';
|
|
17
|
+
export { CHART_KINDS, chartLabel } from './engine/kinds';
|
|
18
|
+
export type { ChartKindInfo } from './engine/kinds';
|
|
19
|
+
export type { ColumnsInput } from './engine/columns';
|
|
20
|
+
export { verifyLicense } from './embed/license';
|
|
21
|
+
export type { LicenseResult } from './embed/license';
|
|
22
|
+
export type { ChartView, ChartViewEvents, MountOptions, ChartStyle } from './charts/runtime';
|
|
23
|
+
export type { ChartWindow, ChartWindowOptions } from './charts/chartWindow';
|
|
24
|
+
export type { ChartStatus, ContextMenuEvent } from './charts/ChartBody';
|
|
25
|
+
export * from './lib/panelChartSettings';
|
|
26
|
+
export { ANNOTATION_KINDS, DEFAULT_ANNOTATION_WIDTH, type AnnotationKind, type AnnotationTool, type ChartAnnotation } from './lib/annotations';
|
|
27
|
+
export { ANNOTATION_CONTROLS_ATTR } from './charts/AnnotationLayer';
|
|
28
|
+
export { colorAt, colorsCss, presetStops, type GaugeColorMode, type GaugeColorStop, type GaugePreset } from './lib/gaugeColors';
|
|
29
|
+
export type { PlotSeries, AlarmLine, AlarmStyle } from './types/plotSeries';
|
|
30
|
+
export { newSeriesId, clampPct } from './types/plotSeries';
|
|
31
|
+
export type { DashboardPanel, DashboardPanelKind } from './components/dashboardGridLayout';
|
|
32
|
+
export { DASHBOARD_GRID_COLS, DASHBOARD_GRID_ROWS, DASHBOARD_GRID_GAP_PX, MIN_PANEL_W, MIN_PANEL_H, clampRectForKind, dragLayout, newPanel, arrangeAutoLayout } from './components/dashboardGridLayout';
|
|
33
|
+
export type { Worksheet } from './lib/savedLayout';
|
|
34
|
+
export { DEFAULT_XY_POINT_RADIUS, DEFAULT_XYZ_POINT_RADIUS } from './lib/savedLayout';
|
|
35
|
+
export type { WorkspaceExportEnvelope, WorkspaceExportEnvelopeV1, WorkbookBody, WorkbookChannel } from './lib/workspaces/io';
|
|
36
|
+
export type { EncryptedWorkbookFile, PasswordWorkbookFile, ScopedWorkbookFile, WorkbookFileScope, WorkbookFileOptions, WorkbookFileInfo, } from './lib/workspaces/encrypted';
|
|
37
|
+
export { encryptWorkbookFile, workbookExportAad, workbookFileInfo } from './lib/workspaces/encrypted';
|
|
38
|
+
export { niceMajorStep } from './lib/yAxisTicks';
|
|
39
|
+
export { computePolyFit, computeR2, buildEquation } from './lib/xyFit';
|
|
40
|
+
export type { XYPoint } from './components/XYScatterChart';
|
|
41
|
+
export type { XYColumns } from './lib/data/xyColumns';
|
|
42
|
+
export type { XYZPoint, XYZViewMode } from './components/XYZMeshChart';
|
|
43
|
+
export type { LoadedDataset } from './types/loadedDataset';
|
|
44
|
+
export type { DatasetFileInfo, FileEvent, GroupSelection, ChannelChooser, ChannelRequest } from './lib/importers/types';
|
|
45
|
+
export type { Dataset, DatasetRow, DatasetParseConfig } from './lib/parseDataset';
|
|
46
|
+
export { parseDatasetWithConfig, inferParseConfig, getRawNonEmptyLines, parseColumnNames, columnIsNumeric, parseConfigsEqual, subsampleIndices, } from './lib/parseDataset';
|
|
47
|
+
export { openDatasetFromText } from './lib/data/openDataset';
|
|
48
|
+
export type { BeaconConfig, BeaconStat } from './lib/beacon';
|
|
49
|
+
export { BEACON_STATS, bestCycleIndex, cyclicChannels, guessBeaconChannel, splitLaps, suggestBeacon, formatLapValue } from './lib/beacon';
|
|
50
|
+
export type { FolderEntry, DirNode } from './lib/folderTree';
|
|
51
|
+
export { buildTree, isImportable, IMPORTABLE_EXT } from './lib/folderTree';
|
|
52
|
+
export { DATASET_PALETTE, colorForDataset, defaultDatasetPalette } from './lib/datasetColors';
|
|
53
|
+
export { colorSchemeOf, observeColorScheme, eventWithin } from './lib/colorScheme';
|
|
54
|
+
export type { MathChannel, MathChannelPatch, MathChannelSource, EvalResult, EvalStatus } from './lib/mathChannels/types';
|
|
55
|
+
export { newMathChannel, evalChannel, parseFormula, extractFreeIdentifiers, FUNCTION_REFERENCE, WINDOW_FN_NAMES, isMathChannelName, decorateColumnLabel, } from './lib/mathChannels';
|
|
56
|
+
export type { FunctionDoc } from './lib/mathChannels';
|
|
57
|
+
export { buildExportBlob as buildMathChannelsBlob, parseImportFile as parseMathChannelsFile } from './lib/mathChannels/io';
|
|
58
|
+
export type { LiveRelayConfig } from './lib/live/stream';
|
|
59
|
+
export type { LiveStreamDescriptor, LiveStreamOptions, LocalLiveStream, StreamKeyProvider } from './lib/live/types';
|
|
60
|
+
export type { LiveColumnsBlock, LiveMessage } from './lib/live/buffer';
|
|
61
|
+
export { LIVE_TIME_COLUMN } from './lib/live/buffer';
|
|
62
|
+
export { openMessage, sealMessage } from './lib/live/wire';
|
|
63
|
+
export type { RecordingKey } from './lib/recordings/keys';
|
|
64
|
+
export { recordingKeyAad, recordingKeySealAad } from './lib/recordings/keys';
|
|
65
|
+
export { parseKrc, parseKrcHeader, KRC_HEADER_BYTES } from './lib/recordings/krc';
|
|
66
|
+
export type { RecordingInput } from './engine/createEngine';
|
|
67
|
+
export { exportRecording, exportRecordingTo, EXPORT_TYPES, type ExportPart, type RecordingSource } from './lib/recordings/export';
|
|
68
|
+
export type { EncryptedEnvelope, DeviceWrap, SealedKey, PasswordSealed } from './lib/live/crypto';
|
|
69
|
+
export { generateApiToken, splitApiKey, generateDeviceKeyPair, unwrapStreamKey, unwrapForDevice, wrapForDevice, projectWrapAad, streamKeyAad, bindKeyAad, randomKey, importStreamKey, sealUnderProjectKey, openUnderProjectKey, senderBindKey, senderBinding, verifySenderBinding, deviceFingerprint, hashToken, generateSalt, deriveKey, deriveRawKeyBase64, makeKeyCheck, verifyKeyCheck, WORKBOOK_EXPORT_AAD, workbookBodyAad, workbookKeyAad, recoveryKeyAad, recoveryAttestationAad, sealWithKey, openWithKey, sealWithPassword, openWithPassword, recoveryCode, parseRecoveryCode, generateRecoveryKeyPair, recoveryPrivateKey, } from './lib/live/crypto';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart annotations: marks a user draws over any chart (text, freehand brush,
|
|
3
|
+
* arrow, box). They live in the chart's settings (`settings.annotations`), so
|
|
4
|
+
* they travel with exports, imports and copies. Threshold lines are not
|
|
5
|
+
* annotations: they are the charts' alarm lines.
|
|
6
|
+
*
|
|
7
|
+
* A point is [x, y]. y is a fraction of the chart's height (0 top, 1 bottom).
|
|
8
|
+
* x is a fraction of its width, or, with `anchor: 'x'`, a value on the chart's
|
|
9
|
+
* X axis: the annotation then follows the data when the chart zooms, pans or
|
|
10
|
+
* scrolls (charts with a numeric X axis pin new annotations this way).
|
|
11
|
+
*/
|
|
12
|
+
export type AnnotationKind = 'text' | 'brush' | 'arrow' | 'box';
|
|
13
|
+
export declare const ANNOTATION_KINDS: readonly AnnotationKind[];
|
|
14
|
+
export interface ChartAnnotation {
|
|
15
|
+
id: string;
|
|
16
|
+
kind: AnnotationKind;
|
|
17
|
+
/** text: its top-left. arrow: from, to. box: two opposite corners. brush: the stroke, in order. */
|
|
18
|
+
points: [number, number][];
|
|
19
|
+
/** 'x': each point's x is a value on the chart's X axis (else a fraction of its width). */
|
|
20
|
+
anchor?: 'x';
|
|
21
|
+
/** Hex colour. */
|
|
22
|
+
color: string;
|
|
23
|
+
/** Stroke width in px; for text, the font size in px. */
|
|
24
|
+
width: number;
|
|
25
|
+
/** The text of a text annotation; the label of a box. */
|
|
26
|
+
text?: string;
|
|
27
|
+
}
|
|
28
|
+
/** What a pointer gesture on the chart creates (`ChartView.setAnnotationTool`). */
|
|
29
|
+
export interface AnnotationTool {
|
|
30
|
+
kind: AnnotationKind;
|
|
31
|
+
color: string;
|
|
32
|
+
width: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const DEFAULT_ANNOTATION_WIDTH: Record<AnnotationKind, number>;
|
|
35
|
+
/** One annotation from untrusted input (a file, an SDK call), or null if it isn't one. */
|
|
36
|
+
export declare function coerceAnnotation(v: unknown): ChartAnnotation | null;
|
|
37
|
+
export declare function coerceAnnotations(v: unknown): ChartAnnotation[] | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DatasetRow } from './parseDataset';
|
|
2
|
+
/**
|
|
3
|
+
* Beacon (lap split): a dataset is cut into sub-datasets every time `channel`
|
|
4
|
+
* resets (e.g. a lap-time channel dropping back to 0). Each lap is quantified by
|
|
5
|
+
* `stat` over the `metric` channel (lap time, distance, mean speed, …).
|
|
6
|
+
*/
|
|
7
|
+
export type BeaconStat = 'span' | 'mean' | 'max' | 'min';
|
|
8
|
+
export interface BeaconConfig {
|
|
9
|
+
channel: string;
|
|
10
|
+
metric: string;
|
|
11
|
+
stat: BeaconStat;
|
|
12
|
+
}
|
|
13
|
+
export declare const BEACON_STATS: {
|
|
14
|
+
value: BeaconStat;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
/** Half-open row range [start, end) of one lap. */
|
|
18
|
+
export interface LapRange {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Split rows wherever `channel` resets. A reset is a drop larger than half of
|
|
24
|
+
* the current lap's span so far, so small sensor jitter backwards never starts
|
|
25
|
+
* a new lap. Rows whose channel is not numeric stay inside the current lap.
|
|
26
|
+
*/
|
|
27
|
+
export declare function splitLaps(rows: DatasetRow[], channel: string): LapRange[];
|
|
28
|
+
/**
|
|
29
|
+
* Channels that start over in cycles — lap time, lap distance, a battery cycle:
|
|
30
|
+
* they ramp up between resets and reset at least once. Ramping up means almost
|
|
31
|
+
* never going down (≥ 90% of steps, so noisy signals like speed or RPM don't
|
|
32
|
+
* qualify) AND actually rising in most samples (≥ 50%, which still allows a
|
|
33
|
+
* pit stop): a channel that mostly holds still and sometimes drops — gear,
|
|
34
|
+
* throttle at 100% — is not a cycle. Most cycles first.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cyclicChannels(rows: DatasetRow[], cols: string[]): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Default beacon: the channel that splits into the most laps while ramping up
|
|
39
|
+
* between resets (lap time / lap distance). Falls back to the first channel.
|
|
40
|
+
*/
|
|
41
|
+
export declare function guessBeaconChannel(rows: DatasetRow[], cols: string[]): string;
|
|
42
|
+
/**
|
|
43
|
+
* The beacon to offer for a dataset, or null when no channel cycles. `preferred`
|
|
44
|
+
* (a predefined beacon) wins when its channels exist and it splits the data
|
|
45
|
+
* into laps; otherwise the most-cycling channel, valued by the span of a cyclic
|
|
46
|
+
* time channel (the lap time) when there is one, else by its own span.
|
|
47
|
+
*/
|
|
48
|
+
export declare function suggestBeacon(rows: DatasetRow[], cols: string[], preferred?: BeaconConfig | null): BeaconConfig | null;
|
|
49
|
+
/** `stat` of the numeric values of `col` in rows[start, end); null if none. */
|
|
50
|
+
export declare function lapMetric(rows: DatasetRow[], lap: LapRange, col: string, stat: BeaconStat): number | null;
|
|
51
|
+
/**
|
|
52
|
+
* Index of the cycle with the lowest value, or null when none has one. Partial
|
|
53
|
+
* cycles — an out-lap, the stub where a recording stops — are ignored when at
|
|
54
|
+
* least two full ones exist (full = at least 80% of the median value), else
|
|
55
|
+
* the lowest of all wins.
|
|
56
|
+
*/
|
|
57
|
+
export declare function bestCycleIndex(values: (number | null)[]): number | null;
|
|
58
|
+
/** Time metrics read as lap times: m:ss.sss, and the lowest one is the best lap. */
|
|
59
|
+
export declare function isTimeMetric(metric: string, unit: string): boolean;
|
|
60
|
+
export declare function formatLapValue(v: number | null, unit: string, isTime: boolean): string;
|
|
61
|
+
/** Id of a lap sub-dataset; laps are selected/colored like any dataset. */
|
|
62
|
+
export declare function lapId(datasetId: string, index: number): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function colorSchemeOf(el: Element | null): 'light' | 'dark';
|
|
2
|
+
/** Calls `onChange` when the theme around `el` changes. Returns a disposer. */
|
|
3
|
+
export declare function observeColorScheme(el: Element | null, onChange: () => void): () => void;
|
|
4
|
+
/** True when `node` is inside `container`, across shadow-DOM retargeting. */
|
|
5
|
+
export declare function eventWithin(e: Event, container: Element | null | undefined): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared blue→cyan→green→yellow→red colormap used by XYZ and XY-color charts. */
|
|
2
|
+
type RGB = {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function colormapRGB(t: number): RGB;
|
|
8
|
+
export declare function colormapStr(t: number): string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DatasetRow } from './parseDataset';
|
|
2
|
+
/**
|
|
3
|
+
* A parsed table stored by column: one Float64Array per column (NaN = empty or
|
|
4
|
+
* text), plus the text cells of the few columns that have any. Built in the parse
|
|
5
|
+
* worker and transferred to the page without copying.
|
|
6
|
+
*/
|
|
7
|
+
export interface ColumnTable {
|
|
8
|
+
/** Row keys, one per column (header name, or `col_<i>` when empty). */
|
|
9
|
+
keys: string[];
|
|
10
|
+
length: number;
|
|
11
|
+
values: Float64Array[];
|
|
12
|
+
/** Per column: its text cells by row index, or null when it has none. */
|
|
13
|
+
text: ((string | null | undefined)[] | null)[];
|
|
14
|
+
}
|
|
15
|
+
/** The column table `rows` were built from, if any (a slice or derived rows have none). */
|
|
16
|
+
export declare function tableOf(rows: DatasetRow[]): ColumnTable | undefined;
|
|
17
|
+
/** Column `key` of `t` (the last one when the name repeats, like row reads), or undefined. */
|
|
18
|
+
export declare function tableColumn(t: ColumnTable, key: string): Float64Array | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Rows over a table: each row holds only its index, and every column is a getter
|
|
21
|
+
* shared on one prototype, so `row[col]` reads the column. Plain object rows of a
|
|
22
|
+
* wide table (hundreds of columns × tens of thousands of rows) took ~1 GB and ~1 s
|
|
23
|
+
* to build, and as long again to copy out of the parse worker.
|
|
24
|
+
*
|
|
25
|
+
* With `previous` rows of the same columns and length (new data for the same
|
|
26
|
+
* dataset), their row objects are reused and read `t` from now on: replacing a
|
|
27
|
+
* million-row column every frame made a million objects per frame (most of the
|
|
28
|
+
* time went to collecting them). The returned rows are a new array to callers
|
|
29
|
+
* (a proxy of the same row list: no million-entry copy and its garbage every
|
|
30
|
+
* frame), so anything cached per rows array recomputes; `previous` now reads
|
|
31
|
+
* the new values too.
|
|
32
|
+
*/
|
|
33
|
+
export declare function tableRows(t: ColumnTable, previous?: DatasetRow[]): DatasetRow[];
|
|
34
|
+
/** The same rows as plain objects (no workers, e.g. tests and server-side). */
|
|
35
|
+
export declare function plainRows(t: ColumnTable): DatasetRow[];
|
|
36
|
+
/** ArrayBuffers to transfer with a table (the text cells are cloned). */
|
|
37
|
+
export declare function tableTransfer(t: ColumnTable): ArrayBuffer[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DecimatedSeries } from './dataSource';
|
|
2
|
+
/** One row of the decimation query result (see buildDecimationSql). */
|
|
3
|
+
export interface DecimationRow {
|
|
4
|
+
b: number;
|
|
5
|
+
lo: number;
|
|
6
|
+
hi: number;
|
|
7
|
+
first: number;
|
|
8
|
+
last: number;
|
|
9
|
+
}
|
|
10
|
+
/** Convert decimation rows (ascending b) to a DecimatedSeries with bucket-center x. */
|
|
11
|
+
export declare function rowsToDecimatedSeries(rows: DecimationRow[], x0: number, bucket: number): DecimatedSeries;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DatasetRow } from '../parseDataset';
|
|
2
|
+
import type { HeatmapCell } from '../../components/HeatmapChart';
|
|
3
|
+
export interface BinnedHeatmapConfig {
|
|
4
|
+
xCol: string;
|
|
5
|
+
yCol: string;
|
|
6
|
+
/** '' = count/density; otherwise the mean of this column per bin. */
|
|
7
|
+
valueCol: string;
|
|
8
|
+
xBins: number;
|
|
9
|
+
yBins: number;
|
|
10
|
+
/** undefined = auto from the data's finite extent. */
|
|
11
|
+
xMin?: number;
|
|
12
|
+
xMax?: number;
|
|
13
|
+
yMin?: number;
|
|
14
|
+
yMax?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Bin rows into an `Nx x Ny` grid over [xMin,xMax] x [yMin,yMax] and aggregate
|
|
18
|
+
* per cell: a count (valueCol === '') or the mean of `valueCol`. Empty *mean*
|
|
19
|
+
* cells are NaN (so the chart can render them empty); empty count cells are 0.
|
|
20
|
+
* Y is oriented with the largest value on top (yLabels[0] is the top row).
|
|
21
|
+
* Returns the exact shape HeatmapChart consumes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildBinnedHeatmap(rows: DatasetRow[], cfg: BinnedHeatmapConfig): {
|
|
24
|
+
cells: HeatmapCell[];
|
|
25
|
+
xLabels: string[];
|
|
26
|
+
yLabels: string[];
|
|
27
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Register a cache keyed by column arrays (returned as is). */
|
|
2
|
+
export declare function columnCache<T extends {
|
|
3
|
+
delete(key: Float64Array): unknown;
|
|
4
|
+
}>(cache: T): T;
|
|
5
|
+
/** Drop `col` from every registered cache: its values are about to change. */
|
|
6
|
+
export declare function forgetColumn(col: Float64Array): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DataSource, ColumnSchema, SeriesQuery, DecimatedSeries, Viewport, MultiSeriesResult } from './dataSource';
|
|
2
|
+
import type { PointColumns } from './pointColumns';
|
|
3
|
+
import type { XRange } from '../duckdb/sql';
|
|
4
|
+
import type { DatasetRow } from '../parseDataset';
|
|
5
|
+
/**
|
|
6
|
+
* DataSource over host-provided typed arrays (large `datasets.addColumns`).
|
|
7
|
+
* Decimates straight from the columns: no row objects, no CSV text. Missing
|
|
8
|
+
* values are NaN.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ColumnarDataSource implements DataSource {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(columns: Map<string, Float64Array>, units?: Record<string, string>);
|
|
13
|
+
get length(): number;
|
|
14
|
+
/** The columns by name (the arrays themselves, not copies). */
|
|
15
|
+
get columnMap(): ReadonlyMap<string, Float64Array>;
|
|
16
|
+
getSchema(): Promise<ColumnSchema[]>;
|
|
17
|
+
getSeries(q: SeriesQuery): Promise<DecimatedSeries>;
|
|
18
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<MultiSeriesResult>;
|
|
19
|
+
/** {@link getSeriesMulti} without the Promise: decimating the columns is pure computation. */
|
|
20
|
+
getSeriesMultiSync(columns: string[], viewport: Viewport, maxPoints: number): MultiSeriesResult;
|
|
21
|
+
getColumnsSync(columns: string[], viewport: Viewport, limit: number): PointColumns | null;
|
|
22
|
+
xBounds(column: string): Promise<{
|
|
23
|
+
x0: number;
|
|
24
|
+
x1: number;
|
|
25
|
+
}>;
|
|
26
|
+
xBoundsSync(column: string): {
|
|
27
|
+
x0: number;
|
|
28
|
+
x1: number;
|
|
29
|
+
};
|
|
30
|
+
/** Strided, order-preserving sample of ~`maxRows` rows (within `range` when given) for the row-based charts. */
|
|
31
|
+
sampleRowsSync(maxRows: number, range?: XRange): DatasetRow[];
|
|
32
|
+
sampleRows(maxRows: number, range?: XRange): Promise<DatasetRow[]>;
|
|
33
|
+
dispose(): Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values (rows × columns) all in-memory datasets may hold together. In memory a
|
|
3
|
+
* value costs 8 bytes (one Float64Array per column), so this is ~800 MB; past it,
|
|
4
|
+
* files go out of core into DuckDB. In memory every row is there for laps and
|
|
5
|
+
* math channels; out of core those only see a ~12k-row sample.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IN_MEMORY_VALUE_BUDGET = 100000000;
|
|
8
|
+
/** Files above this always go out of core: parsing holds the whole text (and its lines) at once. */
|
|
9
|
+
export declare const MAX_IN_MEMORY_BYTES: number;
|
|
10
|
+
/** How much of a file is read to estimate its size in values (and kept for previews). */
|
|
11
|
+
export declare const HEAD_BYTES: number;
|
|
12
|
+
export type SourceKind = 'memory' | 'duckdb';
|
|
13
|
+
/**
|
|
14
|
+
* Where a file goes: in memory while it fits the value budget next to the
|
|
15
|
+
* `priorValues` already loaded in memory, out of core (DuckDB) otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare function chooseSourceKind(sizeBytes: number, values: number, priorValues?: number, budget?: number): SourceKind;
|
|
18
|
+
/**
|
|
19
|
+
* Rows × columns of a delimited file of `sizeBytes`, estimated from its first
|
|
20
|
+
* bytes (`head`): the column count from the header, the rows from the average
|
|
21
|
+
* length of the data lines read.
|
|
22
|
+
*/
|
|
23
|
+
export declare function estimateValues(sizeBytes: number, head: string): number;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { PointColumns } from './pointColumns';
|
|
2
|
+
/** A data-space window on the x axis to fetch. */
|
|
3
|
+
export interface Viewport {
|
|
4
|
+
xKey: string;
|
|
5
|
+
x0: number;
|
|
6
|
+
x1: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SeriesQuery {
|
|
9
|
+
column: string;
|
|
10
|
+
viewport: Viewport;
|
|
11
|
+
/** Target number of x-buckets (≈ chart pixel width). */
|
|
12
|
+
maxPoints: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Min/max decimation of one series over a viewport. One entry per NON-EMPTY
|
|
16
|
+
* x-bucket; arrays are parallel and ascending in `x`. `first`/`last` are the y
|
|
17
|
+
* values at the bucket's smallest/largest x (for endpoint-preserving rendering).
|
|
18
|
+
*/
|
|
19
|
+
export interface DecimatedSeries {
|
|
20
|
+
x: Float64Array;
|
|
21
|
+
min: Float64Array;
|
|
22
|
+
max: Float64Array;
|
|
23
|
+
first: Float64Array;
|
|
24
|
+
last: Float64Array;
|
|
25
|
+
}
|
|
26
|
+
export interface ColumnSchema {
|
|
27
|
+
name: string;
|
|
28
|
+
type: 'number' | 'string';
|
|
29
|
+
unit: string;
|
|
30
|
+
}
|
|
31
|
+
/** One row of a multi-column decimation: `{ b, y0lo, y0hi, y1lo, … }`. */
|
|
32
|
+
export type MultiDecimationRow = Record<string, number | bigint | null>;
|
|
33
|
+
/** Result of decimating several columns at once over a viewport. */
|
|
34
|
+
export interface MultiSeriesResult {
|
|
35
|
+
x0: number;
|
|
36
|
+
bucket: number;
|
|
37
|
+
rows: MultiDecimationRow[];
|
|
38
|
+
/** The columns actually decimated (a subset of those requested that the
|
|
39
|
+
* dataset has). y{i}lo/y{i}hi in each row index into THIS list. */
|
|
40
|
+
columns: string[];
|
|
41
|
+
}
|
|
42
|
+
/** Read interface every chart will use; implementations may be in-memory or out-of-core. */
|
|
43
|
+
export interface DataSource {
|
|
44
|
+
getSchema(): Promise<ColumnSchema[]>;
|
|
45
|
+
getSeries(q: SeriesQuery): Promise<DecimatedSeries>;
|
|
46
|
+
/** Decimate SEVERAL columns over a viewport in one pass (min/max per bucket). */
|
|
47
|
+
getSeriesMulti(columns: string[], viewport: Viewport, maxPoints: number): Promise<MultiSeriesResult>;
|
|
48
|
+
/** Min/max of a numeric column over the whole dataset (for axis auto-scaling). */
|
|
49
|
+
xBounds(column: string): Promise<{
|
|
50
|
+
x0: number;
|
|
51
|
+
x1: number;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Synchronous {@link getSeriesMulti} / {@link xBounds}, for sources where they
|
|
55
|
+
* are pure computation (in memory): a chart then gets new data in the same
|
|
56
|
+
* render, with no query to wait for (and none for a newer update to cancel).
|
|
57
|
+
*/
|
|
58
|
+
getSeriesMultiSync?(columns: string[], viewport: Viewport, maxPoints: number): MultiSeriesResult;
|
|
59
|
+
/**
|
|
60
|
+
* The samples of `columns` in the viewport as they are (no decimation), or null
|
|
61
|
+
* when there are more than `limit` of them or X isn't ascending.
|
|
62
|
+
*/
|
|
63
|
+
getColumnsSync?(columns: string[], viewport: Viewport, limit: number): PointColumns | null;
|
|
64
|
+
xBoundsSync?(column: string): {
|
|
65
|
+
x0: number;
|
|
66
|
+
x1: number;
|
|
67
|
+
};
|
|
68
|
+
/** Release any held resources (DB connections, registered files). */
|
|
69
|
+
dispose(): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/** Progress of a large file being loaded into DuckDB (here, not in duckDbDataSource, so the public types need no DuckDB). */
|
|
72
|
+
export interface IngestProgress {
|
|
73
|
+
phase: 'reading' | 'parsing' | 'done';
|
|
74
|
+
message: string;
|
|
75
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DecimatedSeries, MultiSeriesResult } from './dataSource';
|
|
2
|
+
import type { PointColumns } from './pointColumns';
|
|
3
|
+
/**
|
|
4
|
+
* Min/max-per-bucket decimation of SEVERAL y columns sharing one x array, in the
|
|
5
|
+
* same `{ b, y{i}lo, y{i}hi }` row shape the SQL path produces (so the in-memory
|
|
6
|
+
* and live sources feed the same point builder as DuckDB). NaN samples and
|
|
7
|
+
* out-of-range (or NaN) x are skipped; bucketing matches buildMultiDecimationSql.
|
|
8
|
+
* Accumulates into typed arrays per bucket (an object per bucket and a Map
|
|
9
|
+
* lookup per sample made a million-point series ~17 ms and most of its garbage).
|
|
10
|
+
*/
|
|
11
|
+
export declare function multiDecimateColumns(x: Float64Array, ys: Float64Array[], columns: string[], x0: number, x1: number, maxPoints: number): MultiSeriesResult;
|
|
12
|
+
/**
|
|
13
|
+
* Min/max decimation over parallel x/y arrays. Mirrors buildDecimationSql:
|
|
14
|
+
* bucket = (x1-x0)/maxPoints, b = floor((x-x0)/bucket). Points outside [x0,x1]
|
|
15
|
+
* or with NaN y are skipped; empty buckets are omitted; per-bucket x is the
|
|
16
|
+
* bucket center x0+(b+0.5)*bucket.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decimateArrays(x: Float64Array, y: Float64Array, x0: number, x1: number, maxPoints: number): DecimatedSeries;
|
|
19
|
+
/**
|
|
20
|
+
* The samples with X in [x0, x1] as they are (views of the columns, nothing
|
|
21
|
+
* copied) when X is ascending and there are at most `limit` of them; otherwise
|
|
22
|
+
* null, and the caller decimates. Drawing them all costs the GPU little, and
|
|
23
|
+
* data replaced every frame then skips decimation and its conversions entirely.
|
|
24
|
+
*/
|
|
25
|
+
export declare function rawColumns(x: Float64Array, ys: Float64Array[], columns: string[], x0: number, x1: number, limit: number): PointColumns | null;
|