@opendata-ai/openchart-vanilla 9.0.0-rc.2 → 9.0.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.
Files changed (40) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-RY5JEGFM.js → chunk-42WVDS3V.js} +161 -26
  3. package/dist/chunk-42WVDS3V.js.map +1 -0
  4. package/dist/{chunk-46E3QB6O.js → chunk-6GRMMSQA.js} +2 -2
  5. package/dist/{chunk-A5C4VCUO.js → chunk-7XFFPRQ7.js} +13 -4
  6. package/dist/chunk-7XFFPRQ7.js.map +1 -0
  7. package/dist/chunk-E3ETKTJQ.js +130 -0
  8. package/dist/chunk-E3ETKTJQ.js.map +1 -0
  9. package/dist/{chunk-5ZLSMZRM.js → chunk-HQ5GADZ4.js} +9 -8
  10. package/dist/{chunk-5ZLSMZRM.js.map → chunk-HQ5GADZ4.js.map} +1 -1
  11. package/dist/{chunk-5OQZRGUL.js → chunk-NGNHQOXO.js} +1064 -971
  12. package/dist/chunk-NGNHQOXO.js.map +1 -0
  13. package/dist/{chunk-RBXIZJPE.js → chunk-OEJHSKFZ.js} +2 -2
  14. package/dist/{chunk-CMIJA63X.js → chunk-RWP23N4D.js} +3 -3
  15. package/dist/chunk-SKQAAHHR.js +533 -0
  16. package/dist/chunk-SKQAAHHR.js.map +1 -0
  17. package/dist/{chunk-NLKQ5AOA.js → chunk-XR4B3SPC.js} +70 -30
  18. package/dist/chunk-XR4B3SPC.js.map +1 -0
  19. package/dist/export-gif.js +4 -4
  20. package/dist/graph-3d/index.js +4 -4
  21. package/dist/index.d.ts +41 -51
  22. package/dist/index.js +85 -216
  23. package/dist/index.js.map +1 -1
  24. package/dist/static.d.ts +10 -21
  25. package/dist/static.js +417 -118
  26. package/dist/static.js.map +1 -1
  27. package/dist/story/index.js +7 -7
  28. package/dist/styles.css.map +1 -1
  29. package/package.json +4 -7
  30. package/dist/chunk-5OQZRGUL.js.map +0 -1
  31. package/dist/chunk-A5C4VCUO.js.map +0 -1
  32. package/dist/chunk-FFP5GXIP.js +0 -45
  33. package/dist/chunk-FFP5GXIP.js.map +0 -1
  34. package/dist/chunk-LDSPJFOU.js +0 -297
  35. package/dist/chunk-LDSPJFOU.js.map +0 -1
  36. package/dist/chunk-NLKQ5AOA.js.map +0 -1
  37. package/dist/chunk-RY5JEGFM.js.map +0 -1
  38. /package/dist/{chunk-46E3QB6O.js.map → chunk-6GRMMSQA.js.map} +0 -0
  39. /package/dist/{chunk-RBXIZJPE.js.map → chunk-OEJHSKFZ.js.map} +0 -0
  40. /package/dist/{chunk-CMIJA63X.js.map → chunk-RWP23N4D.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/theme-style-block.ts"],"sourcesContent":["/**\n * Theme `<style>` block for self-contained SVG export.\n *\n * Charts render most fills as inline SVG attributes, but a handful of chrome\n * elements (metric cells, the eyebrow dot, legend text, endpoint labels)\n * take their fill from CSS classes in `chrome.css` via `--oc-*` variables. That\n * works on-screen because the live SVG inherits the page stylesheet — but a\n * serialized/rasterized export (PNG/JPG/GIF) is detached from the page, so those\n * class-based fills vanish. This module builds a `<style>` block that resolves\n * every such rule against a concrete `ResolvedTheme`, so injecting it into an\n * export clone makes the SVG fully self-contained.\n *\n * Both the headless renderer (`static.ts`) and the browser export path use this,\n * so class-based styling round-trips identically no matter which path produced\n * the SVG. Browser-safe (no Node imports) so the browser exporters can import it.\n */\n\nimport type { ResolvedTheme } from '@opendata-ai/openchart-core';\nimport { adaptForLightLineStroke, CSS_TOKENS, cssTokenDefault } from '@opendata-ai/openchart-core';\nimport { SVG_NS } from './renderers/svg-dom';\n\n/**\n * Build the theme `<style>` block CSS text for a resolved theme. Sets the\n * `--oc-*` custom properties on each supported SVG root and defines every class-based\n * chrome rule against them.\n */\nexport function buildThemeStyleBlock(theme: ResolvedTheme): string {\n const accent = theme.colors.categorical[0] ?? cssTokenDefault('--oc-accent', 'light');\n const bg = theme.colors.neutral.surface;\n\n const props = [\n `--oc-font-family: ${theme.fonts.family}`,\n `--oc-font-mono: ${theme.fonts.mono}`,\n `--oc-title-size: ${theme.chrome.title.fontSize}px`,\n `--oc-title-weight: ${theme.chrome.title.fontWeight}`,\n `--oc-title-tracking: ${cssTokenDefault('--oc-title-tracking', 'light')}`,\n `--oc-subtitle-size: ${theme.chrome.subtitle.fontSize}px`,\n `--oc-subtitle-weight: ${theme.chrome.subtitle.fontWeight}`,\n `--oc-source-size: ${theme.chrome.source.fontSize}px`,\n `--oc-source-weight: ${theme.chrome.source.fontWeight}`,\n `--oc-body-size: ${theme.fonts.sizes.body}px`,\n `--oc-eyebrow-size: ${theme.chrome.eyebrow.fontSize}px`,\n `--oc-eyebrow-weight: ${theme.chrome.eyebrow.fontWeight}`,\n `--oc-eyebrow-tracking: ${cssTokenDefault('--oc-eyebrow-tracking', 'light')}`,\n `--oc-bg: ${bg}`,\n `--oc-text: ${theme.colors.text}`,\n `--oc-text-muted: ${theme.colors.axis}`,\n `--oc-text-secondary: ${theme.colors.neutral.secondary}`,\n `--oc-text-faint: ${theme.colors.neutral.faint}`,\n `--oc-border: ${theme.colors.neutral.border}`,\n `--oc-gridline: ${theme.colors.gridline}`,\n // Hairline, not the tick-label ink.\n `--oc-axis: ${theme.colors.hairline}`,\n `--oc-border-radius: ${theme.borderRadius}px`,\n `--oc-accent: ${accent}`,\n `--oc-accent-strong: ${adaptForLightLineStroke(accent)}`,\n `--oc-positive: ${theme.colors.positive}`,\n `--oc-negative: ${theme.colors.negative}`,\n `--oc-legend-text: ${theme.isDark ? cssTokenDefault('--oc-legend-text', 'dark') : cssTokenDefault('--oc-legend-text', 'light')}`,\n `--oc-space-2: ${theme.spacing.chromeGap * 2}px`,\n `--oc-space-4: ${theme.spacing.padding}px`,\n ];\n\n const rules = [\n // Tabular figures everywhere in the chart's own text: axis ticks, value\n // labels and legend entries all line up column-wise.\n `svg.oc-chart, svg.oc-map, svg.oc-tilemap, svg.oc-barlist { ${props.join('; ')}; font-variant-numeric: tabular-nums; }`,\n `.oc-chrome { font-family: var(--oc-font-family); }`,\n `.oc-eyebrow { font-size: var(--oc-eyebrow-size); font-weight: var(--oc-eyebrow-weight); letter-spacing: var(--oc-eyebrow-tracking); text-transform: uppercase; fill: var(--oc-accent); }`,\n `.oc-title { font-size: var(--oc-title-size); font-weight: var(--oc-title-weight); letter-spacing: var(--oc-title-tracking); fill: var(--oc-text); }`,\n `.oc-subtitle { font-size: var(--oc-subtitle-size); font-weight: var(--oc-subtitle-weight); fill: var(--oc-text-muted); }`,\n `.oc-source, .oc-byline, .oc-footer { font-size: var(--oc-source-size); font-weight: var(--oc-source-weight); fill: var(--oc-text-muted); }`,\n `.oc-brand { font-size: 11px; font-weight: 500; letter-spacing: 0.02em; fill: var(--oc-text-faint); }`,\n `.oc-eyebrow-dot { fill: var(--oc-accent); }`,\n `.oc-metrics { font-family: var(--oc-font-family); }`,\n `.oc-metric-label { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; fill: var(--oc-text-muted); }`,\n `.oc-metric-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; fill: var(--oc-text); font-variant-numeric: tabular-nums; }`,\n `.oc-metric-delta-up { fill: var(--oc-positive); font-size: 12px; font-weight: 500; }`,\n `.oc-metric-delta-down { fill: var(--oc-negative); font-size: 12px; font-weight: 500; }`,\n `.oc-axis-tick-inline { font-size: 11px; font-weight: 400; fill: var(--oc-text-muted); }`,\n `.oc-endpoint-labels { font-family: var(--oc-font-family); }`,\n `.oc-endpoint-label { fill: var(--oc-endpoint-label-color, var(--oc-text)); }`,\n `.oc-endpoint-value { fill: var(--oc-endpoint-value-color, var(--oc-text-muted)); }`,\n `.oc-endpoint-leader { stroke: var(--oc-endpoint-leader-color, currentColor); }`,\n `.oc-annotation-subtitle { fill: var(--oc-annotation-subtitle-color, var(--oc-text-muted)); }`,\n `.oc-metric-secondary { fill: var(--oc-text-muted); font-size: 12px; font-weight: 400; }`,\n `.oc-legend { font-family: var(--oc-font-family); font-size: var(--oc-body-size); }`,\n `.oc-legend-entry { cursor: default; }`,\n `.oc-legend text { fill: var(--oc-legend-text); }`,\n ];\n\n return rules.join('\\n');\n}\n\n/**\n * Inject the theme style block into an SVG clone's `<defs>` so class-based fills\n * survive serialization. Replaces any prior export theme block, so repeated\n * preparation produces one block. No-op if `theme` is\n * undefined (nothing to resolve against).\n */\nexport function injectThemeStyleBlock(svg: SVGElement, theme: ResolvedTheme | undefined): void {\n if (!theme) return;\n for (const previous of svg.querySelectorAll('style[data-oc-theme]')) previous.remove();\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS(SVG_NS, 'defs');\n svg.insertBefore(defs, svg.firstChild);\n }\n const style = document.createElementNS(SVG_NS, 'style');\n style.setAttribute('data-oc-theme', '');\n style.textContent = buildThemeStyleBlock(theme);\n defs.insertBefore(style, defs.firstChild);\n}\n\n/** Preserve the live host CSS tokens when an export leaves its document. */\nexport function copyComputedThemeProperties(source: SVGElement, clone: SVGElement): void {\n if (!source.isConnected) return;\n const computed = getComputedStyle(source);\n for (const { name } of CSS_TOKENS) {\n const value = computed.getPropertyValue(name).trim();\n if (value) clone.style.setProperty(name, value);\n }\n}\n\n/** Prepare detached settled geometry with its live cascade or an export override. */\nexport function prepareSettledExportTheme(\n source: SVGElement,\n settled: SVGElement,\n theme: ResolvedTheme | undefined,\n explicitTheme = false,\n): void {\n if (explicitTheme) {\n // A re-render may stamp authored mount values inline. They would beat the\n // export theme's stylesheet even when copying the live cascade is skipped.\n for (const { name } of CSS_TOKENS) settled.style.removeProperty(name);\n } else {\n copyComputedThemeProperties(source, settled);\n }\n injectThemeStyleBlock(settled, theme);\n}\n"],"mappings":";;;;;AAkBA,SAAS,yBAAyB,YAAY,uBAAuB;AAQ9D,SAAS,qBAAqB,OAA8B;AACjE,QAAM,SAAS,MAAM,OAAO,YAAY,CAAC,KAAK,gBAAgB,eAAe,OAAO;AACpF,QAAM,KAAK,MAAM,OAAO,QAAQ;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A,EACtE,OAAO;AACL,gCAA4B,QAAQ,OAAO;AAAA,EAC7C;AACA,wBAAsB,SAAS,KAAK;AACtC;","names":[]}
@@ -1,45 +0,0 @@
1
- // src/renderers/svg-dom.ts
2
- var SVG_NS = "http://www.w3.org/2000/svg";
3
- var XLINK_NS = "http://www.w3.org/1999/xlink";
4
- function createSVGElement(tag) {
5
- return document.createElementNS(SVG_NS, tag);
6
- }
7
- function setAttrs(el, attrs) {
8
- for (const [key, value] of Object.entries(attrs)) {
9
- el.setAttribute(key, String(value));
10
- }
11
- }
12
- function applyKnockoutHalo(el, color, fontSize) {
13
- setAttrs(el, {
14
- stroke: color,
15
- "stroke-width": Math.round(fontSize * 0.3),
16
- "stroke-linejoin": "round",
17
- "paint-order": "stroke"
18
- });
19
- }
20
- function applyTextStyle(el, style) {
21
- const inline = el.style;
22
- inline.setProperty("fill", style.fill);
23
- inline.setProperty("font-size", `${style.fontSize}px`);
24
- inline.setProperty("font-weight", String(style.fontWeight));
25
- inline.setProperty("font-family", style.fontFamily);
26
- if (style.textAnchor) {
27
- el.setAttribute("text-anchor", style.textAnchor);
28
- }
29
- if (style.dominantBaseline) {
30
- el.setAttribute("dominant-baseline", style.dominantBaseline);
31
- }
32
- if (style.fontVariant) {
33
- el.setAttribute("font-variant", style.fontVariant);
34
- }
35
- }
36
-
37
- export {
38
- SVG_NS,
39
- XLINK_NS,
40
- createSVGElement,
41
- setAttrs,
42
- applyKnockoutHalo,
43
- applyTextStyle
44
- };
45
- //# sourceMappingURL=chunk-FFP5GXIP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/renderers/svg-dom.ts"],"sourcesContent":["/**\n * Shared SVG DOM helpers used across the per-concern renderers.\n *\n * Pure, stateless utilities. No layout/theme knowledge.\n */\n\nimport type { TextStyle } from '@opendata-ai/openchart-core';\n\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\n\nexport function createSVGElement(tag: string): SVGElement {\n return document.createElementNS(SVG_NS, tag);\n}\n\nexport function setAttrs(el: SVGElement, attrs: Record<string, string | number>): void {\n for (const [key, value] of Object.entries(attrs)) {\n el.setAttribute(key, String(value));\n }\n}\n\n/**\n * Cut a knockout halo behind text so it stays legible where it crosses\n * gridlines, marks, or a neighbouring series: a surface-colored stroke painted\n * under the glyphs.\n *\n * Presentation attributes, not inline styles, so a stylesheet can still\n * override the halo. The width scales with the font size -- a fixed width rings\n * small glyphs and disappears behind large ones.\n */\nexport function applyKnockoutHalo(el: SVGElement, color: string, fontSize: number): void {\n setAttrs(el, {\n stroke: color,\n 'stroke-width': Math.round(fontSize * 0.3),\n 'stroke-linejoin': 'round',\n 'paint-order': 'stroke',\n });\n}\n\nexport function applyTextStyle(el: SVGElement, style: TextStyle): void {\n // Use inline styles so engine-computed values take priority over CSS class\n // defaults (e.g. .oc-title { font-size: var(--oc-title-size) } would otherwise\n // override the responsive scaling applied by the chrome layout).\n const inline = (el as SVGElement & ElementCSSInlineStyle).style;\n inline.setProperty('fill', style.fill);\n inline.setProperty('font-size', `${style.fontSize}px`);\n inline.setProperty('font-weight', String(style.fontWeight));\n inline.setProperty('font-family', style.fontFamily);\n if (style.textAnchor) {\n el.setAttribute('text-anchor', style.textAnchor);\n }\n if (style.dominantBaseline) {\n el.setAttribute('dominant-baseline', style.dominantBaseline);\n }\n if (style.fontVariant) {\n el.setAttribute('font-variant', style.fontVariant);\n }\n}\n"],"mappings":";AAQO,IAAM,SAAS;AACf,IAAM,WAAW;AAEjB,SAAS,iBAAiB,KAAyB;AACxD,SAAO,SAAS,gBAAgB,QAAQ,GAAG;AAC7C;AAEO,SAAS,SAAS,IAAgB,OAA8C;AACrF,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,OAAG,aAAa,KAAK,OAAO,KAAK,CAAC;AAAA,EACpC;AACF;AAWO,SAAS,kBAAkB,IAAgB,OAAe,UAAwB;AACvF,WAAS,IAAI;AAAA,IACX,QAAQ;AAAA,IACR,gBAAgB,KAAK,MAAM,WAAW,GAAG;AAAA,IACzC,mBAAmB;AAAA,IACnB,eAAe;AAAA,EACjB,CAAC;AACH;AAEO,SAAS,eAAe,IAAgB,OAAwB;AAIrE,QAAM,SAAU,GAA0C;AAC1D,SAAO,YAAY,QAAQ,MAAM,IAAI;AACrC,SAAO,YAAY,aAAa,GAAG,MAAM,QAAQ,IAAI;AACrD,SAAO,YAAY,eAAe,OAAO,MAAM,UAAU,CAAC;AAC1D,SAAO,YAAY,eAAe,MAAM,UAAU;AAClD,MAAI,MAAM,YAAY;AACpB,OAAG,aAAa,eAAe,MAAM,UAAU;AAAA,EACjD;AACA,MAAI,MAAM,kBAAkB;AAC1B,OAAG,aAAa,qBAAqB,MAAM,gBAAgB;AAAA,EAC7D;AACA,MAAI,MAAM,aAAa;AACrB,OAAG,aAAa,gBAAgB,MAAM,WAAW;AAAA,EACnD;AACF;","names":[]}
@@ -1,297 +0,0 @@
1
- import {
2
- nextSvgId,
3
- renderLegend,
4
- stampAnimationVars
5
- } from "./chunk-5OQZRGUL.js";
6
- import {
7
- renderAttributionBrand,
8
- renderChromeElement,
9
- stampThemeProperties
10
- } from "./chunk-NLKQ5AOA.js";
11
-
12
- // src/tilemap-renderer.ts
13
- var SVG_NS = "http://www.w3.org/2000/svg";
14
- function createSVGElement(tag) {
15
- return document.createElementNS(SVG_NS, tag);
16
- }
17
- function setAttrs(el, attrs) {
18
- for (const [key, value] of Object.entries(attrs)) {
19
- el.setAttribute(key, String(value));
20
- }
21
- }
22
- function renderChrome(parent, layout) {
23
- const g = createSVGElement("g");
24
- g.setAttribute("class", "oc-chrome");
25
- const { chrome, measureText } = layout;
26
- const bottomOffset = chrome.bottomAnchorY ?? layout.area.y + layout.area.height;
27
- if (chrome.title) {
28
- renderChromeElement(g, chrome.title, "oc-title", "title", measureText);
29
- }
30
- if (chrome.subtitle) {
31
- renderChromeElement(g, chrome.subtitle, "oc-subtitle", "subtitle", measureText);
32
- }
33
- if (chrome.source) {
34
- renderChromeElement(
35
- g,
36
- { ...chrome.source, y: bottomOffset + chrome.source.y },
37
- "oc-source",
38
- "source",
39
- measureText
40
- );
41
- }
42
- if (chrome.byline) {
43
- renderChromeElement(
44
- g,
45
- { ...chrome.byline, y: bottomOffset + chrome.byline.y },
46
- "oc-byline",
47
- "byline",
48
- measureText
49
- );
50
- }
51
- if (chrome.footer) {
52
- renderChromeElement(
53
- g,
54
- { ...chrome.footer, y: bottomOffset + chrome.footer.y },
55
- "oc-footer",
56
- "footer",
57
- measureText
58
- );
59
- }
60
- parent.appendChild(g);
61
- }
62
- function renderTiles(parent, tiles, animation) {
63
- const g = createSVGElement("g");
64
- g.setAttribute("class", "oc-tilemap-tiles");
65
- g.setAttribute("role", "list");
66
- const tileDelays = [];
67
- if (animation?.enter) {
68
- const baseStagger = 800 / Math.max(tiles.length, 1);
69
- let seed = 17;
70
- for (let i = 0; i < tiles.length; i++) {
71
- const idx = tiles[i].animationIndex ?? i;
72
- seed = seed * 1103515245 + 12345 & 2147483647;
73
- const jitter = (seed % 1e3 / 1e3 - 0.5) * 0.8;
74
- tileDelays.push(Math.max(0, Math.round(idx * baseStagger * (1 + jitter))));
75
- }
76
- }
77
- for (let i = 0; i < tiles.length; i++) {
78
- const tile = tiles[i];
79
- const tileGroup = createSVGElement("g");
80
- tileGroup.setAttribute("class", "oc-tilemap-tile");
81
- tileGroup.setAttribute("data-state", tile.stateCode);
82
- tileGroup.setAttribute("role", "listitem");
83
- if (tile.aria?.label) {
84
- tileGroup.setAttribute("aria-label", tile.aria.label);
85
- }
86
- if (animation?.enter) {
87
- const idx = tile.animationIndex ?? i;
88
- tileGroup.setAttribute("data-animation-index", String(idx));
89
- tileGroup.style.setProperty(
90
- "--oc-mark-index",
91
- String(idx)
92
- );
93
- tileGroup.style.setProperty(
94
- "--oc-tile-delay",
95
- `${tileDelays[i]}ms`
96
- );
97
- }
98
- const rect = createSVGElement("rect");
99
- setAttrs(rect, {
100
- x: tile.x,
101
- y: tile.y,
102
- width: tile.size,
103
- height: tile.size,
104
- rx: tile.cornerRadius,
105
- fill: tile.fill,
106
- "fill-opacity": tile.fillOpacity ?? 1,
107
- stroke: tile.stroke,
108
- "stroke-width": tile.strokeWidth
109
- });
110
- tileGroup.appendChild(rect);
111
- const codeLabel = createSVGElement("text");
112
- setAttrs(codeLabel, {
113
- x: tile.label.x,
114
- y: tile.label.y,
115
- "text-anchor": "middle",
116
- "dominant-baseline": "central",
117
- "font-family": tile.label.style.fontFamily,
118
- "font-size": tile.label.style.fontSize,
119
- "font-weight": tile.label.style.fontWeight,
120
- // A hair of tracking is what keeps a two-letter code legible at 8px now
121
- // that it is set at 600 instead of 700.
122
- "letter-spacing": "0.02em"
123
- });
124
- codeLabel.style.setProperty(
125
- "fill",
126
- tile.label.style.fill
127
- );
128
- codeLabel.textContent = tile.label.text;
129
- tileGroup.appendChild(codeLabel);
130
- if (tile.valueLabel.visible && tile.valueLabel.text) {
131
- const valueLabel = createSVGElement("text");
132
- setAttrs(valueLabel, {
133
- x: tile.valueLabel.x,
134
- y: tile.valueLabel.y,
135
- "text-anchor": "middle",
136
- "dominant-baseline": "central",
137
- "font-family": tile.valueLabel.style.fontFamily,
138
- "font-size": tile.valueLabel.style.fontSize,
139
- "font-weight": tile.valueLabel.style.fontWeight
140
- });
141
- valueLabel.style.setProperty(
142
- "fill",
143
- tile.valueLabel.style.fill
144
- );
145
- valueLabel.textContent = tile.valueLabel.text;
146
- tileGroup.appendChild(valueLabel);
147
- }
148
- g.appendChild(tileGroup);
149
- }
150
- parent.appendChild(g);
151
- }
152
- function renderGradientLegend(parent, layout) {
153
- if (!layout.gradientLegend) return;
154
- const { gradientLegend } = layout;
155
- const g = createSVGElement("g");
156
- g.setAttribute("class", "oc-tilemap-legend");
157
- const defs = parent.querySelector("defs") || createSVGElement("defs");
158
- const exists = parent.querySelector("defs");
159
- if (!exists) {
160
- parent.insertBefore(defs, parent.firstChild);
161
- }
162
- const gradientId = nextSvgId("oc-tilemap-legend-gradient");
163
- const grad = createSVGElement("linearGradient");
164
- grad.id = gradientId;
165
- grad.setAttribute("x1", "0%");
166
- grad.setAttribute("y1", "0%");
167
- grad.setAttribute("x2", "100%");
168
- grad.setAttribute("y2", "0%");
169
- for (const stop of gradientLegend.colorStops) {
170
- const s = createSVGElement("stop");
171
- const attrs = {
172
- offset: `${stop.offset * 100}%`,
173
- "stop-color": stop.color
174
- };
175
- if (stop.opacity !== void 0) {
176
- attrs["stop-opacity"] = stop.opacity;
177
- }
178
- setAttrs(s, attrs);
179
- grad.appendChild(s);
180
- }
181
- defs.appendChild(grad);
182
- const barHeight = gradientLegend.bounds.height;
183
- const bar = createSVGElement("rect");
184
- setAttrs(bar, {
185
- x: gradientLegend.bounds.x,
186
- y: gradientLegend.bounds.y,
187
- width: gradientLegend.bounds.width,
188
- height: barHeight,
189
- fill: `url(#${gradientId})`,
190
- "shape-rendering": "crispEdges"
191
- });
192
- g.appendChild(bar);
193
- const minText = createSVGElement("text");
194
- setAttrs(minText, {
195
- x: gradientLegend.bounds.x,
196
- y: gradientLegend.bounds.y + gradientLegend.bounds.height + 14,
197
- "text-anchor": "start",
198
- "font-family": gradientLegend.labelStyle.fontFamily,
199
- "font-size": gradientLegend.labelStyle.fontSize,
200
- "font-weight": gradientLegend.labelStyle.fontWeight
201
- });
202
- minText.style.setProperty(
203
- "fill",
204
- gradientLegend.labelStyle.fill
205
- );
206
- minText.textContent = gradientLegend.minLabel;
207
- g.appendChild(minText);
208
- const maxText = createSVGElement("text");
209
- setAttrs(maxText, {
210
- x: gradientLegend.bounds.x + gradientLegend.bounds.width,
211
- y: gradientLegend.bounds.y + gradientLegend.bounds.height + 14,
212
- "text-anchor": "end",
213
- "font-family": gradientLegend.labelStyle.fontFamily,
214
- "font-size": gradientLegend.labelStyle.fontSize,
215
- "font-weight": gradientLegend.labelStyle.fontWeight
216
- });
217
- maxText.style.setProperty(
218
- "fill",
219
- gradientLegend.labelStyle.fill
220
- );
221
- maxText.textContent = gradientLegend.maxLabel;
222
- g.appendChild(maxText);
223
- if (gradientLegend.noData) {
224
- const nd = gradientLegend.noData;
225
- const swatch = createSVGElement("rect");
226
- swatch.setAttribute("class", "oc-legend-nodata");
227
- setAttrs(swatch, {
228
- x: nd.x,
229
- y: nd.y,
230
- width: nd.size,
231
- height: nd.size,
232
- fill: nd.fill,
233
- "shape-rendering": "crispEdges"
234
- });
235
- g.appendChild(swatch);
236
- const ndLabel = createSVGElement("text");
237
- setAttrs(ndLabel, {
238
- x: nd.labelX,
239
- y: nd.labelY,
240
- "text-anchor": "start",
241
- "font-family": gradientLegend.labelStyle.fontFamily,
242
- "font-size": gradientLegend.labelStyle.fontSize,
243
- "font-weight": gradientLegend.labelStyle.fontWeight
244
- });
245
- ndLabel.style.setProperty(
246
- "fill",
247
- gradientLegend.labelStyle.fill
248
- );
249
- ndLabel.textContent = nd.label;
250
- g.appendChild(ndLabel);
251
- }
252
- parent.appendChild(g);
253
- }
254
- function renderTileMapSVG(layout, opts) {
255
- const { width, height, tiles, a11y, animation } = layout;
256
- const animate = opts?.animate && !!animation?.enter;
257
- const svg = createSVGElement("svg");
258
- svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
259
- svg.setAttribute("role", "img");
260
- if (a11y.altText) {
261
- svg.setAttribute("aria-label", a11y.altText);
262
- }
263
- const classes = animate ? "oc-tilemap oc-animate" : "oc-tilemap";
264
- svg.setAttribute("class", classes);
265
- stampThemeProperties(svg, layout.theme);
266
- if (animate && animation?.enter) {
267
- const stagger = Math.max(5, Math.round(800 / Math.max(tiles.length, 1)));
268
- stampAnimationVars(svg, {
269
- duration: animation.enter.duration,
270
- spring: animation.enter.spring,
271
- stagger,
272
- annotationDelay: animation.annotationDelay,
273
- ease: animation.enter.ease
274
- });
275
- }
276
- const defs = createSVGElement("defs");
277
- svg.appendChild(defs);
278
- renderChrome(svg, layout);
279
- renderTiles(svg, tiles, animate ? animation : void 0);
280
- if (layout.categoricalLegend) {
281
- renderLegend(svg, layout.categoricalLegend);
282
- } else {
283
- renderGradientLegend(svg, layout);
284
- }
285
- renderAttributionBrand(
286
- svg,
287
- layout.chrome,
288
- layout.chrome.bottomAnchorY ?? layout.area.y + layout.area.height,
289
- layout.measureText
290
- );
291
- return svg;
292
- }
293
-
294
- export {
295
- renderTileMapSVG
296
- };
297
- //# sourceMappingURL=chunk-LDSPJFOU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tilemap-renderer.ts"],"sourcesContent":["/**\n * TileMap SVG renderer: converts a TileMapLayout into SVG DOM elements.\n *\n * Creates an <svg> with tile rectangles, state code labels, value labels,\n * gradient legend, and chrome. All styling via inline SVG attributes from\n * layout data. Animation is pure CSS, driven by data attributes.\n */\n\nimport type {\n ResolvedAnimation,\n TileMapLayout,\n TileMapTileMark,\n} from '@opendata-ai/openchart-core';\nimport { stampAnimationVars } from './animation-vars';\nimport { renderAttributionBrand } from './renderers/brand';\nimport { renderChromeElement } from './renderers/chrome';\nimport { renderLegend } from './renderers/legend';\nimport { nextSvgId } from './svg-ids';\nimport { stampThemeProperties } from './theme-tokens';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction createSVGElement(tag: string): SVGElement {\n return document.createElementNS(SVG_NS, tag);\n}\n\nfunction setAttrs(el: SVGElement, attrs: Record<string, string | number>): void {\n for (const [key, value] of Object.entries(attrs)) {\n el.setAttribute(key, String(value));\n }\n}\n\n// ---------------------------------------------------------------------------\n// Chrome rendering (delegates to the shared helper for text wrapping)\n// ---------------------------------------------------------------------------\n\nfunction renderChrome(parent: SVGElement, layout: TileMapLayout): void {\n const g = createSVGElement('g');\n g.setAttribute('class', 'oc-chrome');\n\n const { chrome, measureText } = layout;\n const bottomOffset = chrome.bottomAnchorY ?? layout.area.y + layout.area.height;\n\n if (chrome.title) {\n renderChromeElement(g, chrome.title, 'oc-title', 'title', measureText);\n }\n if (chrome.subtitle) {\n renderChromeElement(g, chrome.subtitle, 'oc-subtitle', 'subtitle', measureText);\n }\n if (chrome.source) {\n renderChromeElement(\n g,\n { ...chrome.source, y: bottomOffset + chrome.source.y },\n 'oc-source',\n 'source',\n measureText,\n );\n }\n if (chrome.byline) {\n renderChromeElement(\n g,\n { ...chrome.byline, y: bottomOffset + chrome.byline.y },\n 'oc-byline',\n 'byline',\n measureText,\n );\n }\n if (chrome.footer) {\n renderChromeElement(\n g,\n { ...chrome.footer, y: bottomOffset + chrome.footer.y },\n 'oc-footer',\n 'footer',\n measureText,\n );\n }\n\n parent.appendChild(g);\n}\n\n// ---------------------------------------------------------------------------\n// Watermark rendering\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// Tiles rendering\n// ---------------------------------------------------------------------------\n\nfunction renderTiles(\n parent: SVGElement,\n tiles: TileMapTileMark[],\n animation?: ResolvedAnimation,\n): void {\n const g = createSVGElement('g');\n g.setAttribute('class', 'oc-tilemap-tiles');\n g.setAttribute('role', 'list');\n\n // Compute per-tile delays with jitter for organic feel.\n // Base delay spreads tiles across ~800ms window, jitter adds +-40% variation\n // so some tiles pop in clusters while others have longer gaps.\n const tileDelays: number[] = [];\n if (animation?.enter) {\n const baseStagger = 800 / Math.max(tiles.length, 1);\n let seed = 17;\n for (let i = 0; i < tiles.length; i++) {\n const idx = tiles[i].animationIndex ?? i;\n seed = (seed * 1103515245 + 12345) & 0x7fffffff;\n const jitter = ((seed % 1000) / 1000 - 0.5) * 0.8;\n tileDelays.push(Math.max(0, Math.round(idx * baseStagger * (1 + jitter))));\n }\n }\n\n for (let i = 0; i < tiles.length; i++) {\n const tile = tiles[i];\n const tileGroup = createSVGElement('g');\n tileGroup.setAttribute('class', 'oc-tilemap-tile');\n tileGroup.setAttribute('data-state', tile.stateCode);\n tileGroup.setAttribute('role', 'listitem');\n if (tile.aria?.label) {\n tileGroup.setAttribute('aria-label', tile.aria.label);\n }\n\n if (animation?.enter) {\n const idx = tile.animationIndex ?? i;\n tileGroup.setAttribute('data-animation-index', String(idx));\n (tileGroup as SVGElement & ElementCSSInlineStyle).style.setProperty(\n '--oc-mark-index',\n String(idx),\n );\n (tileGroup as SVGElement & ElementCSSInlineStyle).style.setProperty(\n '--oc-tile-delay',\n `${tileDelays[i]}ms`,\n );\n }\n\n // Tile background rect\n const rect = createSVGElement('rect');\n setAttrs(rect, {\n x: tile.x,\n y: tile.y,\n width: tile.size,\n height: tile.size,\n rx: tile.cornerRadius,\n fill: tile.fill,\n 'fill-opacity': tile.fillOpacity ?? 1,\n stroke: tile.stroke,\n 'stroke-width': tile.strokeWidth,\n });\n tileGroup.appendChild(rect);\n\n // State code label\n const codeLabel = createSVGElement('text');\n setAttrs(codeLabel, {\n x: tile.label.x,\n y: tile.label.y,\n 'text-anchor': 'middle',\n 'dominant-baseline': 'central',\n 'font-family': tile.label.style.fontFamily,\n 'font-size': tile.label.style.fontSize,\n 'font-weight': tile.label.style.fontWeight,\n // A hair of tracking is what keeps a two-letter code legible at 8px now\n // that it is set at 600 instead of 700.\n 'letter-spacing': '0.02em',\n });\n (codeLabel as SVGElement & ElementCSSInlineStyle).style.setProperty(\n 'fill',\n tile.label.style.fill,\n );\n codeLabel.textContent = tile.label.text;\n tileGroup.appendChild(codeLabel);\n\n // Value label (if visible)\n if (tile.valueLabel.visible && tile.valueLabel.text) {\n const valueLabel = createSVGElement('text');\n setAttrs(valueLabel, {\n x: tile.valueLabel.x,\n y: tile.valueLabel.y,\n 'text-anchor': 'middle',\n 'dominant-baseline': 'central',\n 'font-family': tile.valueLabel.style.fontFamily,\n 'font-size': tile.valueLabel.style.fontSize,\n 'font-weight': tile.valueLabel.style.fontWeight,\n });\n (valueLabel as SVGElement & ElementCSSInlineStyle).style.setProperty(\n 'fill',\n tile.valueLabel.style.fill,\n );\n valueLabel.textContent = tile.valueLabel.text;\n tileGroup.appendChild(valueLabel);\n }\n\n g.appendChild(tileGroup);\n }\n\n parent.appendChild(g);\n}\n\n// ---------------------------------------------------------------------------\n// Gradient legend rendering\n// ---------------------------------------------------------------------------\n\nfunction renderGradientLegend(parent: SVGElement, layout: TileMapLayout): void {\n if (!layout.gradientLegend) return;\n\n const { gradientLegend } = layout;\n const g = createSVGElement('g');\n g.setAttribute('class', 'oc-tilemap-legend');\n\n // Build linear gradient in defs\n const defs = parent.querySelector('defs') || createSVGElement('defs');\n const exists = parent.querySelector('defs');\n if (!exists) {\n parent.insertBefore(defs, parent.firstChild);\n }\n\n const gradientId = nextSvgId('oc-tilemap-legend-gradient');\n const grad = createSVGElement('linearGradient');\n grad.id = gradientId;\n grad.setAttribute('x1', '0%');\n grad.setAttribute('y1', '0%');\n grad.setAttribute('x2', '100%');\n grad.setAttribute('y2', '0%');\n\n for (const stop of gradientLegend.colorStops) {\n const s = createSVGElement('stop');\n const attrs: Record<string, string | number> = {\n offset: `${stop.offset * 100}%`,\n 'stop-color': stop.color,\n };\n if (stop.opacity !== undefined) {\n attrs['stop-opacity'] = stop.opacity;\n }\n setAttrs(s, attrs);\n grad.appendChild(s);\n }\n\n (defs as SVGElement).appendChild(grad);\n\n // Gradient bar: square-cornered, so it reads as a color scale rather than a\n // pill-shaped UI control.\n const barHeight = gradientLegend.bounds.height;\n const bar = createSVGElement('rect');\n setAttrs(bar, {\n x: gradientLegend.bounds.x,\n y: gradientLegend.bounds.y,\n width: gradientLegend.bounds.width,\n height: barHeight,\n fill: `url(#${gradientId})`,\n 'shape-rendering': 'crispEdges',\n });\n g.appendChild(bar);\n\n // Min label\n const minText = createSVGElement('text');\n setAttrs(minText, {\n x: gradientLegend.bounds.x,\n y: gradientLegend.bounds.y + gradientLegend.bounds.height + 14,\n 'text-anchor': 'start',\n 'font-family': gradientLegend.labelStyle.fontFamily,\n 'font-size': gradientLegend.labelStyle.fontSize,\n 'font-weight': gradientLegend.labelStyle.fontWeight,\n });\n (minText as SVGElement & ElementCSSInlineStyle).style.setProperty(\n 'fill',\n gradientLegend.labelStyle.fill,\n );\n minText.textContent = gradientLegend.minLabel;\n g.appendChild(minText);\n\n // Max label\n const maxText = createSVGElement('text');\n setAttrs(maxText, {\n x: gradientLegend.bounds.x + gradientLegend.bounds.width,\n y: gradientLegend.bounds.y + gradientLegend.bounds.height + 14,\n 'text-anchor': 'end',\n 'font-family': gradientLegend.labelStyle.fontFamily,\n 'font-size': gradientLegend.labelStyle.fontSize,\n 'font-weight': gradientLegend.labelStyle.fontWeight,\n });\n (maxText as SVGElement & ElementCSSInlineStyle).style.setProperty(\n 'fill',\n gradientLegend.labelStyle.fill,\n );\n maxText.textContent = gradientLegend.maxLabel;\n g.appendChild(maxText);\n\n // Detached \"no data\" swatch, keyed beside the ramp rather than at its low end.\n if (gradientLegend.noData) {\n const nd = gradientLegend.noData;\n const swatch = createSVGElement('rect');\n swatch.setAttribute('class', 'oc-legend-nodata');\n setAttrs(swatch, {\n x: nd.x,\n y: nd.y,\n width: nd.size,\n height: nd.size,\n fill: nd.fill,\n 'shape-rendering': 'crispEdges',\n });\n g.appendChild(swatch);\n\n const ndLabel = createSVGElement('text');\n setAttrs(ndLabel, {\n x: nd.labelX,\n y: nd.labelY,\n 'text-anchor': 'start',\n 'font-family': gradientLegend.labelStyle.fontFamily,\n 'font-size': gradientLegend.labelStyle.fontSize,\n 'font-weight': gradientLegend.labelStyle.fontWeight,\n });\n (ndLabel as SVGElement & ElementCSSInlineStyle).style.setProperty(\n 'fill',\n gradientLegend.labelStyle.fill,\n );\n ndLabel.textContent = nd.label;\n g.appendChild(ndLabel);\n }\n\n parent.appendChild(g);\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Render a TileMapLayout to an SVG element.\n */\nexport function renderTileMapSVG(\n layout: TileMapLayout,\n opts?: { animate?: boolean },\n): SVGSVGElement {\n const { width, height, tiles, a11y, animation } = layout;\n const animate = opts?.animate && !!animation?.enter;\n\n const svg = createSVGElement('svg') as SVGSVGElement;\n svg.setAttribute('viewBox', `0 0 ${width} ${height}`);\n svg.setAttribute('role', 'img');\n if (a11y.altText) {\n svg.setAttribute('aria-label', a11y.altText);\n }\n\n const classes = animate ? 'oc-tilemap oc-animate' : 'oc-tilemap';\n svg.setAttribute('class', classes);\n stampThemeProperties(svg, layout.theme);\n\n if (animate && animation?.enter) {\n // Target ~1s total: stagger window ~800ms + per-tile pop ~200ms\n const stagger = Math.max(5, Math.round(800 / Math.max(tiles.length, 1)));\n stampAnimationVars(svg, {\n duration: animation.enter.duration,\n spring: animation.enter.spring,\n stagger,\n annotationDelay: animation.annotationDelay,\n ease: animation.enter.ease,\n });\n }\n\n // Empty defs element (will be filled by gradient legend)\n const defs = createSVGElement('defs');\n svg.appendChild(defs);\n\n // Render chrome\n renderChrome(svg, layout);\n\n // Render tiles\n renderTiles(svg, tiles, animate ? animation : undefined);\n\n // Render legend (gradient for quantitative, categorical for nominal)\n if (layout.categoricalLegend) {\n renderLegend(svg, layout.categoricalLegend);\n } else {\n renderGradientLegend(svg, layout);\n }\n\n // Render watermark\n renderAttributionBrand(\n svg,\n layout.chrome,\n layout.chrome.bottomAnchorY ?? layout.area.y + layout.area.height,\n layout.measureText,\n );\n\n return svg;\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAM,SAAS;AAMf,SAAS,iBAAiB,KAAyB;AACjD,SAAO,SAAS,gBAAgB,QAAQ,GAAG;AAC7C;AAEA,SAAS,SAAS,IAAgB,OAA8C;AAC9E,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,OAAG,aAAa,KAAK,OAAO,KAAK,CAAC;AAAA,EACpC;AACF;AAMA,SAAS,aAAa,QAAoB,QAA6B;AACrE,QAAM,IAAI,iBAAiB,GAAG;AAC9B,IAAE,aAAa,SAAS,WAAW;AAEnC,QAAM,EAAE,QAAQ,YAAY,IAAI;AAChC,QAAM,eAAe,OAAO,iBAAiB,OAAO,KAAK,IAAI,OAAO,KAAK;AAEzE,MAAI,OAAO,OAAO;AAChB,wBAAoB,GAAG,OAAO,OA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M,MAAM,KAAK,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC;AACvE,uBAAmB,KAAK;AAAA,MACtB,UAAU,UAAU,MAAM;AAAA,MAC1B,QAAQ,UAAU,MAAM;AAAA,MACxB;AAAA,MACA,iBAAiB,UAAU;AAAA,MAC3B,MAAM,UAAU,MAAM;AAAA,IACxB,CAAC;AAAA,EACH;AAGA,QAAM,OAAO,iBAAiB,MAAM;AACpC,MAAI,YAAY,IAAI;AAGpB,eAAa,KAAK,MAAM;AAGxB,cAAY,KAAK,OAAO,UAAU,YAAY,MAAS;AAGvD,MAAI,OAAO,mBAAmB;AAC5B,iBAAa,KAAK,OAAO,iBAAiB;AAAA,EAC5C,OAAO;AACL,yBAAqB,KAAK,MAAM;AAAA,EAClC;AAGA;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP,OAAO,OAAO,iBAAiB,OAAO,KAAK,IAAI,OAAO,KAAK;AAAA,IAC3D,OAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/motion/easing.ts","../src/renderers/chrome.ts","../src/renderers/brand.ts","../src/theme-tokens.ts"],"sourcesContent":["/**\n * Shared easing and interpolation primitives.\n *\n * Single source of truth for the hand-rolled easings used by the canvas\n * scheduler (motion/tween.ts), the update-transition driver (transition.ts)\n * and the story tweens (story/tween.ts). No `d3-ease` dependency.\n */\n\n/** Linear (identity) easing. Required for stacked/segmented handoffs. */\nexport function linear(t: number): number {\n return t;\n}\n\n/** Cubic-out: decelerates into place. Maps to `'snappy'`. */\nexport function cubicOut(t: number): number {\n const f = 1 - t;\n return 1 - f * f * f;\n}\n\n/** Cubic-in-out: eases in and out. Maps to `'smooth'`. */\nexport function cubicInOut(t: number): number {\n return t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;\n}\n\nexport const clamp01 = (t: number): number => Math.min(1, Math.max(0, t));\n\nexport const lerp = (a: number, b: number, t: number): number => a + (b - a) * t;\n","/**\n * Chrome rendering: title, subtitle, source, byline, footer.\n */\n\nimport type {\n ChartLayout,\n MeasureTextFn,\n ResolvedChromeElement,\n} from '@opendata-ai/openchart-core';\nimport {\n computeNoteBandHeight,\n FOOTNOTE_LINE_HEIGHT,\n textAscent,\n truncateToWidth,\n wrapText,\n} from '@opendata-ai/openchart-core';\nimport { applyTextStyle, createSVGElement, setAttrs } from './svg-dom';\n\nexport function renderChromeElement(\n parent: SVGElement,\n element: ResolvedChromeElement,\n className: string,\n chromeKey: string,\n measureText?: MeasureTextFn,\n uppercase = false,\n): void {\n const text = createSVGElement('text');\n // element.y is the TOP of the text box; convert to the alphabetic baseline\n // here instead of relying on dominant-baseline:hanging, which WebKit\n // positions from different font metrics and never inherits into tspans.\n setAttrs(text, { x: element.x, y: element.y + textAscent(element.style.fontSize) });\n applyTextStyle(text, element.style);\n text.setAttribute('class', className);\n text.setAttribute('data-chrome-key', chromeKey);\n\n // happy-dom doesn't apply CSS text-transform inside SVG measurement, so\n // pre-uppercase the rendered text for elements that style as uppercase.\n // Browsers honor the CSS rule too, so this is double-applied harmlessly.\n const renderedText = uppercase ? element.text.toUpperCase() : element.text;\n\n const lines = wrapText(\n renderedText,\n element.style.fontSize,\n element.style.fontWeight,\n element.maxWidth,\n measureText,\n );\n\n // Cap wrapped output to maxLines, truncating the last kept line with an\n // ellipsis so it fits maxWidth. Only when the natural wrap exceeds the cap.\n let truncated = false;\n if (element.maxLines != null && lines.length > element.maxLines) {\n truncated = true;\n lines.length = element.maxLines;\n const lastIndex = element.maxLines - 1;\n const measure = measureText\n ? (text: string, fontSize: number, fontWeight?: number) =>\n measureText(text, fontSize, fontWeight).width\n : undefined;\n // Content was dropped, so the last kept line always gets an ellipsis.\n // Append it first, then shrink to fit maxWidth if the combined string\n // overflows.\n const withEllipsis = `${lines[lastIndex]}…`;\n lines[lastIndex] = truncateToWidth(\n withEllipsis,\n element.maxWidth,\n element.style.fontSize,\n element.style.fontWeight,\n measure,\n );\n }\n\n if (lines.length === 1 && !truncated) {\n text.textContent = renderedText;\n } else if (lines.length === 1) {\n text.textContent = lines[0];\n } else {\n const lineHeight = element.style.fontSize * (element.style.lineHeight ?? 1.3);\n for (let i = 0; i < lines.length; i++) {\n const tspan = createSVGElement('tspan');\n setAttrs(tspan, { x: element.x, dy: i === 0 ? 0 : lineHeight });\n tspan.textContent = lines[i];\n text.appendChild(tspan);\n }\n }\n\n parent.appendChild(text);\n}\n\nexport function renderChrome(parent: SVGElement, layout: ChartLayout): void {\n const g = createSVGElement('g');\n g.setAttribute('class', 'oc-chrome');\n\n const { chrome, measureText } = layout;\n\n // Editorial rule: a short colored bar above the top chrome block.\n if (chrome.rule) {\n const rule = createSVGElement('rect');\n rule.setAttribute('class', 'oc-chrome-rule');\n setAttrs(rule, {\n x: chrome.rule.x,\n y: chrome.rule.y,\n width: chrome.rule.width,\n height: chrome.rule.thickness,\n });\n rule.setAttribute('fill', chrome.rule.color);\n rule.setAttribute('shape-rendering', 'crispEdges');\n g.appendChild(rule);\n }\n\n // Top chrome: render at their stored y positions (already absolute)\n if (chrome.eyebrow && chrome.rule) {\n // The rule already carries the accent above the block; a dot as well is\n // two pieces of furniture saying the same thing.\n renderChromeElement(g, chrome.eyebrow, 'oc-eyebrow', 'eyebrow', measureText, true);\n } else if (chrome.eyebrow) {\n // Leading accent dot — matches the editorial design system mock.\n // eyebrow.y is the top of the text box. Visual center is roughly\n // y + fontSize * 0.55 (cap height).\n const eyebrow = chrome.eyebrow;\n const dotR = 3;\n const dotGap = 8;\n const dotX = eyebrow.x + dotR;\n const dotY = eyebrow.y + eyebrow.style.fontSize * 0.42;\n const dot = createSVGElement('circle');\n dot.setAttribute('class', 'oc-eyebrow-dot');\n setAttrs(dot, { cx: dotX, cy: dotY, r: dotR });\n dot.setAttribute('fill', eyebrow.style.fill ?? 'currentColor');\n g.appendChild(dot);\n\n const shifted: ResolvedChromeElement = {\n ...eyebrow,\n x: eyebrow.x + dotR * 2 + dotGap,\n };\n renderChromeElement(g, shifted, 'oc-eyebrow', 'eyebrow', measureText, true);\n }\n if (chrome.title) {\n renderChromeElement(g, chrome.title, 'oc-title', 'title', measureText);\n }\n if (chrome.subtitle) {\n renderChromeElement(g, chrome.subtitle, 'oc-subtitle', 'subtitle', measureText);\n }\n\n const bottomOffset = layout.chrome.bottomAnchorY ?? layout.area.y + layout.area.height;\n\n // Footnotes from auto-thinned annotations, rendered above source/byline.\n // Each footnote gets its own line to avoid horizontal overflow.\n const bandHeight =\n layout.chrome.noteBandHeight ?? computeNoteBandHeight(layout.chrome, layout.theme);\n let noteLine = 0;\n if (chrome.footnotes && chrome.footnotes.length > 0) {\n const fontSize = layout.theme.fonts.sizes.small;\n const pad = layout.theme.spacing.padding;\n const lineHeight = fontSize * FOOTNOTE_LINE_HEIGHT;\n const style = {\n fontFamily: layout.theme.fonts.family,\n fontSize,\n fontWeight: layout.theme.fonts.weights.normal,\n fill: layout.theme.chrome.source.color,\n lineHeight: FOOTNOTE_LINE_HEIGHT,\n textAnchor: 'start' as const,\n };\n\n const list = createSVGElement('g');\n list.setAttribute('role', 'list');\n list.setAttribute('aria-label', 'Annotation notes, in source order');\n g.appendChild(list);\n for (let i = 0; i < chrome.footnotes.length; i++) {\n const f = chrome.footnotes[i];\n const y =\n bottomOffset +\n layout.theme.spacing.chartToFooter +\n textAscent(fontSize) +\n noteLine * lineHeight;\n const el = createSVGElement('text');\n el.setAttribute('class', 'oc-footnotes');\n el.setAttribute('role', 'listitem');\n if (!layout.a11y.hidden) el.setAttribute('tabindex', '0');\n el.setAttribute(\n 'aria-label',\n `${f.index}. ${f.text.replaceAll('**', '')}${f.subtitle ? `. ${f.subtitle.replaceAll('**', '')}` : ''}`,\n );\n if (f.specIndex !== undefined) el.setAttribute('data-note-spec-index', String(f.specIndex));\n if (f.id !== undefined) el.setAttribute('data-note-id', f.id);\n setAttrs(el, { x: pad, y });\n applyTextStyle(el, style);\n const lines = f.lines ?? [`${f.index}. ${f.text}`];\n lines.forEach((line, index) => {\n const span = createSVGElement('tspan');\n setAttrs(span, { x: pad, dy: index === 0 ? 0 : lineHeight });\n const runs = f.spans?.[index];\n if (runs) {\n for (const run of runs) {\n const part = createSVGElement('tspan');\n if (run.bold) part.setAttribute('font-weight', '700');\n part.textContent = run.text;\n span.appendChild(part);\n }\n } else span.textContent = line;\n el.appendChild(span);\n });\n noteLine += f.lines?.length ?? 1;\n list.appendChild(el);\n }\n }\n\n let summaryLine = noteLine;\n for (const entry of chrome.seriesSummary ?? []) {\n const size = layout.theme.fonts.sizes.small;\n const el = createSVGElement('text');\n el.setAttribute('class', 'oc-series-summary');\n el.setAttribute('data-series', entry.key);\n setAttrs(el, {\n x: layout.theme.spacing.padding,\n y:\n bottomOffset +\n layout.theme.spacing.chartToFooter +\n textAscent(size) +\n summaryLine * size * FOOTNOTE_LINE_HEIGHT,\n });\n applyTextStyle(el, {\n fontFamily: layout.theme.fonts.family,\n fontSize: size,\n fontWeight: 500,\n lineHeight: FOOTNOTE_LINE_HEIGHT,\n fill: entry.color,\n });\n entry.lines.forEach((line, index) => {\n const span = createSVGElement('tspan');\n setAttrs(span, {\n x: layout.theme.spacing.padding,\n dy: index === 0 ? 0 : size * FOOTNOTE_LINE_HEIGHT,\n });\n span.textContent = line;\n el.appendChild(span);\n });\n summaryLine += entry.lines.length;\n g.appendChild(el);\n }\n\n if (chrome.source) {\n renderChromeElement(\n g,\n { ...chrome.source, y: bottomOffset + chrome.source.y + bandHeight },\n 'oc-source',\n 'source',\n measureText,\n );\n }\n if (chrome.byline) {\n renderChromeElement(\n g,\n { ...chrome.byline, y: bottomOffset + chrome.byline.y + bandHeight },\n 'oc-byline',\n 'byline',\n measureText,\n );\n }\n if (chrome.footer) {\n renderChromeElement(\n g,\n { ...chrome.footer, y: bottomOffset + chrome.footer.y + bandHeight },\n 'oc-footer',\n 'footer',\n measureText,\n );\n }\n if (chrome.brand) {\n const brandY = bottomOffset + chrome.brand.y + bandHeight;\n renderChromeElement(g, { ...chrome.brand, y: brandY }, 'oc-brand', 'brand', measureText);\n }\n\n parent.appendChild(g);\n}\n","/** Shared measured attribution painting for SVG visualizations. */\nimport type { ChartLayout, MeasureTextFn, ResolvedChrome } from '@opendata-ai/openchart-core';\nimport { computeNoteBandHeight } from '@opendata-ai/openchart-core';\nimport { renderChromeElement } from './chrome';\nimport { createSVGElement, XLINK_NS } from './svg-dom';\n\nconst BRAND_URL = 'https://tryopendata.ai';\n\n/** Paint the exact portable footer mark resolved by computeChrome. */\nexport function renderAttributionBrand(\n parent: SVGElement,\n chrome: ResolvedChrome,\n bottomOffset: number,\n measureText?: MeasureTextFn,\n includeCustom = true,\n): void {\n if (includeCustom && chrome.brand) {\n renderChromeElement(\n parent,\n { ...chrome.brand, y: bottomOffset + chrome.brand.y },\n 'oc-brand',\n 'brand',\n measureText,\n );\n }\n const mark = chrome.watermark;\n if (!mark) return;\n const link = createSVGElement('a');\n link.setAttribute('href', BRAND_URL);\n link.setAttributeNS(XLINK_NS, 'xlink:href', BRAND_URL);\n link.setAttribute('target', '_blank');\n link.setAttribute('rel', 'noopener');\n link.setAttribute('class', 'oc-chrome-ref');\n link.setAttribute('opacity', '0.55');\n renderChromeElement(\n link,\n { ...mark, y: bottomOffset + mark.y },\n 'oc-watermark',\n 'watermark',\n measureText,\n );\n parent.appendChild(link);\n}\n\nexport function renderBrand(parent: SVGElement, layout: ChartLayout): void {\n const bandHeight =\n layout.chrome.noteBandHeight ?? computeNoteBandHeight(layout.chrome, layout.theme);\n const bottomOffset =\n (layout.chrome.bottomAnchorY ?? layout.area.y + layout.area.height) + bandHeight;\n renderAttributionBrand(parent, layout.chrome, bottomOffset, layout.measureText, false);\n}\n","/**\n * Project authored theme leaves to scoped CSS custom properties.\n *\n * Unauthored values remain in tokens.css / dark.css, leaving host CSS in\n * control. Derived neutral values follow authored text/background changes.\n */\n\nimport type { ResolvedTheme, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { adaptForLightLineStroke, cssTokenDefault } from '@opendata-ai/openchart-core';\n\n/**\n * The opaque surface a theme paints on. A transparent theme background has no\n * color of its own, so it resolves to the static `--oc-bg` token for the mode --\n * the same value the engine's knockout strokes are cut in. Resolved once in\n * core, on `colors.neutral.surface`; this is a named read of it.\n */\nexport function resolvedSurface(theme: ResolvedTheme): string {\n return theme.colors.neutral.surface;\n}\n\ntype StyledElement = HTMLElement | SVGElement;\nconst stamped = new WeakMap<\n StyledElement,\n Map<string, { previous: string; priority: string; value: string }>\n>();\n\n/** Read the host cascade without an earlier authored token, then restore it synchronously. */\nexport function readWithoutThemeStamp<T>(el: StyledElement, name: string, read: () => T): T {\n const entry = stamped.get(el)?.get(name);\n const value = el.style.getPropertyValue(name);\n if (!entry || value !== entry.value) return read();\n const priority = el.style.getPropertyPriority(name);\n try {\n if (entry.previous) el.style.setProperty(name, entry.previous, entry.priority);\n else el.style.removeProperty(name);\n return read();\n } finally {\n el.style.setProperty(name, value, priority);\n }\n}\n\n/** Stamp only authored theme leaves. Defaults stay in CSS so host rules can override them. */\nexport function stampThemeProperties(\n el: StyledElement,\n theme: ResolvedTheme,\n kind?: 'table',\n): void {\n el.classList.toggle('oc-dark', theme.isDark);\n const accent = theme.colors.categorical[0] ?? cssTokenDefault('--oc-accent', 'light');\n const bg = resolvedSurface(theme);\n\n const n = theme.colors.neutral;\n\n const props: [string, string][] = [\n ['--oc-font-family', theme.fonts.family],\n ['--oc-font-mono', theme.fonts.mono],\n ['--oc-title-size', `${theme.chrome.title.fontSize}px`],\n ['--oc-title-weight', `${theme.chrome.title.fontWeight}`],\n ['--oc-subtitle-size', `${theme.chrome.subtitle.fontSize}px`],\n ['--oc-subtitle-weight', `${theme.chrome.subtitle.fontWeight}`],\n ['--oc-source-size', `${theme.chrome.source.fontSize}px`],\n ['--oc-source-weight', `${theme.chrome.source.fontWeight}`],\n ['--oc-body-size', `${theme.fonts.sizes.body}px`],\n ['--oc-endpoint-label-size', `${theme.fonts.sizes.endpointLabel}px`],\n ['--oc-endpoint-value-size', `${theme.fonts.sizes.endpointValue}px`],\n ['--oc-endpoint-entry-gap', `${theme.spacing.endpointEntryGap}px`],\n ['--oc-endpoint-value-gap', `${theme.spacing.endpointValueGap}px`],\n ['--oc-endpoint-column-gap', `${theme.spacing.endpointColumnGap}px`],\n ['--oc-eyebrow-size', `${theme.chrome.eyebrow.fontSize}px`],\n ['--oc-eyebrow-weight', `${theme.chrome.eyebrow.fontWeight}`],\n ['--oc-bg', bg],\n ['--oc-text', theme.colors.text],\n ['--oc-text-muted', theme.colors.axis],\n // Secondary grays are derived from the theme's own text/background pair\n // (ResolvedTheme.colors.neutral), so a warm or cool theme gets warm or\n // cool grays instead of zinc. One direction only: theme -> CSS.\n ['--oc-text-secondary', n.secondary],\n ['--oc-text-faint', n.faint],\n ['--oc-border', n.border],\n ['--oc-gray-100', n[100]],\n ['--oc-gray-200', n[200]],\n ['--oc-gray-300', n[300]],\n ['--oc-gray-400', n[400]],\n ['--oc-gray-600', n[600]],\n ['--oc-gray-800', n[800]],\n ['--oc-gridline', theme.colors.gridline],\n // --oc-axis is the hairline the axis line is drawn with, not the ink its\n // tick labels take (that is --oc-text-muted, above).\n ['--oc-axis', theme.colors.hairline],\n ['--oc-border-radius', `${theme.borderRadius}px`],\n ['--oc-accent', accent],\n ['--oc-accent-strong', adaptForLightLineStroke(accent)],\n ['--oc-positive', theme.colors.positive],\n ['--oc-negative', theme.colors.negative],\n ['--oc-space-2', `${theme.spacing.chromeGap * 2}px`],\n ['--oc-space-4', `${theme.spacing.padding}px`],\n ];\n\n const authored = theme._authored;\n const colors = authored?.colors && !Array.isArray(authored.colors) ? authored.colors : {};\n const neutralAuthored = colors.text !== undefined || colors.background !== undefined;\n const colorAuthored = (key: keyof Exclude<ThemeConfig['colors'], string[] | undefined>) =>\n colors[key] !== undefined;\n const chromeAuthored = (\n element: 'title' | 'subtitle' | 'source' | 'eyebrow',\n field: 'fontSize' | 'fontWeight',\n ) => {\n if (authored?.chrome?.[element]?.[field] !== undefined) return true;\n if (field === 'fontWeight' || element === 'eyebrow') return false;\n return authored?.fonts?.sizes?.[element === 'source' ? 'small' : element] !== undefined;\n };\n const paletteAuthored = Array.isArray(authored?.colors) || colors.categorical !== undefined;\n const enabled: Record<string, boolean> = {\n '--oc-font-family': authored?.fonts?.family !== undefined,\n '--oc-font-mono': authored?.fonts?.mono !== undefined,\n '--oc-title-size': chromeAuthored('title', 'fontSize'),\n '--oc-title-weight': chromeAuthored('title', 'fontWeight'),\n '--oc-subtitle-size': chromeAuthored('subtitle', 'fontSize'),\n '--oc-subtitle-weight': chromeAuthored('subtitle', 'fontWeight'),\n '--oc-source-size': chromeAuthored('source', 'fontSize'),\n '--oc-source-weight': chromeAuthored('source', 'fontWeight'),\n '--oc-body-size': authored?.fonts?.sizes?.body !== undefined,\n '--oc-endpoint-label-size': authored?.fonts?.sizes?.endpointLabel !== undefined,\n '--oc-endpoint-value-size': authored?.fonts?.sizes?.endpointValue !== undefined,\n '--oc-endpoint-entry-gap': authored?.spacing?.endpointEntryGap !== undefined,\n '--oc-endpoint-value-gap': authored?.spacing?.endpointValueGap !== undefined,\n '--oc-endpoint-column-gap': authored?.spacing?.endpointColumnGap !== undefined,\n '--oc-eyebrow-size': chromeAuthored('eyebrow', 'fontSize'),\n '--oc-eyebrow-weight': chromeAuthored('eyebrow', 'fontWeight'),\n '--oc-bg': colorAuthored('background'),\n '--oc-text': colorAuthored('text'),\n '--oc-text-muted': colorAuthored('axis') || (kind === 'table' && neutralAuthored),\n '--oc-text-secondary': neutralAuthored,\n '--oc-text-faint': neutralAuthored,\n '--oc-border': neutralAuthored || (kind === 'table' && colorAuthored('gridline')),\n '--oc-gridline': colorAuthored('gridline'),\n '--oc-axis': colorAuthored('hairline'),\n '--oc-border-radius': authored?.borderRadius !== undefined,\n '--oc-accent': paletteAuthored,\n '--oc-accent-strong': paletteAuthored,\n '--oc-positive': colorAuthored('positive'),\n '--oc-negative': colorAuthored('negative'),\n '--oc-space-2': authored?.spacing?.chromeGap !== undefined,\n '--oc-space-4': authored?.spacing?.padding !== undefined,\n };\n for (const key of [\n 'annotationLabel',\n 'annotationMuted',\n 'annotationLeader',\n 'annotationRule',\n 'annotationRangeFill',\n 'annotationMarkerFill',\n 'annotationPlate',\n ] as const) {\n const name = `--oc-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;\n props.push([name, theme.colors[key]]);\n enabled[name] =\n colorAuthored(key) ||\n ((key === 'annotationMarkerFill' || key === 'annotationPlate') && neutralAuthored);\n }\n for (const key of [\n 'gridlineZero',\n 'mapNoDataFill',\n 'mapNoDataHatch',\n 'mapInteriorBorder',\n 'mapOutlineBorder',\n ] as const) {\n const name = `--oc-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;\n if (theme.colors[key] !== undefined) props.push([name, theme.colors[key]]);\n enabled[name] = colorAuthored(key);\n }\n for (const level of [100, 200, 300, 400, 600, 800])\n enabled[`--oc-gray-${level}`] = neutralAuthored;\n if (kind === 'table') {\n if (!colorAuthored('axis')) props.find(([name]) => name === '--oc-text-muted')![1] = n[600];\n if (colorAuthored('gridline'))\n props.find(([name]) => name === '--oc-border')![1] = theme.colors.gridline;\n }\n const previous = stamped.get(el) ?? new Map();\n for (const [name, entry] of previous) {\n if (!enabled[name]) {\n // Do not erase a host change made since our last stamp.\n if (el.style.getPropertyValue(name) === entry.value) {\n if (entry.previous) el.style.setProperty(name, entry.previous, entry.priority);\n else el.style.removeProperty(name);\n }\n previous.delete(name);\n }\n }\n for (const [name, value] of props) {\n if (!enabled[name]) continue;\n const old = previous.get(name);\n previous.set(name, {\n previous: old?.previous ?? el.style.getPropertyValue(name),\n priority: old?.priority ?? el.style.getPropertyPriority(name),\n value,\n });\n el.style.setProperty(name, value);\n }\n stamped.set(el, previous);\n}\n"],"mappings":";;;;;;;;AASO,SAAS,OAAO,GAAmB;AACxC,SAAO;AACT;AAGO,SAAS,SAAS,GAAmB;AAC1C,QAAM,IAAI,IAAI;AACd,SAAO,IAAI,IAAI,I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