Skip to content

chore: fix a2ui catalog styles#2542

Merged
PupilTong merged 1 commit intolynx-family:mainfrom
PupilTong:codex/a2ui-catalog-styles
Apr 29, 2026
Merged

chore: fix a2ui catalog styles#2542
PupilTong merged 1 commit intolynx-family:mainfrom
PupilTong:codex/a2ui-catalog-styles

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Apr 29, 2026

Summary

  • Move built-in a2ui catalog CSS assets out of src/catalog into styles/catalog.
  • Update catalog component side-effect imports so emitted dist/catalog/*/index.jsx resolves ../../../styles/catalog/*.css instead of broken ./style.css paths.
  • Add styles/** to the a2ui Turbo inputs and document the catalog CSS placement rule.

Root Cause

TypeScript preserves the catalog component CSS side-effect imports when emitting JSX. With CSS files living under src/catalog/<Component>/style.css, the emitted dist/catalog/<Component>/index.jsx still imported ./style.css, but no matching CSS file exists beside the emitted JSX.

Validation

  • pnpm install --frozen-lockfile
  • pnpm -C packages/genui/a2ui-catalog-extractor build
  • pnpm exec tsc --build packages/genui/a2ui/tsconfig.json --pretty false
  • pnpm -C packages/genui/a2ui build
  • pnpm dprint fmt .github/a2ui-catalog.instructions.md packages/genui/a2ui/turbo.json packages/genui/a2ui/src/catalog/*/index.tsx packages/genui/a2ui/styles/catalog/*.css
  • pnpm biome check .github/a2ui-catalog.instructions.md packages/genui/a2ui/turbo.json packages/genui/a2ui/src/catalog/*/index.tsx packages/genui/a2ui/styles/catalog/*.css
  • git diff --check

Summary by CodeRabbit

  • Refactor
    • Consolidated stylesheet management for catalog components by centralizing CSS imports.
    • Updated build configuration to properly detect stylesheet changes during the build process.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

⚠️ No Changeset found

Latest commit: 80d8e84

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

The pull request consolidates built-in catalog component CSS assets from component-local directories into a centralized packages/genui/a2ui/styles/catalog/ directory. TSX components now import from this centralized location using relative paths, and catalog CSS files update their Luna styles dependencies to use local imports rather than the parent luna-styles index. Build configuration and documentation are updated accordingly.

Changes

Cohort / File(s) Summary
Catalog Component Imports
packages/genui/a2ui/src/catalog/Button/index.tsx, Card/index.tsx, CheckBox/index.tsx, Column/index.tsx, Divider/index.tsx, Image/index.tsx, List/index.tsx, RadioGroup/index.tsx, Row/index.tsx, Text/index.tsx
All components updated to import CSS from ../../../styles/catalog/{ComponentName}.css instead of local ./style.css files.
Catalog Stylesheet Dependencies
packages/genui/a2ui/styles/catalog/Button.css, Card.css, CheckBox.css, Column.css, Divider.css, RadioGroup.css, Row.css, Text.css
All catalog CSS files updated to import local ./luna.css instead of ../luna-styles/index.css.
Configuration & Documentation
.github/a2ui-catalog.instructions.md, packages/genui/a2ui/turbo.json
Added documentation rule for catalog CSS asset location and updated Turbo build task to include styles/** in dependency inputs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Sherry-hue
  • colinaaa

Poem

🐰 Hop along, dear CSS!
From scattered nests to one address,
The catalog grows clean and neat,
Styles unified, imports complete! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: fix a2ui catalog styles' clearly and specifically summarizes the main change—consolidating catalog CSS assets and fixing import paths—without vagueness or unrelated content.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@PupilTong PupilTong changed the title [codex] fix a2ui catalog styles chore: fix a2ui catalog styles Apr 29, 2026
@PupilTong PupilTong self-assigned this Apr 29, 2026
@PupilTong PupilTong marked this pull request as ready for review April 29, 2026 04:38
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/genui/a2ui/src/catalog/Column/index.tsx (1)

29-35: ⚠️ Potential issue | 🟠 Major

Fix { componentId, path } binding handling for children (currently ignored).

ColumnProps.children supports string[] | { componentId: string; path: string }, but the implementation only renders Array.isArray(children) and otherwise uses [], producing an empty column.

Update to resolve the { componentId, path } form using useDataBinding (as implemented in the List component) to look up bound props against surface with dataContextPath support, then render the resolved child IDs/components.

Also applies to the Row component, which has the identical issue.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/genui/a2ui/src/catalog/Column/index.tsx` around lines 29 - 35,
Column currently ignores children when it's the binding form { componentId, path
} because it only handles Array.isArray(children) and falls back to [], so
update the Column component to detect the object-binding form for
ColumnProps.children and resolve it via useDataBinding (same approach as List):
call useDataBinding(surface, dataContextPath, children) or similar to fetch the
bound array of child IDs/components, map those into explicitChildren for
rendering (preserving existing justify/align handling), and ensure the same fix
is applied to the Row component which has identical logic; reference the
variables children, surface, dataContextPath, explicitChildren and the hook
useDataBinding when making the change.
packages/genui/a2ui/src/catalog/RadioGroup/index.tsx (1)

34-41: ⚠️ Potential issue | 🟠 Major

Resolve { path } bindings for items and value props.

RadioGroupComponentProps explicitly allows items: string[] | { path: string } and value: string | { path: string }, but the component currently discards bindings: it converts items to [] when it's a { path } object and casts value to string without resolving.

Destructure surface and dataContextPath from props, then resolve these bindings via surface.store.getSignal() with relative path support (prepend dataContextPath if the path doesn't start with /). Pass resolved values to the component logic and RadioGroupRoot.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/genui/a2ui/src/catalog/RadioGroup/index.tsx` around lines 34 - 41,
Destructure surface and dataContextPath from props, then when items or value are
objects with a { path } property resolve them via
surface.store.getSignal(resolvedPath) before using; resolvedPath should be the
path as-is if it starts with '/' otherwise prepend dataContextPath + '/' (or
dataContextPath if empty) to form a relative path. Replace the current
assignments to value and explicitItems so: if value is a { path } object read
the signal and use its current string, and if items is a { path } object read
the signal and use its current array (fall back to []), keeping usageHint and
setValue behavior the same, and pass these resolved values into the
RadioGroupRoot/render logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/genui/a2ui/src/catalog/RadioGroup/index.tsx`:
- Line 8: The RadioGroup component must resolve items and value when they are
binding objects ({path: string}) by querying Surface.store and supporting
relative paths against dataContextPath: modify the code in
packages/genui/a2ui/src/catalog/RadioGroup/index.tsx so that when props.items is
an object with a path you call Surface.store.get(resolvedPath, dataContextPath)
(resolve relative paths by joining the binding path with dataContextPath) and
ensure the result is coerced to an array (fallback to [] if null/undefined), and
when props.value is a binding object you similarly resolve it via
Surface.store.get(resolvedPath, dataContextPath) and coerce/convert to string
safely; update the logic that currently converts non-array items to [] and the
direct cast of value to string to use these resolved values instead.

---

Outside diff comments:
In `@packages/genui/a2ui/src/catalog/Column/index.tsx`:
- Around line 29-35: Column currently ignores children when it's the binding
form { componentId, path } because it only handles Array.isArray(children) and
falls back to [], so update the Column component to detect the object-binding
form for ColumnProps.children and resolve it via useDataBinding (same approach
as List): call useDataBinding(surface, dataContextPath, children) or similar to
fetch the bound array of child IDs/components, map those into explicitChildren
for rendering (preserving existing justify/align handling), and ensure the same
fix is applied to the Row component which has identical logic; reference the
variables children, surface, dataContextPath, explicitChildren and the hook
useDataBinding when making the change.

In `@packages/genui/a2ui/src/catalog/RadioGroup/index.tsx`:
- Around line 34-41: Destructure surface and dataContextPath from props, then
when items or value are objects with a { path } property resolve them via
surface.store.getSignal(resolvedPath) before using; resolvedPath should be the
path as-is if it starts with '/' otherwise prepend dataContextPath + '/' (or
dataContextPath if empty) to form a relative path. Replace the current
assignments to value and explicitItems so: if value is a { path } object read
the signal and use its current string, and if items is a { path } object read
the signal and use its current array (fall back to []), keeping usageHint and
setValue behavior the same, and pass these resolved values into the
RadioGroupRoot/render logic.
🪄 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: bc74cd63-ae7c-4d75-86f8-8c352b2cc4c1

📥 Commits

Reviewing files that changed from the base of the PR and between e4ace87 and 80d8e84.

📒 Files selected for processing (27)
  • .github/a2ui-catalog.instructions.md
  • packages/genui/a2ui/src/catalog/Button/index.tsx
  • packages/genui/a2ui/src/catalog/Card/index.tsx
  • packages/genui/a2ui/src/catalog/CheckBox/index.tsx
  • packages/genui/a2ui/src/catalog/Column/index.tsx
  • packages/genui/a2ui/src/catalog/Divider/index.tsx
  • packages/genui/a2ui/src/catalog/Image/index.tsx
  • packages/genui/a2ui/src/catalog/List/index.tsx
  • packages/genui/a2ui/src/catalog/RadioGroup/index.tsx
  • packages/genui/a2ui/src/catalog/Row/index.tsx
  • packages/genui/a2ui/src/catalog/Text/index.tsx
  • packages/genui/a2ui/styles/catalog/Button.css
  • packages/genui/a2ui/styles/catalog/Card.css
  • packages/genui/a2ui/styles/catalog/CheckBox.css
  • packages/genui/a2ui/styles/catalog/Column.css
  • packages/genui/a2ui/styles/catalog/Divider.css
  • packages/genui/a2ui/styles/catalog/Image.css
  • packages/genui/a2ui/styles/catalog/List.css
  • packages/genui/a2ui/styles/catalog/RadioGroup.css
  • packages/genui/a2ui/styles/catalog/Row.css
  • packages/genui/a2ui/styles/catalog/Text.css
  • packages/genui/a2ui/styles/catalog/luna-dark.css
  • packages/genui/a2ui/styles/catalog/luna-light.css
  • packages/genui/a2ui/styles/catalog/luna.css
  • packages/genui/a2ui/styles/catalog/lunaris-dark.css
  • packages/genui/a2ui/styles/catalog/lunaris-light.css
  • packages/genui/a2ui/turbo.json

Comment thread packages/genui/a2ui/src/catalog/RadioGroup/index.tsx
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 29, 2026

Merging this PR will not alter performance

✅ 81 untouched benchmarks
⏩ 26 skipped benchmarks1


Comparing PupilTong:codex/a2ui-catalog-styles (80d8e84) with main (e4ace87)

Open in CodSpeed

Footnotes

  1. 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.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 29, 2026

React MTF Example

#839 Bundle Size — 196.54KiB (-0.02%).

80d8e84(current) vs caadd3b main#834(baseline)

Bundle metrics  Change 3 changes
                 Current
#839
     Baseline
#834
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 43.42% 43.4%
No change  Chunks 0 0
No change  Assets 3 3
Change  Modules 173(-0.57%) 174
No change  Duplicate Modules 66 66
Change  Duplicate Code 44.08%(+0.09%) 44.04%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#839
     Baseline
#834
No change  IMG 111.23KiB 111.23KiB
Improvement  Other 85.31KiB (-0.05%) 85.35KiB

Bundle analysis reportBranch PupilTong:codex/a2ui-catalog-sty...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 29, 2026

Web Explorer

#9280 Bundle Size — 900.02KiB (0%).

80d8e84(current) vs caadd3b main#9275(baseline)

Bundle metrics  Change 1 change
                 Current
#9280
     Baseline
#9275
No change  Initial JS 44.46KiB 44.46KiB
No change  Initial CSS 2.22KiB 2.22KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 9 9
No change  Assets 11 11
Change  Modules 229(-0.43%) 230
No change  Duplicate Modules 11 11
No change  Duplicate Code 27.28% 27.28%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#9280
     Baseline
#9275
No change  JS 495.88KiB 495.88KiB
No change  Other 401.92KiB 401.92KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch PupilTong:codex/a2ui-catalog-sty...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 29, 2026

React Example

#7707 Bundle Size — 225.38KiB (-0.02%).

80d8e84(current) vs caadd3b main#7702(baseline)

Bundle metrics  Change 3 changes
                 Current
#7707
     Baseline
#7702
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 35.34% 35.33%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 179(-0.56%) 180
No change  Duplicate Modules 69 69
Change  Duplicate Code 44.57%(+0.07%) 44.54%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#7707
     Baseline
#7702
No change  IMG 145.76KiB 145.76KiB
Improvement  Other 79.63KiB (-0.05%) 79.67KiB

Bundle analysis reportBranch PupilTong:codex/a2ui-catalog-sty...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 29, 2026

React External

#822 Bundle Size — 680.27KiB (-0.02%).

80d8e84(current) vs caadd3b main#818(baseline)

Bundle metrics  Change 1 change
                 Current
#822
     Baseline
#818
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 39.71% 39.7%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#822
     Baseline
#818
Improvement  Other 680.27KiB (-0.02%) 680.41KiB

Bundle analysis reportBranch PupilTong:codex/a2ui-catalog-sty...Project dashboard


Generated by RelativeCIDocumentationReport issue

@PupilTong PupilTong merged commit cf6e21c into lynx-family:main Apr 29, 2026
104 of 112 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants