Stimulus alias processor for PJX
Project description
pjx-stimulus
Stimulus extension for PJX.
This package provides StimulusExtension, which adds Stimulus-friendly aliases
like stimulus:controller and stimulus:target to PJX templates, and injects
the Stimulus browser script on full HTML pages. Install it directly, or use
pjx[stimulus].
Installation
pip install pjx-stimulus
# or
pip install pjx[stimulus]
What It Adds
stimulus:controller="dropdown"->data-controller="dropdown"stimulus:action="click->dropdown#toggle"->data-action="click->dropdown#toggle"stimulus:target="menu"->data-dropdown-target="menu"stimulus:value-name="foo"->data-dropdown-name-value="foo"
The processor tracks active controllers so target, value, class, and
outlet aliases resolve to the correct data-* attribute.
Example
<div stimulus:controller="dropdown">
<button stimulus:action="click->dropdown#toggle">Menu</button>
<div stimulus:target="menu">Content</div>
</div>
Compiles to:
<div data-controller="dropdown">
<button data-action="click->dropdown#toggle">Menu</button>
<div data-dropdown-target="menu">Content</div>
</div>
Extension
StimulusExtension implements the PJXExtension ABC. It is discovered
automatically via the pjx.extensions entry point when the package is
installed:
[project.entry-points."pjx.extensions"]
stimulus = "pjx_stimulus.extension:StimulusExtension"
You can also register it explicitly:
from pjx import PJXEnvironment
from pjx_stimulus.extension import StimulusExtension
env = PJXEnvironment(
loader=FileSystemLoader("templates"),
extensions=[StimulusExtension()],
)
Browser Asset Injection
On full HTML pages, PJX auto-injects the Stimulus browser script when it
detects Stimulus data-* attributes. To vendor the asset locally instead of
using a CDN:
pjx assets build static/vendor/pjx --provider stimulus
Links
- Repository: https://github.com/oornnery/pjx
- Core package: https://pypi.org/project/pjx/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pjx_stimulus-0.1.1.tar.gz.
File metadata
- Download URL: pjx_stimulus-0.1.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcf6ad76758ac1d0eacc39c6ce8fc8e62ab732f0e2eedf2f25d463caee748352
|
|
| MD5 |
b09010732b6de2224e7c36b02d8bd5e3
|
|
| BLAKE2b-256 |
446f58e99208e36d933aed0f4fe5c2ab0a9588607820b5acb1bbfde5acd47cec
|
Provenance
The following attestation bundles were made for pjx_stimulus-0.1.1.tar.gz:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_stimulus-0.1.1.tar.gz -
Subject digest:
bcf6ad76758ac1d0eacc39c6ce8fc8e62ab732f0e2eedf2f25d463caee748352 - Sigstore transparency entry: 1239424054
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pjx_stimulus-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pjx_stimulus-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c502049ac2043c5f4c2dd56d0ed1e23d9154c40fd78f0023a15472a025785bd7
|
|
| MD5 |
61c22ef6e0ac7db5313b72a20da72ee3
|
|
| BLAKE2b-256 |
8525f1c4cfc88bc6e9e51fc8cd763aa91463248fb58cb44649ab1fe0a7b5eae7
|
Provenance
The following attestation bundles were made for pjx_stimulus-0.1.1-py3-none-any.whl:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_stimulus-0.1.1-py3-none-any.whl -
Subject digest:
c502049ac2043c5f4c2dd56d0ed1e23d9154c40fd78f0023a15472a025785bd7 - Sigstore transparency entry: 1239424060
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type: