jonassiewertsen / statamic-livewire

A Laravel Livewire integration for Statamics antlers engine
91 stars 16 forks source link

Drop Antlers support after all? #39

Closed aerni closed 1 year ago

aerni commented 1 year ago

Given the latest addition of the @antlers Blade directive, I'm very curious if there is any reason to keep supporting Antlers with this addon? I've been exclusively using Blade with Livewire for a while, because Antlers is just too limiting in some advanced scenarios. With Antlers you also have to rebuild Livewire features as tags, e.g. entangle. With the new @antlers directive, you can have the best of both worlds.

Just opening the discussion around this topic. I haven't done any testing. In theory, this addon could be reduced to a simple tag to include a Livewire component in an Antlers view.

edalzell commented 1 year ago

In theory, this addon could be reduced to a simple tag to include a Livewire component in an Antlers view.

With the new tag do you even need this package, cuz then it would be the same as this? https://github.com/Stillat/antlers-components#livewire-components

aerni commented 1 year ago

That's an excellent point. I wasn't aware of that addon. Curious to hear Jonas' thoughts.

jonassiewertsen commented 1 year ago

This has been my wanted approach in the first place, but I got the response that people want to use Livewire wirh Antlers. So here we are 😇

https://github.com/jonassiewertsen/statamic-livewire/issues/31#issuecomment-1663723833

jonassiewertsen commented 1 year ago

On top of that: This addon brings synthesizers in a experimental state to the table.

I am unsure how and if it‘s getting used, but it offers a great value to the comunity on seeing how it works.

with those provided it‘s easy to copy, paste and adjust as needed, if helpful in your application.

jonassiewertsen commented 1 year ago

That's an excellent point. I wasn't aware of that addon. Curious to hear Jonas' thoughts.

Yes. If not using Livewire with blade or if not using synthesizers, you don‘t need this package for livewire to work wirh auto registering those tags (which feature i dont like that much. Too much magic)

edalzell commented 1 year ago

So this addon could be a wrapper around the blade directive and synthesizers for the data, like Entry, Term, etc

marcorieser commented 1 year ago

@edalzell @aerni just a quick note. The antlers components package depends on this one (at least the Livewire part and at least for now).

robdekort commented 1 year ago

How would the proposed thing work? You would use blade components, wrapping all Antlers in Antlers tags so you can write Antlers, except the parts where you use entangle etc? Or am I misunderstanding?

Me not following along with this discussion, makes me wonder - and a bit frightened for - how complex this proposed solution could be, but I really can't judge this stuff as I really don't understand it. However, I remember Marco explaining to me you can already use Livewire magic like entangle and this by using the Alpine code it translates to when using the Blade directives for them. One thing I should probably do is try Blade for my next Livewire component. 😬

Last but not least, of course I don’t want to burden anyone with the maintenance Antlers would require.

jonassiewertsen commented 1 year ago

Thanks for all the feedback and thoughts on this question. I appreciate the discussion and the honesty in this discussion. ❤️

It feels like this discussion is about the meaning of this addon. What should it achieve? What should it be good at? Where should it help to do its magic, and where don't?

In my eyes, this is a solid request, but it does not serve the purpose of this addon and is against what this addon always did and what it's being used like by the community: https://github.com/jonassiewertsen/statamic-livewire/issues/31#issuecomment-1663723833

It has been its key feature to support Livewire in Antlers because this is simply beautiful and simple. I want to keep that simplicity.

You can use the @antlers blade directive of course, which i a nice way to do so. You need to know Blade, though. Not everybody working with Statamic does or does not want to mix Antlers and Blade, especially for simple Livewire tasks.

The synthesizers are nice too. Everybody should feel free to use the one from this addon as a great starting point and adjust those depending on your needs. If you want to. Feel free to add more of those via a PR, if you are using them and want to use them in the future. Disabling those as default does avoid overhead by not loading them at all. So it will not slow down your application.

I feel best by keeping the antlers syntax, as it's simply beautiful and if you need a complex setup with blade only, you can avoid this addon completely if you want. So I don't see those two ways fighting each other, I only see this addon helping out if you want it to.

Using entangle and this does not work with Antlers at the moment. This might be an improvement, but maybe it's fine too?

I'll keep this Issue open for the next couple of days. Feel free to try changing my mind. At this point in time, I like having the Antlers support. Feel free adding to this discussion with your own opinion.

marcorieser commented 1 year ago

Using entangle and this does not work with Antlers at the moment. This might be an improvement, but maybe it's fine too?

How do you mean? I believe these two are working.

jonassiewertsen commented 1 year ago

With Antlers you also have to rebuild Livewire features as tags, e.g. entangle.

Haven't used them with the Antlers syntax myself. So it's just something missing in the docs?

marcorieser commented 1 year ago

With Antlers you also have to rebuild Livewire features as tags, e.g. entangle.

Haven't used them with the Antlers syntax myself. So it's just something missing in the docs?

https://github.com/jonassiewertsen/statamic-livewire#this-accessing-the-livewire-component https://github.com/jonassiewertsen/statamic-livewire#entangle-sharing-state-between-livewire-and-alpine

jonassiewertsen commented 1 year ago

😂 perfect! I should read that documentation more often myself.

In that case I don't know about any edge cases, where there are issues with entangle or why this needs to be rewritten. I am sure @aerni has a solid point, but I am not aware of open issues in that case, as the last entangle issue has been resolved.

https://github.com/jonassiewertsen/statamic-livewire/issues/7

aerni commented 1 year ago

I was using @entangle as an example for Blade directives that would need to be ported to Antlers. I don't have a particular use case in mind. I just found it interesting that you can now use Antlers within Blade using the new @antlers directive. This got me thinking about why we need to copy the Blade functionality into Antlers tags.

But your point is fair! In my opinion, this addon's place is to have a great integration with Statamic and Livewire, like the experimental synthesizers. If people find the Antlers tags useful, then there's no reason to remove them.