Skip to content

bengal-chirp 0.3.1

Choose a tag to compare

@lbliii lbliii released this 30 Mar 18:47
· 141 commits to main since this release
0943478

Chirp 0.3.1

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 boolean view_transitions toggle is replaced with three tiers:

Value Behavior
False / "off" Inject nothing (new default)
True / "htmx" htmx globalViewTransitions only (baseline, all browsers)
"full" htmx JS + MPA CSS/meta (cross-document, no Firefox yet)

Breaking: the default changed from True 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> supportHX-Partial header parsing on Request, fragment block resolution for partial requests, and contract validation for <htmx-partial src="..."> elements.
  • Invoker Commands validationapp.check() validates commandfor targets and command attribute values against the Invoker Commands spec.
  • Speculation Rules injection — See above.

Bug fixes

  • Suspense double-nesting in format_oob_script resolved.
  • 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.index inside {% 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 from True to False.
  • 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

:::{tab-set}
:::{tab-item} UV

uv pip install --upgrade "bengal-chirp>=0.3.1"

:::

:::{tab-item} pip

pip install --upgrade "bengal-chirp>=0.3.1"

:::

:::{/tab-set}

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"))