[BUG]: web_core basic catalog v1 entries load Lit, so they fail without a DOM (React Native)
- [x] I have searched the existing issues to make sure this bug has not already been reported.
Describe the Bug
@a2ui/web_core/catalogs/basic/v1 and @a2ui/web_core/v1_0 re-export the Lit custom elements of the basic catalog. When a bundler resolves with the browser condition but there is no DOM, Lit's browser build defines class extends HTMLElement as soon as it loads, so the import fails with ReferenceError: HTMLElement is not defined.
React Native (Metro) is the case we hit. We wrote a native React Native renderer on top of web_core (the same NodeResolver tree @a2ui/react uses, with 15 native views for the basic catalog). It needs the component APIs, BASIC_FUNCTIONS and the function APIs, and none of the custom elements. Today the only way to get them is to import src/catalogs/basic/v1/components/basic_components.js and src/catalogs/basic/v1/functions/basic_functions.js directly. Those paths are not in exports, so Metro falls back to them with a warning, and other bundlers refuse them.
This is related to #428 (React Native renderer). A server that only validates payloads against the basic catalog hits the same problem if it resolves with the browser condition.
Steps to Reproduce
On main (3ed9601), after yarn build in typescript/core/web_core:
cd typescript/core/web_core/dist/src
node --conditions=browser --input-type=module -e "await import('./catalogs/basic/v1/index.js')"
node --conditions=browser --input-type=module -e "await import('./v1_0/index.js')"
Both fail:
ReferenceError: HTMLElement is not defined
Expected Behavior
There is an exported entry that gives the v1 basic catalog's component APIs, functions and theme schema without Lit, so a renderer with no DOM can import it.
Environment Details
- OS: macOS; iOS and Android through React Native
- Browser/Platform: React Native with Hermes, Metro bundler; reproduced with Node.js 24
--conditions=browser - SDK/Package Name & Version:
@a2ui/web_core0.15.0 andmain - Protocol Version: v1.0
- Agent Framework & LLM Model: not relevant (client side)
Additional Context
In 0.15.0, the regex check also needed FinalizationRegistry (through redos-detector), and Hermes doesn't have it. #3854 removes that dependency on main, so that part is already fixed and only the Lit import is left.
I have a small PR ready that adds a ./catalogs/basic/v1/api entry with no Lit in it, plus a test that loads it with the browser condition and no DOM.
Hi @jpelaez-23blocks, thank you for raising the issue. We have reproduced the issue and we appreciate you raising pr #4239 to fix the issue. The PR will be reviewed. Thank you for your patience and understanding.