Changes
- Added a `page()` decorator for unconditionally rendering HTML (useful when a route needs to serve HTML for non-HTMX requests).
- Added a `Jinja.page()` decorator, the Jinja2 implementation of the generic `page()` decorator.
- Sync routes are now executed in a threadpool to avoid blocking the asyncio event loop.
- Added `Jinja.hx()` as the primary decorator for HTMX-serving routes for overall consistency in the library. At the same time, `Jinja.__call__()` and `Jinja.template()` are now deprecated and will be removed in the future.
- `JinjaContext.unpack_result()` can now handle `None` as well by converting it into an empty Jinja rendering context.
- Typing improvements.
- Renamed `HTMXRenderer` to `HTMLRenderer`. `HTMXRenderer` is still importable as a deprecated alias of `HTMLRenderer`.
- Updated the existing Jinja example to showcase the updated `Jinja` class.
- Added a fully-working (although rather basic) custom rendering example.
- Updated the documentation.
Internals
A lot of internal code has been moved. If, for some reason you imported something directly from a module instead of the package, you will unfortunately need to update your imports. New package layout:
- `fasthx.core_decorators`: the `hx()` and `page()` decorators can now be found here.
- Jinja-related code has been moved from `fasthx.main` to `fasthx.jinja`.
- `get_hx_request()` and `DependsHXRequest` are now in `fasthx.dependencies`.
- All utility types have been moved from `fasthx.main` to `fasthx.typing`.
- The internal `_append_to_signature()` method was moved from `fasthx.main` to `fasthx.utils` and renamed to `append_to_signature`. This method is still for internal use only.