Arguments for Named Slots
As an addition to #1109, it should be possible to pass data from the component to the slot. This allows better separation between integration and component when components are nested and loop over arrays passed to the outer component. All mapping can happen outside of the component, but the component is still in charge of rendering.
Template:
<my:listComponent items="{items}">
<f:fragment name="listItem" argumentsAs="item">
<my:listItemComponent title="{item.title}" link="{item.url}" />
</f:fragment>
</my:listComponent>
ListComponent.html:
<f:argument name="items" type="array" />
<ul>
<f:for each="{items}" as="item" />
<f:slot name="listItem" arguments="{item}" />
</f:for>
</ul>
Syntax isn't final yet, there might be better ways to provide multiple arguments to the slot.
Thinking this a bit further... It would be awsome to be able to define arguemnts in slots and not fall back to an "array" of typeless values.
<my:listComponent items="{items}">
<f:fragment name="listItem">
<my:listItemComponent title="{title}" link="{url}" />
</f:fragment>
</my:listComponent>
<f:argument name="items" type="array" />
<ul>
<f:for each="{items}" as="item" />
<f:slot name="listItem" title="{item.title}" url="{item.url}">
<f:argument name="title" type="string" />
<f:argument name="url" type="string" />
</f:slot>
</f:for>
</ul>
@sascha-egerer In general, I like the added type definitions there. However, I'm not sure about the arbitrary arguments to <f:slot /> mixing with name (and possible future built-in arguments?).