@opendata-ai/openchart-vanilla 8.8.0 → 8.9.1

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 (37) hide show
  1. package/dist/{chunk-SXTHPXG6.js → chunk-APMUBW72.js} +174 -65
  2. package/dist/chunk-APMUBW72.js.map +1 -0
  3. package/dist/{chunk-QBTRAQAX.js → chunk-CCRFYGHU.js} +2299 -1766
  4. package/dist/chunk-CCRFYGHU.js.map +1 -0
  5. package/dist/{chunk-5IMVUHVC.js → chunk-GX6BWMJD.js} +23 -21
  6. package/dist/chunk-GX6BWMJD.js.map +1 -0
  7. package/dist/{chunk-DFKLAB67.js → chunk-MGFXAROR.js} +20 -8
  8. package/dist/chunk-MGFXAROR.js.map +1 -0
  9. package/dist/{chunk-EZQDCLZN.js → chunk-Q7YEEF2X.js} +3 -2
  10. package/dist/{chunk-EZQDCLZN.js.map → chunk-Q7YEEF2X.js.map} +1 -1
  11. package/dist/{chunk-I73B3DJI.js → chunk-R5TZHNTG.js} +23 -5
  12. package/dist/chunk-R5TZHNTG.js.map +1 -0
  13. package/dist/{chunk-2OJZBMXM.js → chunk-REH5UQCL.js} +46 -46
  14. package/dist/{chunk-2OJZBMXM.js.map → chunk-REH5UQCL.js.map} +1 -1
  15. package/dist/{chunk-NG7CVCI2.js → chunk-UC4IHEUO.js} +16 -1
  16. package/dist/chunk-UC4IHEUO.js.map +1 -0
  17. package/dist/export-gif.d.ts +2 -2
  18. package/dist/export-gif.js +2 -2
  19. package/dist/graph-3d/index.d.ts +0 -27
  20. package/dist/graph-3d/index.js +9 -5
  21. package/dist/graph-3d/index.js.map +1 -1
  22. package/dist/index.d.ts +27 -5
  23. package/dist/index.js +635 -214
  24. package/dist/index.js.map +1 -1
  25. package/dist/{mount-WiY9BIr9.d.ts → mount-TEjIdF0m.d.ts} +16 -1
  26. package/dist/static.js +3 -3
  27. package/dist/story/index.d.ts +2 -2
  28. package/dist/story/index.js +5 -5
  29. package/dist/styles.css +1 -1
  30. package/dist/styles.css.map +1 -1
  31. package/package.json +4 -4
  32. package/dist/chunk-5IMVUHVC.js.map +0 -1
  33. package/dist/chunk-DFKLAB67.js.map +0 -1
  34. package/dist/chunk-I73B3DJI.js.map +0 -1
  35. package/dist/chunk-NG7CVCI2.js.map +0 -1
  36. package/dist/chunk-QBTRAQAX.js.map +0 -1
  37. package/dist/chunk-SXTHPXG6.js.map +0 -1
@@ -7,10 +7,11 @@ import {
7
7
  prefersReducedMotion,
8
8
  resolveDarkMode,
9
9
  resolveEase
10
- } from "./chunk-2OJZBMXM.js";
10
+ } from "./chunk-REH5UQCL.js";
11
11
  import {
12
- resolvedSurface
13
- } from "./chunk-NG7CVCI2.js";
12
+ resolvedSurface,
13
+ warnDeprecated
14
+ } from "./chunk-UC4IHEUO.js";
14
15
 
15
16
  // src/graph/renderer-registry.ts
16
17
  var registry = /* @__PURE__ */ new Map();
