@opendata-ai/openchart-vanilla 2.8.0 → 2.9.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/styles.css CHANGED
@@ -742,11 +742,13 @@ th[aria-sort="descending"] .viz-table-sort-btn::before {
742
742
  }
743
743
 
744
744
  /* Dark mode graph overrides (darker bg for canvas-based rendering) */
745
- .viz-dark .viz-graph-wrapper {
745
+ .viz-dark .viz-graph-wrapper,
746
+ .viz-graph-wrapper.viz-dark {
746
747
  --viz-bg: #0d1117;
747
748
  }
748
749
 
749
- .viz-dark .viz-graph-legend {
750
+ .viz-dark .viz-graph-legend,
751
+ .viz-dark.viz-graph-wrapper .viz-graph-legend {
750
752
  background: rgba(13, 17, 23, 0.85);
751
753
  border-color: rgba(255, 255, 255, 0.1);
752
754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-vanilla",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Vanilla JS renderer for openchart: SVG charts, HTML tables, force-directed graphs",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Riley Hilliard",
@@ -49,8 +49,8 @@
49
49
  "typecheck": "tsc --noEmit"
50
50
  },
51
51
  "dependencies": {
52
- "@opendata-ai/openchart-core": "2.8.0",
53
- "@opendata-ai/openchart-engine": "2.8.0",
52
+ "@opendata-ai/openchart-core": "2.9.0",
53
+ "@opendata-ai/openchart-engine": "2.9.0",
54
54
  "d3-force": "^3.0.0",
55
55
  "d3-quadtree": "^3.0.1"
56
56
  },
@@ -259,13 +259,26 @@ export function createGraph(
259
259
 
260
260
  // Wrapper
261
261
  wrapper = document.createElement('div');
262
- wrapper.className = 'viz-graph-wrapper';
262
+ wrapper.className = isDark ? 'viz-graph-wrapper viz-dark' : 'viz-graph-wrapper';
263
263
  if (isDark) {
264
264
  container.classList.add('viz-dark');
265
265
  } else {
266
266
  container.classList.remove('viz-dark');
267
267
  }
268
268
 
269
+ // Apply theme colors as CSS custom properties so chrome HTML picks them up.
270
+ // Without this, consumer-supplied theme.colors.text only affects canvas-drawn
271
+ // labels but not the HTML title/subtitle which read from --viz-text.
272
+ const resolvedTheme = compilation.theme;
273
+ if (resolvedTheme) {
274
+ const s = wrapper.style;
275
+ s.setProperty('--viz-bg', resolvedTheme.colors.background);
276
+ s.setProperty('--viz-text', resolvedTheme.colors.text);
277
+ s.setProperty('--viz-text-secondary', resolvedTheme.colors.axis ?? resolvedTheme.colors.text);
278
+ s.setProperty('--viz-font-family', resolvedTheme.fonts.family);
279
+ s.fontFamily = resolvedTheme.fonts.family;
280
+ }
281
+
269
282
  // Chrome (title, subtitle)
270
283
  chromeEl = document.createElement('div');
271
284
  chromeEl.className = 'viz-graph-chrome';