htmx¶
- class litestar.plugins.htmx.ClientRedirect¶
基类:
ResponseHTMX Response class to support client side redirect.
- class litestar.plugins.htmx.ClientRefresh¶
基类:
ResponseResponse to support HTMX client page refresh
- class litestar.plugins.htmx.HTMXConfig¶
基类:
objectConfiguration for HTMX Plugin.
- class litestar.plugins.htmx.HTMXDetails¶
基类:
objectHTMXDetails holds all the values sent by HTMX client in headers and provide convenient properties.
- __init__(request: Request) None¶
Initialize
HTMXDetails
- property current_url_abs_path: str | None¶
Current url abs path value, to get query and path parameter sent by HTMX client.
- property history_restore_request: bool¶
If True then, request is for history restoration after a miss in the local history cache.
- class litestar.plugins.htmx.HTMXPlugin¶
-
HTMX Plugin.
- __init__(config: HTMXConfig | None = None) None¶
Initialize the plugin.
- 参数:
config¶ -- Configuration for flash messages, including the template engine instance.
- class litestar.plugins.htmx.HTMXTemplate¶
基类:
TemplateHTMX template wrapper
- __init__(push_url: str | bool | None = None, re_swap: Literal['innerHTML', 'outerHTML', 'beforebegin', 'afterbegin', 'beforeend', 'afterend', 'delete', 'none', None] | None = None, re_target: str | None = None, trigger_event: str | None = None, params: dict[str, Any] | None = None, after: Literal['receive', 'settle', 'swap', None] | None = None, **kwargs: Any) None¶
Create HTMXTemplate response.
- 参数:
push_url¶ -- Either a string value specifying a URL to push to browser history or
Falseto prevent HTMX client from pushing a url to browser history.re_swap¶ -- Method value to instruct HTMX which swapping method to use.
re_target¶ -- Value for 'id of target element' to apply changes to.
trigger_event¶ -- Event name to trigger.
params¶ -- Dictionary of parameters if any required with trigger event parameter.
after¶ -- Changes to apply after
receive,settleorswapevent.**kwargs¶ -- Additional arguments to pass to
Template.
- class litestar.plugins.htmx.HXLocation¶
基类:
ResponseClient side redirect without full page reload.
- __init__(redirect_to: str, source: str | None = None, event: str | None = None, target: str | None = None, select: str | None = None, swap: Literal['innerHTML', 'outerHTML', 'beforebegin', 'afterbegin', 'beforeend', 'afterend', 'delete', 'none', None] | None = None, hx_headers: dict[str, Any] | None = None, values: dict[str, str] | None = None, **kwargs: Any) None¶
Initialize HXLocation, Set status code to 200 (required by HTMX), and pass redirect url.
- class litestar.plugins.htmx.HXStopPolling¶
基类:
ResponseStop HTMX client from Polling.
- class litestar.plugins.htmx.HtmxHeaderType¶
基类:
TypedDictType for hx_headers parameter in get_headers().
- class litestar.plugins.htmx.PushUrl¶
基类:
Generic[T],Response[T]Response to push new url into the history stack.
- class litestar.plugins.htmx.ReplaceUrl¶
基类:
Generic[T],Response[T]Response to replace url in the Browser Location bar.
- class litestar.plugins.htmx.Reswap¶
基类:
Generic[T],Response[T]Response to specify how the response will be swapped.
- class litestar.plugins.htmx.Retarget¶
基类:
Generic[T],Response[T]Response to target different element on the page.