These are chat archives for ractivejs/ractive

25th
Feb 2018
Chris Reeves
@evs-chris
Feb 25 2018 06:20
anybody have any opinions on passing setup args to directives? by which I mostly mean modifiers on custom events, but it could also apply to decorators and transitions pretty reasonably
I was looking at a swipe event that could update a variable with partial states e.g. <div on-swipeleft('.pos')="do-a-thing">swipe left to do a thing and track the swipe at .pos</div>
Paul Maly
@PaulMaly_twitter
Feb 25 2018 07:41
Maybe simple function expression: on-swipeleft=“expr(param)”
?
The same for instance methods, custom events, etc
Now for events we have: on-swipeleft=“[‘expr’, param]”
And it’s very strange syntax
Chris Reeves
@evs-chris
Feb 25 2018 07:43
that's already a valid expression that would call expr(param) when the swipe is complete
I was looking more at something that would allow a swipe event update a variable before the swipe is committed
Paul Maly
@PaulMaly_twitter
Feb 25 2018 07:44
Only for methods
Or not?
Chris Reeves
@evs-chris
Feb 25 2018 07:46
the value of the attribute is run when the event fires, but in this case, the event hasn't fired yet - but it is in progress
could be useful for other things, like a key listener that only checks certain keys
Paul Maly
@PaulMaly_twitter
Feb 25 2018 07:48
Oh, I see. I thought you want to make some unification for existing features, but it’s something new
Joseph
@fskreuz
Feb 25 2018 09:35
What would the full code look like? I fail to see what .pos is (seems like a selector... or a variable... I'm confused by syntax), and how do-a-thing is related to it.

Could it also potentially be a separate directive? Like how bootstrap uses data-attributes and ids to support functionality added by classes.

<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">

In the above case, toggling is introduced to the button by dropdown-toggle, but what to toggle is hinted by data-toggle.

Joseph
@fskreuz
Feb 25 2018 09:41
It could be like:
<div on-event="doSomething" event-options="stuff, stuff, and moarStuff">
Anatoli Radulov
@avoto
Feb 25 2018 17:22
Strangely Cloudflare returns 404 when I try to grab the latest Ractive 0.9.13 (minimized) from it... https://cdnjs.com/libraries/ractive/0.9.13 Does that make sense to anyone?
curl -i https://cdnjs.cloudflare.com/ajax/libs/ractive/0.9.13/ractive.min.js HTTP/2 404
Joseph
@fskreuz
Feb 25 2018 17:33
Not sure how CDNjs works, but consider using https://cdn.jsdelivr.net/npm/ractive/ or https://unpkg.com/ractive/ as an alternative.
Anatoli Radulov
@avoto
Feb 25 2018 17:34
Yup, already switched to https://cdn.jsdelivr.net/npm/ractive/ just thought of reporting the above. It is possible it has to do with CdnJs internal issue. Thanks!
Chris Reeves
@evs-chris
Feb 25 2018 22:11
re .pos in the event, it would be a keypath that the event plugin would update with a position during the swipe movement before the event fired. That would allow a peeking-menu-style effect as is common with material
re cdnjs, it's got to be something on their end because they even have 0.9.13 listed here
Chris Reeves
@evs-chris
Feb 25 2018 22:20
also on event args, right now to listen for an enter keypress, you have to handle checking the key in the handler that you pass in, which is fine until you want to do different things with different keys in a bunch of different places
being able to do <input on-key(10,13)="@.accept()" on-key(27)="@.cancel()" /> would be pretty cool
There's only select keys in there, but you can always add more. Goes well with Ractive's multi-event on- (i.e. <input on-enter-backspace="@.youShallNotPass()">)