refactor: make JasprComponent its own API - #28
Merged
brianegan merged 1 commit intoSep 23, 2026
Merged
Conversation
…ponent Basic components now declare name and schema directly instead of holding a separate *Api instance. Minimal components wrap a2ui_core's APIs through the new ExternalApiJasprComponent. Closes #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A custom component is now one class.
JasprComponentdeclares its ownnameandschemanext tobuildandstyles, so a component no longer needs a separateComponentApiclass plus anapifield to hold it. The five minimal components keep usinga2ui_core's API classes through a newExternalApiJasprComponent, which wraps an API defined elsewhere.Changes
JasprComponentloses itsapigetter and thename/schemaforwarders. A subclass that skipsnameorschemanow fails analysis.ExternalApiJasprComponent(ComponentApi api)forwardsnameandschemato the API it wraps.TextComponent,RowComponent,ColumnComponent,ButtonComponentandTextFieldComponentextend it, andJasprComponent.inlineis built on it.nameandschemaon the class. Their*Apiclasses are gone, including the exportedIconApi, and their constructors are nowconst. Eachschemagetter keeps the spec provenance note the deleted API class used to carry.JasprComponentdartdoc show the one-class shape.Testing
This is a refactor with no behavior change, so green tests are the confirmation. New tests in
catalog_extension_test.dartcover a bareJasprComponentacting as its own API and anExternalApiJasprComponenttaking its name and schema from the API it wraps. The existing schema tests now assert on the component, as inconst DividerComponent().schema.Gates
Gated
f1f55abagainstorigin/main@debac66.code-reviewonfable, passed, agent-reportedReviewed against the plan recorded on the issue.
Closes #26