@opendata-ai/openchart-core 6.25.4 → 6.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +231 -14
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/helpers/spec-builders.ts +63 -0
- package/src/index.ts +2 -0
- package/src/styles/animation.css +7 -0
- package/src/styles/base.css +2 -1
- package/src/styles/tokens.css +2 -1
- package/src/types/index.ts +16 -0
- package/src/types/layout.ts +110 -5
- package/src/types/spec.ts +112 -8
package/dist/index.d.ts
CHANGED
|
@@ -328,6 +328,8 @@ interface AxisConfig {
|
|
|
328
328
|
labelPadding?: number;
|
|
329
329
|
/** Color override for axis tick labels and title. Useful in dual-axis charts to match axis color to its series. */
|
|
330
330
|
labelColor?: string;
|
|
331
|
+
/** Secondary data field to display alongside each tick label. Renders in lighter weight/color. Only effective on categorical y-axis labels (horizontal bar charts). */
|
|
332
|
+
labelField?: string;
|
|
331
333
|
}
|
|
332
334
|
/** Scale configuration for an encoding channel. */
|
|
333
335
|
interface ScaleConfig {
|
|
@@ -887,6 +889,12 @@ interface ChartSpec {
|
|
|
887
889
|
* - AnimationConfig: full control via enter/update/exit phases
|
|
888
890
|
*/
|
|
889
891
|
animation?: AnimationSpec;
|
|
892
|
+
/**
|
|
893
|
+
* Show a vertical crosshair line that tracks the nearest data point on
|
|
894
|
+
* line and area charts. Only active when a voronoi overlay is present.
|
|
895
|
+
* Defaults to false.
|
|
896
|
+
*/
|
|
897
|
+
crosshair?: boolean;
|
|
890
898
|
/**
|
|
891
899
|
* Render order within a LayerSpec. Higher values render on top.
|
|
892
900
|
* When omitted, layers render in array order (later layers paint on top).
|
|
@@ -1110,6 +1118,51 @@ interface SankeySpec {
|
|
|
1110
1118
|
*/
|
|
1111
1119
|
valueFormat?: string;
|
|
1112
1120
|
}
|
|
1121
|
+
/** Encoding channels specific to tile map visualizations. */
|
|
1122
|
+
interface TileMapEncoding {
|
|
1123
|
+
/** State code field (required, nominal). Maps to US state abbreviations. */
|
|
1124
|
+
state: EncodingChannel;
|
|
1125
|
+
/** Value field (required, quantitative). Maps to the sequential color scale. */
|
|
1126
|
+
value: EncodingChannel;
|
|
1127
|
+
/** Tooltip encoding (optional). */
|
|
1128
|
+
tooltip?: EncodingChannel | EncodingChannel[];
|
|
1129
|
+
}
|
|
1130
|
+
/** Sequential color palette names available for tile maps. */
|
|
1131
|
+
type TileMapPalette = 'blue' | 'green' | 'orange' | 'purple';
|
|
1132
|
+
interface TileMapSpec {
|
|
1133
|
+
/** Discriminant: always "tilemap". */
|
|
1134
|
+
type: 'tilemap';
|
|
1135
|
+
/**
|
|
1136
|
+
* Data for the tile map. Accepts either:
|
|
1137
|
+
* - A record mapping state codes to numeric values: `{ "CA": 12000, "TX": 8500 }`
|
|
1138
|
+
* - Tabular data rows with state and value fields (requires encoding)
|
|
1139
|
+
*/
|
|
1140
|
+
data: Record<string, number | null> | DataRow[];
|
|
1141
|
+
/**
|
|
1142
|
+
* Encoding channels mapping data fields to visual properties.
|
|
1143
|
+
* Required when data is DataRow[]. Auto-generated when data is a record map.
|
|
1144
|
+
*/
|
|
1145
|
+
encoding?: TileMapEncoding;
|
|
1146
|
+
/** Sequential color palette. Defaults to 'blue'. */
|
|
1147
|
+
palette?: TileMapPalette;
|
|
1148
|
+
/** Editorial chrome (title, subtitle, source, byline, footer). */
|
|
1149
|
+
chrome?: Chrome;
|
|
1150
|
+
/** Legend display configuration. */
|
|
1151
|
+
legend?: LegendConfig;
|
|
1152
|
+
/** Theme configuration overrides. */
|
|
1153
|
+
theme?: ThemeConfig;
|
|
1154
|
+
/** Dark mode behavior. Defaults to "off". */
|
|
1155
|
+
darkMode?: DarkMode;
|
|
1156
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1157
|
+
watermark?: boolean;
|
|
1158
|
+
/** Animation configuration for entrance animations. */
|
|
1159
|
+
animation?: AnimationSpec;
|
|
1160
|
+
/**
|
|
1161
|
+
* d3-format string applied to tile values, legend labels, and tooltips.
|
|
1162
|
+
* Examples: ".1f" for one decimal, "$,.0f" for currency, "~s" for SI.
|
|
1163
|
+
*/
|
|
1164
|
+
valueFormat?: string;
|
|
1165
|
+
}
|
|
1113
1166
|
/**
|
|
1114
1167
|
* Top-level visualization spec: union discriminated by structural shape.
|
|
1115
1168
|
*
|
|
@@ -1118,8 +1171,9 @@ interface SankeySpec {
|
|
|
1118
1171
|
* - TableSpec: has `type: 'table'`
|
|
1119
1172
|
* - GraphSpec: has `type: 'graph'`
|
|
1120
1173
|
* - SankeySpec: has `type: 'sankey'`
|
|
1174
|
+
* - TileMapSpec: has `type: 'tilemap'`
|
|
1121
1175
|
*/
|
|
1122
|
-
type VizSpec = ChartSpec | LayerSpec | TableSpec | GraphSpec | SankeySpec;
|
|
1176
|
+
type VizSpec = ChartSpec | LayerSpec | TableSpec | GraphSpec | SankeySpec | TileMapSpec;
|
|
1123
1177
|
/** Chart spec without runtime data, for persistence/storage. */
|
|
1124
1178
|
type ChartSpecWithoutData = Omit<ChartSpec, 'data'>;
|
|
1125
1179
|
/** Table spec without runtime data and columns, for persistence/storage. Columns can be auto-generated via dataTable(). */
|
|
@@ -1128,8 +1182,10 @@ type TableSpecWithoutData = Omit<TableSpec, 'data' | 'columns'>;
|
|
|
1128
1182
|
type GraphSpecWithoutData = Omit<GraphSpec, 'nodes' | 'edges'>;
|
|
1129
1183
|
/** Sankey spec without runtime data, for persistence/storage. */
|
|
1130
1184
|
type SankeySpecWithoutData = Omit<SankeySpec, 'data'>;
|
|
1185
|
+
/** TileMap spec without runtime data, for persistence/storage. */
|
|
1186
|
+
type TileMapSpecWithoutData = Omit<TileMapSpec, 'data'>;
|
|
1131
1187
|
/** Union of data-stripped spec types for persistence/storage. */
|
|
1132
|
-
type StoredVizSpec = ChartSpecWithoutData | TableSpecWithoutData | GraphSpecWithoutData | SankeySpecWithoutData;
|
|
1188
|
+
type StoredVizSpec = ChartSpecWithoutData | TableSpecWithoutData | GraphSpecWithoutData | SankeySpecWithoutData | TileMapSpecWithoutData;
|
|
1133
1189
|
/** Logical AND combinator for filter predicates. */
|
|
1134
1190
|
interface LogicalAnd<T> {
|
|
1135
1191
|
and: T[];
|
|
@@ -1142,6 +1198,12 @@ interface LogicalOr<T> {
|
|
|
1142
1198
|
interface LogicalNot<T> {
|
|
1143
1199
|
not: T;
|
|
1144
1200
|
}
|
|
1201
|
+
/** A relative-time reference that resolves against the data extent. */
|
|
1202
|
+
interface RelativeTimeRef {
|
|
1203
|
+
anchor: 'max' | 'min';
|
|
1204
|
+
offset: number;
|
|
1205
|
+
unit: 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
1206
|
+
}
|
|
1145
1207
|
/** A predicate that tests a field value against a condition. */
|
|
1146
1208
|
interface FieldPredicate {
|
|
1147
1209
|
/** Data field to test. */
|
|
@@ -1149,15 +1211,15 @@ interface FieldPredicate {
|
|
|
1149
1211
|
/** Equals comparison. */
|
|
1150
1212
|
equal?: unknown;
|
|
1151
1213
|
/** Less than. */
|
|
1152
|
-
lt?: number;
|
|
1214
|
+
lt?: number | RelativeTimeRef;
|
|
1153
1215
|
/** Less than or equal. */
|
|
1154
|
-
lte?: number;
|
|
1216
|
+
lte?: number | RelativeTimeRef;
|
|
1155
1217
|
/** Greater than. */
|
|
1156
|
-
gt?: number;
|
|
1218
|
+
gt?: number | RelativeTimeRef;
|
|
1157
1219
|
/** Greater than or equal. */
|
|
1158
|
-
gte?: number;
|
|
1220
|
+
gte?: number | RelativeTimeRef;
|
|
1159
1221
|
/** Inclusive range [min, max]. */
|
|
1160
|
-
range?: [number, number];
|
|
1222
|
+
range?: [number | RelativeTimeRef, number | RelativeTimeRef];
|
|
1161
1223
|
/** Value is one of these. */
|
|
1162
1224
|
oneOf?: unknown[];
|
|
1163
1225
|
/** Whether the value is valid (non-null, non-undefined, non-NaN). */
|
|
@@ -1237,8 +1299,31 @@ interface FoldTransform {
|
|
|
1237
1299
|
/** Output field names for [key, value]. Defaults to ['key', 'value']. */
|
|
1238
1300
|
as?: [string, string];
|
|
1239
1301
|
}
|
|
1302
|
+
/** Window operation types for computing values relative to other rows. */
|
|
1303
|
+
type WindowOp = 'lag' | 'lead' | 'diff' | 'pct_change' | 'cumsum' | 'rank' | 'first_value';
|
|
1304
|
+
/** Sort field definition for window transforms. */
|
|
1305
|
+
interface WindowSortField {
|
|
1306
|
+
field: string;
|
|
1307
|
+
order?: 'ascending' | 'descending';
|
|
1308
|
+
}
|
|
1309
|
+
/** Window field definition specifying which operation to compute. */
|
|
1310
|
+
interface WindowFieldDef {
|
|
1311
|
+
op: WindowOp;
|
|
1312
|
+
field: string;
|
|
1313
|
+
/** Row offset for lag/lead/diff/pct_change. Defaults to 1. */
|
|
1314
|
+
offset?: number;
|
|
1315
|
+
as: string;
|
|
1316
|
+
}
|
|
1317
|
+
/** Window transform: computes values relative to other rows in sort order within a partition. */
|
|
1318
|
+
interface WindowTransform {
|
|
1319
|
+
window: WindowFieldDef[];
|
|
1320
|
+
/** Fields to sort by within each partition. */
|
|
1321
|
+
sort: WindowSortField[];
|
|
1322
|
+
/** Fields to partition (group) by. Each group is windowed independently. */
|
|
1323
|
+
groupby?: string[];
|
|
1324
|
+
}
|
|
1240
1325
|
/** Discriminated union of all transform types. */
|
|
1241
|
-
type Transform = FilterTransform | BinTransform | CalculateTransform | TimeUnitTransform | AggregateTransform | FoldTransform;
|
|
1326
|
+
type Transform = FilterTransform | BinTransform | CalculateTransform | TimeUnitTransform | AggregateTransform | FoldTransform | WindowTransform;
|
|
1242
1327
|
/**
|
|
1243
1328
|
* A single condition with a test predicate and resulting value/field.
|
|
1244
1329
|
* When the test passes for a datum, the condition's value/field is used.
|
|
@@ -1295,6 +1380,8 @@ declare function isTableSpec(spec: VizSpec | Record<string, unknown>): spec is T
|
|
|
1295
1380
|
declare function isGraphSpec(spec: VizSpec | Record<string, unknown>): spec is GraphSpec;
|
|
1296
1381
|
/** Check if a spec is a SankeySpec. */
|
|
1297
1382
|
declare function isSankeySpec(spec: VizSpec | Record<string, unknown>): spec is SankeySpec;
|
|
1383
|
+
/** Check if a spec is a TileMapSpec. */
|
|
1384
|
+
declare function isTileMapSpec(spec: VizSpec | Record<string, unknown>): spec is TileMapSpec;
|
|
1298
1385
|
/** Check if an annotation is a TextAnnotation. */
|
|
1299
1386
|
declare function isTextAnnotation(annotation: Annotation): annotation is TextAnnotation;
|
|
1300
1387
|
/** Check if an annotation is a RangeAnnotation. */
|
|
@@ -1731,6 +1818,8 @@ interface AxisTick {
|
|
|
1731
1818
|
position: number;
|
|
1732
1819
|
/** Formatted label string for display. */
|
|
1733
1820
|
label: string;
|
|
1821
|
+
/** Secondary label text from axis.labelField. */
|
|
1822
|
+
subtitle?: string;
|
|
1734
1823
|
}
|
|
1735
1824
|
/** A single gridline with computed positions. */
|
|
1736
1825
|
interface Gridline {
|
|
@@ -2131,7 +2220,7 @@ interface ResolvedAnnotation {
|
|
|
2131
2220
|
/** Z-index for render ordering. Higher values render on top. */
|
|
2132
2221
|
zIndex?: number;
|
|
2133
2222
|
}
|
|
2134
|
-
/** A single entry in
|
|
2223
|
+
/** A single entry in a categorical legend. */
|
|
2135
2224
|
interface LegendEntry {
|
|
2136
2225
|
/** The label text (category name or range description). */
|
|
2137
2226
|
label: string;
|
|
@@ -2144,16 +2233,21 @@ interface LegendEntry {
|
|
|
2144
2233
|
/** True for overflow indicator entries ("+N more"). Not interactive. */
|
|
2145
2234
|
overflow?: boolean;
|
|
2146
2235
|
}
|
|
2147
|
-
/**
|
|
2148
|
-
interface
|
|
2236
|
+
/** Base legend layout fields shared by all legend types. */
|
|
2237
|
+
interface BaseLegendLayout {
|
|
2149
2238
|
/** Where the legend is positioned relative to the chart area. */
|
|
2150
2239
|
position: 'top' | 'right' | 'bottom' | 'bottom-right' | 'inline';
|
|
2151
|
-
/** Legend entries. */
|
|
2152
|
-
entries: LegendEntry[];
|
|
2153
2240
|
/** Bounding box for the legend (pixel coordinates). */
|
|
2154
2241
|
bounds: Rect;
|
|
2155
2242
|
/** Entry label style. */
|
|
2156
2243
|
labelStyle: TextStyle;
|
|
2244
|
+
}
|
|
2245
|
+
/** Categorical legend with discrete swatch entries. */
|
|
2246
|
+
interface CategoricalLegendLayout extends BaseLegendLayout {
|
|
2247
|
+
/** Discriminant for legend type. Omitted means categorical (backwards compat). */
|
|
2248
|
+
type?: 'categorical';
|
|
2249
|
+
/** Legend entries. */
|
|
2250
|
+
entries: LegendEntry[];
|
|
2157
2251
|
/** Swatch size in pixels. */
|
|
2158
2252
|
swatchSize: number;
|
|
2159
2253
|
/** Gap between swatch and label. */
|
|
@@ -2161,6 +2255,26 @@ interface LegendLayout {
|
|
|
2161
2255
|
/** Gap between entries. */
|
|
2162
2256
|
entryGap: number;
|
|
2163
2257
|
}
|
|
2258
|
+
/** A color stop in a gradient legend. */
|
|
2259
|
+
interface GradientColorStop {
|
|
2260
|
+
/** Position along the gradient (0 to 1). */
|
|
2261
|
+
offset: number;
|
|
2262
|
+
/** CSS color value. */
|
|
2263
|
+
color: string;
|
|
2264
|
+
}
|
|
2265
|
+
/** Gradient legend for continuous color scales. */
|
|
2266
|
+
interface GradientLegendLayout extends BaseLegendLayout {
|
|
2267
|
+
/** Discriminant for legend type. */
|
|
2268
|
+
type: 'gradient';
|
|
2269
|
+
/** Color stops for the gradient bar. */
|
|
2270
|
+
colorStops: GradientColorStop[];
|
|
2271
|
+
/** Formatted minimum value label. */
|
|
2272
|
+
minLabel: string;
|
|
2273
|
+
/** Formatted maximum value label. */
|
|
2274
|
+
maxLabel: string;
|
|
2275
|
+
}
|
|
2276
|
+
/** Resolved legend layout — either categorical (swatches) or gradient (continuous bar). */
|
|
2277
|
+
type LegendLayout = CategoricalLegendLayout | GradientLegendLayout;
|
|
2164
2278
|
/** A single field-value pair in a tooltip. */
|
|
2165
2279
|
interface TooltipField {
|
|
2166
2280
|
/** Field label (e.g. "GDP Growth"). */
|
|
@@ -2582,6 +2696,74 @@ interface SankeyLayout {
|
|
|
2582
2696
|
/** Real text measurement function from the adapter (for accurate SVG text wrapping). */
|
|
2583
2697
|
measureText?: MeasureTextFn;
|
|
2584
2698
|
}
|
|
2699
|
+
/** A resolved tile map tile with computed position and visual properties. */
|
|
2700
|
+
interface TileMapTileMark {
|
|
2701
|
+
type: 'tile';
|
|
2702
|
+
/** Left edge x position. */
|
|
2703
|
+
x: number;
|
|
2704
|
+
/** Top edge y position. */
|
|
2705
|
+
y: number;
|
|
2706
|
+
/** Tile width and height (tiles are square). */
|
|
2707
|
+
size: number;
|
|
2708
|
+
/** Fill color from the sequential color scale. */
|
|
2709
|
+
fill: string;
|
|
2710
|
+
/** Tile border color. */
|
|
2711
|
+
stroke: string;
|
|
2712
|
+
/** Tile border width. */
|
|
2713
|
+
strokeWidth: number;
|
|
2714
|
+
/** Corner radius. */
|
|
2715
|
+
cornerRadius: number;
|
|
2716
|
+
/** US state abbreviation (e.g. "CA", "TX"). */
|
|
2717
|
+
stateCode: string;
|
|
2718
|
+
/** Numeric value (null if state has no data). */
|
|
2719
|
+
value: number | null;
|
|
2720
|
+
/** Formatted value string (e.g. "12,000" or "–" for missing). */
|
|
2721
|
+
formattedValue: string;
|
|
2722
|
+
/** Whether this state has data. False for missing states. */
|
|
2723
|
+
hasData: boolean;
|
|
2724
|
+
/** State code text label (positioned inside tile). */
|
|
2725
|
+
label: ResolvedLabel;
|
|
2726
|
+
/** Value text label (positioned inside tile, below state code). */
|
|
2727
|
+
valueLabel: ResolvedLabel;
|
|
2728
|
+
/** Accessibility attributes. */
|
|
2729
|
+
aria: MarkAria;
|
|
2730
|
+
/** Index for stagger animation ordering. */
|
|
2731
|
+
animationIndex?: number;
|
|
2732
|
+
/** Original data associated with this tile. */
|
|
2733
|
+
data: Record<string, unknown>;
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* TileMapLayout: the complete engine output for tile map visualizations.
|
|
2737
|
+
*
|
|
2738
|
+
* Contains everything an adapter needs to render the tile map: dimensions,
|
|
2739
|
+
* chrome, tiles, gradient legend, tooltip descriptors, and accessibility metadata.
|
|
2740
|
+
*/
|
|
2741
|
+
interface TileMapLayout {
|
|
2742
|
+
/** The tile map drawing area (after chrome and legend are subtracted). */
|
|
2743
|
+
area: Rect;
|
|
2744
|
+
/** Resolved chrome text elements with positions and styles. */
|
|
2745
|
+
chrome: ResolvedChrome;
|
|
2746
|
+
/** Resolved tile marks with positions, colors, and labels. */
|
|
2747
|
+
tiles: TileMapTileMark[];
|
|
2748
|
+
/** Gradient color legend (null if legend is hidden). */
|
|
2749
|
+
gradientLegend: GradientLegendLayout | null;
|
|
2750
|
+
/** Tooltip content descriptors keyed by state code. */
|
|
2751
|
+
tooltipDescriptors: Map<string, TooltipContent>;
|
|
2752
|
+
/** Accessibility metadata for the tile map. */
|
|
2753
|
+
a11y: A11yMetadata;
|
|
2754
|
+
/** Resolved theme. */
|
|
2755
|
+
theme: ResolvedTheme;
|
|
2756
|
+
/** Total SVG width in pixels. */
|
|
2757
|
+
width: number;
|
|
2758
|
+
/** Total SVG height in pixels. */
|
|
2759
|
+
height: number;
|
|
2760
|
+
/** Resolved animation config (undefined if animation is disabled). */
|
|
2761
|
+
animation: ResolvedAnimation | undefined;
|
|
2762
|
+
/** Whether to render the watermark. */
|
|
2763
|
+
watermark: boolean;
|
|
2764
|
+
/** Text measurement function for the rendering adapter. */
|
|
2765
|
+
measureText: MeasureTextFn;
|
|
2766
|
+
}
|
|
2585
2767
|
/** Function signature for text measurement provided by adapters. */
|
|
2586
2768
|
type MeasureTextFn = (text: string, fontSize: number, fontWeight?: number) => {
|
|
2587
2769
|
width: number;
|
|
@@ -3247,5 +3429,40 @@ declare function scatterChart(data: DataRow[], x: FieldRef, y: FieldRef, options
|
|
|
3247
3429
|
* @param options - Column definitions, chrome, pagination, search, etc.
|
|
3248
3430
|
*/
|
|
3249
3431
|
declare function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec;
|
|
3432
|
+
/** Options for the tileMap convenience builder. */
|
|
3433
|
+
interface TileMapBuilderOptions {
|
|
3434
|
+
/** Encoding channels (required when data is DataRow[]). */
|
|
3435
|
+
encoding?: TileMapEncoding;
|
|
3436
|
+
/** Sequential color palette name. */
|
|
3437
|
+
palette?: TileMapPalette;
|
|
3438
|
+
/** Editorial chrome. */
|
|
3439
|
+
chrome?: Chrome;
|
|
3440
|
+
/** Legend display configuration. */
|
|
3441
|
+
legend?: LegendConfig;
|
|
3442
|
+
/** Theme overrides. */
|
|
3443
|
+
theme?: ThemeConfig;
|
|
3444
|
+
/** Dark mode setting. */
|
|
3445
|
+
darkMode?: DarkMode;
|
|
3446
|
+
/** Whether to show the watermark. */
|
|
3447
|
+
watermark?: boolean;
|
|
3448
|
+
/** Animation configuration. */
|
|
3449
|
+
animation?: AnimationSpec;
|
|
3450
|
+
/** d3-format string for value formatting. */
|
|
3451
|
+
valueFormat?: string;
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* Build a TileMapSpec from a state-to-value record or tabular data.
|
|
3455
|
+
*
|
|
3456
|
+
* @example Record map (simplest):
|
|
3457
|
+
* ```ts
|
|
3458
|
+
* tileMap({ CA: 4.4, TX: 17.6, NY: 4.5 })
|
|
3459
|
+
* ```
|
|
3460
|
+
*
|
|
3461
|
+
* @example Tabular data with encoding:
|
|
3462
|
+
* ```ts
|
|
3463
|
+
* tileMap(data, { encoding: { state: { field: 'code' }, value: { field: 'rate' } } })
|
|
3464
|
+
* ```
|
|
3465
|
+
*/
|
|
3466
|
+
declare function tileMap(data: Record<string, number | null> | DataRow[], options?: TileMapBuilderOptions): TileMapSpec;
|
|
3250
3467
|
|
|
3251
|
-
export { type A11yMetadata, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationOffset, type AnnotationPosition, type ArcMark, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarTableCell, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, COMPACT_WIDTH, type CalculateExpression, type CalculateTransform, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientDef, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, NARROW_VIEWPORT_MAX, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RadialGradient, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness, wrapText };
|
|
3468
|
+
export { type A11yMetadata, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationOffset, type AnnotationPosition, type ArcMark, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarTableCell, type BaseLegendLayout, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, COMPACT_WIDTH, type CalculateExpression, type CalculateTransform, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, NARROW_VIEWPORT_MAX, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RadialGradient, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness, tileMap, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -212,6 +212,9 @@ function isGraphSpec(spec) {
|
|
|
212
212
|
function isSankeySpec(spec) {
|
|
213
213
|
return "type" in spec && spec.type === "sankey";
|
|
214
214
|
}
|
|
215
|
+
function isTileMapSpec(spec) {
|
|
216
|
+
return "type" in spec && spec.type === "tilemap";
|
|
217
|
+
}
|
|
215
218
|
function isTextAnnotation(annotation) {
|
|
216
219
|
return annotation.type === "text";
|
|
217
220
|
}
|
|
@@ -2856,6 +2859,21 @@ function dataTable(data, options) {
|
|
|
2856
2859
|
if (options?.responsive !== void 0) spec.responsive = options.responsive;
|
|
2857
2860
|
return spec;
|
|
2858
2861
|
}
|
|
2862
|
+
function tileMap(data, options) {
|
|
2863
|
+
return {
|
|
2864
|
+
type: "tilemap",
|
|
2865
|
+
data,
|
|
2866
|
+
...options?.encoding && { encoding: options.encoding },
|
|
2867
|
+
...options?.palette && { palette: options.palette },
|
|
2868
|
+
...options?.chrome && { chrome: options.chrome },
|
|
2869
|
+
...options?.legend && { legend: options.legend },
|
|
2870
|
+
...options?.theme && { theme: options.theme },
|
|
2871
|
+
...options?.darkMode && { darkMode: options.darkMode },
|
|
2872
|
+
...options?.watermark !== void 0 && { watermark: options.watermark },
|
|
2873
|
+
...options?.animation && { animation: options.animation },
|
|
2874
|
+
...options?.valueFormat && { valueFormat: options.valueFormat }
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2859
2877
|
export {
|
|
2860
2878
|
AXIS_TITLE_OFFSET_COMPACT,
|
|
2861
2879
|
AXIS_TITLE_OFFSET_DEFAULT,
|
|
@@ -2934,6 +2952,7 @@ export {
|
|
|
2934
2952
|
isSankeySpec,
|
|
2935
2953
|
isTableSpec,
|
|
2936
2954
|
isTextAnnotation,
|
|
2955
|
+
isTileMapSpec,
|
|
2937
2956
|
lineChart,
|
|
2938
2957
|
meetsAA,
|
|
2939
2958
|
pieChart,
|
|
@@ -2943,6 +2962,7 @@ export {
|
|
|
2943
2962
|
resolveTheme,
|
|
2944
2963
|
scatterChart,
|
|
2945
2964
|
simulateColorBlindness,
|
|
2965
|
+
tileMap,
|
|
2946
2966
|
wrapText
|
|
2947
2967
|
};
|
|
2948
2968
|
//# sourceMappingURL=index.js.map
|