feat(a2ui): add icon catalog#2618
Conversation
🦋 Changeset detectedLatest commit: 62fd9c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdds an Icon catalog component (implementation, CSS, and exports), registers it in the A2UI playground, and refactors the playground catalog to generate component prop metadata from JSON schema manifests. A Changeset documents a patch release. ChangesIcon Component & Catalog Metadata
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/genui/a2ui-playground/src/catalog/a2ui.ts (1)
70-73: ⚡ Quick winConsider defensive handling for empty manifests.
Lines 71-72 assume the manifest has at least one key (
const key = Object.keys(manifest)[0]). If an empty manifest is passed,keywill beundefined, and line 73 will attempt to accessmanifest[undefined], returningundefinedand potentially causing issues downstream.🛡️ Proposed defensive check
function schemaToProps(manifest: Record<string, unknown>): ComponentProp[] { const key = Object.keys(manifest)[0]; - if (!key) return []; + if (!key) { + console.warn('schemaToProps: manifest is empty', manifest); + return []; + } const schema = manifest[key] as PropSchema;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/genui/a2ui-playground/src/catalog/a2ui.ts` around lines 70 - 73, In schemaToProps, guard against an empty manifest before using Object.keys(manifest)[0]: check if Object.keys(manifest).length === 0 (or if !key after computing it) and return an empty array immediately to avoid accessing manifest[undefined]; ensure the rest of the function continues to treat schema as PropSchema only when key is defined so downstream code doesn't receive undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/genui/a2ui/src/catalog/Icon/index.tsx`:
- Around line 17-26: IconProps declares name as string | { path: string } but
Icon currently casts name to string then calls toMaterialName, risking runtime
errors; update the Icon implementation (function Icon) to branch on the runtime
type of props.name: if it's a string call toMaterialName(name), if it's an
object extract name.path and pass that to toMaterialName (or handle missing path
defensively), and ensure any downstream code that expects iconName uses the
normalized string; keep references to IconProps, Icon, and toMaterialName when
locating the change.
---
Nitpick comments:
In `@packages/genui/a2ui-playground/src/catalog/a2ui.ts`:
- Around line 70-73: In schemaToProps, guard against an empty manifest before
using Object.keys(manifest)[0]: check if Object.keys(manifest).length === 0 (or
if !key after computing it) and return an empty array immediately to avoid
accessing manifest[undefined]; ensure the rest of the function continues to
treat schema as PropSchema only when key is defined so downstream code doesn't
receive undefined.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 29505f98-9eed-4d61-b005-7ed407155119
📒 Files selected for processing (11)
.changeset/a2ui-icon-component.mdpackages/genui/a2ui-playground/lynx-src/a2ui/App.tsxpackages/genui/a2ui-playground/lynx-src/a2ui/index.csspackages/genui/a2ui-playground/src/catalog/a2ui.tspackages/genui/a2ui-playground/src/styles.csspackages/genui/a2ui/package.jsonpackages/genui/a2ui/src/catalog/Icon/index.tsxpackages/genui/a2ui/src/catalog/index.tspackages/genui/a2ui/src/index.tspackages/genui/a2ui/styles/catalog/Icon.csspackages/genui/a2ui/styles/theme.css
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will improve performance by 17.62%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | transform 1000 view elements |
47 ms | 40 ms | +17.62% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing p/a2ui-icon (62fd9c8) with main (705a3a3)2
Footnotes
-
26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(482d842) during the generation of this report, so 705a3a3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
React Example#8127 Bundle Size — 236.51KiB (0%).62fd9c8(current) vs 705a3a3 main#8102(baseline) Bundle metrics
|
| Current #8127 |
Baseline #8102 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
197 |
197 |
|
80 |
80 |
|
44.87% |
44.87% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #8127 |
Baseline #8102 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
90.75KiB |
90.75KiB |
Bundle analysis report Branch p/a2ui-icon Project dashboard
Generated by RelativeCI Documentation Report issue
Web Explorer#9701 Bundle Size — 901.38KiB (0%).62fd9c8(current) vs 705a3a3 main#9676(baseline) Bundle metrics
Bundle size by type
|
| Current #9701 |
Baseline #9676 |
|
|---|---|---|
497.1KiB |
497.1KiB |
|
402.06KiB |
402.06KiB |
|
2.22KiB |
2.22KiB |
Bundle analysis report Branch p/a2ui-icon Project dashboard
Generated by RelativeCI Documentation Report issue
React Example with Element Template#393 Bundle Size — 197.79KiB (0%).62fd9c8(current) vs 705a3a3 main#369(baseline) Bundle metrics
Bundle size by type
|
| Current #393 |
Baseline #369 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
52.03KiB |
52.03KiB |
Bundle analysis report Branch p/a2ui-icon Project dashboard
Generated by RelativeCI Documentation Report issue
React External#1241 Bundle Size — 693.04KiB (0%).62fd9c8(current) vs 705a3a3 main#1216(baseline) Bundle metrics
|
| Current #1241 |
Baseline #1216 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
17 |
17 |
|
5 |
5 |
|
8.59% |
8.59% |
|
0 |
0 |
|
0 |
0 |
Bundle analysis report Branch p/a2ui-icon Project dashboard
Generated by RelativeCI Documentation Report issue
React MTF Example#1259 Bundle Size — 207.46KiB (0%).62fd9c8(current) vs 705a3a3 main#1234(baseline) Bundle metrics
|
| Current #1259 |
Baseline #1234 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
192 |
192 |
|
77 |
77 |
|
44.38% |
44.38% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #1259 |
Baseline #1234 |
|
|---|---|---|
111.23KiB |
111.23KiB |
|
96.23KiB |
96.23KiB |
Bundle analysis report Branch p/a2ui-icon Project dashboard
Generated by RelativeCI Documentation Report issue
Summary by CodeRabbit
Checklist