These are chat archives for ractivejs/ractive

13th
Jan 2018
Paul Maly
@PaulMaly_twitter
Jan 13 2018 09:40
@evs-chris what is interpolator plugin?https://ractive.js.org/plugins/#interpolators
Have we somewhere any description of this feature?
Juan C. Andreu
@andreujuanc
Jan 13 2018 13:31
Dumb question. Do components get instanciated? Or they are reused? If I have +1000 copies of the same component, should I move some logic to helper functions?
Should I preparse the template?
Paul Maly
@PaulMaly_twitter
Jan 13 2018 13:43
I think yes, I always use preparsed templates (ready to use AST).
Component is js constructor. So, each component in markup become an instance of this constructor like this: new MyComponent()
Paul Maly
@PaulMaly_twitter
Jan 13 2018 13:50
I don't think so, that it's good idea to use +1000 copies (instances) of component in Ractive. I think components in Ractive not the same thing as in React, for example. You can use partials to make these things cheaper.
Chris Reeves
@evs-chris
Jan 13 2018 15:56
I'm not sure where the interpolator plugins thing came from or what it's supposed to be. Afaik there no such construct.
and yes, using thousands of component instances can be quite expensive, whereas partials are only slightly more expensive than regular template
Paul Maly
@PaulMaly_twitter
Jan 13 2018 16:07
Maybe interpolator plugins supposed to be a way to doing such things like: {{#await /}} but by 3rd party devs?
Chris Reeves
@evs-chris
Jan 13 2018 16:09
I don't think so, because in ractive terms only a {{...}} is an interpolator, and {{#...}} is a block
I'm thinking maybe it was meant for filters/helpers, which ractive doesn't have
though helpers are in proposed changes related to computed props
Joseph
@fskreuz
Jan 13 2018 16:35
Yup. There is such a thing as interpolators in Ractive, but they were previously undocumented and no plugins actually exist of that nature. I'll check it out and write documentation about it.
Fun fact: there's only one unit test written for it. :tada:
Chris Reeves
@evs-chris
Jan 13 2018 16:45
ohhhhhhh
those interpolators!
I've actually written one before
Joseph
@fskreuz
Jan 13 2018 16:47
I also confuse them with easings btw :D
Chris Reeves
@evs-chris
Jan 13 2018 16:47
takes a css color of some sort and tweens to another case color of some sort
so easing takes a time point and adjusts it from linear to whatever, and the interpolator takes that time code and converts it into an intermediate value based on the start and end values
Joseph
@fskreuz
Jan 13 2018 16:51
:thumbsup:
I see interpolators take a from and to, while easings take an x to return a y. Does that mean interpolators use easings for each value from from to to?
Chris Reeves
@evs-chris
Jan 13 2018 16:53
indeed they do, but not directly
Joseph
@fskreuz
Jan 13 2018 16:54
:thumbsup:
Chris Reeves
@evs-chris
Jan 13 2018 16:55
I believe both return functions that take a single decimal between 0 and 1 (well, maybe just outside of that for bouncy easings) as their only input and return a corresponding value
Joseph
@fskreuz
Jan 13 2018 17:16
Ahh, got it the other way around. Easing gets called first, then interpolator. Each tick, easing gets called to translate a step (0-1) into progress (a bouncy 0-1). Then given that progress, interpolator gets called to translate progress to a value (translates progress in terms of from and to).
Interesting...
Paul Maly
@PaulMaly_twitter
Jan 13 2018 17:28
I'm thinking maybe it was meant for filters/helpers, which ractive doesn't have
though helpers are in proposed changes related to computed props
Hm, what difference between helpers/filters and: data: { foo: () => {} }
?
I always believe that it actually is helpers/filters in Ractive style
I'll check it out and write documentation about it.
It'll be very nice, thx!
Paul Maly
@PaulMaly_twitter
Jan 13 2018 17:34
:+1:
Chris Reeves
@evs-chris
Jan 13 2018 18:04
helpers are the same thing effectively, but with no nesting, so no need to prefix
and also more easily installed in Ractive.defaults
some people really hate functions in their data, apparently
Joseph
@fskreuz
Jan 13 2018 18:22
Interpolator and updated ractive.animate docs will be up in a few. :tada:
Chris Reeves
@evs-chris
Jan 13 2018 18:25
👌
Paul Maly
@PaulMaly_twitter
Jan 13 2018 21:33
:+1: