Open sashafirsov opened 2 years ago
Rendering JSON
🤔 most of data are passed as non-UI friendly format, novadays mostly as JSON. Native HTML template
does not work with such. It injects HTML via slot
. How to pass the JSON data into slot?
fetch-element
approach: JSON converted into table with keys as table heading and value next to it.slotted-element
approach: inner HTML is used as template, when JSON is loaded for each key the slot with matching name is filled out.As slotted-element
is planned to be inherited form light-dom-element
, its behavior could change.
Would conversion of JSON to template-able HTML be a better approach?
For simple JSON with key:value pairs there is straight answer.
`<span slot="${key}">${value}</span>`
The row of SPANs would reflect the JSON pairs and template
would serve slots of interest.
slot
concept does not reflect the hierarchical and recurrent data structure. Can it be worked around by template
+slot
concept?
Can the template
inclusion or recursion be used for structure and repeated slots for array relation?
shadow-dom-element
is a first implementation capable of external templates with nativeTEMPLATE
andSLOT
use by web page. As such, it could serve as façade to whole concept of native templates use for developers community. Making it simple, efficient, and sexy would serve the evangelizing purpose.The Ananke site template demo for shadow and light DOM included into sources, is just a brief reference implementation which is not sufficient as bootstrap for the site and does not have a guideline.
The idea of JsonResume.org theme could be a good starting point.
shadow-
orlight-
dom-element
.Registering of such resume templates could be automated by visiting forked repos with embedded signed disclaimer. GitHub Stars or NPM stats could serve the listing priority.