Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Let's choose a view framework for docs, generated packages, etc. #5756

@thedaniel

Description

@thedaniel

(This is an attempt to restate #3752, explain the current position and present options)

A blessed view system for Atom

We're in an interesting place with respect to generating views in packages and core. We wrote space-pen and used it heavily, but ultimately decided to discontinue using it for new views (though some base views still use space-pen we are no longer recommending it). So now we find ourselves in an unfortunate position of using the DOM APIs directly, and suggesting package authors do the same, choose a framework themselves, or ╮(. ❛ ᴗ ❛.)╭ - Not a great place to be, and makes it hard to write docs with nice examples.

We used React in the editor component for six months or so, and it was a good experience, but it has a bit of a learning curve.

We experimented with a few things inspired by React and Polymer, and have done some research on 3rd-party view frameworks, but haven't come to a decision. As we work on better docs for the run up to 1.0, we have to start taking this seriously.

Requirements

  • Embrace modern browser features (custom elements, Object.observe, etc) as much as possible
  • It absolutely does not pollute the global namespace
  • Data-binding preferred to imperative updates if templates are used
  • View model / MVVM-style separation of rendering and logic
  • No dependencies on jQuery-like helper libs
  • Small learning curve
    • somewhat self-explanatory when used in docs examples
    • in other words, most web developers will be able to recognize the concepts that are applied without reading a book on it

Contenders / experiments

  • React
  • Etch - a library for writing HTML-based view components that provides the convenience of a virtual DOM while at the same time striving to be minimal, interoperable, and explicit - written by @nathansobo and @maxbrunsfeld
  • rivets for templating+data binding plus some basic JS object glue for Atom
  • television - "Television aims to cleanly integrate the virtual DOM approach of React.js into HTML 5 custom elements." - an experiment from @nathansobo
  • virtual-dom this library is used by television, but could be a component in a similar solution that accomplishes the above goals.
  • elmer - An experiment from @benogle based on Polymer's template binding
  • vue.js - simple, component-based, simple & small
  • Something custom, delightful & new from your friends the Atom team (but we don't reallllly want to maintain another view frameowrk)

Want to help?

One way to help speed this along is to do some experimentation with using your favorite framework in a package. See https://github.com/benogle/template-explore as an example package using https://github.com/atom/elmer.

A couple questions I would try to answer with the package:

  • How does it handle model/DOM updates? Data-binding? Imperative + virtual-dom like react?
  • How does it handle events? i.e. How do I bind a click handler to an element?
  • Can it work with Object.observe and not it's own model system?
  • Does it inject any globals?
  • How does it interact with web components, both in terms of creating new ones and using existing components written using different frameworks?

Discuss

We're interested in hearing the pros and cons of the various ways we can satisfy the items listed under requirements, recommendations for solutions we don't have listed, and questions about the reqs and how and why we arrived at them.

Also, I encourage @atom/core and maintainers to edit the Contenders section in the issue body as more come in, and let me know if I missed / misstated anything in Requirements

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions