Chirp 0.3.1
htmx 4.0 alignment, Speculation Rules API, tiered View Transitions, and bug fixes across standalone examples and framework core
Focus: align with htmx 4.0 and the evolving web platform — Speculation Rules, Invoker Commands,<htmx-partial>support — plus a tiered View Transitions system and a batch of bug fixes across examples and core.
Highlights
Speculation Rules API
Auto-generate<script type="speculationrules"> from your route definitions with tiered opt-in via AppConfig(speculation_rules=...):
| Value | Behavior |
|---|---|
False / "off" |
Inject nothing (default) |
True / "conservative" |
Prefetch linked pages on hover |
"moderate" |
Prefetch eagerly, prerender on hover |
"eager" |
Prerender eagerly (routes must be side-effect-free) |
JSON output is XSS-safe with< and &escaping before embedding in the script tag.
Tiered View Transitions
The single booleanview_transitionstoggle is replaced with three tiers:
| Value | Behavior |
|---|---|
False / "off" |
Inject nothing (new default) |
True / "htmx" |
htmxglobalViewTransitionsonly (baseline, all browsers) |
"full" |
htmx JS + MPA CSS/meta (cross-document, no Firefox yet) |
Breaking: the default changed fromTrue to False to prevent crossfade flicker on plain navigations. Apps that had view_transitions=True(or relied on the old default) should set it explicitly.
htmx 4.0 alignment
Three forward-looking features prepare Chirp for the htmx 4.0 ecosystem:
<htmx-partial>support —HX-Partialheader parsing onRequest, fragment block resolution for partial requests, and contract validation for<htmx-partial src="...">elements.- Invoker Commands validation —
app.check()validatescommandfortargets andcommandattribute values against the Invoker Commands spec. - Speculation Rules injection — See above.
Bug fixes
- Suspense double-nesting in
format_oob_scriptresolved. - SSE fragment whitespace stripped from data fields, fixing htmx table row parsing.
- Markdown filter output marked safe to prevent Kida auto-escaping.
- Standalone examples — contacts edit URL reset, upload delete route fix, dashboard/hackernews SSE restored, ollama chat UX improvements.
- Kanban template — replaced
loop.indexinside{% call %}with CSS:nth-child(odd)for Kida 0.3.0 compatibility.
Changed
- View Transitions — Tiered system (
False/True/"full") replaces single boolean. Default changed fromTruetoFalse. - README — Trimmed redundant sections; added Zoomies to Bengal ecosystem table.
Dependencies
kida-templates>=0.3.0(unchanged minimum)bengal-pounce>=0.4.0(unchanged minimum)
Upgrading
View Transitions migration: If your app relied on the previous default (view_transitions=True), add view_transitions=True (or "htmx") to your AppConfig explicitly. If you used view_transitions=True and want cross-document MPA transitions, switch to view_transitions="full".
To enable Speculation Rules:
app = App(AppConfig(speculation_rules="conservative"))