Skip to content

feat(web_core): add a Lit-free basic catalog v1 api entry - #4239

Open
jpelaez-23blocks wants to merge 1 commit into
a2ui-project:mainfrom
jpelaez-23blocks:web-core-basic-catalog-api-entry
Open

jpelaez-23blocks wants to merge 1 commit into
a2ui-project:mainfrom
jpelaez-23blocks:web-core-basic-catalog-api-entry

Conversation

@jpelaez-23blocks

Copy link
Copy Markdown

Fixes #4238.

@a2ui/web_core/catalogs/basic/v1 (and @a2ui/web_core/v1_0, which re-exports it) loads the basic catalog's Lit custom elements. With the browser condition and no DOM, which is what React Native's Metro does, Lit's browser build fails on load with ReferenceError: HTMLElement is not defined.

This adds a ./catalogs/basic/v1/api entry that exports only what a renderer with no DOM needs: the component APIs (ButtonApi … VideoApi, BASIC_COMPONENTS, WeightSchema, BASIC_CATALOG_DOCUMENT_OPTIONS), the functions and function APIs, and the theme schema. It re-exports existing modules and moves nothing, so the current entries behave the same.

Tests

  • api.test.ts imports the new entry in a child Node process with --conditions=browser and no DOM, and checks that it loads and exports the 18 component APIs and the functions. Pointing the same check at ./index.js fails with the HTMLElement error, so the test catches a Lit import that comes back later.
  • yarn build in typescript/core/web_core, then node --test "dist/**/*.test.js": 1629 pass, 0 fail.
  • Prettier reports the changed files as unchanged.

