@opendata-ai/openchart-vanilla 6.11.0 → 6.13.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.
@@ -1,42 +1,4 @@
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
-
40
2
  // ../../node_modules/.bun/d3-force@3.0.0/node_modules/d3-force/src/center.js
41
3
  function center_default(x, y) {
42
4
  var nodes, strength = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-vanilla",
3
- "version": "6.11.0",
3
+ "version": "6.13.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",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@floating-ui/dom": "^1.7.6",
53
- "@opendata-ai/openchart-core": "6.11.0",
54
- "@opendata-ai/openchart-engine": "6.11.0",
53
+ "@opendata-ai/openchart-core": "6.13.0",
54
+ "@opendata-ai/openchart-engine": "6.13.0",
55
55
  "d3-force": "^3.0.0",
56
56
  "d3-quadtree": "^3.0.1"
57
57
  },
@@ -771,4 +771,11 @@ describe('brand watermark', () => {
771
771
  const brandLink = svg.querySelector('.oc-chrome-ref');
772
772
  expect(brandLink).toBeNull();
773
773
  });
774
+
775
+ it('does not render brand when layout.watermark is false', () => {
776
+ const spec: ChartSpec = { ...lineSpec, watermark: false };
777
+ const { svg } = renderSpec(spec);
778
+ const brandLink = svg.querySelector('.oc-chrome-ref');
779
+ expect(brandLink).toBeNull();
780
+ });
774
781
  });
@@ -229,7 +229,9 @@ export class GraphCanvasRenderer {
229
229
  ctx.restore();
230
230
 
231
231
  // Brand watermark in screen coordinates (unaffected by pan/zoom)
232
- this.drawBrand(ctx, cssWidth, cssHeight, theme);
232
+ if (state.watermark) {
233
+ this.drawBrand(ctx, cssWidth, cssHeight, theme);
234
+ }
233
235
  }
234
236
 
235
237
  // -------------------------------------------------------------------------
@@ -42,4 +42,6 @@ export interface GraphRenderState {
42
42
  searchMatches: Set<string> | null;
43
43
  /** True during active pan/zoom gestures. Renderer skips labels and glow. */
44
44
  isGesturing: boolean;
45
+ /** Whether the tryOpenData.ai watermark is enabled. */
46
+ watermark: boolean;
45
47
  }
@@ -35,6 +35,8 @@ export interface GraphMountOptions {
35
35
  theme?: ThemeConfig;
36
36
  darkMode?: DarkMode;
37
37
  responsive?: boolean;
38
+ /** Show the tryOpenData.ai watermark. Defaults to true. */
39
+ watermark?: boolean;
38
40
  /** Show the built-in tooltip on node/edge hover. Defaults to true. */
39
41
  tooltip?: boolean;
40
42
  /** Show the built-in legend. Defaults to true. */
@@ -157,6 +159,7 @@ export function createGraph(
157
159
  height,
158
160
  theme: options?.theme,
159
161
  darkMode,
162
+ watermark: options?.watermark,
160
163
  };
161
164
 
162
165
  return compileGraph(currentSpec, compileOpts);
@@ -465,6 +468,7 @@ export function createGraph(
465
468
  theme: compilation.theme,
466
469
  searchMatches: searchManager.getMatches(),
467
470
  isGesturing,
471
+ watermark: compilation.watermark,
468
472
  };
469
473
 
470
474
  renderer.render(state);
package/src/mount.ts CHANGED
@@ -57,6 +57,8 @@ export interface MountOptions extends ChartEventHandlers {
57
57
  onDataPointClick?: (data: Record<string, unknown>) => void;
58
58
  /** Enable responsive resizing. Defaults to true. */
59
59
  responsive?: boolean;
60
+ /** Show the tryOpenData.ai watermark. Defaults to true. */
61
+ watermark?: boolean;
60
62
  /** Initial selected element. */
61
63
  selectedElement?: ElementRef;
62
64
  }
@@ -1820,6 +1822,7 @@ export function createChart(
1820
1822
  height,
1821
1823
  theme: options?.theme,
1822
1824
  darkMode,
1825
+ watermark: options?.watermark,
1823
1826
  measureText,
1824
1827
  };
1825
1828
 
@@ -38,6 +38,8 @@ export interface SankeyMountOptions {
38
38
  darkMode?: DarkMode;
39
39
  /** Enable responsive resizing. Defaults to true. */
40
40
  responsive?: boolean;
41
+ /** Show the tryOpenData.ai watermark. Defaults to true. */
42
+ watermark?: boolean;
41
43
  /** Show tooltips on hover. Defaults to true. */
42
44
  tooltip?: boolean;
43
45
  /** Callback when a node is clicked. */
@@ -140,6 +142,7 @@ export function createSankey(
140
142
  height,
141
143
  theme: options?.theme,
142
144
  darkMode,
145
+ watermark: options?.watermark,
143
146
  };
144
147
 
145
148
  return compileSankey(currentSpec, compileOpts);
@@ -608,7 +608,9 @@ export function renderSankeySVG(
608
608
  renderChrome(svg, layout);
609
609
 
610
610
  // Brand
611
- renderBrand(svg, layout);
611
+ if (layout.watermark) {
612
+ renderBrand(svg, layout);
613
+ }
612
614
 
613
615
  return svg;
614
616
  }
@@ -1331,7 +1331,9 @@ export function renderChartSVG(
1331
1331
  renderChrome(svg, layout);
1332
1332
 
1333
1333
  // Brand renders as a footer item, right-aligned on the source/footer row
1334
- renderBrand(svg, layout);
1334
+ if (layout.watermark) {
1335
+ renderBrand(svg, layout);
1336
+ }
1335
1337
 
1336
1338
  // Reset module-level state after rendering
1337
1339
  currentAnimation = undefined;
@@ -39,6 +39,8 @@ export interface TableMountOptions {
39
39
  theme?: ThemeConfig;
40
40
  darkMode?: DarkMode;
41
41
  responsive?: boolean;
42
+ /** Show the tryOpenData.ai watermark. Defaults to true. */
43
+ watermark?: boolean;
42
44
  onRowClick?: (row: Record<string, unknown>) => void;
43
45
  onStateChange?: (state: TableState) => void;
44
46
  externalState?: { sort?: SortState | null; search?: string; page?: number };
@@ -175,6 +177,7 @@ export function createTable(
175
177
  height: 600,
176
178
  theme: options?.theme,
177
179
  darkMode,
180
+ watermark: options?.watermark,
178
181
  sort: state.sort ?? undefined,
179
182
  search: state.search || undefined,
180
183
  page: state.page,
@@ -390,18 +390,20 @@ export function renderTable(
390
390
  wrapper.appendChild(liveRegion);
391
391
 
392
392
  // Brand watermark
393
- const brandColor = theme ? theme.colors.axis : '#999999';
394
- const brand = document.createElement('div');
395
- brand.className = 'oc-table-ref';
396
- brand.style.cssText = 'text-align: right; padding: 4px 8px;';
397
- const brandLink = document.createElement('a');
398
- brandLink.href = BRAND_URL;
399
- brandLink.target = '_blank';
400
- brandLink.rel = 'noopener';
401
- 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'};`;
402
- brandLink.textContent = 'tryOpenData.ai';
403
- brand.appendChild(brandLink);
404
- wrapper.appendChild(brand);
393
+ if (layout.watermark) {
394
+ const brandColor = theme ? theme.colors.axis : '#999999';
395
+ const brand = document.createElement('div');
396
+ brand.className = 'oc-table-ref';
397
+ brand.style.cssText = 'text-align: right; padding: 4px 8px;';
398
+ const brandLink = document.createElement('a');
399
+ brandLink.href = BRAND_URL;
400
+ brandLink.target = '_blank';
401
+ brandLink.rel = 'noopener';
402
+ 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'};`;
403
+ brandLink.textContent = 'tryOpenData.ai';
404
+ brand.appendChild(brandLink);
405
+ wrapper.appendChild(brand);
406
+ }
405
407
 
406
408
  // Animation: stamp CSS custom properties and add oc-animate class BEFORE
407
409
  // DOM insertion to avoid a flash of final state.