plain.htmx 0.12.0__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/PKG-INFO +1 -1
  2. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/CHANGELOG.md +21 -0
  3. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/templates.py +2 -1
  4. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/views.py +15 -15
  5. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/pyproject.toml +1 -1
  6. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/tests/test_views.py +2 -3
  7. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/.gitignore +0 -0
  8. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/LICENSE +0 -0
  9. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/README.md +0 -0
  10. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/deps.yml +0 -0
  11. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/package-lock.json +0 -0
  12. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/package.json +0 -0
  13. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/README.md +0 -0
  14. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/__init__.py +0 -0
  15. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/plainhtmx.js +0 -0
  16. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.js +0 -0
  17. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.min.js +0 -0
  18. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-htmx.js +0 -0
  19. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.amd.js +0 -0
  20. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.cjs.js +0 -0
  21. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.esm.js +0 -0
  22. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.js +0 -0
  23. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.min.js +0 -0
  24. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/README.md +0 -0
  25. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/ajax-header.js +0 -0
  26. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/alpine-morph.js +0 -0
  27. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/class-tools.js +0 -0
  28. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/client-side-templates.js +0 -0
  29. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/debug.js +0 -0
  30. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/disable-element.js +0 -0
  31. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/event-header.js +0 -0
  32. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/head-support.js +0 -0
  33. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/include-vals.js +0 -0
  34. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/json-enc.js +0 -0
  35. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/loading-states.js +0 -0
  36. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/method-override.js +0 -0
  37. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/morphdom-swap.js +0 -0
  38. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/multi-swap.js +0 -0
  39. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/path-deps.js +0 -0
  40. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/path-params.js +0 -0
  41. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/preload.js +0 -0
  42. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/rails-method.js +0 -0
  43. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/remove-me.js +0 -0
  44. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/response-targets.js +0 -0
  45. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/restored.js +0 -0
  46. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/sse.js +0 -0
  47. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/ext/ws.js +0 -0
  48. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.amd.js +0 -0
  49. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.cjs.js +0 -0
  50. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.esm.d.ts +0 -0
  51. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.esm.js +0 -0
  52. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.js +0 -0
  53. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.min.js +0 -0
  54. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/assets/htmx/vendor/src/htmx.min.js.gz +0 -0
  55. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/plain/htmx/templates/htmx/js.html +0 -0
  56. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/tests/app/settings.py +0 -0
  57. {plain_htmx-0.12.0 → plain_htmx-0.14.0}/tests/app/urls.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.htmx
3
- Version: 0.12.0
3
+ Version: 0.14.0
4
4
  Summary: Integrate HTMX with templates and views.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,5 +1,26 @@
1
1
  # plain-htmx changelog
2
2
 
