@opendata-ai/openchart-vanilla 8.9.1 → 9.0.0-rc.2

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.
Files changed (51) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-REH5UQCL.js → chunk-46E3QB6O.js} +6 -20
  3. package/dist/chunk-46E3QB6O.js.map +1 -0
  4. package/dist/{chunk-APMUBW72.js → chunk-5OQZRGUL.js} +1565 -294
  5. package/dist/chunk-5OQZRGUL.js.map +1 -0
  6. package/dist/{chunk-GX6BWMJD.js → chunk-5ZLSMZRM.js} +466 -330
  7. package/dist/chunk-5ZLSMZRM.js.map +1 -0
  8. package/dist/{chunk-SDJHUELU.js → chunk-A5C4VCUO.js} +26 -45
  9. package/dist/chunk-A5C4VCUO.js.map +1 -0
  10. package/dist/{chunk-MGFXAROR.js → chunk-CMIJA63X.js} +5 -3
  11. package/dist/chunk-CMIJA63X.js.map +1 -0
  12. package/dist/chunk-FFP5GXIP.js +45 -0
  13. package/dist/chunk-FFP5GXIP.js.map +1 -0
  14. package/dist/{chunk-Q7YEEF2X.js → chunk-LDSPJFOU.js} +16 -50
  15. package/dist/chunk-LDSPJFOU.js.map +1 -0
  16. package/dist/chunk-NLKQ5AOA.js +448 -0
  17. package/dist/chunk-NLKQ5AOA.js.map +1 -0
  18. package/dist/{chunk-R5TZHNTG.js → chunk-RBXIZJPE.js} +17 -5
  19. package/dist/chunk-RBXIZJPE.js.map +1 -0
  20. package/dist/{chunk-CCRFYGHU.js → chunk-RY5JEGFM.js} +2368 -2339
  21. package/dist/chunk-RY5JEGFM.js.map +1 -0
  22. package/dist/export-gif.d.ts +2 -2
  23. package/dist/export-gif.js +4 -3
  24. package/dist/graph-3d/index.d.ts +28 -1
  25. package/dist/graph-3d/index.js +26 -12
  26. package/dist/graph-3d/index.js.map +1 -1
  27. package/dist/index.d.ts +155 -29
  28. package/dist/index.js +1774 -186
  29. package/dist/index.js.map +1 -1
  30. package/dist/{mount-TEjIdF0m.d.ts → mount-types-DeUCa2hy.d.ts} +34 -21
  31. package/dist/{renderer-registry-Cng76n8F.d.ts → renderer-registry-Bu22Roek.d.ts} +5 -22
  32. package/dist/simulation-worker.js +27 -26
  33. package/dist/static.d.ts +4 -2
  34. package/dist/static.js +34 -10
  35. package/dist/static.js.map +1 -1
  36. package/dist/story/index.d.ts +8 -6
  37. package/dist/story/index.js +15 -12
  38. package/dist/story/index.js.map +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/styles.css.map +1 -1
  41. package/package.json +3 -3
  42. package/dist/chunk-APMUBW72.js.map +0 -1
  43. package/dist/chunk-CCRFYGHU.js.map +0 -1
  44. package/dist/chunk-GX6BWMJD.js.map +0 -1
  45. package/dist/chunk-MGFXAROR.js.map +0 -1
  46. package/dist/chunk-Q7YEEF2X.js.map +0 -1
  47. package/dist/chunk-R5TZHNTG.js.map +0 -1
  48. package/dist/chunk-REH5UQCL.js.map +0 -1
  49. package/dist/chunk-SDJHUELU.js.map +0 -1
  50. package/dist/chunk-UC4IHEUO.js +0 -73
  51. package/dist/chunk-UC4IHEUO.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { ChartLayout, ChartSpec, CompileOptions, TableLayout, TableSpec, VizSpec } from '@opendata-ai/openchart-engine';
2
- import { BarListSpec, BarListLayout, ThemeConfig, DarkMode, ChartLayout, ChartSpec, LayerSpec, GeoMapSpec, GeoMapLayout, ReaderSelection, DataRow, RectMark, Mark, BarTableCell, CategoryTableCell, TableCell, FlagTableCell, HeatmapTableCell, ImageTableCell, SparklineTableCell, TextTableCell, SankeySpec, SankeyLayout, TableSpec, SortState, TableLayout, TileMapSpec, TileMapLayout, ResolvedYouDrawIt } from '@opendata-ai/openchart-core';
3
- import { J as JPGExportOptions, S as SVGExportOptions, C as Camera, a as ChartInstance } from './mount-TEjIdF0m.js';
4
- export { E as ExportOptions, M as MountOptions, P as PNGExportOptions, U as UpdateOptions, c as createChart, e as exportCSV, b as exportJPG, d as exportPNG, f as exportSVG, g as exportSVGWithFonts } from './mount-TEjIdF0m.js';
5
- export { C as CameraFlightOptions, G as GRAPH_3D_NOT_REGISTERED_ERROR, a as GraphCamera, b as GraphFlyTarget, c as GraphHighlightTarget, d as GraphInstance, e as GraphLegendData, f as GraphMountOptions, g as GraphRendererContext, h as GraphRendererFactory, i as GraphShell, j as GraphTooltipFormatter, k as GraphTooltipItem, T as TooltipManager, l as createGraph, m as createTooltipManager, r as registerGraphRenderer } from './renderer-registry-Cng76n8F.js';
2
+ import { BarListSpec, BarListLayout, ThemeConfig, DarkMode, ChartLayout, ChartSpec, LayerSpec, GraphSpec, GeoMapSpec, GeoMapLayout, DatasetBinding, DesignDiagnostic, GeoReaderSelection, GeoEntityRef, ReaderChangeMeta, DataRow, ReaderSelection, ReaderSliceSelection, ReaderSlice, RectMark, Mark, BarTableCell, CategoryTableCell, TableCell, FlagTableCell, HeatmapTableCell, ImageTableCell, SparklineTableCell, TextTableCell, SankeySpec, SankeyLayout, TableSpec, SortState, TableLayout, TileMapSpec, TileMapLayout, ResolvedYouDrawIt } from '@opendata-ai/openchart-core';
3
+ import { J as JPGExportOptions, S as SVGExportOptions, C as Camera, M as MountOptions, a as ChartInstance } from './mount-types-DeUCa2hy.js';
4
+ export { E as ExportOptions, I as InteractionMode, P as PNGExportOptions, U as UpdateOptions, e as exportCSV, b as exportJPG, c as exportPNG, d as exportSVG, f as exportSVGWithFonts, r as resolveInteractionMode } from './mount-types-DeUCa2hy.js';
5
+ import { G as GraphMountOptions, a as GraphInstance } from './renderer-registry-Bu22Roek.js';
6
+ export { C as CameraFlightOptions, b as GRAPH_3D_NOT_REGISTERED_ERROR, c as GraphCamera, d as GraphFlyTarget, e as GraphHighlightTarget, f as GraphLegendData, g as GraphRendererContext, h as GraphRendererFactory, i as GraphShell, j as GraphTooltipFormatter, k as GraphTooltipItem, T as TooltipManager, l as createTooltipManager, r as registerGraphRenderer } from './renderer-registry-Bu22Roek.js';
6
7
  import './export-gif.js';
7
8
  import '@floating-ui/dom';
8
9
 
