Just a random idea:
What if we used dynamic objects (I hope this is possible with Clay objects) to describe html markup? Let me show an example:
Instead of writing this in a view:
<input type="text" name="field">
We would write something like this:
There wouldn't be actual templates hard-coded for every html element, such expressions would be resolved with some kind of "reflection", as it's today with shapes, to give the same result as above.
ClayHtml.input(type: "text", name: "field")
The benefit would be that this way additionally to the tree of shapes we would get the tree of markup (practically the DOM on the server-side); that means, parts of the markup could be modified without overriding a whole shape.
What I would have done with this technique is the changing of a select box of a form in another part. I wanted to change the select to a hidden field as I wanted a value to be given programmatically, unnoticed by the user. AFAIK this can be done by overriding
the whole editor shape of the part in question (and copy-pasting the code still required), or hiding the field with JS. I've chosen the latter one, although it's not something I would recommend.
I know the new Forms module does something like this with forms, but what about being able to do everything with dynamic objects?
What do you think?