feat(a2ui): normalize icon names to Material Symbols ligatures (camelCase → snake_case)#725
Conversation
…Case → snake_case) A2UI catalogs commonly emit camelCase icon identifiers (accountCircle, shoppingCart, moreVert) while Material Symbols ligatures are snake_case. The Icon component now converts the name before rendering so the existing A2UI icon vocabulary renders as real glyphs (not raw text). Single-word / already-snake_case names + emoji pass through unchanged; the original name is kept as the aria-label. Verified live in examples/chat (A2UI mode): an Account card renders account_circle / shopping_cart / settings / notifications / star glyphs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @blove's task in 1m 4s —— View job Code Review
LGTM. This is a clean, minimal fix. A few notes: Correctness —
The
Template — [attr.aria-label]="name"
>{{ glyphName() }}</span> Preserving the original name as the accessible label is correct — screen readers don't need the ligature string, they need a human-readable description. Test coverage Three cases cover the important paths (camelCase→snake_case, passthrough, emoji). One gap worth considering: Minor observation
No correctness bugs, no type-safety issues, no Angular/RxJS pitfalls. Ready to merge. |
Summary
Follow-up to #720. The Material Symbols rendering shipped, but the live smoke found it wasn't actually showcased: A2UI catalogs emit camelCase icon identifiers (
accountCircle,shoppingCart,moreVert— see the enum inexamples/chat's a2ui schema), while Material Symbols ligatures are snake_case (account_circle). So single-word names (check,star) rendered as glyphs but the multi-word camelCase ones rendered as raw text.This adds a small
toMaterialSymbolNamenormalizer in the Icon component (camelCase → snake_case before rendering), so the existing A2UI icon vocabulary — and any backend — renders real glyphs. Single-word / already-snake_case names and emoji pass through unchanged; the original name stays as thearia-label.Changes (libs/chat only)
a2ui/catalog/icon.component.ts— exportedtoMaterialSymbolName(); template renders the normalizedglyphName(), keepsaria-label= original name.icon.component.spec.ts— unit tests for the normalizer (camelCase→snake_case, passthrough, emoji).Verification
chattest + lint + build green.accountCircle→account_circle,shoppingCart→shopping_cart,settings,notifications,star(each 18×18 square = glyph, not text). Screenshot in the PR thread.Disjoint from the subagent-card work (#721).
🤖 Generated with Claude Code