API reference¶
Generated components¶
spaday_webawesome.components contains typed classes generated from WebAwesome’s committed Custom
Elements Manifest. Class names follow the upstream tags: WaButton maps to <wa-button>, WaInput
maps to <wa-input>, and so on. Constructor keyword arguments mirror manifest attributes.
All generated names are re-exported from spaday_webawesome.
from spaday_webawesome import WaButton
WaButton(variant="brand", size="small").text("Save")
Helpers¶
- class spaday_webawesome.Tabs(*, active: str | None = None, placement: str | None = None, key: str | None = None, **props: Any)[source]¶
Bases:
ComponentA
wa-tab-groupbuilt from labelled content panels.Bind
activetwo-way to keep application state synchronized with user tab selection.
- class spaday_webawesome.FormField(label: str | None = None, exclude: bool = False, control: Component | Callable[[str, Any, bool], Component] | None = None, group: Callable[[str, Column], Component] | None = None)[source]¶
Bases:
objectPer-field overrides for
form().Attach one of two ways — co-located on the model with
Annotated[T, FormField(...)], or at the call site withform(model, overrides={path: FormField(...)})(the call-site one wins;pathis the field name, or a dottedparent.childto reach a nested field). Use it to:drop a field —
exclude=Truerelabel it —
label="…"replace its control —
control=either a ready Component (two-way bound to the field onvaluefor you — good for inputs/selects/radios), or a(field, annotation, required) -> Componentfactory you bind yourself (for anything else, e.g. acheckedbinding)wrap a sub-model group —
group=a(label, inner: Stack) -> Componentfactory; the default is an openwa-details(expand/collapse). Return a WaCard, a WaDrawer, or a collapsedWaDetails(summary=label)to present the nested section differently.
- spaday_webawesome.form(model: Any, *, exclude: tuple = (), overrides: dict[str, FormField] | None = None) Column[source]¶
A two-way-bound form for a validation schema.
modelmay be a pydantic model (class or instance), a TypeAdapter (so any type pydantic can validate — dataclasses,TypedDict, etc.), or a raw JSON Schemadict. Fields inexcludeare skipped (by name, or dottedparent.childfor a nested one). Per-field tweaks come from FormField — eitherAnnotatedon a pydantic model, or supplied/overridden here viaoverrides={path: FormField(...)}(which wins). A nested object becomes an expand/collapsewa-detailssection whose controls bind toparent.childpaths.The pydantic-model path keeps detail a JSON Schema can’t carry — Enum member names as option labels, and the exact Python annotation passed to a control factory. Via a TypeAdapter or a raw
dictthose degrade gracefully (enum options are labeled by their raw value; a factory’sannotationis a best-effort Python type —str/int/float/bool— orNone).
Tabs.tab(label, *content, name=None) adds a linked <wa-tab> and <wa-tab-panel>. The default name
is a slug of the label.
form(source, ...) accepts a pydantic model class, model instance, TypeAdapter, or JSON Schema mapping.
package¶
spaday_webawesome.package is a spaday.ComponentPackage named webawesome. Assets load in this order:
css/webawesome.csscdn/index.js
The CSS maps WebAwesome theme colors onto core --spa-* shell tokens. The JavaScript bundle registers
the full component catalog. package.components contains every generated component class;
package.catalog returns their property, event, and slot schemas.
package.imports publishes WebAwesome’s own ES modules under its bare specifiers, which spaday emits
as the page’s import map:
Specifier |
Served from |
|---|---|
|
|
|
|
The bundle imports the catalog through those specifiers too, so any other module on the page that imports them gets the same copy.