intercellular / cell

A self-driving web app framework
https://www.celljs.org
MIT License
1.51k stars 94 forks source link

Cell Native? #157

Open piranna opened 6 years ago

piranna commented 6 years ago

I know the title is misleading, but hope you got the concept ;-)

I've started working with ReactNative and I like the idea of using "abstract" components that later get real implementation for iOS, Android or web, in that latest case using DOM objects (I'm using ReactNative-everywhere, but mostly my target is web at this moment and It's using ReactNative-web for this), but I'm finding React it's still too much complex, specially with such a complex use case as mine. I like simplicity of Cell, but it's too much attached to DOM elements and nodes, so could we be able to move to use a more "abstract" tree? cell-jsx would be a good starting point, but the ideal solution would be to apply Cell to a XML file that later gets converted to DOM or whatever, so Cell components could be writting on this "high level" components and later translated to low level ones. Maybe also it's not needed to do it on the fly, simplifying the process.

Does anyone has worked and got some progress on this? Anyone is interested on moving this forward? Where could we start on this? Any ideas about how to do it?

piranna commented 6 years ago

Also, whoever says XML, it can be JSON or Javascript objects too :-P

israelroldan commented 6 years ago

@piranna While completely separate from cell, I think you may like jasonette, it follows a similar declarative principle and may be suitable for the app you're building?

piranna commented 6 years ago

@piranna While completely separate from cell, I think you may like jasonette, it follows a similar declarative principle and may be suitable for the app you're building?

Yeah, I remembered something about jasonette, that's why I said about JSON instead of XML :-) Only missing things I find on it are support for development of (responsive) web apps that can run on desktop and/or Electron, and the direct access to native mobile APIs instead of abstract and unify them :-/ The point of needing a network connection to download the JSON file has some issues too for offline support, but probably it could be configured to create standalone binaries too.

gliechtenstein commented 6 years ago

Using Cell.js with Electron

Let me first address the easiest part of your question: Electron. The answer is, there's actually nothing stopping you from building an electron app using Cell.js. In fact I'm working on one right now, a very sophisticated one, and it's working beautifully. Remember, electron is built with web browser technology so cell fits right in.

For more general purpose cell

Now let's talk about a larger question: How to make cell so that it's can function in a more general purpose manner?

For something like this to be possible we first need to extract the DOM dependency out of Cell, which is what I discussed over at https://github.com/intercellular/cell/issues/111 (Screenshot below) A lot of people threw rocks at me at that point but I'm glad that you've come to appreciate this idea.


screen shot 2017-08-09 at 5 59 07 pm

I do think it will be cool and would like to work on this but currently occupied with other tasks. If you're interested, feel free to play with the source and see if you can extract out the DOM dependency and make it work. That would be great.

On Mobile

You will learn as you get deeper into react native but it's not all magical unicorns and rainbows. React native is also guilty of "abstract and unifying" APIs internally, you just don't realize it yet since you're are likely looking at the basic stuff. Once you get into deeper level trying to utilize some unpopular native API you'll have to write a Javascript to iOS and Javascript to Android native binding libraries, which is effectively "abstract and unifying" the API.

Also, Jasonette supports offline features http://offline.jasonette.com/

piranna commented 6 years ago

For something like this to be possible we first need to extract the DOM dependency out of Cell, which is what I discussed over at #111 (Screenshot below) A lot of people threw rocks at me at that point but I'm glad that you've come to appreciate this idea.

I think the problem in that issue thread was to being too much hammerish, so people started to yield about it, but having some abstract component objects using Cell structure with custom element types, and a transpiler that convert them to DOM elements would be nice. Native environments (mobile, mainly) would be more difficult because it would be needed to create a runtime that use the native APIs... don't know if there's already a npm module that allow access to the iOS and Android native graphic and components APIs :-/ But doing an initial implementation for the web similar to react-native-web would be easy.