Module

templating.oob_registry

App-level OOB region registry for layout-contract serialization.

Maps OOB block names (e.g.breadcrumbs_oob) to serialization config (target ID, swap strategy, wrapper behavior). Apps register regions during setup; the registry is frozen at runtime alongside routes and middleware.

Convention fallback: unregistered blocks useblock_name.removesuffix("_oob") as target ID,outerHTMLswap, and wrapper div.

Classes

OOBRegionConfig 3
Serialization config for a single OOB region. target_id: DOM element ID for hx-swap-oob targeting.…

Serialization config for a single OOB region.

target_id: DOM element ID for hx-swap-oob targeting. swap: htmx swap strategy — "innerHTML" or "true" (outerHTML). wrap: Whether to wrap in

. False for elements like that embed their own hx-swap-oob attribute.</p> </div> <div class="autodoc-section" data-section="attributes"> <h4 class="autodoc-label">Attributes</h4> <table class="autodoc-table" data-table="attributes"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>target_id</code></td> <td class="autodoc-cell-type"> <code>str</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> <tr> <td class="autodoc-cell-name"><code>swap</code></td> <td class="autodoc-cell-type"> <code>str</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> <tr> <td class="autodoc-cell-name"><code>wrap</code></td> <td class="autodoc-cell-type"> <code>bool</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> </tbody> </table> </div> </div> </details> <details class="autodoc-member" data-member="class" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">OOBRegistry</code> <span class="autodoc-member-count" title="7 methods, 4 attributes">11</span> <span class="autodoc-member-toggle">▼</span> </div> <span class="autodoc-member-desc-preview">App-level registry mapping OOB block names to serialization config. Mutable during setup, frozen a…</span> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-member-desc prose"> <p>App-level registry mapping OOB block names to serialization config.</p> <p>Mutable during setup, frozen at runtime (same lifecycle as routes).</p> </div> <div class="autodoc-section" data-section="attributes"> <h4 class="autodoc-label">Attributes</h4> <table class="autodoc-table" data-table="attributes"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>_regions</code></td> <td class="autodoc-cell-type"> <code>dict[str, OOBRegionConfig]</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> <tr> <td class="autodoc-cell-name"><code>_frozen</code></td> <td class="autodoc-cell-type"> <code>bool</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> <tr> <td class="autodoc-cell-name"><code>_contract_cache</code></td> <td class="autodoc-cell-type"> <code>dict[str, LayoutContract]</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> <tr> <td class="autodoc-cell-name"><code>_contract_lock</code></td> <td class="autodoc-cell-type"> <code>threading.Lock</code> </td> <td class="autodoc-cell-desc"> — </td> </tr> </tbody> </table> </div> <div class="autodoc-section" data-section="methods"> <h4 class="autodoc-label">Methods</h4> <section class="autodoc-section" data-section="methods"> <div class="autodoc-members-list"> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">registered_blocks</code> <span class="autodoc-member-count" title="0 parameters">0</span> <span class="autodoc-member-return" title="Returns frozenset[str]"> <code>frozenset[str]</code> </span> <span class="autodoc-member-toggle">▼</span> </div> </div> <span class="autodoc-member-badges"> <span class="autodoc-badge" data-badge="property">property</span> </span> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def registered_blocks(self) -> frozenset[str]</code> </div> <div class="autodoc-returns"> <h5 class="autodoc-returns-title">Returns</h5> <code class="autodoc-returns-type">frozenset[str]</code> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">register</code> <span class="autodoc-member-count" title="2 parameters">2</span> <span class="autodoc-member-toggle">▼</span> </div> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def register(self, block_name: str, config: OOBRegionConfig) -> None</code> </div> <div class="autodoc-params-section"> <h5 class="autodoc-params-title">Parameters</h5> <table class="autodoc-table autodoc-table--compact" data-table="parameters"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>block_name</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> <tr> <td class="autodoc-cell-name"><code>config</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> </tbody> </table> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">freeze</code> <span class="autodoc-member-count" title="0 parameters">0</span> <span class="autodoc-member-toggle">▼</span> </div> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def freeze(self) -> None</code> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">get</code> <span class="autodoc-member-count" title="1 parameter">1</span> <span class="autodoc-member-return" title="Returns OOBRegionConfig | None"> <code>OOBRegionConfig | None</code> </span> <span class="autodoc-member-toggle">▼</span> </div> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def get(self, block_name: str) -> OOBRegionConfig | None</code> </div> <div class="autodoc-params-section"> <h5 class="autodoc-params-title">Parameters</h5> <table class="autodoc-table autodoc-table--compact" data-table="parameters"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>block_name</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> </tbody> </table> </div> <div class="autodoc-returns"> <h5 class="autodoc-returns-title">Returns</h5> <code class="autodoc-returns-type">OOBRegionConfig | None</code> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">resolve_target</code> <span class="autodoc-member-count" title="1 parameter">1</span> <span class="autodoc-member-return" title="Returns str"> <code>str</code> </span> <span class="autodoc-member-toggle">▼</span> </div> <span class="autodoc-member-desc-preview">Resolve block name to target ID. Registry first, convention fallback.</span> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def resolve_target(self, block_name: str) -> str</code> </div> <div class="autodoc-params-section"> <h5 class="autodoc-params-title">Parameters</h5> <table class="autodoc-table autodoc-table--compact" data-table="parameters"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>block_name</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> </tbody> </table> </div> <div class="autodoc-returns"> <h5 class="autodoc-returns-title">Returns</h5> <code class="autodoc-returns-type">str</code> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">resolve_serialization</code> <span class="autodoc-member-count" title="1 parameter">1</span> <span class="autodoc-member-return" title="Returns tuple[str, bool]"> <code>tuple[str, bool]</code> </span> <span class="autodoc-member-toggle">▼</span> </div> <span class="autodoc-member-desc-preview">Return (swap, wrap) for a target ID. Convention default: outerHTML + wrap.</span> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def resolve_serialization(self, target_id: str) -> tuple[str, bool]</code> </div> <div class="autodoc-params-section"> <h5 class="autodoc-params-title">Parameters</h5> <table class="autodoc-table autodoc-table--compact" data-table="parameters"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>target_id</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> </tbody> </table> </div> <div class="autodoc-returns"> <h5 class="autodoc-returns-title">Returns</h5> <code class="autodoc-returns-type">tuple[str, bool]</code> </div> </div> </details> <details class="autodoc-member" data-member="method" > <summary class="autodoc-member-header"> <span class="autodoc-member-dot"></span> <div class="autodoc-member-content"> <div class="autodoc-member-name-row"> <code class="autodoc-member-name">get_or_build_contract</code> <span class="autodoc-member-count" title="2 parameters">2</span> <span class="autodoc-member-return" title="Returns LayoutContract"> <code>LayoutContract</code> </span> <span class="autodoc-member-toggle">▼</span> </div> <span class="autodoc-member-desc-preview">Return cached LayoutContract, building on first access.</span> </div> </summary> <div class="autodoc-member-body"> <div class="autodoc-signature-section"> <code class="autodoc-member-sig">def get_or_build_contract(self, adapter: Any, template_name: str) -> LayoutContract</code> </div> <div class="autodoc-params-section"> <h5 class="autodoc-params-title">Parameters</h5> <table class="autodoc-table autodoc-table--compact" data-table="parameters"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class="autodoc-cell-name"><code>adapter</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> <tr> <td class="autodoc-cell-name"><code>template_name</code></td> <td class="autodoc-cell-type"><code>—</code></td> <td class="autodoc-cell-desc"> </td> </tr> </tbody> </table> </div> <div class="autodoc-returns"> <h5 class="autodoc-returns-title">Returns</h5> <code class="autodoc-returns-type">LayoutContract</code> </div> </div> </details> </div> </section> </div> </div> </details> </section> </article> <nav class="page-navigation" aria-label="Page navigation"> <div class="nav-links"> <div class="nav-previous"> <a href="/chirp/api/templating/macros/" rel="prev"> <span class="nav-subtitle">← Previous</span> <span class="nav-title">macros</span> </a> </div> <div class="nav-next"> <a href="/chirp/api/templating/render_plan/" rel="next"> <span class="nav-subtitle">Next →</span> <span class="nav-title">render_plan</span> </a> </div> </div> </nav> </div> </div> <button class="docs-sidebar-toggle" aria-label="Toggle navigation sidebar" aria-expanded="false" aria-controls="docs-sidebar"> <svg width="20" height="20" class="bengal-icon icon-list" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none"> <title>List