httk.serve.web.widgets.core¶
The public contracts for static httk-serve widgets.
Attributes¶
Largest individual trusted widget asset accepted by |
|
The deliberately small content-type vocabulary for internal widget assets. |
|
Classes¶
An immutable, deployment-relative asset declared by trusted widget code. |
|
Immutable request and page information made available to widgets. |
|
An explicitly trusted HTML result returned by a widget. |
|
Advanced immutable widget definition protocol. |
|
An immutable adapter for the common module-level |
|
Registry for built-ins; aliases never participate in site resolution. |
Functions¶
|
Wrap a callable as a |
|
Mark a widget's reviewed HTML output as trusted. |
Module Contents¶
- httk.serve.web.widgets.core.MAX_WIDGET_ASSET_BYTES = 1000000[source]¶
Largest individual trusted widget asset accepted by
WidgetAsset.
- httk.serve.web.widgets.core.SUPPORTED_WIDGET_ASSET_CONTENT_TYPES[source]¶
The deliberately small content-type vocabulary for internal widget assets.
- class httk.serve.web.widgets.core.WidgetAsset[source]¶
An immutable, deployment-relative asset declared by trusted widget code.
pathis relative to/_httk/serve/assets/and is never interpreted as a filesystem path. The engine serves only assets it has registered while rendering this site instance.
- class httk.serve.web.widgets.core.WidgetContext[source]¶
Immutable request and page information made available to widgets.
- query: collections.abc.Mapping[str, str][source]¶
- postvars: collections.abc.Mapping[str, str][source]¶
- source_path: pathlib.Path[source]¶
- url_for: collections.abc.Callable[[str], str][source]¶
- absolute_url_for: collections.abc.Callable[[str], str][source]¶
- class httk.serve.web.widgets.core.WidgetRenderResult[source]¶
An explicitly trusted HTML result returned by a widget.
- assets: tuple[WidgetAsset, Ellipsis] = ()[source]¶
- class httk.serve.web.widgets.core.Widget[source]¶
Bases:
ProtocolAdvanced immutable widget definition protocol.
- render(context: WidgetContext, **props: object) str | WidgetRenderResult[source]¶
- class httk.serve.web.widgets.core.FunctionWidget[source]¶
An immutable adapter for the common module-level
renderfacade.- render_function: WidgetRenderer[source]¶
- render(context: WidgetContext, **props: object) str | WidgetRenderResult[source]¶
- httk.serve.web.widgets.core.function_widget(render: WidgetRenderer, *, name: str = '', source: str = '') FunctionWidget[source]¶
Wrap a callable as a
FunctionWidget.Site-local modules normally need no wrapper: a module-level
renderis discovered automatically. The helper is useful for explicit definitions.
- httk.serve.web.widgets.core.trusted_html(value: str) WidgetRenderResult[source]¶
Mark a widget’s reviewed HTML output as trusted.