@dataelvisliang/embedding-atlas 0.15.0-highlight.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/README.md +16 -0
- package/dist/chunk-BlDgrdZE.js +77467 -0
- package/dist/chunk-CcmG315c.js +4 -0
- package/dist/chunk-Cym-eLtO.js +4 -0
- package/dist/chunk-DgFtVqg1.js +60 -0
- package/dist/chunk-fa8UlHZE.js +6 -0
- package/dist/chunk-ssRSlsnF.js +9044 -0
- package/dist/chunk-tn9RgvOq.js +7209 -0
- package/dist/clustering.worker.js +600 -0
- package/dist/component.d.ts +334 -0
- package/dist/component.js +7 -0
- package/dist/index.d.ts +1101 -0
- package/dist/index.js +16 -0
- package/dist/react.d.ts +1076 -0
- package/dist/react.js +38 -0
- package/dist/search.worker.js +1825 -0
- package/dist/umap.d.ts +96 -0
- package/dist/umap.js +1683 -0
- package/dist/viewer.d.ts +513 -0
- package/dist/viewer.js +5 -0
- package/package.json +92 -0
- package/svelte/EmbeddingAtlas.svelte +26 -0
- package/svelte/EmbeddingView.svelte +26 -0
- package/svelte/EmbeddingViewMosaic.svelte +26 -0
- package/svelte/Table.svelte +26 -0
- package/svelte/index.d.ts +9 -0
- package/svelte/index.js +11 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1101 @@
|
|
|
1
|
+
import { Coordinator } from '@uwdata/mosaic-core';
|
|
2
|
+
import { Selection as Selection_2 } from '@uwdata/mosaic-core';
|
|
3
|
+
|
|
4
|
+
declare type AdditionalHeaderContentClass = new (node: HTMLElement, props: AdditionalHeaderContentProps) => {
|
|
5
|
+
update?: (props: AdditionalHeaderContentProps) => void;
|
|
6
|
+
destroy?: () => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
declare interface AdditionalHeaderContentProps {
|
|
10
|
+
column: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare type AdditionalHeaderContentsConfig = {
|
|
14
|
+
[col: string]: CustomHeader;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare type AggregateFn = "count" | "distinct" | "min" | "max" | "mean" | "average" | "median" | "stdev" | "stdevp" | "variance" | "variancep" | "sum" | "product" | "quantile" | "ecdf-value" | "ecdf-rank";
|
|
18
|
+
|
|
19
|
+
/** Mark attribute */
|
|
20
|
+
declare type Attribute = "x" | "y" | "x1" | "x2" | "y1" | "y2" | "color" | "size" | "group";
|
|
21
|
+
|
|
22
|
+
declare interface Axis {
|
|
23
|
+
/** Axis title */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Values for ticks, grid lines, and labels */
|
|
26
|
+
values?: any[];
|
|
27
|
+
/** Desired number of ticks. Default 5. */
|
|
28
|
+
desiredTickCount?: number;
|
|
29
|
+
/** Extend scale to ticks. Default true. */
|
|
30
|
+
extendScaleToTicks?: boolean;
|
|
31
|
+
/** Padding to label */
|
|
32
|
+
labelPadding?: number;
|
|
33
|
+
/** Label font family */
|
|
34
|
+
labelFontFamily?: string;
|
|
35
|
+
/** Label font size */
|
|
36
|
+
labelFontSize?: number;
|
|
37
|
+
/** Label max width */
|
|
38
|
+
labelMaxWidth?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare type BuiltinChartSpec = ChartSpec | ContentViewerSpec | CountPlotSpec | EmbeddingSpec | MarkdownSpec | PredicatesSpec | TableSpec;
|
|
42
|
+
|
|
43
|
+
declare interface Cache_2 {
|
|
44
|
+
/** Gets an object from the cache with the given key. Returns `null` if the entry is not found. */
|
|
45
|
+
get(key: string): Promise<any | null>;
|
|
46
|
+
/** Sets an object to the cache with the given key */
|
|
47
|
+
set(key: string, value: any): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export { Cache_2 as Cache }
|
|
50
|
+
|
|
51
|
+
declare interface Cache_2_2 {
|
|
52
|
+
get: (key: string) => Promise<any | null>;
|
|
53
|
+
set: (key: string, value: any) => Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Encoding channel */
|
|
57
|
+
declare type Channel = "x" | "y" | "color" | "size";
|
|
58
|
+
|
|
59
|
+
/** Chart specification */
|
|
60
|
+
declare interface ChartSpec {
|
|
61
|
+
/** The title of the chart */
|
|
62
|
+
title?: string;
|
|
63
|
+
/** Size configuration */
|
|
64
|
+
plotSize?: {
|
|
65
|
+
/** Width of the plot area */
|
|
66
|
+
width?: number;
|
|
67
|
+
/** Height of the plot area */
|
|
68
|
+
height?: number;
|
|
69
|
+
/** Aspect ratio of the plot area */
|
|
70
|
+
aspectRatio?: number;
|
|
71
|
+
};
|
|
72
|
+
/** Layers */
|
|
73
|
+
layers?: Layer[];
|
|
74
|
+
/** Scale configurations */
|
|
75
|
+
scale?: Partial<Record<Channel, Scale>>;
|
|
76
|
+
/** Axis configurations */
|
|
77
|
+
axis?: Partial<Record<"x" | "y", Axis>>;
|
|
78
|
+
/** Selections */
|
|
79
|
+
selection?: Record<string, Selection_2_2>;
|
|
80
|
+
/** Widgets */
|
|
81
|
+
widgets?: Widget[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare interface ChartTheme {
|
|
85
|
+
scheme: "light" | "dark";
|
|
86
|
+
/** Default interpolate for continuous color scales */
|
|
87
|
+
interpolate: string | string[] | ((v: number) => string);
|
|
88
|
+
/** Category color scheme */
|
|
89
|
+
categoryColors: string[] | ((count: number) => string[]);
|
|
90
|
+
/** Ordinal color scheme */
|
|
91
|
+
ordinalColors: string[] | ((count: number) => string[]);
|
|
92
|
+
/** Color for the '(other)' category */
|
|
93
|
+
otherColor: string;
|
|
94
|
+
/** Color for the '(null)' category */
|
|
95
|
+
nullColor: string;
|
|
96
|
+
/** Mark color */
|
|
97
|
+
markColor: string;
|
|
98
|
+
markColorFade: string;
|
|
99
|
+
markColorGray: string;
|
|
100
|
+
markColorGrayFade: string;
|
|
101
|
+
ruleColor: string;
|
|
102
|
+
/** Embedding view point / contour color when there is no color encoding */
|
|
103
|
+
embeddingColor: string;
|
|
104
|
+
/** Grid color */
|
|
105
|
+
gridColor: string;
|
|
106
|
+
/** Label color */
|
|
107
|
+
labelColor: string;
|
|
108
|
+
labelFontFamily: string;
|
|
109
|
+
labelFontSize: number;
|
|
110
|
+
labelMaxWidth: number;
|
|
111
|
+
/** Border of the brush selection */
|
|
112
|
+
brushBorder: string;
|
|
113
|
+
/** Back border of the brush selection */
|
|
114
|
+
brushBorderBack: string;
|
|
115
|
+
/** Fill color of the brush selection */
|
|
116
|
+
brushFill: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare type ChartThemeConfig = Partial<ChartTheme> & {
|
|
120
|
+
light?: Partial<ChartTheme>;
|
|
121
|
+
dark?: Partial<ChartTheme>;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** A resulting cluster from the find clusters function */
|
|
125
|
+
export declare interface Cluster {
|
|
126
|
+
/** Cluster identifier */
|
|
127
|
+
identifier: number;
|
|
128
|
+
/** The total density */
|
|
129
|
+
sumDensity: number;
|
|
130
|
+
/** The mean x location (weighted by density) */
|
|
131
|
+
meanX: number;
|
|
132
|
+
/** The mean y location (weighted by density) */
|
|
133
|
+
meanY: number;
|
|
134
|
+
/** The maximum density */
|
|
135
|
+
maxDensity: number;
|
|
136
|
+
/** The location with the maximum density */
|
|
137
|
+
maxDensityLocation: [number, number];
|
|
138
|
+
/** The number of pixels in the cluster */
|
|
139
|
+
pixelCount: number;
|
|
140
|
+
/** The cluster's boundary represented as a list of polygons */
|
|
141
|
+
boundary?: [number, number][][];
|
|
142
|
+
/** The cluster's boundary approximated with a list of rectangles, each rectangle is given as an array `[x1, y1, x2, y2]` */
|
|
143
|
+
boundaryRectApproximation?: [number, number, number, number][];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare type ColumnConfig = {
|
|
147
|
+
title?: string;
|
|
148
|
+
width?: number;
|
|
149
|
+
hidden?: boolean;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
declare type ColumnConfigChangeCallback = (column: string, newConfigs: ColumnConfigs) => void;
|
|
153
|
+
|
|
154
|
+
declare type ColumnConfigs = {
|
|
155
|
+
[column: string]: ColumnConfig;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
declare interface ContentViewerSpec {
|
|
159
|
+
type: "content-viewer";
|
|
160
|
+
title?: string;
|
|
161
|
+
field: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare interface CountPlotSpec {
|
|
165
|
+
type: "count-plot";
|
|
166
|
+
title?: string;
|
|
167
|
+
data: {
|
|
168
|
+
/** The data field */
|
|
169
|
+
field: SQLField;
|
|
170
|
+
/** Indicate if the field contains list[str] data, default false */
|
|
171
|
+
isList?: boolean;
|
|
172
|
+
};
|
|
173
|
+
/** The max number of categories to show, default 10 */
|
|
174
|
+
limit?: number;
|
|
175
|
+
/** Labeling method, '%': percentage, '#': count, '#/#': selected count over total count */
|
|
176
|
+
labels?: "%" | "#" | "#/#";
|
|
177
|
+
/** Order the categories by total count, selected count, alphabetical, or custom order, default 'total-descending' */
|
|
178
|
+
order?: "total-descending" | "total-ascending" | "selected-descending" | "selected-ascending" | "alphabetical" | string[];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare function createKNN(count: number, inputDim: number, data: Float32Array, options?: KNNOptions): Promise<KNN>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Initialize a UMAP instance.
|
|
185
|
+
* @param count the number of data points
|
|
186
|
+
* @param inputDim the input dimension
|
|
187
|
+
* @param outputDim the output dimension
|
|
188
|
+
* @param data the data array. Must be a Float32Array with count * inputDim elements.
|
|
189
|
+
* @param options options
|
|
190
|
+
*/
|
|
191
|
+
export declare function createUMAP(
|
|
192
|
+
count: number,
|
|
193
|
+
inputDim: number,
|
|
194
|
+
outputDim: number,
|
|
195
|
+
data: Float32Array,
|
|
196
|
+
options?: UMAPOptions,
|
|
197
|
+
): Promise<UMAP>;
|
|
198
|
+
|
|
199
|
+
declare type CustomCell = {
|
|
200
|
+
class: CustomCellClass;
|
|
201
|
+
props?: CustomCellProps;
|
|
202
|
+
} | CustomCellClass;
|
|
203
|
+
|
|
204
|
+
declare type CustomCellClass = new (node: HTMLElement, props: CustomCellProps) => {
|
|
205
|
+
update?: (props: CustomCellProps) => void;
|
|
206
|
+
destroy?: () => void;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
declare interface CustomCellProps {
|
|
210
|
+
value: any;
|
|
211
|
+
rowData: {
|
|
212
|
+
[col: string]: any;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare type CustomCellsConfig = {
|
|
217
|
+
[col: string]: CustomCell;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export declare type CustomComponent<N, P> = {
|
|
221
|
+
class: CustomComponentClass<N, P & any>;
|
|
222
|
+
props?: Record<string, any>;
|
|
223
|
+
} | CustomComponentClass<N, P>;
|
|
224
|
+
|
|
225
|
+
declare type CustomComponentClass<N, P> = new (node: N, props: P) => {
|
|
226
|
+
update?: (props: P) => void;
|
|
227
|
+
destroy?: () => void;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
declare type CustomHeader = {
|
|
231
|
+
class: AdditionalHeaderContentClass;
|
|
232
|
+
props?: AdditionalHeaderContentProps;
|
|
233
|
+
} | AdditionalHeaderContentClass;
|
|
234
|
+
|
|
235
|
+
export declare type DataField = string | {
|
|
236
|
+
sql: string;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export declare interface DataPoint {
|
|
240
|
+
x: number;
|
|
241
|
+
y: number;
|
|
242
|
+
category?: number;
|
|
243
|
+
text?: string;
|
|
244
|
+
identifier?: DataPointID;
|
|
245
|
+
fields?: Record<string, any>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export declare type DataPointID = string | number | bigint;
|
|
249
|
+
|
|
250
|
+
/** Data value */
|
|
251
|
+
declare type DataValue = string | number | [number, number];
|
|
252
|
+
|
|
253
|
+
export declare function defaultCategoryColors(count: number): string[];
|
|
254
|
+
|
|
255
|
+
/** Returns a list of default charts for a given data table. */
|
|
256
|
+
export declare function defaultCharts(options: {
|
|
257
|
+
coordinator: Coordinator;
|
|
258
|
+
table: string;
|
|
259
|
+
id: string;
|
|
260
|
+
projection?: {
|
|
261
|
+
x: string;
|
|
262
|
+
y: string;
|
|
263
|
+
text?: string;
|
|
264
|
+
};
|
|
265
|
+
config?: DefaultChartsConfig;
|
|
266
|
+
}): Promise<BuiltinChartSpec[]>;
|
|
267
|
+
|
|
268
|
+
declare interface DefaultChartsConfig {
|
|
269
|
+
/** If specified, only include the given columns */
|
|
270
|
+
include?: string[];
|
|
271
|
+
/** Columns to exclude, applicable if `include` is not specified */
|
|
272
|
+
exclude?: string[];
|
|
273
|
+
/** Override the chart spec for certain columns. If the override is set to `null` the column will be skipped */
|
|
274
|
+
override?: Record<string, BuiltinChartSpec | null>;
|
|
275
|
+
/** Set to false to disable the table, or an object to override spec properties */
|
|
276
|
+
table?: boolean | Partial<TableSpec>;
|
|
277
|
+
/** Set to false to disable the embedding view, or an object to override spec properties */
|
|
278
|
+
embedding?: boolean | Partial<EmbeddingSpec>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** Mark dimension for width and height */
|
|
282
|
+
declare type Dimension = {
|
|
283
|
+
gap: number;
|
|
284
|
+
clampToRatio?: number;
|
|
285
|
+
} | {
|
|
286
|
+
ratio: number;
|
|
287
|
+
} | number;
|
|
288
|
+
|
|
289
|
+
export declare class EmbeddingAtlas {
|
|
290
|
+
private component;
|
|
291
|
+
private container;
|
|
292
|
+
private currentProps;
|
|
293
|
+
constructor(target: HTMLElement, props: EmbeddingAtlasProps);
|
|
294
|
+
update(props: Partial<EmbeddingAtlasProps>): void;
|
|
295
|
+
destroy(): void;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export declare interface EmbeddingAtlasProps {
|
|
299
|
+
/** The Mosaic coordinator. */
|
|
300
|
+
coordinator: Coordinator;
|
|
301
|
+
/** The data source. */
|
|
302
|
+
data: {
|
|
303
|
+
/** The name of the data table. */
|
|
304
|
+
table: string;
|
|
305
|
+
/** The column for unique row identifiers. */
|
|
306
|
+
id: string;
|
|
307
|
+
/** The X and Y columns for the embedding projection view. */
|
|
308
|
+
projection?: {
|
|
309
|
+
x: string;
|
|
310
|
+
y: string;
|
|
311
|
+
} | null;
|
|
312
|
+
/** The column for pre-computed nearest neighbors.
|
|
313
|
+
* Each value in the column should be a dictionary with the format: `{ "ids": [id1, id2, ...], "distances": [distance1, distance2, ...] }`.
|
|
314
|
+
* `"ids"` should be an array of row ids (as given by the `idColumn`) of the neighbors, sorted by distance.
|
|
315
|
+
* `"distances"` should contain the corresponding distances to each neighbor.
|
|
316
|
+
* Note that if `searcher.nearestNeighbors` is specified, the UI will use the searcher instead.
|
|
317
|
+
*/
|
|
318
|
+
neighbors?: string | null;
|
|
319
|
+
/** The column for text. The text will be used as content for the tooltip and search features. */
|
|
320
|
+
text?: string | null;
|
|
321
|
+
};
|
|
322
|
+
/** The color scheme. */
|
|
323
|
+
colorScheme?: "light" | "dark" | null;
|
|
324
|
+
/** The initial viewer state. */
|
|
325
|
+
initialState?: EmbeddingAtlasState | null;
|
|
326
|
+
/**
|
|
327
|
+
* Configure the default charts.
|
|
328
|
+
* By default, we show a distribution chart for each column based on the data type in addition to the embedding and table.
|
|
329
|
+
* You may configure these charts with this option.
|
|
330
|
+
*/
|
|
331
|
+
defaultChartsConfig?: DefaultChartsConfig | null;
|
|
332
|
+
/** Configuration for the embedding view. See docs for the EmbeddingView. */
|
|
333
|
+
embeddingViewConfig?: EmbeddingViewConfig | null;
|
|
334
|
+
/** Labels for the embedding view. */
|
|
335
|
+
embeddingViewLabels?: Label[] | null;
|
|
336
|
+
/** Theme config for charts. */
|
|
337
|
+
chartTheme?: ChartThemeConfig | null;
|
|
338
|
+
/** Custom CSS stylesheet to apply at the root of the component. */
|
|
339
|
+
stylesheet?: string | null;
|
|
340
|
+
/** An object that provides search functionalities, including full text search, vector search, and nearest neighbor queries.
|
|
341
|
+
* If not specified (undefined), a default full-text search with the text column will be used.
|
|
342
|
+
* If set to null, search will be disabled. */
|
|
343
|
+
searcher?: Searcher | null;
|
|
344
|
+
/** Custom cell renderers for the table view. */
|
|
345
|
+
tableCellRenderers?: Record<string, CustomCell | "markdown">;
|
|
346
|
+
/** A callback to export the currently selected points. */
|
|
347
|
+
onExportSelection?: ((predicate: string | null, format: "json" | "jsonl" | "csv" | "parquet") => Promise<void>) | null;
|
|
348
|
+
/** A callback to download the application as archive. */
|
|
349
|
+
onExportApplication?: (() => Promise<void>) | null;
|
|
350
|
+
/** A callback when the state of the viewer changes. You may serialize the state to JSON and load it back. */
|
|
351
|
+
onStateChange?: ((state: EmbeddingAtlasState) => void) | null;
|
|
352
|
+
/** A cache to speed up initialization of the viewer. */
|
|
353
|
+
cache?: Cache_2 | null;
|
|
354
|
+
/**
|
|
355
|
+
* An array of row IDs to highlight on the embedding view.
|
|
356
|
+
* When set, orange circles will be drawn at the specified points.
|
|
357
|
+
* The view will animate to show the first point in the array.
|
|
358
|
+
* Pass null or an empty array to clear the highlight.
|
|
359
|
+
*/
|
|
360
|
+
highlight?: any[] | null;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export declare interface EmbeddingAtlasState {
|
|
364
|
+
/** The version of Embedding Atlas that created this state. */
|
|
365
|
+
version: string;
|
|
366
|
+
/** UNIX timestamp when this was created. */
|
|
367
|
+
timestamp: number;
|
|
368
|
+
/** The list of charts. */
|
|
369
|
+
charts?: Record<string, any>;
|
|
370
|
+
/** The state of all charts, stored as a map of id to chart state. */
|
|
371
|
+
chartStates?: Record<string, any>;
|
|
372
|
+
/** The current layout */
|
|
373
|
+
layout?: string;
|
|
374
|
+
/** The state of all layouts. */
|
|
375
|
+
layoutStates?: Record<string, any>;
|
|
376
|
+
/** The selection predicate (SQL expression).
|
|
377
|
+
* This property is derived from chart states, changing this directly has no effect. */
|
|
378
|
+
predicate?: string | null;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
declare interface EmbeddingSpec {
|
|
382
|
+
type: "embedding";
|
|
383
|
+
title: string;
|
|
384
|
+
data: {
|
|
385
|
+
x: string;
|
|
386
|
+
y: string;
|
|
387
|
+
text?: string | null;
|
|
388
|
+
category?: string | null;
|
|
389
|
+
};
|
|
390
|
+
mode?: "points" | "density";
|
|
391
|
+
minimumDensity?: number;
|
|
392
|
+
pointSize?: number;
|
|
393
|
+
/** Maximum number of points to render (for downsampling). Default: 4000000. Set to null to disable. */
|
|
394
|
+
downsampleMaxPoints?: number | null;
|
|
395
|
+
config?: EmbeddingViewConfig;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export declare class EmbeddingView {
|
|
399
|
+
private component;
|
|
400
|
+
private currentProps;
|
|
401
|
+
constructor(target: HTMLElement, props: EmbeddingViewProps);
|
|
402
|
+
update(props: Partial<EmbeddingViewProps>): void;
|
|
403
|
+
destroy(): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export declare interface EmbeddingViewConfig {
|
|
407
|
+
/** Color scheme. */
|
|
408
|
+
colorScheme?: "light" | "dark" | null;
|
|
409
|
+
/** View mode. */
|
|
410
|
+
mode?: "points" | "density" | null;
|
|
411
|
+
/** Minimum average density for density contours to show up.
|
|
412
|
+
* The density is measured as number of points per square points (aka., px in CSS units). */
|
|
413
|
+
minimumDensity?: number | null;
|
|
414
|
+
/** Override the automatically calculated point size.
|
|
415
|
+
* If not specified, point size is calculated based on density. */
|
|
416
|
+
pointSize?: number | null;
|
|
417
|
+
/** Generate labels automatically.
|
|
418
|
+
* By default labels are generated automatically if the `labels` prop is not specified,
|
|
419
|
+
* and a `text` column is specified in the Mosaic view,
|
|
420
|
+
* or a `queryClusterLabels` callback is specified in the non-Mosaic view.
|
|
421
|
+
* Set this to `false` to disable automatic labels. */
|
|
422
|
+
autoLabelEnabled?: boolean | null;
|
|
423
|
+
/** The density threshold to filter the clusters before generating automatic labels.
|
|
424
|
+
* The value is relative to the max density. */
|
|
425
|
+
autoLabelDensityThreshold?: number | null;
|
|
426
|
+
/** The stop words for automatic label generation. By default use NLTK stop words. */
|
|
427
|
+
autoLabelStopWords?: string[] | null;
|
|
428
|
+
/** Approximate maximum number of points to render when downsampling is active.
|
|
429
|
+
* Points are sampled with bias toward sparse regions (fewer points kept in dense areas).
|
|
430
|
+
* The sampling probability is given by this formula:
|
|
431
|
+
* P(i) = (downsampleMaxPoints / numPointsInViewport) * (2 / (1 + density(p_i) / maxDensity * downsampleDensityWeight))
|
|
432
|
+
* Default: 4,000,000. Set to null or Infinity to disable downsampling. */
|
|
433
|
+
downsampleMaxPoints?: number | null;
|
|
434
|
+
/** Density weight for downsampling (0-10).
|
|
435
|
+
* Higher values mean more aggressive culling in dense areas.
|
|
436
|
+
* Default: 5 */
|
|
437
|
+
downsampleDensityWeight?: number | null;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export declare class EmbeddingViewMosaic {
|
|
441
|
+
private component;
|
|
442
|
+
private currentProps;
|
|
443
|
+
constructor(target: HTMLElement, props: EmbeddingViewMosaicProps);
|
|
444
|
+
update(props: Partial<EmbeddingViewMosaicProps>): void;
|
|
445
|
+
destroy(): void;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export declare interface EmbeddingViewMosaicProps {
|
|
449
|
+
/** The Mosaic coordinator.
|
|
450
|
+
* If not specified, the default coordinator from Mosaic's `coordinator()` method will be used. */
|
|
451
|
+
coordinator?: Coordinator;
|
|
452
|
+
/** The data table name. */
|
|
453
|
+
table: string;
|
|
454
|
+
/** The x column name. */
|
|
455
|
+
x: string;
|
|
456
|
+
/** The y column name. */
|
|
457
|
+
y: string;
|
|
458
|
+
/** The name of the category column.
|
|
459
|
+
* The categories should be represented as integers starting from 0.
|
|
460
|
+
* If you have categories represented as strings, you should first convert them to 0-indexed integers. */
|
|
461
|
+
category?: string | null;
|
|
462
|
+
/** The name of the text column.
|
|
463
|
+
* If specified, the default tooltip shows the text content.
|
|
464
|
+
* The text content is also used to generate labels automatically. */
|
|
465
|
+
text?: string | null;
|
|
466
|
+
/** The name of the identifier (aka., id) column.
|
|
467
|
+
* If specified, the `selection` object will contain an `identifier` property that you can use to identify the point. */
|
|
468
|
+
identifier?: string | null;
|
|
469
|
+
/** Additional fields for the tooltip data element.
|
|
470
|
+
* Each field can be specified as a column name or a SQL expression. */
|
|
471
|
+
additionalFields?: Record<string, DataField> | null;
|
|
472
|
+
/** The colors for the categories.
|
|
473
|
+
* Category `i` will use the `i`-th color from this list.
|
|
474
|
+
* If not specified, default colors will be used. */
|
|
475
|
+
categoryColors?: string[] | null;
|
|
476
|
+
/** A Mosaic `Selection` object to filter the contents of this view. */
|
|
477
|
+
filter?: Selection_2 | null;
|
|
478
|
+
/** Labels to display on the embedding view.
|
|
479
|
+
* Each label must have `x`, `y`, and `text` properties,
|
|
480
|
+
* and optionally `level` and `priority`. */
|
|
481
|
+
labels?: Label[] | null;
|
|
482
|
+
/** The width of the view. */
|
|
483
|
+
width?: number | null;
|
|
484
|
+
/** The height of the view. */
|
|
485
|
+
height?: number | null;
|
|
486
|
+
/** The pixel ratio of the view. */
|
|
487
|
+
pixelRatio?: number | null;
|
|
488
|
+
/** Configure the theme of the view. */
|
|
489
|
+
theme?: ThemeConfig | null;
|
|
490
|
+
/** Configure the embedding view. */
|
|
491
|
+
config?: EmbeddingViewConfig | null;
|
|
492
|
+
/** The viewport state.
|
|
493
|
+
* You may use this to share viewport state across multiple views.
|
|
494
|
+
* If undefined or set to `null`, the view will use a default viewport state.
|
|
495
|
+
* To listen to viewport state change, use `onViewportState`. */
|
|
496
|
+
viewportState?: ViewportState | null;
|
|
497
|
+
/** The current tooltip.
|
|
498
|
+
* The tooltip is an object with the following fields: `x`, `y`, `category`,
|
|
499
|
+
* `text`, `identifier`.
|
|
500
|
+
*
|
|
501
|
+
* You may pass the identifier for the data point (`DataPointID`), or a `DataPoint`
|
|
502
|
+
* object, or a Mosaic `Selection`. If an id or a `DataPoint` object is specified,
|
|
503
|
+
* you will need to use `onTooltip` to listen to tooltip changes; if a Mosaic
|
|
504
|
+
* `Selection` is used, the selection will be updated when tooltip is triggered.
|
|
505
|
+
*/
|
|
506
|
+
tooltip?: Selection_2 | DataPoint | DataPointID | null;
|
|
507
|
+
/** The current single or multiple point selection.
|
|
508
|
+
*
|
|
509
|
+
* You may pass an array of `DataPointID` or `DataPoint` objects, or a Mosaic
|
|
510
|
+
* `Selection`. If `DataPointID[]` or `DataPoint[]` is specified, you will need
|
|
511
|
+
* to use `onSelection` to listen to selection changes; if a Mosaic `Selection`
|
|
512
|
+
* is used, the selection will be updated with the appropriate predicates. */
|
|
513
|
+
selection?: Selection_2 | DataPoint[] | DataPointID[] | null;
|
|
514
|
+
/** A Mosaic `Selection` object to capture the component's range selection. */
|
|
515
|
+
rangeSelection?: Selection_2 | null;
|
|
516
|
+
/** The rectangle or polygon that drives the range selection. Setting this
|
|
517
|
+
* changes the current range selection and also affects the selection passed
|
|
518
|
+
* in `rangeSelection`. Use `onRangeSelection` to listen for changes to this
|
|
519
|
+
* rectangle. */
|
|
520
|
+
rangeSelectionValue?: Rectangle | Point[] | null;
|
|
521
|
+
/** A callback for when `viewportState` changes. */
|
|
522
|
+
onViewportState?: ((value: ViewportState) => void) | null;
|
|
523
|
+
/** A callback for when `tooltip` changes. */
|
|
524
|
+
onTooltip?: ((value: DataPoint | null) => void) | null;
|
|
525
|
+
/** A callback for when `selection` changes. */
|
|
526
|
+
onSelection?: ((value: DataPoint[] | null) => void) | null;
|
|
527
|
+
/** A callback for when `rangeSelection` changes. */
|
|
528
|
+
onRangeSelection?: ((value: Rectangle | Point[] | null) => void) | null;
|
|
529
|
+
/** A custom renderer to draw the tooltip content. */
|
|
530
|
+
customTooltip?: CustomComponent<HTMLDivElement, {
|
|
531
|
+
tooltip: DataPoint;
|
|
532
|
+
}> | null;
|
|
533
|
+
/** A custom renderer to draw overlay on top of the embedding view. */
|
|
534
|
+
customOverlay?: CustomComponent<HTMLDivElement, {
|
|
535
|
+
proxy: OverlayProxy;
|
|
536
|
+
}> | null;
|
|
537
|
+
/** A cache for intermediate results. */
|
|
538
|
+
cache?: Cache_2_2 | null;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export declare interface EmbeddingViewProps {
|
|
542
|
+
/** The data. */
|
|
543
|
+
data: {
|
|
544
|
+
/** An array of X coordinates, must be a `Float32Array`. */
|
|
545
|
+
x: Float32Array<ArrayBuffer>;
|
|
546
|
+
/** An array of Y coordinates, must be a `Float32Array`. */
|
|
547
|
+
y: Float32Array<ArrayBuffer>;
|
|
548
|
+
/** An array of category indices, must be a `Uint8Array`. */
|
|
549
|
+
category?: Uint8Array<ArrayBuffer> | null;
|
|
550
|
+
};
|
|
551
|
+
/** The colors for the categories.
|
|
552
|
+
* Category `i` will use the `i`-th color from this list.
|
|
553
|
+
* If not specified, default colors will be used. */
|
|
554
|
+
categoryColors?: string[] | null;
|
|
555
|
+
/** Labels to display on the embedding view.
|
|
556
|
+
* Each label must have `x`, `y`, and `text` properties,
|
|
557
|
+
* and optionally `level` and `priority`. */
|
|
558
|
+
labels?: Label[] | null;
|
|
559
|
+
/** The width of the view. */
|
|
560
|
+
width?: number | null;
|
|
561
|
+
/** The height of the view. */
|
|
562
|
+
height?: number | null;
|
|
563
|
+
/** The pixel ratio of the view. */
|
|
564
|
+
pixelRatio?: number | null;
|
|
565
|
+
/** Configure the theme of the view. */
|
|
566
|
+
theme?: ThemeConfig | null;
|
|
567
|
+
/** Configure the embedding view. */
|
|
568
|
+
config?: EmbeddingViewConfig | null;
|
|
569
|
+
/** The viewport state.
|
|
570
|
+
* You may use this to share viewport state across multiple views.
|
|
571
|
+
* If undefined or set to `null`, the view will use a default viewport state.
|
|
572
|
+
* To listen to viewport state change, use `onViewportState`. */
|
|
573
|
+
viewportState?: ViewportState | null;
|
|
574
|
+
/** The current tooltip.
|
|
575
|
+
* The tooltip is an object with the following fields: `x`, `y`, `category`, `text`, `identifier`.
|
|
576
|
+
* To listen for a tooltip change, use `onTooltip`. */
|
|
577
|
+
tooltip?: DataPoint | null;
|
|
578
|
+
/** The current single or multiple point selection.
|
|
579
|
+
* Selection is triggered by clicking on the points (shift/cmd+click will toggle points).
|
|
580
|
+
* The selection is an array of objects with the following fields: `x`, `y`, `category`, `text`, `identifier`.
|
|
581
|
+
* To listen to selection change, use `onSelection`. */
|
|
582
|
+
selection?: DataPoint[] | null;
|
|
583
|
+
/** A rectangle or a polygon (list of points) that represents the range selection.
|
|
584
|
+
* If the value is a list of points, it is interpreted as a lasso selection
|
|
585
|
+
* with a closed polygon with the list of points as vertices. */
|
|
586
|
+
rangeSelection?: Rectangle | null;
|
|
587
|
+
/** A callback for when `viewportState` changes. */
|
|
588
|
+
onViewportState?: ((value: ViewportState) => void) | null;
|
|
589
|
+
/** A callback for when `tooltip` changes. */
|
|
590
|
+
onTooltip?: ((value: DataPoint | null) => void) | null;
|
|
591
|
+
/** A callback for when `selection` changes. */
|
|
592
|
+
onSelection?: ((value: DataPoint[] | null) => void) | null;
|
|
593
|
+
/** A callback for when `rangeSelection` changes. */
|
|
594
|
+
onRangeSelection?: ((value: Rectangle | Point[] | null) => void) | null;
|
|
595
|
+
/** An async function that returns a data point near the given (x, y) location.
|
|
596
|
+
* The `unitDistance` parameter is the distance of a single pixel in data domain.
|
|
597
|
+
* You can use this to determine the distance threshold for selecting a point. */
|
|
598
|
+
querySelection?: ((x: number, y: number, unitDistance: number) => Promise<DataPoint | null>) | null;
|
|
599
|
+
/** An async function that returns labels for a list of clusters.
|
|
600
|
+
* Each cluster is given as a list of rectangles that approximately cover the region. */
|
|
601
|
+
queryClusterLabels?: ((clusters: Rectangle[][]) => Promise<(string | null)[]>) | null;
|
|
602
|
+
/** A custom renderer to draw the tooltip content. */
|
|
603
|
+
customTooltip?: CustomComponent<HTMLDivElement, {
|
|
604
|
+
tooltip: DataPoint;
|
|
605
|
+
}> | null;
|
|
606
|
+
/** A custom renderer to draw overlay on top of the embedding view. */
|
|
607
|
+
customOverlay?: CustomComponent<HTMLDivElement, {
|
|
608
|
+
proxy: OverlayProxy;
|
|
609
|
+
}> | null;
|
|
610
|
+
/** A cache for intermediate results. */
|
|
611
|
+
cache?: Cache_2_2 | null;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export declare interface EmbeddingViewTheme {
|
|
615
|
+
/** The font family for texts. */
|
|
616
|
+
fontFamily: string;
|
|
617
|
+
/** Color for cluster labels. */
|
|
618
|
+
clusterLabelColor: string;
|
|
619
|
+
/** Color for cluster labels' outline. */
|
|
620
|
+
clusterLabelOutlineColor: string;
|
|
621
|
+
/** Opacity for cluster labels. */
|
|
622
|
+
clusterLabelOpacity: number;
|
|
623
|
+
/** Whether to show the status bar at the bottom. */
|
|
624
|
+
statusBar: boolean;
|
|
625
|
+
/** Color for status bar text. */
|
|
626
|
+
statusBarTextColor: string;
|
|
627
|
+
/** Color for status bar background. */
|
|
628
|
+
statusBarBackgroundColor: string;
|
|
629
|
+
/** Branding link. */
|
|
630
|
+
brandingLink: {
|
|
631
|
+
text: string;
|
|
632
|
+
href: string;
|
|
633
|
+
} | null;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/** Encoding */
|
|
637
|
+
declare type Encoding = {
|
|
638
|
+
/** The data field */
|
|
639
|
+
field: SQLField;
|
|
640
|
+
bin?: {
|
|
641
|
+
/** Desired bin count */
|
|
642
|
+
desiredCount?: number;
|
|
643
|
+
};
|
|
644
|
+
} | {
|
|
645
|
+
/** Aggregate type */
|
|
646
|
+
aggregate: AggregateFn | {
|
|
647
|
+
sql: string;
|
|
648
|
+
};
|
|
649
|
+
/** The data field for the aggregate */
|
|
650
|
+
field?: SQLField;
|
|
651
|
+
/** For "quantile" aggregate, the quantile value (0-1) */
|
|
652
|
+
quantile?: number;
|
|
653
|
+
/** Normalize the value by x or y */
|
|
654
|
+
normalize?: "x" | "y";
|
|
655
|
+
} | {
|
|
656
|
+
value: DataValue;
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Find clusters from a density map
|
|
661
|
+
* @param density_map the density map, a `Float32Array` with `width * height` elements
|
|
662
|
+
* @param width the width of the density map
|
|
663
|
+
* @param height the height of the density map
|
|
664
|
+
* @param options algorithm options
|
|
665
|
+
* @returns
|
|
666
|
+
*/
|
|
667
|
+
export declare function findClusters(
|
|
668
|
+
densityMap: Float32Array,
|
|
669
|
+
width: number,
|
|
670
|
+
height: number,
|
|
671
|
+
options?: Partial<FindClustersOptions>,
|
|
672
|
+
): Promise<Cluster[]>;
|
|
673
|
+
|
|
674
|
+
/** Options of the find clusters function */
|
|
675
|
+
export declare interface FindClustersOptions {
|
|
676
|
+
/** The threshold for unioning two clusters */
|
|
677
|
+
unionThreshold: number;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** Interpolate method for line or area */
|
|
681
|
+
declare type Interpolate = "linear" | "cardinal" | "catmull-rom" | "natural" | "monotone" | "basis" | "step" | "step-before" | "step-after";
|
|
682
|
+
|
|
683
|
+
export declare interface KNN {
|
|
684
|
+
queryByIndex(index: number, k: number): KNNQueryResult;
|
|
685
|
+
queryByVector(data: Float32Array, k: number): KNNQueryResult;
|
|
686
|
+
destroy(): void;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/** KNN options */
|
|
690
|
+
export declare interface KNNOptions {
|
|
691
|
+
/** The distance metric */
|
|
692
|
+
metric?: "euclidean" | "cosine";
|
|
693
|
+
|
|
694
|
+
/** The nearest neighbor method. By default we use HNSW with its default parameters. */
|
|
695
|
+
method?: "hnsw" | "nndescent" | "vptree";
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export declare interface KNNQueryResult {
|
|
699
|
+
indices: Int32Array;
|
|
700
|
+
distances: Float32Array;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export declare interface Label {
|
|
704
|
+
/** X coordinate. */
|
|
705
|
+
x: number;
|
|
706
|
+
/** Y coordinate. */
|
|
707
|
+
y: number;
|
|
708
|
+
/** Label text, use "\n" for a new line. */
|
|
709
|
+
text: string;
|
|
710
|
+
/** Label level. The label will be shown around 2^level zoom factor. */
|
|
711
|
+
level?: number | null;
|
|
712
|
+
/** Placement priority. */
|
|
713
|
+
priority?: number | null;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
declare interface Layer {
|
|
717
|
+
/** Data source, default to the main data table */
|
|
718
|
+
from?: SQLTable;
|
|
719
|
+
/** Filter the data. Use $filter to refer to the shared filter */
|
|
720
|
+
filter?: "$filter";
|
|
721
|
+
/** Mark type */
|
|
722
|
+
mark: MarkType;
|
|
723
|
+
/** Mark style */
|
|
724
|
+
style?: MarkStyle;
|
|
725
|
+
/**
|
|
726
|
+
* z-index indicating the layer order. Default value is 0.
|
|
727
|
+
* If the value is negative, the mark will be drawn below grid lines.
|
|
728
|
+
*/
|
|
729
|
+
zIndex?: number;
|
|
730
|
+
/** Orientation of bar marks */
|
|
731
|
+
orientation?: "vertical" | "horizontal";
|
|
732
|
+
/** Interpolate method for line and area marks */
|
|
733
|
+
interpolate?: Interpolate;
|
|
734
|
+
/** Width of bar / rect marks */
|
|
735
|
+
width?: Dimension;
|
|
736
|
+
/** Height of bar / rect marks */
|
|
737
|
+
height?: Dimension;
|
|
738
|
+
/** Encoding */
|
|
739
|
+
encoding?: Partial<Record<Attribute, Encoding>>;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare interface MarkdownSpec {
|
|
743
|
+
type: "markdown";
|
|
744
|
+
title?: string;
|
|
745
|
+
content: string;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** Mark style */
|
|
749
|
+
declare interface MarkStyle {
|
|
750
|
+
/** Fill color. If `null`, disable fill. Default is based on mark type. */
|
|
751
|
+
fillColor?: string | null;
|
|
752
|
+
/** Fill opacity */
|
|
753
|
+
fillOpacity?: number;
|
|
754
|
+
/** Stroke color. If `null`, disable stroke. Default is based on mark type. */
|
|
755
|
+
strokeColor?: string | null;
|
|
756
|
+
/** Stroke width */
|
|
757
|
+
strokeWidth?: number;
|
|
758
|
+
/** Stroke opacity */
|
|
759
|
+
strokeOpacity?: number;
|
|
760
|
+
/** Stroke cap */
|
|
761
|
+
strokeCap?: "butt" | "round" | "square";
|
|
762
|
+
/** Stroke join */
|
|
763
|
+
strokeJoin?: "round" | "miter-clip" | "miter" | "bevel";
|
|
764
|
+
/** Paint order */
|
|
765
|
+
paintOrder?: string;
|
|
766
|
+
/** Opacity */
|
|
767
|
+
opacity?: number;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** Mark type */
|
|
771
|
+
declare type MarkType = "bar" | "rect" | "line" | "area" | "point" | "rule";
|
|
772
|
+
|
|
773
|
+
export declare function maxDensityModeCategories(): number;
|
|
774
|
+
|
|
775
|
+
export declare interface OverlayProxy {
|
|
776
|
+
location: (x: number, y: number) => {
|
|
777
|
+
x: number;
|
|
778
|
+
y: number;
|
|
779
|
+
};
|
|
780
|
+
width: number;
|
|
781
|
+
height: number;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/** A point with x and y coordinates. */
|
|
785
|
+
export declare interface Point {
|
|
786
|
+
x: number;
|
|
787
|
+
y: number;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
declare interface PredicatesSpec {
|
|
791
|
+
type: "predicates";
|
|
792
|
+
title?: string;
|
|
793
|
+
items?: {
|
|
794
|
+
name: string;
|
|
795
|
+
predicate: string;
|
|
796
|
+
}[];
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** A rectangle with min, max coordinate for each dimension.
|
|
800
|
+
* It is required that xMin <= xMax and yMin <= yMax. */
|
|
801
|
+
export declare interface Rectangle {
|
|
802
|
+
xMin: number;
|
|
803
|
+
yMin: number;
|
|
804
|
+
xMax: number;
|
|
805
|
+
yMax: number;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
declare type RowClickCallback = (rowId: string) => void;
|
|
809
|
+
|
|
810
|
+
/** Scale */
|
|
811
|
+
declare interface Scale {
|
|
812
|
+
/** Scale type for quantitative scales */
|
|
813
|
+
type?: ScaleType;
|
|
814
|
+
/** Scale domain */
|
|
815
|
+
domain?: DataValue[];
|
|
816
|
+
/** Special values. All represented as strings. */
|
|
817
|
+
specialValues?: string[];
|
|
818
|
+
/** symlog constant. */
|
|
819
|
+
constant?: number;
|
|
820
|
+
/**
|
|
821
|
+
* Scale range. Currently do not apply for x and y scales.
|
|
822
|
+
* For size scales, this should be [min, max] size.
|
|
823
|
+
* For nominal color scales, this should be a list of colors.
|
|
824
|
+
* For quantitative color scales, this should be a predefined interpolate scheme, or a list of colors to interpolate.
|
|
825
|
+
*/
|
|
826
|
+
range?: (string | number)[] | string;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/** Scale type */
|
|
830
|
+
declare type ScaleType = "linear" | "log" | "symlog" | "band";
|
|
831
|
+
|
|
832
|
+
export declare interface Searcher {
|
|
833
|
+
/** Perform a full text search with the given query */
|
|
834
|
+
fullTextSearch?(query: string, options?: {
|
|
835
|
+
limit?: number;
|
|
836
|
+
predicate?: string | null;
|
|
837
|
+
onStatus?: (status: string) => void;
|
|
838
|
+
}): Promise<{
|
|
839
|
+
id: any;
|
|
840
|
+
}[]>;
|
|
841
|
+
/** Perform a vector search with the given query */
|
|
842
|
+
vectorSearch?(query: string, options?: {
|
|
843
|
+
limit?: number;
|
|
844
|
+
predicate?: string | null;
|
|
845
|
+
onStatus?: (status: string) => void;
|
|
846
|
+
}): Promise<{
|
|
847
|
+
id: any;
|
|
848
|
+
distance?: number;
|
|
849
|
+
}[]>;
|
|
850
|
+
/** Find nearest neighbors of the row of the given id */
|
|
851
|
+
nearestNeighbors?(id: any, options?: {
|
|
852
|
+
limit?: number;
|
|
853
|
+
predicate?: string | null;
|
|
854
|
+
onStatus?: (status: string) => void;
|
|
855
|
+
}): Promise<{
|
|
856
|
+
id: any;
|
|
857
|
+
distance?: number;
|
|
858
|
+
}[]>;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** Chart selection */
|
|
862
|
+
declare interface Selection_2_2 {
|
|
863
|
+
encoding: "x" | "y" | "xy";
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/** Field from the data table, can be a column name or a SQL expression */
|
|
867
|
+
declare type SQLField = string | {
|
|
868
|
+
sql: string;
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
/** Table name or SQL expression that produces a table */
|
|
872
|
+
declare type SQLTable = string | {
|
|
873
|
+
sql: string;
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
export declare class Table {
|
|
877
|
+
private component;
|
|
878
|
+
private currentProps;
|
|
879
|
+
constructor(target: HTMLElement, props: TableProps);
|
|
880
|
+
update(props: Partial<TableProps>): void;
|
|
881
|
+
destroy(): void;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export declare interface TableProps {
|
|
885
|
+
/** The Mosaic coordinator. If not specified, the default coordinator from Mosaic's `coordinator()` method will be used. */
|
|
886
|
+
coordinator?: Coordinator | null;
|
|
887
|
+
/** The name of the DuckDB table to create a view for. */
|
|
888
|
+
table: string;
|
|
889
|
+
/** The columns of the table to render. These should match the names of the columns in the DuckDB table you wish to render. */
|
|
890
|
+
columns: string[];
|
|
891
|
+
/** The name of the column used to uniquely identify rows. */
|
|
892
|
+
rowKey: string;
|
|
893
|
+
/** Configure columns.
|
|
894
|
+
*
|
|
895
|
+
* A `ColumnConfigs` is a `Record<string, ColumnConfig>`, where a `ColumnConfig` has the following optional options:
|
|
896
|
+
* - **width** `number` The width of the column, if not provided, a default width will be chosen by the table.
|
|
897
|
+
* - **title** `string` The string to render as the title of the column.
|
|
898
|
+
* - **hidden** `boolean` Whether the column should be hidden from the table.
|
|
899
|
+
*
|
|
900
|
+
* The properties `width` and `hidden` may be modified by the table via UI interactions, with updates provided through the `onColumnConfigsChange` callback.
|
|
901
|
+
*/
|
|
902
|
+
columnConfigs?: ColumnConfigs | null;
|
|
903
|
+
/** A function that will be called whenever the table changes its `columnConfigs`.
|
|
904
|
+
* You can use this to save configurations through sessions. */
|
|
905
|
+
onColumnConfigsChange?: ColumnConfigChangeCallback | null;
|
|
906
|
+
/** Whether to show the row number as column. */
|
|
907
|
+
showRowNumber?: boolean | null;
|
|
908
|
+
/** A function that will be called whenever the table changes its `showRowNumber` value.
|
|
909
|
+
* You can use this to save configurations through sessions. */
|
|
910
|
+
onShowRowNumberChange?: (showRowNumber: boolean) => void;
|
|
911
|
+
/** A Mosaic `Selection` used to filter the table. */
|
|
912
|
+
filter?: Selection_2 | null;
|
|
913
|
+
/** A row's ID to scroll to. When this value is updated, the table will scroll to that row. */
|
|
914
|
+
scrollTo?: any | null;
|
|
915
|
+
/** Light or dark mode. */
|
|
916
|
+
colorScheme?: "light" | "dark" | null;
|
|
917
|
+
/** A theme object, which has the following options:
|
|
918
|
+
*
|
|
919
|
+
* - **primaryTextColor** `string` The text color of elements such as cells.
|
|
920
|
+
* - **secondaryTextColor** `string` The text color of elements such as headers.
|
|
921
|
+
* - **tertiaryTextColor** `string` The text color of elements such as sort buttons.
|
|
922
|
+
* - **fontFamily** `string` The font family of text in the table.
|
|
923
|
+
* - **fontSize** `string` The font size of text in the table.
|
|
924
|
+
* - **primaryBackgroundColor** `string` The background of elements such as headers and even-numbered cells.
|
|
925
|
+
* - **secondaryBackgroundColor** `string` The background of elements such as odd-numbered cells.
|
|
926
|
+
* - **hoverBackgroundColor** `string` The background color of hovered elements such as buttons.
|
|
927
|
+
* - **headerFontFamily** `string` The font family of the header, will fall back to the table's font family.
|
|
928
|
+
* - **headerFontSize** `string` The font size of the header, will fall back to the table's font size.
|
|
929
|
+
* - **cellFontFamily** `string` The font family of the cells, will fall back to the table's font family.
|
|
930
|
+
* - **cellFontSize** `string` The font size of the cells, will fall back to the table's font size.
|
|
931
|
+
* - **scrollbarBackgroundColor** `string` The background color of the scrollbars.
|
|
932
|
+
* - **scrollbarPillColor** `string` The background color of the scrollbar pills.
|
|
933
|
+
* - **scrollbarLabelBackgroundColor** `string` The background color of the vertical scrollbar label.
|
|
934
|
+
* - **shadow** `string` The shadow of elements such as overlays.
|
|
935
|
+
* - **outlineColor** `string` The outline of elements such as overlays.
|
|
936
|
+
* - **dimmedRowColor** `string` The overlay color for dimmed rows when highlighted rows are present in the table.
|
|
937
|
+
* - **rowScrollToColor** `string` The color of rows will flash when they're scrolled to using the `scrollTo` property of the table.
|
|
938
|
+
* - **rowHoverColor** `string` The color of rows when they're hovered, enabled through the `showHoveredRow` property of the table.
|
|
939
|
+
*
|
|
940
|
+
* These values can be css variables if you wish to use css defined custom properties. For example: `{ primaryTextColor: "var(--my-color-variable)" }`.
|
|
941
|
+
*
|
|
942
|
+
* You can also provide these options as `light` and `dark` properties, which will control the appearance of the table depending on its `colorScheme`. For example:
|
|
943
|
+
*
|
|
944
|
+
* ```ts
|
|
945
|
+
* {
|
|
946
|
+
* light: {
|
|
947
|
+
* primaryTextColor: "black";
|
|
948
|
+
* }
|
|
949
|
+
* dark: {
|
|
950
|
+
* primaryTextColor: "white";
|
|
951
|
+
* }
|
|
952
|
+
* }
|
|
953
|
+
* ```
|
|
954
|
+
*/
|
|
955
|
+
theme?: Theme | null;
|
|
956
|
+
/** The height of each line of text, in pixels. Defaults to `20`. */
|
|
957
|
+
lineHeight?: number | null;
|
|
958
|
+
/** The number of lines of text to show in each row. Defaults to `3`. */
|
|
959
|
+
numLines?: number | null;
|
|
960
|
+
/** You can use this to designate custom renderers for columns. A `CustomCellsConfig` is a `{ [column: string]: CustomCell }`. */
|
|
961
|
+
customCells?: CustomCellsConfig | null;
|
|
962
|
+
/** You can use this to designate additional content for column headers.
|
|
963
|
+
* Additional header content is rendered above the title of the header, and can
|
|
964
|
+
* be used to add helpful content such as summaries and visualizations to headers.
|
|
965
|
+
* A `AdditionalHeaderContentsConfig` is a `{ [column: string]: AdditionalHeaderContent }`. */
|
|
966
|
+
additionalHeaderContents?: AdditionalHeaderContentsConfig | null;
|
|
967
|
+
/** The height of the header, in pixels. Defaults to an auto height based on rendered title. */
|
|
968
|
+
headerHeight?: number | null;
|
|
969
|
+
/** A handler for rows being clicked, which can be used to coordinate with other views. */
|
|
970
|
+
onRowClick?: RowClickCallback | null;
|
|
971
|
+
/** When provided, these all other rows will be dimmed in the table. */
|
|
972
|
+
highlightedRows?: any[] | null;
|
|
973
|
+
/** Whether to highlight the hovered row. */
|
|
974
|
+
highlightHoveredRow?: boolean | null;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
declare interface TableSpec {
|
|
978
|
+
type: "table";
|
|
979
|
+
title: string;
|
|
980
|
+
columns: string[];
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
declare type Theme = ThemeConfig_2 & {
|
|
984
|
+
dark?: ThemeConfig_2;
|
|
985
|
+
light?: ThemeConfig_2;
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
declare type ThemeConfig = Partial<EmbeddingViewTheme> & {
|
|
989
|
+
/** Overrides for light mode. */
|
|
990
|
+
dark?: Partial<EmbeddingViewTheme>;
|
|
991
|
+
/** Overrides for dark mode. */
|
|
992
|
+
light?: Partial<EmbeddingViewTheme>;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
declare interface ThemeConfig_2 {
|
|
996
|
+
primaryTextColor?: string;
|
|
997
|
+
secondaryTextColor?: string;
|
|
998
|
+
tertiaryTextColor?: string;
|
|
999
|
+
fontFamily?: string;
|
|
1000
|
+
fontSize?: string;
|
|
1001
|
+
primaryBackgroundColor?: string;
|
|
1002
|
+
secondaryBackgroundColor?: string;
|
|
1003
|
+
tertiaryBackgroundColor?: string;
|
|
1004
|
+
hoverBackgroundColor?: string;
|
|
1005
|
+
headerFontFamily?: string;
|
|
1006
|
+
headerFontSize?: string;
|
|
1007
|
+
cellFontFamily?: string;
|
|
1008
|
+
cellFontSize?: string;
|
|
1009
|
+
scrollbarBackgroundColor?: string;
|
|
1010
|
+
scrollbarPillColor?: string;
|
|
1011
|
+
scrollbarLabelBackgroundColor?: string;
|
|
1012
|
+
shadow?: string;
|
|
1013
|
+
outlineColor?: string;
|
|
1014
|
+
dimmedRowColor?: string;
|
|
1015
|
+
rowScrollToColor?: string;
|
|
1016
|
+
rowHoverColor?: string;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
export declare interface UMAP {
|
|
1020
|
+
/** The current epoch number */
|
|
1021
|
+
get epoch(): number;
|
|
1022
|
+
|
|
1023
|
+
/** The input dimension */
|
|
1024
|
+
get inputDim(): number;
|
|
1025
|
+
|
|
1026
|
+
/** The output dimension */
|
|
1027
|
+
get outputDim(): number;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Get the current embedding.
|
|
1031
|
+
* The resulting Float32Array points to WASM internal memory.
|
|
1032
|
+
* If you need to use the data outside this library or after further
|
|
1033
|
+
* interaction with this library, make sure to create a copy
|
|
1034
|
+
* of the array, as the underlying memory may change.
|
|
1035
|
+
*/
|
|
1036
|
+
get embedding(): Float32Array;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Run the UMAP algorithm until reaching `epochLimit` epochs,
|
|
1040
|
+
* or to completion if `epochLimit` is not specified.
|
|
1041
|
+
* @param epochLimit the epoch number to run to
|
|
1042
|
+
*/
|
|
1043
|
+
run(epochLimit?: number): void;
|
|
1044
|
+
|
|
1045
|
+
/** Destroy the instance and release resources */
|
|
1046
|
+
destroy(): void;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/** UMAP options */
|
|
1050
|
+
export declare interface UMAPOptions {
|
|
1051
|
+
/** The input distance metric */
|
|
1052
|
+
metric?: "euclidean" | "cosine";
|
|
1053
|
+
|
|
1054
|
+
/** The nearest neighbor method. By default we use HNSW with its default parameters. */
|
|
1055
|
+
knnMethod?: "hnsw" | "nndescent" | "vptree";
|
|
1056
|
+
|
|
1057
|
+
/** The initialization method. By default we use spectral initialization. */
|
|
1058
|
+
initializeMethod?: "spectral" | "random" | "none";
|
|
1059
|
+
|
|
1060
|
+
localConnectivity?: number;
|
|
1061
|
+
bandwidth?: number;
|
|
1062
|
+
mixRatio?: number;
|
|
1063
|
+
spread?: number;
|
|
1064
|
+
minDist?: number;
|
|
1065
|
+
a?: number;
|
|
1066
|
+
b?: number;
|
|
1067
|
+
repulsionStrength?: number;
|
|
1068
|
+
nEpochs?: number;
|
|
1069
|
+
learningRate?: number;
|
|
1070
|
+
negativeSampleRate?: number;
|
|
1071
|
+
nNeighbors?: number;
|
|
1072
|
+
/** The random seed. */
|
|
1073
|
+
seed?: number;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/** A state describing the viewport's pan and zoom state.
|
|
1077
|
+
* The screen coordinate of a point is calculated as follows:
|
|
1078
|
+
* px = ((x - viewport.x) * viewport.scale + 1) / 2 * width
|
|
1079
|
+
* py = ((y - viewport.y) * viewport.scale + 1) / 2 * height
|
|
1080
|
+
*/
|
|
1081
|
+
export declare interface ViewportState {
|
|
1082
|
+
/** The x coordinate of the center of the viewport in data units. */
|
|
1083
|
+
x: number;
|
|
1084
|
+
/** The y coordinate of the center of the viewport in data units. */
|
|
1085
|
+
y: number;
|
|
1086
|
+
/** The scale of the viewport. This scales data units to [-1, 1]. */
|
|
1087
|
+
scale: number;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/** Widget for editing a chart */
|
|
1091
|
+
declare type Widget = {
|
|
1092
|
+
type: "scale.type";
|
|
1093
|
+
channel: Channel;
|
|
1094
|
+
} | {
|
|
1095
|
+
type: "encoding.normalize";
|
|
1096
|
+
layer: number | number[];
|
|
1097
|
+
attribute: Attribute;
|
|
1098
|
+
options: ("x" | "y")[];
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
export { }
|