feat(openui): implement web preview and components page#2611
Conversation
- Add rawText/rawTextUrl support in render.tsx to pass OpenUI DSL content to the Lynx view via globalProps - Update OpenUI Lynx app to read rawText from globalProps with fallback to mock data, and respect speed multiplier - Fix OpenUIDemosPage to use same-origin baseUrl for iframe rendering - Refactor component metadata into src/catalog/ directory - Enhance OpenUIComponentsPage with full component browsing UI
🦋 Changeset detectedLatest commit: 7c7c21a 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 |
📝 WalkthroughWalkthroughThis PR introduces OpenUI component catalog metadata and a functional components browser for the playground. It extends the playground's initialization data flow to accept raw text and speed parameters, implements chunked streaming rendering in the OpenUI App, builds a components browser page with detail and grid views, and streamlines URL handling in the demos page. ChangesOpenUI Components Catalog and Browser
OpenUI Demos URL Handling Simplification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/genui/a2ui-playground/src/catalog/openui.ts (1)
12-25: ⚡ Quick winConstrain
categoryto known IDs for type safety.
category: stringallows invalid values that won’t be caught at compile time and can break grouping/navigation silently.Suggested diff
export interface OpenUIComponentDoc { name: string; - category: string; + category: OpenUICategory; description: string; props: OpenUIComponentProp[]; usage: string; } +export type OpenUICategory = + | 'layout' + | 'content' + | 'buttons' + | 'data-display'; + export const OPENUI_CATEGORIES = [ { id: 'layout', label: 'Layout' }, { id: 'content', label: 'Content' }, { id: 'buttons', label: 'Buttons' }, { id: 'data-display', label: 'Data Display' }, -] as const; +] as const satisfies ReadonlyArray<{ id: OpenUICategory; label: string }>;🤖 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/openui.ts` around lines 12 - 25, The category field on OpenUIComponentDoc is currently an untyped string and should be constrained to the known category IDs to ensure compile-time safety; update the types so category is the union of OPENUI_CATEGORIES ids (e.g. derive a type like OpenUICategoryId = typeof OPENUI_CATEGORIES[number]['id'] and change OpenUIComponentDoc.category to OpenUICategoryId), and export that type if needed so all usages (component definitions, grouping/navigation code) must use one of the defined ids rather than any string.
🤖 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 @.changeset/many-pots-care.md:
- Around line 1-3: The changeset file is empty; populate
.changeset/many-pots-care.md with a valid changeset: add a YAML section listing
affected package names and semver levels (e.g. "@lynx/playground": minor)
between the --- delimiters and then a short description of the change under the
YAML block describing what was added/changed (one or two sentences) so releases
and versioning can be generated; ensure package names and bump levels match the
PR changes (patch/minor/major) and include a concise human-readable description.
---
Nitpick comments:
In `@packages/genui/a2ui-playground/src/catalog/openui.ts`:
- Around line 12-25: The category field on OpenUIComponentDoc is currently an
untyped string and should be constrained to the known category IDs to ensure
compile-time safety; update the types so category is the union of
OPENUI_CATEGORIES ids (e.g. derive a type like OpenUICategoryId = typeof
OPENUI_CATEGORIES[number]['id'] and change OpenUIComponentDoc.category to
OpenUICategoryId), and export that type if needed so all usages (component
definitions, grouping/navigation code) must use one of the defined ids rather
than any string.
🪄 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: a8f2672a-8d1f-4a77-bd70-f2d457b094a3
📒 Files selected for processing (8)
.changeset/many-pots-care.mdpackages/genui/a2ui-playground/lynx-src/openui/App.tsxpackages/genui/a2ui-playground/src/catalog/a2ui.tspackages/genui/a2ui-playground/src/catalog/openui.tspackages/genui/a2ui-playground/src/pages/ComponentsPage.tsxpackages/genui/a2ui-playground/src/pages/OpenUIComponentsPage.tsxpackages/genui/a2ui-playground/src/pages/OpenUIDemosPage.tsxpackages/genui/a2ui-playground/src/render.tsx
Merging this PR will not alter performance
Comparing Footnotes
|
React MTF Example#1217 Bundle Size — 206.65KiB (-0.39%).7c7c21a(current) vs 1e1257e main#1206(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch feat/openui-web-preview-and-comp... Project dashboard Generated by RelativeCI Documentation Report issue |
React External#1199 Bundle Size — 690.27KiB (-0.4%).7c7c21a(current) vs 1e1257e main#1188(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch feat/openui-web-preview-and-comp... Project dashboard Generated by RelativeCI Documentation Report issue |
React Example#8085 Bundle Size — 235.77KiB (-0.31%).7c7c21a(current) vs 1e1257e main#8075(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch feat/openui-web-preview-and-comp... Project dashboard Generated by RelativeCI Documentation Report issue |
Web Explorer#9659 Bundle Size — 901.27KiB (0%).7c7c21a(current) vs 1e1257e main#9648(baseline) Bundle metrics
|
| Current #9659 |
Baseline #9648 |
|
|---|---|---|
45.06KiB |
45.06KiB |
|
2.22KiB |
2.22KiB |
|
0% |
0% |
|
9 |
9 |
|
11 |
11 |
|
229 |
229 |
|
11 |
11 |
|
27.24% |
27.24% |
|
10 |
10 |
|
0 |
0 |
Bundle size by type no changes
| Current #9659 |
Baseline #9648 |
|
|---|---|---|
497KiB |
497KiB |
|
402.06KiB |
402.06KiB |
|
2.22KiB |
2.22KiB |
Bundle analysis report Branch feat/openui-web-preview-and-comp... Project dashboard
Generated by RelativeCI Documentation Report issue
React Example with Element Template#351 Bundle Size — 197.79KiB (0%).7c7c21a(current) vs 1e1257e main#341(baseline) Bundle metrics
Bundle size by type
|
| Current #351 |
Baseline #341 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
52.03KiB |
52.03KiB |
Bundle analysis report Branch feat/openui-web-preview-and-comp... Project dashboard
Generated by RelativeCI Documentation Report issue
Summary by CodeRabbit
Checklist