Looking at what mods like AFS do as an example, there is probably a good case to make for lightweight "templates" that are not as sophisticated as custom views but can help promote reuse within complex views and reduce repetition.
For example, there is the problem that FormBuilder tries to solve in code. We have a pretty regularized form with:
Section labels
Rows containing:
A label with constant size, padding, margins, etc.
Some sort of form control
A tooltip on the label or entire row
This doesn't work so well with *repeat because it just isn't a single repeating data source, it's an entire context with different properties (of different types) and each property corresponds to a row. They just happen to be formatted in a uniform way for usability or familiarity purposes.
Templates would help with this. A hypothetical grammar would involve a <template> element with attribute replacement and <outlet> sub-elements where additional content could be injected. Similar to normal layout views, could support both default and named outlets.
With a long form, this becomes vastly easier to read and organize than the non-templated equivalent repeating the same margins, layouts, paddings, etc. over and over again.
Some rules probably have to be established for sanity:
<template> can only appear at the document root level
<outlet> can only appear in a <template> (obviously)
Templates are local to the view that created them
Names have be valid tags and can't conflict with built-in tags (or else use a separate element to instantiate templates)
Attribute replacement happens before binding, and templates are effectively inlined; the ViewNodeFactory sees a perfectly ordinary Document without any templates or mysterious & style bindings.
Outlets with no corresponding content are removed entirely.
Looking at what mods like AFS do as an example, there is probably a good case to make for lightweight "templates" that are not as sophisticated as custom views but can help promote reuse within complex views and reduce repetition.
For example, there is the problem that
FormBuilder
tries to solve in code. We have a pretty regularized form with:This doesn't work so well with
*repeat
because it just isn't a single repeating data source, it's an entire context with different properties (of different types) and each property corresponds to a row. They just happen to be formatted in a uniform way for usability or familiarity purposes.Templates would help with this. A hypothetical grammar would involve a
<template>
element with attribute replacement and<outlet>
sub-elements where additional content could be injected. Similar to normal layout views, could support both default and named outlets.Example:
With a long form, this becomes vastly easier to read and organize than the non-templated equivalent repeating the same margins, layouts, paddings, etc. over and over again.
Some rules probably have to be established for sanity:
<template>
can only appear at the document root level<outlet>
can only appear in a<template>
(obviously)ViewNodeFactory
sees a perfectly ordinaryDocument
without any templates or mysterious&
style bindings.