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

"JS" Command Hooks #215

Open
mobile-bungalow opened this issue Oct 28, 2024 · 2 comments
Open

"JS" Command Hooks #215

mobile-bungalow opened this issue Oct 28, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request parity Used to note places where LVN is trying to achieve parity with vanilla live view.

Comments

@mobile-bungalow
Copy link
Contributor

Vanilla Live View exposes several utility commands that can be used to run local, optimistic changes when an even is about to be sent to the server.

To implement this we need to instrument the VDOM to emit local events which optimisitcally remove, mutate and insert elements. These will be valid until otherwise reverted by server side diffs.

@mobile-bungalow mobile-bungalow added enhancement New feature or request parity Used to note places where LVN is trying to achieve parity with vanilla live view. labels Oct 28, 2024
@mobile-bungalow mobile-bungalow self-assigned this Oct 28, 2024
@bcardarella
Copy link

I'll break these into individual issues but here is the list of commands:

  • add_class - Add classes to elements, with optional transitions
  • remove_class - Remove classes from elements, with optional transitions
  • toggle_class - Sets or removes classes from elements, with optional transitions
  • set_attribute - Set an attribute on elements
  • remove_attribute - Remove an attribute from elements
  • toggle_attribute - Sets or removes element attribute based on attribute presence.
  • show - Show elements, with optional transitions
  • hide - Hide elements, with optional transitions
  • toggle - Shows or hides elements based on visibility, with optional transitions
  • transition - Apply a temporary transition to elements for animations
  • dispatch - Dispatch a ViewTree event to elements

@carson-katri
Copy link
Collaborator

Core should also add a way to send a transition to use when applying a diff.

For example, the SwiftUI client could use this to wrap any element changes in a withAnimation block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parity Used to note places where LVN is trying to achieve parity with vanilla live view.
Projects
None yet
Development

No branches or pull requests

3 participants