bundle.website.core.component ============================= .. py:module:: bundle.website.core.component Attributes ---------- .. autoapisummary:: bundle.website.core.component.COMPONENTS_ROOT Classes ------- .. autoapisummary:: bundle.website.core.component.ComponentAsset bundle.website.core.component.Component bundle.website.core.component.ComponentAssets Functions --------- .. autoapisummary:: bundle.website.core.component.attach_routes bundle.website.core.component.context Module Contents --------------- .. py:data:: COMPONENTS_ROOT .. py:class:: ComponentAsset(/, **data: Any) Bases: :py:obj:`bundle.core.data.Data` Base data model class, providing utilities for serialization and deserialization from/to JSON, along with JSON Schema generation. .. attribute:: model_config Default model configuration settings. .. py:attribute:: kind :type: AssetKind | None :value: None .. py:attribute:: path :type: str .. py:attribute:: route_name :type: str :value: 'static' .. py:attribute:: module :type: bool :value: False .. py:class:: Component(/, **data: Any) Bases: :py:obj:`bundle.core.data.Data` Base data model class, providing utilities for serialization and deserialization from/to JSON, along with JSON Schema generation. .. attribute:: model_config Default model configuration settings. .. py:attribute:: slug :type: str .. py:attribute:: template :type: str | None :value: None .. py:attribute:: assets :type: list[ComponentAsset] :value: None .. py:attribute:: routers :type: list[fastapi.APIRouter] :value: None .. py:attribute:: params :type: bundle.core.data.Data | None :value: None .. py:attribute:: name :type: str | None :value: None .. py:attribute:: description :type: str | None :value: None .. py:attribute:: asset_filenames :type: ClassVar[tuple[str, Ellipsis]] :value: ('component.css', 'component.js', 'component.mjs') .. py:attribute:: component_file :type: str | pathlib.Path | None :value: None .. py:method:: build_routers() -> list[fastapi.APIRouter] .. py:method:: component_assets(*paths: str, route_name: str = 'components_static') -> list[ComponentAsset] :staticmethod: .. py:method:: component_asset_paths_for(component_file: str | pathlib.Path, *, asset_filenames: collections.abc.Iterable[str] | None = None) -> list[str] :classmethod: .. py:method:: component_assets_for(component_file: str | pathlib.Path, *, route_name: str = 'components_static') -> list[ComponentAsset] :classmethod: .. py:method:: component_template_for(component_file: str | pathlib.Path) -> str | None :classmethod: .. py:class:: ComponentAssets(/, **data: Any) Bases: :py:obj:`bundle.core.data.Data` Base data model class, providing utilities for serialization and deserialization from/to JSON, along with JSON Schema generation. .. attribute:: model_config Default model configuration settings. .. py:attribute:: styles :type: list[ComponentAsset] :value: None .. py:attribute:: scripts :type: list[ComponentAsset] :value: None .. py:method:: from_components(items: tuple[Component, Ellipsis]) -> ComponentAssets :classmethod: .. py:function:: attach_routes(router: fastapi.APIRouter, *items: Component) -> None .. py:function:: context(*items: Component) -> dict[str, Any]