import { CollectionType, EastFunction, PatchType, SetType, Variable, VariantType } from '../east'; import { ArrayType, BlobType, BooleanType, DateTimeType, DictType, EastType, FloatType, IntegerType, Nullable, PrimitiveType, StringType, StructType } from '../east/types'; import { Stream } from '../data'; import type { ModulePath } from '../template'; import { PatchSourceTaskDescription } from '../source/Source'; import type { Field } from 'vega-lite/build/src/channeldef'; import type { TopLevel, TopLevelParameter } from 'vega-lite/build/src/spec/toplevel'; import type { FacetedUnitSpec } from 'vega-lite/build/src/spec/unit'; import { TopLevelSpec } from 'vega-lite/build/src/spec'; import { ArcMark, AreaMark, AxisEncoding, BarMark, BoxPlotMark, CartesianEncodings, ContinuousColorEncoding, DiscreteColorEncoding, FormatEncodings, LineMark, Mark, NumericEncoding, PointMark, RadialEncodings, RectMark, StringEncoding, TemporalEncoding, TickMark } from './Chart'; import { LLMAssistantTaskDescription } from '../llm/LLMBuilder'; import { MapVisual } from './Geo'; /** @internal */ export type StringConstraint = { type: 'String'; range?: EastFunction | DictType>> | undefined; }; /** @internal */ export type FloatConstraint = { type: 'Float'; min?: EastFunction | undefined; max?: EastFunction | undefined; }; /** @internal */ export type IntegerConstraint = { type: 'Integer'; min?: EastFunction | undefined; max?: EastFunction | undefined; }; /** @internal */ export type DateTimeConstraint = { type: 'DateTime'; min?: EastFunction | undefined; max?: EastFunction | undefined; }; /** @internal */ export type BooleanConstraint = { type: 'Boolean'; }; /** @internal */ export type EditConstraint = T extends StringType ? StringConstraint : T extends SetType ? StringConstraint : T extends FloatType ? FloatConstraint : T extends IntegerType ? IntegerConstraint : T extends DateTimeType ? DateTimeConstraint : T extends BooleanType ? BooleanConstraint : never; /** @internal */ export type PrimitiveFieldType = { kind: 'primitive'; name: string; value: Variable; constraint?: EditConstraint | undefined; readonly?: EastFunction | undefined; display?: EastFunction | undefined; background?: EastFunction | undefined; color?: EastFunction | undefined; target_value?: EastFunction | undefined; target_display?: EastFunction | undefined; tooltip?: EastFunction | undefined; hidden: boolean; hidden_detail: boolean; }; /** @internal */ export type ArrayFieldType = ArrayType, P extends Record = Record> = { kind: 'array'; name: string; value: Variable; fields: Record>; readonly?: EastFunction | undefined; hidden: boolean; hidden_detail: boolean; writable: WritableCollectionConfiguration; }; /** @internal */ export type DictFieldType = DictType, P extends Record = Record> = { kind: 'dict'; name: string; value: Variable; fields: Record>; readonly?: EastFunction | undefined; hidden?: boolean | undefined; hidden_detail: boolean; writable: WritableCollectionConfiguration; }; /** @internal */ export type KeyFieldType = { name: string; kind: 'key'; value: Variable; readonly: EastFunction; hidden: boolean; hidden_detail: boolean; }; /** @internal */ export type ValueColumnType = { name: string; kind: 'value'; value: Variable; readonly: EastFunction; hidden: boolean; hidden_detail: boolean; }; /** @internal */ export type CollectionColumnType = { name: string; kind: 'collection'; value: Variable; readonly: EastFunction; hidden: boolean; hidden_detail: boolean; }; /** @internal */ export type ColumnType = PrimitiveFieldType | ArrayFieldType | DictFieldType | CollectionColumnType | KeyFieldType | ValueColumnType; /** @internal */ export type InputType = PrimitiveFieldType | ArrayFieldType | DictFieldType | KeyFieldType; /** @internal */ export type WritableCollectionConfiguration = { type: 'collection'; insert: boolean; delete: boolean; }; /** @internal */ export type WritableTableConfiguration = { type: 'writable'; add: boolean; remove: boolean; update: boolean; }; /** @internal */ export type PatchTableConfiguration = { type: 'patch'; add: boolean; remove: boolean; update: boolean; conflicts: Stream>>; output: Stream>; base: Stream>; patch: Stream>>; task: PatchSourceTaskDescription; undo: boolean; }; /** @internal */ export type ReadonlyTableConfiguration = { type: 'none'; add: false; remove: false; update: false; }; /** @internal */ export type TableWriteConfiguration = WritableTableConfiguration | PatchTableConfiguration | ReadonlyTableConfiguration; /** @internal */ export declare function tableWriteConfiguration(stream: Stream): TableWriteConfiguration; /** @internal A visual displayed as a data grid */ export type StructTableVisual = { type: 'table'; kind: 'struct'; name: string; stream: Stream>; columns: ColumnType[]; writable: TableWriteConfiguration; input_streams: Stream[]; }; /** @internal A visual displayed as a data grid */ export type ArrayTableVisual = { type: 'table'; kind: 'array'; name: string; stream: Stream>; columns: ColumnType[]; writable: TableWriteConfiguration; input_streams: Stream[]; }; /** @internal */ export type PrimitiveTableVisual = { type: 'table'; kind: 'primitive'; name: string; stream: Stream | ArrayType>; columns: (PrimitiveFieldType | KeyFieldType)[]; writable: TableWriteConfiguration; input_streams: Stream[]; }; /** @internal */ export type TableVisual = ArrayTableVisual | StructTableVisual | PrimitiveTableVisual; /** @internal A pivot displayed as a data grid */ export type PivotVisual = { type: 'pivot'; name: string; streams: Stream | ArrayType>[]; }; /** @internal A visual displayed as a data grid */ export type FormVisual = { type: 'form'; name: string; stream: Stream; inputs: InputType[]; writable: TableWriteConfiguration; input_streams: Stream[]; }; /** * Represents the type for a task within a timeline. * * @property label The task's descriptive label {@link StringType}. * @property start The scheduled start date and time of the task {@link DateTimeType}. * @property end The scheduled end date and time of the task {@link DateTimeType}. * @property start_target An optional start date and time that the task aims to begin by {@link DateTimeType}. * @property end_target An optional end date and time that the task aims to be completed by {@link DateTimeType}. * @property color An optional string defining the color associated with the task for UI representation {@link StringType}. * @property opacity An optional float defining the opacity of the task's representation {@link FloatType}. * @property stroke_color An optional string defining the color of the task's border or stroke {@link StringType}. * @property stroke_opacity An optional float defining the opacity of the task's stroke {@link FloatType}. * @property stroke_width An optional float defining the width of the task's stroke {@link FloatType}. * @property stroke_dash An optional structure defining the pattern of the task's stroke, consisting of 'stroke' and 'space' floats {@link StructType}. * @property dependencies An optional set or array of strings, each representing the label of another task that this task depends on ({@link SetType} or {@link ArrayType}). * @property tooltips An optional array of tooltips, each {@link ArrayType} element representing the label and value as a {@link StructType}. * * @category Layout */ export type TimelineTaskType = StructType<{ id: StringType; label: StringType; start: DateTimeType; end: DateTimeType; start_target?: Nullable | DateTimeType; end_target?: Nullable | DateTimeType; color?: Nullable | StringType; opacity?: Nullable | FloatType; stroke_color?: Nullable | StringType; stroke_opacity?: Nullable | FloatType; stroke_width?: Nullable | FloatType; stroke_dash?: Nullable> | StructType<{ stroke: FloatType; space: FloatType; }>; dependencies?: SetType | ArrayType; tooltips?: ArrayType>; }>; /** * Represents the type for tasks within a timeline, can be a {@link StructType}, an {@link ArrayType} of {@link StructType}, or a {@link DictType} with {@link StructType} value, mapping strings to task structures, allowing for varied forms of task definitions. * * @category Layout */ export type TimelineTasksType = TimelineTaskType | ArrayType | DictType; /** * Represents the type for a boundary within a timeline, `BoundaryType` is a {@link StructType}, each task structure consists of the following fields: * * @property date The date and time of the boundary {@link DateTimeType}. * @property stroke_color An optional string defining the color of the boundary's border or stroke {@link StringType}. * @property stroke_opacity An optional float defining the opacity of the boundary's stroke {@link FloatType}. * @property stroke_width An optional float defining the width of the boundary's stroke {@link FloatType}. * @property stroke_dash An optional structure defining the pattern of the boundary's stroke, consisting of 'stroke' and 'space' floats {@link StructType}. * * @category Layout */ export type TimelineBoundaryType = StructType<{ date: DateTimeType; stroke_color?: Nullable | StringType; stroke_opacity?: Nullable | FloatType; stroke_width?: Nullable | FloatType; stroke_dash?: Nullable> | StructType<{ stroke: FloatType; space: FloatType; }>; }>; /** * Represents the type for an event within a calendar, `CalendarEventType` is a {@link StructType}, each task structure consists of the following fields: * * @property start The scheduled start date and time of the task {@link DateTimeType}. * @property end The scheduled end date and time of the task {@link DateTimeType}. * @property label The boundary's descriptive label {@link StringType}. * @property color An optional string defining the color associated with the boundary for UI representation {@link StringType}. * * @category Layout */ export type CalendarEventType = StructType<{ start: DateTimeType; end?: DateTimeType; label?: Nullable | StringType; color?: Nullable | StringType; }>; /** @internal A visual displayed as a data grid */ export type CalendarVisual = { type: 'calendar'; kind: 'dict' | 'array'; name: string; stream: Stream | ArrayType>; events?: EastFunction | DictType>[]; input_streams: Stream[]; }; /** @internal A visual displayed as a data grid */ export type BlobUploadVisual = { type: 'blob_upload'; name: string; stream: Stream; }; /** @internal A visual displayed as a data grid */ export type TimelineVisual = { type: 'timeline'; name: string; stream: Stream | ArrayType>; tasks: EastFunction | DictType>[]; boundaries?: EastFunction[] | undefined; columns: ColumnType[]; writable: TableWriteConfiguration; input_streams: Stream[]; }; /** @internal */ export type PlannerVisual = TimelineVisual | CalendarVisual; /** @internal */ export declare function toTemporalEncoding(def: TemporalEncoding): { title?: string; timeUnit?: import("./Chart").DiscreteTimeUnit; sort?: import("./Chart").SortOrder; field: string; type: "nominal" | "ordinal" | "quantitative" | "temporal"; }; /** @internal */ export declare function toNumericEncoding(def: NumericEncoding): { bin?: boolean | import("./Chart").Bin; stack?: import("./Chart").Normalize | null; aggregate?: import("./Chart").Aggregate; title?: string; sort?: import("./Chart").SortOrder; field: string; type: import("./Chart").FieldType; }; /** @internal */ export declare function toStringEncoding(def: StringEncoding): { title?: string; sort?: { order: import("./Chart").SortOrder; field?: never; op?: never; } | { field: string; order: import("./Chart").SortOrder; op: import("./Chart").Aggregate; }; field: string; type: import("./Chart").FieldType; }; /** @internal */ export declare function toColorEncoding(def: DiscreteColorEncoding | ContinuousColorEncoding): { bin?: boolean | import("./Chart").Bin; scale?: { domain: string[]; range: string[]; }; aggregate?: import("./Chart").Aggregate; title?: string; field: string; type: import("./Chart").FieldType; }; /** @internal */ export declare function toAxisEncoding(def: AxisEncoding): { title?: string; timeUnit?: import("./Chart").DiscreteTimeUnit; sort?: import("./Chart").SortOrder; field: string; type: "nominal" | "ordinal" | "quantitative" | "temporal"; } | { bin?: boolean | import("./Chart").Bin; stack?: import("./Chart").Normalize | null; aggregate?: import("./Chart").Aggregate; title?: string; sort?: import("./Chart").SortOrder; field: string; type: import("./Chart").FieldType; } | { title?: string; sort?: { order: import("./Chart").SortOrder; field?: never; op?: never; } | { field: string; order: import("./Chart").SortOrder; op: import("./Chart").Aggregate; }; field: string; type: import("./Chart").FieldType; }; /** @internal */ export declare function toPointMark(def: PointMark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; filled?: boolean; shape?: import("./Chart").PointShape; type: "point"; tooltip: { content: string; }; }; /** @internal */ export declare function toBarMark(def: BarMark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; type: "bar"; tooltip: { content: string; }; orient: import("./Chart").Orientation | undefined; cornerRadiusTopRight: number; cornerRadiusBottomRight: number; }; /** @internal */ export declare function toLineMark(def: LineMark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; interpolate?: import("./Chart").Interpolate; type: "line"; tooltip: { content: string; }; }; /** @internal */ export declare function toAreaMark(def: AreaMark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; type: "area"; interpolate: import("./Chart").Interpolate | undefined; tooltip: { content: string; }; }; /** @internal */ export declare function toRectMark(def: RectMark): { type: "rect"; opacity: number; tooltip: { content: string; }; fill: string | undefined; width: number | undefined; height: number | undefined; fillOpacity: number; stroke: string | undefined; strokeWidth: number; strokeOpacity: number | undefined; strokeDash: [stroke: number, space: number] | undefined; }; /** @internal */ export declare function toBoxPlotMark(def: BoxPlotMark): { thickness?: number; strokeDash?: [stroke: number, space: number] | [stroke: number, space: number] | [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number | "filter" | null; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; extent?: number | "stdev" | "stderr" | "min-max" | "ci" | "iqr"; type: "boxplot" | "errorband" | "errorbar"; tooltip: { content: string; }; }; /** @internal */ export declare function toTickMark(def: TickMark): { thickness: number; strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; cornerRadius?: number; type: "tick"; tooltip: { content: string; }; }; /** @internal */ export declare function toArcMark(def: ArcMark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; padAngle?: number; cornerRadius?: number; type: "arc"; tooltip: { content: string; }; innerRadius: { signal: string; }; outerRadius: { signal: string; }; }; /** @internal */ export declare function toMark(mark: Mark): { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; filled?: boolean; shape?: import("./Chart").PointShape; type: "point"; tooltip: { content: string; }; } | { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; type: "bar"; tooltip: { content: string; }; orient: import("./Chart").Orientation | undefined; cornerRadiusTopRight: number; cornerRadiusBottomRight: number; } | { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; interpolate?: import("./Chart").Interpolate; type: "line"; tooltip: { content: string; }; } | { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; type: "area"; interpolate: import("./Chart").Interpolate | undefined; tooltip: { content: string; }; } | { type: "rect"; opacity: number; tooltip: { content: string; }; fill: string | undefined; width: number | undefined; height: number | undefined; fillOpacity: number; stroke: string | undefined; strokeWidth: number; strokeOpacity: number | undefined; strokeDash: [stroke: number, space: number] | undefined; } | { thickness?: number; strokeDash?: [stroke: number, space: number] | [stroke: number, space: number] | [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number | "filter" | null; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; extent?: number | "stdev" | "stderr" | "min-max" | "ci" | "iqr"; type: "boxplot" | "errorband" | "errorbar"; tooltip: { content: string; }; } | { thickness: number; strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; cornerRadius?: number; type: "tick"; tooltip: { content: string; }; } | { strokeDash?: [stroke: number, space: number]; strokeOpacity?: number; strokeWidth?: number; stroke?: string; fillOpacity?: number; fill?: string; opacity?: number; padAngle?: number; cornerRadius?: number; type: "arc"; tooltip: { content: string; }; innerRadius: { signal: string; }; outerRadius: { signal: string; }; } | undefined; /** @internal vega unit spec */ export type VegaViewSpec = Pick>, 'encoding' | 'mark' | 'transform' | 'data'>; /** @internal */ export declare function fromRadialView(def: RadialEncodings): VegaViewSpec; /** @internal */ export declare function fromCartesianView(def: CartesianEncodings): VegaViewSpec; /** @internal */ export declare function specFromVegaViewVisual(def: ViewVisual): TopLevelSpec; /** @internal */ export declare function specFromVegaLayerVisual(def: LayerVisual): TopLevelSpec; /** @internal */ export declare function specFromVegaVisual(def: VegaVisual): TopLevelSpec; /** @internal A visual displayed from a vega specification */ export type SpecView = { type: 'spec'; name: string; stream: Stream | ArrayType>; spec: VegaViewSpec; selections: Record; }; /** @internal */ export type CartesianView = FormatEncodings & CartesianEncodings & { stream: Stream | ArrayType>; selections: Record; }; export declare function cartesianViewFromEncodings(encodings: FormatEncodings & CartesianEncodings, stream: Stream | ArrayType>): ViewVisual; /** @internal */ export type RadialView = FormatEncodings & RadialEncodings & { stream: Stream | ArrayType>; selections: Record; }; /** @internal */ export type View = SpecView | CartesianView | RadialView; /** @internal */ export type ViewVisual = { type: 'view'; name: string; view: View; }; /** @internal */ export type LayerVisual = { type: 'layer'; name: string; views: View[]; }; /** @internal A visual displayed from a vega specification */ export type VegaVisual = ViewVisual | LayerVisual; /** @internal a panel visual */ export type PanelVisualType = MapVisual | PivotVisual | TableVisual | VegaVisual | TabVisual | PanelVisual | FormVisual | PlannerVisual | BlobUploadVisual; /** @internal a panel child - either data or container visuals */ type PanelChildVisual = PanelVisualType & { percentage: number; }; /** @internal a panel visual - contains data or container visuals */ export type PanelVisual = { type: 'panel'; orientation: 'row' | 'column'; visuals: PanelChildVisual[]; }; /** @internal a panel visual */ export type GridVisualType = MapVisual | PivotVisual | TableVisual | VegaVisual | TabVisual | FormVisual | PlannerVisual | BlobUploadVisual; /** @internal a panel child - either data or container visuals */ type GridChildVisual = GridVisualType & { x: number; y: number; w: number; h: number; static: boolean; minW?: number | undefined; maxW?: number | undefined; minH?: number | undefined; maxH?: number | undefined; }; /** @internal a panel visual - contains data or container visuals */ export type GridVisual = { type: 'grid'; visuals: GridChildVisual[]; }; /** @internal a tab visual */ export type TabVisualType = MapVisual | PivotVisual | TableVisual | VegaVisual | FormVisual | PlannerVisual | BlobUploadVisual; /** @internal a tab visual - contains data visuals */ export type TabVisual = { type: 'tab'; visuals: TabVisualType[]; }; /** @internal a header visual - displayed in the header of a layout */ export type HeaderItem = { type: 'value'; name: string; stream: Stream; input_streams: Stream[]; value: EastFunction; color?: EastFunction | undefined; tooltip?: EastFunction | undefined; } | { type: 'slider'; name: string; stream: Stream; input_streams: Stream[]; min: EastFunction; max: EastFunction; step?: EastFunction | undefined; display?: EastFunction | undefined; tooltip?: EastFunction | undefined; target?: EastFunction | undefined; } | { type: 'kpi'; name: string; stream: Stream; input_streams: Stream[]; value: EastFunction; target: EastFunction; tooltip?: EastFunction | undefined; comparison: EastFunction; goal: 'greater' | 'less' | 'equal'; } | { type: 'progress'; name: string; stream: Stream; input_streams: Stream[]; value: EastFunction; display?: EastFunction | undefined; min?: EastFunction | undefined; max?: EastFunction | undefined; tooltip?: EastFunction | undefined; }; /** @internal a tab visual - contains data visuals */ export type HeaderVisual = { type: 'header'; items: HeaderItem[]; }; /** @internal a tab visual - contains data visuals */ export type ChatThreadVisual = { name: string; prompt: Stream>; task: LLMAssistantTaskDescription; }; /** @internal a tab visual - contains data visuals */ export type ChatVisual = { type: 'chat'; threads: ChatThreadVisual[]; }; /** @internal */ export type TargetToolbar = { label: string; show_targets: boolean; }; /** @internal */ export type TaskToolbar = { label: string; show_idle: boolean; }; /** @internal */ export type DownloadStream = { stream: string; format: 'json' | 'jsonl' | 'bytes' | 'csv'; }; /** @internal */ export type DownloadToolbar = { label: string; streams: Record; }; /** @internal */ export type ErrorsToolbar = { label: string; }; /** @internal layout visual - a named visual element that can be used in a portal */ export type LayoutToolbar = { targets?: TargetToolbar | undefined; tasks?: TaskToolbar | undefined; downloads?: DownloadToolbar | undefined; errors?: ErrorsToolbar | undefined; }; /** @internal container visual - either a tab or panel */ export type FlatLayoutVisualType = MapVisual | VegaVisual | PivotVisual | TableVisual | TabVisual | PanelVisual | GridVisual | FormVisual | HeaderVisual | PlannerVisual | BlobUploadVisual; /** @internal flat layout visual - a named visual element that can be used in a portal */ export type FlatLayoutVisual = { type: 'flat'; name: string; caption?: string | undefined; visual: FlatLayoutVisualType; header?: HeaderVisual | undefined; chat?: ChatVisual | undefined; toolbar?: LayoutToolbar | undefined; }; /** @internal */ export type PagedVisualType = FlatLayoutVisual; /** @internal paged layout visual - a named visual element that contains multiple flat layouts */ export type PagedLayoutVisual = { type: 'paged'; name: string; visuals: PagedVisualType[]; }; /** @internal */ export type AccordionVisualType = PagedLayoutVisual | FlatLayoutVisual; /** @internal */ export type AccordionVisualGroup = { name: string; visuals: AccordionVisualType[]; }; /** @internal layout visual - a named visual element that can be used in a portal */ export type AccordionLayoutVisual = { type: 'accordion'; name: string; groups: AccordionVisualGroup[]; numbered: boolean; }; /** @internal layout visual */ export type LayoutVisualType = FlatLayoutVisual | PagedLayoutVisual | AccordionLayoutVisual; /** @internal layout visual */ export type LayoutVisual = { name: string; module: ModulePath; visual: LayoutVisualType; inputs: Record; }; /** @internal container visual - either a tab or panel */ export type Visual = FlatLayoutVisual | PagedLayoutVisual | AccordionLayoutVisual | MapVisual | VegaVisual | PivotVisual | TableVisual | TabVisual | PanelVisual | GridVisual | FormVisual | HeaderVisual | PlannerVisual | BlobUploadVisual; /** @internal */ export declare function visualStreams(visual: Visual, streams: Stream[]): Stream[]; /** @internal */ export declare function visualEditStreams(visual: Visual, streams: Stream[]): Stream[]; export {};