feat: on_xx_loaded extension hooks (#1242)
Some checks failed
Run tests / test_sampleproject (3.13) (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.13) (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.8) (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.9) (push) Has been cancelled
Run tests / build (windows-latest, 3.10) (push) Has been cancelled
Run tests / build (windows-latest, 3.11) (push) Has been cancelled
Run tests / build (windows-latest, 3.12) (push) Has been cancelled
Run tests / build (windows-latest, 3.13) (push) Has been cancelled
Run tests / build (windows-latest, 3.8) (push) Has been cancelled
Run tests / build (windows-latest, 3.9) (push) Has been cancelled
Run tests / test_docs (3.13) (push) Has been cancelled
Docs - build & deploy / docs (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.10) (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.11) (push) Has been cancelled
Run tests / build (ubuntu-latest, 3.12) (push) Has been cancelled

* feat: on_xx_loaded extension hooks

* refactor: fix tests
This commit is contained in:
Juro Oravec 2025-06-08 17:28:10 +02:00 committed by GitHub
parent efe5eb0ba5
commit 09bcf8dbcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 720 additions and 113 deletions

View file

@ -148,6 +148,42 @@ name | type | description
`name` | `str` | The name the component was registered under
`registry` | [`ComponentRegistry`](../api#django_components.ComponentRegistry) | The registry the component was unregistered from
::: django_components.extension.ComponentExtension.on_css_loaded
options:
heading_level: 3
show_root_heading: true
show_signature: true
separate_signature: true
show_symbol_type_heading: false
show_symbol_type_toc: false
show_if_no_docstring: true
show_labels: false
**Available data:**
name | type | description
--|--|--
`component_cls` | [`Type[Component]`](../api#django_components.Component) | The Component class whose CSS was loaded
`content` | `str` | The CSS content (string)
::: django_components.extension.ComponentExtension.on_js_loaded
options:
heading_level: 3
show_root_heading: true
show_signature: true
separate_signature: true
show_symbol_type_heading: false
show_symbol_type_toc: false
show_if_no_docstring: true
show_labels: false
**Available data:**
name | type | description
--|--|--
`component_cls` | [`Type[Component]`](../api#django_components.Component) | The Component class whose JS was loaded
`content` | `str` | The JS content (string)
::: django_components.extension.ComponentExtension.on_registry_created
options:
heading_level: 3
@ -207,6 +243,44 @@ name | type | description
`slot_name` | `str` | The name of the `{% slot %}` tag
`slot_node` | `SlotNode` | The node instance of the `{% slot %}` tag
::: django_components.extension.ComponentExtension.on_template_compiled
options:
heading_level: 3
show_root_heading: true
show_signature: true
separate_signature: true
show_symbol_type_heading: false
show_symbol_type_toc: false
show_if_no_docstring: true
show_labels: false
**Available data:**
name | type | description
--|--|--
`component_cls` | [`Type[Component]`](../api#django_components.Component) | The Component class whose template was loaded
`template` | `django.template.base.Template` | The compiled template object
::: django_components.extension.ComponentExtension.on_template_loaded
options:
heading_level: 3
show_root_heading: true
show_signature: true
separate_signature: true
show_symbol_type_heading: false
show_symbol_type_toc: false
show_if_no_docstring: true
show_labels: false
**Available data:**
name | type | description
--|--|--
`component_cls` | [`Type[Component]`](../api#django_components.Component) | The Component class whose template was loaded
`content` | `str` | The template string
`name` | `Optional[str]` | The name of the template
`origin` | `Optional[django.template.base.Origin]` | The origin of the template
## Objects
::: django_components.extension.OnComponentClassCreatedContext