@opendata-ai/openchart-vanilla 6.7.0 → 6.7.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.
- package/dist/index.js +24 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/sankey-renderer.ts +19 -13
- package/src/svg-renderer.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendata-ai/openchart-vanilla",
|
|
3
|
-
"version": "6.7.
|
|
3
|
+
"version": "6.7.1",
|
|
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.7.
|
|
54
|
-
"@opendata-ai/openchart-engine": "6.7.
|
|
53
|
+
"@opendata-ai/openchart-core": "6.7.1",
|
|
54
|
+
"@opendata-ai/openchart-engine": "6.7.1",
|
|
55
55
|
"d3-force": "^3.0.0",
|
|
56
56
|
"d3-quadtree": "^3.0.1"
|
|
57
57
|
},
|
package/src/sankey-renderer.ts
CHANGED
|
@@ -15,12 +15,12 @@ import type {
|
|
|
15
15
|
SankeyNodeMark,
|
|
16
16
|
TextStyle,
|
|
17
17
|
} from '@opendata-ai/openchart-core';
|
|
18
|
-
import { BRAND_MIN_WIDTH, estimateTextWidth } from '@opendata-ai/openchart-core';
|
|
18
|
+
import { BRAND_FONT_SIZE, BRAND_MIN_WIDTH, estimateTextWidth } from '@opendata-ai/openchart-core';
|
|
19
19
|
import { clampStaggerDelay } from '@opendata-ai/openchart-engine';
|
|
20
20
|
|
|
21
21
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
22
22
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
23
|
-
const BRAND_URL = 'https://
|
|
23
|
+
const BRAND_URL = 'https://tryopendata.ai';
|
|
24
24
|
|
|
25
25
|
/** CSS easing preset map for inline style custom properties. */
|
|
26
26
|
const EASE_VAR_MAP: Record<string, string> = {
|
|
@@ -225,28 +225,34 @@ function renderBrand(parent: SVGElement, layout: SankeyLayout): void {
|
|
|
225
225
|
a.setAttribute('rel', 'noopener');
|
|
226
226
|
a.setAttribute('class', 'oc-chrome-ref');
|
|
227
227
|
|
|
228
|
+
const BRAND_LARGE = 16;
|
|
228
229
|
const text = createSVGElement('text');
|
|
229
230
|
setAttrs(text, {
|
|
230
231
|
x: rightEdge,
|
|
231
|
-
y: chromeY,
|
|
232
|
-
'dominant-baseline': '
|
|
232
|
+
y: chromeY + BRAND_LARGE,
|
|
233
|
+
'dominant-baseline': 'alphabetic',
|
|
233
234
|
'text-anchor': 'end',
|
|
234
235
|
'font-family': layout.theme.fonts.family,
|
|
235
|
-
'font-size':
|
|
236
|
+
'font-size': BRAND_FONT_SIZE,
|
|
236
237
|
'fill-opacity': 0.55,
|
|
237
238
|
});
|
|
238
239
|
(text as SVGElement & ElementCSSInlineStyle).style.setProperty('fill', fill);
|
|
239
240
|
|
|
240
|
-
const
|
|
241
|
-
setAttrs(
|
|
242
|
-
|
|
241
|
+
const trySpan = createSVGElement('tspan');
|
|
242
|
+
setAttrs(trySpan, { 'font-weight': 500 });
|
|
243
|
+
trySpan.textContent = 'try';
|
|
243
244
|
|
|
244
|
-
const
|
|
245
|
-
setAttrs(
|
|
246
|
-
|
|
245
|
+
const openDataSpan = createSVGElement('tspan');
|
|
246
|
+
setAttrs(openDataSpan, { 'font-weight': 600, 'font-size': BRAND_LARGE });
|
|
247
|
+
openDataSpan.textContent = 'OpenData';
|
|
247
248
|
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
const aiSpan = createSVGElement('tspan');
|
|
250
|
+
setAttrs(aiSpan, { 'font-weight': 500 });
|
|
251
|
+
aiSpan.textContent = '.ai';
|
|
252
|
+
|
|
253
|
+
text.appendChild(trySpan);
|
|
254
|
+
text.appendChild(openDataSpan);
|
|
255
|
+
text.appendChild(aiSpan);
|
|
250
256
|
a.appendChild(text);
|
|
251
257
|
parent.appendChild(a);
|
|
252
258
|
}
|
package/src/svg-renderer.ts
CHANGED
|
@@ -1137,11 +1137,13 @@ function renderBrand(parent: SVGElement, layout: ChartLayout): void {
|
|
|
1137
1137
|
|
|
1138
1138
|
// "try" in normal weight, "OpenData" in semibold, ".ai" in normal weight,
|
|
1139
1139
|
// rendered as a single right-aligned text element with three tspans.
|
|
1140
|
+
// Use alphabetic baseline so mixed-size tspans share a common bottom line.
|
|
1141
|
+
const BRAND_LARGE = 16;
|
|
1140
1142
|
const text = createSVGElement('text');
|
|
1141
1143
|
setAttrs(text, {
|
|
1142
1144
|
x: rightEdge,
|
|
1143
|
-
y: chromeY,
|
|
1144
|
-
'dominant-baseline': '
|
|
1145
|
+
y: chromeY + BRAND_LARGE,
|
|
1146
|
+
'dominant-baseline': 'alphabetic',
|
|
1145
1147
|
'font-family': layout.theme.fonts.family,
|
|
1146
1148
|
'font-size': BRAND_FONT_SIZE,
|
|
1147
1149
|
'text-anchor': 'end',
|
|
@@ -1156,6 +1158,7 @@ function renderBrand(parent: SVGElement, layout: ChartLayout): void {
|
|
|
1156
1158
|
|
|
1157
1159
|
const openDataSpan = createSVGElement('tspan');
|
|
1158
1160
|
openDataSpan.setAttribute('font-weight', '600');
|
|
1161
|
+
openDataSpan.setAttribute('font-size', String(BRAND_LARGE));
|
|
1159
1162
|
openDataSpan.textContent = 'OpenData';
|
|
1160
1163
|
text.appendChild(openDataSpan);
|
|
1161
1164
|
|