Skip to content

feat(angular): support universal web components in v0.9 renderer - #2273

Draft
josemontespg wants to merge 1 commit into
web-core-universal-markdownfrom
angular-universal-components
Draft

feat(angular): support universal web components in v0.9 renderer#2273
josemontespg wants to merge 1 commit into
web-core-universal-markdownfrom
angular-universal-components

Conversation

@josemontespg

@josemontespg josemontespg commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces full support for universal W3C Web Components in the Angular v0.9 renderer alongside native Angular component support:

  • Universal Web Components in ComponentHost: Updated ComponentHostComponent to dynamically resolve and render both universal W3C Web Components (from @a2ui/web_core) and native Angular @Component classes. Passes the active Injector and sets ComponentContext reactively.
  • Angular-to-Web-Component Adapter (toWebComponent): Implemented toWebComponent to wrap Angular components as Custom Elements with full lifecycle management (createComponent, attachView, detachView), dynamic injector lookup, and safe reconnection subscription handling.
  • Catalogs & Configuration (provideA2Ui): Added UniversalBasicCatalog, NativeBasicCatalog, and BasicCatalogBase supporting the A2UI_USE_UNIVERSAL_COMPONENTS injection token, configured conveniently via provideA2Ui(...).
  • Pure Surface Lifecycle: Updated SurfaceComponent to accept both surfaceId and direct surface models, managing surface group registration cleanly inside a constructor effect() and keeping effectiveSurfaceId as a pure computed signal.

Verification

  • yarn --cwd renderers/angular test:unit passed (33 unit tests & 267 explorer specs passing).
  • ./scripts/fix_format.sh and yarn --cwd renderers/angular lint passed cleanly.
  • Rebased and verified across Stack #2276.

Resolves #1270

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for universal Web Components in the Angular v0.9 renderer, migrating default Basic Catalog implementations to universal Web Components, adding a toWebComponent adapter, and updating SurfaceComponent and AngularCatalog to dynamically render custom element tags. The review feedback highlights critical improvements, including moving side effects out of a computed signal in SurfaceComponent into an effect block, fixing a reconnection bug in toWebComponent where the component model update subscription is lost, and passing the Angular Injector to bridged Web Components to ensure robust dependency resolution.

Comment thread renderers/angular/src/v0_9/core/surface.component.ts Outdated
Comment thread renderers/angular/src/v0_9/catalog/to_web_component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment thread renderers/angular/src/v0_9/core/surface.component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 4fb7d3f to 744a652 Compare August 14, 2026 19:25
Comment thread renderers/angular/src/v0_9/core/surface.component.ts Outdated
Comment thread renderers/angular/src/v0_9/catalog/to_web_component.ts
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 744a652 to 7db9b6c Compare August 14, 2026 19:38
Comment thread renderers/angular/CHANGELOG.md
@josemontespg
josemontespg force-pushed the angular-universal-components branch 3 times, most recently from 850c3f0 to bab2ced Compare August 14, 2026 19:53
@josemontespg
josemontespg force-pushed the angular-universal-components branch from bab2ced to b33e52c Compare August 14, 2026 19:55
- Add `UniversalBasicCatalog`, `NativeBasicCatalog`, and `BasicCatalogBase` supporting both universal Web Components from `@a2ui/web_core` and native Angular `@Component` implementations.
- Add `toWebComponent` adapter to convert custom Angular `@Component` implementations into W3C Custom Elements with dynamic DI injector forwarding and reconnection handling.
- Update `ComponentHostComponent` to dynamically mount either universal Web Components or native Angular components based on catalog definitions.
- Update `SurfaceComponent` with pure computed surface ID derivation and reactive surface registration via constructor `effect()`.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is an internal implementation detail this line can be removed because it's not part of the public API change

- Add `toWebComponent` adapter to convert custom Angular `@Component` implementations into W3C Custom Elements with dynamic DI injector forwarding and reconnection handling.
- Update `ComponentHostComponent` to dynamically mount either universal Web Components or native Angular components based on catalog definitions.
- Update `SurfaceComponent` with pure computed surface ID derivation and reactive surface registration via constructor `effect()`.
- Add standalone helper `provideA2Ui` configuration function and `A2UI_USE_UNIVERSAL_COMPONENTS` injection token for Angular applications. [#2273](https://github.com/a2ui-project/a2ui/pull/2273)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the provideA2UI function already existed in this PR we're just moving it from one file to another so this is actually not an API change. the important part to mention here is that we are exposing a new configuration option to let app hosts choose if they want to enable the useUniversalComponents option

@josemontespg
josemontespg force-pushed the angular-universal-components branch from b33e52c to 280d7a2 Compare August 14, 2026 23:24
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 280d7a2 to e581bb5 Compare August 14, 2026 23:28
@josemontespg
josemontespg force-pushed the angular-universal-components branch from e581bb5 to 0dfcb2d Compare August 14, 2026 23:36
@josemontespg
josemontespg force-pushed the angular-universal-components branch 2 times, most recently from 15e49be to b922d66 Compare August 17, 2026 17:17
@josemontespg
josemontespg force-pushed the angular-universal-components branch from b922d66 to 0622541 Compare August 17, 2026 19:33
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 0622541 to 6c95cc4 Compare August 17, 2026 20:31
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 6c95cc4 to 4590094 Compare August 17, 2026 20:57
@josemontespg
josemontespg force-pushed the angular-universal-components branch 2 times, most recently from 107a6ce to 6ed751e Compare August 17, 2026 21:27
@josemontespg
josemontespg force-pushed the angular-universal-components branch from 6ed751e to f86ad09 Compare August 18, 2026 18:52
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.

Support "portable A2UI web Components" which can be installed in a Catalog for *any* framework adapter

1 participant