@opendata-ai/openchart-vanilla 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 +54 -2
- package/dist/index.js +644 -29
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/__tests__/compound-labels.test.ts +122 -0
- package/src/__tests__/crosshair.test.ts +121 -0
- package/src/__tests__/tilemap.test.ts +158 -0
- package/src/graph-mount.ts +1 -1
- package/src/index.ts +3 -0
- package/src/mount.ts +22 -2
- package/src/renderers/axes.ts +81 -20
- package/src/renderers/legend.ts +6 -2
- package/src/sankey-renderer.ts +4 -2
- package/src/svg-renderer.ts +21 -1
- package/src/tilemap-mount.ts +394 -0
- package/src/tilemap-renderer.ts +425 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ChartLayout, ChartSpec, CompileOptions, TableLayout, TableSpec, VizSpec } from '@opendata-ai/openchart-engine';
|
|
2
|
-
import { GraphSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, ElementRef, ChartLayout, ChartEventHandlers, BarTableCell, CategoryTableCell, TableCell, FlagTableCell, HeatmapTableCell, ImageTableCell, SparklineTableCell, TextTableCell, SankeySpec, SankeyLayout, Mark, TableSpec, SortState, TableLayout, TooltipContent } from '@opendata-ai/openchart-core';
|
|
2
|
+
import { GraphSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, ElementRef, ChartLayout, ChartEventHandlers, BarTableCell, CategoryTableCell, TableCell, FlagTableCell, HeatmapTableCell, ImageTableCell, SparklineTableCell, TextTableCell, SankeySpec, SankeyLayout, Mark, TableSpec, SortState, TableLayout, TileMapSpec, TileMapLayout, TooltipContent } from '@opendata-ai/openchart-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Export utilities: serialize charts to SVG, PNG, JPG, or CSV.
|
|
@@ -321,6 +321,7 @@ declare function registerMarkRenderer<T extends Mark>(type: T['type'], renderer:
|
|
|
321
321
|
*/
|
|
322
322
|
declare function renderChartSVG(layout: ChartLayout, container: HTMLElement, opts?: {
|
|
323
323
|
animate?: boolean;
|
|
324
|
+
crosshair?: boolean;
|
|
324
325
|
}): SVGElement;
|
|
325
326
|
|
|
326
327
|
/**
|
|
@@ -445,6 +446,57 @@ declare function createTextEditOverlay(config: TextEditOverlayConfig): {
|
|
|
445
446
|
destroy: () => void;
|
|
446
447
|
};
|
|
447
448
|
|
|
449
|
+
/**
|
|
450
|
+
* TileMap mount API: the main entry point for vanilla JS tilemap usage.
|
|
451
|
+
*
|
|
452
|
+
* createTileMap() takes a container, TileMapSpec, and options, compiles the
|
|
453
|
+
* tilemap, renders it as SVG, sets up responsive resizing, tooltip interaction,
|
|
454
|
+
* and returns a TileMapInstance with update/resize/export/destroy.
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
interface TileMapMountOptions {
|
|
458
|
+
/** Theme overrides. */
|
|
459
|
+
theme?: ThemeConfig;
|
|
460
|
+
/** Dark mode setting: "auto" (system pref), "force", or "off". */
|
|
461
|
+
darkMode?: DarkMode;
|
|
462
|
+
/** Enable responsive resizing. Defaults to true. */
|
|
463
|
+
responsive?: boolean;
|
|
464
|
+
/** Show the tryOpenData.ai watermark. Defaults to true. */
|
|
465
|
+
watermark?: boolean;
|
|
466
|
+
/** Show tooltips on hover. Defaults to true. */
|
|
467
|
+
tooltip?: boolean;
|
|
468
|
+
/** Callback when a tile is clicked. */
|
|
469
|
+
onTileClick?: (tile: {
|
|
470
|
+
stateCode: string;
|
|
471
|
+
stateName: string;
|
|
472
|
+
value: number | null;
|
|
473
|
+
data: Record<string, unknown>;
|
|
474
|
+
}) => void;
|
|
475
|
+
/** Callback when a tile is hovered (null on mouse leave). */
|
|
476
|
+
onTileHover?: (tile: {
|
|
477
|
+
stateCode: string;
|
|
478
|
+
stateName: string;
|
|
479
|
+
value: number | null;
|
|
480
|
+
data: Record<string, unknown>;
|
|
481
|
+
} | null) => void;
|
|
482
|
+
}
|
|
483
|
+
interface TileMapInstance {
|
|
484
|
+
/** Re-compile and re-render with a new spec. */
|
|
485
|
+
update(spec: TileMapSpec): void;
|
|
486
|
+
/** Re-compile at current container dimensions. */
|
|
487
|
+
resize(): void;
|
|
488
|
+
/** Export the tilemap. */
|
|
489
|
+
export(format: 'svg' | 'svg-with-fonts' | 'png' | 'jpg', options?: JPGExportOptions | SVGExportOptions): string | Promise<Blob> | Promise<string>;
|
|
490
|
+
/** Remove all DOM elements and disconnect observers. */
|
|
491
|
+
destroy(): void;
|
|
492
|
+
/** The current compiled layout. */
|
|
493
|
+
readonly layout: TileMapLayout;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Create a tilemap instance from a spec and mount it into a container.
|
|
497
|
+
*/
|
|
498
|
+
declare function createTileMap(container: HTMLElement, spec: TileMapSpec, options?: TileMapMountOptions): TileMapInstance;
|
|
499
|
+
|
|
448
500
|
/**
|
|
449
501
|
* Tooltip manager: creates and positions a floating tooltip element.
|
|
450
502
|
*
|
|
@@ -473,4 +525,4 @@ interface TooltipManager {
|
|
|
473
525
|
*/
|
|
474
526
|
declare function createTooltipManager(container: HTMLElement): TooltipManager;
|
|
475
527
|
|
|
476
|
-
export { type ChartInstance, type ExportOptions, type GraphInstance, type GraphMountOptions, type JPGExportOptions, type KeyboardNavOptions, type MountOptions, type PNGExportOptions, type SVGExportOptions, type SankeyInstance, type SankeyMountOptions, type TableInstance, type TableMountOptions, type TableState, type TextEditOverlayConfig, type TooltipManager, type UpdateOptions, attachKeyboardNav, createChart, createGraph, createSankey, createSimulationWorker, createTable, createTextEditOverlay, createTooltipManager, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, observeResize, registerMarkRenderer, renderBarCell, renderCategoryCell, renderCell, renderChartSVG, renderFlagCell, renderHeatmapCell, renderImageCell, renderSparklineCell, renderTable, renderTextCell };
|
|
528
|
+
export { type ChartInstance, type ExportOptions, type GraphInstance, type GraphMountOptions, type JPGExportOptions, type KeyboardNavOptions, type MountOptions, type PNGExportOptions, type SVGExportOptions, type SankeyInstance, type SankeyMountOptions, type TableInstance, type TableMountOptions, type TableState, type TextEditOverlayConfig, type TileMapInstance, type TileMapMountOptions, type TooltipManager, type UpdateOptions, attachKeyboardNav, createChart, createGraph, createSankey, createSimulationWorker, createTable, createTextEditOverlay, createTileMap, createTooltipManager, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, observeResize, registerMarkRenderer, renderBarCell, renderCategoryCell, renderCell, renderChartSVG, renderFlagCell, renderHeatmapCell, renderImageCell, renderSparklineCell, renderTable, renderTextCell };
|