Open marcushellberg opened 6 years ago
If Flow in any case reads through the HTML template (as it must), it can surely scan for custom elements used and auto-import them. (@PolymerImport("vaadin-button")
did not add more info than what is already visible from the HTML)
We can even go slightly further without introducing very much additional magic:
@Tag
and @HtmlTemplate
can by default be derived from the class name.@PolymerImport
can in many cases be derived from the contents of the the actual template file, even though there are some tricky cases:
<vaadin-password-field>
should import vaadin-text-field/vaadin-password-field.html
bower_components
and the application's own elements that would be outside bower_components
.<dom-repeat>
that don't need any special import (even though it doesn't really hurt to import lib/elements/dom-repeat.html
)Some other observations:
<dom-bind>
instead of <dom-module>
, thus further simplifying things by not registering a custom element and not wrapping the contents in a shadow root.src/main/webapp
. This does on the other hand mean that the file would have to be moved to a different location in the file system if you would for any reason want to "upgrade" it to a standalone template.I would consider this as an actual replacement for CustomLayout. (thumbs up)
I want to be able to create an HTML template with data binding, without having to define a full-blown Polymer element with all its boilerplate. This should be an alternative to the current way of always requiring a full element.
I think that this would simplify a majority of use cases. It would also make the choice of doing mixed client/server development more explicit.
Enabling HTML templates without Polymer boilerplate would also make migrating to Polymer 3 easier, as no end user code is explicitly using it.
Mockup code for how I would like this to work:
MyElement.java:
my-element.html. Only the content of the
<template>
tag, Flow would take care of actually wrapping this up in a custom element.I'm not sure how template dependencies should be handled. Here, I mocked it with
@PolymerImport()
.