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

Any thoughts about components? #7

Open
azazel75 opened this issue Mar 25, 2024 · 4 comments
Open

Any thoughts about components? #7

azazel75 opened this issue Mar 25, 2024 · 4 comments

Comments

@azazel75
Copy link

What's your idea of reusability across views? any thoughts on something similar to https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html?

@ogrodnek
Copy link
Owner

@azazel75 Yes, I'd definitely love to have a component and live component implementation, just haven't gotten to it yet...

Even shorter term, template includes (which don't currently work) are high on the list of things to implement.

@azazel75
Copy link
Author

azazel75 commented Apr 8, 2024

That's a bummer! The custom templates are needed because of the diffing protocol, like in the original LiveView?

@ogrodnek
Copy link
Owner

ogrodnek commented Apr 9, 2024

Yup, that's right, we need to generate a tree of statics and dynamics for the diffs and to integrate with the client-side JS (I'm using the same Phoenix Liveview client side JS).

The library I'm currently using as the basis (https://github.com/dmulholl/ibis), does support includes already (for generating strings), I just haven't yet hacked in the statics/dynamics support.

I'm hoping if https://peps.python.org/pep-0501/ get implemented, it would be easier to also generate the tree we needed from python code (in addition to templating).

Theoretically, we could support another templating library if the library had support for generating some kind of parse tree instead of just output text...

@ogrodnek ogrodnek changed the title Any toughts about components? Any thoughts about components? Apr 9, 2024
@ogrodnek
Copy link
Owner

ogrodnek commented Sep 4, 2024

Quick update on this, I did add some initial support for template includes (you can see an example here: https://github.com/ogrodnek/pyview/blob/main/examples/views/includes/includes.html#L1 ), and more details on template includes in the ibis template include docs, so now there is a mechanism to reuse markup across views.

I do still plan to add support for "live components" (Ala phoenix LiveView https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html ) which encapsulate state in addition to markup and can handle events at some point...

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

No branches or pull requests

2 participants