Implement #231 – default slot filling (#269)

* Add 'default' slot option + implicit fills; tests; docs
* Differentiate between standard fillnodes and implicitfillnodes on type lvl
* Reworking slot-fill rendering logic. Simplifying component interfact. Add new get_string_template method
* First working implementation of chainmap instead of stacks for slot resolution
* Stop passing FillNode to Component initalizer -> better decoupling
* Treat fill name and alias and component name as filterexpression, dropping namedvariable
* Name arg of if_filled tags and slots must be string literal
This commit is contained in:
adriaan 2023-05-18 14:58:46 +02:00 committed by GitHub
parent 349e9fe65f
commit 2d86f042da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 843 additions and 422 deletions

View file

@ -4,6 +4,8 @@ from django.conf import settings
from django.forms import Media
from django.http import StreamingHttpResponse
from django_components.component_registry import registry
RENDERED_COMPONENTS_CONTEXT_KEY = "_COMPONENT_DEPENDENCIES"
CSS_DEPENDENCY_PLACEHOLDER = '<link name="CSS_PLACEHOLDER">'
JS_DEPENDENCY_PLACEHOLDER = '<script name="JS_PLACEHOLDER"></script>'
@ -39,8 +41,6 @@ class ComponentDependencyMiddleware:
def process_response_content(content):
from django_components.component import registry
component_names_seen = {
match.group("name")
for match in COMPONENT_COMMENT_REGEX.finditer(content)