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

[Question] Some questions about design #4

Open
Angelinsky7 opened this issue Mar 18, 2021 · 3 comments
Open

[Question] Some questions about design #4

Angelinsky7 opened this issue Mar 18, 2021 · 3 comments
Labels
question Further information is requested

Comments

@Angelinsky7
Copy link

Hi,
i would like to add the support of the html syntax to your package (it seems possible with blade)
the idea would be to use it like that (because i don't think we can override for sure the <x-slot></x-slot> parser before it occurs)

<x-scoped-slot name='row' context='$item'>
</x-scoped-slot>

to create this

@scopedscope('header', '$item')
@endscopedscope

so my questions :

  1. I would like to understand why you use this syntax : ($item) for the variables, i don't see any benefit and if we want to pass multiple variables we could pass an array in the call of the parent.
  2. What kind of other variables do you need inside the scope ? Why can't we use the $component variable to access the parent component ? What is the benefit to add more things to pass thought ?

Thanks for your answers !

@Angelinsky7 Angelinsky7 changed the title [Question] Some question about design [Question] Some questions about design Mar 18, 2021
@konradkalemba
Copy link
Owner

Hi 👋

Thanks for your interest in contributing to the package. It was created before the syntax of <x-slot> was introduced to Laravel. It would be great if the package could support the <x-scoped-slot> syntax as well, so you are willing to add it I would be happy. :)

Regarding your questions:

  1. I did use that syntax to allow users to pass multiple variables to the slot. For example it can be used like this ($item, $odd = false) .
  2. If you're thinking about the third, optional argument of scoped slot -- honestly I don't remember. :D I definitely had some use case for that back when I was creating this package but I had forgotten it by now. However I think it's a good thing to support anyway.

If you have further questions I'd be happy to answer them.

@konradkalemba konradkalemba added the question Further information is requested label Mar 21, 2021
@Angelinsky7
Copy link
Author

Thanks for your answer @konradkalemba
the first thing to note is that <x-scoped-slot> won't be possible, due to the fact that custom pre-compiler will trigger only after the <x-> blade syntax. (and thus create a ComponentNotFoundException)
so we must change this syntax and choose something else like : <ext-scoped-slot> or something like that. (ext for x-extention, for example).
What would be your preferences ?

@konradkalemba
Copy link
Owner

@Angelinsky7 That's a shame it isn't possible to use <x-scoped-slot>.

Are there any more limitations for naming? For example can we name it just <scoped-slot>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants