-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add initial React Renderer v0.9 #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
8dc92bf
Add resources discussion
jacobsimionato c5a8eb3
Improve functions design
jacobsimionato 5df86c2
Add comments about unsubscribing
jacobsimionato 07077b2
Add catalog API proposal doc v1
jacobsimionato 6ae4b24
Update catalog proposal
jacobsimionato 0e75794
Improve catalog API proposal
jacobsimionato 2f52cad
Update renderer guide
jacobsimionato d9f328f
Add improvements to the renderer guide
jacobsimionato a4b2b61
Delete catalog proposal
jacobsimionato f8c147c
remove dumb
jacobsimionato 2a74434
Address feedback
jacobsimionato 46a1504
Improve explanation of scope
jacobsimionato a17edea
Respond to a few more commments
jacobsimionato 7d73d59
Add initial react renderer
jacobsimionato 1daad96
Update react renderer to fix reactivity
jacobsimionato a1fa3ec
improve react renderer
jacobsimionato dc958a6
Improvemeents to react renderer
jacobsimionato 1ceb3f1
More react improvements
jacobsimionato e773e0f
Add deep generic binder etc
jacobsimionato f07b00d
MOve react to react_prototype
jacobsimionato 1eebf0d
clean up react renderer
jacobsimionato b95ab1d
Merge branch 'main' into react-1
jacobsimionato 4168208
Add more samples
jacobsimionato 110f87e
refactor(react): automatically infer component props from Zod schema
jacobsimionato 11399ee
feat(react): implement basic catalog and integrate with gallery app
jacobsimionato 6c113ff
fix(react): robust zod schema matching for generic binder
jacobsimionato 88378d9
refactor(core): move generic binder from react prototype to web core
jacobsimionato 587cdd6
set function invoker properly
jacobsimionato 7a4b788
feat(react): improve generic binder ergonomics for two-way binding
jacobsimionato 99e7095
feat(react): strictly typed setter generation in generic binder
jacobsimionato 502520d
fix(react): remove optional chaining from strictly typed generated se…
jacobsimionato d2d6069
Improements to binder and add copyright headers
jacobsimionato 64ff985
Improve return type of FunctionInvoker
jacobsimionato 2fcf422
Merge branch 'main' into react-1
jacobsimionato 22f81bb
Merge branch 'main' into react-1
jacobsimionato dc7f6a6
Add test for basic_catalog etc
jacobsimionato 2774778
Move react renderer in to place
jacobsimionato 7c6ea9b
Move sample app
jacobsimionato 0105697
Revert web_core changes and fix React demo build
jacobsimionato 6d7bd40
Fix lint errors
jacobsimionato de7c6ee
Fix demo app
jacobsimionato dbcba08
Merge branch 'main' into react-1
jacobsimionato 7725ee9
Fix package locK
jacobsimionato 059c489
Fix text field
jacobsimionato ae4372b
Fix text field
jacobsimionato eb4d3f4
Fix text field
jacobsimionato d213b55
Fix package.json etc
jacobsimionato cca2e02
revert text field changes
jacobsimionato a16520d
Fix CI
jacobsimionato 35e3750
Fix text field
jacobsimionato 4b675e1
Fix CI errors re textfield
jacobsimionato b360c09
Merge branch 'main' into react-1
jacobsimionato c771ea7
revert doc changes
jacobsimionato 7e19997
Remove a2ui_explorer app
jacobsimionato 77ac6b4
Move catalogs to better named locations
jacobsimionato 4038c92
Revert "Remove a2ui_explorer app"
jacobsimionato 628f271
REmove basic catalog support
jacobsimionato 00c6755
remove shell app
jacobsimionato 3bb5229
Readd the samples/client/react/shell app
jacobsimionato e2c0583
fully leverage binder in minimal catalog
jacobsimionato 95bbf40
Fix any lint errors
jacobsimionato 1998632
implement memoization
jacobsimionato 37c6f3b
Fix rendering, undo memoization and add tests
jacobsimionato 3e75b5a
Add memoization
jacobsimionato a926e26
Address feedback
jacobsimionato 72df38a
Fix lint errors
jacobsimionato 7e35c8c
Use gts lint plugin
jacobsimionato b3823fa
Merge branch 'main' into react-1
jacobsimionato 5e917e0
Fix build errors
jacobsimionato be67f11
chore: fix lint warnings
jacobsimionato a457dee
Fix lint warning
jacobsimionato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # A2UI React Gallery App | ||
|
|
||
| This is the reference Gallery Application for the A2UI React renderer. It allows you to explore A2UI samples, inspect the live data model, and step through the message rendering process. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| This application depends on the following local libraries in this repository: | ||
| 1. `@a2ui/web_core` (located in `renderers/web_core`) | ||
| 2. `@a2ui/react` (located in `renderers/react`) | ||
|
|
||
| ## Building Dependencies | ||
|
|
||
| Before running the gallery app, you must build the local renderer library: | ||
|
|
||
| ```bash | ||
| # Navigate to the React renderer library | ||
| cd ../.. | ||
|
|
||
| # Install and build the library | ||
| npm install | ||
| npm run build | ||
| ``` | ||
|
|
||
| *Note: Ensure `@a2ui/web_core` is also built if you have made changes to the core logic.* | ||
|
|
||
| ## Setup and Development | ||
|
|
||
| Once the dependencies are built, you can start the gallery app: | ||
|
|
||
| ```bash | ||
| # Navigate to this directory | ||
| cd renderers/react/a2ui_explorer | ||
|
|
||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Start the development server | ||
| npm run dev | ||
| ``` | ||
|
|
||
| ## Building for Production | ||
|
|
||
| To create a production build of the gallery app: | ||
|
|
||
| ```bash | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## Running Tests | ||
|
|
||
| To run the integration tests: | ||
|
|
||
| ```bash | ||
| npm test | ||
| ``` | ||
|
|
||
| ## Gallery Features | ||
|
|
||
| - **3-Column Layout**: Left (Sample selection), Center (Live preview & Message stepper), Right (Data model & Action logs). | ||
| - **Progressive Stepper**: Use the "Advance" buttons next to each JSON message to see how the UI builds up incrementally. | ||
| - **Action Logs**: View real-time logs of actions triggered by user interactions. | ||
| - **Data Model Inspector**: Observe how the surface's data model changes as you interact with form fields. |
ava-cassiopeia marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /** | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import globals from 'globals'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
| import reactRefreshPlugin from 'eslint-plugin-react-refresh'; | ||
| import prettierConfig from 'eslint-config-prettier'; | ||
| import gts from 'gts'; | ||
|
|
||
| export default tseslint.config( | ||
| // Google TypeScript style guide plugin. | ||
| ...gts.map(config => ({ | ||
| ...config, | ||
| // Override the project for a2ui_explorer since it has its own tsconfig | ||
| ...(config.languageOptions?.parserOptions?.project ? { | ||
| languageOptions: { | ||
| ...config.languageOptions, | ||
| parserOptions: { | ||
| ...config.languageOptions.parserOptions, | ||
| project: ['./tsconfig.app.json', './tsconfig.node.json'] | ||
| } | ||
| } | ||
| } : {}) | ||
| })), | ||
|
|
||
| { | ||
| files: ['**/*.{ts,tsx}'], | ||
| plugins: { | ||
| 'react-hooks': reactHooksPlugin, | ||
| 'react-refresh': reactRefreshPlugin, | ||
| }, | ||
| languageOptions: { | ||
| ecmaVersion: 2020, | ||
| globals: { | ||
| ...globals.browser, | ||
| }, | ||
| parserOptions: { | ||
| ecmaFeatures: { | ||
| jsx: true, | ||
| }, | ||
| }, | ||
| }, | ||
| rules: { | ||
| // React Hooks rules (errors) | ||
| ...reactHooksPlugin.configs.recommended.rules, | ||
|
|
||
| // React Refresh rules | ||
| 'react-refresh/only-export-components': [ | ||
| 'warn', | ||
| { allowConstantExport: true }, | ||
| ], | ||
|
|
||
| // TypeScript rules | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'error', | ||
| { | ||
| argsIgnorePattern: '^_', | ||
| varsIgnorePattern: '^_', | ||
| }, | ||
| ], | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| '@typescript-eslint/consistent-type-imports': [ | ||
| 'warn', | ||
| { | ||
| prefer: 'type-imports', | ||
| fixStyle: 'inline-type-imports', | ||
| }, | ||
| ], | ||
|
|
||
| // General rules | ||
| 'no-console': ['warn', { allow: ['warn', 'error'] }], | ||
| 'prefer-arrow-callback': 'off', | ||
| }, | ||
| }, | ||
|
|
||
| // Test files - relaxed rules | ||
| { | ||
| files: ['tests/**/*.{ts,tsx}', '**/*.test.{ts,tsx}', 'src/setupTests.ts'], | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'off', | ||
| 'no-console': 'off', | ||
| }, | ||
| }, | ||
|
|
||
| // Prettier config | ||
| prettierConfig, | ||
|
|
||
| { | ||
| ignores: ['dist/**', 'node_modules/**', '**/*.d.ts'], | ||
| } | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!-- | ||
| Copyright 2026 Google LLC | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
|
|
||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" /> | ||
| <title>react</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /** | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #root { | ||
| max-width: 1280px; | ||
| margin: 0 auto; | ||
| padding: 2rem; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .logo { | ||
| height: 6em; | ||
| padding: 1.5em; | ||
| will-change: filter; | ||
| transition: filter 300ms; | ||
| } | ||
| .logo:hover { | ||
| filter: drop-shadow(0 0 2em #646cffaa); | ||
| } | ||
| .logo.react:hover { | ||
| filter: drop-shadow(0 0 2em #61dafbaa); | ||
| } | ||
|
|
||
| @keyframes logo-spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: no-preference) { | ||
| .logo.react { | ||
| animation: logo-spin infinite 20s linear; | ||
| } | ||
| } | ||
|
|
||
| .card { | ||
| padding: 2em; | ||
| } | ||
|
|
||
| .read-the-docs { | ||
| color: #888; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.