the type of the Custom Element
The type of the template parameters.
This API is dedicated for developer of Builders.
Decorates the render method.
Forces the rendering into the Grey DOM.
TemplateBuilder.shadow and TemplateBuilder.grey are exclusives. TemplateBuilder.preserveContent and TemplateBuilder.grey are exclusives.
Overrides the default render method name.
the render method name
Set render parameters.
the parameters
Preserve attributes of the Custom Element from rendering processes coming from ancestors.
the names of the attribute
Prevent mutations on the Custom Element content from rendering processes coming from ancestors.
TemplateBuilder.preserveContent and TemplateBuilder.grey are exclusives.
Forces the rendering into the Shadow DOM.
TemplateBuilder.shadow and TemplateBuilder.grey are exclusives.
when true the focus will be delegated to the shadow DOM
Provides a fresh builder.
the type of the Custom Element
The type of the template parameters.
Generated using TypeDoc
The builder handles the integration of a templating solution to update the content of the Custom Element.
Firstly, the integration of the templating solution has to be defined in a method, by default the method name is
render
. The implementation of the method (i.e. the methodrender
) must return an instance of Template.Secondly, the render method is wrapped by the builder in order to render the Template once returned. That means, each time the render method is invoked, the returned Template is rendered automatically. The wrapping is also responsible to select the right destination of the template: Light DOM vs Shadow DOM.
By default, the template is rendered into the Light DOM of the Custom Element. However, the builder can render the template into the Shadow DOM with TemplateBuilder.shadow. Another switch, TemplateBuilder.grey can be used to force the rendering into a scope.
If the scope is not required, the Custom Element content can be simply preserve from ancestral rendering process with TemplateBuilder.preserveContent.
Attributes can also be preserved from ancestral rendering process with TemplateBuilder.preserveAttributes.
By default, the name of the wrapped method is
render
. However, the name can be changed with TemplateBuilder.method.When a Template is rendered, template parameters can be provided to the Template.render method. The template parameters can be set with TemplateBuilder.parameters.
The library provides a built-in template solution: html.
Finally, the builder can be registered using the method ElementBuilder.builder of the main builder (i.e. ElementBuilder). However, it can also be registered with the decorative style using the decorator TemplateBuilder.decorate.