@@ -1412,6 +1413,14 @@ function attachGraphKeyboardNav(options) {
1412
1413
  function findNodeById(id) {
1413
1414
  return getNodes().find((n) => n.id === id);
1414
1415
  }
1416
+ function ensureFocus() {
1417
+ if (focusedNodeId && findNodeById(focusedNodeId)) return;
1418
+ focusedNodeId = getSelectedIds().find((id) => findNodeById(id)) ?? getNodes()[0]?.id ?? null;
1419
+ }
1420
+ function onFocus() {
1421
+ focusedNodeId = getSelectedIds().find((id) => findNodeById(id)) ?? focusedNodeId;
1422
+ ensureFocus();
1423
+ }
1415
1424
  function pickDirectionalNeighbor(fromNode, neighborIds, direction) {
1416
1425
  const nodes = getNodes();
1417
1426
  const candidates = nodes.filter((n) => neighborIds.has(n.id));
@@ -1444,19 +1453,9 @@ function attachGraphKeyboardNav(options) {
1444
1453
  return best?.id ?? null;
1445
1454
  }
1446
1455
  function onKeyDown(e) {
1456
+ if (e.key === "Tab") return;
1457
+ ensureFocus();
1447
1458
  switch (e.key) {
1448
- case "Tab": {
1449
- const selected = getSelectedIds();
1450
- const nodes = getNodes();
1451
- if (nodes.length === 0) return;
1452
- if (selected.length > 0) {
1453
- focusedNodeId = selected[0];
1454
- } else if (!focusedNodeId || !findNodeById(focusedNodeId)) {
1455
- focusedNodeId = nodes[0].id;
1456
- }
1457
- e.preventDefault();
1458
- break;
1459
- }
1460
1459
  case "ArrowUp":
1461
1460
  case "ArrowDown":
1462
1461
  case "ArrowLeft":
@@ -1526,8 +1525,10 @@ function attachGraphKeyboardNav(options) {
1526
1525
  }
1527
1526
  }
1528
1527
  canvas.addEventListener("keydown", onKeyDown);
1528
+ canvas.addEventListener("focus", onFocus);
1529
1529
  return () => {
1530
1530
  canvas.removeEventListener("keydown", onKeyDown);
1531
+ canvas.removeEventListener("focus", onFocus);
1531
1532
  };
1532
1533
  }
1533
1534
 
@@ -2196,10 +2197,6 @@ var SimulationManager = class _SimulationManager {
2196
2197
  }
2197
2198
  };
2198
2199
 
2199
- // src/graph/spatial-index.ts
2200
- var SpatialIndex2 = class extends SpatialIndex {
2201
- };
2202
-
2203
2200
  // src/graph/update-diff-config.ts
2204
2201
  function stableKey(c) {
2205
2202
  return JSON.stringify([
@@ -2374,7 +2371,7 @@ function createGraph(container, spec, options) {
2374
2371
  let legendController = null;
2375
2372
  let renderer = null;
2376
2373
  let simulation = null;
2377
- const spatialIndex = new SpatialIndex2();
2374
+ const spatialIndex = new SpatialIndex();
2378
2375
  let interactionManager = null;
2379
2376
  const searchManager = new GraphSearchManager();
2380
2377
  let tooltipManager = null;
@@ -3118,6 +3115,8 @@ function createGraph(container, spec, options) {
3118
3115
  getAdjacency: () => adjacencyMap,
3119
3116
  onSelect(nodeId) {
3120
3117
  selectedNodeIds = /* @__PURE__ */ new Set([nodeId]);
3118
+ interactionManager?.setSelection([nodeId]);
3119
+ armFocus(performance.now());
3121
3120
  needsRender = true;
3122
3121
  scheduleRender();
3123
3122
  options?.onNodeClick?.(nodeDataById(nodeId));
@@ -3125,6 +3124,8 @@ function createGraph(container, spec, options) {
3125
3124
  },
3126
3125
  onDeselect() {
3127
3126
  selectedNodeIds.clear();
3127
+ interactionManager?.setSelection([]);
3128
+ armFocus(performance.now());
3128
3129
  needsRender = true;
3129
3130
  scheduleRender();
3130
3131
  options?.onSelectionChange?.([]);
@@ -3438,6 +3439,7 @@ function createGraph(container, spec, options) {
3438
3439
  }
3439
3440
  }
3440
3441
  function updateVisuals(newSpec) {
3442
+ warnDeprecated("updateVisuals is deprecated; use update.");
3441
3443
  update(newSpec);
3442
3444
  }
3443
3445
  function teardownSimOnly() {
@@ -3580,4 +3582,4 @@ export {
3580
3582
  reheatAlpha,
3581
3583
  createGraph
3582
3584
  };
3583
- //# sourceMappingURL=chunk-5IMVUHVC.js.map
3585
+ //# sourceMappingURL=chunk-GX6BWMJD.js.map