@mieweb/ui 0.11.0-dev.56 → 0.11.0-dev.57

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/agent/README.md CHANGED
@@ -22,8 +22,8 @@ governing spec: later tickets cite it instead of re-deciding.
22
22
  | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
23
  | [mieweb-ui.instructions.md](mieweb-ui.instructions.md) | The rules template. Copied verbatim to the consumer's `.github/instructions/` (VS Code Copilot auto-applies it via the `applyTo` frontmatter) and embedded, minus frontmatter, in a marked block in the consumer's `AGENTS.md` (the cross-tool convention). |
24
24
  | [init-agent.mjs](init-agent.mjs) | The `mieweb-ui` bin. Idempotent — rerun after upgrading `@mieweb/ui` to refresh all targets. `--experimental-agents` additionally installs the agent team below. |
25
- | [agents/](agents/) | Agent templates: `mieweb-ui-design` (orchestrator) + `mieweb-ui-styling` + `mieweb-ui-install` + `mieweb-ui-a11y` + `mieweb-ui-i18n` + `mieweb-ui-migration` + `mieweb-ui-richtext` + `mieweb-ui-grids`. Installed to the consumer's `.github/agents/` behind `--experimental-agents`. |
26
- | [skills/](skills/) | Skill templates: `mieweb-ui-catalog`, `mieweb-ui-tokens`, `mieweb-ui-icons` (generated — `pnpm agent:skills`, never hand-edit) + `mieweb-ui-brands`, `mieweb-ui-tailwind4`, `mieweb-ui-a11y-checklist`, `mieweb-ui-i18n-checklist`, `mieweb-ui-kerebron`, `mieweb-ui-datavis-api` (hand-written). Installed to `.github/skills/` behind `--experimental-agents`. |
25
+ | [agents/](agents/) | Agent templates: `mieweb-ui-design` (orchestrator) + `mieweb-ui-styling` + `mieweb-ui-install` + `mieweb-ui-a11y` + `mieweb-ui-i18n` + `mieweb-ui-migration` + `mieweb-ui-richtext` + `mieweb-ui-grids` + `mieweb-ui-datavis`. Installed to the consumer's `.github/agents/` behind `--experimental-agents`. |
26
+ | [skills/](skills/) | Skill templates: `mieweb-ui-catalog`, `mieweb-ui-tokens`, `mieweb-ui-icons` (generated — `pnpm agent:skills`, never hand-edit) + `mieweb-ui-brands`, `mieweb-ui-tailwind4`, `mieweb-ui-a11y-checklist`, `mieweb-ui-i18n-checklist`, `mieweb-ui-kerebron`, `mieweb-ui-datavis-api`, `mieweb-ui-charts` (hand-written). Installed to `.github/skills/` behind `--experimental-agents`. |
27
27
  | `evals/` _(Phase 2+)_ | Golden-question eval sets per specialist; the regression harness for agent knowledge. |
28
28
 