We found this while building a React Native renderer for A2UI pages (see #428). It uses web_core's NodeResolver tree with native views and has to import these modules from src/ paths today.

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Nov 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@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 a new entry point @a2ui/web_core/catalogs/basic/v1/api that exports the v1 basic catalog's component APIs, functions, and theme schema without including Lit custom elements. This allows environments running without a DOM, such as React Native, to import these APIs without failing due to the absence of HTMLElement. The changes include updates to package.json to expose the new path, a new api.ts file defining the exports, and a corresponding test suite in api.test.ts to verify DOM-free loading and correct exports. There are no review comments, and I have no feedback to provide.

@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 14, 2026
@jpelaez-23blocks
jpelaez-23blocks force-pushed the web-core-basic-catalog-api-entry branch 2 times, most recently from ced45bd to 02db656 Compare November 14, 2026 16:48
@jpelaez-23blocks

Copy link
Copy Markdown
Author

@googlebot I signed it!

@Varun-S10 Varun-S10 self-assigned this Nov 17, 2026
@Varun-S10 Varun-S10 added status: waiting-for-author-response and removed status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs labels Nov 17, 2026
@Varun-S10

Copy link
Copy Markdown
Collaborator

Hi @jpelaez-23blocks, thank you for raising this pr to fix the issue. Could you please sync with main to fix the CHANGELOG.md conflict, remove the Co-Authored-By line from your commit message, and make sure your GitHub username is added to your signed CLA so the CLA check passes?

Renderers without a DOM (React Native) cannot import
@a2ui/web_core/catalogs/basic/v1, because it re-exports the Lit custom
elements and Lit's browser build extends HTMLElement on load. The new
./catalogs/basic/v1/api entry exports the component APIs, functions and
theme schema only.

Fixes a2ui-project#4238
@jpelaez-23blocks
jpelaez-23blocks force-pushed the web-core-basic-catalog-api-entry branch from 02db656 to 72d1175 Compare November 17, 2026 13:02
@jpelaez-23blocks

Copy link
Copy Markdown
Author

@Varun-S10 thanks. Done: rebased on main with the CHANGELOG conflict resolved, the Co-Authored-By line removed, and the CLA now lists my username (the check passes). Build and the new tests pass on current main.

@Varun-S10

Copy link
Copy Markdown
Collaborator

Hi @jpelaez-23blocks, thank you for updating the pr. We have verified the pr and it does resolve the issue. I will escalate this to the team to review. Thank you for your patience and understanding.
Hi @gspencergoog, could you please take a look?

@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 25, 2026
@polina-c

Copy link
Copy Markdown
Collaborator

From triage bot, analysis:

For humans

TL;DR
Case: this out-of-team PR fixes #4238, and Varun-S10 verified it and asked gspencergoog to look.
Suggestion: assign gspencergoog for triage to decide on it.

Summary:
@a2ui/web_core/catalogs/basic/v1 loads the basic catalog's Lit custom elements, so it fails to load without a DOM, as in React Native. The PR adds a ./catalogs/basic/v1/api entry that re-exports the component APIs, functions and theme schema without Lit, with a test that loads it with no DOM.

Targeted issues:
#4238

Suggestion:

  • It is a small additive change with a test (136 added lines in 4 files), and the existing entries do not change. Varun-S10 verified that it fixes #4238 and asked gspencergoog to take a look on November 18, with no answer yet.
  • gspencergoog wrote 8 of the last 20 commits to the basic catalog in web_core, and 6 of the last 20 to the package.json where the PR adds the entry.
  1. Add labels: status: assigned-for-triage, type: bug, lang: typescript, component: core sdk
  2. Assign: gspencergoog

Reply:

From triage:

Assigning this PR to gspencergoog, who maintains the basic catalog in web_core, to decide on it. Varun-S10 already verified that it fixes #4238.

To adjust the analysis and apply its suggestion, open it in the hosted triage UI, or run in your a2ui checkout:

tools/internal/triage/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4239
For software
<a2ui>
root = TriageAnalysis(
  tldr="""Case: this out-of-team PR fixes [#4238](https://github.com/a2ui-project/a2ui/issues/4238), and `Varun-S10` verified it and asked `gspencergoog` to look.
Suggestion: assign `gspencergoog` for triage to decide on it.""",
  summary="""`@a2ui/web_core/catalogs/basic/v1` loads the basic catalog's Lit custom elements, so it fails to load without a DOM, as in React Native. The PR adds a `./catalogs/basic/v1/api` entry that re-exports the component APIs, functions and theme schema without Lit, with a test that loads it with no DOM.""",
  suggestion="""- It is a small additive change with a test (136 added lines in 4 files), and the existing entries do not change. `Varun-S10` [verified](https://github.com/a2ui-project/a2ui/pull/4239#issuecomment-6969956941) that it fixes [#4238](https://github.com/a2ui-project/a2ui/issues/4238) and asked `gspencergoog` to take a look on November 18, with no answer yet.
- `gspencergoog` wrote [8 of the last 20 commits](https://github.com/a2ui-project/a2ui/commits/main/typescript/core/web_core/src/catalogs/basic) to the basic catalog in `web_core`, and [6 of the last 20](https://github.com/a2ui-project/a2ui/commits/main/typescript/core/web_core/package.json) to the `package.json` where the PR adds the entry.""",
  reply="""Assigning this PR to `gspencergoog`, who maintains the basic catalog in `web_core`, to decide on it. `Varun-S10` already verified that it fixes [#4238](https://github.com/a2ui-project/a2ui/issues/4238).""",
  added_labels=["status: assigned-for-triage", "type: bug", "lang: typescript", "component: core sdk"],
  new_assignees=["gspencergoog"],
  targeted_issues=[4238]
)
</a2ui>

This analysis is auto-created to help humans to triage this item. Please, do not treat it as a team decision.

@github-actions github-actions Bot removed the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 26, 2026
@polina-c

polina-c commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

From triage bot, ping: @Varun-S10 this PR from an out-of-team contributor has had no response from the team for 14 days. Please review it, or tell the author what is next. If nothing changes in 7 days, the PR gets status: needs-triage and goes back to the weekly triage.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: web_core basic catalog v1 entries load Lit, so they fail without a DOM (React Native)

3 participants