@opendata-ai/openchart-vanilla 6.1.0 → 6.1.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.
@@ -1,4 +1,42 @@
1
1
  (() => {
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
33
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
34
+ }) : x)(function(x) {
35
+ if (typeof require !== "undefined")
36
+ return require.apply(this, arguments);
37
+ throw Error('Dynamic require of "' + x + '" is not supported');
38
+ });
39
+
2
40
  // ../../node_modules/.bun/d3-force@3.0.0/node_modules/d3-force/src/center.js
3
41
  function center_default(x, y) {
4
42
  var nodes, strength = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-vanilla",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
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",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@floating-ui/dom": "^1.7.6",
53
- "@opendata-ai/openchart-core": "workspace:*",
54
- "@opendata-ai/openchart-engine": "workspace:*",
53
+ "@opendata-ai/openchart-core": "6.1.2",
54
+ "@opendata-ai/openchart-engine": "6.1.2",
55
55
  "d3-force": "^3.0.0",
56
56
  "d3-quadtree": "^3.0.1"
57
57
  },
package/src/export.ts CHANGED
@@ -438,7 +438,7 @@ export function exportCSV(data: Record<string, unknown>[]): string {
438
438
  }
439
439
 
440
440
  function csvEscape(value: string): string {
441
- if (value.includes(',') || value.includes('"') || value.includes('\n')) {
441
+ if (value.includes(',') || value.includes('"') || value.includes('\n') || value.includes('\r')) {
442
442
  return `"${value.replace(/"/g, '""')}"`;
443
443
  }
444
444
  return value;
@@ -12,6 +12,7 @@
12
12
  * - Labels and glow skipped during active pan/zoom gestures
13
13
  */
14
14
 
15
+ import { BRAND_FONT_SIZE, BRAND_MIN_WIDTH } from '@opendata-ai/openchart-core';
15
16
  import type { GraphRenderState, PositionedEdge, PositionedNode } from './types';
16
17
 
17
18
  // ---------------------------------------------------------------------------
@@ -33,9 +34,6 @@ const TWO_PI = Math.PI * 2;
33
34
  /** Minimum node radius in screen pixels. Keeps nodes visible when zoomed out. */
34
35
  const MIN_SCREEN_RADIUS = 2.5;
35
36
 
36
- /** Minimum canvas width to render the brand watermark. */
37
- const BRAND_MIN_WIDTH = 120;
38
-
39
37
  // ---------------------------------------------------------------------------
40
38
  // Helpers (exported for testing)
41
39
  // ---------------------------------------------------------------------------
@@ -251,7 +249,7 @@ export class GraphCanvasRenderer {
251
249
  const padding = theme.spacing.padding;
252
250
  const x = w - padding;
253
251
  const y = h - padding;
254
- ctx.font = `600 20px ${theme.fonts.family}`;
252
+ ctx.font = `600 ${BRAND_FONT_SIZE}px ${theme.fonts.family}`;
255
253
  ctx.fillStyle = theme.colors.axis;
256
254
  ctx.globalAlpha = 0.55;
257
255
  ctx.textAlign = 'right';
@@ -27,7 +27,7 @@ import type {
27
27
  TextStyle,
28
28
  TickMarkLayout,
29
29
  } from '@opendata-ai/openchart-core';
30
- import { estimateTextWidth } from '@opendata-ai/openchart-core';
30
+ import { BRAND_FONT_SIZE, BRAND_MIN_WIDTH, estimateTextWidth } from '@opendata-ai/openchart-core';
31
31
 
32
32
  const SVG_NS = 'http://www.w3.org/2000/svg';
33
33
 
@@ -1066,8 +1066,6 @@ function renderLegend(parent: SVGElement, legend: LegendLayout): void {
1066
1066
  // Brand rendering
1067
1067
  // ---------------------------------------------------------------------------
1068
1068
 
1069
- const BRAND_FONT_SIZE = 20;
1070
- const BRAND_MIN_WIDTH = 120;
1071
1069
  const BRAND_URL = 'https://tryopendata.ai';
1072
1070
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
1073
1071
 
@@ -70,7 +70,7 @@ function resolveDarkMode(mode?: DarkMode): boolean {
70
70
  // ---------------------------------------------------------------------------
71
71
 
72
72
  function csvEscape(value: string): string {
73
- if (value.includes(',') || value.includes('"') || value.includes('\n')) {
73
+ if (value.includes(',') || value.includes('"') || value.includes('\n') || value.includes('\r')) {
74
74
  return `"${value.replace(/"/g, '""')}"`;
75
75
  }
76
76
  return value;
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { ResolvedColumn, TableLayout, TableRow } from '@opendata-ai/openchart-core';
10
+ import { BRAND_FONT_SIZE } from '@opendata-ai/openchart-core';
10
11
  import { renderCell } from './renderers/table-cells';
11
12
 
12
13
  // ---------------------------------------------------------------------------
@@ -14,7 +15,6 @@ import { renderCell } from './renderers/table-cells';
14
15
  // ---------------------------------------------------------------------------
15
16
 
16
17
  const BRAND_URL = 'https://tryopendata.ai';
17
- const BRAND_FONT_SIZE = 20;
18
18
 
19
19
  // ---------------------------------------------------------------------------
20
20
  // Chrome rendering