djhtmx 1.2.5__tar.gz → 1.2.7__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 (39) hide show
  1. {djhtmx-1.2.5 → djhtmx-1.2.7}/CHANGELOG.md +10 -0
  2. {djhtmx-1.2.5 → djhtmx-1.2.7}/PKG-INFO +1 -1
  3. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/__init__.py +1 -1
  4. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/component.py +4 -0
  5. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/settings.py +2 -0
  6. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/templatetags/htmx.py +8 -3
  7. {djhtmx-1.2.5 → djhtmx-1.2.7}/.gitignore +0 -0
  8. {djhtmx-1.2.5 → djhtmx-1.2.7}/LICENSE +0 -0
  9. {djhtmx-1.2.5 → djhtmx-1.2.7}/MANIFEST.in +0 -0
  10. {djhtmx-1.2.5 → djhtmx-1.2.7}/README.md +0 -0
  11. {djhtmx-1.2.5 → djhtmx-1.2.7}/pyproject.toml +0 -0
  12. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/apps.py +0 -0
  13. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/command_queue.py +0 -0
  14. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/commands.py +0 -0
  15. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/consumer.py +0 -0
  16. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/context.py +0 -0
  17. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/exceptions.py +0 -0
  18. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/global_events.py +0 -0
  19. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/introspection.py +0 -0
  20. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/json.py +0 -0
  21. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/management/commands/htmx.py +0 -0
  22. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/middleware.py +0 -0
  23. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/query.py +0 -0
  24. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/repo.py +0 -0
  25. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/ext/ws.js +0 -0
  26. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.amd.js +0 -0
  27. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.cjs.js +0 -0
  28. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.esm.d.ts +0 -0
  29. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.esm.js +0 -0
  30. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.js +0 -0
  31. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/2.0.4/htmx.min.js +0 -0
  32. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/static/htmx/django.js +0 -0
  33. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/templates/htmx/headers.html +0 -0
  34. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/templates/htmx/lazy.html +0 -0
  35. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/templatetags/__init__.py +0 -0
  36. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/testing.py +0 -0
  37. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/tracing.py +0 -0
  38. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/urls.py +0 -0
  39. {djhtmx-1.2.5 → djhtmx-1.2.7}/src/djhtmx/utils.py +0 -0
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.7] - 2026-01-05
11
+
12
+ ### Changed
13
+ - The `htmx` template tag now accepts component types directly as the first parameter, automatically extracting the component name. You can now use `{% htmx MyComponent data=value %}` instead of `{% htmx 'MyComponent' data=value %}`
14
+
15
+ ## [1.2.6] - 2025-12-24
16
+
17
+ ### Changed
18
+ - The `oob` template tag now automatically converts its suffix parameter to a string, allowing non-string values (integers, floats, etc.) to be passed directly
19
+
10
20
  ## [1.2.5] - 2025-12-05
11
21
 
12
22
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djhtmx
3
- Version: 1.2.5
3
+ Version: 1.2.7
4
4
  Summary: Interactive UI Components for Django using HTMX
5
5
  Project-URL: Homepage, https://github.com/edelvalle/djhtmx
6
6
  Project-URL: Documentation, https://github.com/edelvalle/djhtmx#readme
@@ -1,4 +1,4 @@
1
1
  from .middleware import middleware
2
2
 
3
- __version__ = "1.2.5"
3
+ __version__ = "1.2.7"
4
4
  __all__ = ("middleware",)
@@ -280,6 +280,10 @@ class HtmxComponent(BaseModel):
280
280
  if "[" in component_name and "]" in component_name:
281
281
  public = False
282
282
  elif _ABSTRACT_BASE_REGEX.match(component_name):
283
+ if settings.STRICT_PUBLIC_BASE:
284
+ raise TypeError(
285
+ f"HTMX Component: {FQN[cls]} Automatically detected as non public",
286
+ )
283
287
  logger.info(
284
288
  "HTMX Component: <%s> Automatically detected as non public",
285
289
  FQN[cls],
@@ -45,3 +45,5 @@ KEY_SIZE_SAMPLE_PROB = getattr(
45
45
  "DJHTMX_KEY_SIZE_SAMPLE_PROB",
46
46
  0.1,
47
47
  )
48
+
49
+ STRICT_PUBLIC_BASE = getattr(settings, "DJHTMX_STRICT_PUBLIC_BASE", False)
@@ -73,7 +73,7 @@ def add_delay_jitter(event, arg=None):
73
73
  @register.simple_tag(takes_context=True)
74
74
  def htmx(
75
75
  context,
76
- _name: str,
76
+ _name: str | type[HtmxComponent],
77
77
  _state: dict[str, Any] | None = None,
78
78
  *,
79
79
  lazy: Literal["once"] | bool = False,
@@ -81,12 +81,16 @@ def htmx(
81
81
  ):
82
82
  """Inserts an HTMX Component.
83
83
 
84
- Pass the component name and the initial state:
84
+ Pass the component name (as a string) or component type, and the initial state:
85
85
 
86
86
  ```html
87
87
  {% htmx 'AmazinData' data=some_data %}
88
+ {% htmx MyComponent data=some_data %}
88
89
  ```
89
90
  """
91
+ # Extract component name if a type is passed
92
+ component_name = _name.__name__ if isinstance(_name, type) else _name
93
+
90
94
  state = (_state or {}) | state
91
95
  repo: Repository = context["htmx_repo"]
92
96
  state |= {"lazy": lazy is True}
@@ -94,7 +98,7 @@ def htmx(
94
98
  # Extract parent component ID from context if available
95
99
  parent_id = getattr(context.get("this"), "id", None)
96
100
 
97
- component = repo.build(_name, state, parent_id=parent_id)
101
+ component = repo.build(component_name, state, parent_id=parent_id)
98
102
  return repo.render_html(
99
103
  component,
100
104
  lazy=lazy if isinstance(lazy, bool) else False,
@@ -136,6 +140,7 @@ def hx_tag(context: Context):
136
140
 
137
141
  @register.simple_tag(takes_context=True)
138
142
  def oob(context: Context, suffix: str):
143
+ suffix = str(suffix)
139
144
  oob = context.get("hx_oob")
140
145
  context["hx_oob"] = False
141
146
  component_id = component.id if (component := context.get("this")) else None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes