import { Coordinator } from '@uwdata/mosaic-core'; import { JSONSchema7 } from 'json-schema'; import { Readable } from 'svelte/store'; import { Selection as Selection_3 } from '@uwdata/mosaic-core'; declare interface AdditionalTable { /** The row id column of this table. */ id: string; /** How this table joins to the main (primary) table, used for cross-table filtering. */ relation?: { /** * Join-key expression over the MAIN table's columns. Defaults to the main table's `id`. * Wrap in `UNNEST(...)` when the key is list-valued (e.g. a list/struct-list column → many-to-many). */ mainKey?: string; /** * Join-key expression over THIS table's columns. Defaults to this table's `id`. * Wrap in `UNNEST(...)` when the key is list-valued. */ key?: string; }; } declare type AggregateFn = "count" | "distinct" | "min" | "max" | "mean" | "average" | "median" | "stdev" | "stdevp" | "variance" | "variancep" | "sum" | "product" | "quantile" | "ecdf-value" | "ecdf-rank"; /** Mark attribute */ declare type Attribute = "x" | "y" | "x1" | "x2" | "y1" | "y2" | "color" | "size" | "group"; declare interface Axis { /** Axis title */ title?: string; /** Values for ticks, grid lines, and labels */ values?: any[]; /** Desired number of ticks. Default 5. */ desiredTickCount?: number; /** Extend scale to ticks. Default true. */ extendScaleToTicks?: boolean; /** Padding to label */ labelPadding?: number; /** Label font family */ labelFontFamily?: string; /** Label font size */ labelFontSize?: number; /** Label max width */ labelMaxWidth?: number; } export declare type BuiltinChartSpec = ChartSpec | ContentViewerSpec | CountPlotSpec | EmbeddingSpec | InstancesSpec | FeaturesListSpec | MarkdownSpec | ParallelCoordinatesSpec | PredicatesSpec; declare interface Cache_2 { /** Gets an object from the cache with the given key. Returns `null` if the entry is not found. */ get(key: string): Promise; /** Sets an object to the cache with the given key */ set(key: string, value: any): Promise; } export { Cache_2 as Cache } declare interface Cache_2_2 { get: (key: string) => Promise; set: (key: string, value: any) => Promise; } /** Encoding channel */ declare type Channel = "x" | "y" | "color" | "size"; /** Chart specification */ declare interface ChartSpec { /** The title of the chart */ title?: string; /** Size configuration */ plotSize?: { /** Width of the plot area */ width?: number; /** Height of the plot area */ height?: number; /** Aspect ratio of the plot area */ aspectRatio?: number; }; /** Layers */ layers?: Layer[]; /** Scale configurations */ scale?: Partial>; /** Axis configurations */ axis?: Partial>; /** Selections */ selection?: Record; /** Widgets */ widgets?: Widget[]; } declare interface ChartTheme { scheme: "light" | "dark"; /** Default interpolate for continuous color scales */ interpolate: string | string[] | ((v: number) => string); /** Category color scheme */ categoryColors: string[] | ((count: number) => string[]); /** Ordinal color scheme */ ordinalColors: string[] | ((count: number) => string[]); /** Color for the '(other)' category */ otherColor: string; /** Color for the '(null)' category */ nullColor: string; /** Mark color */ markColor: string; markColorFade: string; markColorGray: string; markColorGrayFade: string; ruleColor: string; /** Embedding view point / contour color when there is no color encoding */ embeddingColor: string; /** Grid color */ gridColor: string; /** Label color */ labelColor: string; labelFontFamily: string; labelFontSize: number; labelMaxWidth: number; /** Border of the brush selection */ brushBorder: string; /** Back border of the brush selection */ brushBorderBack: string; /** Fill color of the brush selection */ brushFill: string; } declare type ChartThemeConfig = Partial & { light?: Partial; dark?: Partial; }; /** A resulting cluster from the find clusters function */ export declare interface Cluster { /** Cluster identifier */ identifier: number; /** The total density */ sumDensity: number; /** The mean x location (weighted by density) */ meanX: number; /** The mean y location (weighted by density) */ meanY: number; /** The maximum density */ maxDensity: number; /** The location with the maximum density */ maxDensityLocation: [number, number]; /** The number of pixels in the cluster */ pixelCount: number; /** The cluster's boundary represented as a list of polygons */ boundary?: [number, number][][]; /** The cluster's boundary approximated with a list of rectangles, each rectangle is given as an array `[x1, y1, x2, y2]` */ boundaryRectApproximation?: [number, number, number, number][]; } /** A type describing how to display a column in the table, tooltip, and search results */ declare interface ColumnStyle { /** * The renderer name. Builtin options: * - "markdown": Render the value as Markdown * - "liquid-template": Render the value with a Liquid template (rendered with liquidjs). Options: template (string): the template, default to "{{ value }}". * - "image": Render an image. Options: size (number): the max width/height of the image. * - "url": Render the value as a link * - "json": Render the value as a JSON string * - "messages": Render chat messages (OpenAI format) */ renderer?: string; /** Options passed to the renderer class as props */ options?: Record; /** Display style in the tooltip */ display?: "full" | "badge" | "hidden"; } declare interface ContentViewerSpec { type: "content-viewer"; title?: string; field: string; } declare interface CountPlotSpec { type: "count-plot"; title?: string; data: { /** The data field */ field: SQLField; /** Indicate if the field contains list[str] data, default false */ isList?: boolean; }; /** The max number of categories to show, default 10 */ limit?: number; /** Labeling method, '%': percentage, '#': count, '#/#': selected count over total count */ labels?: "%" | "#" | "#/#"; /** Order the categories by total count, selected count, alphabetical, or custom order, default 'total-descending' */ order?: "total-descending" | "total-ascending" | "selected-descending" | "selected-ascending" | "alphabetical" | string[]; /** The width of the category column */ categoryWidth?: number; } /** * Create an NNDescent nearest neighbor index. * @param count the number of data points * @param inputDim the input dimension * @param data the data array. Must be a Float32Array with count * inputDim elements. * @param options options */ export declare function createNNDescent( count: number, inputDim: number, data: Float32Array, options?: NNDescentOptions, ): Promise; /** * Initialize a UMAP instance. * @param count the number of data points * @param inputDim the input dimension * @param outputDim the output dimension * @param data the data array. Must be a Float32Array with count * inputDim elements. * @param options options */ export declare function createUMAP( count: number, inputDim: number, outputDim: number, data: Float32Array, options?: UMAPOptions, ): Promise; /** * Build a UMAP instance from a precomputed kNN graph, skipping the internal * nearest-neighbor search. No high-dimensional data is needed — once the graph * exists, UMAP uses only it. The returned instance is the same {@link UMAP} as * {@link createUMAP} (its `inputDim` is reported as 0 since no vectors were given). * * `knnIndices` and `knnDistances` are row-major with `count * k` elements; row `i` * lists the neighbors of point `i` sorted by ascending distance. The point itself * may appear in column 0 (distance 0) or be omitted — this is detected and * normalized per row. * * Caller's contract (the graph is not validated beyond an index-range check, and * bad input degrades silently rather than throwing): every index must be valid * (`0 <= idx < count`); point `i` may appear in its own row at most once; distances * must be finite (a `NaN` propagates to a `NaN` embedding); and the neighbor count * must be uniform across rows — the effective `k` is the per-row minimum, so a * single short row trims every row down to its length. * * @param count the number of data points * @param outputDim the output dimension * @param knnIndices row-major neighbor indices, length count * k * @param knnDistances row-major neighbor distances, length count * k (same shape) * @param options layout options */ export declare function createUMAPFromKNN( count: number, outputDim: number, knnIndices: Int32Array, knnDistances: Float32Array, options?: UMAPFromKNNOptions, ): Promise; export declare type CustomComponent = { class: CustomComponentClass; props?: Record; } | CustomComponentClass; declare type CustomComponentClass = new (node: N, props: P) => { update?: (props: P) => void; destroy?: () => void; }; declare type CustomComponentClass_2 = new (node: N, props: P) => { update?: (props: P) => void; destroy?: () => void; }; export declare type DataField = string | { sql: string; }; export declare interface DataPoint { x: number; y: number; category?: number; text?: string; identifier?: DataPointID; fields?: Record; } export declare type DataPointID = string | number | bigint; /** Data value (a value in the data domain, which can be mapped to the visual domain through a scale) */ declare type DataValue = string | number | [number, number]; export declare function defaultCategoryColors(count: number): string[]; /** Returns a list of default charts for a given data table. */ export declare function defaultCharts(options: { coordinator: Coordinator; table: string; id: string; projection?: { x: string; y: string; text?: string; image?: string; importance?: string; neighbors?: string; }; features?: string; config?: DefaultChartsConfig; }): Promise; declare interface DefaultChartsConfig { /** If specified, only include the given columns */ include?: string[]; /** Columns to exclude, applicable if `include` is not specified */ exclude?: string[]; /** Override the chart spec for certain columns. If the override is set to `null` the column will be skipped */ override?: Record; /** Set to false to disable the instances table, or an object to override spec properties */ table?: boolean | Partial; /** Set to false to disable the embedding view, or an object to override spec properties */ embedding?: boolean | Partial; } /** Mark dimension for width and height */ declare type Dimension = { gap: number; clampToRatio?: number; } | { ratio: number; } | number; export declare const EmbeddingAtlas: (props: EmbeddingAtlasProps) => any; export declare interface EmbeddingAtlasProps { /** The Mosaic coordinator. */ coordinator: Coordinator; /** The data source. */ data: { /** The name of the data table. */ table: string; /** The column for unique row identifiers. */ id: string; /** The X and Y columns for the embedding projection view. */ projection?: { x: string; y: string; } | null; /** * The column for pre-computed nearest neighbors. * Each value in the column should be a dictionary with the format: `{ "ids": [id1, id2, ...], "distances": [distance1, distance2, ...] }`. * `"ids"` should be an array of row ids (as given by the `idColumn`) of the neighbors, sorted by distance. * `"distances"` should contain the corresponding distances to each neighbor. */ neighbors?: string | null; /** The column for text. The text will be used as content for the tooltip and search features. */ text?: string | null; /** The column for image data. Used with `importance` to select representative images for cluster labels. */ image?: string | null; /** The column for importance scores (e.g., PageRank, centrality). Used with `image` to select representative images for cluster labels. */ importance?: string | null; /** The column for features. If available, a features list view will be created by default. */ features?: string | null; }; /** Additional data tables. */ additionalTables?: Record; /** The color scheme. */ colorScheme?: "light" | "dark" | null; /** The initial viewer state. */ initialState?: EmbeddingAtlasState | null; /** * Configure the default charts. * By default, we show a distribution chart for each column based on the data type in addition to the embedding and table. * You may configure these charts with this option. */ defaultChartsConfig?: DefaultChartsConfig | null; /** Configuration for the embedding view. See docs for the EmbeddingView. */ embeddingViewConfig?: EmbeddingViewConfig | null; /** Labels for the embedding view. */ embeddingViewLabels?: Label[] | null; /** Theme config for charts. */ chartTheme?: ChartThemeConfig | null; /** Custom CSS stylesheet to apply at the root of the component. */ stylesheet?: string | null; /** * An object that provides search functionalities, including full text search, vector search, and nearest neighbor queries. * If not specified (undefined), a default full-text search with the text column will be used. * If set to null, search will be disabled. */ searcher?: Searcher | null; /** A callback to export the currently selected points. */ onExportSelection?: ((predicate: string | null, format: "json" | "jsonl" | "csv" | "parquet") => Promise) | null; /** A callback to download the application as archive. */ onExportApplication?: (() => Promise) | null; /** A callback when the state of the viewer changes. You may serialize the state to JSON and load it back. */ onStateChange?: ((state: EmbeddingAtlasState) => void) | null; /** A callback when the current filter predicate changes (e.g., due to brush or click interactions). */ onPredicateChange?: ((predicate: string | null) => void) | null; /** Model context API where the component will register its tools to. */ modelContext?: ModelContextAPI | null; /** A cache to speed up initialization of the viewer. */ cache?: Cache_2 | null; /** * An array of row IDs to highlight on the embedding view. * The highlight is synchronized with the internal highlight store, so highlighted * points are also reflected in other coordinated views (e.g., the instances view). * Pass null or an empty array to clear the highlight. */ highlight?: RowID[] | null; } export declare interface EmbeddingAtlasState { /** The version of Embedding Atlas that created this state. If omitted, assume the current version. */ version?: string; /** The list of charts. */ charts?: Record; /** The state of all charts, stored as a map of id to chart state. */ chartStates?: Record; /** The current layout, if undefined, use the default layout. */ currentLayout?: string; /** The layouts, stored as a map of layout id to layout spec. */ layouts?: Record; /** The order of the layouts. */ layoutOrder?: string[]; /** Column display and rendering styles. */ columnStyles?: Record; } declare interface EmbeddingSpec { type: "embedding"; title?: string; data: { /** The data table, leave undefined for the default table. */ table?: string; /** The row id column, must be set when using a non-default table. */ id?: string; x: string; y: string; text?: string | null; image?: string | null; importance?: string | null; category?: string | null; neighbors?: string | null; }; mode?: "points" | "density"; minimumDensity?: number; pointSize?: number; /** Maximum number of points to render (for downsampling). Default: 4000000. Set to null to disable. */ downsampleMaxPoints?: number | null; config?: EmbeddingViewConfig; } export declare const EmbeddingView: (props: EmbeddingViewProps) => any; export declare interface EmbeddingViewConfig { /** Color scheme. */ colorScheme?: "light" | "dark" | null; /** View mode. */ mode?: "points" | "density" | null; /** Minimum average density for density contours to show up. * The density is measured as number of points per square points (aka., px in CSS units). */ minimumDensity?: number | null; /** Override the automatically calculated point size. * If not specified, point size is calculated based on density. */ pointSize?: number | null; /** Generate labels automatically. * By default labels are generated automatically if the `labels` prop is not specified, * and a `text` column is specified in the Mosaic view, * or a `queryClusterLabels` callback is specified in the non-Mosaic view. * Set this to `false` to disable automatic labels. */ autoLabelEnabled?: boolean | null; /** The density threshold to filter the clusters before generating automatic labels. * The value is relative to the max density. */ autoLabelDensityThreshold?: number | null; /** The stop words for automatic label generation. By default use NLTK stop words. */ autoLabelStopWords?: string[] | null; /** Approximate maximum number of points to render when downsampling is active. * Points are sampled with bias toward sparse regions (fewer points kept in dense areas). * The sampling probability is given by this formula: * P(i) = (downsampleMaxPoints / numPointsInViewport) * (2 / (1 + density(p_i) / maxDensity * downsampleDensityWeight)) * Default: 4,000,000. Set to null or Infinity to disable downsampling. */ downsampleMaxPoints?: number | null; /** Density weight for downsampling (0-10). * Higher values mean more aggressive culling in dense areas. * Default: 5 */ downsampleDensityWeight?: number | null; } export declare const EmbeddingViewMosaic: (props: EmbeddingViewMosaicProps) => any; export declare interface EmbeddingViewMosaicProps { /** The Mosaic coordinator. * If not specified, the default coordinator from Mosaic's `coordinator()` method will be used. */ coordinator?: Coordinator; /** The data table name. */ table: string; /** The x column name. */ x: string; /** The y column name. */ y: string; /** The name of the category column. * The categories should be represented as integers starting from 0. * If you have categories represented as strings, you should first convert them to 0-indexed integers. */ category?: string | null; /** The name of the text column. * If specified, the default tooltip shows the text content. * The text content is also used to generate labels automatically. */ text?: string | null; /** The name of the image column. * If specified along with `importance`, cluster labels will display the highest-importance image per region. */ image?: string | null; /** The name of the importance score column (e.g., PageRank, centrality). * Used together with `image` to select representative images for cluster labels. */ importance?: string | null; /** The name of the identifier (aka., id) column. * If specified, the `selection` object will contain an `identifier` property that you can use to identify the point. */ identifier?: string | null; /** Additional fields for the tooltip data element. * Each field can be specified as a column name or a SQL expression. */ additionalFields?: Record | null; /** The colors for the categories. * Category `i` will use the `i`-th color from this list. * If not specified, default colors will be used. */ categoryColors?: string[] | null; /** A Mosaic `Selection` object to filter the contents of this view. */ filter?: Selection_3 | null; /** Labels to display on the embedding view. * Each label must have `x`, `y`, and `text` properties, * and optionally `level` and `priority`. */ labels?: Label[] | null; /** The width of the view. */ width?: number | null; /** The height of the view. */ height?: number | null; /** The pixel ratio of the view. */ pixelRatio?: number | null; /** Configure the theme of the view. */ theme?: ThemeConfig | null; /** Configure the embedding view. */ config?: EmbeddingViewConfig | null; /** The viewport state. * You may use this to share viewport state across multiple views. * If undefined or set to `null`, the view will use a default viewport state. * To listen to viewport state change, use `onViewportState`. */ viewportState?: ViewportState | null; /** The current tooltip. * The tooltip is an object with the following fields: `x`, `y`, `category`, * `text`, `identifier`. * * You may pass the identifier for the data point (`DataPointID`), or a `DataPoint` * object, or a Mosaic `Selection`. If an id or a `DataPoint` object is specified, * you will need to use `onTooltip` to listen to tooltip changes; if a Mosaic * `Selection` is used, the selection will be updated when tooltip is triggered. */ tooltip?: Selection_3 | DataPoint | DataPointID | null; /** The current single or multiple point selection. * * You may pass an array of `DataPointID` or `DataPoint` objects, or a Mosaic * `Selection`. If `DataPointID[]` or `DataPoint[]` is specified, you will need * to use `onSelection` to listen to selection changes; if a Mosaic `Selection` * is used, the selection will be updated with the appropriate predicates. */ selection?: Selection_3 | DataPoint[] | DataPointID[] | null; /** A Mosaic `Selection` object to capture the component's range selection. */ rangeSelection?: Selection_3 | null; /** The rectangle or polygon that drives the range selection. Setting this * changes the current range selection and also affects the selection passed * in `rangeSelection`. Use `onRangeSelection` to listen for changes to this * rectangle. */ rangeSelectionValue?: Rectangle | Point[] | null; /** A callback for when `viewportState` changes. */ onViewportState?: ((value: ViewportState) => void) | null; /** A callback for when `tooltip` changes. */ onTooltip?: ((value: DataPoint | null) => void) | null; /** A callback for when `selection` changes. */ onSelection?: ((value: DataPoint[] | null) => void) | null; /** A callback for when `rangeSelection` changes. */ onRangeSelection?: ((value: Rectangle | Point[] | null) => void) | null; /** A custom renderer to draw the tooltip content. */ customTooltip?: CustomComponent | null; /** A custom renderer to draw overlay on top of the embedding view. */ customOverlay?: CustomComponent | null; /** A cache for intermediate results. */ cache?: Cache_2_2 | null; } export declare interface EmbeddingViewProps { /** The data. */ data: { /** An array of X coordinates, must be a `Float32Array`. */ x: Float32Array; /** An array of Y coordinates, must be a `Float32Array`. */ y: Float32Array; /** An array of category indices, must be a `Uint8Array`. */ category?: Uint8Array | null; }; /** The colors for the categories. * Category `i` will use the `i`-th color from this list. * If not specified, default colors will be used. */ categoryColors?: string[] | null; /** Labels to display on the embedding view. * Each label must have `x`, `y`, and `text` properties, * and optionally `level` and `priority`. */ labels?: Label[] | null; /** The width of the view. */ width?: number | null; /** The height of the view. */ height?: number | null; /** The pixel ratio of the view. */ pixelRatio?: number | null; /** Configure the theme of the view. */ theme?: ThemeConfig | null; /** Configure the embedding view. */ config?: EmbeddingViewConfig | null; /** The viewport state. * You may use this to share viewport state across multiple views. * If undefined or set to `null`, the view will use a default viewport state. * To listen to viewport state change, use `onViewportState`. */ viewportState?: ViewportState | null; /** The current tooltip. * The tooltip is an object with the following fields: `x`, `y`, `category`, `text`, `identifier`. * To listen for a tooltip change, use `onTooltip`. */ tooltip?: DataPoint | null; /** The current single or multiple point selection. * Selection is triggered by clicking on the points (shift/cmd+click will toggle points). * The selection is an array of objects with the following fields: `x`, `y`, `category`, `text`, `identifier`. * To listen to selection change, use `onSelection`. */ selection?: DataPoint[] | null; /** A rectangle or a polygon (list of points) that represents the range selection. * If the value is a list of points, it is interpreted as a lasso selection * with a closed polygon with the list of points as vertices. */ rangeSelection?: Rectangle | null; /** A callback for when `viewportState` changes. */ onViewportState?: ((value: ViewportState) => void) | null; /** A callback for when `tooltip` changes. */ onTooltip?: ((value: DataPoint | null) => void) | null; /** A callback for when `selection` changes. */ onSelection?: ((value: DataPoint[] | null) => void) | null; /** A callback for when `rangeSelection` changes. */ onRangeSelection?: ((value: Rectangle | Point[] | null) => void) | null; /** An async function that returns a data point near the given (x, y) location. * The `unitDistance` parameter is the distance of a single pixel in data domain. * You can use this to determine the distance threshold for selecting a point. */ querySelection?: ((x: number, y: number, unitDistance: number) => Promise) | null; /** An async function that returns labels for a list of clusters. * Each cluster is given as a list of rectangles that approximately cover the region. */ queryClusterLabels?: ((clusters: Rectangle[][]) => Promise<(LabelContent | null)[]>) | null; /** A custom renderer to draw the tooltip content. */ customTooltip?: CustomComponent | null; /** A custom renderer to draw overlay on top of the embedding view. */ customOverlay?: CustomComponent | null; /** A cache for intermediate results. */ cache?: Cache_2_2 | null; } export declare interface EmbeddingViewTheme { /** The font family for texts. */ fontFamily: string; /** Color for cluster labels. */ clusterLabelColor: string; /** Color for cluster labels' outline. */ clusterLabelOutlineColor: string; /** Opacity for cluster labels. */ clusterLabelOpacity: number; /** Whether to show the status bar at the bottom. */ statusBar: boolean; /** Color for status bar text. */ statusBarTextColor: string; /** Color for status bar background. */ statusBarBackgroundColor: string; /** Branding link. */ brandingLink: { text: string; href: string; } | null; } /** Encoding */ declare type Encoding = { /** The data field to encode */ field: SQLField; bin?: { /** Desired bin count */ desiredCount?: number; }; } | { /** Aggregate type */ aggregate: AggregateFn | { sql: string; }; /** The data field for the aggregate */ field?: SQLField; /** For "quantile" aggregate, the quantile value (0-1) */ quantile?: number; /** Normalize the value by x or y */ normalize?: "x" | "y"; } | { /** The data value to encode */ value: DataValue; }; declare interface FeaturesListSpec { type: "features-list"; title?: string; data: { /** * The features column. Either: * - string[]: a list of feature strings. Every feature is assigned source "default". * - struct[]: a list of structs, one per feature, each `{ feature: string, source?: string, index?: number }`. * - feature: The feature string (required). * - source: The source of the feature, could be a column name, or "prompt", "response", "tool_result", etc. * If missing/NULL, defaults to "default". * - index: For multi-turn conversations, the turn index. Currently unused. * * The column type (string[] vs struct[]) is detected at runtime. */ features: SQLField; /** If specified, show a prediction view where features are scored by how well they predict an outcome. */ predict?: SQLField; }; /** Metadata for features. */ metadata?: { /** The metadata table */ table: SQLTable; /** The feature name column, should be string. */ feature: SQLField; /** The description column. */ description?: SQLField; /** The topics column if available, should be string[]. A feature can be assigned any number of topics. Topics may overlap. */ topics?: SQLField; }; /** Sort order of the feature list */ sort?: "frequency-ascending" | "frequency-descending" | "predictiveness-ascending" | "predictiveness-descending" | "source-skew-ascending" | "source-skew-descending" | "alphabetical"; /** * Limit the number of features shown, default 100. * Limit is applied after search and sort. */ limit?: number; /** * Show features only from the specified sources if specified. Otherwise show all features. * All counts and predictiveness should be computed from the specified sources. */ sources?: string[]; /** Group the features list by topics if specified. Note that a feature may appear in more than one topic. */ groupBy?: "topics"; /** Segment bars by source if specified. */ segmentBy?: "source"; } /** * Find clusters from a density map * @param density_map the density map, a `Float32Array` with `width * height` elements * @param width the width of the density map * @param height the height of the density map * @param options algorithm options * @returns */ export declare function findClusters( densityMap: Float32Array, width: number, height: number, options?: Partial, ): Promise; /** Options of the find clusters function */ export declare interface FindClustersOptions { /** The threshold for unioning two clusters */ unionThreshold: number; } declare interface InstancesSpec { type: "instances"; title?: string; /** * Columns to show in the instance view. * If specified, the table and card views will be limited to the given columns, and custom card template will only receive the given columns as data. * If not specified, include all columns from the dataset (or query result is `query` is specified). */ columns?: string[]; /** Sort order. If not specified, use original data order. */ sort?: SortOrder; /** View mode, defaults to "table" */ viewMode?: "table" | "cards"; /** Optional custom SQL query to filter or transform the data */ query?: string; /** Number of items per page, defaults to 100 */ pageSize?: number; /** Default height in pixels, defaults to 500. This value is used when the view's height is flexible. */ defaultHeight?: number; /** Column styles specific to this instance view. These will override global column styles. */ columnStyles?: Record; /** * Liquid template for the cards (rendered with liquidjs). If not specified, uses the default card with column styles. * The card will be placed in a
container with a border and rounded corner, but no padding — add your own padding to the root element. * * Each column value is available as a template variable (e.g. `{{ title }}`, `{{ price }}`). * * To support dark mode, use CSS custom properties defined in a *
{{ title }}
*
* ``` * The `.dark` class is applied to an ancestor element when dark mode is active. Use `:is(.dark *)` for reliable matching regardless of DOM depth. */ cardTemplate?: string; } /** Interpolate method for line or area */ declare type Interpolate = "linear" | "cardinal" | "catmull-rom" | "natural" | "monotone" | "basis" | "step" | "step-before" | "step-after"; export declare interface Label { /** X coordinate. */ x: number; /** Y coordinate. */ y: number; /** Label content: a text string or an image reference. */ content: LabelContent; /** Label level. The label will be shown around 2^level zoom factor. */ level?: number | null; /** Placement priority. */ priority?: number | null; } /** The content of a label: either a text string or an image with display dimensions (and optionally x, y coordinates). */ declare type LabelContent = string | { x?: number; y?: number; image: string; width: number; height: number; }; declare interface Layer { /** Data source, default to the main data table */ from?: SQLTable; /** Filter the data. Use $filter to refer to the shared filter (a cross-filter) */ filter?: "$filter"; /** Mark type */ mark: MarkType; /** Mark style */ style?: MarkStyle; /** * z-index indicating the layer order. Default value is 0. * If the value is negative, the mark will be drawn below grid lines. */ zIndex?: number; /** Orientation of bar marks */ orientation?: "vertical" | "horizontal"; /** Interpolate method for line and area marks */ interpolate?: Interpolate; /** Width of bar / rect marks */ width?: Dimension; /** Height of bar / rect marks */ height?: Dimension; /** Size (area) of point marks, default 100. */ size?: number; /** Encoding */ encoding?: Partial>; } declare interface MarkdownSpec { type: "markdown"; title?: string; content: string; } /** * Mark style * * For colors such as fillColor, strokeColor, you may use colors from the theme with a $ prefix, including: * - $markColor * - $markColorFade * - $markColorGray * - $markColorGrayFade * - $ruleColor * - $gridColor * - $labelColor */ declare interface MarkStyle { /** Fill color. If `null`, disable fill. Default is based on mark type. */ fillColor?: string | null; /** Fill opacity */ fillOpacity?: number; /** Stroke color. If `null`, disable stroke. Default is based on mark type. */ strokeColor?: string | null; /** Stroke width */ strokeWidth?: number; /** Stroke opacity */ strokeOpacity?: number; /** Stroke cap */ strokeCap?: "butt" | "round" | "square"; /** Stroke join */ strokeJoin?: "round" | "miter" | "bevel"; /** Paint order, default is `fill stroke`, fill first, then stroke. */ paintOrder?: "fill stroke" | "stroke fill"; /** Opacity */ opacity?: number; } /** Mark type */ declare type MarkType = "bar" | "rect" | "line" | "area" | "point" | "rule"; export declare function maxDensityModeCategories(): number; declare interface MCPContext { tools?: MCPTool[]; } /** Tool definition interface */ declare interface MCPTool { /** Unique name for the tool */ name: string; /** The title of the tool */ title?: string; /** Natural language description of what the tool does */ description: string; /** JSON Schema defining the input parameters */ inputSchema: JSONSchema7; /** JSON Schema defining the output parameters */ outputSchema?: JSONSchema7; /** Function that implements the tool and returns a result */ execute: (input: any, agent: unknown) => Promise; } /** A type that mirrors the current design in the upcoming navigator.modelContext API */ declare interface ModelContextAPI { provideContext(context: MCPContext): void; readonly connectionStatus?: Readable<"connecting" | "connected" | "closed" | "error">; } /** NNDescent options */ export declare interface NNDescentOptions { /** The distance metric. Default: "euclidean". */ metric?: "euclidean" | "cosine"; /** Number of neighbors to find. Default: 15. */ nNeighbors?: number; /** Number of random projection trees. Default: auto. */ nTrees?: number; /** Number of NN-descent iterations. Default: auto. */ nIters?: number; /** Early stopping threshold. Default: 0.001. */ delta?: number; /** Whether to use RP tree initialization. Default: true. */ treeInit?: boolean; /** Accuracy/speed tradeoff for queryByVector (higher = more accurate, slower). Default: 0.1. */ epsilon?: number; /** Random seed for reproducibility. */ seed?: number; /** Progress callback: `(progress: number, stage: string) => void`. Progress is in [0, 1]. */ progress?: (progress: number, stage: string) => void; /** Whether to use GPU acceleration (WebGPU). Default: false. */ gpu?: boolean; } export declare interface NNDescentQueryResult { indices: Int32Array; distances: Float32Array; } export declare interface NNDescentResult { queryByIndex(index: number, k: number): NNDescentQueryResult; queryByVector(data: Float32Array, k: number): NNDescentQueryResult; destroy(): void; } export declare interface OverlayProxy { location: (x: number, y: number) => { x: number; y: number; }; width: number; height: number; } declare interface ParallelCoordinatesSpec { type: "parallel-coordinates"; /** The title of the chart */ title?: string; data: { /** Data source, default to the main data table */ from?: SQLTable; /** Filter the data. Use $filter to refer to the shared filter (a cross-filter) */ filter?: "$filter"; /** The data fields */ fields: SQLField[]; /** Color lines by the given field */ color?: SQLField; }; /** Opacity of the lines, default 0.8 */ opacity?: number; /** Fixed chart width in pixels. When unset, the chart fills the width given by the layout. */ width?: number; /** Fixed chart height in pixels. When unset, the chart fills the height given by the layout. */ height?: number; /** Specify color scale */ scales?: { color?: Scale; }; } /** A point with x and y coordinates. */ export declare interface Point { x: number; y: number; } declare interface PredicatesSpec { type: "predicates"; title?: string; items?: { name: string; predicate: string; }[]; } /** A rectangle with min, max coordinate for each dimension. * It is required that xMin <= xMax and yMin <= yMax. */ export declare interface Rectangle { xMin: number; yMin: number; xMax: number; yMax: number; } export declare function registerRenderer(options: { name: string; label?: string; description?: string; renderer: RendererComponent; options?: RendererOptionsComponent; }): void; /** Component for a custom value renderer */ declare type RendererComponent = CustomComponentClass_2; /** Component for a custom value renderer's options config panel */ declare type RendererOptionsComponent = CustomComponentClass_2; declare interface RendererOptionsProps { options?: Record; onChange?: (value?: Record) => void; } declare interface RendererProps { value: any; options?: Record; } declare type RowID = any; /** Scale */ declare interface Scale { /** Scale type for quantitative scales */ type?: ScaleType; /** Scale domain */ domain?: DataValue[]; /** Special values. All represented as strings. */ specialValues?: string[]; /** symlog constant. */ constant?: number; /** * Scale range. Currently do not apply for x and y scales. * For size scales, this should be [min, max] size. * For nominal color scales, this should be a list of colors. * For quantitative color scales, this should be a predefined interpolate scheme, or a list of colors to interpolate. */ range?: (string | number)[] | string; /** * Use when zero means "no data" and should be visually distinct from small positive values. * When true, zero is rendered separately from the continuous scale so that even the smallest * non-zero values are clearly distinguishable. * Defaults to true for color scales whose domain includes zero. */ discontinuityAtZero?: boolean; } /** Scale type */ declare type ScaleType = "linear" | "log" | "symlog" | "band" | "time"; export declare interface Searcher { /** Perform a full text search with the given query */ fullTextSearch?(query: string, options?: { limit?: number; predicate?: string | null; onStatus?: (status: string) => void; }): Promise<{ id: any; }[]>; /** Perform a vector search with the given query */ vectorSearch?(query: string, options?: { limit?: number; predicate?: string | null; onStatus?: (status: string) => void; }): Promise<{ id: any; distance?: number; }[]>; } /** Chart selection */ declare interface Selection_2 { encoding: "x" | "y" | "xy"; } declare type SortOrder = { column: string; direction: "ascending" | "descending"; }[]; /** Field from the data table, can be a column name or a SQL expression */ declare type SQLField = string | { sql: string; }; /** Table name or SQL expression that produces a table. In SQL expression, you can refer to the current filter predicate with $filter. */ declare type SQLTable = string | { sql: string; }; declare type ThemeConfig = Partial & { /** Overrides for light mode. */ dark?: Partial; /** Overrides for dark mode. */ light?: Partial; }; /** Tool response format */ declare interface ToolResponse { content: Array<{ type: "text" | "image" | "video"; text?: string; url?: string; [key: string]: any; }>; isError?: boolean; } /** A stateful, resumable UMAP instance. */ export declare interface UMAP { /** The input dimension */ readonly inputDim: number; /** The output dimension */ readonly outputDim: number; /** The number of epochs run so far. During an in-flight `step`/`run` this * returns the last settled value (the count is refreshed when the op settles). */ readonly epoch: number; /** * Get the current embedding. Valid immediately after `createUMAP` (eager * setup, epoch 0) and refreshed by `run`/`step`. * * Safe to read during an in-flight `step`/`run`: it returns the last settled * snapshot rather than reading the (borrowed) wasm instance, so it never * throws even when polled from a requestAnimationFrame loop. * * Note: returns a reused buffer — copy it (e.g. `new Float32Array(embedding)`) * if you need a stable snapshot across subsequent reads. */ readonly embedding: Float32Array; /** The KNN indices from the neighbor graph. Valid immediately (eager setup); * the graph is immutable, so it is snapshotted at construction and is safe to * access at any time, including during an in-flight `step`/`run`. */ readonly knnIndices: Int32Array; /** The KNN distances from the neighbor graph. Valid immediately (eager setup); * snapshotted at construction and safe to access during an in-flight `step`/`run`. */ readonly knnDistances: Float32Array; /** * Anneal the layout to completion: linear learning-rate decay from the current * `learningRate` down to 0 over the default horizon, continuing from the current * epoch. The peak is the live `learningRate` (from `createUMAP` options or the * last `setParameters`). */ run(): Promise; /** * Advance the layout by `nEpochs` at the current `learningRate`, held flat (no * decay). Intended for interactive/real-time stepping. Default: 1 epoch. */ step(nEpochs?: number): Promise; /** * Update live parameters. `learningRate` is used flat by `step` and as the * decay peak by `run`. `minDist`/`spread` re-fit the output curve. Safe to call * during an in-flight `step`/`run` — the update is queued and applied in order, * once any in-flight/queued sections settle. */ setParameters( params: Pick, ): void; /** Switch optimizer. Resets the velocity buffer. Queued; runs in order after any in-flight `step`/`run`. */ setOptimizer(optimizer: "sgd" | "momentum"): void; /** Re-initialize the embedding and restart from epoch 0. Default: "spectral". Queued; runs in order after any in-flight `step`/`run`. */ reset(method?: "spectral" | "random"): void; /** Destroy the instance and release resources */ destroy(): void; } /** * Options for {@link createUMAPFromKNN}. The kNN-computation knobs (`metric`, * `nNeighbors`) do not apply when the graph is supplied directly. */ export declare type UMAPFromKNNOptions = Omit; /** UMAP options */ export declare interface UMAPOptions { /** The input distance metric */ metric?: "euclidean" | "cosine"; /** The initialization method. Default: "spectral" (momentum forces "random"). */ initializeMethod?: "spectral" | "random"; /** The optimizer. Default: "sgd". "momentum" gives better global structure. */ optimizer?: "sgd" | "momentum"; localConnectivity?: number; mixRatio?: number; spread?: number; minDist?: number; repulsionStrength?: number; nEpochs?: number; learningRate?: number; negativeSampleRate?: number; nNeighbors?: number; /** The random seed. */ seed?: number; /** Progress callback: `(progress: number, stage: string) => void`. Progress is in [0, 1]. */ progress?: (progress: number, stage: string) => void; /** Whether to use GPU acceleration (WebGPU). Default: false. */ gpu?: boolean; } /** A state describing the viewport's pan and zoom state. * The screen coordinate of a point is calculated as follows: * px = ((x - viewport.x) * viewport.scale + 1) / 2 * width * py = ((y - viewport.y) * viewport.scale + 1) / 2 * height */ export declare interface ViewportState { /** The x coordinate of the center of the viewport in data units. */ x: number; /** The y coordinate of the center of the viewport in data units. */ y: number; /** The scale of the viewport. This scales data units to [-1, 1]. */ scale: number; } /** Widget for editing a chart */ declare type Widget = { type: "scale.type"; channel: Channel; } | { type: "encoding.normalize"; layer: number | number[]; attribute: Attribute; options: ("x" | "y")[]; }; export { }