Here I'm documenting ther remaining features/changes that I made in my fork that I'd want to eventually discuss.
Feature name
Description
Resolved
Fallthrough attributes
Allow to pass ad hoc key-value pairs to components as "attributes" to enable component users to configure styling and event handling. See Vue's flalthrough attributes.
[X] (added in v0.74)
HTML attribute formatting
One thing is passing ad hoc attributes to components, but other is formatting them as HTML attributes. E.g. see how django-web-components does it.
[X] (added in v0.74)
Global rendering context
Allow to specify a dict of values that should be automatically made available inside all components in given rendering run. Similar to Vue's inject/provide or React's Context/Provide
[X] (added in v0.80)
Inlined component render
Allow to render a component like a function, passing in the same args and kwargs as the get_context_data accepts. E.g. content = MyComponent.render_from_input(args, kwargs)
[ ]
Typed component inputs
When I render template with django.shortcuts.render("mytemplate.html", data), there's not typing support for what should be the fields of data. Likewise, if the "Inlined component render" was implemented, the args, kwargs would likely not be typed either. Ideally, there'd be a way to define the typing of the component input, so I get a Mypy error if I pass invalid field/type.
NOTE: We will see once we get to it, but in my experience it was easier to add typing to component inputs after enforcing that components could have ONLY kwargs instead of args + kwargs.
Here I'm documenting ther remaining features/changes that I made in my fork that I'd want to eventually discuss.
(added in v0.74)
(added in v0.74)
(added in v0.80)
get_context_data
accepts. E.g.content = MyComponent.render_from_input(args, kwargs)
django.shortcuts.render("mytemplate.html", data)
, there's not typing support for what should be the fields ofdata
. Likewise, if the "Inlined component render" was implemented, theargs, kwargs
would likely not be typed either. Ideally, there'd be a way to define the typing of the component input, so I get a Mypy error if I pass invalid field/type.NOTE: We will see once we get to it, but in my experience it was easier to add typing to component inputs after enforcing that components could have ONLY kwargs instead of args + kwargs.