Functions
format_oob_htmx
2
str
▼
Wrap rendered block HTML as an htmx OOB swap element.
htmx scans the response …
format_oob_htmx
2
str
▼
def format_oob_htmx(block_html: str, target_id: str) -> str
Wrap rendered block HTML as an htmx OOB swap element.
htmx scans the response body for elements withhx-swap-oob
and swaps them into the page byid.
Parameters
| Name | Type | Description |
|---|---|---|
block_html |
str |
|
target_id |
str |
Returns
str
format_oob_script
2
str
▼
Wrap rendered block HTML as a ```` + ```` pair.
Used for initial page loads wh…
format_oob_script
2
str
▼
def format_oob_script(block_html: str, target_id: str) -> str
Wrap rendered block HTML as a<template> + <script>pair.
Used for initial page loads where htmx OOB is not available. The inline script moves template content into the target element.
Parameters
| Name | Type | Description |
|---|---|---|
block_html |
str |
|
target_id |
str |
Returns
str
_find_deferred_blocks
3
dict[str, list[str]]
▼
Map each deferred context key to the template blocks that depend on it.
Uses k…
_find_deferred_blocks
3
dict[str, list[str]]
▼
def _find_deferred_blocks(env: Environment, template_name: str, deferred_keys: set[str]) -> dict[str, list[str]]
Map each deferred context key to the template blocks that depend on it.
Uses kida'sblock_metadata()static analysis to find blocks
whosedepends_onset intersects with the deferred keys.
Returns{context_key: [block_name, ...]}— a key may affect
multiple blocks, and a block may appear under multiple keys
(de-duplicated during rendering).
Parameters
| Name | Type | Description |
|---|---|---|
env |
Environment |
|
template_name |
str |
|
deferred_keys |
set[str] |
Returns
dict[str, list[str]]
_should_wrap_in_layouts
2
bool
▼
Return True if the shell should be wrapped in the layout chain.
_should_wrap_in_layouts
2
bool
▼
def _should_wrap_in_layouts(layout_chain: Any, request: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
layout_chain |
Any |
|
request |
Any |
Returns
bool
render_suspense
6
AsyncIterator[str]
▼
Render a ``Suspense`` return value as an async chunk stream.
async
render_suspense
6
AsyncIterator[str]
▼
async def render_suspense(env: Environment, suspense: Suspense, *, is_htmx: bool = False, layout_chain: Any = None, layout_context: dict[str, Any] | None = None, request: Any = None) -> AsyncIterator[str]
Parameters
| Name | Type | Description |
|---|---|---|
env |
Environment |
Kida template environment. |
suspense |
Suspense |
The |
is_htmx |
bool |
If False
|
layout_chain |
Any |
Optional layout chain to wrap the shell in. Default:None
|
layout_context |
dict[str, Any] | None |
Context for layout templates (when layout_chain used). Default:None
|
request |
Any |
Request for fragment detection (when layout_chain used). Default:None
|
Returns
AsyncIterator[str]