@opendata-ai/openchart-vanilla 2.3.2 → 2.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-vanilla",
3
- "version": "2.3.2",
3
+ "version": "2.3.5",
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",
@@ -46,8 +46,8 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@opendata-ai/openchart-core": "2.3.2",
50
- "@opendata-ai/openchart-engine": "2.3.2",
49
+ "@opendata-ai/openchart-core": "2.3.5",
50
+ "@opendata-ai/openchart-engine": "2.3.5",
51
51
  "d3-force": "^3.0.0",
52
52
  "d3-quadtree": "^3.0.1"
53
53
  },
@@ -33,6 +33,9 @@ const TWO_PI = Math.PI * 2;
33
33
  /** Minimum node radius in screen pixels. Keeps nodes visible when zoomed out. */
34
34
  const MIN_SCREEN_RADIUS = 2.5;
35
35
 
36
+ /** Minimum canvas width to render the brand watermark. */
37
+ const BRAND_MIN_WIDTH = 120;
38
+
36
39
  // ---------------------------------------------------------------------------
37
40
  // Helpers (exported for testing)
38
41
  // ---------------------------------------------------------------------------
@@ -241,7 +244,7 @@ export class GraphCanvasRenderer {
241
244
  h: number,
242
245
  theme: GraphRenderState['theme'],
243
246
  ): void {
244
- if (w < 120) return;
247
+ if (w < BRAND_MIN_WIDTH) return;
245
248
  const { dpr } = this;
246
249
  ctx.save();
247
250
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
@@ -250,7 +253,7 @@ export class GraphCanvasRenderer {
250
253
  const y = h - padding;
251
254
  ctx.font = `600 20px ${theme.fonts.family}`;
252
255
  ctx.fillStyle = theme.colors.axis;
253
- ctx.globalAlpha = 0.5;
256
+ ctx.globalAlpha = 0.55;
254
257
  ctx.textAlign = 'right';
255
258
  ctx.textBaseline = 'alphabetic';
256
259
  ctx.fillText('OpenData', x, y);
@@ -9,6 +9,13 @@
9
9
  import type { ResolvedColumn, TableLayout, TableRow } from '@opendata-ai/openchart-core';
10
10
  import { renderCell } from './renderers/table-cells';
11
11
 
12
+ // ---------------------------------------------------------------------------
13
+ // Constants
14
+ // ---------------------------------------------------------------------------
15
+
16
+ const BRAND_URL = 'https://tryopendata.ai';
17
+ const BRAND_FONT_SIZE = 20;
18
+
12
19
  // ---------------------------------------------------------------------------
13
20
  // Chrome rendering
14
21
  // ---------------------------------------------------------------------------
@@ -351,10 +358,10 @@ export function renderTable(layout: TableLayout, container: HTMLElement): HTMLEl
351
358
  brand.className = 'viz-table-ref';
352
359
  brand.style.cssText = 'text-align: right; padding: 4px 8px;';
353
360
  const brandLink = document.createElement('a');
354
- brandLink.href = 'https://tryopendata.ai';
361
+ brandLink.href = BRAND_URL;
355
362
  brandLink.target = '_blank';
356
363
  brandLink.rel = 'noopener';
357
- brandLink.style.cssText = `font-size: 20px; font-weight: 600; color: ${brandColor}; opacity: 0.55; text-decoration: none; font-family: ${theme ? theme.fonts.family : 'sans-serif'};`;
364
+ brandLink.style.cssText = `font-size: ${BRAND_FONT_SIZE}px; font-weight: 600; color: ${brandColor}; opacity: 0.55; text-decoration: none; font-family: ${theme ? theme.fonts.family : 'sans-serif'};`;
358
365
  brandLink.textContent = 'OpenData';
359
366
  brand.appendChild(brandLink);
360
367
  wrapper.appendChild(brand);