Skip to content

refactor: make JasprComponent its own API - #28

Merged
brianegan merged 1 commit into
mainfrom
26-split-inlinejasprcomponent-from-jasprcomponent
Sep 23, 2026
Merged

brianegan merged 1 commit into
mainfrom
26-split-inlinejasprcomponent-from-jasprcomponent

Conversation

@brianegan

Copy link
Copy Markdown
Collaborator

Summary

A custom component is now one class. JasprComponent declares its own name and schema next to build and styles, so a component no longer needs a separate ComponentApi class plus an api field to hold it. The five minimal components keep using a2ui_core's API classes through a new ExternalApiJasprComponent, which wraps an API defined elsewhere.

Changes

  • JasprComponent loses its api getter and the name/schema forwarders. A subclass that skips name or schema now fails analysis.
  • New public ExternalApiJasprComponent(ComponentApi api) forwards name and schema to the API it wraps. TextComponent, RowComponent, ColumnComponent, ButtonComponent and TextFieldComponent extend it, and JasprComponent.inline is built on it.
  • All thirteen basic-only components declare name and schema on the class. Their *Api classes are gone, including the exported IconApi, and their constructors are now const. Each schema getter keeps the spec provenance note the deleted API class used to carry.
  • README, CHANGELOG and the JasprComponent dartdoc 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.dart cover a bare JasprComponent acting as its own API and an ExternalApiJasprComponent taking its name and schema from the API it wraps. The existing schema tests now assert on the component, as in const DividerComponent().schema.

Gates

Gated f1f55ab against origin/main@debac66.

  • review: skill code-review on fable, passed, agent-reported
  • test: command, passed in 73.4s
  • example-test: command, passed in 15.8s
  • browser-test: command, passed in 6.2s

Reviewed against the plan recorded on the issue.

Closes #26

…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
@brianegan
brianegan merged commit 5350ed7 into main Sep 23, 2026
8 checks passed
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.

Split InlineJasprComponent from JasprComponent?

1 participant