Skip to content

feat(web_core): add WebComponentImplementation helpers and refactor basic catalog - #2596

Open
josemontespg wants to merge 1 commit into
web-core-universal-submodulesfrom
web-core-is-web-component-implementation
Open

feat(web_core): add WebComponentImplementation helpers and refactor basic catalog#2596
josemontespg wants to merge 1 commit into
web-core-universal-submodulesfrom
web-core-is-web-component-implementation

Conversation

@josemontespg

@josemontespg josemontespg commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Overview

Implements the createWebComponentImplementation helper function and isWebComponentImplementation type guard in @a2ui/web_core/v0_9, and refactors all basic Lit components in renderers/web_core/src/v0_9/basic_catalog/components/ to export definitions using createWebComponentImplementation.

Key Changes

  • @a2ui/web_core/v0_9:
    • createWebComponentImplementation: Pairs a ComponentApi definition, Custom Element class, and tag name into a WebComponentImplementation, automatically registering the element in customElements if not already defined.
    • isWebComponentImplementation: Structural duck-typing check verifying whether a component definition specifies a valid string tagName.
  • Basic Catalog components:
    • Refactored all 18 basic catalog components (AudioPlayer, Button, Card, CheckBox, ChoicePicker, Column, DateTimeInput, Divider, Icon, Image, List, Modal, Row, Slider, Tabs, Text, TextField, Video) to export universal definitions using createWebComponentImplementation.
  • Unit Tests: Added test suites for createWebComponentImplementation and isWebComponentImplementation.

Verification

  • yarn --cwd renderers/web_core test (all 474 unit and conformance tests pass)
  • yarn --cwd renderers/web_core lint (clean, 0 errors)
  • ./scripts/fix_format.sh --check (passes)

@github-project-automation github-project-automation Bot moved this to Todo in A2UI Sep 10, 2026
@josemontespg
josemontespg added this pull request to stack #2597 September 10, 2026 00:35

@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 the isWebComponentImplementation type guard function to check if a component API or implementation is a WebComponentImplementation, along with corresponding unit tests and a changelog entry. The feedback suggests improving the type guard by also validating the presence and types of name and schema properties, as WebComponentImplementation extends ComponentApi and requires these fields for full type safety.

Comment thread renderers/web_core/src/v0_9/catalog/types.ts Outdated
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from ecb2dcd to 19abde0 Compare September 10, 2026 00:39
Comment thread renderers/web_core/src/v0_9/catalog/create_component_implementation.ts Outdated
Comment thread renderers/web_core/src/v0_9/catalog/types.ts Outdated
Comment thread renderers/web_core/CHANGELOG.md Outdated
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 19abde0 to 32a9afe Compare September 10, 2026 00:56
Comment thread renderers/web_core/CHANGELOG.md Outdated
Comment thread renderers/web_core/CHANGELOG.md
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 32a9afe to 4e6cdc7 Compare September 10, 2026 04:22
@josemontespg josemontespg changed the title feat(web_core): add isWebComponentImplementation type guard feat(web_core): add WebComponentImplementation helpers and refactor basic catalog Sep 10, 2026
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 4e6cdc7 to d012fd2 Compare September 10, 2026 04:45
@josemontespg
josemontespg removed this pull request from stack #2597 September 10, 2026 04:57
@josemontespg
josemontespg added this pull request to stack #2601 September 10, 2026 05:00
@josemontespg
josemontespg removed this pull request from stack #2601 September 10, 2026 05:01
@josemontespg
josemontespg changed the base branch from web-core-universal-markdown to web-core-universal-submodules September 10, 2026 05:03
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from d012fd2 to bf26acf Compare September 10, 2026 05:06
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from bf26acf to 550966e Compare September 10, 2026 05:09
@josemontespg
josemontespg added this pull request to stack #2602 September 10, 2026 05:11
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 550966e to 8a45eda Compare September 10, 2026 05:35
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 8a45eda to 6c8685c Compare September 10, 2026 05:46
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 6c8685c to 6d0dfb9 Compare September 10, 2026 06:08
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 6d0dfb9 to b8147f2 Compare September 10, 2026 06:18
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from b8147f2 to a09ae2d Compare September 10, 2026 06:24
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from a09ae2d to 5af8c02 Compare September 10, 2026 06:29
@josemontespg
josemontespg marked this pull request as ready for review September 10, 2026 06:42
@josemontespg
josemontespg removed this pull request from stack #2602 September 10, 2026 06:52
@josemontespg
josemontespg added this pull request to stack #2603 September 10, 2026 06:53
@josemontespg
josemontespg removed this pull request from stack #2603 September 10, 2026 08:01
@josemontespg
josemontespg added this pull request to stack #2605 September 10, 2026 08:02
@josemontespg
josemontespg removed this pull request from stack #2605 September 10, 2026 12:26
@josemontespg
josemontespg added this pull request to stack #2607 September 10, 2026 12:26
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 5af8c02 to 07ca19c Compare September 10, 2026 20:41
Comment thread renderers/web_core/src/v0_9/universal/create_web_component_implementation.test.ts Outdated
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 07ca19c to 09dbea1 Compare September 10, 2026 20:57
@josemontespg
josemontespg removed this pull request from stack #2607 September 11, 2026 00:22
@josemontespg
josemontespg added this pull request to stack #2616 September 11, 2026 00:23
@josemontespg
josemontespg force-pushed the web-core-is-web-component-implementation branch from 09dbea1 to 04cbdd7 Compare September 11, 2026 18:51
@josemontespg
josemontespg removed this pull request from stack #2616 September 11, 2026 18:53
@josemontespg
josemontespg added this pull request to stack #2631 September 11, 2026 18:53
Comment on lines +66 to +69
export const A2uiAudioPlayer = createWebComponentImplementation(
AudioPlayerApi,
A2uiAudioPlayerElement,
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(Same comment as in the previous entry, maybe it's enough to export createWebComponentImplementation and isWebComponentImplementation to users of web_core (the catalog implementers) and they can create this glue over there?

Or maybe all catalogs are going to use these A2uiAudioPlayer implementation instead of the Element? In that case, do we need to re-export the A2uiAudioPlayerElement custom element implementation?

My hunch is that we don't need to export both the WebComponentImplementation and the BasicCatalogA2uiLitElement classes?

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.

2 participants