@@ -17,7 +18,8 @@ import '@floating-ui/dom';
17
18
  interface BarListMountOptions {
18
19
  theme?: ThemeConfig;
19
20
  darkMode?: DarkMode;
20
- responsive?: boolean;
21
+ /** Observe container resizing. Defaults to true. */
22
+ autoResize?: boolean;
21
23
  watermark?: boolean;
22
24
  tooltip?: boolean;
23
25
  onRowClick?: (row: {
@@ -155,6 +157,25 @@ interface SpecSequenceOptions {
155
157
  */
156
158
  declare function exportSpecSequence(specs: Array<ChartSpec | LayerSpec>, options: SpecSequenceOptions): Promise<Blob>;
157
159
 
160
+ /**
161
+ * Graph mount API: the main entry point for vanilla JS graph usage.
162
+ *
163
+ * createGraph() takes a container, GraphSpec, and options, compiles the graph,
164
+ * creates a force simulation, canvas renderer, spatial index, interaction
165
+ * manager, and search manager, then runs an animation loop driven by
166
+ * simulation ticks. Returns a GraphInstance with update/search/zoom/destroy.
167
+ */
168
+
169
+ /**
170
+ * Create a graph instance from a spec and mount it into a container.
171
+ *
172
+ * @param container - The DOM element to render into.
173
+ * @param spec - The graph spec.
174
+ * @param options - Mount options.
175
+ * @returns A GraphInstance with update/search/zoom/destroy methods.
176
+ */
177
+ declare function createGraph(container: HTMLElement, spec: GraphSpec, options?: GraphMountOptions): GraphInstance;
178
+
158
179
  /**
159
180
  * Creates a Web Worker running the force simulation.
160
181
  *
@@ -175,33 +196,38 @@ declare function createSimulationWorker(): Worker;
175
196
  */
176
197
 
177
198
  interface GeoMapCameraOptions {
199
+ /** Explicit camera scope for an authored inset or the root view. */
200
+ viewId?: string;
178
201
  /** Transition duration in ms. 0 snaps instantly. Default 600. */
179
202
  duration?: number;
180
203
  /** Padding in map-local units around the target. Default 16. */
181
204
  padding?: number;
182
205
  }
183
206
 
184
- /**
185
- * Map mount API: the main entry point for vanilla JS map usage.
186
- *
187
- * createGeoMap() takes a container, GeoMapSpec, and options, compiles the
188
- * map, renders it as SVG, sets up responsive resizing, tooltip interaction,
189
- * and returns a GeoMapInstance with update/resize/export/destroy.
190
- */
207
+ type LabelInventoryOptions = false | {
208
+ container: HTMLElement;
209
+ };
191
210
 
192
211
  type GeoMapMarkEvent = {
193
212
  kind: 'feature' | 'point';
194
213
  id: string | number;
195
214
  name?: string;
196
215
  data: Record<string, unknown> | null;
216
+ viewId?: string;
217
+ layerId?: string;
197
218
  };
219
+ interface GeoMapCameraChangeMeta {
220
+ viewId: string;
221
+ }
198
222
  interface GeoMapMountOptions {
223
+ /** Optional host for the visible Map places and notes disclosure. */
224
+ labelInventory?: LabelInventoryOptions;
199
225
  /** Theme overrides. */
200
226
  theme?: ThemeConfig;
201
227
  /** Dark mode setting: "auto" (system pref), "force", or "off". */
202
228
  darkMode?: DarkMode;
203
- /** Enable responsive resizing. Defaults to true. */
204
- responsive?: boolean;
229
+ /** Observe container resizing. Defaults to true. */
230
+ autoResize?: boolean;
205
231
  /** Show the OpenData watermark. Defaults to true. */
206
232
  watermark?: boolean;
207
233
  /** Show tooltips on hover. Defaults to true. */
@@ -216,9 +242,11 @@ interface GeoMapMountOptions {
216
242
  * animated move. `cx`/`cy` are the view center in map-frame units, `k` the
217
243
  * zoom factor (1 = full map).
218
244
  */
219
- onCameraChange?: (camera: Camera) => void;
245
+ onCameraChange?: (camera: Camera, meta?: GeoMapCameraChangeMeta) => void;
220
246
  }
221
247
  interface GeoMapInstance {
248
+ /** Replace the disclosure host without resetting the camera or map. */
249
+ setLabelInventory(options?: LabelInventoryOptions): void;
222
250
  /** Re-compile and re-render with a new spec. */
223
251
  update(spec: GeoMapSpec): void;
224
252
  /** Re-compile at current container dimensions. */
@@ -244,15 +272,58 @@ interface GeoMapInstance {
244
272
  /** Reset the camera to the full map view. */
245
273
  resetView(opts?: GeoMapCameraOptions): void;
246
274
  /** Get a snapshot of the current camera state. */
247
- getCamera(): Camera;
275
+ getCamera(viewId?: string): Camera;
276
+ /** Defensive snapshots of every current view camera, including root. */
277
+ getCameras(): Readonly<Record<string, Camera>>;
248
278
  /** Set the camera to an exact state (no animation). */
249
- setCamera(camera: Camera): void;
279
+ setCamera(camera: Camera, options?: {
280
+ viewId?: string;
281
+ }): void;
250
282
  }
251
283
  /**
252
284
  * Create a map instance from a spec and mount it into a container.
253
285
  */
254
286
  declare function createGeoMap(container: HTMLElement, spec: GeoMapSpec, options?: GeoMapMountOptions): GeoMapInstance;
255
287
 
288
+ interface MapCompanionOptions {
289
+ container: HTMLElement;
290
+ search?: boolean;
291
+ rank?: 'ascending' | 'descending';
292
+ kind?: 'feature' | 'point';
293
+ pageSize?: number;
294
+ }
295
+
296
+ interface ReaderPresentationOptions {
297
+ mode?: 'observations' | 'slices';
298
+ panel?: false | {
299
+ container: HTMLElement;
300
+ };
301
+ comparison?: 'values' | 'absolute' | 'relative';
302
+ allowNegativeRelative?: boolean;
303
+ binding?: DatasetBinding;
304
+ /** Source data revision. Geometry-only changes preserve the current revision. */
305
+ revision?: string;
306
+ onDiagnostic?: (diagnostic: DesignDiagnostic) => void;
307
+ }
308
+ interface ReaderSetOptions {
309
+ notify?: boolean;
310
+ }
311
+
312
+ interface GeoReaderOptions extends Omit<ReaderPresentationOptions, 'mode'> {
313
+ companion?: false | MapCompanionOptions;
314
+ }
315
+ interface GeoReaderController {
316
+ readonly selection: GeoReaderSelection;
317
+ update(spec: GeoMapSpec, visibleKeys?: ReadonlySet<string>): void;
318
+ setOptions(options: GeoReaderOptions): void;
319
+ setSelection(next: GeoReaderSelection, options?: ReaderSetOptions): void;
320
+ pin(ref: GeoEntityRef): void;
321
+ preview(ref: GeoEntityRef | null): void;
322
+ clear(): void;
323
+ destroy(): void;
324
+ }
325
+ declare function createGeoReader(container: HTMLElement, instance: GeoMapInstance, initial: GeoMapSpec, onChange: (selection: GeoReaderSelection, meta: ReaderChangeMeta) => void, initialOptions?: GeoReaderOptions): GeoReaderController;
326
+
256
327
  /**
257
328
  * Default cap on the mark count that still runs a tweened data-update
258
329
  * transition. Override per chart with `animation.update.maxMarks`.
@@ -269,20 +340,74 @@ declare const DEFAULT_UPDATE_MAX_MARKS = 500;
269
340
  */
270
341
  declare const CANVAS_DEFAULT_UPDATE_MAX_MARKS = 20000;
271
342
 
343
+ /**
344
+ * Mount API: the main entry point for vanilla JS usage.
345
+ *
346
+ * createChart() takes a container, spec, and options, compiles the chart,
347
+ * renders it as SVG, sets up responsive resizing, tooltip interaction
348
+ * (mouse/touch/keyboard), keyboard navigation between data points,
349
+ * and returns a ChartInstance with update/resize/export/destroy methods.
350
+ */
351
+
352
+ /**
353
+ * Create a chart instance from a spec and mount it into a container.
354
+ */
355
+ declare function createChart<TData extends DataRow = DataRow>(container: HTMLElement, spec: ChartSpec<TData> | LayerSpec<TData>, options?: MountOptions): ChartInstance;
356
+
272
357
  interface ReaderController {
273
358
  readonly selection: ReaderSelection;
274
359
  /** Call after chart.update(). Without an override, visibility follows compiled marks. */
275
360
  update(spec: ChartSpec | LayerSpec, visibleKeys?: ReadonlySet<string>): void;
276
361
  pin(datum: DataRow): void;
277
362
  clear(): void;
363
+ setSelection(next: ReaderSelection, options?: ReaderSetOptions): void;
364
+ setOptions(options: ReaderPresentationOptions): void;
278
365
  destroy(): void;
279
366
  }
280
- /**
281
- * Persistent reader interaction, separate from editor ElementRef selection.
282
- * Layered specs clear/disable inspection and announce the unsupported binding;
283
- * updating back to a single chart resumes inspection without choosing a leaf.
284
- */
285
- declare function createReader(container: HTMLElement, instance: ChartInstance, initial: ChartSpec | LayerSpec, onChange: (selection: ReaderSelection) => void): ReaderController;
367
+
368
+ interface SliceReaderController {
369
+ readonly selection: ReaderSliceSelection;
370
+ update(spec: ChartSpec | LayerSpec, visibleObservationKeys?: ReadonlySet<string>): void;
371
+ pin(slice: ReaderSlice): void;
372
+ clear(): void;
373
+ setSelection(next: ReaderSliceSelection, options?: ReaderSetOptions): void;
374
+ setOptions(options: ReaderPresentationOptions): void;
375
+ destroy(): void;
376
+ }
377
+
378
+ declare function createReader(container: HTMLElement, instance: ChartInstance, spec: ChartSpec | LayerSpec, onChange: (selection: ReaderSelection, meta: ReaderChangeMeta) => void, options?: ReaderPresentationOptions & {
379
+ mode?: 'observations';
380
+ }): ReaderController;
381
+ declare function createReader(container: HTMLElement, instance: ChartInstance, spec: ChartSpec | LayerSpec, onChange: (selection: ReaderSliceSelection, meta: ReaderChangeMeta) => void, options: ReaderPresentationOptions & {
382
+ mode: 'slices';
383
+ }): SliceReaderController;
384
+
385
+ /** Framework lifecycle bridge; reader state survives a renderer-only remount. */
386
+
387
+ type ChartReaderSelection = ReaderSelection | ReaderSliceSelection;
388
+ type ChartReaderProps = {
389
+ reader?: false | (ReaderPresentationOptions & {
390
+ mode?: 'observations';
391
+ });
392
+ readerSelection?: ReaderSelection;
393
+ onReaderChange?: (selection: ReaderSelection, meta: ReaderChangeMeta) => void;
394
+ } | {
395
+ reader: ReaderPresentationOptions & {
396
+ mode: 'slices';
397
+ };
398
+ readerSelection?: ReaderSliceSelection;
399
+ onReaderChange?: (selection: ReaderSliceSelection, meta: ReaderChangeMeta) => void;
400
+ };
401
+ declare function createChartReaderBinding(): {
402
+ sync(container: HTMLElement, instance: ChartInstance, spec: ChartSpec | LayerSpec, options: ReaderPresentationOptions | false | undefined, selection: ChartReaderSelection | undefined, onChange?: (selection: ChartReaderSelection, meta: ReaderChangeMeta) => void): void;
403
+ detach: () => void;
404
+ destroy(): void;
405
+ };
406
+ declare function createGeoReaderBinding(): {
407
+ sync(container: HTMLElement, instance: GeoMapInstance, spec: GeoMapSpec, options: GeoReaderOptions | false | undefined, selection: GeoReaderSelection | undefined, onChange?: ((selection: GeoReaderSelection, meta: ReaderChangeMeta) => void) | undefined): void;
408
+ detach: () => void;
409
+ destroy(): void;
410
+ };
286
411
 
287
412
  /**
288
413
  * Mark rendering: dispatches to per-mark-type sub-renderers (line, area, rect,
@@ -366,8 +491,8 @@ interface SankeyMountOptions {
366
491
  theme?: ThemeConfig;
367
492
  /** Dark mode setting: "auto" (system pref), "force", or "off". */
368
493
  darkMode?: DarkMode;
369
- /** Enable responsive resizing. Defaults to true. */
370
- responsive?: boolean;
494
+ /** Observe container resizing. Defaults to true. */
495
+ autoResize?: boolean;
371
496
  /** Show the OpenData watermark. Defaults to true. */
372
497
  watermark?: boolean;
373
498
  /** Show tooltips on hover. Defaults to true. */
@@ -473,7 +598,8 @@ interface TableState {
473
598
  interface TableMountOptions {
474
599
  theme?: ThemeConfig;
475
600
  darkMode?: DarkMode;
476
- responsive?: boolean;
601
+ /** Observe container resizing (and re-apply width breakpoints). Defaults to true. */
602
+ autoResize?: boolean;
477
603
  /** Show the OpenData watermark. Defaults to true. */
478
604
  watermark?: boolean;
479
605
  onRowClick?: (row: Record<string, unknown>) => void;
@@ -564,8 +690,8 @@ interface TileMapMountOptions {
564
690
  theme?: ThemeConfig;
565
691
  /** Dark mode setting: "auto" (system pref), "force", or "off". */
566
692
  darkMode?: DarkMode;
567
- /** Enable responsive resizing. Defaults to true. */
568
- responsive?: boolean;
693
+ /** Observe container resizing. Defaults to true. */
694
+ autoResize?: boolean;
569
695
  /** Show the OpenData watermark. Defaults to true. */
570
696
  watermark?: boolean;
571
697
  /** Show tooltips on hover. Defaults to true. */
@@ -654,4 +780,4 @@ interface YouDrawItController {
654
780
  */
655
781
  declare function createYouDrawIt(options: YouDrawItOptions): YouDrawItController;
656
782
 
657
- export { type BarListInstance, type BarListMountOptions, CANVAS_DEFAULT_UPDATE_MAX_MARKS, Camera, ChartInstance, DEFAULT_UPDATE_MAX_MARKS, type GeoMapCameraOptions, type GeoMapInstance, type GeoMapMarkEvent, type GeoMapMountOptions, JPGExportOptions, type KeyboardNavOptions, type ReaderController, SVGExportOptions, type SankeyInstance, type SankeyMountOptions, type SpecSequenceOptions, type TableInstance, type TableMountOptions, type TableState, type TextEditOverlayConfig, type TileMapInstance, type TileMapMountOptions, VECTOR_EXPORT_MAX_POINTS, type YouDrawItController, type YouDrawItOptions, attachKeyboardNav, createBarList, createGeoMap, createReader, createSankey, createSimulationWorker, createTable, createTextEditOverlay, createTileMap, createYouDrawIt, exportSpecSequence, materializeCanvasModeSVG, observeResize, rectPathWithCorners, registerMarkRenderer, renderBarCell, renderCategoryCell, renderCell, renderChartSVG, renderFlagCell, renderHeatmapCell, renderImageCell, renderSparklineCell, renderTable, renderTextCell };
783
+ export { type BarListInstance, type BarListMountOptions, CANVAS_DEFAULT_UPDATE_MAX_MARKS, Camera, ChartInstance, type ChartReaderProps, type ChartReaderSelection, DEFAULT_UPDATE_MAX_MARKS, type GeoMapCameraChangeMeta, type GeoMapCameraOptions, type GeoMapInstance, type GeoMapMarkEvent, type GeoMapMountOptions, type GeoReaderController, type GeoReaderOptions, GraphInstance, GraphMountOptions, JPGExportOptions, type KeyboardNavOptions, MountOptions, type ReaderController, type ReaderPresentationOptions, type ReaderSetOptions, SVGExportOptions, type SankeyInstance, type SankeyMountOptions, type SliceReaderController, type SpecSequenceOptions, type TableInstance, type TableMountOptions, type TableState, type TextEditOverlayConfig, type TileMapInstance, type TileMapMountOptions, VECTOR_EXPORT_MAX_POINTS, type YouDrawItController, type YouDrawItOptions, attachKeyboardNav, createBarList, createChart, createChartReaderBinding, createGeoMap, createGeoReader, createGeoReaderBinding, createGraph, createReader, createSankey, createSimulationWorker, createTable, createTextEditOverlay, createTileMap, createYouDrawIt, exportSpecSequence, materializeCanvasModeSVG, observeResize, rectPathWithCorners, registerMarkRenderer, renderBarCell, renderCategoryCell, renderCell, renderChartSVG, renderFlagCell, renderHeatmapCell, renderImageCell, renderSparklineCell, renderTable, renderTextCell };