3
+ ## [0.14.0](https://github.com/dropseed/plain/releases/plain-htmx@0.14.0) (2025-12-04)
4
+
5
+ ### What's changed
6
+
7
+ - Improved type annotations for template extension context handling ([ac1eeb0](https://github.com/dropseed/plain/commit/ac1eeb0))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - No changes required
12
+
13
+ ## [0.13.0](https://github.com/dropseed/plain/releases/plain-htmx@0.13.0) (2025-11-24)
14
+
15
+ ### What's changed
16
+
17
+ - Replaced `HTMXViewMixin` with `HTMXView` class that inherits from `TemplateView` for better type checking support ([569afd6](https://github.com/dropseed/plain/commit/569afd6))
18
+
19
+ ### Upgrade instructions
20
+
21
+ - Replace `class MyView(HTMXViewMixin, TemplateView)` with `class MyView(HTMXView)` - the new `HTMXView` class already inherits from `TemplateView`
22
+ - Update imports from `from plain.htmx.views import HTMXViewMixin` to `from plain.htmx.views import HTMXView`
23
+
3
24
  ## [0.12.0](https://github.com/dropseed/plain/releases/plain-htmx@0.12.0) (2025-11-12)
4
25
 
5
26
  ### What's changed
@@ -7,6 +7,7 @@ from jinja2 import meta, nodes
7
7
  from jinja2.ext import Extension
8
8
  from jinja2.nodes import CallBlock, Node
9
9
  from jinja2.parser import Parser
10
+ from jinja2.runtime import Context
10
11
 
11
12
  from plain.runtime import settings
12
13
  from plain.templates import register_template_extension
@@ -19,7 +20,7 @@ class HTMXJSExtension(InclusionTagExtension):
19
20
  template_name = "htmx/js.html"
20
21
 
21
22
  def get_context(
22
- self, context: dict[str, Any], *args: Any, **kwargs: Any
23
+ self, context: Context, *args: Any, **kwargs: Any
23
24
  ) -> dict[str, Any]:
24
25
  request = context.get("request")
25
26
  return {
@@ -3,19 +3,19 @@ from __future__ import annotations
3
3
  from collections.abc import Callable
4
4
  from typing import Any
5
5
 
6
- from plain.http import Response
6
+ from plain.http import ResponseBase
7
7
  from plain.utils.cache import patch_vary_headers
8
+ from plain.views import TemplateView
8
9
 
9
10
  from .templates import render_template_fragment
10
11
 
11
12
 
12
- class HTMXViewMixin:
13
- """Mixin for View classes to add HTMX-specific functionality."""
13
+ class HTMXView(TemplateView):
14
+ """View with HTMX-specific functionality."""
14
15
 
15
16
  def render_template(self) -> str:
16
- # These methods are provided by the View base class
17
- template = self.get_template() # type: ignore[attr-defined]
18
- context = self.get_template_context() # type: ignore[attr-defined]
17
+ template = self.get_template()
18
+ context = self.get_template_context()
19
19
 
20
20
  if self.is_htmx_request() and self.get_htmx_fragment_name():
21
21
  return render_template_fragment(
@@ -26,8 +26,8 @@ class HTMXViewMixin:
26
26
 
27
27
  return template.render(context)
28
28
 
29
- def get_response(self) -> Response:
30
- response = super().get_response() # type: ignore[misc]
29
+ def get_response(self) -> ResponseBase:
30
+ response = super().get_response()
31
31
  # Tell browser caching to also consider the fragment header,
32
32
  # not just the url/cookie.
33
33
  patch_vary_headers(
@@ -35,11 +35,11 @@ class HTMXViewMixin:
35
35
  )
36
36
  return response
37
37
 
38
- def get_request_handler(self) -> Callable[..., Any]:
39
- if self.is_htmx_request():
38
+ def get_request_handler(self) -> Callable[[], Any] | None:
39
+ if self.is_htmx_request() and self.request.method:
40
40
  # You can use an htmx_{method} method on views
41
41
  # (or htmx_{method}_{action} for specific actions)
42
- method = f"htmx_{self.request.method.lower()}" # type: ignore[attr-defined]
42
+ method = f"htmx_{self.request.method.lower()}"
43
43
 
44
44
  if action := self.get_htmx_action_name():
45
45
  # If an action is specified, we throw an error if
@@ -52,14 +52,14 @@ class HTMXViewMixin:
52
52
  # to a regular post method if it's not found
53
53
  return handler
54
54
 
55
- return super().get_request_handler() # type: ignore[misc]
55
+ return super().get_request_handler()
56
56
 
57
57
  def is_htmx_request(self) -> bool:
58
- return self.request.headers.get("HX-Request") == "true" # type: ignore[attr-defined]
58
+ return self.request.headers.get("HX-Request") == "true"
59
59
 
60
60
  def get_htmx_fragment_name(self) -> str:
61
61
  # A custom header that we pass with the {% htmxfragment %} tag
62
- return self.request.headers.get("Plain-HX-Fragment", "") # type: ignore[attr-defined]
62
+ return self.request.headers.get("Plain-HX-Fragment", "")
63
63
 
64
64
  def get_htmx_action_name(self) -> str:
65
- return self.request.headers.get("Plain-HX-Action", "") # type: ignore[attr-defined]
65
+ return self.request.headers.get("Plain-HX-Action", "")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.htmx"
3
- version = "0.12.0"
3
+ version = "0.14.0"
4
4
  description = "Integrate HTMX with templates and views."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  license = "BSD-3-Clause"
@@ -1,10 +1,9 @@
1
- from plain.htmx.views import HTMXViewMixin
1
+ from plain.htmx.views import HTMXView
2
2
  from plain.http import Response
3
3
  from plain.test import RequestFactory
4
- from plain.views import View
5
4
 
6
5
 
7
- class V(HTMXViewMixin, View):
6
+ class V(HTMXView):
8
7
  def get(self):
9
8
  return Response("Ok")
10
9
 
File without changes
File without changes
File without changes
File without changes
File without changes