29
29
  Rule content is sourced from [lessons/component-policy.md](../lessons/component-policy.md);
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: MIE UI DataVis Agent
3
+ description: Visualization specialist for the @mieweb/ui design system — charts, maps, globes, decks and org charts (Sparkline, DataVisNitroGraph boundary, Deck, Globe, PointMap, OrgChart, TileCartogramSection, report-template sections). Invoke for choosing or configuring a chart/map/globe/deck/org-chart, their peer-dependency and CSS errors, SSR/client-boundary issues, theming of canvas-rendered visuals, and report-page composition.
4
+ tools: ['search', 'codebase', 'fetch', 'runInTerminal']
5
+ handoffs:
6
+ - label: Apply Fixes
7
+ agent: agent
8
+ prompt: Apply the visualization integration fixes identified above to the codebase.
9
+ send: false
10
+ ---
11
+
12
+ # MIE UI DataVis Agent
13
+
14
+ You are the visualization specialist for the **@mieweb/ui** design system:
15
+ charts, maps, globes, slide decks, org charts and report-page sections. You
16
+ help consumers pick the right visual, wire its entry point, peers and CSS,
17
+ and debug rendering/SSR/theming problems. You diagnose from evidence and
18
+ report a minimal fix — you do not edit files (offer the **Apply Fixes**
19
+ handoff instead).
20
+
21
+ ## Your sources of truth (never inline-duplicate them)
22
+
23
+ - **`mieweb-ui-charts` skill** — the domain bible: the which-visual guide,
24
+ the entry/peers/CSS matrix, per-component props and data shapes, the
25
+ client-only constraints, Globe/PointMap/OrgChart traps, the YChart
26
+ non-export, and the symptom→fix troubleshooting table. Start every answer
27
+ here.
28
+ - **`mieweb-ui-catalog` skill** — entry points, component inventory and
29
+ per-entry peer requirements.
30
+ - **`mieweb-ui-datavis-api` skill** — the boundary case: when the question
31
+ is really a NITRO Grid/Graph over a fetched dataset.
32
+ - The consumer's installed package — verify props against the entry's
33
+ `.d.ts` when in doubt; never guess.
34
+
35
+ ## Workflow
36
+
37
+ 1. **Pick the visual before configuring it.** Dataset exploration with
38
+ user-changeable axes is `DataVisNitroGraph` (Grids domain, not yours);
39
+ inline trend is `Sparkline`; real geography is `PointMap`; equal-area
40
+ shading is `TileCartogramSection`; narrative is `Deck`; hierarchy is
41
+ `OrgChart`; network showcase is `Globe`. Hand-rolled `<svg>`/canvas
42
+ charts or a new charting library is the finding — redirect to the family
43
+ first.
44
+ 2. **Check plumbing before props.** Most failures are structural: missing
45
+ optional peers (they don't warn at install), the two required CSS imports
46
+ (Leaflet, xyflow), or a client-only component rendered during SSR.
47
+ 3. **Respect the data contracts.** Deck slides are JSON-only (behavior goes
48
+ through `renderers`/`graphics`/`components`); OrgChart input is
49
+ normalized to a forest; Sparkline takes pre-bucketed points, it does not
50
+ aggregate.
51
+ 4. **Carry the a11y posture.** Canvas/WebGL surfaces have no accessible
52
+ tree — the accessible data is the companion content (PointMap's list,
53
+ Deck's `sr-only` tables, OrgChart's list view). Never suggest removing
54
+ those to "clean up" the UI.
55
+ 5. **Match the skill's troubleshooting table**, then report root cause,
56
+ evidence, and the smallest fix. Offer **Apply Fixes** for the edit.
57
+
58
+ ## Redirects
59
+
60
+ - "Which component should I use?" across families → **MIE UI Design Agent**;
61
+ you own selection *within* the visualization family.
62
+ - Grids, NITRO sources/columns, and `DataVisNitroGraph` configuration →
63
+ **MIE UI Grids Agent** (Graph is a renderer over a NITRO source).
64
+ - Install plumbing beyond the chart peers (Tailwind setup, `styles.css`,
65
+ main-entry peer errors) → **MIE UI Install Agent**.
66
+ - Token/Tailwind/brand theming of surrounding UI → **MIE UI Styling Agent**
67
+ (you keep the canvas-specific cases: Globe's host-resolved `theme` prop,
68
+ `--xy-*` mapping, `--mieweb-chart-*` palette).
69
+ - Accessibility audits → **MIE UI A11y Agent** — with the canvas caveat
70
+ carried by you.
71
+ - Deck slide *content* authoring beyond the schema (copy, markdown) → the
72
+ orchestrator/catalog.
73
+
74
+ ## Rules
75
+
76
+ 1. Never invent props, slide types, or capabilities — verify against the
77
+ `mieweb-ui-charts` skill or the installed types; these components wrap
78
+ third-party libraries behind deliberately curated surfaces.
79
+ 2. Never route dataset-exploration charting here-and-away from NITRO: a
80
+ fetched dataset the user wants to slice belongs to
81
+ `DataVisNitroSource` + `DataVisNitroGraph` (Grids Agent).
82
+ 3. `YChart` is not a shipped component — never recommend importing it from
83
+ `@mieweb/ui`; offer `OrgChart`, `DataVisNitroGraph`, or direct
84
+ `@mieweb/ychart` adoption.
85
+ 4. Chart peers stay out of shared barrels: never advise re-exporting
86
+ Globe/PointMap/OrgChart from a module that non-visualization pages
87
+ import — the optional peers would break every consumer of that barrel.
88
+ 5. Production maps need a licensed tile service — flag default-OSM usage in
89
+ anything beyond a demo.
90
+ 6. Prefer the smallest change that fixes the root cause; no visualization
91
+ rewrites.
92
+ 7. The installed `mieweb-ui.instructions.md` rules apply to any code you
93
+ recommend.
@@ -31,6 +31,10 @@ handoffs:
31
31
  agent: MIE UI Grids Agent
32
32
  prompt: Handle the grid/eSheet question above (DataVis NITRO sources, columns, features, operations, eSheet Builder/Renderer) and report the minimal fix.
33
33
  send: false
34
+ - label: Charts & maps
35
+ agent: MIE UI DataVis Agent
36
+ prompt: Handle the visualization question above (Sparkline, Deck, Globe, PointMap, OrgChart, report sections — peers, CSS, SSR boundaries, data shapes) and report the minimal fix.
37
+ send: false
34
38
  ---
35
39
 
36
40
  # MIE UI Design Agent (orchestrator)
@@ -70,8 +74,9 @@ comparison tables) and `mieweb-ui-icons` (icon aliases and conventions):
70
74
  | migrating code to @mieweb/ui, raw-HTML compliance | MIE UI Migration Agent |
71
75
  | rich text editors (RichEditor, TextAreaRich, EmailEditor), Kerebron peers/WASM/patches, collab, Markdown rendering | MIE UI Rich Text Agent |
72
76
  | DataVis NITRO config (sources, columns, features, operations), eSheet Builder/Renderer, grid debugging | MIE UI Grids Agent |
77
+ | charts, maps, globes, decks, org charts (Sparkline, Deck, Globe, PointMap, OrgChart, report sections) | MIE UI DataVis Agent |
73
78
 
74
- More specialists (DataVis, Views,
79
+ More specialists (Views,
75
80
  SuperChat) land in later phases; until one ships, answer its domain
76
81
  from the skills and the component docs, or defer (below).
77
82
 
@@ -65,9 +65,8 @@ you do not edit files (offer the **Apply Fixes** handoff instead).
65
65
  - Grid accessibility audits → **MIE UI A11y Agent** — but always carry the
66
66
  caveat yourself: the engine's DOM is not screen-reader friendly; keep
67
67
  critical actions reachable outside the grid.
68
- - Charts beyond the NITRO Graph (YChart, Deck, Globe, maps) → the DataVis
69
- specialist once it ships; until then the orchestrator answers from the
70
- catalog skill.
68
+ - Charts beyond the NITRO Graph (Sparkline, Deck, Globe, maps, OrgChart,
69
+ report sections) → **MIE UI DataVis Agent**.
71
70
 
72
71
  ## Rules
73
72
 
@@ -22,6 +22,7 @@ These files are maintainer-side quality tooling. They are **not** shipped by
22
22
  | [migration.md](./migration.md) | Migration / compliance (incl. icons) | MIE UI Migration Agent |
23
23
  | [richtext.md](./richtext.md) | Rich text / Kerebron editors | MIE UI Rich Text Agent |
24
24
  | [grids.md](./grids.md) | DataVis NITRO + eSheet grids | MIE UI Grids Agent |
25
+ | [datavis.md](./datavis.md) | Charts / maps / decks / org charts | MIE UI DataVis Agent |
25
26
 
26
27
  ## Entry format
27
28
 
@@ -0,0 +1,224 @@
1
+ # Evals — Charts / maps / decks / org charts
2
+
3
+ Primary agent: **MIE UI DataVis Agent**. See [README.md](./README.md) for
4
+ format and scoring. The #606 done-when: the agent routes correctly vs the
5
+ Grids agent (charts ≠ grids) and answers these without inventing API.
6
+
7
+ ### DV-1 — Chart vs grid routing (the boundary)
8
+
9
+ - **Ask:** "I fetched a dataset and want a chart the user can regroup and change axes on."
10
+ - **Expect:** That's `DataVisNitroGraph` over a `DataVisNitroSource` — the
11
+ Grids domain (route/defer to the Grids Agent, cite the datavis-api skill).
12
+ The charts family is for presentation visuals, not dataset exploration.
13
+ - **Agent:** MIE UI Grids Agent (via the DataVis Agent's redirect)
14
+ - **Source:** mieweb-ui-charts skill — Which visual?; grids.md GRD-14
15
+
16
+ ### DV-2 — Inline trend
17
+
18
+ - **Ask:** "I need a tiny trend indicator inside a table cell / stat card."
19
+ - **Expect:** `Sparkline` from the **main** entry — pure HTML, no chart
20
+ library, no peers. `data: SparklinePoint[]` is pre-bucketed
21
+ (`{ key, label?, value }`); it does not aggregate. `onSelect` makes bars
22
+ clickable toggles; without it the bars are read-only.
23
+ - **Agent:** MIE UI DataVis Agent
24
+ - **Source:** src/components/Sparkline/Sparkline.tsx
25
+
26
+ ### DV-3 — Globe won't build
27
+
28
+ - **Ask:** "Importing `@mieweb/ui/globe` fails to resolve `react-globe.gl`."
29
+ - **Expect:** `/globe` needs the optional peers `react-globe.gl>=2.30.0` +
30
+ `three>=0.160.0` (~700KB, deliberately out of the main bundle). Optional
31
+ peers don't warn at install — the entry just fails without them.
32
+ - **Agent:** MIE UI DataVis Agent
33
+ - **Source:** src/globe.ts header; package.json peerDependencies
34
+
35
+ ### DV-4 — Broken map tiles
36
+
37
+ - **Ask:** "PointMap shows markers but the map looks like an unstyled tile mosaic."
38
+ - **Expect:** Missing `import 'leaflet/dist/leaflet.css'` — the one required
39
+ CSS import for `/maps` (plus `leaflet>=1.9.0` as peer).
40
+ - **Agent:** MIE UI DataVis Agent
41
+ - **Source:** src/maps.ts header; PointMap.stories.tsx
42
+
43
+ ### DV-5 — SSR crash
44
+
45
+ - **Ask:** "Globe/OrgChart throws `window is not defined` in my Next.js build."
46
+ - **Expect:** Only **Globe** needs a dynamic import with `ssr: false` —
47
+ `react-globe.gl` touches `window` at module scope, so a Client Component
48
+ boundary alone still prerenders and crashes. OrgChart/Deck just need a
49
+ client boundary, and PointMap prerenders safely (Leaflet is
50
+ dynamic-imported in an effect — keep its accessible point list in the
51
+ initial HTML). Sparkline and the report sections are server-safe.
52
+ - **Agent:** MIE UI DataVis Agent
53
+ - **Source:** Globe MAINTAINERS.md; PointMap MAINTAINERS.md; entry headers
54
+ src/org-chart.ts, src/deck.ts
55
+
56
+ ### DV-6 — OrgChart missing styles
57
+
58
+ - **Ask:** "OrgChart renders nodes but edges and the canvas look unstyled."
59
+ - **Expect:** Import `@xyflow/react/dist/style.css` once; `/org-chart` also
60
+ needs peers `@xyflow/react>=12.0.0` + `elkjs>=0.9.0` (elkjs ~1.6MB,
61
+ lazy-loaded on first layout from its bundled build).
62
+ - **Agent:** MIE UI DataVis Agent
63
+ - **Source:** src/org-chart.ts header; OrgChart MAINTAINERS.md
64
+
65
+ ### DV-7 — Deck slide wants a callback
66
+
67
+ - **Ask:** "How do I put an onClick handler / custom React element inside a Deck slide?"
68
+ - **Expect:** You don't — slides are **JSON-only** (no functions, elements,
69
+ closures). Behavior and custom rendering come through the registries:
70
+ `renderers` (slide types), `graphics` (named components for
71
+ `{ type: 'custom', component: 'name' }`), `components` (framework
72
+ image/link), `labels`, `onSlideChange`.
73
+ - **Agent:** MIE UI DataVis Agent
74
+ - **Source:** Deck MAINTAINERS.md; Deck.tsx props
75
+
76
+ ### DV-8 — Map inside a deck
77
+
78
+ - **Ask:** "A slide in my Deck needs a geographic map."
79
+ - **Expect:** Register PointMap in the `graphics` map
80
+ (`<Deck graphics={{ map: PointMap }} />`) and reference it from a slide's
81
+ `graphic` field — e.g. a `chart` slide with
82
+ `graphic: { type: 'custom', component: 'map', props }`. A top-level
83
+ `{ type: 'custom' }` **slide** resolves through `renderers` instead and
84
+ renders nothing without one.
85
+ - **Agent:** MIE UI DataVis Agent
86
+ - **Source:** Deck.tsx slide resolution; Deck graphics.tsx custom lookup
87
+
88
+ ### DV-9 — Globe stuck in light mode
89
+
90
+ - **Ask:** "After toggling dark mode, the Globe keeps its old colors."
91
+ - **Expect:** Globe never reads CSS tokens — a fixed hex default palette
92
+ merges with the `theme` prop on every render, so remounting alone changes
93
+ nothing. Resolve brand tokens host-side and pass/update an explicit
94
+ `theme: GlobeTheme`.
95
+ - **Agent:** MIE UI DataVis Agent
96
+ - **Source:** Globe.tsx DEFAULT_THEME merge
97
+
98
+ ### DV-10 — Globe with no land
99
+
100
+ - **Ask:** "On our locked-down network the Globe renders ocean but no continents."
101
+ - **Expect:** Continent outlines come from the runtime `geoUrl` fetch (not
102
+ bundled). Pass a self-hosted GeoJSON URL, or `null` to skip land hexes.
103
+ - **Agent:** MIE UI DataVis Agent
104
+ - **Source:** Globe MAINTAINERS.md; Globe.tsx geoUrl
105
+
106
+ ### DV-11 — Custom tooltip XSS
107
+
108
+ - **Ask:** "Can I put rich HTML in Globe point tooltips?"
109
+ - **Expect:** Yes via `pointLabel`, but it returns **raw HTML** — the caller
110
+ owns sanitization (the default label HTML-escapes). Flag the XSS risk for
111
+ user-derived names.
112
+ - **Agent:** MIE UI DataVis Agent
113
+ - **Source:** Globe MAINTAINERS.md — tooltip HTML
114
+
115
+ ### DV-12 — Production tiles
116
+
117
+ - **Ask:** "We're shipping PointMap to all customers — anything to change from the demo?"
118
+ - **Expect:** The default `tileUrl` is OpenStreetMap — production/heavy use
119
+ must configure a licensed tile service and matching `attribution`.
120
+ - **Agent:** MIE UI DataVis Agent
121
+ - **Source:** PointMap.tsx tileUrl/attribution docs
122
+
123
+ ### DV-13 — Map accessibility
124
+
125
+ - **Ask:** "Can I set `hideList` to clean up the UI under the PointMap?"
126
+ - **Expect:** Caution — the text list **is** the accessible data (the map is
127
+ `role="group"`, not an image; Leaflet canvas has no accessible tree). Only
128
+ hide it if the same data is rendered elsewhere on the page.
129
+ - **Agent:** MIE UI DataVis Agent
130
+ - **Source:** PointMap MAINTAINERS.md — a11y model
131
+
132
+ ### DV-14 — Regional shading
133
+
134
+ - **Ask:** "I want a US map where every state is shaded by a metric bucket and small states stay visible."
135
+ - **Expect:** `TileCartogramSection` (`/templates`, server-safe) — every
136
+ region equal size, shaded by bucket. `PointMap` is for real geographic
137
+ positions/bubbles instead.
138
+ - **Agent:** MIE UI DataVis Agent
139
+ - **Source:** Reports.mdx; charts skill matrix
140
+
141
+ ### DV-15 — YChart import
142
+
143
+ - **Ask:** "How do I import YChart from @mieweb/ui?"
144
+ - **Expect:** You can't — YChart is a Storybook-only evaluation of the
145
+ `packages/ychart` submodule, **not exported from any entry**. Use
146
+ `OrgChart` (hierarchy) or `DataVisNitroGraph` (charting), or install
147
+ `@mieweb/ychart` directly and own the integration. Inventing an import
148
+ path FAILS.
149
+ - **Agent:** MIE UI DataVis Agent
150
+ - **Source:** YChart MAINTAINERS.md; DataDisplay.mdx
151
+
152
+ ### DV-16 — OrgChart data hygiene
153
+
154
+ - **Ask:** "My org data has a cycle and some employees point at managers that don't exist — will OrgChart crash?"
155
+ - **Expect:** No — input is normalized to a forest: first duplicate id wins,
156
+ unknown-parent nodes become roots, cycles are broken. But fix the data;
157
+ and reason about the normalized tree, not raw `parentId`.
158
+ - **Agent:** MIE UI DataVis Agent
159
+ - **Source:** OrgChart MAINTAINERS.md — buildOrgForest
160
+
161
+ ### DV-17 — OrgChart keyboard path
162
+
163
+ - **Ask:** "Is the OrgChart canvas keyboard accessible?"
164
+ - **Expect:** The canvas is pointer-first; the **list view** is the
165
+ keyboard/screen-reader path (WAI-ARIA tree pattern, default view under
166
+ 640px). Keep it reachable; detail panel is a non-modal dialog. Full audit
167
+ → A11y agent.
168
+ - **Agent:** MIE UI DataVis Agent
169
+ - **Source:** OrgChart MAINTAINERS.md — a11y
170
+
171
+ ### DV-18 — OrgChart theming
172
+
173
+ - **Ask:** "How do I give each department its own color in OrgChart?"
174
+ - **Expect:** `getGroupAccent(group, index)` returning **token names**
175
+ (drawn as wash + marker, never as text color); React Flow chrome themes
176
+ via `--xy-*` variables mapped from `--mieweb-*`. No raw hex.
177
+ - **Agent:** MIE UI DataVis Agent
178
+ - **Source:** OrgChart.tsx getGroupAccent; MAINTAINERS.md theming
179
+
180
+ ### DV-19 — Shared barrel trap
181
+
182
+ - **Ask:** "Can I re-export PointMap and Globe from our app's shared components barrel?"
183
+ - **Expect:** No — their optional peers would hard-break every page that
184
+ imports the barrel without leaflet/three installed. Keep chart imports at
185
+ the subpath entry, inside the pages that use them.
186
+ - **Agent:** MIE UI DataVis Agent
187
+ - **Source:** Globe/PointMap MAINTAINERS.md — main-entry warnings
188
+
189
+ ### DV-20 — Deck i18n
190
+
191
+ - **Ask:** "How do I localize a Deck — numbers and the chrome labels?"
192
+ - **Expect:** `locale` (BCP-47) drives number formatting; `labels` overrides
193
+ the chrome strings; slide content is the host's data. There's an RTL
194
+ story. String audits → i18n agent.
195
+ - **Agent:** MIE UI DataVis Agent
196
+ - **Source:** Deck.tsx props; Deck.stories.tsx RTL
197
+
198
+ ### DV-21 — Chart a11y posture
199
+
200
+ - **Ask:** "Are the Deck charts screen-reader accessible?"
201
+ - **Expect:** Yes by design: every built-in chart ships an `sr-only` value
202
+ table and the drawing is `aria-hidden`; count-ups respect
203
+ `prefers-reduced-motion`. Custom `graphics` must carry the same posture.
204
+ - **Agent:** MIE UI DataVis Agent
205
+ - **Source:** Deck MAINTAINERS.md — a11y
206
+
207
+ ### DV-22 — Testing the map
208
+
209
+ - **Ask:** "My vitest unit test for the PointMap page explodes inside Leaflet."
210
+ - **Expect:** Leaflet can't run in jsdom — don't unit-test the map itself;
211
+ cover it in Storybook/Playwright. (Similarly: Globe has no visual
212
+ regression — WebGL isn't pixel-deterministic.)
213
+ - **Agent:** MIE UI DataVis Agent
214
+ - **Source:** PointMap MAINTAINERS.md; Globe MAINTAINERS.md
215
+
216
+ ### DV-23 — Canned reports
217
+
218
+ - **Ask:** "We need to render existing WebChart reports with a date-range picker — which component family?"
219
+ - **Expect:** `WebChartReportViewer` + `ReportTimeRange`/`ReportDatePicker`
220
+ (main entry) for canned backend reports; `ReportDashboard` for the KPI +
221
+ bar-chart analytics page. For report *pages*, compose the `/templates`
222
+ sections (Methodology, Byline, Legend, MetricStatusBadge…).
223
+ - **Agent:** MIE UI DataVis Agent
224
+ - **Source:** WebChartReportViewer/index.ts; Dashboards.mdx; Reports.mdx
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: mieweb-ui-charts
3
+ description: Chart, map, globe and presentation components of @mieweb/ui — Sparkline, DataVisNitroGraph pointer, Deck slide decks, Globe, PointMap, OrgChart, TileCartogramSection and the report-template sections. Entry points, optional peers, required CSS imports, client-only constraints, data shapes, theming and a11y paths. USE WHEN selecting, configuring or debugging a chart/map/globe/deck/org-chart, resolving their peer or CSS errors, or deciding chart vs grid.
4
+ ---
5
+
6
+ # @mieweb/ui charts, maps & presentation visuals
7
+
8
+ Sourced from the entry-file headers (`src/deck.ts`, `src/globe.ts`,
9
+ `src/maps.ts`, `src/org-chart.ts`), component MAINTAINERS notes, and the
10
+ catalog pages (Presentations, Reports, Dashboards, Records, Data Display).
11
+
12
+ > **Which visual?** Exploring a fetched dataset (axes the user can change)
13
+ > → **DataVisNitroGraph** beside its grid — that's the Grids domain (see the
14
+ > **mieweb-ui-datavis-api** skill). Tiny inline trend in a card/table row →
15
+ > **Sparkline** (main entry, dependency-free). Full-screen narrative →
16
+ > **Deck**. Real geographic locations → **PointMap**; equal-area regional
17
+ > shading (every state same size) → **TileCartogramSection**; global
18
+ > network showcase → **Globe**. Reporting lines / location hierarchy →
19
+ > **OrgChart**. Canned backend reports → **WebChartReportViewer** /
20
+ > **ReportDashboard** (main entry). **YChart is not a component** — it's a
21
+ > Storybook-only evaluation of the `@mieweb/ychart` submodule; point
22
+ > consumers at OrgChart or DataVisNitroGraph.
23
+
24
+ ## Entry / peers / CSS matrix
25
+
26
+ | Component | Entry | Optional peers | Required CSS | Client-only? |
27
+ | --- | --- | --- | --- | --- |
28
+ | `Sparkline` | main `@mieweb/ui` | none | none | SSR-safe |
29
+ | `DataVisNitroGraph` | `/datavis` | none (engine bundled) | base styles.css | yes |
30
+ | `Deck` | `/deck` | none beyond main | built into `@mieweb/ui/styles.css` | yes (scroll/keys/fullscreen) |
31
+ | `Globe` | `/globe` | `react-globe.gl>=2.30.0`, `three>=0.160.0` (~700KB) | none (WebGL canvas) | yes — `ssr: false` boundary |
32
+ | `PointMap` | `/maps` | `leaflet>=1.9.0` | **`leaflet/dist/leaflet.css`** | client boundary; prerenders safely (Leaflet dynamic-imported in an effect) |
33
+ | `OrgChart` | `/org-chart` | `@xyflow/react>=12.0.0`, `elkjs>=0.9.0` | **`@xyflow/react/dist/style.css`** | client boundary |
34
+ | Report sections (`TileCartogramSection`, `BenchmarkTableSection`, `RankedListSection`, `MetricListSection`, `ReportMethodology`, `ReportByline`, `ReportLegend`, `MetricStatusBadge`, `LinkGroupsSection`, `PdfEmbedSection`) | `/templates` | none | base styles.css | server-safe |
35
+ | `WebChartReportViewer`, `ReportDashboard` | main | none | base styles.css | SSR-safe |
36
+
37
+ The chart peers are **optional**: installs don't warn when absent, but the
38
+ subpath entry hard-fails to resolve without them. They are kept out of the
39
+ main bundle deliberately — never re-export these components from your own
40
+ shared barrel that non-map/globe pages import.
41
+
42
+ ## Sparkline (main entry)
43
+
44
+ Pure-HTML bars, no chart library. `data: SparklinePoint[]`
45
+ (`{ key, label?, value }` — pre-bucketed; it does not aggregate),
46
+ `selectedKey`/`onSelect` (bars become toggle buttons; read-only without
47
+ `onSelect`), `label`, `height` (px, default 32), `formatValue(point)` for the
48
+ tooltip, `ariaLabel`. A11y: `role="group"` + labels; it is a glanceable
49
+ summary, not a data-exploration surface.
50
+
51
+ ## Deck (`@mieweb/ui/deck`)
52
+
53
+ Full-screen slide deck rendered from **JSON slides** — no functions,
54
+ elements or closures in the slide array; site behavior arrives through
55
+ props: `renderers` (override/add slide types; top-level `{ type: 'custom' }`
56
+ **slides** resolve here and render nothing without one), `graphics`
57
+ (components for a slide's `graphic: { type: 'custom', component: '<name>',
58
+ props }` — e.g. `<Deck graphics={{ map: PointMap }} />` with a `chart`
59
+ slide), `components` (framework
60
+ image/link), `icons`, `labels` (chrome strings), `locale` (BCP-47 number
61
+ formatting), `syncHash` (default true — slide deep-links in
62
+ `location.hash`), `home`, `onSlideChange`. ~24 built-in slide types plus
63
+ built-in graphic renderers `bar`, `horizontal-bar`, `multi-line`,
64
+ `kpi-row`, `spark`. Fills the viewport (`h-dvh`) — hide site chrome on deck
65
+ routes. A11y: every chart ships an `sr-only` value table, drawings are
66
+ `aria-hidden`, count-ups respect `prefers-reduced-motion`; reveal is
67
+ CSS-only (reduced-motion and print show everything). The window key handler
68
+ skips typing targets and `role="tab"` elements.
69
+
70
+ ## Globe (`@mieweb/ui/globe`)
71
+
72
+ `react-globe.gl` + three.js showcase globe. `points: GlobePoint[]`
73
+ (`{ id, lat, lng, name, sub?, hub?, color?, timeZone?, flag?, href? }`),
74
+ `arcs` (`kind: 'backbone' | 'spoke'`), `connectHubs`, `hexResolution` (2–4),
75
+ `pointOfView`, `autoRotateSpeed` (respects `prefers-reduced-motion`),
76
+ `selectedId`/`onSelect`/`onPointHover`, `callout`, `height` (default
77
+ `clamp(360px, 54vw, 560px)`). Traps:
78
+
79
+ - Globe never reads CSS tokens: a fixed hex default palette merges with the
80
+ `theme` prop on every render, so remounting alone changes nothing. Resolve
81
+ `--mieweb-*` tokens host-side and pass/update an explicit `GlobeTheme` for
82
+ brand or dark-mode colors.
83
+ - `geoUrl` (continent outlines) is **fetched at runtime**, not bundled —
84
+ offline/locked-down hosts pass `null` (skip land hexes) or a self-hosted
85
+ GeoJSON URL.
86
+ - The default `pointLabel` HTML-escapes names; a custom `pointLabel` returns
87
+ **raw HTML** — the caller owns sanitization.
88
+ - Visual showcase only: the WebGL canvas has no accessible tree; put the
89
+ real data in accompanying text/table content.
90
+
91
+ ## PointMap (`@mieweb/ui/maps`)
92
+
93
+ Leaflet dots/bubbles map. `points: MapPoint[]`
94
+ (`{ lat, lng, label, value?, detail? }`), required `label` (accessible map
95
+ name), `center`/`zoom` (seed initial state only — not reactive deps),
96
+ `tileUrl` + `attribution` (**default is OpenStreetMap; production/heavy use
97
+ must configure a licensed tile service**), `outlineUrl` (runtime-fetched
98
+ GeoJSON overlays), `sizeBy: 'value' | 'none'`, `showValues`, `hideList`.
99
+ A11y model: the map is `role="group"` with `aria-roledescription="map"`;
100
+ **the text list under the map is the accessible data** — `hideList` opts out
101
+ of it, so keep it unless the same data is rendered elsewhere. Colors come
102
+ from runtime `--mieweb-*` tokens (Leaflet paints outside Tailwind). Leaflet
103
+ cannot run in jsdom — verify map behavior in Storybook/Playwright, not unit
104
+ tests. In a Deck, register it in `graphics` and reference it from a slide's
105
+ `graphic: { type: 'custom', component: 'map', props }` (e.g. a `chart` slide).
106
+
107
+ ## OrgChart (`@mieweb/ui/org-chart`)
108
+
109
+ React Flow canvas + elkjs layered layout over a **flat node list**:
110
+ `nodes: OrgChartNode[]` (`{ id, parentId, name, title?, subtitle?, group?,
111
+ avatarUrl?, meta? }`). The input is normalized to a forest (`buildOrgForest`
112
+ keeps the first duplicate id, promotes unknown-parent nodes to roots, breaks
113
+ cycles) — reason about the normalized tree, not raw `parentId`. Key props:
114
+ `nodeVariant: 'person' | 'location'`, `direction: 'DOWN' | 'RIGHT'` (RTL
115
+ mirrors the x-axis), `initialDepth`, `focusId`/`highlightedId`,
116
+ `view`/`defaultView: 'chart' | 'list'` (list is the default under 640px),
117
+ `defaultQuery`/`defaultGroup`, `getGroupAccent` (returns token names, never
118
+ raw colors), `onSelect`/`onOpen`/`getHref`, `renderDetail`, `labels` (every
119
+ string localizable, some are count functions), `classNames`. elkjs
120
+ (~1.6MB) is lazy-loaded on first layout from its **bundled** build. A11y:
121
+ the canvas is pointer-first; **the list view is the keyboard/screen-reader
122
+ path** (full WAI-ARIA tree pattern), the detail panel is a non-modal dialog.
123
+ Custom node content must not exceed the fixed card size (layout measures
124
+ nothing from the DOM).
125
+
126
+ ## YChart (not shipped)
127
+
128
+ `src/components/YChart/` is a Storybook-only evaluation wrapper around the
129
+ `packages/ychart` git submodule (published separately as `@mieweb/ychart` —
130
+ vanilla D3 + YAML editor with its own `--yc-color-*` theming). It is **not
131
+ exported from any entry**. For app use: `OrgChart` (hierarchy) or
132
+ `DataVisNitroGraph` (charting); if a consumer truly wants the YAML editor,
133
+ they install `@mieweb/ychart` directly and own the integration.
134
+
135
+ ## Troubleshooting
136
+
137
+ | Symptom | Cause | Fix |
138
+ | --- | --- | --- |
139
+ | Build fails resolving `react-globe.gl`/`three` or `@xyflow/react`/`elkjs` | Optional peers of `/globe` / `/org-chart` not installed (no install-time warning) | Install the pair listed in the matrix |
140
+ | Map renders as a broken/unstyled tile mosaic | `leaflet/dist/leaflet.css` not imported | Import it once where `PointMap` is used |
141
+ | OrgChart nodes float without edges/handles styling | `@xyflow/react/dist/style.css` missing | Import it once where `OrgChart` is used |
142
+ | Globe crashes during SSR (`window is not defined`) | `react-globe.gl` touches `window` at module scope — a Client Component boundary alone still prerenders | Dynamic import with `ssr: false` (Globe only — PointMap/OrgChart/Deck need just a client boundary; PointMap prerenders its accessible point list) |
143
+ | Globe colors stale after dark-mode toggle | Globe never reads CSS tokens — fixed hex defaults merge with `theme` each render | Resolve tokens host-side and update the `theme` prop (remount alone does nothing) |
144
+ | Globe renders ocean but no land | `geoUrl` runtime fetch blocked (offline/CSP) | Pass `null` or a self-hosted GeoJSON URL |
145
+ | Tile requests throttled / licensing concern | Default `tileUrl` is OpenStreetMap | Configure a licensed tile service + matching `attribution` |
146
+ | Deck slide "needs" a callback or JSX | Slides are JSON-only by design | Move behavior into `renderers`/`graphics`/`components` registries |
147
+ | `YChart` import not found | Not exported — Storybook-only submodule demo | Use `OrgChart` or `DataVisNitroGraph`; or install `@mieweb/ychart` directly |
148
+ | OrgChart drops/duplicates people | Duplicate ids, unknown `parentId`, or cycles in input | Input is normalized (first-id wins, orphans become roots, cycles broken) — fix the data |
149
+ | PointMap unit tests fail in jsdom | Leaflet can't run in jsdom | Cover with Storybook/Playwright instead |
150
+ | Screen reader gets nothing from the map/globe | Canvas has no accessible tree | Keep PointMap's list (`hideList` off) / pair Globe with text content |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mieweb/ui",
3
- "version": "0.11.0-dev.56",
3
+ "version": "0.11.0-dev.57",
4
4
  "description": "A themeable, accessible React component library built with Tailwind CSS",
5
5
  "author": "Medical Informatics Engineering, Inc.",
6
6
  "license": "SEE LICENSE IN LICENSE",