These are chat archives for ractivejs/ractive

28th
Aug 2017
Chris Reeves
@evs-chris
Aug 28 2017 19:57
random question of the day: have you ever wanted to create programmatic mappings from your components?
I've been doing it a bunch recently, and it's also a solution to #3067, but the currently available method is not, shall we say, pretty
Joseph
@fskreuz
Aug 28 2017 20:37
Not me. I prefer mine declared in advance (i.e. templates) than on-the-fly wiring. Much verbose, so wow, doge... :grin:
Chris Reeves
@evs-chris
Aug 28 2017 21:00
I typically do too, but lately I've been doing whacky stuff, like pulling options of sub-elements in component content and making them both bindable and viewable from the component template
if you need it to be bindable, a yield won't get you where you need to be
but if you throw it into a generated mapping, you have it
<tabs><tab disabled="{{.tab1active}}" title="a tab">stuff in the tab</tab><tab title="moar">...<tab></tabs>
Chris Reeves
@evs-chris
Aug 28 2017 21:06
you can't do {{#if yield tab.disabled}}class-disabled{{/if}}, so you have to turn it into mapping, which I do, storing the generated mapping name in the generated tab data and reference with something like {{#if ~/conditions[.disabled]}}
so in a way it's both declared in advance and on-the-fly
in effort to have more user-friendly components that can be both declarative and imperative with both template and api to manage stuff
Joseph
@fskreuz
Aug 28 2017 21:08
ahh