Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better slots and component composition. #39

Closed
wants to merge 1 commit into from
Closed

Better slots and component composition. #39

wants to merge 1 commit into from

Conversation

TheComputerM
Copy link

Rendered

This is my first RFC so please comment any helpful suggestions.

@TheComputerM
Copy link
Author

Somewhat like sveltejs/svelte#4556

@lukeed
Copy link
Member

lukeed commented Sep 30, 2020

I was just going to link that – what are the differences? It looks like this is implemented as described

@TheComputerM
Copy link
Author

This is still incomplete and I am brain storming on better syntax.
The goal of it is to provide a more svelte like syntax and some additional features also such as slot options:

<Component>
  <svelte:fragment dense={true}>
    This will do something in the component
  </svelte:fragment>
</Component>

@lukeed
Copy link
Member

lukeed commented Sep 30, 2020

Wouldn't slots just be a portal for where to render? The contents of what is rendered is determined by the content itself.

As far as I understand it, this RFC seems to be mostly about using svelte:fragment to render text nodes (non-component and non-element) with siblings.

I have an RFC open about inheriting <slot/> attributes (#15)
But (imo) if you're passing dense={true} so that the slot can react/alter its display, then I think that falls more into svelte:template territory (#34).

But, I might be misunderstanding you completely. I'm sorta guessing at the examples

@TheComputerM
Copy link
Author

Yeah, sorry for the short explanation. Was thinking more on the lines of something like this:
The syntax is just for better understanding.

<svelte:slot tag={ListItem} export:dense on:click={func}>
  Default
</svelte:slot>
<svelte:fragment dense={true}>
  Content
</svelte:fragment>
<ListItem dense={true} on:click={func}>
  Content
</ListItem>

@TheComputerM
Copy link
Author

This was mainly intended to solve sveltejs/svelte#2079 and add some new features.

@lukeed
Copy link
Member

lukeed commented Sep 30, 2020

No problem

Yeah, to me that's 100% an inline component, if not an external component. Either of which only get placed by a <slot>

@TheComputerM TheComputerM marked this pull request as draft October 8, 2020 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants