djhtmx 1.2.5__py3-none-any.whl → 1.2.7__py3-none-any.whl
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.
- djhtmx/__init__.py +1 -1
- djhtmx/component.py +4 -0
- djhtmx/settings.py +2 -0
- djhtmx/templatetags/htmx.py +8 -3
- {djhtmx-1.2.5.dist-info → djhtmx-1.2.7.dist-info}/METADATA +1 -1
- {djhtmx-1.2.5.dist-info → djhtmx-1.2.7.dist-info}/RECORD +8 -8
- {djhtmx-1.2.5.dist-info → djhtmx-1.2.7.dist-info}/WHEEL +0 -0
- {djhtmx-1.2.5.dist-info → djhtmx-1.2.7.dist-info}/licenses/LICENSE +0 -0
djhtmx/__init__.py
CHANGED
djhtmx/component.py
CHANGED
|
@@ -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],
|
djhtmx/settings.py
CHANGED
djhtmx/templatetags/htmx.py
CHANGED
|
@@ -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(
|
|
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
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
djhtmx/__init__.py,sha256=
|
|
1
|
+
djhtmx/__init__.py,sha256=lggPY1vL1w3aXlDiCSKNZqUXFilPRS7UpSKfv3nQAaA,84
|
|
2
2
|
djhtmx/apps.py,sha256=hAyjzmInEstxLY9k8Qn58LvNlezgQLx5_NqyVL1WwYs,323
|
|
3
3
|
djhtmx/command_queue.py,sha256=n1TERk9RmVT4dycmCroAOMLx_KXJ-HiqIA3qs_ptG7U,4884
|
|
4
4
|
djhtmx/commands.py,sha256=UxXbARd4Teetjh_zjvAWgI2KNbvdETH-WrGf4qD9Xr8,1206
|
|
5
|
-
djhtmx/component.py,sha256=
|
|
5
|
+
djhtmx/component.py,sha256=9Uhtdmpn4C6CbQYcMOwEoSHt4uPMx3VF22zEy2Gn9Y8,15988
|
|
6
6
|
djhtmx/consumer.py,sha256=kHNoXokcWaFjs5zbZAhM7Y0x7GVwwawXbxBCkP8HNA8,2839
|
|
7
7
|
djhtmx/context.py,sha256=cWvz8Z0MC6x_G8sn5mvoH8Hu38qReY21_eNdThuba1A,214
|
|
8
8
|
djhtmx/exceptions.py,sha256=UtyE1N-52OmzwgRM9xFxjUuhHTMDvD7Oy3rNpgthLcs,47
|
|
@@ -12,7 +12,7 @@ djhtmx/json.py,sha256=7cjwWIJj7e0dk54INKYZJe6zKkIW7wlsNSlD05cbXfY,1374
|
|
|
12
12
|
djhtmx/middleware.py,sha256=JuMtv9ZnpungTvQ1qD2Lg6LiFPB3knQlA1ERgH4iGl0,1274
|
|
13
13
|
djhtmx/query.py,sha256=UyjN1jokh4wTwQJxcRwA9f-Zn-A7A4GLToeGrCnPhKA,6674
|
|
14
14
|
djhtmx/repo.py,sha256=SpJK6KpxK9MraN29RvShaFt3ksifBAkv_gHUrxVkzIQ,22374
|
|
15
|
-
djhtmx/settings.py,sha256=
|
|
15
|
+
djhtmx/settings.py,sha256=Iti4LkcKBTy-dNyCZxFH_cUp56aTcXjB5ftbssWyDnU,1318
|
|
16
16
|
djhtmx/testing.py,sha256=AdZKsT6sNTsyqSKx6EmfthOIHzSAPkTquheMfg9znbk,8301
|
|
17
17
|
djhtmx/tracing.py,sha256=xkCXb7t_3yCj1PGzmQfHPu9sYQftDKwtALaEbFVnQ1E,1260
|
|
18
18
|
djhtmx/urls.py,sha256=29BMD7fm05VFXtge3fRNDZuM5v_GziDm09n88aVp2fc,3961
|
|
@@ -29,8 +29,8 @@ djhtmx/static/htmx/2.0.4/ext/ws.js,sha256=HwUYFqEZBvs7Tx0_O0Bi-Dcmg5UOMlbMdkJ2FW
|
|
|
29
29
|
djhtmx/templates/htmx/headers.html,sha256=z7r9klwBDXDyjbHrzatZeHDvXB2DaZhgu55CFbbD3d4,159
|
|
30
30
|
djhtmx/templates/htmx/lazy.html,sha256=LfAThtKmFj-lCUZ7JWF_sC1Y6XsIpEz8A3IgWASn-J8,52
|
|
31
31
|
djhtmx/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
djhtmx/templatetags/htmx.py,sha256
|
|
33
|
-
djhtmx-1.2.
|
|
34
|
-
djhtmx-1.2.
|
|
35
|
-
djhtmx-1.2.
|
|
36
|
-
djhtmx-1.2.
|
|
32
|
+
djhtmx/templatetags/htmx.py,sha256=-qFqz4T9mCJocG9XIIey81cCYwk07XUd_DMpxNdmbsM,8397
|
|
33
|
+
djhtmx-1.2.7.dist-info/METADATA,sha256=lq4p5zwNpWYNMdqwpKTPInlCZ1JXGhGUcrnZM4vniWQ,32245
|
|
34
|
+
djhtmx-1.2.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
35
|
+
djhtmx-1.2.7.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
|
|
36
|
+
djhtmx-1.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|