-
Notifications
You must be signed in to change notification settings - Fork 76
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
Generic rendering backend targets #100
Conversation
This: 1. Allows other renderers to be named at the type-level, instead of disguising themselves as `Html a`. 2. Enables the generic functions to operate with alternative renderers, ie instead of `Html a`, the type is `forall target. target a`.
Pux requires a custom `render` function since it special-cases string parameters. To maintain backwards compatibility: 1. Move `render` to `Pux.Base` 2. Parameterise `start` (as `start'` to allow a custom `render` function 3. Refactor `Pux.render` as a wrapper around `Pux.Base.render` that maintains the existing behaviour
The diff makes it hard to read and the meat is in other repos you will make later. I don't see any reference to |
To make alexmingoia#100 clearer, inline the changes back into `Pux` to make for a simpler/clearer diff.
To make alexmingoia#100 clearer, inline the changes back into `Pux` to make for a simpler/clearer diff.
To make alexmingoia#100 clearer, inline the changes back into `Pux` to make for a simpler/clearer diff.
To make alexmingoia#100 clearer, inline the changes back into `Pux` to make for a simpler/clearer diff.
Ah, right. I didn't think of that. Because they are copies plus small changes, it's not really obvious what the actual change is. The core of the change is really just making the exported types more generic.
I've made a throwaway commit that pulled the changes back into The modifications to
Right, I didn't want to include those as they would then require a dependency on React Native, or react-blessed. Here's a gist that |
@bodhi I'm very interested in getting this working with RN as well. Considering how this project has been idle for the past ~3 months, I'd suggest hosting your own version while you work on the changes needed. I'd be happy to collaborate with you. |
@Qata it's actually possible to use RN with Pux in the current state, you just need to:
That said, if you want to make the RN code from my gist above into a real package, that would be cool. |
FYI the next release of Pux will be a major overhaul, and includes generic renderers (shipping with React renderer) and with purescript-smolder replacing Pux's current virtual-dom types. I haven't had much time to talk about it. Looking to release that soon, and get back to actively maintaining this library. |
@alexmingoia sounds interesting, have you started working on it? Would be nice to see it progress ;) |
I've released Pux 8 which uses purescript-smolder for markup and includes a React renderer, which you can use as a reference implementation for other virtual DOM backends. That should allow developers to implement any kind of custom rendering or caching they need. See the updated guide for more details, and https://pursuit.purescript.org/packages/purescript-pux/8.0.0/docs/Pux.Renderer.React |
As an experiment to use Pux with react-blessed and React Native, I made a few changes to make Pux more general:
forall a. target a
instead ofHtml a
. This allowed me to reuse most of Pux to implementScreen a
andNative a
as backends using the Pux architecture.This PR is mostly a proof-of-concept, and I'd be grateful for any feedback. I don't feel that it has to be merged in it's current state. Some parts are a bit odd as I tried to to maintain backwards-compatibility in
Pux
, while providing the generic functionality inPux.Base
. I haven't included the RN and Blessed backends, I'll hopefully put them online in a different repository shortly, but the code is a bit of a mess (doesn't everyone say that? 😹).