These are chat archives for ractivejs/ractive

20th
Oct 2017
Chris Reeves
@evs-chris
Oct 20 2017 00:13
@fskreuz reserved partial names? For async components? If so, no. It makes up the vdom node on the fly without having to hit the partials registry.
Joseph
@fskreuz
Oct 20 2017 00:29
Was looking at
<SomeComponentThatIsAsync>
  {{#partial async-loading}}Loading...{{/partial}}
</SomeComponentThatIsAsync>
at first glance, async-loading looks like a predefined name for a loading status content :D
Chris Reeves
@evs-chris
Oct 20 2017 00:30
Ah. Yes, special names kinda like content.
Joseph
@fskreuz
Oct 20 2017 00:31
:thumbsup:
Chris Reeves
@evs-chris
Oct 20 2017 00:32
I figure those are relatively unlikely to clash 😀
Chris Reeves
@evs-chris
Oct 20 2017 05:49
would you say async components are worth ~1000b on the minified build?
kouts
@kouts
Oct 20 2017 06:54
Async components is an important feature so I think they worth it!
I don't understand the question about the promise though :blush:
Chris Reeves
@evs-chris
Oct 20 2017 08:00
I think I explained it slightly better on the pr. Basically if r.toggle('foo') triggers an async component to load, should the promise returned from the set also wait on the component promise?
kouts
@kouts
Oct 20 2017 08:09
I see, I don't see the reason why the set operation to wait
I think it's ok
Cerem Cem ASLAN
@ceremcem
Oct 20 2017 15:30
+1 for async-loading (or something like that) as a special partial name for loading content
Chris Reeves
@evs-chris
Oct 20 2017 17:56
anyone have any opinions on slots? The {{#partial name}}...{{/partial}} syntax for passing template to elements, while better than <!-- {{>name}} -->...<!-- {{/name}} -->, feels a bit cumbersome. I feel like maybe having a designated element for passing template would fit better, though slot is really for the other direction.
Perhaps a component should be able to request that certain top-level elements automatically be converted to a set of partials - one for the content and one for the attrs, kinda like components can request that certain attrs be treated normally while others are collected into extra-attributes?
Chris Reeves
@evs-chris
Oct 20 2017 18:11
To clarify slightly, I was thinking something like <tabs><tab title="tab 1">...</tab><tab title="tab 2">...</tab></tabs> would request that top-level tab elements get turned into partials. I have some material-ish components that I will eventually publish that do just that, but manually in construct.
Joseph
@fskreuz
Oct 20 2017 19:44
I thought named yields === slots?
That's how I'm using them really. :D
Chris Reeves
@evs-chris
Oct 20 2017 19:44
they are
I was looking at the other side... providing content for the slots
providing/collecting bits of template for a component seems like a rough edge
Joseph
@fskreuz
Oct 20 2017 19:51
I do find sticking {{#partial }} for all the things a bit weird. :D
It's like Ractive's multi-purpose tool to solve everything.
Chris Reeves
@evs-chris
Oct 20 2017 19:52
partial all the things
Joseph
@fskreuz
Oct 20 2017 19:55
I think I've asked this question before, but why does {{ yield }} not have a prefix? i.e. {{>yield }}, {{>yield name}}, {{#yield }} or {{#yield name}}? And can {{# yield }}something default{{/yield}} be a thing?
I've always thought that anything with {{# }} is special, but {{ yield }} was the outlier.
Chris Reeves
@evs-chris
Oct 20 2017 19:56
I'm not entirely sure why there's no sigil. It came into being before I could successfully read the code :)
{{#...}} is for blocks
{{yield}} isn't a block (nor is {{>partial}}), so they don't get to hash
Joseph
@fskreuz
Oct 20 2017 19:57
Ahh
I think that's how it was explained (I need a refresher course :D )
Chris Reeves
@evs-chris
Oct 20 2017 19:59
I think the idea on default content is that you supply the partial for the default in the usual registry manner and anything passed in wins
so partials: { thing: 'nothing to see here' } {{yield thing}}
with <cmp />, you get nothing to see here and <cmp>{{#partial thing}}thing here{{/partial}}</cmp> gets you thing here
it's not particularly pretty - a rough edge
Joseph
@fskreuz
Oct 20 2017 20:01
So it's this ability of partials that makes it very versatile. I see.
Chris Reeves
@evs-chris
Oct 20 2017 20:02
yep, partials are what make ractive awesome for me
well, that and the built-in binding
you have to be careful yielding a default though, because of the context
yielding was originally only allowed on inline partials for that reason, but that means you also couldn't have partials defined on the fly to be yielded
I've considered swapping {{yield}} for <slot />, but I quite like the aliasing ability of {{yield}}, so I'm not sure that that would play out perfectly
Chris Reeves
@evs-chris
Oct 20 2017 20:07
I definitely don't like the way slots are filled in custom elements though e.g. <custom><span slot="name">slot content</span></custom>
seems like there should be an element that is paired with slot, like fill or something
any old element with a slot attribute feels weird
Joseph
@fskreuz
Oct 20 2017 20:33
yeah, slot attribute is weird.
At least ng2/4/whatever does it somewhat similar to ractive.
Sometimes I wonder what goes in the minds of the people making these standards :D
Chris Reeves
@evs-chris
Oct 20 2017 20:36
has ng gotten away from the whole transcluding cycle of directive digests? I last looked at it around 1, if you couldn't tell
indeed! there're lots of "but, why?" bits of the custom element spec
supposedly it's the future of components though, so I suppose we'll have to address it at some point
there are some neat things with shadowing, but the rest is a bit of a head scratcher to me
why do you want to require js for elements that look like they're built in... at that point, aren't you basically just templating anyhow?
Joseph
@fskreuz
Oct 20 2017 20:38
:D
Joseph
@fskreuz
Oct 20 2017 21:09
Just for laughs but the ractive version of the slots example probably has lesser js :D https://jsfiddle.net/e3waz9ou/
if you discount the library and the fact that yields can't do default content :D
Chris Reeves
@evs-chris
Oct 20 2017 21:14
nice!
runs on ie9 :laughing:
also, you can safely default content-only partials: https://jsfiddle.net/e3waz9ou/1/
I've not seen a details element prior to this... interesting
I guess that's a sort of native accordion block
Chris Reeves
@evs-chris
Oct 20 2017 21:19
and yeah, the worst-looking part of that is the {{#partial ...}} stuff, which is not too bad, I suppose
Joseph
@fskreuz
Oct 20 2017 21:23
Actually, I also didn't even know about <details> and <summary> until today :D
#TIL :D
{{#partial }} isn't too bad :D
In-template partial declarations ftw! https://jsfiddle.net/e3waz9ou/2/