feat(angular): native signals for v0.9 renderer#925
Draft
gspencergoog wants to merge 16 commits intogoogle:mainfrom
Draft
feat(angular): native signals for v0.9 renderer#925gspencergoog wants to merge 16 commits intogoogle:mainfrom
gspencergoog wants to merge 16 commits intogoogle:mainfrom
Conversation
…date - Updated `A2uiRendererService` and `RendererConfiguration` to use `A2uiClientAction` instead of `SurfaceGroupAction`. - Modified `ComponentHostComponent` to accept and pass `componentId` to rendered components. - Updated all v0.9 catalog components to include a required `componentId` input. - Passing `sourceComponentId` in `SurfaceModel.dispatchAction` calls (e.g., in `ButtonComponent`). - Updated all test specs and dummy components to support the new `componentId` input. This fix aligns the Angular renderer with the client data model synchronization changes introduced in @a2ui/web_core.
…y API This major refactor migrates the Angular v0.9 renderer to use native Angular Signals instead of translating from Preact signals. Key changes: - Core: Introduced ReactiveProvider in web_core and AngularReactiveProvider in @a2ui/angular to allow the core logic to use the renderer's native reactive primitives. - Components: Refactored all v0.9 catalog components to use signal-based property getters (this.props()['key']?()) instead of the .value() API. - Inputs: Migrated all component inputs (props, surfaceId, componentId, dataContextPath) to use the Angular input() and input.required() Signal API. - Protocol: Adopted the updated A2UI v0.9 Action protocol from main, moving from functionCall to named event name and context. - Integration: Reconciled all merge conflicts with the main branch following the adoption of Signal inputs in both branches. - Tests: Updated the comprehensive test suite and integration tests to support the new signal-based property and action structures.
Resolved conflicts in basic catalog components by keeping componentId as a required input. Updated button.component.spec.ts to use more general action dispatch assertion. Includes upstream documentation for A2UI over MCP.
…nding Resolved a regression in the v0.9 demo where two-way data binding for text fields and other interactive components was failing. The root cause was that signal wrapper properties created by the reactive providers were non-configurable by default, preventing the ComponentBinder from augmenting them with DataModel setters. Changes: - Set `configurable: true` for all wrapped signal properties in both Angular and Preact reactive providers. - Added explicit `.set(v)` method to Preact's signal wrapper for API consistency across renderers. - Updated `GenericSignal` interface in `web_core` to include `.set()`. - Verified fix in `a2a_explorer` Login Form example.
Previously, failures in defining the "name" property (used primarily for debugging) were silently ignored. Added a console.warn to capture unexpected redefinition errors.
- Introduce ReactiveProvider and GenericSignal abstractions to permit multiple reactive engines. - Add isSignal type guard and toGenericSignal coercion method to ReactiveProvider. - Implement AngularReactiveProvider to bridge native Angular signals. - Update DataContext to use standardized signal resolution for both path-bindings and literals. - Fix web_core test failures by providing proper reactive providers to mock surfaces. - Support direct signal updates via prop.set(v) in ComponentBinder and Angular components.
- Support `set()` method in `AngularReactiveProvider` to allow direct signal mutations. - Update `ComponentBinder` to use standardized `GenericSignal` interface from `@a2ui/web_core`. - Refactor test specs to utilize `PreactReactiveProvider` from `web_core/v0_9/testing`. - Ensure `DataModel` notifications trigger Angular reactivity by properly updating wrapped signal values. - Verified fix with the Login Form demo example; text input now correctly propagates to the data model and action context.
…Signal<T> This aligns BoundProperty with GenericSignal and improves consistency. Updated test mocks (createBoundProperty) to use a getter for .value. Added missing BoundProperty imports in spec files.
Replaced z.object({}).passthrough() with explicit property definitions
for better type safety and validation in the demo catalog.
Updated the assertion to verify that sourceComponentId ('test-btn')
is correctly passed to mockSurface.dispatchAction.
…ec files - Extract `createBoundProperty`, `StubComponent`, and mock factories to `src/v0_9/testing.ts`. - Refactor `button`, `simple-components`, `complex-components`, `column`, `row`, `text`, and `text-field` spec files to use the new helpers. - Fix specific test assertions and service mocking in `button.component.spec.ts`. - Verify all 192 tests pass in the Angular renderer.
- Add `name` property to `BoundProperty` type in `types.ts`. - Refactor `ComponentBinder` to use `defineSafe` for `name` property. - Update `wrapAngularSignal` and `createBoundProperty` mock to use `unknown` instead of `any` for safety. - Update `createBoundProperty` mock to include `name` property. - Deduplicate and simplify `setter` logic in `wrapAngularSignal`. - Verified with 192/192 passing tests.
…dd defensive value getter - Add `name` property to `BoundProperty` type in `types.ts`. - Refactor `ComponentBinder` to use `defineSafe` for `name`, `raw`, `set`, and `value` properties. - Add defensive `value` getter in `ComponentBinder.bind` to ensure reactive property access. - Update `createBoundProperty` mock factory in `testing.ts` to include `name` property. - Update type casts to use `unknown` instead of `any` for better type safety. - Verified with 192/192 passing tests.
- Remove `update` method from `createBoundProperty` mock factory in `testing.ts`. - Align mock object with the `BoundProperty` type definition. - Verified with 192/192 passing tests.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Refactor the A2UI v0.9 Angular renderer to use native Angular Signals directly, eliminating the overhead and complexity of translating from Preact signals. This change also decouples
web_corefrom Preact-specific logic by introducing aReactiveProviderinterface.Changes
ReactiveProviderandGenericSignalabstractions to support multiple reactive engines.PreactReactiveProvideras the default implementation for the web core.SurfaceModelandMessageProcessorto inject the reactive provider during initialization.AngularReactiveProviderusing native Angularsignal(),computed(), andeffect().BoundPropertyAPI: components now access values viaprop()instead ofprop.value()and update viaprop.set(v)instead ofprop.onUpdate(v).toAngularSignalutility as it is superseded by the direct provider integration.ComponentBinderservice to support signal-based property binding.AgentStubServiceto align with the unifiedBoundPropertystructure.Impact & Risks
BoundPropertyAPI is now consistent across different reactive providers, simplifying cross-framework logic inweb_core.BoundProperty.valueor.onUpdatewill need to be updated to the new function-call and.set()syntax.Testing
renderers/angularpass successfully.integration_tests_09pass successfully.a2a_explorerapplication.