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

Download component definition for re-use #6

Open
flip111 opened this issue Mar 1, 2019 · 3 comments
Open

Download component definition for re-use #6

flip111 opened this issue Mar 1, 2019 · 3 comments

Comments

@flip111
Copy link
Contributor

flip111 commented Mar 1, 2019

I realize this product has just been open sourced and a community has not yet formed. Anyway i'm throwing this idea out there because i think it could be interesting.

When exporting to React, Angular or another framework, first some internal representation is created from which the export can occur. Let's call this internal representation Pagedraw Model (PM). The PM could be least common denominator which the frameworks support. Maybe this idea is somewhat similar to https://github.com/andlabs/libui but then for the web.

When the PM can be extracted/downloaded. It can also be uploaded by users for other users to get the component for their framework of choice. Right now there are collections of components for particular frameworks such as for react. But they don't offer a good search function (only textual with browser search function). When there are a lot of components in the collections searching becomes more difficult. The PM could help with this. By having a definition it could be queried like "show me all the models with a single text input and a button". Making such a search would not be easy, but searching for the type of things can be done. Hoogle comes to mind when searching for types (not that i suggest that this can be used 1on1 for a component search).

It's not difficult to imagine a repository or marketplace from here if you will. I hope someone finds this idea useful. I don't have the time, means and resources to work on it at the moment. But i would like to discuss it a bit more.

@jaredp
Copy link
Contributor

jaredp commented Mar 1, 2019

Our internal model is called pdom (https://github.com/Pagedraw/pagedraw/blob/master/src/pdom.coffee)

The compiler was designed to treat all different frameworks as backends (https://github.com/Pagedraw/pagedraw/blob/master/src/core.coffee#L2361)— the engine can happily export pdom to React, Angular, Vue, or whatever else.

We actually built pretty full Angular support, but decided at the last minute that we shouldn't launch it. You can get it by toggling the angular_support config in https://github.com/Pagedraw/pagedraw/blob/master/src/config.coffee#L66

@flip111
Copy link
Contributor Author

flip111 commented Mar 1, 2019

I saw that there was a serialize function for pdom, could it be deserialized as well ?

@jaredp
Copy link
Contributor

jaredp commented Mar 1, 2019

If I recall correctly, you should ignore that serialize function. pdom is usually just json, so it doesn't need serialization / deserialization.

There's some minor exceptions

  • .backingBlock :: Block? is an object which could be serialized but really should just be ignored— it's the block that generated that specific pdom node, but once you have the pdom, there's no reason you need to carry around the source
  • .tag :: String|Component, like in JSX. It's usually the string "div", but it could be an object describing another component

For the things I could imagine wanting to do with pdom, you can just treat it as a json

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