You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Implament something like can stache with lit-html or any backtick tag
we need to cheat a bit but can then reuse existing codebase!!!
What needs to be done
Propertys need a Name Symbol
Process the Template once with the Name Symbol
Hand over to result to can-stache.
optional but cool would be if can stache could add support for ${} === string as long as it returns strings?
Explaining why we need to use the symbol name way?!?
because a tagged template literal is a function that accepts unlimited arguments and we don't know the name of the arguments but we know the arguments, so the arguments need to get converted to its property expression via symbols, then we return the argument expression for stache and can process it.
it needs to be aware of the local scope tree.
a raw example of the algo that uses a cheat as it knows scope name
// Note this works as long as we deal with a single object as parameter for the template functionfunctionmyTemplate(scope){// we need now to look in the Lit functionreturnLit`my deep ${scope.person.name}`}constlit=(..args)=>{constliterals=args[0]// now we iterate over args[1.........Infinity]// and need to know scope.person.namereturn'my deep {{scope.person.name}}'}
The text was updated successfully, but these errors were encountered:
lit-html can-lit
To Implament something like can stache with lit-html or any
backtick tag
we need to cheat a bit but can then reuse existing codebase!!!
What needs to be done
Explaining why we need to use the symbol name way?!?
because a tagged template literal is a function that accepts unlimited arguments and we don't know the name of the arguments but we know the arguments, so the arguments need to get converted to its property expression via symbols, then we return the argument expression for stache and can process it.
it needs to be aware of the local scope tree.
a raw example of the algo that uses a cheat as it knows scope name
The text was updated successfully, but these errors were encountered: