feat(react): support universal web components in v0.9 renderer - #2283
feat(react): support universal web components in v0.9 renderer#2283josemontespg wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for universal W3C Custom Element components alongside native React components, adding the toWebComponent adapter, A2UIProvider context, and a multi-catalog architecture (BasicCatalog, NativeBasicCatalog, UniversalBasicCatalog). The review feedback highlights several critical improvements: adding SSR guards and handling tag name collisions in toWebComponent, optimizing WebComponentNode to prevent ref callback thrashing, and ensuring that overridden components in both NativeBasicCatalog and UniversalBasicCatalog have their names aligned with their override keys to prevent silent rendering failures.
9d58099 to
d3bb540
Compare
5b38793 to
1b4f5df
Compare
1b4f5df to
1298cd8
Compare
1298cd8 to
f2cf7a9
Compare
f2cf7a9 to
fc5931a
Compare
fc5931a to
686cdb4
Compare
686cdb4 to
eae46de
Compare
There was a problem hiding this comment.
Move this to the previous PR that is adding the keyboard shortcuts
eae46de to
da74f18
Compare
5dde6f5 to
5a40ced
Compare
5a40ced to
dfa3c12
Compare
dfa3c12 to
db4a5a4
Compare
db4a5a4 to
dbffd3d
Compare
dbffd3d to
89d5ccb
Compare
Summary
Enables the A2UI React Renderer (
@a2ui/react) to optionally render canonical W3C Custom Element Web Components from@a2ui/web_corealongside existing native React components, maintaining 100% backwards compatibility by defaulting to native React components (useUniversalComponents: false).Key Changes
Multi-Catalog Architecture (
@a2ui/react/v0_9):NativeBasicCatalog: Populated with native React component implementations.UniversalBasicCatalog: Populated with universal W3C Custom Elements from@a2ui/web_core.BasicCatalog: Dynamic catalog selecting between native and universal based on theuseUniversalComponentsoption.basicCataloginstance preserves native React rendering as the default behavior.React to Web Component Bridge (
toWebComponent):Rootlifecycle safely with microtask-deferred unmounting to prevent teardown during DOM re-parenting.ComponentContextandbuildChildto allow custom React components to host and be hosted within universal container elements.Global React Configuration (
A2UIProvider&useA2UI):<A2UIProvider useUniversalComponents={boolean}>context provider anduseA2UI()hook for global renderer configuration.Surface Host Component Dual-Mode Rendering (
A2uiSurface.tsx):ResolvedChilddynamically resolves bothReactComponentImplementation(JSX render function) andWebComponentImplementation(W3C Custom Element tag withcontextbinding).React Explorer Query Parameter Support (
a2ui_explorer):?useUniversalComponent=trueor?useUniversalComponents=truequery parameter to test both modes interactively.Pre-launch Checklist